From af076d944a30d7781df2280658d64add043d5aa9 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Thu, 21 Sep 2017 22:49:46 +0200 Subject: [PATCH 01/12] add unit tests for everything and flow compilation --- .eslintignore | 1 + .gitignore | 3 + bin/config-yargs.js | 2 +- bin/convert-argv.js | 126 +- bin/prepareOptions.js | 30 + bin/webpack.js | 445 +++---- lib/creator/yeoman/utils/entry.js | 120 +- lib/creator/yeoman/webpack-generator.js | 482 ++++---- .../bannerPlugin/bannerPlugin.js | 20 +- .../extractTextPlugin/extractTextPlugin.js | 27 +- lib/transformations/index.js | 31 +- .../loaderOptionsPlugin.js | 21 +- lib/transformations/loaders/loaders.js | 143 ++- lib/transformations/outputPath/outputPath.js | 57 +- .../removeDeprecatedPlugins.js | 29 +- .../removeJsonLoader/removeJsonLoader.js | 10 +- lib/transformations/resolve/resolve.js | 35 +- .../uglifyJsPlugin/uglifyJsPlugin.js | 36 +- lib/transformations/utils.js | 243 ++-- lib/types.js | 49 +- lib/utils/npm-exists.js | 2 +- lib/utils/resolve-packages.js | 3 +- lib/utils/validateSchema.js | 6 +- package-lock.json | 1055 +++++++++++++++-- package.json | 20 +- test/BinTestCases.test.js | 146 +++ test/binCases/config-name/found-many/index.js | 1 + .../binCases/config-name/found-many/index2.js | 1 + .../binCases/config-name/found-many/index3.js | 0 test/binCases/config-name/found-many/test.js | 9 + .../binCases/config-name/found-many/test.opts | 6 + .../config-name/found-many/webpack.config.js | 16 + test/binCases/config-name/found-one/index.js | 1 + test/binCases/config-name/found-one/index2.js | 1 + test/binCases/config-name/found-one/test.js | 9 + test/binCases/config-name/found-one/test.opts | 5 + .../config-name/found-one/webpack.config.js | 12 + test/binCases/config-name/not-found/test.js | 7 + test/binCases/config-name/not-found/test.opts | 2 + .../config-name/not-found/webpack.config.js | 5 + test/binCases/configFile/profile/bar.js | 1 + test/binCases/configFile/profile/foo.js | 3 + test/binCases/configFile/profile/index.js | 1 + test/binCases/configFile/profile/test.js | 12 + .../configFile/profile/webpack.config.js | 6 + test/binCases/entry/multi-file/a.js | 1 + test/binCases/entry/multi-file/index.js | 1 + test/binCases/entry/multi-file/test.js | 12 + test/binCases/entry/multi-file/test.opts | 6 + .../entry/multi-file/webpack.config.js | 1 + test/binCases/entry/named-entry/a.js | 1 + test/binCases/entry/named-entry/index.js | 1 + test/binCases/entry/named-entry/test.js | 12 + test/binCases/entry/named-entry/test.opts | 6 + .../entry/named-entry/webpack.config.js | 1 + test/binCases/entry/non-hyphenated-args/a.js | 1 + .../entry/non-hyphenated-args/index.js | 1 + .../entry/non-hyphenated-args/test.js | 12 + .../entry/non-hyphenated-args/test.opts | 6 + .../non-hyphenated-args/webpack.config.js | 1 + test/binCases/errors/issue-5576/a.js | 1 + test/binCases/errors/issue-5576/a/.keep | 1 + test/binCases/errors/issue-5576/test.js | 14 + test/binCases/errors/issue-5576/test.opts | 3 + .../errors/issue-5576/webpack.config.js | 1 + test/binCases/errors/parse/index.js | 1 + test/binCases/errors/parse/test.js | 17 + test/binCases/errors/parse/webpack.config.js | 4 + test/binCases/help/help-output/test.js | 19 + test/binCases/help/help-output/test.opts | 1 + test/binCases/module/module-bind/file.post | 1 + test/binCases/module/module-bind/file.pre | 1 + test/binCases/module/module-bind/index.js | 3 + .../module/module-bind/post-loader.js | 4 + .../binCases/module/module-bind/pre-loader.js | 4 + test/binCases/module/module-bind/test.js | 10 + test/binCases/module/module-bind/test.opts | 7 + .../module/module-bind/webpack.config.js | 5 + .../uglifyjsplugin-empty-args/index.js | 1 + .../plugins/uglifyjsplugin-empty-args/test.js | 10 + .../uglifyjsplugin-empty-args/test.opts | 6 + .../webpack.config.js | 5 + test/binCases/stats/custom-preset/index.js | 1 + test/binCases/stats/custom-preset/test.js | 7 + test/binCases/stats/custom-preset/test.opts | 5 + test/binCases/stats/multi-config/index.js | 1 + test/binCases/stats/multi-config/index2.js | 1 + test/binCases/stats/multi-config/test.js | 7 + .../stats/multi-config/webpack.config.js | 12 + test/binCases/stats/none/index.js | 1 + test/binCases/stats/none/test.js | 7 + test/binCases/stats/none/webpack.config.js | 6 + test/binCases/stats/single-config/index.js | 1 + test/binCases/stats/single-config/test.js | 17 + .../stats/single-config/webpack.config.js | 11 + test/binCases/test.opts | 5 + .../watch/multi-config-watch-opt/async | 0 .../watch/multi-config-watch-opt/index.js | 1 + .../watch/multi-config-watch-opt/index2.js | 1 + .../watch/multi-config-watch-opt/test.js | 10 + .../watch/multi-config-watch-opt/test.opts | 6 + .../multi-config-watch-opt/webpack.config.js | 10 + test/binCases/watch/multi-config/async | 0 test/binCases/watch/multi-config/index.js | 1 + test/binCases/watch/multi-config/index2.js | 1 + test/binCases/watch/multi-config/test.js | 10 + .../watch/multi-config/webpack.config.js | 11 + .../watch/single-config-watch-opt/async | 0 .../watch/single-config-watch-opt/index.js | 0 .../watch/single-config-watch-opt/test.js | 10 + .../watch/single-config-watch-opt/test.opts | 6 + .../single-config-watch-opt/webpack.config.js | 5 + test/binCases/watch/single-config/async | 0 test/binCases/watch/single-config/index.js | 0 test/binCases/watch/single-config/test.js | 10 + .../watch/single-config/webpack.config.js | 6 + test/js/bin/config-name/found-many/main.js | 74 ++ test/js/bin/config-name/found-one/main.js | 74 ++ test/js/bin/configFile/profile/null.js | 90 ++ test/js/bin/entry/multi-file/null.js | 97 ++ test/js/bin/entry/named-entry/foo.js | 84 ++ test/js/bin/entry/named-entry/null.js | 85 ++ test/js/bin/entry/non-hyphenated-args/main.js | 85 ++ test/js/bin/entry/non-hyphenated-args/null.js | 84 ++ test/js/bin/errors/parse/null.js | 86 ++ test/js/bin/module/module-bind/null.js | 98 ++ .../plugins/uglifyjsplugin-empty-args/null.js | 38 + test/js/bin/stats/custom-preset/null.js | 84 ++ test/js/bin/stats/multi-config/null.js | 84 ++ test/js/bin/stats/none/null.js | 84 ++ test/js/bin/stats/single-config/null.js | 84 ++ .../bin/watch/multi-config-watch-opt/null.js | 84 ++ test/js/bin/watch/multi-config/null.js | 84 ++ .../bin/watch/single-config-watch-opt/null.js | 82 ++ test/js/bin/watch/single-config/null.js | 82 ++ 135 files changed, 4248 insertions(+), 907 deletions(-) create mode 100644 bin/prepareOptions.js create mode 100644 test/BinTestCases.test.js create mode 100644 test/binCases/config-name/found-many/index.js create mode 100644 test/binCases/config-name/found-many/index2.js create mode 100644 test/binCases/config-name/found-many/index3.js create mode 100644 test/binCases/config-name/found-many/test.js create mode 100644 test/binCases/config-name/found-many/test.opts create mode 100644 test/binCases/config-name/found-many/webpack.config.js create mode 100644 test/binCases/config-name/found-one/index.js create mode 100644 test/binCases/config-name/found-one/index2.js create mode 100644 test/binCases/config-name/found-one/test.js create mode 100644 test/binCases/config-name/found-one/test.opts create mode 100644 test/binCases/config-name/found-one/webpack.config.js create mode 100644 test/binCases/config-name/not-found/test.js create mode 100644 test/binCases/config-name/not-found/test.opts create mode 100644 test/binCases/config-name/not-found/webpack.config.js create mode 100644 test/binCases/configFile/profile/bar.js create mode 100644 test/binCases/configFile/profile/foo.js create mode 100644 test/binCases/configFile/profile/index.js create mode 100644 test/binCases/configFile/profile/test.js create mode 100644 test/binCases/configFile/profile/webpack.config.js create mode 100644 test/binCases/entry/multi-file/a.js create mode 100644 test/binCases/entry/multi-file/index.js create mode 100644 test/binCases/entry/multi-file/test.js create mode 100644 test/binCases/entry/multi-file/test.opts create mode 100644 test/binCases/entry/multi-file/webpack.config.js create mode 100644 test/binCases/entry/named-entry/a.js create mode 100644 test/binCases/entry/named-entry/index.js create mode 100644 test/binCases/entry/named-entry/test.js create mode 100644 test/binCases/entry/named-entry/test.opts create mode 100644 test/binCases/entry/named-entry/webpack.config.js create mode 100644 test/binCases/entry/non-hyphenated-args/a.js create mode 100644 test/binCases/entry/non-hyphenated-args/index.js create mode 100644 test/binCases/entry/non-hyphenated-args/test.js create mode 100644 test/binCases/entry/non-hyphenated-args/test.opts create mode 100644 test/binCases/entry/non-hyphenated-args/webpack.config.js create mode 100644 test/binCases/errors/issue-5576/a.js create mode 100644 test/binCases/errors/issue-5576/a/.keep create mode 100644 test/binCases/errors/issue-5576/test.js create mode 100644 test/binCases/errors/issue-5576/test.opts create mode 100644 test/binCases/errors/issue-5576/webpack.config.js create mode 100644 test/binCases/errors/parse/index.js create mode 100644 test/binCases/errors/parse/test.js create mode 100644 test/binCases/errors/parse/webpack.config.js create mode 100644 test/binCases/help/help-output/test.js create mode 100644 test/binCases/help/help-output/test.opts create mode 100644 test/binCases/module/module-bind/file.post create mode 100644 test/binCases/module/module-bind/file.pre create mode 100644 test/binCases/module/module-bind/index.js create mode 100644 test/binCases/module/module-bind/post-loader.js create mode 100644 test/binCases/module/module-bind/pre-loader.js create mode 100644 test/binCases/module/module-bind/test.js create mode 100644 test/binCases/module/module-bind/test.opts create mode 100644 test/binCases/module/module-bind/webpack.config.js create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/index.js create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/test.js create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/test.opts create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/webpack.config.js create mode 100644 test/binCases/stats/custom-preset/index.js create mode 100644 test/binCases/stats/custom-preset/test.js create mode 100644 test/binCases/stats/custom-preset/test.opts create mode 100644 test/binCases/stats/multi-config/index.js create mode 100644 test/binCases/stats/multi-config/index2.js create mode 100644 test/binCases/stats/multi-config/test.js create mode 100644 test/binCases/stats/multi-config/webpack.config.js create mode 100644 test/binCases/stats/none/index.js create mode 100644 test/binCases/stats/none/test.js create mode 100644 test/binCases/stats/none/webpack.config.js create mode 100644 test/binCases/stats/single-config/index.js create mode 100644 test/binCases/stats/single-config/test.js create mode 100644 test/binCases/stats/single-config/webpack.config.js create mode 100644 test/binCases/test.opts create mode 100644 test/binCases/watch/multi-config-watch-opt/async create mode 100644 test/binCases/watch/multi-config-watch-opt/index.js create mode 100644 test/binCases/watch/multi-config-watch-opt/index2.js create mode 100644 test/binCases/watch/multi-config-watch-opt/test.js create mode 100644 test/binCases/watch/multi-config-watch-opt/test.opts create mode 100644 test/binCases/watch/multi-config-watch-opt/webpack.config.js create mode 100644 test/binCases/watch/multi-config/async create mode 100644 test/binCases/watch/multi-config/index.js create mode 100644 test/binCases/watch/multi-config/index2.js create mode 100644 test/binCases/watch/multi-config/test.js create mode 100644 test/binCases/watch/multi-config/webpack.config.js create mode 100644 test/binCases/watch/single-config-watch-opt/async create mode 100644 test/binCases/watch/single-config-watch-opt/index.js create mode 100644 test/binCases/watch/single-config-watch-opt/test.js create mode 100644 test/binCases/watch/single-config-watch-opt/test.opts create mode 100644 test/binCases/watch/single-config-watch-opt/webpack.config.js create mode 100644 test/binCases/watch/single-config/async create mode 100644 test/binCases/watch/single-config/index.js create mode 100644 test/binCases/watch/single-config/test.js create mode 100644 test/binCases/watch/single-config/webpack.config.js create mode 100644 test/js/bin/config-name/found-many/main.js create mode 100644 test/js/bin/config-name/found-one/main.js create mode 100644 test/js/bin/configFile/profile/null.js create mode 100644 test/js/bin/entry/multi-file/null.js create mode 100644 test/js/bin/entry/named-entry/foo.js create mode 100644 test/js/bin/entry/named-entry/null.js create mode 100644 test/js/bin/entry/non-hyphenated-args/main.js create mode 100644 test/js/bin/entry/non-hyphenated-args/null.js create mode 100644 test/js/bin/errors/parse/null.js create mode 100644 test/js/bin/module/module-bind/null.js create mode 100644 test/js/bin/plugins/uglifyjsplugin-empty-args/null.js create mode 100644 test/js/bin/stats/custom-preset/null.js create mode 100644 test/js/bin/stats/multi-config/null.js create mode 100644 test/js/bin/stats/none/null.js create mode 100644 test/js/bin/stats/single-config/null.js create mode 100644 test/js/bin/watch/multi-config-watch-opt/null.js create mode 100644 test/js/bin/watch/multi-config/null.js create mode 100644 test/js/bin/watch/single-config-watch-opt/null.js create mode 100644 test/js/bin/watch/single-config/null.js diff --git a/.eslintignore b/.eslintignore index 2eee14cbe2a..a62988d01bf 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ **/__testfixtures__/* coverage +test diff --git a/.gitignore b/.gitignore index 79960dd2d49..3d29695d9be 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ yarn-error.log # Jest Coverage coverage + +# Dist build +dist diff --git a/bin/config-yargs.js b/bin/config-yargs.js index c7ca20a2b67..a4b6cec19f6 100644 --- a/bin/config-yargs.js +++ b/bin/config-yargs.js @@ -10,7 +10,7 @@ var INIT_GROUP = "Initialization:"; module.exports = function(yargs) { yargs .help("help") - .alias("help", "h", "?") + .alias("help", "h") .version() .alias("version", "v") .options({ diff --git a/bin/convert-argv.js b/bin/convert-argv.js index 29dc5062918..aa77df656fa 100644 --- a/bin/convert-argv.js +++ b/bin/convert-argv.js @@ -1,9 +1,8 @@ -"use strict"; - var path = require("path"); var fs = require("fs"); fs.existsSync = fs.existsSync || path.existsSync; var interpret = require("interpret"); +var prepareOptions = require("./prepareOptions"); module.exports = function(yargs, argv, convertOptions) { var options = []; @@ -20,7 +19,7 @@ module.exports = function(yargs, argv, convertOptions) { argv["optimize-minimize"] = true; argv["define"] = [] .concat(argv["define"] || []) - .concat("process.env.NODE_ENV='production'"); + .concat("process.env.NODE_ENV=\"production\""); } var configFileLoaded = false; @@ -103,14 +102,7 @@ module.exports = function(yargs, argv, convertOptions) { 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); - } + options = prepareOptions(options, argv); return options; }; @@ -134,7 +126,7 @@ module.exports = function(yargs, argv, convertOptions) { console.error( "Config did not export an object or a function returning an object." ); - process.exit(-1); + process.exit(-1); // eslint-disable-line } // process Promise @@ -147,6 +139,22 @@ module.exports = function(yargs, argv, convertOptions) { return processConfiguredOptions(options.default); } + // filter multi-config by name + if (Array.isArray(options) && argv["config-name"]) { + var namedOptions = options.filter(function(opt) { + return opt.name === argv["config-name"]; + }); + if (namedOptions.length === 0) { + console.error( + "Configuration with name '" + argv["config-name"] + "' was not found." + ); + process.exit(-1); // eslint-disable-line + } else if (namedOptions.length === 1) { + return processConfiguredOptions(namedOptions[0]); + } + options = namedOptions; + } + if (Array.isArray(options)) { options.forEach(processOptions); } else { @@ -169,11 +177,12 @@ module.exports = function(yargs, argv, convertOptions) { options.watchOptions.aggregateTimeout = +argv["watch-aggregate-timeout"]; } - if (argv["watch-poll"]) { + if (typeof argv["watch-poll"] !== undefined) { options.watchOptions = options.watchOptions || {}; - if (typeof argv["watch-poll"] !== "boolean") + if (argv["watch-poll"] === "true" || argv["watch-poll"] === "") + options.watchOptions.poll = true; + else if (!isNaN(argv["watch-poll"])) options.watchOptions.poll = +argv["watch-poll"]; - else options.watchOptions.poll = true; } if (argv["watch-stdin"]) { @@ -233,21 +242,22 @@ module.exports = function(yargs, argv, convertOptions) { } function mapArgToBoolean(name, optionName) { + if (options[optionName || name]) { + options[name] = true; + } + //eslint-disable-next-line + if (name && options[name] == true) { + return; + } ifArg(name, function(bool) { if (bool === true) options[optionName || name] = true; else if (bool === false) options[optionName || name] = false; }); } - //eslint-disable-next-line - function mapArgToPath(name, optionName) { - ifArg(name, function(str) { - options[optionName || name] = path.resolve(str); - }); - } function loadPlugin(name) { var loadUtils = require("loader-utils"); - var args = null; + var args; try { var p = name && name.indexOf("?"); if (p > -1) { @@ -256,7 +266,7 @@ module.exports = function(yargs, argv, convertOptions) { } } catch (e) { console.log("Invalid plugin arguments " + name + " (" + e + ")."); - process.exit(-1); + process.exit(-1); // eslint-disable-line } var path; @@ -265,7 +275,7 @@ module.exports = function(yargs, argv, convertOptions) { path = resolve.sync(process.cwd(), name); } catch (e) { console.log("Cannot resolve plugin " + name + "."); - process.exit(-1); + process.exit(-1); // eslint-disable-line } var Plugin; try { @@ -297,14 +307,21 @@ module.exports = function(yargs, argv, convertOptions) { ifArgPair( "entry", function(name, entry) { - options.entry[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) { + function bindRules(arg) { ifArgPair( arg, function(name, binding) { @@ -312,28 +329,31 @@ module.exports = function(yargs, argv, convertOptions) { name = binding; binding += "-loader"; } - options.module[collection].push({ + var rule = { + /* eslint-disable no-useless-escape */ test: new RegExp( "\\." + - // eslint thinks that the escapes are useless, - // however, when testing them, the special regex chars - // mess up with the regex we want to use to check. - // eslint-disable-next-line name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "$" - ), + ) /* eslint-enable no-useless-escape */, loader: binding - }); + }; + if (arg === "module-bind-pre") { + rule.enforce = "pre"; + } else if (arg === "module-bind-post") { + rule.enforce = "post"; + } + options.module.rules.push(rule); }, function() { ensureObject(options, "module"); - ensureArray(options.module, collection); + ensureArray(options.module, "rules"); } ); } - bindLoaders("module-bind", "loaders"); - bindLoaders("module-bind-pre", "preLoaders"); - bindLoaders("module-bind-post", "postLoaders"); + bindRules("module-bind"); + bindRules("module-bind-pre"); + bindRules("module-bind-post"); var defineObject; ifArgPair( @@ -357,7 +377,7 @@ module.exports = function(yargs, argv, convertOptions) { ifArg("output-path", function(value) { ensureObject(options, "output"); - options.output.path = value; + options.output.path = path.resolve(value); }); ifArg("output-filename", function(value) { @@ -502,7 +522,7 @@ module.exports = function(yargs, argv, convertOptions) { ifArg("prefetch", function(request) { ensureArray(options, "plugins"); - var PrefetchPlugin = require("webpack/PrefetchPlugin"); + var PrefetchPlugin = require("webpack/lib/PrefetchPlugin"); options.plugins.push(new PrefetchPlugin(request)); }); @@ -516,16 +536,10 @@ module.exports = function(yargs, argv, convertOptions) { } else { name = value; } - var ProvidePlugin = require("webpack/ProvidePlugin"); + var ProvidePlugin = require("webpack/lib/ProvidePlugin"); options.plugins.push(new ProvidePlugin(name, value)); }); - ifBooleanArg("labeled-modules", function() { - ensureArray(options, "plugins"); - var LabeledModulesPlugin = require("webpack/lib/dependencies/LabeledModulesPlugin"); - options.plugins.push(new LabeledModulesPlugin()); - }); - ifArg("plugin", function(value) { ensureArray(options, "plugins"); options.plugins.push(loadPlugin(value)); @@ -534,15 +548,18 @@ module.exports = function(yargs, argv, convertOptions) { mapArgToBoolean("bail"); mapArgToBoolean("profile"); - if (noOutputFilenameDefined) { ensureObject(options, "output"); if (convertOptions && convertOptions.outputFilename) { - options.output.path = path.dirname(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.dirname(options.output.filename); + options.output.path = path.resolve( + path.dirname(options.output.filename) + ); options.output.filename = path.basename(options.output.filename); } else if (configFileLoaded) { throw new Error( @@ -556,7 +573,7 @@ module.exports = function(yargs, argv, convertOptions) { "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); + process.exit(-1); // eslint-disable-line } } @@ -584,7 +601,12 @@ module.exports = function(yargs, argv, convertOptions) { if (i < 0 || (j >= 0 && j < i)) { var resolved = path.resolve(content); if (fs.existsSync(resolved)) { - addTo("main", resolved); + addTo( + "main", + `${resolved}${fs.statSync(resolved).isDirectory() + ? path.sep + : ""}` + ); } else { addTo("main", content); } @@ -609,7 +631,7 @@ module.exports = function(yargs, argv, convertOptions) { ); } console.error("Use --help to display the CLI options."); - process.exit(-1); + process.exit(-1); // eslint-disable-line } } }; diff --git a/bin/prepareOptions.js b/bin/prepareOptions.js new file mode 100644 index 00000000000..09d83469dba --- /dev/null +++ b/bin/prepareOptions.js @@ -0,0 +1,30 @@ +"use strict"; + +module.exports = function prepareOptions(options, argv) { + argv = argv || {}; + + options = handleExport(options); + + if (Array.isArray(options)) { + options = options.map(_options => handleFunction(_options, argv)); + } else { + options = handleFunction(options, argv); + } + return options; +}; + +function handleExport(options) { + const isES6DefaultExported = + typeof options === "object" && + options !== null && + typeof options.default !== "undefined"; + options = isES6DefaultExported ? options.default : options; + return options; +} + +function handleFunction(options, argv) { + if (typeof options === "function") { + options = options(argv.env, argv); + } + return options; +} diff --git a/bin/webpack.js b/bin/webpack.js index 19e31709f9a..829f712999d 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -1,26 +1,35 @@ #!/usr/bin/env node + /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ -"use strict"; - var path = require("path"); var resolveCwd = require("resolve-cwd"); - +// Local version replace global one var localCLI = resolveCwd.silent("webpack-cli/bin/webpack"); +if (process.argv.slice(2).includes("init")) { + const initPkgs = + process.argv.slice(2).length === 1 ? [] : [process.argv.slice(2).pop()]; + + return require("../dist/initialize")(initPkgs); +} else if (process.argv.slice(2).includes("migrate")) { + const filePaths = + process.argv.slice(2).length === 1 ? [] : [process.argv.slice(2).pop()]; + if (!filePaths.length) { + throw new Error("Please specify a path to your webpack config"); + } + const inputConfigPath = path.resolve(process.cwd(), filePaths[0]); + + return require("../dist/migrate.js")(inputConfigPath, inputConfigPath); +} if (localCLI && path.relative(localCLI, __filename) !== "") { - require(localCLI); + return require(localCLI); } else { - try { - require("./webpack"); - } catch (err) { - console.error(`\n ${err.message}`); - process.exitCode = 1; - } + return require("webpack/bin/webpack"); } - +// eslint-disable-next-line var yargs = require("yargs").usage( "webpack " + require("../package.json").version + @@ -29,8 +38,8 @@ var yargs = require("yargs").usage( "Usage without config file: webpack [] \n" + "Usage with config file: webpack" ); -require("./config-yargs")(yargs); +require("./config-yargs")(yargs); var DISPLAY_GROUP = "Stats options:"; var BASIC_GROUP = "Basic options:"; @@ -134,258 +143,262 @@ yargs.options({ group: DISPLAY_GROUP, describe: "Display information about exports provided from modules" }, + "display-optimization-bailout": { + type: "boolean", + group: DISPLAY_GROUP, + describe: + "Display information about why optimization bailed out for modules" + }, "display-error-details": { type: "boolean", group: DISPLAY_GROUP, describe: "Display details about errors" }, + display: { + type: "string", + group: DISPLAY_GROUP, + describe: + "Select display preset (verbose, detailed, normal, minimal, errors-only, none)" + }, verbose: { type: "boolean", group: DISPLAY_GROUP, describe: "Show more details" } }); +// yargs will terminate the process early when the user uses help or version. +// This causes large help outputs to be cut short (https://github.com/nodejs/node/wiki/API-changes-between-v0.10-and-v4#process). +// To prevent this we use the yargs.parse API and exit the process normally -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; -} -if (argv._.includes("init")) { - const initPkgs = argv._.length === 1 ? [] : [argv._.pop()]; - - return require("../lib/initialize")(initPkgs); -} else if (argv._.includes("migrate")) { - const filePaths = argv._.length === 1 ? [] : [argv._.pop()]; - if (!filePaths.length) { - throw new Error("Please specify a path to your webpack config"); - } - const inputConfigPath = path.resolve(process.cwd(), filePaths[0]); - - return require("../lib/migrate.js")(inputConfigPath, inputConfigPath); -} else { - var options = require("./convert-argv")(yargs, argv); - - return processOptions(options); -} - -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); - } -} //eslint-disable-next-line -function processOptions(options) { - // process Promise - if (typeof options.then === "function") { - options.then(processOptions).catch(function(err) { - console.error(err.stack || err); - process.exitCode = -1; - }); +yargs.parse(process.argv.slice(2), (err, argv, output) => { + // arguments validation failed + if (err && output) { + console.error(output); + process.exitCode = 1; return; } - - var firstOptions = [].concat(options)[0]; - var statsPresetToOptions = require("webpack/lib/Stats.js").presetToOptions; - - var outputOptions = options.stats; - if (typeof outputOptions === "boolean" || typeof outputOptions === "string") { - outputOptions = statsPresetToOptions(outputOptions); - } else if (!outputOptions) { - outputOptions = {}; + if (output) { + console.log(output); + return; } - outputOptions = Object.create(outputOptions); - if (Array.isArray(options) && !outputOptions.children) { - outputOptions.children = options.map(o => o.stats); + if (argv.verbose) { + argv["display"] = "verbose"; } - 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"); + var options = require("./convert-argv")(yargs, argv); - ifArg("sort-modules-by", function(value) { - outputOptions.modulesSort = value; - }); + 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); + } + } - ifArg("sort-chunks-by", function(value) { - outputOptions.chunksSort = value; - }); + 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; + } - ifArg("sort-assets-by", function(value) { - outputOptions.assetsSort = value; - }); + var firstOptions = [].concat(options)[0]; + var statsPresetToOptions = require("webpack/lib/Stats.js").presetToOptions; + + var outputOptions = options.stats; + if ( + typeof outputOptions === "boolean" || + typeof outputOptions === "string" + ) { + outputOptions = statsPresetToOptions(outputOptions); + } else if (!outputOptions) { + outputOptions = {}; + } - ifArg("display-exclude", function(value) { - outputOptions.exclude = value; - }); + ifArg("display", function(preset) { + outputOptions = statsPresetToOptions(preset); + }); - if (!outputOptions.json) { - if (typeof outputOptions.cached === "undefined") - outputOptions.cached = false; - if (typeof outputOptions.cachedAssets === "undefined") - outputOptions.cachedAssets = false; + 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("display-chunks", function(bool) { - outputOptions.modules = !bool; - outputOptions.chunks = bool; + ifArg("json", function(bool) { + if (bool) outputOptions.json = bool; }); - ifArg("display-entrypoints", function(bool) { - outputOptions.entrypoints = bool; - }); + if (typeof outputOptions.colors === "undefined") + outputOptions.colors = require("supports-color"); - ifArg("display-reasons", function(bool) { - outputOptions.reasons = bool; + ifArg("sort-modules-by", function(value) { + outputOptions.modulesSort = value; }); - ifArg("display-depth", function(bool) { - outputOptions.depth = bool; + ifArg("sort-chunks-by", function(value) { + outputOptions.chunksSort = value; }); - ifArg("display-used-exports", function(bool) { - outputOptions.usedExports = bool; + ifArg("sort-assets-by", function(value) { + outputOptions.assetsSort = value; }); - ifArg("display-provided-exports", function(bool) { - outputOptions.providedExports = bool; + ifArg("display-exclude", function(value) { + outputOptions.exclude = value; }); - ifArg("display-error-details", function(bool) { - outputOptions.errorDetails = bool; - }); + if (!outputOptions.json) { + if (typeof outputOptions.cached === "undefined") + outputOptions.cached = false; + if (typeof outputOptions.cachedAssets === "undefined") + outputOptions.cachedAssets = false; + + ifArg("display-chunks", function(bool) { + if (bool) { + outputOptions.modules = false; + outputOptions.chunks = true; + outputOptions.chunkModules = true; + } + }); - ifArg("display-origins", function(bool) { - outputOptions.chunkOrigins = bool; - }); + ifArg("display-entrypoints", function(bool) { + if (bool) outputOptions.entrypoints = true; + }); - ifArg("display-max-modules", function(value) { - outputOptions.maxModules = value; - }); + ifArg("display-reasons", function(bool) { + if (bool) outputOptions.reasons = true; + }); - ifArg("display-cached", function(bool) { - if (bool) outputOptions.cached = true; - }); + ifArg("display-depth", function(bool) { + if (bool) outputOptions.depth = true; + }); - ifArg("display-cached-assets", function(bool) { - if (bool) outputOptions.cachedAssets = true; - }); + ifArg("display-used-exports", function(bool) { + if (bool) outputOptions.usedExports = true; + }); - if (!outputOptions.exclude) - outputOptions.exclude = [ - "node_modules", - "bower_components", - "components" - ]; + ifArg("display-provided-exports", function(bool) { + if (bool) outputOptions.providedExports = true; + }); - 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("display-optimization-bailout", function(bool) { + if (bool) outputOptions.optimizationBailout = bool; + }); - ifArg("hide-modules", function(bool) { - if (bool) { - outputOptions.modules = false; - outputOptions.chunkModules = false; - } - }); - - var webpack = require("webpack/lib/webpack.js"); - - Error.stackTraceLimit = 30; - var lastHash = null; - var compiler; - try { - compiler = webpack(options); - } catch (e) { - var WebpackOptionsValidationError = require("webpack/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.exitCode = 1; - } - throw e; - } + ifArg("display-error-details", function(bool) { + if (bool) outputOptions.errorDetails = true; + }); - if (argv.progress) { - var ProgressPlugin = require("webpack/lib/ProgressPlugin"); - compiler.apply( - new ProgressPlugin({ - profile: argv.profile - }) - ); - } + ifArg("display-origins", function(bool) { + if (bool) outputOptions.chunkOrigins = true; + }); + + 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; + }); - function compilerCallback(err, stats) { - if (!options.watch || err) { - // Do not keep cache anymore - compiler.purgeInputFileSystem(); + if (!outputOptions.exclude) + outputOptions.exclude = [ + "node_modules", + "bower_components", + "components" + ]; + + if (argv["display-modules"]) { + outputOptions.maxModules = Infinity; + outputOptions.exclude = undefined; + outputOptions.modules = true; + } } - if (err) { - lastHash = null; - console.error(err.stack || err); - if (err.details) console.error(err.details); - process.exitCode = 1; + + ifArg("hide-modules", function(bool) { + if (bool) { + outputOptions.modules = false; + outputOptions.chunkModules = false; + } + }); + + var webpack = require("webpack/lib/webpack.js"); + + Error.stackTraceLimit = 30; + var lastHash = null; + var compiler; + try { + compiler = webpack(options); + } catch (e) { + var WebpackOptionsValidationError = require("webpack/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 (outputOptions.json) { - process.stdout.write( - JSON.stringify(stats.toJson(outputOptions), null, 2) + "\n" + if (argv.progress) { + var ProgressPlugin = require("webpack/lib/ProgressPlugin"); + compiler.apply( + new ProgressPlugin({ + profile: argv.profile + }) ); - } else if (stats.hash !== lastHash) { - lastHash = stats.hash; - process.stdout.write(stats.toString(outputOptions) + "\n"); } - if (!options.watch && stats.hasErrors()) { - process.on("exit", function() { + + 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; + var statsString = stats.toString(outputOptions); + if (statsString) process.stdout.write(statsString + "\n"); + } + if (!options.watch && stats.hasErrors()) { process.exitCode = 2; - }); + } } + if (firstOptions.watch || options.watch) { + var watchOptions = + firstOptions.watchOptions || firstOptions.watch || options.watch || {}; + if (watchOptions.stdin) { + process.stdin.on("end", function() { + process.exit(); // eslint-disable-line + }); + process.stdin.resume(); + } + compiler.watch(watchOptions, compilerCallback); + console.log("\nWebpack is watching the files…\n"); + } else compiler.run(compilerCallback); } - if (firstOptions.watch || options.watch) { - var watchOptions = - firstOptions.watchOptions || firstOptions.watch || options.watch || {}; - if (watchOptions.stdin) { - process.stdin.on("end", function() { - process.exitCode = 0; - }); - process.stdin.resume(); - } - compiler.watch(watchOptions, compilerCallback); - console.log("\nWebpack is watching the files…\n"); - } else compiler.run(compilerCallback); -} + + processOptions(options); +}); diff --git a/lib/creator/yeoman/utils/entry.js b/lib/creator/yeoman/utils/entry.js index a21ae95eabc..027499c9610 100644 --- a/lib/creator/yeoman/utils/entry.js +++ b/lib/creator/yeoman/utils/entry.js @@ -7,69 +7,75 @@ module.exports = (self, answer) => { let entryIdentifiers; let result; if (answer["entryType"] === true) { - result = self.prompt([ - InputValidate( - "multipleEntries", - "Type the names you want for your modules (entry files), separated by comma [example: 'app,vendor']", - validate - ) - ]).then(multipleEntriesAnswer => { - let webpackEntryPoint = {}; - entryIdentifiers = multipleEntriesAnswer["multipleEntries"].split(","); - function forEachPromise(obj, fn) { - return obj.reduce(function(promise, prop) { - const trimmedProp = prop.trim(); - return promise.then(n => { - if (n) { - Object.keys(n).forEach((val) => { - if ( - n[val].charAt(0) !== "(" - && n[val].charAt(0) !== "[" - && n[val].indexOf("function") < 0 - && n[val].indexOf("path") < 0 - && n[val].indexOf("process") < 0 - ) { - n[val] = `"${n[val]}.js"`; - } - webpackEntryPoint[val] = n[val]; - }); - } else { - n = {}; - } - return fn(trimmedProp); - }); - }, Promise.resolve()); - } - return forEachPromise(entryIdentifiers, (entryProp) => self.prompt([ + result = self + .prompt([ InputValidate( - `${entryProp}`, - `What is the location of "${entryProp}"? [example: "./src/${entryProp}"]`, + "multipleEntries", + "Type the names you want for your modules (entry files), separated by comma [example: 'app,vendor']", validate ) - ])).then(propAns => { - Object.keys(propAns).forEach((val) => { - if ( - propAns[val].charAt(0) !== "(" - && propAns[val].charAt(0) !== "[" - && propAns[val].indexOf("function") < 0 - && propAns[val].indexOf("path") < 0 - && propAns[val].indexOf("process") < 0 - ) { - propAns[val] = `"${propAns[val]}.js"`; - } - webpackEntryPoint[val] = propAns[val]; + ]) + .then(multipleEntriesAnswer => { + let webpackEntryPoint = {}; + entryIdentifiers = multipleEntriesAnswer["multipleEntries"].split(","); + function forEachPromise(obj, fn) { + return obj.reduce(function(promise, prop) { + const trimmedProp = prop.trim(); + return promise.then(n => { + if (n) { + Object.keys(n).forEach(val => { + if ( + n[val].charAt(0) !== "(" && + n[val].charAt(0) !== "[" && + n[val].indexOf("function") < 0 && + n[val].indexOf("path") < 0 && + n[val].indexOf("process") < 0 + ) { + n[val] = `"${n[val]}.js"`; + } + webpackEntryPoint[val] = n[val]; + }); + } else { + n = {}; + } + return fn(trimmedProp); + }); + }, Promise.resolve()); + } + return forEachPromise(entryIdentifiers, entryProp => + self.prompt([ + InputValidate( + `${entryProp}`, + `What is the location of "${entryProp}"? [example: "./src/${entryProp}"]`, + validate + ) + ]) + ).then(propAns => { + Object.keys(propAns).forEach(val => { + if ( + propAns[val].charAt(0) !== "(" && + propAns[val].charAt(0) !== "[" && + propAns[val].indexOf("function") < 0 && + propAns[val].indexOf("path") < 0 && + propAns[val].indexOf("process") < 0 + ) { + propAns[val] = `"${propAns[val]}.js"`; + } + webpackEntryPoint[val] = propAns[val]; + }); + return webpackEntryPoint; }); - return webpackEntryPoint; }); - }); } else { - result = self.prompt([ - InputValidate( - "singularEntry", - "Which module will be the first to enter the application? [example: './src/index']", - validate - ) - ]).then((singularAnswer) => `"${singularAnswer["singularEntry"]}"`); + result = self + .prompt([ + InputValidate( + "singularEntry", + "Which module will be the first to enter the application? [example: './src/index']", + validate + ) + ]) + .then(singularAnswer => `"${singularAnswer["singularEntry"]}"`); } return result; }; diff --git a/lib/creator/yeoman/webpack-generator.js b/lib/creator/yeoman/webpack-generator.js index 08b5018f45c..f959dcc9ad6 100644 --- a/lib/creator/yeoman/webpack-generator.js +++ b/lib/creator/yeoman/webpack-generator.js @@ -3,7 +3,8 @@ const Generator = require("yeoman-generator"); const chalk = require("chalk"); -const createCommonsChunkPlugin = require("webpack-addons").createCommonsChunkPlugin; +const createCommonsChunkPlugin = require("webpack-addons") + .createCommonsChunkPlugin; const Input = require("webpack-addons").Input; const Confirm = require("webpack-addons").Confirm; @@ -37,7 +38,9 @@ module.exports = class WebpackGenerator extends Generator { `\n${chalk.bold("Insecure about some of the questions?")}\n` ); process.stdout.write( - `\n${chalk.bold.green("https://github.com/webpack/webpack-cli/blob/master/INIT.md")}\n\n` + `\n${chalk.bold.green( + "https://github.com/webpack/webpack-cli/blob/master/INIT.md" + )}\n\n` ); this.configuration.config.webpackOptions.module = { rules: [] @@ -54,68 +57,88 @@ module.exports = class WebpackGenerator extends Generator { Confirm("entryType", "Will your application have multiple bundles?") ]).then(entryTypeAnswer => { // Ask different questions for entry points - entryQuestions(self, entryTypeAnswer).then(entryOptions => { - this.configuration.config.webpackOptions.entry = entryOptions; - oneOrMoreEntries = Object.keys(entryOptions); - }).then(() => { - this.prompt([ - Input( - "outputType", - "Which folder will your generated bundles be in? [default: dist]:" - ) - ]).then(outputTypeAnswer => { - if (!this.configuration.config.webpackOptions.entry.length) { - this.configuration.config.topScope.push(tooltip.commonsChunk()); - this.configuration.config.webpackOptions.output = { - filename: "'[name].[chunkhash].js'", - chunkFilename: "'[name].[chunkhash].js'" - }; - } else { - this.configuration.config.webpackOptions.output = { - filename: "'[name].bundle.js'", - }; - } - if (outputTypeAnswer["outputType"].length) { - outputPath = outputTypeAnswer["outputType"]; - } - this.configuration.config.webpackOptions.output.path = `path.resolve(__dirname, '${outputPath}')`; - }).then(() => { + entryQuestions(self, entryTypeAnswer) + .then(entryOptions => { + this.configuration.config.webpackOptions.entry = entryOptions; + oneOrMoreEntries = Object.keys(entryOptions); + }) + .then(() => { this.prompt([ - Confirm("prodConfirm", "Are you going to use this in production?") - ]).then(prodAnswer => { - if (prodAnswer["prodConfirm"] === true) { - this.isProd = true; - } else { - this.isProd = false; - } - }).then(() => { - this.prompt([ - Confirm("babelConfirm", "Will you be using ES2015?") - ]).then(ans => { - if (ans["babelConfirm"] === true) { - this.configuration.config.webpackOptions.module.rules.push(getBabelPlugin()); - this.npmInstalls.push("babel-loader", "babel-core", "babel-preset-es2015"); + Input( + "outputType", + "Which folder will your generated bundles be in? [default: dist]:" + ) + ]) + .then(outputTypeAnswer => { + if (!this.configuration.config.webpackOptions.entry.length) { + this.configuration.config.topScope.push(tooltip.commonsChunk()); + this.configuration.config.webpackOptions.output = { + filename: "'[name].[chunkhash].js'", + chunkFilename: "'[name].[chunkhash].js'" + }; + } else { + this.configuration.config.webpackOptions.output = { + filename: "'[name].bundle.js'" + }; } - }).then(() => { + if (outputTypeAnswer["outputType"].length) { + outputPath = outputTypeAnswer["outputType"]; + } + this.configuration.config.webpackOptions.output.path = `path.resolve(__dirname, '${outputPath}')`; + }) + .then(() => { this.prompt([ - RawList( - "stylingType", - "Will you use one of the below CSS solutions?", - ["SASS", "LESS", "CSS", "PostCSS", "No"] + Confirm( + "prodConfirm", + "Are you going to use this in production?" ) - ]).then(stylingAnswer => { - if (!this.isProd) { - ExtractUseProps = []; - } - switch (stylingAnswer["stylingType"]) { - case "SASS": - this.npmInstalls.push( - "sass-loader", "node-sass", - "style-loader", "css-loader" - ); - regExpForStyles = new RegExp(/\.(scss|css)$/); - if (this.isProd) { - ExtractUseProps = `use: [{ + ]) + .then(prodAnswer => { + if (prodAnswer["prodConfirm"] === true) { + this.isProd = true; + } else { + this.isProd = false; + } + }) + .then(() => { + this.prompt([ + Confirm("babelConfirm", "Will you be using ES2015?") + ]) + .then(ans => { + if (ans["babelConfirm"] === true) { + this.configuration.config.webpackOptions.module.rules.push( + getBabelPlugin() + ); + this.npmInstalls.push( + "babel-loader", + "babel-core", + "babel-preset-es2015" + ); + } + }) + .then(() => { + this.prompt([ + RawList( + "stylingType", + "Will you use one of the below CSS solutions?", + ["SASS", "LESS", "CSS", "PostCSS", "No"] + ) + ]) + .then(stylingAnswer => { + if (!this.isProd) { + ExtractUseProps = []; + } + switch (stylingAnswer["stylingType"]) { + case "SASS": + this.npmInstalls.push( + "sass-loader", + "node-sass", + "style-loader", + "css-loader" + ); + regExpForStyles = new RegExp(/\.(scss|css)$/); + if (this.isProd) { + ExtractUseProps = `use: [{ loader: "css-loader", options: { sourceMap: true @@ -127,24 +150,30 @@ module.exports = class WebpackGenerator extends Generator { } }], fallback: "style-loader"`; - } else { - ExtractUseProps.push({ - loader: "'style-loader'" - }, { - loader: "'css-loader'" - }, { - loader: "'sass-loader'" - }); - } - break; - case "LESS": - regExpForStyles = new RegExp(/\.(less|css)$/); - this.npmInstalls.push( - "less-loader", "less", - "style-loader", "css-loader" - ); - if (this.isProd) { - ExtractUseProps = ` + } else { + ExtractUseProps.push( + { + loader: "'style-loader'" + }, + { + loader: "'css-loader'" + }, + { + loader: "'sass-loader'" + } + ); + } + break; + case "LESS": + regExpForStyles = new RegExp(/\.(less|css)$/); + this.npmInstalls.push( + "less-loader", + "less", + "style-loader", + "css-loader" + ); + if (this.isProd) { + ExtractUseProps = ` use: [{ loader: "css-loader", options: { @@ -157,35 +186,40 @@ module.exports = class WebpackGenerator extends Generator { } }], fallback: "style-loader"`; - } else { - ExtractUseProps.push({ - loader: "'css-loader'", - options: { - sourceMap: true - } - }, { - loader: "'less-loader'", - options: { - sourceMap: true - } - }); - } - break; - case "PostCSS": - this.configuration.config.topScope.push( - tooltip.postcss(), - "const autoprefixer = require('autoprefixer');", - "const precss = require('precss');", - "\n" - ); - this.npmInstalls.push( - "style-loader", "css-loader", - "postcss-loader", "precss", - "autoprefixer" - ); - regExpForStyles = new RegExp(/\.css$/); - if (this.isProd) { - ExtractUseProps = ` + } else { + ExtractUseProps.push( + { + loader: "'css-loader'", + options: { + sourceMap: true + } + }, + { + loader: "'less-loader'", + options: { + sourceMap: true + } + } + ); + } + break; + case "PostCSS": + this.configuration.config.topScope.push( + tooltip.postcss(), + "const autoprefixer = require('autoprefixer');", + "const precss = require('precss');", + "\n" + ); + this.npmInstalls.push( + "style-loader", + "css-loader", + "postcss-loader", + "precss", + "autoprefixer" + ); + regExpForStyles = new RegExp(/\.css$/); + if (this.isProd) { + ExtractUseProps = ` use: [{ loader: "style-loader" },{ @@ -206,133 +240,157 @@ module.exports = class WebpackGenerator extends Generator { } }], fallback: "style-loader"`; - } else { - ExtractUseProps.push({ - loader: "'style-loader'" - },{ - loader: "'css-loader'", - options: { - sourceMap: true, - importLoaders: 1 - } - }, { - loader: "'postcss-loader'", - options: { - plugins: `function () { + } else { + ExtractUseProps.push( + { + loader: "'style-loader'" + }, + { + loader: "'css-loader'", + options: { + sourceMap: true, + importLoaders: 1 + } + }, + { + loader: "'postcss-loader'", + options: { + plugins: `function () { return [ precss, autoprefixer ]; }` - } - }); - } - break; - case "CSS": - this.npmInstalls.push("style-loader", "css-loader"); - regExpForStyles = new RegExp(/\.css$/); - if (this.isProd) { - ExtractUseProps = `use: [{ + } + } + ); + } + break; + case "CSS": + this.npmInstalls.push( + "style-loader", + "css-loader" + ); + regExpForStyles = new RegExp(/\.css$/); + if (this.isProd) { + ExtractUseProps = `use: [{ loader: "css-loader", options: { sourceMap: true } }], fallback: "style-loader"`; - } else { - ExtractUseProps.push({ - loader: "'style-loader'", - options: { - sourceMap: true - } - }, { - loader: "'css-loader'", - }); - } - break; - default: - regExpForStyles = null; - } - }).then(() => { - // Ask if the user wants to use extractPlugin - this.prompt([ - Input( - "extractPlugin", - "If you want to bundle your CSS files, what will you name the bundle? (press enter to skip)" - ) - ]).then(extractAnswer => { - if (regExpForStyles) { - if (this.isProd) { - - this.configuration.config.topScope.push(tooltip.cssPlugin()); - this.npmInstalls.push("extract-text-webpack-plugin"); - if (extractAnswer["extractPlugin"].length !== 0) { - this.configuration.config.webpackOptions.plugins.push( - "new ExtractTextPlugin('" + - extractAnswer["extractPlugin"] + - ".[contentHash].css')" - ); - } else { - this.configuration.config.webpackOptions.plugins.push( - "new ExtractTextPlugin('" + - "style.css')" - ); - } - const moduleRulesObj = { - test: regExpForStyles, - use: `ExtractTextPlugin.extract({ + } else { + ExtractUseProps.push( + { + loader: "'style-loader'", + options: { + sourceMap: true + } + }, + { + loader: "'css-loader'" + } + ); + } + break; + default: + regExpForStyles = null; + } + }) + .then(() => { + // Ask if the user wants to use extractPlugin + this.prompt([ + Input( + "extractPlugin", + "If you want to bundle your CSS files, what will you name the bundle? (press enter to skip)" + ) + ]) + .then(extractAnswer => { + if (regExpForStyles) { + if (this.isProd) { + this.configuration.config.topScope.push( + tooltip.cssPlugin() + ); + this.npmInstalls.push( + "extract-text-webpack-plugin" + ); + if ( + extractAnswer["extractPlugin"].length !== 0 + ) { + this.configuration.config.webpackOptions.plugins.push( + "new ExtractTextPlugin('" + + extractAnswer["extractPlugin"] + + ".[contentHash].css')" + ); + } else { + this.configuration.config.webpackOptions.plugins.push( + "new ExtractTextPlugin('" + "style.css')" + ); + } + const moduleRulesObj = { + test: regExpForStyles, + use: `ExtractTextPlugin.extract({ ${ExtractUseProps} })` - }; - this.configuration.config.webpackOptions.module.rules.push( - moduleRulesObj - ); - this.configuration.config.topScope.push( - "const ExtractTextPlugin = require('extract-text-webpack-plugin');", - "\n" - ); - } else { - const moduleRulesObj = { - test: regExpForStyles, - use: ExtractUseProps - }; - this.configuration.config.webpackOptions.module.rules.push( - moduleRulesObj - ); - } - } - }).then(() => { - if (!this.configuration.config.webpackOptions.entry.length) { - oneOrMoreEntries.forEach(prop => { - this.configuration.config.webpackOptions.plugins.push( - createCommonsChunkPlugin(prop) - ); + }; + this.configuration.config.webpackOptions.module.rules.push( + moduleRulesObj + ); + this.configuration.config.topScope.push( + "const ExtractTextPlugin = require('extract-text-webpack-plugin');", + "\n" + ); + } else { + const moduleRulesObj = { + test: regExpForStyles, + use: ExtractUseProps + }; + this.configuration.config.webpackOptions.module.rules.push( + moduleRulesObj + ); + } + } + }) + .then(() => { + if ( + !this.configuration.config.webpackOptions.entry + .length + ) { + oneOrMoreEntries.forEach(prop => { + this.configuration.config.webpackOptions.plugins.push( + createCommonsChunkPlugin(prop) + ); + }); + } + done(); + }); + }); }); - } - done(); }); - }); }); - }); }); - }); }); } installPlugins() { let asyncNamePrompt = this.async(); let defaultName = this.isProd ? "prod" : "config"; this.prompt([ - Input("nameType", `Name your 'webpack.[name].js?' [default: '${defaultName}']:`) - ]).then(nameAnswer => { - if (nameAnswer["nameType"].length) { - this.configuration.config.configName = nameAnswer["nameType"]; - } else { - this.configuration.config.configName = defaultName; - } - }).then(() => { - asyncNamePrompt(); - this.npmInstall(this.npmInstalls, { "save-dev": true }); - }); + Input( + "nameType", + `Name your 'webpack.[name].js?' [default: '${defaultName}']:` + ) + ]) + .then(nameAnswer => { + if (nameAnswer["nameType"].length) { + this.configuration.config.configName = nameAnswer["nameType"]; + } else { + this.configuration.config.configName = defaultName; + } + }) + .then(() => { + asyncNamePrompt(); + this.npmInstall(this.npmInstalls, { "save-dev": true }); + }); } - }; diff --git a/lib/transformations/bannerPlugin/bannerPlugin.js b/lib/transformations/bannerPlugin/bannerPlugin.js index 2e04fa6c002..0a13a818ac1 100644 --- a/lib/transformations/bannerPlugin/bannerPlugin.js +++ b/lib/transformations/bannerPlugin/bannerPlugin.js @@ -1,15 +1,12 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - INewExpression, - IPath -} from "../../types"; +import type { Ijscodeshit, INewExpression, IPath } from "../../types"; const utils = require("../utils"); module.exports = function(j: Ijscodeshit, ast: IPath<*>) { - return utils.findPluginsByName(j, ast, ["webpack.BannerPlugin"]) + return utils + .findPluginsByName(j, ast, ["webpack.BannerPlugin"]) .forEach((path: IPath) => { const args: any[] = path.value.arguments; // any node // If the first argument is a literal replace it with object notation @@ -17,9 +14,14 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { if (args && args.length > 1 && args[0].type === j.Literal.name) { // and remove the first argument path.value.arguments = [path.value.arguments[1]]; - utils.createOrUpdatePluginByName(j, path.parent, "webpack.BannerPlugin", { - banner: args[0].value - }); + utils.createOrUpdatePluginByName( + j, + path.parent, + "webpack.BannerPlugin", + { + banner: args[0].value + } + ); } }); }; diff --git a/lib/transformations/extractTextPlugin/extractTextPlugin.js b/lib/transformations/extractTextPlugin/extractTextPlugin.js index 97ce0ad07dc..622d02e4d25 100644 --- a/lib/transformations/extractTextPlugin/extractTextPlugin.js +++ b/lib/transformations/extractTextPlugin/extractTextPlugin.js @@ -11,11 +11,17 @@ import type { const utils = require("../utils"); -function findInvocation(j: Ijscodeshit, node: IPath, pluginName: string): boolean { +function findInvocation( + j: Ijscodeshit, + node: IPath, + pluginName: string +): boolean { let found: boolean = false; - found = j(node) - .find(j.MemberExpression) - .filter(p => p.get("object").value.name === pluginName).size() > 0; + found = + j(node) + .find(j.MemberExpression) + .filter(p => p.get("object").value.name === pluginName) + .size() > 0; return found; } @@ -25,7 +31,9 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { // if(args.length === 1) { // return p; // } else - const literalArgs: IPath[] = args.filter(p => utils.isType(p, "Literal")); + const literalArgs: IPath[] = args.filter(p => + utils.isType(p, "Literal") + ); if (literalArgs && literalArgs.length > 1) { const newArgs: IObjectExpression = j.objectExpression( literalArgs.map((p: IPath, index: number) => @@ -36,10 +44,15 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { } return p; }; - const name: ?string = utils.findVariableToPlugin(j, ast, "extract-text-webpack-plugin"); + const name: ?string = utils.findVariableToPlugin( + j, + ast, + "extract-text-webpack-plugin" + ); if (!name) return ast; - return ast.find(j.CallExpression) + return ast + .find(j.CallExpression) .filter((p: IPath) => findInvocation(j, p, name)) .forEach(changeArguments); }; diff --git a/lib/transformations/index.js b/lib/transformations/index.js index 74e9c25db6d..dd202a62f92 100644 --- a/lib/transformations/index.js +++ b/lib/transformations/index.js @@ -1,8 +1,6 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - IPath -} from "../types"; +import type { IPath } from "../types"; const jscodeshift = require("jscodeshift"); const pEachSeries = require("p-each-series"); @@ -29,11 +27,16 @@ const transformsObject = { }; const transformations = Object.keys(transformsObject).reduce((res, key) => { - res[key] = (ast, source) => transformSingleAST(ast, source, transformsObject[key]); + res[key] = (ast, source) => + transformSingleAST(ast, source, transformsObject[key]); return res; }, {}); -function transformSingleAST(ast: IPath<*>, source: string, transformFunction: Function): IPath<*> { +function transformSingleAST( + ast: IPath<*>, + source: string, + transformFunction: Function +): IPath<*> { return new PLazy((resolve, reject) => { setTimeout(() => { try { @@ -56,12 +59,20 @@ function transformSingleAST(ast: IPath<*>, source: string, transformFunction: Fu * @param { Object } options - Reacst formatting options * @returns { String } Transformed source code * */ -function transform(source: string, transforms: Function[], options: Object): string { +function transform( + source: string, + transforms: Function[], + options: Object +): string { const ast: IPath<*> = jscodeshift(source); - const recastOptions = Object.assign({ - quote: "single" - }, options); - transforms = transforms || Object.keys(transformations).map(k => transformations[k]); + const recastOptions = Object.assign( + { + quote: "single" + }, + options + ); + transforms = + transforms || Object.keys(transformations).map(k => transformations[k]); return pEachSeries(transforms, f => f(ast, source)) .then(() => { return ast.toSource(recastOptions); diff --git a/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js b/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js index 35e3a2afd6e..f661c352bb3 100644 --- a/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js +++ b/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js @@ -1,14 +1,11 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - IPath, - IArrayExpression -} from "../../types"; +import type { Ijscodeshit, IPath, IArrayExpression } from "../../types"; const isEmpty = require("lodash/isEmpty"); const findPluginsByName = require("../utils").findPluginsByName; -const createOrUpdatePluginByName = require("../utils").createOrUpdatePluginByName; +const createOrUpdatePluginByName = require("../utils") + .createOrUpdatePluginByName; const safeTraverse = require("../utils").safeTraverse; module.exports = function(j: Ijscodeshit, ast: IPath<*>) { @@ -28,9 +25,17 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { return ast .find(j.ArrayExpression) - .filter((path: IPath<*>) => safeTraverse(path, ["parent", "value", "key", "name"]) === "plugins") + .filter( + (path: IPath<*>) => + safeTraverse(path, ["parent", "value", "key", "name"]) === "plugins" + ) .forEach((path: IPath) => { !isEmpty(loaderOptions) && - createOrUpdatePluginByName(j, path, "webpack.LoaderOptionsPlugin", loaderOptions); + createOrUpdatePluginByName( + j, + path, + "webpack.LoaderOptionsPlugin", + loaderOptions + ); }); }; diff --git a/lib/transformations/loaders/loaders.js b/lib/transformations/loaders/loaders.js index 635620cfd4a..48509dcc653 100644 --- a/lib/transformations/loaders/loaders.js +++ b/lib/transformations/loaders/loaders.js @@ -51,10 +51,14 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {Node} path Must be an ObjectExpression * @return {Node} [] */ - const createArrayExpressionFromArray = function(path: IPath): IPath<*> { + const createArrayExpressionFromArray = function( + path: IPath + ): IPath<*> { const value: IObjectExpression = path.value; // Find paths with `loaders` keys in the given Object - const paths = value.properties.filter((prop: IProperty<*>) => prop.key.name.startsWith("loader")); + const paths = value.properties.filter((prop: IProperty<*>) => + prop.key.name.startsWith("loader") + ); // For each pair of key and value paths.forEach((pair: IProperty<*>) => { // Replace 'loaders' Identifier with 'use' @@ -76,28 +80,30 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { return arrElement; }) ); - // If the value is String of loaders like 'style!css' + // If the value is String of loaders like 'style!css' } else if (pair.value.type === j.Literal.name) { // Replace it with Array expression of loaders const literalValue: ILiteral = pair.value; pair.value = j.arrayExpression( - literalValue.value - .split("!") - .map(loader => { - return j.objectExpression([ - utils.createProperty(j, "loader", loader) - ]); - }) + literalValue.value.split("!").map(loader => { + return j.objectExpression([ + utils.createProperty(j, "loader", loader) + ]); + }) ); } }); return path; }; - const createLoaderWithQuery = (p: IPath): IObjectExpression => { + const createLoaderWithQuery = ( + p: IPath + ): IObjectExpression => { let properties = p.value.properties; - let loaderValue = properties - .reduce((val, prop) => prop.key.name === "loader" ? prop.value.value : val, ""); + let loaderValue = properties.reduce( + (val, prop) => (prop.key.name === "loader" ? prop.value.value : val), + "" + ); let loader = loaderValue.split("?")[0]; let query = loaderValue.split("?")[1]; let options: Object[] = query.split("&").map(option => { @@ -107,17 +113,22 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { return j.objectProperty(j.identifier(key), utils.createLiteral(j, val)); }); let loaderProp: IProperty<*> = utils.createProperty(j, "loader", loader); - let queryProp: IProperty = j.property("init", j.identifier("options"), j.objectExpression(options)); + let queryProp: IProperty = j.property( + "init", + j.identifier("options"), + j.objectExpression(options) + ); return j.objectExpression([loaderProp, queryProp]); }; const findLoaderWithQueryString = (p: IPath): boolean => { - return p.value.properties - .reduce((predicate, prop) => { - return utils.safeTraverse(prop, ["value", "value", "indexOf"]) - && prop.value.value.indexOf("?") > -1 - || predicate; - }, false); + return p.value.properties.reduce((predicate, prop) => { + return ( + (utils.safeTraverse(prop, ["value", "value", "indexOf"]) && + prop.value.value.indexOf("?") > -1) || + predicate + ); + }, false); }; /** @@ -127,8 +138,16 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {Node} path [description] * @return {Node} [description] */ - const checkForLoader = path => path.value.name === "loaders" && - utils.safeTraverse(path, ["parent", "parent", "parent", "node", "key", "name"]) === "module"; + const checkForLoader = path => + path.value.name === "loaders" && + utils.safeTraverse(path, [ + "parent", + "parent", + "parent", + "node", + "key", + "name" + ]) === "module"; /** * Puts node path that is pre- or postLoader into `enforce` key @@ -136,7 +155,9 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {Node} p [] * @returns {*} [] */ - const fitIntoLoaders = (p: IPath): IPath => { + const fitIntoLoaders = ( + p: IPath + ): IPath => { let loaders; p.value.properties.map(prop => { const keyName = prop.key.name; @@ -159,7 +180,9 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { } }); if (loaders) { - p.value.properties = p.value.properties.filter(prop => prop.key.name === "loaders"); + p.value.properties = p.value.properties.filter( + prop => prop.key.name === "loaders" + ); } return p; }; @@ -170,10 +193,11 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {[type]} IPath [description] * @return {[type]} [description] */ - const prepostLoaders = (): IPath => ast - .find(j.ObjectExpression) - .filter(p => utils.findObjWithOneOfKeys(p, ["preLoaders", "postLoaders"])) - .forEach(fitIntoLoaders); + const prepostLoaders = (): IPath => + ast + .find(j.ObjectExpression) + .filter(p => utils.findObjWithOneOfKeys(p, ["preLoaders", "postLoaders"])) + .forEach(fitIntoLoaders); /** * Convert top level `loaders` to `rules` @@ -181,22 +205,32 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {[type]} IPath [description] * @return {[type]} [description] */ - const loadersToRules = (): IPath => ast - .find(j.Identifier) - .filter(checkForLoader) - .forEach((p: IPath) => p.value.name = "rules"); + const loadersToRules = (): IPath => + ast + .find(j.Identifier) + .filter(checkForLoader) + .forEach((p: IPath) => (p.value.name = "rules")); /** * Converts 'loader' and 'loaders' to Array of {Rule.Use} * * @returns {Node} [] */ - const loadersToArrayExpression = (): IPath => ast - .find(j.ObjectExpression) - .filter(path => utils.findObjWithOneOfKeys(path, ["loader", "loaders"])) - .filter(path => utils.safeTraverse( - path, ["parent", "parent", "node", "key", "name"]) === "rules") - .forEach(createArrayExpressionFromArray); + const loadersToArrayExpression = (): IPath => + ast + .find(j.ObjectExpression) + .filter(path => utils.findObjWithOneOfKeys(path, ["loader", "loaders"])) + .filter( + path => + utils.safeTraverse(path, [ + "parent", + "parent", + "node", + "key", + "name" + ]) === "rules" + ) + .forEach(createArrayExpressionFromArray); /** * Finds loaders with options encoded as query string and replaces it with options obejct @@ -220,11 +254,12 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @type {[type]} * @returns {Node} [] */ - const loaderWithQueryParam = (): IPath => ast - .find(j.ObjectExpression) - .filter(p => utils.findObjWithOneOfKeys(p, ["loader"])) - .filter(findLoaderWithQueryString) - .replaceWith(createLoaderWithQuery); + const loaderWithQueryParam = (): IPath => + ast + .find(j.ObjectExpression) + .filter(p => utils.findObjWithOneOfKeys(p, ["loader"])) + .filter(findLoaderWithQueryString) + .replaceWith(createLoaderWithQuery); /** * Finds nodes with `query` key and replaces it with `options` @@ -241,23 +276,25 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * } * @returns {Node} [] */ - const loaderWithQueryProp = (): IPath => ast - .find(j.Identifier) - .filter(p => p.value.name === "query") - .replaceWith(j.identifier("options")); + const loaderWithQueryProp = (): IPath => + ast + .find(j.Identifier) + .filter(p => p.value.name === "query") + .replaceWith(j.identifier("options")); /** * Adds required `-loader` suffix to loader with missing suffix * i.e. for `babel` it should generate `babel-loader` * @returns {Node} [] */ - const addLoaderSuffix = (): IPath => ast - .find(j.ObjectExpression) - .forEach(path => { + const addLoaderSuffix = (): IPath => + ast.find(j.ObjectExpression).forEach(path => { path.value.properties.forEach(prop => { - if (prop.key.name === "loader" - && utils.safeTraverse(prop, ["value", "value"]) - && !prop.value.value.endsWith("-loader")) { + if ( + prop.key.name === "loader" && + utils.safeTraverse(prop, ["value", "value"]) && + !prop.value.value.endsWith("-loader") + ) { prop.value = j.literal(prop.value.value + "-loader"); } }); diff --git a/lib/transformations/outputPath/outputPath.js b/lib/transformations/outputPath/outputPath.js index f5a95cb023d..3cd5b1a928a 100644 --- a/lib/transformations/outputPath/outputPath.js +++ b/lib/transformations/outputPath/outputPath.js @@ -1,31 +1,41 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - ICallExpression, - IPath -} from "../../types"; +import type { Ijscodeshit, ICallExpression, IPath } from "../../types"; const utils = require("../utils"); module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { const literalOutputPath = ast .find(j.ObjectExpression) - .filter((p: IPath<*>) => utils.safeTraverse(p, ["parentPath", "value", "key", "name"]) === "output") + .filter( + (p: IPath<*>) => + utils.safeTraverse(p, ["parentPath", "value", "key", "name"]) === + "output" + ) .find(j.Property) - .filter((p: IPath<*>) => utils.safeTraverse(p, ["value", "key", "name"]) === "path" - && utils.safeTraverse(p, ["value", "value", "type"]) === "Literal"); + .filter( + (p: IPath<*>) => + utils.safeTraverse(p, ["value", "key", "name"]) === "path" && + utils.safeTraverse(p, ["value", "value", "type"]) === "Literal" + ); if (literalOutputPath) { let pathVarName: ?string = "path"; let isPathPresent: boolean = false; const pathDecalaration = ast .find(j.VariableDeclarator) - .filter((p: IPath<*>) => utils.safeTraverse(p, ["value", "init", "callee", "name"]) === "require") - .filter((p: IPath<*>) => utils.safeTraverse(p, ["value", "init", "arguments"]) - && p.value.init.arguments.reduce((isPresent, a) => { - return a.type === "Literal" && a.value === "path" || isPresent; - }, false)); + .filter( + (p: IPath<*>) => + utils.safeTraverse(p, ["value", "init", "callee", "name"]) === + "require" + ) + .filter( + (p: IPath<*>) => + utils.safeTraverse(p, ["value", "init", "arguments"]) && + p.value.init.arguments.reduce((isPresent, a) => { + return (a.type === "Literal" && a.value === "path") || isPresent; + }, false) + ); if (pathDecalaration) { isPathPresent = true; @@ -40,19 +50,24 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { if (!isPathPresent) { const pathRequire: string = (utils.getRequire(j, "path", "path"): any); - return ast.find(j.Program) - .replaceWith(p => j.program([].concat(pathRequire).concat(p.value.body))); + return ast + .find(j.Program) + .replaceWith(p => + j.program([].concat(pathRequire).concat(p.value.body)) + ); } } return ast; }; -function replaceWithPath(j: Ijscodeshit, p: IPath<*>, pathVarName: string): IPath { +function replaceWithPath( + j: Ijscodeshit, + p: IPath<*>, + pathVarName: string +): IPath { const convertedPath = j.callExpression( - j.memberExpression( - j.identifier(pathVarName), - j.identifier("join"), - false), - [j.identifier("__dirname"), p.value]); + j.memberExpression(j.identifier(pathVarName), j.identifier("join"), false), + [j.identifier("__dirname"), p.value] + ); return convertedPath; } diff --git a/lib/transformations/removeDeprecatedPlugins/removeDeprecatedPlugins.js b/lib/transformations/removeDeprecatedPlugins/removeDeprecatedPlugins.js index 078a17e32f8..24b43447a12 100644 --- a/lib/transformations/removeDeprecatedPlugins/removeDeprecatedPlugins.js +++ b/lib/transformations/removeDeprecatedPlugins/removeDeprecatedPlugins.js @@ -1,9 +1,6 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - IPath -} from "../../types"; +import type { Ijscodeshit, IPath } from "../../types"; const codeFrame = require("babel-code-frame"); const chalk = require("chalk"); @@ -23,10 +20,14 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>, source: string) { "webpack.optimize.DedupePlugin" ]; - return utils.findPluginsByName(j, ast, deprecatedPlugingsList) + return utils + .findPluginsByName(j, ast, deprecatedPlugingsList) .forEach((path: IPath<*>) => { // For now we only support the case there plugins are defined in an Array - const arrayPath: ?IPath<*> = utils.safeTraverse(path, ["parent","value"]); + const arrayPath: ?IPath<*> = utils.safeTraverse(path, [ + "parent", + "value" + ]); if (arrayPath && utils.isType(arrayPath, "ArrayExpression")) { // Check how many plugins are defined and // if there is only last plugin left remove `plugins: []` node @@ -39,16 +40,20 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>, source: string) { } else { const startLoc = path.value.loc.start; console.log(` -${ chalk.red("Only plugins instantiated in the array can be automatically removed i.e.:") } +${chalk.red( + "Only plugins instantiated in the array can be automatically removed i.e.:" + )} -${ codeFrame(example, null, null, { highlightCode: true }) } +${codeFrame(example, null, null, { highlightCode: true })} -${ chalk.red("but you use it like this:") } +${chalk.red("but you use it like this:")} -${ codeFrame(source, startLoc.line, startLoc.column, { highlightCode: true }) } +${codeFrame(source, startLoc.line, startLoc.column, { highlightCode: true })} -${ chalk.red("Please remove deprecated plugins manually. ") } -See ${ chalk.underline("https://webpack.js.org/guides/migrating/")} for more information.`); +${chalk.red("Please remove deprecated plugins manually. ")} +See ${chalk.underline( + "https://webpack.js.org/guides/migrating/" + )} for more information.`); } }); }; diff --git a/lib/transformations/removeJsonLoader/removeJsonLoader.js b/lib/transformations/removeJsonLoader/removeJsonLoader.js index 90fb8151cc9..79914586ca7 100644 --- a/lib/transformations/removeJsonLoader/removeJsonLoader.js +++ b/lib/transformations/removeJsonLoader/removeJsonLoader.js @@ -19,7 +19,7 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { }); const loaderIndex = loaders.indexOf(name); if (loaders.length && loaderIndex > -1) { - // Remove loader from the array + // Remove loader from the array loaders.splice(loaderIndex, 1); // and from AST loadersNode.elements.splice(loaderIndex, 1); @@ -32,8 +32,8 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { break; } case j.Literal.name: { - // If only the loader with the matching name was used - // we can remove the whole Property node completely + // If only the loader with the matching name was used + // we can remove the whole Property node completely if ((loadersNode: ILiteral).value === name) { j(path.parent).remove(); } @@ -52,9 +52,7 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { .forEach((path: IPath<*>) => removeLoaderByName(path, "json-loader")); } - const transforms = [ - removeLoaders - ]; + const transforms = [removeLoaders]; transforms.forEach(t => t(ast)); diff --git a/lib/transformations/resolve/resolve.js b/lib/transformations/resolve/resolve.js index 2ee320ca97e..e6ec9ab915b 100644 --- a/lib/transformations/resolve/resolve.js +++ b/lib/transformations/resolve/resolve.js @@ -9,24 +9,28 @@ import type { } from "../../types"; module.exports = function transformer(j: Ijscodeshit, ast: IPath<*>) { - - const getRootVal = (p: IPath>): IProperty => { + const getRootVal = ( + p: IPath> + ): IProperty => { return p.node.value.properties.filter(prop => prop.key.name === "root")[0]; }; const getRootIndex = p => { - return p.node.value.properties - .reduce((rootIndex, prop, index) => { - return prop.key.name === "root" ? index : rootIndex; - }, -1); + return p.node.value.properties.reduce((rootIndex, prop, index) => { + return prop.key.name === "root" ? index : rootIndex; + }, -1); }; const isModulePresent = (p: IPath>) => { - const modules = p.node.value.properties.filter(prop => prop.key.name === "modules"); + const modules = p.node.value.properties.filter( + prop => prop.key.name === "modules" + ); return modules.length > 0 && modules[0]; }; - const createModuleArray = (p: IPath>): IPath> => { + const createModuleArray = ( + p: IPath> + ): IPath> => { const rootVal = getRootVal(p); let modulesVal = null; if (rootVal.value.type === "ArrayExpression") { @@ -37,7 +41,11 @@ module.exports = function transformer(j: Ijscodeshit, ast: IPath<*>) { let module = isModulePresent(p); if (!module) { - module = j.property("init", j.identifier("modules"), j.arrayExpression(modulesVal)); + module = j.property( + "init", + j.identifier("modules"), + j.arrayExpression(modulesVal) + ); p.node.value.properties = p.node.value.properties.concat([module]); } else { module.value.elements = module.value.elements.concat(modulesVal); @@ -50,10 +58,11 @@ module.exports = function transformer(j: Ijscodeshit, ast: IPath<*>) { return ast .find(j.Property) .filter((p: IPath>) => { - return p.node.key.name === "resolve" - && p.node.value.properties - .filter(prop => prop.key.name === "root") - .length === 1; + return ( + p.node.key.name === "resolve" && + p.node.value.properties.filter(prop => prop.key.name === "root") + .length === 1 + ); }) .forEach(createModuleArray); }; diff --git a/lib/transformations/uglifyJsPlugin/uglifyJsPlugin.js b/lib/transformations/uglifyJsPlugin/uglifyJsPlugin.js index adf5f8e0aed..cf0acdd6b1f 100644 --- a/lib/transformations/uglifyJsPlugin/uglifyJsPlugin.js +++ b/lib/transformations/uglifyJsPlugin/uglifyJsPlugin.js @@ -1,32 +1,28 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - IPath -} from "../../types"; +import type { Ijscodeshit, IPath } from "../../types"; const findPluginsByName = require("../utils").findPluginsByName; module.exports = function(j: Ijscodeshit, ast: IPath<*>) { - function createSourceMapsProperty() { return j.property("init", j.identifier("sourceMap"), j.identifier("true")); } - return findPluginsByName(j, ast, ["webpack.optimize.UglifyJsPlugin"]) - .forEach(path => { - const args = path.value.arguments; + return findPluginsByName(j, ast, [ + "webpack.optimize.UglifyJsPlugin" + ]).forEach(path => { + const args = path.value.arguments; - if (args.length) { - // Plugin is called with object as arguments - j(path) - .find(j.ObjectExpression) - .get("properties") - .value - .push(createSourceMapsProperty()); - } else { - // Plugin is called without arguments - args.push(j.objectExpression([createSourceMapsProperty()])); - } - }); + if (args.length) { + // Plugin is called with object as arguments + j(path) + .find(j.ObjectExpression) + .get("properties") + .value.push(createSourceMapsProperty()); + } else { + // Plugin is called without arguments + args.push(j.objectExpression([createSourceMapsProperty()])); + } + }); }; diff --git a/lib/transformations/utils.js b/lib/transformations/utils.js index 35c8651a41c..d9d46240f50 100644 --- a/lib/transformations/utils.js +++ b/lib/transformations/utils.js @@ -28,7 +28,9 @@ function safeTraverse(obj: Object, paths: string[]): ?any { // Convert nested MemberExpressions to strings like webpack.optimize.DedupePlugin function memberExpressionToPathString(path: Object): string { if (path && path.object) { - return [memberExpressionToPathString(path.object), path.property.name].join("."); + return [memberExpressionToPathString(path.object), path.property.name].join( + "." + ); } return path.name; } @@ -59,14 +61,17 @@ function pathsToMemberExpression(j: Ijscodeshit, paths: string[]) { * @param { Array } pluginNamesArray - Array of plugin names like `webpack.LoaderOptionsPlugin` * @returns Path * */ -function findPluginsByName(j: Ijscodeshit, node: IPath<*>, pluginNamesArray: string[]): IPath<*> { - return node - .find(j.NewExpression) - .filter(path => { - return pluginNamesArray.some( - plugin => memberExpressionToPathString(path.get("callee").value) === plugin - ); - }); +function findPluginsByName( + j: Ijscodeshit, + node: IPath<*>, + pluginNamesArray: string[] +): IPath<*> { + return node.find(j.NewExpression).filter(path => { + return pluginNamesArray.some( + plugin => + memberExpressionToPathString(path.get("callee").value) === plugin + ); + }); } /* @@ -78,7 +83,10 @@ function findPluginsByName(j: Ijscodeshit, node: IPath<*>, pluginNamesArray: str * @param { Node } node - Node to start search from * @returns Path * */ -function findPluginsRootNodes(j: Ijscodeshit, node: IPath<*>): IPath> { +function findPluginsRootNodes( + j: Ijscodeshit, + node: IPath<*> +): IPath> { return node.find(j.Property, { key: { name: "plugins" } }); } @@ -92,7 +100,11 @@ function findPluginsRootNodes(j: Ijscodeshit, node: IPath<*>): IPath { +function createProperty( + j: Ijscodeshit, + key: string | number, + value: any +): IProperty<*> { return j.property( "init", createIdentifierOrLiteral(j, key), @@ -110,7 +122,10 @@ function createProperty(j: Ijscodeshit, key: string | number, value: any): IProp * @returns { Node } * */ -function createLiteral(j: Ijscodeshit, val: string | boolean | number): IPath { +function createLiteral( + j: Ijscodeshit, + val: string | boolean | number +): IPath { let literalVal: any = val; // We'll need String to native type conversions if (typeof val === "string") { @@ -134,7 +149,8 @@ function createLiteral(j: Ijscodeshit, val: string | boolean | number): IPath | IPath doesn't work, find another way +function createIdentifierOrLiteral(j: Ijscodeshit, val: any): any { + // IPath | IPath doesn't work, find another way let literalVal = val; // We'll need String to native type conversions if (typeof val === "string" || val.__paths) { @@ -176,8 +192,15 @@ function createIdentifierOrLiteral(j: Ijscodeshit, val: any): any { // IPath, pluginName: string, options: any) { - const pluginInstancePath = findPluginsByName(j, j(rootNodePath), [pluginName]); +function createOrUpdatePluginByName( + j: Ijscodeshit, + rootNodePath: IPath<*>, + pluginName: string, + options: any +) { + const pluginInstancePath = findPluginsByName(j, j(rootNodePath), [ + pluginName + ]); let optionsProps; if (options) { optionsProps = Object.keys(options).map(key => { @@ -214,12 +237,9 @@ function createOrUpdatePluginByName(j: Ijscodeshit, rootNodePath: IPath<*>, plug currentProps.value.push(opt); } }); - } else { // Plugin is called without arguments - args.push( - j.objectExpression(optionsProps) - ); + args.push(j.objectExpression(optionsProps)); } } }); @@ -247,8 +267,13 @@ function createOrUpdatePluginByName(j: Ijscodeshit, rootNodePath: IPath<*>, plug * @returns { string } variable name - ex. 'var s = require(s) gives "s"` * */ -function findVariableToPlugin(j: Ijscodeshit, rootNode: IPath<*>, pluginPackageName: string): ?string { - const moduleVarNames: IVariableDeclarator[] = rootNode.find(j.VariableDeclarator) +function findVariableToPlugin( + j: Ijscodeshit, + rootNode: IPath<*>, + pluginPackageName: string +): ?string { + const moduleVarNames: IVariableDeclarator[] = rootNode + .find(j.VariableDeclarator) .filter(j.filters.VariableDeclarator.requiresModule(pluginPackageName)) .nodes(); if (moduleVarNames.length === 0) return null; @@ -269,12 +294,10 @@ function isType(path: IPath<*>, type: string): boolean { } function findObjWithOneOfKeys(p: IPath<*>, keyNames: string[]): boolean { - return p.value.properties - .reduce((predicate, prop) => { - const name = prop.key.name; - return keyNames.indexOf(name) > -1 - || predicate; - }, false); + return p.value.properties.reduce((predicate, prop) => { + const name = prop.key.name; + return keyNames.indexOf(name) > -1 || predicate; + }, false); } /* @@ -287,14 +310,15 @@ function findObjWithOneOfKeys(p: IPath<*>, keyNames: string[]): boolean { * @returns {NodePath} - the created ast */ -function getRequire(j: Ijscodeshit, constName: string, packagePath: string): IPath { +function getRequire( + j: Ijscodeshit, + constName: string, + packagePath: string +): IPath { return j.variableDeclaration("const", [ j.variableDeclarator( j.identifier(constName), - j.callExpression( - j.identifier("require"), - [j.literal(packagePath)] - ) + j.callExpression(j.identifier("require"), [j.literal(packagePath)]) ) ]); } @@ -310,8 +334,15 @@ function getRequire(j: Ijscodeshit, constName: string, packagePath: string): IPa * @returns - nothing */ -function checkIfExistsAndAddValue(j: Ijscodeshit, node: IPath, key: string, value: string): void { - const existingProp = node.value.properties.filter(prop => prop.key.name === key); +function checkIfExistsAndAddValue( + j: Ijscodeshit, + node: IPath, + key: string, + value: string +): void { + const existingProp = node.value.properties.filter( + prop => prop.key.name === key + ); let prop; if (existingProp.length > 0) { prop = existingProp[0]; @@ -330,7 +361,10 @@ function checkIfExistsAndAddValue(j: Ijscodeshit, node: IPath * @param { String } key - st name * @returns - { Array } arr - An empty array */ -function createEmptyArrayProperty(j: Ijscodeshit, key: string): IProperty { +function createEmptyArrayProperty( + j: Ijscodeshit, + key: string +): IProperty { return j.property("init", j.identifier(key), j.arrayExpression([])); } @@ -345,21 +379,30 @@ function createEmptyArrayProperty(j: Ijscodeshit, key: string): IProperty) => { let objectOfArray = j.objectExpression([]); - if (typeof(subProperty) !== "string") { + if (typeof subProperty !== "string") { loopThroughObjects(j, objectOfArray, subProperty); arr.value.elements.push(objectOfArray); } else { - return arr.value.elements.push(createIdentifierOrLiteral(j, subProperty)); + return arr.value.elements.push( + createIdentifierOrLiteral(j, subProperty) + ); } }); } else { - Object.keys(subProps[key]).forEach((subProperty) => { - arr.value.elements.push(createIdentifierOrLiteral(j, subProps[key][subProperty])); + Object.keys(subProps[key]).forEach(subProperty => { + arr.value.elements.push( + createIdentifierOrLiteral(j, subProps[key][subProperty]) + ); }); } return arr; @@ -376,24 +419,39 @@ function createArrayWithChildren(j: Ijscodeshit, key: string, subProps: { [strin * nothing is left */ -function loopThroughObjects(j: Ijscodeshit, p: IObjectExpression, obj: Object): void { - Object.keys(obj).forEach((prop) => { +function loopThroughObjects( + j: Ijscodeshit, + p: IObjectExpression, + obj: Object +): void { + Object.keys(obj).forEach(prop => { if (prop.indexOf("inject") >= 0) { // TODO to insert the type of node, identifier or literal - const propertyExpression: IPath<*> = createIdentifierOrLiteral(j, obj[prop]); + const propertyExpression: IPath<*> = createIdentifierOrLiteral( + j, + obj[prop] + ); return p.properties.push(propertyExpression); } // eslint-disable-next-line no-irregular-whitespace - if (typeof(obj[prop]) !== "object" || obj[prop] instanceof RegExp) { - p.properties.push(createObjectWithSuppliedProperty( - j, prop, createIdentifierOrLiteral(j, obj[prop]) - )); + if (typeof obj[prop] !== "object" || obj[prop] instanceof RegExp) { + p.properties.push( + createObjectWithSuppliedProperty( + j, + prop, + createIdentifierOrLiteral(j, obj[prop]) + ) + ); } else if (Array.isArray(obj[prop])) { let arrayProp = createArrayWithChildren(j, prop, obj[prop], true); p.properties.push(arrayProp); } else { let objectBlock = j.objectExpression([]); - let propertyOfBlock = createObjectWithSuppliedProperty(j, prop, objectBlock); + let propertyOfBlock = createObjectWithSuppliedProperty( + j, + prop, + objectBlock + ); loopThroughObjects(j, objectBlock, obj[prop]); p.properties.push(propertyOfBlock); } @@ -410,7 +468,11 @@ function loopThroughObjects(j: Ijscodeshit, p: IObjectExpression, obj: Object): * @returns - { Node } - An property with the supplied property */ -function createObjectWithSuppliedProperty(j: Ijscodeshit, key: string, prop: any): IProperty<*> { +function createObjectWithSuppliedProperty( + j: Ijscodeshit, + key: string, + prop: any +): IProperty<*> { return j.property("init", j.identifier(key), prop); } @@ -439,7 +501,12 @@ function createExternalRegExp(j: Ijscodeshit, prop: any): IPath { * @returns - { Node } - Returns node the pushed property */ -function pushCreateProperty(j: Ijscodeshit, p: IPath, key: string, val: any): number { +function pushCreateProperty( + j: Ijscodeshit, + p: IPath, + key: string, + val: any +): number { let property: string | IPath | IPath; if (val.hasOwnProperty("type")) { property = val; @@ -462,32 +529,50 @@ function pushCreateProperty(j: Ijscodeshit, p: IPath, key: st *subProperty is an array, else it will invoke a function that will push a single node */ -function pushObjectKeys(j: Ijscodeshit, p: IPath<*>, webpackProperties: Object, name: string): any { - p.value.properties.filter(n => - (safeTraverse(n, ["key", "name"]) === name) - ).forEach((prop) => { - Object.keys(webpackProperties).forEach((webpackProp) => { - if (webpackProp.indexOf("inject") >= 0) { - return prop.value.properties.push(createIdentifierOrLiteral(j, webpackProperties[webpackProp])); - } else if (Array.isArray(webpackProperties[webpackProp])) { - const propArray = createArrayWithChildren( - j, webpackProp, webpackProperties[webpackProp], true - ); - return prop.value.properties.push(propArray); - } else if (typeof(webpackProperties[webpackProp]) !== "object" || webpackProperties[webpackProp].__paths || webpackProperties[webpackProp] instanceof RegExp) { - return pushCreateProperty( - j, prop, webpackProp, webpackProperties[webpackProp] - ); - } else { - pushCreateProperty( - j, prop, webpackProp, j.objectExpression([]) - ); - return pushObjectKeys( - j, prop, webpackProperties[webpackProp], webpackProp - ); - } +function pushObjectKeys( + j: Ijscodeshit, + p: IPath<*>, + webpackProperties: Object, + name: string +): any { + p.value.properties + .filter(n => safeTraverse(n, ["key", "name"]) === name) + .forEach(prop => { + Object.keys(webpackProperties).forEach(webpackProp => { + if (webpackProp.indexOf("inject") >= 0) { + return prop.value.properties.push( + createIdentifierOrLiteral(j, webpackProperties[webpackProp]) + ); + } else if (Array.isArray(webpackProperties[webpackProp])) { + const propArray = createArrayWithChildren( + j, + webpackProp, + webpackProperties[webpackProp], + true + ); + return prop.value.properties.push(propArray); + } else if ( + typeof webpackProperties[webpackProp] !== "object" || + webpackProperties[webpackProp].__paths || + webpackProperties[webpackProp] instanceof RegExp + ) { + return pushCreateProperty( + j, + prop, + webpackProp, + webpackProperties[webpackProp] + ); + } else { + pushCreateProperty(j, prop, webpackProp, j.objectExpression([])); + return pushObjectKeys( + j, + prop, + webpackProperties[webpackProp], + webpackProp + ); + } + }); }); - }); } /* @@ -505,7 +590,13 @@ function pushObjectKeys(j: Ijscodeshit, p: IPath<*>, webpackProperties: Object, * @returns - { Function } cb - Returns the callback and pushes a new node */ -function isAssignment(j: Ijscodeshit, p: IPath<*>, cb: () => void, identifier: string, property: Object): any { +function isAssignment( + j: Ijscodeshit, + p: IPath<*>, + cb: () => void, + identifier: string, + property: Object +): any { if (p.parent.value.type === "AssignmentExpression") { if (j) { return cb(j, p, identifier, property); diff --git a/lib/types.js b/lib/types.js index fc5651e22c6..b6edbcbe147 100644 --- a/lib/types.js +++ b/lib/types.js @@ -4,7 +4,7 @@ export type Ijscodeshit = { literal: (literalVal: string | boolean | number) => IPath, identifier: (literalVal: string | boolean | number) => IPath, - property: (name: string, key: any, assignee: any) => IProperty<*>, + property: (name: string, key: any, assignee: any) => IProperty<*>, memberExpression: (first: any, second: any) => any, (): IPath<*>, // (node: IPath<*>): IPath<*>, @@ -12,14 +12,23 @@ export type Ijscodeshit = { arrayExpression: () => any, program: (paths: string[]) => IPath<*>, callExpression: () => IPath, - objectProperty: (node: any, objectLiteral?: Object) => IPath, + objectProperty: ( + node: any, + objectLiteral?: Object + ) => IPath, filters: { VariableDeclarator: { requiresModule: (moduelToRequire: any) => () => void } }, - variableDeclaration: (declarationName: string, declaratino: any) => IPath, - variableDeclarator: (declarator: any, expression: any) => IPath, + variableDeclaration: ( + declarationName: string, + declaratino: any + ) => IPath, + variableDeclarator: ( + declarator: any, + expression: any + ) => IPath, newExpression: (rightExpression: any, leftExpressino: any) => IIdentifier, // primitives expressions @@ -37,7 +46,7 @@ export type Ijscodeshit = { export type Expression = { name: string -} +}; export type IPath = { value: NodeType, @@ -48,12 +57,12 @@ export type IPath = { size: () => number, filter: (callback: (node: IPath<*>) => any) => IPath<*>, forEach: (callback: (node: IPath<*>) => any | void) => IPath<*>, - replaceWith: (any) => IPath<*>, + replaceWith: any => IPath<*>, toSource: (options?: Object) => IPath<*>, get: (property: string) => any, remove: (node: any) => void, nodes: () => any[] -} +}; /** * [IAstNodeCommentLine description] * @type {Object} @@ -65,7 +74,7 @@ export type IAstNodeCommentLine = { end: number, loc: ILoc, rage: number[] -} +}; /** * [ILoc description] @@ -80,7 +89,7 @@ type ILoc = { line: number, column: number } -} +}; /** * [ITokenType description] @@ -103,7 +112,7 @@ export type ITokenType = { binop: any, updateContext: any } -} +}; export type ILiteral = { type: string, @@ -114,18 +123,18 @@ export type ILiteral = { rawValue: string, raw: string, name: string -} +}; export type INewExpression = { arguments: any[] -} +}; export type IObjectExpression = { properties: any[], type: string, range: [number, number], loc: ILoc -} +}; export type IProperty = { type: string, @@ -135,19 +144,19 @@ export type IProperty = { value: any, // any node loc: ILoc, value: NodeType -} +}; export type IIdentifier = { name: string, type: string, loc: ILoc, range: [number, number] -} +}; export type IArrayExpression = { elements: any[], // ILiteral[] | IObjectExpression[] value: any // any node -} +}; export type IMemberExpression = { type: string, @@ -156,7 +165,7 @@ export type IMemberExpression = { property: IIdentifier, range: [number, number], loc: ILoc -} +}; export type IVariableDeclaration = { declaration: IVariableDeclarator[], @@ -164,7 +173,7 @@ export type IVariableDeclaration = { kind: string, range: [number, number], loc: ILoc -} +}; export type IVariableDeclarator = { type: string, @@ -172,7 +181,7 @@ export type IVariableDeclarator = { init: any, range: [number, number], loc: ILoc -} +}; export type ICallExpression = { type: string, @@ -180,4 +189,4 @@ export type ICallExpression = { arguments?: any[], range: [number, number], loc: ILoc -} +}; diff --git a/lib/utils/npm-exists.js b/lib/utils/npm-exists.js index 22c60bc3ae9..f8a11b8d9d4 100644 --- a/lib/utils/npm-exists.js +++ b/lib/utils/npm-exists.js @@ -16,7 +16,7 @@ const constant = value => () => value; module.exports = function npmExists(moduleName) { //eslint-disable-next-line - if (moduleName.length <= 14 || moduleName.slice(0,14) !== 'webpack-addons') { + if (moduleName.length <= 14 || moduleName.slice(0, 14) !== "webpack-addons") { throw new TypeError( chalk.bold(`${moduleName} isn't a valid name.\n`) + chalk.red( diff --git a/lib/utils/resolve-packages.js b/lib/utils/resolve-packages.js index 016d6f107b8..98f8457722d 100644 --- a/lib/utils/resolve-packages.js +++ b/lib/utils/resolve-packages.js @@ -16,7 +16,8 @@ const globalPath = require("global-modules"); */ function processPromise(child) { - return new Promise(function(resolve, reject) { //eslint-disable-line + return new Promise(function(resolve, reject) { + //eslint-disable-line if (child.status !== 0) { reject(); } else { diff --git a/lib/utils/validateSchema.js b/lib/utils/validateSchema.js index 2975d93cf19..3a20782e68f 100644 --- a/lib/utils/validateSchema.js +++ b/lib/utils/validateSchema.js @@ -5,13 +5,13 @@ "use strict"; /* eslint-disable */ -const Ajv = require('ajv'); +const Ajv = require("ajv"); const ajv = new Ajv({ - errorDataPath: 'configuration', + errorDataPath: "configuration", allErrors: true, verbose: true }); -require('ajv-keywords')(ajv, ['instanceof']); +require("ajv-keywords")(ajv, ["instanceof"]); /* eslint-enable */ function validateSchema(schema, options) { diff --git a/package-lock.json b/package-lock.json index 504137263c9..570f993ff07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,12 @@ "integrity": "sha1-uB3l9ydOxOdW15fNg08wNkJyTl0=", "dev": true }, + "abbrev": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", + "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=", + "dev": true + }, "acorn": { "version": "4.0.13", "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", @@ -1234,6 +1240,12 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, + "boolify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/boolify/-/boolify-1.0.1.tgz", + "integrity": "sha1-tcCeF8rNET0Rt7s+04TMASmU2Gs=", + "dev": true + }, "boom": { "version": "2.10.1", "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", @@ -1289,6 +1301,12 @@ } } }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, "browserify-aes": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.8.tgz", @@ -1407,6 +1425,25 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=" }, + "camelcase-keys": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.1.0.tgz", + "integrity": "sha1-IU00jMVFfzkxaiwxzD43JGMl5z8=", + "dev": true, + "requires": { + "camelcase": "4.1.0", + "map-obj": "2.0.0", + "quick-lru": "1.1.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } + } + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -1601,6 +1638,15 @@ "graceful-readlink": "1.0.1" } }, + "common-tags": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.4.0.tgz", + "integrity": "sha1-EYe+Tz1M8MBCfUP3Tu8fc1AWFMA=", + "dev": true, + "requires": { + "babel-runtime": "6.23.0" + } + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -2004,6 +2050,12 @@ "randombytes": "2.0.5" } }, + "dlv": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.0.tgz", + "integrity": "sha1-/uGnxD9jvnXz9nnoUmLaXxAnZKc=", + "dev": true + }, "doctrine": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", @@ -2069,14 +2121,14 @@ "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=" }, "enhanced-resolve": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.3.0.tgz", - "integrity": "sha512-2qbxE7ek3YxPJ1ML6V+satHkzHpJQKWkRHmRx6mfAoW59yP8YH8BFplbegSP+u2hBd6B6KCOpvJQ3dZAP+hkpg==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz", + "integrity": "sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24=", "requires": { "graceful-fs": "4.1.11", "memory-fs": "0.4.1", "object-assign": "4.1.1", - "tapable": "0.2.6" + "tapable": "0.2.8" } }, "errno": { @@ -2623,6 +2675,16 @@ "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.49.1.tgz", "integrity": "sha1-amqTLNagyPUXSnYSR1tLcWT18NA=" }, + "flow-remove-types": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-1.2.1.tgz", + "integrity": "sha1-WOJhv4uEK9I0yGyvuYKhITr/Dts=", + "dev": true, + "requires": { + "babylon": "6.17.4", + "vlq": "0.2.2" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -3730,6 +3792,12 @@ "lodash": "4.17.4" } }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, "growly": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", @@ -3848,6 +3916,12 @@ "sntp": "1.0.9" } }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -4064,9 +4138,9 @@ } }, "interpret": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.3.tgz", - "integrity": "sha1-y8NcYu7uc/Gat7EKgBURQBr8D5A=" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", + "integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=" }, "invariant": { "version": "2.2.2", @@ -5265,6 +5339,12 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", @@ -5591,6 +5671,92 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash.keys": "3.1.2" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true, + "requires": { + "lodash._baseassign": "3.2.0", + "lodash._basecreate": "3.0.3", + "lodash._isiterateecall": "3.0.9" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + } + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.0.tgz", + "integrity": "sha1-aYhLoUSsM/5plzemCG3v+t0PicU=", + "dev": true + }, + "lodash.unescape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", + "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=", + "dev": true + }, "log-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", @@ -5627,6 +5793,43 @@ "cli-cursor": "1.0.2" } }, + "loglevel": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.5.0.tgz", + "integrity": "sha512-OQ2jhWI5G2qsvO0UFNyCQWgKl/tFiwuPIXxELzACeUO2FqstN/R7mmL09+nhv6xOWVPPojQO1A90sCEoJSgBcQ==", + "dev": true + }, + "loglevel-colored-level-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/loglevel-colored-level-prefix/-/loglevel-colored-level-prefix-1.0.0.tgz", + "integrity": "sha1-akAhj9x64V/HbD0PPmdsRlOIYD4=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "loglevel": "1.5.0" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -5654,6 +5857,24 @@ "yallist": "2.1.2" } }, + "make-plural": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/make-plural/-/make-plural-3.0.6.tgz", + "integrity": "sha1-IDOgO6wpC487uRJY9lud9+iwHKc=", + "dev": true, + "requires": { + "minimist": "1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true, + "optional": true + } + } + }, "makeerror": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", @@ -5663,6 +5884,12 @@ "tmpl": "1.0.4" } }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, "md5.js": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", @@ -5763,6 +5990,41 @@ "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=", "dev": true }, + "messageformat": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/messageformat/-/messageformat-1.0.2.tgz", + "integrity": "sha1-kI9GkfKf8o2uNcRUNqJM/5NAI4g=", + "dev": true, + "requires": { + "glob": "7.0.6", + "make-plural": "3.0.6", + "messageformat-parser": "1.1.0", + "nopt": "3.0.6", + "reserved-words": "0.1.2" + }, + "dependencies": { + "glob": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", + "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + } + } + }, + "messageformat-parser": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/messageformat-parser/-/messageformat-parser-1.1.0.tgz", + "integrity": "sha512-Hwem6G3MsKDLS1FtBRGIs8T50P1Q00r3srS6QJePCFbad9fq0nYxwf3rnU2BreApRGhmpKMV7oZI06Sy1c9TPA==", + "dev": true + }, "micromatch": { "version": "2.3.11", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", @@ -5848,6 +6110,66 @@ "minimist": "0.0.8" } }, + "mocha": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", + "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.2.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.1", + "growl": "1.9.2", + "he": "1.1.1", + "json3": "3.3.2", + "lodash.create": "3.1.1", + "mkdirp": "0.5.1", + "supports-color": "3.1.2" + }, + "dependencies": { + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + } + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -5972,6 +6294,15 @@ } } }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1.1.0" + } + }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -6348,16 +6679,6 @@ "integrity": "sha1-WbcIwcAZCi9pLxx2GMRGsFL9F2I=", "dev": true }, - "pre-commit": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/pre-commit/-/pre-commit-1.2.2.tgz", - "integrity": "sha1-287g7p3nI15X95xW186UZBpp7sY=", - "requires": { - "cross-spawn": "5.1.0", - "spawn-sync": "1.0.15", - "which": "1.2.14" - } - }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -6379,21 +6700,71 @@ "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.6.1.tgz", "integrity": "sha512-f85qBoQiqiFM/sCmJaN4Lagj9bqMcv38vCftqp4GfVessAqq3Ns6g+3gd8UXReStLLE/DGEdwiZXoFKxphKqwg==" }, - "pretty-bytes": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", - "integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=" + "prettier-eslint": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/prettier-eslint/-/prettier-eslint-8.1.1.tgz", + "integrity": "sha512-eVvH4HQkaKfEvnXy3DizRoW8CuMSQMPFTDkWCRGBv1+XqFZc2O4cDejKPnJCAUhmaWVMLdmhweU6PwEFLM+/lA==", + "dev": true, + "requires": { + "common-tags": "1.4.0", + "dlv": "1.1.0", + "eslint": "4.6.1", + "indent-string": "3.2.0", + "lodash.merge": "4.6.0", + "loglevel-colored-level-prefix": "1.0.0", + "prettier": "1.7.0", + "pretty-format": "20.0.3", + "require-relative": "0.8.7", + "typescript": "2.5.2", + "typescript-eslint-parser": "7.0.0" + }, + "dependencies": { + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "prettier": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.7.0.tgz", + "integrity": "sha512-kIbA3UE9sYGiVCxlWg92EOHWZqte6EAkC7DS5je6NaL8g3Uw1rWe0eH+UX4Hy5OEiR9aql2vVMHeg6lR4YGxYg==", + "dev": true + } + } }, - "pretty-format": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-20.0.3.tgz", - "integrity": "sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ=", + "prettier-eslint-cli": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/prettier-eslint-cli/-/prettier-eslint-cli-4.3.2.tgz", + "integrity": "sha512-bUHRWIt8mBndrI4X/nPpd4+Ftb7LvdIfZhTIYk5b7EB8+dQDyxcJNbbxgTGo5ukAn+HqC3frFRO58Vt/XxkDrQ==", "dev": true, "requires": { - "ansi-regex": "2.1.1", - "ansi-styles": "3.2.0" + "arrify": "1.0.1", + "babel-runtime": "6.23.0", + "boolify": "1.0.1", + "camelcase-keys": "4.1.0", + "chalk": "2.1.0", + "common-tags": "1.4.0", + "eslint": "4.6.1", + "find-up": "2.1.0", + "get-stdin": "5.0.1", + "glob": "7.1.2", + "ignore": "3.3.3", + "indent-string": "3.2.0", + "lodash.memoize": "4.1.2", + "loglevel-colored-level-prefix": "1.0.0", + "messageformat": "1.0.2", + "prettier-eslint": "8.1.1", + "rxjs": "5.4.1", + "yargs": "8.0.2" }, "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", @@ -6402,31 +6773,247 @@ "requires": { "color-convert": "1.9.0" } - } - } - }, - "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" - }, - "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", - "dev": true - }, - "prr": { + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.4.0" + } + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=", + "dev": true + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "2.3.0" + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "dev": true, + "requires": { + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + } + } + } + }, + "pretty-bytes": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", + "integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=" + }, + "pretty-format": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-20.0.3.tgz", + "integrity": "sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1", + "ansi-styles": "3.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + } + } + }, + "private": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, + "prr": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz", "integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=" @@ -6474,6 +7061,12 @@ "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, "randomatic": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", @@ -6809,6 +7402,12 @@ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" }, + "require-relative": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz", + "integrity": "sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4=", + "dev": true + }, "require-uncached": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", @@ -6819,6 +7418,12 @@ "resolve-from": "1.0.1" } }, + "reserved-words": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/reserved-words/-/reserved-words-0.1.2.tgz", + "integrity": "sha1-AKCUD5jNUBrqqsMWQR2a3FKzGrE=", + "dev": true + }, "resolve": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.3.3.tgz", @@ -6827,6 +7432,21 @@ "path-parse": "1.0.5" } }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "requires": { + "resolve-from": "3.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" + } + } + }, "resolve-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.0.tgz", @@ -6997,7 +7617,7 @@ "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", "requires": { "glob": "7.1.2", - "interpret": "1.0.3", + "interpret": "1.0.4", "rechoir": "0.6.2" } }, @@ -7007,6 +7627,60 @@ "integrity": "sha1-Zq/Ue2oSky2Qccv9mKUueFzQuhQ=", "dev": true }, + "should": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/should/-/should-13.1.0.tgz", + "integrity": "sha512-Nn354G2A2lnmDsKB5rQbSjdOA6XOYcdO8XysWOY7iGJMMsuQf3vo1yHcwjjczNUQJY7sKYlY/mAc2FoZpaGvDA==", + "dev": true, + "requires": { + "should-equal": "2.0.0", + "should-format": "3.0.3", + "should-type": "1.4.0", + "should-type-adaptors": "1.0.1", + "should-util": "1.0.0" + } + }, + "should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "dev": true, + "requires": { + "should-type": "1.4.0" + } + }, + "should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=", + "dev": true, + "requires": { + "should-type": "1.4.0", + "should-type-adaptors": "1.0.1" + } + }, + "should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=", + "dev": true + }, + "should-type-adaptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.0.1.tgz", + "integrity": "sha1-7+VVPN9oz/ZuXF9RtxLcNRx3vqo=", + "dev": true, + "requires": { + "should-type": "1.4.0", + "should-util": "1.0.0" + } + }, + "should-util": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz", + "integrity": "sha1-yYzaN0qmsZDfi6h8mInCtNtiAGM=", + "dev": true + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -7370,9 +8044,9 @@ } }, "tapable": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.6.tgz", - "integrity": "sha1-IGvo4YiGC1FEJTdebxrom/sB/Y0=" + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.8.tgz", + "integrity": "sha1-mTcqXJmb8t8WCvwNdL7U9HlIzSI=" }, "temp": { "version": "0.8.3", @@ -7534,6 +8208,22 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "typescript": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.2.tgz", + "integrity": "sha1-A4qV99m7tCCxvzW6MdTFwd0//jQ=", + "dev": true + }, + "typescript-eslint-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/typescript-eslint-parser/-/typescript-eslint-parser-7.0.0.tgz", + "integrity": "sha1-vlfYdo43cHr4JeM56irxjXOTyrs=", + "dev": true, + "requires": { + "lodash.unescape": "4.0.1", + "semver": "5.3.0" + } + }, "uglify-js": { "version": "2.8.29", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", @@ -7701,6 +8391,12 @@ "vinyl": "1.2.0" } }, + "vlq": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.2.tgz", + "integrity": "sha1-4xbVJXtAuGu0PLjV/qXX9U1rDKE=", + "dev": true + }, "vm-browserify": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", @@ -7751,9 +8447,9 @@ "dev": true }, "webpack": { - "version": "3.5.6", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.5.6.tgz", - "integrity": "sha512-sXnxfx6KoZVrFAGLjdhCCwDtDwkYMfwm8mJjkQv3thr5pjTlbxopVlr/kJwc9Bz317gL+gNjvz++ir9TgG1MDg==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.6.0.tgz", + "integrity": "sha512-OsHT3D0W0KmPPh60tC7asNnOmST6bKTiR90UyEdT9QYoaJ4OYN4Gg7WK1k3VxHK07ZoiYWPsKvlS/gAjwL/vRA==", "requires": { "acorn": "5.1.2", "acorn-dynamic-import": "2.0.2", @@ -7762,7 +8458,7 @@ "async": "2.5.0", "enhanced-resolve": "3.4.1", "escope": "3.6.0", - "interpret": "1.0.3", + "interpret": "1.0.4", "json-loader": "0.5.7", "json5": "0.5.1", "loader-runner": "2.3.0", @@ -7784,6 +8480,11 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==" }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, "async": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", @@ -7792,6 +8493,33 @@ "lodash": "4.17.4" } }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, "enhanced-resolve": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz", @@ -7803,10 +8531,142 @@ "tapable": "0.2.8" } }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "2.0.0" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "requires": { + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "requires": { + "pify": "2.3.0" + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, "tapable": { "version": "0.2.8", "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.8.tgz", "integrity": "sha1-mTcqXJmb8t8WCvwNdL7U9HlIzSI=" + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "requires": { + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "requires": { + "camelcase": "4.1.0" + } } } }, @@ -7970,20 +8830,20 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" }, "yargs": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", - "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", + "integrity": "sha1-UqzCP+7Kw0BCB47njAwAf1CF20w=", "requires": { "camelcase": "4.1.0", "cliui": "3.2.0", "decamelize": "1.2.0", "get-caller-file": "1.0.2", - "os-locale": "2.0.0", + "os-locale": "2.1.0", "read-pkg-up": "2.0.0", "require-directory": "2.1.1", "require-main-filename": "1.0.1", "set-blocking": "2.0.0", - "string-width": "2.1.0", + "string-width": "2.1.1", "which-module": "2.0.0", "y18n": "3.2.1", "yargs-parser": "7.0.0" @@ -8021,22 +8881,13 @@ } } }, - "cross-spawn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", - "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", - "requires": { - "lru-cache": "4.1.1", - "which": "1.2.14" - } - }, "execa": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.5.1.tgz", - "integrity": "sha1-3j+4XLjW6RyFvLzrFkWBeFy1ezY=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "requires": { - "cross-spawn": "4.0.2", - "get-stream": "2.3.1", + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", "is-stream": "1.1.0", "npm-run-path": "2.0.2", "p-finally": "1.0.0", @@ -8052,15 +8903,6 @@ "locate-path": "2.0.0" } }, - "get-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", - "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", - "requires": { - "object-assign": "4.1.1", - "pinkie-promise": "2.0.1" - } - }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -8073,11 +8915,11 @@ } }, "os-locale": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.0.0.tgz", - "integrity": "sha1-FZGN7VEFIrge565aMJ1U9jn8OaQ=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "requires": { - "execa": "0.5.1", + "execa": "0.7.0", "lcid": "1.0.0", "mem": "1.1.0" } @@ -8110,9 +8952,9 @@ } }, "string-width": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.0.tgz", - "integrity": "sha1-AwZkVh/BRslCPsfZeP4kV0N/5tA=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "requires": { "is-fullwidth-code-point": "2.0.0", "strip-ansi": "4.0.0" @@ -8142,14 +8984,21 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "requires": { - "camelcase": "4.1.0" - } + } + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "requires": { + "camelcase": "4.1.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" } } }, diff --git a/package.json b/package.json index 3a99527065c..ab44fc77833 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,11 @@ }, "scripts": { "lint": "eslint \"**/*.js\"", + "format": "prettier-eslint \"bin/**/**/*.js\" --write && prettier-eslint \"lib/**/**/*.js\" --write && prettier-eslint \"test/**/**/*.js\" --write", + "test:cli": "mocha test/*.test.js --max-old-space-size=4096 --harmony --check-leaks", "lint:codeOnly": "eslint \"{lib,bin,__mocks__}/**/!(__testfixtures__)/*.js\" \"{lib,bin,__mocks__}/**.js\"", "precommit": "lint-staged", + "prepublish": "flow-remove-types lib/ -d dist/", "pretest": "npm run lint", "test": "jest --coverage" }, @@ -39,11 +42,11 @@ "chalk": "^2.0.1", "cross-spawn": "^5.1.0", "diff": "^3.3.0", - "enhanced-resolve": "^3.3.0", + "enhanced-resolve": "^3.4.1", "global-modules": "^1.0.0", "got": "^7.1.0", "inquirer": "^3.2.0", - "interpret": "^1.0.3", + "interpret": "^1.0.4", "jscodeshift": "^0.3.32", "listr": "^0.12.0", "loader-utils": "^1.1.0", @@ -52,12 +55,13 @@ "p-lazy": "^1.0.0", "prettier": "^1.5.3", "recast": "git://github.com/kalcifer/recast.git#bug/allowbreak", + "resolve-cwd": "^2.0.0", "rx": "^4.1.0", - "supports-color": "^4.2.0", - "webpack": "^3.3.0", + "supports-color": "^4.4.0", + "webpack": "^3.6.0", "webpack-addons": "1.1.2", "webpack-addons-ylvis": "0.0.34", - "yargs": "^8.0.2", + "yargs": "^9.0.1", "yeoman-environment": "^2.0.0", "yeoman-generator": "git://github.com/ev1stensberg/generator.git#Feature-getArgument" }, @@ -73,9 +77,13 @@ "eslint-plugin-flowtype": "^2.35.1", "eslint-plugin-node": "^5.1.0", "flow-bin": "^0.49.1", + "flow-remove-types": "^1.2.1", "husky": "^0.14.3", "jest": "^20.0.4", "jest-cli": "^20.0.4", - "lint-staged": "^4.1.3" + "lint-staged": "^4.1.3", + "mocha": "^3.5.3", + "prettier-eslint-cli": "^4.3.2", + "should": "^13.1.0" } } diff --git a/test/BinTestCases.test.js b/test/BinTestCases.test.js new file mode 100644 index 00000000000..5bb0bbdda8d --- /dev/null +++ b/test/BinTestCases.test.js @@ -0,0 +1,146 @@ +/* globals describe it before */ +"use strict"; + +const should = require("should"); +const path = require("path"); +const fs = require("fs"); +const spawn = require("child_process").spawn; + +function loadOptsFile(optsPath) { + // Options file parser from Mocha + // https://github.com/mochajs/mocha/blob/2bb2b9fa35818db7a02e5068364b0c417436b1af/bin/options.js#L25-L31 + return fs + .readFileSync(optsPath, "utf8") + .replace(/\\\s/g, "%20") + .split(/\s/) + .filter(Boolean) + .map(function(value) { + return value.replace(/%20/g, " "); + }); +} + +function getTestSpecificArguments(testDirectory) { + try { + return loadOptsFile(path.join(testDirectory, "test.opts")); + } catch (e) { + return null; + } +} + +function convertToArrayOfLines(outputArray) { + if (outputArray.length === 0) return outputArray; + return outputArray.join("").split("\n"); +} + +const casesPath = path.join(__dirname, "binCases"); +const defaultArgs = loadOptsFile(path.join(casesPath, "test.opts")); + +describe("BinTestCases", function() { + const categoryDirectories = fs.readdirSync(casesPath).filter(folder => { + return fs.statSync(path.join(casesPath, folder)).isDirectory(); + }); + + const categories = categoryDirectories.map(function(categoryDirectory) { + return { + name: categoryDirectory, + tests: fs.readdirSync(path.join(casesPath, categoryDirectory)) + }; + }); + + categories.forEach(function(category) { + describe(category.name, function() { + category.tests.forEach(function(testName) { + const testDirectory = path.join(casesPath, category.name, testName); + const testArgs = getTestSpecificArguments(testDirectory) || defaultArgs; + const testAssertions = require(path.join(testDirectory, "test.js")); + const outputPath = path.join( + path.resolve(casesPath, "../js/bin"), + category.name, + testName + ); + + const cmd = `${path.resolve(process.cwd(), "bin/webpack.js")}`; + const args = testArgs.concat(["--output-path", `${outputPath}`]); + const opts = { + cwd: path.resolve("./", testDirectory) + }; + const asyncExists = fs.existsSync(path.join(testDirectory, "async")); + + const env = { + stdout: [], + stderr: [], + error: [] + }; + + if (asyncExists) { + describe(testName, function() { + it("should run successfully", function(done) { + this.timeout(10000); + const child = spawn(process.execPath, [cmd].concat(args), opts); + child.on("close", function(code) { + env.code = code; + }); + + child.on("error", function(error) { + env.error.push(error); + }); + + child.stdout.on("data", data => { + env.stdout.push(data); + }); + + child.stderr.on("data", data => { + env.stderr.push(data); + }); + setTimeout(() => { + if (env.code) { + done(`Watch didn't run ${env.error}`); + } + + const stdout = convertToArrayOfLines(env.stdout); + const stderr = convertToArrayOfLines(env.stderr); + testAssertions(stdout, stderr, done); + child.kill(); + }, 3000); // wait a little to get an output + }); + }); + } else { + describe(testName, function() { + before(function(done) { + this.timeout(20000); + + const child = spawn(process.execPath, [cmd].concat(args), opts); + + child.on("close", function(code) { + env.code = code; + done(); + }); + + child.on("error", function(error) { + env.error.push(error); + }); + + child.stdout.on("data", data => { + env.stdout.push(data); + }); + + child.stderr.on("data", data => { + env.stderr.push(data); + }); + }); + + it("should not cause any errors", function() { + should(env.error).be.empty(); + }); + + it("should run successfully", function() { + const stdout = convertToArrayOfLines(env.stdout); + const stderr = convertToArrayOfLines(env.stderr); + testAssertions(env.code, stdout, stderr); + }); + }); + } + }); + }); + }); +}); diff --git a/test/binCases/config-name/found-many/index.js b/test/binCases/config-name/found-many/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/config-name/found-many/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/config-name/found-many/index2.js b/test/binCases/config-name/found-many/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/config-name/found-many/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/config-name/found-many/index3.js b/test/binCases/config-name/found-many/index3.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/config-name/found-many/test.js b/test/binCases/config-name/found-many/test.js new file mode 100644 index 00000000000..c4af6f45db6 --- /dev/null +++ b/test/binCases/config-name/found-many/test.js @@ -0,0 +1,9 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + stdout.should.be.ok(); + stdout[7].should.containEql("./index2.js"); + stdout[13].should.containEql("./index3.js"); + stderr.should.be.empty(); +}; diff --git a/test/binCases/config-name/found-many/test.opts b/test/binCases/config-name/found-many/test.opts new file mode 100644 index 00000000000..059f8c49627 --- /dev/null +++ b/test/binCases/config-name/found-many/test.opts @@ -0,0 +1,6 @@ +--config ./webpack.config.js +--config-name bar +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node + diff --git a/test/binCases/config-name/found-many/webpack.config.js b/test/binCases/config-name/found-many/webpack.config.js new file mode 100644 index 00000000000..2f6d0872765 --- /dev/null +++ b/test/binCases/config-name/found-many/webpack.config.js @@ -0,0 +1,16 @@ +var path = require("path"); + +module.exports = [ + { + name: "foo", + entry: path.resolve(__dirname, "./index") + }, + { + name: "bar", + entry: path.resolve(__dirname, "./index2") + }, + { + name: "bar", + entry: path.resolve(__dirname, "./index3.js") + } +]; diff --git a/test/binCases/config-name/found-one/index.js b/test/binCases/config-name/found-one/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/config-name/found-one/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/config-name/found-one/index2.js b/test/binCases/config-name/found-one/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/config-name/found-one/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/config-name/found-one/test.js b/test/binCases/config-name/found-one/test.js new file mode 100644 index 00000000000..373fd876c4c --- /dev/null +++ b/test/binCases/config-name/found-one/test.js @@ -0,0 +1,9 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[5].should.containEql("./index2.js"); + stderr.should.be.empty(); +}; diff --git a/test/binCases/config-name/found-one/test.opts b/test/binCases/config-name/found-one/test.opts new file mode 100644 index 00000000000..b9b00798672 --- /dev/null +++ b/test/binCases/config-name/found-one/test.opts @@ -0,0 +1,5 @@ +--config ./webpack.config.js +--config-name bar +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/config-name/found-one/webpack.config.js b/test/binCases/config-name/found-one/webpack.config.js new file mode 100644 index 00000000000..cfeca70c7a6 --- /dev/null +++ b/test/binCases/config-name/found-one/webpack.config.js @@ -0,0 +1,12 @@ +var path = require("path"); + +module.exports = [ + { + name: "foo", + entry: path.resolve(__dirname, "./index") + }, + { + name: "bar", + entry: path.resolve(__dirname, "./index2") + } +]; diff --git a/test/binCases/config-name/not-found/test.js b/test/binCases/config-name/not-found/test.js new file mode 100644 index 00000000000..ccf5c59f0b6 --- /dev/null +++ b/test/binCases/config-name/not-found/test.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.not.eql(0); + stdout.should.be.empty(); + stderr[0].should.containEql("Configuration with name 'foo' was not found."); +}; diff --git a/test/binCases/config-name/not-found/test.opts b/test/binCases/config-name/not-found/test.opts new file mode 100644 index 00000000000..dfe77dcedc7 --- /dev/null +++ b/test/binCases/config-name/not-found/test.opts @@ -0,0 +1,2 @@ +--config ./webpack.config.js +--config-name foo diff --git a/test/binCases/config-name/not-found/webpack.config.js b/test/binCases/config-name/not-found/webpack.config.js new file mode 100644 index 00000000000..3c788726cac --- /dev/null +++ b/test/binCases/config-name/not-found/webpack.config.js @@ -0,0 +1,5 @@ +module.exports = [ + { + name: "bar" + } +]; diff --git a/test/binCases/configFile/profile/bar.js b/test/binCases/configFile/profile/bar.js new file mode 100644 index 00000000000..636c1fc2774 --- /dev/null +++ b/test/binCases/configFile/profile/bar.js @@ -0,0 +1 @@ +console.log("bar"); diff --git a/test/binCases/configFile/profile/foo.js b/test/binCases/configFile/profile/foo.js new file mode 100644 index 00000000000..2753f2eb024 --- /dev/null +++ b/test/binCases/configFile/profile/foo.js @@ -0,0 +1,3 @@ +require("./bar"); + +console.log("foo"); diff --git a/test/binCases/configFile/profile/index.js b/test/binCases/configFile/profile/index.js new file mode 100644 index 00000000000..e51c55eb6a5 --- /dev/null +++ b/test/binCases/configFile/profile/index.js @@ -0,0 +1 @@ +const foo = require("./foo"); diff --git a/test/binCases/configFile/profile/test.js b/test/binCases/configFile/profile/test.js new file mode 100644 index 00000000000..ee830f33d11 --- /dev/null +++ b/test/binCases/configFile/profile/test.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[6].should.containEql("factory:"); + stdout[8].should.containEql("factory:"); + stdout[10].should.containEql("factory:"); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/configFile/profile/webpack.config.js b/test/binCases/configFile/profile/webpack.config.js new file mode 100644 index 00000000000..686dc437972 --- /dev/null +++ b/test/binCases/configFile/profile/webpack.config.js @@ -0,0 +1,6 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index"), + profile: true +}; diff --git a/test/binCases/entry/multi-file/a.js b/test/binCases/entry/multi-file/a.js new file mode 100644 index 00000000000..aa7a96ad992 --- /dev/null +++ b/test/binCases/entry/multi-file/a.js @@ -0,0 +1 @@ +module.exports = "fileA"; diff --git a/test/binCases/entry/multi-file/index.js b/test/binCases/entry/multi-file/index.js new file mode 100644 index 00000000000..0d24e266fe2 --- /dev/null +++ b/test/binCases/entry/multi-file/index.js @@ -0,0 +1 @@ +module.exports = "index"; diff --git a/test/binCases/entry/multi-file/test.js b/test/binCases/entry/multi-file/test.js new file mode 100644 index 00000000000..cfa1ff6d584 --- /dev/null +++ b/test/binCases/entry/multi-file/test.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[4].should.containEql("null.js"); + stdout[5].should.match(/multi.*index\.js.*a\.js/); // should have multi-file entry + stdout[6].should.match(/index\.js.*\{0\}/); + stdout[7].should.match(/a\.js.*\{0\}/); + stderr.should.be.empty(); +}; diff --git a/test/binCases/entry/multi-file/test.opts b/test/binCases/entry/multi-file/test.opts new file mode 100644 index 00000000000..53402ac53c5 --- /dev/null +++ b/test/binCases/entry/multi-file/test.opts @@ -0,0 +1,6 @@ +--entry ./index.js +--entry ./a.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/entry/multi-file/webpack.config.js b/test/binCases/entry/multi-file/webpack.config.js new file mode 100644 index 00000000000..f053ebf7976 --- /dev/null +++ b/test/binCases/entry/multi-file/webpack.config.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/test/binCases/entry/named-entry/a.js b/test/binCases/entry/named-entry/a.js new file mode 100644 index 00000000000..aa7a96ad992 --- /dev/null +++ b/test/binCases/entry/named-entry/a.js @@ -0,0 +1 @@ +module.exports = "fileA"; diff --git a/test/binCases/entry/named-entry/index.js b/test/binCases/entry/named-entry/index.js new file mode 100644 index 00000000000..0d24e266fe2 --- /dev/null +++ b/test/binCases/entry/named-entry/index.js @@ -0,0 +1 @@ +module.exports = "index"; diff --git a/test/binCases/entry/named-entry/test.js b/test/binCases/entry/named-entry/test.js new file mode 100644 index 00000000000..4c62f985eb6 --- /dev/null +++ b/test/binCases/entry/named-entry/test.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[4].should.containEql("null.js"); + stdout[5].should.containEql("foo.js"); // named entry from --entry foo=./a.js + stdout[6].should.match(/a\.js.*\{1\}/); + stdout[7].should.match(/index\.js.*\{0\}/); + stderr.should.be.empty(); +}; diff --git a/test/binCases/entry/named-entry/test.opts b/test/binCases/entry/named-entry/test.opts new file mode 100644 index 00000000000..b8f0fa016e2 --- /dev/null +++ b/test/binCases/entry/named-entry/test.opts @@ -0,0 +1,6 @@ +--entry foo=./a.js +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/entry/named-entry/webpack.config.js b/test/binCases/entry/named-entry/webpack.config.js new file mode 100644 index 00000000000..f053ebf7976 --- /dev/null +++ b/test/binCases/entry/named-entry/webpack.config.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/test/binCases/entry/non-hyphenated-args/a.js b/test/binCases/entry/non-hyphenated-args/a.js new file mode 100644 index 00000000000..aa7a96ad992 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/a.js @@ -0,0 +1 @@ +module.exports = "fileA"; diff --git a/test/binCases/entry/non-hyphenated-args/index.js b/test/binCases/entry/non-hyphenated-args/index.js new file mode 100644 index 00000000000..0d24e266fe2 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/index.js @@ -0,0 +1 @@ +module.exports = "index"; diff --git a/test/binCases/entry/non-hyphenated-args/test.js b/test/binCases/entry/non-hyphenated-args/test.js new file mode 100644 index 00000000000..0e1ae1ce1ff --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/test.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[4].should.containEql("null.js"); + stdout[5].should.containEql("main.js"); // non-hyphenated arg ./a.js should create chunk "main" + stdout[6].should.match(/index\.js.*\{0\}/); // index.js should be in chunk 0 + stdout[7].should.match(/a\.js.*\{1\}/); // a.js should be in chunk 1 + stderr.should.be.empty(); +}; diff --git a/test/binCases/entry/non-hyphenated-args/test.opts b/test/binCases/entry/non-hyphenated-args/test.opts new file mode 100644 index 00000000000..6b8499d5275 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/test.opts @@ -0,0 +1,6 @@ +./a.js +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/entry/non-hyphenated-args/webpack.config.js b/test/binCases/entry/non-hyphenated-args/webpack.config.js new file mode 100644 index 00000000000..f053ebf7976 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/webpack.config.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/test/binCases/errors/issue-5576/a.js b/test/binCases/errors/issue-5576/a.js new file mode 100644 index 00000000000..aa7a96ad992 --- /dev/null +++ b/test/binCases/errors/issue-5576/a.js @@ -0,0 +1 @@ +module.exports = "fileA"; diff --git a/test/binCases/errors/issue-5576/a/.keep b/test/binCases/errors/issue-5576/a/.keep new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/test/binCases/errors/issue-5576/a/.keep @@ -0,0 +1 @@ + diff --git a/test/binCases/errors/issue-5576/test.js b/test/binCases/errors/issue-5576/test.js new file mode 100644 index 00000000000..bd4db65fd62 --- /dev/null +++ b/test/binCases/errors/issue-5576/test.js @@ -0,0 +1,14 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(2); + + stdout[0].should.containEql("Hash: "); + stdout[1].should.containEql("Version: "); + stdout[2].should.containEql("Time: "); + stdout[4].should.containEql( + "ERROR in Entry module not found: Error: Can't resolve" + ); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/errors/issue-5576/test.opts b/test/binCases/errors/issue-5576/test.opts new file mode 100644 index 00000000000..368eb2326cf --- /dev/null +++ b/test/binCases/errors/issue-5576/test.opts @@ -0,0 +1,3 @@ +a +bundle.js + diff --git a/test/binCases/errors/issue-5576/webpack.config.js b/test/binCases/errors/issue-5576/webpack.config.js new file mode 100644 index 00000000000..f053ebf7976 --- /dev/null +++ b/test/binCases/errors/issue-5576/webpack.config.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/test/binCases/errors/parse/index.js b/test/binCases/errors/parse/index.js new file mode 100644 index 00000000000..5c34318c214 --- /dev/null +++ b/test/binCases/errors/parse/index.js @@ -0,0 +1 @@ +} diff --git a/test/binCases/errors/parse/test.js b/test/binCases/errors/parse/test.js new file mode 100644 index 00000000000..122ab47b45b --- /dev/null +++ b/test/binCases/errors/parse/test.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(2); + + stdout[0].should.containEql("Hash: "); + stdout[1].should.containEql("Version: "); + stdout[2].should.containEql("Time: "); + stdout[5].should.containEql("./index.js"); + stdout[5].should.containEql("[built]"); + stdout[5].should.containEql("[failed]"); + stdout[5].should.containEql("[1 error]"); + stdout[7].should.containEql("ERROR in ./index.js"); + stdout[8].should.containEql("Module parse failed:"); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/errors/parse/webpack.config.js b/test/binCases/errors/parse/webpack.config.js new file mode 100644 index 00000000000..f00c469a2be --- /dev/null +++ b/test/binCases/errors/parse/webpack.config.js @@ -0,0 +1,4 @@ +module.exports = { + context: __dirname, + entry: "./index" +}; diff --git a/test/binCases/help/help-output/test.js b/test/binCases/help/help-output/test.js new file mode 100644 index 00000000000..895d915c23e --- /dev/null +++ b/test/binCases/help/help-output/test.js @@ -0,0 +1,19 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[0].should.startWith("webpack"); + stdout.should.containEql("Config options:"); + stdout.should.containEql("Basic options:"); + stdout.should.containEql("Module options:"); + stdout.should.containEql("Output options:"); + stdout.should.containEql("Advanced options:"); + stdout.should.containEql("Resolving options:"); + stdout.should.containEql("Optimizing options:"); + stdout.should.containEql("Stats options:"); + stdout.should.containEql("Options:"); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/help/help-output/test.opts b/test/binCases/help/help-output/test.opts new file mode 100644 index 00000000000..2255a80a730 --- /dev/null +++ b/test/binCases/help/help-output/test.opts @@ -0,0 +1 @@ +--help diff --git a/test/binCases/module/module-bind/file.post b/test/binCases/module/module-bind/file.post new file mode 100644 index 00000000000..8b1e502f812 --- /dev/null +++ b/test/binCases/module/module-bind/file.post @@ -0,0 +1 @@ +post diff --git a/test/binCases/module/module-bind/file.pre b/test/binCases/module/module-bind/file.pre new file mode 100644 index 00000000000..ecca61d996a --- /dev/null +++ b/test/binCases/module/module-bind/file.pre @@ -0,0 +1 @@ +pre diff --git a/test/binCases/module/module-bind/index.js b/test/binCases/module/module-bind/index.js new file mode 100644 index 00000000000..18c4f18cda7 --- /dev/null +++ b/test/binCases/module/module-bind/index.js @@ -0,0 +1,3 @@ +var pre = require("./file.pre"); +var post = require("./file.post"); +module.exports = "foo"; diff --git a/test/binCases/module/module-bind/post-loader.js b/test/binCases/module/module-bind/post-loader.js new file mode 100644 index 00000000000..713c44c1103 --- /dev/null +++ b/test/binCases/module/module-bind/post-loader.js @@ -0,0 +1,4 @@ +module.exports = function(source) { + console.log("post-loaded " + source.replace(/\r?\n/g, "")); + return source; +}; diff --git a/test/binCases/module/module-bind/pre-loader.js b/test/binCases/module/module-bind/pre-loader.js new file mode 100644 index 00000000000..32a5b4c2656 --- /dev/null +++ b/test/binCases/module/module-bind/pre-loader.js @@ -0,0 +1,4 @@ +module.exports = function(source) { + console.log("pre-loaded " + source.replace(/\r?\n/g, "")); + return source; +}; diff --git a/test/binCases/module/module-bind/test.js b/test/binCases/module/module-bind/test.js new file mode 100644 index 00000000000..eeef1f0ca6c --- /dev/null +++ b/test/binCases/module/module-bind/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout.should.containEql("pre-loaded pre"); + stdout.should.containEql("post-loaded post"); + stderr.should.be.empty(); +}; diff --git a/test/binCases/module/module-bind/test.opts b/test/binCases/module/module-bind/test.opts new file mode 100644 index 00000000000..94331cd34e2 --- /dev/null +++ b/test/binCases/module/module-bind/test.opts @@ -0,0 +1,7 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--module-bind-pre pre=./pre-loader +--module-bind-post post=./post-loader diff --git a/test/binCases/module/module-bind/webpack.config.js b/test/binCases/module/module-bind/webpack.config.js new file mode 100644 index 00000000000..a5c12a44666 --- /dev/null +++ b/test/binCases/module/module-bind/webpack.config.js @@ -0,0 +1,5 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index") +}; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/index.js b/test/binCases/plugins/uglifyjsplugin-empty-args/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/test.js b/test/binCases/plugins/uglifyjsplugin-empty-args/test.js new file mode 100644 index 00000000000..7837b1d9536 --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[4].should.containEql("bytes"); // without uglifyjs it's multiple kBs + + stderr.should.be.empty(); +}; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/test.opts b/test/binCases/plugins/uglifyjsplugin-empty-args/test.opts new file mode 100644 index 00000000000..edc5ab3dcb3 --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/test.opts @@ -0,0 +1,6 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--plugin webpack/lib/optimize/UglifyJsPlugin diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/webpack.config.js b/test/binCases/plugins/uglifyjsplugin-empty-args/webpack.config.js new file mode 100644 index 00000000000..a5c12a44666 --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/webpack.config.js @@ -0,0 +1,5 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index") +}; diff --git a/test/binCases/stats/custom-preset/index.js b/test/binCases/stats/custom-preset/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/stats/custom-preset/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/stats/custom-preset/test.js b/test/binCases/stats/custom-preset/test.js new file mode 100644 index 00000000000..5457915cd9f --- /dev/null +++ b/test/binCases/stats/custom-preset/test.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + stderr.should.be.empty(); + code.should.be.eql(0); + stdout.should.be.empty(); +}; diff --git a/test/binCases/stats/custom-preset/test.opts b/test/binCases/stats/custom-preset/test.opts new file mode 100644 index 00000000000..e45b168921d --- /dev/null +++ b/test/binCases/stats/custom-preset/test.opts @@ -0,0 +1,5 @@ +--entry ./index.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--display diff --git a/test/binCases/stats/multi-config/index.js b/test/binCases/stats/multi-config/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/stats/multi-config/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/stats/multi-config/index2.js b/test/binCases/stats/multi-config/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/stats/multi-config/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/stats/multi-config/test.js b/test/binCases/stats/multi-config/test.js new file mode 100644 index 00000000000..9515f2f778c --- /dev/null +++ b/test/binCases/stats/multi-config/test.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(0); + stdout.should.be.ok(); + stderr.should.be.empty(); +}; diff --git a/test/binCases/stats/multi-config/webpack.config.js b/test/binCases/stats/multi-config/webpack.config.js new file mode 100644 index 00000000000..f522c7813d3 --- /dev/null +++ b/test/binCases/stats/multi-config/webpack.config.js @@ -0,0 +1,12 @@ +var path = require("path"); + +module.exports = [ + { + entry: path.resolve(__dirname, "./index"), + stats: "errors-only" + }, + { + entry: path.resolve(__dirname, "./index2"), + stats: "errors-only" + } +]; diff --git a/test/binCases/stats/none/index.js b/test/binCases/stats/none/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/stats/none/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/stats/none/test.js b/test/binCases/stats/none/test.js new file mode 100644 index 00000000000..a2cc82d2396 --- /dev/null +++ b/test/binCases/stats/none/test.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(0); + stdout.should.be.empty(); + stderr.should.be.empty(); +}; diff --git a/test/binCases/stats/none/webpack.config.js b/test/binCases/stats/none/webpack.config.js new file mode 100644 index 00000000000..40a6ae80766 --- /dev/null +++ b/test/binCases/stats/none/webpack.config.js @@ -0,0 +1,6 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index"), + stats: "none" +}; diff --git a/test/binCases/stats/single-config/index.js b/test/binCases/stats/single-config/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/stats/single-config/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/stats/single-config/test.js b/test/binCases/stats/single-config/test.js new file mode 100644 index 00000000000..a961bcd51de --- /dev/null +++ b/test/binCases/stats/single-config/test.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(0); + + stdout.should.be.ok(); + stdout[0].should.containEql("Hash: "); + stdout[1].should.containEql("Version: "); + stdout[2].should.containEql("Time: "); + stdout[4].should.containEql("\u001b[1m\u001b[32mnull.js\u001b[39m\u001b[22m"); + stdout[5].should.containEql("chunk"); + stdout[6].should.not.containEql("./index.js"); + stdout[6].should.not.containEql("[built]"); + stdout[6].should.containEql("1 module"); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/stats/single-config/webpack.config.js b/test/binCases/stats/single-config/webpack.config.js new file mode 100644 index 00000000000..d15e7a1936d --- /dev/null +++ b/test/binCases/stats/single-config/webpack.config.js @@ -0,0 +1,11 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index"), + stats: { + assets: true, + colors: true, + chunks: true, + maxModules: 0 + } +}; diff --git a/test/binCases/test.opts b/test/binCases/test.opts new file mode 100644 index 00000000000..f9e6657e70b --- /dev/null +++ b/test/binCases/test.opts @@ -0,0 +1,5 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/watch/multi-config-watch-opt/async b/test/binCases/watch/multi-config-watch-opt/async new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/multi-config-watch-opt/index.js b/test/binCases/watch/multi-config-watch-opt/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/watch/multi-config-watch-opt/index2.js b/test/binCases/watch/multi-config-watch-opt/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/watch/multi-config-watch-opt/test.js b/test/binCases/watch/multi-config-watch-opt/test.js new file mode 100644 index 00000000000..f4d37c16fa0 --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + stdout.should.be.ok(); + stdout[0].should.containEql(""); + stdout[1].should.containEql("Webpack is watching the files…"); + + stderr.should.be.empty(); + done(); +}; diff --git a/test/binCases/watch/multi-config-watch-opt/test.opts b/test/binCases/watch/multi-config-watch-opt/test.opts new file mode 100644 index 00000000000..38534ad5708 --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/test.opts @@ -0,0 +1,6 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--watch diff --git a/test/binCases/watch/multi-config-watch-opt/webpack.config.js b/test/binCases/watch/multi-config-watch-opt/webpack.config.js new file mode 100644 index 00000000000..1eea67aa467 --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/webpack.config.js @@ -0,0 +1,10 @@ +var path = require("path"); + +module.exports = [ + { + entry: path.resolve(__dirname, "./index") + }, + { + entry: path.resolve(__dirname, "./index2") + } +]; diff --git a/test/binCases/watch/multi-config/async b/test/binCases/watch/multi-config/async new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/multi-config/index.js b/test/binCases/watch/multi-config/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/watch/multi-config/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/watch/multi-config/index2.js b/test/binCases/watch/multi-config/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/watch/multi-config/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/watch/multi-config/test.js b/test/binCases/watch/multi-config/test.js new file mode 100644 index 00000000000..f4d37c16fa0 --- /dev/null +++ b/test/binCases/watch/multi-config/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + stdout.should.be.ok(); + stdout[0].should.containEql(""); + stdout[1].should.containEql("Webpack is watching the files…"); + + stderr.should.be.empty(); + done(); +}; diff --git a/test/binCases/watch/multi-config/webpack.config.js b/test/binCases/watch/multi-config/webpack.config.js new file mode 100644 index 00000000000..9bb64699dc7 --- /dev/null +++ b/test/binCases/watch/multi-config/webpack.config.js @@ -0,0 +1,11 @@ +var path = require("path"); + +module.exports = [ + { + entry: path.resolve(__dirname, "./index"), + watch: true + }, + { + entry: path.resolve(__dirname, "./index2") + } +]; diff --git a/test/binCases/watch/single-config-watch-opt/async b/test/binCases/watch/single-config-watch-opt/async new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/single-config-watch-opt/index.js b/test/binCases/watch/single-config-watch-opt/index.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/single-config-watch-opt/test.js b/test/binCases/watch/single-config-watch-opt/test.js new file mode 100644 index 00000000000..f4d37c16fa0 --- /dev/null +++ b/test/binCases/watch/single-config-watch-opt/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + stdout.should.be.ok(); + stdout[0].should.containEql(""); + stdout[1].should.containEql("Webpack is watching the files…"); + + stderr.should.be.empty(); + done(); +}; diff --git a/test/binCases/watch/single-config-watch-opt/test.opts b/test/binCases/watch/single-config-watch-opt/test.opts new file mode 100644 index 00000000000..38534ad5708 --- /dev/null +++ b/test/binCases/watch/single-config-watch-opt/test.opts @@ -0,0 +1,6 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--watch diff --git a/test/binCases/watch/single-config-watch-opt/webpack.config.js b/test/binCases/watch/single-config-watch-opt/webpack.config.js new file mode 100644 index 00000000000..a5c12a44666 --- /dev/null +++ b/test/binCases/watch/single-config-watch-opt/webpack.config.js @@ -0,0 +1,5 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index") +}; diff --git a/test/binCases/watch/single-config/async b/test/binCases/watch/single-config/async new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/single-config/index.js b/test/binCases/watch/single-config/index.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/single-config/test.js b/test/binCases/watch/single-config/test.js new file mode 100644 index 00000000000..f4d37c16fa0 --- /dev/null +++ b/test/binCases/watch/single-config/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + stdout.should.be.ok(); + stdout[0].should.containEql(""); + stdout[1].should.containEql("Webpack is watching the files…"); + + stderr.should.be.empty(); + done(); +}; diff --git a/test/binCases/watch/single-config/webpack.config.js b/test/binCases/watch/single-config/webpack.config.js new file mode 100644 index 00000000000..8a01f0715a7 --- /dev/null +++ b/test/binCases/watch/single-config/webpack.config.js @@ -0,0 +1,6 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index"), + watch: true +}; diff --git a/test/js/bin/config-name/found-many/main.js b/test/js/bin/config-name/found-many/main.js new file mode 100644 index 00000000000..115f09a4d04 --- /dev/null +++ b/test/js/bin/config-name/found-many/main.js @@ -0,0 +1,74 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = "bar"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/config-name/found-one/main.js b/test/js/bin/config-name/found-one/main.js new file mode 100644 index 00000000000..115f09a4d04 --- /dev/null +++ b/test/js/bin/config-name/found-one/main.js @@ -0,0 +1,74 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = "bar"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/configFile/profile/null.js b/test/js/bin/configFile/profile/null.js new file mode 100644 index 00000000000..ab5478d665e --- /dev/null +++ b/test/js/bin/configFile/profile/null.js @@ -0,0 +1,90 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +const foo = __webpack_require__(1); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__(2); + +console.log("foo"); + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +console.log("bar"); + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/multi-file/null.js b/test/js/bin/entry/multi-file/null.js new file mode 100644 index 00000000000..ca280784866 --- /dev/null +++ b/test/js/bin/entry/multi-file/null.js @@ -0,0 +1,97 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(1); + module.exports = __webpack_require__(2); + + /***/ + }, + /* 1 */ + /***/ function(module, exports) { + module.exports = "index"; + + /***/ + }, + /* 2 */ + /***/ function(module, exports) { + module.exports = "fileA"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/entry/named-entry/foo.js b/test/js/bin/entry/named-entry/foo.js new file mode 100644 index 00000000000..39e8b5f838c --- /dev/null +++ b/test/js/bin/entry/named-entry/foo.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "fileA"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/entry/named-entry/null.js b/test/js/bin/entry/named-entry/null.js new file mode 100644 index 00000000000..50f8e4a2224 --- /dev/null +++ b/test/js/bin/entry/named-entry/null.js @@ -0,0 +1,85 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 1)); + /******/ +})( + /************************************************************************/ + /******/ [ + , + /* 0 */ /* 1 */ + /***/ function(module, exports) { + module.exports = "index"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/entry/non-hyphenated-args/main.js b/test/js/bin/entry/non-hyphenated-args/main.js new file mode 100644 index 00000000000..3c2414a7c24 --- /dev/null +++ b/test/js/bin/entry/non-hyphenated-args/main.js @@ -0,0 +1,85 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 1)); + /******/ +})( + /************************************************************************/ + /******/ [ + , + /* 0 */ /* 1 */ + /***/ function(module, exports) { + module.exports = "fileA"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/entry/non-hyphenated-args/null.js b/test/js/bin/entry/non-hyphenated-args/null.js new file mode 100644 index 00000000000..037354ae43c --- /dev/null +++ b/test/js/bin/entry/non-hyphenated-args/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "index"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/errors/parse/null.js b/test/js/bin/errors/parse/null.js new file mode 100644 index 00000000000..3df4ead4a74 --- /dev/null +++ b/test/js/bin/errors/parse/null.js @@ -0,0 +1,86 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + throw new Error( + "Module parse failed: /Users/evenstensberg/Documents/webpack-cli/test/binCases/errors/parse/index.js Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type.\n| }\n| " + ); + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/module/module-bind/null.js b/test/js/bin/module/module-bind/null.js new file mode 100644 index 00000000000..cac8026cf6a --- /dev/null +++ b/test/js/bin/module/module-bind/null.js @@ -0,0 +1,98 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports, __webpack_require__) { + var pre = __webpack_require__(1); + var post = __webpack_require__(2); + module.exports = "foo"; + + /***/ + }, + /* 1 */ + /***/ function(module, exports) { + pre; + + /***/ + }, + /* 2 */ + /***/ function(module, exports) { + post; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js b/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js new file mode 100644 index 00000000000..68f8c94b142 --- /dev/null +++ b/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js @@ -0,0 +1,38 @@ +!(function(r) { + function t(n) { + if (e[n]) return e[n].exports; + var o = (e[n] = { i: n, l: !1, exports: {} }); + return r[n].call(o.exports, o, o.exports, t), (o.l = !0), o.exports; + } + var e = {}; + (t.m = r), + (t.c = e), + (t.d = function(r, e, n) { + t.o(r, e) || + Object.defineProperty(r, e, { + configurable: !1, + enumerable: !0, + get: n + }); + }), + (t.n = function(r) { + var e = + r && r.__esModule + ? function() { + return r.default; + } + : function() { + return r; + }; + return t.d(e, "a", e), e; + }), + (t.o = function(r, t) { + return Object.prototype.hasOwnProperty.call(r, t); + }), + (t.p = ""), + t((t.s = 0)); +})([ + function(r, t) { + r.exports = "foo"; + } +]); diff --git a/test/js/bin/stats/custom-preset/null.js b/test/js/bin/stats/custom-preset/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/stats/custom-preset/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/stats/multi-config/null.js b/test/js/bin/stats/multi-config/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/stats/multi-config/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/stats/none/null.js b/test/js/bin/stats/none/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/stats/none/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/stats/single-config/null.js b/test/js/bin/stats/single-config/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/stats/single-config/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/watch/multi-config-watch-opt/null.js b/test/js/bin/watch/multi-config-watch-opt/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/watch/multi-config-watch-opt/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/watch/multi-config/null.js b/test/js/bin/watch/multi-config/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/watch/multi-config/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/watch/single-config-watch-opt/null.js b/test/js/bin/watch/single-config-watch-opt/null.js new file mode 100644 index 00000000000..23643f275de --- /dev/null +++ b/test/js/bin/watch/single-config-watch-opt/null.js @@ -0,0 +1,82 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/watch/single-config/null.js b/test/js/bin/watch/single-config/null.js new file mode 100644 index 00000000000..23643f275de --- /dev/null +++ b/test/js/bin/watch/single-config/null.js @@ -0,0 +1,82 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + /***/ + } + /******/ + ] +); From 72ff372a5a64a90113450f8e7813bc7261920023 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Thu, 21 Sep 2017 22:50:55 +0200 Subject: [PATCH 02/12] add travis builds --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 807f3a1f60b..345cebfbbec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,5 +17,7 @@ before_script: - bash <(curl -s https://codecov.io/bash) script: + - npm run prepublish + - npm run test:cli - npm run lint - npm run test From 0b3627105cb0d92323a1714b24dc7f35be17d79d Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Thu, 21 Sep 2017 22:57:23 +0200 Subject: [PATCH 03/12] add cli to signature & add ignore to trash code --- .gitignore | 3 + bin/webpack.js | 2 +- test/js/bin/entry/multi-file/null.js | 180 +++++++++-------- test/js/bin/entry/named-entry/foo.js | 156 +++++++-------- test/js/bin/entry/named-entry/null.js | 158 +++++++-------- test/js/bin/entry/non-hyphenated-args/main.js | 158 +++++++-------- test/js/bin/entry/non-hyphenated-args/null.js | 156 +++++++-------- test/js/bin/errors/parse/null.js | 157 +++++++-------- test/js/bin/module/module-bind/null.js | 182 +++++++++--------- .../plugins/uglifyjsplugin-empty-args/null.js | 39 +--- test/js/bin/stats/custom-preset/null.js | 156 +++++++-------- test/js/bin/stats/multi-config/null.js | 156 +++++++-------- test/js/bin/stats/none/null.js | 156 +++++++-------- test/js/bin/stats/single-config/null.js | 156 +++++++-------- .../bin/watch/multi-config-watch-opt/null.js | 156 +++++++-------- test/js/bin/watch/multi-config/null.js | 156 +++++++-------- .../bin/watch/single-config-watch-opt/null.js | 155 +++++++-------- test/js/bin/watch/single-config/null.js | 155 +++++++-------- 18 files changed, 1128 insertions(+), 1309 deletions(-) diff --git a/.gitignore b/.gitignore index 3d29695d9be..798edadc1c1 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ coverage # Dist build dist + +# Test Compilation +test/js/* diff --git a/bin/webpack.js b/bin/webpack.js index 829f712999d..de028bab8cf 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -31,7 +31,7 @@ if (localCLI && path.relative(localCLI, __filename) !== "") { } // eslint-disable-next-line var yargs = require("yargs").usage( - "webpack " + + "webpack-cli " + require("../package.json").version + "\n" + "Usage: https://webpack.js.org/api/cli/\n" + diff --git a/test/js/bin/entry/multi-file/null.js b/test/js/bin/entry/multi-file/null.js index ca280784866..d76d21d5f03 100644 --- a/test/js/bin/entry/multi-file/null.js +++ b/test/js/bin/entry/multi-file/null.js @@ -1,97 +1,89 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports, __webpack_require__) { - __webpack_require__(1); - module.exports = __webpack_require__(2); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { - /***/ - }, - /* 1 */ - /***/ function(module, exports) { - module.exports = "index"; +__webpack_require__(1); +module.exports = __webpack_require__(2); - /***/ - }, - /* 2 */ - /***/ function(module, exports) { - module.exports = "fileA"; - /***/ - } - /******/ - ] -); +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +module.exports = "index"; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +module.exports = "fileA"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/named-entry/foo.js b/test/js/bin/entry/named-entry/foo.js index 39e8b5f838c..70b4cfb536a 100644 --- a/test/js/bin/entry/named-entry/foo.js +++ b/test/js/bin/entry/named-entry/foo.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "fileA"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "fileA"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/named-entry/null.js b/test/js/bin/entry/named-entry/null.js index 50f8e4a2224..89fae7c48ce 100644 --- a/test/js/bin/entry/named-entry/null.js +++ b/test/js/bin/entry/named-entry/null.js @@ -1,85 +1,75 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 1)); - /******/ -})( - /************************************************************************/ - /******/ [ - , - /* 0 */ /* 1 */ - /***/ function(module, exports) { - module.exports = "index"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 1); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */, +/* 1 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "index"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/non-hyphenated-args/main.js b/test/js/bin/entry/non-hyphenated-args/main.js index 3c2414a7c24..18c1ee46cb2 100644 --- a/test/js/bin/entry/non-hyphenated-args/main.js +++ b/test/js/bin/entry/non-hyphenated-args/main.js @@ -1,85 +1,75 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 1)); - /******/ -})( - /************************************************************************/ - /******/ [ - , - /* 0 */ /* 1 */ - /***/ function(module, exports) { - module.exports = "fileA"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 1); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */, +/* 1 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "fileA"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/non-hyphenated-args/null.js b/test/js/bin/entry/non-hyphenated-args/null.js index 037354ae43c..527680c3621 100644 --- a/test/js/bin/entry/non-hyphenated-args/null.js +++ b/test/js/bin/entry/non-hyphenated-args/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "index"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "index"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/errors/parse/null.js b/test/js/bin/errors/parse/null.js index 3df4ead4a74..8ab06b6a8e2 100644 --- a/test/js/bin/errors/parse/null.js +++ b/test/js/bin/errors/parse/null.js @@ -1,86 +1,73 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - throw new Error( - "Module parse failed: /Users/evenstensberg/Documents/webpack-cli/test/binCases/errors/parse/index.js Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type.\n| }\n| " - ); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +throw new Error("Module parse failed: /Users/evenstensberg/Documents/webpack-cli/test/binCases/errors/parse/index.js Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type.\n| }\n| "); + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/module/module-bind/null.js b/test/js/bin/module/module-bind/null.js index cac8026cf6a..fe5e939a265 100644 --- a/test/js/bin/module/module-bind/null.js +++ b/test/js/bin/module/module-bind/null.js @@ -1,98 +1,90 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports, __webpack_require__) { - var pre = __webpack_require__(1); - var post = __webpack_require__(2); - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { - /***/ - }, - /* 1 */ - /***/ function(module, exports) { - pre; +var pre = __webpack_require__(1); +var post = __webpack_require__(2); +module.exports = "foo"; - /***/ - }, - /* 2 */ - /***/ function(module, exports) { - post; - /***/ - } - /******/ - ] -); +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +pre + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +post + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js b/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js index 68f8c94b142..a71ebe70b50 100644 --- a/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js +++ b/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js @@ -1,38 +1 @@ -!(function(r) { - function t(n) { - if (e[n]) return e[n].exports; - var o = (e[n] = { i: n, l: !1, exports: {} }); - return r[n].call(o.exports, o, o.exports, t), (o.l = !0), o.exports; - } - var e = {}; - (t.m = r), - (t.c = e), - (t.d = function(r, e, n) { - t.o(r, e) || - Object.defineProperty(r, e, { - configurable: !1, - enumerable: !0, - get: n - }); - }), - (t.n = function(r) { - var e = - r && r.__esModule - ? function() { - return r.default; - } - : function() { - return r; - }; - return t.d(e, "a", e), e; - }), - (t.o = function(r, t) { - return Object.prototype.hasOwnProperty.call(r, t); - }), - (t.p = ""), - t((t.s = 0)); -})([ - function(r, t) { - r.exports = "foo"; - } -]); +!function(r){function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var e={};t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{configurable:!1,enumerable:!0,get:n})},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},t.p="",t(t.s=0)}([function(r,t){r.exports="foo"}]); \ No newline at end of file diff --git a/test/js/bin/stats/custom-preset/null.js b/test/js/bin/stats/custom-preset/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/stats/custom-preset/null.js +++ b/test/js/bin/stats/custom-preset/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/stats/multi-config/null.js b/test/js/bin/stats/multi-config/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/stats/multi-config/null.js +++ b/test/js/bin/stats/multi-config/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/stats/none/null.js b/test/js/bin/stats/none/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/stats/none/null.js +++ b/test/js/bin/stats/none/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/stats/single-config/null.js b/test/js/bin/stats/single-config/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/stats/single-config/null.js +++ b/test/js/bin/stats/single-config/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/watch/multi-config-watch-opt/null.js b/test/js/bin/watch/multi-config-watch-opt/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/watch/multi-config-watch-opt/null.js +++ b/test/js/bin/watch/multi-config-watch-opt/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/watch/multi-config/null.js b/test/js/bin/watch/multi-config/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/watch/multi-config/null.js +++ b/test/js/bin/watch/multi-config/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/watch/single-config-watch-opt/null.js b/test/js/bin/watch/single-config-watch-opt/null.js index 23643f275de..30d65ea5b72 100644 --- a/test/js/bin/watch/single-config-watch-opt/null.js +++ b/test/js/bin/watch/single-config-watch-opt/null.js @@ -1,82 +1,73 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - /***/ - } - /******/ - ] -); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/watch/single-config/null.js b/test/js/bin/watch/single-config/null.js index 23643f275de..30d65ea5b72 100644 --- a/test/js/bin/watch/single-config/null.js +++ b/test/js/bin/watch/single-config/null.js @@ -1,82 +1,73 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - /***/ - } - /******/ - ] -); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + + + +/***/ }) +/******/ ]); \ No newline at end of file From 18a4df17e9993f4610c46f9ce086dfaab97520f8 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Mon, 25 Sep 2017 23:14:40 +0200 Subject: [PATCH 04/12] port to jest --- .eslintignore | 1 + bin/webpack.js | 4 +- package-lock.json | 1596 +++++++++-------- package.json | 9 +- test/BinTestCases.test.js | 17 +- test/binCases/config-name/found-many/stdin.js | 10 + test/binCases/config-name/found-many/test.js | 9 - test/binCases/config-name/found-one/stdin.js | 9 + test/binCases/config-name/found-one/test.js | 9 - test/binCases/config-name/not-found/stdin.js | 7 + test/binCases/config-name/not-found/test.js | 7 - test/binCases/configFile/profile/stdin.js | 11 + test/binCases/configFile/profile/test.js | 12 - test/binCases/entry/multi-file/stdin.js | 11 + test/binCases/entry/multi-file/test.js | 12 - test/binCases/entry/named-entry/stdin.js | 11 + test/binCases/entry/named-entry/test.js | 12 - .../entry/non-hyphenated-args/stdin.js | 11 + .../entry/non-hyphenated-args/test.js | 12 - test/binCases/errors/issue-5576/stdin.js | 13 + test/binCases/errors/issue-5576/test.js | 14 - test/binCases/errors/parse/stdin.js | 16 + test/binCases/errors/parse/test.js | 17 - test/binCases/help/help-output/stdin.js | 17 + test/binCases/help/help-output/test.js | 19 - test/binCases/module/module-bind/stdin.js | 10 + test/binCases/module/module-bind/test.js | 10 - .../uglifyjsplugin-empty-args/stdin.js | 10 + .../plugins/uglifyjsplugin-empty-args/test.js | 10 - test/binCases/stats/custom-preset/stdin.js | 7 + test/binCases/stats/custom-preset/test.js | 7 - test/binCases/stats/multi-config/stdin.js | 7 + test/binCases/stats/multi-config/test.js | 7 - test/binCases/stats/none/stdin.js | 7 + test/binCases/stats/none/test.js | 7 - test/binCases/stats/single-config/stdin.js | 16 + test/binCases/stats/single-config/test.js | 17 - .../watch/multi-config-watch-opt/stdin.js | 10 + .../watch/multi-config-watch-opt/test.js | 10 - test/binCases/watch/multi-config/stdin.js | 10 + test/binCases/watch/multi-config/test.js | 10 - .../watch/single-config-watch-opt/stdin.js | 10 + .../watch/single-config-watch-opt/test.js | 10 - test/binCases/watch/single-config/stdin.js | 10 + test/binCases/watch/single-config/test.js | 10 - 45 files changed, 1066 insertions(+), 995 deletions(-) create mode 100644 test/binCases/config-name/found-many/stdin.js delete mode 100644 test/binCases/config-name/found-many/test.js create mode 100644 test/binCases/config-name/found-one/stdin.js delete mode 100644 test/binCases/config-name/found-one/test.js create mode 100644 test/binCases/config-name/not-found/stdin.js delete mode 100644 test/binCases/config-name/not-found/test.js create mode 100644 test/binCases/configFile/profile/stdin.js delete mode 100644 test/binCases/configFile/profile/test.js create mode 100644 test/binCases/entry/multi-file/stdin.js delete mode 100644 test/binCases/entry/multi-file/test.js create mode 100644 test/binCases/entry/named-entry/stdin.js delete mode 100644 test/binCases/entry/named-entry/test.js create mode 100644 test/binCases/entry/non-hyphenated-args/stdin.js delete mode 100644 test/binCases/entry/non-hyphenated-args/test.js create mode 100644 test/binCases/errors/issue-5576/stdin.js delete mode 100644 test/binCases/errors/issue-5576/test.js create mode 100644 test/binCases/errors/parse/stdin.js delete mode 100644 test/binCases/errors/parse/test.js create mode 100644 test/binCases/help/help-output/stdin.js delete mode 100644 test/binCases/help/help-output/test.js create mode 100644 test/binCases/module/module-bind/stdin.js delete mode 100644 test/binCases/module/module-bind/test.js create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/stdin.js delete mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/test.js create mode 100644 test/binCases/stats/custom-preset/stdin.js delete mode 100644 test/binCases/stats/custom-preset/test.js create mode 100644 test/binCases/stats/multi-config/stdin.js delete mode 100644 test/binCases/stats/multi-config/test.js create mode 100644 test/binCases/stats/none/stdin.js delete mode 100644 test/binCases/stats/none/test.js create mode 100644 test/binCases/stats/single-config/stdin.js delete mode 100644 test/binCases/stats/single-config/test.js create mode 100644 test/binCases/watch/multi-config-watch-opt/stdin.js delete mode 100644 test/binCases/watch/multi-config-watch-opt/test.js create mode 100644 test/binCases/watch/multi-config/stdin.js delete mode 100644 test/binCases/watch/multi-config/test.js create mode 100644 test/binCases/watch/single-config-watch-opt/stdin.js delete mode 100644 test/binCases/watch/single-config-watch-opt/test.js create mode 100644 test/binCases/watch/single-config/stdin.js delete mode 100644 test/binCases/watch/single-config/test.js diff --git a/.eslintignore b/.eslintignore index a62988d01bf..aa24f295da5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ **/__testfixtures__/* coverage test +dist diff --git a/bin/webpack.js b/bin/webpack.js index de028bab8cf..36b34b07b29 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -12,7 +12,7 @@ var localCLI = resolveCwd.silent("webpack-cli/bin/webpack"); if (process.argv.slice(2).includes("init")) { const initPkgs = process.argv.slice(2).length === 1 ? [] : [process.argv.slice(2).pop()]; - + //eslint-disable-next-line return require("../dist/initialize")(initPkgs); } else if (process.argv.slice(2).includes("migrate")) { const filePaths = @@ -21,7 +21,7 @@ if (process.argv.slice(2).includes("init")) { throw new Error("Please specify a path to your webpack config"); } const inputConfigPath = path.resolve(process.cwd(), filePaths[0]); - + //eslint-disable-next-line return require("../dist/migrate.js")(inputConfigPath, inputConfigPath); } if (localCLI && path.relative(localCLI, __filename) !== "") { diff --git a/package-lock.json b/package-lock.json index 570f993ff07..28f4c2c5368 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "abab": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.3.tgz", - "integrity": "sha1-uB3l9ydOxOdW15fNg08wNkJyTl0=", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", + "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=", "dev": true }, "abbrev": { @@ -214,9 +214,9 @@ } }, "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true }, "ast-traverse": { @@ -229,6 +229,12 @@ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.2.tgz", "integrity": "sha1-LMGZedFcZVEIv1ZTI7jn7jh1H2s=" }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, "async": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", @@ -246,9 +252,9 @@ "dev": true }, "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", "dev": true }, "aws4": { @@ -602,6 +608,12 @@ } } }, + "babel-plugin-jest-hoist": { + "version": "21.0.2", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.0.2.tgz", + "integrity": "sha512-iQeYbiM0lr5TCW42qvGkBBoy0rTx6SPppRFT7NwvdnSwNOGMI8+1Oc27SF5wJbCvAY7x5KScP3f0TKtunl+NRw==", + "dev": true + }, "babel-plugin-jscript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/babel-plugin-jscript/-/babel-plugin-jscript-1.0.4.tgz", @@ -1095,6 +1107,15 @@ "babel-plugin-transform-flow-strip-types": "6.22.0" } }, + "babel-preset-jest": { + "version": "21.0.2", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-21.0.2.tgz", + "integrity": "sha512-WyzCFIoU+ga307hPnobHL9eRrZlpZYHQf7M3yOtimAwrLAgNFoSfin7ZVw903+zz81ZLuowZMKWCd0w3PNpAhg==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "21.0.2" + } + }, "babel-preset-stage-1": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", @@ -1247,12 +1268,12 @@ "dev": true }, "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "dev": true, "requires": { - "hoek": "2.16.3" + "hoek": "4.2.0" } }, "brace-expansion": { @@ -1301,12 +1322,6 @@ } } }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, "browserify-aes": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.8.tgz", @@ -1799,12 +1814,23 @@ } }, "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", "dev": true, "requires": { - "boom": "2.10.1" + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "dev": true, + "requires": { + "hoek": "4.2.0" + } + } } }, "crypto-browserify": { @@ -1859,14 +1885,6 @@ "dev": true, "requires": { "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "date-fns": { @@ -2226,40 +2244,16 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", + "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", "dev": true, "requires": { - "esprima": "2.7.3", - "estraverse": "1.9.3", + "esprima": "3.1.3", + "estraverse": "4.2.0", "esutils": "2.0.2", "optionator": "0.8.2", - "source-map": "0.2.0" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true, - "requires": { - "amdefine": "1.0.1" - } - } + "source-map": "0.5.6" } }, "escope": { @@ -2477,9 +2471,9 @@ } }, "exec-sh": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.0.tgz", - "integrity": "sha1-FPdd4/INKG75MwmbLOUKkDWc7xA=", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz", + "integrity": "sha512-aLt95pexaugVtQerpmE51+4QfWrNc304uez7jvj6fWnN8GeEHpttB8F36n8N7uVhUMbH/1enbxQ9HImZ4w/9qg==", "dev": true, "requires": { "merge": "1.2.0" @@ -2529,6 +2523,58 @@ "homedir-polyfill": "1.0.1" } }, + "expect": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-21.1.0.tgz", + "integrity": "sha512-gBmUVy+A4+brj/MnuiwLe+MIMfSffWUmZMNjKHrMkB0cpkAjnFdwHAxs6MvYeh4+14ocp+SfKp4ebNEhkbV3YQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "jest-diff": "21.1.0", + "jest-get-type": "21.0.2", + "jest-matcher-utils": "21.1.0", + "jest-message-util": "21.1.0", + "jest-regex-util": "21.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "jest-matcher-utils": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.1.0.tgz", + "integrity": "sha512-V/Xindf+VY5UM+oz9Nhsv0Ql93lRcKS7tHtVoXtlXkZXoXpydHwuezkLLCpZkH/Uew5y2OyDZpnlxPvEalJZng==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "pretty-format": "21.1.0" + } + }, + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", + "dev": true, + "requires": { + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" + } + } + } + }, "extend": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", @@ -2553,9 +2599,9 @@ } }, "extsprintf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", - "integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, "fast-deep-equal": { @@ -2705,14 +2751,14 @@ "dev": true }, "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", "dev": true, "requires": { "asynckit": "0.4.0", "combined-stream": "1.0.5", - "mime-types": "2.1.15" + "mime-types": "2.1.17" } }, "fs-readdir-recursive": { @@ -3493,14 +3539,6 @@ } } }, - "string_decoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", - "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", - "requires": { - "safe-buffer": "5.0.1" - } - }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -3511,6 +3549,14 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", + "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", + "requires": { + "safe-buffer": "5.0.1" + } + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -3657,14 +3703,6 @@ "dev": true, "requires": { "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "gh-got": { @@ -3792,12 +3830,6 @@ "lodash": "4.17.4" } }, - "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", - "dev": true - }, "growly": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", @@ -3828,31 +3860,19 @@ } }, "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", "dev": true }, "har-validator": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "dev": true, "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" - }, - "dependencies": { - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", - "dev": true, - "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" - } - } + "ajv": "5.2.2", + "har-schema": "2.0.0" } }, "has-ansi": { @@ -3905,23 +3925,17 @@ } }, "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "dev": true, "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.0", + "sntp": "2.0.2" } }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -3933,9 +3947,9 @@ } }, "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==", "dev": true }, "home-or-tmp": { @@ -3970,13 +3984,13 @@ } }, "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.0", + "assert-plus": "1.0.0", + "jsprim": "1.4.1", "sshpk": "1.13.1" } }, @@ -4382,19 +4396,19 @@ "dev": true }, "istanbul-api": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.1.10.tgz", - "integrity": "sha1-8n5ecSXI3hP2qAZhr3j1EuVDmys=", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.1.14.tgz", + "integrity": "sha1-JbxXAffGgMD//5E95G42GaOm5oA=", "dev": true, "requires": { "async": "2.5.0", "fileset": "2.0.3", "istanbul-lib-coverage": "1.1.1", "istanbul-lib-hook": "1.0.7", - "istanbul-lib-instrument": "1.7.3", + "istanbul-lib-instrument": "1.8.0", "istanbul-lib-report": "1.1.1", "istanbul-lib-source-maps": "1.2.1", - "istanbul-reports": "1.1.1", + "istanbul-reports": "1.1.2", "js-yaml": "3.8.4", "mkdirp": "0.5.1", "once": "1.4.0" @@ -4408,6 +4422,27 @@ "requires": { "lodash": "4.17.4" } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.8.0.tgz", + "integrity": "sha1-ZvbJQhzJ7EcE928tsIS6kHiitTI=", + "dev": true, + "requires": { + "babel-generator": "6.25.0", + "babel-template": "6.25.0", + "babel-traverse": "6.25.0", + "babel-types": "6.25.0", + "babylon": "6.18.0", + "istanbul-lib-coverage": "1.1.1", + "semver": "5.3.0" + } } } }, @@ -4473,14 +4508,14 @@ "debug": "2.6.8", "istanbul-lib-coverage": "1.1.1", "mkdirp": "0.5.1", - "rimraf": "2.6.1", + "rimraf": "2.6.2", "source-map": "0.5.6" }, "dependencies": { "rimraf": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", - "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { "glob": "7.1.2" @@ -4489,9 +4524,9 @@ } }, "istanbul-reports": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.1.tgz", - "integrity": "sha512-P8G873A0kW24XRlxHVGhMJBhQ8gWAec+dae7ZxOBzxT4w+a9ATSPvRVK3LB1RAJ9S8bg2tOyWHAGW40Zd2dKfw==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.2.tgz", + "integrity": "sha1-D7Lj9qqZIr085F0F2KtNXo4HvU8=", "dev": true, "requires": { "handlebars": "4.0.10" @@ -4517,483 +4552,628 @@ } }, "jest": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest/-/jest-20.0.4.tgz", - "integrity": "sha1-PdJgwpidba1nix6cxNkZRPbWAqw=", + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-21.1.0.tgz", + "integrity": "sha512-yPxhkAyxCymLkpZakAGm8VGNQB04HgD5bhYCQHBcIGCbH5oYHZDekkt/FBtFC2vPcyWG+dsKCqvmys/1kQYjKA==", + "dev": true, + "requires": { + "jest-cli": "21.1.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "jest-cli": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.1.0.tgz", + "integrity": "sha512-ISnDjHv9m0nCrSKFC+Cnr9SotaWHYRP+TK81vMtPwkV+/70JbfYJT6ZnuqgqyAnTYE4f/aCe6uyMPKHAVT1RpA==", + "dev": true, + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.0.1", + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "is-ci": "1.0.10", + "istanbul-api": "1.1.14", + "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-instrument": "1.7.3", + "istanbul-lib-source-maps": "1.2.1", + "jest-changed-files": "21.1.0", + "jest-config": "21.1.0", + "jest-environment-jsdom": "21.1.0", + "jest-haste-map": "21.1.0", + "jest-message-util": "21.1.0", + "jest-regex-util": "21.1.0", + "jest-resolve-dependencies": "21.1.0", + "jest-runner": "21.1.0", + "jest-runtime": "21.1.0", + "jest-snapshot": "21.1.0", + "jest-util": "21.1.0", + "micromatch": "2.3.11", + "node-notifier": "5.1.2", + "pify": "3.0.0", + "slash": "1.0.0", + "string-length": "2.0.0", + "strip-ansi": "4.0.0", + "which": "1.2.14", + "worker-farm": "1.5.0", + "yargs": "9.0.1" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "jest-changed-files": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-21.1.0.tgz", + "integrity": "sha512-OnjMoORBVG9Jko6Bc3UGJPx9G1PNsETiqpQXZ6wPU3fk1gtxhKYE4Mgdk28ER/CWeg7bzGUcaragLf1lf1tzbQ==", "dev": true, "requires": { - "jest-cli": "20.0.4" + "throat": "4.1.0" } }, "jest-cli": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-20.0.4.tgz", - "integrity": "sha1-5TKxnYiuW8bEF+iwWTpv6VSx3JM=", + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.1.0.tgz", + "integrity": "sha512-ISnDjHv9m0nCrSKFC+Cnr9SotaWHYRP+TK81vMtPwkV+/70JbfYJT6ZnuqgqyAnTYE4f/aCe6uyMPKHAVT1RpA==", "dev": true, "requires": { - "ansi-escapes": "1.4.0", - "callsites": "2.0.0", - "chalk": "1.1.3", + "ansi-escapes": "3.0.0", + "chalk": "2.0.1", + "glob": "7.1.2", "graceful-fs": "4.1.11", "is-ci": "1.0.10", - "istanbul-api": "1.1.10", + "istanbul-api": "1.1.14", "istanbul-lib-coverage": "1.1.1", "istanbul-lib-instrument": "1.7.3", "istanbul-lib-source-maps": "1.2.1", - "jest-changed-files": "20.0.3", - "jest-config": "20.0.4", - "jest-docblock": "20.0.3", - "jest-environment-jsdom": "20.0.3", - "jest-haste-map": "20.0.4", - "jest-jasmine2": "20.0.4", - "jest-message-util": "20.0.3", - "jest-regex-util": "20.0.3", - "jest-resolve-dependencies": "20.0.3", - "jest-runtime": "20.0.4", - "jest-snapshot": "20.0.3", - "jest-util": "20.0.3", + "jest-changed-files": "21.1.0", + "jest-config": "21.1.0", + "jest-environment-jsdom": "21.1.0", + "jest-haste-map": "21.1.0", + "jest-message-util": "21.1.0", + "jest-regex-util": "21.1.0", + "jest-resolve-dependencies": "21.1.0", + "jest-runner": "21.1.0", + "jest-runtime": "21.1.0", + "jest-snapshot": "21.1.0", + "jest-util": "21.1.0", "micromatch": "2.3.11", "node-notifier": "5.1.2", - "pify": "2.3.0", + "pify": "3.0.0", "slash": "1.0.0", - "string-length": "1.0.1", - "throat": "3.2.0", + "string-length": "2.0.0", + "strip-ansi": "4.0.0", "which": "1.2.14", - "worker-farm": "1.4.1", - "yargs": "7.1.0" + "worker-farm": "1.5.0", + "yargs": "9.0.1" }, "dependencies": { - "ansi-styles": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.1.0.tgz", - "integrity": "sha1-CcIC1ckX7CMYjKpcnLkXnNlUd1A=", - "dev": true, - "requires": { - "color-convert": "1.9.0" - } + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true }, - "babel-jest": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-20.0.3.tgz", - "integrity": "sha1-5KA7E9wQOJ4UD8ZF0J/8TO0wFnE=", - "dev": true, - "requires": { - "babel-core": "6.25.0", - "babel-plugin-istanbul": "4.1.4", - "babel-preset-jest": "20.0.3" - } + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, - "babel-plugin-jest-hoist": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-20.0.3.tgz", - "integrity": "sha1-r+3IU70/jcNUjqZx++adA8wsF2c=", + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true }, - "babel-preset-jest": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-20.0.3.tgz", - "integrity": "sha1-y6yq3stdaJyh4d4TYOv8ZoYsF4o=", + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "babel-plugin-jest-hoist": "20.0.3" + "ansi-regex": "3.0.0" } + } + } + }, + "jest-config": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-21.1.0.tgz", + "integrity": "sha512-RQnWwHRSIRvtyJQeZTpXUmsNYVVr/qu3XWfV3FTFkDsxHQi6Sj5sfUK5FHCNUCXIuFTs+r3qbYoMz2q8rdm/EA==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "glob": "7.1.2", + "jest-environment-jsdom": "21.1.0", + "jest-environment-node": "21.1.0", + "jest-get-type": "21.0.2", + "jest-jasmine2": "21.1.0", + "jest-regex-util": "21.1.0", + "jest-resolve": "21.1.0", + "jest-util": "21.1.0", + "jest-validate": "21.1.0", + "pretty-format": "21.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, - "bser": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bser/-/bser-1.0.2.tgz", - "integrity": "sha1-OBEWlwsqbe6lZG3RXdcnhES1YWk=", + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "node-int64": "0.4.0" + "color-convert": "1.9.0" } }, - "callsites": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", - "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", - "dev": true - }, - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - } - } - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "jest-validate": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.1.0.tgz", + "integrity": "sha512-xS0cyErNWpsLFlGkn/b87pk/Mv7J+mCTs8hQ4KmtOIIoM1sHYobXII8AtkoN8FC7E3+Ptxjo+/3xWk6LK1dKcw==", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "leven": "2.1.0", + "pretty-format": "21.1.0" } }, - "jest-changed-files": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-20.0.3.tgz", - "integrity": "sha1-k5TVzGXEOEBhSb7xv01Sto4D4/g=", + "leven": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", "dev": true }, - "jest-config": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-20.0.4.tgz", - "integrity": "sha1-43kwqyIXyRNgXv8T5712PsSPruo=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "glob": "7.1.2", - "jest-environment-jsdom": "20.0.3", - "jest-environment-node": "20.0.3", - "jest-jasmine2": "20.0.4", - "jest-matcher-utils": "20.0.3", - "jest-regex-util": "20.0.3", - "jest-resolve": "20.0.4", - "jest-validate": "20.0.3", - "pretty-format": "20.0.3" - } - }, - "jest-diff": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-20.0.3.tgz", - "integrity": "sha1-gfKI/Z5nXw+yPHXxwrGURf5YZhc=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "diff": "3.3.1", - "jest-matcher-utils": "20.0.3", - "pretty-format": "20.0.3" - } - }, - "jest-environment-jsdom": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-20.0.3.tgz", - "integrity": "sha1-BIqKwS7iJfcZBBdxODS7mZeH3pk=", + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", "dev": true, "requires": { - "jest-mock": "20.0.3", - "jest-util": "20.0.3", - "jsdom": "9.12.0" + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" } + } + } + }, + "jest-diff": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-21.1.0.tgz", + "integrity": "sha512-mGJinKrAB6hj1cpO1FOuDCfgILozGvYi4Zpk8GrxmNgdd9/9llIA2Xzu5879Fa4ayh7lb9ej2NdvuNLMCjbrMg==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "diff": "3.3.1", + "jest-get-type": "21.0.2", + "pretty-format": "21.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, - "jest-environment-node": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-20.0.3.tgz", - "integrity": "sha1-1Ii8RhKvLCRumG6K52caCZFj1AM=", + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "jest-mock": "20.0.3", - "jest-util": "20.0.3" + "color-convert": "1.9.0" } }, - "jest-haste-map": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-20.0.4.tgz", - "integrity": "sha1-ZT61XIic48Ah97lGk/IKQVm63wM=", + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", "dev": true, "requires": { - "fb-watchman": "2.0.0", - "graceful-fs": "4.1.11", - "jest-docblock": "20.0.3", - "micromatch": "2.3.11", - "sane": "1.6.0", - "worker-farm": "1.4.1" + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" } + } + } + }, + "jest-docblock": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.1.0.tgz", + "integrity": "sha512-ai3olFJ/3cSd60klaRIcC/Cb44/RsJ69qS8uXxfWXEbnbDqjcbl5K8Z5ekfY15hgVZGSAiLz7pOwfjIBE/yJVw==", + "dev": true + }, + "jest-environment-jsdom": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-21.1.0.tgz", + "integrity": "sha512-sMcGlN11SnnuJKzR5oJ5LsDRzHEBLUeMRImDbvxyusNW9l17wAEsoLuAWbv0W8crZTTwjRO6/mitpNF3PmVsMg==", + "dev": true, + "requires": { + "jest-mock": "21.1.0", + "jest-util": "21.1.0", + "jsdom": "9.12.0" + } + }, + "jest-environment-node": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-21.1.0.tgz", + "integrity": "sha512-Lv/pcK2zq2DZKL/q7+u8mrlSeXmaMGgmJOx0+Ew+FxYKdSzO0jpEUTEfzQOnMvpSWMqjKUYLDYkCPCBFcOX93w==", + "dev": true, + "requires": { + "jest-mock": "21.1.0", + "jest-util": "21.1.0" + } + }, + "jest-get-type": { + "version": "21.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-21.0.2.tgz", + "integrity": "sha512-4KvNzzXMXeapGaMWd+SL5e47zcMn8KTWjom6Fl3avxVXnbKS7abD1p4xWe4ToAZfgNoYNsQ9Av/mnWMnZK/Z4A==", + "dev": true + }, + "jest-haste-map": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-21.1.0.tgz", + "integrity": "sha512-a7chVtmpzRgRkYDL4eZgRuXZUlos1JOC7Dam3WryXGiD/1GNj+QONt6jcsAzDZohzs9XYg2EkjyGxIAXcNipBg==", + "dev": true, + "requires": { + "fb-watchman": "2.0.0", + "graceful-fs": "4.1.11", + "jest-docblock": "21.1.0", + "micromatch": "2.3.11", + "sane": "2.2.0", + "worker-farm": "1.5.0" + } + }, + "jest-jasmine2": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-21.1.0.tgz", + "integrity": "sha512-YjbAaXN6K5f8rtwPVxkMRIYNZGB5GiJcApcj/5ER7uGJrqJMqyCklMAPZR5Gq8XPzzuDVfoB2h7kxyOGVqaxrw==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "expect": "21.1.0", + "graceful-fs": "4.1.11", + "jest-diff": "21.1.0", + "jest-matcher-utils": "21.1.0", + "jest-message-util": "21.1.0", + "jest-snapshot": "21.1.0", + "p-cancelable": "0.3.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, - "jest-jasmine2": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-20.0.4.tgz", - "integrity": "sha1-/MWxQReA2RHQQpAu8YWehS5g1eE=", + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "chalk": "1.1.3", - "graceful-fs": "4.1.11", - "jest-diff": "20.0.3", - "jest-matcher-utils": "20.0.3", - "jest-matchers": "20.0.3", - "jest-message-util": "20.0.3", - "jest-snapshot": "20.0.3", - "once": "1.4.0", - "p-map": "1.1.1" + "color-convert": "1.9.0" } }, "jest-matcher-utils": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz", - "integrity": "sha1-s6a443yld4A7CDKpixZPRLeBVhI=", + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.1.0.tgz", + "integrity": "sha512-V/Xindf+VY5UM+oz9Nhsv0Ql93lRcKS7tHtVoXtlXkZXoXpydHwuezkLLCpZkH/Uew5y2OyDZpnlxPvEalJZng==", "dev": true, "requires": { - "chalk": "1.1.3", - "pretty-format": "20.0.3" + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "pretty-format": "21.1.0" } }, - "jest-matchers": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-matchers/-/jest-matchers-20.0.3.tgz", - "integrity": "sha1-ymnbHDLbWm9wf6XgQBq7VXAN/WA=", + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", "dev": true, "requires": { - "jest-diff": "20.0.3", - "jest-matcher-utils": "20.0.3", - "jest-message-util": "20.0.3", - "jest-regex-util": "20.0.3" + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" } - }, - "jest-message-util": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-20.0.3.tgz", - "integrity": "sha1-auwoRDBvyw5udNV5bBAG2W/dgxw=", + } + } + }, + "jest-matcher-utils": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz", + "integrity": "sha1-s6a443yld4A7CDKpixZPRLeBVhI=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "pretty-format": "20.0.3" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "chalk": "1.1.3", - "micromatch": "2.3.11", - "slash": "1.0.0" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, - "jest-mock": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-20.0.3.tgz", - "integrity": "sha1-i8Bw6QQUqhVcEajWTIaaDVxx2lk=", + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true - }, - "jest-regex-util": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-20.0.3.tgz", - "integrity": "sha1-hburXRM+RGJbGfr4xqpRItCF12I=", + } + } + }, + "jest-message-util": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-21.1.0.tgz", + "integrity": "sha512-BwKrjR4HvGoodYw3PFh95IU4qDk3nVOf3LqOKRaaR6486bJM8IZIlxWR8yfxhAN7nDGBDco/TR+U50WcPgzvgA==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "micromatch": "2.3.11", + "slash": "1.0.0" + } + }, + "jest-mock": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-21.1.0.tgz", + "integrity": "sha512-iwING4rMP1rhepAj/MVPHVxGltwwR+Lfmiy9ARevQ7XDZ/zF7h+KPFeOFMSMGvV5/dS05PHhwRjFzrjvkybNLw==", + "dev": true + }, + "jest-regex-util": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-21.1.0.tgz", + "integrity": "sha512-1QiJa6nvdzVgDhY1FTG3fl+2eYrCQGQoIeGaVPjt9+VmxsQ/BwZD6aglH0z6ZK/uEXZPAaj1XaemKM9tC6VVlQ==", + "dev": true + }, + "jest-resolve": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-21.1.0.tgz", + "integrity": "sha512-HKh0pnf2SwR3hDaToONjHrR9ds282QFkxCA9xMet3JpsdLL24oRYMLSQ7jtepZfA6EP+XycRE6RfcMBD8emetg==", + "dev": true, + "requires": { + "browser-resolve": "1.11.2", + "chalk": "2.0.1", + "is-builtin-module": "1.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-21.1.0.tgz", + "integrity": "sha512-Xj0mzS+Gh6ERgf9ofr5/vuqtyvTh4pAp4aVe6OkiZ4cLxUl6zQ6wByXMX0CLq0hwojFYmwwt+v3+fOAV7PqHPg==", + "dev": true, + "requires": { + "jest-regex-util": "21.1.0" + } + }, + "jest-runner": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-21.1.0.tgz", + "integrity": "sha512-EXFqEQRHSo6ksBrT+vRNoBRfIVVepQF56JfTczzXLs+dIKcq3DDKaiMkkehBc2LdHzm/e63qbhz2aeQn64qqlA==", + "dev": true, + "requires": { + "jest-config": "21.1.0", + "jest-docblock": "21.1.0", + "jest-haste-map": "21.1.0", + "jest-jasmine2": "21.1.0", + "jest-message-util": "21.1.0", + "jest-runtime": "21.1.0", + "jest-util": "21.1.0", + "pify": "3.0.0", + "throat": "4.1.0", + "worker-farm": "1.5.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true - }, - "jest-resolve": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-20.0.4.tgz", - "integrity": "sha1-lEiz6La6/BVHlETGSZBFt//ll6U=", - "dev": true, - "requires": { - "browser-resolve": "1.11.2", - "is-builtin-module": "1.0.0", - "resolve": "1.3.3" - } - }, - "jest-resolve-dependencies": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-20.0.3.tgz", - "integrity": "sha1-bhSntxevDyyzZnxUneQK8Bexcjo=", - "dev": true, - "requires": { - "jest-regex-util": "20.0.3" - } - }, - "jest-runtime": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-20.0.4.tgz", - "integrity": "sha1-osgCIZxCA/dU3xQE5JAYYWnRJNg=", + } + } + }, + "jest-runtime": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-21.1.0.tgz", + "integrity": "sha512-BNc1v8Cs6bjnti1JBCSGIJdSI/6MIGMMCiY+MpoyWXhoZGNLkUKGw7073lZtOo0PC/RZcXMDy1DcZXHH7YHKQw==", + "dev": true, + "requires": { + "babel-core": "6.25.0", + "babel-jest": "21.0.2", + "babel-plugin-istanbul": "4.1.4", + "chalk": "2.0.1", + "convert-source-map": "1.5.0", + "graceful-fs": "4.1.11", + "jest-config": "21.1.0", + "jest-haste-map": "21.1.0", + "jest-regex-util": "21.1.0", + "jest-resolve": "21.1.0", + "jest-util": "21.1.0", + "json-stable-stringify": "1.0.1", + "micromatch": "2.3.11", + "slash": "1.0.0", + "strip-bom": "3.0.0", + "write-file-atomic": "2.3.0", + "yargs": "9.0.1" + }, + "dependencies": { + "babel-jest": { + "version": "21.0.2", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-21.0.2.tgz", + "integrity": "sha512-7nF+URWcIVX3A9DiLRcuwq86a+Phl+wXN/fwlSO4boTP/GmLLVyIQTui3th7tbA8F3L5xkYEO0e3NSf7oB/BJQ==", "dev": true, "requires": { - "babel-core": "6.25.0", - "babel-jest": "20.0.3", "babel-plugin-istanbul": "4.1.4", - "chalk": "1.1.3", - "convert-source-map": "1.5.0", - "graceful-fs": "4.1.11", - "jest-config": "20.0.4", - "jest-haste-map": "20.0.4", - "jest-regex-util": "20.0.3", - "jest-resolve": "20.0.4", - "jest-util": "20.0.3", - "json-stable-stringify": "1.0.1", - "micromatch": "2.3.11", - "strip-bom": "3.0.0", - "yargs": "7.1.0" - } - }, - "jest-snapshot": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-20.0.3.tgz", - "integrity": "sha1-W4R+GtsaTZCFKn+fElCG4YfHZWY=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "jest-diff": "20.0.3", - "jest-matcher-utils": "20.0.3", - "jest-util": "20.0.3", - "natural-compare": "1.4.0", - "pretty-format": "20.0.3" + "babel-preset-jest": "21.0.2" } }, - "jest-util": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-20.0.3.tgz", - "integrity": "sha1-DAf32A2C9OWmfG+LnD/n9lz9Mq0=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "graceful-fs": "4.1.11", - "jest-message-util": "20.0.3", - "jest-mock": "20.0.3", - "jest-validate": "20.0.3", - "leven": "2.1.0", - "mkdirp": "0.5.1" - } - }, - "jest-validate": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-20.0.3.tgz", - "integrity": "sha1-0M/R3k9XnymEhJJcKA+PHZTsPKs=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "jest-matcher-utils": "20.0.3", - "leven": "2.1.0", - "pretty-format": "20.0.3" - } - }, - "leven": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", - "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", - "dev": true - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, - "pretty-format": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-20.0.3.tgz", - "integrity": "sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1", - "ansi-styles": "3.1.0" - } - }, - "sane": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/sane/-/sane-1.6.0.tgz", - "integrity": "sha1-lhDEUjB6E10pwf3+JUcDQYDEZ3U=", + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", "dev": true, "requires": { - "anymatch": "1.3.0", - "exec-sh": "0.2.0", - "fb-watchman": "1.9.2", - "minimatch": "3.0.4", - "minimist": "1.2.0", - "walker": "1.0.7", - "watch": "0.10.0" - }, - "dependencies": { - "fb-watchman": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-1.9.2.tgz", - "integrity": "sha1-okz0eCf4LTj7Waaa1wt247auc4M=", - "dev": true, - "requires": { - "bser": "1.0.2" - } - } + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "signal-exit": "3.0.2" } - }, - "strip-bom": { + } + } + }, + "jest-snapshot": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-21.1.0.tgz", + "integrity": "sha512-oYASKqxO/Ghbdd96z/3KSQ1y4YUtqrQVzSKbnz3yjGsi1nu3AXMPmjRCM/CZXL+H+DAIgMirj5Uq0dZOxo6Bnw==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "jest-diff": "21.1.0", + "jest-matcher-utils": "21.1.0", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "pretty-format": "21.1.0" + }, + "dependencies": { + "ansi-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } }, - "yargs": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", - "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "jest-matcher-utils": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.1.0.tgz", + "integrity": "sha512-V/Xindf+VY5UM+oz9Nhsv0Ql93lRcKS7tHtVoXtlXkZXoXpydHwuezkLLCpZkH/Uew5y2OyDZpnlxPvEalJZng==", "dev": true, "requires": { - "camelcase": "3.0.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "1.4.0", - "read-pkg-up": "1.0.1", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "1.0.2", - "which-module": "1.0.0", - "y18n": "3.2.1", - "yargs-parser": "5.0.0" + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "pretty-format": "21.1.0" } }, - "yargs-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", - "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", "dev": true, "requires": { - "camelcase": "3.0.0" + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" } } } }, - "jest-docblock": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-20.0.3.tgz", - "integrity": "sha1-F76phDQswz2DxQ++FUXqDvqkRxI=", - "dev": true - }, - "jest-matcher-utils": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz", - "integrity": "sha1-s6a443yld4A7CDKpixZPRLeBVhI=", + "jest-util": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-21.1.0.tgz", + "integrity": "sha512-PJxaShBieLpB55NV4+loIZHiOlfZHjAGzVRp9BDzrr2m70UxQViDJenNdz4edJMWXJLjp817t1QrWi+LjcRaKw==", "dev": true, "requires": { - "chalk": "1.1.3", - "pretty-format": "20.0.3" + "callsites": "2.0.0", + "chalk": "2.0.1", + "graceful-fs": "4.1.11", + "jest-message-util": "21.1.0", + "jest-mock": "21.1.0", + "jest-validate": "21.1.0", + "mkdirp": "0.5.1" }, "dependencies": { - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "color-convert": "1.9.0" } }, - "supports-color": { + "callsites": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + }, + "jest-validate": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.1.0.tgz", + "integrity": "sha512-xS0cyErNWpsLFlGkn/b87pk/Mv7J+mCTs8hQ4KmtOIIoM1sHYobXII8AtkoN8FC7E3+Ptxjo+/3xWk6LK1dKcw==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "leven": "2.1.0", + "pretty-format": "21.1.0" + } + }, + "leven": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", "dev": true + }, + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", + "dev": true, + "requires": { + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" + } } } }, @@ -5283,22 +5463,22 @@ "integrity": "sha1-6MVG//ywbADUgzyoRBD+1/igl9Q=", "dev": true, "requires": { - "abab": "1.0.3", + "abab": "1.0.4", "acorn": "4.0.13", "acorn-globals": "3.1.0", "array-equal": "1.0.0", "content-type-parser": "1.0.1", "cssom": "0.3.2", "cssstyle": "0.2.37", - "escodegen": "1.8.1", + "escodegen": "1.9.0", "html-encoding-sniffer": "1.0.1", - "nwmatcher": "1.4.1", + "nwmatcher": "1.4.2", "parse5": "1.5.1", - "request": "2.81.0", + "request": "2.82.0", "sax": "1.2.4", "symbol-tree": "3.2.2", - "tough-cookie": "2.3.2", - "webidl-conversions": "4.0.1", + "tough-cookie": "2.3.3", + "webidl-conversions": "4.0.2", "whatwg-encoding": "1.0.1", "whatwg-url": "4.8.0", "xml-name-validator": "2.0.1" @@ -5339,12 +5519,6 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", @@ -5356,23 +5530,15 @@ "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" }, "jsprim": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", - "integrity": "sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg=", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", "dev": true, "requires": { "assert-plus": "1.0.0", - "extsprintf": "1.0.2", + "extsprintf": "1.3.0", "json-schema": "0.2.3", - "verror": "1.3.6" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "verror": "1.10.0" } }, "kind-of": { @@ -5671,74 +5837,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true, - "requires": { - "lodash._basecopy": "3.0.1", - "lodash.keys": "3.1.2" - } - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true, - "requires": { - "lodash._baseassign": "3.2.0", - "lodash._basecreate": "3.0.3", - "lodash._isiterateecall": "3.0.9" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true, - "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" - } - }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -6055,18 +6153,18 @@ } }, "mime-db": { - "version": "1.27.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz", - "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=", + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", "dev": true }, "mime-types": { - "version": "2.1.15", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", - "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", "dev": true, "requires": { - "mime-db": "1.27.0" + "mime-db": "1.30.0" } }, "mimic-fn": { @@ -6110,66 +6208,6 @@ "minimist": "0.0.8" } }, - "mocha": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", - "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", - "dev": true, - "requires": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.8", - "diff": "3.2.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", - "he": "1.1.1", - "json3": "3.3.2", - "lodash.create": "3.1.1", - "mkdirp": "0.5.1", - "supports-color": "3.1.2" - }, - "dependencies": { - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true, - "requires": { - "graceful-readlink": "1.0.1" - } - }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true - }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "dev": true, - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "dev": true, - "requires": { - "has-flag": "1.0.0" - } - } - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -6259,7 +6297,7 @@ "requires": { "growly": "1.3.0", "semver": "5.3.0", - "shellwords": "0.1.0", + "shellwords": "0.1.1", "which": "1.2.14" } }, @@ -6356,9 +6394,9 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "nwmatcher": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.1.tgz", - "integrity": "sha1-eumwew6oBNt+JfBctf5Al9TklJ8=", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.2.tgz", + "integrity": "sha512-QMkCGQFYp5p+zwU3INntLmz1HMfSx9dMVJMYKmE1yuSf/22Wjo6VPFa405mCLUuQn9lbQvH2DZN9lt10ZNvtAg==", "dev": true }, "oauth-sign": { @@ -6650,9 +6688,9 @@ } }, "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, "pify": { @@ -7046,9 +7084,9 @@ "integrity": "sha1-3QG6ydBtMObyGa7LglPunr3DCPE=" }, "qs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", "dev": true }, "querystring": { @@ -7357,31 +7395,31 @@ "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=" }, "request": { - "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", + "version": "2.82.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.82.0.tgz", + "integrity": "sha512-/QWqfmyTfQ4OYs6EhB1h2wQsX9ZxbuNePCvCm0Mdz/mxw73mjdg0D4QdIl0TQBFs35CZmMXLjk0iCGK395CUDg==", "dev": true, "requires": { - "aws-sign2": "0.6.0", + "aws-sign2": "0.7.0", "aws4": "1.6.0", "caseless": "0.12.0", "combined-stream": "1.0.5", "extend": "3.0.1", "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", + "form-data": "2.3.1", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", - "mime-types": "2.1.15", + "mime-types": "2.1.17", "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", + "performance-now": "2.1.0", + "qs": "6.5.1", "safe-buffer": "5.1.1", "stringstream": "0.0.5", - "tough-cookie": "2.3.2", + "tough-cookie": "2.3.3", "tunnel-agent": "0.6.0", "uuid": "3.1.0" } @@ -7559,6 +7597,30 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, + "sane": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/sane/-/sane-2.2.0.tgz", + "integrity": "sha512-OSJxhHO0CgPUw3lUm3GhfREAfza45smvEI9ozuFrxKG10GHVo0ryW9FK5VYlLvxj0SV7HVKHW0voYJIRu27GWg==", + "dev": true, + "requires": { + "anymatch": "1.3.0", + "exec-sh": "0.2.1", + "fb-watchman": "2.0.0", + "fsevents": "1.1.2", + "minimatch": "3.0.4", + "minimist": "1.2.0", + "walker": "1.0.7", + "watch": "0.18.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", @@ -7622,9 +7684,9 @@ } }, "shellwords": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.0.tgz", - "integrity": "sha1-Zq/Ue2oSky2Qccv9mKUueFzQuhQ=", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", "dev": true }, "should": { @@ -7712,12 +7774,12 @@ "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=" }, "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz", + "integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=", "dev": true, "requires": { - "hoek": "2.16.3" + "hoek": "4.2.0" } }, "source-list-map": { @@ -7785,14 +7847,6 @@ "getpass": "0.1.7", "jsbn": "0.1.1", "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "stable": { @@ -7832,21 +7886,31 @@ "resolved": "https://registry.npmjs.org/stream-to-observable/-/stream-to-observable-0.1.0.tgz", "integrity": "sha1-Rb8dny19wJvtgfHDB8Qw5ouEz/4=" }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "requires": { - "safe-buffer": "5.1.1" - } - }, "string-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-1.0.1.tgz", - "integrity": "sha1-VpcPscOFWOnnC3KL894mmsRa36w=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", + "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", "dev": true, "requires": { - "strip-ansi": "3.0.1" + "astral-regex": "1.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } } }, "string-template": { @@ -7864,6 +7928,14 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "5.1.1" + } + }, "stringify-object": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.2.0.tgz", @@ -8081,9 +8153,9 @@ "integrity": "sha1-G+DcKg3CRNRL6KCa9qha+5PE28M=" }, "throat": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/throat/-/throat-3.2.0.tgz", - "integrity": "sha512-/EY8VpvlqJ+sFtLPeOgc8Pl7kQVOWv0woD87KTXVHPIAE842FGT+rokxIhe8xIUP1cfgrkt0as0vDLjDiMtr8w==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", + "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", "dev": true }, "through": { @@ -8138,9 +8210,9 @@ "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=" }, "tough-cookie": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", - "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", "dev": true, "requires": { "punycode": "1.4.1" @@ -8360,12 +8432,14 @@ } }, "verror": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", - "integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "extsprintf": "1.0.2" + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" } }, "vinyl": { @@ -8415,10 +8489,22 @@ } }, "watch": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/watch/-/watch-0.10.0.tgz", - "integrity": "sha1-d3mLLaD5kQ1ZXxrOWwwiWFIfIdw=", - "dev": true + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/watch/-/watch-0.18.0.tgz", + "integrity": "sha1-KAlUdsbffJDJYxOJkMClQj60uYY=", + "dev": true, + "requires": { + "exec-sh": "0.2.1", + "minimist": "1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } }, "watchpack": { "version": "1.4.0", @@ -8441,9 +8527,9 @@ } }, "webidl-conversions": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.1.tgz", - "integrity": "sha1-gBWherg+fhsxFjhIas6B2mziBqA=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", "dev": true }, "webpack": { @@ -8749,12 +8835,6 @@ "isexe": "2.0.0" } }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", - "dev": true - }, "window-size": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", @@ -8766,9 +8846,9 @@ "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=" }, "worker-farm": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.4.1.tgz", - "integrity": "sha512-tgFAtgOYLPutkAyzgpS6VJFL5HY+0ui1Tvua+fITgz8ByaJTMFGtazR6xxQfwfiAcbwE+2fLG/K49wc2TfwCNw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.0.tgz", + "integrity": "sha512-DHRiUggxtbruaTwnLDm2/BRDKZIoOYvrgYUj5Bam4fU6Gtvc0FaEyoswFPBjMXAweGW2H4BDNIpy//1yXXuaqQ==", "dev": true, "requires": { "errno": "0.1.4", diff --git a/package.json b/package.json index ab44fc77833..76a509aa01c 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "scripts": { "lint": "eslint \"**/*.js\"", "format": "prettier-eslint \"bin/**/**/*.js\" --write && prettier-eslint \"lib/**/**/*.js\" --write && prettier-eslint \"test/**/**/*.js\" --write", - "test:cli": "mocha test/*.test.js --max-old-space-size=4096 --harmony --check-leaks", "lint:codeOnly": "eslint \"{lib,bin,__mocks__}/**/!(__testfixtures__)/*.js\" \"{lib,bin,__mocks__}/**.js\"", "precommit": "lint-staged", "prepublish": "flow-remove-types lib/ -d dist/", @@ -32,7 +31,8 @@ ] }, "jest": { - "testEnvironment": "node" + "testEnvironment": "node", + "modulePathIgnorePatterns": ["dist"] }, "dependencies": { "babel-code-frame": "^6.22.0", @@ -79,10 +79,9 @@ "flow-bin": "^0.49.1", "flow-remove-types": "^1.2.1", "husky": "^0.14.3", - "jest": "^20.0.4", - "jest-cli": "^20.0.4", + "jest": "^21.1.0", + "jest-cli": "^21.1.0", "lint-staged": "^4.1.3", - "mocha": "^3.5.3", "prettier-eslint-cli": "^4.3.2", "should": "^13.1.0" } diff --git a/test/BinTestCases.test.js b/test/BinTestCases.test.js index 5bb0bbdda8d..6cc26058277 100644 --- a/test/BinTestCases.test.js +++ b/test/BinTestCases.test.js @@ -1,7 +1,6 @@ /* globals describe it before */ "use strict"; -const should = require("should"); const path = require("path"); const fs = require("fs"); const spawn = require("child_process").spawn; @@ -52,7 +51,7 @@ describe("BinTestCases", function() { category.tests.forEach(function(testName) { const testDirectory = path.join(casesPath, category.name, testName); const testArgs = getTestSpecificArguments(testDirectory) || defaultArgs; - const testAssertions = require(path.join(testDirectory, "test.js")); + const testAssertions = require(path.join(testDirectory, "stdin.js")); const outputPath = path.join( path.resolve(casesPath, "../js/bin"), category.name, @@ -74,8 +73,8 @@ describe("BinTestCases", function() { if (asyncExists) { describe(testName, function() { - it("should run successfully", function(done) { - this.timeout(10000); + test("should run successfully", function(done) { + jest.setTimeout(10000); const child = spawn(process.execPath, [cmd].concat(args), opts); child.on("close", function(code) { env.code = code; @@ -106,8 +105,8 @@ describe("BinTestCases", function() { }); } else { describe(testName, function() { - before(function(done) { - this.timeout(20000); + beforeEach(function(done) { + jest.setTimeout(20000); const child = spawn(process.execPath, [cmd].concat(args), opts); @@ -129,11 +128,11 @@ describe("BinTestCases", function() { }); }); - it("should not cause any errors", function() { - should(env.error).be.empty(); + test("should not cause any errors", function() { + expect(env.error).toHaveLength(0); }); - it("should run successfully", function() { + test("should run successfully", function() { const stdout = convertToArrayOfLines(env.stdout); const stderr = convertToArrayOfLines(env.stderr); testAssertions(env.code, stdout, stderr); diff --git a/test/binCases/config-name/found-many/stdin.js b/test/binCases/config-name/found-many/stdin.js new file mode 100644 index 00000000000..85cc3132e37 --- /dev/null +++ b/test/binCases/config-name/found-many/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[7]).toContain('./index2.js'); + expect(stdout[7]).toContain('./index2.js'); + expect(stdout[13]).toContain('./index3.js'); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/config-name/found-many/test.js b/test/binCases/config-name/found-many/test.js deleted file mode 100644 index c4af6f45db6..00000000000 --- a/test/binCases/config-name/found-many/test.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - stdout.should.be.ok(); - stdout[7].should.containEql("./index2.js"); - stdout[13].should.containEql("./index3.js"); - stderr.should.be.empty(); -}; diff --git a/test/binCases/config-name/found-one/stdin.js b/test/binCases/config-name/found-one/stdin.js new file mode 100644 index 00000000000..11b81e410d6 --- /dev/null +++ b/test/binCases/config-name/found-one/stdin.js @@ -0,0 +1,9 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + + expect(stdout[5]).toContain("./index2.js"); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/config-name/found-one/test.js b/test/binCases/config-name/found-one/test.js deleted file mode 100644 index 373fd876c4c..00000000000 --- a/test/binCases/config-name/found-one/test.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[5].should.containEql("./index2.js"); - stderr.should.be.empty(); -}; diff --git a/test/binCases/config-name/not-found/stdin.js b/test/binCases/config-name/not-found/stdin.js new file mode 100644 index 00000000000..fec19b5be2d --- /dev/null +++ b/test/binCases/config-name/not-found/stdin.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).not.toBe(0); + expect(stdout).toHaveLength(0); + expect(stderr[0]).toContain("Configuration with name 'foo' was not found."); +}; diff --git a/test/binCases/config-name/not-found/test.js b/test/binCases/config-name/not-found/test.js deleted file mode 100644 index ccf5c59f0b6..00000000000 --- a/test/binCases/config-name/not-found/test.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.not.eql(0); - stdout.should.be.empty(); - stderr[0].should.containEql("Configuration with name 'foo' was not found."); -}; diff --git a/test/binCases/configFile/profile/stdin.js b/test/binCases/configFile/profile/stdin.js new file mode 100644 index 00000000000..100438d3af6 --- /dev/null +++ b/test/binCases/configFile/profile/stdin.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + + expect(stdout[6]).toContain("factory:"); + expect(stdout[8]).toContain("factory:"); + expect(stdout[10]).toContain("factory:"); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/configFile/profile/test.js b/test/binCases/configFile/profile/test.js deleted file mode 100644 index ee830f33d11..00000000000 --- a/test/binCases/configFile/profile/test.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[6].should.containEql("factory:"); - stdout[8].should.containEql("factory:"); - stdout[10].should.containEql("factory:"); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/entry/multi-file/stdin.js b/test/binCases/entry/multi-file/stdin.js new file mode 100644 index 00000000000..d6a349eeea3 --- /dev/null +++ b/test/binCases/entry/multi-file/stdin.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[4]).toContain("null.js"); + expect(stdout[5]).toMatch(/multi.*index\.js.*a\.js/); // should have multi-file entry + expect(stdout[6]).toMatch(/index\.js.*\{0\}/); + expect(stdout[7]).toMatch(/a\.js.*\{0\}/); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/entry/multi-file/test.js b/test/binCases/entry/multi-file/test.js deleted file mode 100644 index cfa1ff6d584..00000000000 --- a/test/binCases/entry/multi-file/test.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[4].should.containEql("null.js"); - stdout[5].should.match(/multi.*index\.js.*a\.js/); // should have multi-file entry - stdout[6].should.match(/index\.js.*\{0\}/); - stdout[7].should.match(/a\.js.*\{0\}/); - stderr.should.be.empty(); -}; diff --git a/test/binCases/entry/named-entry/stdin.js b/test/binCases/entry/named-entry/stdin.js new file mode 100644 index 00000000000..92d7807231c --- /dev/null +++ b/test/binCases/entry/named-entry/stdin.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[4]).toContain("null.js"); + expect(stdout[5]).toContain("foo.js"); // named entry from --entry foo=./a.js + expect(stdout[6]).toMatch(/a\.js.*\{1\}/); + expect(stdout[7]).toMatch(/index\.js.*\{0\}/); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/entry/named-entry/test.js b/test/binCases/entry/named-entry/test.js deleted file mode 100644 index 4c62f985eb6..00000000000 --- a/test/binCases/entry/named-entry/test.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[4].should.containEql("null.js"); - stdout[5].should.containEql("foo.js"); // named entry from --entry foo=./a.js - stdout[6].should.match(/a\.js.*\{1\}/); - stdout[7].should.match(/index\.js.*\{0\}/); - stderr.should.be.empty(); -}; diff --git a/test/binCases/entry/non-hyphenated-args/stdin.js b/test/binCases/entry/non-hyphenated-args/stdin.js new file mode 100644 index 00000000000..3512125c6f8 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/stdin.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[4]).toContain("null.js"); + expect(stdout[5]).toContain("main.js"); // non-hyphenated arg ./a.js should create chunk "main" + expect(stdout[6]).toMatch(/index\.js.*\{0\}/); // index.js should be in chunk 0 + expect(stdout[7]).toMatch(/a\.js.*\{1\}/); // a.js should be in chunk 1 + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/entry/non-hyphenated-args/test.js b/test/binCases/entry/non-hyphenated-args/test.js deleted file mode 100644 index 0e1ae1ce1ff..00000000000 --- a/test/binCases/entry/non-hyphenated-args/test.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[4].should.containEql("null.js"); - stdout[5].should.containEql("main.js"); // non-hyphenated arg ./a.js should create chunk "main" - stdout[6].should.match(/index\.js.*\{0\}/); // index.js should be in chunk 0 - stdout[7].should.match(/a\.js.*\{1\}/); // a.js should be in chunk 1 - stderr.should.be.empty(); -}; diff --git a/test/binCases/errors/issue-5576/stdin.js b/test/binCases/errors/issue-5576/stdin.js new file mode 100644 index 00000000000..577ec2f6887 --- /dev/null +++ b/test/binCases/errors/issue-5576/stdin.js @@ -0,0 +1,13 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(2); + expect(stdout[0]).toContain("Hash: "); + expect(stdout[1]).toContain("Version: "); + expect(stdout[2]).toContain("Time: "); + expect(stdout[4]).toContain( + "ERROR in Entry module not found: Error: Can't resolve" + ); + + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/errors/issue-5576/test.js b/test/binCases/errors/issue-5576/test.js deleted file mode 100644 index bd4db65fd62..00000000000 --- a/test/binCases/errors/issue-5576/test.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(2); - - stdout[0].should.containEql("Hash: "); - stdout[1].should.containEql("Version: "); - stdout[2].should.containEql("Time: "); - stdout[4].should.containEql( - "ERROR in Entry module not found: Error: Can't resolve" - ); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/errors/parse/stdin.js b/test/binCases/errors/parse/stdin.js new file mode 100644 index 00000000000..158648c5e46 --- /dev/null +++ b/test/binCases/errors/parse/stdin.js @@ -0,0 +1,16 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(2); + expect(stdout[0]).toContain("Hash: "); + expect(stdout[1]).toContain("Version: "); + expect(stdout[2]).toContain("Time: "); + expect(stdout[5]).toContain("./index.js"); + expect(stdout[5]).toContain("[built]"); + expect(stdout[5]).toContain("[failed]"); + expect(stdout[5]).toContain("[1 error]"); + expect(stdout[7]).toContain("ERROR in ./index.js"); + expect(stdout[8]).toContain("Module parse failed:"); + + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/errors/parse/test.js b/test/binCases/errors/parse/test.js deleted file mode 100644 index 122ab47b45b..00000000000 --- a/test/binCases/errors/parse/test.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(2); - - stdout[0].should.containEql("Hash: "); - stdout[1].should.containEql("Version: "); - stdout[2].should.containEql("Time: "); - stdout[5].should.containEql("./index.js"); - stdout[5].should.containEql("[built]"); - stdout[5].should.containEql("[failed]"); - stdout[5].should.containEql("[1 error]"); - stdout[7].should.containEql("ERROR in ./index.js"); - stdout[8].should.containEql("Module parse failed:"); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/help/help-output/stdin.js b/test/binCases/help/help-output/stdin.js new file mode 100644 index 00000000000..602c1914075 --- /dev/null +++ b/test/binCases/help/help-output/stdin.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toMatch(/webpack/); + expect(stdout).toContain("Config options:"); + expect(stdout).toContain("Basic options:"); + expect(stdout).toContain("Module options:"); + expect(stdout).toContain("Output options:"); + expect(stdout).toContain("Advanced options:"); + expect(stdout).toContain("Resolving options:"); + expect(stdout).toContain("Optimizing options:"); + expect(stdout).toContain("Stats options:"); + expect(stdout).toContain("Options:"); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/help/help-output/test.js b/test/binCases/help/help-output/test.js deleted file mode 100644 index 895d915c23e..00000000000 --- a/test/binCases/help/help-output/test.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[0].should.startWith("webpack"); - stdout.should.containEql("Config options:"); - stdout.should.containEql("Basic options:"); - stdout.should.containEql("Module options:"); - stdout.should.containEql("Output options:"); - stdout.should.containEql("Advanced options:"); - stdout.should.containEql("Resolving options:"); - stdout.should.containEql("Optimizing options:"); - stdout.should.containEql("Stats options:"); - stdout.should.containEql("Options:"); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/module/module-bind/stdin.js b/test/binCases/module/module-bind/stdin.js new file mode 100644 index 00000000000..53abdd0f535 --- /dev/null +++ b/test/binCases/module/module-bind/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + + expect(stdout).toEqual(expect.anything()); + expect(stdout).toContain("pre-loaded pre"); + expect(stdout).toContain("post-loaded post"); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/module/module-bind/test.js b/test/binCases/module/module-bind/test.js deleted file mode 100644 index eeef1f0ca6c..00000000000 --- a/test/binCases/module/module-bind/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout.should.containEql("pre-loaded pre"); - stdout.should.containEql("post-loaded post"); - stderr.should.be.empty(); -}; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/stdin.js b/test/binCases/plugins/uglifyjsplugin-empty-args/stdin.js new file mode 100644 index 00000000000..f99dbf070f3 --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + + expect(stdout).toEqual(expect.anything()); + expect(stdout[4]).toContain("bytes"); // without uglifyjs it's multiple kBs + + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/test.js b/test/binCases/plugins/uglifyjsplugin-empty-args/test.js deleted file mode 100644 index 7837b1d9536..00000000000 --- a/test/binCases/plugins/uglifyjsplugin-empty-args/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[4].should.containEql("bytes"); // without uglifyjs it's multiple kBs - - stderr.should.be.empty(); -}; diff --git a/test/binCases/stats/custom-preset/stdin.js b/test/binCases/stats/custom-preset/stdin.js new file mode 100644 index 00000000000..ca175acffe4 --- /dev/null +++ b/test/binCases/stats/custom-preset/stdin.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(stderr).toHaveLength(0); + expect(code).toBe(0); + expect(stdout).toHaveLength(0); +}; diff --git a/test/binCases/stats/custom-preset/test.js b/test/binCases/stats/custom-preset/test.js deleted file mode 100644 index 5457915cd9f..00000000000 --- a/test/binCases/stats/custom-preset/test.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - stderr.should.be.empty(); - code.should.be.eql(0); - stdout.should.be.empty(); -}; diff --git a/test/binCases/stats/multi-config/stdin.js b/test/binCases/stats/multi-config/stdin.js new file mode 100644 index 00000000000..d3023f4feb2 --- /dev/null +++ b/test/binCases/stats/multi-config/stdin.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/stats/multi-config/test.js b/test/binCases/stats/multi-config/test.js deleted file mode 100644 index 9515f2f778c..00000000000 --- a/test/binCases/stats/multi-config/test.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(0); - stdout.should.be.ok(); - stderr.should.be.empty(); -}; diff --git a/test/binCases/stats/none/stdin.js b/test/binCases/stats/none/stdin.js new file mode 100644 index 00000000000..f53dcbf4f32 --- /dev/null +++ b/test/binCases/stats/none/stdin.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toHaveLength(0); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/stats/none/test.js b/test/binCases/stats/none/test.js deleted file mode 100644 index a2cc82d2396..00000000000 --- a/test/binCases/stats/none/test.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(0); - stdout.should.be.empty(); - stderr.should.be.empty(); -}; diff --git a/test/binCases/stats/single-config/stdin.js b/test/binCases/stats/single-config/stdin.js new file mode 100644 index 00000000000..e0cf0717163 --- /dev/null +++ b/test/binCases/stats/single-config/stdin.js @@ -0,0 +1,16 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain("Hash: "); + expect(stdout[1]).toContain("Version: "); + expect(stdout[2]).toContain("Time: "); + expect(stdout[4]).toContain("\u001b[1m\u001b[32mnull.js\u001b[39m\u001b[22m"); + expect(stdout[5]).toContain("chunk"); + expect(stdout[6]).not.toContain("./index.js"); + expect(stdout[6]).not.toContain("[built]"); + expect(stdout[6]).toContain("1 module"); + + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/stats/single-config/test.js b/test/binCases/stats/single-config/test.js deleted file mode 100644 index a961bcd51de..00000000000 --- a/test/binCases/stats/single-config/test.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(0); - - stdout.should.be.ok(); - stdout[0].should.containEql("Hash: "); - stdout[1].should.containEql("Version: "); - stdout[2].should.containEql("Time: "); - stdout[4].should.containEql("\u001b[1m\u001b[32mnull.js\u001b[39m\u001b[22m"); - stdout[5].should.containEql("chunk"); - stdout[6].should.not.containEql("./index.js"); - stdout[6].should.not.containEql("[built]"); - stdout[6].should.containEql("1 module"); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/watch/multi-config-watch-opt/stdin.js b/test/binCases/watch/multi-config-watch-opt/stdin.js new file mode 100644 index 00000000000..8fae9bafeb6 --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain(""); + expect(stdout[1]).toContain("Webpack is watching the files…"); + + expect(stderr).toHaveLength(0); + done(); +}; diff --git a/test/binCases/watch/multi-config-watch-opt/test.js b/test/binCases/watch/multi-config-watch-opt/test.js deleted file mode 100644 index f4d37c16fa0..00000000000 --- a/test/binCases/watch/multi-config-watch-opt/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(stdout, stderr, done) { - stdout.should.be.ok(); - stdout[0].should.containEql(""); - stdout[1].should.containEql("Webpack is watching the files…"); - - stderr.should.be.empty(); - done(); -}; diff --git a/test/binCases/watch/multi-config/stdin.js b/test/binCases/watch/multi-config/stdin.js new file mode 100644 index 00000000000..8fae9bafeb6 --- /dev/null +++ b/test/binCases/watch/multi-config/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain(""); + expect(stdout[1]).toContain("Webpack is watching the files…"); + + expect(stderr).toHaveLength(0); + done(); +}; diff --git a/test/binCases/watch/multi-config/test.js b/test/binCases/watch/multi-config/test.js deleted file mode 100644 index f4d37c16fa0..00000000000 --- a/test/binCases/watch/multi-config/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(stdout, stderr, done) { - stdout.should.be.ok(); - stdout[0].should.containEql(""); - stdout[1].should.containEql("Webpack is watching the files…"); - - stderr.should.be.empty(); - done(); -}; diff --git a/test/binCases/watch/single-config-watch-opt/stdin.js b/test/binCases/watch/single-config-watch-opt/stdin.js new file mode 100644 index 00000000000..8fae9bafeb6 --- /dev/null +++ b/test/binCases/watch/single-config-watch-opt/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain(""); + expect(stdout[1]).toContain("Webpack is watching the files…"); + + expect(stderr).toHaveLength(0); + done(); +}; diff --git a/test/binCases/watch/single-config-watch-opt/test.js b/test/binCases/watch/single-config-watch-opt/test.js deleted file mode 100644 index f4d37c16fa0..00000000000 --- a/test/binCases/watch/single-config-watch-opt/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(stdout, stderr, done) { - stdout.should.be.ok(); - stdout[0].should.containEql(""); - stdout[1].should.containEql("Webpack is watching the files…"); - - stderr.should.be.empty(); - done(); -}; diff --git a/test/binCases/watch/single-config/stdin.js b/test/binCases/watch/single-config/stdin.js new file mode 100644 index 00000000000..8fae9bafeb6 --- /dev/null +++ b/test/binCases/watch/single-config/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain(""); + expect(stdout[1]).toContain("Webpack is watching the files…"); + + expect(stderr).toHaveLength(0); + done(); +}; diff --git a/test/binCases/watch/single-config/test.js b/test/binCases/watch/single-config/test.js deleted file mode 100644 index f4d37c16fa0..00000000000 --- a/test/binCases/watch/single-config/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(stdout, stderr, done) { - stdout.should.be.ok(); - stdout[0].should.containEql(""); - stdout[1].should.containEql("Webpack is watching the files…"); - - stderr.should.be.empty(); - done(); -}; From e72bc10f0cea206fc9173c505c80b38329e7dd70 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Mon, 25 Sep 2017 23:39:11 +0200 Subject: [PATCH 05/12] remove redundant cli command --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 345cebfbbec..4e493cc75ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,5 @@ before_script: script: - npm run prepublish - - npm run test:cli - npm run lint - npm run test From e887dba1fe8a8ca08daf43e8bb895ec184892dba Mon Sep 17 00:00:00 2001 From: Ian J Sikes Date: Fri, 29 Sep 2017 14:59:31 -0700 Subject: [PATCH 06/12] Feature/generate loader (#183) * Add template files for loader yeoman generator * Create yeoman generator for a webpack loader project * Add tests for loader-generator * Add `mkdirp` dependency for loader-generator * Add function to create yeoman env and run loader-generator * Add `generate-loader` command to webpack-cli * Copy loader templates from proper directory * Add template files for plugin generator * Create yeoman generator for webpack plugins * Add function to create yeoman env and run plugin generator * Add cli command to generate plugin * Register generate- commands in yargs * Add template files for loader examples and tests * Copy loader test and example template files in generator * Add template files for plugin examples and tests * Copy plugin test and example template files in generator * Refactor generator file copying, switch .includes with .indexOf in CLI arg parsing * Change `indexOf('foo') > -1` to `indexOf('foo') >= 0` * Factor out generator copy utilities into separate module * Rewrite generators using a function that returns a customized generator class * Fix linting errors * Remove //eslint-disable lines from template files --- bin/config-yargs.js | 10 +++ bin/webpack.js | 8 +- lib/generate-loader/index.js | 17 ++++ lib/generate-loader/loader-generator.js | 58 +++++++++++++ lib/generate-loader/loader-generator.test.js | 17 ++++ .../examples/simple/src/index.js.tpl | 11 +++ .../examples/simple/src/lazy-module.js.tpl | 1 + .../simple/src/static-esm-module.js.tpl | 1 + .../examples/simple/webpack.config.js.tpl | 27 ++++++ .../templates/src/_index.js.tpl | 25 ++++++ lib/generate-loader/templates/src/cjs.js.tpl | 1 + .../test/fixtures/simple-file.js.tpl | 3 + .../templates/test/functional.test.js.tpl | 21 +++++ .../templates/test/test-utils.js.tpl | 82 +++++++++++++++++++ .../templates/test/unit.test.js.tpl | 32 ++++++++ lib/generate-plugin/index.js | 17 ++++ lib/generate-plugin/plugin-generator.js | 40 +++++++++ .../examples/simple/_webpack.config.js.tpl | 13 +++ .../examples/simple/src/index.js.tpl | 11 +++ .../examples/simple/src/lazy-module.js.tpl | 1 + .../simple/src/static-esm-module.js.tpl | 1 + .../templates/src/_index.js.tpl | 16 ++++ lib/generate-plugin/templates/src/cjs.js.tpl | 1 + .../test/fixtures/simple-file.js.tpl | 3 + .../templates/test/functional.test.js.tpl | 10 +++ .../templates/test/test-utils.js.tpl | 82 +++++++++++++++++++ lib/utils/copy-utils.js | 50 +++++++++++ lib/utils/webpack-generator.js | 65 +++++++++++++++ package-lock.json | 7 -- package.json | 1 + 30 files changed, 623 insertions(+), 9 deletions(-) create mode 100644 lib/generate-loader/index.js create mode 100644 lib/generate-loader/loader-generator.js create mode 100644 lib/generate-loader/loader-generator.test.js create mode 100644 lib/generate-loader/templates/examples/simple/src/index.js.tpl create mode 100644 lib/generate-loader/templates/examples/simple/src/lazy-module.js.tpl create mode 100644 lib/generate-loader/templates/examples/simple/src/static-esm-module.js.tpl create mode 100644 lib/generate-loader/templates/examples/simple/webpack.config.js.tpl create mode 100644 lib/generate-loader/templates/src/_index.js.tpl create mode 100644 lib/generate-loader/templates/src/cjs.js.tpl create mode 100644 lib/generate-loader/templates/test/fixtures/simple-file.js.tpl create mode 100644 lib/generate-loader/templates/test/functional.test.js.tpl create mode 100644 lib/generate-loader/templates/test/test-utils.js.tpl create mode 100644 lib/generate-loader/templates/test/unit.test.js.tpl create mode 100644 lib/generate-plugin/index.js create mode 100644 lib/generate-plugin/plugin-generator.js create mode 100644 lib/generate-plugin/templates/examples/simple/_webpack.config.js.tpl create mode 100644 lib/generate-plugin/templates/examples/simple/src/index.js.tpl create mode 100644 lib/generate-plugin/templates/examples/simple/src/lazy-module.js.tpl create mode 100644 lib/generate-plugin/templates/examples/simple/src/static-esm-module.js.tpl create mode 100644 lib/generate-plugin/templates/src/_index.js.tpl create mode 100644 lib/generate-plugin/templates/src/cjs.js.tpl create mode 100644 lib/generate-plugin/templates/test/fixtures/simple-file.js.tpl create mode 100644 lib/generate-plugin/templates/test/functional.test.js.tpl create mode 100644 lib/generate-plugin/templates/test/test-utils.js.tpl create mode 100644 lib/utils/copy-utils.js create mode 100644 lib/utils/webpack-generator.js diff --git a/bin/config-yargs.js b/bin/config-yargs.js index c7ca20a2b67..ac2187e350d 100644 --- a/bin/config-yargs.js +++ b/bin/config-yargs.js @@ -28,6 +28,16 @@ module.exports = function(yargs) { "Migrate your webpack configuration from webpack 1 to webpack 2", group: INIT_GROUP }, + "generate-loader": { + type: "boolean", + describe: "Generates a new webpack loader project", + group: INIT_GROUP + }, + "generate-plugin": { + type: "boolean", + describe: "Generates a new webpack plugin project", + group: INIT_GROUP + }, config: { type: "string", describe: "Path to the config file", diff --git a/bin/webpack.js b/bin/webpack.js index 19e31709f9a..db514c3f362 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -159,11 +159,11 @@ if (argv.verbose) { argv["display-cached"] = true; argv["display-cached-assets"] = true; } -if (argv._.includes("init")) { +if (argv._.indexOf("init") >= 0) { const initPkgs = argv._.length === 1 ? [] : [argv._.pop()]; return require("../lib/initialize")(initPkgs); -} else if (argv._.includes("migrate")) { +} else if (argv._.indexOf("migrate") >= 0) { const filePaths = argv._.length === 1 ? [] : [argv._.pop()]; if (!filePaths.length) { throw new Error("Please specify a path to your webpack config"); @@ -171,6 +171,10 @@ if (argv._.includes("init")) { const inputConfigPath = path.resolve(process.cwd(), filePaths[0]); return require("../lib/migrate.js")(inputConfigPath, inputConfigPath); +} else if (argv._.indexOf("generate-loader") >= 0) { + return require("../lib/generate-loader/index.js")(); +} else if (argv._.indexOf("generate-plugin") >= 0) { + return require("../lib/generate-plugin/index.js")(); } else { var options = require("./convert-argv")(yargs, argv); diff --git a/lib/generate-loader/index.js b/lib/generate-loader/index.js new file mode 100644 index 00000000000..ff83f5f84fa --- /dev/null +++ b/lib/generate-loader/index.js @@ -0,0 +1,17 @@ +var yeoman = require("yeoman-environment"); +var LoaderGenerator = require("./loader-generator").LoaderGenerator; + +/** + * Runs a yeoman generator to create a new webpack loader project + * @returns {void} + */ +function loaderCreator() { + var env = yeoman.createEnv(); + var generatorName = "webpack-loader-generator"; + + env.registerStub(LoaderGenerator, generatorName); + + env.run(generatorName); +} + +module.exports = loaderCreator; diff --git a/lib/generate-loader/loader-generator.js b/lib/generate-loader/loader-generator.js new file mode 100644 index 00000000000..9e5a22e27b5 --- /dev/null +++ b/lib/generate-loader/loader-generator.js @@ -0,0 +1,58 @@ +var path = require("path"); +var _ = require("lodash"); +var webpackGenerator = require("../utils/webpack-generator"); + +/** + * Formats a string into webpack loader format + * (eg: 'style-loader', 'raw-loader') + * + * @param {string} name A loader name to be formatted + * @returns {string} The formatted string + */ +function makeLoaderName(name) { + name = _.kebabCase(name); + if (!/loader$/.test(name)) { + name += "-loader"; + } + return name; +} + +/** + * A yeoman generator class for creating a webpack + * loader project. It adds some starter loader code + * and runs `webpack-defaults`. + * + * @class LoaderGenerator + * @extends {Generator} + */ +var LoaderGenerator = webpackGenerator( + [{ + type: "input", + name: "name", + message: "Loader name", + default: "my-loader", + filter: makeLoaderName, + validate: str => str.length > 0, + }], + path.join(__dirname, "templates"), + [ + "src/cjs.js.tpl", + "test/test-utils.js.tpl", + "test/unit.test.js.tpl", + "test/functional.test.js.tpl", + "test/fixtures/simple-file.js.tpl", + "examples/simple/webpack.config.js.tpl", + "examples/simple/src/index.js.tpl", + "examples/simple/src/lazy-module.js.tpl", + "examples/simple/src/static-esm-module.js.tpl", + ], + [ + "src/_index.js.tpl", + ], + (gen) => ({ name: gen.props.name }) +); + +module.exports = { + makeLoaderName, + LoaderGenerator, +}; diff --git a/lib/generate-loader/loader-generator.test.js b/lib/generate-loader/loader-generator.test.js new file mode 100644 index 00000000000..3dc3e55dd7e --- /dev/null +++ b/lib/generate-loader/loader-generator.test.js @@ -0,0 +1,17 @@ +"use strict"; + +var makeLoaderName = require("./loader-generator").makeLoaderName; + +describe("makeLoaderName", () => { + + it("should kebab-case loader name and append '-loader'", () => { + var loaderName = makeLoaderName("This is a test"); + expect(loaderName).toEqual("this-is-a-test-loader"); + }); + + it("should not modify a properly formatted loader name", () => { + var loaderName = makeLoaderName("properly-named-loader"); + expect(loaderName).toEqual("properly-named-loader"); + }); + +}); diff --git a/lib/generate-loader/templates/examples/simple/src/index.js.tpl b/lib/generate-loader/templates/examples/simple/src/index.js.tpl new file mode 100644 index 00000000000..2c49d366408 --- /dev/null +++ b/lib/generate-loader/templates/examples/simple/src/index.js.tpl @@ -0,0 +1,11 @@ +import esmModule from './static-esm-module'; + +const getLazyModule = () => System.import('./lazy-module'); + +setTimeout(() => { + getLazyModule.then((modDefault) => { + console.log(modDefault); + }); +}, 300); + +console.log(esmModule); diff --git a/lib/generate-loader/templates/examples/simple/src/lazy-module.js.tpl b/lib/generate-loader/templates/examples/simple/src/lazy-module.js.tpl new file mode 100644 index 00000000000..f3dac067326 --- /dev/null +++ b/lib/generate-loader/templates/examples/simple/src/lazy-module.js.tpl @@ -0,0 +1 @@ +export default 'lazy'; diff --git a/lib/generate-loader/templates/examples/simple/src/static-esm-module.js.tpl b/lib/generate-loader/templates/examples/simple/src/static-esm-module.js.tpl new file mode 100644 index 00000000000..d02ba545bd3 --- /dev/null +++ b/lib/generate-loader/templates/examples/simple/src/static-esm-module.js.tpl @@ -0,0 +1 @@ +export default 'foo'; diff --git a/lib/generate-loader/templates/examples/simple/webpack.config.js.tpl b/lib/generate-loader/templates/examples/simple/webpack.config.js.tpl new file mode 100644 index 00000000000..75b6744b7a2 --- /dev/null +++ b/lib/generate-loader/templates/examples/simple/webpack.config.js.tpl @@ -0,0 +1,27 @@ +const path = require('path'); + +module.exports = { + entry: './src/index.js', + output: { + path: path.join(__dirname, 'example_dist'), + filename: '[name].chunk.js', + }, + module: { + rules: [ + { + test: /\.js$/, + use: [ + { + loader: 'example-loader', + options: {}, + }, + ], + }, + ], + }, + resolveLoader: { + alias: { + 'example-loader': require.resolve('../../src/'), + }, + }, +}; diff --git a/lib/generate-loader/templates/src/_index.js.tpl b/lib/generate-loader/templates/src/_index.js.tpl new file mode 100644 index 00000000000..c69d5d329a6 --- /dev/null +++ b/lib/generate-loader/templates/src/_index.js.tpl @@ -0,0 +1,25 @@ +/** + * See the webpack docs for more information about loaders: + * https://github.com/webpack/docs/wiki/how-to-write-a-loader + */ + +export default function loader(source) { + const { loaders, resource, request, version, webpack } = this; + + const newSource = ` + /** + * <%= name %> + * + * Resource Location: ${resource} + * Loaders chained to module: ${JSON.stringify(loaders)} + * Loader API Version: ${version} + * Is this in "webpack mode": ${webpack} + * This is the users request for the module: ${request} + */ + /** + * Original Source From Loader + */ + ${source}`; + + return newSource; +} diff --git a/lib/generate-loader/templates/src/cjs.js.tpl b/lib/generate-loader/templates/src/cjs.js.tpl new file mode 100644 index 00000000000..82657ce3a74 --- /dev/null +++ b/lib/generate-loader/templates/src/cjs.js.tpl @@ -0,0 +1 @@ +module.exports = require('./index').default; diff --git a/lib/generate-loader/templates/test/fixtures/simple-file.js.tpl b/lib/generate-loader/templates/test/fixtures/simple-file.js.tpl new file mode 100644 index 00000000000..908ed137dff --- /dev/null +++ b/lib/generate-loader/templates/test/fixtures/simple-file.js.tpl @@ -0,0 +1,3 @@ +import foo from "./foo"; // eslint-disable-line + +console.log(foo); diff --git a/lib/generate-loader/templates/test/functional.test.js.tpl b/lib/generate-loader/templates/test/functional.test.js.tpl new file mode 100644 index 00000000000..b69f8d7f17a --- /dev/null +++ b/lib/generate-loader/templates/test/functional.test.js.tpl @@ -0,0 +1,21 @@ +import { + runWebpackExampleInMemory, +} from '../test/test-utils'; + +test('should run with no errors or warnings', async () => { + const buildStats = await runWebpackExampleInMemory('simple'); + const { errors, warnings } = buildStats; + + expect([...errors, ...warnings].length).toBe(0); +}); + +test('should append transformations to JavaScript module', async () => { + const buildStats = await runWebpackExampleInMemory('simple'); + const { modules } = buildStats; + + const moduleToTest = modules[0].source()._source._value; + const loadedString = '* Original Source From Loader'; + + expect(moduleToTest).toEqual(expect.stringContaining(loadedString)); + expect(moduleToTest).toMatchSnapshot(); +}); diff --git a/lib/generate-loader/templates/test/test-utils.js.tpl b/lib/generate-loader/templates/test/test-utils.js.tpl new file mode 100644 index 00000000000..bf8116f065f --- /dev/null +++ b/lib/generate-loader/templates/test/test-utils.js.tpl @@ -0,0 +1,82 @@ +import path from 'path'; +import webpack from 'webpack'; +import Promise from 'bluebird'; +import MemoryFs from 'memory-fs'; + +const fs = new MemoryFs(); +const unitTestFixtures = path.resolve(__dirname, 'fixtures'); + +/** + * + * + * @param {string} fixtureName + * @param {string} [withQueryString=''] + * @returns {string} Absolute path of a file with query that is to be run by a loader. + */ +function getFixtureResource(fixtureName, withQueryString = '') { + return `${getFixture(fixtureName)}?${withQueryString}`; +} + +/** + * + * + * @param {string} fixtureName + * @returns {string} Absolute path of a file with query that is to be run by a loader. + */ +function getFixture(fixtureName) { + return path.resolve(unitTestFixtures, `${fixtureName}.js`); +} + +/** + * + * + * @param {Object} withOptions - Loader Options + * @returns {{loader: string, options: Object}} + */ +function getLoader(withOptions) { + return [{ loader: path.resolve(__dirname, '../dist/index.js'), options: withOptions }]; +} + +/** + * + * + * @param {string} exampleName + * @returns {Object|Array} - Returns an object or array of objects representing the webpack configuration options + */ +function getExampleConfig(exampleName) { + return require(`../examples/${exampleName}/webpack.config.js`); +} + +/** + * + * + * @param {string} exampleName - name of example inside of examples folder + * @returns + */ +async function runWebpackExampleInMemory(exampleName) { + const webpackConfig = getExampleConfig(exampleName); + const compiler = webpack(webpackConfig); + + compiler.outputFileSystem = fs; + + const run = Promise.promisify(compiler.run, { context: compiler }); + const stats = await run(); + + + const { compilation } = stats; + const { errors, warnings, assets, entrypoints, chunks, modules } = compilation; + const statsJson = stats.toJson(); + + return { + assets, + entrypoints, + errors, + warnings, + stats, + chunks, + modules, + statsJson, + }; +} + +export { getExampleConfig, runWebpackExampleInMemory, fs, getFixtureResource, getLoader, getFixture }; diff --git a/lib/generate-loader/templates/test/unit.test.js.tpl b/lib/generate-loader/templates/test/unit.test.js.tpl new file mode 100644 index 00000000000..ac1b90a4e4a --- /dev/null +++ b/lib/generate-loader/templates/test/unit.test.js.tpl @@ -0,0 +1,32 @@ +import fs from 'fs'; +import Promise from 'bluebird'; +import { runLoaders } from 'loader-runner'; +import { getFixtureResource, getFixture, getLoader } from './test-utils'; + +const runLoadersPromise = Promise.promisify(runLoaders); +const readFilePromise = Promise.promisify(fs.readFile, { context: fs }); + + +const loaders = getLoader(); + +describe('Example Loader Tests: Fixture: simple-file', () => { + const fixtureName = 'simple-file'; + const resource = getFixture(fixtureName); + + test('loaded file should be different', async () => { + const originalSource = await readFilePromise(resource); + const { result } = await runLoadersPromise({ resource: getFixtureResource(fixtureName), loaders }); + + expect(result).not.toEqual(originalSource); + }); + + test('loader prepends correct information', async () => { + const { result } = await runLoadersPromise({ resource: getFixtureResource(fixtureName), loaders }); + const resultMatcher = expect.arrayContaining([ + expect.stringContaining(' * Original Source From Loader'), + ]); + + expect(result).toEqual(resultMatcher); + expect(result).toMatchSnapshot(); + }); +}); diff --git a/lib/generate-plugin/index.js b/lib/generate-plugin/index.js new file mode 100644 index 00000000000..82fe7dd386d --- /dev/null +++ b/lib/generate-plugin/index.js @@ -0,0 +1,17 @@ +var yeoman = require("yeoman-environment"); +var PluginGenerator = require("./plugin-generator").PluginGenerator; + +/** + * Runs a yeoman generator to create a new webpack plugin project + * @returns {void} + */ +function pluginCreator() { + var env = yeoman.createEnv(); + var generatorName = "webpack-plugin-generator"; + + env.registerStub(PluginGenerator, generatorName); + + env.run(generatorName); +} + +module.exports = pluginCreator; diff --git a/lib/generate-plugin/plugin-generator.js b/lib/generate-plugin/plugin-generator.js new file mode 100644 index 00000000000..fcddd43993a --- /dev/null +++ b/lib/generate-plugin/plugin-generator.js @@ -0,0 +1,40 @@ +var path = require("path"); +var _ = require("lodash"); +var webpackGenerator = require("../utils/webpack-generator"); + +/** + * A yeoman generator class for creating a webpack + * plugin project. It adds some starter plugin code + * and runs `webpack-defaults`. + * + * @class PluginGenerator + * @extends {Generator} + */ +var PluginGenerator = webpackGenerator( + [{ + type: "input", + name: "name", + message: "Plugin name", + default: "my-webpack-plugin", + filter: _.kebabCase, + validate: str => str.length > 0, + }], + path.join(__dirname, "templates"), + [ + "src/cjs.js.tpl", + "test/test-utils.js.tpl", + "test/functional.test.js.tpl", + "examples/simple/src/index.js.tpl", + "examples/simple/src/lazy-module.js.tpl", + "examples/simple/src/static-esm-module.js.tpl", + ], + [ + "src/_index.js.tpl", + "examples/simple/_webpack.config.js.tpl", + ], + (gen) => ({ name: _.upperFirst(_.camelCase(gen.props.name)) }) +); + +module.exports = { + PluginGenerator, +}; diff --git a/lib/generate-plugin/templates/examples/simple/_webpack.config.js.tpl b/lib/generate-plugin/templates/examples/simple/_webpack.config.js.tpl new file mode 100644 index 00000000000..e50ecc3e588 --- /dev/null +++ b/lib/generate-plugin/templates/examples/simple/_webpack.config.js.tpl @@ -0,0 +1,13 @@ +const path = require('path'); +const <%= name %> = require('../../src/index.js'); + +module.exports = { + entry: './src/index.js', + output: { + path: path.join(__dirname, 'example_dist'), + filename: '[name].chunk.js', + }, + plugins: [ + new <%= name %>() + ] +}; diff --git a/lib/generate-plugin/templates/examples/simple/src/index.js.tpl b/lib/generate-plugin/templates/examples/simple/src/index.js.tpl new file mode 100644 index 00000000000..2c49d366408 --- /dev/null +++ b/lib/generate-plugin/templates/examples/simple/src/index.js.tpl @@ -0,0 +1,11 @@ +import esmModule from './static-esm-module'; + +const getLazyModule = () => System.import('./lazy-module'); + +setTimeout(() => { + getLazyModule.then((modDefault) => { + console.log(modDefault); + }); +}, 300); + +console.log(esmModule); diff --git a/lib/generate-plugin/templates/examples/simple/src/lazy-module.js.tpl b/lib/generate-plugin/templates/examples/simple/src/lazy-module.js.tpl new file mode 100644 index 00000000000..f3dac067326 --- /dev/null +++ b/lib/generate-plugin/templates/examples/simple/src/lazy-module.js.tpl @@ -0,0 +1 @@ +export default 'lazy'; diff --git a/lib/generate-plugin/templates/examples/simple/src/static-esm-module.js.tpl b/lib/generate-plugin/templates/examples/simple/src/static-esm-module.js.tpl new file mode 100644 index 00000000000..d02ba545bd3 --- /dev/null +++ b/lib/generate-plugin/templates/examples/simple/src/static-esm-module.js.tpl @@ -0,0 +1 @@ +export default 'foo'; diff --git a/lib/generate-plugin/templates/src/_index.js.tpl b/lib/generate-plugin/templates/src/_index.js.tpl new file mode 100644 index 00000000000..1a9001b8d67 --- /dev/null +++ b/lib/generate-plugin/templates/src/_index.js.tpl @@ -0,0 +1,16 @@ +/** + * See the webpack docs for more information about plugins: + * https://github.com/webpack/docs/wiki/how-to-write-a-plugin + */ + +function <%= name %>(options) { + // Setup the plugin instance with options... +} + +<%= name %>.prototype.apply = function(compiler) { + compiler.plugin('done', function() { + console.log('Hello World!'); + }); +}; + +module.exports = <%= name %>; diff --git a/lib/generate-plugin/templates/src/cjs.js.tpl b/lib/generate-plugin/templates/src/cjs.js.tpl new file mode 100644 index 00000000000..82657ce3a74 --- /dev/null +++ b/lib/generate-plugin/templates/src/cjs.js.tpl @@ -0,0 +1 @@ +module.exports = require('./index').default; diff --git a/lib/generate-plugin/templates/test/fixtures/simple-file.js.tpl b/lib/generate-plugin/templates/test/fixtures/simple-file.js.tpl new file mode 100644 index 00000000000..908ed137dff --- /dev/null +++ b/lib/generate-plugin/templates/test/fixtures/simple-file.js.tpl @@ -0,0 +1,3 @@ +import foo from "./foo"; // eslint-disable-line + +console.log(foo); diff --git a/lib/generate-plugin/templates/test/functional.test.js.tpl b/lib/generate-plugin/templates/test/functional.test.js.tpl new file mode 100644 index 00000000000..07f2099cec0 --- /dev/null +++ b/lib/generate-plugin/templates/test/functional.test.js.tpl @@ -0,0 +1,10 @@ +import { + runWebpackExampleInMemory, +} from '../test/test-utils'; + +test('should run with no errors or warnings', async () => { + const buildStats = await runWebpackExampleInMemory('simple'); + const { errors, warnings } = buildStats; + + expect([...errors, ...warnings].length).toBe(0); +}); diff --git a/lib/generate-plugin/templates/test/test-utils.js.tpl b/lib/generate-plugin/templates/test/test-utils.js.tpl new file mode 100644 index 00000000000..bf8116f065f --- /dev/null +++ b/lib/generate-plugin/templates/test/test-utils.js.tpl @@ -0,0 +1,82 @@ +import path from 'path'; +import webpack from 'webpack'; +import Promise from 'bluebird'; +import MemoryFs from 'memory-fs'; + +const fs = new MemoryFs(); +const unitTestFixtures = path.resolve(__dirname, 'fixtures'); + +/** + * + * + * @param {string} fixtureName + * @param {string} [withQueryString=''] + * @returns {string} Absolute path of a file with query that is to be run by a loader. + */ +function getFixtureResource(fixtureName, withQueryString = '') { + return `${getFixture(fixtureName)}?${withQueryString}`; +} + +/** + * + * + * @param {string} fixtureName + * @returns {string} Absolute path of a file with query that is to be run by a loader. + */ +function getFixture(fixtureName) { + return path.resolve(unitTestFixtures, `${fixtureName}.js`); +} + +/** + * + * + * @param {Object} withOptions - Loader Options + * @returns {{loader: string, options: Object}} + */ +function getLoader(withOptions) { + return [{ loader: path.resolve(__dirname, '../dist/index.js'), options: withOptions }]; +} + +/** + * + * + * @param {string} exampleName + * @returns {Object|Array} - Returns an object or array of objects representing the webpack configuration options + */ +function getExampleConfig(exampleName) { + return require(`../examples/${exampleName}/webpack.config.js`); +} + +/** + * + * + * @param {string} exampleName - name of example inside of examples folder + * @returns + */ +async function runWebpackExampleInMemory(exampleName) { + const webpackConfig = getExampleConfig(exampleName); + const compiler = webpack(webpackConfig); + + compiler.outputFileSystem = fs; + + const run = Promise.promisify(compiler.run, { context: compiler }); + const stats = await run(); + + + const { compilation } = stats; + const { errors, warnings, assets, entrypoints, chunks, modules } = compilation; + const statsJson = stats.toJson(); + + return { + assets, + entrypoints, + errors, + warnings, + stats, + chunks, + modules, + statsJson, + }; +} + +export { getExampleConfig, runWebpackExampleInMemory, fs, getFixtureResource, getLoader, getFixture }; diff --git a/lib/utils/copy-utils.js b/lib/utils/copy-utils.js new file mode 100644 index 00000000000..e515d862257 --- /dev/null +++ b/lib/utils/copy-utils.js @@ -0,0 +1,50 @@ +var path = require("path"); + +/** + * Takes in a file path in the `./templates` directory. Copies that + * file to the destination, with the `.tpl` extension stripped. + * + * @param {Generator} generator A Yeoman Generator instance + * @param {string} templateDir Absolute path to template directory + * @returns {Function} A curried function that takes a file path and copies it + */ +var generatorCopy = (generator, templateDir) => /** @param {string} filePath */ (filePath) => { + var sourceParts = templateDir.split(path.delimiter); + sourceParts.push.apply(sourceParts, filePath.split("/")); + var targetParts = path.dirname(filePath).split("/"); + targetParts.push(path.basename(filePath, ".tpl")); + + generator.fs.copy( + path.join.apply(null, sourceParts), + generator.destinationPath(path.join.apply(null, targetParts)) + ); +}; + +/** + * Takes in a file path in the `./templates` directory. Copies that + * file to the destination, with the `.tpl` extension and `_` prefix + * stripped. Passes `this.props` to the template. + * + * @param {Generator} generator A Yeoman Generator instance + * @param {string} templateDir Absolute path to template directory + * @param {any} templateData An object containing the data passed to + * the template files. + * @returns {Function} A curried function that takes a file path and copies it + */ +var generatorCopyTpl = (generator, templateDir, templateData) => /** @param {string} filePath */ (filePath) => { + var sourceParts = templateDir.split(path.delimiter); + sourceParts.push.apply(sourceParts, filePath.split("/")); + var targetParts = path.dirname(filePath).split("/"); + targetParts.push(path.basename(filePath, ".tpl").slice(1)); + + generator.fs.copyTpl( + path.join.apply(null, sourceParts), + generator.destinationPath(path.join.apply(null, targetParts)), + templateData + ); +}; + +module.exports = { + generatorCopy, + generatorCopyTpl, +}; diff --git a/lib/utils/webpack-generator.js b/lib/utils/webpack-generator.js new file mode 100644 index 00000000000..f7f058098a6 --- /dev/null +++ b/lib/utils/webpack-generator.js @@ -0,0 +1,65 @@ +var path = require("path"); +var mkdirp = require("mkdirp"); +var Generator = require("yeoman-generator"); +var copyUtils = require("../utils/copy-utils"); + +/** + * Creates a Yeoman Generator that generates a project conforming + * to webpack-defaults. + * + * @param {any[]} prompts An array of Yeoman prompt objects + * + * @param {string} templateDir Absolute path to template directory + * + * @param {string[]} copyFiles An array of file paths (relative to `./templates`) + * of files to be copied to the generated project. File paths should be of the + * form `path/to/file.js.tpl`. + * + * @param {string[]} copyTemplateFiles An array of file paths (relative to + * `./templates`) of files to be copied to the generated project. Template + * file paths should be of the form `path/to/_file.js.tpl`. + * + * @param {Function} templateFn A function that is passed a generator instance and + * returns an object containing data to be supplied to the template files. + * + * @returns {Generator} A class extending Generator + */ +function webpackGenerator(prompts, templateDir, copyFiles, copyTemplateFiles, templateFn) { + //eslint-disable-next-line + return class extends Generator { + prompting() { + return this.prompt(prompts).then(props => { + this.props = props; + }); + } + + default() { + var currentDirName = path.basename(this.destinationPath()); + if (currentDirName !== this.props.name) { + this.log(` + Your project must be inside a folder named ${this.props.name} + I will create this folder for you. + `); + mkdirp(this.props.name); + var pathToProjectDir = this.destinationPath(this.props.name); + this.destinationRoot(pathToProjectDir); + } + } + + writing() { + this.copy = copyUtils.generatorCopy(this, templateDir); + this.copyTpl = copyUtils.generatorCopyTpl(this, templateDir, templateFn(this)); + + copyFiles.forEach(this.copy); + copyTemplateFiles.forEach(this.copyTpl); + } + + install() { + this.npmInstall(["webpack-defaults", "bluebird"], { "save-dev": true }).then(() => { + this.spawnCommand("npm", ["run", "webpack-defaults"]); + }); + } + }; +} + +module.exports = webpackGenerator; diff --git a/package-lock.json b/package-lock.json index 504137263c9..db75dc657e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1449,7 +1449,6 @@ "requires": { "anymatch": "1.3.0", "async-each": "1.0.1", - "fsevents": "1.1.2", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -5869,12 +5868,6 @@ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" }, - "nan": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", - "integrity": "sha1-5P805slf37WuzAjeZZb0NgWn20U=", - "optional": true - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", diff --git a/package.json b/package.json index 3a99527065c..9c28c1776d4 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "listr": "^0.12.0", "loader-utils": "^1.1.0", "lodash": "^4.17.4", + "mkdirp": "^0.5.1", "p-each-series": "^1.0.0", "p-lazy": "^1.0.0", "prettier": "^1.5.3", From 5d0859af07d1b05b211f0ea28da8d7f37df68159 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Thu, 21 Sep 2017 22:49:46 +0200 Subject: [PATCH 07/12] add unit tests for everything and flow compilation --- .eslintignore | 1 + .gitignore | 3 + bin/config-yargs.js | 2 +- bin/convert-argv.js | 126 +- bin/prepareOptions.js | 30 + bin/webpack.js | 452 +++---- lib/creator/yeoman/utils/entry.js | 120 +- lib/creator/yeoman/webpack-generator.js | 482 ++++---- .../bannerPlugin/bannerPlugin.js | 20 +- .../extractTextPlugin/extractTextPlugin.js | 27 +- lib/transformations/index.js | 31 +- .../loaderOptionsPlugin.js | 21 +- lib/transformations/loaders/loaders.js | 143 ++- lib/transformations/outputPath/outputPath.js | 57 +- .../removeDeprecatedPlugins.js | 29 +- .../removeJsonLoader/removeJsonLoader.js | 10 +- lib/transformations/resolve/resolve.js | 35 +- .../uglifyJsPlugin/uglifyJsPlugin.js | 36 +- lib/transformations/utils.js | 243 ++-- lib/types.js | 49 +- lib/utils/npm-exists.js | 2 +- lib/utils/resolve-packages.js | 3 +- lib/utils/validateSchema.js | 6 +- package-lock.json | 1055 +++++++++++++++-- package.json | 20 +- test/BinTestCases.test.js | 146 +++ test/binCases/config-name/found-many/index.js | 1 + .../binCases/config-name/found-many/index2.js | 1 + .../binCases/config-name/found-many/index3.js | 0 test/binCases/config-name/found-many/test.js | 9 + .../binCases/config-name/found-many/test.opts | 6 + .../config-name/found-many/webpack.config.js | 16 + test/binCases/config-name/found-one/index.js | 1 + test/binCases/config-name/found-one/index2.js | 1 + test/binCases/config-name/found-one/test.js | 9 + test/binCases/config-name/found-one/test.opts | 5 + .../config-name/found-one/webpack.config.js | 12 + test/binCases/config-name/not-found/test.js | 7 + test/binCases/config-name/not-found/test.opts | 2 + .../config-name/not-found/webpack.config.js | 5 + test/binCases/configFile/profile/bar.js | 1 + test/binCases/configFile/profile/foo.js | 3 + test/binCases/configFile/profile/index.js | 1 + test/binCases/configFile/profile/test.js | 12 + .../configFile/profile/webpack.config.js | 6 + test/binCases/entry/multi-file/a.js | 1 + test/binCases/entry/multi-file/index.js | 1 + test/binCases/entry/multi-file/test.js | 12 + test/binCases/entry/multi-file/test.opts | 6 + .../entry/multi-file/webpack.config.js | 1 + test/binCases/entry/named-entry/a.js | 1 + test/binCases/entry/named-entry/index.js | 1 + test/binCases/entry/named-entry/test.js | 12 + test/binCases/entry/named-entry/test.opts | 6 + .../entry/named-entry/webpack.config.js | 1 + test/binCases/entry/non-hyphenated-args/a.js | 1 + .../entry/non-hyphenated-args/index.js | 1 + .../entry/non-hyphenated-args/test.js | 12 + .../entry/non-hyphenated-args/test.opts | 6 + .../non-hyphenated-args/webpack.config.js | 1 + test/binCases/errors/issue-5576/a.js | 1 + test/binCases/errors/issue-5576/a/.keep | 1 + test/binCases/errors/issue-5576/test.js | 14 + test/binCases/errors/issue-5576/test.opts | 3 + .../errors/issue-5576/webpack.config.js | 1 + test/binCases/errors/parse/index.js | 1 + test/binCases/errors/parse/test.js | 17 + test/binCases/errors/parse/webpack.config.js | 4 + test/binCases/help/help-output/test.js | 19 + test/binCases/help/help-output/test.opts | 1 + test/binCases/module/module-bind/file.post | 1 + test/binCases/module/module-bind/file.pre | 1 + test/binCases/module/module-bind/index.js | 3 + .../module/module-bind/post-loader.js | 4 + .../binCases/module/module-bind/pre-loader.js | 4 + test/binCases/module/module-bind/test.js | 10 + test/binCases/module/module-bind/test.opts | 7 + .../module/module-bind/webpack.config.js | 5 + .../uglifyjsplugin-empty-args/index.js | 1 + .../plugins/uglifyjsplugin-empty-args/test.js | 10 + .../uglifyjsplugin-empty-args/test.opts | 6 + .../webpack.config.js | 5 + test/binCases/stats/custom-preset/index.js | 1 + test/binCases/stats/custom-preset/test.js | 7 + test/binCases/stats/custom-preset/test.opts | 5 + test/binCases/stats/multi-config/index.js | 1 + test/binCases/stats/multi-config/index2.js | 1 + test/binCases/stats/multi-config/test.js | 7 + .../stats/multi-config/webpack.config.js | 12 + test/binCases/stats/none/index.js | 1 + test/binCases/stats/none/test.js | 7 + test/binCases/stats/none/webpack.config.js | 6 + test/binCases/stats/single-config/index.js | 1 + test/binCases/stats/single-config/test.js | 17 + .../stats/single-config/webpack.config.js | 11 + test/binCases/test.opts | 5 + .../watch/multi-config-watch-opt/async | 0 .../watch/multi-config-watch-opt/index.js | 1 + .../watch/multi-config-watch-opt/index2.js | 1 + .../watch/multi-config-watch-opt/test.js | 10 + .../watch/multi-config-watch-opt/test.opts | 6 + .../multi-config-watch-opt/webpack.config.js | 10 + test/binCases/watch/multi-config/async | 0 test/binCases/watch/multi-config/index.js | 1 + test/binCases/watch/multi-config/index2.js | 1 + test/binCases/watch/multi-config/test.js | 10 + .../watch/multi-config/webpack.config.js | 11 + .../watch/single-config-watch-opt/async | 0 .../watch/single-config-watch-opt/index.js | 0 .../watch/single-config-watch-opt/test.js | 10 + .../watch/single-config-watch-opt/test.opts | 6 + .../single-config-watch-opt/webpack.config.js | 5 + test/binCases/watch/single-config/async | 0 test/binCases/watch/single-config/index.js | 0 test/binCases/watch/single-config/test.js | 10 + .../watch/single-config/webpack.config.js | 6 + test/js/bin/config-name/found-many/main.js | 74 ++ test/js/bin/config-name/found-one/main.js | 74 ++ test/js/bin/configFile/profile/null.js | 90 ++ test/js/bin/entry/multi-file/null.js | 97 ++ test/js/bin/entry/named-entry/foo.js | 84 ++ test/js/bin/entry/named-entry/null.js | 85 ++ test/js/bin/entry/non-hyphenated-args/main.js | 85 ++ test/js/bin/entry/non-hyphenated-args/null.js | 84 ++ test/js/bin/errors/parse/null.js | 86 ++ test/js/bin/module/module-bind/null.js | 98 ++ .../plugins/uglifyjsplugin-empty-args/null.js | 38 + test/js/bin/stats/custom-preset/null.js | 84 ++ test/js/bin/stats/multi-config/null.js | 84 ++ test/js/bin/stats/none/null.js | 84 ++ test/js/bin/stats/single-config/null.js | 84 ++ .../bin/watch/multi-config-watch-opt/null.js | 84 ++ test/js/bin/watch/multi-config/null.js | 84 ++ .../bin/watch/single-config-watch-opt/null.js | 82 ++ test/js/bin/watch/single-config/null.js | 82 ++ 135 files changed, 4251 insertions(+), 911 deletions(-) create mode 100644 bin/prepareOptions.js create mode 100644 test/BinTestCases.test.js create mode 100644 test/binCases/config-name/found-many/index.js create mode 100644 test/binCases/config-name/found-many/index2.js create mode 100644 test/binCases/config-name/found-many/index3.js create mode 100644 test/binCases/config-name/found-many/test.js create mode 100644 test/binCases/config-name/found-many/test.opts create mode 100644 test/binCases/config-name/found-many/webpack.config.js create mode 100644 test/binCases/config-name/found-one/index.js create mode 100644 test/binCases/config-name/found-one/index2.js create mode 100644 test/binCases/config-name/found-one/test.js create mode 100644 test/binCases/config-name/found-one/test.opts create mode 100644 test/binCases/config-name/found-one/webpack.config.js create mode 100644 test/binCases/config-name/not-found/test.js create mode 100644 test/binCases/config-name/not-found/test.opts create mode 100644 test/binCases/config-name/not-found/webpack.config.js create mode 100644 test/binCases/configFile/profile/bar.js create mode 100644 test/binCases/configFile/profile/foo.js create mode 100644 test/binCases/configFile/profile/index.js create mode 100644 test/binCases/configFile/profile/test.js create mode 100644 test/binCases/configFile/profile/webpack.config.js create mode 100644 test/binCases/entry/multi-file/a.js create mode 100644 test/binCases/entry/multi-file/index.js create mode 100644 test/binCases/entry/multi-file/test.js create mode 100644 test/binCases/entry/multi-file/test.opts create mode 100644 test/binCases/entry/multi-file/webpack.config.js create mode 100644 test/binCases/entry/named-entry/a.js create mode 100644 test/binCases/entry/named-entry/index.js create mode 100644 test/binCases/entry/named-entry/test.js create mode 100644 test/binCases/entry/named-entry/test.opts create mode 100644 test/binCases/entry/named-entry/webpack.config.js create mode 100644 test/binCases/entry/non-hyphenated-args/a.js create mode 100644 test/binCases/entry/non-hyphenated-args/index.js create mode 100644 test/binCases/entry/non-hyphenated-args/test.js create mode 100644 test/binCases/entry/non-hyphenated-args/test.opts create mode 100644 test/binCases/entry/non-hyphenated-args/webpack.config.js create mode 100644 test/binCases/errors/issue-5576/a.js create mode 100644 test/binCases/errors/issue-5576/a/.keep create mode 100644 test/binCases/errors/issue-5576/test.js create mode 100644 test/binCases/errors/issue-5576/test.opts create mode 100644 test/binCases/errors/issue-5576/webpack.config.js create mode 100644 test/binCases/errors/parse/index.js create mode 100644 test/binCases/errors/parse/test.js create mode 100644 test/binCases/errors/parse/webpack.config.js create mode 100644 test/binCases/help/help-output/test.js create mode 100644 test/binCases/help/help-output/test.opts create mode 100644 test/binCases/module/module-bind/file.post create mode 100644 test/binCases/module/module-bind/file.pre create mode 100644 test/binCases/module/module-bind/index.js create mode 100644 test/binCases/module/module-bind/post-loader.js create mode 100644 test/binCases/module/module-bind/pre-loader.js create mode 100644 test/binCases/module/module-bind/test.js create mode 100644 test/binCases/module/module-bind/test.opts create mode 100644 test/binCases/module/module-bind/webpack.config.js create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/index.js create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/test.js create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/test.opts create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/webpack.config.js create mode 100644 test/binCases/stats/custom-preset/index.js create mode 100644 test/binCases/stats/custom-preset/test.js create mode 100644 test/binCases/stats/custom-preset/test.opts create mode 100644 test/binCases/stats/multi-config/index.js create mode 100644 test/binCases/stats/multi-config/index2.js create mode 100644 test/binCases/stats/multi-config/test.js create mode 100644 test/binCases/stats/multi-config/webpack.config.js create mode 100644 test/binCases/stats/none/index.js create mode 100644 test/binCases/stats/none/test.js create mode 100644 test/binCases/stats/none/webpack.config.js create mode 100644 test/binCases/stats/single-config/index.js create mode 100644 test/binCases/stats/single-config/test.js create mode 100644 test/binCases/stats/single-config/webpack.config.js create mode 100644 test/binCases/test.opts create mode 100644 test/binCases/watch/multi-config-watch-opt/async create mode 100644 test/binCases/watch/multi-config-watch-opt/index.js create mode 100644 test/binCases/watch/multi-config-watch-opt/index2.js create mode 100644 test/binCases/watch/multi-config-watch-opt/test.js create mode 100644 test/binCases/watch/multi-config-watch-opt/test.opts create mode 100644 test/binCases/watch/multi-config-watch-opt/webpack.config.js create mode 100644 test/binCases/watch/multi-config/async create mode 100644 test/binCases/watch/multi-config/index.js create mode 100644 test/binCases/watch/multi-config/index2.js create mode 100644 test/binCases/watch/multi-config/test.js create mode 100644 test/binCases/watch/multi-config/webpack.config.js create mode 100644 test/binCases/watch/single-config-watch-opt/async create mode 100644 test/binCases/watch/single-config-watch-opt/index.js create mode 100644 test/binCases/watch/single-config-watch-opt/test.js create mode 100644 test/binCases/watch/single-config-watch-opt/test.opts create mode 100644 test/binCases/watch/single-config-watch-opt/webpack.config.js create mode 100644 test/binCases/watch/single-config/async create mode 100644 test/binCases/watch/single-config/index.js create mode 100644 test/binCases/watch/single-config/test.js create mode 100644 test/binCases/watch/single-config/webpack.config.js create mode 100644 test/js/bin/config-name/found-many/main.js create mode 100644 test/js/bin/config-name/found-one/main.js create mode 100644 test/js/bin/configFile/profile/null.js create mode 100644 test/js/bin/entry/multi-file/null.js create mode 100644 test/js/bin/entry/named-entry/foo.js create mode 100644 test/js/bin/entry/named-entry/null.js create mode 100644 test/js/bin/entry/non-hyphenated-args/main.js create mode 100644 test/js/bin/entry/non-hyphenated-args/null.js create mode 100644 test/js/bin/errors/parse/null.js create mode 100644 test/js/bin/module/module-bind/null.js create mode 100644 test/js/bin/plugins/uglifyjsplugin-empty-args/null.js create mode 100644 test/js/bin/stats/custom-preset/null.js create mode 100644 test/js/bin/stats/multi-config/null.js create mode 100644 test/js/bin/stats/none/null.js create mode 100644 test/js/bin/stats/single-config/null.js create mode 100644 test/js/bin/watch/multi-config-watch-opt/null.js create mode 100644 test/js/bin/watch/multi-config/null.js create mode 100644 test/js/bin/watch/single-config-watch-opt/null.js create mode 100644 test/js/bin/watch/single-config/null.js diff --git a/.eslintignore b/.eslintignore index 2eee14cbe2a..a62988d01bf 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ **/__testfixtures__/* coverage +test diff --git a/.gitignore b/.gitignore index 79960dd2d49..3d29695d9be 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ yarn-error.log # Jest Coverage coverage + +# Dist build +dist diff --git a/bin/config-yargs.js b/bin/config-yargs.js index ac2187e350d..e5cff717a3a 100644 --- a/bin/config-yargs.js +++ b/bin/config-yargs.js @@ -10,7 +10,7 @@ var INIT_GROUP = "Initialization:"; module.exports = function(yargs) { yargs .help("help") - .alias("help", "h", "?") + .alias("help", "h") .version() .alias("version", "v") .options({ diff --git a/bin/convert-argv.js b/bin/convert-argv.js index 29dc5062918..aa77df656fa 100644 --- a/bin/convert-argv.js +++ b/bin/convert-argv.js @@ -1,9 +1,8 @@ -"use strict"; - var path = require("path"); var fs = require("fs"); fs.existsSync = fs.existsSync || path.existsSync; var interpret = require("interpret"); +var prepareOptions = require("./prepareOptions"); module.exports = function(yargs, argv, convertOptions) { var options = []; @@ -20,7 +19,7 @@ module.exports = function(yargs, argv, convertOptions) { argv["optimize-minimize"] = true; argv["define"] = [] .concat(argv["define"] || []) - .concat("process.env.NODE_ENV='production'"); + .concat("process.env.NODE_ENV=\"production\""); } var configFileLoaded = false; @@ -103,14 +102,7 @@ module.exports = function(yargs, argv, convertOptions) { 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); - } + options = prepareOptions(options, argv); return options; }; @@ -134,7 +126,7 @@ module.exports = function(yargs, argv, convertOptions) { console.error( "Config did not export an object or a function returning an object." ); - process.exit(-1); + process.exit(-1); // eslint-disable-line } // process Promise @@ -147,6 +139,22 @@ module.exports = function(yargs, argv, convertOptions) { return processConfiguredOptions(options.default); } + // filter multi-config by name + if (Array.isArray(options) && argv["config-name"]) { + var namedOptions = options.filter(function(opt) { + return opt.name === argv["config-name"]; + }); + if (namedOptions.length === 0) { + console.error( + "Configuration with name '" + argv["config-name"] + "' was not found." + ); + process.exit(-1); // eslint-disable-line + } else if (namedOptions.length === 1) { + return processConfiguredOptions(namedOptions[0]); + } + options = namedOptions; + } + if (Array.isArray(options)) { options.forEach(processOptions); } else { @@ -169,11 +177,12 @@ module.exports = function(yargs, argv, convertOptions) { options.watchOptions.aggregateTimeout = +argv["watch-aggregate-timeout"]; } - if (argv["watch-poll"]) { + if (typeof argv["watch-poll"] !== undefined) { options.watchOptions = options.watchOptions || {}; - if (typeof argv["watch-poll"] !== "boolean") + if (argv["watch-poll"] === "true" || argv["watch-poll"] === "") + options.watchOptions.poll = true; + else if (!isNaN(argv["watch-poll"])) options.watchOptions.poll = +argv["watch-poll"]; - else options.watchOptions.poll = true; } if (argv["watch-stdin"]) { @@ -233,21 +242,22 @@ module.exports = function(yargs, argv, convertOptions) { } function mapArgToBoolean(name, optionName) { + if (options[optionName || name]) { + options[name] = true; + } + //eslint-disable-next-line + if (name && options[name] == true) { + return; + } ifArg(name, function(bool) { if (bool === true) options[optionName || name] = true; else if (bool === false) options[optionName || name] = false; }); } - //eslint-disable-next-line - function mapArgToPath(name, optionName) { - ifArg(name, function(str) { - options[optionName || name] = path.resolve(str); - }); - } function loadPlugin(name) { var loadUtils = require("loader-utils"); - var args = null; + var args; try { var p = name && name.indexOf("?"); if (p > -1) { @@ -256,7 +266,7 @@ module.exports = function(yargs, argv, convertOptions) { } } catch (e) { console.log("Invalid plugin arguments " + name + " (" + e + ")."); - process.exit(-1); + process.exit(-1); // eslint-disable-line } var path; @@ -265,7 +275,7 @@ module.exports = function(yargs, argv, convertOptions) { path = resolve.sync(process.cwd(), name); } catch (e) { console.log("Cannot resolve plugin " + name + "."); - process.exit(-1); + process.exit(-1); // eslint-disable-line } var Plugin; try { @@ -297,14 +307,21 @@ module.exports = function(yargs, argv, convertOptions) { ifArgPair( "entry", function(name, entry) { - options.entry[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) { + function bindRules(arg) { ifArgPair( arg, function(name, binding) { @@ -312,28 +329,31 @@ module.exports = function(yargs, argv, convertOptions) { name = binding; binding += "-loader"; } - options.module[collection].push({ + var rule = { + /* eslint-disable no-useless-escape */ test: new RegExp( "\\." + - // eslint thinks that the escapes are useless, - // however, when testing them, the special regex chars - // mess up with the regex we want to use to check. - // eslint-disable-next-line name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "$" - ), + ) /* eslint-enable no-useless-escape */, loader: binding - }); + }; + if (arg === "module-bind-pre") { + rule.enforce = "pre"; + } else if (arg === "module-bind-post") { + rule.enforce = "post"; + } + options.module.rules.push(rule); }, function() { ensureObject(options, "module"); - ensureArray(options.module, collection); + ensureArray(options.module, "rules"); } ); } - bindLoaders("module-bind", "loaders"); - bindLoaders("module-bind-pre", "preLoaders"); - bindLoaders("module-bind-post", "postLoaders"); + bindRules("module-bind"); + bindRules("module-bind-pre"); + bindRules("module-bind-post"); var defineObject; ifArgPair( @@ -357,7 +377,7 @@ module.exports = function(yargs, argv, convertOptions) { ifArg("output-path", function(value) { ensureObject(options, "output"); - options.output.path = value; + options.output.path = path.resolve(value); }); ifArg("output-filename", function(value) { @@ -502,7 +522,7 @@ module.exports = function(yargs, argv, convertOptions) { ifArg("prefetch", function(request) { ensureArray(options, "plugins"); - var PrefetchPlugin = require("webpack/PrefetchPlugin"); + var PrefetchPlugin = require("webpack/lib/PrefetchPlugin"); options.plugins.push(new PrefetchPlugin(request)); }); @@ -516,16 +536,10 @@ module.exports = function(yargs, argv, convertOptions) { } else { name = value; } - var ProvidePlugin = require("webpack/ProvidePlugin"); + var ProvidePlugin = require("webpack/lib/ProvidePlugin"); options.plugins.push(new ProvidePlugin(name, value)); }); - ifBooleanArg("labeled-modules", function() { - ensureArray(options, "plugins"); - var LabeledModulesPlugin = require("webpack/lib/dependencies/LabeledModulesPlugin"); - options.plugins.push(new LabeledModulesPlugin()); - }); - ifArg("plugin", function(value) { ensureArray(options, "plugins"); options.plugins.push(loadPlugin(value)); @@ -534,15 +548,18 @@ module.exports = function(yargs, argv, convertOptions) { mapArgToBoolean("bail"); mapArgToBoolean("profile"); - if (noOutputFilenameDefined) { ensureObject(options, "output"); if (convertOptions && convertOptions.outputFilename) { - options.output.path = path.dirname(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.dirname(options.output.filename); + options.output.path = path.resolve( + path.dirname(options.output.filename) + ); options.output.filename = path.basename(options.output.filename); } else if (configFileLoaded) { throw new Error( @@ -556,7 +573,7 @@ module.exports = function(yargs, argv, convertOptions) { "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); + process.exit(-1); // eslint-disable-line } } @@ -584,7 +601,12 @@ module.exports = function(yargs, argv, convertOptions) { if (i < 0 || (j >= 0 && j < i)) { var resolved = path.resolve(content); if (fs.existsSync(resolved)) { - addTo("main", resolved); + addTo( + "main", + `${resolved}${fs.statSync(resolved).isDirectory() + ? path.sep + : ""}` + ); } else { addTo("main", content); } @@ -609,7 +631,7 @@ module.exports = function(yargs, argv, convertOptions) { ); } console.error("Use --help to display the CLI options."); - process.exit(-1); + process.exit(-1); // eslint-disable-line } } }; diff --git a/bin/prepareOptions.js b/bin/prepareOptions.js new file mode 100644 index 00000000000..09d83469dba --- /dev/null +++ b/bin/prepareOptions.js @@ -0,0 +1,30 @@ +"use strict"; + +module.exports = function prepareOptions(options, argv) { + argv = argv || {}; + + options = handleExport(options); + + if (Array.isArray(options)) { + options = options.map(_options => handleFunction(_options, argv)); + } else { + options = handleFunction(options, argv); + } + return options; +}; + +function handleExport(options) { + const isES6DefaultExported = + typeof options === "object" && + options !== null && + typeof options.default !== "undefined"; + options = isES6DefaultExported ? options.default : options; + return options; +} + +function handleFunction(options, argv) { + if (typeof options === "function") { + options = options(argv.env, argv); + } + return options; +} diff --git a/bin/webpack.js b/bin/webpack.js index db514c3f362..e5ac67f483a 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -1,26 +1,38 @@ #!/usr/bin/env node + /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ -"use strict"; - var path = require("path"); var resolveCwd = require("resolve-cwd"); - +// Local version replace global one var localCLI = resolveCwd.silent("webpack-cli/bin/webpack"); +if (process.argv.slice(2).indexOf("init") >= 0) { + const initPkgs = + process.argv.slice(2).length === 1 ? [] : [process.argv.slice(2).pop()]; + + return require("../dist/initialize")(initPkgs); +} else if (process.argv.slice(2).indexOf("migrate") >= 0) { + const filePaths = + process.argv.slice(2).length === 1 ? [] : [process.argv.slice(2).pop()]; + if (!filePaths.length) { + throw new Error("Please specify a path to your webpack config"); + } + const inputConfigPath = path.resolve(process.cwd(), filePaths[0]); + + return require("../dist/migrate.js")(inputConfigPath, inputConfigPath); +} else if (process.argv.slice(2).indexOf("generate-loader") >= 0) { + return require("../lib/generate-loader/index.js")(); +} else if (process.argv.slice(2).indexOf("generate-plugin") >= 0) { + return require("../lib/generate-plugin/index.js")(); if (localCLI && path.relative(localCLI, __filename) !== "") { - require(localCLI); + return require(localCLI); } else { - try { - require("./webpack"); - } catch (err) { - console.error(`\n ${err.message}`); - process.exitCode = 1; - } + return require("webpack/bin/webpack"); } - +// eslint-disable-next-line var yargs = require("yargs").usage( "webpack " + require("../package.json").version + @@ -29,8 +41,8 @@ var yargs = require("yargs").usage( "Usage without config file: webpack [] \n" + "Usage with config file: webpack" ); -require("./config-yargs")(yargs); +require("./config-yargs")(yargs); var DISPLAY_GROUP = "Stats options:"; var BASIC_GROUP = "Basic options:"; @@ -134,262 +146,262 @@ yargs.options({ group: DISPLAY_GROUP, describe: "Display information about exports provided from modules" }, + "display-optimization-bailout": { + type: "boolean", + group: DISPLAY_GROUP, + describe: + "Display information about why optimization bailed out for modules" + }, "display-error-details": { type: "boolean", group: DISPLAY_GROUP, describe: "Display details about errors" }, + display: { + type: "string", + group: DISPLAY_GROUP, + describe: + "Select display preset (verbose, detailed, normal, minimal, errors-only, none)" + }, verbose: { type: "boolean", group: DISPLAY_GROUP, describe: "Show more details" } }); +// yargs will terminate the process early when the user uses help or version. +// This causes large help outputs to be cut short (https://github.com/nodejs/node/wiki/API-changes-between-v0.10-and-v4#process). +// To prevent this we use the yargs.parse API and exit the process normally -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; -} -if (argv._.indexOf("init") >= 0) { - const initPkgs = argv._.length === 1 ? [] : [argv._.pop()]; - - return require("../lib/initialize")(initPkgs); -} else if (argv._.indexOf("migrate") >= 0) { - const filePaths = argv._.length === 1 ? [] : [argv._.pop()]; - if (!filePaths.length) { - throw new Error("Please specify a path to your webpack config"); - } - const inputConfigPath = path.resolve(process.cwd(), filePaths[0]); - - return require("../lib/migrate.js")(inputConfigPath, inputConfigPath); -} else if (argv._.indexOf("generate-loader") >= 0) { - return require("../lib/generate-loader/index.js")(); -} else if (argv._.indexOf("generate-plugin") >= 0) { - return require("../lib/generate-plugin/index.js")(); -} else { - var options = require("./convert-argv")(yargs, argv); - - return processOptions(options); -} - -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); - } -} //eslint-disable-next-line -function processOptions(options) { - // process Promise - if (typeof options.then === "function") { - options.then(processOptions).catch(function(err) { - console.error(err.stack || err); - process.exitCode = -1; - }); +yargs.parse(process.argv.slice(2), (err, argv, output) => { + // arguments validation failed + if (err && output) { + console.error(output); + process.exitCode = 1; return; } - - var firstOptions = [].concat(options)[0]; - var statsPresetToOptions = require("webpack/lib/Stats.js").presetToOptions; - - var outputOptions = options.stats; - if (typeof outputOptions === "boolean" || typeof outputOptions === "string") { - outputOptions = statsPresetToOptions(outputOptions); - } else if (!outputOptions) { - outputOptions = {}; + if (output) { + console.log(output); + return; } - outputOptions = Object.create(outputOptions); - if (Array.isArray(options) && !outputOptions.children) { - outputOptions.children = options.map(o => o.stats); + if (argv.verbose) { + argv["display"] = "verbose"; } - 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"); + var options = require("./convert-argv")(yargs, argv); - ifArg("sort-modules-by", function(value) { - outputOptions.modulesSort = value; - }); + 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); + } + } - ifArg("sort-chunks-by", function(value) { - outputOptions.chunksSort = value; - }); + 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; + } - ifArg("sort-assets-by", function(value) { - outputOptions.assetsSort = value; - }); + var firstOptions = [].concat(options)[0]; + var statsPresetToOptions = require("webpack/lib/Stats.js").presetToOptions; + + var outputOptions = options.stats; + if ( + typeof outputOptions === "boolean" || + typeof outputOptions === "string" + ) { + outputOptions = statsPresetToOptions(outputOptions); + } else if (!outputOptions) { + outputOptions = {}; + } - ifArg("display-exclude", function(value) { - outputOptions.exclude = value; - }); + ifArg("display", function(preset) { + outputOptions = statsPresetToOptions(preset); + }); - if (!outputOptions.json) { - if (typeof outputOptions.cached === "undefined") - outputOptions.cached = false; - if (typeof outputOptions.cachedAssets === "undefined") - outputOptions.cachedAssets = false; + 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("display-chunks", function(bool) { - outputOptions.modules = !bool; - outputOptions.chunks = bool; + ifArg("json", function(bool) { + if (bool) outputOptions.json = bool; }); - ifArg("display-entrypoints", function(bool) { - outputOptions.entrypoints = bool; - }); + if (typeof outputOptions.colors === "undefined") + outputOptions.colors = require("supports-color"); - ifArg("display-reasons", function(bool) { - outputOptions.reasons = bool; + ifArg("sort-modules-by", function(value) { + outputOptions.modulesSort = value; }); - ifArg("display-depth", function(bool) { - outputOptions.depth = bool; + ifArg("sort-chunks-by", function(value) { + outputOptions.chunksSort = value; }); - ifArg("display-used-exports", function(bool) { - outputOptions.usedExports = bool; + ifArg("sort-assets-by", function(value) { + outputOptions.assetsSort = value; }); - ifArg("display-provided-exports", function(bool) { - outputOptions.providedExports = bool; + ifArg("display-exclude", function(value) { + outputOptions.exclude = value; }); - ifArg("display-error-details", function(bool) { - outputOptions.errorDetails = bool; - }); + if (!outputOptions.json) { + if (typeof outputOptions.cached === "undefined") + outputOptions.cached = false; + if (typeof outputOptions.cachedAssets === "undefined") + outputOptions.cachedAssets = false; + + ifArg("display-chunks", function(bool) { + if (bool) { + outputOptions.modules = false; + outputOptions.chunks = true; + outputOptions.chunkModules = true; + } + }); - ifArg("display-origins", function(bool) { - outputOptions.chunkOrigins = bool; - }); + ifArg("display-entrypoints", function(bool) { + if (bool) outputOptions.entrypoints = true; + }); - ifArg("display-max-modules", function(value) { - outputOptions.maxModules = value; - }); + ifArg("display-reasons", function(bool) { + if (bool) outputOptions.reasons = true; + }); - ifArg("display-cached", function(bool) { - if (bool) outputOptions.cached = true; - }); + ifArg("display-depth", function(bool) { + if (bool) outputOptions.depth = true; + }); - ifArg("display-cached-assets", function(bool) { - if (bool) outputOptions.cachedAssets = true; - }); + ifArg("display-used-exports", function(bool) { + if (bool) outputOptions.usedExports = true; + }); - if (!outputOptions.exclude) - outputOptions.exclude = [ - "node_modules", - "bower_components", - "components" - ]; + ifArg("display-provided-exports", function(bool) { + if (bool) outputOptions.providedExports = true; + }); - 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("display-optimization-bailout", function(bool) { + if (bool) outputOptions.optimizationBailout = bool; + }); - ifArg("hide-modules", function(bool) { - if (bool) { - outputOptions.modules = false; - outputOptions.chunkModules = false; - } - }); - - var webpack = require("webpack/lib/webpack.js"); - - Error.stackTraceLimit = 30; - var lastHash = null; - var compiler; - try { - compiler = webpack(options); - } catch (e) { - var WebpackOptionsValidationError = require("webpack/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.exitCode = 1; - } - throw e; - } + ifArg("display-error-details", function(bool) { + if (bool) outputOptions.errorDetails = true; + }); - if (argv.progress) { - var ProgressPlugin = require("webpack/lib/ProgressPlugin"); - compiler.apply( - new ProgressPlugin({ - profile: argv.profile - }) - ); - } + ifArg("display-origins", function(bool) { + if (bool) outputOptions.chunkOrigins = true; + }); + + 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; + }); - function compilerCallback(err, stats) { - if (!options.watch || err) { - // Do not keep cache anymore - compiler.purgeInputFileSystem(); + if (!outputOptions.exclude) + outputOptions.exclude = [ + "node_modules", + "bower_components", + "components" + ]; + + if (argv["display-modules"]) { + outputOptions.maxModules = Infinity; + outputOptions.exclude = undefined; + outputOptions.modules = true; + } } - if (err) { - lastHash = null; - console.error(err.stack || err); - if (err.details) console.error(err.details); - process.exitCode = 1; + + ifArg("hide-modules", function(bool) { + if (bool) { + outputOptions.modules = false; + outputOptions.chunkModules = false; + } + }); + + var webpack = require("webpack/lib/webpack.js"); + + Error.stackTraceLimit = 30; + var lastHash = null; + var compiler; + try { + compiler = webpack(options); + } catch (e) { + var WebpackOptionsValidationError = require("webpack/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 (outputOptions.json) { - process.stdout.write( - JSON.stringify(stats.toJson(outputOptions), null, 2) + "\n" + if (argv.progress) { + var ProgressPlugin = require("webpack/lib/ProgressPlugin"); + compiler.apply( + new ProgressPlugin({ + profile: argv.profile + }) ); - } else if (stats.hash !== lastHash) { - lastHash = stats.hash; - process.stdout.write(stats.toString(outputOptions) + "\n"); } - if (!options.watch && stats.hasErrors()) { - process.on("exit", function() { + + 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; + var statsString = stats.toString(outputOptions); + if (statsString) process.stdout.write(statsString + "\n"); + } + if (!options.watch && stats.hasErrors()) { process.exitCode = 2; - }); + } } + if (firstOptions.watch || options.watch) { + var watchOptions = + firstOptions.watchOptions || firstOptions.watch || options.watch || {}; + if (watchOptions.stdin) { + process.stdin.on("end", function() { + process.exit(); // eslint-disable-line + }); + process.stdin.resume(); + } + compiler.watch(watchOptions, compilerCallback); + console.log("\nWebpack is watching the files…\n"); + } else compiler.run(compilerCallback); } - if (firstOptions.watch || options.watch) { - var watchOptions = - firstOptions.watchOptions || firstOptions.watch || options.watch || {}; - if (watchOptions.stdin) { - process.stdin.on("end", function() { - process.exitCode = 0; - }); - process.stdin.resume(); - } - compiler.watch(watchOptions, compilerCallback); - console.log("\nWebpack is watching the files…\n"); - } else compiler.run(compilerCallback); -} + + processOptions(options); +}); diff --git a/lib/creator/yeoman/utils/entry.js b/lib/creator/yeoman/utils/entry.js index a21ae95eabc..027499c9610 100644 --- a/lib/creator/yeoman/utils/entry.js +++ b/lib/creator/yeoman/utils/entry.js @@ -7,69 +7,75 @@ module.exports = (self, answer) => { let entryIdentifiers; let result; if (answer["entryType"] === true) { - result = self.prompt([ - InputValidate( - "multipleEntries", - "Type the names you want for your modules (entry files), separated by comma [example: 'app,vendor']", - validate - ) - ]).then(multipleEntriesAnswer => { - let webpackEntryPoint = {}; - entryIdentifiers = multipleEntriesAnswer["multipleEntries"].split(","); - function forEachPromise(obj, fn) { - return obj.reduce(function(promise, prop) { - const trimmedProp = prop.trim(); - return promise.then(n => { - if (n) { - Object.keys(n).forEach((val) => { - if ( - n[val].charAt(0) !== "(" - && n[val].charAt(0) !== "[" - && n[val].indexOf("function") < 0 - && n[val].indexOf("path") < 0 - && n[val].indexOf("process") < 0 - ) { - n[val] = `"${n[val]}.js"`; - } - webpackEntryPoint[val] = n[val]; - }); - } else { - n = {}; - } - return fn(trimmedProp); - }); - }, Promise.resolve()); - } - return forEachPromise(entryIdentifiers, (entryProp) => self.prompt([ + result = self + .prompt([ InputValidate( - `${entryProp}`, - `What is the location of "${entryProp}"? [example: "./src/${entryProp}"]`, + "multipleEntries", + "Type the names you want for your modules (entry files), separated by comma [example: 'app,vendor']", validate ) - ])).then(propAns => { - Object.keys(propAns).forEach((val) => { - if ( - propAns[val].charAt(0) !== "(" - && propAns[val].charAt(0) !== "[" - && propAns[val].indexOf("function") < 0 - && propAns[val].indexOf("path") < 0 - && propAns[val].indexOf("process") < 0 - ) { - propAns[val] = `"${propAns[val]}.js"`; - } - webpackEntryPoint[val] = propAns[val]; + ]) + .then(multipleEntriesAnswer => { + let webpackEntryPoint = {}; + entryIdentifiers = multipleEntriesAnswer["multipleEntries"].split(","); + function forEachPromise(obj, fn) { + return obj.reduce(function(promise, prop) { + const trimmedProp = prop.trim(); + return promise.then(n => { + if (n) { + Object.keys(n).forEach(val => { + if ( + n[val].charAt(0) !== "(" && + n[val].charAt(0) !== "[" && + n[val].indexOf("function") < 0 && + n[val].indexOf("path") < 0 && + n[val].indexOf("process") < 0 + ) { + n[val] = `"${n[val]}.js"`; + } + webpackEntryPoint[val] = n[val]; + }); + } else { + n = {}; + } + return fn(trimmedProp); + }); + }, Promise.resolve()); + } + return forEachPromise(entryIdentifiers, entryProp => + self.prompt([ + InputValidate( + `${entryProp}`, + `What is the location of "${entryProp}"? [example: "./src/${entryProp}"]`, + validate + ) + ]) + ).then(propAns => { + Object.keys(propAns).forEach(val => { + if ( + propAns[val].charAt(0) !== "(" && + propAns[val].charAt(0) !== "[" && + propAns[val].indexOf("function") < 0 && + propAns[val].indexOf("path") < 0 && + propAns[val].indexOf("process") < 0 + ) { + propAns[val] = `"${propAns[val]}.js"`; + } + webpackEntryPoint[val] = propAns[val]; + }); + return webpackEntryPoint; }); - return webpackEntryPoint; }); - }); } else { - result = self.prompt([ - InputValidate( - "singularEntry", - "Which module will be the first to enter the application? [example: './src/index']", - validate - ) - ]).then((singularAnswer) => `"${singularAnswer["singularEntry"]}"`); + result = self + .prompt([ + InputValidate( + "singularEntry", + "Which module will be the first to enter the application? [example: './src/index']", + validate + ) + ]) + .then(singularAnswer => `"${singularAnswer["singularEntry"]}"`); } return result; }; diff --git a/lib/creator/yeoman/webpack-generator.js b/lib/creator/yeoman/webpack-generator.js index 08b5018f45c..f959dcc9ad6 100644 --- a/lib/creator/yeoman/webpack-generator.js +++ b/lib/creator/yeoman/webpack-generator.js @@ -3,7 +3,8 @@ const Generator = require("yeoman-generator"); const chalk = require("chalk"); -const createCommonsChunkPlugin = require("webpack-addons").createCommonsChunkPlugin; +const createCommonsChunkPlugin = require("webpack-addons") + .createCommonsChunkPlugin; const Input = require("webpack-addons").Input; const Confirm = require("webpack-addons").Confirm; @@ -37,7 +38,9 @@ module.exports = class WebpackGenerator extends Generator { `\n${chalk.bold("Insecure about some of the questions?")}\n` ); process.stdout.write( - `\n${chalk.bold.green("https://github.com/webpack/webpack-cli/blob/master/INIT.md")}\n\n` + `\n${chalk.bold.green( + "https://github.com/webpack/webpack-cli/blob/master/INIT.md" + )}\n\n` ); this.configuration.config.webpackOptions.module = { rules: [] @@ -54,68 +57,88 @@ module.exports = class WebpackGenerator extends Generator { Confirm("entryType", "Will your application have multiple bundles?") ]).then(entryTypeAnswer => { // Ask different questions for entry points - entryQuestions(self, entryTypeAnswer).then(entryOptions => { - this.configuration.config.webpackOptions.entry = entryOptions; - oneOrMoreEntries = Object.keys(entryOptions); - }).then(() => { - this.prompt([ - Input( - "outputType", - "Which folder will your generated bundles be in? [default: dist]:" - ) - ]).then(outputTypeAnswer => { - if (!this.configuration.config.webpackOptions.entry.length) { - this.configuration.config.topScope.push(tooltip.commonsChunk()); - this.configuration.config.webpackOptions.output = { - filename: "'[name].[chunkhash].js'", - chunkFilename: "'[name].[chunkhash].js'" - }; - } else { - this.configuration.config.webpackOptions.output = { - filename: "'[name].bundle.js'", - }; - } - if (outputTypeAnswer["outputType"].length) { - outputPath = outputTypeAnswer["outputType"]; - } - this.configuration.config.webpackOptions.output.path = `path.resolve(__dirname, '${outputPath}')`; - }).then(() => { + entryQuestions(self, entryTypeAnswer) + .then(entryOptions => { + this.configuration.config.webpackOptions.entry = entryOptions; + oneOrMoreEntries = Object.keys(entryOptions); + }) + .then(() => { this.prompt([ - Confirm("prodConfirm", "Are you going to use this in production?") - ]).then(prodAnswer => { - if (prodAnswer["prodConfirm"] === true) { - this.isProd = true; - } else { - this.isProd = false; - } - }).then(() => { - this.prompt([ - Confirm("babelConfirm", "Will you be using ES2015?") - ]).then(ans => { - if (ans["babelConfirm"] === true) { - this.configuration.config.webpackOptions.module.rules.push(getBabelPlugin()); - this.npmInstalls.push("babel-loader", "babel-core", "babel-preset-es2015"); + Input( + "outputType", + "Which folder will your generated bundles be in? [default: dist]:" + ) + ]) + .then(outputTypeAnswer => { + if (!this.configuration.config.webpackOptions.entry.length) { + this.configuration.config.topScope.push(tooltip.commonsChunk()); + this.configuration.config.webpackOptions.output = { + filename: "'[name].[chunkhash].js'", + chunkFilename: "'[name].[chunkhash].js'" + }; + } else { + this.configuration.config.webpackOptions.output = { + filename: "'[name].bundle.js'" + }; } - }).then(() => { + if (outputTypeAnswer["outputType"].length) { + outputPath = outputTypeAnswer["outputType"]; + } + this.configuration.config.webpackOptions.output.path = `path.resolve(__dirname, '${outputPath}')`; + }) + .then(() => { this.prompt([ - RawList( - "stylingType", - "Will you use one of the below CSS solutions?", - ["SASS", "LESS", "CSS", "PostCSS", "No"] + Confirm( + "prodConfirm", + "Are you going to use this in production?" ) - ]).then(stylingAnswer => { - if (!this.isProd) { - ExtractUseProps = []; - } - switch (stylingAnswer["stylingType"]) { - case "SASS": - this.npmInstalls.push( - "sass-loader", "node-sass", - "style-loader", "css-loader" - ); - regExpForStyles = new RegExp(/\.(scss|css)$/); - if (this.isProd) { - ExtractUseProps = `use: [{ + ]) + .then(prodAnswer => { + if (prodAnswer["prodConfirm"] === true) { + this.isProd = true; + } else { + this.isProd = false; + } + }) + .then(() => { + this.prompt([ + Confirm("babelConfirm", "Will you be using ES2015?") + ]) + .then(ans => { + if (ans["babelConfirm"] === true) { + this.configuration.config.webpackOptions.module.rules.push( + getBabelPlugin() + ); + this.npmInstalls.push( + "babel-loader", + "babel-core", + "babel-preset-es2015" + ); + } + }) + .then(() => { + this.prompt([ + RawList( + "stylingType", + "Will you use one of the below CSS solutions?", + ["SASS", "LESS", "CSS", "PostCSS", "No"] + ) + ]) + .then(stylingAnswer => { + if (!this.isProd) { + ExtractUseProps = []; + } + switch (stylingAnswer["stylingType"]) { + case "SASS": + this.npmInstalls.push( + "sass-loader", + "node-sass", + "style-loader", + "css-loader" + ); + regExpForStyles = new RegExp(/\.(scss|css)$/); + if (this.isProd) { + ExtractUseProps = `use: [{ loader: "css-loader", options: { sourceMap: true @@ -127,24 +150,30 @@ module.exports = class WebpackGenerator extends Generator { } }], fallback: "style-loader"`; - } else { - ExtractUseProps.push({ - loader: "'style-loader'" - }, { - loader: "'css-loader'" - }, { - loader: "'sass-loader'" - }); - } - break; - case "LESS": - regExpForStyles = new RegExp(/\.(less|css)$/); - this.npmInstalls.push( - "less-loader", "less", - "style-loader", "css-loader" - ); - if (this.isProd) { - ExtractUseProps = ` + } else { + ExtractUseProps.push( + { + loader: "'style-loader'" + }, + { + loader: "'css-loader'" + }, + { + loader: "'sass-loader'" + } + ); + } + break; + case "LESS": + regExpForStyles = new RegExp(/\.(less|css)$/); + this.npmInstalls.push( + "less-loader", + "less", + "style-loader", + "css-loader" + ); + if (this.isProd) { + ExtractUseProps = ` use: [{ loader: "css-loader", options: { @@ -157,35 +186,40 @@ module.exports = class WebpackGenerator extends Generator { } }], fallback: "style-loader"`; - } else { - ExtractUseProps.push({ - loader: "'css-loader'", - options: { - sourceMap: true - } - }, { - loader: "'less-loader'", - options: { - sourceMap: true - } - }); - } - break; - case "PostCSS": - this.configuration.config.topScope.push( - tooltip.postcss(), - "const autoprefixer = require('autoprefixer');", - "const precss = require('precss');", - "\n" - ); - this.npmInstalls.push( - "style-loader", "css-loader", - "postcss-loader", "precss", - "autoprefixer" - ); - regExpForStyles = new RegExp(/\.css$/); - if (this.isProd) { - ExtractUseProps = ` + } else { + ExtractUseProps.push( + { + loader: "'css-loader'", + options: { + sourceMap: true + } + }, + { + loader: "'less-loader'", + options: { + sourceMap: true + } + } + ); + } + break; + case "PostCSS": + this.configuration.config.topScope.push( + tooltip.postcss(), + "const autoprefixer = require('autoprefixer');", + "const precss = require('precss');", + "\n" + ); + this.npmInstalls.push( + "style-loader", + "css-loader", + "postcss-loader", + "precss", + "autoprefixer" + ); + regExpForStyles = new RegExp(/\.css$/); + if (this.isProd) { + ExtractUseProps = ` use: [{ loader: "style-loader" },{ @@ -206,133 +240,157 @@ module.exports = class WebpackGenerator extends Generator { } }], fallback: "style-loader"`; - } else { - ExtractUseProps.push({ - loader: "'style-loader'" - },{ - loader: "'css-loader'", - options: { - sourceMap: true, - importLoaders: 1 - } - }, { - loader: "'postcss-loader'", - options: { - plugins: `function () { + } else { + ExtractUseProps.push( + { + loader: "'style-loader'" + }, + { + loader: "'css-loader'", + options: { + sourceMap: true, + importLoaders: 1 + } + }, + { + loader: "'postcss-loader'", + options: { + plugins: `function () { return [ precss, autoprefixer ]; }` - } - }); - } - break; - case "CSS": - this.npmInstalls.push("style-loader", "css-loader"); - regExpForStyles = new RegExp(/\.css$/); - if (this.isProd) { - ExtractUseProps = `use: [{ + } + } + ); + } + break; + case "CSS": + this.npmInstalls.push( + "style-loader", + "css-loader" + ); + regExpForStyles = new RegExp(/\.css$/); + if (this.isProd) { + ExtractUseProps = `use: [{ loader: "css-loader", options: { sourceMap: true } }], fallback: "style-loader"`; - } else { - ExtractUseProps.push({ - loader: "'style-loader'", - options: { - sourceMap: true - } - }, { - loader: "'css-loader'", - }); - } - break; - default: - regExpForStyles = null; - } - }).then(() => { - // Ask if the user wants to use extractPlugin - this.prompt([ - Input( - "extractPlugin", - "If you want to bundle your CSS files, what will you name the bundle? (press enter to skip)" - ) - ]).then(extractAnswer => { - if (regExpForStyles) { - if (this.isProd) { - - this.configuration.config.topScope.push(tooltip.cssPlugin()); - this.npmInstalls.push("extract-text-webpack-plugin"); - if (extractAnswer["extractPlugin"].length !== 0) { - this.configuration.config.webpackOptions.plugins.push( - "new ExtractTextPlugin('" + - extractAnswer["extractPlugin"] + - ".[contentHash].css')" - ); - } else { - this.configuration.config.webpackOptions.plugins.push( - "new ExtractTextPlugin('" + - "style.css')" - ); - } - const moduleRulesObj = { - test: regExpForStyles, - use: `ExtractTextPlugin.extract({ + } else { + ExtractUseProps.push( + { + loader: "'style-loader'", + options: { + sourceMap: true + } + }, + { + loader: "'css-loader'" + } + ); + } + break; + default: + regExpForStyles = null; + } + }) + .then(() => { + // Ask if the user wants to use extractPlugin + this.prompt([ + Input( + "extractPlugin", + "If you want to bundle your CSS files, what will you name the bundle? (press enter to skip)" + ) + ]) + .then(extractAnswer => { + if (regExpForStyles) { + if (this.isProd) { + this.configuration.config.topScope.push( + tooltip.cssPlugin() + ); + this.npmInstalls.push( + "extract-text-webpack-plugin" + ); + if ( + extractAnswer["extractPlugin"].length !== 0 + ) { + this.configuration.config.webpackOptions.plugins.push( + "new ExtractTextPlugin('" + + extractAnswer["extractPlugin"] + + ".[contentHash].css')" + ); + } else { + this.configuration.config.webpackOptions.plugins.push( + "new ExtractTextPlugin('" + "style.css')" + ); + } + const moduleRulesObj = { + test: regExpForStyles, + use: `ExtractTextPlugin.extract({ ${ExtractUseProps} })` - }; - this.configuration.config.webpackOptions.module.rules.push( - moduleRulesObj - ); - this.configuration.config.topScope.push( - "const ExtractTextPlugin = require('extract-text-webpack-plugin');", - "\n" - ); - } else { - const moduleRulesObj = { - test: regExpForStyles, - use: ExtractUseProps - }; - this.configuration.config.webpackOptions.module.rules.push( - moduleRulesObj - ); - } - } - }).then(() => { - if (!this.configuration.config.webpackOptions.entry.length) { - oneOrMoreEntries.forEach(prop => { - this.configuration.config.webpackOptions.plugins.push( - createCommonsChunkPlugin(prop) - ); + }; + this.configuration.config.webpackOptions.module.rules.push( + moduleRulesObj + ); + this.configuration.config.topScope.push( + "const ExtractTextPlugin = require('extract-text-webpack-plugin');", + "\n" + ); + } else { + const moduleRulesObj = { + test: regExpForStyles, + use: ExtractUseProps + }; + this.configuration.config.webpackOptions.module.rules.push( + moduleRulesObj + ); + } + } + }) + .then(() => { + if ( + !this.configuration.config.webpackOptions.entry + .length + ) { + oneOrMoreEntries.forEach(prop => { + this.configuration.config.webpackOptions.plugins.push( + createCommonsChunkPlugin(prop) + ); + }); + } + done(); + }); + }); }); - } - done(); }); - }); }); - }); }); - }); }); } installPlugins() { let asyncNamePrompt = this.async(); let defaultName = this.isProd ? "prod" : "config"; this.prompt([ - Input("nameType", `Name your 'webpack.[name].js?' [default: '${defaultName}']:`) - ]).then(nameAnswer => { - if (nameAnswer["nameType"].length) { - this.configuration.config.configName = nameAnswer["nameType"]; - } else { - this.configuration.config.configName = defaultName; - } - }).then(() => { - asyncNamePrompt(); - this.npmInstall(this.npmInstalls, { "save-dev": true }); - }); + Input( + "nameType", + `Name your 'webpack.[name].js?' [default: '${defaultName}']:` + ) + ]) + .then(nameAnswer => { + if (nameAnswer["nameType"].length) { + this.configuration.config.configName = nameAnswer["nameType"]; + } else { + this.configuration.config.configName = defaultName; + } + }) + .then(() => { + asyncNamePrompt(); + this.npmInstall(this.npmInstalls, { "save-dev": true }); + }); } - }; diff --git a/lib/transformations/bannerPlugin/bannerPlugin.js b/lib/transformations/bannerPlugin/bannerPlugin.js index 2e04fa6c002..0a13a818ac1 100644 --- a/lib/transformations/bannerPlugin/bannerPlugin.js +++ b/lib/transformations/bannerPlugin/bannerPlugin.js @@ -1,15 +1,12 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - INewExpression, - IPath -} from "../../types"; +import type { Ijscodeshit, INewExpression, IPath } from "../../types"; const utils = require("../utils"); module.exports = function(j: Ijscodeshit, ast: IPath<*>) { - return utils.findPluginsByName(j, ast, ["webpack.BannerPlugin"]) + return utils + .findPluginsByName(j, ast, ["webpack.BannerPlugin"]) .forEach((path: IPath) => { const args: any[] = path.value.arguments; // any node // If the first argument is a literal replace it with object notation @@ -17,9 +14,14 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { if (args && args.length > 1 && args[0].type === j.Literal.name) { // and remove the first argument path.value.arguments = [path.value.arguments[1]]; - utils.createOrUpdatePluginByName(j, path.parent, "webpack.BannerPlugin", { - banner: args[0].value - }); + utils.createOrUpdatePluginByName( + j, + path.parent, + "webpack.BannerPlugin", + { + banner: args[0].value + } + ); } }); }; diff --git a/lib/transformations/extractTextPlugin/extractTextPlugin.js b/lib/transformations/extractTextPlugin/extractTextPlugin.js index 97ce0ad07dc..622d02e4d25 100644 --- a/lib/transformations/extractTextPlugin/extractTextPlugin.js +++ b/lib/transformations/extractTextPlugin/extractTextPlugin.js @@ -11,11 +11,17 @@ import type { const utils = require("../utils"); -function findInvocation(j: Ijscodeshit, node: IPath, pluginName: string): boolean { +function findInvocation( + j: Ijscodeshit, + node: IPath, + pluginName: string +): boolean { let found: boolean = false; - found = j(node) - .find(j.MemberExpression) - .filter(p => p.get("object").value.name === pluginName).size() > 0; + found = + j(node) + .find(j.MemberExpression) + .filter(p => p.get("object").value.name === pluginName) + .size() > 0; return found; } @@ -25,7 +31,9 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { // if(args.length === 1) { // return p; // } else - const literalArgs: IPath[] = args.filter(p => utils.isType(p, "Literal")); + const literalArgs: IPath[] = args.filter(p => + utils.isType(p, "Literal") + ); if (literalArgs && literalArgs.length > 1) { const newArgs: IObjectExpression = j.objectExpression( literalArgs.map((p: IPath, index: number) => @@ -36,10 +44,15 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { } return p; }; - const name: ?string = utils.findVariableToPlugin(j, ast, "extract-text-webpack-plugin"); + const name: ?string = utils.findVariableToPlugin( + j, + ast, + "extract-text-webpack-plugin" + ); if (!name) return ast; - return ast.find(j.CallExpression) + return ast + .find(j.CallExpression) .filter((p: IPath) => findInvocation(j, p, name)) .forEach(changeArguments); }; diff --git a/lib/transformations/index.js b/lib/transformations/index.js index 74e9c25db6d..dd202a62f92 100644 --- a/lib/transformations/index.js +++ b/lib/transformations/index.js @@ -1,8 +1,6 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - IPath -} from "../types"; +import type { IPath } from "../types"; const jscodeshift = require("jscodeshift"); const pEachSeries = require("p-each-series"); @@ -29,11 +27,16 @@ const transformsObject = { }; const transformations = Object.keys(transformsObject).reduce((res, key) => { - res[key] = (ast, source) => transformSingleAST(ast, source, transformsObject[key]); + res[key] = (ast, source) => + transformSingleAST(ast, source, transformsObject[key]); return res; }, {}); -function transformSingleAST(ast: IPath<*>, source: string, transformFunction: Function): IPath<*> { +function transformSingleAST( + ast: IPath<*>, + source: string, + transformFunction: Function +): IPath<*> { return new PLazy((resolve, reject) => { setTimeout(() => { try { @@ -56,12 +59,20 @@ function transformSingleAST(ast: IPath<*>, source: string, transformFunction: Fu * @param { Object } options - Reacst formatting options * @returns { String } Transformed source code * */ -function transform(source: string, transforms: Function[], options: Object): string { +function transform( + source: string, + transforms: Function[], + options: Object +): string { const ast: IPath<*> = jscodeshift(source); - const recastOptions = Object.assign({ - quote: "single" - }, options); - transforms = transforms || Object.keys(transformations).map(k => transformations[k]); + const recastOptions = Object.assign( + { + quote: "single" + }, + options + ); + transforms = + transforms || Object.keys(transformations).map(k => transformations[k]); return pEachSeries(transforms, f => f(ast, source)) .then(() => { return ast.toSource(recastOptions); diff --git a/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js b/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js index 35e3a2afd6e..f661c352bb3 100644 --- a/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js +++ b/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js @@ -1,14 +1,11 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - IPath, - IArrayExpression -} from "../../types"; +import type { Ijscodeshit, IPath, IArrayExpression } from "../../types"; const isEmpty = require("lodash/isEmpty"); const findPluginsByName = require("../utils").findPluginsByName; -const createOrUpdatePluginByName = require("../utils").createOrUpdatePluginByName; +const createOrUpdatePluginByName = require("../utils") + .createOrUpdatePluginByName; const safeTraverse = require("../utils").safeTraverse; module.exports = function(j: Ijscodeshit, ast: IPath<*>) { @@ -28,9 +25,17 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { return ast .find(j.ArrayExpression) - .filter((path: IPath<*>) => safeTraverse(path, ["parent", "value", "key", "name"]) === "plugins") + .filter( + (path: IPath<*>) => + safeTraverse(path, ["parent", "value", "key", "name"]) === "plugins" + ) .forEach((path: IPath) => { !isEmpty(loaderOptions) && - createOrUpdatePluginByName(j, path, "webpack.LoaderOptionsPlugin", loaderOptions); + createOrUpdatePluginByName( + j, + path, + "webpack.LoaderOptionsPlugin", + loaderOptions + ); }); }; diff --git a/lib/transformations/loaders/loaders.js b/lib/transformations/loaders/loaders.js index 635620cfd4a..48509dcc653 100644 --- a/lib/transformations/loaders/loaders.js +++ b/lib/transformations/loaders/loaders.js @@ -51,10 +51,14 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {Node} path Must be an ObjectExpression * @return {Node} [] */ - const createArrayExpressionFromArray = function(path: IPath): IPath<*> { + const createArrayExpressionFromArray = function( + path: IPath + ): IPath<*> { const value: IObjectExpression = path.value; // Find paths with `loaders` keys in the given Object - const paths = value.properties.filter((prop: IProperty<*>) => prop.key.name.startsWith("loader")); + const paths = value.properties.filter((prop: IProperty<*>) => + prop.key.name.startsWith("loader") + ); // For each pair of key and value paths.forEach((pair: IProperty<*>) => { // Replace 'loaders' Identifier with 'use' @@ -76,28 +80,30 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { return arrElement; }) ); - // If the value is String of loaders like 'style!css' + // If the value is String of loaders like 'style!css' } else if (pair.value.type === j.Literal.name) { // Replace it with Array expression of loaders const literalValue: ILiteral = pair.value; pair.value = j.arrayExpression( - literalValue.value - .split("!") - .map(loader => { - return j.objectExpression([ - utils.createProperty(j, "loader", loader) - ]); - }) + literalValue.value.split("!").map(loader => { + return j.objectExpression([ + utils.createProperty(j, "loader", loader) + ]); + }) ); } }); return path; }; - const createLoaderWithQuery = (p: IPath): IObjectExpression => { + const createLoaderWithQuery = ( + p: IPath + ): IObjectExpression => { let properties = p.value.properties; - let loaderValue = properties - .reduce((val, prop) => prop.key.name === "loader" ? prop.value.value : val, ""); + let loaderValue = properties.reduce( + (val, prop) => (prop.key.name === "loader" ? prop.value.value : val), + "" + ); let loader = loaderValue.split("?")[0]; let query = loaderValue.split("?")[1]; let options: Object[] = query.split("&").map(option => { @@ -107,17 +113,22 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { return j.objectProperty(j.identifier(key), utils.createLiteral(j, val)); }); let loaderProp: IProperty<*> = utils.createProperty(j, "loader", loader); - let queryProp: IProperty = j.property("init", j.identifier("options"), j.objectExpression(options)); + let queryProp: IProperty = j.property( + "init", + j.identifier("options"), + j.objectExpression(options) + ); return j.objectExpression([loaderProp, queryProp]); }; const findLoaderWithQueryString = (p: IPath): boolean => { - return p.value.properties - .reduce((predicate, prop) => { - return utils.safeTraverse(prop, ["value", "value", "indexOf"]) - && prop.value.value.indexOf("?") > -1 - || predicate; - }, false); + return p.value.properties.reduce((predicate, prop) => { + return ( + (utils.safeTraverse(prop, ["value", "value", "indexOf"]) && + prop.value.value.indexOf("?") > -1) || + predicate + ); + }, false); }; /** @@ -127,8 +138,16 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {Node} path [description] * @return {Node} [description] */ - const checkForLoader = path => path.value.name === "loaders" && - utils.safeTraverse(path, ["parent", "parent", "parent", "node", "key", "name"]) === "module"; + const checkForLoader = path => + path.value.name === "loaders" && + utils.safeTraverse(path, [ + "parent", + "parent", + "parent", + "node", + "key", + "name" + ]) === "module"; /** * Puts node path that is pre- or postLoader into `enforce` key @@ -136,7 +155,9 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {Node} p [] * @returns {*} [] */ - const fitIntoLoaders = (p: IPath): IPath => { + const fitIntoLoaders = ( + p: IPath + ): IPath => { let loaders; p.value.properties.map(prop => { const keyName = prop.key.name; @@ -159,7 +180,9 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { } }); if (loaders) { - p.value.properties = p.value.properties.filter(prop => prop.key.name === "loaders"); + p.value.properties = p.value.properties.filter( + prop => prop.key.name === "loaders" + ); } return p; }; @@ -170,10 +193,11 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {[type]} IPath [description] * @return {[type]} [description] */ - const prepostLoaders = (): IPath => ast - .find(j.ObjectExpression) - .filter(p => utils.findObjWithOneOfKeys(p, ["preLoaders", "postLoaders"])) - .forEach(fitIntoLoaders); + const prepostLoaders = (): IPath => + ast + .find(j.ObjectExpression) + .filter(p => utils.findObjWithOneOfKeys(p, ["preLoaders", "postLoaders"])) + .forEach(fitIntoLoaders); /** * Convert top level `loaders` to `rules` @@ -181,22 +205,32 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @param {[type]} IPath [description] * @return {[type]} [description] */ - const loadersToRules = (): IPath => ast - .find(j.Identifier) - .filter(checkForLoader) - .forEach((p: IPath) => p.value.name = "rules"); + const loadersToRules = (): IPath => + ast + .find(j.Identifier) + .filter(checkForLoader) + .forEach((p: IPath) => (p.value.name = "rules")); /** * Converts 'loader' and 'loaders' to Array of {Rule.Use} * * @returns {Node} [] */ - const loadersToArrayExpression = (): IPath => ast - .find(j.ObjectExpression) - .filter(path => utils.findObjWithOneOfKeys(path, ["loader", "loaders"])) - .filter(path => utils.safeTraverse( - path, ["parent", "parent", "node", "key", "name"]) === "rules") - .forEach(createArrayExpressionFromArray); + const loadersToArrayExpression = (): IPath => + ast + .find(j.ObjectExpression) + .filter(path => utils.findObjWithOneOfKeys(path, ["loader", "loaders"])) + .filter( + path => + utils.safeTraverse(path, [ + "parent", + "parent", + "node", + "key", + "name" + ]) === "rules" + ) + .forEach(createArrayExpressionFromArray); /** * Finds loaders with options encoded as query string and replaces it with options obejct @@ -220,11 +254,12 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * @type {[type]} * @returns {Node} [] */ - const loaderWithQueryParam = (): IPath => ast - .find(j.ObjectExpression) - .filter(p => utils.findObjWithOneOfKeys(p, ["loader"])) - .filter(findLoaderWithQueryString) - .replaceWith(createLoaderWithQuery); + const loaderWithQueryParam = (): IPath => + ast + .find(j.ObjectExpression) + .filter(p => utils.findObjWithOneOfKeys(p, ["loader"])) + .filter(findLoaderWithQueryString) + .replaceWith(createLoaderWithQuery); /** * Finds nodes with `query` key and replaces it with `options` @@ -241,23 +276,25 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { * } * @returns {Node} [] */ - const loaderWithQueryProp = (): IPath => ast - .find(j.Identifier) - .filter(p => p.value.name === "query") - .replaceWith(j.identifier("options")); + const loaderWithQueryProp = (): IPath => + ast + .find(j.Identifier) + .filter(p => p.value.name === "query") + .replaceWith(j.identifier("options")); /** * Adds required `-loader` suffix to loader with missing suffix * i.e. for `babel` it should generate `babel-loader` * @returns {Node} [] */ - const addLoaderSuffix = (): IPath => ast - .find(j.ObjectExpression) - .forEach(path => { + const addLoaderSuffix = (): IPath => + ast.find(j.ObjectExpression).forEach(path => { path.value.properties.forEach(prop => { - if (prop.key.name === "loader" - && utils.safeTraverse(prop, ["value", "value"]) - && !prop.value.value.endsWith("-loader")) { + if ( + prop.key.name === "loader" && + utils.safeTraverse(prop, ["value", "value"]) && + !prop.value.value.endsWith("-loader") + ) { prop.value = j.literal(prop.value.value + "-loader"); } }); diff --git a/lib/transformations/outputPath/outputPath.js b/lib/transformations/outputPath/outputPath.js index f5a95cb023d..3cd5b1a928a 100644 --- a/lib/transformations/outputPath/outputPath.js +++ b/lib/transformations/outputPath/outputPath.js @@ -1,31 +1,41 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - ICallExpression, - IPath -} from "../../types"; +import type { Ijscodeshit, ICallExpression, IPath } from "../../types"; const utils = require("../utils"); module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { const literalOutputPath = ast .find(j.ObjectExpression) - .filter((p: IPath<*>) => utils.safeTraverse(p, ["parentPath", "value", "key", "name"]) === "output") + .filter( + (p: IPath<*>) => + utils.safeTraverse(p, ["parentPath", "value", "key", "name"]) === + "output" + ) .find(j.Property) - .filter((p: IPath<*>) => utils.safeTraverse(p, ["value", "key", "name"]) === "path" - && utils.safeTraverse(p, ["value", "value", "type"]) === "Literal"); + .filter( + (p: IPath<*>) => + utils.safeTraverse(p, ["value", "key", "name"]) === "path" && + utils.safeTraverse(p, ["value", "value", "type"]) === "Literal" + ); if (literalOutputPath) { let pathVarName: ?string = "path"; let isPathPresent: boolean = false; const pathDecalaration = ast .find(j.VariableDeclarator) - .filter((p: IPath<*>) => utils.safeTraverse(p, ["value", "init", "callee", "name"]) === "require") - .filter((p: IPath<*>) => utils.safeTraverse(p, ["value", "init", "arguments"]) - && p.value.init.arguments.reduce((isPresent, a) => { - return a.type === "Literal" && a.value === "path" || isPresent; - }, false)); + .filter( + (p: IPath<*>) => + utils.safeTraverse(p, ["value", "init", "callee", "name"]) === + "require" + ) + .filter( + (p: IPath<*>) => + utils.safeTraverse(p, ["value", "init", "arguments"]) && + p.value.init.arguments.reduce((isPresent, a) => { + return (a.type === "Literal" && a.value === "path") || isPresent; + }, false) + ); if (pathDecalaration) { isPathPresent = true; @@ -40,19 +50,24 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>): IPath<*> { if (!isPathPresent) { const pathRequire: string = (utils.getRequire(j, "path", "path"): any); - return ast.find(j.Program) - .replaceWith(p => j.program([].concat(pathRequire).concat(p.value.body))); + return ast + .find(j.Program) + .replaceWith(p => + j.program([].concat(pathRequire).concat(p.value.body)) + ); } } return ast; }; -function replaceWithPath(j: Ijscodeshit, p: IPath<*>, pathVarName: string): IPath { +function replaceWithPath( + j: Ijscodeshit, + p: IPath<*>, + pathVarName: string +): IPath { const convertedPath = j.callExpression( - j.memberExpression( - j.identifier(pathVarName), - j.identifier("join"), - false), - [j.identifier("__dirname"), p.value]); + j.memberExpression(j.identifier(pathVarName), j.identifier("join"), false), + [j.identifier("__dirname"), p.value] + ); return convertedPath; } diff --git a/lib/transformations/removeDeprecatedPlugins/removeDeprecatedPlugins.js b/lib/transformations/removeDeprecatedPlugins/removeDeprecatedPlugins.js index 078a17e32f8..24b43447a12 100644 --- a/lib/transformations/removeDeprecatedPlugins/removeDeprecatedPlugins.js +++ b/lib/transformations/removeDeprecatedPlugins/removeDeprecatedPlugins.js @@ -1,9 +1,6 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - IPath -} from "../../types"; +import type { Ijscodeshit, IPath } from "../../types"; const codeFrame = require("babel-code-frame"); const chalk = require("chalk"); @@ -23,10 +20,14 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>, source: string) { "webpack.optimize.DedupePlugin" ]; - return utils.findPluginsByName(j, ast, deprecatedPlugingsList) + return utils + .findPluginsByName(j, ast, deprecatedPlugingsList) .forEach((path: IPath<*>) => { // For now we only support the case there plugins are defined in an Array - const arrayPath: ?IPath<*> = utils.safeTraverse(path, ["parent","value"]); + const arrayPath: ?IPath<*> = utils.safeTraverse(path, [ + "parent", + "value" + ]); if (arrayPath && utils.isType(arrayPath, "ArrayExpression")) { // Check how many plugins are defined and // if there is only last plugin left remove `plugins: []` node @@ -39,16 +40,20 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>, source: string) { } else { const startLoc = path.value.loc.start; console.log(` -${ chalk.red("Only plugins instantiated in the array can be automatically removed i.e.:") } +${chalk.red( + "Only plugins instantiated in the array can be automatically removed i.e.:" + )} -${ codeFrame(example, null, null, { highlightCode: true }) } +${codeFrame(example, null, null, { highlightCode: true })} -${ chalk.red("but you use it like this:") } +${chalk.red("but you use it like this:")} -${ codeFrame(source, startLoc.line, startLoc.column, { highlightCode: true }) } +${codeFrame(source, startLoc.line, startLoc.column, { highlightCode: true })} -${ chalk.red("Please remove deprecated plugins manually. ") } -See ${ chalk.underline("https://webpack.js.org/guides/migrating/")} for more information.`); +${chalk.red("Please remove deprecated plugins manually. ")} +See ${chalk.underline( + "https://webpack.js.org/guides/migrating/" + )} for more information.`); } }); }; diff --git a/lib/transformations/removeJsonLoader/removeJsonLoader.js b/lib/transformations/removeJsonLoader/removeJsonLoader.js index 90fb8151cc9..79914586ca7 100644 --- a/lib/transformations/removeJsonLoader/removeJsonLoader.js +++ b/lib/transformations/removeJsonLoader/removeJsonLoader.js @@ -19,7 +19,7 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { }); const loaderIndex = loaders.indexOf(name); if (loaders.length && loaderIndex > -1) { - // Remove loader from the array + // Remove loader from the array loaders.splice(loaderIndex, 1); // and from AST loadersNode.elements.splice(loaderIndex, 1); @@ -32,8 +32,8 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { break; } case j.Literal.name: { - // If only the loader with the matching name was used - // we can remove the whole Property node completely + // If only the loader with the matching name was used + // we can remove the whole Property node completely if ((loadersNode: ILiteral).value === name) { j(path.parent).remove(); } @@ -52,9 +52,7 @@ module.exports = function(j: Ijscodeshit, ast: IPath<*>) { .forEach((path: IPath<*>) => removeLoaderByName(path, "json-loader")); } - const transforms = [ - removeLoaders - ]; + const transforms = [removeLoaders]; transforms.forEach(t => t(ast)); diff --git a/lib/transformations/resolve/resolve.js b/lib/transformations/resolve/resolve.js index 2ee320ca97e..e6ec9ab915b 100644 --- a/lib/transformations/resolve/resolve.js +++ b/lib/transformations/resolve/resolve.js @@ -9,24 +9,28 @@ import type { } from "../../types"; module.exports = function transformer(j: Ijscodeshit, ast: IPath<*>) { - - const getRootVal = (p: IPath>): IProperty => { + const getRootVal = ( + p: IPath> + ): IProperty => { return p.node.value.properties.filter(prop => prop.key.name === "root")[0]; }; const getRootIndex = p => { - return p.node.value.properties - .reduce((rootIndex, prop, index) => { - return prop.key.name === "root" ? index : rootIndex; - }, -1); + return p.node.value.properties.reduce((rootIndex, prop, index) => { + return prop.key.name === "root" ? index : rootIndex; + }, -1); }; const isModulePresent = (p: IPath>) => { - const modules = p.node.value.properties.filter(prop => prop.key.name === "modules"); + const modules = p.node.value.properties.filter( + prop => prop.key.name === "modules" + ); return modules.length > 0 && modules[0]; }; - const createModuleArray = (p: IPath>): IPath> => { + const createModuleArray = ( + p: IPath> + ): IPath> => { const rootVal = getRootVal(p); let modulesVal = null; if (rootVal.value.type === "ArrayExpression") { @@ -37,7 +41,11 @@ module.exports = function transformer(j: Ijscodeshit, ast: IPath<*>) { let module = isModulePresent(p); if (!module) { - module = j.property("init", j.identifier("modules"), j.arrayExpression(modulesVal)); + module = j.property( + "init", + j.identifier("modules"), + j.arrayExpression(modulesVal) + ); p.node.value.properties = p.node.value.properties.concat([module]); } else { module.value.elements = module.value.elements.concat(modulesVal); @@ -50,10 +58,11 @@ module.exports = function transformer(j: Ijscodeshit, ast: IPath<*>) { return ast .find(j.Property) .filter((p: IPath>) => { - return p.node.key.name === "resolve" - && p.node.value.properties - .filter(prop => prop.key.name === "root") - .length === 1; + return ( + p.node.key.name === "resolve" && + p.node.value.properties.filter(prop => prop.key.name === "root") + .length === 1 + ); }) .forEach(createModuleArray); }; diff --git a/lib/transformations/uglifyJsPlugin/uglifyJsPlugin.js b/lib/transformations/uglifyJsPlugin/uglifyJsPlugin.js index adf5f8e0aed..cf0acdd6b1f 100644 --- a/lib/transformations/uglifyJsPlugin/uglifyJsPlugin.js +++ b/lib/transformations/uglifyJsPlugin/uglifyJsPlugin.js @@ -1,32 +1,28 @@ // @flow // eslint-disable-next-line node/no-unsupported-features -import type { - Ijscodeshit, - IPath -} from "../../types"; +import type { Ijscodeshit, IPath } from "../../types"; const findPluginsByName = require("../utils").findPluginsByName; module.exports = function(j: Ijscodeshit, ast: IPath<*>) { - function createSourceMapsProperty() { return j.property("init", j.identifier("sourceMap"), j.identifier("true")); } - return findPluginsByName(j, ast, ["webpack.optimize.UglifyJsPlugin"]) - .forEach(path => { - const args = path.value.arguments; + return findPluginsByName(j, ast, [ + "webpack.optimize.UglifyJsPlugin" + ]).forEach(path => { + const args = path.value.arguments; - if (args.length) { - // Plugin is called with object as arguments - j(path) - .find(j.ObjectExpression) - .get("properties") - .value - .push(createSourceMapsProperty()); - } else { - // Plugin is called without arguments - args.push(j.objectExpression([createSourceMapsProperty()])); - } - }); + if (args.length) { + // Plugin is called with object as arguments + j(path) + .find(j.ObjectExpression) + .get("properties") + .value.push(createSourceMapsProperty()); + } else { + // Plugin is called without arguments + args.push(j.objectExpression([createSourceMapsProperty()])); + } + }); }; diff --git a/lib/transformations/utils.js b/lib/transformations/utils.js index 35c8651a41c..d9d46240f50 100644 --- a/lib/transformations/utils.js +++ b/lib/transformations/utils.js @@ -28,7 +28,9 @@ function safeTraverse(obj: Object, paths: string[]): ?any { // Convert nested MemberExpressions to strings like webpack.optimize.DedupePlugin function memberExpressionToPathString(path: Object): string { if (path && path.object) { - return [memberExpressionToPathString(path.object), path.property.name].join("."); + return [memberExpressionToPathString(path.object), path.property.name].join( + "." + ); } return path.name; } @@ -59,14 +61,17 @@ function pathsToMemberExpression(j: Ijscodeshit, paths: string[]) { * @param { Array } pluginNamesArray - Array of plugin names like `webpack.LoaderOptionsPlugin` * @returns Path * */ -function findPluginsByName(j: Ijscodeshit, node: IPath<*>, pluginNamesArray: string[]): IPath<*> { - return node - .find(j.NewExpression) - .filter(path => { - return pluginNamesArray.some( - plugin => memberExpressionToPathString(path.get("callee").value) === plugin - ); - }); +function findPluginsByName( + j: Ijscodeshit, + node: IPath<*>, + pluginNamesArray: string[] +): IPath<*> { + return node.find(j.NewExpression).filter(path => { + return pluginNamesArray.some( + plugin => + memberExpressionToPathString(path.get("callee").value) === plugin + ); + }); } /* @@ -78,7 +83,10 @@ function findPluginsByName(j: Ijscodeshit, node: IPath<*>, pluginNamesArray: str * @param { Node } node - Node to start search from * @returns Path * */ -function findPluginsRootNodes(j: Ijscodeshit, node: IPath<*>): IPath> { +function findPluginsRootNodes( + j: Ijscodeshit, + node: IPath<*> +): IPath> { return node.find(j.Property, { key: { name: "plugins" } }); } @@ -92,7 +100,11 @@ function findPluginsRootNodes(j: Ijscodeshit, node: IPath<*>): IPath { +function createProperty( + j: Ijscodeshit, + key: string | number, + value: any +): IProperty<*> { return j.property( "init", createIdentifierOrLiteral(j, key), @@ -110,7 +122,10 @@ function createProperty(j: Ijscodeshit, key: string | number, value: any): IProp * @returns { Node } * */ -function createLiteral(j: Ijscodeshit, val: string | boolean | number): IPath { +function createLiteral( + j: Ijscodeshit, + val: string | boolean | number +): IPath { let literalVal: any = val; // We'll need String to native type conversions if (typeof val === "string") { @@ -134,7 +149,8 @@ function createLiteral(j: Ijscodeshit, val: string | boolean | number): IPath | IPath doesn't work, find another way +function createIdentifierOrLiteral(j: Ijscodeshit, val: any): any { + // IPath | IPath doesn't work, find another way let literalVal = val; // We'll need String to native type conversions if (typeof val === "string" || val.__paths) { @@ -176,8 +192,15 @@ function createIdentifierOrLiteral(j: Ijscodeshit, val: any): any { // IPath, pluginName: string, options: any) { - const pluginInstancePath = findPluginsByName(j, j(rootNodePath), [pluginName]); +function createOrUpdatePluginByName( + j: Ijscodeshit, + rootNodePath: IPath<*>, + pluginName: string, + options: any +) { + const pluginInstancePath = findPluginsByName(j, j(rootNodePath), [ + pluginName + ]); let optionsProps; if (options) { optionsProps = Object.keys(options).map(key => { @@ -214,12 +237,9 @@ function createOrUpdatePluginByName(j: Ijscodeshit, rootNodePath: IPath<*>, plug currentProps.value.push(opt); } }); - } else { // Plugin is called without arguments - args.push( - j.objectExpression(optionsProps) - ); + args.push(j.objectExpression(optionsProps)); } } }); @@ -247,8 +267,13 @@ function createOrUpdatePluginByName(j: Ijscodeshit, rootNodePath: IPath<*>, plug * @returns { string } variable name - ex. 'var s = require(s) gives "s"` * */ -function findVariableToPlugin(j: Ijscodeshit, rootNode: IPath<*>, pluginPackageName: string): ?string { - const moduleVarNames: IVariableDeclarator[] = rootNode.find(j.VariableDeclarator) +function findVariableToPlugin( + j: Ijscodeshit, + rootNode: IPath<*>, + pluginPackageName: string +): ?string { + const moduleVarNames: IVariableDeclarator[] = rootNode + .find(j.VariableDeclarator) .filter(j.filters.VariableDeclarator.requiresModule(pluginPackageName)) .nodes(); if (moduleVarNames.length === 0) return null; @@ -269,12 +294,10 @@ function isType(path: IPath<*>, type: string): boolean { } function findObjWithOneOfKeys(p: IPath<*>, keyNames: string[]): boolean { - return p.value.properties - .reduce((predicate, prop) => { - const name = prop.key.name; - return keyNames.indexOf(name) > -1 - || predicate; - }, false); + return p.value.properties.reduce((predicate, prop) => { + const name = prop.key.name; + return keyNames.indexOf(name) > -1 || predicate; + }, false); } /* @@ -287,14 +310,15 @@ function findObjWithOneOfKeys(p: IPath<*>, keyNames: string[]): boolean { * @returns {NodePath} - the created ast */ -function getRequire(j: Ijscodeshit, constName: string, packagePath: string): IPath { +function getRequire( + j: Ijscodeshit, + constName: string, + packagePath: string +): IPath { return j.variableDeclaration("const", [ j.variableDeclarator( j.identifier(constName), - j.callExpression( - j.identifier("require"), - [j.literal(packagePath)] - ) + j.callExpression(j.identifier("require"), [j.literal(packagePath)]) ) ]); } @@ -310,8 +334,15 @@ function getRequire(j: Ijscodeshit, constName: string, packagePath: string): IPa * @returns - nothing */ -function checkIfExistsAndAddValue(j: Ijscodeshit, node: IPath, key: string, value: string): void { - const existingProp = node.value.properties.filter(prop => prop.key.name === key); +function checkIfExistsAndAddValue( + j: Ijscodeshit, + node: IPath, + key: string, + value: string +): void { + const existingProp = node.value.properties.filter( + prop => prop.key.name === key + ); let prop; if (existingProp.length > 0) { prop = existingProp[0]; @@ -330,7 +361,10 @@ function checkIfExistsAndAddValue(j: Ijscodeshit, node: IPath * @param { String } key - st name * @returns - { Array } arr - An empty array */ -function createEmptyArrayProperty(j: Ijscodeshit, key: string): IProperty { +function createEmptyArrayProperty( + j: Ijscodeshit, + key: string +): IProperty { return j.property("init", j.identifier(key), j.arrayExpression([])); } @@ -345,21 +379,30 @@ function createEmptyArrayProperty(j: Ijscodeshit, key: string): IProperty) => { let objectOfArray = j.objectExpression([]); - if (typeof(subProperty) !== "string") { + if (typeof subProperty !== "string") { loopThroughObjects(j, objectOfArray, subProperty); arr.value.elements.push(objectOfArray); } else { - return arr.value.elements.push(createIdentifierOrLiteral(j, subProperty)); + return arr.value.elements.push( + createIdentifierOrLiteral(j, subProperty) + ); } }); } else { - Object.keys(subProps[key]).forEach((subProperty) => { - arr.value.elements.push(createIdentifierOrLiteral(j, subProps[key][subProperty])); + Object.keys(subProps[key]).forEach(subProperty => { + arr.value.elements.push( + createIdentifierOrLiteral(j, subProps[key][subProperty]) + ); }); } return arr; @@ -376,24 +419,39 @@ function createArrayWithChildren(j: Ijscodeshit, key: string, subProps: { [strin * nothing is left */ -function loopThroughObjects(j: Ijscodeshit, p: IObjectExpression, obj: Object): void { - Object.keys(obj).forEach((prop) => { +function loopThroughObjects( + j: Ijscodeshit, + p: IObjectExpression, + obj: Object +): void { + Object.keys(obj).forEach(prop => { if (prop.indexOf("inject") >= 0) { // TODO to insert the type of node, identifier or literal - const propertyExpression: IPath<*> = createIdentifierOrLiteral(j, obj[prop]); + const propertyExpression: IPath<*> = createIdentifierOrLiteral( + j, + obj[prop] + ); return p.properties.push(propertyExpression); } // eslint-disable-next-line no-irregular-whitespace - if (typeof(obj[prop]) !== "object" || obj[prop] instanceof RegExp) { - p.properties.push(createObjectWithSuppliedProperty( - j, prop, createIdentifierOrLiteral(j, obj[prop]) - )); + if (typeof obj[prop] !== "object" || obj[prop] instanceof RegExp) { + p.properties.push( + createObjectWithSuppliedProperty( + j, + prop, + createIdentifierOrLiteral(j, obj[prop]) + ) + ); } else if (Array.isArray(obj[prop])) { let arrayProp = createArrayWithChildren(j, prop, obj[prop], true); p.properties.push(arrayProp); } else { let objectBlock = j.objectExpression([]); - let propertyOfBlock = createObjectWithSuppliedProperty(j, prop, objectBlock); + let propertyOfBlock = createObjectWithSuppliedProperty( + j, + prop, + objectBlock + ); loopThroughObjects(j, objectBlock, obj[prop]); p.properties.push(propertyOfBlock); } @@ -410,7 +468,11 @@ function loopThroughObjects(j: Ijscodeshit, p: IObjectExpression, obj: Object): * @returns - { Node } - An property with the supplied property */ -function createObjectWithSuppliedProperty(j: Ijscodeshit, key: string, prop: any): IProperty<*> { +function createObjectWithSuppliedProperty( + j: Ijscodeshit, + key: string, + prop: any +): IProperty<*> { return j.property("init", j.identifier(key), prop); } @@ -439,7 +501,12 @@ function createExternalRegExp(j: Ijscodeshit, prop: any): IPath { * @returns - { Node } - Returns node the pushed property */ -function pushCreateProperty(j: Ijscodeshit, p: IPath, key: string, val: any): number { +function pushCreateProperty( + j: Ijscodeshit, + p: IPath, + key: string, + val: any +): number { let property: string | IPath | IPath; if (val.hasOwnProperty("type")) { property = val; @@ -462,32 +529,50 @@ function pushCreateProperty(j: Ijscodeshit, p: IPath, key: st *subProperty is an array, else it will invoke a function that will push a single node */ -function pushObjectKeys(j: Ijscodeshit, p: IPath<*>, webpackProperties: Object, name: string): any { - p.value.properties.filter(n => - (safeTraverse(n, ["key", "name"]) === name) - ).forEach((prop) => { - Object.keys(webpackProperties).forEach((webpackProp) => { - if (webpackProp.indexOf("inject") >= 0) { - return prop.value.properties.push(createIdentifierOrLiteral(j, webpackProperties[webpackProp])); - } else if (Array.isArray(webpackProperties[webpackProp])) { - const propArray = createArrayWithChildren( - j, webpackProp, webpackProperties[webpackProp], true - ); - return prop.value.properties.push(propArray); - } else if (typeof(webpackProperties[webpackProp]) !== "object" || webpackProperties[webpackProp].__paths || webpackProperties[webpackProp] instanceof RegExp) { - return pushCreateProperty( - j, prop, webpackProp, webpackProperties[webpackProp] - ); - } else { - pushCreateProperty( - j, prop, webpackProp, j.objectExpression([]) - ); - return pushObjectKeys( - j, prop, webpackProperties[webpackProp], webpackProp - ); - } +function pushObjectKeys( + j: Ijscodeshit, + p: IPath<*>, + webpackProperties: Object, + name: string +): any { + p.value.properties + .filter(n => safeTraverse(n, ["key", "name"]) === name) + .forEach(prop => { + Object.keys(webpackProperties).forEach(webpackProp => { + if (webpackProp.indexOf("inject") >= 0) { + return prop.value.properties.push( + createIdentifierOrLiteral(j, webpackProperties[webpackProp]) + ); + } else if (Array.isArray(webpackProperties[webpackProp])) { + const propArray = createArrayWithChildren( + j, + webpackProp, + webpackProperties[webpackProp], + true + ); + return prop.value.properties.push(propArray); + } else if ( + typeof webpackProperties[webpackProp] !== "object" || + webpackProperties[webpackProp].__paths || + webpackProperties[webpackProp] instanceof RegExp + ) { + return pushCreateProperty( + j, + prop, + webpackProp, + webpackProperties[webpackProp] + ); + } else { + pushCreateProperty(j, prop, webpackProp, j.objectExpression([])); + return pushObjectKeys( + j, + prop, + webpackProperties[webpackProp], + webpackProp + ); + } + }); }); - }); } /* @@ -505,7 +590,13 @@ function pushObjectKeys(j: Ijscodeshit, p: IPath<*>, webpackProperties: Object, * @returns - { Function } cb - Returns the callback and pushes a new node */ -function isAssignment(j: Ijscodeshit, p: IPath<*>, cb: () => void, identifier: string, property: Object): any { +function isAssignment( + j: Ijscodeshit, + p: IPath<*>, + cb: () => void, + identifier: string, + property: Object +): any { if (p.parent.value.type === "AssignmentExpression") { if (j) { return cb(j, p, identifier, property); diff --git a/lib/types.js b/lib/types.js index fc5651e22c6..b6edbcbe147 100644 --- a/lib/types.js +++ b/lib/types.js @@ -4,7 +4,7 @@ export type Ijscodeshit = { literal: (literalVal: string | boolean | number) => IPath, identifier: (literalVal: string | boolean | number) => IPath, - property: (name: string, key: any, assignee: any) => IProperty<*>, + property: (name: string, key: any, assignee: any) => IProperty<*>, memberExpression: (first: any, second: any) => any, (): IPath<*>, // (node: IPath<*>): IPath<*>, @@ -12,14 +12,23 @@ export type Ijscodeshit = { arrayExpression: () => any, program: (paths: string[]) => IPath<*>, callExpression: () => IPath, - objectProperty: (node: any, objectLiteral?: Object) => IPath, + objectProperty: ( + node: any, + objectLiteral?: Object + ) => IPath, filters: { VariableDeclarator: { requiresModule: (moduelToRequire: any) => () => void } }, - variableDeclaration: (declarationName: string, declaratino: any) => IPath, - variableDeclarator: (declarator: any, expression: any) => IPath, + variableDeclaration: ( + declarationName: string, + declaratino: any + ) => IPath, + variableDeclarator: ( + declarator: any, + expression: any + ) => IPath, newExpression: (rightExpression: any, leftExpressino: any) => IIdentifier, // primitives expressions @@ -37,7 +46,7 @@ export type Ijscodeshit = { export type Expression = { name: string -} +}; export type IPath = { value: NodeType, @@ -48,12 +57,12 @@ export type IPath = { size: () => number, filter: (callback: (node: IPath<*>) => any) => IPath<*>, forEach: (callback: (node: IPath<*>) => any | void) => IPath<*>, - replaceWith: (any) => IPath<*>, + replaceWith: any => IPath<*>, toSource: (options?: Object) => IPath<*>, get: (property: string) => any, remove: (node: any) => void, nodes: () => any[] -} +}; /** * [IAstNodeCommentLine description] * @type {Object} @@ -65,7 +74,7 @@ export type IAstNodeCommentLine = { end: number, loc: ILoc, rage: number[] -} +}; /** * [ILoc description] @@ -80,7 +89,7 @@ type ILoc = { line: number, column: number } -} +}; /** * [ITokenType description] @@ -103,7 +112,7 @@ export type ITokenType = { binop: any, updateContext: any } -} +}; export type ILiteral = { type: string, @@ -114,18 +123,18 @@ export type ILiteral = { rawValue: string, raw: string, name: string -} +}; export type INewExpression = { arguments: any[] -} +}; export type IObjectExpression = { properties: any[], type: string, range: [number, number], loc: ILoc -} +}; export type IProperty = { type: string, @@ -135,19 +144,19 @@ export type IProperty = { value: any, // any node loc: ILoc, value: NodeType -} +}; export type IIdentifier = { name: string, type: string, loc: ILoc, range: [number, number] -} +}; export type IArrayExpression = { elements: any[], // ILiteral[] | IObjectExpression[] value: any // any node -} +}; export type IMemberExpression = { type: string, @@ -156,7 +165,7 @@ export type IMemberExpression = { property: IIdentifier, range: [number, number], loc: ILoc -} +}; export type IVariableDeclaration = { declaration: IVariableDeclarator[], @@ -164,7 +173,7 @@ export type IVariableDeclaration = { kind: string, range: [number, number], loc: ILoc -} +}; export type IVariableDeclarator = { type: string, @@ -172,7 +181,7 @@ export type IVariableDeclarator = { init: any, range: [number, number], loc: ILoc -} +}; export type ICallExpression = { type: string, @@ -180,4 +189,4 @@ export type ICallExpression = { arguments?: any[], range: [number, number], loc: ILoc -} +}; diff --git a/lib/utils/npm-exists.js b/lib/utils/npm-exists.js index 22c60bc3ae9..f8a11b8d9d4 100644 --- a/lib/utils/npm-exists.js +++ b/lib/utils/npm-exists.js @@ -16,7 +16,7 @@ const constant = value => () => value; module.exports = function npmExists(moduleName) { //eslint-disable-next-line - if (moduleName.length <= 14 || moduleName.slice(0,14) !== 'webpack-addons') { + if (moduleName.length <= 14 || moduleName.slice(0, 14) !== "webpack-addons") { throw new TypeError( chalk.bold(`${moduleName} isn't a valid name.\n`) + chalk.red( diff --git a/lib/utils/resolve-packages.js b/lib/utils/resolve-packages.js index 016d6f107b8..98f8457722d 100644 --- a/lib/utils/resolve-packages.js +++ b/lib/utils/resolve-packages.js @@ -16,7 +16,8 @@ const globalPath = require("global-modules"); */ function processPromise(child) { - return new Promise(function(resolve, reject) { //eslint-disable-line + return new Promise(function(resolve, reject) { + //eslint-disable-line if (child.status !== 0) { reject(); } else { diff --git a/lib/utils/validateSchema.js b/lib/utils/validateSchema.js index 2975d93cf19..3a20782e68f 100644 --- a/lib/utils/validateSchema.js +++ b/lib/utils/validateSchema.js @@ -5,13 +5,13 @@ "use strict"; /* eslint-disable */ -const Ajv = require('ajv'); +const Ajv = require("ajv"); const ajv = new Ajv({ - errorDataPath: 'configuration', + errorDataPath: "configuration", allErrors: true, verbose: true }); -require('ajv-keywords')(ajv, ['instanceof']); +require("ajv-keywords")(ajv, ["instanceof"]); /* eslint-enable */ function validateSchema(schema, options) { diff --git a/package-lock.json b/package-lock.json index db75dc657e8..3b1a0960b2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,12 @@ "integrity": "sha1-uB3l9ydOxOdW15fNg08wNkJyTl0=", "dev": true }, + "abbrev": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", + "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=", + "dev": true + }, "acorn": { "version": "4.0.13", "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", @@ -1234,6 +1240,12 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, + "boolify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/boolify/-/boolify-1.0.1.tgz", + "integrity": "sha1-tcCeF8rNET0Rt7s+04TMASmU2Gs=", + "dev": true + }, "boom": { "version": "2.10.1", "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", @@ -1289,6 +1301,12 @@ } } }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, "browserify-aes": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.8.tgz", @@ -1407,6 +1425,25 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=" }, + "camelcase-keys": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.1.0.tgz", + "integrity": "sha1-IU00jMVFfzkxaiwxzD43JGMl5z8=", + "dev": true, + "requires": { + "camelcase": "4.1.0", + "map-obj": "2.0.0", + "quick-lru": "1.1.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } + } + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -1600,6 +1637,15 @@ "graceful-readlink": "1.0.1" } }, + "common-tags": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.4.0.tgz", + "integrity": "sha1-EYe+Tz1M8MBCfUP3Tu8fc1AWFMA=", + "dev": true, + "requires": { + "babel-runtime": "6.23.0" + } + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -2003,6 +2049,12 @@ "randombytes": "2.0.5" } }, + "dlv": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.0.tgz", + "integrity": "sha1-/uGnxD9jvnXz9nnoUmLaXxAnZKc=", + "dev": true + }, "doctrine": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", @@ -2068,14 +2120,14 @@ "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=" }, "enhanced-resolve": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.3.0.tgz", - "integrity": "sha512-2qbxE7ek3YxPJ1ML6V+satHkzHpJQKWkRHmRx6mfAoW59yP8YH8BFplbegSP+u2hBd6B6KCOpvJQ3dZAP+hkpg==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz", + "integrity": "sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24=", "requires": { "graceful-fs": "4.1.11", "memory-fs": "0.4.1", "object-assign": "4.1.1", - "tapable": "0.2.6" + "tapable": "0.2.8" } }, "errno": { @@ -2622,6 +2674,16 @@ "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.49.1.tgz", "integrity": "sha1-amqTLNagyPUXSnYSR1tLcWT18NA=" }, + "flow-remove-types": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-1.2.1.tgz", + "integrity": "sha1-WOJhv4uEK9I0yGyvuYKhITr/Dts=", + "dev": true, + "requires": { + "babylon": "6.17.4", + "vlq": "0.2.2" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -3729,6 +3791,12 @@ "lodash": "4.17.4" } }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, "growly": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", @@ -3847,6 +3915,12 @@ "sntp": "1.0.9" } }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -4063,9 +4137,9 @@ } }, "interpret": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.3.tgz", - "integrity": "sha1-y8NcYu7uc/Gat7EKgBURQBr8D5A=" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", + "integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=" }, "invariant": { "version": "2.2.2", @@ -5264,6 +5338,12 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", @@ -5590,6 +5670,92 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash.keys": "3.1.2" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true, + "requires": { + "lodash._baseassign": "3.2.0", + "lodash._basecreate": "3.0.3", + "lodash._isiterateecall": "3.0.9" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + } + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.0.tgz", + "integrity": "sha1-aYhLoUSsM/5plzemCG3v+t0PicU=", + "dev": true + }, + "lodash.unescape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", + "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=", + "dev": true + }, "log-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", @@ -5626,6 +5792,43 @@ "cli-cursor": "1.0.2" } }, + "loglevel": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.5.0.tgz", + "integrity": "sha512-OQ2jhWI5G2qsvO0UFNyCQWgKl/tFiwuPIXxELzACeUO2FqstN/R7mmL09+nhv6xOWVPPojQO1A90sCEoJSgBcQ==", + "dev": true + }, + "loglevel-colored-level-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/loglevel-colored-level-prefix/-/loglevel-colored-level-prefix-1.0.0.tgz", + "integrity": "sha1-akAhj9x64V/HbD0PPmdsRlOIYD4=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "loglevel": "1.5.0" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -5653,6 +5856,24 @@ "yallist": "2.1.2" } }, + "make-plural": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/make-plural/-/make-plural-3.0.6.tgz", + "integrity": "sha1-IDOgO6wpC487uRJY9lud9+iwHKc=", + "dev": true, + "requires": { + "minimist": "1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true, + "optional": true + } + } + }, "makeerror": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", @@ -5662,6 +5883,12 @@ "tmpl": "1.0.4" } }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, "md5.js": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", @@ -5762,6 +5989,41 @@ "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=", "dev": true }, + "messageformat": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/messageformat/-/messageformat-1.0.2.tgz", + "integrity": "sha1-kI9GkfKf8o2uNcRUNqJM/5NAI4g=", + "dev": true, + "requires": { + "glob": "7.0.6", + "make-plural": "3.0.6", + "messageformat-parser": "1.1.0", + "nopt": "3.0.6", + "reserved-words": "0.1.2" + }, + "dependencies": { + "glob": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", + "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + } + } + }, + "messageformat-parser": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/messageformat-parser/-/messageformat-parser-1.1.0.tgz", + "integrity": "sha512-Hwem6G3MsKDLS1FtBRGIs8T50P1Q00r3srS6QJePCFbad9fq0nYxwf3rnU2BreApRGhmpKMV7oZI06Sy1c9TPA==", + "dev": true + }, "micromatch": { "version": "2.3.11", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", @@ -5847,6 +6109,66 @@ "minimist": "0.0.8" } }, + "mocha": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", + "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.2.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.1", + "growl": "1.9.2", + "he": "1.1.1", + "json3": "3.3.2", + "lodash.create": "3.1.1", + "mkdirp": "0.5.1", + "supports-color": "3.1.2" + }, + "dependencies": { + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + } + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -5965,6 +6287,15 @@ } } }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1.1.0" + } + }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -6341,16 +6672,6 @@ "integrity": "sha1-WbcIwcAZCi9pLxx2GMRGsFL9F2I=", "dev": true }, - "pre-commit": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/pre-commit/-/pre-commit-1.2.2.tgz", - "integrity": "sha1-287g7p3nI15X95xW186UZBpp7sY=", - "requires": { - "cross-spawn": "5.1.0", - "spawn-sync": "1.0.15", - "which": "1.2.14" - } - }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -6372,21 +6693,71 @@ "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.6.1.tgz", "integrity": "sha512-f85qBoQiqiFM/sCmJaN4Lagj9bqMcv38vCftqp4GfVessAqq3Ns6g+3gd8UXReStLLE/DGEdwiZXoFKxphKqwg==" }, - "pretty-bytes": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", - "integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=" + "prettier-eslint": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/prettier-eslint/-/prettier-eslint-8.1.1.tgz", + "integrity": "sha512-eVvH4HQkaKfEvnXy3DizRoW8CuMSQMPFTDkWCRGBv1+XqFZc2O4cDejKPnJCAUhmaWVMLdmhweU6PwEFLM+/lA==", + "dev": true, + "requires": { + "common-tags": "1.4.0", + "dlv": "1.1.0", + "eslint": "4.6.1", + "indent-string": "3.2.0", + "lodash.merge": "4.6.0", + "loglevel-colored-level-prefix": "1.0.0", + "prettier": "1.7.0", + "pretty-format": "20.0.3", + "require-relative": "0.8.7", + "typescript": "2.5.2", + "typescript-eslint-parser": "7.0.0" + }, + "dependencies": { + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "prettier": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.7.0.tgz", + "integrity": "sha512-kIbA3UE9sYGiVCxlWg92EOHWZqte6EAkC7DS5je6NaL8g3Uw1rWe0eH+UX4Hy5OEiR9aql2vVMHeg6lR4YGxYg==", + "dev": true + } + } }, - "pretty-format": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-20.0.3.tgz", - "integrity": "sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ=", + "prettier-eslint-cli": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/prettier-eslint-cli/-/prettier-eslint-cli-4.3.2.tgz", + "integrity": "sha512-bUHRWIt8mBndrI4X/nPpd4+Ftb7LvdIfZhTIYk5b7EB8+dQDyxcJNbbxgTGo5ukAn+HqC3frFRO58Vt/XxkDrQ==", "dev": true, "requires": { - "ansi-regex": "2.1.1", - "ansi-styles": "3.2.0" + "arrify": "1.0.1", + "babel-runtime": "6.23.0", + "boolify": "1.0.1", + "camelcase-keys": "4.1.0", + "chalk": "2.1.0", + "common-tags": "1.4.0", + "eslint": "4.6.1", + "find-up": "2.1.0", + "get-stdin": "5.0.1", + "glob": "7.1.2", + "ignore": "3.3.3", + "indent-string": "3.2.0", + "lodash.memoize": "4.1.2", + "loglevel-colored-level-prefix": "1.0.0", + "messageformat": "1.0.2", + "prettier-eslint": "8.1.1", + "rxjs": "5.4.1", + "yargs": "8.0.2" }, "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", @@ -6395,31 +6766,247 @@ "requires": { "color-convert": "1.9.0" } - } - } - }, - "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" - }, - "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", - "dev": true - }, - "prr": { + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.4.0" + } + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=", + "dev": true + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "2.3.0" + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "dev": true, + "requires": { + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + } + } + } + }, + "pretty-bytes": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", + "integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=" + }, + "pretty-format": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-20.0.3.tgz", + "integrity": "sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1", + "ansi-styles": "3.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + } + } + }, + "private": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, + "prr": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz", "integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=" @@ -6467,6 +7054,12 @@ "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, "randomatic": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", @@ -6802,6 +7395,12 @@ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" }, + "require-relative": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz", + "integrity": "sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4=", + "dev": true + }, "require-uncached": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", @@ -6812,6 +7411,12 @@ "resolve-from": "1.0.1" } }, + "reserved-words": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/reserved-words/-/reserved-words-0.1.2.tgz", + "integrity": "sha1-AKCUD5jNUBrqqsMWQR2a3FKzGrE=", + "dev": true + }, "resolve": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.3.3.tgz", @@ -6820,6 +7425,21 @@ "path-parse": "1.0.5" } }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "requires": { + "resolve-from": "3.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" + } + } + }, "resolve-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.0.tgz", @@ -6990,7 +7610,7 @@ "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", "requires": { "glob": "7.1.2", - "interpret": "1.0.3", + "interpret": "1.0.4", "rechoir": "0.6.2" } }, @@ -7000,6 +7620,60 @@ "integrity": "sha1-Zq/Ue2oSky2Qccv9mKUueFzQuhQ=", "dev": true }, + "should": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/should/-/should-13.1.0.tgz", + "integrity": "sha512-Nn354G2A2lnmDsKB5rQbSjdOA6XOYcdO8XysWOY7iGJMMsuQf3vo1yHcwjjczNUQJY7sKYlY/mAc2FoZpaGvDA==", + "dev": true, + "requires": { + "should-equal": "2.0.0", + "should-format": "3.0.3", + "should-type": "1.4.0", + "should-type-adaptors": "1.0.1", + "should-util": "1.0.0" + } + }, + "should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "dev": true, + "requires": { + "should-type": "1.4.0" + } + }, + "should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=", + "dev": true, + "requires": { + "should-type": "1.4.0", + "should-type-adaptors": "1.0.1" + } + }, + "should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=", + "dev": true + }, + "should-type-adaptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.0.1.tgz", + "integrity": "sha1-7+VVPN9oz/ZuXF9RtxLcNRx3vqo=", + "dev": true, + "requires": { + "should-type": "1.4.0", + "should-util": "1.0.0" + } + }, + "should-util": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz", + "integrity": "sha1-yYzaN0qmsZDfi6h8mInCtNtiAGM=", + "dev": true + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -7363,9 +8037,9 @@ } }, "tapable": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.6.tgz", - "integrity": "sha1-IGvo4YiGC1FEJTdebxrom/sB/Y0=" + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.8.tgz", + "integrity": "sha1-mTcqXJmb8t8WCvwNdL7U9HlIzSI=" }, "temp": { "version": "0.8.3", @@ -7527,6 +8201,22 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "typescript": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.2.tgz", + "integrity": "sha1-A4qV99m7tCCxvzW6MdTFwd0//jQ=", + "dev": true + }, + "typescript-eslint-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/typescript-eslint-parser/-/typescript-eslint-parser-7.0.0.tgz", + "integrity": "sha1-vlfYdo43cHr4JeM56irxjXOTyrs=", + "dev": true, + "requires": { + "lodash.unescape": "4.0.1", + "semver": "5.3.0" + } + }, "uglify-js": { "version": "2.8.29", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", @@ -7694,6 +8384,12 @@ "vinyl": "1.2.0" } }, + "vlq": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.2.tgz", + "integrity": "sha1-4xbVJXtAuGu0PLjV/qXX9U1rDKE=", + "dev": true + }, "vm-browserify": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", @@ -7744,9 +8440,9 @@ "dev": true }, "webpack": { - "version": "3.5.6", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.5.6.tgz", - "integrity": "sha512-sXnxfx6KoZVrFAGLjdhCCwDtDwkYMfwm8mJjkQv3thr5pjTlbxopVlr/kJwc9Bz317gL+gNjvz++ir9TgG1MDg==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.6.0.tgz", + "integrity": "sha512-OsHT3D0W0KmPPh60tC7asNnOmST6bKTiR90UyEdT9QYoaJ4OYN4Gg7WK1k3VxHK07ZoiYWPsKvlS/gAjwL/vRA==", "requires": { "acorn": "5.1.2", "acorn-dynamic-import": "2.0.2", @@ -7755,7 +8451,7 @@ "async": "2.5.0", "enhanced-resolve": "3.4.1", "escope": "3.6.0", - "interpret": "1.0.3", + "interpret": "1.0.4", "json-loader": "0.5.7", "json5": "0.5.1", "loader-runner": "2.3.0", @@ -7777,6 +8473,11 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==" }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, "async": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", @@ -7785,6 +8486,33 @@ "lodash": "4.17.4" } }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, "enhanced-resolve": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz", @@ -7796,10 +8524,142 @@ "tapable": "0.2.8" } }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "2.0.0" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "requires": { + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "requires": { + "pify": "2.3.0" + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, "tapable": { "version": "0.2.8", "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.8.tgz", "integrity": "sha1-mTcqXJmb8t8WCvwNdL7U9HlIzSI=" + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "requires": { + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "requires": { + "camelcase": "4.1.0" + } } } }, @@ -7963,20 +8823,20 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" }, "yargs": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", - "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", + "integrity": "sha1-UqzCP+7Kw0BCB47njAwAf1CF20w=", "requires": { "camelcase": "4.1.0", "cliui": "3.2.0", "decamelize": "1.2.0", "get-caller-file": "1.0.2", - "os-locale": "2.0.0", + "os-locale": "2.1.0", "read-pkg-up": "2.0.0", "require-directory": "2.1.1", "require-main-filename": "1.0.1", "set-blocking": "2.0.0", - "string-width": "2.1.0", + "string-width": "2.1.1", "which-module": "2.0.0", "y18n": "3.2.1", "yargs-parser": "7.0.0" @@ -8014,22 +8874,13 @@ } } }, - "cross-spawn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", - "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", - "requires": { - "lru-cache": "4.1.1", - "which": "1.2.14" - } - }, "execa": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.5.1.tgz", - "integrity": "sha1-3j+4XLjW6RyFvLzrFkWBeFy1ezY=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "requires": { - "cross-spawn": "4.0.2", - "get-stream": "2.3.1", + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", "is-stream": "1.1.0", "npm-run-path": "2.0.2", "p-finally": "1.0.0", @@ -8045,15 +8896,6 @@ "locate-path": "2.0.0" } }, - "get-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", - "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", - "requires": { - "object-assign": "4.1.1", - "pinkie-promise": "2.0.1" - } - }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -8066,11 +8908,11 @@ } }, "os-locale": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.0.0.tgz", - "integrity": "sha1-FZGN7VEFIrge565aMJ1U9jn8OaQ=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "requires": { - "execa": "0.5.1", + "execa": "0.7.0", "lcid": "1.0.0", "mem": "1.1.0" } @@ -8103,9 +8945,9 @@ } }, "string-width": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.0.tgz", - "integrity": "sha1-AwZkVh/BRslCPsfZeP4kV0N/5tA=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "requires": { "is-fullwidth-code-point": "2.0.0", "strip-ansi": "4.0.0" @@ -8135,14 +8977,21 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "requires": { - "camelcase": "4.1.0" - } + } + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "requires": { + "camelcase": "4.1.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" } } }, diff --git a/package.json b/package.json index 9c28c1776d4..cd39df12a46 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,11 @@ }, "scripts": { "lint": "eslint \"**/*.js\"", + "format": "prettier-eslint \"bin/**/**/*.js\" --write && prettier-eslint \"lib/**/**/*.js\" --write && prettier-eslint \"test/**/**/*.js\" --write", + "test:cli": "mocha test/*.test.js --max-old-space-size=4096 --harmony --check-leaks", "lint:codeOnly": "eslint \"{lib,bin,__mocks__}/**/!(__testfixtures__)/*.js\" \"{lib,bin,__mocks__}/**.js\"", "precommit": "lint-staged", + "prepublish": "flow-remove-types lib/ -d dist/", "pretest": "npm run lint", "test": "jest --coverage" }, @@ -39,11 +42,11 @@ "chalk": "^2.0.1", "cross-spawn": "^5.1.0", "diff": "^3.3.0", - "enhanced-resolve": "^3.3.0", + "enhanced-resolve": "^3.4.1", "global-modules": "^1.0.0", "got": "^7.1.0", "inquirer": "^3.2.0", - "interpret": "^1.0.3", + "interpret": "^1.0.4", "jscodeshift": "^0.3.32", "listr": "^0.12.0", "loader-utils": "^1.1.0", @@ -53,12 +56,13 @@ "p-lazy": "^1.0.0", "prettier": "^1.5.3", "recast": "git://github.com/kalcifer/recast.git#bug/allowbreak", + "resolve-cwd": "^2.0.0", "rx": "^4.1.0", - "supports-color": "^4.2.0", - "webpack": "^3.3.0", + "supports-color": "^4.4.0", + "webpack": "^3.6.0", "webpack-addons": "1.1.2", "webpack-addons-ylvis": "0.0.34", - "yargs": "^8.0.2", + "yargs": "^9.0.1", "yeoman-environment": "^2.0.0", "yeoman-generator": "git://github.com/ev1stensberg/generator.git#Feature-getArgument" }, @@ -74,9 +78,13 @@ "eslint-plugin-flowtype": "^2.35.1", "eslint-plugin-node": "^5.1.0", "flow-bin": "^0.49.1", + "flow-remove-types": "^1.2.1", "husky": "^0.14.3", "jest": "^20.0.4", "jest-cli": "^20.0.4", - "lint-staged": "^4.1.3" + "lint-staged": "^4.1.3", + "mocha": "^3.5.3", + "prettier-eslint-cli": "^4.3.2", + "should": "^13.1.0" } } diff --git a/test/BinTestCases.test.js b/test/BinTestCases.test.js new file mode 100644 index 00000000000..5bb0bbdda8d --- /dev/null +++ b/test/BinTestCases.test.js @@ -0,0 +1,146 @@ +/* globals describe it before */ +"use strict"; + +const should = require("should"); +const path = require("path"); +const fs = require("fs"); +const spawn = require("child_process").spawn; + +function loadOptsFile(optsPath) { + // Options file parser from Mocha + // https://github.com/mochajs/mocha/blob/2bb2b9fa35818db7a02e5068364b0c417436b1af/bin/options.js#L25-L31 + return fs + .readFileSync(optsPath, "utf8") + .replace(/\\\s/g, "%20") + .split(/\s/) + .filter(Boolean) + .map(function(value) { + return value.replace(/%20/g, " "); + }); +} + +function getTestSpecificArguments(testDirectory) { + try { + return loadOptsFile(path.join(testDirectory, "test.opts")); + } catch (e) { + return null; + } +} + +function convertToArrayOfLines(outputArray) { + if (outputArray.length === 0) return outputArray; + return outputArray.join("").split("\n"); +} + +const casesPath = path.join(__dirname, "binCases"); +const defaultArgs = loadOptsFile(path.join(casesPath, "test.opts")); + +describe("BinTestCases", function() { + const categoryDirectories = fs.readdirSync(casesPath).filter(folder => { + return fs.statSync(path.join(casesPath, folder)).isDirectory(); + }); + + const categories = categoryDirectories.map(function(categoryDirectory) { + return { + name: categoryDirectory, + tests: fs.readdirSync(path.join(casesPath, categoryDirectory)) + }; + }); + + categories.forEach(function(category) { + describe(category.name, function() { + category.tests.forEach(function(testName) { + const testDirectory = path.join(casesPath, category.name, testName); + const testArgs = getTestSpecificArguments(testDirectory) || defaultArgs; + const testAssertions = require(path.join(testDirectory, "test.js")); + const outputPath = path.join( + path.resolve(casesPath, "../js/bin"), + category.name, + testName + ); + + const cmd = `${path.resolve(process.cwd(), "bin/webpack.js")}`; + const args = testArgs.concat(["--output-path", `${outputPath}`]); + const opts = { + cwd: path.resolve("./", testDirectory) + }; + const asyncExists = fs.existsSync(path.join(testDirectory, "async")); + + const env = { + stdout: [], + stderr: [], + error: [] + }; + + if (asyncExists) { + describe(testName, function() { + it("should run successfully", function(done) { + this.timeout(10000); + const child = spawn(process.execPath, [cmd].concat(args), opts); + child.on("close", function(code) { + env.code = code; + }); + + child.on("error", function(error) { + env.error.push(error); + }); + + child.stdout.on("data", data => { + env.stdout.push(data); + }); + + child.stderr.on("data", data => { + env.stderr.push(data); + }); + setTimeout(() => { + if (env.code) { + done(`Watch didn't run ${env.error}`); + } + + const stdout = convertToArrayOfLines(env.stdout); + const stderr = convertToArrayOfLines(env.stderr); + testAssertions(stdout, stderr, done); + child.kill(); + }, 3000); // wait a little to get an output + }); + }); + } else { + describe(testName, function() { + before(function(done) { + this.timeout(20000); + + const child = spawn(process.execPath, [cmd].concat(args), opts); + + child.on("close", function(code) { + env.code = code; + done(); + }); + + child.on("error", function(error) { + env.error.push(error); + }); + + child.stdout.on("data", data => { + env.stdout.push(data); + }); + + child.stderr.on("data", data => { + env.stderr.push(data); + }); + }); + + it("should not cause any errors", function() { + should(env.error).be.empty(); + }); + + it("should run successfully", function() { + const stdout = convertToArrayOfLines(env.stdout); + const stderr = convertToArrayOfLines(env.stderr); + testAssertions(env.code, stdout, stderr); + }); + }); + } + }); + }); + }); +}); diff --git a/test/binCases/config-name/found-many/index.js b/test/binCases/config-name/found-many/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/config-name/found-many/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/config-name/found-many/index2.js b/test/binCases/config-name/found-many/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/config-name/found-many/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/config-name/found-many/index3.js b/test/binCases/config-name/found-many/index3.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/config-name/found-many/test.js b/test/binCases/config-name/found-many/test.js new file mode 100644 index 00000000000..c4af6f45db6 --- /dev/null +++ b/test/binCases/config-name/found-many/test.js @@ -0,0 +1,9 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + stdout.should.be.ok(); + stdout[7].should.containEql("./index2.js"); + stdout[13].should.containEql("./index3.js"); + stderr.should.be.empty(); +}; diff --git a/test/binCases/config-name/found-many/test.opts b/test/binCases/config-name/found-many/test.opts new file mode 100644 index 00000000000..059f8c49627 --- /dev/null +++ b/test/binCases/config-name/found-many/test.opts @@ -0,0 +1,6 @@ +--config ./webpack.config.js +--config-name bar +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node + diff --git a/test/binCases/config-name/found-many/webpack.config.js b/test/binCases/config-name/found-many/webpack.config.js new file mode 100644 index 00000000000..2f6d0872765 --- /dev/null +++ b/test/binCases/config-name/found-many/webpack.config.js @@ -0,0 +1,16 @@ +var path = require("path"); + +module.exports = [ + { + name: "foo", + entry: path.resolve(__dirname, "./index") + }, + { + name: "bar", + entry: path.resolve(__dirname, "./index2") + }, + { + name: "bar", + entry: path.resolve(__dirname, "./index3.js") + } +]; diff --git a/test/binCases/config-name/found-one/index.js b/test/binCases/config-name/found-one/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/config-name/found-one/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/config-name/found-one/index2.js b/test/binCases/config-name/found-one/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/config-name/found-one/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/config-name/found-one/test.js b/test/binCases/config-name/found-one/test.js new file mode 100644 index 00000000000..373fd876c4c --- /dev/null +++ b/test/binCases/config-name/found-one/test.js @@ -0,0 +1,9 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[5].should.containEql("./index2.js"); + stderr.should.be.empty(); +}; diff --git a/test/binCases/config-name/found-one/test.opts b/test/binCases/config-name/found-one/test.opts new file mode 100644 index 00000000000..b9b00798672 --- /dev/null +++ b/test/binCases/config-name/found-one/test.opts @@ -0,0 +1,5 @@ +--config ./webpack.config.js +--config-name bar +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/config-name/found-one/webpack.config.js b/test/binCases/config-name/found-one/webpack.config.js new file mode 100644 index 00000000000..cfeca70c7a6 --- /dev/null +++ b/test/binCases/config-name/found-one/webpack.config.js @@ -0,0 +1,12 @@ +var path = require("path"); + +module.exports = [ + { + name: "foo", + entry: path.resolve(__dirname, "./index") + }, + { + name: "bar", + entry: path.resolve(__dirname, "./index2") + } +]; diff --git a/test/binCases/config-name/not-found/test.js b/test/binCases/config-name/not-found/test.js new file mode 100644 index 00000000000..ccf5c59f0b6 --- /dev/null +++ b/test/binCases/config-name/not-found/test.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.not.eql(0); + stdout.should.be.empty(); + stderr[0].should.containEql("Configuration with name 'foo' was not found."); +}; diff --git a/test/binCases/config-name/not-found/test.opts b/test/binCases/config-name/not-found/test.opts new file mode 100644 index 00000000000..dfe77dcedc7 --- /dev/null +++ b/test/binCases/config-name/not-found/test.opts @@ -0,0 +1,2 @@ +--config ./webpack.config.js +--config-name foo diff --git a/test/binCases/config-name/not-found/webpack.config.js b/test/binCases/config-name/not-found/webpack.config.js new file mode 100644 index 00000000000..3c788726cac --- /dev/null +++ b/test/binCases/config-name/not-found/webpack.config.js @@ -0,0 +1,5 @@ +module.exports = [ + { + name: "bar" + } +]; diff --git a/test/binCases/configFile/profile/bar.js b/test/binCases/configFile/profile/bar.js new file mode 100644 index 00000000000..636c1fc2774 --- /dev/null +++ b/test/binCases/configFile/profile/bar.js @@ -0,0 +1 @@ +console.log("bar"); diff --git a/test/binCases/configFile/profile/foo.js b/test/binCases/configFile/profile/foo.js new file mode 100644 index 00000000000..2753f2eb024 --- /dev/null +++ b/test/binCases/configFile/profile/foo.js @@ -0,0 +1,3 @@ +require("./bar"); + +console.log("foo"); diff --git a/test/binCases/configFile/profile/index.js b/test/binCases/configFile/profile/index.js new file mode 100644 index 00000000000..e51c55eb6a5 --- /dev/null +++ b/test/binCases/configFile/profile/index.js @@ -0,0 +1 @@ +const foo = require("./foo"); diff --git a/test/binCases/configFile/profile/test.js b/test/binCases/configFile/profile/test.js new file mode 100644 index 00000000000..ee830f33d11 --- /dev/null +++ b/test/binCases/configFile/profile/test.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[6].should.containEql("factory:"); + stdout[8].should.containEql("factory:"); + stdout[10].should.containEql("factory:"); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/configFile/profile/webpack.config.js b/test/binCases/configFile/profile/webpack.config.js new file mode 100644 index 00000000000..686dc437972 --- /dev/null +++ b/test/binCases/configFile/profile/webpack.config.js @@ -0,0 +1,6 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index"), + profile: true +}; diff --git a/test/binCases/entry/multi-file/a.js b/test/binCases/entry/multi-file/a.js new file mode 100644 index 00000000000..aa7a96ad992 --- /dev/null +++ b/test/binCases/entry/multi-file/a.js @@ -0,0 +1 @@ +module.exports = "fileA"; diff --git a/test/binCases/entry/multi-file/index.js b/test/binCases/entry/multi-file/index.js new file mode 100644 index 00000000000..0d24e266fe2 --- /dev/null +++ b/test/binCases/entry/multi-file/index.js @@ -0,0 +1 @@ +module.exports = "index"; diff --git a/test/binCases/entry/multi-file/test.js b/test/binCases/entry/multi-file/test.js new file mode 100644 index 00000000000..cfa1ff6d584 --- /dev/null +++ b/test/binCases/entry/multi-file/test.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[4].should.containEql("null.js"); + stdout[5].should.match(/multi.*index\.js.*a\.js/); // should have multi-file entry + stdout[6].should.match(/index\.js.*\{0\}/); + stdout[7].should.match(/a\.js.*\{0\}/); + stderr.should.be.empty(); +}; diff --git a/test/binCases/entry/multi-file/test.opts b/test/binCases/entry/multi-file/test.opts new file mode 100644 index 00000000000..53402ac53c5 --- /dev/null +++ b/test/binCases/entry/multi-file/test.opts @@ -0,0 +1,6 @@ +--entry ./index.js +--entry ./a.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/entry/multi-file/webpack.config.js b/test/binCases/entry/multi-file/webpack.config.js new file mode 100644 index 00000000000..f053ebf7976 --- /dev/null +++ b/test/binCases/entry/multi-file/webpack.config.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/test/binCases/entry/named-entry/a.js b/test/binCases/entry/named-entry/a.js new file mode 100644 index 00000000000..aa7a96ad992 --- /dev/null +++ b/test/binCases/entry/named-entry/a.js @@ -0,0 +1 @@ +module.exports = "fileA"; diff --git a/test/binCases/entry/named-entry/index.js b/test/binCases/entry/named-entry/index.js new file mode 100644 index 00000000000..0d24e266fe2 --- /dev/null +++ b/test/binCases/entry/named-entry/index.js @@ -0,0 +1 @@ +module.exports = "index"; diff --git a/test/binCases/entry/named-entry/test.js b/test/binCases/entry/named-entry/test.js new file mode 100644 index 00000000000..4c62f985eb6 --- /dev/null +++ b/test/binCases/entry/named-entry/test.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[4].should.containEql("null.js"); + stdout[5].should.containEql("foo.js"); // named entry from --entry foo=./a.js + stdout[6].should.match(/a\.js.*\{1\}/); + stdout[7].should.match(/index\.js.*\{0\}/); + stderr.should.be.empty(); +}; diff --git a/test/binCases/entry/named-entry/test.opts b/test/binCases/entry/named-entry/test.opts new file mode 100644 index 00000000000..b8f0fa016e2 --- /dev/null +++ b/test/binCases/entry/named-entry/test.opts @@ -0,0 +1,6 @@ +--entry foo=./a.js +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/entry/named-entry/webpack.config.js b/test/binCases/entry/named-entry/webpack.config.js new file mode 100644 index 00000000000..f053ebf7976 --- /dev/null +++ b/test/binCases/entry/named-entry/webpack.config.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/test/binCases/entry/non-hyphenated-args/a.js b/test/binCases/entry/non-hyphenated-args/a.js new file mode 100644 index 00000000000..aa7a96ad992 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/a.js @@ -0,0 +1 @@ +module.exports = "fileA"; diff --git a/test/binCases/entry/non-hyphenated-args/index.js b/test/binCases/entry/non-hyphenated-args/index.js new file mode 100644 index 00000000000..0d24e266fe2 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/index.js @@ -0,0 +1 @@ +module.exports = "index"; diff --git a/test/binCases/entry/non-hyphenated-args/test.js b/test/binCases/entry/non-hyphenated-args/test.js new file mode 100644 index 00000000000..0e1ae1ce1ff --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/test.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[4].should.containEql("null.js"); + stdout[5].should.containEql("main.js"); // non-hyphenated arg ./a.js should create chunk "main" + stdout[6].should.match(/index\.js.*\{0\}/); // index.js should be in chunk 0 + stdout[7].should.match(/a\.js.*\{1\}/); // a.js should be in chunk 1 + stderr.should.be.empty(); +}; diff --git a/test/binCases/entry/non-hyphenated-args/test.opts b/test/binCases/entry/non-hyphenated-args/test.opts new file mode 100644 index 00000000000..6b8499d5275 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/test.opts @@ -0,0 +1,6 @@ +./a.js +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/entry/non-hyphenated-args/webpack.config.js b/test/binCases/entry/non-hyphenated-args/webpack.config.js new file mode 100644 index 00000000000..f053ebf7976 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/webpack.config.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/test/binCases/errors/issue-5576/a.js b/test/binCases/errors/issue-5576/a.js new file mode 100644 index 00000000000..aa7a96ad992 --- /dev/null +++ b/test/binCases/errors/issue-5576/a.js @@ -0,0 +1 @@ +module.exports = "fileA"; diff --git a/test/binCases/errors/issue-5576/a/.keep b/test/binCases/errors/issue-5576/a/.keep new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/test/binCases/errors/issue-5576/a/.keep @@ -0,0 +1 @@ + diff --git a/test/binCases/errors/issue-5576/test.js b/test/binCases/errors/issue-5576/test.js new file mode 100644 index 00000000000..bd4db65fd62 --- /dev/null +++ b/test/binCases/errors/issue-5576/test.js @@ -0,0 +1,14 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(2); + + stdout[0].should.containEql("Hash: "); + stdout[1].should.containEql("Version: "); + stdout[2].should.containEql("Time: "); + stdout[4].should.containEql( + "ERROR in Entry module not found: Error: Can't resolve" + ); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/errors/issue-5576/test.opts b/test/binCases/errors/issue-5576/test.opts new file mode 100644 index 00000000000..368eb2326cf --- /dev/null +++ b/test/binCases/errors/issue-5576/test.opts @@ -0,0 +1,3 @@ +a +bundle.js + diff --git a/test/binCases/errors/issue-5576/webpack.config.js b/test/binCases/errors/issue-5576/webpack.config.js new file mode 100644 index 00000000000..f053ebf7976 --- /dev/null +++ b/test/binCases/errors/issue-5576/webpack.config.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/test/binCases/errors/parse/index.js b/test/binCases/errors/parse/index.js new file mode 100644 index 00000000000..5c34318c214 --- /dev/null +++ b/test/binCases/errors/parse/index.js @@ -0,0 +1 @@ +} diff --git a/test/binCases/errors/parse/test.js b/test/binCases/errors/parse/test.js new file mode 100644 index 00000000000..122ab47b45b --- /dev/null +++ b/test/binCases/errors/parse/test.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(2); + + stdout[0].should.containEql("Hash: "); + stdout[1].should.containEql("Version: "); + stdout[2].should.containEql("Time: "); + stdout[5].should.containEql("./index.js"); + stdout[5].should.containEql("[built]"); + stdout[5].should.containEql("[failed]"); + stdout[5].should.containEql("[1 error]"); + stdout[7].should.containEql("ERROR in ./index.js"); + stdout[8].should.containEql("Module parse failed:"); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/errors/parse/webpack.config.js b/test/binCases/errors/parse/webpack.config.js new file mode 100644 index 00000000000..f00c469a2be --- /dev/null +++ b/test/binCases/errors/parse/webpack.config.js @@ -0,0 +1,4 @@ +module.exports = { + context: __dirname, + entry: "./index" +}; diff --git a/test/binCases/help/help-output/test.js b/test/binCases/help/help-output/test.js new file mode 100644 index 00000000000..895d915c23e --- /dev/null +++ b/test/binCases/help/help-output/test.js @@ -0,0 +1,19 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[0].should.startWith("webpack"); + stdout.should.containEql("Config options:"); + stdout.should.containEql("Basic options:"); + stdout.should.containEql("Module options:"); + stdout.should.containEql("Output options:"); + stdout.should.containEql("Advanced options:"); + stdout.should.containEql("Resolving options:"); + stdout.should.containEql("Optimizing options:"); + stdout.should.containEql("Stats options:"); + stdout.should.containEql("Options:"); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/help/help-output/test.opts b/test/binCases/help/help-output/test.opts new file mode 100644 index 00000000000..2255a80a730 --- /dev/null +++ b/test/binCases/help/help-output/test.opts @@ -0,0 +1 @@ +--help diff --git a/test/binCases/module/module-bind/file.post b/test/binCases/module/module-bind/file.post new file mode 100644 index 00000000000..8b1e502f812 --- /dev/null +++ b/test/binCases/module/module-bind/file.post @@ -0,0 +1 @@ +post diff --git a/test/binCases/module/module-bind/file.pre b/test/binCases/module/module-bind/file.pre new file mode 100644 index 00000000000..ecca61d996a --- /dev/null +++ b/test/binCases/module/module-bind/file.pre @@ -0,0 +1 @@ +pre diff --git a/test/binCases/module/module-bind/index.js b/test/binCases/module/module-bind/index.js new file mode 100644 index 00000000000..18c4f18cda7 --- /dev/null +++ b/test/binCases/module/module-bind/index.js @@ -0,0 +1,3 @@ +var pre = require("./file.pre"); +var post = require("./file.post"); +module.exports = "foo"; diff --git a/test/binCases/module/module-bind/post-loader.js b/test/binCases/module/module-bind/post-loader.js new file mode 100644 index 00000000000..713c44c1103 --- /dev/null +++ b/test/binCases/module/module-bind/post-loader.js @@ -0,0 +1,4 @@ +module.exports = function(source) { + console.log("post-loaded " + source.replace(/\r?\n/g, "")); + return source; +}; diff --git a/test/binCases/module/module-bind/pre-loader.js b/test/binCases/module/module-bind/pre-loader.js new file mode 100644 index 00000000000..32a5b4c2656 --- /dev/null +++ b/test/binCases/module/module-bind/pre-loader.js @@ -0,0 +1,4 @@ +module.exports = function(source) { + console.log("pre-loaded " + source.replace(/\r?\n/g, "")); + return source; +}; diff --git a/test/binCases/module/module-bind/test.js b/test/binCases/module/module-bind/test.js new file mode 100644 index 00000000000..eeef1f0ca6c --- /dev/null +++ b/test/binCases/module/module-bind/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout.should.containEql("pre-loaded pre"); + stdout.should.containEql("post-loaded post"); + stderr.should.be.empty(); +}; diff --git a/test/binCases/module/module-bind/test.opts b/test/binCases/module/module-bind/test.opts new file mode 100644 index 00000000000..94331cd34e2 --- /dev/null +++ b/test/binCases/module/module-bind/test.opts @@ -0,0 +1,7 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--module-bind-pre pre=./pre-loader +--module-bind-post post=./post-loader diff --git a/test/binCases/module/module-bind/webpack.config.js b/test/binCases/module/module-bind/webpack.config.js new file mode 100644 index 00000000000..a5c12a44666 --- /dev/null +++ b/test/binCases/module/module-bind/webpack.config.js @@ -0,0 +1,5 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index") +}; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/index.js b/test/binCases/plugins/uglifyjsplugin-empty-args/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/test.js b/test/binCases/plugins/uglifyjsplugin-empty-args/test.js new file mode 100644 index 00000000000..7837b1d9536 --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.exactly(0); + + stdout.should.be.ok(); + stdout[4].should.containEql("bytes"); // without uglifyjs it's multiple kBs + + stderr.should.be.empty(); +}; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/test.opts b/test/binCases/plugins/uglifyjsplugin-empty-args/test.opts new file mode 100644 index 00000000000..edc5ab3dcb3 --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/test.opts @@ -0,0 +1,6 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--plugin webpack/lib/optimize/UglifyJsPlugin diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/webpack.config.js b/test/binCases/plugins/uglifyjsplugin-empty-args/webpack.config.js new file mode 100644 index 00000000000..a5c12a44666 --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/webpack.config.js @@ -0,0 +1,5 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index") +}; diff --git a/test/binCases/stats/custom-preset/index.js b/test/binCases/stats/custom-preset/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/stats/custom-preset/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/stats/custom-preset/test.js b/test/binCases/stats/custom-preset/test.js new file mode 100644 index 00000000000..5457915cd9f --- /dev/null +++ b/test/binCases/stats/custom-preset/test.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + stderr.should.be.empty(); + code.should.be.eql(0); + stdout.should.be.empty(); +}; diff --git a/test/binCases/stats/custom-preset/test.opts b/test/binCases/stats/custom-preset/test.opts new file mode 100644 index 00000000000..e45b168921d --- /dev/null +++ b/test/binCases/stats/custom-preset/test.opts @@ -0,0 +1,5 @@ +--entry ./index.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--display diff --git a/test/binCases/stats/multi-config/index.js b/test/binCases/stats/multi-config/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/stats/multi-config/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/stats/multi-config/index2.js b/test/binCases/stats/multi-config/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/stats/multi-config/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/stats/multi-config/test.js b/test/binCases/stats/multi-config/test.js new file mode 100644 index 00000000000..9515f2f778c --- /dev/null +++ b/test/binCases/stats/multi-config/test.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(0); + stdout.should.be.ok(); + stderr.should.be.empty(); +}; diff --git a/test/binCases/stats/multi-config/webpack.config.js b/test/binCases/stats/multi-config/webpack.config.js new file mode 100644 index 00000000000..f522c7813d3 --- /dev/null +++ b/test/binCases/stats/multi-config/webpack.config.js @@ -0,0 +1,12 @@ +var path = require("path"); + +module.exports = [ + { + entry: path.resolve(__dirname, "./index"), + stats: "errors-only" + }, + { + entry: path.resolve(__dirname, "./index2"), + stats: "errors-only" + } +]; diff --git a/test/binCases/stats/none/index.js b/test/binCases/stats/none/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/stats/none/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/stats/none/test.js b/test/binCases/stats/none/test.js new file mode 100644 index 00000000000..a2cc82d2396 --- /dev/null +++ b/test/binCases/stats/none/test.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(0); + stdout.should.be.empty(); + stderr.should.be.empty(); +}; diff --git a/test/binCases/stats/none/webpack.config.js b/test/binCases/stats/none/webpack.config.js new file mode 100644 index 00000000000..40a6ae80766 --- /dev/null +++ b/test/binCases/stats/none/webpack.config.js @@ -0,0 +1,6 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index"), + stats: "none" +}; diff --git a/test/binCases/stats/single-config/index.js b/test/binCases/stats/single-config/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/stats/single-config/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/stats/single-config/test.js b/test/binCases/stats/single-config/test.js new file mode 100644 index 00000000000..a961bcd51de --- /dev/null +++ b/test/binCases/stats/single-config/test.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + code.should.be.eql(0); + + stdout.should.be.ok(); + stdout[0].should.containEql("Hash: "); + stdout[1].should.containEql("Version: "); + stdout[2].should.containEql("Time: "); + stdout[4].should.containEql("\u001b[1m\u001b[32mnull.js\u001b[39m\u001b[22m"); + stdout[5].should.containEql("chunk"); + stdout[6].should.not.containEql("./index.js"); + stdout[6].should.not.containEql("[built]"); + stdout[6].should.containEql("1 module"); + + stderr.should.be.empty(); +}; diff --git a/test/binCases/stats/single-config/webpack.config.js b/test/binCases/stats/single-config/webpack.config.js new file mode 100644 index 00000000000..d15e7a1936d --- /dev/null +++ b/test/binCases/stats/single-config/webpack.config.js @@ -0,0 +1,11 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index"), + stats: { + assets: true, + colors: true, + chunks: true, + maxModules: 0 + } +}; diff --git a/test/binCases/test.opts b/test/binCases/test.opts new file mode 100644 index 00000000000..f9e6657e70b --- /dev/null +++ b/test/binCases/test.opts @@ -0,0 +1,5 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node diff --git a/test/binCases/watch/multi-config-watch-opt/async b/test/binCases/watch/multi-config-watch-opt/async new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/multi-config-watch-opt/index.js b/test/binCases/watch/multi-config-watch-opt/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/watch/multi-config-watch-opt/index2.js b/test/binCases/watch/multi-config-watch-opt/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/watch/multi-config-watch-opt/test.js b/test/binCases/watch/multi-config-watch-opt/test.js new file mode 100644 index 00000000000..f4d37c16fa0 --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + stdout.should.be.ok(); + stdout[0].should.containEql(""); + stdout[1].should.containEql("Webpack is watching the files…"); + + stderr.should.be.empty(); + done(); +}; diff --git a/test/binCases/watch/multi-config-watch-opt/test.opts b/test/binCases/watch/multi-config-watch-opt/test.opts new file mode 100644 index 00000000000..38534ad5708 --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/test.opts @@ -0,0 +1,6 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--watch diff --git a/test/binCases/watch/multi-config-watch-opt/webpack.config.js b/test/binCases/watch/multi-config-watch-opt/webpack.config.js new file mode 100644 index 00000000000..1eea67aa467 --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/webpack.config.js @@ -0,0 +1,10 @@ +var path = require("path"); + +module.exports = [ + { + entry: path.resolve(__dirname, "./index") + }, + { + entry: path.resolve(__dirname, "./index2") + } +]; diff --git a/test/binCases/watch/multi-config/async b/test/binCases/watch/multi-config/async new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/multi-config/index.js b/test/binCases/watch/multi-config/index.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/binCases/watch/multi-config/index.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/binCases/watch/multi-config/index2.js b/test/binCases/watch/multi-config/index2.js new file mode 100644 index 00000000000..a7f281456cc --- /dev/null +++ b/test/binCases/watch/multi-config/index2.js @@ -0,0 +1 @@ +module.exports = "bar"; diff --git a/test/binCases/watch/multi-config/test.js b/test/binCases/watch/multi-config/test.js new file mode 100644 index 00000000000..f4d37c16fa0 --- /dev/null +++ b/test/binCases/watch/multi-config/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + stdout.should.be.ok(); + stdout[0].should.containEql(""); + stdout[1].should.containEql("Webpack is watching the files…"); + + stderr.should.be.empty(); + done(); +}; diff --git a/test/binCases/watch/multi-config/webpack.config.js b/test/binCases/watch/multi-config/webpack.config.js new file mode 100644 index 00000000000..9bb64699dc7 --- /dev/null +++ b/test/binCases/watch/multi-config/webpack.config.js @@ -0,0 +1,11 @@ +var path = require("path"); + +module.exports = [ + { + entry: path.resolve(__dirname, "./index"), + watch: true + }, + { + entry: path.resolve(__dirname, "./index2") + } +]; diff --git a/test/binCases/watch/single-config-watch-opt/async b/test/binCases/watch/single-config-watch-opt/async new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/single-config-watch-opt/index.js b/test/binCases/watch/single-config-watch-opt/index.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/single-config-watch-opt/test.js b/test/binCases/watch/single-config-watch-opt/test.js new file mode 100644 index 00000000000..f4d37c16fa0 --- /dev/null +++ b/test/binCases/watch/single-config-watch-opt/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + stdout.should.be.ok(); + stdout[0].should.containEql(""); + stdout[1].should.containEql("Webpack is watching the files…"); + + stderr.should.be.empty(); + done(); +}; diff --git a/test/binCases/watch/single-config-watch-opt/test.opts b/test/binCases/watch/single-config-watch-opt/test.opts new file mode 100644 index 00000000000..38534ad5708 --- /dev/null +++ b/test/binCases/watch/single-config-watch-opt/test.opts @@ -0,0 +1,6 @@ +--entry ./index.js +--config ./webpack.config.js +--output-filename [name].js +--output-chunk-filename [id].chunk.js +--target async-node +--watch diff --git a/test/binCases/watch/single-config-watch-opt/webpack.config.js b/test/binCases/watch/single-config-watch-opt/webpack.config.js new file mode 100644 index 00000000000..a5c12a44666 --- /dev/null +++ b/test/binCases/watch/single-config-watch-opt/webpack.config.js @@ -0,0 +1,5 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index") +}; diff --git a/test/binCases/watch/single-config/async b/test/binCases/watch/single-config/async new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/single-config/index.js b/test/binCases/watch/single-config/index.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/binCases/watch/single-config/test.js b/test/binCases/watch/single-config/test.js new file mode 100644 index 00000000000..f4d37c16fa0 --- /dev/null +++ b/test/binCases/watch/single-config/test.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + stdout.should.be.ok(); + stdout[0].should.containEql(""); + stdout[1].should.containEql("Webpack is watching the files…"); + + stderr.should.be.empty(); + done(); +}; diff --git a/test/binCases/watch/single-config/webpack.config.js b/test/binCases/watch/single-config/webpack.config.js new file mode 100644 index 00000000000..8a01f0715a7 --- /dev/null +++ b/test/binCases/watch/single-config/webpack.config.js @@ -0,0 +1,6 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index"), + watch: true +}; diff --git a/test/js/bin/config-name/found-many/main.js b/test/js/bin/config-name/found-many/main.js new file mode 100644 index 00000000000..115f09a4d04 --- /dev/null +++ b/test/js/bin/config-name/found-many/main.js @@ -0,0 +1,74 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = "bar"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/config-name/found-one/main.js b/test/js/bin/config-name/found-one/main.js new file mode 100644 index 00000000000..115f09a4d04 --- /dev/null +++ b/test/js/bin/config-name/found-one/main.js @@ -0,0 +1,74 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = "bar"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/configFile/profile/null.js b/test/js/bin/configFile/profile/null.js new file mode 100644 index 00000000000..ab5478d665e --- /dev/null +++ b/test/js/bin/configFile/profile/null.js @@ -0,0 +1,90 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +const foo = __webpack_require__(1); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__(2); + +console.log("foo"); + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +console.log("bar"); + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/multi-file/null.js b/test/js/bin/entry/multi-file/null.js new file mode 100644 index 00000000000..ca280784866 --- /dev/null +++ b/test/js/bin/entry/multi-file/null.js @@ -0,0 +1,97 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(1); + module.exports = __webpack_require__(2); + + /***/ + }, + /* 1 */ + /***/ function(module, exports) { + module.exports = "index"; + + /***/ + }, + /* 2 */ + /***/ function(module, exports) { + module.exports = "fileA"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/entry/named-entry/foo.js b/test/js/bin/entry/named-entry/foo.js new file mode 100644 index 00000000000..39e8b5f838c --- /dev/null +++ b/test/js/bin/entry/named-entry/foo.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "fileA"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/entry/named-entry/null.js b/test/js/bin/entry/named-entry/null.js new file mode 100644 index 00000000000..50f8e4a2224 --- /dev/null +++ b/test/js/bin/entry/named-entry/null.js @@ -0,0 +1,85 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 1)); + /******/ +})( + /************************************************************************/ + /******/ [ + , + /* 0 */ /* 1 */ + /***/ function(module, exports) { + module.exports = "index"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/entry/non-hyphenated-args/main.js b/test/js/bin/entry/non-hyphenated-args/main.js new file mode 100644 index 00000000000..3c2414a7c24 --- /dev/null +++ b/test/js/bin/entry/non-hyphenated-args/main.js @@ -0,0 +1,85 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 1)); + /******/ +})( + /************************************************************************/ + /******/ [ + , + /* 0 */ /* 1 */ + /***/ function(module, exports) { + module.exports = "fileA"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/entry/non-hyphenated-args/null.js b/test/js/bin/entry/non-hyphenated-args/null.js new file mode 100644 index 00000000000..037354ae43c --- /dev/null +++ b/test/js/bin/entry/non-hyphenated-args/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "index"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/errors/parse/null.js b/test/js/bin/errors/parse/null.js new file mode 100644 index 00000000000..3df4ead4a74 --- /dev/null +++ b/test/js/bin/errors/parse/null.js @@ -0,0 +1,86 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + throw new Error( + "Module parse failed: /Users/evenstensberg/Documents/webpack-cli/test/binCases/errors/parse/index.js Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type.\n| }\n| " + ); + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/module/module-bind/null.js b/test/js/bin/module/module-bind/null.js new file mode 100644 index 00000000000..cac8026cf6a --- /dev/null +++ b/test/js/bin/module/module-bind/null.js @@ -0,0 +1,98 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports, __webpack_require__) { + var pre = __webpack_require__(1); + var post = __webpack_require__(2); + module.exports = "foo"; + + /***/ + }, + /* 1 */ + /***/ function(module, exports) { + pre; + + /***/ + }, + /* 2 */ + /***/ function(module, exports) { + post; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js b/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js new file mode 100644 index 00000000000..68f8c94b142 --- /dev/null +++ b/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js @@ -0,0 +1,38 @@ +!(function(r) { + function t(n) { + if (e[n]) return e[n].exports; + var o = (e[n] = { i: n, l: !1, exports: {} }); + return r[n].call(o.exports, o, o.exports, t), (o.l = !0), o.exports; + } + var e = {}; + (t.m = r), + (t.c = e), + (t.d = function(r, e, n) { + t.o(r, e) || + Object.defineProperty(r, e, { + configurable: !1, + enumerable: !0, + get: n + }); + }), + (t.n = function(r) { + var e = + r && r.__esModule + ? function() { + return r.default; + } + : function() { + return r; + }; + return t.d(e, "a", e), e; + }), + (t.o = function(r, t) { + return Object.prototype.hasOwnProperty.call(r, t); + }), + (t.p = ""), + t((t.s = 0)); +})([ + function(r, t) { + r.exports = "foo"; + } +]); diff --git a/test/js/bin/stats/custom-preset/null.js b/test/js/bin/stats/custom-preset/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/stats/custom-preset/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/stats/multi-config/null.js b/test/js/bin/stats/multi-config/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/stats/multi-config/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/stats/none/null.js b/test/js/bin/stats/none/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/stats/none/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/stats/single-config/null.js b/test/js/bin/stats/single-config/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/stats/single-config/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/watch/multi-config-watch-opt/null.js b/test/js/bin/watch/multi-config-watch-opt/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/watch/multi-config-watch-opt/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/watch/multi-config/null.js b/test/js/bin/watch/multi-config/null.js new file mode 100644 index 00000000000..9e1a121dfa6 --- /dev/null +++ b/test/js/bin/watch/multi-config/null.js @@ -0,0 +1,84 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + module.exports = "foo"; + + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/watch/single-config-watch-opt/null.js b/test/js/bin/watch/single-config-watch-opt/null.js new file mode 100644 index 00000000000..23643f275de --- /dev/null +++ b/test/js/bin/watch/single-config-watch-opt/null.js @@ -0,0 +1,82 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + /***/ + } + /******/ + ] +); diff --git a/test/js/bin/watch/single-config/null.js b/test/js/bin/watch/single-config/null.js new file mode 100644 index 00000000000..23643f275de --- /dev/null +++ b/test/js/bin/watch/single-config/null.js @@ -0,0 +1,82 @@ +/******/ (function(modules) { + // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; // The require function + /******/ + /******/ /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if (installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ + } // Create a new module (and put it into the cache) + /******/ /******/ var module = (installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ + }); // Execute the module function + /******/ + /******/ /******/ modules[moduleId].call( + module.exports, + module, + module.exports, + __webpack_require__ + ); // Flag the module as loaded + /******/ + /******/ /******/ module.l = true; // Return the exports of the module + /******/ + /******/ /******/ return module.exports; + /******/ + } // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ /******/ __webpack_require__.m = modules; // expose the module cache + /******/ + /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports + /******/ + /******/ /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if (!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ + }); + /******/ + } + /******/ + }; // getDefaultExport function for compatibility with non-harmony modules + /******/ + /******/ /******/ __webpack_require__.n = function(module) { + /******/ var getter = + module && module.__esModule + ? /******/ function getDefault() { + return module["default"]; + } + : /******/ function getModuleExports() { + return module; + }; + /******/ __webpack_require__.d(getter, "a", getter); + /******/ return getter; + /******/ + }; // Object.prototype.hasOwnProperty.call + /******/ + /******/ /******/ __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; // __webpack_public_path__ + /******/ + /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports + /******/ + /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); + /******/ +})( + /************************************************************************/ + /******/ [ + /* 0 */ + /***/ function(module, exports) { + /***/ + } + /******/ + ] +); From 4667661d545b303a0a64532145cb77bae6d2b2ba Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Thu, 21 Sep 2017 22:50:55 +0200 Subject: [PATCH 08/12] add travis builds --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 807f3a1f60b..345cebfbbec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,5 +17,7 @@ before_script: - bash <(curl -s https://codecov.io/bash) script: + - npm run prepublish + - npm run test:cli - npm run lint - npm run test From ee9a9e927562bfbdf2976f0ee154b2f1b3a4782f Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Thu, 21 Sep 2017 22:57:23 +0200 Subject: [PATCH 09/12] add cli to signature & add ignore to trash code --- .gitignore | 3 + bin/webpack.js | 2 +- test/js/bin/entry/multi-file/null.js | 180 +++++++++-------- test/js/bin/entry/named-entry/foo.js | 156 +++++++-------- test/js/bin/entry/named-entry/null.js | 158 +++++++-------- test/js/bin/entry/non-hyphenated-args/main.js | 158 +++++++-------- test/js/bin/entry/non-hyphenated-args/null.js | 156 +++++++-------- test/js/bin/errors/parse/null.js | 157 +++++++-------- test/js/bin/module/module-bind/null.js | 182 +++++++++--------- .../plugins/uglifyjsplugin-empty-args/null.js | 39 +--- test/js/bin/stats/custom-preset/null.js | 156 +++++++-------- test/js/bin/stats/multi-config/null.js | 156 +++++++-------- test/js/bin/stats/none/null.js | 156 +++++++-------- test/js/bin/stats/single-config/null.js | 156 +++++++-------- .../bin/watch/multi-config-watch-opt/null.js | 156 +++++++-------- test/js/bin/watch/multi-config/null.js | 156 +++++++-------- .../bin/watch/single-config-watch-opt/null.js | 155 +++++++-------- test/js/bin/watch/single-config/null.js | 155 +++++++-------- 18 files changed, 1128 insertions(+), 1309 deletions(-) diff --git a/.gitignore b/.gitignore index 3d29695d9be..798edadc1c1 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ coverage # Dist build dist + +# Test Compilation +test/js/* diff --git a/bin/webpack.js b/bin/webpack.js index e5ac67f483a..2ed043ba6f8 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -34,7 +34,7 @@ if (localCLI && path.relative(localCLI, __filename) !== "") { } // eslint-disable-next-line var yargs = require("yargs").usage( - "webpack " + + "webpack-cli " + require("../package.json").version + "\n" + "Usage: https://webpack.js.org/api/cli/\n" + diff --git a/test/js/bin/entry/multi-file/null.js b/test/js/bin/entry/multi-file/null.js index ca280784866..d76d21d5f03 100644 --- a/test/js/bin/entry/multi-file/null.js +++ b/test/js/bin/entry/multi-file/null.js @@ -1,97 +1,89 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports, __webpack_require__) { - __webpack_require__(1); - module.exports = __webpack_require__(2); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { - /***/ - }, - /* 1 */ - /***/ function(module, exports) { - module.exports = "index"; +__webpack_require__(1); +module.exports = __webpack_require__(2); - /***/ - }, - /* 2 */ - /***/ function(module, exports) { - module.exports = "fileA"; - /***/ - } - /******/ - ] -); +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +module.exports = "index"; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +module.exports = "fileA"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/named-entry/foo.js b/test/js/bin/entry/named-entry/foo.js index 39e8b5f838c..70b4cfb536a 100644 --- a/test/js/bin/entry/named-entry/foo.js +++ b/test/js/bin/entry/named-entry/foo.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "fileA"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "fileA"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/named-entry/null.js b/test/js/bin/entry/named-entry/null.js index 50f8e4a2224..89fae7c48ce 100644 --- a/test/js/bin/entry/named-entry/null.js +++ b/test/js/bin/entry/named-entry/null.js @@ -1,85 +1,75 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 1)); - /******/ -})( - /************************************************************************/ - /******/ [ - , - /* 0 */ /* 1 */ - /***/ function(module, exports) { - module.exports = "index"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 1); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */, +/* 1 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "index"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/non-hyphenated-args/main.js b/test/js/bin/entry/non-hyphenated-args/main.js index 3c2414a7c24..18c1ee46cb2 100644 --- a/test/js/bin/entry/non-hyphenated-args/main.js +++ b/test/js/bin/entry/non-hyphenated-args/main.js @@ -1,85 +1,75 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 1)); - /******/ -})( - /************************************************************************/ - /******/ [ - , - /* 0 */ /* 1 */ - /***/ function(module, exports) { - module.exports = "fileA"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 1); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */, +/* 1 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "fileA"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/entry/non-hyphenated-args/null.js b/test/js/bin/entry/non-hyphenated-args/null.js index 037354ae43c..527680c3621 100644 --- a/test/js/bin/entry/non-hyphenated-args/null.js +++ b/test/js/bin/entry/non-hyphenated-args/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "index"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "index"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/errors/parse/null.js b/test/js/bin/errors/parse/null.js index 3df4ead4a74..8ab06b6a8e2 100644 --- a/test/js/bin/errors/parse/null.js +++ b/test/js/bin/errors/parse/null.js @@ -1,86 +1,73 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - throw new Error( - "Module parse failed: /Users/evenstensberg/Documents/webpack-cli/test/binCases/errors/parse/index.js Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type.\n| }\n| " - ); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +throw new Error("Module parse failed: /Users/evenstensberg/Documents/webpack-cli/test/binCases/errors/parse/index.js Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type.\n| }\n| "); + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/module/module-bind/null.js b/test/js/bin/module/module-bind/null.js index cac8026cf6a..fe5e939a265 100644 --- a/test/js/bin/module/module-bind/null.js +++ b/test/js/bin/module/module-bind/null.js @@ -1,98 +1,90 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports, __webpack_require__) { - var pre = __webpack_require__(1); - var post = __webpack_require__(2); - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { - /***/ - }, - /* 1 */ - /***/ function(module, exports) { - pre; +var pre = __webpack_require__(1); +var post = __webpack_require__(2); +module.exports = "foo"; - /***/ - }, - /* 2 */ - /***/ function(module, exports) { - post; - /***/ - } - /******/ - ] -); +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +pre + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +post + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js b/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js index 68f8c94b142..a71ebe70b50 100644 --- a/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js +++ b/test/js/bin/plugins/uglifyjsplugin-empty-args/null.js @@ -1,38 +1 @@ -!(function(r) { - function t(n) { - if (e[n]) return e[n].exports; - var o = (e[n] = { i: n, l: !1, exports: {} }); - return r[n].call(o.exports, o, o.exports, t), (o.l = !0), o.exports; - } - var e = {}; - (t.m = r), - (t.c = e), - (t.d = function(r, e, n) { - t.o(r, e) || - Object.defineProperty(r, e, { - configurable: !1, - enumerable: !0, - get: n - }); - }), - (t.n = function(r) { - var e = - r && r.__esModule - ? function() { - return r.default; - } - : function() { - return r; - }; - return t.d(e, "a", e), e; - }), - (t.o = function(r, t) { - return Object.prototype.hasOwnProperty.call(r, t); - }), - (t.p = ""), - t((t.s = 0)); -})([ - function(r, t) { - r.exports = "foo"; - } -]); +!function(r){function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var e={};t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{configurable:!1,enumerable:!0,get:n})},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},t.p="",t(t.s=0)}([function(r,t){r.exports="foo"}]); \ No newline at end of file diff --git a/test/js/bin/stats/custom-preset/null.js b/test/js/bin/stats/custom-preset/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/stats/custom-preset/null.js +++ b/test/js/bin/stats/custom-preset/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/stats/multi-config/null.js b/test/js/bin/stats/multi-config/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/stats/multi-config/null.js +++ b/test/js/bin/stats/multi-config/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/stats/none/null.js b/test/js/bin/stats/none/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/stats/none/null.js +++ b/test/js/bin/stats/none/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/stats/single-config/null.js b/test/js/bin/stats/single-config/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/stats/single-config/null.js +++ b/test/js/bin/stats/single-config/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/watch/multi-config-watch-opt/null.js b/test/js/bin/watch/multi-config-watch-opt/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/watch/multi-config-watch-opt/null.js +++ b/test/js/bin/watch/multi-config-watch-opt/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/watch/multi-config/null.js b/test/js/bin/watch/multi-config/null.js index 9e1a121dfa6..127d2e0ca0f 100644 --- a/test/js/bin/watch/multi-config/null.js +++ b/test/js/bin/watch/multi-config/null.js @@ -1,84 +1,74 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - module.exports = "foo"; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { - /***/ - } - /******/ - ] -); +module.exports = "foo"; + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/watch/single-config-watch-opt/null.js b/test/js/bin/watch/single-config-watch-opt/null.js index 23643f275de..30d65ea5b72 100644 --- a/test/js/bin/watch/single-config-watch-opt/null.js +++ b/test/js/bin/watch/single-config-watch-opt/null.js @@ -1,82 +1,73 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - /***/ - } - /******/ - ] -); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + + + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/test/js/bin/watch/single-config/null.js b/test/js/bin/watch/single-config/null.js index 23643f275de..30d65ea5b72 100644 --- a/test/js/bin/watch/single-config/null.js +++ b/test/js/bin/watch/single-config/null.js @@ -1,82 +1,73 @@ -/******/ (function(modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call( - module.exports, - module, - module.exports, - __webpack_require__ - ); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { - /******/ configurable: false, - /******/ enumerable: true, - /******/ get: getter - /******/ - }); - /******/ - } - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function(module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module["default"]; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, "a", getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 0)); - /******/ -})( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function(module, exports) { - /***/ - } - /******/ - ] -); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + + + +/***/ }) +/******/ ]); \ No newline at end of file From 41f5ee49717fc6eba7588f505fe1be53754068cf Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Mon, 25 Sep 2017 23:14:40 +0200 Subject: [PATCH 10/12] port to jest --- .eslintignore | 1 + bin/webpack.js | 4 +- package-lock.json | 1596 +++++++++-------- package.json | 9 +- test/BinTestCases.test.js | 17 +- test/binCases/config-name/found-many/stdin.js | 10 + test/binCases/config-name/found-many/test.js | 9 - test/binCases/config-name/found-one/stdin.js | 9 + test/binCases/config-name/found-one/test.js | 9 - test/binCases/config-name/not-found/stdin.js | 7 + test/binCases/config-name/not-found/test.js | 7 - test/binCases/configFile/profile/stdin.js | 11 + test/binCases/configFile/profile/test.js | 12 - test/binCases/entry/multi-file/stdin.js | 11 + test/binCases/entry/multi-file/test.js | 12 - test/binCases/entry/named-entry/stdin.js | 11 + test/binCases/entry/named-entry/test.js | 12 - .../entry/non-hyphenated-args/stdin.js | 11 + .../entry/non-hyphenated-args/test.js | 12 - test/binCases/errors/issue-5576/stdin.js | 13 + test/binCases/errors/issue-5576/test.js | 14 - test/binCases/errors/parse/stdin.js | 16 + test/binCases/errors/parse/test.js | 17 - test/binCases/help/help-output/stdin.js | 17 + test/binCases/help/help-output/test.js | 19 - test/binCases/module/module-bind/stdin.js | 10 + test/binCases/module/module-bind/test.js | 10 - .../uglifyjsplugin-empty-args/stdin.js | 10 + .../plugins/uglifyjsplugin-empty-args/test.js | 10 - test/binCases/stats/custom-preset/stdin.js | 7 + test/binCases/stats/custom-preset/test.js | 7 - test/binCases/stats/multi-config/stdin.js | 7 + test/binCases/stats/multi-config/test.js | 7 - test/binCases/stats/none/stdin.js | 7 + test/binCases/stats/none/test.js | 7 - test/binCases/stats/single-config/stdin.js | 16 + test/binCases/stats/single-config/test.js | 17 - .../watch/multi-config-watch-opt/stdin.js | 10 + .../watch/multi-config-watch-opt/test.js | 10 - test/binCases/watch/multi-config/stdin.js | 10 + test/binCases/watch/multi-config/test.js | 10 - .../watch/single-config-watch-opt/stdin.js | 10 + .../watch/single-config-watch-opt/test.js | 10 - test/binCases/watch/single-config/stdin.js | 10 + test/binCases/watch/single-config/test.js | 10 - 45 files changed, 1066 insertions(+), 995 deletions(-) create mode 100644 test/binCases/config-name/found-many/stdin.js delete mode 100644 test/binCases/config-name/found-many/test.js create mode 100644 test/binCases/config-name/found-one/stdin.js delete mode 100644 test/binCases/config-name/found-one/test.js create mode 100644 test/binCases/config-name/not-found/stdin.js delete mode 100644 test/binCases/config-name/not-found/test.js create mode 100644 test/binCases/configFile/profile/stdin.js delete mode 100644 test/binCases/configFile/profile/test.js create mode 100644 test/binCases/entry/multi-file/stdin.js delete mode 100644 test/binCases/entry/multi-file/test.js create mode 100644 test/binCases/entry/named-entry/stdin.js delete mode 100644 test/binCases/entry/named-entry/test.js create mode 100644 test/binCases/entry/non-hyphenated-args/stdin.js delete mode 100644 test/binCases/entry/non-hyphenated-args/test.js create mode 100644 test/binCases/errors/issue-5576/stdin.js delete mode 100644 test/binCases/errors/issue-5576/test.js create mode 100644 test/binCases/errors/parse/stdin.js delete mode 100644 test/binCases/errors/parse/test.js create mode 100644 test/binCases/help/help-output/stdin.js delete mode 100644 test/binCases/help/help-output/test.js create mode 100644 test/binCases/module/module-bind/stdin.js delete mode 100644 test/binCases/module/module-bind/test.js create mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/stdin.js delete mode 100644 test/binCases/plugins/uglifyjsplugin-empty-args/test.js create mode 100644 test/binCases/stats/custom-preset/stdin.js delete mode 100644 test/binCases/stats/custom-preset/test.js create mode 100644 test/binCases/stats/multi-config/stdin.js delete mode 100644 test/binCases/stats/multi-config/test.js create mode 100644 test/binCases/stats/none/stdin.js delete mode 100644 test/binCases/stats/none/test.js create mode 100644 test/binCases/stats/single-config/stdin.js delete mode 100644 test/binCases/stats/single-config/test.js create mode 100644 test/binCases/watch/multi-config-watch-opt/stdin.js delete mode 100644 test/binCases/watch/multi-config-watch-opt/test.js create mode 100644 test/binCases/watch/multi-config/stdin.js delete mode 100644 test/binCases/watch/multi-config/test.js create mode 100644 test/binCases/watch/single-config-watch-opt/stdin.js delete mode 100644 test/binCases/watch/single-config-watch-opt/test.js create mode 100644 test/binCases/watch/single-config/stdin.js delete mode 100644 test/binCases/watch/single-config/test.js diff --git a/.eslintignore b/.eslintignore index a62988d01bf..aa24f295da5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ **/__testfixtures__/* coverage test +dist diff --git a/bin/webpack.js b/bin/webpack.js index 2ed043ba6f8..f3898a2553c 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -12,7 +12,7 @@ var localCLI = resolveCwd.silent("webpack-cli/bin/webpack"); if (process.argv.slice(2).indexOf("init") >= 0) { const initPkgs = process.argv.slice(2).length === 1 ? [] : [process.argv.slice(2).pop()]; - + //eslint-disable-next-line return require("../dist/initialize")(initPkgs); } else if (process.argv.slice(2).indexOf("migrate") >= 0) { const filePaths = @@ -21,7 +21,7 @@ if (process.argv.slice(2).indexOf("init") >= 0) { throw new Error("Please specify a path to your webpack config"); } const inputConfigPath = path.resolve(process.cwd(), filePaths[0]); - + //eslint-disable-next-line return require("../dist/migrate.js")(inputConfigPath, inputConfigPath); } else if (process.argv.slice(2).indexOf("generate-loader") >= 0) { return require("../lib/generate-loader/index.js")(); diff --git a/package-lock.json b/package-lock.json index 3b1a0960b2a..4fd4acd6989 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "abab": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.3.tgz", - "integrity": "sha1-uB3l9ydOxOdW15fNg08wNkJyTl0=", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", + "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=", "dev": true }, "abbrev": { @@ -214,9 +214,9 @@ } }, "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true }, "ast-traverse": { @@ -229,6 +229,12 @@ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.2.tgz", "integrity": "sha1-LMGZedFcZVEIv1ZTI7jn7jh1H2s=" }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, "async": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", @@ -246,9 +252,9 @@ "dev": true }, "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", "dev": true }, "aws4": { @@ -602,6 +608,12 @@ } } }, + "babel-plugin-jest-hoist": { + "version": "21.0.2", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.0.2.tgz", + "integrity": "sha512-iQeYbiM0lr5TCW42qvGkBBoy0rTx6SPppRFT7NwvdnSwNOGMI8+1Oc27SF5wJbCvAY7x5KScP3f0TKtunl+NRw==", + "dev": true + }, "babel-plugin-jscript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/babel-plugin-jscript/-/babel-plugin-jscript-1.0.4.tgz", @@ -1095,6 +1107,15 @@ "babel-plugin-transform-flow-strip-types": "6.22.0" } }, + "babel-preset-jest": { + "version": "21.0.2", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-21.0.2.tgz", + "integrity": "sha512-WyzCFIoU+ga307hPnobHL9eRrZlpZYHQf7M3yOtimAwrLAgNFoSfin7ZVw903+zz81ZLuowZMKWCd0w3PNpAhg==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "21.0.2" + } + }, "babel-preset-stage-1": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", @@ -1247,12 +1268,12 @@ "dev": true }, "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "dev": true, "requires": { - "hoek": "2.16.3" + "hoek": "4.2.0" } }, "brace-expansion": { @@ -1301,12 +1322,6 @@ } } }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, "browserify-aes": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.8.tgz", @@ -1798,12 +1813,23 @@ } }, "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", "dev": true, "requires": { - "boom": "2.10.1" + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "dev": true, + "requires": { + "hoek": "4.2.0" + } + } } }, "crypto-browserify": { @@ -1858,14 +1884,6 @@ "dev": true, "requires": { "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "date-fns": { @@ -2225,40 +2243,16 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", + "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", "dev": true, "requires": { - "esprima": "2.7.3", - "estraverse": "1.9.3", + "esprima": "3.1.3", + "estraverse": "4.2.0", "esutils": "2.0.2", "optionator": "0.8.2", - "source-map": "0.2.0" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true, - "requires": { - "amdefine": "1.0.1" - } - } + "source-map": "0.5.6" } }, "escope": { @@ -2476,9 +2470,9 @@ } }, "exec-sh": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.0.tgz", - "integrity": "sha1-FPdd4/INKG75MwmbLOUKkDWc7xA=", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz", + "integrity": "sha512-aLt95pexaugVtQerpmE51+4QfWrNc304uez7jvj6fWnN8GeEHpttB8F36n8N7uVhUMbH/1enbxQ9HImZ4w/9qg==", "dev": true, "requires": { "merge": "1.2.0" @@ -2528,6 +2522,58 @@ "homedir-polyfill": "1.0.1" } }, + "expect": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-21.1.0.tgz", + "integrity": "sha512-gBmUVy+A4+brj/MnuiwLe+MIMfSffWUmZMNjKHrMkB0cpkAjnFdwHAxs6MvYeh4+14ocp+SfKp4ebNEhkbV3YQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "jest-diff": "21.1.0", + "jest-get-type": "21.0.2", + "jest-matcher-utils": "21.1.0", + "jest-message-util": "21.1.0", + "jest-regex-util": "21.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "jest-matcher-utils": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.1.0.tgz", + "integrity": "sha512-V/Xindf+VY5UM+oz9Nhsv0Ql93lRcKS7tHtVoXtlXkZXoXpydHwuezkLLCpZkH/Uew5y2OyDZpnlxPvEalJZng==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "pretty-format": "21.1.0" + } + }, + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", + "dev": true, + "requires": { + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" + } + } + } + }, "extend": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", @@ -2552,9 +2598,9 @@ } }, "extsprintf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", - "integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, "fast-deep-equal": { @@ -2704,14 +2750,14 @@ "dev": true }, "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", "dev": true, "requires": { "asynckit": "0.4.0", "combined-stream": "1.0.5", - "mime-types": "2.1.15" + "mime-types": "2.1.17" } }, "fs-readdir-recursive": { @@ -3492,14 +3538,6 @@ } } }, - "string_decoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", - "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", - "requires": { - "safe-buffer": "5.0.1" - } - }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -3510,6 +3548,14 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", + "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", + "requires": { + "safe-buffer": "5.0.1" + } + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -3656,14 +3702,6 @@ "dev": true, "requires": { "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "gh-got": { @@ -3791,12 +3829,6 @@ "lodash": "4.17.4" } }, - "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", - "dev": true - }, "growly": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", @@ -3827,31 +3859,19 @@ } }, "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", "dev": true }, "har-validator": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "dev": true, "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" - }, - "dependencies": { - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", - "dev": true, - "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" - } - } + "ajv": "5.2.2", + "har-schema": "2.0.0" } }, "has-ansi": { @@ -3904,23 +3924,17 @@ } }, "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "dev": true, "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.0", + "sntp": "2.0.2" } }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -3932,9 +3946,9 @@ } }, "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==", "dev": true }, "home-or-tmp": { @@ -3969,13 +3983,13 @@ } }, "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.0", + "assert-plus": "1.0.0", + "jsprim": "1.4.1", "sshpk": "1.13.1" } }, @@ -4381,19 +4395,19 @@ "dev": true }, "istanbul-api": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.1.10.tgz", - "integrity": "sha1-8n5ecSXI3hP2qAZhr3j1EuVDmys=", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.1.14.tgz", + "integrity": "sha1-JbxXAffGgMD//5E95G42GaOm5oA=", "dev": true, "requires": { "async": "2.5.0", "fileset": "2.0.3", "istanbul-lib-coverage": "1.1.1", "istanbul-lib-hook": "1.0.7", - "istanbul-lib-instrument": "1.7.3", + "istanbul-lib-instrument": "1.8.0", "istanbul-lib-report": "1.1.1", "istanbul-lib-source-maps": "1.2.1", - "istanbul-reports": "1.1.1", + "istanbul-reports": "1.1.2", "js-yaml": "3.8.4", "mkdirp": "0.5.1", "once": "1.4.0" @@ -4407,6 +4421,27 @@ "requires": { "lodash": "4.17.4" } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.8.0.tgz", + "integrity": "sha1-ZvbJQhzJ7EcE928tsIS6kHiitTI=", + "dev": true, + "requires": { + "babel-generator": "6.25.0", + "babel-template": "6.25.0", + "babel-traverse": "6.25.0", + "babel-types": "6.25.0", + "babylon": "6.18.0", + "istanbul-lib-coverage": "1.1.1", + "semver": "5.3.0" + } } } }, @@ -4472,14 +4507,14 @@ "debug": "2.6.8", "istanbul-lib-coverage": "1.1.1", "mkdirp": "0.5.1", - "rimraf": "2.6.1", + "rimraf": "2.6.2", "source-map": "0.5.6" }, "dependencies": { "rimraf": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", - "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { "glob": "7.1.2" @@ -4488,9 +4523,9 @@ } }, "istanbul-reports": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.1.tgz", - "integrity": "sha512-P8G873A0kW24XRlxHVGhMJBhQ8gWAec+dae7ZxOBzxT4w+a9ATSPvRVK3LB1RAJ9S8bg2tOyWHAGW40Zd2dKfw==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.2.tgz", + "integrity": "sha1-D7Lj9qqZIr085F0F2KtNXo4HvU8=", "dev": true, "requires": { "handlebars": "4.0.10" @@ -4516,483 +4551,628 @@ } }, "jest": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest/-/jest-20.0.4.tgz", - "integrity": "sha1-PdJgwpidba1nix6cxNkZRPbWAqw=", + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-21.1.0.tgz", + "integrity": "sha512-yPxhkAyxCymLkpZakAGm8VGNQB04HgD5bhYCQHBcIGCbH5oYHZDekkt/FBtFC2vPcyWG+dsKCqvmys/1kQYjKA==", + "dev": true, + "requires": { + "jest-cli": "21.1.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "jest-cli": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.1.0.tgz", + "integrity": "sha512-ISnDjHv9m0nCrSKFC+Cnr9SotaWHYRP+TK81vMtPwkV+/70JbfYJT6ZnuqgqyAnTYE4f/aCe6uyMPKHAVT1RpA==", + "dev": true, + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.0.1", + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "is-ci": "1.0.10", + "istanbul-api": "1.1.14", + "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-instrument": "1.7.3", + "istanbul-lib-source-maps": "1.2.1", + "jest-changed-files": "21.1.0", + "jest-config": "21.1.0", + "jest-environment-jsdom": "21.1.0", + "jest-haste-map": "21.1.0", + "jest-message-util": "21.1.0", + "jest-regex-util": "21.1.0", + "jest-resolve-dependencies": "21.1.0", + "jest-runner": "21.1.0", + "jest-runtime": "21.1.0", + "jest-snapshot": "21.1.0", + "jest-util": "21.1.0", + "micromatch": "2.3.11", + "node-notifier": "5.1.2", + "pify": "3.0.0", + "slash": "1.0.0", + "string-length": "2.0.0", + "strip-ansi": "4.0.0", + "which": "1.2.14", + "worker-farm": "1.5.0", + "yargs": "9.0.1" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "jest-changed-files": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-21.1.0.tgz", + "integrity": "sha512-OnjMoORBVG9Jko6Bc3UGJPx9G1PNsETiqpQXZ6wPU3fk1gtxhKYE4Mgdk28ER/CWeg7bzGUcaragLf1lf1tzbQ==", "dev": true, "requires": { - "jest-cli": "20.0.4" + "throat": "4.1.0" } }, "jest-cli": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-20.0.4.tgz", - "integrity": "sha1-5TKxnYiuW8bEF+iwWTpv6VSx3JM=", + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.1.0.tgz", + "integrity": "sha512-ISnDjHv9m0nCrSKFC+Cnr9SotaWHYRP+TK81vMtPwkV+/70JbfYJT6ZnuqgqyAnTYE4f/aCe6uyMPKHAVT1RpA==", "dev": true, "requires": { - "ansi-escapes": "1.4.0", - "callsites": "2.0.0", - "chalk": "1.1.3", + "ansi-escapes": "3.0.0", + "chalk": "2.0.1", + "glob": "7.1.2", "graceful-fs": "4.1.11", "is-ci": "1.0.10", - "istanbul-api": "1.1.10", + "istanbul-api": "1.1.14", "istanbul-lib-coverage": "1.1.1", "istanbul-lib-instrument": "1.7.3", "istanbul-lib-source-maps": "1.2.1", - "jest-changed-files": "20.0.3", - "jest-config": "20.0.4", - "jest-docblock": "20.0.3", - "jest-environment-jsdom": "20.0.3", - "jest-haste-map": "20.0.4", - "jest-jasmine2": "20.0.4", - "jest-message-util": "20.0.3", - "jest-regex-util": "20.0.3", - "jest-resolve-dependencies": "20.0.3", - "jest-runtime": "20.0.4", - "jest-snapshot": "20.0.3", - "jest-util": "20.0.3", + "jest-changed-files": "21.1.0", + "jest-config": "21.1.0", + "jest-environment-jsdom": "21.1.0", + "jest-haste-map": "21.1.0", + "jest-message-util": "21.1.0", + "jest-regex-util": "21.1.0", + "jest-resolve-dependencies": "21.1.0", + "jest-runner": "21.1.0", + "jest-runtime": "21.1.0", + "jest-snapshot": "21.1.0", + "jest-util": "21.1.0", "micromatch": "2.3.11", "node-notifier": "5.1.2", - "pify": "2.3.0", + "pify": "3.0.0", "slash": "1.0.0", - "string-length": "1.0.1", - "throat": "3.2.0", + "string-length": "2.0.0", + "strip-ansi": "4.0.0", "which": "1.2.14", - "worker-farm": "1.4.1", - "yargs": "7.1.0" + "worker-farm": "1.5.0", + "yargs": "9.0.1" }, "dependencies": { - "ansi-styles": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.1.0.tgz", - "integrity": "sha1-CcIC1ckX7CMYjKpcnLkXnNlUd1A=", - "dev": true, - "requires": { - "color-convert": "1.9.0" - } + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true }, - "babel-jest": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-20.0.3.tgz", - "integrity": "sha1-5KA7E9wQOJ4UD8ZF0J/8TO0wFnE=", - "dev": true, - "requires": { - "babel-core": "6.25.0", - "babel-plugin-istanbul": "4.1.4", - "babel-preset-jest": "20.0.3" - } + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, - "babel-plugin-jest-hoist": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-20.0.3.tgz", - "integrity": "sha1-r+3IU70/jcNUjqZx++adA8wsF2c=", + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true }, - "babel-preset-jest": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-20.0.3.tgz", - "integrity": "sha1-y6yq3stdaJyh4d4TYOv8ZoYsF4o=", + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "babel-plugin-jest-hoist": "20.0.3" + "ansi-regex": "3.0.0" } + } + } + }, + "jest-config": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-21.1.0.tgz", + "integrity": "sha512-RQnWwHRSIRvtyJQeZTpXUmsNYVVr/qu3XWfV3FTFkDsxHQi6Sj5sfUK5FHCNUCXIuFTs+r3qbYoMz2q8rdm/EA==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "glob": "7.1.2", + "jest-environment-jsdom": "21.1.0", + "jest-environment-node": "21.1.0", + "jest-get-type": "21.0.2", + "jest-jasmine2": "21.1.0", + "jest-regex-util": "21.1.0", + "jest-resolve": "21.1.0", + "jest-util": "21.1.0", + "jest-validate": "21.1.0", + "pretty-format": "21.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, - "bser": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bser/-/bser-1.0.2.tgz", - "integrity": "sha1-OBEWlwsqbe6lZG3RXdcnhES1YWk=", + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "node-int64": "0.4.0" + "color-convert": "1.9.0" } }, - "callsites": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", - "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", - "dev": true - }, - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - } - } - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "jest-validate": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.1.0.tgz", + "integrity": "sha512-xS0cyErNWpsLFlGkn/b87pk/Mv7J+mCTs8hQ4KmtOIIoM1sHYobXII8AtkoN8FC7E3+Ptxjo+/3xWk6LK1dKcw==", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "leven": "2.1.0", + "pretty-format": "21.1.0" } }, - "jest-changed-files": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-20.0.3.tgz", - "integrity": "sha1-k5TVzGXEOEBhSb7xv01Sto4D4/g=", + "leven": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", "dev": true }, - "jest-config": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-20.0.4.tgz", - "integrity": "sha1-43kwqyIXyRNgXv8T5712PsSPruo=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "glob": "7.1.2", - "jest-environment-jsdom": "20.0.3", - "jest-environment-node": "20.0.3", - "jest-jasmine2": "20.0.4", - "jest-matcher-utils": "20.0.3", - "jest-regex-util": "20.0.3", - "jest-resolve": "20.0.4", - "jest-validate": "20.0.3", - "pretty-format": "20.0.3" - } - }, - "jest-diff": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-20.0.3.tgz", - "integrity": "sha1-gfKI/Z5nXw+yPHXxwrGURf5YZhc=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "diff": "3.3.1", - "jest-matcher-utils": "20.0.3", - "pretty-format": "20.0.3" - } - }, - "jest-environment-jsdom": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-20.0.3.tgz", - "integrity": "sha1-BIqKwS7iJfcZBBdxODS7mZeH3pk=", + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", "dev": true, "requires": { - "jest-mock": "20.0.3", - "jest-util": "20.0.3", - "jsdom": "9.12.0" + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" } + } + } + }, + "jest-diff": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-21.1.0.tgz", + "integrity": "sha512-mGJinKrAB6hj1cpO1FOuDCfgILozGvYi4Zpk8GrxmNgdd9/9llIA2Xzu5879Fa4ayh7lb9ej2NdvuNLMCjbrMg==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "diff": "3.3.1", + "jest-get-type": "21.0.2", + "pretty-format": "21.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, - "jest-environment-node": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-20.0.3.tgz", - "integrity": "sha1-1Ii8RhKvLCRumG6K52caCZFj1AM=", + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "jest-mock": "20.0.3", - "jest-util": "20.0.3" + "color-convert": "1.9.0" } }, - "jest-haste-map": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-20.0.4.tgz", - "integrity": "sha1-ZT61XIic48Ah97lGk/IKQVm63wM=", + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", "dev": true, "requires": { - "fb-watchman": "2.0.0", - "graceful-fs": "4.1.11", - "jest-docblock": "20.0.3", - "micromatch": "2.3.11", - "sane": "1.6.0", - "worker-farm": "1.4.1" + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" } + } + } + }, + "jest-docblock": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.1.0.tgz", + "integrity": "sha512-ai3olFJ/3cSd60klaRIcC/Cb44/RsJ69qS8uXxfWXEbnbDqjcbl5K8Z5ekfY15hgVZGSAiLz7pOwfjIBE/yJVw==", + "dev": true + }, + "jest-environment-jsdom": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-21.1.0.tgz", + "integrity": "sha512-sMcGlN11SnnuJKzR5oJ5LsDRzHEBLUeMRImDbvxyusNW9l17wAEsoLuAWbv0W8crZTTwjRO6/mitpNF3PmVsMg==", + "dev": true, + "requires": { + "jest-mock": "21.1.0", + "jest-util": "21.1.0", + "jsdom": "9.12.0" + } + }, + "jest-environment-node": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-21.1.0.tgz", + "integrity": "sha512-Lv/pcK2zq2DZKL/q7+u8mrlSeXmaMGgmJOx0+Ew+FxYKdSzO0jpEUTEfzQOnMvpSWMqjKUYLDYkCPCBFcOX93w==", + "dev": true, + "requires": { + "jest-mock": "21.1.0", + "jest-util": "21.1.0" + } + }, + "jest-get-type": { + "version": "21.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-21.0.2.tgz", + "integrity": "sha512-4KvNzzXMXeapGaMWd+SL5e47zcMn8KTWjom6Fl3avxVXnbKS7abD1p4xWe4ToAZfgNoYNsQ9Av/mnWMnZK/Z4A==", + "dev": true + }, + "jest-haste-map": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-21.1.0.tgz", + "integrity": "sha512-a7chVtmpzRgRkYDL4eZgRuXZUlos1JOC7Dam3WryXGiD/1GNj+QONt6jcsAzDZohzs9XYg2EkjyGxIAXcNipBg==", + "dev": true, + "requires": { + "fb-watchman": "2.0.0", + "graceful-fs": "4.1.11", + "jest-docblock": "21.1.0", + "micromatch": "2.3.11", + "sane": "2.2.0", + "worker-farm": "1.5.0" + } + }, + "jest-jasmine2": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-21.1.0.tgz", + "integrity": "sha512-YjbAaXN6K5f8rtwPVxkMRIYNZGB5GiJcApcj/5ER7uGJrqJMqyCklMAPZR5Gq8XPzzuDVfoB2h7kxyOGVqaxrw==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "expect": "21.1.0", + "graceful-fs": "4.1.11", + "jest-diff": "21.1.0", + "jest-matcher-utils": "21.1.0", + "jest-message-util": "21.1.0", + "jest-snapshot": "21.1.0", + "p-cancelable": "0.3.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, - "jest-jasmine2": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-20.0.4.tgz", - "integrity": "sha1-/MWxQReA2RHQQpAu8YWehS5g1eE=", + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "chalk": "1.1.3", - "graceful-fs": "4.1.11", - "jest-diff": "20.0.3", - "jest-matcher-utils": "20.0.3", - "jest-matchers": "20.0.3", - "jest-message-util": "20.0.3", - "jest-snapshot": "20.0.3", - "once": "1.4.0", - "p-map": "1.1.1" + "color-convert": "1.9.0" } }, "jest-matcher-utils": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz", - "integrity": "sha1-s6a443yld4A7CDKpixZPRLeBVhI=", + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.1.0.tgz", + "integrity": "sha512-V/Xindf+VY5UM+oz9Nhsv0Ql93lRcKS7tHtVoXtlXkZXoXpydHwuezkLLCpZkH/Uew5y2OyDZpnlxPvEalJZng==", "dev": true, "requires": { - "chalk": "1.1.3", - "pretty-format": "20.0.3" + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "pretty-format": "21.1.0" } }, - "jest-matchers": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-matchers/-/jest-matchers-20.0.3.tgz", - "integrity": "sha1-ymnbHDLbWm9wf6XgQBq7VXAN/WA=", + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", "dev": true, "requires": { - "jest-diff": "20.0.3", - "jest-matcher-utils": "20.0.3", - "jest-message-util": "20.0.3", - "jest-regex-util": "20.0.3" + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" } - }, - "jest-message-util": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-20.0.3.tgz", - "integrity": "sha1-auwoRDBvyw5udNV5bBAG2W/dgxw=", + } + } + }, + "jest-matcher-utils": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz", + "integrity": "sha1-s6a443yld4A7CDKpixZPRLeBVhI=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "pretty-format": "20.0.3" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "chalk": "1.1.3", - "micromatch": "2.3.11", - "slash": "1.0.0" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, - "jest-mock": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-20.0.3.tgz", - "integrity": "sha1-i8Bw6QQUqhVcEajWTIaaDVxx2lk=", + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true - }, - "jest-regex-util": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-20.0.3.tgz", - "integrity": "sha1-hburXRM+RGJbGfr4xqpRItCF12I=", + } + } + }, + "jest-message-util": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-21.1.0.tgz", + "integrity": "sha512-BwKrjR4HvGoodYw3PFh95IU4qDk3nVOf3LqOKRaaR6486bJM8IZIlxWR8yfxhAN7nDGBDco/TR+U50WcPgzvgA==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "micromatch": "2.3.11", + "slash": "1.0.0" + } + }, + "jest-mock": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-21.1.0.tgz", + "integrity": "sha512-iwING4rMP1rhepAj/MVPHVxGltwwR+Lfmiy9ARevQ7XDZ/zF7h+KPFeOFMSMGvV5/dS05PHhwRjFzrjvkybNLw==", + "dev": true + }, + "jest-regex-util": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-21.1.0.tgz", + "integrity": "sha512-1QiJa6nvdzVgDhY1FTG3fl+2eYrCQGQoIeGaVPjt9+VmxsQ/BwZD6aglH0z6ZK/uEXZPAaj1XaemKM9tC6VVlQ==", + "dev": true + }, + "jest-resolve": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-21.1.0.tgz", + "integrity": "sha512-HKh0pnf2SwR3hDaToONjHrR9ds282QFkxCA9xMet3JpsdLL24oRYMLSQ7jtepZfA6EP+XycRE6RfcMBD8emetg==", + "dev": true, + "requires": { + "browser-resolve": "1.11.2", + "chalk": "2.0.1", + "is-builtin-module": "1.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-21.1.0.tgz", + "integrity": "sha512-Xj0mzS+Gh6ERgf9ofr5/vuqtyvTh4pAp4aVe6OkiZ4cLxUl6zQ6wByXMX0CLq0hwojFYmwwt+v3+fOAV7PqHPg==", + "dev": true, + "requires": { + "jest-regex-util": "21.1.0" + } + }, + "jest-runner": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-21.1.0.tgz", + "integrity": "sha512-EXFqEQRHSo6ksBrT+vRNoBRfIVVepQF56JfTczzXLs+dIKcq3DDKaiMkkehBc2LdHzm/e63qbhz2aeQn64qqlA==", + "dev": true, + "requires": { + "jest-config": "21.1.0", + "jest-docblock": "21.1.0", + "jest-haste-map": "21.1.0", + "jest-jasmine2": "21.1.0", + "jest-message-util": "21.1.0", + "jest-runtime": "21.1.0", + "jest-util": "21.1.0", + "pify": "3.0.0", + "throat": "4.1.0", + "worker-farm": "1.5.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true - }, - "jest-resolve": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-20.0.4.tgz", - "integrity": "sha1-lEiz6La6/BVHlETGSZBFt//ll6U=", - "dev": true, - "requires": { - "browser-resolve": "1.11.2", - "is-builtin-module": "1.0.0", - "resolve": "1.3.3" - } - }, - "jest-resolve-dependencies": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-20.0.3.tgz", - "integrity": "sha1-bhSntxevDyyzZnxUneQK8Bexcjo=", - "dev": true, - "requires": { - "jest-regex-util": "20.0.3" - } - }, - "jest-runtime": { - "version": "20.0.4", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-20.0.4.tgz", - "integrity": "sha1-osgCIZxCA/dU3xQE5JAYYWnRJNg=", + } + } + }, + "jest-runtime": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-21.1.0.tgz", + "integrity": "sha512-BNc1v8Cs6bjnti1JBCSGIJdSI/6MIGMMCiY+MpoyWXhoZGNLkUKGw7073lZtOo0PC/RZcXMDy1DcZXHH7YHKQw==", + "dev": true, + "requires": { + "babel-core": "6.25.0", + "babel-jest": "21.0.2", + "babel-plugin-istanbul": "4.1.4", + "chalk": "2.0.1", + "convert-source-map": "1.5.0", + "graceful-fs": "4.1.11", + "jest-config": "21.1.0", + "jest-haste-map": "21.1.0", + "jest-regex-util": "21.1.0", + "jest-resolve": "21.1.0", + "jest-util": "21.1.0", + "json-stable-stringify": "1.0.1", + "micromatch": "2.3.11", + "slash": "1.0.0", + "strip-bom": "3.0.0", + "write-file-atomic": "2.3.0", + "yargs": "9.0.1" + }, + "dependencies": { + "babel-jest": { + "version": "21.0.2", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-21.0.2.tgz", + "integrity": "sha512-7nF+URWcIVX3A9DiLRcuwq86a+Phl+wXN/fwlSO4boTP/GmLLVyIQTui3th7tbA8F3L5xkYEO0e3NSf7oB/BJQ==", "dev": true, "requires": { - "babel-core": "6.25.0", - "babel-jest": "20.0.3", "babel-plugin-istanbul": "4.1.4", - "chalk": "1.1.3", - "convert-source-map": "1.5.0", - "graceful-fs": "4.1.11", - "jest-config": "20.0.4", - "jest-haste-map": "20.0.4", - "jest-regex-util": "20.0.3", - "jest-resolve": "20.0.4", - "jest-util": "20.0.3", - "json-stable-stringify": "1.0.1", - "micromatch": "2.3.11", - "strip-bom": "3.0.0", - "yargs": "7.1.0" - } - }, - "jest-snapshot": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-20.0.3.tgz", - "integrity": "sha1-W4R+GtsaTZCFKn+fElCG4YfHZWY=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "jest-diff": "20.0.3", - "jest-matcher-utils": "20.0.3", - "jest-util": "20.0.3", - "natural-compare": "1.4.0", - "pretty-format": "20.0.3" + "babel-preset-jest": "21.0.2" } }, - "jest-util": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-20.0.3.tgz", - "integrity": "sha1-DAf32A2C9OWmfG+LnD/n9lz9Mq0=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "graceful-fs": "4.1.11", - "jest-message-util": "20.0.3", - "jest-mock": "20.0.3", - "jest-validate": "20.0.3", - "leven": "2.1.0", - "mkdirp": "0.5.1" - } - }, - "jest-validate": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-20.0.3.tgz", - "integrity": "sha1-0M/R3k9XnymEhJJcKA+PHZTsPKs=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "jest-matcher-utils": "20.0.3", - "leven": "2.1.0", - "pretty-format": "20.0.3" - } - }, - "leven": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", - "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", - "dev": true - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, - "pretty-format": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-20.0.3.tgz", - "integrity": "sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ=", + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", "dev": true, "requires": { - "ansi-regex": "2.1.1", - "ansi-styles": "3.1.0" - } - }, - "sane": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/sane/-/sane-1.6.0.tgz", - "integrity": "sha1-lhDEUjB6E10pwf3+JUcDQYDEZ3U=", - "dev": true, - "requires": { - "anymatch": "1.3.0", - "exec-sh": "0.2.0", - "fb-watchman": "1.9.2", - "minimatch": "3.0.4", - "minimist": "1.2.0", - "walker": "1.0.7", - "watch": "0.10.0" - }, - "dependencies": { - "fb-watchman": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-1.9.2.tgz", - "integrity": "sha1-okz0eCf4LTj7Waaa1wt247auc4M=", - "dev": true, - "requires": { - "bser": "1.0.2" - } - } + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "signal-exit": "3.0.2" } - }, - "strip-bom": { + } + } + }, + "jest-snapshot": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-21.1.0.tgz", + "integrity": "sha512-oYASKqxO/Ghbdd96z/3KSQ1y4YUtqrQVzSKbnz3yjGsi1nu3AXMPmjRCM/CZXL+H+DAIgMirj5Uq0dZOxo6Bnw==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "jest-diff": "21.1.0", + "jest-matcher-utils": "21.1.0", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "pretty-format": "21.1.0" + }, + "dependencies": { + "ansi-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } }, - "yargs": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", - "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "jest-matcher-utils": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.1.0.tgz", + "integrity": "sha512-V/Xindf+VY5UM+oz9Nhsv0Ql93lRcKS7tHtVoXtlXkZXoXpydHwuezkLLCpZkH/Uew5y2OyDZpnlxPvEalJZng==", "dev": true, "requires": { - "camelcase": "3.0.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "1.4.0", - "read-pkg-up": "1.0.1", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "1.0.2", - "which-module": "1.0.0", - "y18n": "3.2.1", - "yargs-parser": "5.0.0" + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "pretty-format": "21.1.0" } }, - "yargs-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", - "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", "dev": true, "requires": { - "camelcase": "3.0.0" + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" } } } }, - "jest-docblock": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-20.0.3.tgz", - "integrity": "sha1-F76phDQswz2DxQ++FUXqDvqkRxI=", - "dev": true - }, - "jest-matcher-utils": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz", - "integrity": "sha1-s6a443yld4A7CDKpixZPRLeBVhI=", + "jest-util": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-21.1.0.tgz", + "integrity": "sha512-PJxaShBieLpB55NV4+loIZHiOlfZHjAGzVRp9BDzrr2m70UxQViDJenNdz4edJMWXJLjp817t1QrWi+LjcRaKw==", "dev": true, "requires": { - "chalk": "1.1.3", - "pretty-format": "20.0.3" + "callsites": "2.0.0", + "chalk": "2.0.1", + "graceful-fs": "4.1.11", + "jest-message-util": "21.1.0", + "jest-mock": "21.1.0", + "jest-validate": "21.1.0", + "mkdirp": "0.5.1" }, "dependencies": { - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "color-convert": "1.9.0" } }, - "supports-color": { + "callsites": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + }, + "jest-validate": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.1.0.tgz", + "integrity": "sha512-xS0cyErNWpsLFlGkn/b87pk/Mv7J+mCTs8hQ4KmtOIIoM1sHYobXII8AtkoN8FC7E3+Ptxjo+/3xWk6LK1dKcw==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "jest-get-type": "21.0.2", + "leven": "2.1.0", + "pretty-format": "21.1.0" + } + }, + "leven": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", "dev": true + }, + "pretty-format": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.1.0.tgz", + "integrity": "sha512-041BVxr2pp7uGG8slfw43ysRXSaBIVqo5Li03BwI3K1/9oENlhkEEYWPkHpDzj7NlJ3GZte+Tv/DId5g2PLduA==", + "dev": true, + "requires": { + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" + } } } }, @@ -5282,22 +5462,22 @@ "integrity": "sha1-6MVG//ywbADUgzyoRBD+1/igl9Q=", "dev": true, "requires": { - "abab": "1.0.3", + "abab": "1.0.4", "acorn": "4.0.13", "acorn-globals": "3.1.0", "array-equal": "1.0.0", "content-type-parser": "1.0.1", "cssom": "0.3.2", "cssstyle": "0.2.37", - "escodegen": "1.8.1", + "escodegen": "1.9.0", "html-encoding-sniffer": "1.0.1", - "nwmatcher": "1.4.1", + "nwmatcher": "1.4.2", "parse5": "1.5.1", - "request": "2.81.0", + "request": "2.82.0", "sax": "1.2.4", "symbol-tree": "3.2.2", - "tough-cookie": "2.3.2", - "webidl-conversions": "4.0.1", + "tough-cookie": "2.3.3", + "webidl-conversions": "4.0.2", "whatwg-encoding": "1.0.1", "whatwg-url": "4.8.0", "xml-name-validator": "2.0.1" @@ -5338,12 +5518,6 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", @@ -5355,23 +5529,15 @@ "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" }, "jsprim": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", - "integrity": "sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg=", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", "dev": true, "requires": { "assert-plus": "1.0.0", - "extsprintf": "1.0.2", + "extsprintf": "1.3.0", "json-schema": "0.2.3", - "verror": "1.3.6" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "verror": "1.10.0" } }, "kind-of": { @@ -5670,74 +5836,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true, - "requires": { - "lodash._basecopy": "3.0.1", - "lodash.keys": "3.1.2" - } - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true, - "requires": { - "lodash._baseassign": "3.2.0", - "lodash._basecreate": "3.0.3", - "lodash._isiterateecall": "3.0.9" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true, - "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" - } - }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -6054,18 +6152,18 @@ } }, "mime-db": { - "version": "1.27.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz", - "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=", + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", "dev": true }, "mime-types": { - "version": "2.1.15", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", - "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", "dev": true, "requires": { - "mime-db": "1.27.0" + "mime-db": "1.30.0" } }, "mimic-fn": { @@ -6109,66 +6207,6 @@ "minimist": "0.0.8" } }, - "mocha": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", - "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", - "dev": true, - "requires": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.8", - "diff": "3.2.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", - "he": "1.1.1", - "json3": "3.3.2", - "lodash.create": "3.1.1", - "mkdirp": "0.5.1", - "supports-color": "3.1.2" - }, - "dependencies": { - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true, - "requires": { - "graceful-readlink": "1.0.1" - } - }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true - }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "dev": true, - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "dev": true, - "requires": { - "has-flag": "1.0.0" - } - } - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -6252,7 +6290,7 @@ "requires": { "growly": "1.3.0", "semver": "5.3.0", - "shellwords": "0.1.0", + "shellwords": "0.1.1", "which": "1.2.14" } }, @@ -6349,9 +6387,9 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "nwmatcher": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.1.tgz", - "integrity": "sha1-eumwew6oBNt+JfBctf5Al9TklJ8=", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.2.tgz", + "integrity": "sha512-QMkCGQFYp5p+zwU3INntLmz1HMfSx9dMVJMYKmE1yuSf/22Wjo6VPFa405mCLUuQn9lbQvH2DZN9lt10ZNvtAg==", "dev": true }, "oauth-sign": { @@ -6643,9 +6681,9 @@ } }, "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, "pify": { @@ -7039,9 +7077,9 @@ "integrity": "sha1-3QG6ydBtMObyGa7LglPunr3DCPE=" }, "qs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", "dev": true }, "querystring": { @@ -7350,31 +7388,31 @@ "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=" }, "request": { - "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", + "version": "2.82.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.82.0.tgz", + "integrity": "sha512-/QWqfmyTfQ4OYs6EhB1h2wQsX9ZxbuNePCvCm0Mdz/mxw73mjdg0D4QdIl0TQBFs35CZmMXLjk0iCGK395CUDg==", "dev": true, "requires": { - "aws-sign2": "0.6.0", + "aws-sign2": "0.7.0", "aws4": "1.6.0", "caseless": "0.12.0", "combined-stream": "1.0.5", "extend": "3.0.1", "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", + "form-data": "2.3.1", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", - "mime-types": "2.1.15", + "mime-types": "2.1.17", "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", + "performance-now": "2.1.0", + "qs": "6.5.1", "safe-buffer": "5.1.1", "stringstream": "0.0.5", - "tough-cookie": "2.3.2", + "tough-cookie": "2.3.3", "tunnel-agent": "0.6.0", "uuid": "3.1.0" } @@ -7552,6 +7590,30 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, + "sane": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/sane/-/sane-2.2.0.tgz", + "integrity": "sha512-OSJxhHO0CgPUw3lUm3GhfREAfza45smvEI9ozuFrxKG10GHVo0ryW9FK5VYlLvxj0SV7HVKHW0voYJIRu27GWg==", + "dev": true, + "requires": { + "anymatch": "1.3.0", + "exec-sh": "0.2.1", + "fb-watchman": "2.0.0", + "fsevents": "1.1.2", + "minimatch": "3.0.4", + "minimist": "1.2.0", + "walker": "1.0.7", + "watch": "0.18.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", @@ -7615,9 +7677,9 @@ } }, "shellwords": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.0.tgz", - "integrity": "sha1-Zq/Ue2oSky2Qccv9mKUueFzQuhQ=", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", "dev": true }, "should": { @@ -7705,12 +7767,12 @@ "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=" }, "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz", + "integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=", "dev": true, "requires": { - "hoek": "2.16.3" + "hoek": "4.2.0" } }, "source-list-map": { @@ -7778,14 +7840,6 @@ "getpass": "0.1.7", "jsbn": "0.1.1", "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "stable": { @@ -7825,21 +7879,31 @@ "resolved": "https://registry.npmjs.org/stream-to-observable/-/stream-to-observable-0.1.0.tgz", "integrity": "sha1-Rb8dny19wJvtgfHDB8Qw5ouEz/4=" }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "requires": { - "safe-buffer": "5.1.1" - } - }, "string-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-1.0.1.tgz", - "integrity": "sha1-VpcPscOFWOnnC3KL894mmsRa36w=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", + "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", "dev": true, "requires": { - "strip-ansi": "3.0.1" + "astral-regex": "1.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } } }, "string-template": { @@ -7857,6 +7921,14 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "5.1.1" + } + }, "stringify-object": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.2.0.tgz", @@ -8074,9 +8146,9 @@ "integrity": "sha1-G+DcKg3CRNRL6KCa9qha+5PE28M=" }, "throat": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/throat/-/throat-3.2.0.tgz", - "integrity": "sha512-/EY8VpvlqJ+sFtLPeOgc8Pl7kQVOWv0woD87KTXVHPIAE842FGT+rokxIhe8xIUP1cfgrkt0as0vDLjDiMtr8w==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", + "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", "dev": true }, "through": { @@ -8131,9 +8203,9 @@ "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=" }, "tough-cookie": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", - "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", "dev": true, "requires": { "punycode": "1.4.1" @@ -8353,12 +8425,14 @@ } }, "verror": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", - "integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "extsprintf": "1.0.2" + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" } }, "vinyl": { @@ -8408,10 +8482,22 @@ } }, "watch": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/watch/-/watch-0.10.0.tgz", - "integrity": "sha1-d3mLLaD5kQ1ZXxrOWwwiWFIfIdw=", - "dev": true + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/watch/-/watch-0.18.0.tgz", + "integrity": "sha1-KAlUdsbffJDJYxOJkMClQj60uYY=", + "dev": true, + "requires": { + "exec-sh": "0.2.1", + "minimist": "1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } }, "watchpack": { "version": "1.4.0", @@ -8434,9 +8520,9 @@ } }, "webidl-conversions": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.1.tgz", - "integrity": "sha1-gBWherg+fhsxFjhIas6B2mziBqA=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", "dev": true }, "webpack": { @@ -8742,12 +8828,6 @@ "isexe": "2.0.0" } }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", - "dev": true - }, "window-size": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", @@ -8759,9 +8839,9 @@ "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=" }, "worker-farm": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.4.1.tgz", - "integrity": "sha512-tgFAtgOYLPutkAyzgpS6VJFL5HY+0ui1Tvua+fITgz8ByaJTMFGtazR6xxQfwfiAcbwE+2fLG/K49wc2TfwCNw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.0.tgz", + "integrity": "sha512-DHRiUggxtbruaTwnLDm2/BRDKZIoOYvrgYUj5Bam4fU6Gtvc0FaEyoswFPBjMXAweGW2H4BDNIpy//1yXXuaqQ==", "dev": true, "requires": { "errno": "0.1.4", diff --git a/package.json b/package.json index cd39df12a46..6587f565497 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "scripts": { "lint": "eslint \"**/*.js\"", "format": "prettier-eslint \"bin/**/**/*.js\" --write && prettier-eslint \"lib/**/**/*.js\" --write && prettier-eslint \"test/**/**/*.js\" --write", - "test:cli": "mocha test/*.test.js --max-old-space-size=4096 --harmony --check-leaks", "lint:codeOnly": "eslint \"{lib,bin,__mocks__}/**/!(__testfixtures__)/*.js\" \"{lib,bin,__mocks__}/**.js\"", "precommit": "lint-staged", "prepublish": "flow-remove-types lib/ -d dist/", @@ -32,7 +31,8 @@ ] }, "jest": { - "testEnvironment": "node" + "testEnvironment": "node", + "modulePathIgnorePatterns": ["dist"] }, "dependencies": { "babel-code-frame": "^6.22.0", @@ -80,10 +80,9 @@ "flow-bin": "^0.49.1", "flow-remove-types": "^1.2.1", "husky": "^0.14.3", - "jest": "^20.0.4", - "jest-cli": "^20.0.4", + "jest": "^21.1.0", + "jest-cli": "^21.1.0", "lint-staged": "^4.1.3", - "mocha": "^3.5.3", "prettier-eslint-cli": "^4.3.2", "should": "^13.1.0" } diff --git a/test/BinTestCases.test.js b/test/BinTestCases.test.js index 5bb0bbdda8d..6cc26058277 100644 --- a/test/BinTestCases.test.js +++ b/test/BinTestCases.test.js @@ -1,7 +1,6 @@ /* globals describe it before */ "use strict"; -const should = require("should"); const path = require("path"); const fs = require("fs"); const spawn = require("child_process").spawn; @@ -52,7 +51,7 @@ describe("BinTestCases", function() { category.tests.forEach(function(testName) { const testDirectory = path.join(casesPath, category.name, testName); const testArgs = getTestSpecificArguments(testDirectory) || defaultArgs; - const testAssertions = require(path.join(testDirectory, "test.js")); + const testAssertions = require(path.join(testDirectory, "stdin.js")); const outputPath = path.join( path.resolve(casesPath, "../js/bin"), category.name, @@ -74,8 +73,8 @@ describe("BinTestCases", function() { if (asyncExists) { describe(testName, function() { - it("should run successfully", function(done) { - this.timeout(10000); + test("should run successfully", function(done) { + jest.setTimeout(10000); const child = spawn(process.execPath, [cmd].concat(args), opts); child.on("close", function(code) { env.code = code; @@ -106,8 +105,8 @@ describe("BinTestCases", function() { }); } else { describe(testName, function() { - before(function(done) { - this.timeout(20000); + beforeEach(function(done) { + jest.setTimeout(20000); const child = spawn(process.execPath, [cmd].concat(args), opts); @@ -129,11 +128,11 @@ describe("BinTestCases", function() { }); }); - it("should not cause any errors", function() { - should(env.error).be.empty(); + test("should not cause any errors", function() { + expect(env.error).toHaveLength(0); }); - it("should run successfully", function() { + test("should run successfully", function() { const stdout = convertToArrayOfLines(env.stdout); const stderr = convertToArrayOfLines(env.stderr); testAssertions(env.code, stdout, stderr); diff --git a/test/binCases/config-name/found-many/stdin.js b/test/binCases/config-name/found-many/stdin.js new file mode 100644 index 00000000000..85cc3132e37 --- /dev/null +++ b/test/binCases/config-name/found-many/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[7]).toContain('./index2.js'); + expect(stdout[7]).toContain('./index2.js'); + expect(stdout[13]).toContain('./index3.js'); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/config-name/found-many/test.js b/test/binCases/config-name/found-many/test.js deleted file mode 100644 index c4af6f45db6..00000000000 --- a/test/binCases/config-name/found-many/test.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - stdout.should.be.ok(); - stdout[7].should.containEql("./index2.js"); - stdout[13].should.containEql("./index3.js"); - stderr.should.be.empty(); -}; diff --git a/test/binCases/config-name/found-one/stdin.js b/test/binCases/config-name/found-one/stdin.js new file mode 100644 index 00000000000..11b81e410d6 --- /dev/null +++ b/test/binCases/config-name/found-one/stdin.js @@ -0,0 +1,9 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + + expect(stdout[5]).toContain("./index2.js"); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/config-name/found-one/test.js b/test/binCases/config-name/found-one/test.js deleted file mode 100644 index 373fd876c4c..00000000000 --- a/test/binCases/config-name/found-one/test.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[5].should.containEql("./index2.js"); - stderr.should.be.empty(); -}; diff --git a/test/binCases/config-name/not-found/stdin.js b/test/binCases/config-name/not-found/stdin.js new file mode 100644 index 00000000000..fec19b5be2d --- /dev/null +++ b/test/binCases/config-name/not-found/stdin.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).not.toBe(0); + expect(stdout).toHaveLength(0); + expect(stderr[0]).toContain("Configuration with name 'foo' was not found."); +}; diff --git a/test/binCases/config-name/not-found/test.js b/test/binCases/config-name/not-found/test.js deleted file mode 100644 index ccf5c59f0b6..00000000000 --- a/test/binCases/config-name/not-found/test.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.not.eql(0); - stdout.should.be.empty(); - stderr[0].should.containEql("Configuration with name 'foo' was not found."); -}; diff --git a/test/binCases/configFile/profile/stdin.js b/test/binCases/configFile/profile/stdin.js new file mode 100644 index 00000000000..100438d3af6 --- /dev/null +++ b/test/binCases/configFile/profile/stdin.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + + expect(stdout[6]).toContain("factory:"); + expect(stdout[8]).toContain("factory:"); + expect(stdout[10]).toContain("factory:"); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/configFile/profile/test.js b/test/binCases/configFile/profile/test.js deleted file mode 100644 index ee830f33d11..00000000000 --- a/test/binCases/configFile/profile/test.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[6].should.containEql("factory:"); - stdout[8].should.containEql("factory:"); - stdout[10].should.containEql("factory:"); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/entry/multi-file/stdin.js b/test/binCases/entry/multi-file/stdin.js new file mode 100644 index 00000000000..d6a349eeea3 --- /dev/null +++ b/test/binCases/entry/multi-file/stdin.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[4]).toContain("null.js"); + expect(stdout[5]).toMatch(/multi.*index\.js.*a\.js/); // should have multi-file entry + expect(stdout[6]).toMatch(/index\.js.*\{0\}/); + expect(stdout[7]).toMatch(/a\.js.*\{0\}/); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/entry/multi-file/test.js b/test/binCases/entry/multi-file/test.js deleted file mode 100644 index cfa1ff6d584..00000000000 --- a/test/binCases/entry/multi-file/test.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[4].should.containEql("null.js"); - stdout[5].should.match(/multi.*index\.js.*a\.js/); // should have multi-file entry - stdout[6].should.match(/index\.js.*\{0\}/); - stdout[7].should.match(/a\.js.*\{0\}/); - stderr.should.be.empty(); -}; diff --git a/test/binCases/entry/named-entry/stdin.js b/test/binCases/entry/named-entry/stdin.js new file mode 100644 index 00000000000..92d7807231c --- /dev/null +++ b/test/binCases/entry/named-entry/stdin.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[4]).toContain("null.js"); + expect(stdout[5]).toContain("foo.js"); // named entry from --entry foo=./a.js + expect(stdout[6]).toMatch(/a\.js.*\{1\}/); + expect(stdout[7]).toMatch(/index\.js.*\{0\}/); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/entry/named-entry/test.js b/test/binCases/entry/named-entry/test.js deleted file mode 100644 index 4c62f985eb6..00000000000 --- a/test/binCases/entry/named-entry/test.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[4].should.containEql("null.js"); - stdout[5].should.containEql("foo.js"); // named entry from --entry foo=./a.js - stdout[6].should.match(/a\.js.*\{1\}/); - stdout[7].should.match(/index\.js.*\{0\}/); - stderr.should.be.empty(); -}; diff --git a/test/binCases/entry/non-hyphenated-args/stdin.js b/test/binCases/entry/non-hyphenated-args/stdin.js new file mode 100644 index 00000000000..3512125c6f8 --- /dev/null +++ b/test/binCases/entry/non-hyphenated-args/stdin.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[4]).toContain("null.js"); + expect(stdout[5]).toContain("main.js"); // non-hyphenated arg ./a.js should create chunk "main" + expect(stdout[6]).toMatch(/index\.js.*\{0\}/); // index.js should be in chunk 0 + expect(stdout[7]).toMatch(/a\.js.*\{1\}/); // a.js should be in chunk 1 + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/entry/non-hyphenated-args/test.js b/test/binCases/entry/non-hyphenated-args/test.js deleted file mode 100644 index 0e1ae1ce1ff..00000000000 --- a/test/binCases/entry/non-hyphenated-args/test.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[4].should.containEql("null.js"); - stdout[5].should.containEql("main.js"); // non-hyphenated arg ./a.js should create chunk "main" - stdout[6].should.match(/index\.js.*\{0\}/); // index.js should be in chunk 0 - stdout[7].should.match(/a\.js.*\{1\}/); // a.js should be in chunk 1 - stderr.should.be.empty(); -}; diff --git a/test/binCases/errors/issue-5576/stdin.js b/test/binCases/errors/issue-5576/stdin.js new file mode 100644 index 00000000000..577ec2f6887 --- /dev/null +++ b/test/binCases/errors/issue-5576/stdin.js @@ -0,0 +1,13 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(2); + expect(stdout[0]).toContain("Hash: "); + expect(stdout[1]).toContain("Version: "); + expect(stdout[2]).toContain("Time: "); + expect(stdout[4]).toContain( + "ERROR in Entry module not found: Error: Can't resolve" + ); + + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/errors/issue-5576/test.js b/test/binCases/errors/issue-5576/test.js deleted file mode 100644 index bd4db65fd62..00000000000 --- a/test/binCases/errors/issue-5576/test.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(2); - - stdout[0].should.containEql("Hash: "); - stdout[1].should.containEql("Version: "); - stdout[2].should.containEql("Time: "); - stdout[4].should.containEql( - "ERROR in Entry module not found: Error: Can't resolve" - ); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/errors/parse/stdin.js b/test/binCases/errors/parse/stdin.js new file mode 100644 index 00000000000..158648c5e46 --- /dev/null +++ b/test/binCases/errors/parse/stdin.js @@ -0,0 +1,16 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(2); + expect(stdout[0]).toContain("Hash: "); + expect(stdout[1]).toContain("Version: "); + expect(stdout[2]).toContain("Time: "); + expect(stdout[5]).toContain("./index.js"); + expect(stdout[5]).toContain("[built]"); + expect(stdout[5]).toContain("[failed]"); + expect(stdout[5]).toContain("[1 error]"); + expect(stdout[7]).toContain("ERROR in ./index.js"); + expect(stdout[8]).toContain("Module parse failed:"); + + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/errors/parse/test.js b/test/binCases/errors/parse/test.js deleted file mode 100644 index 122ab47b45b..00000000000 --- a/test/binCases/errors/parse/test.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(2); - - stdout[0].should.containEql("Hash: "); - stdout[1].should.containEql("Version: "); - stdout[2].should.containEql("Time: "); - stdout[5].should.containEql("./index.js"); - stdout[5].should.containEql("[built]"); - stdout[5].should.containEql("[failed]"); - stdout[5].should.containEql("[1 error]"); - stdout[7].should.containEql("ERROR in ./index.js"); - stdout[8].should.containEql("Module parse failed:"); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/help/help-output/stdin.js b/test/binCases/help/help-output/stdin.js new file mode 100644 index 00000000000..602c1914075 --- /dev/null +++ b/test/binCases/help/help-output/stdin.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toMatch(/webpack/); + expect(stdout).toContain("Config options:"); + expect(stdout).toContain("Basic options:"); + expect(stdout).toContain("Module options:"); + expect(stdout).toContain("Output options:"); + expect(stdout).toContain("Advanced options:"); + expect(stdout).toContain("Resolving options:"); + expect(stdout).toContain("Optimizing options:"); + expect(stdout).toContain("Stats options:"); + expect(stdout).toContain("Options:"); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/help/help-output/test.js b/test/binCases/help/help-output/test.js deleted file mode 100644 index 895d915c23e..00000000000 --- a/test/binCases/help/help-output/test.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[0].should.startWith("webpack"); - stdout.should.containEql("Config options:"); - stdout.should.containEql("Basic options:"); - stdout.should.containEql("Module options:"); - stdout.should.containEql("Output options:"); - stdout.should.containEql("Advanced options:"); - stdout.should.containEql("Resolving options:"); - stdout.should.containEql("Optimizing options:"); - stdout.should.containEql("Stats options:"); - stdout.should.containEql("Options:"); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/module/module-bind/stdin.js b/test/binCases/module/module-bind/stdin.js new file mode 100644 index 00000000000..53abdd0f535 --- /dev/null +++ b/test/binCases/module/module-bind/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + + expect(stdout).toEqual(expect.anything()); + expect(stdout).toContain("pre-loaded pre"); + expect(stdout).toContain("post-loaded post"); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/module/module-bind/test.js b/test/binCases/module/module-bind/test.js deleted file mode 100644 index eeef1f0ca6c..00000000000 --- a/test/binCases/module/module-bind/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout.should.containEql("pre-loaded pre"); - stdout.should.containEql("post-loaded post"); - stderr.should.be.empty(); -}; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/stdin.js b/test/binCases/plugins/uglifyjsplugin-empty-args/stdin.js new file mode 100644 index 00000000000..f99dbf070f3 --- /dev/null +++ b/test/binCases/plugins/uglifyjsplugin-empty-args/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + + expect(stdout).toEqual(expect.anything()); + expect(stdout[4]).toContain("bytes"); // without uglifyjs it's multiple kBs + + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/plugins/uglifyjsplugin-empty-args/test.js b/test/binCases/plugins/uglifyjsplugin-empty-args/test.js deleted file mode 100644 index 7837b1d9536..00000000000 --- a/test/binCases/plugins/uglifyjsplugin-empty-args/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.exactly(0); - - stdout.should.be.ok(); - stdout[4].should.containEql("bytes"); // without uglifyjs it's multiple kBs - - stderr.should.be.empty(); -}; diff --git a/test/binCases/stats/custom-preset/stdin.js b/test/binCases/stats/custom-preset/stdin.js new file mode 100644 index 00000000000..ca175acffe4 --- /dev/null +++ b/test/binCases/stats/custom-preset/stdin.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(stderr).toHaveLength(0); + expect(code).toBe(0); + expect(stdout).toHaveLength(0); +}; diff --git a/test/binCases/stats/custom-preset/test.js b/test/binCases/stats/custom-preset/test.js deleted file mode 100644 index 5457915cd9f..00000000000 --- a/test/binCases/stats/custom-preset/test.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - stderr.should.be.empty(); - code.should.be.eql(0); - stdout.should.be.empty(); -}; diff --git a/test/binCases/stats/multi-config/stdin.js b/test/binCases/stats/multi-config/stdin.js new file mode 100644 index 00000000000..d3023f4feb2 --- /dev/null +++ b/test/binCases/stats/multi-config/stdin.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/stats/multi-config/test.js b/test/binCases/stats/multi-config/test.js deleted file mode 100644 index 9515f2f778c..00000000000 --- a/test/binCases/stats/multi-config/test.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(0); - stdout.should.be.ok(); - stderr.should.be.empty(); -}; diff --git a/test/binCases/stats/none/stdin.js b/test/binCases/stats/none/stdin.js new file mode 100644 index 00000000000..f53dcbf4f32 --- /dev/null +++ b/test/binCases/stats/none/stdin.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toHaveLength(0); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/stats/none/test.js b/test/binCases/stats/none/test.js deleted file mode 100644 index a2cc82d2396..00000000000 --- a/test/binCases/stats/none/test.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(0); - stdout.should.be.empty(); - stderr.should.be.empty(); -}; diff --git a/test/binCases/stats/single-config/stdin.js b/test/binCases/stats/single-config/stdin.js new file mode 100644 index 00000000000..e0cf0717163 --- /dev/null +++ b/test/binCases/stats/single-config/stdin.js @@ -0,0 +1,16 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(code).toBe(0); + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain("Hash: "); + expect(stdout[1]).toContain("Version: "); + expect(stdout[2]).toContain("Time: "); + expect(stdout[4]).toContain("\u001b[1m\u001b[32mnull.js\u001b[39m\u001b[22m"); + expect(stdout[5]).toContain("chunk"); + expect(stdout[6]).not.toContain("./index.js"); + expect(stdout[6]).not.toContain("[built]"); + expect(stdout[6]).toContain("1 module"); + + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/stats/single-config/test.js b/test/binCases/stats/single-config/test.js deleted file mode 100644 index a961bcd51de..00000000000 --- a/test/binCases/stats/single-config/test.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(code, stdout, stderr) { - code.should.be.eql(0); - - stdout.should.be.ok(); - stdout[0].should.containEql("Hash: "); - stdout[1].should.containEql("Version: "); - stdout[2].should.containEql("Time: "); - stdout[4].should.containEql("\u001b[1m\u001b[32mnull.js\u001b[39m\u001b[22m"); - stdout[5].should.containEql("chunk"); - stdout[6].should.not.containEql("./index.js"); - stdout[6].should.not.containEql("[built]"); - stdout[6].should.containEql("1 module"); - - stderr.should.be.empty(); -}; diff --git a/test/binCases/watch/multi-config-watch-opt/stdin.js b/test/binCases/watch/multi-config-watch-opt/stdin.js new file mode 100644 index 00000000000..8fae9bafeb6 --- /dev/null +++ b/test/binCases/watch/multi-config-watch-opt/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain(""); + expect(stdout[1]).toContain("Webpack is watching the files…"); + + expect(stderr).toHaveLength(0); + done(); +}; diff --git a/test/binCases/watch/multi-config-watch-opt/test.js b/test/binCases/watch/multi-config-watch-opt/test.js deleted file mode 100644 index f4d37c16fa0..00000000000 --- a/test/binCases/watch/multi-config-watch-opt/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(stdout, stderr, done) { - stdout.should.be.ok(); - stdout[0].should.containEql(""); - stdout[1].should.containEql("Webpack is watching the files…"); - - stderr.should.be.empty(); - done(); -}; diff --git a/test/binCases/watch/multi-config/stdin.js b/test/binCases/watch/multi-config/stdin.js new file mode 100644 index 00000000000..8fae9bafeb6 --- /dev/null +++ b/test/binCases/watch/multi-config/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain(""); + expect(stdout[1]).toContain("Webpack is watching the files…"); + + expect(stderr).toHaveLength(0); + done(); +}; diff --git a/test/binCases/watch/multi-config/test.js b/test/binCases/watch/multi-config/test.js deleted file mode 100644 index f4d37c16fa0..00000000000 --- a/test/binCases/watch/multi-config/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(stdout, stderr, done) { - stdout.should.be.ok(); - stdout[0].should.containEql(""); - stdout[1].should.containEql("Webpack is watching the files…"); - - stderr.should.be.empty(); - done(); -}; diff --git a/test/binCases/watch/single-config-watch-opt/stdin.js b/test/binCases/watch/single-config-watch-opt/stdin.js new file mode 100644 index 00000000000..8fae9bafeb6 --- /dev/null +++ b/test/binCases/watch/single-config-watch-opt/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain(""); + expect(stdout[1]).toContain("Webpack is watching the files…"); + + expect(stderr).toHaveLength(0); + done(); +}; diff --git a/test/binCases/watch/single-config-watch-opt/test.js b/test/binCases/watch/single-config-watch-opt/test.js deleted file mode 100644 index f4d37c16fa0..00000000000 --- a/test/binCases/watch/single-config-watch-opt/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(stdout, stderr, done) { - stdout.should.be.ok(); - stdout[0].should.containEql(""); - stdout[1].should.containEql("Webpack is watching the files…"); - - stderr.should.be.empty(); - done(); -}; diff --git a/test/binCases/watch/single-config/stdin.js b/test/binCases/watch/single-config/stdin.js new file mode 100644 index 00000000000..8fae9bafeb6 --- /dev/null +++ b/test/binCases/watch/single-config/stdin.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function testAssertions(stdout, stderr, done) { + expect(stdout).toEqual(expect.anything()); + expect(stdout[0]).toContain(""); + expect(stdout[1]).toContain("Webpack is watching the files…"); + + expect(stderr).toHaveLength(0); + done(); +}; diff --git a/test/binCases/watch/single-config/test.js b/test/binCases/watch/single-config/test.js deleted file mode 100644 index f4d37c16fa0..00000000000 --- a/test/binCases/watch/single-config/test.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function testAssertions(stdout, stderr, done) { - stdout.should.be.ok(); - stdout[0].should.containEql(""); - stdout[1].should.containEql("Webpack is watching the files…"); - - stderr.should.be.empty(); - done(); -}; From c67eb0cd5194f5bd70e280a1b5c3625cd2aa80d7 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Mon, 25 Sep 2017 23:39:11 +0200 Subject: [PATCH 11/12] remove redundant cli command --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 345cebfbbec..4e493cc75ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,5 @@ before_script: script: - npm run prepublish - - npm run test:cli - npm run lint - npm run test From 6b5d4328bb72474329cad074ba3a0f6dd56b216f Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Sat, 30 Sep 2017 00:06:02 +0200 Subject: [PATCH 12/12] rebase against master --- bin/webpack.js | 1 + lib/generate-loader/loader-generator.js | 28 +++++++++---------- lib/generate-loader/loader-generator.test.js | 2 -- lib/generate-plugin/plugin-generator.js | 29 ++++++++++---------- lib/utils/copy-utils.js | 13 +++++++-- lib/utils/webpack-generator.js | 18 ++++++++++-- package-lock.json | 9 +++++- package.json | 4 ++- 8 files changed, 65 insertions(+), 39 deletions(-) diff --git a/bin/webpack.js b/bin/webpack.js index f3898a2553c..43320996895 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -27,6 +27,7 @@ if (process.argv.slice(2).indexOf("init") >= 0) { return require("../lib/generate-loader/index.js")(); } else if (process.argv.slice(2).indexOf("generate-plugin") >= 0) { return require("../lib/generate-plugin/index.js")(); +} if (localCLI && path.relative(localCLI, __filename) !== "") { return require(localCLI); } else { diff --git a/lib/generate-loader/loader-generator.js b/lib/generate-loader/loader-generator.js index 9e5a22e27b5..8d5720c69ab 100644 --- a/lib/generate-loader/loader-generator.js +++ b/lib/generate-loader/loader-generator.js @@ -26,14 +26,16 @@ function makeLoaderName(name) { * @extends {Generator} */ var LoaderGenerator = webpackGenerator( - [{ - type: "input", - name: "name", - message: "Loader name", - default: "my-loader", - filter: makeLoaderName, - validate: str => str.length > 0, - }], + [ + { + type: "input", + name: "name", + message: "Loader name", + default: "my-loader", + filter: makeLoaderName, + validate: str => str.length > 0 + } + ], path.join(__dirname, "templates"), [ "src/cjs.js.tpl", @@ -44,15 +46,13 @@ var LoaderGenerator = webpackGenerator( "examples/simple/webpack.config.js.tpl", "examples/simple/src/index.js.tpl", "examples/simple/src/lazy-module.js.tpl", - "examples/simple/src/static-esm-module.js.tpl", - ], - [ - "src/_index.js.tpl", + "examples/simple/src/static-esm-module.js.tpl" ], - (gen) => ({ name: gen.props.name }) + ["src/_index.js.tpl"], + gen => ({ name: gen.props.name }) ); module.exports = { makeLoaderName, - LoaderGenerator, + LoaderGenerator }; diff --git a/lib/generate-loader/loader-generator.test.js b/lib/generate-loader/loader-generator.test.js index 3dc3e55dd7e..232013598ed 100644 --- a/lib/generate-loader/loader-generator.test.js +++ b/lib/generate-loader/loader-generator.test.js @@ -3,7 +3,6 @@ var makeLoaderName = require("./loader-generator").makeLoaderName; describe("makeLoaderName", () => { - it("should kebab-case loader name and append '-loader'", () => { var loaderName = makeLoaderName("This is a test"); expect(loaderName).toEqual("this-is-a-test-loader"); @@ -13,5 +12,4 @@ describe("makeLoaderName", () => { var loaderName = makeLoaderName("properly-named-loader"); expect(loaderName).toEqual("properly-named-loader"); }); - }); diff --git a/lib/generate-plugin/plugin-generator.js b/lib/generate-plugin/plugin-generator.js index fcddd43993a..ffc4022119a 100644 --- a/lib/generate-plugin/plugin-generator.js +++ b/lib/generate-plugin/plugin-generator.js @@ -11,14 +11,16 @@ var webpackGenerator = require("../utils/webpack-generator"); * @extends {Generator} */ var PluginGenerator = webpackGenerator( - [{ - type: "input", - name: "name", - message: "Plugin name", - default: "my-webpack-plugin", - filter: _.kebabCase, - validate: str => str.length > 0, - }], + [ + { + type: "input", + name: "name", + message: "Plugin name", + default: "my-webpack-plugin", + filter: _.kebabCase, + validate: str => str.length > 0 + } + ], path.join(__dirname, "templates"), [ "src/cjs.js.tpl", @@ -26,15 +28,12 @@ var PluginGenerator = webpackGenerator( "test/functional.test.js.tpl", "examples/simple/src/index.js.tpl", "examples/simple/src/lazy-module.js.tpl", - "examples/simple/src/static-esm-module.js.tpl", - ], - [ - "src/_index.js.tpl", - "examples/simple/_webpack.config.js.tpl", + "examples/simple/src/static-esm-module.js.tpl" ], - (gen) => ({ name: _.upperFirst(_.camelCase(gen.props.name)) }) + ["src/_index.js.tpl", "examples/simple/_webpack.config.js.tpl"], + gen => ({ name: _.upperFirst(_.camelCase(gen.props.name)) }) ); module.exports = { - PluginGenerator, + PluginGenerator }; diff --git a/lib/utils/copy-utils.js b/lib/utils/copy-utils.js index e515d862257..d161d38943d 100644 --- a/lib/utils/copy-utils.js +++ b/lib/utils/copy-utils.js @@ -8,7 +8,10 @@ var path = require("path"); * @param {string} templateDir Absolute path to template directory * @returns {Function} A curried function that takes a file path and copies it */ -var generatorCopy = (generator, templateDir) => /** @param {string} filePath */ (filePath) => { +var generatorCopy = ( + generator, + templateDir +) => /** @param {string} filePath */ filePath => { var sourceParts = templateDir.split(path.delimiter); sourceParts.push.apply(sourceParts, filePath.split("/")); var targetParts = path.dirname(filePath).split("/"); @@ -31,7 +34,11 @@ var generatorCopy = (generator, templateDir) => /** @param {string} filePath */ * the template files. * @returns {Function} A curried function that takes a file path and copies it */ -var generatorCopyTpl = (generator, templateDir, templateData) => /** @param {string} filePath */ (filePath) => { +var generatorCopyTpl = ( + generator, + templateDir, + templateData +) => /** @param {string} filePath */ filePath => { var sourceParts = templateDir.split(path.delimiter); sourceParts.push.apply(sourceParts, filePath.split("/")); var targetParts = path.dirname(filePath).split("/"); @@ -46,5 +53,5 @@ var generatorCopyTpl = (generator, templateDir, templateData) => /** @param {str module.exports = { generatorCopy, - generatorCopyTpl, + generatorCopyTpl }; diff --git a/lib/utils/webpack-generator.js b/lib/utils/webpack-generator.js index f7f058098a6..561f10931f7 100644 --- a/lib/utils/webpack-generator.js +++ b/lib/utils/webpack-generator.js @@ -24,7 +24,13 @@ var copyUtils = require("../utils/copy-utils"); * * @returns {Generator} A class extending Generator */ -function webpackGenerator(prompts, templateDir, copyFiles, copyTemplateFiles, templateFn) { +function webpackGenerator( + prompts, + templateDir, + copyFiles, + copyTemplateFiles, + templateFn +) { //eslint-disable-next-line return class extends Generator { prompting() { @@ -48,14 +54,20 @@ function webpackGenerator(prompts, templateDir, copyFiles, copyTemplateFiles, te writing() { this.copy = copyUtils.generatorCopy(this, templateDir); - this.copyTpl = copyUtils.generatorCopyTpl(this, templateDir, templateFn(this)); + this.copyTpl = copyUtils.generatorCopyTpl( + this, + templateDir, + templateFn(this) + ); copyFiles.forEach(this.copy); copyTemplateFiles.forEach(this.copyTpl); } install() { - this.npmInstall(["webpack-defaults", "bluebird"], { "save-dev": true }).then(() => { + this.npmInstall(["webpack-defaults", "bluebird"], { + "save-dev": true + }).then(() => { this.spawnCommand("npm", ["run", "webpack-defaults"]); }); } diff --git a/package-lock.json b/package-lock.json index 4fd4acd6989..d819ae34668 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1501,6 +1501,7 @@ "requires": { "anymatch": "1.3.0", "async-each": "1.0.1", + "fsevents": "1.1.2", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -2776,7 +2777,7 @@ "integrity": "sha512-Sn44E5wQW4bTHXvQmvSHwqbuiXtduD6Rrjm2ZtUEGbyrig+nUH3t/QD4M4/ZXViY556TBpRgZkHLDx3JxPwxiw==", "optional": true, "requires": { - "nan": "2.6.2", + "nan": "2.7.0", "node-pre-gyp": "0.6.36" }, "dependencies": { @@ -6228,6 +6229,12 @@ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" }, + "nan": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", + "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=", + "optional": true + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", diff --git a/package.json b/package.json index 6587f565497..3e9d2192fda 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,9 @@ }, "jest": { "testEnvironment": "node", - "modulePathIgnorePatterns": ["dist"] + "modulePathIgnorePatterns": [ + "dist" + ] }, "dependencies": { "babel-code-frame": "^6.22.0",