@boshen_c: Published Oxc packages that run on Cloudflare Workers using the wasm32-wasip1 target. Demo:

X AI KOLs Timeline Tools

Summary

Oxc packages now run on Cloudflare Workers using the wasm32-wasip1 target, with live demos and deployment instructions.

Published Oxc packages that run on Cloudflare Workers using the wasm32-wasip1 target. Demo: https://t.co/WGbxnrjS9F
Original Article
View Cached Full Text

Cached at: 08/10/26, 05:26 AM

Published Oxc packages that run on Cloudflare Workers using the wasm32-wasip1 target.

Demo: https://t.co/WGbxnrjS9F


Boshen/oxc-wasip1-workers

Source: https://github.com/Boshen/oxc-wasip1-workers

Oxc WASI bindings on Cloudflare Workers

Runnable Cloudflare Workers demos for Oxc’s threadless wasm32-wasip1 N-API bindings:

  • @oxc-parser/binding-wasm32-wasip1
  • @oxc-minify/binding-wasm32-wasip1
  • @oxc-transform/binding-wasm32-wasip1
  • @oxc-transform-react/binding-wasm32-wasip1

Each Worker imports a precompiled WebAssembly module and instantiates the N-API binding inside its request handler, where Cloudflare permits WASI initialization.

Live demos

curl -fsS https://oxc-wasip1-parser-yx3a4w.boshenc.workers.dev/
curl -fsS https://oxc-wasip1-minify-yx3a4w.boshenc.workers.dev/
curl -fsS https://oxc-wasip1-transform-yx3a4w.boshenc.workers.dev/
curl -fsS https://oxc-wasip1-transform-react-yx3a4w.boshenc.workers.dev/

Every endpoint returns JSON containing "ok": true, its package version, and package-specific output.

Run locally against Cloudflare’s remote runtime

Install dependencies:

npm ci

Start any demo through Wrangler’s remote preview:

npm run dev:parser
npm run dev:minify
npm run dev:transform
npm run dev:transform-react

Run the bundle checks and verify the deployed endpoints:

npm run check
npm run test:remote

Deploy

Authenticate Wrangler, then deploy one or all Workers:

npx wrangler login
npm run deploy:parser
npm run deploy:all

The four Workers are kept separate so every compressed bundle remains comfortably below Cloudflare’s Worker size limits.

To remove them:

npx wrangler delete --name oxc-wasip1-parser-yx3a4w --force
npx wrangler delete --name oxc-wasip1-minify-yx3a4w --force
npx wrangler delete --name oxc-wasip1-transform-yx3a4w --force
npx wrangler delete --name oxc-wasip1-transform-react-yx3a4w --force

Integration details

Use the .wasm-suffixed package export so Wrangler classifies the import as a compiled WebAssembly module:

import parserWasm from "@oxc-parser/binding-wasm32-wasip1/wasm.wasm";
import { instantiate } from "@oxc-parser/binding-wasm32-wasip1/workerd";

Start instantiation inside fetch(), not at module scope. The demos cache the resulting promise so warm requests reuse the same binding:

let bindingPromise;

function getBinding() {
  bindingPromise ??= instantiate(parserWasm);
  return bindingPromise;
}

The low-level parser binding returns serialized AST data through result.program. Decode it with JSON.parse(result.program).node, as shown in src/parser.js.

Project layout

  • src/parser.js parses TypeScript and inspects its AST.
  • src/minify.js minifies JavaScript.
  • src/transform.js removes TypeScript syntax.
  • src/transform-react.js runs the React Compiler and JSX transform.
  • scripts/test-remote.mjs checks all live endpoints.

License

MIT

This demo was created with AI assistance and reviewed through live Cloudflare Worker execution.

Similar Articles

Workers Cache

Hacker News Top

Cloudflare launches Workers Cache, a tiered cache that sits in front of Workers, allowing cached responses to be served without invoking the Worker, reducing CPU time and improving performance.

cloudflare/computer

GitHub Trending (daily)

Cloudflare Computer is a preview virtual filesystem built on Durable Objects, with pluggable runtimes for containers, shell, and JavaScript, enabling stateful serverless compute on Cloudflare Workers.

Firefox in WebAssembly

Simon Willison's Blog

Puter compiled Firefox to WebAssembly, enabling it to run inside another browser via a WebSocket proxy using the Wisp protocol. The demo, estimated to cost $25,000 in AI tokens, features end-to-end encryption and a public repository.