# @pomsky-lang/compiler-web

> A portable, modern regular expression language

Latest version **0.12.2** (published 2025-11-16) · MIT OR Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @pomsky-lang/compiler-web
pnpm add @pomsky-lang/compiler-web
yarn add @pomsky-lang/compiler-web
bun add @pomsky-lang/compiler-web
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.12.2 |
| Published | 2025-11-16 |
| First published | 2023-03-21 |
| Weekly downloads | 0 |
| License | MIT OR Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 279.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1352 |
| Maintainers | aloso, kyza |

## Links

- npm: https://www.npmjs.com/package/@pomsky-lang/compiler-web
- Repository: https://github.com/pomsky-lang/pomsky
- Homepage: https://pomsky-lang.org
- Issues: https://github.com/pomsky-lang/pomsky/issues
- npm.io page: https://npm.io/package/@pomsky-lang/compiler-web

## Recent versions

- 0.12.2 (latest) — 2025-11-16
- 0.12.0 — 2025-11-08
- 0.11.0 — 2023-11-09
- 0.10.1 — 2023-03-21
- 0.10.0 — 2023-03-21

## README

# Pomsky WASM module for web

WASM module of [Pomsky](https://pomsky-lang.org).

## Usage

```js
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:

```js
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:

```diff
  import { defineConfig } from 'vite'

  export default defineConfig(({ mode }) => ({
+   optimizeDeps: {
+     exclude: mode === 'production' ? [] : ['@pomsky-lang/compiler-web'],
+   },
  }))
```

## License

Dual-licensed under the [MIT license][mit-license] or the [Apache 2.0 license][apache-2-license].

[mit-license]: https://opensource.org/licenses/MIT
[apache-2-license]: https://opensource.org/licenses/Apache-2.0

---
_Source: https://npm.io/package/@pomsky-lang/compiler-web · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
