Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 89 lines (79 sloc) 1.988 kB
#!/usr/bin/env node
'use strict';
var count = require('es5-ext/object/count')
, readFile = require('fs2/read-file')
, writeFile = require('fs2/write-file')
, resolve = require('path').resolve
, webmake = require('../')
, isArray = Array.isArray, now = Date.now
, optimist = require('optimist')
.usage("Usage: $0 [options] [<input>] [<output>]", {
name: {
string: true,
description: "Expose program in your namespace with given name"
},
amd: {
boolean: true,
description: "Expose bundle as AMD module"
},
ext: {
string: true,
description: "Optional extensions"
},
'ignore-errors': {
boolean: true,
description: "Ignore unparsable require calls"
},
'use-strict': {
boolean: true,
description: "Enforce strict mode"
},
include: {
string: true,
description: "Additional module(s) that should be included (and are" +
" not picked by the parser)"
},
help: {
boolean: true,
desription: "Show this help"
},
sourcemap: {
boolean: true,
description: "Include source maps"
}
})
, argv = optimist.argv
, input, options, time;
if (argv.help) {
console.log(optimist.help());
process.exit(0);
}
options = {};
input = argv._[0];
if (!input) {
options.stream = process.stdin;
process.stdin.resume();
input = resolve(process.cwd(), ':stream:.js');
}
if (argv.include) {
options.include = argv.include;
if (!isArray(options.include)) {
options.include = [options.include];
}
}
options.ext = argv.ext;
options.sourceMap = argv.sourcemap;
options.useStrict = argv['use-strict'];
options.ignoreErrors = argv['ignore-errors'];
if (argv._[1]) options.output = argv._[1];
time = now();
webmake(input, options).done(function (parser) {
time = now() - time;
if (!options.output) {
process.stdout.write(parser);
return;
}
console.log("Done [" + parser.modulesFiles.length + " modules from " +
count(parser.packages) + " packages in " + (time / 1000).toFixed(2) +
"s]");
});
Jump to Line
Something went wrong with that request. Please try again.