all da files
This commit is contained in:
113
node_modules/browserify/bin/cmd.js
generated
vendored
Executable file
113
node_modules/browserify/bin/cmd.js
generated
vendored
Executable file
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env node
|
||||
var browserify = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var JSONStream = require('JSONStream');
|
||||
var spawn = require('child_process').spawn;
|
||||
var parseShell = require('shell-quote').parse;
|
||||
var duplexer = require('duplexer');
|
||||
|
||||
var argv = require('optimist')
|
||||
.boolean(['deps','pack','ig','dg', 'im', 'd'])
|
||||
.alias('insert-globals', 'ig')
|
||||
.alias('detect-globals', 'dg')
|
||||
.alias('ignore-missing', 'im')
|
||||
.alias('debug', 'd')
|
||||
.alias('ig', 'fast')
|
||||
.default('ig', false)
|
||||
.default('im', false)
|
||||
.default('dg', true)
|
||||
.default('d', false)
|
||||
.argv
|
||||
;
|
||||
|
||||
if (argv.h || argv.help || process.argv.length <= 2) {
|
||||
return fs.createReadStream(__dirname + '/usage.txt')
|
||||
.pipe(process.stdout)
|
||||
.on('close', function () { process.exit(1) })
|
||||
;
|
||||
}
|
||||
if (argv.v || argv.verbose) {
|
||||
return console.log(require('../package.json').version);
|
||||
}
|
||||
|
||||
var entries = argv._.concat(argv.e).filter(Boolean).map(function(entry) {
|
||||
return path.resolve(process.cwd(), entry);
|
||||
});
|
||||
var b = browserify(entries);
|
||||
|
||||
b.on('error', function (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
[].concat(argv.i).concat(argv.ignore).filter(Boolean)
|
||||
.forEach(function (i) { b.ignore(i) })
|
||||
;
|
||||
|
||||
[].concat(argv.r).concat(argv.require).filter(Boolean)
|
||||
.forEach(function (r) { b.require(r, { expose: r }) })
|
||||
;
|
||||
|
||||
// resolve any external files and add them to the bundle as externals
|
||||
[].concat(argv.x).concat(argv.external).filter(Boolean)
|
||||
.forEach(function (x) { b.external(path.resolve(process.cwd(), x)) })
|
||||
;
|
||||
|
||||
[].concat(argv.t).concat(argv.transform).filter(Boolean)
|
||||
.forEach(function (t) { b.transform(t) })
|
||||
;
|
||||
|
||||
[].concat(argv.c).concat(argv.command).filter(Boolean)
|
||||
.forEach(function (c) {
|
||||
var cmd = parseShell(c);
|
||||
b.transform(function (file) {
|
||||
var env = Object.keys(process.env).reduce(function (acc, key) {
|
||||
acc[key] = process.env[key];
|
||||
return acc;
|
||||
}, {});
|
||||
env.FILENAME = file;
|
||||
var ps = spawn(cmd[0], cmd.slice(1), { env: env });
|
||||
var error = '';
|
||||
ps.stderr.on('data', function (buf) { error += buf });
|
||||
|
||||
ps.on('exit', function (code) {
|
||||
if (code === 0) return;
|
||||
console.error([
|
||||
'error running source transform command: ' + c,
|
||||
error.split('\n').join('\n '),
|
||||
''
|
||||
].join('\n'));
|
||||
process.exit(1);
|
||||
});
|
||||
return duplexer(ps.stdin, ps.stdout);
|
||||
});
|
||||
})
|
||||
;
|
||||
|
||||
if (argv.pack) {
|
||||
process.stdin.pipe(b.pack()).pipe(process.stdout);
|
||||
process.stdin.resume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (argv.deps) {
|
||||
var stringify = JSONStream.stringify();
|
||||
b.deps().pipe(stringify).pipe(process.stdout);
|
||||
return;
|
||||
}
|
||||
|
||||
var bundle = b.bundle({
|
||||
detectGlobals: argv['detect-globals'] !== false && argv.dg !== false,
|
||||
insertGlobals: argv['insert-globals'] || argv.ig,
|
||||
ignoreMissing: argv['ignore-missing'] || argv.im,
|
||||
debug: argv['debug'] || argv.d
|
||||
});
|
||||
|
||||
var outfile = argv.o || argv.outfile;
|
||||
if (outfile) {
|
||||
bundle.pipe(fs.createWriteStream(outfile));
|
||||
}
|
||||
else {
|
||||
bundle.pipe(process.stdout);
|
||||
}
|
49
node_modules/browserify/bin/usage.txt
generated
vendored
Normal file
49
node_modules/browserify/bin/usage.txt
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
Usage: browserify [entry files] {OPTIONS}
|
||||
|
||||
Standard Options:
|
||||
|
||||
--outfile, -o Write the browserify bundle to this file.
|
||||
If unspecified, browserify prints to stdout.
|
||||
|
||||
--require, -r A module name or file to bundle.require()
|
||||
Optionally use a colon separator to set the target.
|
||||
|
||||
--entry, -e An entry point of your app
|
||||
|
||||
--ignore, -i Omit a file from the output bundle.
|
||||
|
||||
--external, -x Reference a file from another bundle.
|
||||
|
||||
--transform, -t Use a transform module on top-level files.
|
||||
|
||||
--command, -c Use a transform command on top-level files.
|
||||
|
||||
--help, -h Show this message
|
||||
|
||||
Advanced Options:
|
||||
|
||||
--insert-globals, --ig, --fast [default: false]
|
||||
|
||||
Skip detection and always insert definitions for process, global,
|
||||
__filename, and __dirname.
|
||||
|
||||
benefit: faster builds
|
||||
cost: extra bytes
|
||||
|
||||
--detect-globals, --dg [default: true]
|
||||
|
||||
Detect the presence of process, global, __filename, and __dirname and define
|
||||
these values when present.
|
||||
|
||||
benefit: npm modules more likely to work
|
||||
cost: slower builds
|
||||
|
||||
--ignore-missing, --im [default: false]
|
||||
|
||||
Ignore `require()` statements that don't resolve to anything.
|
||||
|
||||
--debug -d [default: false]
|
||||
|
||||
Enable source maps that allow you to debug your files separately.
|
||||
|
||||
Specify a parameter.
|
Reference in New Issue
Block a user