{
"name": "browserify",
"version": "2.14.1",
"description": "browser-side require() the node way",
"main": "index.js",
"bin": {
"browserify": "bin/cmd.js"
},
"repository": {
"type": "git",
"url": "http://github.com/substack/node-browserify.git"
},
"keywords": [
"browser",
"require",
"commonjs",
"commonj-esque",
"bundle",
"npm",
"javascript"
],
"dependencies": {
"module-deps": "~0.8.0",
"browser-pack": "~0.8.0",
"shell-quote": "~0.0.1",
"through": "~2.2.0",
"duplexer": "~0.0.2",
"concat-stream": "~0.1.1",
"insert-module-globals": "~0.2.0",
"syntax-error": "~0.0.0",
"browser-resolve": "~0.1.1",
"inherits": "~1.0.0",
"optimist": "~0.3.5",
"JSONStream": "~0.4.3",
"umd": "~1.1.0"
},
"devDependencies": {
"tap": "~0.4.0",
"mkdirp": "~0.3.3",
"backbone": "~0.9.2",
"dnode": "~1.0.3",
"seq": "0.3.3",
"coffee-script": "~1.5.0"
},
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"scripts": {
"test": "tap test/*.js"
},
"license": "MIT",
"readme": "# browserify\n\n`require('modules')` in the browser\n\nUse a [node](http://nodejs.org)-style `require()` to organize your browser code\nand load modules installed by [npm](https://npmjs.org).\n\nbrowserify will recursively analyze all the `require()` calls in your app in\norder to build a bundle you can serve up to the browser in a single `` into your\nhtml!\n\n## external requires\n\nYou can just as easily create bundle that will export a `require()` function so\nyou can `require()` modules from another script tag. Here we'll create a\n`bundle.js` with the [through](https://npmjs.org/package/through)\nand [duplexer](https://npmjs.org/package/duplexer) modules.\n\n```\n$ browserify -r through -r duplexer > bundle.js\n```\n\nThen in your page you can do:\n\n``` js\n\n\n```\n\n## multiple bundles\n\nIf browserify finds a `require` function already defined in the page scope, it\nwill fall back to that function if it didn't find any matches in its own set of\nbundled modules.\n\nIn this way you can use browserify to split up bundles among multiple pages to\nget the benefit of caching for shared, infrequently-changing modules, while\nstill being able to use `require()`. Just use a combination of `--external` and\n`--require` to factor out common dependencies.\n\nFor example, if a website with 2 pages, `beep.js`:\n\n``` js\nvar robot = require('./robot');\nconsole.log(robot('beep'));\n```\n\nand `boop.js`:\n\n``` js\nvar robot = require('./robot');\nconsole.log(robot('boop'));\n```\n\nboth depend on `robot.js`:\n\n``` js\nmodule.exports = function (s) { return s.toUpperCase() + '!' };\n```\n\n```\n$ browserify -r ./robot > static/common.js\n$ browserify -x ./robot.js beep.js > static/beep.js\n$ browserify -x ./robot.js boop.js > static/boop.js\n```\n\nThen on the beep page you can have:\n\n``` html\n\n\n```\n\nwhile the boop page can have:\n\n``` html\n\n\n```\n\n## api example\n\nYou can use the API directly too:\n\n``` js\nvar browserify = require('browserify');\nvar b = browserify();\nb.add('./browser/main.js');\nb.bundle().pipe(process.stdout);\n```\n\n# usage\n\n```\nUsage: browserify [entry files] {OPTIONS}\n\nStandard Options:\n\n --outfile, -o Write the browserify bundle to this file.\n If unspecified, browserify prints to stdout.\n\n --require, -r A module name or file to bundle.require()\n Optionally use a colon separator to set the target.\n\n --entry, -e An entry point of your app\n \n --ignore, -i Omit a file from the output bundle.\n\n --external, -x Reference a file from another bundle.\n \n --transform, -t Use a transform module on top-level files.\n \n --command, -c Use a transform command on top-level files.\n \n --standalone -s Generate a UMD bundle for the supplied export name.\n This bundle works with other module systems and sets the name\n given as a window global if no module system is found.\n \n --debug -d Enable source maps that allow you to debug your files\n separately.\n\n --help, -h Show this message\n\nFor advanced options, type `browserify help advanced`.\n\nSpecify a parameter.\n```\n\n```\nAdvanced Options:\n\n --insert-globals, --ig, --fast [default: false]\n\n Skip detection and always insert definitions for process, global,\n __filename, and __dirname.\n \n benefit: faster builds\n cost: extra bytes\n \n --detect-globals, --dg [default: true]\n\n Detect the presence of process, global, __filename, and __dirname and define\n these values when present.\n\n benefit: npm modules more likely to work\n cost: slower builds\n\n --ignore-missing, --im [default: false]\n\n Ignore `require()` statements that don't resolve to anything.\n\n --noparse=FILE\n\n Don't parse FILE at all. This will make bundling much, much faster for giant\n libs like jquery or threejs.\n\n --deps\n \n Instead of standard bundle output, print the dependency array generated by\n module-deps.\n\n --list\n \n Print each file in the dependency graph. Useful for makefiles.\n\n```\n\n# compatibility\n\nMany [npm](http://npmjs.org) modules that don't do IO will just work after being\nbrowserified. Others take more work.\n\nMany node built-in modules have been wrapped to work in the browser, but only\nwhen you explicitly `require()` or use their functionality.\n\nWhen you `require()` any of these modules, you will get a browser-specific shim:\n\n* events\n* stream\n* path\n* assert\n* url\n* util\n* querystring\n* buffer\n* buffer_ieee754\n* console\n* [vm](https://github.com/substack/vm-browserify)\n* [http](https://github.com/substack/http-browserify)\n* [crypto](https://github.com/dominictarr/crypto-browserify)\n* [zlib](https://github.com/brianloveswords/zlib-browserify)\n\nAdditionally if you use any of these variables, they\n[will be defined](https://github.com/substack/insert-module-globals)\nin the bundled output in a browser-appropriate way:\n\n* [process](https://github.com/shtylman/node-process)\n* [Buffer](https://github.com/toots/buffer-browserify)\n* global - top-level scope object (window)\n* __filename - file path of the currently executing file\n* __dirname - directory path of the currently executing file\n\n# methods\n\n``` js\nvar browserify = require('browserify')\n```\n\n## var b = browserify(files=[] or opts={})\n\nCreate a browserify instance `b` from the entry main `files` or `opts.files`.\n`files` can be an array of files or a single file.\n\nYou can also specify an `opts.noParse` array which will skip all require() and\nglobal parsing for each file in the array. Use this for giant libs like jquery\nor threejs that don't have any requires or node-style globals but take forever\nto parse.\n\n## b.add(file)\n\nAdd an entry file from `file` that will be executed when the bundle loads.\n\n## b.require(file[, opts])\n\nMake `file` available from outside the bundle with `require(file)`.\n\nThe `file` param is anything that can be resolved by `require.resolve()`.\n\nUse the `expose` property of opts to specify a custom dependency name. \n`require('./vendor/angular/angular.js', {expose: 'angular'})` enables `require('angular')`\n\n## b.bundle(opts, cb)\n\nBundle the files and their dependencies into a single javascript file.\n\nReturn a readable stream with the javascript file contents or\noptionally specify a `cb(err, src)` to get the buffered results.\n\nWhen `opts.insertGlobals` is true, always insert `process`, `global`,\n`__filename`, and `__dirname` without analyzing the AST for faster builds but\nlarger output bundles. Default false.\n\nWhen `opts.detectGlobals` is true, scan all files for `process`, `global`,\n`__filename`, and `__dirname`, defining as necessary. With this option npm\nmodules are more likely to work but bundling takes longer. Default true.\n\nWhen `opts.debug` is true, add a source map inline to the end of the bundle.\nThis makes debugging easier because you can see all the original files if\nyou are in a modern enough browser.\n\nWhen `opts.standalone` is a non-empty string, a standalone module is created\nwith that name and a [umd](https://github.com/forbeslindesay/umd) wrapper.\n\n## b.external(file)\n\nPrevent `file` from being loaded into the current bundle, instead referencing\nfrom another bundle.\n\n## b.ignore(file)\n\nPrevent the module name or file at `file` from showing up in the output bundle.\n\n## b.transform(tr)\n\nTransform source code before parsing it for `require()` calls with the transform\nfunction or module name `tr`.\n\nIf `tr` is a function, it will be called with `tr(file)` and it should return a\n[through-stream](https://github.com/substack/stream-handbook#through)\nthat takes the raw file contents and produces the transformed source.\n\nIf `tr` is a string, it should be a module name or file path of a\n[transform module](https://github.com/substack/module-deps#transforms)\nwith a signature of:\n\n``` js\nvar through = require('through');\nmodule.exports = function (file) { return through() };\n```\n\nYou don't need to necessarily use the\n[through](https://npmjs.org/package/through) module, this is just a simple\nexample.\n\nHere's how you might compile coffee script on the fly using `.transform()`:\n\n```\nvar coffee = require('coffee-script');\nvar through = require('through');\n\nb.transform(function (file) {\n var data = '';\n return through(write, end);\n \n function write (buf) { data += buf }\n function end () {\n this.queue(coffee.compile(data));\n this.queue(null);\n }\n});\n```\n\nNote that on the command-line with the `-c` flag you can just do:\n\n```\n$ browserify -c 'coffee -sc' main.coffee > bundle.js\n```\n\nOr better still, use the [coffeeify](https://github.com/substack/coffeeify)\nmodule:\n\n```\n$ npm install coffeeify\n$ browserify -t coffeeify main.coffee > bundle.js\n```\n\n# package.json\n\nbrowserify uses the `package.json` in its module resolution algorithm just like\nnode, but there is a special\n\"[browser](https://gist.github.com/4339901)\" field you can set to override file\nresolution for browser-specific versions.\n\nYou can specify source transforms in the package.json in the\nbrowserify.transforms field. There is more information about how source\ntransforms work in package.json on the\n[module-deps readme](https://github.com/substack/module-deps#transforms).\n\n# events\n\n## b.on('file', function (file, id, parent) {})\n\nWhen a file is resolved for the bundle, the bundle emits a `'file'` event with\nthe full `file` path, the `id` string passed to `require()`, and the `parent`\nobject used by\n[browser-resolve](https://github.com/shtylman/node-browser-resolve).\n\nYou could use the `file` event to implement a file watcher to regenerate bundles\nwhen files change.\n\n# list of source transforms\n\nHere is a list of known source transforms:\n\n* [brfs](https://github.com/substack/brfs) - inline\n`fs.readFileSync()` calls with file contents\n\n* [coffeeify](https://github.com/substack/coffeeify) - compile\n`.coffee` files to javascript automatically\n\n* [caching-coffeeify](https://github.com/thlorenz/caching-coffeeify) - coffeeify\nversion that caches previously compiled files to optimize the compilation step\n\n* [hbsfy](https://github.com/epeli/node-hbsfy) - precompile handlebars\ntemplates to javascript functions automatically\n\n* [rfileify](https://github.com/ForbesLindesay/rfileify) - inline `rfile(path)`\ncalls with file contents (also supports `ruglify` and any other `rfile` derivatives)\n\n* [liveify](https://github.com/quarterto/liveify) - compile livescript files to javascript automatically\n\n* [es6ify](https://github.com/thlorenz/es6ify) - compile ES6 files to \nES5 javascript automatically\n\n* [turn](https://github.com/juliangruber/turn) - minimal modules for a hypothetical es6 with lua's return\n\n# third-party tools\n\nIf you are using express or connect, you can use\n[enchilada](https://github.com/shtylman/node-enchilada) or [browserify-middleware](https://github.com/ForbesLindesay/browserify-middleware)\nto host your bundles as middleware.\n\nIf you want a standalone web server for development that will create bundles on\ndemand, check out [browservefy](https://github.com/chrisdickinson/browservefy).\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install -g browserify\n```\n\n# license\n\nMIT\n\n![browserify!](http://substack.net/images/browserify/browserify.png)\n",
"readmeFilename": "readme.markdown",
"bugs": {
"url": "https://github.com/substack/node-browserify/issues"
},
"_id": "browserify@2.14.1",
"_from": "browserify@2.14.1"
}