0.9.2 • Published 1 year ago

pomsky-wasm v0.9.2

Weekly downloads
-
License
MIT OR Apache-2.0
Repository
github
Last release
1 year ago

pomsky-wasm

Node.js/WASM module of pomsky.

Usage

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.

With vite

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'],
+   },
  }))

License

Dual-licensed under the MIT license or the Apache 2.0 license.