rollup-plugin-peggy
TypeScript icon, indicating that this package has built-in type declarations

6.0.0 • Public • Published

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 });

/rollup-plugin-peggy/

    Package Sidebar

    Install

    npm i rollup-plugin-peggy

    Weekly Downloads

    17

    Version

    6.0.0

    License

    MIT

    Unpacked Size

    338 kB

    Total Files

    18

    Last publish

    Collaborators

    • caleb531