bun-nearley-loader
v1.0.2
Published
A Bun plugin for loading Nearley grammar files
Readme
Bun Nearley loader
This plugin allows you to import .ne files in your Bun project like so:
import nearley from "nearley";
import grammar from "./grammar.ne";
const parser = new nearley.Parser(nearley.Grammar.fromCompiled(grammar));Install
bun add -d bun-nearley-loader
Usage
Add this to your bunfig.toml
preload = ["bun-nearley-loader"]Or use JS build API
import nearleyLoader from "bun-nearley-loader";
await Bun.build({
entrypoints: ["index.ts"],
plugins: [nearleyLoader],
});