https://github.com/browserify/browser-pack
pack node-style source files from a json stream into a browser bundle
https://github.com/browserify/browser-pack
Last synced: about 2 months ago
JSON representation
pack node-style source files from a json stream into a browser bundle
- Host: GitHub
- URL: https://github.com/browserify/browser-pack
- Owner: browserify
- License: other
- Created: 2013-02-11T08:43:17.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2021-02-28T14:45:27.000Z (almost 5 years ago)
- Last Synced: 2024-05-21T13:14:54.108Z (over 1 year ago)
- Language: JavaScript
- Size: 103 KB
- Stars: 173
- Watchers: 15
- Forks: 58
- Open Issues: 15
-
Metadata Files:
- Readme: readme.markdown
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# browser-pack
pack node-style source files from a json stream into a browser bundle
[](http://travis-ci.org/browserify/browser-pack)
# example
json input:
``` json
[
{
"id": "a1b5af78",
"source": "console.log(require('./foo')(5))",
"deps": { "./foo": "b8f69fa5" },
"entry": true
},
{
"id": "b8f69fa5",
"source": "module.exports = function (n) { return n * 111 }",
"deps": {}
}
]
```
bundle script:
``` js
var pack = require('browser-pack')();
process.stdin.pipe(pack).pipe(process.stdout);
process.stdin.resume();
```
output:
```
$ browser-pack < input.json
(function(p,c,e){function r(n){if(!c[n]){c[n]={exports:{}};p[n][0](function(x){return r(p[n][1][x])},c[n],c[n].exports);}return c[n].exports}for(var i=0;i