npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pegify

v1.0.1

Published

Pegjs browserify transform that just works.

Readme

Pegify Build Status

A configurable Browserify transform for PegJS that just works.

Installation

npm install pegify pegjs --save-dev

NOTE: PegJS is not bundled with the transform and must be installed along with Pegify if is not already included in your project. This allows you to select the version of PegJS that works with your project.

Usage

Command Line

Command line usage is as you would expect, just apply it as a transform.

browserify -t pegify myfile.js

Middleware

Here is an example of Pegify being used as Browserify middleware

var bundler = browserify()
  .transform(pegify())
  .add('myfile.js');

After everything is all setup, you are able to require PegJS files.

var parser = require('./path/to/file.pegjs');

parser.parse(/* your langage */);

Configuration

All options provided to Pegify will be sent directly to PegJS. Meaning all options supported by PegJS are automatically supported by Pegify. There is one exception, output is permanently set to source. Along with the standard options provided by PegJS, Pegify itself can be configured.

To set Pegify options, just pass in an options object when the transform is being initialized.

pegify({
    export: 'window.parser',
    extensions: ['.pgjs']
});

All Pegify options can also be included in a .pegifyrc as json.

output = 'source'

This option is locked, and cannot be modified.

export = 'module.exports'

Defines variable that the compiled parser should be exported to. The default is set to commonjs module.export so that it can be injected as a module.

extensions = ['.peg', '.pegjs']

Extensions that Pegify should work on.

Gulp Usage

Pegify will drop in directly into any Browserify build pipeline. Below is just one implementations.

var browserify = require('browserify'),
    gulp = require('gulp'),
    pegify = require('pegify'),
    source = require('vinyl-source-stream');

gulp.task('js', function () {
  var bundler = browserify()
    .add('./main.js')
    .transform(pegify({
      optimize: 'size'
    }));

  return bundler
    .bundle()
    .pipe(source('main.js'))
    .pipe(gulp.dest('./bin'));
});

You may notice that vinyl-source-stream is included after the bundler.bundle. This is due to the differences between Browserify streams and Gulp/Vinyl streams. Browserify streams a bundle as text, while Gulp uses Vinyl streams. This is where vinyl-source-stream comes in, it will convert a text stream into a vinyl stream. Depending on down stream pipes, other stream manipulation may be needed such as buffering.

License

MIT