rollup-plugin-peggy
v6.0.0
Published
Import PEG.js grammars as parsers directly in your code via Peggy, the PEG.js successor
Downloads
19
Readme
rollup-plugin-peggy
Copyright (c) 2016 Cameron Hunter
Copyright (c) 2022-2023 Caleb Evans
Released under the MIT license
A rollup plugin allowing you to import PEG.js grammars as parsers directly in your code via Peggy, the PEG.js successor. This project is a fork of rollup-plugin-pegjs, since PEG.js has been abandoned in favor of Peggy.
import { parse } from 'grammar.pegjs';
console.log(parse('language to parse'));
Install
This plugin is compatible with Rollup 2 and 3, as well as Vite 3 and 4. To use it with either, simply install it via the command below.
The peggy
package is also required as a peer dependency. You may install any
version as old as 1.2.0, through version 3.x.
npm install --save-dev peggy
npm install --save-dev rollup-plugin-peggy
Usage
// rollup.config.mjs
import { rollup } from 'rollup';
import peggy from 'rollup-plugin-peggy';
export default {
input: 'main.js',
plugins: [peggy()]
});
You can also pass any of the documented Peggy JavaScript API options.
peggy({ cache: true });