forked from jamesshore/lets_code_javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.json
More file actions
102 lines (102 loc) · 23.5 KB
/
package.json
File metadata and controls
102 lines (102 loc) · 23.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
"name": "browserify",
"version": "3.43.0",
"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": {
"JSONStream": "~0.7.1",
"assert": "~1.1.0",
"browser-pack": "~2.0.0",
"browser-resolve": "~1.2.1",
"browserify-zlib": "~0.1.2",
"buffer": "~2.1.4",
"builtins": "~0.0.3",
"commondir": "0.0.1",
"concat-stream": "~1.4.1",
"console-browserify": "~1.0.1",
"constants-browserify": "~0.0.1",
"crypto-browserify": "~1.0.9",
"deep-equal": "~0.1.0",
"defined": "~0.0.0",
"deps-sort": "~0.1.1",
"derequire": "~0.8.0",
"domain-browser": "~1.1.0",
"duplexer": "~0.1.1",
"events": "~1.0.0",
"glob": "~3.2.8",
"http-browserify": "~1.3.1",
"https-browserify": "~0.0.0",
"inherits": "~2.0.1",
"insert-module-globals": "~5.0.1",
"module-deps": "~1.9.0",
"os-browserify": "~0.1.1",
"parents": "~0.0.1",
"path-browserify": "~0.0.0",
"punycode": "~1.2.3",
"querystring-es3": "0.2.0",
"resolve": "~0.6.1",
"shallow-copy": "0.0.1",
"shell-quote": "~0.0.1",
"stream-browserify": "~0.1.0",
"stream-combiner": "~0.0.2",
"string_decoder": "~0.0.0",
"subarg": "0.0.1",
"syntax-error": "~1.1.0",
"through2": "~0.4.1",
"timers-browserify": "~1.0.1",
"tty-browserify": "~0.0.0",
"umd": "~2.0.0",
"url": "~0.7.9",
"util": "~0.10.1",
"vm-browserify": "~0.0.1"
},
"devDependencies": {
"backbone": "~0.9.2",
"browser-unpack": "~0.0.0",
"coffee-script": "~1.5.0",
"coffeeify": "~0.6.0",
"dnode": "~1.0.3",
"es6ify": "~0.4.8",
"mkdirp": "~0.3.3",
"seq": "0.3.3",
"tap": "~0.4.0",
"through": "~2.3.4"
},
"author": {
"name": "James Halliday",
"email": "[email protected]",
"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 `<script>`\ntag.\n\n[](http://travis-ci.org/substack/node-browserify)\n\n\n\n# example\n\nWhip up a file, `main.js` with some `require()s` in it. You can use relative\npaths like `'./foo.js'` and `'../lib/bar.js'` or module paths like `'gamma'`\nthat will search `node_modules/` using\n[node's module lookup algorithm](https://github.com/substack/node-resolve).\n\n``` js\nvar foo = require('./foo.js');\nvar bar = require('../lib/bar.js');\nvar gamma = require('gamma');\n\nvar elem = document.getElementById('result');\nvar x = foo(100) + bar('baz');\nelem.textContent = gamma(x);\n```\n\nExport functionality by assigning onto `module.exports` or `exports`:\n\n``` js\nmodule.exports = function (n) { return n * 111 }\n```\n\nNow just use the `browserify` command to build a bundle starting at `main.js`:\n\n```\n$ browserify main.js > bundle.js\n```\n\nAll of the modules that `main.js` needs are included in the `bundle.js` from a\nrecursive walk of the `require()` graph using\n[required](https://github.com/defunctzombie/node-required).\n\nTo use this bundle, just toss a `<script src=\"bundle.js\"></script>` into your\nhtml!\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install -g browserify\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 Replace a file with an empty stub. Files can be globs.\n \n --exclude, -u Omit a file from the output bundle. Files can be globs.\n\n --external, -x Reference a file from another bundle. Files can be globs.\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 --insert-global-vars, --igv\n\n Comma-separated list of global variables to detect and define.\n Default: __filename,__dirname,process,Buffer,global\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 --no-builtins\n\n Turn off builtins. This is handy when you want to run a bundle in node which\n provides the core builtins.\n\n --no-commondir\n \n Turn off setting a commondir. This is useful if you want to preserve the\n original paths that a bundle was generated with. \n \n --no-bundle-external\n\n Turn off bundling of all external modules. This is useful if you only want\n to bundle your local files.\n\n --bare \n\n Alias for both --no-builtins, --no-commondir, and sets --insert-global-vars\n to just \"__filename,__dirname\". This is handy if you want to run bundles in\n node.\n\n --full-paths\n\n Turn off converting module ids into numerical indexes. This is useful for\n preserving the original paths that a bundle was generated with.\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 --extension=EXTENSION\n\n Consider files with specified EXTENSION as modules, this option can used\n multiple times.\n\n --global-transform=MODULE, --g MODULE\n\n Use a transform module on all files after any ordinary transforms have run.\n\n --plugin=MODULE, -p MODULE\n\n Register MODULE as a plugin.\n\nPassing arguments to transforms and plugins:\n\n For -t, -g, and -p, you may use subarg syntax to pass options to the\n transforms or plugin function as the second parameter. For example:\n\n -t [ foo -x 3 --beep ]\n\n will call the `foo` transform for each applicable file by calling:\n\n foo(file, { x: 3, beep: true })\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* [assert](https://npmjs.org/package/assert)\n* [buffer](https://npmjs.org/package/buffer)\n* [console](https://npmjs.org/package/console-browserify)\n* [constants](https://npmjs.org/package/constants-browserify)\n* [crypto](https://npmjs.org/package/crypto-browserify)\n* [domain](https://npmjs.org/package/domain-browser)\n* [events](https://npmjs.org/package/events-browserify)\n* [http](https://npmjs.org/package/http-browserify)\n* [https](https://npmjs.org/package/https-browserify)\n* [os](https://npmjs.org/package/os-browserify)\n* [path](https://npmjs.org/package/path-browserify)\n* [punycode](https://npmjs.org/package/punycode)\n* [querystring](https://npmjs.org/package/querystring)\n* [stream](https://npmjs.org/package/stream-browserify)\n* [string_decoder](https://npmjs.org/package/string_decoder)\n* [timers](https://npmjs.org/package/timers-browserify)\n* [tty](https://npmjs.org/package/tty-browserify)\n* [url](https://npmjs.org/package/url)\n* [util](https://npmjs.org/package/util)\n* [vm](https://npmjs.org/package/vm-browserify)\n* [zlib](https://npmjs.org/package/browserify-zlib)\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://npmjs.org/package/process)\n* [Buffer](https://npmjs.org/package/buffer)\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# more examples\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 -r ./my-file.js:my-module > bundle.js\n```\n\nThen in your page you can do:\n\n``` html\n<script src=\"bundle.js\"></script>\n<script>\n var through = require('through');\n var duplexer = require('duplexer');\n var myModule = require('my-module');\n /* ... */\n</script>\n```\n\n## external source maps\n\nIf you prefer the source maps be saved to a separate `.js.map` source map file, you may use\n[exorcist](https://github.com/thlorenz/exorcist) in order to achieve that. It's as simple as:\n\n```\n$ browserify main.js --debug | exorcist bundle.js.map > bundle.js \n```\n\nLearn about additional options [here](https://github.com/thlorenz/exorcist#usage).\n\n## multiple bundles\n\nIf browserify finds a `require`d 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.js');\nconsole.log(robot('beep'));\n```\n\nand `boop.js`:\n\n``` js\nvar robot = require('./robot.js');\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<script src=\"common.js\"></script>\n<script src=\"beep.js\"></script>\n```\n\nwhile the boop page can have:\n\n``` html\n<script src=\"common.js\"></script>\n<script src=\"boop.js\"></script>\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# 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.entries`.\n`files` can be an array of files or a single file.\n\nFor each `file` in `files`, if `file` is a stream, its contents will be used.\nYou should use `opts.basedir` when using streaming files so that relative\nrequires will know where to resolve from.\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`opts.extensions` is an array of optional extra extensions for the module lookup\nmachinery to use when the extension has not been specified.\nBy default browserify considers only `.js` and `.json` files in such cases.\n\n`opts.basedir` is the directory that browserify starts bundling from for\nfilenames that start with `.`.\n\n`opts.commondir` sets the algorithm used to parse out the common paths. Use\n`false` to turn this off, otherwise it uses the\n[commondir](https://npmjs.org/package/commondir) module.\n\n`opts.fullPaths` disables converting module ids into numerical indexes. This is\nuseful for preserving the original paths that a bundle was generated with.\n\n`opts.builtins` sets the list of builtins to use, which by default is set in\n`lib/builtins.js` in this distribution.\n\n`opts.bundleExternal` boolean option to set if external modules should be\nbundled. Defaults to true.\n\n`opts.pack` sets the browser-pack implementation to use. The `opts.pack()`\nshould return a transform stream that accepts objects of the form that\n[module-deps](https://npmjs.org/package/module-deps) generates. Simplified, this\nis roughly:\n\n```\n{\"id\":\"1\",\"source\":\"console.log('beep boop')\",\"deps\":{}}\n{\"id\":\"2\",\"source\":\"require('./boop.js')\",\"deps\":{\"./boop.js\":\"1\"}}\n```\n\nBy default, `opts.pack` uses\n[browser-pack](https://npmjs.org/package/browser-pack):\n\n```\nrequire('browser-pack')({ raw: true, sourceMapPrefix: '//@' });\n```\n\n`opts.externalRequireName` defaults to `'require'` in `expose` mode but you can\nuse another name.\n\nYou can give browserify a custom `opts.resolve()` function or by default it uses\n[browser-resolve](https://npmjs.org/package/browser-resolve).\n\nNote that if files do not contain javascript source code then you also need to\nspecify a corresponding transform for them.\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\n`file` can also be a stream, but you should also use `opts.basedir` so that\nrelative requires will be resolvable.\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.\nYou can use namespaces in the standalone global export using a `.` in the string\nname as a separator. For example: `'A.B.C'` \n\n`opts.insertGlobalVars` will be passed to\n[insert-module-globals](http://npmjs.org/package/insert-module-globals)\nas the `opts.vars` parameter.\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\nInstead you will get a file with `module.exports = {}`.\n\n## b.exclude(file)\n\nPrevent the module name or file at `file` from showing up in the output bundle.\n\nIf your code tries to `require()` that file it will throw unless you've provided\nanother mechanism for loading it.\n\n## b.transform(opts={}, 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\nIf `opts.global` is `true`, the transform will operate on ALL files, despite\nwhether they exist up a level in a `node_modules/` directory. Use global\ntransforms cautiously and sparingly, since most of the time an ordinary\ntransform will suffice. You can also not configure global transforms in a\n`package.json` like you can with ordinary transforms.\n\nGlobal transforms always run after any ordinary transforms have run.\n\n## b.plugin(plugin, opts)\n\nRegister a `plugin` with `opts`. Plugins can be a string module name or a\nfunction the same as transforms.\n\n`plugin(b, opts)` is called with the browserify instance `b`.\n\nFor more information, consult the plugins section below.\n\n## b.deps(opts)\n\nReturn a readable stream of the dependency array generated by module-deps.\n\n# package.json\n\nbrowserify uses the `package.json` in its module resolution algorithm just like\nnode. If there is a `\"main\"` field, browserify will start resolving the package\nat that point. If there is no `\"main\"` field, browserify will look for an\n`\"index.js\"` file in the module root directory. Here are some more\nsophisticated things you can do in the package.json:\n\n## browser field\n\nThere is a special \"[browser](https://gist.github.com/4339901)\" field you can\nset in your package.json on a per-module basis to override file resolution for\nbrowser-specific versions of files.\n\nFor example, if you want to have a browser-specific module entry point for your\n`\"main\"` field you can just set the `\"browser\"` field to a string:\n\n``` json\n\"browser\": \"./browser.js\"\n```\n\nor you can have overrides on a per-file basis:\n\n``` json\n\"browser\": {\n \"fs\": \"level-fs\",\n \"./lib/ops.js\": \"./browser/opts.js\"\n}\n```\n\nNote that the browser field only applies to files in the local module and like\ntransforms it doesn't apply into `node_modules` directories.\n\n## browserify.transform\n\nYou can specify source transforms in the package.json in the\n`browserify.transform` 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\nFor example, if your module requires [brfs](https://npmjs.org/package/brfs), you\ncan add\n\n``` json\n\"browserify\": { \"transform\": [ \"brfs\" ] }\n```\n\nto your package.json. Now when somebody `require()`s your module, brfs will\nautomatically be applied to the files in your module without explicit\nintervention by the person using your module. Make sure to add transforms to\nyour package.json dependencies field.\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/defunctzombie/node-browser-resolve).\n\nYou could use the `file` event to implement a file watcher to regenerate bundles\nwhen files change.\n\n## b.on('bundle', function (bundle) {})\n\nWhen `.bundle()` is called, this event fires with the `bundle` output stream.\n\n## bundle.on('transform', function (tr, file) {})\n\nWhen a transform is applied to a file, the `'transform'` event fires on the\nbundle stream with the transform stream `tr` and the `file` that the transform\nis being applied to.\n\n# plugins\n\nFor some more advanced use-cases, a transform is not sufficiently extensible.\nPlugins are modules that take the bundle instance as their first parameter and\nan option hash as their second.\n\nPlugins can be used to do perform some fancy features that transforms can't do.\nFor example, [factor-bundle](https://npmjs.org/package/factor-bundle) is a\nplugin that can factor out common dependencies from multiple entry-points into a\ncommon bundle. Use plugins with `-p` and pass options to plugins with\n[subarg](https://npmjs.org/package/subarg) syntax:\n\n```\nbrowserify x.js y.js -p [ factor-bundle -o bundle/x.js -o bundle/y.js ] \\\n > bundle/common.js\n```\n\nFor a list of plugins, consult the\n[browserify-plugin tag](https://npmjs.org/browse/keyword/browserify-plugin)\non npm.\n\n# list of source transforms\n\nThere is a [wiki page that lists the known browserify\ntransforms](https://github.com/substack/node-browserify/wiki/list-of-transforms).\n\nIf you write a transform, make sure to add your transform to that wiki page and\nadd a package.json keyword of `browserify-transform` so that\n[people can browse for all the browserify\ntransforms](https://npmjs.org/browse/keyword/browserify-transform) on npmjs.org.\n\n# third-party tools\n\nThere is a [wiki page that lists the known browserify\ntools](https://github.com/substack/node-browserify/wiki/browserify-tools).\n\nIf you write a tool, make sure to add it to that wiki page and\nadd a package.json keyword of `browserify-tool` so that\n[people can browse for all the browserify\ntools](https://npmjs.org/browse/keyword/browserify-tool) on npmjs.org.\n\n# license\n\nMIT\n\n\n",
"readmeFilename": "readme.markdown",
"bugs": {
"url": "https://github.com/substack/node-browserify/issues"
},
"homepage": "https://github.com/substack/node-browserify",
"_id": "[email protected]",
"dist": {
"shasum": "41b9296bffb058e0b7617b2d8a75e2c03351a5af"
},
"_from": "browserify@",
"_resolved": "https://registry.npmjs.org/browserify/-/browserify-3.43.0.tgz"
}