jsfuse
Simple CommonJS-based JavaScript distribution builder.
Last updated 6 years ago by rstacruz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jsfuse 
SYNC missed versions from official npm registry.

Jsfuse

Simple CommonJS-based JavaScript distribution builder.

Replaces require('...') with the files they require. This makes it easy to create distributions for frontend packages. It's like browserify or webpack, only it produces smaller files and doesn't support circular dependencies.

$ npm install -g jsfuse
$ jsfuse your_file.js

Example

// index.js
alert(require('./foo'));

// foo.js
module.exports = "Hello";

Then run:

jsfuse index.js

This will replace require('./foo') with the exports of foo.js, which yields something to the effect of:

alert((function(){
 var module={exports:{}},exports=module.exports;
 (function(){ module.exports = "Hello"; })();
 return module.exports;
}()));

Which is functionally-equivalent to: (and in fact will compile down to via closure compiler)

alert("Hello");

Why?

It's great for making frontend libraries, which usually are distributed as a single .js file. When using browserify to build the final file, you'll get an entire working CommonJS loader embedded into it, which may be unnecessary bloat.

Jsfuse allows you to bake smaller files by assuming some limitations:

  • circular dependencies are not allowed.
  • requiring a dependency more than once will bloat up your file size.
  • doesn't support node_modules.

Thanks

Jsfuse © 2014, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors.

ricostacruz.com  ·  GitHub @rstacruz  ·  Twitter @rstacruz

Status npm version

Current Tags

  • 0.9.12                                ...           latest (6 years ago)

4 Versions

  • 0.9.12                                ...           6 years ago
  • 0.9.11                                ...           6 years ago
  • 0.9.10                                ...           6 years ago
  • 0.9.9                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |