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 🙏

© 2024 – Pkg Stats / Ryan Hefner

eggroll

v0.0.4

Published

Common.js bundler that hoists all modules into a single scope.

Downloads

4

Readme

eggroll

Commonjs module bundler that hoists all modules into a single scope so they can be concatenated safely without wrapping them in individual function scopes.

This allows the resulting package to be minified more efficiently and minimizes the extra overhead at runtime from evaluating these modules. See: https://nolanlawson.com/2016/08/15/the-cost-of-small-modules/

How this works

We implement the ideas described in http://www.nonblocking.io/2011/12/experimental-support-for-common-js-and.html that have been implemented in Google's closure compiler.

  1. All local variables are prefixed with a module specific prefix so they don't collide with local variables in other modules when added to the same scope.
  2. module.exports and exports.* are replaced with a module specific global that other modules then reference directly.
  3. require calls are replace with the respective module specific globals.

Running eggroll on the rollup-comparison: with output: https://gist.github.com/ymichael/91ef54ca7c756530635285cf8eb41d6e (318 bytes gzipped).

Installation

npm install -g eggroll

Quick Start

# Outputs a bundle using main.js as the entry point.
$ eggroll bundle --resolve main.js

# Outputs a bundle using public/main.js as the entry point.
$ eggroll bundle --resolve --root ./public ./public/main.js

# Outputs a bundle containing just the given files
$ eggroll bundle --root ./public ./public/foo.js ./public/bar.js

Usage

Usage: eggroll <command> [options]

Commands:
  deps [options]               Output the dependencies found for the given entry
                               point
  bundle [options] <files...>  Bundle the given files

Options:
  -h, --help  Show help                                                [boolean]
$ eggroll bundle -h
bin/cli.js bundle [options] <files...>

Options:
  -h, --help  Show help                                                [boolean]
  --prefix    custom prefix for module variables[string] [default: "$$module$$"]
  --resolve   whether to resolve dependencies         [boolean] [default: false]
  --root      root to resolve module ids
                                             [string] [default: "process.cwd()"]
$ eggroll deps [options]

Options:
  -h, --help  Show help                                                [boolean]
  --entry     module id of bundle entry point                [string] [required]
  --root      root to resolve module ids
                                             [string] [default: "process.cwd()"]

API Example

var eggroll = require('eggroll');
// TODO

Other links

  • Original idea: http://www.nonblocking.io/2011/12/experimental-support-for-common-js-and.html
  • Motivation: https://nolanlawson.com/2016/08/15/the-cost-of-small-modules/
  • Initial prototype: https://runkit.com/ymichael/58b1076665aeab00137caeb3
  • https://en.wikipedia.org/wiki/Egg_roll