npm.io
0.12.2 • Published 10 months ago

@pomsky-lang/compiler-web

Licence
MIT OR Apache-2.0
Version
0.12.2
Deps
0
Size
280 kB
Vulns
0
Weekly
0
Stars
1.4K

Pomsky WASM module for web

WASM module of Pomsky.

Usage

import { compile } from '@pomsky-lang/compiler-web'

const { output, diagnostics } = compile(`^ C* '.' C* 

Pomsky WASM module for web

WASM module of Pomsky.

Usage

, '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* 

Pomsky WASM module for web

WASM module of Pomsky.

Usage

import { compile } from '@pomsky-lang/compiler-web'

const { output, diagnostics } = compile(`^ C* '.' C* 

Pomsky WASM module for web

WASM module of Pomsky.

Usage

, 'js')

If this doesn't work with your bundler, try initializing the module explicitly:

, '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.