Registry / serialization / babel-plugin-pegjs-inline-precompile

babel-plugin-pegjs-inline-precompile

JSON →
library0.1.1jsnpmunverified

Babel plugin that precompiles inline PEG.js grammar expressions at build time. Version 0.1.1, limited release cadence. Replaces runtime parsing with a compile-time step using a tagged template literal `peg`, requiring the complementary `pegjs-inline-precompile` runtime helper. Differentiates from other PEG.js integrations by minimizing runtime overhead and bundling size.

npm install babel-plugin-pegjs-inline-precompile
INSTALL
IMPORT
SIG · BABEL-PLUGIN-PEGJS
B
babel-plugin-pegjs-inline-precompile
serializationjavascriptv0.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

peg
import peg from 'pegjs-inline-precompile';
import { peg } from 'pegjs-inline-precompile';
Default export, not a named export.
peg
const peg = require('pegjs-inline-precompile');
const { peg } = require('pegjs-inline-precompile');
CommonJS require returns the default as the module exports object.
plugin
// .babelrc { "plugins": ["babel-plugin-pegjs-inline-precompile"] }
{ "plugins": ["pegjs-inline-precompile"] }
Plugin name must be the full package name; omitting 'babel-plugin-' prefix is a common mistake.

Shows installation, Babel configuration, and usage of the peg tagged template literal for inline PEG.js grammar precompilation.

// Install dependencies // npm install babel-plugin-pegjs-inline-precompile pegjs pegjs-inline-precompile // .babelrc { "plugins": ["babel-plugin-pegjs-inline-precompile"] } // source.js import peg from 'pegjs-inline-precompile'; const parser = peg` // Grammar Expression = Term ("+" Term)* Term = Number ("*" Number)* Number = [0-9]+ `; export default function evaluate(input) { return parser.parse(input); }
Debug
Known issues
gotchaThe plugin requires the 'pegjs-inline-precompile' runtime package to be installed; otherwise, the `peg` import will fail.
fix
Ensure 'pegjs-inline-precompile' is in your dependencies, not just devDependencies.
affects: >=0.1.0
gotchaThe plugin itself does not include PEG.js; you must install 'pegjs' separately if you need the PEG.js runtime for dynamic grammar compilation.
fix
Install 'pegjs' as a dependency if you plan to use PEG.js outside of the precompilation context.
affects: >=0.1.0
gotchaThe plugin only processes tagged template literals with the exact identifier name 'peg'; custom names will not be precompiled.
fix
Always use `peg` as the tag function name in your source code.
affects: >=0.1.0
Errors
Common errors & fixes
Module not found: Can't resolve 'pegjs-inline-precompile'
Missing runtime package dependency.
fix
Run 'npm install pegjs-inline-precompile' and add to dependencies.
Error: The 'pegjs-inline-precompile' plugin requires a matching runtime package, but it is not loaded.
Babel plugin unable to locate the runtime module.
fix
Install 'pegjs-inline-precompile' and ensure it is resolvable in node_modules.
ReferenceError: peg is not defined
Missing import of 'peg' from 'pegjs-inline-precompile'.
fix
Add 'import peg from 'pegjs-inline-precompile';' at top of file.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
pegjsoptionalPEG.js dependency for grammar parsing and code generation
pegjs-inline-precompileoptionalRuntime helper required for the `peg` tagged template literal
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
babel-plugin-pegjs-inline-precompile — npm install babel-plugin-pegjs-inline-precompile · libregistry