From 00f2b5ede76e43c7e1c4b8791985cac6476506cd Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Sat, 11 Nov 2017 18:48:29 +0100 Subject: [PATCH] advanced module type refactoring added json type .mjs default to javascript/esm type adjusted parser plugins to react on module type --- lib/APIPlugin.js | 2 +- lib/CompatibilityPlugin.js | 16 +-- lib/ConstPlugin.js | 2 +- lib/DefinePlugin.js | 2 +- lib/ExtendedAPIPlugin.js | 2 +- lib/FunctionModuleTemplatePlugin.js | 15 ++- lib/HotModuleReplacementPlugin.js | 3 +- lib/JavascriptModulesPlugin.js | 6 +- lib/JsonModulesPlugin.js | 32 +++++ lib/JsonParser.js | 27 +++++ lib/LibraryTemplatePlugin.js | 2 +- lib/Module.js | 12 +- lib/ModuleTemplate.js | 3 +- lib/NodeStuffPlugin.js | 2 +- lib/NormalModule.js | 2 +- lib/NormalModuleFactory.js | 12 +- lib/ProvidePlugin.js | 2 +- lib/RequireJsStuffPlugin.js | 2 +- lib/Template.js | 4 +- lib/UseStrictPlugin.js | 2 +- lib/WebAssemblyModulesPlugin.js | 4 +- lib/WebpackOptionsApply.js | 15 ++- lib/WebpackOptionsDefaulter.js | 2 +- lib/dependencies/AMDPlugin.js | 2 +- ...AMDRequireDependenciesBlockParserPlugin.js | 4 +- lib/dependencies/CommonJsPlugin.js | 2 +- .../HarmonyCompatibilityDependency.js | 2 +- .../HarmonyDetectionParserPlugin.js | 5 +- .../HarmonyExportExpressionDependency.js | 2 +- ...armonyExportImportedSpecifierDependency.js | 6 +- .../HarmonyExportSpecifierDependency.js | 2 +- lib/dependencies/HarmonyModulesPlugin.js | 2 +- lib/dependencies/ImportPlugin.js | 2 +- lib/dependencies/RequireContextPlugin.js | 2 +- lib/dependencies/RequireEnsurePlugin.js | 2 +- lib/dependencies/RequireIncludePlugin.js | 2 +- lib/dependencies/SystemPlugin.js | 2 +- lib/node/NodeMainTemplatePlugin.js | 113 ++++++++++-------- lib/node/NodeSourcePlugin.js | 2 +- .../ReadFileCompileWasmMainTemplatePlugin.js | 83 +++++++++++++ ...ReadFileCompileWasmModuleTemplatePlugin.js | 39 ++++++ lib/node/ReadFileCompileWasmTemplatePlugin.js | 19 +++ lib/optimize/ConcatenatedModule.js | 10 +- lib/optimize/ModuleConcatenationPlugin.js | 2 +- .../FetchCompileWasmMainTemplatePlugin.js | 47 ++++---- .../FetchCompileWasmModuleTemplatePlugin.js | 6 +- .../FetchCompileWasmTemplatePlugin.js | 0 lib/{ => web}/JsonpChunkTemplatePlugin.js | 0 .../JsonpExportMainTemplatePlugin.js | 0 .../JsonpHotUpdateChunkTemplatePlugin.js | 0 lib/{ => web}/JsonpMainTemplate.runtime.js | 0 lib/{ => web}/JsonpMainTemplatePlugin.js | 7 +- lib/{ => web}/JsonpTemplatePlugin.js | 0 lib/webpack.js | 9 +- package.json | 2 +- schemas/webpackOptionsSchema.json | 1 + test/ExternalModule.unittest.js | 8 +- .../JsonpExportMainTemplatePlugin.unittest.js | 2 +- test/NormalModule.unittest.js | 4 + test/TestCases.test.js | 6 +- test/cases/loaders/issue-2299/loader/index.js | 4 +- test/cases/mjs/esm-by-default/index.mjs | 8 ++ test/cases/wasm/simple/index.js | 7 ++ test/cases/wasm/simple/module.js | 5 + test/cases/wasm/simple/wasm.wasm | Bin 0 -> 63 bytes .../aggressive-splitting-entry/expected.txt | 18 +-- .../expected.txt | 8 +- test/statsCases/chunks/expected.txt | 4 +- test/statsCases/color-disabled/expected.txt | 2 +- .../color-enabled-custom/expected.txt | 2 +- test/statsCases/color-enabled/expected.txt | 2 +- .../commons-chunk-min-size-0/expected.txt | 4 +- .../expected.txt | 2 +- .../expected.txt | 10 +- .../commons-plugin-issue-4980/expected.txt | 10 +- test/statsCases/define-plugin/expected.txt | 6 +- .../exclude-with-loader/expected.txt | 4 +- test/statsCases/external/expected.txt | 2 +- test/statsCases/filter-warnings/expected.txt | 42 +++---- .../import-context-filter/expected.txt | 4 +- test/statsCases/import-weak/expected.txt | 4 +- .../limit-chunk-count-plugin/expected.txt | 16 +-- .../max-modules-default/expected.txt | 2 +- test/statsCases/max-modules/expected.txt | 2 +- .../module-deduplication-named/expected.txt | 6 +- .../module-deduplication/expected.txt | 6 +- .../named-chunks-plugin-async/expected.txt | 4 +- .../named-chunks-plugin/expected.txt | 4 +- test/statsCases/optimize-chunks/expected.txt | 4 +- test/statsCases/preset-detailed/expected.txt | 4 +- test/statsCases/preset-normal/expected.txt | 4 +- test/statsCases/preset-verbose/expected.txt | 4 +- .../resolve-plugin-context/expected.txt | 2 +- .../reverse-sort-modules/expected.txt | 2 +- .../scope-hoisting-multi/expected.txt | 6 +- .../separate-css-bundle/expected.txt | 10 +- test/statsCases/simple-more-info/expected.txt | 2 +- test/statsCases/simple/expected.txt | 2 +- test/statsCases/tree-shaking/expected.txt | 2 +- .../statsCases/warnings-uglifyjs/expected.txt | 2 +- yarn.lock | 2 +- 101 files changed, 537 insertions(+), 265 deletions(-) create mode 100644 lib/JsonModulesPlugin.js create mode 100644 lib/JsonParser.js create mode 100644 lib/node/ReadFileCompileWasmMainTemplatePlugin.js create mode 100644 lib/node/ReadFileCompileWasmModuleTemplatePlugin.js create mode 100644 lib/node/ReadFileCompileWasmTemplatePlugin.js rename lib/{ => web}/FetchCompileWasmMainTemplatePlugin.js (59%) rename lib/{ => web}/FetchCompileWasmModuleTemplatePlugin.js (88%) rename lib/{ => web}/FetchCompileWasmTemplatePlugin.js (100%) rename lib/{ => web}/JsonpChunkTemplatePlugin.js (100%) rename lib/{ => web}/JsonpExportMainTemplatePlugin.js (100%) rename lib/{ => web}/JsonpHotUpdateChunkTemplatePlugin.js (100%) rename lib/{ => web}/JsonpMainTemplate.runtime.js (100%) rename lib/{ => web}/JsonpMainTemplatePlugin.js (98%) rename lib/{ => web}/JsonpTemplatePlugin.js (100%) create mode 100644 test/cases/mjs/esm-by-default/index.mjs create mode 100644 test/cases/wasm/simple/index.js create mode 100644 test/cases/wasm/simple/module.js create mode 100644 test/cases/wasm/simple/wasm.wasm diff --git a/lib/APIPlugin.js b/lib/APIPlugin.js index 6456ad85a..19791d08e 100644 --- a/lib/APIPlugin.js +++ b/lib/APIPlugin.js @@ -32,7 +32,7 @@ class APIPlugin { compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); - params.normalModuleFactory.plugin("parser", parser => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic", "parser javascript/esm"], parser => { Object.keys(REPLACEMENTS).forEach(key => { parser.plugin(`expression ${key}`, ParserHelpers.toConstantDependency(REPLACEMENTS[key])); parser.plugin(`evaluate typeof ${key}`, ParserHelpers.evaluateToString(REPLACEMENT_TYPES[key])); diff --git a/lib/CompatibilityPlugin.js b/lib/CompatibilityPlugin.js index c6fdd890c..d171f3b2c 100644 --- a/lib/CompatibilityPlugin.js +++ b/lib/CompatibilityPlugin.js @@ -8,9 +8,6 @@ const ConstDependency = require("./dependencies/ConstDependency"); const NullFactory = require("./NullFactory"); -const jsonLoaderPath = require.resolve("json-loader"); -const matchJson = /\.json$/i; - class CompatibilityPlugin { apply(compiler) { @@ -18,7 +15,7 @@ class CompatibilityPlugin { compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin("parser javascript/auto", (parser, parserOptions) => { if(typeof parserOptions.browserify !== "undefined" && !parserOptions.browserify) return; @@ -40,17 +37,6 @@ class CompatibilityPlugin { return true; }); }); - - params.normalModuleFactory.plugin("after-resolve", (data, done) => { - // if this is a json file and there are no loaders active, we use the json-loader in order to avoid parse errors - // @see https://github.com/webpack/webpack/issues/3363 - if(matchJson.test(data.request) && data.loaders.length === 0) { - data.loaders.push({ - loader: jsonLoaderPath - }); - } - done(null, data); - }); }); } } diff --git a/lib/ConstPlugin.js b/lib/ConstPlugin.js index 294be09a7..f7c075813 100644 --- a/lib/ConstPlugin.js +++ b/lib/ConstPlugin.js @@ -18,7 +18,7 @@ class ConstPlugin { compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); - params.normalModuleFactory.plugin("parser", parser => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic", "parser javascript/esm"], parser => { parser.plugin("statement if", statement => { const param = parser.evaluateExpression(statement.test); const bool = param.asBool(); diff --git a/lib/DefinePlugin.js b/lib/DefinePlugin.js index 9f03f6c4d..7ba0ce625 100644 --- a/lib/DefinePlugin.js +++ b/lib/DefinePlugin.js @@ -36,7 +36,7 @@ class DefinePlugin { compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic", "parser javascript/esm"], (parser) => { const walkDefinitions = (definitions, prefix) => { Object.keys(definitions).forEach((key) => { const code = definitions[key]; diff --git a/lib/ExtendedAPIPlugin.js b/lib/ExtendedAPIPlugin.js index b3df2ba6f..895a5080f 100644 --- a/lib/ExtendedAPIPlugin.js +++ b/lib/ExtendedAPIPlugin.js @@ -36,7 +36,7 @@ class ExtendedAPIPlugin { }); mainTemplate.plugin("global-hash", () => true); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic", "parser javascript/esm"], (parser, parserOptions) => { Object.keys(REPLACEMENTS).forEach(key => { parser.plugin(`expression ${key}`, ParserHelpers.toConstantDependency(REPLACEMENTS[key])); parser.plugin(`evaluate typeof ${key}`, ParserHelpers.evaluateToString(REPLACEMENT_TYPES[key])); diff --git a/lib/FunctionModuleTemplatePlugin.js b/lib/FunctionModuleTemplatePlugin.js index a83be52e8..0507884d2 100644 --- a/lib/FunctionModuleTemplatePlugin.js +++ b/lib/FunctionModuleTemplatePlugin.js @@ -11,12 +11,19 @@ class FunctionModuleTemplatePlugin { apply(moduleTemplate) { moduleTemplate.plugin("render", (moduleSource, module) => { const source = new ConcatSource(); - const defaultArguments = [module.moduleArgument || "module", module.exportsArgument || "exports"]; + const args = [module.moduleArgument]; // TODO remove HACK checking type for javascript - if(!module.type || !module.type.startsWith("javascript") || (module.arguments && module.arguments.length !== 0) || module.hasDependencies(d => d.requireWebpackRequire !== false)) { - defaultArguments.push("__webpack_require__"); + if(module.type && module.type.startsWith("javascript")) { + args.push(module.exportsArgument); + if(module.hasDependencies(d => d.requireWebpackRequire !== false)) { + args.push("__webpack_require__"); + } + } else if(module.type && module.type.startsWith("json")) { + // no additional arguments needed + } else { + args.push(module.exportsArgument, "__webpack_require__"); } - source.add("/***/ (function(" + defaultArguments.concat(module.arguments || []).join(", ") + ") {\n\n"); + source.add("/***/ (function(" + args.join(", ") + ") {\n\n"); if(module.strict) source.add("\"use strict\";\n"); source.add(moduleSource); source.add("\n\n/***/ })"); diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 0c33f69ca..eb7c2e0a1 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -190,7 +190,8 @@ module.exports = class HotModuleReplacementPlugin { ]); }); - normalModuleFactory.plugin("parser", (parser, parserOptions) => { + // TODO add HMR support for javascript/esm + normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic"], (parser, parserOptions) => { parser.plugin("expression __webpack_hash__", ParserHelpers.toConstantDependency("__webpack_require__.h()")); parser.plugin("evaluate typeof __webpack_hash__", ParserHelpers.evaluateToString("string")); parser.plugin("evaluate Identifier module.hot", expr => { diff --git a/lib/JavascriptModulesPlugin.js b/lib/JavascriptModulesPlugin.js index 992c5d71a..39b711cbf 100644 --- a/lib/JavascriptModulesPlugin.js +++ b/lib/JavascriptModulesPlugin.js @@ -8,8 +8,10 @@ const Parser = require("./Parser"); class JavascriptModulesPlugin { apply(compiler) { - compiler.plugin("compilation", (compilation, { normalModuleFactory }) => { - normalModuleFactory.plugin(["create-parser javascript/auto", "create-parser javascript/esm"], () => { + compiler.plugin("compilation", (compilation, { + normalModuleFactory + }) => { + normalModuleFactory.plugin(["create-parser javascript/auto", "create-parser javascript/dynamic", "create-parser javascript/esm"], () => { return new Parser(); }); }); diff --git a/lib/JsonModulesPlugin.js b/lib/JsonModulesPlugin.js new file mode 100644 index 000000000..7c513cdd7 --- /dev/null +++ b/lib/JsonModulesPlugin.js @@ -0,0 +1,32 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const JsonParser = require("./JsonParser"); +const ConcatSource = require("webpack-sources").ConcatSource; + +class JsonModulesPlugin { + apply(compiler) { + compiler.plugin("compilation", (compilation, { + normalModuleFactory + }) => { + normalModuleFactory.plugin("create-parser json", () => { + return new JsonParser(); + }); + compilation.moduleTemplates.javascript.plugin("content", (moduleSource, module) => { + if(module.type && module.type.startsWith("json")) { + const source = new ConcatSource(); + source.add(`${module.moduleArgument}.exports = `); + source.add(moduleSource); + return source; + } else { + return moduleSource; + } + }); + }); + } +} + +module.exports = JsonModulesPlugin; diff --git a/lib/JsonParser.js b/lib/JsonParser.js new file mode 100644 index 000000000..4d2467320 --- /dev/null +++ b/lib/JsonParser.js @@ -0,0 +1,27 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const ConstDependency = require("./dependencies/ConstDependency"); + +class JsonParser { + constructor(options) { + this.options = options; + } + + parse(source, state) { + const regExp = /\u2028|\u2029/g; // invalid in JavaScript but valid JSON + let match = regExp.exec(source); + while(match) { + const escaped = match[0] === "\u2028" ? "\\u2028" : "\\u2029"; + const dep = new ConstDependency(escaped, [match.index, match.index]); + state.module.addDependency(dep); + match = regExp.exec(source); + } + return state; + } +} + +module.exports = JsonParser; diff --git a/lib/LibraryTemplatePlugin.js b/lib/LibraryTemplatePlugin.js index 93cb6b07b..73cb4072c 100644 --- a/lib/LibraryTemplatePlugin.js +++ b/lib/LibraryTemplatePlugin.js @@ -79,7 +79,7 @@ class LibraryTemplatePlugin { })); break; case "jsonp": - var JsonpExportMainTemplatePlugin = require("./JsonpExportMainTemplatePlugin"); + var JsonpExportMainTemplatePlugin = require("./web/JsonpExportMainTemplatePlugin"); compilation.apply(new JsonpExportMainTemplatePlugin(this.name)); break; default: diff --git a/lib/Module.js b/lib/Module.js index ccb8dd5b4..e6aba1249 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -59,8 +59,8 @@ class Module extends DependenciesBlock { this.errors = []; this.strict = false; this.meta = {}; - this.exportsArgument = undefined; - this.moduleArgument = undefined; + this.exportsArgument = "exports"; + this.moduleArgument = "module"; this.assets = null; this.fileDependencies = undefined; this.contextDependencies = undefined; @@ -261,6 +261,14 @@ class Module extends DependenciesBlock { unbuild() { this.disconnect(); } + + get arguments() { + throw new Error("Module.arguments was removed, there is no replacement."); + } + + set arguments(value) { + throw new Error("Module.arguments was removed, there is no replacement."); + } } Object.defineProperty(Module.prototype, "entry", { diff --git a/lib/ModuleTemplate.js b/lib/ModuleTemplate.js index 63370d856..90c435300 100644 --- a/lib/ModuleTemplate.js +++ b/lib/ModuleTemplate.js @@ -13,7 +13,8 @@ module.exports = class ModuleTemplate extends Template { render(module, dependencyTemplates, options) { const moduleSource = module.source(dependencyTemplates, this.outputOptions, this.requestShortener); - const moduleSourcePostModule = this.applyPluginsWaterfall("module", moduleSource, module, options, dependencyTemplates); + const moduleSourcePostContent = this.applyPluginsWaterfall("content", moduleSource, module, options, dependencyTemplates); + const moduleSourcePostModule = this.applyPluginsWaterfall("module", moduleSourcePostContent, module, options, dependencyTemplates); const moduleSourcePostRender = this.applyPluginsWaterfall("render", moduleSourcePostModule, module, options, dependencyTemplates); return this.applyPluginsWaterfall("package", moduleSourcePostRender, module, options, dependencyTemplates); } diff --git a/lib/NodeStuffPlugin.js b/lib/NodeStuffPlugin.js index 1f45c397e..2d00e128d 100644 --- a/lib/NodeStuffPlugin.js +++ b/lib/NodeStuffPlugin.js @@ -21,7 +21,7 @@ class NodeStuffPlugin { compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic"], (parser, parserOptions) => { if(parserOptions.node === false) return; diff --git a/lib/NormalModule.js b/lib/NormalModule.js index 092169d55..fb9eb1a5c 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -363,7 +363,7 @@ class NormalModule extends Module { contextArgument(block) { if(this === block) { - return this.exportsArgument || "exports"; + return this.exportsArgument; } return "this"; } diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js index ceead2f65..d54a35f5d 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -191,7 +191,7 @@ class NormalModuleFactory extends Tapable { if(err) return callback(err); loaders = results[0].concat(loaders, results[1], results[2]); process.nextTick(() => { - const type = settings.type || "javascript/auto"; + const type = settings.type || this.getDefaultType(resourcePath); callback(null, { context: context, request: loaders.map(loaderToIdent).concat([resource]).join("!"), @@ -210,6 +210,16 @@ class NormalModuleFactory extends Tapable { }); } + getDefaultType(resourcePath) { + if(/\.wasm$/.test(resourcePath)) + return "webassembly/experimental"; + if(/\.mjs$/.test(resourcePath)) + return "javascript/esm"; + if(/\.json$/.test(resourcePath)) + return "json"; + return "javascript/auto"; + } + create(data, callback) { const dependencies = data.dependencies; const cacheEntry = dependencies[0].__NormalModuleFactoryCache; diff --git a/lib/ProvidePlugin.js b/lib/ProvidePlugin.js index a23402797..58bf86ed8 100644 --- a/lib/ProvidePlugin.js +++ b/lib/ProvidePlugin.js @@ -19,7 +19,7 @@ class ProvidePlugin { compiler.plugin("compilation", (compilation, params) => { compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic", "parser javascript/esm"], (parser, parserOptions) => { Object.keys(definitions).forEach(name => { var request = [].concat(definitions[name]); var splittedName = name.split("."); diff --git a/lib/RequireJsStuffPlugin.js b/lib/RequireJsStuffPlugin.js index c2f8f200e..6e964b56d 100644 --- a/lib/RequireJsStuffPlugin.js +++ b/lib/RequireJsStuffPlugin.js @@ -14,7 +14,7 @@ module.exports = class RequireJsStuffPlugin { compiler.plugin("compilation", (compilation, params) => { compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic"], (parser, parserOptions) => { if(typeof parserOptions.requireJs !== "undefined" && !parserOptions.requireJs) return; diff --git a/lib/Template.js b/lib/Template.js index 43b1a59b9..df83f733c 100644 --- a/lib/Template.js +++ b/lib/Template.js @@ -138,7 +138,9 @@ module.exports = class Template extends Tapable { var allModules = modules.map(module => { return { id: module.id, - source: moduleTemplate.render(module, dependencyTemplates, { chunk }) + source: moduleTemplate.render(module, dependencyTemplates, { + chunk + }) }; }); if(removedModules && removedModules.length > 0) { diff --git a/lib/UseStrictPlugin.js b/lib/UseStrictPlugin.js index f3fa2cbd6..ca76c0cab 100644 --- a/lib/UseStrictPlugin.js +++ b/lib/UseStrictPlugin.js @@ -9,7 +9,7 @@ const ConstDependency = require("./dependencies/ConstDependency"); class UseStrictPlugin { apply(compiler) { compiler.plugin("compilation", (compilation, params) => { - params.normalModuleFactory.plugin("parser", (parser) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic", "parser javascript/esm"], (parser) => { const parserInstance = parser; parser.plugin("program", (ast) => { const firstNode = ast.body[0]; diff --git a/lib/WebAssemblyModulesPlugin.js b/lib/WebAssemblyModulesPlugin.js index 131819ace..977e07990 100644 --- a/lib/WebAssemblyModulesPlugin.js +++ b/lib/WebAssemblyModulesPlugin.js @@ -8,7 +8,9 @@ const WebAssemblyParser = require("./WebAssemblyParser"); class WebAssemblyModulesPlugin { apply(compiler) { - compiler.plugin("compilation", (compilation, { normalModuleFactory }) => { + compiler.plugin("compilation", (compilation, { + normalModuleFactory + }) => { normalModuleFactory.plugin("create-parser webassembly/experimental", () => { return new WebAssemblyParser(); }); diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index 1eedf112c..0ec15c995 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -7,6 +7,7 @@ const OptionsApply = require("./OptionsApply"); const JavascriptModulesPlugin = require("./JavascriptModulesPlugin"); +const JsonModulesPlugin = require("./JsonModulesPlugin"); const WebAssemblyModulesPlugin = require("./WebAssemblyModulesPlugin"); const LoaderTargetPlugin = require("./LoaderTargetPlugin"); @@ -66,14 +67,15 @@ class WebpackOptionsApply extends OptionsApply { if(typeof options.target === "string") { let JsonpTemplatePlugin; let FetchCompileWasmTemplatePlugin; + let ReadFileCompileWasmTemplatePlugin; let NodeSourcePlugin; let NodeTargetPlugin; let NodeTemplatePlugin; switch(options.target) { case "web": - JsonpTemplatePlugin = require("./JsonpTemplatePlugin"); - FetchCompileWasmTemplatePlugin = require("./FetchCompileWasmTemplatePlugin"); + JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin"); + FetchCompileWasmTemplatePlugin = require("./web/FetchCompileWasmTemplatePlugin"); NodeSourcePlugin = require("./node/NodeSourcePlugin"); compiler.apply( new JsonpTemplatePlugin(options.output), @@ -86,9 +88,11 @@ class WebpackOptionsApply extends OptionsApply { case "webworker": { let WebWorkerTemplatePlugin = require("./webworker/WebWorkerTemplatePlugin"); + FetchCompileWasmTemplatePlugin = require("./web/FetchCompileWasmTemplatePlugin"); NodeSourcePlugin = require("./node/NodeSourcePlugin"); compiler.apply( new WebWorkerTemplatePlugin(), + new FetchCompileWasmTemplatePlugin(options.output), new FunctionModulePlugin(options.output), new NodeSourcePlugin(options.node), new LoaderTargetPlugin(options.target) @@ -98,18 +102,20 @@ class WebpackOptionsApply extends OptionsApply { case "node": case "async-node": NodeTemplatePlugin = require("./node/NodeTemplatePlugin"); + ReadFileCompileWasmTemplatePlugin = require("./node/ReadFileCompileWasmTemplatePlugin"); NodeTargetPlugin = require("./node/NodeTargetPlugin"); compiler.apply( new NodeTemplatePlugin({ asyncChunkLoading: options.target === "async-node" }), + new ReadFileCompileWasmTemplatePlugin(options.output), new FunctionModulePlugin(options.output), new NodeTargetPlugin(), new LoaderTargetPlugin("node") ); break; case "node-webkit": - JsonpTemplatePlugin = require("./JsonpTemplatePlugin"); + JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin"); NodeTargetPlugin = require("./node/NodeTargetPlugin"); ExternalsPlugin = require("./ExternalsPlugin"); compiler.apply( @@ -160,7 +166,7 @@ class WebpackOptionsApply extends OptionsApply { ); break; case "electron-renderer": - JsonpTemplatePlugin = require("./JsonpTemplatePlugin"); + JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin"); NodeTargetPlugin = require("./node/NodeTargetPlugin"); ExternalsPlugin = require("./ExternalsPlugin"); compiler.apply( @@ -239,6 +245,7 @@ class WebpackOptionsApply extends OptionsApply { } compiler.apply( new JavascriptModulesPlugin(), + new JsonModulesPlugin(), new WebAssemblyModulesPlugin() ); diff --git a/lib/WebpackOptionsDefaulter.js b/lib/WebpackOptionsDefaulter.js index eb03e859a..8415fcfb5 100644 --- a/lib/WebpackOptionsDefaulter.js +++ b/lib/WebpackOptionsDefaulter.js @@ -98,7 +98,7 @@ class WebpackOptionsDefaulter extends OptionsDefaulter { this.set("resolve", "call", value => Object.assign({}, value)); this.set("resolve.unsafeCache", true); this.set("resolve.modules", ["node_modules"]); - this.set("resolve.extensions", [".js", ".json"]); + this.set("resolve.extensions", [".mjs", ".js", ".json"]); this.set("resolve.mainFiles", ["index"]); this.set("resolve.aliasFields", "make", (options) => { if(options.target === "web" || options.target === "webworker") diff --git a/lib/dependencies/AMDPlugin.js b/lib/dependencies/AMDPlugin.js index fd3c605cd..21f3f23e2 100644 --- a/lib/dependencies/AMDPlugin.js +++ b/lib/dependencies/AMDPlugin.js @@ -56,7 +56,7 @@ class AMDPlugin { compilation.dependencyFactories.set(LocalModuleDependency, new NullFactory()); compilation.dependencyTemplates.set(LocalModuleDependency, new LocalModuleDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic"], (parser, parserOptions) => { if(typeof parserOptions.amd !== "undefined" && !parserOptions.amd) return; diff --git a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js index 329b3e0d8..89a224a93 100644 --- a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +++ b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js @@ -150,9 +150,9 @@ class AMDRequireDependenciesBlockParserPlugin { if(param.string === "require") { dep = new ConstDependency("__webpack_require__", param.string); } else if(param.string === "module") { - dep = new ConstDependency(parser.state.module.moduleArgument || "module", param.range); + dep = new ConstDependency(parser.state.module.moduleArgument, param.range); } else if(param.string === "exports") { - dep = new ConstDependency(parser.state.module.exportsArgument || "exports", param.range); + dep = new ConstDependency(parser.state.module.exportsArgument, param.range); } else if(localModule = LocalModulesHelpers.getLocalModule(parser.state, param.string)) { // eslint-disable-line no-cond-assign dep = new LocalModuleDependency(localModule, param.range); } else { diff --git a/lib/dependencies/CommonJsPlugin.js b/lib/dependencies/CommonJsPlugin.js index 9bef044a7..3bb176f52 100644 --- a/lib/dependencies/CommonJsPlugin.js +++ b/lib/dependencies/CommonJsPlugin.js @@ -47,7 +47,7 @@ class CommonJsPlugin { compilation.dependencyFactories.set(RequireHeaderDependency, new NullFactory()); compilation.dependencyTemplates.set(RequireHeaderDependency, new RequireHeaderDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic"], (parser, parserOptions) => { if(typeof parserOptions.commonjs !== "undefined" && !parserOptions.commonjs) return; diff --git a/lib/dependencies/HarmonyCompatibilityDependency.js b/lib/dependencies/HarmonyCompatibilityDependency.js index 1370346e0..a6a086ffb 100644 --- a/lib/dependencies/HarmonyCompatibilityDependency.js +++ b/lib/dependencies/HarmonyCompatibilityDependency.js @@ -20,7 +20,7 @@ HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate apply(dep, source) { const usedExports = dep.originModule.usedExports; if(usedExports && !Array.isArray(usedExports)) { - const exportName = dep.originModule.exportsArgument || "exports"; + const exportName = dep.originModule.exportsArgument; const content = `Object.defineProperty(${exportName}, "__esModule", { value: true });\n`; source.insert(-10, content); } diff --git a/lib/dependencies/HarmonyDetectionParserPlugin.js b/lib/dependencies/HarmonyDetectionParserPlugin.js index 224286a1b..943674e39 100644 --- a/lib/dependencies/HarmonyDetectionParserPlugin.js +++ b/lib/dependencies/HarmonyDetectionParserPlugin.js @@ -10,7 +10,8 @@ const HarmonyInitDependency = require("./HarmonyInitDependency"); module.exports = class HarmonyDetectionParserPlugin { apply(parser) { parser.plugin("program", (ast) => { - var isHarmony = ast.body.some(statement => { + const isStrictHarmony = parser.state.module.type === "javascript/esm"; + const isHarmony = isStrictHarmony || ast.body.some(statement => { return /^(Import|Export).*Declaration$/.test(statement.type); }); if(isHarmony) { @@ -45,6 +46,8 @@ module.exports = class HarmonyDetectionParserPlugin { module.meta.harmonyModule = true; module.strict = true; module.exportsArgument = "__webpack_exports__"; + if(isStrictHarmony) + module.moduleArgument = "__webpack_module__"; } }); diff --git a/lib/dependencies/HarmonyExportExpressionDependency.js b/lib/dependencies/HarmonyExportExpressionDependency.js index 5b52541ed..610ac7a20 100644 --- a/lib/dependencies/HarmonyExportExpressionDependency.js +++ b/lib/dependencies/HarmonyExportExpressionDependency.js @@ -39,7 +39,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla } getContent(module, used) { - const exportsName = module.exportsArgument || "exports"; + const exportsName = module.exportsArgument; if(used) { return `/* harmony default export */ ${exportsName}[${JSON.stringify(used)}] = `; } diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index 925659c20..bcf16df01 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -344,7 +344,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS content += "if(" + JSON.stringify(activeExports.concat("default")) + ".indexOf(__WEBPACK_IMPORT_KEY__) < 0) "; else content += "if(__WEBPACK_IMPORT_KEY__ !== 'default') "; - const exportsName = dep.originModule.exportsArgument || "exports"; + const exportsName = dep.originModule.exportsArgument; return content + `(function(key) { __webpack_require__.d(${exportsName}, key, function() { return ${name}[key]; }) }(__WEBPACK_IMPORT_KEY__));\n`; } @@ -354,13 +354,13 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS } getReexportStatement(module, key, name, valueKey) { - const exportsName = module.exportsArgument || "exports"; + const exportsName = module.exportsArgument; const returnValue = this.getReturnValue(valueKey); return `__webpack_require__.d(${exportsName}, ${JSON.stringify(key)}, function() { return ${name}${returnValue}; });\n`; } getConditionalReexportStatement(module, key, name, valueKey) { - const exportsName = module.exportsArgument || "exports"; + const exportsName = module.exportsArgument; const returnValue = this.getReturnValue(valueKey); return `if(__webpack_require__.o(${name}, ${JSON.stringify(valueKey)})) __webpack_require__.d(${exportsName}, ${JSON.stringify(key)}, function() { return ${name}${returnValue}; });\n`; } diff --git a/lib/dependencies/HarmonyExportSpecifierDependency.js b/lib/dependencies/HarmonyExportSpecifierDependency.js index b9e73f477..cb2b60bfa 100644 --- a/lib/dependencies/HarmonyExportSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportSpecifierDependency.js @@ -42,7 +42,7 @@ HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependen return `/* unused harmony export ${(dep.name || "namespace")} */\n`; } - const exportsName = dep.originModule.exportsArgument || "exports"; + const exportsName = dep.originModule.exportsArgument; return `/* harmony export (binding) */ __webpack_require__.d(${exportsName}, ${JSON.stringify(used)}, function() { return ${dep.id}; });\n`; } diff --git a/lib/dependencies/HarmonyModulesPlugin.js b/lib/dependencies/HarmonyModulesPlugin.js index 279183b87..a507a27b3 100644 --- a/lib/dependencies/HarmonyModulesPlugin.js +++ b/lib/dependencies/HarmonyModulesPlugin.js @@ -59,7 +59,7 @@ class HarmonyModulesPlugin { compilation.dependencyFactories.set(HarmonyAcceptImportDependency, normalModuleFactory); compilation.dependencyTemplates.set(HarmonyAcceptImportDependency, new HarmonyAcceptImportDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/esm"], (parser, parserOptions) => { if(typeof parserOptions.harmony !== "undefined" && !parserOptions.harmony) return; diff --git a/lib/dependencies/ImportPlugin.js b/lib/dependencies/ImportPlugin.js index 708f93d6f..3eb9ee9ef 100644 --- a/lib/dependencies/ImportPlugin.js +++ b/lib/dependencies/ImportPlugin.js @@ -33,7 +33,7 @@ class ImportPlugin { compilation.dependencyFactories.set(ImportContextDependency, contextModuleFactory); compilation.dependencyTemplates.set(ImportContextDependency, new ImportContextDependency.Template()); - normalModuleFactory.plugin("parser", (parser, parserOptions) => { + normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic", "parser javascript/esm"], (parser, parserOptions) => { if(typeof parserOptions.import !== "undefined" && !parserOptions.import) return; diff --git a/lib/dependencies/RequireContextPlugin.js b/lib/dependencies/RequireContextPlugin.js index ebd3e2020..0739c64ac 100644 --- a/lib/dependencies/RequireContextPlugin.js +++ b/lib/dependencies/RequireContextPlugin.js @@ -30,7 +30,7 @@ class RequireContextPlugin { compilation.dependencyFactories.set(ContextElementDependency, normalModuleFactory); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic"], (parser, parserOptions) => { if(typeof parserOptions.requireContext !== "undefined" && !parserOptions.requireContext) return; diff --git a/lib/dependencies/RequireEnsurePlugin.js b/lib/dependencies/RequireEnsurePlugin.js index 307b3ec78..d3f7718d0 100644 --- a/lib/dependencies/RequireEnsurePlugin.js +++ b/lib/dependencies/RequireEnsurePlugin.js @@ -25,7 +25,7 @@ class RequireEnsurePlugin { compilation.dependencyFactories.set(RequireEnsureDependency, new NullFactory()); compilation.dependencyTemplates.set(RequireEnsureDependency, new RequireEnsureDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic"], (parser, parserOptions) => { if(typeof parserOptions.requireEnsure !== "undefined" && !parserOptions.requireEnsure) return; diff --git a/lib/dependencies/RequireIncludePlugin.js b/lib/dependencies/RequireIncludePlugin.js index f3ad6974d..cd4a3f194 100644 --- a/lib/dependencies/RequireIncludePlugin.js +++ b/lib/dependencies/RequireIncludePlugin.js @@ -18,7 +18,7 @@ class RequireIncludePlugin { compilation.dependencyFactories.set(RequireIncludeDependency, normalModuleFactory); compilation.dependencyTemplates.set(RequireIncludeDependency, new RequireIncludeDependency.Template()); - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic"], (parser, parserOptions) => { if(typeof parserOptions.requireInclude !== "undefined" && !parserOptions.requireInclude) return; diff --git a/lib/dependencies/SystemPlugin.js b/lib/dependencies/SystemPlugin.js index 895302a73..d92d82d8e 100644 --- a/lib/dependencies/SystemPlugin.js +++ b/lib/dependencies/SystemPlugin.js @@ -12,7 +12,7 @@ class SystemPlugin { apply(compiler) { compiler.plugin("compilation", (compilation, params) => { - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic"], (parser, parserOptions) => { if(typeof parserOptions.system !== "undefined" && !parserOptions.system) return; diff --git a/lib/node/NodeMainTemplatePlugin.js b/lib/node/NodeMainTemplatePlugin.js index b4e299832..3ae37ff99 100644 --- a/lib/node/NodeMainTemplatePlugin.js +++ b/lib/node/NodeMainTemplatePlugin.js @@ -44,7 +44,7 @@ module.exports = class NodeMainTemplatePlugin { } return source; }); - mainTemplate.plugin("require-ensure", (_, chunk, hash) => { + mainTemplate.plugin("require-ensure", (source, chunk, hash) => { const chunkFilename = mainTemplate.outputOptions.chunkFilename; const chunkMaps = chunk.getChunkMaps(); const insertMoreModules = [ @@ -55,61 +55,69 @@ module.exports = class NodeMainTemplatePlugin { ]; if(asyncChunkLoading) { return mainTemplate.asString([ - "// \"0\" is the signal for \"already loaded\"", - "if(installedChunks[chunkId] === 0)", + source, + "", + "// ReadFile + VM.run chunk loading for javascript", + "", + "var installedChunkData = installedChunks[chunkId];", + "if(installedChunkData !== 0) { // 0 means \"already installed\".", mainTemplate.indent([ - "return Promise.resolve();" - ]), - "// array of [resolve, reject, promise] means \"currently loading\"", - "if(installedChunks[chunkId])", - mainTemplate.indent([ - "return installedChunks[chunkId][2];" - ]), - "// load the chunk and return promise to it", - "var promise = new Promise(function(resolve, reject) {", - mainTemplate.indent([ - "installedChunks[chunkId] = [resolve, reject];", - "var filename = __dirname + " + mainTemplate.applyPluginsWaterfall("asset-path", JSON.stringify(`/${chunkFilename}`), { - hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, - hashWithLength: (length) => `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, - chunk: { - id: "\" + chunkId + \"", - hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`, - hashWithLength: (length) => { - const shortChunkHashMap = {}; - Object.keys(chunkMaps.hash).forEach((chunkId) => { - if(typeof chunkMaps.hash[chunkId] === "string") - shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(0, length); - }); - return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`; - }, - name: `" + (${JSON.stringify(chunkMaps.name)}[chunkId]||chunkId) + "` - } - }) + ";", - "require('fs').readFile(filename, 'utf-8', function(err, content) {", + "// array of [resolve, reject, promise] means \"currently loading\"", + "if(installedChunkData) {", mainTemplate.indent([ - "if(err) return reject(err);", - "var chunk = {};", - "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + - "(chunk, require, require('path').dirname(filename), filename);" - ].concat(insertMoreModules).concat([ - "var callbacks = [];", - "for(var i = 0; i < chunkIds.length; i++) {", + "promises.push(installedChunkData[2]);" + ]), + "} else {", + mainTemplate.indent([ + "// load the chunk and return promise to it", + "var promise = new Promise(function(resolve, reject) {", mainTemplate.indent([ - "if(installedChunks[chunkIds[i]])", + "installedChunkData = installedChunks[chunkId] = [resolve, reject];", + "var filename = __dirname + " + mainTemplate.applyPluginsWaterfall("asset-path", JSON.stringify(`/${chunkFilename}`), { + hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, + hashWithLength: (length) => `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, + chunk: { + id: "\" + chunkId + \"", + hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`, + hashWithLength: (length) => { + const shortChunkHashMap = {}; + Object.keys(chunkMaps.hash).forEach((chunkId) => { + if(typeof chunkMaps.hash[chunkId] === "string") + shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(0, length); + }); + return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`; + }, + name: `" + (${JSON.stringify(chunkMaps.name)}[chunkId]||chunkId) + "` + } + }) + ";", + "require('fs').readFile(filename, 'utf-8', function(err, content) {", mainTemplate.indent([ - "callbacks = callbacks.concat(installedChunks[chunkIds[i]][0]);" - ]), - "installedChunks[chunkIds[i]] = 0;" + "if(err) return reject(err);", + "var chunk = {};", + "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + + "(chunk, require, require('path').dirname(filename), filename);" + ].concat(insertMoreModules).concat([ + "var callbacks = [];", + "for(var i = 0; i < chunkIds.length; i++) {", + mainTemplate.indent([ + "if(installedChunks[chunkIds[i]])", + mainTemplate.indent([ + "callbacks = callbacks.concat(installedChunks[chunkIds[i]][0]);" + ]), + "installedChunks[chunkIds[i]] = 0;" + ]), + "}", + "for(i = 0; i < callbacks.length; i++)", + mainTemplate.indent("callbacks[i]();") + ])), + "});" ]), - "}", - "for(i = 0; i < callbacks.length; i++)", - mainTemplate.indent("callbacks[i]();") - ])), - "});" + "});", + "promises.push(installedChunkData[2] = promise);" + ]), + "}" ]), - "});", - "return installedChunks[chunkId][2] = promise;" + "}" ]); } else { const request = mainTemplate.applyPluginsWaterfall("asset-path", JSON.stringify(`./${chunkFilename}`), { @@ -130,6 +138,10 @@ module.exports = class NodeMainTemplatePlugin { } }); return mainTemplate.asString([ + source, + "", + "// require() chunk loading for javascript", + "", "// \"0\" is the signal for \"already loaded\"", "if(installedChunks[chunkId] !== 0) {", mainTemplate.indent([ @@ -139,7 +151,6 @@ module.exports = class NodeMainTemplatePlugin { mainTemplate.indent("installedChunks[chunkIds[i]] = 0;") ])), "}", - "return Promise.resolve();" ]); } }); diff --git a/lib/node/NodeSourcePlugin.js b/lib/node/NodeSourcePlugin.js index 42520a2f0..81a91b510 100644 --- a/lib/node/NodeSourcePlugin.js +++ b/lib/node/NodeSourcePlugin.js @@ -37,7 +37,7 @@ module.exports = class NodeSourcePlugin { }; compiler.plugin("compilation", (compilation, params) => { - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic", "parser javascript/esm"], (parser, parserOptions) => { if(parserOptions.node === false) return; diff --git a/lib/node/ReadFileCompileWasmMainTemplatePlugin.js b/lib/node/ReadFileCompileWasmMainTemplatePlugin.js new file mode 100644 index 000000000..e59f42c74 --- /dev/null +++ b/lib/node/ReadFileCompileWasmMainTemplatePlugin.js @@ -0,0 +1,83 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +class ReadFileCompileWasmMainTemplatePlugin { + + apply(mainTemplate) { + mainTemplate.plugin("local-vars", (source, chunk) => { + return mainTemplate.asString([ + source, + "", + "// object to store loaded and loading wasm modules", + "var installedWasmModules = {};", + ]); + }); + mainTemplate.plugin("require-ensure", (source, chunk, hash) => { + const webassemblyModuleFilename = mainTemplate.outputOptions.webassemblyModuleFilename; + const chunkModuleMaps = chunk.getChunkModuleMaps(false, m => m.type.startsWith("webassembly")); + if(Object.keys(chunkModuleMaps.id).length === 0) return source; + const wasmModuleSrcPath = mainTemplate.applyPluginsWaterfall("asset-path", JSON.stringify(webassemblyModuleFilename), { + hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, + hashWithLength: length => `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, + module: { + id: "\" + wasmModuleId + \"", + hash: `" + ${JSON.stringify(chunkModuleMaps.hash)}[wasmModuleId] + "`, + hashWithLength(length) { + const shortChunkHashMap = Object.create(null); + Object.keys(chunkModuleMaps.hash).forEach(wasmModuleId => { + if(typeof chunkModuleMaps.hash[wasmModuleId] === "string") + shortChunkHashMap[wasmModuleId] = chunkModuleMaps.hash[wasmModuleId].substr(0, length); + }); + return `" + ${JSON.stringify(shortChunkHashMap)}[wasmModuleId] + "`; + } + } + }); + return mainTemplate.asString([ + source, + "", + "// ReadFile + compile chunk loading for webassembly", + "", + `var wasmModules = ${JSON.stringify(chunkModuleMaps.id)}[chunkId] || [];`, + "", + "wasmModules.forEach(function(wasmModuleId) {", + mainTemplate.indent([ + "var installedWasmModuleData = installedWasmModules[wasmModuleId];", + "", + "// a Promise means \"currently loading\" or \"already loaded\".", + "promises.push(installedWasmModuleData ||", + mainTemplate.indent([ + "(installedWasmModules[wasmModuleId] = new Promise(function(resolve, reject) {", + mainTemplate.indent([ + `require('fs').readFile(require('path').resolve(__dirname, ${wasmModuleSrcPath}), function(err, buffer) {`, + mainTemplate.indent([ + "if(err) return reject(err);", + "resolve(WebAssembly.compile(buffer));" + ]), + "});" + ]), + `}).then(function(module) { ${mainTemplate.requireFn}.w[wasmModuleId] = module; }))` + ]), + ");", + ]), + "});", + ]); + }); + mainTemplate.plugin("require-extensions", (source, chunk) => { + return mainTemplate.asString([ + source, + "", + "// object with all compiled WebAssmbly.Modules", + `${mainTemplate.requireFn}.w = {};` + ]); + }); + mainTemplate.plugin("hash", hash => { + hash.update("ReadFileCompileWasmMainTemplatePlugin"); + hash.update("1"); + hash.update(`${mainTemplate.outputOptions.webassemblyModuleFilename}`); + }); + } +} +module.exports = ReadFileCompileWasmMainTemplatePlugin; diff --git a/lib/node/ReadFileCompileWasmModuleTemplatePlugin.js b/lib/node/ReadFileCompileWasmModuleTemplatePlugin.js new file mode 100644 index 000000000..f68bddec0 --- /dev/null +++ b/lib/node/ReadFileCompileWasmModuleTemplatePlugin.js @@ -0,0 +1,39 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const RawSource = require("webpack-sources").RawSource; + +class ReadFileCompileWasmModuleTemplatePlugin { + apply(moduleTemplate) { + moduleTemplate.plugin("content", (moduleSource, module, { + chunk + }) => { + if(module.type && module.type.startsWith("webassembly")) { + if(chunk.isInitial()) + throw new Error("Sync WebAsssmbly compilation is not yet implemented"); + const source = new RawSource([ + "\"use strict\";", + "", + "// Instanciate WebAssembly module", + "var instance = new WebAssembly.Instance(__webpack_require__.w[module.i], {});", + "", + "// export exports from WebAssmbly module", + // TODO rewrite this to getters depending on exports to support circular dependencies + "module.exports = instance.exports;" + ].join("\n")); + return source; + } else { + return moduleSource; + } + }); + + moduleTemplate.plugin("hash", hash => { + hash.update("ReadFileCompileWasmModuleTemplatePlugin"); + hash.update("1"); + }); + } +} +module.exports = ReadFileCompileWasmModuleTemplatePlugin; diff --git a/lib/node/ReadFileCompileWasmTemplatePlugin.js b/lib/node/ReadFileCompileWasmTemplatePlugin.js new file mode 100644 index 000000000..ce6440da6 --- /dev/null +++ b/lib/node/ReadFileCompileWasmTemplatePlugin.js @@ -0,0 +1,19 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const ReadFileCompileWasmMainTemplatePlugin = require("./ReadFileCompileWasmMainTemplatePlugin"); +const ReadFileCompileWasmModuleTemplatePlugin = require("./ReadFileCompileWasmModuleTemplatePlugin"); + +class ReadFileCompileWasmTemplatePlugin { + apply(compiler) { + compiler.plugin("this-compilation", (compilation) => { + compilation.mainTemplate.apply(new ReadFileCompileWasmMainTemplatePlugin()); + compilation.moduleTemplates.javascript.apply(new ReadFileCompileWasmModuleTemplatePlugin()); + }); + } +} + +module.exports = ReadFileCompileWasmTemplatePlugin; diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index 9a0dc0111..10d2fee80 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -9,8 +9,8 @@ const Template = require("../Template"); const Parser = require("../Parser"); const acorn = require("acorn"); const escope = require("escope"); -const ReplaceSource = require("webpack-sources/lib/ReplaceSource"); -const ConcatSource = require("webpack-sources/lib/ConcatSource"); +const ReplaceSource = require("webpack-sources").ReplaceSource; +const ConcatSource = require("webpack-sources").ConcatSource; const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency"); const HarmonyImportSideEffectDependency = require("../dependencies/HarmonyImportSideEffectDependency"); const HarmonyImportSpecifierDependency = require("../dependencies/HarmonyImportSpecifierDependency"); @@ -599,7 +599,7 @@ class ConcatenatedModule extends Module { // add harmony compatibility flag (must be first because of possible circular dependencies) const usedExports = this.rootModule.usedExports; if(usedExports === true) { - result.add(`Object.defineProperty(${this.exportsArgument || "exports"}, "__esModule", { value: true });\n`); + result.add(`Object.defineProperty(${this.exportsArgument}, "__esModule", { value: true });\n`); } // define required namespace objects (must be before evaluation modules) @@ -790,7 +790,7 @@ class HarmonyExportExpressionDependencyConcatenatedTemplate { let content = "/* harmony default export */ var __WEBPACK_MODULE_DEFAULT_EXPORT__ = "; if(dep.originModule === this.rootModule) { const used = dep.originModule.isUsed("default"); - const exportsName = dep.originModule.exportsArgument || "exports"; + const exportsName = dep.originModule.exportsArgument; if(used) content += `${exportsName}[${JSON.stringify(used)}] = `; } @@ -874,7 +874,7 @@ class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate { const exportData = new Buffer(def.id, "utf-8").toString("hex"); // eslint-disable-line node/no-deprecated-api finalName = `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}__`; } - const exportsName = this.rootModule.exportsArgument || "exports"; + const exportsName = this.rootModule.exportsArgument; const content = `/* concated harmony reexport */__webpack_require__.d(${exportsName}, ${JSON.stringify(used)}, function() { return ${finalName}; });\n`; source.insert(-1, content); }); diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index e62ff9139..293a035cf 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -22,7 +22,7 @@ class ModuleConcatenationPlugin { apply(compiler) { compiler.plugin("compilation", (compilation, params) => { - params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { + params.normalModuleFactory.plugin(["parser javascript/auto", "parser javascript/dynamic", "parser javascript/esm"], (parser, parserOptions) => { parser.plugin("call eval", () => { parser.state.module.meta.hasEval = true; }); diff --git a/lib/FetchCompileWasmMainTemplatePlugin.js b/lib/web/FetchCompileWasmMainTemplatePlugin.js similarity index 59% rename from lib/FetchCompileWasmMainTemplatePlugin.js rename to lib/web/FetchCompileWasmMainTemplatePlugin.js index 8219d9708..813c7b820 100644 --- a/lib/FetchCompileWasmMainTemplatePlugin.js +++ b/lib/web/FetchCompileWasmMainTemplatePlugin.js @@ -7,21 +7,21 @@ class FetchCompileWasmMainTemplatePlugin { apply(mainTemplate) { - mainTemplate.plugin("local-vars", function(source, chunk) { - return this.asString([ + mainTemplate.plugin("local-vars", (source, chunk) => { + return mainTemplate.asString([ source, "", "// object to store loaded and loading wasm modules", "var installedWasmModules = {};", ]); }); - mainTemplate.plugin("require-ensure", function(source, chunk, hash) { - const webassemblyModuleFilename = this.outputOptions.webassemblyModuleFilename; + mainTemplate.plugin("require-ensure", (source, chunk, hash) => { + const webassemblyModuleFilename = mainTemplate.outputOptions.webassemblyModuleFilename; const chunkModuleMaps = chunk.getChunkModuleMaps(false, m => m.type.startsWith("webassembly")); if(Object.keys(chunkModuleMaps.id).length === 0) return source; - const wasmModuleSrcPath = this.applyPluginsWaterfall("asset-path", JSON.stringify(webassemblyModuleFilename), { - hash: `" + ${this.renderCurrentHashCode(hash)} + "`, - hashWithLength: length => `" + ${this.renderCurrentHashCode(hash, length)} + "`, + const wasmModuleSrcPath = mainTemplate.applyPluginsWaterfall("asset-path", JSON.stringify(webassemblyModuleFilename), { + hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, + hashWithLength: length => `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, module: { id: "\" + wasmModuleId + \"", hash: `" + ${JSON.stringify(chunkModuleMaps.hash)}[wasmModuleId] + "`, @@ -35,7 +35,7 @@ class FetchCompileWasmMainTemplatePlugin { } } }); - return this.asString([ + return mainTemplate.asString([ source, "", "// Fetch + compile chunk loading for webassembly", @@ -43,46 +43,43 @@ class FetchCompileWasmMainTemplatePlugin { `var wasmModules = ${JSON.stringify(chunkModuleMaps.id)}[chunkId] || [];`, "", "wasmModules.forEach(function(wasmModuleId) {", - this.indent([ + mainTemplate.indent([ "var installedWasmModuleData = installedWasmModules[wasmModuleId];", "", "// a Promise means \"currently loading\" or \"already loaded\".", "promises.push(installedWasmModuleData ||", - this.indent([ - `promises.push(installedWasmModules[wasmModuleId] = fetch(${this.requireFn}.p + ${wasmModuleSrcPath}).then(function(response) {`, - this.indent([ + mainTemplate.indent([ + `(installedWasmModules[wasmModuleId] = fetch(${mainTemplate.requireFn}.p + ${wasmModuleSrcPath}).then(function(response) {`, + mainTemplate.indent([ "if(WebAssembly.compileStreaming) {", - this.indent([ + mainTemplate.indent([ "return WebAssembly.compileStreaming(response);" ]), "} else {", - this.indent([ + mainTemplate.indent([ "return response.arrayBuffer().then(function(bytes) { return WebAssembly.compile(bytes); });", ]), "}" ]), - `}).then(function(module) { ${this.requireFn}.w[wasmModuleId] = module; }))` + `}).then(function(module) { ${mainTemplate.requireFn}.w[wasmModuleId] = module; }))` ]), ");", ]), "});", ]); }); - mainTemplate.plugin("require-extensions", function(source, chunk) { - return this.asString([ + mainTemplate.plugin("require-extensions", (source, chunk) => { + return mainTemplate.asString([ source, "", "// object with all compiled WebAssmbly.Modules", - `${this.requireFn}.w = {};` + `${mainTemplate.requireFn}.w = {};` ]); }); - mainTemplate.plugin("hash", function(hash) { - hash.update("jsonp"); - hash.update("5"); - hash.update(`${this.outputOptions.filename}`); - hash.update(`${this.outputOptions.chunkFilename}`); - hash.update(`${this.outputOptions.jsonpFunction}`); - hash.update(`${this.outputOptions.hotUpdateFunction}`); + mainTemplate.plugin("hash", hash => { + hash.update("FetchCompileWasmMainTemplatePlugin"); + hash.update("1"); + hash.update(`${mainTemplate.outputOptions.webassemblyModuleFilename}`); }); } } diff --git a/lib/FetchCompileWasmModuleTemplatePlugin.js b/lib/web/FetchCompileWasmModuleTemplatePlugin.js similarity index 88% rename from lib/FetchCompileWasmModuleTemplatePlugin.js rename to lib/web/FetchCompileWasmModuleTemplatePlugin.js index 10d2436b9..c2f2141a2 100644 --- a/lib/FetchCompileWasmModuleTemplatePlugin.js +++ b/lib/web/FetchCompileWasmModuleTemplatePlugin.js @@ -8,7 +8,9 @@ const RawSource = require("webpack-sources").RawSource; class FetchCompileWasmModuleTemplatePlugin { apply(moduleTemplate) { - moduleTemplate.plugin("module", function(moduleSource, module, { chunk }) { + moduleTemplate.plugin("content", (moduleSource, module, { + chunk + }) => { if(module.type && module.type.startsWith("webassembly")) { if(chunk.isInitial()) throw new Error("Sync WebAsssmbly compilation is not yet implemented"); @@ -28,7 +30,7 @@ class FetchCompileWasmModuleTemplatePlugin { } }); - moduleTemplate.plugin("hash", function(hash) { + moduleTemplate.plugin("hash", hash => { hash.update("FetchCompileWasmModuleTemplatePlugin"); hash.update("1"); }); diff --git a/lib/FetchCompileWasmTemplatePlugin.js b/lib/web/FetchCompileWasmTemplatePlugin.js similarity index 100% rename from lib/FetchCompileWasmTemplatePlugin.js rename to lib/web/FetchCompileWasmTemplatePlugin.js diff --git a/lib/JsonpChunkTemplatePlugin.js b/lib/web/JsonpChunkTemplatePlugin.js similarity index 100% rename from lib/JsonpChunkTemplatePlugin.js rename to lib/web/JsonpChunkTemplatePlugin.js diff --git a/lib/JsonpExportMainTemplatePlugin.js b/lib/web/JsonpExportMainTemplatePlugin.js similarity index 100% rename from lib/JsonpExportMainTemplatePlugin.js rename to lib/web/JsonpExportMainTemplatePlugin.js diff --git a/lib/JsonpHotUpdateChunkTemplatePlugin.js b/lib/web/JsonpHotUpdateChunkTemplatePlugin.js similarity index 100% rename from lib/JsonpHotUpdateChunkTemplatePlugin.js rename to lib/web/JsonpHotUpdateChunkTemplatePlugin.js diff --git a/lib/JsonpMainTemplate.runtime.js b/lib/web/JsonpMainTemplate.runtime.js similarity index 100% rename from lib/JsonpMainTemplate.runtime.js rename to lib/web/JsonpMainTemplate.runtime.js diff --git a/lib/JsonpMainTemplatePlugin.js b/lib/web/JsonpMainTemplatePlugin.js similarity index 98% rename from lib/JsonpMainTemplatePlugin.js rename to lib/web/JsonpMainTemplatePlugin.js index fdd77f4fe..5f218e20f 100644 --- a/lib/JsonpMainTemplatePlugin.js +++ b/lib/web/JsonpMainTemplatePlugin.js @@ -4,7 +4,7 @@ */ "use strict"; -const Template = require("./Template"); +const Template = require("../Template"); class JsonpMainTemplatePlugin { @@ -115,14 +115,13 @@ class JsonpMainTemplatePlugin { mainTemplate.indent([ "installedChunkData = installedChunks[chunkId] = [resolve, reject];" ]), - "installedChunkData[2] = promise;", "});", + "promises.push(installedChunkData[2] = promise);", "", "// start chunk loading", "var head = document.getElementsByTagName('head')[0];", mainTemplate.applyPluginsWaterfall("jsonp-script", "", chunk, hash), - "head.appendChild(script);", - "promises.push(promise);" + "head.appendChild(script);" ]), "}", ]), diff --git a/lib/JsonpTemplatePlugin.js b/lib/web/JsonpTemplatePlugin.js similarity index 100% rename from lib/JsonpTemplatePlugin.js rename to lib/web/JsonpTemplatePlugin.js diff --git a/lib/webpack.js b/lib/webpack.js index 007a1a5ce..d1fedfd2b 100644 --- a/lib/webpack.js +++ b/lib/webpack.js @@ -87,7 +87,6 @@ exportPlugins(exports, { "CachePlugin": () => require("./CachePlugin"), "ExtendedAPIPlugin": () => require("./ExtendedAPIPlugin"), "ExternalsPlugin": () => require("./ExternalsPlugin"), - "JsonpTemplatePlugin": () => require("./JsonpTemplatePlugin"), "LibraryTemplatePlugin": () => require("./LibraryTemplatePlugin"), "LoaderTargetPlugin": () => require("./LoaderTargetPlugin"), "MemoryOutputFileSystem": () => require("./MemoryOutputFileSystem"), @@ -119,3 +118,11 @@ exportPlugins(exports.optimize = {}, { "OccurrenceOrderPlugin": () => require("./optimize/OccurrenceOrderPlugin"), "UglifyJsPlugin": () => require("./optimize/UglifyJsPlugin") }); +exportPlugins(exports.web = {}, { + "JsonpTemplatePlugin": () => require("./web/JsonpTemplatePlugin"), + "FetchCompileWasmTemplatePlugin": () => require("./web/FetchCompileWasmTemplatePlugin"), +}); +exportPlugins(exports.node = {}, { + "NodeTemplatePlugin": () => require("./node/NodeTemplatePlugin"), + "ReadFileCompileWasmTemplatePlugin": () => require("./node/ReadFileCompileWasmTemplatePlugin"), +}); diff --git a/package.json b/package.json index cca11eb64..77a3f8d69 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "enhanced-resolve": "^3.4.0", "escope": "^3.6.0", "interpret": "^1.0.0", - "json-loader": "^0.5.4", "loader-runner": "^2.3.0", "loader-utils": "^1.1.0", "memory-fs": "~0.4.1", @@ -47,6 +46,7 @@ "jade": "^1.11.0", "jade-loader": "~0.8.0", "js-beautify": "^1.5.10", + "json-loader": "^0.5.7", "less": "^2.5.1", "less-loader": "^4.0.3", "lodash": "^4.17.4", diff --git a/schemas/webpackOptionsSchema.json b/schemas/webpackOptionsSchema.json index 9c5b855c7..43077874e 100644 --- a/schemas/webpackOptionsSchema.json +++ b/schemas/webpackOptionsSchema.json @@ -663,6 +663,7 @@ "javascript/auto", "javascript/dynamic", "javascript/esm", + "json", "webassembly/experimental" ] }, diff --git a/test/ExternalModule.unittest.js b/test/ExternalModule.unittest.js index 93c69c98d..2a74f94b7 100644 --- a/test/ExternalModule.unittest.js +++ b/test/ExternalModule.unittest.js @@ -247,7 +247,7 @@ module.exports = some/request;`; it("deletgates to #getSourceForGlobalVariableExternal", function() { ["this", "window", "global"].forEach((type, i) => { // set up - externalModule.type = type; + externalModule.externalType = type; // invoke externalModule.getSourceString(); @@ -264,7 +264,7 @@ module.exports = some/request;`; it("deletgates to #getSourceForCommonJsExternal", function() { ["commonjs", "commonjs2"].forEach((type, i) => { // set up - externalModule.type = type; + externalModule.externalType = type; // invoke externalModule.getSourceString(); @@ -281,7 +281,7 @@ module.exports = some/request;`; it("deletgates to #getSourceForAmdOrUmdExternal", function() { ["amd", "umd", "umd2"].forEach((type, i) => { // set up - externalModule.type = type; + externalModule.externalType = type; // invoke externalModule.getSourceString(); @@ -298,7 +298,7 @@ module.exports = some/request;`; it("deletgates to #getSourceForGlobalVariableExternal", function() { ["foo", "bar", undefined].forEach((type, i) => { // set up - externalModule.type = type; + externalModule.externalType = type; // invoke externalModule.getSourceString(); diff --git a/test/JsonpExportMainTemplatePlugin.unittest.js b/test/JsonpExportMainTemplatePlugin.unittest.js index 79bc9fc8c..2613f10cd 100644 --- a/test/JsonpExportMainTemplatePlugin.unittest.js +++ b/test/JsonpExportMainTemplatePlugin.unittest.js @@ -4,7 +4,7 @@ const should = require("should"); const sinon = require("sinon"); const TemplatePluginEnvironment = require("./helpers/TemplatePluginEnvironment"); const ConcatSource = require("webpack-sources").ConcatSource; -const JsonpExportMainTemplatePlugin = require("../lib/JsonpExportMainTemplatePlugin"); +const JsonpExportMainTemplatePlugin = require("../lib/web/JsonpExportMainTemplatePlugin"); describe("JsonpExportMainTemplatePlugin", () => { let env; diff --git a/test/NormalModule.unittest.js b/test/NormalModule.unittest.js index 826aa6363..7715310a9 100644 --- a/test/NormalModule.unittest.js +++ b/test/NormalModule.unittest.js @@ -26,6 +26,7 @@ describe("NormalModule", function() { parse() {} }; normalModule = new NormalModule( + "javascript/auto", request, userRequest, rawRequest, @@ -68,6 +69,7 @@ describe("NormalModule", function() { beforeEach(function() { userRequest = "some/userRequest!some/other/userRequest!some/thing/is/off/here"; normalModule = new NormalModule( + "javascript/auto", request, userRequest, rawRequest, @@ -86,6 +88,7 @@ describe("NormalModule", function() { it("ignores paths in query parameters", function() { userRequest = "some/context/loader?query=foo\\bar&otherPath=testpath/other"; normalModule = new NormalModule( + "javascript/auto", request, userRequest, rawRequest, @@ -109,6 +112,7 @@ describe("NormalModule", function() { beforeEach(function() { resource = baseResource + "?some=query"; normalModule = new NormalModule( + "javascript/auto", request, userRequest, rawRequest, diff --git a/test/TestCases.test.js b/test/TestCases.test.js index 0ecf9ccfc..659a57c7c 100644 --- a/test/TestCases.test.js +++ b/test/TestCases.test.js @@ -133,7 +133,7 @@ describe("TestCases", () => { modules: ["web_modules", "node_modules"], mainFields: ["webpack", "browser", "web", "browserify", ["jam", "main"], "main"], aliasFields: ["browser"], - extensions: [".webpack.js", ".web.js", ".js", ".json"] + extensions: [".mjs", ".webpack.js", ".web.js", ".js", ".json"] }, resolveLoader: { modules: ["web_loaders", "web_modules", "node_loaders", "node_modules"], @@ -181,12 +181,14 @@ describe("TestCases", () => { const p = path.join(outputDirectory, module); const fn = vm.runInThisContext("(function(require, module, exports, __dirname, it) {" + fs.readFileSync(p, "utf-8") + "\n})", p); const m = { - exports: {} + exports: {}, + webpackTestSuiteModule: true }; fn.call(m.exports, _require, m, m.exports, outputDirectory, _it); return m.exports; } else return require(module); } + _require.webpackTestSuiteRequire = true; _require("./bundle.js"); if(exportedTest === 0) return done(new Error("No tests exported by test case")); done(); diff --git a/test/cases/loaders/issue-2299/loader/index.js b/test/cases/loaders/issue-2299/loader/index.js index b29af5426..6b2edcda0 100644 --- a/test/cases/loaders/issue-2299/loader/index.js +++ b/test/cases/loaders/issue-2299/loader/index.js @@ -9,8 +9,8 @@ module.exports = function(content) { if(err) { return callback(err); } - callback(null, this.exec(source, url)); - }.bind(this)); + callback(null, JSON.parse(source)); + }); }.bind(this), function(err, results) { if(err) { diff --git a/test/cases/mjs/esm-by-default/index.mjs b/test/cases/mjs/esm-by-default/index.mjs new file mode 100644 index 000000000..839b81030 --- /dev/null +++ b/test/cases/mjs/esm-by-default/index.mjs @@ -0,0 +1,8 @@ +it("should not have commonjs stuff available", function() { + if(typeof module !== "undefined") { // If module is available + module.should.have.property("webpackTestSuiteModule"); // it must be the node.js module + } + if(typeof require !== "undefined") { // If require is available + require.should.have.property("webpackTestSuiteRequire"); // it must be the node.js require + } +}); diff --git a/test/cases/wasm/simple/index.js b/test/cases/wasm/simple/index.js new file mode 100644 index 000000000..aa5fa4dbb --- /dev/null +++ b/test/cases/wasm/simple/index.js @@ -0,0 +1,7 @@ +it("should allow to run a WebAssembly module", function(done) { + import("./module").then(function(module) { + const result = module.run(); + result.should.be.eql(42); + done(); + }); +}); diff --git a/test/cases/wasm/simple/module.js b/test/cases/wasm/simple/module.js new file mode 100644 index 000000000..353e57c62 --- /dev/null +++ b/test/cases/wasm/simple/module.js @@ -0,0 +1,5 @@ +import { add, getNumber } from "./wasm.wasm"; + +export function run() { + return add(getNumber(), 2); +} diff --git a/test/cases/wasm/simple/wasm.wasm b/test/cases/wasm/simple/wasm.wasm new file mode 100644 index 0000000000000000000000000000000000000000..5364a02e7843ddafd1d3273e61e29a4ab08c1939 GIT binary patch literal 63 zcmZQbEY4+QU|?Y6W=deHuV<`JU|_6gW@chwWEW;)PE1K*VBkzoE%7VOO-e0dVC3Rs SVrNibP+-jBW?^vD;06F&`3htJ literal 0 HcmV?d00001 diff --git a/test/statsCases/aggressive-splitting-entry/expected.txt b/test/statsCases/aggressive-splitting-entry/expected.txt index ff106a0e6..5259241a1 100644 --- a/test/statsCases/aggressive-splitting-entry/expected.txt +++ b/test/statsCases/aggressive-splitting-entry/expected.txt @@ -1,13 +1,13 @@ -Hash: 794ae6df9cb4748fbcd7794ae6df9cb4748fbcd7 +Hash: 0c4822f4b0f344d71ebc0c4822f4b0f344d71ebc Child fitting: - Hash: 794ae6df9cb4748fbcd7 + Hash: 0c4822f4b0f344d71ebc Time: Xms Asset Size Chunks Chunk Names 3b0abf784cffee9cdb84.js 2.29 kB 0 [emitted] fd43aeccca69e5179cb6.js 1.98 kB 4 [emitted] - 37a2e572a7162ac860f9.js 5.94 kB 5 [emitted] + 0fb4d7363ffcca01b706.js 5.94 kB 5 [emitted] e1f8db72211be4caf41d.js 1.03 kB 6 [emitted] - Entrypoint main = 37a2e572a7162ac860f9.js e1f8db72211be4caf41d.js fd43aeccca69e5179cb6.js 3b0abf784cffee9cdb84.js + Entrypoint main = 0fb4d7363ffcca01b706.js e1f8db72211be4caf41d.js fd43aeccca69e5179cb6.js 3b0abf784cffee9cdb84.js chunk {0} 3b0abf784cffee9cdb84.js 1.91 kB [initial] [rendered] > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {0} [built] @@ -17,7 +17,7 @@ Child fitting: > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js [0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {4} [built] [1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {4} [built] - chunk {5} 37a2e572a7162ac860f9.js 1.8 kB [entry] [rendered] [recorded] + chunk {5} 0fb4d7363ffcca01b706.js 1.8 kB [entry] [rendered] [recorded] > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js [2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {5} [built] [5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {5} [built] @@ -25,14 +25,14 @@ Child fitting: > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js [3] (webpack)/test/statsCases/aggressive-splitting-entry/e.js 899 bytes {6} [built] Child content-change: - Hash: 794ae6df9cb4748fbcd7 + Hash: 0c4822f4b0f344d71ebc Time: Xms Asset Size Chunks Chunk Names 3b0abf784cffee9cdb84.js 2.29 kB 0 [emitted] fd43aeccca69e5179cb6.js 1.98 kB 4 [emitted] - 37a2e572a7162ac860f9.js 5.94 kB 5 [emitted] + 0fb4d7363ffcca01b706.js 5.94 kB 5 [emitted] e1f8db72211be4caf41d.js 1.03 kB 6 [emitted] - Entrypoint main = 37a2e572a7162ac860f9.js e1f8db72211be4caf41d.js fd43aeccca69e5179cb6.js 3b0abf784cffee9cdb84.js + Entrypoint main = 0fb4d7363ffcca01b706.js e1f8db72211be4caf41d.js fd43aeccca69e5179cb6.js 3b0abf784cffee9cdb84.js chunk {0} 3b0abf784cffee9cdb84.js 1.91 kB [initial] [rendered] > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {0} [built] @@ -42,7 +42,7 @@ Child content-change: > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js [0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {4} [built] [1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {4} [built] - chunk {5} 37a2e572a7162ac860f9.js 1.8 kB [entry] [rendered] [recorded] + chunk {5} 0fb4d7363ffcca01b706.js 1.8 kB [entry] [rendered] [recorded] > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js [2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {5} [built] [5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {5} [built] diff --git a/test/statsCases/aggressive-splitting-on-demand/expected.txt b/test/statsCases/aggressive-splitting-on-demand/expected.txt index 57de94911..9831b7686 100644 --- a/test/statsCases/aggressive-splitting-on-demand/expected.txt +++ b/test/statsCases/aggressive-splitting-on-demand/expected.txt @@ -1,4 +1,4 @@ -Hash: b9000d018fcafbe7adf7 +Hash: 643982be9b8a84182a8b Time: Xms Asset Size Chunks Chunk Names 1744d4ad4296f5fa250c.js 2.01 kB 0 [emitted] @@ -8,8 +8,8 @@ fcea9401f4f21cf79d39.js 1.99 kB 1 [emitted] c1e3d74e221cc503e2e1.js 1.99 kB 4 [emitted] 3d41758100f56aac517e.js 1.03 kB 5 [emitted] c64eeda8f0bfba682f9d.js 1.03 kB 6 [emitted] -9410b3c3e392a3a95fec.js 8.52 kB 7 [emitted] main -Entrypoint main = 9410b3c3e392a3a95fec.js +520c994eaddf273485ec.js 8.5 kB 7 [emitted] main +Entrypoint main = 520c994eaddf273485ec.js chunk {0} 1744d4ad4296f5fa250c.js 1.8 kB {7} [recorded] > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 4:0-51 > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 5:0-44 @@ -44,6 +44,6 @@ chunk {5} 3d41758100f56aac517e.js 899 bytes {7} chunk {6} c64eeda8f0bfba682f9d.js 899 bytes {7} > [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 1:0-16 [10] (webpack)/test/statsCases/aggressive-splitting-on-demand/a.js 899 bytes {6} [built] -chunk {7} 9410b3c3e392a3a95fec.js (main) 248 bytes [entry] +chunk {7} 520c994eaddf273485ec.js (main) 248 bytes [entry] > main [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 248 bytes {7} [built] \ No newline at end of file diff --git a/test/statsCases/chunks/expected.txt b/test/statsCases/chunks/expected.txt index 858e05dd8..db81d30c1 100644 --- a/test/statsCases/chunks/expected.txt +++ b/test/statsCases/chunks/expected.txt @@ -1,10 +1,10 @@ -Hash: acd61a6f698d13599727 +Hash: 5fa31bb3cd49eecb6ebd Time: Xms Asset Size Chunks Chunk Names 0.bundle.js 288 bytes 0 [emitted] 1.bundle.js 152 bytes 1 [emitted] 2.bundle.js 232 bytes 2 [emitted] - bundle.js 7.16 kB 3 [emitted] main + bundle.js 7.14 kB 3 [emitted] main chunk {0} 0.bundle.js 54 bytes {3} [rendered] > [0] (webpack)/test/statsCases/chunks/index.js 3:0-16 [3] (webpack)/test/statsCases/chunks/c.js 54 bytes {0} [built] diff --git a/test/statsCases/color-disabled/expected.txt b/test/statsCases/color-disabled/expected.txt index 5f4668bd6..ee4cea7df 100644 --- a/test/statsCases/color-disabled/expected.txt +++ b/test/statsCases/color-disabled/expected.txt @@ -1,4 +1,4 @@ -Hash: 46a7ae6dc4165f8abc60 +Hash: 9b62d877d26dd61e1fb9 Time: Xms Asset Size Chunks Chunk Names main.js 2.69 kB 0 [emitted] main diff --git a/test/statsCases/color-enabled-custom/expected.txt b/test/statsCases/color-enabled-custom/expected.txt index 872a24ecd..8b05ecb98 100644 --- a/test/statsCases/color-enabled-custom/expected.txt +++ b/test/statsCases/color-enabled-custom/expected.txt @@ -1,4 +1,4 @@ -Hash: 46a7ae6dc4165f8abc60 +Hash: 9b62d877d26dd61e1fb9 Time: Xms Asset Size Chunks Chunk Names main.js 2.69 kB 0 [emitted] main diff --git a/test/statsCases/color-enabled/expected.txt b/test/statsCases/color-enabled/expected.txt index fb740b5bf..dfc322394 100644 --- a/test/statsCases/color-enabled/expected.txt +++ b/test/statsCases/color-enabled/expected.txt @@ -1,4 +1,4 @@ -Hash: 46a7ae6dc4165f8abc60 +Hash: 9b62d877d26dd61e1fb9 Time: Xms Asset Size Chunks Chunk Names main.js 2.69 kB 0 [emitted] main diff --git a/test/statsCases/commons-chunk-min-size-0/expected.txt b/test/statsCases/commons-chunk-min-size-0/expected.txt index bac7ecaa6..2563752ab 100644 --- a/test/statsCases/commons-chunk-min-size-0/expected.txt +++ b/test/statsCases/commons-chunk-min-size-0/expected.txt @@ -1,8 +1,8 @@ -Hash: 555ed68441b4e61480de +Hash: 6e3e301d55085d22e738 Time: Xms Asset Size Chunks Chunk Names entry-1.js 81 bytes 0 [emitted] entry-1 -vendor-1.js 8.24 kB 1 [emitted] vendor-1 +vendor-1.js 8.21 kB 1 [emitted] vendor-1 [0] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/a.js 22 bytes {1} [built] [1] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/b.js 22 bytes {1} [built] [2] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/c.js 22 bytes {1} [built] diff --git a/test/statsCases/commons-chunk-min-size-Infinity/expected.txt b/test/statsCases/commons-chunk-min-size-Infinity/expected.txt index 210c946f3..19cb9793e 100644 --- a/test/statsCases/commons-chunk-min-size-Infinity/expected.txt +++ b/test/statsCases/commons-chunk-min-size-Infinity/expected.txt @@ -1,4 +1,4 @@ -Hash: 770feff5bea289bd08f4 +Hash: 6b34e4a15d90c981775e Time: Xms Asset Size Chunks Chunk Names entry-1.js 3.32 kB 0 [emitted] entry-1 diff --git a/test/statsCases/commons-chunk-plugin-children/expected.txt b/test/statsCases/commons-chunk-plugin-children/expected.txt index 87db05bb1..0fe9efe79 100644 --- a/test/statsCases/commons-chunk-plugin-children/expected.txt +++ b/test/statsCases/commons-chunk-plugin-children/expected.txt @@ -6,7 +6,7 @@ Child normal: 3.bundle.js 837 bytes 3 [emitted] x2 4.bundle.js 530 bytes 4 [emitted] x1 5.bundle.js 1.15 kB 5 [emitted] xx5 - bundle.js 7.24 kB 6 [emitted] main + bundle.js 7.21 kB 6 [emitted] main chunk {0} 0.bundle.js (x4) 56 bytes {6} [rendered] > x4 [4] (webpack)/test/statsCases/commons-chunk-plugin-children/index.js 4:0-42 [0] (webpack)/test/statsCases/commons-chunk-plugin-children/a.js 0 bytes {0} {1} {2} {3} {4} [built] @@ -51,7 +51,7 @@ Child children: 3.bundle.js 692 bytes 3 [emitted] x2 4.bundle.js 472 bytes 4 [emitted] x1 5.bundle.js 1.15 kB 5 [emitted] xx5 - bundle.js 7.36 kB 6 [emitted] main + bundle.js 7.34 kB 6 [emitted] main chunk {0} 0.bundle.js (x4) 56 bytes {6} [rendered] > x4 [4] (webpack)/test/statsCases/commons-chunk-plugin-children/index.js 4:0-42 [1] (webpack)/test/statsCases/commons-chunk-plugin-children/c.js 0 bytes {0} {1} {5} [built] @@ -90,7 +90,7 @@ Child async: 4.bundle.js 692 bytes 4 [emitted] x2 5.bundle.js 472 bytes 5 [emitted] x1 6.bundle.js 1.15 kB 6 [emitted] xx5 - bundle.js 7.44 kB 7 [emitted] main + bundle.js 7.42 kB 7 [emitted] main chunk {0} 0.bundle.js 0 bytes {7} [rendered] > async commons x1 [4] (webpack)/test/statsCases/commons-chunk-plugin-children/index.js 1:0-42 > async commons x2 [4] (webpack)/test/statsCases/commons-chunk-plugin-children/index.js 2:0-42 @@ -134,7 +134,7 @@ Child deep-children: 3.bundle.js 912 bytes 3 [emitted] x3 4.bundle.js 692 bytes 4 [emitted] x2 5.bundle.js 472 bytes 5 [emitted] x1 - bundle.js 7.41 kB 6 [emitted] main + bundle.js 7.39 kB 6 [emitted] main chunk {0} 0.bundle.js (xx5) 42 bytes {6} [rendered] > xx5 [9] (webpack)/test/statsCases/commons-chunk-plugin-children/x5.js 3:0-44 [3] (webpack)/test/statsCases/commons-chunk-plugin-children/d.js 0 bytes {0} {1} [built] @@ -171,7 +171,7 @@ Child deep-async: 4.bundle.js 692 bytes 4 [emitted] x2 5.bundle.js 472 bytes 5 [emitted] x1 6.bundle.js 1.03 kB 6 [emitted] xx5 - bundle.js 7.44 kB 7 [emitted] main + bundle.js 7.42 kB 7 [emitted] main chunk {0} 0.bundle.js 0 bytes {7} [rendered] > async commons x1 [4] (webpack)/test/statsCases/commons-chunk-plugin-children/index.js 1:0-42 > async commons x2 [4] (webpack)/test/statsCases/commons-chunk-plugin-children/index.js 2:0-42 diff --git a/test/statsCases/commons-plugin-issue-4980/expected.txt b/test/statsCases/commons-plugin-issue-4980/expected.txt index 858c70958..6aac57fd0 100644 --- a/test/statsCases/commons-plugin-issue-4980/expected.txt +++ b/test/statsCases/commons-plugin-issue-4980/expected.txt @@ -1,22 +1,22 @@ -Hash: c107a06e25bb732bf473181ecf9358e3cc7f45e7 +Hash: 5d62edfa66d98709f5017b119fd7e38c61b8ef0d Child - Hash: c107a06e25bb732bf473 + Hash: 5d62edfa66d98709f501 Time: Xms Asset Size Chunks Chunk Names app.js 1.32 kB 0 [emitted] app vendor.3210cd7580ff3ec8d7c1.js 619 bytes 1 [emitted] vendor - runtime.js 7.25 kB 2 [emitted] runtime + runtime.js 7.22 kB 2 [emitted] runtime [./constants.js] (webpack)/test/statsCases/commons-plugin-issue-4980/constants.js 87 bytes {1} [built] [./entry-1.js] (webpack)/test/statsCases/commons-plugin-issue-4980/entry-1.js 67 bytes {0} [built] [./submodule-a.js] (webpack)/test/statsCases/commons-plugin-issue-4980/submodule-a.js 59 bytes {0} [built] [./submodule-b.js] (webpack)/test/statsCases/commons-plugin-issue-4980/submodule-b.js 59 bytes {0} [built] Child - Hash: 181ecf9358e3cc7f45e7 + Hash: 7b119fd7e38c61b8ef0d Time: Xms Asset Size Chunks Chunk Names app.js 1.37 kB 0 [emitted] app vendor.3210cd7580ff3ec8d7c1.js 619 bytes 1 [emitted] vendor - runtime.js 7.25 kB 2 [emitted] runtime + runtime.js 7.22 kB 2 [emitted] runtime [./constants.js] (webpack)/test/statsCases/commons-plugin-issue-4980/constants.js 87 bytes {1} [built] [./entry-2.js] (webpack)/test/statsCases/commons-plugin-issue-4980/entry-2.js 67 bytes {0} [built] [./submodule-a.js] (webpack)/test/statsCases/commons-plugin-issue-4980/submodule-a.js 59 bytes {0} [built] diff --git a/test/statsCases/define-plugin/expected.txt b/test/statsCases/define-plugin/expected.txt index 357600191..254b15707 100644 --- a/test/statsCases/define-plugin/expected.txt +++ b/test/statsCases/define-plugin/expected.txt @@ -1,12 +1,12 @@ -Hash: 5740106240ac3936376e1d8c50bebd858f67edaf +Hash: 591f65b34ea2fed28590a2524f672c23ebaef569 Child - Hash: 5740106240ac3936376e + Hash: 591f65b34ea2fed28590 Time: Xms Asset Size Chunks Chunk Names main.js 2.73 kB 0 [emitted] main [0] (webpack)/test/statsCases/define-plugin/index.js 24 bytes {0} [built] Child - Hash: 1d8c50bebd858f67edaf + Hash: a2524f672c23ebaef569 Time: Xms Asset Size Chunks Chunk Names main.js 2.73 kB 0 [emitted] main diff --git a/test/statsCases/exclude-with-loader/expected.txt b/test/statsCases/exclude-with-loader/expected.txt index a36b319f9..ee191ccd0 100644 --- a/test/statsCases/exclude-with-loader/expected.txt +++ b/test/statsCases/exclude-with-loader/expected.txt @@ -1,7 +1,7 @@ -Hash: 42d4b473056b7c1c9f38 +Hash: e2851c8d4cdd7e82ca78 Time: Xms Asset Size Chunks Chunk Names -bundle.js 3.14 kB 0 [emitted] main +bundle.js 3.13 kB 0 [emitted] main + 1 hidden asset [0] (webpack)/test/statsCases/exclude-with-loader/index.js 77 bytes {0} [built] [1] (webpack)/test/statsCases/exclude-with-loader/a.txt 43 bytes {0} [built] diff --git a/test/statsCases/external/expected.txt b/test/statsCases/external/expected.txt index 7ed996f36..fb58d209c 100644 --- a/test/statsCases/external/expected.txt +++ b/test/statsCases/external/expected.txt @@ -1,4 +1,4 @@ -Hash: 6d4c276e12a806fa09b1 +Hash: 7aea3de5f4fd504d5195 Time: Xms Asset Size Chunks Chunk Names main.js 2.82 kB 0 [emitted] main diff --git a/test/statsCases/filter-warnings/expected.txt b/test/statsCases/filter-warnings/expected.txt index 06c595861..cc502098f 100644 --- a/test/statsCases/filter-warnings/expected.txt +++ b/test/statsCases/filter-warnings/expected.txt @@ -1,12 +1,12 @@ -Hash: 19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a19b74c5b0289d95eca2a +Hash: cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0cd4abefb3963c61372a0 Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main WARNING in bundle.js from UglifyJs - Dropping unused variable installedWasmModules [webpack/bootstrap 19b74c5b0289d95eca2a:5,0] + Dropping unused variable installedWasmModules [webpack/bootstrap cd4abefb3963c61372a0:5,0] Dropping side-effect-free statement [./index.js:6,0] Dropping unused function someUnUsedFunction1 [./index.js:8,0] Dropping unused function someUnUsedFunction2 [./index.js:9,0] @@ -19,43 +19,43 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main WARNING in bundle.js from UglifyJs - Dropping unused variable installedWasmModules [webpack/bootstrap 19b74c5b0289d95eca2a:5,0] + Dropping unused variable installedWasmModules [webpack/bootstrap cd4abefb3963c61372a0:5,0] Dropping side-effect-free statement [./index.js:6,0] Dropping unused function someUnUsedFunction1 [./index.js:8,0] Dropping unused function someUnUsedFunction2 [./index.js:9,0] @@ -68,13 +68,13 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main WARNING in bundle.js from UglifyJs - Dropping unused variable installedWasmModules [webpack/bootstrap 19b74c5b0289d95eca2a:5,0] + Dropping unused variable installedWasmModules [webpack/bootstrap cd4abefb3963c61372a0:5,0] Dropping side-effect-free statement [./index.js:6,0] Dropping unused function someUnUsedFunction1 [./index.js:8,0] Dropping unused function someUnUsedFunction2 [./index.js:9,0] @@ -87,13 +87,13 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main WARNING in bundle.js from UglifyJs - Dropping unused variable installedWasmModules [webpack/bootstrap 19b74c5b0289d95eca2a:5,0] + Dropping unused variable installedWasmModules [webpack/bootstrap cd4abefb3963c61372a0:5,0] Dropping side-effect-free statement [./index.js:6,0] Dropping unused function someUnUsedFunction1 [./index.js:8,0] Dropping unused function someUnUsedFunction2 [./index.js:9,0] @@ -106,13 +106,13 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main WARNING in bundle.js from UglifyJs - Dropping unused variable installedWasmModules [webpack/bootstrap 19b74c5b0289d95eca2a:5,0] + Dropping unused variable installedWasmModules [webpack/bootstrap cd4abefb3963c61372a0:5,0] Dropping side-effect-free statement [./index.js:6,0] Dropping unused function someUnUsedFunction1 [./index.js:8,0] Dropping unused function someUnUsedFunction2 [./index.js:9,0] @@ -125,13 +125,13 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main WARNING in bundle.js from UglifyJs - Dropping unused variable installedWasmModules [webpack/bootstrap 19b74c5b0289d95eca2a:5,0] + Dropping unused variable installedWasmModules [webpack/bootstrap cd4abefb3963c61372a0:5,0] Dropping side-effect-free statement [./index.js:6,0] Dropping unused function someUnUsedFunction1 [./index.js:8,0] Dropping unused function someUnUsedFunction2 [./index.js:9,0] @@ -144,13 +144,13 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 19b74c5b0289d95eca2a + Hash: cd4abefb3963c61372a0 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main WARNING in bundle.js from UglifyJs - Dropping unused variable installedWasmModules [webpack/bootstrap 19b74c5b0289d95eca2a:5,0] + Dropping unused variable installedWasmModules [webpack/bootstrap cd4abefb3963c61372a0:5,0] Dropping side-effect-free statement [./index.js:6,0] Dropping unused function someUnUsedFunction1 [./index.js:8,0] Dropping unused function someUnUsedFunction2 [./index.js:9,0] diff --git a/test/statsCases/import-context-filter/expected.txt b/test/statsCases/import-context-filter/expected.txt index e34b3533a..bc1c5f812 100644 --- a/test/statsCases/import-context-filter/expected.txt +++ b/test/statsCases/import-context-filter/expected.txt @@ -1,10 +1,10 @@ -Hash: 6c4d6f1ed0a9a90ec93e +Hash: 9a8c88d293855a916088 Time: Xms Asset Size Chunks Chunk Names 0.js 339 bytes 0 [emitted] 1.js 345 bytes 1 [emitted] 2.js 336 bytes 2 [emitted] -entry.js 7.88 kB 3 [emitted] entry +entry.js 7.86 kB 3 [emitted] entry [0] (webpack)/test/statsCases/import-context-filter/templates/bar.js 38 bytes {2} [optional] [built] [1] (webpack)/test/statsCases/import-context-filter/templates/baz.js 38 bytes {1} [optional] [built] [2] (webpack)/test/statsCases/import-context-filter/templates/foo.js 38 bytes {0} [optional] [built] diff --git a/test/statsCases/import-weak/expected.txt b/test/statsCases/import-weak/expected.txt index aeca2c4c0..c07cea651 100644 --- a/test/statsCases/import-weak/expected.txt +++ b/test/statsCases/import-weak/expected.txt @@ -1,8 +1,8 @@ -Hash: a6cd1e3ec94a80959c78 +Hash: 9915cc41cf8ad107ab1e Time: Xms Asset Size Chunks Chunk Names 0.js 149 bytes 0 [emitted] -entry.js 7.28 kB 1 [emitted] entry +entry.js 7.26 kB 1 [emitted] entry [0] (webpack)/test/statsCases/import-weak/modules/b.js 22 bytes {0} [built] [1] (webpack)/test/statsCases/import-weak/entry.js 120 bytes {1} [built] [2] (webpack)/test/statsCases/import-weak/modules/a.js 37 bytes [built] \ No newline at end of file diff --git a/test/statsCases/limit-chunk-count-plugin/expected.txt b/test/statsCases/limit-chunk-count-plugin/expected.txt index 54bf42376..663baee2c 100644 --- a/test/statsCases/limit-chunk-count-plugin/expected.txt +++ b/test/statsCases/limit-chunk-count-plugin/expected.txt @@ -1,6 +1,6 @@ -Hash: 468570e5397bec3aa1424f36dcb9c59adabdac76a4dfe141df617e196eba275cb1ecca589a656bdb +Hash: 8a563b80ea8746a3892436a7c7bbedbe36681d4bad59fc60a72e40a54e4dcc419a84b806e80ea299 Child - Hash: 468570e5397bec3aa142 + Hash: 8a563b80ea8746a38924 Time: Xms Asset Size Chunks Chunk Names bundle.js 3.61 kB 0 [emitted] main @@ -12,11 +12,11 @@ Child [4] (webpack)/test/statsCases/limit-chunk-count-plugin/d.js 22 bytes {0} [built] [5] (webpack)/test/statsCases/limit-chunk-count-plugin/e.js 22 bytes {0} [built] Child - Hash: 4f36dcb9c59adabdac76 + Hash: 36a7c7bbedbe36681d4b Time: Xms Asset Size Chunks Chunk Names 0.bundle.js 651 bytes 0 [emitted] - bundle.js 7.19 kB 1 [emitted] main + bundle.js 7.17 kB 1 [emitted] main chunk {0} 0.bundle.js 118 bytes {1} [rendered] [1] (webpack)/test/statsCases/limit-chunk-count-plugin/a.js 22 bytes {0} [built] [2] (webpack)/test/statsCases/limit-chunk-count-plugin/b.js 22 bytes {0} [built] @@ -26,12 +26,12 @@ Child chunk {1} bundle.js (main) 73 bytes [entry] [rendered] [0] (webpack)/test/statsCases/limit-chunk-count-plugin/index.js 73 bytes {1} [built] Child - Hash: a4dfe141df617e196eba + Hash: ad59fc60a72e40a54e4d Time: Xms Asset Size Chunks Chunk Names 0.bundle.js 504 bytes 0 [emitted] 1.bundle.js 232 bytes 1 [emitted] - bundle.js 7.19 kB 2 [emitted] main + bundle.js 7.17 kB 2 [emitted] main chunk {0} 0.bundle.js 74 bytes {2} [rendered] [1] (webpack)/test/statsCases/limit-chunk-count-plugin/a.js 22 bytes {0} [built] [3] (webpack)/test/statsCases/limit-chunk-count-plugin/c.js 30 bytes {0} [built] @@ -42,13 +42,13 @@ Child chunk {2} bundle.js (main) 73 bytes [entry] [rendered] [0] (webpack)/test/statsCases/limit-chunk-count-plugin/index.js 73 bytes {2} [built] Child - Hash: 275cb1ecca589a656bdb + Hash: cc419a84b806e80ea299 Time: Xms Asset Size Chunks Chunk Names 0.bundle.js 232 bytes 0 [emitted] 1.bundle.js 254 bytes 1 [emitted] 2.bundle.js 333 bytes 2 [emitted] - bundle.js 7.18 kB 3 [emitted] main + bundle.js 7.16 kB 3 [emitted] main chunk {0} 0.bundle.js 44 bytes {2} {3} [rendered] [2] (webpack)/test/statsCases/limit-chunk-count-plugin/b.js 22 bytes {0} [built] [5] (webpack)/test/statsCases/limit-chunk-count-plugin/e.js 22 bytes {0} [built] diff --git a/test/statsCases/max-modules-default/expected.txt b/test/statsCases/max-modules-default/expected.txt index 3ff08548b..6748fbbad 100644 --- a/test/statsCases/max-modules-default/expected.txt +++ b/test/statsCases/max-modules-default/expected.txt @@ -1,4 +1,4 @@ -Hash: 25e5bbed2cc755384806 +Hash: ce34adc7e3ac058ea5f0 Time: Xms Asset Size Chunks Chunk Names main.js 6 kB 0 [emitted] main diff --git a/test/statsCases/max-modules/expected.txt b/test/statsCases/max-modules/expected.txt index 870f5764e..e409d3306 100644 --- a/test/statsCases/max-modules/expected.txt +++ b/test/statsCases/max-modules/expected.txt @@ -1,4 +1,4 @@ -Hash: 25e5bbed2cc755384806 +Hash: ce34adc7e3ac058ea5f0 Time: Xms Asset Size Chunks Chunk Names main.js 6 kB 0 [emitted] main diff --git a/test/statsCases/module-deduplication-named/expected.txt b/test/statsCases/module-deduplication-named/expected.txt index cba3a9d98..0d1b12147 100644 --- a/test/statsCases/module-deduplication-named/expected.txt +++ b/test/statsCases/module-deduplication-named/expected.txt @@ -2,9 +2,9 @@ Asset Size Chunks Chunk Names 0.js 839 bytes 0 [emitted] async3 1.js 839 bytes 1 [emitted] async2 2.js 839 bytes 2 [emitted] async1 -e3.js 8.23 kB 3 [emitted] e3 -e2.js 8.21 kB 4 [emitted] e2 -e1.js 8.19 kB 5 [emitted] e1 +e3.js 8.21 kB 3 [emitted] e3 +e2.js 8.19 kB 4 [emitted] e2 +e1.js 8.17 kB 5 [emitted] e1 chunk {0} 0.js (async3) 89 bytes {1} {3} [rendered] [4] (webpack)/test/statsCases/module-deduplication-named/h.js 9 bytes {0} {3} [built] [7] (webpack)/test/statsCases/module-deduplication-named/async3.js 80 bytes {0} [built] diff --git a/test/statsCases/module-deduplication/expected.txt b/test/statsCases/module-deduplication/expected.txt index ef8125bc7..483db51d9 100644 --- a/test/statsCases/module-deduplication/expected.txt +++ b/test/statsCases/module-deduplication/expected.txt @@ -5,9 +5,9 @@ Asset Size Chunks Chunk Names 3.js 692 bytes 3 [emitted] 4.js 692 bytes 4 [emitted] 5.js 692 bytes 5 [emitted] -e3.js 8.43 kB 6 [emitted] e3 -e2.js 8.4 kB 7 [emitted] e2 -e1.js 8.38 kB 8 [emitted] e1 +e3.js 8.4 kB 6 [emitted] e3 +e2.js 8.38 kB 7 [emitted] e2 +e1.js 8.36 kB 8 [emitted] e1 chunk {0} 0.js 37 bytes {7} {8} [rendered] [6] (webpack)/test/statsCases/module-deduplication/async3.js 28 bytes {0} {3} [built] [7] (webpack)/test/statsCases/module-deduplication/h.js 9 bytes {0} {6} [built] diff --git a/test/statsCases/named-chunks-plugin-async/expected.txt b/test/statsCases/named-chunks-plugin-async/expected.txt index a2d467c5c..32c48427c 100644 --- a/test/statsCases/named-chunks-plugin-async/expected.txt +++ b/test/statsCases/named-chunks-plugin-async/expected.txt @@ -1,9 +1,9 @@ -Hash: e569776cf2d7bb15f549 +Hash: 2bb1fb80e892d7ca83ed Time: Xms Asset Size Chunks Chunk Names chunk-containing-__a_js.js 316 bytes chunk-containing-__a_js [emitted] chunk-containing-__b_js.js 173 bytes chunk-containing-__b_js [emitted] - entry.js 7.07 kB entry [emitted] entry + entry.js 7.04 kB entry [emitted] entry [0] (webpack)/test/statsCases/named-chunks-plugin-async/modules/b.js 22 bytes {chunk-containing-__b_js} [built] [1] (webpack)/test/statsCases/named-chunks-plugin-async/entry.js 47 bytes {entry} [built] [2] (webpack)/test/statsCases/named-chunks-plugin-async/modules/a.js 37 bytes {chunk-containing-__a_js} [built] \ No newline at end of file diff --git a/test/statsCases/named-chunks-plugin/expected.txt b/test/statsCases/named-chunks-plugin/expected.txt index 257836f00..a1a8e8846 100644 --- a/test/statsCases/named-chunks-plugin/expected.txt +++ b/test/statsCases/named-chunks-plugin/expected.txt @@ -1,8 +1,8 @@ -Hash: a1229254603619424568 +Hash: 3e5729d50a2db92f6b0e Time: Xms Asset Size Chunks Chunk Names entry.js 615 bytes entry [emitted] entry -manifest.js 7.26 kB manifest [emitted] manifest +manifest.js 7.23 kB manifest [emitted] manifest vendor.js 469 bytes vendor [emitted] vendor [0] multi ./modules/a ./modules/b 40 bytes {vendor} [built] [./entry.js] (webpack)/test/statsCases/named-chunks-plugin/entry.js 72 bytes {entry} [built] diff --git a/test/statsCases/optimize-chunks/expected.txt b/test/statsCases/optimize-chunks/expected.txt index 66b1d32bc..a2a12b23a 100644 --- a/test/statsCases/optimize-chunks/expected.txt +++ b/test/statsCases/optimize-chunks/expected.txt @@ -1,4 +1,4 @@ -Hash: 7c00c9ec24322c092eb7 +Hash: f3ec4488d129c46ade54 Time: Xms Asset Size Chunks Chunk Names 0.js 281 bytes 0 [emitted] cir1 @@ -8,7 +8,7 @@ Time: Xms 4.js 212 bytes 4, 6 [emitted] chunk 5.js 356 bytes 5, 3 [emitted] cir2 from cir1 6.js 130 bytes 6 [emitted] ac in ab -main.js 7.85 kB 7 [emitted] main +main.js 7.83 kB 7 [emitted] main chunk {0} 0.js (cir1) 81 bytes {3} {7} [rendered] > duplicate cir1 from cir2 [6] (webpack)/test/statsCases/optimize-chunks/circular2.js 1:0-79 > duplicate cir1 [7] (webpack)/test/statsCases/optimize-chunks/index.js 13:0-54 diff --git a/test/statsCases/preset-detailed/expected.txt b/test/statsCases/preset-detailed/expected.txt index 3cd5880ef..e9f1a0880 100644 --- a/test/statsCases/preset-detailed/expected.txt +++ b/test/statsCases/preset-detailed/expected.txt @@ -1,10 +1,10 @@ -Hash: 7b6e615d7bd302eb9c50 +Hash: c40b21f5fbec6559b344 Time: Xms Asset Size Chunks Chunk Names 0.js 288 bytes 0 [emitted] 1.js 152 bytes 1 [emitted] 2.js 232 bytes 2 [emitted] -main.js 7.16 kB 3 [emitted] main +main.js 7.13 kB 3 [emitted] main Entrypoint main = main.js chunk {0} 0.js 54 bytes {3} [rendered] > [0] (webpack)/test/statsCases/preset-detailed/index.js 3:0-16 diff --git a/test/statsCases/preset-normal/expected.txt b/test/statsCases/preset-normal/expected.txt index 43e370123..b55fbe2b8 100644 --- a/test/statsCases/preset-normal/expected.txt +++ b/test/statsCases/preset-normal/expected.txt @@ -1,10 +1,10 @@ -Hash: 7b6e615d7bd302eb9c50 +Hash: c40b21f5fbec6559b344 Time: Xms Asset Size Chunks Chunk Names 0.js 288 bytes 0 [emitted] 1.js 152 bytes 1 [emitted] 2.js 232 bytes 2 [emitted] -main.js 7.16 kB 3 [emitted] main +main.js 7.13 kB 3 [emitted] main [0] (webpack)/test/statsCases/preset-normal/index.js 51 bytes {3} [built] [1] (webpack)/test/statsCases/preset-normal/a.js 22 bytes {3} [built] [2] (webpack)/test/statsCases/preset-normal/b.js 22 bytes {1} [built] diff --git a/test/statsCases/preset-verbose/expected.txt b/test/statsCases/preset-verbose/expected.txt index f69043b6c..4bf2546bb 100644 --- a/test/statsCases/preset-verbose/expected.txt +++ b/test/statsCases/preset-verbose/expected.txt @@ -1,10 +1,10 @@ -Hash: 7b6e615d7bd302eb9c50 +Hash: c40b21f5fbec6559b344 Time: Xms Asset Size Chunks Chunk Names 0.js 288 bytes 0 [emitted] 1.js 152 bytes 1 [emitted] 2.js 232 bytes 2 [emitted] -main.js 7.16 kB 3 [emitted] main +main.js 7.13 kB 3 [emitted] main Entrypoint main = main.js chunk {0} 0.js 54 bytes {3} [rendered] > [0] (webpack)/test/statsCases/preset-verbose/index.js 3:0-16 diff --git a/test/statsCases/resolve-plugin-context/expected.txt b/test/statsCases/resolve-plugin-context/expected.txt index cf9d33a95..183dc0882 100644 --- a/test/statsCases/resolve-plugin-context/expected.txt +++ b/test/statsCases/resolve-plugin-context/expected.txt @@ -1,4 +1,4 @@ -Hash: b28ec09e6f09816bd407 +Hash: 2f10a36f9685efee695a Time: Xms Asset Size Chunks Chunk Names bundle.js 3.1 kB 0 [emitted] main diff --git a/test/statsCases/reverse-sort-modules/expected.txt b/test/statsCases/reverse-sort-modules/expected.txt index f6fd12e6c..7dabf4970 100644 --- a/test/statsCases/reverse-sort-modules/expected.txt +++ b/test/statsCases/reverse-sort-modules/expected.txt @@ -1,4 +1,4 @@ -Hash: 25e5bbed2cc755384806 +Hash: ce34adc7e3ac058ea5f0 Time: Xms Asset Size Chunks Chunk Names main.js 6 kB 0 [emitted] main diff --git a/test/statsCases/scope-hoisting-multi/expected.txt b/test/statsCases/scope-hoisting-multi/expected.txt index 2b0f5002d..24cf832c3 100644 --- a/test/statsCases/scope-hoisting-multi/expected.txt +++ b/test/statsCases/scope-hoisting-multi/expected.txt @@ -1,6 +1,6 @@ -Hash: 8619511e846dc23eb000e02721a227f38dff757d +Hash: 1392f84a24c55c490b5e2d28fa80892d711ae32b Child - Hash: 8619511e846dc23eb000 + Hash: 1392f84a24c55c490b5e Time: Xms [0] (webpack)/test/statsCases/scope-hoisting-multi/common2.js 25 bytes {3} {4} [built] [1] (webpack)/test/statsCases/scope-hoisting-multi/common_lazy_shared.js 25 bytes {0} {1} {2} [built] @@ -14,7 +14,7 @@ Child [9] (webpack)/test/statsCases/scope-hoisting-multi/second.js 177 bytes {4} [built] [10] (webpack)/test/statsCases/scope-hoisting-multi/lazy_second.js 55 bytes {1} [built] Child - Hash: e02721a227f38dff757d + Hash: 2d28fa80892d711ae32b Time: Xms [0] (webpack)/test/statsCases/scope-hoisting-multi/common_lazy_shared.js 25 bytes {0} {1} {2} [built] [1] (webpack)/test/statsCases/scope-hoisting-multi/vendor.js 25 bytes {5} [built] diff --git a/test/statsCases/separate-css-bundle/expected.txt b/test/statsCases/separate-css-bundle/expected.txt index 60af3a771..cd2085a6e 100644 --- a/test/statsCases/separate-css-bundle/expected.txt +++ b/test/statsCases/separate-css-bundle/expected.txt @@ -1,9 +1,9 @@ -Hash: 9b8205a049992bc9783bb1a58f5b0b09d9dd1037 +Hash: 83e56382e56968147d36dee705eb8be60b2037db Child - Hash: 9b8205a049992bc9783b + Hash: 83e56382e56968147d36 Time: Xms Asset Size Chunks Chunk Names - fd4c2ca1440010a55587.js 2.83 kB 0 [emitted] main + 240942974444681d3abd.js 2.83 kB 0 [emitted] main c815cf440254d4f3bba4e7041db00a28.css 26 bytes 0 [emitted] main [0] (webpack)/test/statsCases/separate-css-bundle/a/index.js 23 bytes {0} [built] [1] (webpack)/test/statsCases/separate-css-bundle/a/file.css 41 bytes {0} [built] @@ -15,10 +15,10 @@ Child [0] (webpack)/node_modules/css-loader!(webpack)/test/statsCases/separate-css-bundle/a/file.css 199 bytes {0} [built] [1] (webpack)/node_modules/css-loader/lib/css-base.js 2.26 kB {0} [built] Child - Hash: b1a58f5b0b09d9dd1037 + Hash: dee705eb8be60b2037db Time: Xms Asset Size Chunks Chunk Names - fd4c2ca1440010a55587.js 2.83 kB 0 [emitted] main + 240942974444681d3abd.js 2.83 kB 0 [emitted] main a3f385680aef7a9bb2a517699532cc34.css 28 bytes 0 [emitted] main [0] (webpack)/test/statsCases/separate-css-bundle/b/index.js 23 bytes {0} [built] [1] (webpack)/test/statsCases/separate-css-bundle/b/file.css 41 bytes {0} [built] diff --git a/test/statsCases/simple-more-info/expected.txt b/test/statsCases/simple-more-info/expected.txt index 3368a6345..aace31f91 100644 --- a/test/statsCases/simple-more-info/expected.txt +++ b/test/statsCases/simple-more-info/expected.txt @@ -1,4 +1,4 @@ -Hash: 2e10a5e30d58364c392c +Hash: 9bd1f5491993467e8b27 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.69 kB 0 [emitted] main diff --git a/test/statsCases/simple/expected.txt b/test/statsCases/simple/expected.txt index 81f7f1400..5302d2575 100644 --- a/test/statsCases/simple/expected.txt +++ b/test/statsCases/simple/expected.txt @@ -1,4 +1,4 @@ -Hash: 2e10a5e30d58364c392c +Hash: 9bd1f5491993467e8b27 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.69 kB 0 [emitted] main diff --git a/test/statsCases/tree-shaking/expected.txt b/test/statsCases/tree-shaking/expected.txt index cac6798fd..8296fa34d 100644 --- a/test/statsCases/tree-shaking/expected.txt +++ b/test/statsCases/tree-shaking/expected.txt @@ -1,4 +1,4 @@ -Hash: 86e656e04ad1845b5137 +Hash: 2500e9cab76400ff4f51 Time: Xms Asset Size Chunks Chunk Names bundle.js 7.25 kB 0 [emitted] main diff --git a/test/statsCases/warnings-uglifyjs/expected.txt b/test/statsCases/warnings-uglifyjs/expected.txt index bc216f8e0..889394ddc 100644 --- a/test/statsCases/warnings-uglifyjs/expected.txt +++ b/test/statsCases/warnings-uglifyjs/expected.txt @@ -1,4 +1,4 @@ -Hash: 10e3e5dbac353b4cd892 +Hash: 7df1195d08327e14c776 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.13 kB 0 [emitted] main diff --git a/yarn.lock b/yarn.lock index b3e6d70b2..b9a972ff7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2232,7 +2232,7 @@ jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" -json-loader@^0.5.4: +json-loader@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d"