Skip to content

About

Oxc Playground

Resources

Security policy

Stars

74 stars

Watchers

4 watching

Forks

Repository files navigation

Oxc Playground

playground.oxc.rs

Development

Assuming the oxc repository is in ../oxc:

  • in a different terminal and in the oxc repository:
    • just install-wasm
    • just watch-playground
  • in this repo: pnpm run dev

Running output

Run output in the Printed tab executes the generated JavaScript in a sandboxed iframe and shows its console output. Stop removes the iframe and its timers; editing the output stops the run. The previous result stays visible during a new run and is replaced when that run finishes, fails, or is stopped, with up to 500 entries per console. Pending promises are not tracked, and a blocking loop cannot be interrupted.

The executed copy carries an inline source map, so devtools map back to the original source; the printed output is unchanged. Scripts run as scripts and ES modules as modules.

Source type in Parser defaults to Module, so runtime helpers use ESM imports even when the input has no import/export declarations. The binding uses the same sourceType values as oxc-parser: module, script, commonjs, and unambiguous. Script and CommonJS use require() for helpers; CommonJS also permits constructs such as top-level return. Unambiguous detects module syntax regardless of the extension. Source type overrides the module kind implied by the extension while preserving its language and JSX syntax. The choice is saved in the share URL. Older URLs with saved options but no source-type setting are mapped to an equivalent explicit mode: mjs/mts use Module, cjs/cts use CommonJS, and other supported extensions use Unambiguous.

Runtime helpers in Transformer selects npm package paths (the default) or versioned esm.sh URLs matching the sibling Oxc checkout, and the choice is saved in the share URL. To run helper-using output, use Source type → Module and Runtime helpers → esm.sh. The sandbox uses the browser's native module loader; bare npm imports, require(), and Node.js APIs are unavailable. Execution errors appear in the console. Enable the Transformer first to run TypeScript or JSX.

Compare runs the same input through an esnext baseline with TypeScript/JSX lowering enabled and minification, define/inject replacements, and optional transforms disabled. It executes the baseline and current output in separate sandboxes with their own console and status, and clicking it again recompares. Run output executes the output alone and returns to the single console. Stop, Clear console, and collapse/expand apply to what is shown. The selected mode is saved in the share URL.

Our sponsors

About

Oxc Playground

Resources

Security policy

Stars

74 stars

Watchers

4 watching

Forks

Sponsor this project

Used by

Contributors

Languages