Git Product home page Git Product logo

packd__browserify_as_saas_service's Introduction

packd

Rollup as a service (with a little help from Browserify).

This is a simple app for generating UMD bundles of npm packages, similar to browserify-cdn aka wzrd.in. I made it because wzrd.in sometimes goes offline, and I need its functionality for the Svelte REPL. Unfortunately I couldn't get browserify-cdn to run on now.sh, so I decided to roll my own.

And since I was rolling my own, it made sense to use Rollup. (Feel free to roll your eyes.) For npm packages that expose pkg.module, such as the D3 modules, this means you get smaller, more efficient bundles than with browserify-cdn. packd also gzips the files it serves, typically resulting in much smaller requests.

Since Rollup can't handle all of the CommonJS code on npm, packd will use Browserify (or a combination of Rollup and Browserify) where appropriate.

Using packd

You can try a hosted version of packd at https://packd.now.sh. This is not designed with production use in mind! Please host your own instance if you want to use packd for your own apps.

Bundles can be accessed like so. Bear in mind that if a bundle isn't cached, it needs to be installed and built before it can be served, which may take a little while:

/bundle/[name]

You can specify a tag (e.g. 'latest') or a version (e.g. '1.2.3'):

/bundle/[name]@latest

If you're using these URLs with <script> tags, you may need to specify the module's name (i.e. the global variable name used to access it, corresponding to moduleName in Rollup and standalone in Browserify). packd will guess based on the module ID, but you may need to control it with the name query:

/bundle/underscore?name=_

Hosting an instance

packd is a straightforward Express app — clone this repo, npm install (or yarn install), then npm start. To host on now, simply npm install -g now and run now.

Is this like unpkg.com?

No. unpkg.com is like a CDN for npm — it serves the actual files in npm packages. In a lot of cases that's perfect, but since some library authors don't include distributable bundles (tsk, tsk) it's not a general solution to the problem that packd addresses. Moreover, many npm package authors don't minify their code, whereas packd does.

It is, however, blazing fast and extremely reliable. If a distributable version of a dependency is on unpkg, you should always prefer that.

Credits

Thanks to James Halliday and Joshua Holbrook for their work on Browserify and browserify-cdn, and Zeit for making such an easy to use hosting environment.

License

MIT

packd__browserify_as_saas_service's People

Contributors

rich-harris avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.