A PEG.js transformer for Parcel 2.
Run:
npm install parcel-transformer-pegjs
Add to .parcelrc
:
{
//...
"transformers": {
"*.pegjs": ["parcel-transformer-pegjs"]
}
}
Usage:
import { parse } from "./grammar.pegjs"
Here's a simple hack for using this in a TypeScript project:
// grammar.js
export { parse } from "./grammar.pegjs";
// grammar.d.ts
export function parse(s: string): OutputType;
// caller.ts
import {parse} from "./grammar"