Node.js/WASM module of pomsky.
import { compile } from 'pomsky-wasm'
const { output, diagnostics } = compile(`^ C* '.' C* $`, 'js')
If this doesn't work with your bundler, try initializing the module explicitly:
import init, { compile } from 'pomsky-wasm'
await init()
const { output, diagnostics } = compile(`^ C* '.' C* $`, 'js')
Don't forget to check if output === null
, which means that compilation failed, and you have to look at the diagnostics. Even when the expression compiled successfully, diagnostics
may contain useful warnings.
If you're using vite, you also need to update your vite config like this:
import { defineConfig } from 'vite'
export default defineConfig(({ mode }) => ({
+ optimizeDeps: {
+ exclude: mode === 'production' ? [] : ['pomsky-wasm'],
+ },
}))
Dual-licensed under the MIT license or the Apache 2.0 license.