JSPM

  • Created
  • Published
  • Downloads 574285
  • Score
    100M100P100Q232311F
  • License MIT

Oxc Parser Node API

Package Exports

  • oxc-parser
  • oxc-parser/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (oxc-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

The JavaScript Oxidation Compiler

See index.d.ts for parseSync and parseAsync API.

TypeScript typings for the AST is currently work in progress.

cjs

const oxc = require("oxc-parser");
const assert = require('assert');

function test(ret) {
  const program = JSON.parse(ret.program);
  assert(program.body.length == 1);
  assert(ret.errors.length == 0);
}

test(oxc.parseSync("foo"));

async function main() {
  test(await oxc.parseAsync("foo"));
}

main()

ESM

import oxc from 'oxc-parser';
import assert from 'assert';

function test(ret) {
  const program = JSON.parse(ret.program);
  assert(program.body.length == 1);
  assert(ret.errors.length == 0);
}

test(oxc.parseSync("foo"));

async function main() {
  test(await oxc.parseAsync("foo"));
}

main()