New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

esbuild-plugin-peg

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-peg

> This plugin lets you import [PEGjs](https://pegjs.org/) and [Peggy](https://peggyjs.org/) files when bundling with [Esbuild](https://esbuild.github.io/)

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

esbuild-plugin-peg

This plugin lets you import PEGjs and Peggy files when bundling with Esbuild

Installation

npm install --save-dev esbuild-plugin-peg

or

bun add -D esbuild-plugin-peg

Getting Started

my.peggy

start = a:[0-9] "+" b:[0-9] { return a + b; }

main.js

import * as parser from './my.peggy'

console.log(parser.parse("1+2"))

build.js

const peg = require('esbuild-plugin-peg');

require('esbuild').build({
  entryPoints: ['main.js'],
  bundle: true,
  outfile: 'out.js',
  plugins: [peg()],
});

If you are using bun, you can activate the plugin as follows:

peg-loader.ts

import { plugin } from 'bun'
import peg from 'esbuild-plugin-peg/bun'

await plugin(peg())

You can then activate the loader per default in your project via

bunfig.toml

preload = "./peg-loader.ts"

Configuration

An object containing configuration options may be passed into the plugin constructor peg

peg({
  bare: true,
});

See Peggy API Documentation for available configuration options.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Package last updated on 28 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts