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

enchilada

v0.13.0

Published

middleware for automatic javascript bundles

Downloads

26

Readme

enchilada Build Status

serve up your javascript files all wrapped up using browserify. Yum!

with express/connect

var app = express();

// serves up all your javascript files, handling all require() calls
app.use(enchilada(__dirname + '/public'));

// fallback for other static resources
app.use(express.static(__dirname + '/public'));

Now just visit any .js url which maps to a path under /public and the packaged file will be served.

sourcemaps

Versions 0.7+ of enchilada do not bundle sourcemaps with your javascript files; instead sourceMapURL comment is used. This allows for specifying both the compress and debug options as true in production without impacting users but still benefiting from being able to obtain sourcemaps. Care should be taken to limit access to the mapfiles (served via the /path/to/original/js/script.map.json) usually with middleware before enchilada.

options

No one likes a stale enchilada. Out in the real world, you want to leverage browser caching for rarely changing files. Imagine that your project uses files like jquery or engine.io, these files don't change as much as your app code. It would be silly to keep sending them with every js file you serve up. Enchilada makes this easy to do.

Just add the proper ingredients and your enchilada will be served up as you requested.

app.use(enchilada({
    src: __dirname + '/public', // location of your js files
    cache: true || false, // default false (use true for production to disable file watching)
    compress: true || false || { uglify options }, // default false
    debug: true || false, // default false (enable sourcemap output with bundle)
    watchCallback: function(err, filename) {}, // optional (use to do something clever, like tell client to reload the page)
    routes: {
        // key is the url route, value is either a file relative to src
        '/js/jquery.js': './js/jquery.js',
        // or a module installed via npm
        '/js/engine.io.js': 'engine.io-client'
    },
    transforms: [ handleify, brfs ]
}));

Now just make sure you load the required scripts before any other js file that might use them.

<!-- load the scripts we know will be used by several files -->
<script src="/js/jquery.js"></script>
<script src="/js/engine.io.js"></script>

<!-- load other js files as you would before -->
<script src="/js/app.js"></script>

examples

See the examples directory for working code you can copy and paste.

install

Install with npm

npm install enchilada