0.11.0 • Published 6 months ago
@pomsky-lang/compiler-web v0.11.0
Pomsky WASM module for web
WASM module of Pomsky.
Usage
import { compile } from '@pomsky-lang/compiler-web'
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-lang/compiler-web'
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-lang/compiler-web'],
+ },
}))
License
Dual-licensed under the MIT license or the Apache 2.0 license.