From 61dfa67d105cea49df7cfb978bc126649293b9b2 Mon Sep 17 00:00:00 2001 From: Alan Zhang Date: Tue, 23 Apr 2019 12:16:28 +0800 Subject: [PATCH 01/35] Turn off NodeStuffPlugin with when "node" configuration set to "false" --- lib/NodeStuffPlugin.js | 2 ++ test/configCases/parsing/issue-9042/index.js | 3 +++ test/configCases/parsing/issue-9042/test.config.js | 5 +++++ test/configCases/parsing/issue-9042/webpack.config.js | 4 ++++ 4 files changed, 14 insertions(+) create mode 100644 test/configCases/parsing/issue-9042/index.js create mode 100644 test/configCases/parsing/issue-9042/test.config.js create mode 100644 test/configCases/parsing/issue-9042/webpack.config.js diff --git a/lib/NodeStuffPlugin.js b/lib/NodeStuffPlugin.js index 75d2e73b0..66dc1e671 100644 --- a/lib/NodeStuffPlugin.js +++ b/lib/NodeStuffPlugin.js @@ -17,6 +17,8 @@ class NodeStuffPlugin { apply(compiler) { const options = this.options; + if (options === false) return; + compiler.hooks.compilation.tap( "NodeStuffPlugin", (compilation, { normalModuleFactory }) => { diff --git a/test/configCases/parsing/issue-9042/index.js b/test/configCases/parsing/issue-9042/index.js new file mode 100644 index 000000000..c469ca799 --- /dev/null +++ b/test/configCases/parsing/issue-9042/index.js @@ -0,0 +1,3 @@ +it("should not load __dirname when node option is false", function() { + expect((typeof __dirname)).toBe("undefined"); +}); diff --git a/test/configCases/parsing/issue-9042/test.config.js b/test/configCases/parsing/issue-9042/test.config.js new file mode 100644 index 000000000..d55bc3823 --- /dev/null +++ b/test/configCases/parsing/issue-9042/test.config.js @@ -0,0 +1,5 @@ +module.exports = { + moduleScope: function(scope) { + delete scope.__dirname; + } +}; diff --git a/test/configCases/parsing/issue-9042/webpack.config.js b/test/configCases/parsing/issue-9042/webpack.config.js new file mode 100644 index 000000000..9f1a00b55 --- /dev/null +++ b/test/configCases/parsing/issue-9042/webpack.config.js @@ -0,0 +1,4 @@ +module.exports = { + target: "web", + node: false +}; From 5b8daf847aac10ad48496d7e6eedecdf3e1e9cf1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 24 Apr 2019 02:14:57 +0000 Subject: [PATCH 02/35] chore(deps-dev): bump typescript from 3.4.3 to 3.4.5 Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.4.3 to 3.4.5. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/commits) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5e3df6f85..c89d2029f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6802,9 +6802,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@^3.0.0-rc: - version "3.4.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.3.tgz#0eb320e4ace9b10eadf5bc6103286b0f8b7c224f" - integrity sha512-FFgHdPt4T/duxx6Ndf7hwgMZZjZpB+U0nMNGVCYPq0rEzWKjEDobm4J6yb3CS7naZ0yURFqdw9Gwc7UOh/P9oQ== + version "3.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" + integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== uglify-js@^2.4.19, uglify-js@^2.6.1: version "2.8.29" From 269efb9fd7754ab9d385c3d1650b56f3000854c4 Mon Sep 17 00:00:00 2001 From: Alan Zhang Date: Wed, 24 Apr 2019 10:40:51 +0800 Subject: [PATCH 03/35] Never apply NodeStuffPlugin when "node" set to false --- lib/NodeStuffPlugin.js | 2 -- lib/WebpackOptionsApply.js | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/NodeStuffPlugin.js b/lib/NodeStuffPlugin.js index 66dc1e671..75d2e73b0 100644 --- a/lib/NodeStuffPlugin.js +++ b/lib/NodeStuffPlugin.js @@ -17,8 +17,6 @@ class NodeStuffPlugin { apply(compiler) { const options = this.options; - if (options === false) return; - compiler.hooks.compilation.tap( "NodeStuffPlugin", (compilation, { normalModuleFactory }) => { diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index b9fd13084..bfe7d920b 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -21,7 +21,6 @@ const RecordIdsPlugin = require("./RecordIdsPlugin"); const APIPlugin = require("./APIPlugin"); const ConstPlugin = require("./ConstPlugin"); -const NodeStuffPlugin = require("./NodeStuffPlugin"); const CompatibilityPlugin = require("./CompatibilityPlugin"); const TemplatedPathPlugin = require("./TemplatedPathPlugin"); @@ -290,7 +289,10 @@ class WebpackOptionsApply extends OptionsApply { } new CommonJsPlugin(options.module).apply(compiler); new LoaderPlugin().apply(compiler); - new NodeStuffPlugin(options.node).apply(compiler); + if (options.node !== false) { + const NodeStuffPlugin = require("./NodeStuffPlugin"); + new NodeStuffPlugin(options.node).apply(compiler); + } new APIPlugin().apply(compiler); new ConstPlugin().apply(compiler); new UseStrictPlugin().apply(compiler); From 420ffc296fbc7f46ca5098f5d26c91dc01390909 Mon Sep 17 00:00:00 2001 From: Iain Wilson Date: Thu, 25 Apr 2019 13:19:04 +0100 Subject: [PATCH 04/35] fix(parser): Fixes a parser issue where rest element identifiers in object patterns were not added to the defined variables of the scope --- lib/Parser.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Parser.js b/lib/Parser.js index 3df20ce7a..7a75a3dde 100644 --- a/lib/Parser.js +++ b/lib/Parser.js @@ -1968,7 +1968,12 @@ class Parser extends Tapable { propIndex++ ) { const prop = pattern.properties[propIndex]; - this.enterPattern(prop.value, onIdent); + + if (prop.type === "Property") { + this.enterPattern(prop.value, onIdent); + } else { + this.enterPattern(prop, onIdent); + } } } From 260d69e995915444a1752eb3d1e0f91595723ecb Mon Sep 17 00:00:00 2001 From: Iain Wilson Date: Thu, 25 Apr 2019 14:42:01 +0100 Subject: [PATCH 05/35] fix(parser): Unit test for object pattern rest spread identifiers being added to definitions --- test/Parser.unittest.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/Parser.unittest.js b/test/Parser.unittest.js index 3d3fdeeca..97fe221b4 100644 --- a/test/Parser.unittest.js +++ b/test/Parser.unittest.js @@ -617,6 +617,22 @@ describe("Parser", () => { }); }); }); + + it("should collect definitions from identifiers introduced in object patterns", () => { + let definitions; + + const parser = new Parser(); + + parser.hooks.statement.tap("ParserTest", expr => { + definitions = parser.scope.definitions; + return true; + }); + + parser.parse("const { a, ...rest } = { a: 1, b: 2 };"); + + expect(definitions.has("a")).toBe(true); + expect(definitions.has("rest")).toBe(true); + }); }); describe("optional catch binding support", () => { From eaf8be005f937d3a81b584a6df9f134917d378fe Mon Sep 17 00:00:00 2001 From: Iain Wilson Date: Thu, 25 Apr 2019 16:09:55 +0100 Subject: [PATCH 06/35] Arrange differently for coverage --- lib/Parser.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/Parser.js b/lib/Parser.js index 7a75a3dde..554fa667a 100644 --- a/lib/Parser.js +++ b/lib/Parser.js @@ -1954,6 +1954,9 @@ class Parser extends Tapable { case "RestElement": this.enterRestElement(pattern, onIdent); break; + case "Property": + this.enterPattern(pattern.value, onIdent); + break; } } @@ -1968,12 +1971,7 @@ class Parser extends Tapable { propIndex++ ) { const prop = pattern.properties[propIndex]; - - if (prop.type === "Property") { - this.enterPattern(prop.value, onIdent); - } else { - this.enterPattern(prop, onIdent); - } + this.enterPattern(prop, onIdent); } } From 54e442b399c4853be0460c19856de2367ebf953b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 26 Apr 2019 19:44:16 +0000 Subject: [PATCH 07/35] chore(deps-dev): bump @types/node from 10.14.4 to 10.14.6 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 10.14.4 to 10.14.6. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5e3df6f85..b15e93980 100644 --- a/yarn.lock +++ b/yarn.lock @@ -373,9 +373,9 @@ integrity sha512-MeatbbUsZ80BEsKPXby6pUZjUM9ZuHIpWElN0siopih3fvnlpX2O9L6D5+dzDIb36lf9tM/8U4PVdLQ+L4qr4A== "@types/node@^10.12.21": - version "10.14.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.4.tgz#1c586b991457cbb58fef51bc4e0cfcfa347714b5" - integrity sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg== + version "10.14.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.6.tgz#9cbfcb62c50947217f4d88d4d274cc40c22625a9" + integrity sha512-Fvm24+u85lGmV4hT5G++aht2C5I4Z4dYlWZIh62FAfFO/TfzXtPpoLI6I7AuBWkIFqZCnhFOoTT7RjjaIL5Fjg== "@types/prettier@^1.16.1": version "1.16.1" From 8fbcc5672f6472c23b7d56036ede86ff82473751 Mon Sep 17 00:00:00 2001 From: Alan Zhang Date: Mon, 29 Apr 2019 02:41:54 +0800 Subject: [PATCH 08/35] don't evaluate `__dirname` and `__filename` when set to false --- lib/NodeStuffPlugin.js | 64 ++++++++++--------- test/configCases/parsing/issue-9042/index.js | 10 ++- .../parsing/issue-9042/test.config.js | 1 + .../parsing/issue-9042/webpack.config.js | 5 +- .../parsing/node-stuff-plugin-off/index.js | 9 +++ .../node-stuff-plugin-off/test.config.js | 6 ++ .../node-stuff-plugin-off/webpack.config.js | 4 ++ 7 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 test/configCases/parsing/node-stuff-plugin-off/index.js create mode 100644 test/configCases/parsing/node-stuff-plugin-off/test.config.js create mode 100644 test/configCases/parsing/node-stuff-plugin-off/webpack.config.js diff --git a/lib/NodeStuffPlugin.js b/lib/NodeStuffPlugin.js index 75d2e73b0..fc0338ae5 100644 --- a/lib/NodeStuffPlugin.js +++ b/lib/NodeStuffPlugin.js @@ -58,38 +58,42 @@ class NodeStuffPlugin { }); }; const context = compiler.context; - if (localOptions.__filename === "mock") { - setConstant("__filename", "/index.js"); - } else if (localOptions.__filename) { - setModuleConstant("__filename", module => - path.relative(context, module.resource) - ); + if (localOptions.__filename) { + if (localOptions.__filename === "mock") { + setConstant("__filename", "/index.js"); + } else { + setModuleConstant("__filename", module => + path.relative(context, module.resource) + ); + } + parser.hooks.evaluateIdentifier + .for("__filename") + .tap("NodeStuffPlugin", expr => { + if (!parser.state.module) return; + const resource = parser.state.module.resource; + const i = resource.indexOf("?"); + return ParserHelpers.evaluateToString( + i < 0 ? resource : resource.substr(0, i) + )(expr); + }); } - parser.hooks.evaluateIdentifier - .for("__filename") - .tap("NodeStuffPlugin", expr => { - if (!parser.state.module) return; - const resource = parser.state.module.resource; - const i = resource.indexOf("?"); - return ParserHelpers.evaluateToString( - i < 0 ? resource : resource.substr(0, i) - )(expr); - }); - if (localOptions.__dirname === "mock") { - setConstant("__dirname", "/"); - } else if (localOptions.__dirname) { - setModuleConstant("__dirname", module => - path.relative(context, module.context) - ); + if (localOptions.__dirname) { + if (localOptions.__dirname === "mock") { + setConstant("__dirname", "/"); + } else { + setModuleConstant("__dirname", module => + path.relative(context, module.context) + ); + } + parser.hooks.evaluateIdentifier + .for("__dirname") + .tap("NodeStuffPlugin", expr => { + if (!parser.state.module) return; + return ParserHelpers.evaluateToString( + parser.state.module.context + )(expr); + }); } - parser.hooks.evaluateIdentifier - .for("__dirname") - .tap("NodeStuffPlugin", expr => { - if (!parser.state.module) return; - return ParserHelpers.evaluateToString( - parser.state.module.context - )(expr); - }); parser.hooks.expression .for("require.main") .tap( diff --git a/test/configCases/parsing/issue-9042/index.js b/test/configCases/parsing/issue-9042/index.js index c469ca799..e535e4ad1 100644 --- a/test/configCases/parsing/issue-9042/index.js +++ b/test/configCases/parsing/issue-9042/index.js @@ -1,3 +1,9 @@ -it("should not load __dirname when node option is false", function() { - expect((typeof __dirname)).toBe("undefined"); +it("should not evaluate __dirname or __filename when set to false", function(done) { + if (typeof __dirname !== "undefined") { + done.fail(); + } + if (typeof __filename !== "undefined") { + done.fail(); + } + done(); }); diff --git a/test/configCases/parsing/issue-9042/test.config.js b/test/configCases/parsing/issue-9042/test.config.js index d55bc3823..1266625de 100644 --- a/test/configCases/parsing/issue-9042/test.config.js +++ b/test/configCases/parsing/issue-9042/test.config.js @@ -1,5 +1,6 @@ module.exports = { moduleScope: function(scope) { delete scope.__dirname; + delete scope.__filename; } }; diff --git a/test/configCases/parsing/issue-9042/webpack.config.js b/test/configCases/parsing/issue-9042/webpack.config.js index 9f1a00b55..47da81765 100644 --- a/test/configCases/parsing/issue-9042/webpack.config.js +++ b/test/configCases/parsing/issue-9042/webpack.config.js @@ -1,4 +1,7 @@ module.exports = { target: "web", - node: false + node: { + __filename: false, + __dirname: false + } }; diff --git a/test/configCases/parsing/node-stuff-plugin-off/index.js b/test/configCases/parsing/node-stuff-plugin-off/index.js new file mode 100644 index 000000000..97e3ca579 --- /dev/null +++ b/test/configCases/parsing/node-stuff-plugin-off/index.js @@ -0,0 +1,9 @@ +it("should not evaluate __dirname or __filename when node option is false", function(done) { + if (typeof __dirname !== "undefined") { + done.fail(); + } + if (typeof __filename !== "undefined") { + done.fail(); + } + done(); +}); diff --git a/test/configCases/parsing/node-stuff-plugin-off/test.config.js b/test/configCases/parsing/node-stuff-plugin-off/test.config.js new file mode 100644 index 000000000..1266625de --- /dev/null +++ b/test/configCases/parsing/node-stuff-plugin-off/test.config.js @@ -0,0 +1,6 @@ +module.exports = { + moduleScope: function(scope) { + delete scope.__dirname; + delete scope.__filename; + } +}; diff --git a/test/configCases/parsing/node-stuff-plugin-off/webpack.config.js b/test/configCases/parsing/node-stuff-plugin-off/webpack.config.js new file mode 100644 index 000000000..9f1a00b55 --- /dev/null +++ b/test/configCases/parsing/node-stuff-plugin-off/webpack.config.js @@ -0,0 +1,4 @@ +module.exports = { + target: "web", + node: false +}; From beb9a5358da4de601f38aaa50955d608ce9c8b6a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 2 May 2019 11:06:16 +0000 Subject: [PATCH 09/35] chore(deps-dev): bump jest-junit from 6.3.0 to 6.4.0 Bumps [jest-junit](https://github.com/jest-community/jest-junit) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/jest-community/jest-junit/releases) - [Commits](https://github.com/jest-community/jest-junit/compare/v6.3.0...v6.4.0) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5e3df6f85..304a87078 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3717,9 +3717,9 @@ jest-jasmine2@^24.5.0: throat "^4.0.0" jest-junit@^6.2.1: - version "6.3.0" - resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-6.3.0.tgz#99e64ebc54eddcb21238f0cc49f5820c89a8c785" - integrity sha512-3PH9UkpaomX6CUzqjlnk0m4yBCW/eroxV6v61OM6LkCQFO848P3YUhfIzu8ypZSBKB3vvCbB4WaLTKT0BrIf8A== + version "6.4.0" + resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-6.4.0.tgz#23e15c979fa6338afde46f2d2ac2a6b7e8cf0d9e" + integrity sha512-GXEZA5WBeUich94BARoEUccJumhCgCerg7mXDFLxWwI2P7wL3Z7sGWk+53x343YdBLjiMR9aD/gYMVKO+0pE4Q== dependencies: jest-validate "^24.0.0" mkdirp "^0.5.1" From cbef99199a508edb4d5ade22d4501122e88ee2bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 3 May 2019 07:58:58 +0000 Subject: [PATCH 10/35] chore(deps-dev): bump lint-staged from 8.1.5 to 8.1.6 Bumps [lint-staged](https://github.com/okonet/lint-staged) from 8.1.5 to 8.1.6. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Commits](https://github.com/okonet/lint-staged/compare/v8.1.5...v8.1.6) Signed-off-by: dependabot[bot] --- yarn.lock | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5e3df6f85..cf371f90c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -98,12 +98,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/runtime@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.0.0.tgz#adeb78fedfc855aa05bc041640f3f6f98e85424c" - integrity sha512-7hGhzlcmg01CvH1EHdSPVXYX1aJ8KCEyz6I9xYIi/asDtzBPMyMhVibhM/K6g/5qnKBwjZtp10bNZIEFTRW1MA== +"@babel/runtime@^7.0.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.4.tgz#dc2e34982eb236803aa27a07fea6857af1b9171d" + integrity sha512-w0+uT71b6Yi7i5SE0co4NioIpSYS6lLiXvCzWzGSKvpK5vdQtCbICHMj+gbAKAOtxiV6HsVh/MBdaF9EQ6faSg== dependencies: - regenerator-runtime "^0.12.0" + regenerator-runtime "^0.13.2" "@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0": version "7.4.0" @@ -1519,16 +1519,16 @@ commander@2.8.x: dependencies: graceful-readlink ">= 1.0.0" -commander@^2.14.1, commander@^2.9.0, commander@~2.17.1: - version "2.17.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" - integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== - -commander@~2.19.0: +commander@^2.14.1, commander@^2.9.0, commander@~2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== +commander@~2.17.1: + version "2.17.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== + commander@~2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d" @@ -4188,9 +4188,9 @@ levn@^0.3.0, levn@~0.3.0: type-check "~0.3.2" lint-staged@^8.0.4: - version "8.1.5" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-8.1.5.tgz#372476fe1a58b8834eb562ed4c99126bd60bdd79" - integrity sha512-e5ZavfnSLcBJE1BTzRTqw6ly8OkqVyO3GL2M6teSmTBYQ/2BuueD5GIt2RPsP31u/vjKdexUyDCxSyK75q4BDA== + version "8.1.6" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-8.1.6.tgz#128a9bc5effbf69a359fb8f7eeb2da71a998daf6" + integrity sha512-QT13AniHN6swAtTjsrzxOfE4TVCiQ39xESwLmjGVNCMMZ/PK5aopwvbxLrzw+Zf9OxM3cQG6WCx9lceLzETOnQ== dependencies: chalk "^2.3.1" commander "^2.14.1" @@ -4216,7 +4216,7 @@ lint-staged@^8.0.4: staged-git-files "1.1.2" string-argv "^0.0.2" stringify-object "^3.2.2" - yup "^0.26.10" + yup "^0.27.0" listr-silent-renderer@^1.1.1: version "1.1.1" @@ -4323,7 +4323,7 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4: +lodash@^4.17.11, lodash@^4.17.4: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== @@ -5758,10 +5758,10 @@ regenerator-runtime@^0.11.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== -regenerator-runtime@^0.12.0: - version "0.12.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de" - integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg== +regenerator-runtime@^0.13.2: + version "0.13.2" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447" + integrity sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA== regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" @@ -6542,10 +6542,10 @@ symbol-tree@^3.2.2: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" integrity sha1-rifbOPZgp64uHDt9G8KQgZuFGeY= -synchronous-promise@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.6.tgz#de76e0ea2b3558c1e673942e47e714a930fa64aa" - integrity sha512-TyOuWLwkmtPL49LHCX1caIwHjRzcVd62+GF6h8W/jHOeZUFHpnd2XJDVuUlaTaLPH1nuu2M69mfHr5XbQJnf/g== +synchronous-promise@^2.0.6: + version "2.0.7" + resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.7.tgz#3574b3d2fae86b145356a4b89103e1577f646fe3" + integrity sha512-16GbgwTmFMYFyQMLvtQjvNWh30dsFe1cAW5Fg1wm5+dg84L9Pe36mftsIRU95/W2YsISxsz/xq4VB23sqpgb/A== table@^5.2.3: version "5.2.3" @@ -7292,14 +7292,14 @@ yargs@~3.10.0: decamelize "^1.0.0" window-size "0.1.0" -yup@^0.26.10: - version "0.26.10" - resolved "https://registry.yarnpkg.com/yup/-/yup-0.26.10.tgz#3545839663289038faf25facfc07e11fd67c0cb1" - integrity sha512-keuNEbNSnsOTOuGCt3UJW69jDE3O4P+UHAakO7vSeFMnjaitcmlbij/a3oNb9g1Y1KvSKH/7O1R2PQ4m4TRylw== +yup@^0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/yup/-/yup-0.27.0.tgz#f8cb198c8e7dd2124beddc2457571329096b06e7" + integrity sha512-v1yFnE4+u9za42gG/b/081E7uNW9mUj3qtkmelLbW5YPROZzSH/KUUyJu9Wt8vxFJcT9otL/eZopS0YK1L5yPQ== dependencies: - "@babel/runtime" "7.0.0" + "@babel/runtime" "^7.0.0" fn-name "~2.0.1" - lodash "^4.17.10" + lodash "^4.17.11" property-expr "^1.5.0" - synchronous-promise "^2.0.5" + synchronous-promise "^2.0.6" toposort "^2.0.2" From f9e877f9c170997ba8dfe14dc7e40bec89178446 Mon Sep 17 00:00:00 2001 From: EugeneHlushko Date: Sat, 4 May 2019 17:46:38 +0300 Subject: [PATCH 11/35] fix(typo) remove redundant is --- declarations/WebpackOptions.d.ts | 2 +- schemas/WebpackOptions.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index 6be525d1f..2980c5d6e 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -1054,7 +1054,7 @@ export interface OutputOptions { */ filename?: string | Function; /** - * Use the future version of asset emitting logic, which is allows freeing memory of assets after emitting. It could break plugins which assume that assets are still readable after emitting. Will be the new default in the next major version. + * Use the future version of asset emitting logic, which allows freeing memory of assets after emitting. It could break plugins which assume that assets are still readable after emitting. Will be the new default in the next major version. */ futureEmitAssets?: boolean; /** diff --git a/schemas/WebpackOptions.json b/schemas/WebpackOptions.json index 85dcce9b4..eeed09af0 100644 --- a/schemas/WebpackOptions.json +++ b/schemas/WebpackOptions.json @@ -868,7 +868,7 @@ ] }, "futureEmitAssets": { - "description": "Use the future version of asset emitting logic, which is allows freeing memory of assets after emitting. It could break plugins which assume that assets are still readable after emitting. Will be the new default in the next major version.", + "description": "Use the future version of asset emitting logic, which allows freeing memory of assets after emitting. It could break plugins which assume that assets are still readable after emitting. Will be the new default in the next major version.", "type": "boolean" }, "globalObject": { From 6517aa103897a0f4fb05397d1115a854ba2ff82d Mon Sep 17 00:00:00 2001 From: Joey Burzynski Date: Thu, 9 May 2019 14:12:00 -0400 Subject: [PATCH 12/35] Updated Invalid URL Reference: "Getting Started" Referenced URL returns 404: `https://webpack.js.org/get-started/` Updated to: `https://webpack.js.org/guides/getting-started` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d3a5d2b6b..167f6c2b1 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ or packaging just about any resource or asset. ### Get Started -Check out webpack's quick [**Get Started**](https://webpack.js.org/get-started/) guide and the [other guides](https://webpack.js.org/guides/). +Check out webpack's quick [**Get Started**](https://webpack.js.org/guides/getting-started) guide and the [other guides](https://webpack.js.org/guides/). ### Browser Compatibility From 1939e31730538fdef974b570f7e60d25a2385c65 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 9 May 2019 20:00:30 +0000 Subject: [PATCH 13/35] chore(deps-dev): bump prettier from 1.16.4 to 1.17.0 Bumps [prettier](https://github.com/prettier/prettier) from 1.16.4 to 1.17.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/1.16.4...1.17.0) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2c91f43f3..13c4c5aea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5340,9 +5340,9 @@ prettier-linter-helpers@^1.0.0: fast-diff "^1.1.2" prettier@^1.14.3, prettier@^1.16.4: - version "1.16.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" - integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== + version "1.17.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.0.tgz#53b303676eed22cc14a9f0cec09b477b3026c008" + integrity sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw== pretty-format@^24.5.0: version "24.5.0" From f314d8157b8bffa134bccde9569208bec15fdf6e Mon Sep 17 00:00:00 2001 From: Joey Burzynski Date: Thu, 9 May 2019 14:12:00 -0400 Subject: [PATCH 14/35] Updated Invalid URL Reference: "Getting Started" Referenced URL returns 404: `https://webpack.js.org/get-started/` Updated to: `https://webpack.js.org/guides/getting-started` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d3a5d2b6b..167f6c2b1 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ or packaging just about any resource or asset. ### Get Started -Check out webpack's quick [**Get Started**](https://webpack.js.org/get-started/) guide and the [other guides](https://webpack.js.org/guides/). +Check out webpack's quick [**Get Started**](https://webpack.js.org/guides/getting-started) guide and the [other guides](https://webpack.js.org/guides/). ### Browser Compatibility From b6fa2e702474b7486470da43ddebb041c04acbcc Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Fri, 10 May 2019 13:51:38 +0530 Subject: [PATCH 15/35] chore(bin):sets string messages to const made string message to const, previously it was let --- bin/webpack.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/webpack.js b/bin/webpack.js index 8c0bfdbe2..ca31cfb0d 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -109,7 +109,7 @@ if (installedClis.length === 0) { )}".` ); - let question = `Do you want to install 'webpack-cli' (yes/no): `; + const question = `Do you want to install 'webpack-cli' (yes/no): `; const questionInterface = readLine.createInterface({ input: process.stdin, From 6033db679f5c92085bacea4c8aa65d61b883c200 Mon Sep 17 00:00:00 2001 From: Yuta Hiroto Date: Thu, 9 May 2019 21:16:19 +0100 Subject: [PATCH 16/35] chore(ci): add Node.js v12 to azure-pipelines --- azure-pipelines.yml | 12 +++++++++--- test/cases/parsing/harmony-tdz/index.js | 8 +++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4465f924f..72f6d4ce5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -90,8 +90,10 @@ jobs: pool: vmImage: ubuntu-16.04 strategy: - maxParallel: 3 + maxParallel: 4 matrix: + node-12: + node_version: ^12.2.0 node-10: node_version: ^10.10.0 node-8: @@ -139,8 +141,10 @@ jobs: pool: vmImage: "macOS 10.13" strategy: - maxParallel: 3 + maxParallel: 4 matrix: + node-12: + node_version: ^12.2.0 node-10: node_version: ^10.10.0 node-8: @@ -188,8 +192,10 @@ jobs: pool: vmImage: vs2017-win2016 strategy: - maxParallel: 3 + maxParallel: 4 matrix: + node-12: + node_version: ^12.2.0 node-10: node_version: ^10.10.0 node-8: diff --git a/test/cases/parsing/harmony-tdz/index.js b/test/cases/parsing/harmony-tdz/index.js index 0f2ef06aa..5459cb421 100644 --- a/test/cases/parsing/harmony-tdz/index.js +++ b/test/cases/parsing/harmony-tdz/index.js @@ -1,8 +1,10 @@ import value, { exception } from "./module"; -it("should have a TDZ for exported const values", function() { - expect((typeof exception)).toBe("object"); +it("should have a TDZ for exported const values", () => { + expect(typeof exception).toBe("object"); expect(exception).toBeInstanceOf(Error); - expect(exception.message).toMatch(/ is not defined$/); + expect(exception.message).toMatch( + / is not defined$|^Cannot access '.+?' before initialization$/ + ); expect(value).toBe("value"); }); From e79e2417c7167c4a5d4101bb48a62b88309dd574 Mon Sep 17 00:00:00 2001 From: Dan Homola Date: Thu, 19 Jul 2018 09:22:37 +0200 Subject: [PATCH 17/35] test: make prefetch/preload tests stricter --- test/configCases/web/prefetch-preload/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/configCases/web/prefetch-preload/index.js b/test/configCases/web/prefetch-preload/index.js index dba5b0575..b25574654 100644 --- a/test/configCases/web/prefetch-preload/index.js +++ b/test/configCases/web/prefetch-preload/index.js @@ -26,7 +26,7 @@ it("should prefetch and preload child chunks on chunk load", () => { link = document.head._children[0]; expect(link._type).toBe("link"); expect(link.rel).toBe("prefetch"); - expect(link.href).toMatch(/chunk1\.js$/); + expect(link.href).toBe("https://example.com/public/path/chunk1.js"); const promise = import(/* webpackChunkName: "chunk1", webpackPrefetch: true */ "./chunk1"); @@ -35,7 +35,7 @@ it("should prefetch and preload child chunks on chunk load", () => { // Test normal script loading script = document.head._children[1]; expect(script._type).toBe("script"); - expect(script.src).toMatch(/chunk1\.js$/); + expect(script.src).toBe("https://example.com/public/path/chunk1.js"); expect(script.getAttribute("nonce")).toBe("nonce") expect(script.crossOrigin).toBe("anonymous"); expect(script.onload).toBeTypeOf("function"); @@ -45,7 +45,7 @@ it("should prefetch and preload child chunks on chunk load", () => { expect(link._type).toBe("link"); expect(link.rel).toBe("preload"); expect(link.as).toBe("script"); - expect(link.href).toMatch(/chunk1-b\.js$/); + expect(link.href).toBe("https://example.com/public/path/chunk1-b.js"); expect(link.charset).toBe("utf-8"); expect(link.getAttribute("nonce")).toBe("nonce"); expect(link.crossOrigin).toBe("anonymous"); @@ -62,13 +62,13 @@ it("should prefetch and preload child chunks on chunk load", () => { link = document.head._children[3]; expect(link._type).toBe("link"); expect(link.rel).toBe("prefetch"); - expect(link.href).toMatch(/chunk1-c\.js$/); + expect(link.href).toBe("https://example.com/public/path/chunk1-c.js"); expect(link.crossOrigin).toBe("anonymous"); link = document.head._children[4]; expect(link._type).toBe("link"); expect(link.rel).toBe("prefetch"); - expect(link.href).toMatch(/chunk1-a\.js$/); + expect(link.href).toBe("https://example.com/public/path/chunk1-a.js"); expect(link.crossOrigin).toBe("anonymous"); const promise2 = import(/* webpackChunkName: "chunk1", webpackPrefetch: true */ "./chunk1"); @@ -83,7 +83,7 @@ it("should prefetch and preload child chunks on chunk load", () => { // Test normal script loading script = document.head._children[5]; expect(script._type).toBe("script"); - expect(script.src).toMatch(/chunk2\.js$/); + expect(script.src).toBe("https://example.com/public/path/chunk2.js"); expect(script.getAttribute("nonce")).toBe("nonce") expect(script.crossOrigin).toBe("anonymous"); expect(script.onload).toBeTypeOf("function"); From 905da8cabf15ceb3ac3e1798d25678acff1975c3 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 10 May 2019 22:19:39 +0200 Subject: [PATCH 18/35] fix test case --- .../configCases/web/prefetch-preload/index.js | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/test/configCases/web/prefetch-preload/index.js b/test/configCases/web/prefetch-preload/index.js index b25574654..e9391304a 100644 --- a/test/configCases/web/prefetch-preload/index.js +++ b/test/configCases/web/prefetch-preload/index.js @@ -1,22 +1,8 @@ - -let oldNonce; -let oldPublicPath; - -beforeEach(done => { - oldNonce = __webpack_nonce__; - oldPublicPath = __webpack_public_path__; - done(); -}); - -afterEach(done => { - __webpack_nonce__ = oldNonce; - __webpack_public_path__ = oldPublicPath; - done(); -}); +// This config need to be set on initial evaluation to be effective +__webpack_nonce__ = "nonce"; +__webpack_public_path__ = "https://example.com/public/path/"; it("should prefetch and preload child chunks on chunk load", () => { - __webpack_nonce__ = "nonce"; - __webpack_public_path__ = "https://example.com/public/path/"; let link, script; From b6090b6943bc013c68076bd7456e662aaba56694 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 10 May 2019 23:04:29 +0200 Subject: [PATCH 19/35] delay prefetching until all initial code is evaluated add test case fix bug in Chunk.getChildIdsByOrdersMap --- lib/Chunk.js | 10 +++- lib/MainTemplate.js | 15 +++++ lib/web/JsonpMainTemplatePlugin.js | 59 ++++++++++++++----- .../web/prefetch-split-chunks/chunk1.js | 0 .../web/prefetch-split-chunks/index.js | 13 ++++ .../web/prefetch-split-chunks/public-path.js | 1 + .../web/prefetch-split-chunks/test.config.js | 5 ++ .../prefetch-split-chunks/webpack.config.js | 23 ++++++++ 8 files changed, 111 insertions(+), 15 deletions(-) create mode 100644 test/configCases/web/prefetch-split-chunks/chunk1.js create mode 100644 test/configCases/web/prefetch-split-chunks/index.js create mode 100644 test/configCases/web/prefetch-split-chunks/public-path.js create mode 100644 test/configCases/web/prefetch-split-chunks/test.config.js create mode 100644 test/configCases/web/prefetch-split-chunks/webpack.config.js diff --git a/lib/Chunk.js b/lib/Chunk.js index 13dd33954..aa69c7fa9 100644 --- a/lib/Chunk.js +++ b/lib/Chunk.js @@ -688,7 +688,15 @@ class Chunk { }; if (includeDirectChildren) { - addChildIdsByOrdersToMap(this); + const chunks = new Set(); + for (const chunkGroup of this.groupsIterable) { + for (const chunk of chunkGroup.chunks) { + chunks.add(chunk); + } + } + for (const chunk of chunks) { + addChildIdsByOrdersToMap(chunk); + } } for (const chunk of this.getAllAsyncChunks()) { diff --git a/lib/MainTemplate.js b/lib/MainTemplate.js index db42205e7..1023dc63a 100644 --- a/lib/MainTemplate.js +++ b/lib/MainTemplate.js @@ -98,6 +98,8 @@ module.exports = class MainTemplate extends Tapable { beforeStartup: new SyncWaterfallHook(["source", "chunk", "hash"]), /** @type {SyncWaterfallHook} */ startup: new SyncWaterfallHook(["source", "chunk", "hash"]), + /** @type {SyncWaterfallHook} */ + afterStartup: new SyncWaterfallHook(["source", "chunk", "hash"]), render: new SyncWaterfallHook([ "source", "chunk", @@ -404,7 +406,20 @@ module.exports = class MainTemplate extends Tapable { ); buf.push(""); buf.push(Template.asString(this.hooks.beforeStartup.call("", chunk, hash))); + const afterStartupCode = Template.asString( + this.hooks.afterStartup.call("", chunk, hash) + ); + if (afterStartupCode) { + // TODO webpack 5: this is a bit hacky to avoid a breaking change + // change it to a better way + buf.push("var startupResult = (function() {"); + } buf.push(Template.asString(this.hooks.startup.call("", chunk, hash))); + if (afterStartupCode) { + buf.push("})();"); + buf.push(afterStartupCode); + buf.push("return startupResult;"); + } return buf; } diff --git a/lib/web/JsonpMainTemplatePlugin.js b/lib/web/JsonpMainTemplatePlugin.js index 6466ff766..482f72bbd 100644 --- a/lib/web/JsonpMainTemplatePlugin.js +++ b/lib/web/JsonpMainTemplatePlugin.js @@ -115,7 +115,11 @@ class JsonpMainTemplatePlugin { ), "};", "", - needEntryDeferringCode(chunk) ? "var deferredModules = [];" : "" + needEntryDeferringCode(chunk) + ? needPrefetchingCode(chunk) + ? "var deferredModules = [], deferredPrefetch = [];" + : "var deferredModules = [];" + : "" ); } if (needChunkOnDemandLoadingCode(chunk)) { @@ -384,20 +388,22 @@ class JsonpMainTemplatePlugin { "}", "if(parentJsonpFunction) parentJsonpFunction(data);", withPrefetch - ? Template.asString([ - "// chunk prefetching for javascript", - "prefetchChunks.forEach(function(chunkId) {", - Template.indent([ - "if(installedChunks[chunkId] === undefined) {", + ? withDefer + ? "deferredPrefetch.push.apply(deferredPrefetch, prefetchChunks);" + : Template.asString([ + "// chunk prefetching for javascript", + "prefetchChunks.forEach(function(chunkId) {", Template.indent([ - "installedChunks[chunkId] = null;", - mainTemplate.hooks.linkPrefetch.call("", chunk, hash), - "document.head.appendChild(link);" + "if(installedChunks[chunkId] === undefined) {", + Template.indent([ + "installedChunks[chunkId] = null;", + mainTemplate.hooks.linkPrefetch.call("", chunk, hash), + "document.head.appendChild(link);" + ]), + "}" ]), - "}" - ]), - "});" - ]) + "});" + ]) : "", "while(resolves.length) {", Template.indent("resolves.shift()();"), @@ -441,6 +447,31 @@ class JsonpMainTemplatePlugin { "}" ]), "}", + withPrefetch + ? Template.asString([ + "if(deferredModules.length === 0) {", + Template.indent([ + "// chunk prefetching for javascript", + "deferredPrefetch.forEach(function(chunkId) {", + Template.indent([ + "if(installedChunks[chunkId] === undefined) {", + Template.indent([ + "installedChunks[chunkId] = null;", + mainTemplate.hooks.linkPrefetch.call( + "", + chunk, + hash + ), + "document.head.appendChild(link);" + ]), + "}" + ]), + "});", + "deferredPrefetch.length = 0;" + ]), + "}" + ]) + : "", "return result;" ]), "}" @@ -473,7 +504,7 @@ class JsonpMainTemplatePlugin { return source; } ); - mainTemplate.hooks.beforeStartup.tap( + mainTemplate.hooks.afterStartup.tap( "JsonpMainTemplatePlugin", (source, chunk, hash) => { const prefetchChunks = chunk.getChildIdsByOrders().prefetch; diff --git a/test/configCases/web/prefetch-split-chunks/chunk1.js b/test/configCases/web/prefetch-split-chunks/chunk1.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/configCases/web/prefetch-split-chunks/index.js b/test/configCases/web/prefetch-split-chunks/index.js new file mode 100644 index 000000000..712036d1f --- /dev/null +++ b/test/configCases/web/prefetch-split-chunks/index.js @@ -0,0 +1,13 @@ +import "./public-path"; + +it("should prefetch correctly", () => { + expect(document.head._children).toHaveLength(1); + + // Test prefetch from entry chunk + const link = document.head._children[0]; + expect(link._type).toBe("link"); + expect(link.rel).toBe("prefetch"); + expect(link.href).toBe("https://example.com/public/path/chunk1.js"); + + import(/* webpackChunkName: "chunk1", webpackPrefetch: true */ "./chunk1"); +}); diff --git a/test/configCases/web/prefetch-split-chunks/public-path.js b/test/configCases/web/prefetch-split-chunks/public-path.js new file mode 100644 index 000000000..beedca3b6 --- /dev/null +++ b/test/configCases/web/prefetch-split-chunks/public-path.js @@ -0,0 +1 @@ +__webpack_public_path__ = "https://example.com/public/path/"; diff --git a/test/configCases/web/prefetch-split-chunks/test.config.js b/test/configCases/web/prefetch-split-chunks/test.config.js new file mode 100644 index 000000000..60ac1ad86 --- /dev/null +++ b/test/configCases/web/prefetch-split-chunks/test.config.js @@ -0,0 +1,5 @@ +module.exports = { + findBundle: function(i, options) { + return ["main.js", "bundle0.js", "separate~main.js"]; + } +}; diff --git a/test/configCases/web/prefetch-split-chunks/webpack.config.js b/test/configCases/web/prefetch-split-chunks/webpack.config.js new file mode 100644 index 000000000..c2b5112d0 --- /dev/null +++ b/test/configCases/web/prefetch-split-chunks/webpack.config.js @@ -0,0 +1,23 @@ +module.exports = { + target: "web", + output: { + chunkFilename: "[name].js", + crossOriginLoading: "anonymous" + }, + performance: { + hints: false + }, + optimization: { + minimize: false, + splitChunks: { + cacheGroups: { + separate: { + enforce: true, + chunks: "all", + test: /public-path/ + } + } + }, + runtimeChunk: true + } +}; From ac23b8e479f55fbe4ff17cd1ed9429dda3729809 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 10 May 2019 23:16:06 +0200 Subject: [PATCH 20/35] update stats snapshot, because new line was added --- .../__snapshots__/StatsTestCases.test.js.snap | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/test/__snapshots__/StatsTestCases.test.js.snap b/test/__snapshots__/StatsTestCases.test.js.snap index 08650dcbd..bd5274584 100644 --- a/test/__snapshots__/StatsTestCases.test.js.snap +++ b/test/__snapshots__/StatsTestCases.test.js.snap @@ -1,21 +1,21 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`StatsTestCases should print correct stats for aggressive-splitting-entry 1`] = ` -"Hash: 6b5ddd5d48acc0426e7a6b5ddd5d48acc0426e7a +"Hash: e82547675e389094fe3de82547675e389094fe3d Child fitting: - Hash: 6b5ddd5d48acc0426e7a + Hash: e82547675e389094fe3d Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names + 1c1645069e9e0eeefaba.js 11 KiB 1 [emitted] 33966214360bbbb31383.js 1.94 KiB 2 [emitted] 445d4c6a1d7381d6cb2c.js 1.94 KiB 3 [emitted] d4b551c6319035df2898.js 1.05 KiB 0 [emitted] - ed31350d9c86da6a8353.js 11 KiB 1 [emitted] - Entrypoint main = 33966214360bbbb31383.js 445d4c6a1d7381d6cb2c.js ed31350d9c86da6a8353.js + Entrypoint main = 33966214360bbbb31383.js 445d4c6a1d7381d6cb2c.js 1c1645069e9e0eeefaba.js chunk {0} d4b551c6319035df2898.js 916 bytes <{1}> <{2}> <{3}> > ./g [4] ./index.js 7:0-13 [7] ./g.js 916 bytes {0} [built] - chunk {1} ed31350d9c86da6a8353.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] + chunk {1} 1c1645069e9e0eeefaba.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] > ./index main [3] ./e.js 899 bytes {1} [built] [4] ./index.js 111 bytes {1} [built] @@ -29,19 +29,19 @@ Child fitting: [1] ./c.js 899 bytes {3} [built] [2] ./d.js 899 bytes {3} [built] Child content-change: - Hash: 6b5ddd5d48acc0426e7a + Hash: e82547675e389094fe3d Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names + 1c1645069e9e0eeefaba.js 11 KiB 1 [emitted] 33966214360bbbb31383.js 1.94 KiB 2 [emitted] 445d4c6a1d7381d6cb2c.js 1.94 KiB 3 [emitted] d4b551c6319035df2898.js 1.05 KiB 0 [emitted] - ed31350d9c86da6a8353.js 11 KiB 1 [emitted] - Entrypoint main = 33966214360bbbb31383.js 445d4c6a1d7381d6cb2c.js ed31350d9c86da6a8353.js + Entrypoint main = 33966214360bbbb31383.js 445d4c6a1d7381d6cb2c.js 1c1645069e9e0eeefaba.js chunk {0} d4b551c6319035df2898.js 916 bytes <{1}> <{2}> <{3}> > ./g [4] ./index.js 7:0-13 [7] ./g.js 916 bytes {0} [built] - chunk {1} ed31350d9c86da6a8353.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] + chunk {1} 1c1645069e9e0eeefaba.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] > ./index main [3] ./e.js 899 bytes {1} [built] [4] ./index.js 111 bytes {1} [built] @@ -611,11 +611,11 @@ Entrypoint main = main.js `; exports[`StatsTestCases should print correct stats for commons-chunk-min-size-0 1`] = ` -"Hash: 578e4c7a1795861b0a9c +"Hash: 7b8e101018ec6d0192ce Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - entry-1.js 6.6 KiB 0 [emitted] entry-1 + entry-1.js 6.61 KiB 0 [emitted] entry-1 vendor-1~entry-1.js 314 bytes 1 [emitted] vendor-1~entry-1 Entrypoint entry-1 = vendor-1~entry-1.js entry-1.js [0] ./entry-1.js 145 bytes {0} [built] @@ -628,11 +628,11 @@ Entrypoint entry-1 = vendor-1~entry-1.js entry-1.js `; exports[`StatsTestCases should print correct stats for commons-chunk-min-size-Infinity 1`] = ` -"Hash: 8d92f1bebd2cb6793d22 +"Hash: a581e9e73e7d1c8f66ba Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - entry-1.js 6.6 KiB 0 [emitted] entry-1 + entry-1.js 6.61 KiB 0 [emitted] entry-1 vendor-1.js 314 bytes 1 [emitted] vendor-1 Entrypoint entry-1 = vendor-1.js entry-1.js [0] ./entry-1.js 145 bytes {0} [built] @@ -645,13 +645,13 @@ Entrypoint entry-1 = vendor-1.js entry-1.js `; exports[`StatsTestCases should print correct stats for commons-plugin-issue-4980 1`] = ` -"Hash: 159313d738428f44ef68a283ef191845660a080d +"Hash: e65354c1b5a5e1aac83e55f955aa9425b37b6bc7 Child - Hash: 159313d738428f44ef68 + Hash: e65354c1b5a5e1aac83e Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - app.js 6.69 KiB 0 [emitted] app + app.js 6.7 KiB 0 [emitted] app vendor.aa94f0c872c214f6cb2e.js 619 bytes 1 [emitted] vendor Entrypoint app = vendor.aa94f0c872c214f6cb2e.js app.js [./constants.js] 87 bytes {1} [built] @@ -660,11 +660,11 @@ Child | ./submodule-a.js 59 bytes [built] | ./submodule-b.js 59 bytes [built] Child - Hash: a283ef191845660a080d + Hash: 55f955aa9425b37b6bc7 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - app.js 6.7 KiB 0 [emitted] app + app.js 6.71 KiB 0 [emitted] app vendor.aa94f0c872c214f6cb2e.js 619 bytes 1 [emitted] vendor Entrypoint app = vendor.aa94f0c872c214f6cb2e.js app.js [./constants.js] 87 bytes {1} [built] @@ -1124,31 +1124,31 @@ Compilation error while processing magic comment(-s): /* webpackPrefetch: true, `; exports[`StatsTestCases should print correct stats for issue-7577 1`] = ` -"Hash: 3a382f7c6759b0401b6ff9bcd7c310309db5b68ce2bf53b0bf1432b722d8 +"Hash: 9c248e1f7cf8b331fba532fffa02370ddddc7d7d1319e261db9517be4c62 Child - Hash: 3a382f7c6759b0401b6f + Hash: 9c248e1f7cf8b331fba5 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names a-all~main-0034bb84916bcade4cc7.js 154 bytes all~main [emitted] all~main a-main-14ee9c594789bd77b887.js 108 bytes main [emitted] main - a-runtime~main-7b4918090cfe19b7778a.js 6.05 KiB runtime~main [emitted] runtime~main - Entrypoint main = a-runtime~main-7b4918090cfe19b7778a.js a-all~main-0034bb84916bcade4cc7.js a-main-14ee9c594789bd77b887.js + a-runtime~main-e27e72d77edfc378d751.js 6.06 KiB runtime~main [emitted] runtime~main + Entrypoint main = a-runtime~main-e27e72d77edfc378d751.js a-all~main-0034bb84916bcade4cc7.js a-main-14ee9c594789bd77b887.js [0] ./a.js 18 bytes {all~main} [built] Child - Hash: f9bcd7c310309db5b68c + Hash: 32fffa02370ddddc7d7d Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names b-all~main-3f0b62a9e243706ccaf8.js 468 bytes all~main [emitted] all~main b-main-09f4ddfc4098d7f3f188.js 123 bytes main [emitted] main - b-runtime~main-7b4918090cfe19b7778a.js 6.05 KiB runtime~main [emitted] runtime~main + b-runtime~main-e27e72d77edfc378d751.js 6.06 KiB runtime~main [emitted] runtime~main b-vendors~main-f7664221ad5d986cf06a.js 163 bytes vendors~main [emitted] vendors~main - Entrypoint main = b-runtime~main-7b4918090cfe19b7778a.js b-vendors~main-f7664221ad5d986cf06a.js b-all~main-3f0b62a9e243706ccaf8.js b-main-09f4ddfc4098d7f3f188.js + Entrypoint main = b-runtime~main-e27e72d77edfc378d751.js b-vendors~main-f7664221ad5d986cf06a.js b-all~main-3f0b62a9e243706ccaf8.js b-main-09f4ddfc4098d7f3f188.js [0] ./node_modules/vendor.js 23 bytes {vendors~main} [built] [1] ./b.js 17 bytes {all~main} [built] Child - Hash: e2bf53b0bf1432b722d8 + Hash: 1319e261db9517be4c62 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names @@ -1156,8 +1156,8 @@ Child c-1-5eacbd7fee2224716029.js 153 bytes 1 [emitted] c-all~main-3de9f206741c28715d19.js 305 bytes all~main [emitted] all~main c-main-75156155081cda3092db.js 114 bytes main [emitted] main - c-runtime~main-a95c7b9d72f76dc9feef.js 8.78 KiB runtime~main [emitted] runtime~main - Entrypoint main = c-runtime~main-a95c7b9d72f76dc9feef.js c-all~main-3de9f206741c28715d19.js c-main-75156155081cda3092db.js (prefetch: c-1-5eacbd7fee2224716029.js c-0-5b8bdddff2dcbbac44bf.js) + c-runtime~main-fa9139835607a6c95344.js 9.59 KiB runtime~main [emitted] runtime~main + Entrypoint main = c-runtime~main-fa9139835607a6c95344.js c-all~main-3de9f206741c28715d19.js c-main-75156155081cda3092db.js (prefetch: c-1-5eacbd7fee2224716029.js c-0-5b8bdddff2dcbbac44bf.js) [0] ./b.js 17 bytes {0} [built] [1] ./c.js 61 bytes {all~main} [built] [2] ./node_modules/vendor.js 23 bytes {1} [built]" @@ -1473,11 +1473,11 @@ Child `; exports[`StatsTestCases should print correct stats for named-chunks-plugin 1`] = ` -"Hash: deb7cd22c634f1c52662 +"Hash: bd0fd1a7b49d8e42b67a Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - entry.js 6.45 KiB entry [emitted] entry + entry.js 6.46 KiB entry [emitted] entry vendor.js 269 bytes vendor [emitted] vendor Entrypoint entry = vendor.js entry.js [./entry.js] 72 bytes {entry} [built] @@ -1826,7 +1826,7 @@ exports[`StatsTestCases should print correct stats for prefetch 1`] = ` " Asset Size Chunks Chunk Names inner.js 130 bytes 0 [emitted] inner inner2.js 188 bytes 1 [emitted] inner2 - main.js 9.55 KiB 2 [emitted] main + main.js 9.65 KiB 2 [emitted] main normal.js 130 bytes 3 [emitted] normal prefetched.js 475 bytes 4 [emitted] prefetched prefetched2.js 127 bytes 5 [emitted] prefetched2 @@ -2174,9 +2174,9 @@ Entrypoint entry = entry.js `; exports[`StatsTestCases should print correct stats for scope-hoisting-multi 1`] = ` -"Hash: e9ee59c952da1a23368e3ae60c31c1c21dd62d86 +"Hash: 5c9b2608ec3886c8a552d597421ff533ba6b23ef Child - Hash: e9ee59c952da1a23368e + Hash: 5c9b2608ec3886c8a552 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint first = vendor.js first.js @@ -2193,7 +2193,7 @@ Child [9] ./common_lazy_shared.js 25 bytes {2} {3} {4} [built] [10] ./common_lazy.js 25 bytes {2} {3} [built] Child - Hash: 3ae60c31c1c21dd62d86 + Hash: d597421ff533ba6b23ef Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint first = vendor.js first.js From 9bad7218c95407c3202e9ee25ec8abf9158ba7c2 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 10 May 2019 23:37:00 +0200 Subject: [PATCH 21/35] fix test case --- test/configCases/web/prefetch-split-chunks/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/configCases/web/prefetch-split-chunks/index.js b/test/configCases/web/prefetch-split-chunks/index.js index 712036d1f..6b9b6dd8e 100644 --- a/test/configCases/web/prefetch-split-chunks/index.js +++ b/test/configCases/web/prefetch-split-chunks/index.js @@ -9,5 +9,7 @@ it("should prefetch correctly", () => { expect(link.rel).toBe("prefetch"); expect(link.href).toBe("https://example.com/public/path/chunk1.js"); - import(/* webpackChunkName: "chunk1", webpackPrefetch: true */ "./chunk1"); + if (Math.random() < -1) { + import(/* webpackChunkName: "chunk1", webpackPrefetch: true */ "./chunk1"); + } }); From 2ff2048577b8b0352ec453989dc0c76a36c4869d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 13 May 2019 02:16:22 +0000 Subject: [PATCH 22/35] chore(deps-dev): bump eslint-plugin-prettier from 3.0.1 to 3.1.0 Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.0.1 to 3.1.0. - [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases) - [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.0.1...v3.1.0) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 13c4c5aea..f94d29c75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2213,9 +2213,9 @@ eslint-plugin-node@^8.0.0: semver "^5.5.0" eslint-plugin-prettier@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.1.tgz#19d521e3981f69dd6d14f64aec8c6a6ac6eb0b0d" - integrity sha512-/PMttrarPAY78PLvV3xfWibMOdMDl57hmlQ2XqFeA37wd+CJ7WSxV7txqjVPHi/AAFKd2lX0ZqfsOc/i5yFCSQ== + version "3.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d" + integrity sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA== dependencies: prettier-linter-helpers "^1.0.0" From 326f4c91cb4e6ca553047e7b01f7105b28d71bcd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 13 May 2019 02:16:48 +0000 Subject: [PATCH 23/35] chore(deps): bump neo-async from 2.6.0 to 2.6.1 Bumps [neo-async](https://github.com/suguru03/neo-async) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/suguru03/neo-async/releases) - [Commits](https://github.com/suguru03/neo-async/compare/v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 13c4c5aea..df9b2f323 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4729,9 +4729,9 @@ negotiator@0.6.1: integrity sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk= neo-async@^2.5.0, neo-async@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835" - integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA== + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== next-tick@1: version "1.0.0" From 1e5affb6b119b6b26f01989a429083f0c0486bd6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 14 May 2019 02:18:50 +0000 Subject: [PATCH 24/35] chore(deps-dev): bump prettier from 1.17.0 to 1.17.1 Bumps [prettier](https://github.com/prettier/prettier) from 1.17.0 to 1.17.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/1.17.0...1.17.1) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index b1c91f3e1..ca8e0e5d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5340,9 +5340,9 @@ prettier-linter-helpers@^1.0.0: fast-diff "^1.1.2" prettier@^1.14.3, prettier@^1.16.4: - version "1.17.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.0.tgz#53b303676eed22cc14a9f0cec09b477b3026c008" - integrity sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw== + version "1.17.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.1.tgz#ed64b4e93e370cb8a25b9ef7fef3e4fd1c0995db" + integrity sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg== pretty-format@^24.5.0: version "24.5.0" From e81fb969cf7f48d28da7040ad6d6a7d0ed52fb34 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 14 May 2019 16:29:30 +0200 Subject: [PATCH 25/35] Skip CLA for dependabot --- open-bot.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/open-bot.yaml b/open-bot.yaml index a099b9ecd..b38ecb4f2 100644 --- a/open-bot.yaml +++ b/open-bot.yaml @@ -492,6 +492,20 @@ rules: *You don't have to change it for this PR, just make sure to follow this hint the next time you submit a PR.* + # skip CLA for dependabot + - filters: + open: true + pull_request: + author: "^dependabot\\[bot\\]$" + status: + context: "licence/cla" + state: "pending" + actions: + status: + context: "licence/cla" + description: "Contributor License Agreement is not needed for this user." + state: "success" + # add "Send a PR" label when somebody with write permission say it - filters: open: true From cc05770ea8bc773ae7aefb54ce3de4074d2dd6bc Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 14 May 2019 22:04:15 +0200 Subject: [PATCH 26/35] merge dependabot PRs automatically --- open-bot.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/open-bot.yaml b/open-bot.yaml index b38ecb4f2..0ba44873e 100644 --- a/open-bot.yaml +++ b/open-bot.yaml @@ -505,6 +505,17 @@ rules: context: "licence/cla" description: "Contributor License Agreement is not needed for this user." state: "success" + + # merge dependabot PRs automatically + - filters: + open: true + pull_request: + author: "^dependabot\\[bot\\]$" + mergeable_state: clean + merged: false + label: "PR: CI-ok" + actions: + merge: true # add "Send a PR" label when somebody with write permission say it - filters: From af0bf5e9d2c55cd4f3ca49b22f70c414dab99297 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 16 May 2019 02:17:37 +0000 Subject: [PATCH 27/35] chore(deps-dev): bump webpack-dev-middleware from 3.6.2 to 3.7.0 Bumps [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) from 3.6.2 to 3.7.0. - [Release notes](https://github.com/webpack/webpack-dev-middleware/releases) - [Changelog](https://github.com/webpack/webpack-dev-middleware/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack/webpack-dev-middleware/compare/v3.6.2...v3.7.0) Signed-off-by: dependabot[bot] --- yarn.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index ca8e0e5d8..bf4ae87d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4558,10 +4558,10 @@ mime@^1.4.1: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mime@^2.0.3, mime@^2.3.1: - version "2.4.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.0.tgz#e051fd881358585f3279df333fe694da0bcffdd6" - integrity sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w== +mime@^2.0.3, mime@^2.4.2: + version "2.4.3" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.3.tgz#229687331e86f68924e6cb59e1cdd937f18275fe" + integrity sha512-QgrPRJfE+riq5TPZMcHZOtm8c6K/yYrMbKIoRfapfiGLxS8OTeIfRhUGW5LU7MlRa52KOAGCfUNruqLrIBvWZw== mimic-fn@^1.0.0: version "1.2.0" @@ -5634,10 +5634,10 @@ randomfill@^1.0.3: randombytes "^2.0.5" safe-buffer "^5.1.0" -range-parser@^1.0.3, range-parser@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" - integrity sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4= +range-parser@^1.2.1, range-parser@~1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== raw-body@2.3.3: version "2.3.3" @@ -7043,13 +7043,13 @@ webidl-conversions@^4.0.2: integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== webpack-dev-middleware@^3.5.1: - version "3.6.2" - resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.6.2.tgz#f37a27ad7c09cd7dc67cd97655413abaa1f55942" - integrity sha512-A47I5SX60IkHrMmZUlB0ZKSWi29TZTcPz7cha1Z75yYOsgWh/1AcPmQEbC8ZIbU3A1ytSv1PMU0PyPz2Lmz2jg== + version "3.7.0" + resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.7.0.tgz#ef751d25f4e9a5c8a35da600c5fda3582b5c6cff" + integrity sha512-qvDesR1QZRIAZHOE3iQ4CXLZZSQ1lAUsSpnQmlB1PBfoN/xdRjmge3Dok0W4IdaVLJOGJy3sGI4sZHwjRU0PCA== dependencies: memory-fs "^0.4.1" - mime "^2.3.1" - range-parser "^1.0.3" + mime "^2.4.2" + range-parser "^1.2.1" webpack-log "^2.0.0" webpack-log@^2.0.0: From 412a1ed82f637dd70a4314d4ed9d747d7366d04f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 16 May 2019 02:18:35 +0000 Subject: [PATCH 28/35] chore(deps-dev): bump lint-staged from 8.1.6 to 8.1.7 Bumps [lint-staged](https://github.com/okonet/lint-staged) from 8.1.6 to 8.1.7. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Commits](https://github.com/okonet/lint-staged/compare/v8.1.6...v8.1.7) Signed-off-by: dependabot[bot] --- yarn.lock | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/yarn.lock b/yarn.lock index ca8e0e5d8..04fde8f69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1652,14 +1652,14 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cosmiconfig@^5.0.2, cosmiconfig@^5.0.7: - version "5.0.7" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.7.tgz#39826b292ee0d78eda137dfa3173bd1c21a43b04" - integrity sha512-PcLqxTKiDmNT6pSpy4N6KtuPwb53W+2tzNvwOZw0WH9N6O0vLIBq0x8aj8Oj75ere4YcGi48bDFCL+3fRJdlNA== +cosmiconfig@^5.0.7, cosmiconfig@^5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" + integrity sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA== dependencies: import-fresh "^2.0.0" is-directory "^0.3.1" - js-yaml "^3.9.0" + js-yaml "^3.13.1" parse-json "^4.0.0" coveralls@^3.0.2: @@ -3943,7 +3943,7 @@ js-stringify@^1.0.1: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.x, js-yaml@^3.11.0, js-yaml@^3.12.0, js-yaml@^3.12.1, js-yaml@^3.13.0, js-yaml@^3.9.0: +js-yaml@3.x, js-yaml@^3.11.0, js-yaml@^3.12.0, js-yaml@^3.12.1, js-yaml@^3.13.0: version "3.13.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e" integrity sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ== @@ -3951,6 +3951,14 @@ js-yaml@3.x, js-yaml@^3.11.0, js-yaml@^3.12.0, js-yaml@^3.12.1, js-yaml@^3.13.0, argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^3.13.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -4188,13 +4196,13 @@ levn@^0.3.0, levn@~0.3.0: type-check "~0.3.2" lint-staged@^8.0.4: - version "8.1.6" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-8.1.6.tgz#128a9bc5effbf69a359fb8f7eeb2da71a998daf6" - integrity sha512-QT13AniHN6swAtTjsrzxOfE4TVCiQ39xESwLmjGVNCMMZ/PK5aopwvbxLrzw+Zf9OxM3cQG6WCx9lceLzETOnQ== + version "8.1.7" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-8.1.7.tgz#a8988bc83bdffa97d04adb09dbc0b1f3a58fa6fc" + integrity sha512-egT0goFhIFoOGk6rasPngTFh2qDqxZddM0PwI58oi66RxCDcn5uDwxmiasWIF0qGnchHSYVJ8HPRD5LrFo7TKA== dependencies: chalk "^2.3.1" commander "^2.14.1" - cosmiconfig "^5.0.2" + cosmiconfig "^5.2.0" debug "^3.1.0" dedent "^0.7.0" del "^3.0.0" From 290ab5d0717ef89745459f5746cd8e598ee8f0da Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 16 May 2019 10:18:16 -0600 Subject: [PATCH 29/35] Allow loaders to access the mode --- lib/NormalModule.js | 1 + test/configCases/loaders/mode-default/a.js | 0 test/configCases/loaders/mode-default/index.js | 3 +++ test/configCases/loaders/mode-default/loader.js | 3 +++ .../loaders/mode-default/webpack.config.js | 10 ++++++++++ test/configCases/loaders/mode-development/a.js | 0 test/configCases/loaders/mode-development/index.js | 3 +++ test/configCases/loaders/mode-development/loader.js | 3 +++ .../loaders/mode-development/webpack.config.js | 11 +++++++++++ test/configCases/loaders/mode-none/a.js | 0 test/configCases/loaders/mode-none/index.js | 3 +++ test/configCases/loaders/mode-none/loader.js | 3 +++ test/configCases/loaders/mode-none/webpack.config.js | 11 +++++++++++ test/configCases/loaders/mode-production/a.js | 0 test/configCases/loaders/mode-production/index.js | 3 +++ test/configCases/loaders/mode-production/loader.js | 3 +++ .../loaders/mode-production/webpack.config.js | 11 +++++++++++ 17 files changed, 68 insertions(+) create mode 100644 test/configCases/loaders/mode-default/a.js create mode 100644 test/configCases/loaders/mode-default/index.js create mode 100644 test/configCases/loaders/mode-default/loader.js create mode 100644 test/configCases/loaders/mode-default/webpack.config.js create mode 100644 test/configCases/loaders/mode-development/a.js create mode 100644 test/configCases/loaders/mode-development/index.js create mode 100644 test/configCases/loaders/mode-development/loader.js create mode 100644 test/configCases/loaders/mode-development/webpack.config.js create mode 100644 test/configCases/loaders/mode-none/a.js create mode 100644 test/configCases/loaders/mode-none/index.js create mode 100644 test/configCases/loaders/mode-none/loader.js create mode 100644 test/configCases/loaders/mode-none/webpack.config.js create mode 100644 test/configCases/loaders/mode-production/a.js create mode 100644 test/configCases/loaders/mode-production/index.js create mode 100644 test/configCases/loaders/mode-production/loader.js create mode 100644 test/configCases/loaders/mode-production/webpack.config.js diff --git a/lib/NormalModule.js b/lib/NormalModule.js index 3e9dc5555..b01d9d00b 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -212,6 +212,7 @@ class NormalModule extends Module { rootContext: options.context, webpack: true, sourceMap: !!this.useSourceMap, + mode: options.mode, _module: this, _compilation: compilation, _compiler: compilation.compiler, diff --git a/test/configCases/loaders/mode-default/a.js b/test/configCases/loaders/mode-default/a.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/configCases/loaders/mode-default/index.js b/test/configCases/loaders/mode-default/index.js new file mode 100644 index 000000000..d0a4e106a --- /dev/null +++ b/test/configCases/loaders/mode-default/index.js @@ -0,0 +1,3 @@ +it("provides mode to loaders when the option is omitted", function() { + expect(require("./a")).toBe("production"); +}); diff --git a/test/configCases/loaders/mode-default/loader.js b/test/configCases/loaders/mode-default/loader.js new file mode 100644 index 000000000..0083d38fd --- /dev/null +++ b/test/configCases/loaders/mode-default/loader.js @@ -0,0 +1,3 @@ +module.exports = function(source) { + return `module.exports = "${this.mode}";`; +}; diff --git a/test/configCases/loaders/mode-default/webpack.config.js b/test/configCases/loaders/mode-default/webpack.config.js new file mode 100644 index 000000000..87ef526b9 --- /dev/null +++ b/test/configCases/loaders/mode-default/webpack.config.js @@ -0,0 +1,10 @@ +module.exports = { + module: { + rules: [ + { + test: /a\.js$/, + use: "./loader" + } + ] + } +}; diff --git a/test/configCases/loaders/mode-development/a.js b/test/configCases/loaders/mode-development/a.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/configCases/loaders/mode-development/index.js b/test/configCases/loaders/mode-development/index.js new file mode 100644 index 000000000..6fd77efcc --- /dev/null +++ b/test/configCases/loaders/mode-development/index.js @@ -0,0 +1,3 @@ +it("provides mode to loaders when the option is 'development'", function() { + expect(require("./a")).toBe("development"); +}); diff --git a/test/configCases/loaders/mode-development/loader.js b/test/configCases/loaders/mode-development/loader.js new file mode 100644 index 000000000..0083d38fd --- /dev/null +++ b/test/configCases/loaders/mode-development/loader.js @@ -0,0 +1,3 @@ +module.exports = function(source) { + return `module.exports = "${this.mode}";`; +}; diff --git a/test/configCases/loaders/mode-development/webpack.config.js b/test/configCases/loaders/mode-development/webpack.config.js new file mode 100644 index 000000000..5d7d3bf9b --- /dev/null +++ b/test/configCases/loaders/mode-development/webpack.config.js @@ -0,0 +1,11 @@ +module.exports = { + mode: "development", + module: { + rules: [ + { + test: /a\.js$/, + use: "./loader" + } + ] + } +}; diff --git a/test/configCases/loaders/mode-none/a.js b/test/configCases/loaders/mode-none/a.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/configCases/loaders/mode-none/index.js b/test/configCases/loaders/mode-none/index.js new file mode 100644 index 000000000..ffecdce0b --- /dev/null +++ b/test/configCases/loaders/mode-none/index.js @@ -0,0 +1,3 @@ +it("provides mode to loaders when the option is 'none'", function() { + expect(require("./a")).toBe("none"); +}); diff --git a/test/configCases/loaders/mode-none/loader.js b/test/configCases/loaders/mode-none/loader.js new file mode 100644 index 000000000..0083d38fd --- /dev/null +++ b/test/configCases/loaders/mode-none/loader.js @@ -0,0 +1,3 @@ +module.exports = function(source) { + return `module.exports = "${this.mode}";`; +}; diff --git a/test/configCases/loaders/mode-none/webpack.config.js b/test/configCases/loaders/mode-none/webpack.config.js new file mode 100644 index 000000000..ba5a8fb0a --- /dev/null +++ b/test/configCases/loaders/mode-none/webpack.config.js @@ -0,0 +1,11 @@ +module.exports = { + mode: "none", + module: { + rules: [ + { + test: /a\.js$/, + use: "./loader" + } + ] + } +}; diff --git a/test/configCases/loaders/mode-production/a.js b/test/configCases/loaders/mode-production/a.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/configCases/loaders/mode-production/index.js b/test/configCases/loaders/mode-production/index.js new file mode 100644 index 000000000..c6ccd5be9 --- /dev/null +++ b/test/configCases/loaders/mode-production/index.js @@ -0,0 +1,3 @@ +it("provides mode to loaders when the option is 'production'", function() { + expect(require("./a")).toBe("production"); +}); diff --git a/test/configCases/loaders/mode-production/loader.js b/test/configCases/loaders/mode-production/loader.js new file mode 100644 index 000000000..0083d38fd --- /dev/null +++ b/test/configCases/loaders/mode-production/loader.js @@ -0,0 +1,3 @@ +module.exports = function(source) { + return `module.exports = "${this.mode}";`; +}; diff --git a/test/configCases/loaders/mode-production/webpack.config.js b/test/configCases/loaders/mode-production/webpack.config.js new file mode 100644 index 000000000..20f3afada --- /dev/null +++ b/test/configCases/loaders/mode-production/webpack.config.js @@ -0,0 +1,11 @@ +module.exports = { + mode: "production", + module: { + rules: [ + { + test: /a\.js$/, + use: "./loader" + } + ] + } +}; From 1a63d7bd0dcad7091365586048b61e0c8384815a Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 16 May 2019 13:50:31 -0600 Subject: [PATCH 30/35] Default to production Co-Authored-By: Tobias Koppers --- lib/NormalModule.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/NormalModule.js b/lib/NormalModule.js index b01d9d00b..b8165366e 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -212,7 +212,7 @@ class NormalModule extends Module { rootContext: options.context, webpack: true, sourceMap: !!this.useSourceMap, - mode: options.mode, + mode: options.mode || "production", _module: this, _compilation: compilation, _compiler: compilation.compiler, From fac1b9f7707e35b12537a71895435b7319b875d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 17 May 2019 02:15:30 +0000 Subject: [PATCH 31/35] chore(deps-dev): bump eslint-config-prettier from 4.2.0 to 4.3.0 Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 4.2.0 to 4.3.0. - [Release notes](https://github.com/prettier/eslint-config-prettier/releases) - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v4.2.0...v4.3.0) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 04fde8f69..954d917d7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2181,9 +2181,9 @@ escodegen@^1.9.1: source-map "~0.6.1" eslint-config-prettier@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.2.0.tgz#70b946b629cd0e3e98233fd9ecde4cb9778de96c" - integrity sha512-y0uWc/FRfrHhpPZCYflWC8aE0KRJRY04rdZVfl8cL3sEZmOYyaBdhdlQPjKZBnuRMyLVK+JUZr7HaZFClQiH4w== + version "4.3.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.3.0.tgz#c55c1fcac8ce4518aeb77906984e134d9eb5a4f0" + integrity sha512-sZwhSTHVVz78+kYD3t5pCWSYEdVSBR0PXnwjDRsUs8ytIrK8PLXw+6FKp8r3Z7rx4ZszdetWlXYKOHoUrrwPlA== dependencies: get-stdin "^6.0.0" From b3220703446574c9749882bf23fd258ea6ab6097 Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Mon, 13 May 2019 23:58:35 +0200 Subject: [PATCH 32/35] fix: provide useful stacktrace on chunk loading failure Error created from load/error event handler has no useful stack trace whatsoever as it's an async event and stack has unwound already at that point. To have better (sync) stacktrace of what triggered loading of the chunk, create error before stack has unwound and use it and its stacktrace later, in case of an error. This potentially has some processing overhead as browser needs to create a stacktrace. It's probably not that big though but I haven't done any real testing. --- lib/web/JsonpMainTemplatePlugin.js | 4 +- .../__snapshots__/StatsTestCases.test.js.snap | 118 +++++++++--------- 2 files changed, 62 insertions(+), 60 deletions(-) diff --git a/lib/web/JsonpMainTemplatePlugin.js b/lib/web/JsonpMainTemplatePlugin.js index 482f72bbd..75a9da22a 100644 --- a/lib/web/JsonpMainTemplatePlugin.js +++ b/lib/web/JsonpMainTemplatePlugin.js @@ -173,6 +173,8 @@ class JsonpMainTemplatePlugin { "}" ]) : "", + "// create error before stack unwound to get useful stacktrace later", + "var error = new Error();", "onScriptComplete = function (event) {", Template.indent([ "// avoid mem leaks in IE.", @@ -185,7 +187,7 @@ class JsonpMainTemplatePlugin { Template.indent([ "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", "var realSrc = event && event.target && event.target.src;", - "var error = new Error('Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')');", + "error.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", "error.type = errorType;", "error.request = realSrc;", "chunk[1](error);" diff --git a/test/__snapshots__/StatsTestCases.test.js.snap b/test/__snapshots__/StatsTestCases.test.js.snap index bd5274584..70c82e944 100644 --- a/test/__snapshots__/StatsTestCases.test.js.snap +++ b/test/__snapshots__/StatsTestCases.test.js.snap @@ -1,21 +1,21 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`StatsTestCases should print correct stats for aggressive-splitting-entry 1`] = ` -"Hash: e82547675e389094fe3de82547675e389094fe3d +"Hash: d524793ebb8ce4369ef3d524793ebb8ce4369ef3 Child fitting: - Hash: e82547675e389094fe3d + Hash: d524793ebb8ce4369ef3 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - 1c1645069e9e0eeefaba.js 11 KiB 1 [emitted] 33966214360bbbb31383.js 1.94 KiB 2 [emitted] 445d4c6a1d7381d6cb2c.js 1.94 KiB 3 [emitted] + 921eee6e6f9c90854444.js 11.1 KiB 1 [emitted] d4b551c6319035df2898.js 1.05 KiB 0 [emitted] - Entrypoint main = 33966214360bbbb31383.js 445d4c6a1d7381d6cb2c.js 1c1645069e9e0eeefaba.js + Entrypoint main = 33966214360bbbb31383.js 445d4c6a1d7381d6cb2c.js 921eee6e6f9c90854444.js chunk {0} d4b551c6319035df2898.js 916 bytes <{1}> <{2}> <{3}> > ./g [4] ./index.js 7:0-13 [7] ./g.js 916 bytes {0} [built] - chunk {1} 1c1645069e9e0eeefaba.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] + chunk {1} 921eee6e6f9c90854444.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] > ./index main [3] ./e.js 899 bytes {1} [built] [4] ./index.js 111 bytes {1} [built] @@ -29,19 +29,19 @@ Child fitting: [1] ./c.js 899 bytes {3} [built] [2] ./d.js 899 bytes {3} [built] Child content-change: - Hash: e82547675e389094fe3d + Hash: d524793ebb8ce4369ef3 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - 1c1645069e9e0eeefaba.js 11 KiB 1 [emitted] 33966214360bbbb31383.js 1.94 KiB 2 [emitted] 445d4c6a1d7381d6cb2c.js 1.94 KiB 3 [emitted] + 921eee6e6f9c90854444.js 11.1 KiB 1 [emitted] d4b551c6319035df2898.js 1.05 KiB 0 [emitted] - Entrypoint main = 33966214360bbbb31383.js 445d4c6a1d7381d6cb2c.js 1c1645069e9e0eeefaba.js + Entrypoint main = 33966214360bbbb31383.js 445d4c6a1d7381d6cb2c.js 921eee6e6f9c90854444.js chunk {0} d4b551c6319035df2898.js 916 bytes <{1}> <{2}> <{3}> > ./g [4] ./index.js 7:0-13 [7] ./g.js 916 bytes {0} [built] - chunk {1} 1c1645069e9e0eeefaba.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] + chunk {1} 921eee6e6f9c90854444.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] > ./index main [3] ./e.js 899 bytes {1} [built] [4] ./index.js 111 bytes {1} [built] @@ -57,13 +57,13 @@ Child content-change: `; exports[`StatsTestCases should print correct stats for aggressive-splitting-on-demand 1`] = ` -"Hash: f682b6dfa3cec23b4fff +"Hash: 96eb8998861d28c252c9 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 01a8254701931adbf278.js 1.01 KiB 9 [emitted] 07830cd8072d83cdc6ad.js 1.01 KiB 10 [emitted] -1cd3a64e15add49c06d8.js 9.64 KiB 4 [emitted] main +12cc6b35fbee8a83d4c7.js 9.75 KiB 4 [emitted] main 2736cf9d79233cd0a9b6.js 1.93 KiB 0 [emitted] 29de52df747b400f6177.js 1 KiB 1 [emitted] 41be79832883258c21e6.js 1.94 KiB 6 [emitted] @@ -73,7 +73,7 @@ Built at: Thu Jan 01 1970 00:00:00 GMT ba9fedb7aa0c69201639.js 1.94 KiB 11 [emitted] d40ae25f5e7ef09d2e24.js 1.94 KiB 7, 10 [emitted] e5fb899955fa03a8053b.js 1.94 KiB 5 [emitted] -Entrypoint main = 1cd3a64e15add49c06d8.js +Entrypoint main = 12cc6b35fbee8a83d4c7.js chunk {0} 2736cf9d79233cd0a9b6.js 1.76 KiB <{4}> ={1}= ={2}= ={3}= ={6}= ={10}= [recorded] aggressive splitted > ./b ./d ./e ./f ./g [11] ./index.js 5:0-44 > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 @@ -93,7 +93,7 @@ chunk {3} 43c1ac24102c075ecb2d.js 1.76 KiB <{4}> ={0}= ={2}= ={6}= ={10}= [re > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 [2] ./e.js 899 bytes {1} {3} [built] [6] ./h.js 899 bytes {3} {11} [built] -chunk {4} 1cd3a64e15add49c06d8.js (main) 248 bytes >{0}< >{1}< >{2}< >{3}< >{5}< >{6}< >{7}< >{8}< >{9}< >{10}< >{11}< [entry] [rendered] +chunk {4} 12cc6b35fbee8a83d4c7.js (main) 248 bytes >{0}< >{1}< >{2}< >{3}< >{5}< >{6}< >{7}< >{8}< >{9}< >{10}< >{11}< [entry] [rendered] > ./index main [11] ./index.js 248 bytes {4} [built] chunk {5} e5fb899955fa03a8053b.js 1.76 KiB <{4}> @@ -492,14 +492,14 @@ chunk {1} main1.js (main1) 136 bytes [entry] [rendered] `; exports[`StatsTestCases should print correct stats for chunks 1`] = ` -"Hash: 34cad0d1897c8ba31143 +"Hash: d705fa47b1ad3d93dd58 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 1.bundle.js 232 bytes 1 [emitted] 2.bundle.js 152 bytes 2 [emitted] 3.bundle.js 289 bytes 3 [emitted] - bundle.js 8.23 KiB 0 [emitted] main + bundle.js 8.34 KiB 0 [emitted] main Entrypoint main = bundle.js chunk {0} bundle.js (main) 73 bytes >{2}< >{3}< [entry] [rendered] > ./index main @@ -530,14 +530,14 @@ chunk {3} 3.bundle.js 54 bytes <{0}> >{1}< [rendered] `; exports[`StatsTestCases should print correct stats for chunks-development 1`] = ` -"Hash: 7192da34b98e59fe39b2 +"Hash: c12322ddb1ced28f356c Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.bundle.js 588 bytes 0 [emitted] 1.bundle.js 297 bytes 1 [emitted] 2.bundle.js 433 bytes 2 [emitted] - bundle.js 8.61 KiB main [emitted] main + bundle.js 8.72 KiB main [emitted] main Entrypoint main = bundle.js chunk {0} 0.bundle.js 60 bytes <{2}> [rendered] > [./c.js] ./c.js 1:0-52 @@ -1072,14 +1072,14 @@ chunk {5} y.js (y) 0 bytes <{3}> <{4}> [rendered] `; exports[`StatsTestCases should print correct stats for import-context-filter 1`] = ` -"Hash: cbf8fc5e9562c9249823 +"Hash: 029b08a3a0c343d3a477 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.js 305 bytes 0 [emitted] 1.js 314 bytes 1 [emitted] 2.js 308 bytes 2 [emitted] -entry.js 9.05 KiB 3 [emitted] entry +entry.js 9.16 KiB 3 [emitted] entry Entrypoint entry = entry.js [0] ./templates/bar.js 38 bytes {0} [optional] [built] [1] ./templates/baz.js 38 bytes {1} [optional] [built] @@ -1089,12 +1089,12 @@ Entrypoint entry = entry.js `; exports[`StatsTestCases should print correct stats for import-weak 1`] = ` -"Hash: 818b39ea7c5c1ff94df3 +"Hash: 3c7715820cb46e731729 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 1.js 149 bytes 1 [emitted] -entry.js 8.47 KiB 0 [emitted] entry +entry.js 8.58 KiB 0 [emitted] entry Entrypoint entry = entry.js [0] ./modules/b.js 22 bytes {1} [built] [1] ./entry.js 120 bytes {0} [built] @@ -1124,7 +1124,7 @@ Compilation error while processing magic comment(-s): /* webpackPrefetch: true, `; exports[`StatsTestCases should print correct stats for issue-7577 1`] = ` -"Hash: 9c248e1f7cf8b331fba532fffa02370ddddc7d7d1319e261db9517be4c62 +"Hash: 9c248e1f7cf8b331fba532fffa02370ddddc7d7dfcb8e81ff94ce622913a Child Hash: 9c248e1f7cf8b331fba5 Time: Xms @@ -1148,7 +1148,7 @@ Child [0] ./node_modules/vendor.js 23 bytes {vendors~main} [built] [1] ./b.js 17 bytes {all~main} [built] Child - Hash: 1319e261db9517be4c62 + Hash: fcb8e81ff94ce622913a Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names @@ -1156,15 +1156,15 @@ Child c-1-5eacbd7fee2224716029.js 153 bytes 1 [emitted] c-all~main-3de9f206741c28715d19.js 305 bytes all~main [emitted] all~main c-main-75156155081cda3092db.js 114 bytes main [emitted] main - c-runtime~main-fa9139835607a6c95344.js 9.59 KiB runtime~main [emitted] runtime~main - Entrypoint main = c-runtime~main-fa9139835607a6c95344.js c-all~main-3de9f206741c28715d19.js c-main-75156155081cda3092db.js (prefetch: c-1-5eacbd7fee2224716029.js c-0-5b8bdddff2dcbbac44bf.js) + c-runtime~main-d9218b78b260b895303b.js 9.7 KiB runtime~main [emitted] runtime~main + Entrypoint main = c-runtime~main-d9218b78b260b895303b.js c-all~main-3de9f206741c28715d19.js c-main-75156155081cda3092db.js (prefetch: c-1-5eacbd7fee2224716029.js c-0-5b8bdddff2dcbbac44bf.js) [0] ./b.js 17 bytes {0} [built] [1] ./c.js 61 bytes {all~main} [built] [2] ./node_modules/vendor.js 23 bytes {1} [built]" `; exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin 1`] = ` -"Hash: 4c228d725cbf3eab49b0c4c4e0337021c38dadbfe19eb8024444df3ec45e8ce9ff5edae99037259a +"Hash: 4c228d725cbf3eab49b01d459b5ae91657520cf1ea5d046a3a3199b128cb4e594c01cb2ee66a4e9e Child 1 chunks: Hash: 4c228d725cbf3eab49b0 Time: Xms @@ -1180,12 +1180,12 @@ Child 1 chunks: [4] ./d.js 22 bytes {0} [built] [5] ./e.js 22 bytes {0} [built] Child 2 chunks: - Hash: c4c4e0337021c38dadbf + Hash: 1d459b5ae91657520cf1 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.bundle.js 401 bytes 0 [emitted] - bundle.js 8.46 KiB 1 [emitted] main + bundle.js 8.57 KiB 1 [emitted] main Entrypoint main = bundle.js chunk {0} 0.bundle.js 88 bytes <{1}> [rendered] [2] ./a.js 22 bytes {0} [built] @@ -1196,13 +1196,13 @@ Child 2 chunks: [0] ./index.js 101 bytes {1} [built] [1] ./c.js 30 bytes {1} [built] Child 3 chunks: - Hash: e19eb8024444df3ec45e + Hash: ea5d046a3a3199b128cb Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 1.bundle.js 245 bytes 1 [emitted] 2.bundle.js 232 bytes 2 [emitted] - bundle.js 8.46 KiB 0 [emitted] main + bundle.js 8.57 KiB 0 [emitted] main Entrypoint main = bundle.js chunk {0} bundle.js (main) 131 bytes <{0}> >{0}< >{1}< >{2}< [entry] [rendered] [0] ./index.js 101 bytes {0} [built] @@ -1214,14 +1214,14 @@ Child 3 chunks: [4] ./d.js 22 bytes {2} [built] [5] ./e.js 22 bytes {2} [built] Child 4 chunks: - Hash: 8ce9ff5edae99037259a + Hash: 4e594c01cb2ee66a4e9e Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 1.bundle.js 245 bytes 1 [emitted] 2.bundle.js 152 bytes 2 [emitted] 3.bundle.js 152 bytes 3 [emitted] - bundle.js 8.46 KiB 0 [emitted] main + bundle.js 8.57 KiB 0 [emitted] main Entrypoint main = bundle.js chunk {0} bundle.js (main) 131 bytes <{0}> >{0}< >{1}< >{2}< >{3}< [entry] [rendered] [0] ./index.js 101 bytes {0} [built] @@ -1291,7 +1291,7 @@ Entrypoint main = main.js `; exports[`StatsTestCases should print correct stats for module-assets 1`] = ` -"Hash: 3800082315c6d35bb423 +"Hash: 2c05268b726f002f1d70 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint main = main.js @@ -1313,9 +1313,9 @@ exports[`StatsTestCases should print correct stats for module-deduplication 1`] 6.js 661 bytes 6 [emitted] 7.js 661 bytes 7 [emitted] 8.js 661 bytes 8 [emitted] -e1.js 9.37 KiB 3 [emitted] e1 -e2.js 9.39 KiB 4 [emitted] e2 -e3.js 9.41 KiB 5 [emitted] e3 +e1.js 9.48 KiB 3 [emitted] e1 +e2.js 9.5 KiB 4 [emitted] e2 +e3.js 9.52 KiB 5 [emitted] e3 Entrypoint e1 = e1.js Entrypoint e2 = e2.js Entrypoint e3 = e3.js @@ -1359,9 +1359,9 @@ exports[`StatsTestCases should print correct stats for module-deduplication-name async1.js 820 bytes 0 [emitted] async1 async2.js 820 bytes 1 [emitted] async2 async3.js 820 bytes 2 [emitted] async3 - e1.js 9.23 KiB 3 [emitted] e1 - e2.js 9.25 KiB 4 [emitted] e2 - e3.js 9.27 KiB 5 [emitted] e3 + e1.js 9.34 KiB 3 [emitted] e1 + e2.js 9.36 KiB 4 [emitted] e2 + e3.js 9.38 KiB 5 [emitted] e3 Entrypoint e1 = e1.js Entrypoint e2 = e2.js Entrypoint e3 = e3.js @@ -1487,13 +1487,13 @@ Entrypoint entry = vendor.js entry.js `; exports[`StatsTestCases should print correct stats for named-chunks-plugin-async 1`] = ` -"Hash: c90d9bc140f3e8bbd29c +"Hash: 60385d369365bc0fd54c Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names chunk-containing-__a_js.js 307 bytes chunk-containing-__a_js [emitted] chunk-containing-__b_js.js 182 bytes chunk-containing-__b_js [emitted] - entry.js 8.13 KiB entry [emitted] entry + entry.js 8.23 KiB entry [emitted] entry Entrypoint entry = entry.js [0] ./entry.js 47 bytes {entry} [built] [1] ./modules/b.js 22 bytes {chunk-containing-__b_js} [built] @@ -1523,7 +1523,7 @@ Child child: `; exports[`StatsTestCases should print correct stats for optimize-chunks 1`] = ` -"Hash: aa85d85eda19bac37a2e +"Hash: 9fb1f75980b8d2b56559 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names @@ -1534,7 +1534,7 @@ Built at: Thu Jan 01 1970 00:00:00 GMT cir1.js 299 bytes 0 [emitted] cir1 cir2 from cir1.js 359 bytes 6, 5 [emitted] cir2 from cir1 cir2.js 299 bytes 5 [emitted] cir2 - main.js 9.03 KiB 7 [emitted] main + main.js 9.14 KiB 7 [emitted] main Entrypoint main = main.js chunk {0} cir1.js (cir1) 81 bytes <{5}> <{7}> >{6}< [rendered] > [5] ./index.js 13:0-54 @@ -1826,7 +1826,7 @@ exports[`StatsTestCases should print correct stats for prefetch 1`] = ` " Asset Size Chunks Chunk Names inner.js 130 bytes 0 [emitted] inner inner2.js 188 bytes 1 [emitted] inner2 - main.js 9.65 KiB 2 [emitted] main + main.js 9.76 KiB 2 [emitted] main normal.js 130 bytes 3 [emitted] normal prefetched.js 475 bytes 4 [emitted] prefetched prefetched2.js 127 bytes 5 [emitted] prefetched2 @@ -1859,7 +1859,7 @@ exports[`StatsTestCases should print correct stats for preload 1`] = ` " Asset Size Chunks Chunk Names inner.js 130 bytes 0 [emitted] inner inner2.js 188 bytes 1 [emitted] inner2 - main.js 9.75 KiB 2 [emitted] main + main.js 9.86 KiB 2 [emitted] main normal.js 130 bytes 3 [emitted] normal preloaded.js 467 bytes 4 [emitted] preloaded preloaded2.js 127 bytes 5 [emitted] preloaded2 @@ -1875,14 +1875,14 @@ chunk {6} preloaded3.js (preloaded3) 0 bytes <{2}> [rendered]" `; exports[`StatsTestCases should print correct stats for preset-detailed 1`] = ` -"Hash: 934b93428d78d30a6bf2 +"Hash: 6ec7fe98c2ecd225affe Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 1.js 232 bytes 1 [emitted] 2.js 152 bytes 2 [emitted] 3.js 289 bytes 3 [emitted] -main.js 8.23 KiB 0 [emitted] main +main.js 8.34 KiB 0 [emitted] main Entrypoint main = main.js chunk {0} main.js (main) 73 bytes >{2}< >{3}< [entry] [rendered] > ./index main @@ -1936,14 +1936,14 @@ exports[`StatsTestCases should print correct stats for preset-none-array 1`] = ` exports[`StatsTestCases should print correct stats for preset-none-error 1`] = `""`; exports[`StatsTestCases should print correct stats for preset-normal 1`] = ` -"Hash: 934b93428d78d30a6bf2 +"Hash: 6ec7fe98c2ecd225affe Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 1.js 232 bytes 1 [emitted] 2.js 152 bytes 2 [emitted] 3.js 289 bytes 3 [emitted] -main.js 8.23 KiB 0 [emitted] main +main.js 8.34 KiB 0 [emitted] main Entrypoint main = main.js [0] ./index.js 51 bytes {0} [built] [1] ./a.js 22 bytes {0} [built] @@ -2014,14 +2014,14 @@ Entrypoints: `; exports[`StatsTestCases should print correct stats for preset-verbose 1`] = ` -"Hash: 934b93428d78d30a6bf2 +"Hash: 6ec7fe98c2ecd225affe Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 1.js 232 bytes 1 [emitted] 2.js 152 bytes 2 [emitted] 3.js 289 bytes 3 [emitted] -main.js 8.23 KiB 0 [emitted] main +main.js 8.34 KiB 0 [emitted] main Entrypoint main = main.js chunk {0} main.js (main) 73 bytes >{2}< >{3}< [entry] [rendered] > ./index main @@ -2111,7 +2111,7 @@ exports[`StatsTestCases should print correct stats for runtime-chunk-integration Asset Size Chunks Chunk Names 0.js 728 bytes 0 [emitted] main1.js 539 bytes 1 [emitted] main1 - runtime.js 8.7 KiB 2 [emitted] runtime + runtime.js 8.81 KiB 2 [emitted] runtime Entrypoint main1 = runtime.js main1.js [0] ./main1.js 66 bytes {1} [built] [1] ./b.js 20 bytes {0} [built] @@ -2121,7 +2121,7 @@ Child manifest is named entry: Asset Size Chunks Chunk Names 0.js 737 bytes 0 [emitted] main1.js 539 bytes 2 [emitted] main1 - manifest.js 9.01 KiB 1 [emitted] manifest + manifest.js 9.12 KiB 1 [emitted] manifest Entrypoint main1 = manifest.js main1.js Entrypoint manifest = manifest.js [0] ./main1.js 66 bytes {2} [built] @@ -2142,7 +2142,7 @@ Entrypoint e2 = runtime.js e2.js" `; exports[`StatsTestCases should print correct stats for scope-hoisting-bailouts 1`] = ` -"Hash: 21b74df86e904b9e34c1 +"Hash: 2a7b18734507859f49cf Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint index = index.js @@ -2174,9 +2174,9 @@ Entrypoint entry = entry.js `; exports[`StatsTestCases should print correct stats for scope-hoisting-multi 1`] = ` -"Hash: 5c9b2608ec3886c8a552d597421ff533ba6b23ef +"Hash: a5a12aaa20eb499386135bf1947abb0f025e8f21 Child - Hash: 5c9b2608ec3886c8a552 + Hash: a5a12aaa20eb49938613 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint first = vendor.js first.js @@ -2193,7 +2193,7 @@ Child [9] ./common_lazy_shared.js 25 bytes {2} {3} {4} [built] [10] ./common_lazy.js 25 bytes {2} {3} [built] Child - Hash: d597421ff533ba6b23ef + Hash: 5bf1947abb0f025e8f21 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint first = vendor.js first.js @@ -2221,12 +2221,12 @@ Child `; exports[`StatsTestCases should print correct stats for side-effects-issue-7428 1`] = ` -"Hash: 1db323720a3bbea98b3b +"Hash: 0521fcbcd079754c226d Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 1.js 481 bytes 1 [emitted] -main.js 9.29 KiB 0 [emitted] main +main.js 9.4 KiB 0 [emitted] main Entrypoint main = main.js [0] ./components/src/CompAB/index.js 87 bytes [built] [no exports used] From ad08a378ceb7e199c259454099527fb4781bbd27 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 20 May 2019 02:17:21 +0000 Subject: [PATCH 33/35] chore(deps-dev): bump @types/node from 10.14.6 to 10.14.7 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 10.14.6 to 10.14.7. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 15bc84bc4..a34e093d7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -373,9 +373,9 @@ integrity sha512-MeatbbUsZ80BEsKPXby6pUZjUM9ZuHIpWElN0siopih3fvnlpX2O9L6D5+dzDIb36lf9tM/8U4PVdLQ+L4qr4A== "@types/node@^10.12.21": - version "10.14.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.6.tgz#9cbfcb62c50947217f4d88d4d274cc40c22625a9" - integrity sha512-Fvm24+u85lGmV4hT5G++aht2C5I4Z4dYlWZIh62FAfFO/TfzXtPpoLI6I7AuBWkIFqZCnhFOoTT7RjjaIL5Fjg== + version "10.14.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.7.tgz#1854f0a9aa8d2cd6818d607b3d091346c6730362" + integrity sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A== "@types/prettier@^1.16.1": version "1.16.1" From a4bbdae0d247e4e37de31d7c422324aecac0ad9f Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 20 May 2019 11:09:45 +0200 Subject: [PATCH 34/35] fix problem with dll and sideEffects allow to redirect module and id in reexports SideEffects plugin redirects reexports too fixes #9146 --- ...armonyExportImportedSpecifierDependency.js | 28 +++++++++++++------ lib/optimize/SideEffectsFlagPlugin.js | 5 ++-- .../__snapshots__/StatsTestCases.test.js.snap | 8 +++--- test/configCases/dll-plugin/0-create-dll/h.js | 1 + .../configCases/dll-plugin/0-create-dll/h1.js | 2 ++ .../configCases/dll-plugin/0-create-dll/ha.js | 1 + .../configCases/dll-plugin/0-create-dll/hb.js | 1 + .../dll-plugin/0-create-dll/webpack.config.js | 9 +++++- .../configCases/dll-plugin/1-use-dll/index.js | 24 +++++++++++----- .../2-use-dll-without-scope/index.js | 26 +++++++++++++---- 10 files changed, 77 insertions(+), 28 deletions(-) create mode 100644 test/configCases/dll-plugin/0-create-dll/h.js create mode 100644 test/configCases/dll-plugin/0-create-dll/h1.js create mode 100644 test/configCases/dll-plugin/0-create-dll/ha.js create mode 100644 test/configCases/dll-plugin/0-create-dll/hb.js diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index 1965d0dbb..af782589d 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -50,6 +50,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { ) { super(request, originModule, sourceOrder, parserScope); this.id = id; + this.redirectedId = undefined; this.name = name; this.activeExports = activeExports; this.otherStarExports = otherStarExports; @@ -60,9 +61,13 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { return "harmony export imported specifier"; } + get _id() { + return this.redirectedId || this.id; + } + getMode(ignoreUnused) { const name = this.name; - const id = this.id; + const id = this._id; const used = this.originModule.isUsed(name); const importedModule = this._module; @@ -288,7 +293,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { }; } - const importedModule = this.module; + const importedModule = this._module; if (!importedModule) { // no imported module available @@ -350,11 +355,11 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { // It's not an harmony module if ( this.originModule.buildMeta.strictHarmonyModule && - this.id !== "default" + this._id !== "default" ) { // In strict harmony modules we only support the default export - const exportName = this.id - ? `the named export '${this.id}'` + const exportName = this._id + ? `the named export '${this._id}'` : "the namespace object"; return [ new HarmonyLinkingError( @@ -365,20 +370,20 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { return; } - if (!this.id) { + if (!this._id) { return; } - if (importedModule.isProvided(this.id) !== false) { + if (importedModule.isProvided(this._id) !== false) { // It's provided or we are not sure return; } // We are sure that it's not provided const idIsNotNameMessage = - this.id !== this.name ? ` (reexported as '${this.name}')` : ""; + this._id !== this.name ? ` (reexported as '${this.name}')` : ""; const errorMessage = `"export '${ - this.id + this._id }'${idIsNotNameMessage} was not found in '${this.userRequest}'`; return [new HarmonyLinkingError(errorMessage)]; } @@ -402,6 +407,11 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { importedModule.used + stringifiedUsedExport + stringifiedProvidedExport ); } + + disconnect() { + super.disconnect(); + this.redirectedId = undefined; + } } module.exports = HarmonyExportImportedSpecifierDependency; diff --git a/lib/optimize/SideEffectsFlagPlugin.js b/lib/optimize/SideEffectsFlagPlugin.js index e2a706a7f..96a4cb4c1 100644 --- a/lib/optimize/SideEffectsFlagPlugin.js +++ b/lib/optimize/SideEffectsFlagPlugin.js @@ -111,8 +111,9 @@ class SideEffectsFlagPlugin { const reason = module.reasons[i]; const dep = reason.dependency; if ( - dep instanceof HarmonyImportSpecifierDependency && - !dep.namespaceObjectAsContext + dep instanceof HarmonyExportImportedSpecifierDependency || + (dep instanceof HarmonyImportSpecifierDependency && + !dep.namespaceObjectAsContext) ) { const mapping = map.get(dep.id); if (mapping) { diff --git a/test/__snapshots__/StatsTestCases.test.js.snap b/test/__snapshots__/StatsTestCases.test.js.snap index 70c82e944..17044f9d3 100644 --- a/test/__snapshots__/StatsTestCases.test.js.snap +++ b/test/__snapshots__/StatsTestCases.test.js.snap @@ -2231,16 +2231,14 @@ Entrypoint main = main.js [0] ./components/src/CompAB/index.js 87 bytes [built] [no exports used] harmony side effect evaluation ./CompAB [3] ./components/src/index.js 1:0-40 - harmony export imported specifier ./CompAB [3] ./components/src/index.js 1:0-40 - harmony export imported specifier ./CompAB [3] ./components/src/index.js 1:0-40 [1] ./components/src/CompC/CompC.js 33 bytes [built] [no exports used] harmony side effect evaluation ./CompC [2] ./components/src/CompC/index.js 1:0-34 harmony export imported specifier ./CompC [2] ./components/src/CompC/index.js 1:0-34 + harmony export imported specifier ./CompC [3] ./components/src/index.js 2:0-43 (skipped side-effect-free modules) [2] ./components/src/CompC/index.js 34 bytes [built] [no exports used] harmony side effect evaluation ./CompC [3] ./components/src/index.js 2:0-43 - harmony export imported specifier ./CompC [3] ./components/src/index.js 2:0-43 [3] ./components/src/index.js 84 bytes [built] [no exports used] harmony side effect evaluation ./components [6] ./foo.js 1:0-37 @@ -2249,6 +2247,7 @@ Entrypoint main = main.js [only some exports used: default] harmony side effect evaluation ./CompA [0] ./components/src/CompAB/index.js 1:0-43 harmony export imported specifier ./CompA [0] ./components/src/CompAB/index.js 1:0-43 + harmony export imported specifier ./CompAB [3] ./components/src/index.js 1:0-40 (skipped side-effect-free modules) harmony import specifier ./components [6] ./foo.js 3:20-25 (skipped side-effect-free modules) harmony import specifier ./components ./main.js 3:15-20 (skipped side-effect-free modules) [5] ./components/src/CompAB/utils.js 97 bytes {0} [built] @@ -2266,11 +2265,12 @@ Entrypoint main = main.js | [only some exports used: default] | harmony side effect evaluation ./CompB [0] ./components/src/CompAB/index.js 2:0-43 | harmony export imported specifier ./CompB [0] ./components/src/CompAB/index.js 2:0-43 + | harmony export imported specifier ./CompAB [3] ./components/src/index.js 1:0-40 (skipped side-effect-free modules) | harmony import specifier ./components ./main.js 4:15-20 (skipped side-effect-free modules)" `; exports[`StatsTestCases should print correct stats for side-effects-simple-unused 1`] = ` -"Hash: 518ad50555bd6e64c28b +"Hash: a5866e21e8cfa3ae1a89 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names diff --git a/test/configCases/dll-plugin/0-create-dll/h.js b/test/configCases/dll-plugin/0-create-dll/h.js new file mode 100644 index 000000000..1fa89a4fb --- /dev/null +++ b/test/configCases/dll-plugin/0-create-dll/h.js @@ -0,0 +1 @@ +export { B } from "./h1.js"; diff --git a/test/configCases/dll-plugin/0-create-dll/h1.js b/test/configCases/dll-plugin/0-create-dll/h1.js new file mode 100644 index 000000000..a392743d9 --- /dev/null +++ b/test/configCases/dll-plugin/0-create-dll/h1.js @@ -0,0 +1,2 @@ +export { A } from "./ha.js"; +export { B } from "./hb.js"; diff --git a/test/configCases/dll-plugin/0-create-dll/ha.js b/test/configCases/dll-plugin/0-create-dll/ha.js new file mode 100644 index 000000000..6506d8d86 --- /dev/null +++ b/test/configCases/dll-plugin/0-create-dll/ha.js @@ -0,0 +1 @@ +export const A = "A"; \ No newline at end of file diff --git a/test/configCases/dll-plugin/0-create-dll/hb.js b/test/configCases/dll-plugin/0-create-dll/hb.js new file mode 100644 index 000000000..f3c1f2c5d --- /dev/null +++ b/test/configCases/dll-plugin/0-create-dll/hb.js @@ -0,0 +1 @@ +export const B = "B"; \ No newline at end of file diff --git a/test/configCases/dll-plugin/0-create-dll/webpack.config.js b/test/configCases/dll-plugin/0-create-dll/webpack.config.js index af773ff4f..527195e32 100644 --- a/test/configCases/dll-plugin/0-create-dll/webpack.config.js +++ b/test/configCases/dll-plugin/0-create-dll/webpack.config.js @@ -2,7 +2,7 @@ var path = require("path"); var webpack = require("../../../../"); module.exports = { - entry: ["./a", "./b", "./_d", "./_e", "./f", "./g.abc"], + entry: ["./a", "./b", "./_d", "./_e", "./f", "./g.abc", "./h"], resolve: { extensions: [".js", ".jsx"] }, @@ -19,9 +19,16 @@ module.exports = { options: { test: 1 } + }, + { + test: /0-create-dll.h/, + sideEffects: false } ] }, + optimization: { + sideEffects: true + }, plugins: [ new webpack.DllPlugin({ path: path.resolve( diff --git a/test/configCases/dll-plugin/1-use-dll/index.js b/test/configCases/dll-plugin/1-use-dll/index.js index 9d0f47340..12ab50636 100644 --- a/test/configCases/dll-plugin/1-use-dll/index.js +++ b/test/configCases/dll-plugin/1-use-dll/index.js @@ -1,6 +1,7 @@ import d from "dll/d"; import { x1, y2 } from "./e"; import { x2, y1 } from "dll/e"; +import { B } from "dll/h"; it("should load a module from dll", function() { expect(require("dll/a")).toBe("a"); @@ -11,10 +12,12 @@ it("should load a module of non-default type without extension from dll", functi }); it("should load an async module from dll", function(done) { - require("dll/b")().then(function(c) { - expect(c).toEqual(nsObj({ default: "c" })); - done(); - }).catch(done); + require("dll/b")() + .then(function(c) { + expect(c).toEqual(nsObj({ default: "c" })); + done(); + }) + .catch(done); }); it("should load an harmony module from dll (default export)", function() { @@ -33,7 +36,9 @@ it("should load a module with loader applied", function() { }); it("should give modules the correct ids", function() { - expect(Object.keys(__webpack_modules__).filter(m => !m.startsWith("../.."))).toEqual([ + expect( + Object.keys(__webpack_modules__).filter(m => !m.startsWith("../..")) + ).toEqual([ "./index.js", "dll-reference ../0-create-dll/dll.js", "dll/a.js", @@ -43,6 +48,11 @@ it("should give modules the correct ids", function() { "dll/e1.js", "dll/e2.js", "dll/f.jsx", - "dll/g.abc.js" - ]); + "dll/g.abc.js", + "dll/h.js" + ]); +}); + +it("should not crash on side-effect-free modules", function() { + expect(B).toBe("B"); }); diff --git a/test/configCases/dll-plugin/2-use-dll-without-scope/index.js b/test/configCases/dll-plugin/2-use-dll-without-scope/index.js index 28f812593..acf04df03 100644 --- a/test/configCases/dll-plugin/2-use-dll-without-scope/index.js +++ b/test/configCases/dll-plugin/2-use-dll-without-scope/index.js @@ -1,6 +1,8 @@ import d from "../0-create-dll/d"; import { x1, y2 } from "./e"; import { x2, y1 } from "../0-create-dll/e"; +import { B } from "../0-create-dll/h"; +import { A } from "../0-create-dll/h1"; it("should load a module from dll", function() { expect(require("../0-create-dll/a")).toBe("a"); @@ -11,10 +13,12 @@ it("should load a module of non-default type without extension from dll", functi }); it("should load an async module from dll", function(done) { - require("../0-create-dll/b")().then(function(c) { - expect(c).toEqual(nsObj({ default: "c" })); - done(); - }).catch(done); + require("../0-create-dll/b")() + .then(function(c) { + expect(c).toEqual(nsObj({ default: "c" })); + done(); + }) + .catch(done); }); it("should load an harmony module from dll (default export)", function() { @@ -33,7 +37,9 @@ it("should load a module with loader applied", function() { }); it("should give modules the correct ids", function() { - expect(Object.keys(__webpack_modules__).filter(m => !m.startsWith("../.."))).toEqual([ + expect( + Object.keys(__webpack_modules__).filter(m => !m.startsWith("../..")) + ).toEqual([ "../0-create-dll/a.js", "../0-create-dll/b.js", "../0-create-dll/d.js", @@ -42,7 +48,17 @@ it("should give modules the correct ids", function() { "../0-create-dll/e2.js", "../0-create-dll/f.jsx", "../0-create-dll/g.abc.js", + "../0-create-dll/h.js", + "../0-create-dll/hb.js", "./index.js", "dll-reference ../0-create-dll/dll.js" ]); }); + +it("should not crash on side-effect-free modules", function() { + expect(B).toBe("B"); +}); + +it("should be able to reference side-effect-free reexport-only module", function() { + expect(A).toBe("A"); +}); From bbe71d89cb7a8c1cc81ce1e17929d8de2260ff80 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 20 May 2019 11:53:48 +0200 Subject: [PATCH 35/35] 4.32.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3a523ef05..8762aa2f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack", - "version": "4.31.0", + "version": "4.32.0", "author": "Tobias Koppers @sokra", "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", "license": "MIT",