aboutsummaryrefslogtreecommitdiff
path: root/node_modules/webpack/bin
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/webpack/bin')
-rw-r--r--node_modules/webpack/bin/config-optimist.js47
-rw-r--r--node_modules/webpack/bin/config-yargs.js266
-rw-r--r--node_modules/webpack/bin/convert-argv.js547
-rwxr-xr-xnode_modules/webpack/bin/webpack.js363
4 files changed, 1223 insertions, 0 deletions
diff --git a/node_modules/webpack/bin/config-optimist.js b/node_modules/webpack/bin/config-optimist.js
new file mode 100644
index 000000000..5ea07ee14
--- /dev/null
+++ b/node_modules/webpack/bin/config-optimist.js
@@ -0,0 +1,47 @@
+module.exports = function(optimist) {
+ optimist
+ .boolean("help").alias("help", "h").alias("help", "?").describe("help")
+ .string("config").describe("config", "Path to the config file")
+ .string("env").describe("env", "Environment passed to the config, when it is a function")
+ .string("context").describe("context", "The root directory for resolving entry point and stats")
+ .string("entry").describe("entry", "The entry point")
+ .string("module-bind").describe("module-bind", "Bind an extension to a loader")
+ .string("module-bind-post").describe("module-bind-post")
+ .string("module-bind-pre").describe("module-bind-pre")
+ .string("output-path").describe("output-path", "The output path for compilation assets")
+ .string("output-filename").describe("output-filename", "The output filename of the bundle")
+ .string("output-chunk-filename").describe("output-chunk-filename", "The output filename for additional chunks")
+ .string("output-source-map-filename").describe("output-source-map-filename", "The output filename for the SourceMap")
+ .string("output-public-path").describe("output-public-path", "The public path for the assets")
+ .string("output-jsonp-function").describe("output-jsonp-function", "The name of the jsonp function used for chunk loading")
+ .boolean("output-pathinfo").describe("output-pathinfo", "Include a comment with the request for every dependency")
+ .string("output-library").describe("output-library", "Expose the exports of the entry point as library")
+ .string("output-library-target").describe("output-library-target", "The type for exposing the exports of the entry point as library")
+ .string("records-input-path").describe("records-input-path", "Path to the records file (reading)")
+ .string("records-output-path").describe("records-output-path", "Path to the records file (writing)")
+ .string("records-path").describe("records-path", "Path to the records file")
+ .string("define").describe("define", "Define any free var in the bundle")
+ .string("target").describe("target", "The targeted execution environment")
+ .boolean("cache").describe("cache", "Enable in memory caching").default("cache", true)
+ .boolean("watch").alias("watch", "w").describe("watch", "Watch the filesystem for changes")
+ .boolean("watch-stdin").alias("watch-stdin", "stdin").describe("Exit the process when stdin is closed")
+ .describe("watch-aggregate-timeout", "Timeout for gathering changes while watching")
+ .describe("watch-poll", "The polling interval for watching (also enable polling)")
+ .boolean("hot").describe("hot", "Enables Hot Module Replacement")
+ .boolean("debug").describe("debug", "Switch loaders to debug mode")
+ .string("devtool").describe("devtool", "Enable devtool for better debugging experience")
+ .boolean("progress").describe("progress", "Print compilation progress in percentage")
+ .string("resolve-alias").describe("resolve-alias", "Setup a module alias for resolving")
+ .string("resolve-extensions").describe("resolve-extensions", "Setup extensions that should be used to resolve modules")
+ .string("resolve-loader-alias").describe("resolve-loader-alias", "Setup a loader alias for resolving")
+ .describe("optimize-max-chunks", "Try to keep the chunk count below a limit")
+ .describe("optimize-min-chunk-size", "Try to keep the chunk size above a limit")
+ .boolean("optimize-minimize").describe("optimize-minimize", "Minimize javascript and switches loaders to minimizing")
+ .string("prefetch").describe("prefetch", "Prefetch this request")
+ .string("provide").describe("provide", "Provide these modules as free vars in all modules")
+ .string("plugin").describe("plugin", "Load this plugin")
+ .boolean("bail").describe("bail", "Abort the compilation on first error")
+ .boolean("profile").describe("profile", "Profile the compilation and include information in stats")
+ .boolean("d").describe("d", "shortcut for --debug --devtool eval-check-module-source-map --output-pathinfo")
+ .boolean("p").describe("p", "shortcut for --optimize-minimize --define process.env.NODE_ENV=\"production\"");
+};
diff --git a/node_modules/webpack/bin/config-yargs.js b/node_modules/webpack/bin/config-yargs.js
new file mode 100644
index 000000000..a3f7e0c3e
--- /dev/null
+++ b/node_modules/webpack/bin/config-yargs.js
@@ -0,0 +1,266 @@
+var CONFIG_GROUP = "Config options:";
+var BASIC_GROUP = "Basic options:";
+var MODULE_GROUP = "Module options:";
+var OUTPUT_GROUP = "Output options:";
+var ADVANCED_GROUP = "Advanced options:";
+var RESOLVE_GROUP = "Resolving options:";
+var OPTIMIZE_GROUP = "Optimizing options:";
+
+module.exports = function(yargs) {
+ yargs
+ .help("help")
+ .alias("help", "h", "?")
+ .version()
+ .alias("version", "v")
+ .options({
+ "config": {
+ type: "string",
+ describe: "Path to the config file",
+ group: CONFIG_GROUP,
+ defaultDescription: "webpack.config.js or webpackfile.js",
+ requiresArg: true
+ },
+ "env": {
+ describe: "Environment passed to the config, when it is a function",
+ group: CONFIG_GROUP
+ },
+ "context": {
+ type: "string",
+ describe: "The root directory for resolving entry point and stats",
+ group: BASIC_GROUP,
+ defaultDescription: "The current directory",
+ requiresArg: true
+ },
+ "entry": {
+ type: "string",
+ describe: "The entry point",
+ group: BASIC_GROUP,
+ requiresArg: true
+ },
+ "module-bind": {
+ type: "string",
+ describe: "Bind an extension to a loader",
+ group: MODULE_GROUP,
+ requiresArg: true
+ },
+ "module-bind-post": {
+ type: "string",
+ describe: "",
+ group: MODULE_GROUP,
+ requiresArg: true
+ },
+ "module-bind-pre": {
+ type: "string",
+ describe: "",
+ group: MODULE_GROUP,
+ requiresArg: true
+ },
+ "output-path": {
+ type: "string",
+ describe: "The output path for compilation assets",
+ group: OUTPUT_GROUP,
+ defaultDescription: "The current directory",
+ requiresArg: true
+ },
+ "output-filename": {
+ type: "string",
+ describe: "The output filename of the bundle",
+ group: OUTPUT_GROUP,
+ defaultDescription: "[name].js",
+ requiresArg: true
+ },
+ "output-chunk-filename": {
+ type: "string",
+ describe: "The output filename for additional chunks",
+ group: OUTPUT_GROUP,
+ defaultDescription: "filename with [id] instead of [name] or [id] prefixed",
+ requiresArg: true
+ },
+ "output-source-map-filename": {
+ type: "string",
+ describe: "The output filename for the SourceMap",
+ group: OUTPUT_GROUP,
+ requiresArg: true
+ },
+ "output-public-path": {
+ type: "string",
+ describe: "The public path for the assets",
+ group: OUTPUT_GROUP,
+ requiresArg: true
+ },
+ "output-jsonp-function": {
+ type: "string",
+ describe: "The name of the jsonp function used for chunk loading",
+ group: OUTPUT_GROUP,
+ requiresArg: true
+ },
+ "output-pathinfo": {
+ type: "boolean",
+ describe: "Include a comment with the request for every dependency (require, import, etc.)",
+ group: OUTPUT_GROUP
+ },
+ "output-library": {
+ type: "string",
+ describe: "Expose the exports of the entry point as library",
+ group: OUTPUT_GROUP,
+ requiresArg: true
+ },
+ "output-library-target": {
+ type: "string",
+ describe: "The type for exposing the exports of the entry point as library",
+ group: OUTPUT_GROUP,
+ requiresArg: true
+ },
+ "records-input-path": {
+ type: "string",
+ describe: "Path to the records file (reading)",
+ group: ADVANCED_GROUP,
+ requiresArg: true
+ },
+ "records-output-path": {
+ type: "string",
+ describe: "Path to the records file (writing)",
+ group: ADVANCED_GROUP,
+ requiresArg: true
+ },
+ "records-path": {
+ type: "string",
+ describe: "Path to the records file",
+ group: ADVANCED_GROUP,
+ requiresArg: true
+ },
+ "define": {
+ type: "string",
+ describe: "Define any free var in the bundle",
+ group: ADVANCED_GROUP,
+ requiresArg: true
+ },
+ "target": {
+ type: "string",
+ describe: "The targeted execution environment",
+ group: ADVANCED_GROUP,
+ requiresArg: true
+ },
+ "cache": {
+ type: "boolean",
+ describe: "Enable in memory caching",
+ default: null,
+ group: ADVANCED_GROUP,
+ defaultDescription: "It's enabled by default when watching"
+ },
+ "watch": {
+ type: "boolean",
+ alias: "w",
+ describe: "Watch the filesystem for changes",
+ group: BASIC_GROUP
+ },
+ "watch-stdin": {
+ type: "boolean",
+ alias: "stdin",
+ describe: "Exit the process when stdin is closed",
+ group: ADVANCED_GROUP
+ },
+ "watch-aggregate-timeout": {
+ describe: "Timeout for gathering changes while watching",
+ group: ADVANCED_GROUP,
+ requiresArg: true
+ },
+ "watch-poll": {
+ type: "boolean",
+ describe: "The polling interval for watching (also enable polling)",
+ group: ADVANCED_GROUP
+ },
+ "hot": {
+ type: "boolean",
+ describe: "Enables Hot Module Replacement",
+ group: ADVANCED_GROUP
+ },
+ "debug": {
+ type: "boolean",
+ describe: "Switch loaders to debug mode",
+ group: BASIC_GROUP
+ },
+ "devtool": {
+ type: "string",
+ describe: "Enable devtool for better debugging experience (Example: --devtool eval-cheap-module-source-map)",
+ group: BASIC_GROUP,
+ requiresArg: true
+ },
+ "resolve-alias": {
+ type: "string",
+ describe: "Setup a module alias for resolving (Example: jquery-plugin=jquery.plugin)",
+ group: RESOLVE_GROUP,
+ requiresArg: true
+ },
+ "resolve-extensions": {
+ "type": "array",
+ describe: "Setup extensions that should be used to resolve modules (Example: --resolve-extensions .es6 .js)",
+ group: RESOLVE_GROUP,
+ requiresArg: true
+ },
+ "resolve-loader-alias": {
+ type: "string",
+ describe: "Setup a loader alias for resolving",
+ group: RESOLVE_GROUP,
+ requiresArg: true
+ },
+ "optimize-max-chunks": {
+ describe: "Try to keep the chunk count below a limit",
+ group: OPTIMIZE_GROUP,
+ requiresArg: true
+ },
+ "optimize-min-chunk-size": {
+ describe: "Try to keep the chunk size above a limit",
+ group: OPTIMIZE_GROUP,
+ requiresArg: true
+ },
+ "optimize-minimize": {
+ type: "boolean",
+ describe: "Minimize javascript and switches loaders to minimizing",
+ group: OPTIMIZE_GROUP
+ },
+ "prefetch": {
+ type: "string",
+ describe: "Prefetch this request (Example: --prefetch ./file.js)",
+ group: ADVANCED_GROUP,
+ requiresArg: true
+ },
+ "provide": {
+ type: "string",
+ describe: "Provide these modules as free vars in all modules (Example: --provide jQuery=jquery)",
+ group: ADVANCED_GROUP,
+ requiresArg: true
+ },
+ "labeled-modules": {
+ type: "boolean",
+ describe: "Enables labeled modules",
+ group: ADVANCED_GROUP
+ },
+ "plugin": {
+ type: "string",
+ describe: "Load this plugin",
+ group: ADVANCED_GROUP,
+ requiresArg: true
+ },
+ "bail": {
+ type: "boolean",
+ describe: "Abort the compilation on first error",
+ group: ADVANCED_GROUP
+ },
+ "profile": {
+ type: "boolean",
+ describe: "Profile the compilation and include information in stats",
+ group: ADVANCED_GROUP
+ },
+ "d": {
+ type: "boolean",
+ describe: "shortcut for --debug --devtool eval-cheap-module-source-map --output-pathinfo",
+ group: BASIC_GROUP
+ },
+ "p": {
+ type: "boolean",
+ describe: "shortcut for --optimize-minimize --define process.env.NODE_ENV=\"production\"",
+ group: BASIC_GROUP
+ }
+ }).strict();
+};
diff --git a/node_modules/webpack/bin/convert-argv.js b/node_modules/webpack/bin/convert-argv.js
new file mode 100644
index 000000000..ab0ba3343
--- /dev/null
+++ b/node_modules/webpack/bin/convert-argv.js
@@ -0,0 +1,547 @@
+var path = require("path");
+var fs = require("fs");
+fs.existsSync = fs.existsSync || path.existsSync;
+var interpret = require("interpret");
+
+module.exports = function(yargs, argv, convertOptions) {
+
+ var options = [];
+
+ // Shortcuts
+ if(argv.d) {
+ argv.debug = true;
+ argv["output-pathinfo"] = true;
+ if(!argv.devtool) {
+ argv.devtool = "eval-cheap-module-source-map";
+ }
+ }
+ if(argv.p) {
+ argv["optimize-minimize"] = true;
+ argv["define"] = [].concat(argv["define"] || []).concat("process.env.NODE_ENV=\"production\"");
+ }
+
+ var configFileLoaded = false;
+ var configFiles = [];
+ var extensions = Object.keys(interpret.extensions).sort(function(a, b) {
+ return a === ".js" ? -1 : b === ".js" ? 1 : a.length - b.length;
+ });
+ var defaultConfigFiles = ["webpack.config", "webpackfile"].map(function(filename) {
+ return extensions.map(function(ext) {
+ return {
+ path: path.resolve(filename + ext),
+ ext: ext
+ };
+ });
+ }).reduce(function(a, i) {
+ return a.concat(i);
+ }, []);
+
+ var i;
+ if(argv.config) {
+ var getConfigExtension = function getConfigExtension(configPath) {
+ for(i = extensions.length - 1; i >= 0; i--) {
+ var tmpExt = extensions[i];
+ if(configPath.indexOf(tmpExt, configPath.length - tmpExt.length) > -1) {
+ return tmpExt;
+ }
+ }
+ return path.extname(configPath);
+ };
+
+ var mapConfigArg = function mapConfigArg(configArg) {
+ var resolvedPath = path.resolve(configArg);
+ var extension = getConfigExtension(resolvedPath);
+ return {
+ path: resolvedPath,
+ ext: extension
+ };
+ };
+
+ var configArgList = Array.isArray(argv.config) ? argv.config : [argv.config];
+ configFiles = configArgList.map(mapConfigArg);
+ } else {
+ for(i = 0; i < defaultConfigFiles.length; i++) {
+ var webpackConfig = defaultConfigFiles[i].path;
+ if(fs.existsSync(webpackConfig)) {
+ configFiles.push({
+ path: webpackConfig,
+ ext: defaultConfigFiles[i].ext
+ });
+ break;
+ }
+ }
+ }
+
+ if(configFiles.length > 0) {
+ var registerCompiler = function registerCompiler(moduleDescriptor) {
+ if(moduleDescriptor) {
+ if(typeof moduleDescriptor === "string") {
+ require(moduleDescriptor);
+ } else if(!Array.isArray(moduleDescriptor)) {
+ moduleDescriptor.register(require(moduleDescriptor.module));
+ } else {
+ for(var i = 0; i < moduleDescriptor.length; i++) {
+ try {
+ registerCompiler(moduleDescriptor[i]);
+ break;
+ } catch(e) {
+ // do nothing
+ }
+ }
+ }
+ }
+ };
+
+ var requireConfig = function requireConfig(configPath) {
+ var options = require(configPath);
+ var isES6DefaultExportedFunc = (
+ typeof options === "object" && options !== null && typeof options.default === "function"
+ );
+ if(typeof options === "function" || isES6DefaultExportedFunc) {
+ options = isES6DefaultExportedFunc ? options.default : options;
+ options = options(argv.env, argv);
+ }
+ return options;
+ };
+
+ configFiles.forEach(function(file) {
+ registerCompiler(interpret.extensions[file.ext]);
+ options.push(requireConfig(file.path));
+ });
+ configFileLoaded = true;
+ }
+
+ if(!configFileLoaded) {
+ return processConfiguredOptions({});
+ } else if(options.length === 1) {
+ return processConfiguredOptions(options[0]);
+ } else {
+ return processConfiguredOptions(options);
+ }
+
+ function processConfiguredOptions(options) {
+ if(options === null || typeof options !== "object") {
+ console.error("Config did not export an object or a function returning an object.");
+ process.exit(-1); // eslint-disable-line
+ }
+
+ // process Promise
+ if(typeof options.then === "function") {
+ return options.then(processConfiguredOptions);
+ }
+
+ // process ES6 default
+ if(typeof options === "object" && typeof options.default === "object") {
+ return processConfiguredOptions(options.default);
+ }
+
+ if(Array.isArray(options)) {
+ options.forEach(processOptions);
+ } else {
+ processOptions(options);
+ }
+
+ if(argv.context) {
+ options.context = path.resolve(argv.context);
+ }
+ if(!options.context) {
+ options.context = process.cwd();
+ }
+
+ if(argv.watch) {
+ options.watch = true;
+ }
+
+ if(argv["watch-aggregate-timeout"]) {
+ options.watchOptions = options.watchOptions || {};
+ options.watchOptions.aggregateTimeout = +argv["watch-aggregate-timeout"];
+ }
+
+ if(argv["watch-poll"]) {
+ options.watchOptions = options.watchOptions || {};
+ if(typeof argv["watch-poll"] !== "boolean")
+ options.watchOptions.poll = +argv["watch-poll"];
+ else
+ options.watchOptions.poll = true;
+ }
+
+ if(argv["watch-stdin"]) {
+ options.watchOptions = options.watchOptions || {};
+ options.watchOptions.stdin = true;
+ options.watch = true;
+ }
+
+ return options;
+ }
+
+ function processOptions(options) {
+ var noOutputFilenameDefined = !options.output || !options.output.filename;
+
+ function ifArg(name, fn, init, finalize) {
+ if(Array.isArray(argv[name])) {
+ if(init) {
+ init();
+ }
+ argv[name].forEach(fn);
+ if(finalize) {
+ finalize();
+ }
+ } else if(typeof argv[name] !== "undefined" && argv[name] !== null) {
+ if(init) {
+ init();
+ }
+ fn(argv[name], -1);
+ if(finalize) {
+ finalize();
+ }
+ }
+ }
+
+ function ifArgPair(name, fn, init, finalize) {
+ ifArg(name, function(content, idx) {
+ var i = content.indexOf("=");
+ if(i < 0) {
+ return fn(null, content, idx);
+ } else {
+ return fn(content.substr(0, i), content.substr(i + 1), idx);
+ }
+ }, init, finalize);
+ }
+
+ function ifBooleanArg(name, fn) {
+ ifArg(name, function(bool) {
+ if(bool) {
+ fn();
+ }
+ });
+ }
+
+ function mapArgToBoolean(name, optionName) {
+ ifArg(name, function(bool) {
+ if(bool === true)
+ options[optionName || name] = true;
+ else if(bool === false)
+ options[optionName || name] = false;
+ });
+ }
+
+ function loadPlugin(name) {
+ var loadUtils = require("loader-utils");
+ var args;
+ try {
+ var p = name && name.indexOf("?");
+ if(p > -1) {
+ args = loadUtils.parseQuery(name.substring(p));
+ name = name.substring(0, p);
+ }
+ } catch(e) {
+ console.log("Invalid plugin arguments " + name + " (" + e + ").");
+ process.exit(-1); // eslint-disable-line
+ }
+
+ var path;
+ try {
+ var resolve = require("enhanced-resolve");
+ path = resolve.sync(process.cwd(), name);
+ } catch(e) {
+ console.log("Cannot resolve plugin " + name + ".");
+ process.exit(-1); // eslint-disable-line
+ }
+ var Plugin;
+ try {
+ Plugin = require(path);
+ } catch(e) {
+ console.log("Cannot load plugin " + name + ". (" + path + ")");
+ throw e;
+ }
+ try {
+ return new Plugin(args);
+ } catch(e) {
+ console.log("Cannot instantiate plugin " + name + ". (" + path + ")");
+ throw e;
+ }
+ }
+
+ function ensureObject(parent, name) {
+ if(typeof parent[name] !== "object" || parent[name] === null) {
+ parent[name] = {};
+ }
+ }
+
+ function ensureArray(parent, name) {
+ if(!Array.isArray(parent[name])) {
+ parent[name] = [];
+ }
+ }
+
+ ifArgPair("entry", function(name, entry) {
+ if(typeof options.entry[name] !== "undefined" && options.entry[name] !== null) {
+ options.entry[name] = [].concat(options.entry[name]).concat(entry);
+ } else {
+ options.entry[name] = entry;
+ }
+ }, function() {
+ ensureObject(options, "entry");
+ });
+
+ function bindLoaders(arg, collection) {
+ ifArgPair(arg, function(name, binding) {
+ if(name === null) {
+ name = binding;
+ binding += "-loader";
+ }
+ options.module[collection].push({
+ test: new RegExp("\\." + name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "$"),
+ loader: binding
+ });
+ }, function() {
+ ensureObject(options, "module");
+ ensureArray(options.module, collection);
+ });
+ }
+ bindLoaders("module-bind", "loaders");
+ bindLoaders("module-bind-pre", "preLoaders");
+ bindLoaders("module-bind-post", "postLoaders");
+
+ var defineObject;
+ ifArgPair("define", function(name, value) {
+ if(name === null) {
+ name = value;
+ value = true;
+ }
+ defineObject[name] = value;
+ }, function() {
+ defineObject = {};
+ }, function() {
+ ensureArray(options, "plugins");
+ var DefinePlugin = require("../lib/DefinePlugin");
+ options.plugins.push(new DefinePlugin(defineObject));
+ });
+
+ ifArg("output-path", function(value) {
+ ensureObject(options, "output");
+ options.output.path = path.resolve(value);
+ });
+
+ ifArg("output-filename", function(value) {
+ ensureObject(options, "output");
+ options.output.filename = value;
+ noOutputFilenameDefined = false;
+ });
+
+ ifArg("output-chunk-filename", function(value) {
+ ensureObject(options, "output");
+ options.output.chunkFilename = value;
+ });
+
+ ifArg("output-source-map-filename", function(value) {
+ ensureObject(options, "output");
+ options.output.sourceMapFilename = value;
+ });
+
+ ifArg("output-public-path", function(value) {
+ ensureObject(options, "output");
+ options.output.publicPath = value;
+ });
+
+ ifArg("output-jsonp-function", function(value) {
+ ensureObject(options, "output");
+ options.output.jsonpFunction = value;
+ });
+
+ ifBooleanArg("output-pathinfo", function() {
+ ensureObject(options, "output");
+ options.output.pathinfo = true;
+ });
+
+ ifArg("output-library", function(value) {
+ ensureObject(options, "output");
+ options.output.library = value;
+ });
+
+ ifArg("output-library-target", function(value) {
+ ensureObject(options, "output");
+ options.output.libraryTarget = value;
+ });
+
+ ifArg("records-input-path", function(value) {
+ options.recordsInputPath = path.resolve(value);
+ });
+
+ ifArg("records-output-path", function(value) {
+ options.recordsOutputPath = path.resolve(value);
+ });
+
+ ifArg("records-path", function(value) {
+ options.recordsPath = path.resolve(value);
+ });
+
+ ifArg("target", function(value) {
+ options.target = value;
+ });
+
+ mapArgToBoolean("cache");
+
+ ifBooleanArg("hot", function() {
+ ensureArray(options, "plugins");
+ var HotModuleReplacementPlugin = require("../lib/HotModuleReplacementPlugin");
+ options.plugins.push(new HotModuleReplacementPlugin());
+ });
+
+ ifBooleanArg("debug", function() {
+ ensureArray(options, "plugins");
+ var LoaderOptionsPlugin = require("../lib/LoaderOptionsPlugin");
+ options.plugins.push(new LoaderOptionsPlugin({
+ debug: true
+ }));
+ });
+
+ ifArg("devtool", function(value) {
+ options.devtool = value;
+ });
+
+ function processResolveAlias(arg, key) {
+ ifArgPair(arg, function(name, value) {
+ if(!name) {
+ throw new Error("--" + arg + " <string>=<string>");
+ }
+ ensureObject(options, key);
+ ensureObject(options[key], "alias");
+ options[key].alias[name] = value;
+ });
+ }
+ processResolveAlias("resolve-alias", "resolve");
+ processResolveAlias("resolve-loader-alias", "resolveLoader");
+
+ ifArg("resolve-extensions", function(value) {
+ ensureObject(options, "resolve");
+ if(Array.isArray(value)) {
+ options.resolve.extensions = value;
+ } else {
+ options.resolve.extensions = value.split(/,\s*/);
+ }
+ });
+
+ ifArg("optimize-max-chunks", function(value) {
+ ensureArray(options, "plugins");
+ var LimitChunkCountPlugin = require("../lib/optimize/LimitChunkCountPlugin");
+ options.plugins.push(new LimitChunkCountPlugin({
+ maxChunks: parseInt(value, 10)
+ }));
+ });
+
+ ifArg("optimize-min-chunk-size", function(value) {
+ ensureArray(options, "plugins");
+ var MinChunkSizePlugin = require("../lib/optimize/MinChunkSizePlugin");
+ options.plugins.push(new MinChunkSizePlugin({
+ minChunkSize: parseInt(value, 10)
+ }));
+ });
+
+ ifBooleanArg("optimize-minimize", function() {
+ ensureArray(options, "plugins");
+ var UglifyJsPlugin = require("../lib/optimize/UglifyJsPlugin");
+ var LoaderOptionsPlugin = require("../lib/LoaderOptionsPlugin");
+ options.plugins.push(new UglifyJsPlugin({
+ sourceMap: options.devtool && (options.devtool.indexOf("sourcemap") >= 0 || options.devtool.indexOf("source-map") >= 0)
+ }));
+ options.plugins.push(new LoaderOptionsPlugin({
+ minimize: true
+ }));
+ });
+
+ ifArg("prefetch", function(request) {
+ ensureArray(options, "plugins");
+ var PrefetchPlugin = require("../lib/PrefetchPlugin");
+ options.plugins.push(new PrefetchPlugin(request));
+ });
+
+ ifArg("provide", function(value) {
+ ensureArray(options, "plugins");
+ var idx = value.indexOf("=");
+ var name;
+ if(idx >= 0) {
+ name = value.substr(0, idx);
+ value = value.substr(idx + 1);
+ } else {
+ name = value;
+ }
+ var ProvidePlugin = require("../lib/ProvidePlugin");
+ options.plugins.push(new ProvidePlugin(name, value));
+ });
+
+ ifArg("plugin", function(value) {
+ ensureArray(options, "plugins");
+ options.plugins.push(loadPlugin(value));
+ });
+
+ mapArgToBoolean("bail");
+
+ mapArgToBoolean("profile");
+
+ if(noOutputFilenameDefined) {
+ ensureObject(options, "output");
+ if(convertOptions && convertOptions.outputFilename) {
+ options.output.path = path.resolve(path.dirname(convertOptions.outputFilename));
+ options.output.filename = path.basename(convertOptions.outputFilename);
+ } else if(argv._.length > 0) {
+ options.output.filename = argv._.pop();
+ options.output.path = path.resolve(path.dirname(options.output.filename));
+ options.output.filename = path.basename(options.output.filename);
+ } else if(configFileLoaded) {
+ throw new Error("'output.filename' is required, either in config file or as --output-filename");
+ } else {
+ console.error("No configuration file found and no output filename configured via CLI option.");
+ console.error("A configuration file could be named 'webpack.config.js' in the current directory.");
+ console.error("Use --help to display the CLI options.");
+ process.exit(-1); // eslint-disable-line
+ }
+ }
+
+ if(argv._.length > 0) {
+ if(Array.isArray(options.entry) || typeof options.entry === "string") {
+ options.entry = {
+ main: options.entry
+ };
+ }
+ ensureObject(options, "entry");
+
+ var addTo = function addTo(name, entry) {
+ if(options.entry[name]) {
+ if(!Array.isArray(options.entry[name])) {
+ options.entry[name] = [options.entry[name]];
+ }
+ options.entry[name].push(entry);
+ } else {
+ options.entry[name] = entry;
+ }
+ };
+ argv._.forEach(function(content) {
+ var i = content.indexOf("=");
+ var j = content.indexOf("?");
+ if(i < 0 || (j >= 0 && j < i)) {
+ var resolved = path.resolve(content);
+ if(fs.existsSync(resolved)) {
+ addTo("main", resolved);
+ } else {
+ addTo("main", content);
+ }
+ } else {
+ addTo(content.substr(0, i), content.substr(i + 1));
+ }
+ });
+ }
+
+ if(!options.entry) {
+ if(configFileLoaded) {
+ console.error("Configuration file found but no entry configured.");
+ } else {
+ console.error("No configuration file found and no entry configured via CLI option.");
+ console.error("When using the CLI you need to provide at least two arguments: entry and output.");
+ console.error("A configuration file could be named 'webpack.config.js' in the current directory.");
+ }
+ console.error("Use --help to display the CLI options.");
+ process.exit(-1); // eslint-disable-line
+ }
+ }
+};
diff --git a/node_modules/webpack/bin/webpack.js b/node_modules/webpack/bin/webpack.js
new file mode 100755
index 000000000..37125533c
--- /dev/null
+++ b/node_modules/webpack/bin/webpack.js
@@ -0,0 +1,363 @@
+#!/usr/bin/env node
+
+/*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author Tobias Koppers @sokra
+*/
+var path = require("path");
+
+// Local version replace global one
+try {
+ var localWebpack = require.resolve(path.join(process.cwd(), "node_modules", "webpack", "bin", "webpack.js"));
+ if(__filename !== localWebpack) {
+ return require(localWebpack);
+ }
+} catch(e) {}
+var yargs = require("yargs")
+ .usage("webpack " + require("../package.json").version + "\n" +
+ "Usage: https://webpack.js.org/api/cli/\n" +
+ "Usage without config file: webpack <entry> [<entry>] <output>\n" +
+ "Usage with config file: webpack");
+
+require("./config-yargs")(yargs);
+
+var DISPLAY_GROUP = "Stats options:";
+var BASIC_GROUP = "Basic options:";
+
+yargs.options({
+ "json": {
+ type: "boolean",
+ alias: "j",
+ describe: "Prints the result as JSON."
+ },
+ "progress": {
+ type: "boolean",
+ describe: "Print compilation progress in percentage",
+ group: BASIC_GROUP
+ },
+ "color": {
+ type: "boolean",
+ alias: "colors",
+ default: function supportsColor() {
+ return require("supports-color");
+ },
+ group: DISPLAY_GROUP,
+ describe: "Enables/Disables colors on the console"
+ },
+ "sort-modules-by": {
+ type: "string",
+ group: DISPLAY_GROUP,
+ describe: "Sorts the modules list by property in module"
+ },
+ "sort-chunks-by": {
+ type: "string",
+ group: DISPLAY_GROUP,
+ describe: "Sorts the chunks list by property in chunk"
+ },
+ "sort-assets-by": {
+ type: "string",
+ group: DISPLAY_GROUP,
+ describe: "Sorts the assets list by property in asset"
+ },
+ "hide-modules": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Hides info about modules"
+ },
+ "display-exclude": {
+ type: "string",
+ group: DISPLAY_GROUP,
+ describe: "Exclude modules in the output"
+ },
+ "display-modules": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display even excluded modules in the output"
+ },
+ "display-max-modules": {
+ type: "number",
+ group: DISPLAY_GROUP,
+ describe: "Sets the maximum number of visible modules in output"
+ },
+ "display-chunks": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display chunks in the output"
+ },
+ "display-entrypoints": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display entry points in the output"
+ },
+ "display-origins": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display origins of chunks in the output"
+ },
+ "display-cached": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display also cached modules in the output"
+ },
+ "display-cached-assets": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display also cached assets in the output"
+ },
+ "display-reasons": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display reasons about module inclusion in the output"
+ },
+ "display-depth": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display distance from entry point for each module"
+ },
+ "display-used-exports": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display information about used exports in modules (Tree Shaking)"
+ },
+ "display-provided-exports": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display information about exports provided from modules"
+ },
+ "display-error-details": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Display details about errors"
+ },
+ "verbose": {
+ type: "boolean",
+ group: DISPLAY_GROUP,
+ describe: "Show more details"
+ }
+});
+
+var argv = yargs.argv;
+
+if(argv.verbose) {
+ argv["display-reasons"] = true;
+ argv["display-depth"] = true;
+ argv["display-entrypoints"] = true;
+ argv["display-used-exports"] = true;
+ argv["display-provided-exports"] = true;
+ argv["display-error-details"] = true;
+ argv["display-modules"] = true;
+ argv["display-cached"] = true;
+ argv["display-cached-assets"] = true;
+}
+
+var options = require("./convert-argv")(yargs, argv);
+
+function ifArg(name, fn, init) {
+ if(Array.isArray(argv[name])) {
+ if(init) init();
+ argv[name].forEach(fn);
+ } else if(typeof argv[name] !== "undefined") {
+ if(init) init();
+ fn(argv[name], -1);
+ }
+}
+
+function processOptions(options) {
+ // process Promise
+ if(typeof options.then === "function") {
+ options.then(processOptions).catch(function(err) {
+ console.error(err.stack || err);
+ process.exit(1); // eslint-disable-line
+ });
+ return;
+ }
+
+ var firstOptions = [].concat(options)[0];
+ var statsPresetToOptions = require("../lib/Stats.js").presetToOptions;
+
+ var outputOptions = options.stats;
+ if(typeof outputOptions === "boolean" || typeof outputOptions === "string") {
+ outputOptions = statsPresetToOptions(outputOptions);
+ } else if(!outputOptions) {
+ outputOptions = {};
+ }
+ outputOptions = Object.create(outputOptions);
+ if(Array.isArray(options) && !outputOptions.children) {
+ outputOptions.children = options.map(o => o.stats);
+ }
+ if(typeof outputOptions.context === "undefined")
+ outputOptions.context = firstOptions.context;
+
+ ifArg("json", function(bool) {
+ if(bool)
+ outputOptions.json = bool;
+ });
+
+ if(typeof outputOptions.colors === "undefined")
+ outputOptions.colors = require("supports-color");
+
+ ifArg("sort-modules-by", function(value) {
+ outputOptions.modulesSort = value;
+ });
+
+ ifArg("sort-chunks-by", function(value) {
+ outputOptions.chunksSort = value;
+ });
+
+ ifArg("sort-assets-by", function(value) {
+ outputOptions.assetsSort = value;
+ });
+
+ ifArg("display-exclude", function(value) {
+ outputOptions.exclude = value;
+ });
+
+ if(!outputOptions.json) {
+ if(typeof outputOptions.cached === "undefined")
+ outputOptions.cached = false;
+ if(typeof outputOptions.cachedAssets === "undefined")
+ outputOptions.cachedAssets = false;
+
+ ifArg("display-chunks", function(bool) {
+ outputOptions.modules = !bool;
+ outputOptions.chunks = bool;
+ });
+
+ ifArg("display-entrypoints", function(bool) {
+ outputOptions.entrypoints = bool;
+ });
+
+ ifArg("display-reasons", function(bool) {
+ outputOptions.reasons = bool;
+ });
+
+ ifArg("display-depth", function(bool) {
+ outputOptions.depth = bool;
+ });
+
+ ifArg("display-used-exports", function(bool) {
+ outputOptions.usedExports = bool;
+ });
+
+ ifArg("display-provided-exports", function(bool) {
+ outputOptions.providedExports = bool;
+ });
+
+ ifArg("display-error-details", function(bool) {
+ outputOptions.errorDetails = bool;
+ });
+
+ ifArg("display-origins", function(bool) {
+ outputOptions.chunkOrigins = bool;
+ });
+
+ ifArg("display-max-modules", function(value) {
+ outputOptions.maxModules = value;
+ });
+
+ ifArg("display-cached", function(bool) {
+ if(bool)
+ outputOptions.cached = true;
+ });
+
+ ifArg("display-cached-assets", function(bool) {
+ if(bool)
+ outputOptions.cachedAssets = true;
+ });
+
+ if(!outputOptions.exclude)
+ outputOptions.exclude = ["node_modules", "bower_components", "components"];
+
+ if(argv["display-modules"]) {
+ outputOptions.maxModules = Infinity;
+ outputOptions.exclude = undefined;
+ }
+ } else {
+ if(typeof outputOptions.chunks === "undefined")
+ outputOptions.chunks = true;
+ if(typeof outputOptions.entrypoints === "undefined")
+ outputOptions.entrypoints = true;
+ if(typeof outputOptions.modules === "undefined")
+ outputOptions.modules = true;
+ if(typeof outputOptions.chunkModules === "undefined")
+ outputOptions.chunkModules = true;
+ if(typeof outputOptions.reasons === "undefined")
+ outputOptions.reasons = true;
+ if(typeof outputOptions.cached === "undefined")
+ outputOptions.cached = true;
+ if(typeof outputOptions.cachedAssets === "undefined")
+ outputOptions.cachedAssets = true;
+ }
+
+ ifArg("hide-modules", function(bool) {
+ if(bool) {
+ outputOptions.modules = false;
+ outputOptions.chunkModules = false;
+ }
+ });
+
+ var webpack = require("../lib/webpack.js");
+
+ Error.stackTraceLimit = 30;
+ var lastHash = null;
+ var compiler;
+ try {
+ compiler = webpack(options);
+ } catch(e) {
+ var WebpackOptionsValidationError = require("../lib/WebpackOptionsValidationError");
+ if(e instanceof WebpackOptionsValidationError) {
+ if(argv.color)
+ console.error("\u001b[1m\u001b[31m" + e.message + "\u001b[39m\u001b[22m");
+ else
+ console.error(e.message);
+ process.exit(1); // eslint-disable-line no-process-exit
+ }
+ throw e;
+ }
+
+ if(argv.progress) {
+ var ProgressPlugin = require("../lib/ProgressPlugin");
+ compiler.apply(new ProgressPlugin({
+ profile: argv.profile
+ }));
+ }
+
+ function compilerCallback(err, stats) {
+ if(!options.watch || err) {
+ // Do not keep cache anymore
+ compiler.purgeInputFileSystem();
+ }
+ if(err) {
+ lastHash = null;
+ console.error(err.stack || err);
+ if(err.details) console.error(err.details);
+ process.exit(1); // eslint-disable-line
+ }
+ if(outputOptions.json) {
+ process.stdout.write(JSON.stringify(stats.toJson(outputOptions), null, 2) + "\n");
+ } else if(stats.hash !== lastHash) {
+ lastHash = stats.hash;
+ process.stdout.write(stats.toString(outputOptions) + "\n");
+ }
+ if(!options.watch && stats.hasErrors()) {
+ process.on("exit", function() {
+ process.exit(2); // eslint-disable-line
+ });
+ }
+ }
+ if(firstOptions.watch || options.watch) {
+ var watchOptions = firstOptions.watchOptions || firstOptions.watch || options.watch || {};
+ if(watchOptions.stdin) {
+ process.stdin.on("end", function() {
+ process.exit(0); // eslint-disable-line
+ });
+ process.stdin.resume();
+ }
+ compiler.watch(watchOptions, compilerCallback);
+ console.log("\nWebpack is watching the files…\n");
+ } else
+ compiler.run(compilerCallback);
+
+}
+
+processOptions(options);