diff --git a/.editorconfig b/.editorconfig index 07e49a0e38b..0c2b037f084 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,14 +12,14 @@ max_line_length = 80 indent_style = space indent_size = 2 -[test/cases/parsing/bom/bomfile.{css,js}] -charset = utf-8-bom - -[test/configCases/css/no-extra-runtime-in-js/source.text] -insert_final_newline = false - [*.md] trim_trailing_whitespace = false [*.snap] trim_trailing_whitespace = false + +[test/cases/parsing/bom/bomfile.{css,js}] +charset = utf-8-bom + +[test/configCases/css/no-extra-runtime-in-js/source.text] +insert_final_newline = false diff --git a/.prettierrc.js b/.prettierrc.js index b8110f9cd35..04b93b8c6a7 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -5,7 +5,7 @@ module.exports = { useTabs: true, tabWidth: 2, trailingComma: "none", - arrowParens: "avoid", + arrowParens: "always", overrides: [ { files: "*.json", diff --git a/README.md b/README.md index 2149c2f2126..a4b1440cbef 100644 --- a/README.md +++ b/README.md @@ -133,16 +133,6 @@ loaders](https://webpack.js.org/api/loaders/) using Node.js. Loaders are activated by using `loadername!` prefixes in `require()` statements, or are automatically applied via regex from your webpack configuration. -#### Files - -| Name | Status | Install Size | Description | -| :---------------: | :--------: | :----------: | :------------------------------------------------------- | -| [val-loader][val] | ![val-npm] | ![val-size] | Executes code as module and considers exports as JS code | - -[val]: https://github.com/webpack-contrib/val-loader -[val-npm]: https://img.shields.io/npm/v/val-loader.svg -[val-size]: https://packagephobia.com/badge?p=val-loader - #### JSON | Name | Status | Install Size | Description | @@ -262,6 +252,18 @@ you full control of what is loaded initially and what is loaded at runtime through code splitting. It can also make your code chunks **cache friendly** by using hashes. +### Developer Tools + +If you're working on webpack itself, or building advanced plugins or integrations, the tools below can help you explore internal mechanics, debug plugin life-cycles, and build custom tooling. + +#### Instrumentation + +| Name | Status | Description | +| --------------------------------------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| [tapable-tracer](https://github.com/ertgl/tapable-tracer) | ![tapable-tracer-npm] | Traces tapable hook execution in real-time and collects structured stack frames. Can export to UML for generating visualizations. | + +[tapable-tracer-npm]: https://img.shields.io/npm/v/tapable-tracer.svg +

Contributing

**We want contributing to webpack to be fun, enjoyable, and educational for anyone, and everyone.** We have a [vibrant ecosystem](https://medium.com/webpack/contributors-guide/home) that spans beyond this single repo. We welcome you to check out any of the repositories in [our organization](https://github.com/webpack) or [webpack-contrib organization](https://github.com/webpack-contrib) which houses all of our loaders and plugins. diff --git a/bin/webpack.js b/bin/webpack.js index 26273bdbc75..ba71ec29ef6 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -16,11 +16,11 @@ const runCommand = (command, args) => { shell: true }); - executedCommand.on("error", error => { + executedCommand.on("error", (error) => { reject(error); }); - executedCommand.on("exit", code => { + executedCommand.on("exit", (code) => { if (code === 0) { resolve(); } else { @@ -34,7 +34,7 @@ const runCommand = (command, args) => { * @param {string} packageName name of the package * @returns {boolean} is the package installed? */ -const isInstalled = packageName => { +const isInstalled = (packageName) => { if (process.versions.pnp) { return true; } @@ -76,7 +76,7 @@ const isInstalled = packageName => { * @param {CliOption} cli options * @returns {void} */ -const runCli = cli => { +const runCli = (cli) => { const path = require("path"); const pkgPath = require.resolve(`${cli.package}/package.json`); @@ -85,7 +85,7 @@ const runCli = cli => { if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) { import(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName])).catch( - err => { + (err) => { console.error(err); process.exitCode = 1; } @@ -152,7 +152,7 @@ if (!cli.installed) { // executed. Setting the exit code here to ensure the script exits correctly in those cases. The callback // function is responsible for clearing the exit code if the user wishes to install webpack-cli. process.exitCode = 1; - questionInterface.question(question, answer => { + questionInterface.question(question, (answer) => { questionInterface.close(); const normalizedAnswer = answer.toLowerCase().startsWith("y"); @@ -183,7 +183,7 @@ if (!cli.installed) { .then(() => { runCli(cli); }) - .catch(err => { + .catch((err) => { console.error(err); process.exitCode = 1; }); diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index e2ba028309a..c6116554e4a 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -3287,6 +3287,10 @@ export interface JavascriptParserOptions { * Enable/disable parsing "import { createRequire } from "module"" and evaluating createRequire(). */ createRequire?: boolean | string; + /** + * Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use. + */ + deferImport?: boolean; /** * Specifies global fetchPriority for dynamic import. */ diff --git a/eslint.config.mjs b/eslint.config.mjs index 0cdd3278e53..a2fe9268c28 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -137,9 +137,6 @@ export default defineConfig([ "id-length": "off", - "unicorn/no-array-for-each": "off", - "unicorn/prefer-includes": "off", - "jsdoc/require-jsdoc": "off", // Revisit it in future @@ -151,9 +148,6 @@ export default defineConfig([ { files: ["test/**/*.js"], rules: { - // TODO enable me - strict: "off", - // Some our tests contain `package.json` without `engines`, but tests should work on Node.js@10, so let's disable it "n/prefer-node-protocol": "off", @@ -208,7 +202,6 @@ export default defineConfig([ { files: [ "test/configCases/{dll-plugin-entry,dll-plugin-side-effects,dll-plugin}/**/webpack.config.js", - "examples/**/*.js", "test/NodeTemplatePlugin.test.js", "test/PersistentCaching.test.js" ], diff --git a/examples/module-code-splitting/README.md b/examples/module-code-splitting/README.md index 36ad2da8154..5ea18941e70 100644 --- a/examples/module-code-splitting/README.md +++ b/examples/module-code-splitting/README.md @@ -145,22 +145,22 @@ export function reset() { /******/ }; /******/ /******/ var installChunk = (data) => { -/******/ var {__webpack_ids__, __webpack_modules__, __webpack_runtime__} = data; +/******/ var {__webpack_esm_ids__, __webpack_esm_modules__, __webpack_esm_runtime__} = data; /******/ // add "modules" to the modules object, /******/ // then flag all "ids" as loaded and fire callback /******/ var moduleId, chunkId, i = 0; -/******/ for(moduleId in __webpack_modules__) { -/******/ if(__webpack_require__.o(__webpack_modules__, moduleId)) { -/******/ __webpack_require__.m[moduleId] = __webpack_modules__[moduleId]; +/******/ for(moduleId in __webpack_esm_modules__) { +/******/ if(__webpack_require__.o(__webpack_esm_modules__, moduleId)) { +/******/ __webpack_require__.m[moduleId] = __webpack_esm_modules__[moduleId]; /******/ } /******/ } -/******/ if(__webpack_runtime__) __webpack_runtime__(__webpack_require__); -/******/ for(;i < __webpack_ids__.length; i++) { -/******/ chunkId = __webpack_ids__[i]; +/******/ if(__webpack_esm_runtime__) __webpack_esm_runtime__(__webpack_require__); +/******/ for(;i < __webpack_esm_ids__.length; i++) { +/******/ chunkId = __webpack_esm_ids__[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[__webpack_ids__[i]] = 0; +/******/ installedChunks[__webpack_esm_ids__[i]] = 0; /******/ } /******/ /******/ } @@ -237,7 +237,7 @@ setTimeout(async () => { # dist/output.js (production) ```javascript -var e,t,o={},r={};function n(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};return o[e](i,i.exports,n),i.exports}n.m=o,n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,o)=>(n.f[o](e,t),t),[])),n.u=e=>e+".output.js",n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.p="dist/",e={792:0},t=t=>{var o,r,{__webpack_ids__:i,__webpack_modules__:a,__webpack_runtime__:s}=t,u=0;for(o in a)n.o(a,o)&&(n.m[o]=a[o]);for(s&&s(n);u{var i=n.o(e,o)?e[o]:void 0;if(0!==i)if(i)r.push(i[1]);else{var a=import(n.p+n.u(o)).then(t,t=>{throw 0!==e[o]&&(e[o]=void 0),t});a=Promise.race([a,new Promise(t=>i=e[o]=[t])]),r.push(i[1]=a)}};const i=e=>console.log(e);setTimeout(async()=>{const e=await n.e(481).then(n.bind(n,481));i(e.value),e.increment(),e.increment(),e.increment(),i(e.value),await(async()=>{(await n.e(481).then(n.bind(n,481))).reset()})(),i(e.value)},100); +var e,t,o={},r={};function n(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};return o[e](i,i.exports,n),i.exports}n.m=o,n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,o)=>(n.f[o](e,t),t),[])),n.u=e=>e+".output.js",n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.p="dist/",e={792:0},t=t=>{var o,r,{__webpack_esm_ids__:i,__webpack_esm_modules__:a,__webpack_esm_runtime__:s}=t,u=0;for(o in a)n.o(a,o)&&(n.m[o]=a[o]);for(s&&s(n);u{var i=n.o(e,o)?e[o]:void 0;if(0!==i)if(i)r.push(i[1]);else{var a=import(n.p+n.u(o)).then(t,t=>{throw 0!==e[o]&&(e[o]=void 0),t});a=Promise.race([a,new Promise(t=>i=e[o]=[t])]),r.push(i[1]=a)}};const i=e=>console.log(e);setTimeout(async()=>{const e=await n.e(481).then(n.bind(n,481));i(e.value),e.increment(),e.increment(),e.increment(),i(e.value),await(async()=>{(await n.e(481).then(n.bind(n,481))).reset()})(),i(e.value)},100); ``` # Info @@ -245,11 +245,11 @@ var e,t,o={},r={};function n(e){var t=r[e];if(void 0!==t)return t.exports;var i= ## Unoptimized ``` -asset output.js 6.66 KiB [emitted] [javascript module] (name: main) -asset 1.output.js 1.38 KiB [emitted] [javascript module] -chunk (runtime: main) output.js (main) 420 bytes (javascript) 3.07 KiB (runtime) [entry] [rendered] +asset output.js 6.71 KiB [emitted] [javascript module] (name: main) +asset 1.output.js 1.39 KiB [emitted] [javascript module] +chunk (runtime: main) output.js (main) 420 bytes (javascript) 3.11 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.07 KiB 7 modules + runtime modules 3.11 KiB 7 modules ./example.js + 1 modules 420 bytes [built] [code generated] [no exports] [no exports used] @@ -268,8 +268,8 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 1.19 KiB [emitted] [javascript module] [minimized] (name: main) -asset 481.output.js 249 bytes [emitted] [javascript module] [minimized] +asset output.js 1.2 KiB [emitted] [javascript module] [minimized] (name: main) +asset 481.output.js 261 bytes [emitted] [javascript module] [minimized] chunk (runtime: main) 481.output.js 146 bytes [rendered] > ./counter ./methods.js 2:8-27 > ./counter ./example.js 4:23-42 @@ -277,9 +277,9 @@ chunk (runtime: main) 481.output.js 146 bytes [rendered] [exports: decrement, increment, reset, value] import() ./counter ./example.js + 1 modules ./example.js 4:23-42 import() ./counter ./example.js + 1 modules ./methods.js 2:8-27 -chunk (runtime: main) output.js (main) 420 bytes (javascript) 3.07 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 420 bytes (javascript) 3.11 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.07 KiB 7 modules + runtime modules 3.11 KiB 7 modules ./example.js + 1 modules 420 bytes [built] [code generated] [no exports] [no exports used] diff --git a/examples/module-worker/README.md b/examples/module-worker/README.md index 032e02deda8..fa0732fe87d 100644 --- a/examples/module-worker/README.md +++ b/examples/module-worker/README.md @@ -261,22 +261,22 @@ export const add = (content, from) => { /******/ }; /******/ /******/ var installChunk = (data) => { -/******/ var {__webpack_ids__, __webpack_modules__, __webpack_runtime__} = data; +/******/ var {__webpack_esm_ids__, __webpack_esm_modules__, __webpack_esm_runtime__} = data; /******/ // add "modules" to the modules object, /******/ // then flag all "ids" as loaded and fire callback /******/ var moduleId, chunkId, i = 0; -/******/ for(moduleId in __webpack_modules__) { -/******/ if(__webpack_require__.o(__webpack_modules__, moduleId)) { -/******/ __webpack_require__.m[moduleId] = __webpack_modules__[moduleId]; +/******/ for(moduleId in __webpack_esm_modules__) { +/******/ if(__webpack_require__.o(__webpack_esm_modules__, moduleId)) { +/******/ __webpack_require__.m[moduleId] = __webpack_esm_modules__[moduleId]; /******/ } /******/ } -/******/ if(__webpack_runtime__) __webpack_runtime__(__webpack_require__); -/******/ for(;i < __webpack_ids__.length; i++) { -/******/ chunkId = __webpack_ids__[i]; +/******/ if(__webpack_esm_runtime__) __webpack_esm_runtime__(__webpack_require__); +/******/ for(;i < __webpack_esm_ids__.length; i++) { +/******/ chunkId = __webpack_esm_ids__[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[__webpack_ids__[i]] = 0; +/******/ installedChunks[__webpack_esm_ids__[i]] = 0; /******/ } /******/ /******/ } @@ -531,22 +531,22 @@ fibWorker.onmessage = event => { /******/ }; /******/ /******/ var installChunk = (data) => { -/******/ var {__webpack_ids__, __webpack_modules__, __webpack_runtime__} = data; +/******/ var {__webpack_esm_ids__, __webpack_esm_modules__, __webpack_esm_runtime__} = data; /******/ // add "modules" to the modules object, /******/ // then flag all "ids" as loaded and fire callback /******/ var moduleId, chunkId, i = 0; -/******/ for(moduleId in __webpack_modules__) { -/******/ if(__webpack_require__.o(__webpack_modules__, moduleId)) { -/******/ __webpack_require__.m[moduleId] = __webpack_modules__[moduleId]; +/******/ for(moduleId in __webpack_esm_modules__) { +/******/ if(__webpack_require__.o(__webpack_esm_modules__, moduleId)) { +/******/ __webpack_require__.m[moduleId] = __webpack_esm_modules__[moduleId]; /******/ } /******/ } -/******/ if(__webpack_runtime__) __webpack_runtime__(__webpack_require__); -/******/ for(;i < __webpack_ids__.length; i++) { -/******/ chunkId = __webpack_ids__[i]; +/******/ if(__webpack_esm_runtime__) __webpack_esm_runtime__(__webpack_require__); +/******/ for(;i < __webpack_esm_ids__.length; i++) { +/******/ chunkId = __webpack_esm_ids__[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[__webpack_ids__[i]] = 0; +/******/ installedChunks[__webpack_esm_ids__[i]] = 0; /******/ } /******/ /******/ } @@ -620,7 +620,7 @@ onconnect = function (e) { ``` ```javascript -var e,o,t={},r={};function s(e){var o=r[e];if(void 0!==o)return o.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,s),n.exports}s.m=t,s.d=(e,o)=>{for(var t in o)s.o(o,t)&&!s.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((o,t)=>(s.f[t](e,o),o),[])),s.u=e=>e+".js",s.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),s.p="/dist/",e={377:0},o=o=>{var t,r,{__webpack_ids__:n,__webpack_modules__:a,__webpack_runtime__:i}=o,c=0;for(t in a)s.o(a,t)&&(s.m[t]=a[t]);for(i&&i(s);c{var n=s.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[1]);else{var a=import(s.p+s.u(t)).then(o,o=>{throw 0!==e[t]&&(e[t]=void 0),o});a=Promise.race([a,new Promise(o=>n=e[t]=[o])]),r.push(n[1]=a)}},onconnect=function(e){for(const o of e.ports)o.onmessage=async e=>{const t=e.data;switch(t.type){case"message":const{add:e}=await s.e(936).then(s.bind(s,936));e(t.content,t.from);case"history":const{history:r}=await s.e(936).then(s.bind(s,936));o.postMessage({type:"history",history:r})}}}; +var e,o,t={},r={};function s(e){var o=r[e];if(void 0!==o)return o.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,s),n.exports}s.m=t,s.d=(e,o)=>{for(var t in o)s.o(o,t)&&!s.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((o,t)=>(s.f[t](e,o),o),[])),s.u=e=>e+".js",s.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),s.p="/dist/",e={377:0},o=o=>{var t,r,{__webpack_esm_ids__:n,__webpack_esm_modules__:a,__webpack_esm_runtime__:i}=o,c=0;for(t in a)s.o(a,t)&&(s.m[t]=a[t]);for(i&&i(s);c{var n=s.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[1]);else{var a=import(s.p+s.u(t)).then(o,o=>{throw 0!==e[t]&&(e[t]=void 0),o});a=Promise.race([a,new Promise(o=>n=e[t]=[o])]),r.push(n[1]=a)}},onconnect=function(e){for(const o of e.ports)o.onmessage=async e=>{const t=e.data;switch(t.type){case"message":const{add:e}=await s.e(936).then(s.bind(s,936));e(t.content,t.from);case"history":const{history:r}=await s.e(936).then(s.bind(s,936));o.postMessage({type:"history",history:r})}}}; ``` # dist/workers/fibonacci.js @@ -728,22 +728,22 @@ var e,o,t={},r={};function s(e){var o=r[e];if(void 0!==o)return o.exports;var n= /******/ }; /******/ /******/ var installChunk = (data) => { -/******/ var {__webpack_ids__, __webpack_modules__, __webpack_runtime__} = data; +/******/ var {__webpack_esm_ids__, __webpack_esm_modules__, __webpack_esm_runtime__} = data; /******/ // add "modules" to the modules object, /******/ // then flag all "ids" as loaded and fire callback /******/ var moduleId, chunkId, i = 0; -/******/ for(moduleId in __webpack_modules__) { -/******/ if(__webpack_require__.o(__webpack_modules__, moduleId)) { -/******/ __webpack_require__.m[moduleId] = __webpack_modules__[moduleId]; +/******/ for(moduleId in __webpack_esm_modules__) { +/******/ if(__webpack_require__.o(__webpack_esm_modules__, moduleId)) { +/******/ __webpack_require__.m[moduleId] = __webpack_esm_modules__[moduleId]; /******/ } /******/ } -/******/ if(__webpack_runtime__) __webpack_runtime__(__webpack_require__); -/******/ for(;i < __webpack_ids__.length; i++) { -/******/ chunkId = __webpack_ids__[i]; +/******/ if(__webpack_esm_runtime__) __webpack_esm_runtime__(__webpack_require__); +/******/ for(;i < __webpack_esm_ids__.length; i++) { +/******/ chunkId = __webpack_esm_ids__[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[__webpack_ids__[i]] = 0; +/******/ installedChunks[__webpack_esm_ids__[i]] = 0; /******/ } /******/ /******/ } @@ -802,15 +802,15 @@ onmessage = async event => { ``` ```javascript -var e,r,o={},t={};function a(e){var r=t[e];if(void 0!==r)return r.exports;var s=t[e]={exports:{}};return o[e](s,s.exports,a),s.exports}a.m=o,a.d=(e,r)=>{for(var o in r)a.o(r,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((r,o)=>(a.f[o](e,r),r),[])),a.u=e=>e+".js",a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),a.p="/dist/",e={721:0},r=r=>{var o,t,{__webpack_ids__:s,__webpack_modules__:i,__webpack_runtime__:n}=r,p=0;for(o in i)a.o(i,o)&&(a.m[o]=i[o]);for(n&&n(a);p{var s=a.o(e,o)?e[o]:void 0;if(0!==s)if(s)t.push(s[1]);else{var i=import(a.p+a.u(o)).then(r,r=>{throw 0!==e[o]&&(e[o]=void 0),r});i=Promise.race([i,new Promise(r=>s=e[o]=[r])]),t.push(s[1]=i)}},onmessage=async e=>{const{fibonacci:r}=await a.e(129).then(a.bind(a,129)),o=JSON.parse(e.data);postMessage(`fib(${o}) = ${r(o)}`)}; +var e,r,o={},s={};function t(e){var r=s[e];if(void 0!==r)return r.exports;var a=s[e]={exports:{}};return o[e](a,a.exports,t),a.exports}t.m=o,t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.f={},t.e=e=>Promise.all(Object.keys(t.f).reduce((r,o)=>(t.f[o](e,r),r),[])),t.u=e=>e+".js",t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.p="/dist/",e={721:0},r=r=>{var o,s,{__webpack_esm_ids__:a,__webpack_esm_modules__:i,__webpack_esm_runtime__:n}=r,p=0;for(o in i)t.o(i,o)&&(t.m[o]=i[o]);for(n&&n(t);p{var a=t.o(e,o)?e[o]:void 0;if(0!==a)if(a)s.push(a[1]);else{var i=import(t.p+t.u(o)).then(r,r=>{throw 0!==e[o]&&(e[o]=void 0),r});i=Promise.race([i,new Promise(r=>a=e[o]=[r])]),s.push(a[1]=i)}},onmessage=async e=>{const{fibonacci:r}=await t.e(129).then(t.bind(t,129)),o=JSON.parse(e.data);postMessage(`fib(${o}) = ${r(o)}`)}; ``` # dist/129.js ```javascript -export const __webpack_id__ = 129; -export const __webpack_ids__ = [129]; -export const __webpack_modules__ = { +export const __webpack_esm_id__ = 129; +export const __webpack_esm_ids__ = [129]; +export const __webpack_esm_modules__ = { /***/ 3: /*!**********************!*\ @@ -841,11 +841,11 @@ function fibonacci(n) { ## Unoptimized ``` -asset main.js 8.79 KiB [emitted] [javascript module] (name: main) -asset chat.js 6.7 KiB [emitted] [javascript module] (name: chat) -asset workers/fibonacci.js 6.35 KiB [emitted] [javascript module] (name: fibonacci) -asset 936.js 1.04 KiB [emitted] [javascript module] -asset 129.js 881 bytes [emitted] [javascript module] +asset main.js 8.83 KiB [emitted] [javascript module] (name: main) +asset chat.js 6.75 KiB [emitted] [javascript module] (name: chat) +asset workers/fibonacci.js 6.39 KiB [emitted] [javascript module] (name: fibonacci) +asset 936.js 1.05 KiB [emitted] [javascript module] +asset 129.js 893 bytes [emitted] [javascript module] chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered] > ./fibonacci ./example.js 70:30-51 > ./fibonacci ./fib-worker.js 2:29-50 @@ -854,21 +854,21 @@ chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered] [used exports unknown] import() ./fibonacci ./example.js 70:30-51 import() ./fibonacci ./fib-worker.js 2:29-50 -chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 442 bytes (javascript) 3.06 KiB (runtime) [entry] [rendered] +chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 442 bytes (javascript) 3.11 KiB (runtime) [entry] [rendered] > ./example.js 25:19-31:1 - runtime modules 3.06 KiB 7 modules + runtime modules 3.11 KiB 7 modules ./chat-worker.js 442 bytes [built] [code generated] [used exports unknown] new Worker() ./chat-worker.js ./example.js 25:19-31:1 -chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 3.06 KiB (runtime) [entry] [rendered] +chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 3.11 KiB (runtime) [entry] [rendered] > ./example.js 80:18-84:2 - runtime modules 3.06 KiB 7 modules + runtime modules 3.11 KiB 7 modules ./fib-worker.js 176 bytes [built] [code generated] [used exports unknown] new Worker() ./fib-worker.js ./example.js 80:18-84:2 -chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 3.24 KiB (runtime) [entry] [rendered] +chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 3.28 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.24 KiB 7 modules + runtime modules 3.28 KiB 7 modules ./example.js 2.25 KiB [built] [code generated] [used exports unknown] entry ./example.js main @@ -886,11 +886,11 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset main.js 2.35 KiB [emitted] [javascript module] [minimized] (name: main) -asset chat.js 1.07 KiB [emitted] [javascript module] [minimized] (name: chat) -asset workers/fibonacci.js 939 bytes [emitted] [javascript module] [minimized] (name: fibonacci) -asset 936.js 216 bytes [emitted] [javascript module] [minimized] -asset 129.js 190 bytes [emitted] [javascript module] [minimized] +asset main.js 2.36 KiB [emitted] [javascript module] [minimized] (name: main) +asset chat.js 1.08 KiB [emitted] [javascript module] [minimized] (name: chat) +asset workers/fibonacci.js 951 bytes [emitted] [javascript module] [minimized] (name: fibonacci) +asset 936.js 228 bytes [emitted] [javascript module] [minimized] +asset 129.js 202 bytes [emitted] [javascript module] [minimized] chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered] > ./fibonacci ./fib-worker.js 2:29-50 > ./fibonacci ./example.js 70:30-51 @@ -899,21 +899,21 @@ chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered] [all exports used] import() ./fibonacci ./example.js 70:30-51 import() ./fibonacci ./fib-worker.js 2:29-50 -chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 442 bytes (javascript) 2.8 KiB (runtime) [entry] [rendered] +chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 442 bytes (javascript) 2.84 KiB (runtime) [entry] [rendered] > ./example.js 25:19-31:1 - runtime modules 2.8 KiB 6 modules + runtime modules 2.84 KiB 6 modules ./chat-worker.js 442 bytes [built] [code generated] [no exports used] new Worker() ./chat-worker.js ./example.js 25:19-31:1 -chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.8 KiB (runtime) [entry] [rendered] +chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.84 KiB (runtime) [entry] [rendered] > ./example.js 80:18-84:2 - runtime modules 2.8 KiB 6 modules + runtime modules 2.84 KiB 6 modules ./fib-worker.js 176 bytes [built] [code generated] [no exports used] new Worker() ./fib-worker.js ./example.js 80:18-84:2 -chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 2.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 3.01 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 2.97 KiB 6 modules + runtime modules 3.01 KiB 6 modules ./example.js 2.25 KiB [built] [code generated] [no exports used] entry ./example.js main diff --git a/examples/nodejs-addons/README.md b/examples/nodejs-addons/README.md index 12792394eba..1f159d50b12 100644 --- a/examples/nodejs-addons/README.md +++ b/examples/nodejs-addons/README.md @@ -65,10 +65,10 @@ webpack X.X.X compiled successfully ``` asset 7726cbf5eb6de9759226.node 16.5 KiB [emitted] [immutable] [from: file.node] (auxiliary name: main) -asset output.js 510 bytes [emitted] [minimized] (name: main) -chunk (runtime: main) output.js (main) 16.5 KiB (asset) 457 bytes (javascript) 440 bytes (runtime) [entry] [rendered] +asset output.js 515 bytes [emitted] [minimized] (name: main) +chunk (runtime: main) output.js (main) 16.5 KiB (asset) 457 bytes (javascript) 445 bytes (runtime) [entry] [rendered] > ./example.js main - runtime modules 440 bytes 3 modules + runtime modules 445 bytes 3 modules dependent modules 16.5 KiB (asset) 42 bytes (javascript) [dependent] 1 module ./example.js + 2 modules 415 bytes [not cacheable] [built] [code generated] [no exports] diff --git a/generate-types-config.js b/generate-types-config.js index a3ce7af1250..89205e3496b 100644 --- a/generate-types-config.js +++ b/generate-types-config.js @@ -4,7 +4,8 @@ module.exports = { nameMapping: { FsStats: /^Stats Import fs/, validateFunction: /^validate Import/, - Configuration: /^WebpackOptions / + Configuration: /^WebpackOptions /, + MultiConfiguration: /^MultiWebpackOptions / }, exclude: [/^devServer in WebpackOptions /], include: [/^(_module|_compilation|_compiler) in NormalModuleLoaderContext /] diff --git a/lib/APIPlugin.js b/lib/APIPlugin.js index b8978e337e8..56dcf63e0be 100644 --- a/lib/APIPlugin.js +++ b/lib/APIPlugin.js @@ -169,7 +169,7 @@ class APIPlugin { compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.chunkName) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { compilation.addRuntimeModule( chunk, new ChunkNameRuntimeModule(/** @type {string} */ (chunk.name)) @@ -190,13 +190,11 @@ class APIPlugin { PLUGIN_NAME, (source, module, renderContext) => { if (/** @type {BuildInfo} */ (module.buildInfo).needCreateRequire) { - const needPrefix = - renderContext.runtimeTemplate.supportNodePrefixForCoreModules(); const chunkInitFragments = [ new InitFragment( - `import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "${ - needPrefix ? "node:" : "" - }module";\n`, + `import { createRequire as __WEBPACK_EXTERNAL_createRequire } from ${renderContext.runtimeTemplate.renderNodePrefixForCoreModule( + "module" + )};\n`, InitFragment.STAGE_HARMONY_IMPORTS, 0, "external module node-commonjs" @@ -213,10 +211,10 @@ class APIPlugin { /** * @param {JavascriptParser} parser the parser */ - const handler = parser => { + const handler = (parser) => { for (const key of Object.keys(REPLACEMENTS)) { const info = REPLACEMENTS[key]; - parser.hooks.expression.for(key).tap(PLUGIN_NAME, expression => { + parser.hooks.expression.for(key).tap(PLUGIN_NAME, (expression) => { const dep = toConstantDependency(parser, info.expr, info.req); if (key === "__non_webpack_require__" && this.options.module) { @@ -227,7 +225,7 @@ class APIPlugin { return dep(expression); }); if (info.assign === false) { - parser.hooks.assign.for(key).tap(PLUGIN_NAME, expr => { + parser.hooks.assign.for(key).tap(PLUGIN_NAME, (expr) => { const err = new WebpackError(`${key} must not be assigned`); err.loc = /** @type {DependencyLocation} */ (expr.loc); throw err; @@ -242,7 +240,7 @@ class APIPlugin { parser.hooks.expression .for("__webpack_layer__") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { const dep = new ConstDependency( JSON.stringify(parser.state.module.layer), /** @type {Range} */ (expr.range) @@ -253,7 +251,7 @@ class APIPlugin { }); parser.hooks.evaluateIdentifier .for("__webpack_layer__") - .tap(PLUGIN_NAME, expr => + .tap(PLUGIN_NAME, (expr) => (parser.state.module.layer === null ? new BasicEvaluatedExpression().setNull() : new BasicEvaluatedExpression().setString( @@ -263,7 +261,7 @@ class APIPlugin { ); parser.hooks.evaluateTypeof .for("__webpack_layer__") - .tap(PLUGIN_NAME, expr => + .tap(PLUGIN_NAME, (expr) => new BasicEvaluatedExpression() .setString( parser.state.module.layer === null ? "object" : "string" @@ -273,7 +271,7 @@ class APIPlugin { parser.hooks.expression .for("__webpack_module__.id") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { /** @type {BuildInfo} */ (parser.state.module.buildInfo).moduleConcatenationBailout = "__webpack_module__.id"; @@ -289,7 +287,7 @@ class APIPlugin { parser.hooks.expression .for("__webpack_module__") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { /** @type {BuildInfo} */ (parser.state.module.buildInfo).moduleConcatenationBailout = "__webpack_module__"; diff --git a/lib/AutomaticPrefetchPlugin.js b/lib/AutomaticPrefetchPlugin.js index b0926614e69..1295f8245ef 100644 --- a/lib/AutomaticPrefetchPlugin.js +++ b/lib/AutomaticPrefetchPlugin.js @@ -31,7 +31,7 @@ class AutomaticPrefetchPlugin { ); /** @type {{context: string | null, request: string}[] | null} */ let lastModules = null; - compiler.hooks.afterCompile.tap(PLUGIN_NAME, compilation => { + compiler.hooks.afterCompile.tap(PLUGIN_NAME, (compilation) => { lastModules = []; for (const m of compilation.modules) { @@ -54,7 +54,7 @@ class AutomaticPrefetchPlugin { callback ); }, - err => { + (err) => { lastModules = null; callback(err); } diff --git a/lib/BannerPlugin.js b/lib/BannerPlugin.js index 22ec021f6b9..b45256e4fad 100644 --- a/lib/BannerPlugin.js +++ b/lib/BannerPlugin.js @@ -32,7 +32,7 @@ const validate = createSchemaValidation( * @param {string} str string to wrap * @returns {string} wrapped string */ -const wrapComment = str => { +const wrapComment = (str) => { if (!str.includes("\n")) { return Template.toComment(str); } @@ -67,7 +67,7 @@ class BannerPlugin { /** @type {BannerFunction} */ this.banner = this.options.raw ? getBanner - : /** @type {BannerFunction} */ data => wrapComment(getBanner(data)); + : /** @type {BannerFunction} */ (data) => wrapComment(getBanner(data)); } else { const banner = this.options.raw ? bannerOption @@ -93,7 +93,7 @@ class BannerPlugin { const stage = this.options.stage || Compilation.PROCESS_ASSETS_STAGE_ADDITIONS; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.processAssets.tap({ name: PLUGIN_NAME, stage }, () => { for (const chunk of compilation.chunks) { if (options.entryOnly && !chunk.canBeInitial()) { @@ -114,7 +114,7 @@ class BannerPlugin { data ); - compilation.updateAsset(file, old => { + compilation.updateAsset(file, (old) => { const cached = cache.get(old); if (!cached || cached.comment !== comment) { const source = options.footer diff --git a/lib/Cache.js b/lib/Cache.js index 757119c9de5..f807055e956 100644 --- a/lib/Cache.js +++ b/lib/Cache.js @@ -40,7 +40,7 @@ const { * @param {(err?: Error) => void} callback callback * @returns {(err?: Error) => void} callback */ -const needCalls = (times, callback) => err => { +const needCalls = (times, callback) => (err) => { if (--times === 0) { return callback(err); } diff --git a/lib/CacheFacade.js b/lib/CacheFacade.js index 190de11dc06..8887d3d955e 100644 --- a/lib/CacheFacade.js +++ b/lib/CacheFacade.js @@ -61,8 +61,8 @@ class MultiItemCache { * @param {number} i index * @returns {Promise} promise with the data */ - const next = i => - this._items[i].getPromise().then(result => { + const next = (i) => + this._items[i].getPromise().then((result) => { if (result !== undefined) return result; if (++i < this._items.length) return next(i); }); @@ -89,7 +89,7 @@ class MultiItemCache { * @returns {Promise} promise signals when the value is stored */ storePromise(data) { - return Promise.all(this._items.map(item => item.storePromise(data))).then( + return Promise.all(this._items.map((item) => item.storePromise(data))).then( () => {} ); } @@ -149,7 +149,7 @@ class ItemCacheFacade { */ storePromise(data) { return new Promise((resolve, reject) => { - this._cache.store(this._name, this._etag, data, err => { + this._cache.store(this._name, this._etag, data, (err) => { if (err) { reject(err); } else { @@ -171,7 +171,7 @@ class ItemCacheFacade { if (cacheEntry !== undefined) return cacheEntry; computer((err, result) => { if (err) return callback(err); - this.store(result, err => { + this.store(result, (err) => { if (err) return callback(err); callback(null, result); }); @@ -297,7 +297,7 @@ class CacheFacade { */ storePromise(identifier, etag, data) { return new Promise((resolve, reject) => { - this._cache.store(`${this._name}|${identifier}`, etag, data, err => { + this._cache.store(`${this._name}|${identifier}`, etag, data, (err) => { if (err) { reject(err); } else { @@ -321,7 +321,7 @@ class CacheFacade { if (cacheEntry !== undefined) return cacheEntry; computer((err, result) => { if (err) return callback(err); - this.store(identifier, etag, result, err => { + this.store(identifier, etag, result, (err) => { if (err) return callback(err); callback(null, result); }); diff --git a/lib/CaseSensitiveModulesWarning.js b/lib/CaseSensitiveModulesWarning.js index 2680753fa1b..0ee17aa56c6 100644 --- a/lib/CaseSensitiveModulesWarning.js +++ b/lib/CaseSensitiveModulesWarning.js @@ -14,7 +14,7 @@ const WebpackError = require("./WebpackError"); * @param {Module[]} modules the modules to be sorted * @returns {Module[]} sorted version of original modules */ -const sortModules = modules => +const sortModules = (modules) => modules.sort((a, b) => { const aIdent = a.identifier(); const bIdent = b.identifier(); @@ -33,7 +33,7 @@ const sortModules = modules => */ const createModulesListMessage = (modules, moduleGraph) => modules - .map(m => { + .map((m) => { let message = `* ${m.identifier()}`; const validReasons = [ ...moduleGraph.getIncomingConnectionsByOriginModule(m).keys() diff --git a/lib/Chunk.js b/lib/Chunk.js index b19d06b6b9d..21fdaba9be7 100644 --- a/lib/Chunk.js +++ b/lib/Chunk.js @@ -583,7 +583,7 @@ class Chunk { const chunks = new Set(); const initialChunks = intersect( - Array.from(this.groupsIterable, g => new Set(g.chunks)) + Array.from(this.groupsIterable, (g) => new Set(g.chunks)) ); const initialQueue = new Set(this.groupsIterable); @@ -672,7 +672,7 @@ class Chunk { const queue = new Set(); const initialChunks = intersect( - Array.from(this.groupsIterable, g => new Set(g.chunks)) + Array.from(this.groupsIterable, (g) => new Set(g.chunks)) ); for (const chunkGroup of this.groupsIterable) { @@ -812,7 +812,7 @@ class Chunk { * @param {Chunk} chunk a chunk * @returns {void} */ - const addChildIdsByOrdersToMap = chunk => { + const addChildIdsByOrdersToMap = (chunk) => { const data = chunk.getChildIdsByOrders(chunkGraph, filterFn); for (const key of Object.keys(data)) { let chunkMap = chunkMaps[key]; diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js index 0998125b286..f30cfb13d7e 100644 --- a/lib/ChunkGraph.js +++ b/lib/ChunkGraph.js @@ -76,13 +76,13 @@ class ModuleHashInfo { * @param {SortableSet} set the set * @returns {T[]} set as array */ -const getArray = set => [...set]; +const getArray = (set) => [...set]; /** * @param {SortableSet} chunks the chunks * @returns {RuntimeSpecSet} runtimes */ -const getModuleRuntimes = chunks => { +const getModuleRuntimes = (chunks) => { const runtimes = new RuntimeSpecSet(); for (const chunk of chunks) { runtimes.add(chunk.runtime); @@ -94,7 +94,7 @@ const getModuleRuntimes = chunks => { * @param {WeakMap> | undefined} sourceTypesByModule sourceTypesByModule * @returns {(set: SortableSet) => Map>} modules by source type */ -const modulesBySourceType = sourceTypesByModule => set => { +const modulesBySourceType = (sourceTypesByModule) => (set) => { /** @type {Map>} */ const map = new Map(); for (const module of set) { @@ -136,10 +136,10 @@ const createOrderedArrayFunctionMap = new WeakMap(); * @param {ModuleComparator} comparator comparator function * @returns {ModuleSetToArrayFunction} set as ordered array */ -const createOrderedArrayFunction = comparator => { +const createOrderedArrayFunction = (comparator) => { let fn = createOrderedArrayFunctionMap.get(comparator); if (fn !== undefined) return fn; - fn = set => { + fn = (set) => { set.sortWith(comparator); return [...set]; }; @@ -151,7 +151,7 @@ const createOrderedArrayFunction = comparator => { * @param {Iterable} modules the modules to get the count/size of * @returns {number} the size of the modules */ -const getModulesSize = modules => { +const getModulesSize = (modules) => { let size = 0; for (const module of modules) { for (const type of module.getSourceTypes()) { @@ -165,7 +165,7 @@ const getModulesSize = modules => { * @param {Iterable} modules the sortable Set to get the size of * @returns {Record} the sizes of the modules */ -const getModulesSizes = modules => { +const getModulesSizes = (modules) => { const sizes = Object.create(null); for (const module of modules) { for (const type of module.getSourceTypes()) { @@ -311,13 +311,13 @@ class ChunkGraph { _getGraphRoots(set) { const { moduleGraph } = this; return [ - ...findGraphRoots(set, module => { + ...findGraphRoots(set, (module) => { /** @type {Set} */ const set = new Set(); /** * @param {Module} module module */ - const addDependencies = module => { + const addDependencies = (module) => { for (const connection of moduleGraph.getOutgoingConnections(module)) { if (!connection.module) continue; const activeState = connection.getActiveState(undefined); @@ -1272,7 +1272,10 @@ class ChunkGraph { const array = [...cgc.runtimeModules]; array.sort( concatComparators( - compareSelect(r => /** @type {RuntimeModule} */ (r).stage, compareIds), + compareSelect( + (r) => /** @type {RuntimeModule} */ (r).stage, + compareIds + ), compareModulesByIdentifier ) ); @@ -1401,7 +1404,7 @@ class ChunkGraph { throw new Error( `No unique hash info entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( hashes.keys(), - r => runtimeToString(r) + (r) => runtimeToString(r) ).join(", ")}). Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` ); @@ -1493,7 +1496,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza cgm.runtimeRequirements = map; return; } - runtimeRequirementsMap.update(runtime, runtimeRequirements => { + runtimeRequirementsMap.update(runtime, (runtimeRequirements) => { if (runtimeRequirements === undefined) { return transferOwnership ? items : new Set(items); } else if (!transferOwnership || runtimeRequirements.size >= items.size) { @@ -1623,7 +1626,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza * @param {ConnectionState} state state * @returns {"F" | "T" | "O"} result */ - const activeStateToString = state => { + const activeStateToString = (state) => { if (state === false) return "F"; if (state === true) return "T"; if (state === ModuleGraphConnection.TRANSITIVE_ONLY) return "O"; @@ -1675,7 +1678,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza let stateInfo = ""; forEachRuntime( runtime, - runtime => { + (runtime) => { const state = connection.getActiveState(runtime); states.add(state); stateInfo += activeStateToString(state) + runtime; @@ -1702,7 +1705,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza /** * @param {Module} module module */ - const addModuleToHash = module => { + const addModuleToHash = (module) => { hash.update( this._getModuleGraphHashBigInt( this._getChunkGraphModule(module), @@ -1714,7 +1717,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza /** * @param {Set} modules modules */ - const addModulesToHash = modules => { + const addModulesToHash = (modules) => { let xor = ZERO_BIG_INT; for (const m of modules) { xor ^= this._getModuleGraphHashBigInt( @@ -1769,7 +1772,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza * @param {Module} module the module * @returns {ChunkGraph} the chunk graph */ - module => { + (module) => { const chunkGraph = chunkGraphForModuleMap.get(module); if (!chunkGraph) { throw new Error( @@ -1821,7 +1824,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza * @param {Chunk} chunk the chunk * @returns {ChunkGraph} the chunk graph */ - chunk => { + (chunk) => { const chunkGraph = chunkGraphForChunkMap.get(chunk); if (!chunkGraph) { throw new Error( diff --git a/lib/ChunkGroup.js b/lib/ChunkGroup.js index 5306625a6bc..36d7389d2fe 100644 --- a/lib/ChunkGroup.js +++ b/lib/ChunkGroup.js @@ -40,7 +40,7 @@ let debugId = 5000; * @param {SortableSet} set set to convert to array. * @returns {T[]} the array format of existing set */ -const getArray = set => [...set]; +const getArray = (set) => [...set]; /** * A convenience method used to sort chunks based on their id's @@ -165,7 +165,7 @@ class ChunkGroup { * @returns {string} a unique concatenation of chunk debugId's */ get debugId() { - return Array.from(this.chunks, x => x.debugId).join("+"); + return Array.from(this.chunks, (x) => x.debugId).join("+"); } /** @@ -173,7 +173,7 @@ class ChunkGroup { * @returns {string} a unique concatenation of chunk ids */ get id() { - return Array.from(this.chunks, x => x.id).join("+"); + return Array.from(this.chunks, (x) => x.id).join("+"); } /** @@ -533,7 +533,7 @@ class ChunkGroup { if (cmp !== 0) return cmp; return a.group.compareTo(chunkGraph, b.group); }); - result[name] = list.map(i => i.group); + result[name] = list.map((i) => i.group); } return result; } diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js index cdc39201035..5a43a7dc32f 100644 --- a/lib/CleanPlugin.js +++ b/lib/CleanPlugin.js @@ -72,7 +72,7 @@ function getDirectories(assets) { /** * @param {string} filename asset filename */ - const addDirectory = filename => { + const addDirectory = (filename) => { directories.add(path.dirname(filename)); }; @@ -87,38 +87,6 @@ function getDirectories(assets) { return directories; } -/** - * @param {string} a First directory path to compare - * @param {string} b Second directory path to compare - * @returns {boolean} True if both paths have the same parent directory - */ -function isEqualPath(a, b) { - return path.normalize(a) === path.normalize(b); -} - -/** - * @param {Map|Set} files Collection of files to check against - * @param {string} file File path to check - * @returns {boolean} True if the file or its parent exists in the collection - */ -function hasFile(files, file) { - if (files instanceof Set) { - for (const dir of files) { - if (isEqualPath(dir, file)) { - return true; - } - } - } - if (files instanceof Map) { - for (const dir of files.keys()) { - if (isEqualPath(dir, file)) { - return true; - } - } - } - return false; -} - /** @typedef {Set} Diff */ /** @@ -147,18 +115,18 @@ const getDiffToFs = (fs, outputPath, currentAssets, callback) => { } for (const entry of /** @type {string[]} */ (entries)) { const file = entry; - const filename = directory ? `${directory}/${file}` : file; - if ( - !hasFile(directories, filename) && - !hasFile(currentAssets, filename) - ) { + // Since path.normalize("./file") === path.normalize("file"), + // return file directly when directory === "." + const filename = + directory && directory !== "." ? `${directory}/${file}` : file; + if (!directories.has(filename) && !currentAssets.has(filename)) { diff.add(filename); } } callback(); }); }, - err => { + (err) => { if (err) return callback(err); callback(null, diff); @@ -210,7 +178,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { /** * @param {string} msg message */ - const log = msg => { + const log = (msg) => { if (dry) { logger.info(msg); } else { @@ -219,7 +187,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { }; /** @typedef {{ type: "check" | "unlink" | "rmdir", filename: string, parent: { remaining: number, job: Job } | undefined }} Job */ /** @type {Job[]} */ - const jobs = Array.from(diff.keys(), filename => ({ + const jobs = Array.from(diff.keys(), (filename) => ({ type: "check", filename, parent: undefined @@ -235,15 +203,15 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { * @param {Error & { code?: string }} err error * @returns {void} */ - const handleError = err => { + const handleError = (err) => { const isAlreadyRemoved = () => - new Promise(resolve => { + new Promise((resolve) => { if (err.code === "ENOENT") { resolve(true); } else if (err.code === "EPERM") { // https://github.com/isaacs/rimraf/blob/main/src/fix-eperm.ts#L37 // fs.existsSync(path) === false https://github.com/webpack/webpack/actions/runs/15493412975/job/43624272783?pr=19586 - doStat(fs, path, err => { + doStat(fs, path, (err) => { if (err) { resolve(err.code === "ENOENT"); } else { @@ -255,7 +223,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { } }); - isAlreadyRemoved().then(isRemoved => { + isAlreadyRemoved().then((isRemoved) => { if (isRemoved) { log(`${filename} was removed during cleaning by something else`); handleParent(); @@ -334,7 +302,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { ); return process.nextTick(callback); } - fs.rmdir(path, err => { + fs.rmdir(path, (err) => { if (err) return handleError(err); handleParent(); callback(); @@ -352,7 +320,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { ); return process.nextTick(callback); } - fs.unlink(path, err => { + fs.unlink(path, (err) => { if (err) return handleError(err); handleParent(); callback(); @@ -360,7 +328,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { break; } }, - err => { + (err) => { if (err) return callback(err); callback(undefined, keptAssets); } @@ -412,9 +380,9 @@ class CleanPlugin { typeof keep === "function" ? keep : typeof keep === "string" - ? path => path.startsWith(keep) + ? (path) => path.startsWith(keep) : typeof keep === "object" && keep.test - ? path => keep.test(path) + ? (path) => keep.test(path) : () => false; // We assume that no external modification happens while the compiler is active @@ -470,7 +438,7 @@ class CleanPlugin { * @param {string} path path * @returns {boolean | void} true, if needs to be kept */ - const isKept = path => { + const isKept = (path) => { const result = hooks.keep.call(path); if (result !== undefined) return result; return keepFn(path); @@ -518,5 +486,3 @@ class CleanPlugin { module.exports = CleanPlugin; module.exports._getDirectories = getDirectories; -module.exports._hasFile = hasFile; -module.exports._isEqualPath = isEqualPath; diff --git a/lib/CodeGenerationResults.js b/lib/CodeGenerationResults.js index 3ba4e8028a3..fe2097ea5d3 100644 --- a/lib/CodeGenerationResults.js +++ b/lib/CodeGenerationResults.js @@ -39,7 +39,7 @@ class CodeGenerationResults { throw new Error( `No code generation entry for ${module.identifier()} (existing entries: ${Array.from( this.map.keys(), - m => m.identifier() + (m) => m.identifier() ).join(", ")})` ); } @@ -50,7 +50,7 @@ class CodeGenerationResults { throw new Error( `No unique code generation entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from( entry.keys(), - r => runtimeToString(r) + (r) => runtimeToString(r) ).join(", ")}). Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").` ); @@ -66,7 +66,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza runtime )} for ${module.identifier()} (existing runtimes: ${Array.from( entry.keys(), - r => runtimeToString(r) + (r) => runtimeToString(r) ).join(", ")})` ); } diff --git a/lib/CompatibilityPlugin.js b/lib/CompatibilityPlugin.js index 759d6a8c534..d5ce1872512 100644 --- a/lib/CompatibilityPlugin.js +++ b/lib/CompatibilityPlugin.js @@ -54,7 +54,7 @@ class CompatibilityPlugin { * @param {CallExpression} expr call expression * @returns {boolean | void} true when need to handle */ - expr => { + (expr) => { // support for browserify style require delegator: "require(o, !0)" if (expr.arguments.length !== 2) return; const second = parser.evaluateExpression(expr.arguments[1]); @@ -90,9 +90,9 @@ class CompatibilityPlugin { * @param {JavascriptParser} parser the parser * @returns {void} */ - const handler = parser => { + const handler = (parser) => { // Handle nested requires - parser.hooks.preStatement.tap(PLUGIN_NAME, statement => { + parser.hooks.preStatement.tap(PLUGIN_NAME, (statement) => { if ( statement.type === "FunctionDeclaration" && statement.id && @@ -118,7 +118,7 @@ class CompatibilityPlugin { }); parser.hooks.pattern .for(RuntimeGlobals.require) - .tap(PLUGIN_NAME, pattern => { + .tap(PLUGIN_NAME, (pattern) => { const newName = `__nested_webpack_require_${ /** @type {Range} */ (pattern.range)[0] }__`; @@ -134,7 +134,7 @@ class CompatibilityPlugin { }); parser.hooks.pattern .for(RuntimeGlobals.exports) - .tap(PLUGIN_NAME, pattern => { + .tap(PLUGIN_NAME, (pattern) => { parser.tagVariable(pattern.name, nestedWebpackIdentifierTag, { name: "__nested_webpack_exports__", declaration: { @@ -147,7 +147,7 @@ class CompatibilityPlugin { }); parser.hooks.expression .for(nestedWebpackIdentifierTag) - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { const { name, declaration } = /** @type {TagData} */ (parser.currentTagData); diff --git a/lib/Compilation.js b/lib/Compilation.js index b5f7558ac61..4e39047fe0a 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -372,7 +372,7 @@ const { isSourceEqual } = require("./util/source"); * @property {false | "none" | "error" | "warn" | "info" | "log" | "verbose"} logging * @property {((value: string) => boolean)[]} loggingDebug * @property {boolean} loggingTrace - * @property {TODO} _env + * @property {EXPECTED_ANY} _env */ /** @typedef {KnownNormalizedStatsOptions & Omit & Record} NormalizedStatsOptions */ @@ -403,7 +403,7 @@ const deprecatedNormalModuleLoaderHook = util.deprecate( * @param {Compilation} compilation compilation * @returns {NormalModuleCompilationHooks["loader"]} hooks */ - compilation => + (compilation) => require("./NormalModule").getCompilationHooks(compilation).loader, "Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader", "DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK" @@ -413,7 +413,7 @@ const deprecatedNormalModuleLoaderHook = util.deprecate( /** * @param {ModuleTemplates | undefined} moduleTemplates module templates */ -const defineRemovedModuleTemplates = moduleTemplates => { +const defineRemovedModuleTemplates = (moduleTemplates) => { Object.defineProperties(moduleTemplates, { asset: { enumerable: false, @@ -437,21 +437,24 @@ const defineRemovedModuleTemplates = moduleTemplates => { moduleTemplates = undefined; }; -const byId = compareSelect(c => c.id, compareIds); +const byId = compareSelect((c) => c.id, compareIds); const byNameOrHash = concatComparators( - compareSelect(c => c.name, compareIds), - compareSelect(c => c.fullHash, compareIds) + compareSelect((c) => c.name, compareIds), + compareSelect((c) => c.fullHash, compareIds) ); -const byMessage = compareSelect(err => `${err.message}`, compareStringsNumeric); +const byMessage = compareSelect( + (err) => `${err.message}`, + compareStringsNumeric +); const byModule = compareSelect( - err => (err.module && err.module.identifier()) || "", + (err) => (err.module && err.module.identifier()) || "", compareStringsNumeric ); -const byLocation = compareSelect(err => err.loc, compareLocations); +const byLocation = compareSelect((err) => err.loc, compareLocations); const compareErrors = concatComparators(byModule, byLocation, byMessage); @@ -497,7 +500,7 @@ class Compilation { * @param {CompilationAssets} assets assets * @returns {CompilationAssets} new assets */ - const popNewAssets = assets => { + const popNewAssets = (assets) => { let newAssets; for (const file of Object.keys(assets)) { if (savedAssets.has(file)) continue; @@ -514,7 +517,7 @@ class Compilation { call: () => { savedAssets = new Set(Object.keys(this.assets)); }, - register: tap => { + register: (tap) => { const { type, name } = tap; const { fn, additionalAssets, ...remainingTap } = tap; const additionalAssetsFn = @@ -526,7 +529,7 @@ class Compilation { switch (type) { case "sync": if (additionalAssetsFn) { - this.hooks.processAdditionalAssets.tap(name, assets => { + this.hooks.processAdditionalAssets.tap(name, (assets) => { if ( /** @type {ProcessedAssets} */ (processedAssets).has(this.assets) @@ -592,7 +595,7 @@ class Compilation { * @param {Error} err err * @returns {void} */ - err => { + (err) => { if (err) return callback(err); if (processedAssets !== undefined) { processedAssets.add(this.assets); @@ -612,7 +615,7 @@ class Compilation { }; case "promise": if (additionalAssetsFn) { - this.hooks.processAdditionalAssets.tapPromise(name, assets => { + this.hooks.processAdditionalAssets.tapPromise(name, (assets) => { if ( /** @type {ProcessedAssets} */ (processedAssets).has(this.assets) @@ -628,7 +631,7 @@ class Compilation { * @param {CompilationAssets} assets assets * @returns {Promise} result */ - fn: assets => { + fn: (assets) => { const p = fn(assets); if (!p || !p.then) return p; return p.then(() => { @@ -665,14 +668,15 @@ class Compilation { * @param {string} reason reason * @returns {string} error message */ - const errorMessage = - reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}. + const errorMessage = ( + reason + ) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}. BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`; /** * @param {string | (import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions)} options hook options * @returns {import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions} modified options */ - const getOptions = options => { + const getOptions = (options) => { if (typeof options === "string") options = { name: options }; if (options.stage) { throw new Error(errorMessage("it's using the 'stage' option")); @@ -1075,7 +1079,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.addModuleQueue = new AsyncQueue({ name: "addModule", parent: this.processDependenciesQueue, - getKey: module => module.identifier(), + getKey: (module) => module.identifier(), processor: this._addModule.bind(this) }); /** @type {AsyncQueue} */ @@ -1199,7 +1203,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @param {string} item item * @returns {LazySet} file dependencies */ - item => this.fileDependencies.add(item), + (item) => this.fileDependencies.add(item), "Compilation.compilationDependencies is deprecated (used Compilation.fileDependencies instead)", "DEP_WEBPACK_COMPILATION_COMPILATION_DEPENDENCIES" ) @@ -1351,7 +1355,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si /* eslint-enable no-console */ } }, - childName => { + (childName) => { if (typeof name === "function") { if (typeof childName === "function") { return this.getLogger(() => { @@ -1527,7 +1531,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.resolverFactory.get("normal", module.resolveOptions), /** @type {InputFileSystem} */ (this.inputFileSystem), - err => { + (err) => { if (currentProfile !== undefined) { currentProfile.markBuildingEnd(); } @@ -1538,20 +1542,25 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si if (currentProfile !== undefined) { currentProfile.markStoringStart(); } - this._modulesCache.store(module.identifier(), null, module, err => { - if (currentProfile !== undefined) { - currentProfile.markStoringEnd(); - } - if (err) { - this.hooks.failedModule.call( - module, - /** @type {WebpackError} */ (err) - ); - return callback(new ModuleStoreError(module, err)); + this._modulesCache.store( + module.identifier(), + null, + module, + (err) => { + if (currentProfile !== undefined) { + currentProfile.markStoringEnd(); + } + if (err) { + this.hooks.failedModule.call( + module, + /** @type {WebpackError} */ (err) + ); + return callback(new ModuleStoreError(module, err)); + } + this.hooks.succeedModule.call(module); + return callback(); } - this.hooks.succeedModule.call(module); - return callback(); - }); + ); } ); } @@ -1575,7 +1584,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si /** * @param {DependenciesBlock} block block */ - const processDependenciesBlock = block => { + const processDependenciesBlock = (block) => { if (block.dependencies) { let i = 0; for (const dep of block.dependencies) { @@ -1625,7 +1634,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @param {WebpackError=} err error * @returns {void} */ - const onDependenciesSorted = err => { + const onDependenciesSorted = (err) => { if (err) return callback(err); // early exit without changing parallelism back and forth @@ -1639,7 +1648,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si for (const item of sortedDependencies) { inProgressTransitive++; // eslint-disable-next-line no-loop-func - this.handleModuleCreation(item, err => { + this.handleModuleCreation(item, (err) => { // In V8, the Error objects keep a reference to the functions on the stack. These warnings & // errors are created inside closures that keep a reference to the Compilation, so errors are // leaking the Compilation object. @@ -1661,7 +1670,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @param {WebpackError=} err error * @returns {void} */ - const onTransitiveTasksFinished = err => { + const onTransitiveTasksFinished = (err) => { if (err) return callback(err); this.processDependenciesQueue.decreaseParallelism(); @@ -1738,7 +1747,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si module, dep, cachedModule, - err => { + (err) => { if (err) { if (inProgressTransitive <= 0) return; inProgressTransitive = -1; @@ -1783,7 +1792,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @param {Dependency} dep dependency * @returns {void} */ - const processDependencyForResolving = dep => { + const processDependencyForResolving = (dep) => { const resourceIdent = dep.getResourceIdentifier(); if (resourceIdent !== undefined && resourceIdent !== null) { const category = dep.category; @@ -1982,7 +1991,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si }; if (err) { if (factoryResult) applyFactoryResultDependencies(); - if (dependencies.every(d => d.optional)) { + if (dependencies.every((d) => d.optional)) { this.warnings.push(err); return callback(); } @@ -2136,7 +2145,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } } - this.buildModule(module, err => { + this.buildModule(module, (err) => { if (creatingModuleDuringBuildSet !== undefined) { creatingModuleDuringBuildSet.delete(module); } @@ -2160,7 +2169,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si return callback(null, module); } - this.processModuleDependencies(module, err => { + this.processModuleDependencies(module, (err) => { if (err) { return callback(err); } @@ -2238,7 +2247,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si originModule, err, /** @type {DependencyLocation} */ - (dependencies.map(d => d.loc).find(Boolean)) + (dependencies.map((d) => d.loc).find(Boolean)) ); return callback(notFoundError, factoryResult ? result : undefined); } @@ -2453,9 +2462,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si const oldBlocks = [...module.blocks]; module.invalidateBuild(); this.buildQueue.invalidate(module); - this.buildModule(module, err => { + this.buildModule(module, (err) => { if (err) { - return this.hooks.finishRebuildingModule.callAsync(module, err2 => { + return this.hooks.finishRebuildingModule.callAsync(module, (err2) => { if (err2) { callback( makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") @@ -2468,13 +2477,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.processDependenciesQueue.invalidate(module); this.moduleGraph.unfreeze(); - this.processModuleDependencies(module, err => { + this.processModuleDependencies(module, (err) => { if (err) return callback(err); this.removeReasonsOfDependencyBlock(module, { dependencies: oldDependencies, blocks: oldBlocks }); - this.hooks.finishRebuildingModule.callAsync(module, err2 => { + this.hooks.finishRebuildingModule.callAsync(module, (err2) => { if (err2) { callback( makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule") @@ -2511,7 +2520,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @param {Module} module module * @returns {WeakReferences | undefined} references */ - const computeReferences = module => { + const computeReferences = (module) => { /** @type {WeakReferences | undefined} */ let references; for (const connection of moduleGraph.getOutgoingConnections(module)) { @@ -2604,7 +2613,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @param {readonly ModuleGraphConnection[]} connections connections * @returns {symbol|boolean} result */ - const reduceAffectType = connections => { + const reduceAffectType = (connections) => { let affected = false; for (const { dependency } of connections) { if (!dependency) continue; @@ -2684,7 +2693,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @param {Module} module module * @returns {References} references */ - const computeReferences = module => { + const computeReferences = (module) => { const id = /** @type {ModuleId} */ (chunkGraph.getModuleId(module)); /** @type {Map | undefined} */ let modules; @@ -2804,27 +2813,27 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si p.range( profile.buildingStartTime, profile.buildingEndTime, - f => (profile.buildingParallelismFactor = f) + (f) => (profile.buildingParallelismFactor = f) ); p.range( profile.factoryStartTime, profile.factoryEndTime, - f => (profile.factoryParallelismFactor = f) + (f) => (profile.factoryParallelismFactor = f) ); p.range( profile.integrationStartTime, profile.integrationEndTime, - f => (profile.integrationParallelismFactor = f) + (f) => (profile.integrationParallelismFactor = f) ); p.range( profile.storingStartTime, profile.storingEndTime, - f => (profile.storingParallelismFactor = f) + (f) => (profile.storingParallelismFactor = f) ); p.range( profile.restoringStartTime, profile.restoringEndTime, - f => (profile.restoringParallelismFactor = f) + (f) => (profile.restoringParallelismFactor = f) ); if (profile.additionalFactoryTimes) { for (const { start, end } of profile.additionalFactoryTimes) { @@ -2832,7 +2841,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si p.range( start, end, - f => + (f) => (profile.additionalFactoriesParallelismFactor += f * influence) ); } @@ -2955,33 +2964,33 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si }; logNormalSummary( "resolve to new modules", - p => p.factory, - p => p.factoryParallelismFactor + (p) => p.factory, + (p) => p.factoryParallelismFactor ); logNormalSummary( "resolve to existing modules", - p => p.additionalFactories, - p => p.additionalFactoriesParallelismFactor + (p) => p.additionalFactories, + (p) => p.additionalFactoriesParallelismFactor ); logNormalSummary( "integrate modules", - p => p.restoring, - p => p.restoringParallelismFactor + (p) => p.restoring, + (p) => p.restoringParallelismFactor ); logByLoadersSummary( "build modules", - p => p.building, - p => p.buildingParallelismFactor + (p) => p.building, + (p) => p.buildingParallelismFactor ); logNormalSummary( "store modules", - p => p.storing, - p => p.storingParallelismFactor + (p) => p.storing, + (p) => p.storingParallelismFactor ); logNormalSummary( "restore modules", - p => p.restoring, - p => p.restoringParallelismFactor + (p) => p.restoring, + (p) => p.restoringParallelismFactor ); this.logger.timeEnd("finish module profiles"); } @@ -2990,7 +2999,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.logger.timeEnd("compute affected modules"); this.logger.time("finish modules"); const { modules, moduleMemCaches } = this; - this.hooks.finishModules.callAsync(modules, err => { + this.hooks.finishModules.callAsync(modules, (err) => { this.logger.timeEnd("finish modules"); if (err) return callback(/** @type {WebpackError} */ (err)); @@ -3061,7 +3070,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @param {WebpackError=} err err * @returns {void} */ - const finalCallback = err => { + const finalCallback = (err) => { this.factorizeQueue.clear(); this.buildQueue.clear(); this.rebuildQueue.clear(); @@ -3139,11 +3148,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @param {Dependency[]} deps deps * @returns {Module[]} sorted deps */ - const mapAndSort = deps => + const mapAndSort = (deps) => /** @type {Module[]} */ - (deps.map(dep => this.moduleGraph.getModule(dep)).filter(Boolean)).sort( - compareModulesByIdentifier - ); + ( + deps.map((dep) => this.moduleGraph.getModule(dep)).filter(Boolean) + ).sort(compareModulesByIdentifier); const includedModules = [ ...mapAndSort(this.globalEntry.includeDependencies), ...mapAndSort(includeDependencies) @@ -3250,7 +3259,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups); - this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => { + this.hooks.optimizeTree.callAsync(this.chunks, this.modules, (err) => { if (err) { return finalCallback( makeWebpackError(err, "Compilation.hooks.optimizeTree") @@ -3262,7 +3271,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o this.hooks.optimizeChunkModules.callAsync( this.chunks, this.modules, - err => { + (err) => { if (err) { return finalCallback( makeWebpackError(err, "Compilation.hooks.optimizeChunkModules") @@ -3325,7 +3334,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o this.logger.time("code generation"); this.hooks.beforeCodeGeneration.call(); - this.codeGeneration(err => { + this.codeGeneration((err) => { if (err) { return finalCallback(err); } @@ -3344,7 +3353,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o this.hooks.afterHash.call(); this.logger.timeEnd("hashing"); - this._runCodeGenerationJobs(codeGenerationJobs, err => { + this._runCodeGenerationJobs(codeGenerationJobs, (err) => { if (err) { return finalCallback(err); } @@ -3367,7 +3376,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o const cont = () => { this.logger.time("process assets"); - this.hooks.processAssets.callAsync(this.assets, err => { + this.hooks.processAssets.callAsync(this.assets, (err) => { if (err) { return finalCallback( makeWebpackError(err, "Compilation.hooks.processAssets") @@ -3403,7 +3412,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o this.unseal(); return this.seal(callback); } - return this.hooks.afterSeal.callAsync(err => { + return this.hooks.afterSeal.callAsync((err) => { if (err) { return finalCallback( makeWebpackError(err, "Compilation.hooks.afterSeal") @@ -3418,7 +3427,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o this.logger.time("create chunk assets"); if (this.hooks.shouldGenerateChunkAssets.call() !== false) { this.hooks.beforeChunkAssets.call(); - this.createChunkAssets(err => { + this.createChunkAssets((err) => { this.logger.timeEnd("create chunk assets"); if (err) { return finalCallback(err); @@ -3542,7 +3551,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o if ( codeGenerationDependencies !== undefined && (notCodeGeneratedModules === undefined || - codeGenerationDependencies.some(dep => { + codeGenerationDependencies.some((dep) => { const referencedModule = /** @type {Module} */ ( moduleGraph.getModule(dep) ); @@ -3574,7 +3583,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } ); }, - err => { + (err) => { if (err) return callback(err); if (delayedJobs.length > 0) { if (delayedJobs.length === jobs.length) { @@ -3583,7 +3592,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o new Error( `Unable to make progress during code generation because of circular code generation dependency: ${Array.from( delayedModules, - m => m.identifier() + (m) => m.identifier() ).join(", ")}` ) ) @@ -3597,7 +3606,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } if (errors.length > 0) { errors.sort( - compareSelect(err => err.module, compareModulesByIdentifier) + compareSelect((err) => err.module, compareModulesByIdentifier) ); for (const error of errors) { this.errors.push(error); @@ -3644,7 +3653,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o ) { let codeGenerated = false; const cache = new MultiItemCache( - runtimes.map(runtime => + runtimes.map((runtime) => this._codeGenerationCache.getItemCache( `${module.identifier()}|${getRuntimeKey(runtime)}`, `${hash}|${dependencyTemplates.getHash()}` @@ -3683,7 +3692,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o results.add(module, runtime, result); } if (!cachedResult) { - cache.store(result, err => + cache.store(result, (err) => callback(/** @type {WebpackError} */ (err), codeGenerated) ); } else { @@ -4031,7 +4040,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o * @param {Module} module module for processing * @returns {void} */ - const processModule = module => { + const processModule = (module) => { if (!moduleGraph.setDepthIfLower(module, depth)) return; queue.add(module); }; @@ -4157,7 +4166,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o /** * @param {Dependency} d dependency to (maybe) patch up */ - const iteratorDependency = d => { + const iteratorDependency = (d) => { const depModule = this.moduleGraph.getModule(d); if (!depModule) { return; @@ -4190,7 +4199,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o /** * @param {Entrypoint} ep an entrypoint */ - const processEntrypoint = ep => { + const processEntrypoint = (ep) => { const runtime = /** @type {string} */ (ep.options.runtime || ep.name); const chunk = /** @type {Chunk} */ (ep.getRuntimeChunk()); chunkGraph.setRuntimeId(runtime, /** @type {ChunkId} */ (chunk.id)); @@ -4273,7 +4282,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } } if (errors.length > 0) { - errors.sort(compareSelect(err => err.module, compareModulesByIdentifier)); + errors.sort( + compareSelect((err) => err.module, compareModulesByIdentifier) + ); for (const error of errors) { this.errors.push(error); } @@ -4410,7 +4421,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o for (const info of runtimeChunksMap.values()) { for (const other of new Set( [...info.chunk.getAllReferencedAsyncEntrypoints()].map( - e => e.chunks[e.chunks.length - 1] + (e) => e.chunks[e.chunks.length - 1] ) )) { const otherInfo = @@ -4463,11 +4474,11 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o circularRuntimeChunkInfo.push(info); } } - circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId)); + circularRuntimeChunkInfo.sort(compareSelect((i) => i.chunk, byId)); const err = new WebpackError(`Circular dependency between chunks with runtime (${Array.from( circularRuntimeChunkInfo, - c => c.chunk.name || c.chunk.id + (c) => c.chunk.name || c.chunk.id ).join(", ")}) This prevents using hashes of each other and should be avoided.`); err.chunk = circularRuntimeChunkInfo[0].chunk; @@ -4487,7 +4498,7 @@ This prevents using hashes of each other and should be avoided.`); /** * @param {Chunk} chunk chunk */ - const processChunk = chunk => { + const processChunk = (chunk) => { // Last minute module hash generation for modules that depend on chunk hashes this.logger.time("hashing: hash runtime modules"); const runtime = chunk.runtime; @@ -4564,7 +4575,9 @@ This prevents using hashes of each other and should be avoided.`); for (const chunk of runtimeChunks) processChunk(chunk); for (const chunk of initialChunks) processChunk(chunk); if (errors.length > 0) { - errors.sort(compareSelect(err => err.module, compareModulesByIdentifier)); + errors.sort( + compareSelect((err) => err.module, compareModulesByIdentifier) + ); for (const error of errors) { this.errors.push(error); } @@ -4671,7 +4684,7 @@ This prevents using hashes of each other and should be avoided.`); /** * @param {string} name name */ - const remove = name => { + const remove = (name) => { const relatedIn = this._assetsRelatedIn.get(name); if (relatedIn === undefined) return; const entry = relatedIn.get(key); @@ -4696,7 +4709,7 @@ This prevents using hashes of each other and should be avoided.`); /** * @param {string} name name */ - const add = name => { + const add = (name) => { let relatedIn = this._assetsRelatedIn.get(name); if (relatedIn === undefined) { this._assetsRelatedIn.set(name, (relatedIn = new Map())); @@ -4783,7 +4796,7 @@ This prevents using hashes of each other and should be avoided.`); const entry = related[key]; let newEntry; if (Array.isArray(entry)) { - newEntry = entry.map(x => (x === file ? newFile : x)); + newEntry = entry.map((x) => (x === file ? newFile : x)); } else if (entry === file) { newEntry = newFile; } else { @@ -4837,7 +4850,7 @@ This prevents using hashes of each other and should be avoided.`); /** * @param {string} file file */ - const checkUsedAndDelete = file => { + const checkUsedAndDelete = (file) => { if (!this._assetsRelatedIn.has(file)) { this.deleteAsset(file); } @@ -4987,7 +5000,7 @@ This prevents using hashes of each other and should be avoided.`); * @param {Error} err error * @returns {void} */ - const errorAndCallback = err => { + const errorAndCallback = (err) => { const filename = file || (typeof file === "string" @@ -5068,7 +5081,7 @@ This prevents using hashes of each other and should be avoided.`); chunk }); if (source !== sourceFromCache) { - assetCacheItem.store(source, err => { + assetCacheItem.store(source, (err) => { if (err) return errorAndCallback(err); inTry = false; return callback(); @@ -5190,9 +5203,9 @@ This prevents using hashes of each other and should be avoided.`); modules, 10, (module, push, callback) => { - this.buildQueue.waitFor(module, err => { + this.buildQueue.waitFor(module, (err) => { if (err) return callback(err); - this.processDependenciesQueue.waitFor(module, err => { + this.processDependenciesQueue.waitFor(module, (err) => { if (err) return callback(err); for (const { module: m } of this.moduleGraph.getOutgoingConnections( module @@ -5205,7 +5218,7 @@ This prevents using hashes of each other and should be avoided.`); }); }); }, - err => { + (err) => { if (err) return callback(/** @type {WebpackError} */ (err)); // Create new chunk graph, chunk and entrypoint for the build time execution @@ -5288,7 +5301,7 @@ This prevents using hashes of each other and should be avoided.`); const reportErrors = () => { if (errors.length > 0) { errors.sort( - compareSelect(err => err.module, compareModulesByIdentifier) + compareSelect((err) => err.module, compareModulesByIdentifier) ); for (const error of errors) { this.errors.push(error); @@ -5298,7 +5311,7 @@ This prevents using hashes of each other and should be avoided.`); }; // Generate code for all aggregated modules - asyncLib.eachLimit(modules, 10, codeGen, err => { + asyncLib.eachLimit(modules, 10, codeGen, (err) => { if (err) return callback(err); reportErrors(); @@ -5334,7 +5347,7 @@ This prevents using hashes of each other and should be avoided.`); } // Generate code for all runtime modules - asyncLib.eachLimit(runtimeModules, 10, codeGen, err => { + asyncLib.eachLimit(runtimeModules, 10, codeGen, (err) => { if (err) return callback(err); reportErrors(); @@ -5410,7 +5423,7 @@ This prevents using hashes of each other and should be avoided.`); callback ); }, - err => { + (err) => { if (err) return callback(err); /** @type {ExecuteModuleExports | undefined} */ @@ -5422,7 +5435,7 @@ This prevents using hashes of each other and should be avoided.`); } = this.outputOptions; /** @type {WebpackRequire} */ - const __webpack_require__ = id => { + const __webpack_require__ = (id) => { const cached = moduleCache[id]; if (cached !== undefined) { if (cached.error) throw cached.error; @@ -5656,7 +5669,7 @@ Object.defineProperty(compilationPrototype, "cache", { /** * @param {EXPECTED_ANY} _v value */ - _v => {}, + (_v) => {}, "Compilation.cache was removed in favor of Compilation.getCache()", "DEP_WEBPACK_COMPILATION_CACHE" ) diff --git a/lib/Compiler.js b/lib/Compiler.js index fb509a8dc61..f87921e8139 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -125,7 +125,7 @@ const webpack = require("."); * @param {string[]} array an array * @returns {boolean} true, if the array is sorted */ -const isSorted = array => { +const isSorted = (array) => { for (let i = 1; i < array.length; i++) { if (array[i - 1] > array[i]) return false; } @@ -154,7 +154,7 @@ const sortObject = (obj, keys) => { const includesHash = (filename, hashes) => { if (!hashes) return false; if (Array.isArray(hashes)) { - return hashes.some(hash => filename.includes(hash)); + return hashes.some((hash) => filename.includes(hash)); } return filename.includes(hashes); }; @@ -388,7 +388,7 @@ class Compiler { this.infrastructureLogger(name, type, args); } }, - childName => { + (childName) => { if (typeof name === "function") { if (typeof childName === "function") { return this.getInfrastructureLogger(() => { @@ -540,7 +540,7 @@ class Compiler { compilation.startTime = startTime; compilation.endTime = Date.now(); const stats = new Stats(compilation); - this.hooks.done.callAsync(stats, err => { + this.hooks.done.callAsync(stats, (err) => { if (err) return finalCallback(err); return finalCallback(null, stats); }); @@ -550,7 +550,7 @@ class Compiler { process.nextTick(() => { logger = compilation.getLogger("webpack.Compiler"); logger.time("emitAssets"); - this.emitAssets(compilation, err => { + this.emitAssets(compilation, (err) => { /** @type {Logger} */ (logger).timeEnd("emitAssets"); if (err) return finalCallback(err); @@ -563,12 +563,12 @@ class Compiler { /** @type {Logger} */ (logger).time("done hook"); const stats = new Stats(compilation); - this.hooks.done.callAsync(stats, err => { + this.hooks.done.callAsync(stats, (err) => { /** @type {Logger} */ (logger).timeEnd("done hook"); if (err) return finalCallback(err); - this.hooks.additionalPass.callAsync(err => { + this.hooks.additionalPass.callAsync((err) => { if (err) return finalCallback(err); this.compile(onCompiled); }); @@ -578,7 +578,7 @@ class Compiler { /** @type {Logger} */ (logger).time("emitRecords"); - this.emitRecords(err => { + this.emitRecords((err) => { /** @type {Logger} */ (logger).timeEnd("emitRecords"); if (err) return finalCallback(err); @@ -588,13 +588,13 @@ class Compiler { /** @type {Logger} */ (logger).time("done hook"); const stats = new Stats(compilation); - this.hooks.done.callAsync(stats, err => { + this.hooks.done.callAsync(stats, (err) => { /** @type {Logger} */ (logger).timeEnd("done hook"); if (err) return finalCallback(err); this.cache.storeBuildDependencies( compilation.buildDependencies, - err => { + (err) => { if (err) return finalCallback(err); return finalCallback(null, stats); } @@ -606,13 +606,13 @@ class Compiler { }; const run = () => { - this.hooks.beforeRun.callAsync(this, err => { + this.hooks.beforeRun.callAsync(this, (err) => { if (err) return finalCallback(err); - this.hooks.run.callAsync(this, err => { + this.hooks.run.callAsync(this, (err) => { if (err) return finalCallback(err); - this.readRecords(err => { + this.readRecords((err) => { if (err) return finalCallback(err); this.compile(onCompiled); @@ -622,7 +622,7 @@ class Compiler { }; if (this.idle) { - this.cache.endIdle(err => { + this.cache.endIdle((err) => { if (err) return finalCallback(err); this.idle = false; @@ -706,7 +706,7 @@ class Compiler { * @param {Error=} err error * @returns {void} */ - const emitFiles = err => { + const emitFiles = (err) => { if (err) return callback(err); const assets = compilation.getAssets(); @@ -739,7 +739,7 @@ class Compiler { * @param {Error=} err error * @returns {void} */ - const writeOut = err => { + const writeOut = (err) => { if (err) return callback(err); const targetPath = join( /** @type {OutputFileSystem} */ @@ -838,9 +838,9 @@ ${other}`); * @param {Buffer} content content to be written * @returns {void} */ - const doWrite = content => { + const doWrite = (content) => { /** @type {OutputFileSystem} */ - (this.outputFileSystem).writeFile(targetPath, content, err => { + (this.outputFileSystem).writeFile(targetPath, content, (err) => { if (err) return callback(err); // information marker that the asset has been emitted @@ -871,7 +871,7 @@ ${other}`); /** * @param {number} size size */ - const updateWithReplacementSource = size => { + const updateWithReplacementSource = (size) => { updateFileWithReplacementSource( file, /** @type {CacheEntry} */ (cacheEntry), @@ -915,7 +915,7 @@ ${other}`); * @param {IStats} stats stats * @returns {void} */ - const processExistingFile = stats => { + const processExistingFile = (stats) => { // skip emitting if it's already there and an immutable file if (immutable) { updateWithReplacementSource(/** @type {number} */ (stats.size)); @@ -1015,7 +1015,7 @@ ${other}`); writeOut(); } }, - err => { + (err) => { // Clear map to free up memory caseInsensitiveMap.clear(); if (err) { @@ -1025,7 +1025,7 @@ ${other}`); this._assetEmittingPreviousFiles = allTargetPaths; - this.hooks.afterEmit.callAsync(compilation, err => { + this.hooks.afterEmit.callAsync(compilation, (err) => { if (err) return callback(err); return callback(); @@ -1034,7 +1034,7 @@ ${other}`); ); }; - this.hooks.emit.callAsync(compilation, err => { + this.hooks.emit.callAsync(compilation, (err) => { if (err) return callback(err); outputPath = compilation.getPath(this.outputPath, {}); mkdirp( @@ -1054,10 +1054,10 @@ ${other}`); if (this.recordsOutputPath) { asyncLib.parallel( [ - cb => this.hooks.emitRecords.callAsync(cb), + (cb) => this.hooks.emitRecords.callAsync(cb), this._emitRecords.bind(this) ], - err => callback(err) + (err) => callback(err) ); } else { this.hooks.emitRecords.callAsync(callback); @@ -1111,7 +1111,7 @@ ${other}`); mkdirp( /** @type {OutputFileSystem} */ (this.outputFileSystem), recordsOutputPathDirectory, - err => { + (err) => { if (err) return callback(err); writeFile(); } @@ -1127,10 +1127,10 @@ ${other}`); if (this.recordsInputPath) { asyncLib.parallel( [ - cb => this.hooks.readRecords.callAsync(cb), + (cb) => this.hooks.readRecords.callAsync(cb), this._readRecords.bind(this) ], - err => callback(err) + (err) => callback(err) ); } else { this.records = {}; @@ -1154,7 +1154,7 @@ ${other}`); return callback(); } /** @type {InputFileSystem} */ - (this.inputFileSystem).stat(this.recordsInputPath, err => { + (this.inputFileSystem).stat(this.recordsInputPath, (err) => { // It doesn't exist // We can ignore this. if (err) return callback(); @@ -1339,7 +1339,7 @@ ${other}`); */ compile(callback) { const params = this.newCompilationParams(); - this.hooks.beforeCompile.callAsync(params, err => { + this.hooks.beforeCompile.callAsync(params, (err) => { if (err) return callback(err); this.hooks.compile.call(params); @@ -1349,28 +1349,28 @@ ${other}`); const logger = compilation.getLogger("webpack.Compiler"); logger.time("make hook"); - this.hooks.make.callAsync(compilation, err => { + this.hooks.make.callAsync(compilation, (err) => { logger.timeEnd("make hook"); if (err) return callback(err); logger.time("finish make hook"); - this.hooks.finishMake.callAsync(compilation, err => { + this.hooks.finishMake.callAsync(compilation, (err) => { logger.timeEnd("finish make hook"); if (err) return callback(err); process.nextTick(() => { logger.time("finish compilation"); - compilation.finish(err => { + compilation.finish((err) => { logger.timeEnd("finish compilation"); if (err) return callback(err); logger.time("seal compilation"); - compilation.seal(err => { + compilation.seal((err) => { logger.timeEnd("seal compilation"); if (err) return callback(err); logger.time("afterCompile hook"); - this.hooks.afterCompile.callAsync(compilation, err => { + this.hooks.afterCompile.callAsync(compilation, (err) => { logger.timeEnd("afterCompile hook"); if (err) return callback(err); @@ -1391,12 +1391,12 @@ ${other}`); close(callback) { if (this.watching) { // When there is still an active watching, close this first - this.watching.close(_err => { + this.watching.close((_err) => { this.close(callback); }); return; } - this.hooks.shutdown.callAsync(err => { + this.hooks.shutdown.callAsync((err) => { if (err) return callback(err); // Get rid of reference to last compilation to avoid leaking memory // We can't run this._cleanupLastCompilation() as the Stats to this compilation diff --git a/lib/ConcatenationScope.js b/lib/ConcatenationScope.js index 76b0a1dde56..e14add3899f 100644 --- a/lib/ConcatenationScope.js +++ b/lib/ConcatenationScope.js @@ -30,8 +30,9 @@ class ConcatenationScope { /** * @param {ModuleInfo[] | Map} modulesMap all module info by module * @param {ConcatenatedModuleInfo} currentModule the current module info + * @param {Set} usedNames all used names */ - constructor(modulesMap, currentModule) { + constructor(modulesMap, currentModule, usedNames) { this._currentModule = currentModule; if (Array.isArray(modulesMap)) { const map = new Map(); @@ -40,6 +41,7 @@ class ConcatenationScope { } modulesMap = map; } + this.usedNames = usedNames; this._modulesMap = modulesMap; } @@ -77,6 +79,30 @@ class ConcatenationScope { } } + /** + * @param {string} exportName name of the export + * @returns {string | undefined} the expression of the export + */ + getRawExport(exportName) { + if (!this._currentModule.rawExportMap) { + return undefined; + } + return this._currentModule.rawExportMap.get(exportName); + } + + /** + * @param {string} exportName name of the export + * @param {string} expression expression to be used + */ + setRawExportMap(exportName, expression) { + if (!this._currentModule.rawExportMap) { + this._currentModule.rawExportMap = new Map(); + } + if (this._currentModule.rawExportMap.has(exportName)) { + this._currentModule.rawExportMap.set(exportName, expression); + } + } + /** * @param {string} symbol identifier of the export in source code */ @@ -84,6 +110,18 @@ class ConcatenationScope { this._currentModule.namespaceExportSymbol = symbol; } + /** + * @param {string} symbol identifier of the export in source code + * @returns {boolean} registered success + */ + registerUsedName(symbol) { + if (this.usedNames.has(symbol)) { + return false; + } + this.usedNames.add(symbol); + return true; + } + /** * @param {Module} module the referenced module * @param {Partial} options options diff --git a/lib/ConstPlugin.js b/lib/ConstPlugin.js index 04cca9430a3..82ac18cac93 100644 --- a/lib/ConstPlugin.js +++ b/lib/ConstPlugin.js @@ -159,9 +159,9 @@ class ConstPlugin { /** * @param {JavascriptParser} parser the parser */ - const handler = parser => { - parser.hooks.terminate.tap(PLUGIN_NAME, _statement => true); - parser.hooks.statementIf.tap(PLUGIN_NAME, statement => { + const handler = (parser) => { + parser.hooks.terminate.tap(PLUGIN_NAME, (_statement) => true); + parser.hooks.statementIf.tap(PLUGIN_NAME, (statement) => { if (parser.scope.isAsmJs) return; const param = parser.evaluateExpression(statement.test); const bool = param.asBool(); @@ -185,7 +185,7 @@ class ConstPlugin { return bool; } }); - parser.hooks.unusedStatement.tap(PLUGIN_NAME, statement => { + parser.hooks.unusedStatement.tap(PLUGIN_NAME, (statement) => { if ( parser.scope.isAsmJs || // Check top level scope here again @@ -198,7 +198,7 @@ class ConstPlugin { }); parser.hooks.expressionConditionalOperator.tap( PLUGIN_NAME, - expression => { + (expression) => { if (parser.scope.isAsmJs) return; const param = parser.evaluateExpression(expression.test); const bool = param.asBool(); @@ -239,7 +239,7 @@ class ConstPlugin { ); parser.hooks.expressionLogicalOperator.tap( PLUGIN_NAME, - expression => { + (expression) => { if (parser.scope.isAsmJs) return; if ( expression.operator === "&&" || @@ -381,7 +381,7 @@ class ConstPlugin { } } ); - parser.hooks.optionalChaining.tap(PLUGIN_NAME, expr => { + parser.hooks.optionalChaining.tap(PLUGIN_NAME, (expr) => { /** @type {Expression[]} */ const optionalExpressionsStack = []; /** @type {Expression | Super} */ @@ -441,7 +441,7 @@ class ConstPlugin { }); parser.hooks.evaluateIdentifier .for("__resourceQuery") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { if (parser.scope.isAsmJs) return; if (!parser.state.module) return; return evaluateToString( @@ -450,7 +450,7 @@ class ConstPlugin { }); parser.hooks.expression .for("__resourceQuery") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { if (parser.scope.isAsmJs) return; if (!parser.state.module) return; const dep = new CachedConstDependency( @@ -467,7 +467,7 @@ class ConstPlugin { parser.hooks.evaluateIdentifier .for("__resourceFragment") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { if (parser.scope.isAsmJs) return; if (!parser.state.module) return; return evaluateToString( @@ -476,7 +476,7 @@ class ConstPlugin { }); parser.hooks.expression .for("__resourceFragment") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { if (parser.scope.isAsmJs) return; if (!parser.state.module) return; const dep = new CachedConstDependency( diff --git a/lib/ContextExclusionPlugin.js b/lib/ContextExclusionPlugin.js index c9ad952e143..6bd57c6e0d2 100644 --- a/lib/ContextExclusionPlugin.js +++ b/lib/ContextExclusionPlugin.js @@ -23,9 +23,9 @@ class ContextExclusionPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => { - cmf.hooks.contextModuleFiles.tap(PLUGIN_NAME, files => - files.filter(filePath => !this.negativeMatcher.test(filePath)) + compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, (cmf) => { + cmf.hooks.contextModuleFiles.tap(PLUGIN_NAME, (files) => + files.filter((filePath) => !this.negativeMatcher.test(filePath)) ); }); } diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 6cbbc7aa0e2..207854d4d1f 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -283,7 +283,7 @@ class ContextModule extends Module { identifier = `${requestShortener.shorten(`${this.options.resource}`)}/`; } else { identifier = this.options.resource - .map(r => `${requestShortener.shorten(r)}/`) + .map((r) => `${requestShortener.shorten(r)}/`) .join(" "); } if (this.options.resourceQuery) { @@ -309,7 +309,7 @@ class ContextModule extends Module { } if (this.options.referencedExports) { identifier += ` referencedExports: ${this.options.referencedExports - .map(e => e.join(".")) + .map((e) => e.join(".")) .join(", ")}`; } if (this.options.chunkName) { @@ -355,7 +355,7 @@ class ContextModule extends Module { identifier = "false"; } else { identifier = this.options.resource - .map(res => + .map((res) => contextify(options.context, res, options.associatedObjectForCache) ) .join(" "); @@ -386,7 +386,7 @@ class ContextModule extends Module { } if (this.options.referencedExports) { identifier += ` referencedExports: ${this.options.referencedExports - .map(e => e.join(".")) + .map((e) => e.join(".")) .join(", ")}`; } @@ -466,7 +466,7 @@ class ContextModule extends Module { } dependencies.sort( concatComparators( - compareSelect(a => a.loc, compareLocations), + compareSelect((a) => a.loc, compareLocations), keepOriginalOrder(this.dependencies) ) ); @@ -588,7 +588,7 @@ class ContextModule extends Module { const sortedDependencies = /** @type {ContextElementDependency[]} */ (dependencies) - .filter(dependency => moduleGraph.getModule(dependency)) + .filter((dependency) => moduleGraph.getModule(dependency)) .sort((a, b) => { if (a.userRequest === b.userRequest) { return 0; @@ -621,7 +621,8 @@ class ContextModule extends Module { // therefore the order of this is !important! const sortedModules = dependencies .map( - dependency => /** @type {Module} */ (moduleGraph.getModule(dependency)) + (dependency) => + /** @type {Module} */ (moduleGraph.getModule(dependency)) ) .filter(Boolean) .sort(comparator); @@ -945,7 +946,7 @@ module.exports = webpackAsyncContext;`; let hasMultipleOrNoChunks = false; let hasNoChunk = true; const fakeMap = this.getFakeMap( - blocks.map(b => b.dependencies[0]), + blocks.map((b) => b.dependencies[0]), chunkGraph ); const hasFakeMap = typeof fakeMap === "object"; @@ -954,7 +955,7 @@ module.exports = webpackAsyncContext;`; * @type {Item[]} */ const items = blocks - .map(block => { + .map((block) => { const dependency = /** @type {ContextElementDependency} */ (block.dependencies[0]); @@ -966,7 +967,7 @@ module.exports = webpackAsyncContext;`; chunks: undefined }; }) - .filter(item => item.module); + .filter((item) => item.module); for (const item of items) { const chunkGroup = chunkGraph.getBlockChunkGroup(item.block); const chunks = (chunkGroup && chunkGroup.chunks) || []; @@ -1000,7 +1001,7 @@ module.exports = webpackAsyncContext;`; map[item.userRequest] = [ ...arrayStart, .../** @type {Chunk[]} */ - (item.chunks).map(chunk => /** @type {ChunkId} */ (chunk.id)) + (item.chunks).map((chunk) => /** @type {ChunkId} */ (chunk.id)) ]; } } diff --git a/lib/ContextModuleFactory.js b/lib/ContextModuleFactory.js index 77a7bf5919c..03e9b3e3a2d 100644 --- a/lib/ContextModuleFactory.js +++ b/lib/ContextModuleFactory.js @@ -56,7 +56,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory { { name: "alternatives", /** @type {AsyncSeriesWaterfallHook<[ContextAlternativeRequest[]]>["intercept"]} */ - intercept: interceptor => { + intercept: (interceptor) => { throw new Error( "Intercepting fake hook ContextModuleFactory.hooks.alternatives is not possible, use ContextModuleFactory.hooks.alternativeRequests instead" ); @@ -169,13 +169,13 @@ module.exports = class ContextModuleFactory extends ModuleFactory { asyncLib.parallel( [ - callback => { + (callback) => { const results = /** @type ResolveRequest[] */ ([]); /** * @param {ResolveRequest} obj obj * @returns {void} */ - const yield_ = obj => { + const yield_ = (obj) => { results.push(obj); }; @@ -189,13 +189,13 @@ module.exports = class ContextModuleFactory extends ModuleFactory { contextDependencies, yield: yield_ }, - err => { + (err) => { if (err) return callback(err); callback(null, results); } ); }, - callback => { + (callback) => { asyncLib.map( loaders, (loader, callback) => { @@ -230,7 +230,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory { /** @type {[ResolveRequest[], string[]]} */ (result); if (contextResult.length > 1) { const first = contextResult[0]; - contextResult = contextResult.filter(r => r.path); + contextResult = contextResult.filter((r) => r.path); if (contextResult.length === 0) contextResult.push(first); } this.hooks.afterResolve.callAsync( @@ -241,7 +241,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory { (loaderResult.length > 0 ? "!" : ""), resource: contextResult.length > 1 - ? contextResult.map(r => r.path) + ? contextResult.map((r) => r.path) : contextResult[0].path, resolveDependencies: this.resolveDependencies.bind(this), resourceQuery: contextResult[0].query, @@ -342,13 +342,13 @@ module.exports = class ContextModuleFactory extends ModuleFactory { fs.readdir(directory, (err, files) => { if (err) return callback(err); const processedFiles = cmf.hooks.contextModuleFiles.call( - /** @type {string[]} */ (files).map(file => file.normalize("NFC")) + /** @type {string[]} */ (files).map((file) => file.normalize("NFC")) ); if (!processedFiles || processedFiles.length === 0) { return callback(null, []); } asyncLib.map( - processedFiles.filter(p => p.indexOf(".") !== 0), + processedFiles.filter((p) => p.indexOf(".") !== 0), (segment, callback) => { const subResource = join(fs, directory, segment); @@ -387,10 +387,10 @@ module.exports = class ContextModuleFactory extends ModuleFactory { null, /** @type {ContextAlternativeRequest[]} */ (alternatives) - .filter(obj => + .filter((obj) => regExp.test(/** @type {string} */ (obj.request)) ) - .map(obj => { + .map((obj) => { const dep = new ContextElementDependency( `${obj.request}${resourceQuery}${resourceFragment}`, obj.request, diff --git a/lib/ContextReplacementPlugin.js b/lib/ContextReplacementPlugin.js index 828b8192ed8..76188c29cd1 100644 --- a/lib/ContextReplacementPlugin.js +++ b/lib/ContextReplacementPlugin.js @@ -97,8 +97,8 @@ class ContextReplacementPlugin { const newContentRegExp = this.newContentRegExp; const newContentCreateContextMap = this.newContentCreateContextMap; - compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => { - cmf.hooks.beforeResolve.tap(PLUGIN_NAME, result => { + compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, (cmf) => { + cmf.hooks.beforeResolve.tap(PLUGIN_NAME, (result) => { if (!result) return; if (resourceRegExp.test(result.request)) { if (newContentResource !== undefined) { @@ -120,7 +120,7 @@ class ContextReplacementPlugin { } return result; }); - cmf.hooks.afterResolve.tap(PLUGIN_NAME, result => { + cmf.hooks.afterResolve.tap(PLUGIN_NAME, (result) => { if (!result) return; if (resourceRegExp.test(result.resource)) { if (newContentResource !== undefined) { @@ -183,11 +183,11 @@ class ContextReplacementPlugin { * @returns {(fs: InputFileSystem, options: ContextModuleOptions, callback: (err: null | Error, dependencies?: ContextElementDependency[]) => void) => void} resolve resolve dependencies from context map function */ const createResolveDependenciesFromContextMap = - createContextMap => (fs, options, callback) => { + (createContextMap) => (fs, options, callback) => { createContextMap(fs, (err, map) => { if (err) return callback(err); const dependencies = Object.keys(map).map( - key => + (key) => new ContextElementDependency( map[key] + options.resourceQuery + options.resourceFragment, key, diff --git a/lib/DefinePlugin.js b/lib/DefinePlugin.js index f60d68f00c9..e3d75973f82 100644 --- a/lib/DefinePlugin.js +++ b/lib/DefinePlugin.js @@ -130,7 +130,7 @@ class RuntimeValue { */ function getObjKeys(properties) { if (!properties) return; - return new Set([...properties].map(p => p.id)); + return new Set([...properties].map((p) => p.id)); } /** @typedef {Set | null} ObjKeys */ @@ -161,7 +161,7 @@ const stringifyObj = ( const arr = Array.isArray(obj); if (arr) { code = `[${obj - .map(code => + .map((code) => toCode( code, parser, @@ -176,10 +176,10 @@ const stringifyObj = ( } else { let keys = Object.keys(obj); if (objKeys) { - keys = objKeys.size === 0 ? [] : keys.filter(k => objKeys.has(k)); + keys = objKeys.size === 0 ? [] : keys.filter((k) => objKeys.has(k)); } code = `{${keys - .map(key => { + .map((key) => { const code = obj[key]; return `${JSON.stringify(key)}:${toCode( code, @@ -286,7 +286,7 @@ const toCode = ( * @param {CodeValue} code code * @returns {string | undefined} result */ -const toCacheVersion = code => { +const toCacheVersion = (code) => { if (code === null) { return "null"; } @@ -306,7 +306,7 @@ const toCacheVersion = code => { return `(${code.toString()})`; } if (typeof code === "object") { - const items = Object.keys(code).map(key => ({ + const items = Object.keys(code).map((key) => ({ key, value: toCacheVersion( /** @type {Record} */ @@ -390,7 +390,7 @@ class DefinePlugin { * @param {JavascriptParser} parser Parser * @returns {void} */ - const handler = parser => { + const handler = (parser) => { const hooked = new Set(); const mainValue = /** @type {ValueCacheVersion} */ @@ -408,7 +408,7 @@ class DefinePlugin { /** * @param {string} key key */ - const addValueDependency = key => { + const addValueDependency = (key) => { const buildInfo = /** @type {BuildInfo} */ (parser.state.module.buildInfo); @@ -495,7 +495,7 @@ class DefinePlugin { // why 100? Ensures it runs after object define stage: 100 }, - expr => { + (expr) => { const destructed = parser.destructuringAssignmentPropertiesFor(expr); if (destructed === undefined) { @@ -557,7 +557,7 @@ class DefinePlugin { }); parser.hooks.evaluateIdentifier .for(key) - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { /** * this is needed in case there is a recursion in the DefinePlugin * to prevent an endless recursion @@ -584,7 +584,7 @@ class DefinePlugin { res.setRange(/** @type {Range} */ (expr.range)); return res; }); - parser.hooks.expression.for(key).tap(PLUGIN_NAME, expr => { + parser.hooks.expression.for(key).tap(PLUGIN_NAME, (expr) => { addValueDependency(originalKey); let strCode = toCode( code, @@ -613,7 +613,7 @@ class DefinePlugin { return toConstantDependency(parser, strCode)(expr); }); } - parser.hooks.evaluateTypeof.for(key).tap(PLUGIN_NAME, expr => { + parser.hooks.evaluateTypeof.for(key).tap(PLUGIN_NAME, (expr) => { /** * this is needed in case there is a recursion in the DefinePlugin * to prevent an endless recursion @@ -640,7 +640,7 @@ class DefinePlugin { res.setRange(/** @type {Range} */ (expr.range)); return res; }); - parser.hooks.typeof.for(key).tap(PLUGIN_NAME, expr => { + parser.hooks.typeof.for(key).tap(PLUGIN_NAME, (expr) => { addValueDependency(originalKey); const codeCode = toCode( code, @@ -672,20 +672,22 @@ class DefinePlugin { addValueDependency(key); return true; }); - parser.hooks.evaluateIdentifier.for(key).tap(PLUGIN_NAME, expr => { - addValueDependency(key); - return new BasicEvaluatedExpression() - .setTruthy() - .setSideEffects(false) - .setRange(/** @type {Range} */ (expr.range)); - }); + parser.hooks.evaluateIdentifier + .for(key) + .tap(PLUGIN_NAME, (expr) => { + addValueDependency(key); + return new BasicEvaluatedExpression() + .setTruthy() + .setSideEffects(false) + .setRange(/** @type {Range} */ (expr.range)); + }); parser.hooks.evaluateTypeof .for(key) .tap( PLUGIN_NAME, withValueDependency(key, evaluateToString("object")) ); - parser.hooks.expression.for(key).tap(PLUGIN_NAME, expr => { + parser.hooks.expression.for(key).tap(PLUGIN_NAME, (expr) => { addValueDependency(key); let strCode = stringifyObj( obj, @@ -778,7 +780,7 @@ class DefinePlugin { * @param {Record} definitions Definitions map * @returns {void} */ - const walkDefinitionsForKeys = definitions => { + const walkDefinitionsForKeys = (definitions) => { /** * @param {Map>} map Map * @param {string} key key diff --git a/lib/DelegatedModuleFactoryPlugin.js b/lib/DelegatedModuleFactoryPlugin.js index c12c27bd9d2..32d80a005b1 100644 --- a/lib/DelegatedModuleFactoryPlugin.js +++ b/lib/DelegatedModuleFactoryPlugin.js @@ -92,7 +92,7 @@ class DelegatedModuleFactoryPlugin { } ); } else { - normalModuleFactory.hooks.module.tap(PLUGIN_NAME, module => { + normalModuleFactory.hooks.module.tap(PLUGIN_NAME, (module) => { const request = module.libIdent(this.options); if (request && request in this.options.content) { const resolved = this.options.content[request]; diff --git a/lib/DllEntryPlugin.js b/lib/DllEntryPlugin.js index 3bbafb0c645..a63946cf96b 100644 --- a/lib/DllEntryPlugin.js +++ b/lib/DllEntryPlugin.js @@ -64,7 +64,7 @@ class DllEntryPlugin { this.options.name ), this.options, - error => { + (error) => { if (error) return callback(error); callback(); } diff --git a/lib/DllReferencePlugin.js b/lib/DllReferencePlugin.js index 0cec5bdcf62..927feb5704b 100644 --- a/lib/DllReferencePlugin.js +++ b/lib/DllReferencePlugin.js @@ -102,7 +102,7 @@ class DllReferencePlugin { return callback(); }); - compiler.hooks.compile.tap(PLUGIN_NAME, params => { + compiler.hooks.compile.tap(PLUGIN_NAME, (params) => { let name = this.options.name; let sourceType = this.options.sourceType; let resolvedContent = diff --git a/lib/DynamicEntryPlugin.js b/lib/DynamicEntryPlugin.js index 79600542090..d30acbae10a 100644 --- a/lib/DynamicEntryPlugin.js +++ b/lib/DynamicEntryPlugin.js @@ -43,9 +43,9 @@ class DynamicEntryPlugin { } ); - compiler.hooks.make.tapPromise(PLUGIN_NAME, compilation => + compiler.hooks.make.tapPromise(PLUGIN_NAME, (compilation) => Promise.resolve(this.entry()) - .then(entry => { + .then((entry) => { const promises = []; for (const name of Object.keys(entry)) { const desc = entry[name]; @@ -68,7 +68,7 @@ class DynamicEntryPlugin { this.context, EntryPlugin.createDependency(entry, options), options, - err => { + (err) => { if (err) return reject(err); resolve(); } diff --git a/lib/EntryPlugin.js b/lib/EntryPlugin.js index 5031b6d077a..35392d871ba 100644 --- a/lib/EntryPlugin.js +++ b/lib/EntryPlugin.js @@ -45,7 +45,7 @@ class EntryPlugin { const dep = EntryPlugin.createDependency(entry, options); compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => { - compilation.addEntry(context, dep, options, err => { + compilation.addEntry(context, dep, options, (err) => { callback(err); }); }); diff --git a/lib/EnvironmentPlugin.js b/lib/EnvironmentPlugin.js index 078cdf67c70..3bf01f09673 100644 --- a/lib/EnvironmentPlugin.js +++ b/lib/EnvironmentPlugin.js @@ -48,7 +48,7 @@ class EnvironmentPlugin { : this.defaultValues[key]; if (value === undefined) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const error = new WebpackError( `${PLUGIN_NAME} - ${key} environment variable is undefined.\n\n` + "You can pass an object with default values to suppress this warning.\n" + diff --git a/lib/ErrorHelpers.js b/lib/ErrorHelpers.js index af5801786bd..b23d1f1b421 100644 --- a/lib/ErrorHelpers.js +++ b/lib/ErrorHelpers.js @@ -28,13 +28,13 @@ const cutOffByFlag = (stack, flag) => { * @param {string} stack stack trace * @returns {string} stack trace without the loader execution flag included */ -const cutOffLoaderExecution = stack => cutOffByFlag(stack, loaderFlag); +const cutOffLoaderExecution = (stack) => cutOffByFlag(stack, loaderFlag); /** * @param {string} stack stack trace * @returns {string} stack trace without the webpack options flag included */ -const cutOffWebpackOptions = stack => cutOffByFlag(stack, webpackOptionsFlag); +const cutOffWebpackOptions = (stack) => cutOffByFlag(stack, webpackOptionsFlag); /** * @param {string} stack stack trace diff --git a/lib/EvalDevToolModulePlugin.js b/lib/EvalDevToolModulePlugin.js index bde4bb6466d..f5ca3d1958b 100644 --- a/lib/EvalDevToolModulePlugin.js +++ b/lib/EvalDevToolModulePlugin.js @@ -55,7 +55,7 @@ class EvalDevToolModulePlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); hooks.renderModuleContent.tap( PLUGIN_NAME, @@ -110,7 +110,7 @@ class EvalDevToolModulePlugin { ); hooks.render.tap( PLUGIN_NAME, - source => new ConcatSource(devtoolWarning, source) + (source) => new ConcatSource(devtoolWarning, source) ); hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash) => { hash.update(PLUGIN_NAME); diff --git a/lib/EvalSourceMapDevToolPlugin.js b/lib/EvalSourceMapDevToolPlugin.js index 386f8ae4f80..a8c6ce318d4 100644 --- a/lib/EvalSourceMapDevToolPlugin.js +++ b/lib/EvalSourceMapDevToolPlugin.js @@ -69,7 +69,7 @@ class EvalSourceMapDevToolPlugin { */ apply(compiler) { const options = this.options; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); const matchModule = ModuleFilenameHelpers.matchObject.bind( @@ -88,7 +88,7 @@ class EvalSourceMapDevToolPlugin { * @param {Source} r result * @returns {Source} result */ - const result = r => { + const result = (r) => { cache.set(source, r); return r; }; @@ -136,13 +136,13 @@ class EvalSourceMapDevToolPlugin { sourceMap = { ...sourceMap }; const context = /** @type {string} */ (compiler.options.context); const root = compiler.root; - const modules = sourceMap.sources.map(source => { + const modules = sourceMap.sources.map((source) => { if (!source.startsWith("webpack://")) return source; source = makePathsAbsolute(context, source.slice(10), root); const module = compilation.findModule(source); return module || source; }); - let moduleFilenames = modules.map(module => + let moduleFilenames = modules.map((module) => ModuleFilenameHelpers.createFilename( module, { @@ -205,7 +205,7 @@ class EvalSourceMapDevToolPlugin { ); hooks.render.tap( PLUGIN_NAME, - source => new ConcatSource(devtoolWarning, source) + (source) => new ConcatSource(devtoolWarning, source) ); hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash) => { hash.update(PLUGIN_NAME); diff --git a/lib/ExportsInfo.js b/lib/ExportsInfo.js index e8fb81d01d0..695511ba8f6 100644 --- a/lib/ExportsInfo.js +++ b/lib/ExportsInfo.js @@ -142,7 +142,7 @@ class ExportsInfo { if (this._redirectTo !== undefined) { /** @type {Exports} */ const map = new Map( - Array.from(this._redirectTo.orderedExports, item => [item.name, item]) + Array.from(this._redirectTo.orderedExports, (item) => [item.name, item]) ); for (const [key, value] of this._exports) { map.set(key, value); @@ -402,7 +402,7 @@ class ExportsInfo { } else { if ( this._otherExportsInfo.setUsedConditionally( - used => used < UsageState.Unknown, + (used) => used < UsageState.Unknown, UsageState.Unknown, runtime ) @@ -465,7 +465,7 @@ class ExportsInfo { */ setUsedForSideEffectsOnly(runtime) { return this._sideEffectsOnlyInfo.setUsedConditionally( - used => used === UsageState.Unused, + (used) => used === UsageState.Unused, UsageState.Used, runtime ); @@ -988,7 +988,7 @@ class ExportInfo { let changed = false; if ( this.setUsedConditionally( - used => used < UsageState.Unknown, + (used) => used < UsageState.Unknown, UsageState.Unknown, runtime ) @@ -1050,7 +1050,7 @@ class ExportInfo { } else if (this._usedInRuntime === undefined) { if (newValue !== UsageState.Unused && condition(UsageState.Unused)) { this._usedInRuntime = new Map(); - forEachRuntime(runtime, runtime => + forEachRuntime(runtime, (runtime) => /** @type {UsedInRuntime} */ (this._usedInRuntime).set(/** @type {string} */ (runtime), newValue) ); @@ -1058,7 +1058,7 @@ class ExportInfo { } } else { let changed = false; - forEachRuntime(runtime, _runtime => { + forEachRuntime(runtime, (_runtime) => { const runtime = /** @type {string} */ (_runtime); const usedInRuntime = /** @type {UsedInRuntime} */ @@ -1098,7 +1098,7 @@ class ExportInfo { } else if (this._usedInRuntime === undefined) { if (newValue !== UsageState.Unused) { this._usedInRuntime = new Map(); - forEachRuntime(runtime, runtime => + forEachRuntime(runtime, (runtime) => /** @type {UsedInRuntime} */ (this._usedInRuntime).set(/** @type {string} */ (runtime), newValue) ); @@ -1106,7 +1106,7 @@ class ExportInfo { } } else { let changed = false; - forEachRuntime(runtime, _runtime => { + forEachRuntime(runtime, (_runtime) => { const runtime = /** @type {string} */ (_runtime); const usedInRuntime = /** @type {UsedInRuntime} */ @@ -1247,7 +1247,7 @@ class ExportInfo { } else if ( runtime !== undefined && [...runtime].every( - runtime => + (runtime) => !(/** @type {UsedInRuntime} */ (this._usedInRuntime).has(runtime)) ) ) { diff --git a/lib/ExportsInfoApiPlugin.js b/lib/ExportsInfoApiPlugin.js index faf4594bbd0..2fdf8bdbecd 100644 --- a/lib/ExportsInfoApiPlugin.js +++ b/lib/ExportsInfoApiPlugin.js @@ -38,7 +38,7 @@ class ExportsInfoApiPlugin { * @param {JavascriptParser} parser the parser * @returns {void} */ - const handler = parser => { + const handler = (parser) => { parser.hooks.expressionMemberChain .for("__webpack_exports_info__") .tap(PLUGIN_NAME, (expr, members) => { @@ -60,7 +60,7 @@ class ExportsInfoApiPlugin { }); parser.hooks.expression .for("__webpack_exports_info__") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { const dep = new ConstDependency( "true", /** @type {Range} */ (expr.range) diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index 66edc91de99..de7b38919fe 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -75,8 +75,11 @@ const { register } = require("./util/serialization"); * @property {string} expression * @property {InitFragment[]=} chunkInitFragments * @property {ReadOnlyRuntimeRequirements=} runtimeRequirements + * @property {[string, string][]=} specifiers */ +/** @typedef {true | [string, string][]} Imported */ + const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]); const RUNTIME_REQUIREMENTS_FOR_SCRIPT = new Set([RuntimeGlobals.loadScript]); const RUNTIME_REQUIREMENTS_FOR_MODULE = new Set([ @@ -96,7 +99,9 @@ const getSourceForGlobalVariableExternal = (variableName, type) => { } // needed for e.g. window["some"]["thing"] - const objectLookup = variableName.map(r => `[${JSON.stringify(r)}]`).join(""); + const objectLookup = variableName + .map((r) => `[${JSON.stringify(r)}]`) + .join(""); return { iife: type === "this", expression: `${type}${objectLookup}` @@ -107,7 +112,7 @@ const getSourceForGlobalVariableExternal = (variableName, type) => { * @param {string|string[]} moduleAndSpecifiers the module request * @returns {SourceData} the generated source */ -const getSourceForCommonJsExternal = moduleAndSpecifiers => { +const getSourceForCommonJsExternal = (moduleAndSpecifiers) => { if (!Array.isArray(moduleAndSpecifiers)) { return { expression: `require(${JSON.stringify(moduleAndSpecifiers)})` @@ -123,21 +128,24 @@ const getSourceForCommonJsExternal = moduleAndSpecifiers => { }; /** - * @param {string|string[]} moduleAndSpecifiers the module request - * @param {string} importMetaName import.meta name - * @param {boolean} needPrefix need to use `node:` prefix for `module` import + * @param {string | string[]} moduleAndSpecifiers the module request + * @param {RuntimeTemplate} runtimeTemplate the runtime template * @returns {SourceData} the generated source */ const getSourceForCommonJsExternalInNodeModule = ( moduleAndSpecifiers, - importMetaName, - needPrefix + runtimeTemplate ) => { + const importMetaName = + /** @type {string} */ + (runtimeTemplate.outputOptions.importMetaName); + + // /** @type {boolean} */ + // (runtimeTemplate.supportNodePrefixForCoreModules()) + const chunkInitFragments = [ new InitFragment( - `import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "${ - needPrefix ? "node:" : "" - }module";\n`, + `import { createRequire as __WEBPACK_EXTERNAL_createRequire } from ${runtimeTemplate.renderNodePrefixForCoreModule("module")};\n`, InitFragment.STAGE_HARMONY_IMPORTS, 0, "external module node-commonjs" @@ -215,10 +223,9 @@ const getSourceForImportExternal = ( }; /** - * @template {{ [key: string]: string }} T - * @param {keyof T} key key - * @param {T[keyof T]} value value - * @returns {undefined | T[keyof T]} replaced value + * @param {string} key key + * @param {ImportAttributes | string | boolean | undefined} value value + * @returns {ImportAttributes | string | boolean | undefined} replaced value */ const importAssertionReplacer = (key, value) => { if (key === "_isLegacyAssert") { @@ -229,17 +236,19 @@ const importAssertionReplacer = (key, value) => { }; /** - * @extends {InitFragment} + * @extends {InitFragment} */ class ModuleExternalInitFragment extends InitFragment { /** * @param {string} request import source + * @param {Imported} imported the imported specifiers * @param {string=} ident recomputed ident * @param {ImportDependencyMeta=} dependencyMeta the dependency meta * @param {HashFunction=} hashFunction the hash function to use */ constructor( request, + imported, ident, dependencyMeta, hashFunction = DEFAULTS.HASH_FUNCTION @@ -253,28 +262,78 @@ class ModuleExternalInitFragment extends InitFragment { .slice(0, 8)}`; } } + const identifier = `__WEBPACK_EXTERNAL_MODULE_${ident}__`; super( - `import * as ${identifier} from ${JSON.stringify(request)}${ - dependencyMeta && dependencyMeta.attributes - ? dependencyMeta.attributes._isLegacyAssert - ? ` assert ${JSON.stringify( - dependencyMeta.attributes, - importAssertionReplacer - )}` - : ` with ${JSON.stringify(dependencyMeta.attributes)}` - : "" - };\n`, + "", InitFragment.STAGE_HARMONY_IMPORTS, 0, - `external module import ${ident}` + `external module import ${ident} ${imported === true ? imported : imported.join(" ")}` ); this._ident = ident; this._request = request; - this._dependencyMeta = request; + this._dependencyMeta = dependencyMeta; + this._imported = imported; this._identifier = identifier; } + /** + * @returns {Imported} imported + */ + getImported() { + return this._imported; + } + + /** + * @param {Imported} imported imported + */ + setImported(imported) { + this._imported = imported; + } + + /** + * @param {GenerateContext} context context + * @returns {string | Source | undefined} the source code that will be included as initialization code + */ + getContent(context) { + const { + _dependencyMeta: dependencyMeta, + _imported: imported, + _request: request, + _identifier: identifier + } = this; + const attributes = + dependencyMeta && dependencyMeta.attributes + ? dependencyMeta.attributes._isLegacyAssert && + dependencyMeta.attributes._isLegacyAssert + ? ` assert ${JSON.stringify( + dependencyMeta.attributes, + importAssertionReplacer + )}` + : ` with ${JSON.stringify(dependencyMeta.attributes)}` + : ""; + let content = ""; + if (imported === true) { + // namespace + content = `import * as ${identifier} from ${JSON.stringify(request)}${ + attributes + };\n`; + } else if (imported.length === 0) { + // just import, no use + content = `import ${JSON.stringify(request)}${attributes};\n`; + } else { + content = `import { ${imported + .map(([name, finalName]) => { + if (name !== finalName) { + return `${name} as ${finalName}`; + } + return name; + }) + .join(", ")} } from ${JSON.stringify(request)}${attributes};\n`; + } + return content; + } + getNamespaceIdentifier() { return this._identifier; } @@ -287,11 +346,12 @@ register( { serialize(obj, { write }) { write(obj._request); + write(obj._imported); write(obj._ident); write(obj._dependencyMeta); }, deserialize({ read }) { - return new ModuleExternalInitFragment(read(), read(), read()); + return new ModuleExternalInitFragment(read(), read(), read(), read()); } } ); @@ -343,6 +403,7 @@ const generateModuleRemapping = ( * @param {RuntimeSpec} runtime the runtime * @param {RuntimeTemplate} runtimeTemplate the runtime template * @param {ImportDependencyMeta} dependencyMeta the dependency meta + * @param {ConcatenationScope=} concatenationScope concatenationScope * @returns {SourceData} the generated source */ const getSourceForModuleExternal = ( @@ -350,28 +411,71 @@ const getSourceForModuleExternal = ( exportsInfo, runtime, runtimeTemplate, - dependencyMeta + dependencyMeta, + concatenationScope ) => { if (!Array.isArray(moduleAndSpecifiers)) { moduleAndSpecifiers = [moduleAndSpecifiers]; } + + /** @type {Imported} */ + let imported = true; + if (concatenationScope) { + const usedExports = exportsInfo.getUsedExports(runtime); + switch (usedExports) { + case true: + case null: + // unknown exports + imported = true; + break; + case false: + // no used exports + imported = []; + break; + default: + imported = []; + if (exportsInfo.isUsed(runtime) === false) { + // no used, only + } + for (const [name] of usedExports.entries()) { + let counter = 0; + let finalName = name; + + if (concatenationScope) { + while (!concatenationScope.registerUsedName(finalName)) { + finalName = `${name}_${counter++}`; + } + } + imported.push([name, finalName]); + } + } + } + const initFragment = new ModuleExternalInitFragment( moduleAndSpecifiers[0], + imported, undefined, dependencyMeta, runtimeTemplate.outputOptions.hashFunction ); + const specifiers = imported === true ? undefined : imported; const baseAccess = `${initFragment.getNamespaceIdentifier()}${propertyAccess( moduleAndSpecifiers, 1 )}`; - const moduleRemapping = generateModuleRemapping( - baseAccess, - exportsInfo, - runtime, - runtimeTemplate - ); - const expression = moduleRemapping || baseAccess; + let expression = baseAccess; + + const useNamespace = imported === true; + let moduleRemapping; + if (useNamespace) { + moduleRemapping = generateModuleRemapping( + baseAccess, + exportsInfo, + runtime, + runtimeTemplate + ); + expression = moduleRemapping || baseAccess; + } return { expression, init: moduleRemapping @@ -383,10 +487,13 @@ const getSourceForModuleExternal = ( "x" )}` : undefined, + specifiers, runtimeRequirements: moduleRemapping ? RUNTIME_REQUIREMENTS_FOR_MODULE : undefined, - chunkInitFragments: [initFragment] + chunkInitFragments: [ + /** @type {InitFragment} */ (initFragment) + ] }; }; @@ -733,6 +840,7 @@ class ExternalModule extends Module { * @param {ChunkGraph} chunkGraph the chunk graph * @param {RuntimeSpec} runtime the runtime * @param {DependencyMeta | undefined} dependencyMeta the dependency meta + * @param {ConcatenationScope=} concatenationScope concatenationScope * @returns {SourceData} the source data */ _getSourceData( @@ -742,7 +850,8 @@ class ExternalModule extends Module { moduleGraph, chunkGraph, runtime, - dependencyMeta + dependencyMeta, + concatenationScope ) { switch (externalType) { case "this": @@ -761,13 +870,7 @@ class ExternalModule extends Module { return getSourceForCommonJsExternal(request); case "node-commonjs": return /** @type {BuildInfo} */ (this.buildInfo).javascriptModule - ? getSourceForCommonJsExternalInNodeModule( - request, - /** @type {string} */ - (runtimeTemplate.outputOptions.importMetaName), - /** @type {boolean} */ - (runtimeTemplate.supportNodePrefixForCoreModules()) - ) + ? getSourceForCommonJsExternalInNodeModule(request, runtimeTemplate) : getSourceForCommonJsExternal(request); case "amd": case "amd-require": @@ -818,7 +921,8 @@ class ExternalModule extends Module { moduleGraph.getExportsInfo(this), runtime, runtimeTemplate, - /** @type {ImportDependencyMeta} */ (dependencyMeta) + /** @type {ImportDependencyMeta} */ (dependencyMeta), + concatenationScope ); } case "var": @@ -898,14 +1002,24 @@ class ExternalModule extends Module { moduleGraph, chunkGraph, runtime, - this.dependencyMeta + this.dependencyMeta, + concatenationScope ); + // sourceString can be empty str only when there is concatenationScope let sourceString = sourceData.expression; if (sourceData.iife) { sourceString = `(function() { return ${sourceString}; }())`; } - if (concatenationScope) { + + const specifiers = sourceData.specifiers; + if (specifiers) { + sourceString = ""; + const scope = /** @type {ConcatenationScope} */ (concatenationScope); + for (const [specifier, finalName] of specifiers) { + scope.registerRawExport(specifier, finalName); + } + } else if (concatenationScope) { sourceString = `${ runtimeTemplate.supportsConst() ? "const" : "var" } ${ConcatenationScope.NAMESPACE_OBJECT_EXPORT} = ${sourceString};`; @@ -1011,3 +1125,4 @@ class ExternalModule extends Module { makeSerializable(ExternalModule, "webpack/lib/ExternalModule"); module.exports = ExternalModule; +module.exports.ModuleExternalInitFragment = ModuleExternalInitFragment; diff --git a/lib/ExternalModuleFactoryPlugin.js b/lib/ExternalModuleFactoryPlugin.js index 85b95b95d52..e011ae0e9eb 100644 --- a/lib/ExternalModuleFactoryPlugin.js +++ b/lib/ExternalModuleFactoryPlugin.js @@ -264,7 +264,7 @@ class ExternalModuleFactoryPlugin { request: dependency.request, dependencyType, contextInfo, - getResolve: options => (context, request, callback) => { + getResolve: (options) => (context, request, callback) => { const resolveContext = { fileDependencies: data.fileDependencies, missingDependencies: data.missingDependencies, @@ -307,7 +307,7 @@ class ExternalModuleFactoryPlugin { }, cb ); - if (promise && promise.then) promise.then(r => cb(null, r), cb); + if (promise && promise.then) promise.then((r) => cb(null, r), cb); } return; } else if (typeof externals === "object") { diff --git a/lib/ExternalsPlugin.js b/lib/ExternalsPlugin.js index 87b692e7fed..b713357ec3c 100644 --- a/lib/ExternalsPlugin.js +++ b/lib/ExternalsPlugin.js @@ -5,10 +5,13 @@ "use strict"; +const { ModuleExternalInitFragment } = require("./ExternalModule"); const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin"); +const ConcatenatedModule = require("./optimize/ConcatenatedModule"); /** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ /** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./optimize/ConcatenatedModule").ConcatenatedModuleInfo} ConcatenatedModuleInfo */ const PLUGIN_NAME = "ExternalsPlugin"; @@ -33,6 +36,48 @@ class ExternalsPlugin { normalModuleFactory ); }); + + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { + const { concatenatedModuleInfo } = + ConcatenatedModule.getCompilationHooks(compilation); + concatenatedModuleInfo.tap(PLUGIN_NAME, (updatedInfo, moduleInfo) => { + const rawExportMap = + /** @type {ConcatenatedModuleInfo} */ updatedInfo.rawExportMap; + + if (!rawExportMap) { + return; + } + + const chunkInitFragments = + /** @type {ConcatenatedModuleInfo} */ moduleInfo.chunkInitFragments; + const moduleExternalInitFragments = chunkInitFragments + ? chunkInitFragments.filter( + (fragment) => fragment instanceof ModuleExternalInitFragment + ) + : []; + + let initFragmentChanged = false; + + for (const fragment of moduleExternalInitFragments) { + const imported = fragment.getImported(); + + if (Array.isArray(imported)) { + const newImported = imported.map(([specifier, finalName]) => [ + specifier, + rawExportMap.has(specifier) + ? rawExportMap.get(specifier) + : finalName + ]); + fragment.setImported(newImported); + initFragmentChanged = true; + } + } + + if (initFragmentChanged) { + return true; + } + }); + }); } } diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index f295078b67b..8ae2f7ffc20 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -15,6 +15,7 @@ const StackedCacheMap = require("./util/StackedCacheMap"); const createHash = require("./util/createHash"); const { dirname, join, lstatReadlinkAbsolute, relative } = require("./util/fs"); const makeSerializable = require("./util/makeSerializable"); +const memoize = require("./util/memoize"); const processAsyncTree = require("./util/processAsyncTree"); /** @typedef {import("enhanced-resolve").Resolver} Resolver */ @@ -550,7 +551,7 @@ class Snapshot { */ getFileIterable() { if (this._cachedFileIterable === undefined) { - this._cachedFileIterable = this._createIterable(s => [ + this._cachedFileIterable = this._createIterable((s) => [ s.fileTimestamps, s.fileHashes, s.fileTshs, @@ -565,7 +566,7 @@ class Snapshot { */ getContextIterable() { if (this._cachedContextIterable === undefined) { - this._cachedContextIterable = this._createIterable(s => [ + this._cachedContextIterable = this._createIterable((s) => [ s.contextTimestamps, s.contextHashes, s.contextTshs, @@ -580,7 +581,7 @@ class Snapshot { */ getMissingIterable() { if (this._cachedMissingIterable === undefined) { - this._cachedMissingIterable = this._createIterable(s => [ + this._cachedMissingIterable = this._createIterable((s) => [ s.missingExistence, s.managedMissing ]); @@ -661,7 +662,7 @@ class SnapshotOptimization { * @param {SnapshotOptimizationEntry} entry optimization entry * @returns {void} */ - const increaseSharedAndStoreOptimizationEntry = entry => { + const increaseSharedAndStoreOptimizationEntry = (entry) => { if (entry.children !== undefined) { for (const child of entry.children) { increaseSharedAndStoreOptimizationEntry(child); @@ -674,7 +675,7 @@ class SnapshotOptimization { * @param {SnapshotOptimizationEntry} entry optimization entry * @returns {void} */ - const storeOptimizationEntry = entry => { + const storeOptimizationEntry = (entry) => { for (const path of /** @type {SnapshotContent} */ ( entry.snapshotContent )) { @@ -872,7 +873,7 @@ class SnapshotOptimization { * @param {string} str input * @returns {string} result */ -const parseString = str => { +const parseString = (str) => { if (str[0] === "'" || str[0] === "`") { str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`; } @@ -883,7 +884,7 @@ const parseString = str => { /** * @param {number} mtime mtime */ -const applyMtime = mtime => { +const applyMtime = (mtime) => { if (FS_ACCURACY > 1 && mtime % 2 !== 0) FS_ACCURACY = 1; else if (FS_ACCURACY > 10 && mtime % 20 !== 0) FS_ACCURACY = 10; else if (FS_ACCURACY > 100 && mtime % 200 !== 0) FS_ACCURACY = 100; @@ -1014,7 +1015,7 @@ const getManagedItem = (managedPath, path) => { * @param {T | null} entry entry * @returns {T["resolved"] | null | undefined} the resolved entry */ -const getResolvedTimestamp = entry => { +const getResolvedTimestamp = (entry) => { if (entry === null) return null; if (entry.resolved !== undefined) return entry.resolved; return entry.symlinks === undefined ? entry : undefined; @@ -1024,7 +1025,7 @@ const getResolvedTimestamp = entry => { * @param {ContextHash | null} entry entry * @returns {string | null | undefined} the resolved entry */ -const getResolvedHash = entry => { +const getResolvedHash = (entry) => { if (entry === null) return null; if (entry.resolved !== undefined) return entry.resolved; return entry.symlinks === undefined ? entry.hash : undefined; @@ -1039,6 +1040,8 @@ const addAll = (source, target) => { for (const key of source) target.add(key); }; +const getEsModuleLexer = memoize(() => require("es-module-lexer")); + /** @typedef {Set} LoggedPaths */ /** @typedef {FileSystemInfoEntry | "ignore" | null} FileTimestamp */ @@ -1079,66 +1082,66 @@ class FileSystemInfo { /** @type {WeakMap} */ this._snapshotCache = new WeakMap(); this._fileTimestampsOptimization = new SnapshotOptimization( - s => s.hasFileTimestamps(), - s => s.fileTimestamps, + (s) => s.hasFileTimestamps(), + (s) => s.fileTimestamps, (s, v) => s.setFileTimestamps(v) ); this._fileHashesOptimization = new SnapshotOptimization( - s => s.hasFileHashes(), - s => s.fileHashes, + (s) => s.hasFileHashes(), + (s) => s.fileHashes, (s, v) => s.setFileHashes(v), false ); this._fileTshsOptimization = new SnapshotOptimization( - s => s.hasFileTshs(), - s => s.fileTshs, + (s) => s.hasFileTshs(), + (s) => s.fileTshs, (s, v) => s.setFileTshs(v) ); this._contextTimestampsOptimization = new SnapshotOptimization( - s => s.hasContextTimestamps(), - s => s.contextTimestamps, + (s) => s.hasContextTimestamps(), + (s) => s.contextTimestamps, (s, v) => s.setContextTimestamps(v) ); this._contextHashesOptimization = new SnapshotOptimization( - s => s.hasContextHashes(), - s => s.contextHashes, + (s) => s.hasContextHashes(), + (s) => s.contextHashes, (s, v) => s.setContextHashes(v), false ); this._contextTshsOptimization = new SnapshotOptimization( - s => s.hasContextTshs(), - s => s.contextTshs, + (s) => s.hasContextTshs(), + (s) => s.contextTshs, (s, v) => s.setContextTshs(v) ); this._missingExistenceOptimization = new SnapshotOptimization( - s => s.hasMissingExistence(), - s => s.missingExistence, + (s) => s.hasMissingExistence(), + (s) => s.missingExistence, (s, v) => s.setMissingExistence(v), false ); this._managedItemInfoOptimization = new SnapshotOptimization( - s => s.hasManagedItemInfo(), - s => s.managedItemInfo, + (s) => s.hasManagedItemInfo(), + (s) => s.managedItemInfo, (s, v) => s.setManagedItemInfo(v), false ); this._managedFilesOptimization = new SnapshotOptimization( - s => s.hasManagedFiles(), - s => s.managedFiles, + (s) => s.hasManagedFiles(), + (s) => s.managedFiles, (s, v) => s.setManagedFiles(v), false, true ); this._managedContextsOptimization = new SnapshotOptimization( - s => s.hasManagedContexts(), - s => s.managedContexts, + (s) => s.hasManagedContexts(), + (s) => s.managedContexts, (s, v) => s.setManagedContexts(v), false, true ); this._managedMissingOptimization = new SnapshotOptimization( - s => s.hasManagedMissing(), - s => s.managedMissing, + (s) => s.hasManagedMissing(), + (s) => s.managedMissing, (s, v) => s.setManagedMissing(v), false, true @@ -1202,32 +1205,32 @@ class FileSystemInfo { const _unmanagedPaths = [...unmanagedPaths]; this.unmanagedPathsWithSlash = /** @type {string[]} */ - (_unmanagedPaths.filter(p => typeof p === "string")).map(p => + (_unmanagedPaths.filter((p) => typeof p === "string")).map((p) => join(fs, p, "_").slice(0, -1) ); this.unmanagedPathsRegExps = /** @type {RegExp[]} */ - (_unmanagedPaths.filter(p => typeof p !== "string")); + (_unmanagedPaths.filter((p) => typeof p !== "string")); this.managedPaths = [...managedPaths]; this.managedPathsWithSlash = /** @type {string[]} */ - (this.managedPaths.filter(p => typeof p === "string")).map(p => + (this.managedPaths.filter((p) => typeof p === "string")).map((p) => join(fs, p, "_").slice(0, -1) ); this.managedPathsRegExps = /** @type {RegExp[]} */ - (this.managedPaths.filter(p => typeof p !== "string")); + (this.managedPaths.filter((p) => typeof p !== "string")); this.immutablePaths = [...immutablePaths]; this.immutablePathsWithSlash = /** @type {string[]} */ - (this.immutablePaths.filter(p => typeof p === "string")).map(p => + (this.immutablePaths.filter((p) => typeof p === "string")).map((p) => join(fs, p, "_").slice(0, -1) ); this.immutablePathsRegExps = /** @type {RegExp[]} */ - (this.immutablePaths.filter(p => typeof p !== "string")); + (this.immutablePaths.filter((p) => typeof p !== "string")); this._cachedDeprecatedFileTimestamps = undefined; this._cachedDeprecatedContextTimestamps = undefined; @@ -1605,7 +1608,7 @@ class FileSystemInfo { * @param {undefined | boolean | string} expected expected result * @returns {string} expected result */ - const expectedToString = expected => + const expectedToString = (expected) => expected ? ` (expected ${expected})` : ""; /** @typedef {{ type: JobType, context: string | undefined, path: string, issuer: Job | undefined, expected: undefined | boolean | string }} Job */ @@ -1613,7 +1616,7 @@ class FileSystemInfo { * @param {Job} job job * @returns {`resolve commonjs file ${string}${string}`|`resolve esm file ${string}${string}`|`resolve esm ${string}${string}`|`resolve directory ${string}`|`file ${string}`|`unknown ${string} ${string}`|`resolve commonjs ${string}${string}`|`directory ${string}`|`file dependencies ${string}`|`directory dependencies ${string}`} result */ - const jobToString = job => { + const jobToString = (job) => { switch (job.type) { case RBDT_RESOLVE_CJS: return `resolve commonjs ${job.path}${expectedToString( @@ -1646,7 +1649,7 @@ class FileSystemInfo { * @param {Job} job job * @returns {string} string value */ - const pathToString = job => { + const pathToString = (job) => { let result = ` at ${jobToString(job)}`; /** @type {Job | undefined} */ (job) = job.issuer; @@ -1660,7 +1663,7 @@ class FileSystemInfo { processAsyncTree( Array.from( deps, - dep => + (dep) => /** @type {Job} */ ({ type: RBDT_RESOLVE_CJS, context, @@ -1676,7 +1679,7 @@ class FileSystemInfo { * @param {string} path path * @returns {void} */ - const resolveDirectory = path => { + const resolveDirectory = (path) => { const key = `d\n${context}\n${path}`; if (resolveResults.has(key)) { return callback(); @@ -1935,7 +1938,7 @@ class FileSystemInfo { this._warnAboutExperimentalEsmTracking = true; } - const lexer = require("es-module-lexer"); + const lexer = getEsModuleLexer(); lexer.init.then(() => { this.fs.readFile(path, (err, content) => { @@ -2071,7 +2074,7 @@ class FileSystemInfo { } } }, - err => { + (err) => { if (err) return callback(err); for (const l of fileSymlinks) files.delete(l); for (const l of directorySymlinks) directories.delete(l); @@ -2158,7 +2161,7 @@ class FileSystemInfo { * @param {Error | typeof INVALID=} err error or invalid flag * @returns {void} */ - err => { + (err) => { if (err === INVALID) { return callback(null, false); } @@ -2172,9 +2175,9 @@ class FileSystemInfo { /** * @param {number | null | undefined} startTime when processing the files has started - * @param {Iterable | null} files all files - * @param {Iterable | null} directories all directories - * @param {Iterable | null} missing all missing files or directories + * @param {Iterable | null | undefined} files all files + * @param {Iterable | null | undefined} directories all directories + * @param {Iterable | null | undefined} missing all missing files or directories * @param {SnapshotOptions | null | undefined} options options object (for future extensions) * @param {(err: WebpackError | null, snapshot: Snapshot | null) => void} callback callback function * @returns {void} @@ -2332,7 +2335,7 @@ class FileSystemInfo { /** * @param {ManagedFiles} capturedFiles captured files */ - const processCapturedFiles = capturedFiles => { + const processCapturedFiles = (capturedFiles) => { switch (mode) { case 3: this._fileTshsOptimization.optimize(snapshot, capturedFiles); @@ -2420,7 +2423,7 @@ class FileSystemInfo { /** * @param {ManagedContexts} capturedDirectories captured directories */ - const processCapturedDirectories = capturedDirectories => { + const processCapturedDirectories = (capturedDirectories) => { switch (mode) { case 3: this._contextTshsOptimization.optimize(snapshot, capturedDirectories); @@ -2565,7 +2568,7 @@ class FileSystemInfo { /** * @param {ManagedMissing} capturedMissing captured missing */ - const processCapturedMissing = capturedMissing => { + const processCapturedMissing = (capturedMissing) => { this._missingExistenceOptimization.optimize(snapshot, capturedMissing); for (const path of capturedMissing) { const cache = this._fileTimestamps.get(path); @@ -3345,7 +3348,7 @@ class FileSystemInfo { * @param {string} hash hash * @returns {void} */ - const continueWithHash = hash => { + const continueWithHash = (hash) => { const cache = this._fileTimestamps.get(path); if (cache !== undefined) { if (cache !== "ignore") { @@ -3421,8 +3424,8 @@ class FileSystemInfo { return callback(err); } const files = /** @type {string[]} */ (_files) - .map(file => file.normalize("NFC")) - .filter(file => !/^\./.test(file)) + .map((file) => file.normalize("NFC")) + .filter((file) => !/^\./.test(file)) .sort(); asyncLib.map( files, @@ -3510,7 +3513,7 @@ class FileSystemInfo { fromImmutablePath: () => /** @type {ContextFileSystemInfoEntry | FileSystemInfoEntry | "ignore" | null} */ (null), - fromManagedItem: info => ({ + fromManagedItem: (info) => ({ safeTime: 0, timestampHash: info }), @@ -3643,7 +3646,7 @@ class FileSystemInfo { callback(); }); }, - err => { + (err) => { if (err) return callback(/** @type {WebpackError} */ (err)); const hash = createHash(this._hashFunction); hash.update(/** @type {string} */ (entry.timestampHash)); @@ -3674,7 +3677,7 @@ class FileSystemInfo { { path, fromImmutablePath: () => /** @type {ContextHash | ""} */ (""), - fromManagedItem: info => info || "", + fromManagedItem: (info) => info || "", fromSymlink: (file, target, callback) => { callback( null, @@ -3759,7 +3762,7 @@ class FileSystemInfo { callback(); }); }, - err => { + (err) => { if (err) return callback(/** @type {WebpackError} */ (err)); const hash = createHash(this._hashFunction); hash.update(entry.hash); @@ -3817,7 +3820,7 @@ class FileSystemInfo { path, fromImmutablePath: () => /** @type {ContextTimestampAndHash | null} */ (null), - fromManagedItem: info => ({ + fromManagedItem: (info) => ({ safeTime: 0, timestampHash: info, hash: info || "" @@ -3937,7 +3940,7 @@ class FileSystemInfo { callback(); }); }, - err => { + (err) => { if (err) return callback(/** @type {WebpackError} */ (err)); const hash = createHash(this._hashFunction); const tsHash = createHash(this._hashFunction); @@ -3979,7 +3982,7 @@ class FileSystemInfo { return callback(/** @type {WebpackError} */ (err)); } const set = new Set( - /** @type {string[]} */ (elements).map(element => + /** @type {string[]} */ (elements).map((element) => join(this.fs, path, element) ) ); diff --git a/lib/FlagAllModulesAsUsedPlugin.js b/lib/FlagAllModulesAsUsedPlugin.js index eb3ee4cf43d..0f5969cac7a 100644 --- a/lib/FlagAllModulesAsUsedPlugin.js +++ b/lib/FlagAllModulesAsUsedPlugin.js @@ -26,9 +26,9 @@ class FlagAllModulesAsUsedPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const moduleGraph = compilation.moduleGraph; - compilation.hooks.optimizeDependencies.tap(PLUGIN_NAME, modules => { + compilation.hooks.optimizeDependencies.tap(PLUGIN_NAME, (modules) => { /** @type {RuntimeSpec} */ let runtime; for (const [name, { options }] of compilation.entries) { diff --git a/lib/FlagDependencyExportsPlugin.js b/lib/FlagDependencyExportsPlugin.js index abb93846c1d..b26e3b03faf 100644 --- a/lib/FlagDependencyExportsPlugin.js +++ b/lib/FlagDependencyExportsPlugin.js @@ -28,7 +28,7 @@ class FlagDependencyExportsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const moduleGraph = compilation.moduleGraph; const cache = compilation.getCache(PLUGIN_NAME); compilation.hooks.finishModules.tapAsync( @@ -103,7 +103,7 @@ class FlagDependencyExportsPlugin { } ); }, - err => { + (err) => { logger.timeEnd("restore cached provided exports"); if (err) return callback(err); @@ -129,7 +129,7 @@ class FlagDependencyExportsPlugin { * @param {DependenciesBlock} depBlock the dependencies block * @returns {void} */ - const processDependenciesBlock = depBlock => { + const processDependenciesBlock = (depBlock) => { for (const dep of depBlock.dependencies) { processDependency(dep); } @@ -142,7 +142,7 @@ class FlagDependencyExportsPlugin { * @param {Dependency} dep the dependency * @returns {void} */ - const processDependency = dep => { + const processDependency = (dep) => { const exportDesc = dep.getExports(moduleGraph); if (!exportDesc) return; exportsSpecsFromDependencies.set(dep, exportDesc); @@ -399,7 +399,7 @@ class FlagDependencyExportsPlugin { callback ); }, - err => { + (err) => { logger.timeEnd("store provided exports into cache"); callback(err); } @@ -411,13 +411,13 @@ class FlagDependencyExportsPlugin { /** @type {WeakMap} */ const providedExportsCache = new WeakMap(); - compilation.hooks.rebuildModule.tap(PLUGIN_NAME, module => { + compilation.hooks.rebuildModule.tap(PLUGIN_NAME, (module) => { providedExportsCache.set( module, moduleGraph.getExportsInfo(module).getRestoreProvidedData() ); }); - compilation.hooks.finishRebuildingModule.tap(PLUGIN_NAME, module => { + compilation.hooks.finishRebuildingModule.tap(PLUGIN_NAME, (module) => { moduleGraph.getExportsInfo(module).restoreProvided( /** @type {RestoreProvidedData} */ (providedExportsCache.get(module)) diff --git a/lib/FlagDependencyUsagePlugin.js b/lib/FlagDependencyUsagePlugin.js index bce1dbe403d..9f6e761f005 100644 --- a/lib/FlagDependencyUsagePlugin.js +++ b/lib/FlagDependencyUsagePlugin.js @@ -41,11 +41,11 @@ class FlagDependencyUsagePlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const moduleGraph = compilation.moduleGraph; compilation.hooks.optimizeDependencies.tap( { name: PLUGIN_NAME, stage: STAGE_DEFAULT }, - modules => { + (modules) => { if (compilation.moduleMemCaches) { throw new Error( "optimization.usedExports can't be used with cacheUnaffected as export usage is a global effect" @@ -108,7 +108,7 @@ class FlagDependencyUsagePlugin { if (nestedInfo) { if ( exportInfo.setUsedConditionally( - used => used === UsageState.Unused, + (used) => used === UsageState.Unused, UsageState.OnlyPropertiesUsed, runtime ) @@ -127,7 +127,7 @@ class FlagDependencyUsagePlugin { } if ( exportInfo.setUsedConditionally( - v => v !== UsageState.Used, + (v) => v !== UsageState.Used, UsageState.Used, runtime ) diff --git a/lib/FlagEntryExportAsUsedPlugin.js b/lib/FlagEntryExportAsUsedPlugin.js index d2826d12fb2..71e770d92ae 100644 --- a/lib/FlagEntryExportAsUsedPlugin.js +++ b/lib/FlagEntryExportAsUsedPlugin.js @@ -27,7 +27,7 @@ class FlagEntryExportAsUsedPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const moduleGraph = compilation.moduleGraph; compilation.hooks.seal.tap(PLUGIN_NAME, () => { for (const [ diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 9e63892ad81..9d8fd2d46bb 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -123,7 +123,7 @@ class HotModuleReplacementPlugin { const { hotAcceptCallback, hotAcceptWithoutCallback } = HotModuleReplacementPlugin.getParserHooks(parser); - return expr => { + return (expr) => { const module = parser.state.module; const dep = new ConstDependency( `${module.moduleArgument}.hot.accept`, @@ -145,7 +145,7 @@ class HotModuleReplacementPlugin { } else if (arg.isArray()) { params = /** @type {BasicEvaluatedExpression[]} */ - (arg.items).filter(param => param.isString()); + (arg.items).filter((param) => param.isString()); } /** @type {string[]} */ const requests = []; @@ -185,7 +185,7 @@ class HotModuleReplacementPlugin { * @param {typeof ModuleHotDeclineDependency} ParamDependency dependency * @returns {(expr: CallExpression) => boolean | undefined} callback */ - const createDeclineHandler = (parser, ParamDependency) => expr => { + const createDeclineHandler = (parser, ParamDependency) => (expr) => { const module = parser.state.module; const dep = new ConstDependency( `${module.moduleArgument}.hot.decline`, @@ -205,7 +205,7 @@ class HotModuleReplacementPlugin { } else if (arg.isArray()) { params = /** @type {BasicEvaluatedExpression[]} */ - (arg.items).filter(param => param.isString()); + (arg.items).filter((param) => param.isString()); } for (const [idx, param] of params.entries()) { const dep = new ParamDependency( @@ -225,7 +225,7 @@ class HotModuleReplacementPlugin { * @param {JavascriptParser} parser the parser * @returns {(expr: Expression) => boolean | undefined} callback */ - const createHMRExpressionHandler = parser => expr => { + const createHMRExpressionHandler = (parser) => (expr) => { const module = parser.state.module; const dep = new ConstDependency( `${module.moduleArgument}.hot`, @@ -243,13 +243,13 @@ class HotModuleReplacementPlugin { * @param {JavascriptParser} parser the parser * @returns {void} */ - const applyModuleHot = parser => { + const applyModuleHot = (parser) => { parser.hooks.evaluateIdentifier.for("module.hot").tap( { name: PLUGIN_NAME, before: "NodeStuffPlugin" }, - expr => + (expr) => evaluateToIdentifier( "module.hot", "module", @@ -278,10 +278,10 @@ class HotModuleReplacementPlugin { * @param {JavascriptParser} parser the parser * @returns {void} */ - const applyImportMetaHot = parser => { + const applyImportMetaHot = (parser) => { parser.hooks.evaluateIdentifier .for("import.meta.webpackHot") - .tap(PLUGIN_NAME, expr => + .tap(PLUGIN_NAME, (expr) => evaluateToIdentifier( "import.meta.webpackHot", "import.meta", @@ -381,7 +381,7 @@ class HotModuleReplacementPlugin { chunk, compareModulesById(chunkGraph) ), - m => /** @type {ModuleId} */ (chunkGraph.getModuleId(m)) + (m) => /** @type {ModuleId} */ (chunkGraph.getModuleId(m)) ); } }); @@ -391,7 +391,7 @@ class HotModuleReplacementPlugin { const fullHashModules = new TupleSet(); /** @type {TupleSet} */ const nonCodeGeneratedModules = new TupleSet(); - compilation.hooks.fullHash.tap(PLUGIN_NAME, hash => { + compilation.hooks.fullHash.tap(PLUGIN_NAME, (hash) => { const chunkGraph = compilation.chunkGraph; const records = /** @type {Records} */ (compilation.records); for (const chunk of compilation.chunks) { @@ -399,7 +399,7 @@ class HotModuleReplacementPlugin { * @param {Module} module module * @returns {string} module hash */ - const getModuleHash = module => { + const getModuleHash = (module) => { if ( compilation.codeGenerationResults.has(module, chunk.runtime) ) { @@ -524,7 +524,7 @@ class HotModuleReplacementPlugin { const runtime = keyToRuntime(chunkRuntime[key]); allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime); } - forEachRuntime(allOldRuntime, runtime => { + forEachRuntime(allOldRuntime, (runtime) => { const { path: filename, info: assetInfo } = compilation.getPathWithInfo( /** @type {NonNullable} */ @@ -588,7 +588,7 @@ class HotModuleReplacementPlugin { let removedFromRuntime; const currentChunk = find( compilation.chunks, - chunk => `${chunk.id}` === key + (chunk) => `${chunk.id}` === key ); if (currentChunk) { chunkId = currentChunk.id; @@ -599,22 +599,22 @@ class HotModuleReplacementPlugin { if (newRuntime === undefined) continue; newModules = chunkGraph .getChunkModules(currentChunk) - .filter(module => updatedModules.has(module, currentChunk)); + .filter((module) => updatedModules.has(module, currentChunk)); newRuntimeModules = [ ...chunkGraph.getChunkRuntimeModulesIterable(currentChunk) - ].filter(module => updatedModules.has(module, currentChunk)); + ].filter((module) => updatedModules.has(module, currentChunk)); const fullHashModules = chunkGraph.getChunkFullHashModulesIterable(currentChunk); newFullHashModules = fullHashModules && - [...fullHashModules].filter(module => + [...fullHashModules].filter((module) => updatedModules.has(module, currentChunk) ); const dependentHashModules = chunkGraph.getChunkDependentHashModulesIterable(currentChunk); newDependentHashModules = dependentHashModules && - [...dependentHashModules].filter(module => + [...dependentHashModules].filter((module) => updatedModules.has(module, currentChunk) ); removedFromRuntime = subtractRuntime(oldRuntime, newRuntime); @@ -626,7 +626,7 @@ class HotModuleReplacementPlugin { } if (removedFromRuntime) { // chunk was removed from some runtimes - forEachRuntime(removedFromRuntime, runtime => { + forEachRuntime(removedFromRuntime, (runtime) => { const item = /** @type {HotUpdateMainContentByRuntimeItem} */ ( @@ -665,7 +665,7 @@ class HotModuleReplacementPlugin { // module is no longer in this runtime combination // We (incorrectly) assume that it's not in an overlapping runtime combination // and dispose it from the main runtimes the chunk was removed from - forEachRuntime(removedFromRuntime, runtime => { + forEachRuntime(removedFromRuntime, (runtime) => { // If the module is still used in this runtime, do not dispose it // This could create a bad runtime state where the module is still loaded, // but no chunk which contains it. This means we don't receive further HMR updates @@ -764,7 +764,7 @@ class HotModuleReplacementPlugin { compilation.hooks.chunkAsset.call(currentChunk, filename); } } - forEachRuntime(newRuntime, runtime => { + forEachRuntime(newRuntime, (runtime) => { const item = /** @type {HotUpdateMainContentByRuntimeItem} */ ( hotUpdateMainContentByRuntime.get( @@ -829,7 +829,7 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename ...completelyRemovedModulesArray, ...Array.from( removedModules, - m => + (m) => /** @type {ModuleId} */ (chunkGraph.getModuleId(m)) ) ] @@ -863,28 +863,28 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename normalModuleFactory.hooks.parser .for(JAVASCRIPT_MODULE_TYPE_AUTO) - .tap(PLUGIN_NAME, parser => { + .tap(PLUGIN_NAME, (parser) => { applyModuleHot(parser); applyImportMetaHot(parser); }); normalModuleFactory.hooks.parser .for(JAVASCRIPT_MODULE_TYPE_DYNAMIC) - .tap(PLUGIN_NAME, parser => { + .tap(PLUGIN_NAME, (parser) => { applyModuleHot(parser); }); normalModuleFactory.hooks.parser .for(JAVASCRIPT_MODULE_TYPE_ESM) - .tap(PLUGIN_NAME, parser => { + .tap(PLUGIN_NAME, (parser) => { applyImportMetaHot(parser); }); - normalModuleFactory.hooks.module.tap(PLUGIN_NAME, module => { + normalModuleFactory.hooks.module.tap(PLUGIN_NAME, (module) => { module.hot = true; return module; }); NormalModule.getCompilationHooks(compilation).loader.tap( PLUGIN_NAME, - context => { + (context) => { context.hot = true; } ); diff --git a/lib/IgnorePlugin.js b/lib/IgnorePlugin.js index 004aa8d8c9e..310af5ee2f1 100644 --- a/lib/IgnorePlugin.js +++ b/lib/IgnorePlugin.js @@ -71,8 +71,8 @@ class IgnorePlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, nmf => { - nmf.hooks.beforeResolve.tap(PLUGIN_NAME, resolveData => { + compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, (nmf) => { + nmf.hooks.beforeResolve.tap(PLUGIN_NAME, (resolveData) => { const result = this.checkIgnore(resolveData); if ( @@ -93,7 +93,7 @@ class IgnorePlugin { return result; }); }); - compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => { + compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, (cmf) => { cmf.hooks.beforeResolve.tap(PLUGIN_NAME, this.checkIgnore); }); } diff --git a/lib/IgnoreWarningsPlugin.js b/lib/IgnoreWarningsPlugin.js index 5518b648dd7..de5fd35e23b 100644 --- a/lib/IgnoreWarningsPlugin.js +++ b/lib/IgnoreWarningsPlugin.js @@ -24,11 +24,11 @@ class IgnoreWarningsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { - compilation.hooks.processWarnings.tap(PLUGIN_NAME, warnings => + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { + compilation.hooks.processWarnings.tap(PLUGIN_NAME, (warnings) => warnings.filter( - warning => - !this._ignoreWarnings.some(ignore => ignore(warning, compilation)) + (warning) => + !this._ignoreWarnings.some((ignore) => ignore(warning, compilation)) ) ); }); diff --git a/lib/InitFragment.js b/lib/InitFragment.js index 228f592a4ff..e06f8e906b6 100644 --- a/lib/InitFragment.js +++ b/lib/InitFragment.js @@ -173,6 +173,12 @@ makeSerializable(InitFragment, "webpack/lib/InitFragment"); InitFragment.prototype.merge = /** @type {TODO} */ (undefined); +InitFragment.prototype.getImported = + /** @type {TODO} */ + (undefined); +InitFragment.prototype.setImported = + /** @type {TODO} */ + (undefined); InitFragment.STAGE_CONSTANTS = 10; InitFragment.STAGE_ASYNC_BOUNDARY = 20; diff --git a/lib/InvalidDependenciesModuleWarning.js b/lib/InvalidDependenciesModuleWarning.js index b77d991b379..7fb7d3c6c4a 100644 --- a/lib/InvalidDependenciesModuleWarning.js +++ b/lib/InvalidDependenciesModuleWarning.js @@ -18,7 +18,7 @@ class InvalidDependenciesModuleWarning extends WebpackError { */ constructor(module, deps) { const orderedDeps = deps ? [...deps].sort() : []; - const depsList = orderedDeps.map(dep => ` * ${JSON.stringify(dep)}`); + const depsList = orderedDeps.map((dep) => ` * ${JSON.stringify(dep)}`); super(`Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths. Invalid dependencies may lead to broken watching and caching. As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior. diff --git a/lib/JavascriptMetaInfoPlugin.js b/lib/JavascriptMetaInfoPlugin.js index 35fcb68c14a..e3d9ffa8b90 100644 --- a/lib/JavascriptMetaInfoPlugin.js +++ b/lib/JavascriptMetaInfoPlugin.js @@ -32,7 +32,7 @@ class JavascriptMetaInfoPlugin { * @param {JavascriptParser} parser the parser * @returns {void} */ - const handler = parser => { + const handler = (parser) => { parser.hooks.call.for("eval").tap(PLUGIN_NAME, () => { const buildInfo = /** @type {BuildInfo} */ diff --git a/lib/LibManifestPlugin.js b/lib/LibManifestPlugin.js index b364564dd34..4d6a1e8e1ef 100644 --- a/lib/LibManifestPlugin.js +++ b/lib/LibManifestPlugin.js @@ -86,7 +86,7 @@ class LibManifestPlugin { this.options.entryOnly && !someInIterable( moduleGraph.getIncomingConnections(module), - c => c.dependency instanceof EntryDependency + (c) => c.dependency instanceof EntryDependency ) ) { continue; @@ -129,7 +129,7 @@ class LibManifestPlugin { mkdirp( intermediateFileSystem, dirname(intermediateFileSystem, targetPath), - err => { + (err) => { if (err) return callback(err); intermediateFileSystem.writeFile(targetPath, buffer, callback); } diff --git a/lib/LoaderOptionsPlugin.js b/lib/LoaderOptionsPlugin.js index 2d5ae88479a..4c803f92e9f 100644 --- a/lib/LoaderOptionsPlugin.js +++ b/lib/LoaderOptionsPlugin.js @@ -59,7 +59,7 @@ class LoaderOptionsPlugin { */ apply(compiler) { const options = this.options; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { NormalModule.getCompilationHooks(compilation).loader.tap( PLUGIN_NAME, (context, module) => { diff --git a/lib/LoaderTargetPlugin.js b/lib/LoaderTargetPlugin.js index e6ea9810db6..8f3664122c3 100644 --- a/lib/LoaderTargetPlugin.js +++ b/lib/LoaderTargetPlugin.js @@ -25,10 +25,10 @@ class LoaderTargetPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { NormalModule.getCompilationHooks(compilation).loader.tap( PLUGIN_NAME, - loaderContext => { + (loaderContext) => { loaderContext.target = this.target; } ); diff --git a/lib/MainTemplate.js b/lib/MainTemplate.js index 599f4fe1c16..a793b1a8319 100644 --- a/lib/MainTemplate.js +++ b/lib/MainTemplate.js @@ -323,7 +323,7 @@ class MainTemplate { /** * @param {PathData} options context data * @returns {string} interpolated path - */ options => + */ (options) => compilation.getAssetPath( /** @type {string} */ (compilation.outputOptions.publicPath), diff --git a/lib/Module.js b/lib/Module.js index 9e325a2507e..899b26a84b4 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -775,7 +775,7 @@ class Module extends DependenciesBlock { fromModule, connections ] of moduleGraph.getIncomingConnectionsByOriginModule(this)) { - if (!connections.some(c => c.isTargetActive(chunk.runtime))) continue; + if (!connections.some((c) => c.isTargetActive(chunk.runtime))) continue; for (const originChunk of chunkGraph.getModuleChunksIterable( /** @type {Module} */ (fromModule) )) { diff --git a/lib/ModuleFilenameHelpers.js b/lib/ModuleFilenameHelpers.js index 0abb1220e9a..0ef302e1337 100644 --- a/lib/ModuleFilenameHelpers.js +++ b/lib/ModuleFilenameHelpers.js @@ -96,13 +96,13 @@ const getHash = * @param {Record T>} obj the object to convert to a lazy access object * @returns {T} the lazy access object */ -const lazyObject = obj => { +const lazyObject = (obj) => { const newObj = /** @type {T} */ ({}); for (const key of Object.keys(obj)) { const fn = obj[key]; Object.defineProperty(newObj, key, { get: () => fn(), - set: v => { + set: (v) => { Object.defineProperty(newObj, key, { value: v, enumerable: true, @@ -320,7 +320,7 @@ ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => { const matchPart = (str, test) => { if (!test) return true; if (Array.isArray(test)) { - return test.some(test => matchPart(str, test)); + return test.some((test) => matchPart(str, test)); } if (typeof test === "string") { return str.startsWith(test); diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js index 554bbde0493..20bf162c142 100644 --- a/lib/ModuleGraph.js +++ b/lib/ModuleGraph.js @@ -11,6 +11,7 @@ const ModuleGraphConnection = require("./ModuleGraphConnection"); const SortableSet = require("./util/SortableSet"); const WeakTupleMap = require("./util/WeakTupleMap"); const { sortWithSourceOrder } = require("./util/comparators"); +const memoize = require("./util/memoize"); /** @typedef {import("./Compilation").ModuleMemCaches} ModuleMemCaches */ /** @typedef {import("./DependenciesBlock")} DependenciesBlock */ @@ -24,6 +25,10 @@ const { sortWithSourceOrder } = require("./util/comparators"); /** @typedef {import("./dependencies/HarmonyImportSpecifierDependency")} HarmonyImportSpecifierDependency */ /** @typedef {import("./util/comparators").DependencySourceOrder} DependencySourceOrder */ +const getCommonJsSelfReferenceDependency = memoize(() => + require("./dependencies/CommonJsSelfReferenceDependency") +); + /** * @callback OptimizationBailoutFunction * @param {RequestShortener} requestShortener @@ -36,7 +41,7 @@ const EMPTY_SET = new Set(); * @param {SortableSet} set input * @returns {readonly Map} mapped by origin module */ -const getConnectionsByOriginModule = set => { +const getConnectionsByOriginModule = (set) => { const map = new Map(); /** @type {Module | 0} */ let lastModule = 0; @@ -67,7 +72,7 @@ const getConnectionsByOriginModule = set => { * @param {SortableSet} set input * @returns {readonly Map} mapped by module */ -const getConnectionsByModule = set => { +const getConnectionsByModule = (set) => { const map = new Map(); /** @type {Module | 0} */ let lastModule = 0; @@ -840,8 +845,7 @@ class ModuleGraph { for (const connection of connections) { if ( !connection.dependency || - connection.dependency instanceof - require("./dependencies/CommonJsSelfReferenceDependency") + connection.dependency instanceof getCommonJsSelfReferenceDependency() ) { continue; } @@ -956,7 +960,7 @@ class ModuleGraph { * @param {Module} module the module * @returns {ModuleGraph} the module graph */ - module => { + (module) => { const moduleGraph = moduleGraphForModuleMap.get(module); if (!moduleGraph) { throw new Error( diff --git a/lib/ModuleInfoHeaderPlugin.js b/lib/ModuleInfoHeaderPlugin.js index 58ad847d3f1..5aecdb2ca62 100644 --- a/lib/ModuleInfoHeaderPlugin.js +++ b/lib/ModuleInfoHeaderPlugin.js @@ -26,7 +26,7 @@ const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin"); * @param {Iterable} iterable iterable * @returns {string} joined with comma */ -const joinIterableWithComma = iterable => { +const joinIterableWithComma = (iterable) => { // This is more performant than Array.from().join(", ") // as it doesn't create an array let str = ""; @@ -94,7 +94,7 @@ const printExportsInfoToSource = ( ? ` -> ${target.module.readableIdentifier(requestShortener)}${ target.export ? ` .${target.export - .map(e => JSON.stringify(e).slice(1, -1)) + .map((e) => JSON.stringify(e).slice(1, -1)) .join(".")}` : "" }` @@ -165,7 +165,7 @@ class ModuleInfoHeaderPlugin { */ apply(compiler) { const { _verbose: verbose } = this; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const javascriptHooks = JavascriptModulesPlugin.getCompilationHooks(compilation); javascriptHooks.renderModulePackage.tap( diff --git a/lib/ModuleParseError.js b/lib/ModuleParseError.js index dae44e05839..54774bb579a 100644 --- a/lib/ModuleParseError.js +++ b/lib/ModuleParseError.js @@ -43,7 +43,7 @@ class ModuleParseError extends WebpackError { "\nYou may need an appropriate loader to handle this file type."; } else if (loaders.length >= 1) { message += `\nFile was processed with these loaders:${loaders - .map(loader => `\n * ${loader}`) + .map((loader) => `\n * ${loader}`) .join("")}`; message += "\nYou may need an additional loader to handle the result of these loaders."; @@ -75,8 +75,10 @@ class ModuleParseError extends WebpackError { const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2); message += `${linesBefore - .map(l => `\n| ${l}`) - .join("")}\n> ${theLine}${linesAfter.map(l => `\n| ${l}`).join("")}`; + .map((l) => `\n| ${l}`) + .join( + "" + )}\n> ${theLine}${linesAfter.map((l) => `\n| ${l}`).join("")}`; } loc = { start: err.loc }; diff --git a/lib/MultiCompiler.js b/lib/MultiCompiler.js index 6e0c4e9f0e0..3ab64e4affc 100644 --- a/lib/MultiCompiler.js +++ b/lib/MultiCompiler.js @@ -16,6 +16,7 @@ const ArrayQueue = require("./util/ArrayQueue"); /** @template T @typedef {import("tapable").AsyncSeriesHook} AsyncSeriesHook */ /** @template T @template R @typedef {import("tapable").SyncBailHook} SyncBailHook */ +/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ /** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */ /** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Stats")} Stats */ @@ -44,6 +45,8 @@ const ArrayQueue = require("./util/ArrayQueue"); * @property {number=} parallelism how many Compilers are allows to run at the same time in parallel */ +/** @typedef {ReadonlyArray & MultiCompilerOptions} MultiWebpackOptions */ + const CLASS_NAME = "MultiCompiler"; module.exports = class MultiCompiler { @@ -54,7 +57,7 @@ module.exports = class MultiCompiler { constructor(compilers, options) { if (!Array.isArray(compilers)) { /** @type {Compiler[]} */ - compilers = Object.keys(compilers).map(name => { + compilers = Object.keys(compilers).map((name) => { /** @type {Record} */ (compilers)[name].name = name; return /** @type {Record} */ (compilers)[name]; @@ -65,16 +68,16 @@ module.exports = class MultiCompiler { /** @type {SyncHook<[MultiStats]>} */ done: new SyncHook(["stats"]), /** @type {MultiHook>} */ - invalid: new MultiHook(compilers.map(c => c.hooks.invalid)), + invalid: new MultiHook(compilers.map((c) => c.hooks.invalid)), /** @type {MultiHook>} */ - run: new MultiHook(compilers.map(c => c.hooks.run)), + run: new MultiHook(compilers.map((c) => c.hooks.run)), /** @type {SyncHook<[]>} */ watchClose: new SyncHook([]), /** @type {MultiHook>} */ - watchRun: new MultiHook(compilers.map(c => c.hooks.watchRun)), + watchRun: new MultiHook(compilers.map((c) => c.hooks.watchRun)), /** @type {MultiHook>} */ infrastructureLog: new MultiHook( - compilers.map(c => c.hooks.infrastructureLog) + compilers.map((c) => c.hooks.infrastructureLog) ) }); this.compilers = compilers; @@ -94,7 +97,7 @@ module.exports = class MultiCompiler { const compilerIndex = index; let compilerDone = false; // eslint-disable-next-line no-loop-func - compiler.hooks.done.tap(CLASS_NAME, stats => { + compiler.hooks.done.tap(CLASS_NAME, (stats) => { if (!compilerDone) { compilerDone = true; doneCompilers++; @@ -124,7 +127,7 @@ module.exports = class MultiCompiler { * @param {WebpackError} warning warning */ const addWarning = (compiler, warning) => { - compiler.hooks.thisCompilation.tap(CLASS_NAME, compilation => { + compiler.hooks.thisCompilation.tap(CLASS_NAME, (compilation) => { compilation.warnings.push(warning); }); }; @@ -152,7 +155,7 @@ module.exports = class MultiCompiler { get options() { return Object.assign( - this.compilers.map(c => c.options), + this.compilers.map((c) => c.options), this._options ); } @@ -254,7 +257,7 @@ module.exports = class MultiCompiler { * @param {Compiler} compiler compiler * @returns {boolean} target was found */ - const targetFound = compiler => { + const targetFound = (compiler) => { for (const edge of edges) { if (edge.target === compiler) { return true; @@ -276,7 +279,7 @@ module.exports = class MultiCompiler { const dependencies = this.dependencies.get(source); if (dependencies) { for (const dep of dependencies) { - const target = this.compilers.find(c => c.name === dep); + const target = this.compilers.find((c) => c.name === dep); if (!target) { missing.push(dep); } else { @@ -289,8 +292,10 @@ module.exports = class MultiCompiler { } } /** @type {string[]} */ - const errors = missing.map(m => `Compiler dependency \`${m}\` not found.`); - const stack = this.compilers.filter(c => !targetFound(c)); + const errors = missing.map( + (m) => `Compiler dependency \`${m}\` not found.` + ); + const stack = this.compilers.filter((c) => !targetFound(c)); while (stack.length > 0) { const current = stack.pop(); for (const edge of edges) { @@ -307,7 +312,7 @@ module.exports = class MultiCompiler { /** @type {string[]} */ const lines = [...edges] .sort(sortEdges) - .map(edge => `${edge.source.name} -> ${edge.target.name}`); + .map((edge) => `${edge.source.name} -> ${edge.target.name}`); lines.unshift("Circular dependency found in compiler dependencies."); errors.unshift(lines.join("\n")); } @@ -334,7 +339,7 @@ module.exports = class MultiCompiler { * @param {string} d dependency * @returns {boolean} when dependency was fulfilled */ - const isDependencyFulfilled = d => fulfilledNames.has(d); + const isDependencyFulfilled = (d) => fulfilledNames.has(d); /** * @returns {Compiler[]} compilers */ @@ -358,12 +363,12 @@ module.exports = class MultiCompiler { * @param {Callback} callback callback * @returns {void} */ - const runCompilers = callback => { + const runCompilers = (callback) => { if (remainingCompilers.length === 0) return callback(null); asyncLib.map( getReadyCompilers(), (compiler, callback) => { - fn(compiler, err => { + fn(compiler, (err) => { if (err) return callback(err); fulfilledNames.add(compiler.name); runCompilers(callback); @@ -400,7 +405,7 @@ module.exports = class MultiCompiler { // running-outdated -> blocked [running--] (when compilation is done) /** @type {Node[]} */ - const nodes = this.compilers.map(compiler => ({ + const nodes = this.compilers.map((compiler) => ({ compiler, setupResult: undefined, result: undefined, @@ -472,7 +477,7 @@ module.exports = class MultiCompiler { * @param {Node} node node * @returns {void} */ - const nodeInvalidFromParent = node => { + const nodeInvalidFromParent = (node) => { if (node.state === "done") { node.state = "blocked"; } else if (node.state === "running") { @@ -486,7 +491,7 @@ module.exports = class MultiCompiler { * @param {Node} node node * @returns {void} */ - const nodeInvalid = node => { + const nodeInvalid = (node) => { if (node.state === "done") { node.state = "pending"; } else if (node.state === "running") { @@ -500,7 +505,7 @@ module.exports = class MultiCompiler { * @param {Node} node node * @returns {void} */ - const nodeChange = node => { + const nodeChange = (node) => { nodeInvalid(node); if (node.state === "pending") { node.state = "blocked"; @@ -538,7 +543,7 @@ module.exports = class MultiCompiler { if ( node.state === "queued" || (node.state === "blocked" && - node.parents.every(p => p.state === "done")) + node.parents.every((p) => p.state === "done")) ) { running++; node.state = "starting"; @@ -554,7 +559,7 @@ module.exports = class MultiCompiler { if ( !errored && running === 0 && - nodes.every(node => node.state === "done") + nodes.every((node) => node.state === "done") ) { const stats = []; for (const node of nodes) { @@ -574,7 +579,7 @@ module.exports = class MultiCompiler { } /** - * @param {WatchOptions|WatchOptions[]} watchOptions the watcher's options + * @param {WatchOptions | WatchOptions[]} watchOptions the watcher's options * @param {Callback} handler signals when the call finishes * @returns {MultiWatching} a compiler watcher */ @@ -653,7 +658,7 @@ module.exports = class MultiCompiler { (compiler, callback) => { compiler.close(callback); }, - error => { + (error) => { callback(error); } ); diff --git a/lib/MultiStats.js b/lib/MultiStats.js index 73ab807942f..62504ab8234 100644 --- a/lib/MultiStats.js +++ b/lib/MultiStats.js @@ -25,6 +25,8 @@ const indent = (str, prefix) => { return prefix + rem; }; +/** @typedef {undefined | string | boolean | StatsOptions} ChildrenStatsOptions */ +/** @typedef {Omit & { children?: ChildrenStatsOptions | ChildrenStatsOptions[] }} MultiStatsOptions */ /** @typedef {{ version: boolean, hash: boolean, errorsCount: boolean, warningsCount: boolean, errors: boolean, warnings: boolean, children: NormalizedStatsOptions[] }} ChildOptions */ class MultiStats { @@ -36,25 +38,25 @@ class MultiStats { } get hash() { - return this.stats.map(stat => stat.hash).join(""); + return this.stats.map((stat) => stat.hash).join(""); } /** * @returns {boolean} true if a child compilation encountered an error */ hasErrors() { - return this.stats.some(stat => stat.hasErrors()); + return this.stats.some((stat) => stat.hasErrors()); } /** * @returns {boolean} true if a child compilation had a warning */ hasWarnings() { - return this.stats.some(stat => stat.hasWarnings()); + return this.stats.some((stat) => stat.hasWarnings()); } /** - * @param {string | boolean | StatsOptions | undefined} options stats options + * @param {undefined | string | boolean | MultiStatsOptions} options stats options * @param {CreateStatsOptionsContext} context context * @returns {ChildOptions} context context */ @@ -80,6 +82,9 @@ class MultiStats { const childOptions = Array.isArray(childrenOptions) ? childrenOptions[idx] : childrenOptions; + if (typeof childOptions === "boolean") { + return stat.compilation.createStatsOptions(childOptions, context); + } return stat.compilation.createStatsOptions( { ...baseOptions, @@ -93,18 +98,18 @@ class MultiStats { ); }); return { - version: children.every(o => o.version), - hash: children.every(o => o.hash), - errorsCount: children.every(o => o.errorsCount), - warningsCount: children.every(o => o.warningsCount), - errors: children.every(o => o.errors), - warnings: children.every(o => o.warnings), + version: children.every((o) => o.version), + hash: children.every((o) => o.hash), + errorsCount: children.every((o) => o.errorsCount), + warningsCount: children.every((o) => o.warningsCount), + errors: children.every((o) => o.errors), + warnings: children.every((o) => o.warnings), children }; } /** - * @param {(string | boolean | StatsOptions)=} options stats options + * @param {(string | boolean | MultiStatsOptions)=} options stats options * @returns {StatsCompilation} json output */ toJson(options) { @@ -130,7 +135,7 @@ class MultiStats { obj.version = obj.children[0].version; } if (childOptions.hash) { - obj.hash = obj.children.map(j => j.hash).join(""); + obj.hash = obj.children.map((j) => j.hash).join(""); } /** * @param {StatsCompilation} j stats error @@ -179,7 +184,7 @@ class MultiStats { } /** - * @param {(string | boolean | StatsOptions)=} options stats options + * @param {(string | boolean | MultiStatsOptions)=} options stats options * @returns {string} string output */ toString(options) { diff --git a/lib/MultiWatching.js b/lib/MultiWatching.js index cfe95f17b28..448ac96206a 100644 --- a/lib/MultiWatching.js +++ b/lib/MultiWatching.js @@ -67,7 +67,7 @@ class MultiWatching { (watching, finishedCallback) => { watching.close(finishedCallback); }, - err => { + (err) => { this.compiler.hooks.watchClose.call(); if (typeof callback === "function") { this.compiler.running = false; diff --git a/lib/NoEmitOnErrorsPlugin.js b/lib/NoEmitOnErrorsPlugin.js index dfcde930954..f0a7f00332f 100644 --- a/lib/NoEmitOnErrorsPlugin.js +++ b/lib/NoEmitOnErrorsPlugin.js @@ -16,10 +16,10 @@ class NoEmitOnErrorsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.shouldEmit.tap(PLUGIN_NAME, compilation => { + compiler.hooks.shouldEmit.tap(PLUGIN_NAME, (compilation) => { if (compilation.getStats().hasErrors()) return false; }); - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.shouldRecord.tap(PLUGIN_NAME, () => { if (compilation.getStats().hasErrors()) return false; }); diff --git a/lib/NodeStuffPlugin.js b/lib/NodeStuffPlugin.js index 87a5cd61405..6cd44b8d53f 100644 --- a/lib/NodeStuffPlugin.js +++ b/lib/NodeStuffPlugin.js @@ -74,7 +74,7 @@ class NodeStuffPlugin { if (localOptions.global !== false) { const withWarning = localOptions.global === "warn"; - parser.hooks.expression.for("global").tap(PLUGIN_NAME, expr => { + parser.hooks.expression.for("global").tap(PLUGIN_NAME, (expr) => { const dep = new ConstDependency( RuntimeGlobals.global, /** @type {Range} */ (expr.range), @@ -94,7 +94,7 @@ class NodeStuffPlugin { ); } }); - parser.hooks.rename.for("global").tap(PLUGIN_NAME, expr => { + parser.hooks.rename.for("global").tap(PLUGIN_NAME, (expr) => { const dep = new ConstDependency( RuntimeGlobals.global, /** @type {Range} */ (expr.range), @@ -115,10 +115,11 @@ class NodeStuffPlugin { const setModuleConstant = (expressionName, fn, warning) => { parser.hooks.expression .for(expressionName) - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { const dep = new CachedConstDependency( JSON.stringify(fn(parser.state.module)), - /** @type {Range} */ (expr.range), + /** @type {Range} */ + (expr.range), expressionName ); dep.loc = /** @type {DependencyLocation} */ (expr.loc); @@ -143,7 +144,7 @@ class NodeStuffPlugin { const setUrlModuleConstant = (expressionName, fn) => { parser.hooks.expression .for(expressionName) - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { const dep = new ExternalModuleDependency( "url", [ @@ -186,14 +187,19 @@ class NodeStuffPlugin { "__filename is a Node.js feature and isn't available in browsers." ); break; - case "node-module": + case "node-module": { + const importMetaName = + /** @type {string} */ + (compilation.outputOptions.importMetaName); + setUrlModuleConstant( "__filename", - functionName => `${functionName}(import.meta.url)` + (functionName) => `${functionName}(${importMetaName}.url)` ); break; + } case true: - setModuleConstant("__filename", module => + setModuleConstant("__filename", (module) => relative( /** @type {InputFileSystem} */ (compiler.inputFileSystem), context, @@ -205,7 +211,7 @@ class NodeStuffPlugin { parser.hooks.evaluateIdentifier .for("__filename") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { if (!parser.state.module) return; const resource = parseResource(parser.state.module.resource); return evaluateToString(resource.path)(expr); @@ -223,15 +229,20 @@ class NodeStuffPlugin { "__dirname is a Node.js feature and isn't available in browsers." ); break; - case "node-module": + case "node-module": { + const importMetaName = + /** @type {string} */ + (compilation.outputOptions.importMetaName); + setUrlModuleConstant( "__dirname", - functionName => - `${functionName}(import.meta.url + "/..").slice(0, -1)` + (functionName) => + `${functionName}(${importMetaName}.url + "/..").slice(0, -1)` ); break; + } case true: - setModuleConstant("__dirname", module => + setModuleConstant("__dirname", (module) => relative( /** @type {InputFileSystem} */ (compiler.inputFileSystem), context, @@ -243,10 +254,11 @@ class NodeStuffPlugin { parser.hooks.evaluateIdentifier .for("__dirname") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { if (!parser.state.module) return; return evaluateToString( - /** @type {string} */ (parser.state.module.context) + /** @type {string} */ + (parser.state.module.context) )(expr); }); } diff --git a/lib/NormalModule.js b/lib/NormalModule.js index 20ff21b3b74..f9d4c2d95de 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -163,17 +163,17 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { const { sourceRoot } = sourceMap; /** @type {(source: string) => string} */ const mapper = !sourceRoot - ? source => source + ? (source) => source : sourceRoot.endsWith("/") - ? source => + ? (source) => source.startsWith("/") ? `${sourceRoot.slice(0, -1)}${source}` : `${sourceRoot}${source}` - : source => + : (source) => source.startsWith("/") ? `${sourceRoot}${source}` : `${sourceRoot}/${source}`; - const newSources = sourceMap.sources.map(source => + const newSources = sourceMap.sources.map((source) => contextifySourceUrl(context, mapper(source), associatedObjectForCache) ); return { @@ -188,7 +188,7 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { * @param {string | Buffer} input the input * @returns {string} the converted string */ -const asString = input => { +const asString = (input) => { if (Buffer.isBuffer(input)) { return input.toString("utf8"); } @@ -199,7 +199,7 @@ const asString = input => { * @param {string | Buffer} input the input * @returns {Buffer} the converted buffer */ -const asBuffer = input => { +const asBuffer = (input) => { if (!Buffer.isBuffer(input)) { return Buffer.from(input, "utf8"); } @@ -279,14 +279,14 @@ class NormalModule extends Module { beforeParse: new SyncHook(["module"]), beforeSnapshot: new SyncHook(["module"]), // TODO webpack 6 deprecate - readResourceForScheme: new HookMap(scheme => { + readResourceForScheme: new HookMap((scheme) => { const hook = /** @type {NormalModuleCompilationHooks} */ (hooks).readResource.for(scheme); return createFakeHook( /** @type {AsyncSeriesBailHook<[string, NormalModule], string | Buffer | null>} */ ({ tap: (options, fn) => - hook.tap(options, loaderContext => + hook.tap(options, (loaderContext) => fn( loaderContext.resource, /** @type {NormalModule} */ (loaderContext._module) @@ -301,7 +301,7 @@ class NormalModule extends Module { ) ), tapPromise: (options, fn) => - hook.tapPromise(options, loaderContext => + hook.tapPromise(options, (loaderContext) => fn( loaderContext.resource, /** @type {NormalModule} */ (loaderContext._module) @@ -599,19 +599,19 @@ class NormalModule extends Module { */ const getResolveContext = () => ({ fileDependencies: { - add: d => + add: (d) => /** @type {LoaderContext} */ ( loaderContext ).addDependency(d) }, contextDependencies: { - add: d => + add: (d) => /** @type {LoaderContext} */ ( loaderContext ).addContextDependency(d) }, missingDependencies: { - add: d => + add: (d) => /** @type {LoaderContext} */ ( loaderContext ).addMissingDependency(d) @@ -660,7 +660,7 @@ class NormalModule extends Module { * @param {HashFunction=} type type * @returns {Hash} hash */ - createHash: type => + createHash: (type) => createHash( type || /** @type {HashFunction} */ @@ -674,7 +674,7 @@ class NormalModule extends Module { * @param {import("../declarations/LoaderContext").Schema=} schema schema * @returns {T} options */ - getOptions: schema => { + getOptions: (schema) => { const loader = this.getCurrentLoader( /** @type {LoaderContext} */ (loaderContext) ); @@ -716,7 +716,7 @@ class NormalModule extends Module { return /** @type {T} */ (options); }, - emitWarning: warning => { + emitWarning: (warning) => { if (!(warning instanceof Error)) { warning = new NonErrorEmittedError(warning); } @@ -726,7 +726,7 @@ class NormalModule extends Module { }) ); }, - emitError: error => { + emitError: (error) => { if (!(error instanceof Error)) { error = new NonErrorEmittedError(error); } @@ -736,7 +736,7 @@ class NormalModule extends Module { }) ); }, - getLogger: name => { + getLogger: (name) => { const currentLoader = this.getCurrentLoader( /** @type {LoaderContext} */ (loaderContext) ); @@ -802,7 +802,7 @@ class NormalModule extends Module { ); assetsInfo.set(name, assetInfo); }, - addBuildDependency: dep => { + addBuildDependency: (dep) => { const buildInfo = /** @type {BuildInfo} */ (this.buildInfo); if (buildInfo.buildDependencies === undefined) { @@ -1190,7 +1190,7 @@ class NormalModule extends Module { const hooks = NormalModule.getCompilationHooks(compilation); - return this._doBuild(options, compilation, resolver, fs, hooks, err => { + return this._doBuild(options, compilation, resolver, fs, hooks, (err) => { // if we have an error mark module as failed and exit if (err) { this.markModuleAsErrored(err); @@ -1202,9 +1202,9 @@ class NormalModule extends Module { * @param {Error} e error * @returns {void} */ - const handleParseError = e => { + const handleParseError = (e) => { const source = /** @type {Source} */ (this._source).source(); - const loaders = this.loaders.map(item => + const loaders = this.loaders.map((item) => contextify( /** @type {string} */ (options.context), item.loader, @@ -1220,7 +1220,7 @@ class NormalModule extends Module { const handleParseResult = () => { this.dependencies.sort( concatComparators( - compareSelect(a => a.loc, compareLocations), + compareSelect((a) => a.loc, compareLocations), keepOriginalOrder(this.dependencies) ) ); @@ -1252,7 +1252,7 @@ class NormalModule extends Module { /** * @param {LazySet} deps deps */ - const checkDependencies = deps => { + const checkDependencies = (deps) => { for (const dep of deps) { if (!ABSOLUTE_PATH_REGEX.test(dep)) { if (nonAbsoluteDependencies === undefined) { diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js index c585ace432a..93dc8129b58 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -124,7 +124,7 @@ const LEADING_DOT_EXTENSION_REGEX = /^[^.]/; * @param {LoaderItem} data data * @returns {string} ident */ -const loaderToIdent = data => { +const loaderToIdent = (data) => { if (!data.options) { return data.loader; } @@ -158,7 +158,7 @@ const stringifyLoadersAndResource = (loaders, resource) => { * @param {(err?: null | Error) => void} callback callback * @returns {(err?: null | Error) => void} callback */ -const needCalls = (times, callback) => err => { +const needCalls = (times, callback) => (err) => { if (--times === 0) { return callback(err); } @@ -204,7 +204,7 @@ const mergeGlobalOptions = (globalOptions, type, localOptions) => { * @returns {string} result */ const deprecationChangedHookMessage = (name, hook) => { - const names = hook.taps.map(tapped => tapped.name).join(", "); + const names = hook.taps.map((tapped) => tapped.name).join(", "); return ( `NormalModuleFactory.${name} (${names}) is no longer a waterfall hook, but a bailing hook instead. ` + @@ -227,7 +227,7 @@ const ruleSetCompiler = new RuleSetCompiler([ new BasicMatcherRulePlugin("issuer"), new BasicMatcherRulePlugin("compiler"), new BasicMatcherRulePlugin("issuerLayer"), - new ObjectMatcherRulePlugin("assert", "assertions", value => { + new ObjectMatcherRulePlugin("assert", "assertions", (value) => { if (value) { return ( /** @type {ImportAttributes} */ (value)._isLegacyAssert !== undefined @@ -236,7 +236,7 @@ const ruleSetCompiler = new RuleSetCompiler([ return false; }), - new ObjectMatcherRulePlugin("with", "assertions", value => { + new ObjectMatcherRulePlugin("with", "assertions", (value) => { if (value) { return !(/** @type {ImportAttributes} */ (value)._isLegacyAssert); } @@ -498,7 +498,7 @@ class NormalModuleFactory extends ModuleFactory { ) .split(/!+/); unresolvedResource = /** @type {string} */ (rawElements.pop()); - elements = rawElements.map(el => { + elements = rawElements.map((el) => { const { path, query } = cachedParseResourceWithoutFragment(el); return { loader: path, @@ -528,7 +528,7 @@ class NormalModuleFactory extends ModuleFactory { /** @type {undefined | LoaderItem[]} */ let loaders; - const continueCallback = needCalls(2, err => { + const continueCallback = needCalls(2, (err) => { if (err) return callback(err); // translate option idents @@ -656,7 +656,7 @@ class NormalModuleFactory extends ModuleFactory { /** @type {undefined | LoaderItem[]} */ let preLoaders; - const continueCallback = needCalls(3, err => { + const continueCallback = needCalls(3, (err) => { if (err) { return callback(err); } @@ -775,7 +775,7 @@ class NormalModuleFactory extends ModuleFactory { /** * @param {string} context context */ - const defaultResolve = context => { + const defaultResolve = (context) => { if (/^($|\?)/.test(unresolvedResource)) { resourceData = { ...cacheParseResource(unresolvedResource), @@ -835,7 +835,7 @@ class NormalModuleFactory extends ModuleFactory { }; this.hooks.resolveForScheme .for(scheme) - .callAsync(resourceData, data, err => { + .callAsync(resourceData, data, (err) => { if (err) return continueCallback(err); continueCallback(); }); @@ -1016,13 +1016,15 @@ ${hints.join("\n\n")}`; // Check if the extension is missing a leading dot (e.g. "js" instead of ".js") let appendResolveExtensionsHint = false; const specifiedExtensions = [...resolver.options.extensions]; - const expectedExtensions = specifiedExtensions.map(extension => { - if (LEADING_DOT_EXTENSION_REGEX.test(extension)) { - appendResolveExtensionsHint = true; - return `.${extension}`; + const expectedExtensions = specifiedExtensions.map( + (extension) => { + if (LEADING_DOT_EXTENSION_REGEX.test(extension)) { + appendResolveExtensionsHint = true; + return `.${extension}`; + } + return extension; } - return extension; - }); + ); if (appendResolveExtensionsHint) { err.message += `\nDid you miss the leading dot in 'resolve.extensions'? Did you mean '${JSON.stringify( expectedExtensions @@ -1059,7 +1061,7 @@ ${hints.join("\n\n")}`; ) { asyncLib.parallel( [ - callback => { + (callback) => { if (!resolver.options.fullySpecified) return callback(); resolver .withOptions({ @@ -1089,7 +1091,7 @@ Add the extension to the request.` } ); }, - callback => { + (callback) => { if (!resolver.options.enforceExtension) return callback(); resolver .withOptions({ @@ -1128,7 +1130,7 @@ Including the extension in the request is no longer possible. Did you mean to en } ); }, - callback => { + (callback) => { if ( /^\.\.?\//.test(unresolvedResource) || resolver.options.preferRelative @@ -1143,7 +1145,7 @@ Including the extension in the request is no longer possible. Did you mean to en (err, resolvedResource) => { if (err || !resolvedResource) return callback(); const moduleDirectories = resolver.options.modules - .map(m => (Array.isArray(m) ? m.join(", ") : m)) + .map((m) => (Array.isArray(m) ? m.join(", ") : m)) .join(", "); callback( null, @@ -1201,7 +1203,7 @@ If changing the source code is not an option there is also a resolve options cal context, `${item.loader}-loader`, resolveContext, - err2 => { + (err2) => { if (!err2) { err.message = `${err.message}\n` + diff --git a/lib/NormalModuleReplacementPlugin.js b/lib/NormalModuleReplacementPlugin.js index 80206f26ac0..aa7eea7d6a2 100644 --- a/lib/NormalModuleReplacementPlugin.js +++ b/lib/NormalModuleReplacementPlugin.js @@ -34,8 +34,8 @@ class NormalModuleReplacementPlugin { apply(compiler) { const resourceRegExp = this.resourceRegExp; const newResource = this.newResource; - compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, nmf => { - nmf.hooks.beforeResolve.tap(PLUGIN_NAME, result => { + compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, (nmf) => { + nmf.hooks.beforeResolve.tap(PLUGIN_NAME, (result) => { if (resourceRegExp.test(result.request)) { if (typeof newResource === "function") { newResource(result); @@ -44,7 +44,7 @@ class NormalModuleReplacementPlugin { } } }); - nmf.hooks.afterResolve.tap(PLUGIN_NAME, result => { + nmf.hooks.afterResolve.tap(PLUGIN_NAME, (result) => { const createData = result.createData; if (resourceRegExp.test(/** @type {string} */ (createData.resource))) { if (typeof newResource === "function") { diff --git a/lib/PrefetchPlugin.js b/lib/PrefetchPlugin.js index ce5d802ef5d..52cf9647bb1 100644 --- a/lib/PrefetchPlugin.js +++ b/lib/PrefetchPlugin.js @@ -45,7 +45,7 @@ class PrefetchPlugin { compilation.addModuleChain( this.context || compiler.context, new PrefetchDependency(this.request), - err => { + (err) => { callback(err); } ); diff --git a/lib/ProgressPlugin.js b/lib/ProgressPlugin.js index 65d6dacd173..9577f93a81f 100644 --- a/lib/ProgressPlugin.js +++ b/lib/ProgressPlugin.js @@ -74,7 +74,7 @@ const createDefaultHandler = (profile, logger) => { lastStateInfo.length = 0; } const fullState = [msg, ...args]; - const state = fullState.map(s => s.replace(/\d+\/\d+ /g, "")); + const state = fullState.map((s) => s.replace(/\d+\/\d+ /g, "")); const now = Date.now(); const len = Math.max(state.length, lastStateInfo.length); for (let i = len; i >= 0; i--) { @@ -354,7 +354,7 @@ class ProgressPlugin { /** * @param {Module} module the module */ - const moduleBuild = module => { + const moduleBuild = (module) => { const ident = module.identifier(); if (ident) { activeModules.add(ident); @@ -375,7 +375,7 @@ class ProgressPlugin { /** * @param {Module} module the module */ - const moduleDone = module => { + const moduleDone = (module) => { doneModules++; if (showActiveModules) { const ident = module.identifier(); @@ -411,7 +411,7 @@ class ProgressPlugin { compiler.hooks.beforeCompile.tap(PLUGIN_NAME, () => { if (!cacheGetPromise) { cacheGetPromise = cache.getPromise().then( - data => { + (data) => { if (data) { lastModulesCount = lastModulesCount || data.modulesCount; lastDependenciesCount = @@ -419,17 +419,17 @@ class ProgressPlugin { } return data; }, - _err => { + (_err) => { // Ignore error } ); } }); - compiler.hooks.afterCompile.tapPromise(PLUGIN_NAME, compilation => { + compiler.hooks.afterCompile.tapPromise(PLUGIN_NAME, (compilation) => { if (compilation.compiler.isChild()) return Promise.resolve(); return /** @type {Promise} */ (cacheGetPromise).then( - async oldData => { + async (oldData) => { const realModulesCount = modulesCount - skippedModulesCount; const realDependenciesCount = dependenciesCount - skippedDependenciesCount; @@ -448,7 +448,7 @@ class ProgressPlugin { ); }); - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { if (compilation.compiler.isChild()) return; lastModulesCount = modulesCount; lastEntriesCount = entriesCount; @@ -461,12 +461,12 @@ class ProgressPlugin { 0; doneModules = doneDependencies = doneEntries = 0; - compilation.factorizeQueue.hooks.added.tap(PLUGIN_NAME, item => + compilation.factorizeQueue.hooks.added.tap(PLUGIN_NAME, (item) => factorizeAdd(compilation.factorizeQueue, item) ); compilation.factorizeQueue.hooks.result.tap(PLUGIN_NAME, factorizeDone); - compilation.addModuleQueue.hooks.added.tap(PLUGIN_NAME, item => + compilation.addModuleQueue.hooks.added.tap(PLUGIN_NAME, (item) => moduleAdd(compilation.addModuleQueue, item) ); compilation.processDependenciesQueue.hooks.result.tap( @@ -487,7 +487,7 @@ class ProgressPlugin { const requiredLoaders = new Set(); NormalModule.getCompilationHooks(compilation).beforeLoaders.tap( PLUGIN_NAME, - loaders => { + (loaders) => { for (const loader of loaders) { if ( loader.type !== "module" && diff --git a/lib/ProvidePlugin.js b/lib/ProvidePlugin.js index dbf98a69a41..898bd0d0847 100644 --- a/lib/ProvidePlugin.js +++ b/lib/ProvidePlugin.js @@ -74,7 +74,7 @@ class ProvidePlugin { } } - parser.hooks.expression.for(name).tap(PLUGIN_NAME, expr => { + parser.hooks.expression.for(name).tap(PLUGIN_NAME, (expr) => { const nameIdentifier = name.includes(".") ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` : name; @@ -89,7 +89,7 @@ class ProvidePlugin { return true; }); - parser.hooks.call.for(name).tap(PLUGIN_NAME, expr => { + parser.hooks.call.for(name).tap(PLUGIN_NAME, (expr) => { const nameIdentifier = name.includes(".") ? `__webpack_provided_${name.replace(/\./g, "_dot_")}` : name; diff --git a/lib/RecordIdsPlugin.js b/lib/RecordIdsPlugin.js index f3e11443905..fa7cb8ce2db 100644 --- a/lib/RecordIdsPlugin.js +++ b/lib/RecordIdsPlugin.js @@ -63,14 +63,14 @@ class RecordIdsPlugin { * @param {Module} module the module * @returns {string} the (portable) identifier */ - const getModuleIdentifier = module => { + const getModuleIdentifier = (module) => { if (portableIds) { return makePathsRelative(module.identifier()); } return module.identifier(); }; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.recordModules.tap(PLUGIN_NAME, (modules, records) => { const chunkGraph = compilation.chunkGraph; if (!records.modules) records.modules = {}; @@ -112,7 +112,7 @@ class RecordIdsPlugin { * @param {Chunk} chunk the chunk * @returns {string[]} sources of the chunk */ - const getChunkSources = chunk => { + const getChunkSources = (chunk) => { /** @type {string[]} */ const sources = []; for (const chunkGroup of chunk.groupsIterable) { diff --git a/lib/ResolverFactory.js b/lib/ResolverFactory.js index 61bb42ebd89..697fdee5c16 100644 --- a/lib/ResolverFactory.js +++ b/lib/ResolverFactory.js @@ -36,7 +36,7 @@ const EMPTY_RESOLVE_OPTIONS = {}; * @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType enhanced options * @returns {ResolveOptions} merged options */ -const convertToResolveOptions = resolveOptionsWithDepType => { +const convertToResolveOptions = (resolveOptionsWithDepType) => { const { dependencyType, plugins, ...remaining } = resolveOptionsWithDepType; // check type compat @@ -46,7 +46,7 @@ const convertToResolveOptions = resolveOptionsWithDepType => { plugins: plugins && /** @type {ResolvePluginInstance[]} */ ( - plugins.filter(item => item !== "...") + plugins.filter((item) => item !== "...") ) }; @@ -142,7 +142,7 @@ module.exports = class ResolverFactory { } /** @type {WeakMap, ResolverWithOptions>} */ const childCache = new WeakMap(); - resolver.withOptions = options => { + resolver.withOptions = (options) => { const cacheEntry = childCache.get(options); if (cacheEntry !== undefined) return cacheEntry; const mergedOptions = cachedCleverMerge(originalResolveOptions, options); diff --git a/lib/RuntimeGlobals.js b/lib/RuntimeGlobals.js index 753d6891ea4..26178a0e5df 100644 --- a/lib/RuntimeGlobals.js +++ b/lib/RuntimeGlobals.js @@ -109,6 +109,26 @@ module.exports.ensureChunkIncludeEntries = */ module.exports.entryModuleId = "__webpack_require__.s"; +/** + * esm module id + */ +module.exports.esmId = "__webpack_esm_id__"; + +/** + * esm module ids + */ +module.exports.esmIds = "__webpack_esm_ids__"; + +/** + * esm modules + */ +module.exports.esmModules = "__webpack_esm_modules__"; + +/** + * esm runtime + */ +module.exports.esmRuntime = "__webpack_esm_runtime__"; + /** * the internal exports object */ diff --git a/lib/RuntimePlugin.js b/lib/RuntimePlugin.js index d4eeb5b86da..6e9e30959bb 100644 --- a/lib/RuntimePlugin.js +++ b/lib/RuntimePlugin.js @@ -118,13 +118,13 @@ class RuntimePlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const globalChunkLoading = compilation.outputOptions.chunkLoading; /** * @param {Chunk} chunk chunk * @returns {boolean} true, when chunk loading is disabled for the chunk */ - const isChunkLoadingDisabledForChunk = chunk => { + const isChunkLoadingDisabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const chunkLoading = options && options.chunkLoading !== undefined @@ -168,7 +168,7 @@ class RuntimePlugin { } compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.definePropertyGetters) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { compilation.addRuntimeModule( chunk, new DefinePropertyGettersRuntimeModule() @@ -177,7 +177,7 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.makeNamespaceObject) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { compilation.addRuntimeModule( chunk, new MakeNamespaceObjectRuntimeModule() @@ -186,7 +186,7 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.createFakeNamespaceObject) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { compilation.addRuntimeModule( chunk, new CreateFakeNamespaceObjectRuntimeModule() @@ -206,7 +206,7 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.hasOwnProperty) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { compilation.addRuntimeModule( chunk, new HasOwnPropertyRuntimeModule() @@ -215,7 +215,7 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.compatGetDefaultExport) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { compilation.addRuntimeModule( chunk, new CompatGetDefaultExportRuntimeModule() @@ -224,7 +224,7 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.runtimeId) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { compilation.addRuntimeModule(chunk, new RuntimeIdRuntimeModule()); return true; }); @@ -259,13 +259,13 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.global) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { compilation.addRuntimeModule(chunk, new GlobalRuntimeModule()); return true; }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.asyncModule) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { const experiments = compilation.options.experiments; compilation.addRuntimeModule( chunk, @@ -275,7 +275,7 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.systemContext) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { const entryOptions = chunk.getEntryOptions(); const libraryType = entryOptions && entryOptions.library !== undefined @@ -308,7 +308,7 @@ class RuntimePlugin { "javascript", "javascript", RuntimeGlobals.getChunkScriptFilename, - chunk => + (chunk) => getJavascriptModulesPlugin().chunkHasJs(chunk, chunkGraph) && /** @type {TemplatePath} */ ( chunk.filenameTemplate || @@ -338,7 +338,7 @@ class RuntimePlugin { "css", "css", RuntimeGlobals.getChunkCssFilename, - chunk => + (chunk) => getCssModulesPlugin().chunkHasCss(chunk, chunkGraph) && getChunkFilenameTemplate(chunk, compilation.outputOptions), set.has(RuntimeGlobals.hmrDownloadUpdateHandlers) @@ -363,7 +363,7 @@ class RuntimePlugin { "javascript", "javascript update", RuntimeGlobals.getChunkUpdateScriptFilename, - _chunk => + (_chunk) => /** @type {NonNullable} */ (compilation.outputOptions.hotUpdateChunkFilename), true @@ -480,7 +480,7 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.baseURI) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { if (isChunkLoadingDisabledForChunk(chunk)) { compilation.addRuntimeModule(chunk, new BaseUriRuntimeModule()); return true; @@ -488,7 +488,7 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.scriptNonce) - .tap(PLUGIN_NAME, chunk => { + .tap(PLUGIN_NAME, (chunk) => { compilation.addRuntimeModule(chunk, new NonceRuntimeModule()); return true; }); diff --git a/lib/RuntimeTemplate.js b/lib/RuntimeTemplate.js index ac1b2d358b3..bc5c4cf9015 100644 --- a/lib/RuntimeTemplate.js +++ b/lib/RuntimeTemplate.js @@ -49,12 +49,12 @@ This should not happen. It's in these chunks: ${ Array.from( chunkGraph.getModuleChunksIterable(module), - c => c.name || c.id || c.debugId + (c) => c.name || c.id || c.debugId ).join(", ") || "none" } (If module is in no chunk this indicates a bug in some chunk/module optimization logic) Module has these incoming connections: ${Array.from( chunkGraph.moduleGraph.getIncomingConnections(module), - connection => + (connection) => `\n - ${ connection.originModule && connection.originModule.identifier() } ${connection.dependency && connection.dependency.type} ${ @@ -162,6 +162,16 @@ class RuntimeTemplate { return this.outputOptions.environment.nodePrefixForCoreModules; } + /** + * @param {string} mod a module + * @returns {string} a module with `node:` prefix when supported, otherwise an original name + */ + renderNodePrefixForCoreModule(mod) { + return this.outputOptions.environment.nodePrefixForCoreModules + ? `"node:${mod}"` + : `"${mod}"`; + } + /** * @param {string} returnValue return value * @param {string} args arguments @@ -229,7 +239,7 @@ class RuntimeTemplate { if (concatenationCost <= templateCost) return this._es5Concatenation(args); return `\`${args - .map(arg => (typeof arg === "string" ? arg : `\${${arg.expr}}`)) + .map((arg) => (typeof arg === "string" ? arg : `\${${arg.expr}}`)) .join("")}\``; } @@ -240,7 +250,7 @@ class RuntimeTemplate { */ _es5Concatenation(args) { const str = args - .map(arg => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr)) + .map((arg) => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr)) .join(" + "); // when the first two args are expression, we need to prepend "" + to force string @@ -290,7 +300,9 @@ class RuntimeTemplate { return this.supportsDestructuring() ? `var {${items.join(", ")}} = ${value};` : Template.asString( - items.map(item => `var ${item} = ${value}${propertyAccess([item])};`) + items.map( + (item) => `var ${item} = ${value}${propertyAccess([item])};` + ) ); } @@ -332,12 +344,12 @@ class RuntimeTemplate { if (this.outputOptions.pathinfo) { content = [message, request, chunkName, chunkReason] .filter(Boolean) - .map(item => this.requestShortener.shorten(item)) + .map((item) => this.requestShortener.shorten(item)) .join(" | "); } else { content = [message, chunkName, chunkReason] .filter(Boolean) - .map(item => this.requestShortener.shorten(item)) + .map((item) => this.requestShortener.shorten(item)) .join(" | "); } if (!content) return ""; @@ -763,14 +775,14 @@ class RuntimeTemplate { if (typeof runtimeCondition === "boolean") return `${runtimeCondition}`; /** @type {Set} */ const positiveRuntimeIds = new Set(); - forEachRuntime(runtimeCondition, runtime => + forEachRuntime(runtimeCondition, (runtime) => positiveRuntimeIds.add( `${chunkGraph.getRuntimeId(/** @type {string} */ (runtime))}` ) ); /** @type {Set} */ const negativeRuntimeIds = new Set(); - forEachRuntime(subtractRuntime(runtime, runtimeCondition), runtime => + forEachRuntime(subtractRuntime(runtime, runtimeCondition), (runtime) => negativeRuntimeIds.add( `${chunkGraph.getRuntimeId(/** @type {string} */ (runtime))}` ) @@ -817,13 +829,6 @@ class RuntimeTemplate { ]; } - defer = defer && (module.buildMeta ? !module.buildMeta.async : true); - - /** @type {Set} */ - const outgoingAsyncModules = defer - ? getOutgoingAsyncModules(moduleGraph, module) - : new Set(); - if (chunkGraph.getModuleId(module) === null) { if (weak) { // only weak referenced modules don't get an id @@ -860,12 +865,15 @@ class RuntimeTemplate { ); runtimeRequirements.add(RuntimeGlobals.require); let importContent; - if (defer) { + if (defer && !(/** @type {BuildMeta} */ (module.buildMeta).async)) { + /** @type {Set} */ + const outgoingAsyncModules = getOutgoingAsyncModules(moduleGraph, module); + importContent = `/* deferred harmony import */ ${optDeclaration}${importVar} = ${getOptimizedDeferredModule( this, exportsType, moduleId, - Array.from(outgoingAsyncModules, mod => chunkGraph.getModuleId(mod)) + Array.from(outgoingAsyncModules, (mod) => chunkGraph.getModuleId(mod)) )};\n`; return [importContent, ""]; @@ -924,8 +932,6 @@ class RuntimeTemplate { request }); } - - defer = defer && (module.buildMeta ? !module.buildMeta.async : true); if (!Array.isArray(exportName)) { exportName = exportName ? [exportName] : []; } @@ -935,10 +941,13 @@ class RuntimeTemplate { (originModule.buildMeta).strictHarmonyModule ); + const isDeferred = + defer && !(/** @type {BuildMeta} */ (module.buildMeta).async); + if (defaultInterop) { // when the defaultInterop is used (when a ESM imports a CJS module), if (exportName.length > 0 && exportName[0] === "default") { - if (defer && exportsType !== "namespace") { + if (isDeferred && exportsType !== "namespace") { const access = `${importVar}.a${propertyAccess(exportName, 1)}`; if (isCall || asiSafe === undefined) { return access; @@ -983,7 +992,7 @@ class RuntimeTemplate { ) { return "/* __esModule */true"; } - } else if (defer) { + } else if (isDeferred) { // now exportName.length is 0 // fall through to the end of this function, create the namespace there. } else if ( @@ -1026,7 +1035,7 @@ class RuntimeTemplate { ? "" : `${Template.toNormalComment(propertyAccess(exportName))} `; const access = `${importVar}${ - defer ? ".a" : "" + isDeferred ? ".a" : "" }${comment}${propertyAccess(used)}`; if (isCall && callContext === false) { return asiSafe @@ -1037,7 +1046,7 @@ class RuntimeTemplate { } return access; } - if (defer) { + if (isDeferred) { initFragments.push( new InitFragment( `var ${importVar}_deferred_namespace_cache;\n`, @@ -1087,7 +1096,7 @@ class RuntimeTemplate { return `Promise.resolve(${comment.trim()})`; } const chunks = chunkGroup.chunks.filter( - chunk => !chunk.hasRuntime() && chunk.id !== null + (chunk) => !chunk.hasRuntime() && chunk.id !== null ); const comment = this.comment({ message, @@ -1119,7 +1128,7 @@ class RuntimeTemplate { * @param {Chunk} chunk chunk * @returns {string} require chunk id code */ - const requireChunkId = chunk => + const requireChunkId = (chunk) => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(chunk.id)}${ fetchPriority ? `, ${JSON.stringify(fetchPriority)}` : "" })`; diff --git a/lib/SizeFormatHelpers.js b/lib/SizeFormatHelpers.js index 4c6a748f0eb..e233d5fa630 100644 --- a/lib/SizeFormatHelpers.js +++ b/lib/SizeFormatHelpers.js @@ -9,7 +9,7 @@ * @param {number} size the size in bytes * @returns {string} the formatted size */ -module.exports.formatSize = size => { +module.exports.formatSize = (size) => { if (typeof size !== "number" || Number.isNaN(size) === true) { return "unknown size"; } diff --git a/lib/SourceMapDevToolModuleOptionsPlugin.js b/lib/SourceMapDevToolModuleOptionsPlugin.js index ae62b0379aa..c024125bd7a 100644 --- a/lib/SourceMapDevToolModuleOptionsPlugin.js +++ b/lib/SourceMapDevToolModuleOptionsPlugin.js @@ -27,17 +27,17 @@ class SourceMapDevToolModuleOptionsPlugin { apply(compilation) { const options = this.options; if (options.module !== false) { - compilation.hooks.buildModule.tap(PLUGIN_NAME, module => { + compilation.hooks.buildModule.tap(PLUGIN_NAME, (module) => { module.useSourceMap = true; }); - compilation.hooks.runtimeModule.tap(PLUGIN_NAME, module => { + compilation.hooks.runtimeModule.tap(PLUGIN_NAME, (module) => { module.useSourceMap = true; }); } else { - compilation.hooks.buildModule.tap(PLUGIN_NAME, module => { + compilation.hooks.buildModule.tap(PLUGIN_NAME, (module) => { module.useSimpleSourceMap = true; }); - compilation.hooks.runtimeModule.tap(PLUGIN_NAME, module => { + compilation.hooks.runtimeModule.tap(PLUGIN_NAME, (module) => { module.useSimpleSourceMap = true; }); } diff --git a/lib/SourceMapDevToolPlugin.js b/lib/SourceMapDevToolPlugin.js index f5f28efd533..913dad02730 100644 --- a/lib/SourceMapDevToolPlugin.js +++ b/lib/SourceMapDevToolPlugin.js @@ -65,7 +65,7 @@ const URL_FORMATTING_REGEXP = /^\n\/\/(.*)$/; * @param {RegExp} regexp Stateful Regular Expression to be reset * @returns {void} */ -const resetRegexpState = regexp => { +const resetRegexpState = (regexp) => { regexp.lastIndex = -1; }; @@ -74,7 +74,7 @@ const resetRegexpState = regexp => { * @param {string} str String to quote * @returns {string} Escaped string */ -const quoteMeta = str => str.replace(METACHARACTERS_REGEXP, "\\$&"); +const quoteMeta = (str) => str.replace(METACHARACTERS_REGEXP, "\\$&"); /** * Creating {@link SourceMapTask} for given file @@ -112,7 +112,7 @@ const getTaskForFile = ( const context = /** @type {string} */ (compilation.options.context); const root = compilation.compiler.root; const cachedAbsolutify = makePathsAbsolute.bindContextCache(context, root); - const modules = sourceMap.sources.map(source => { + const modules = sourceMap.sources.map((source) => { if (!source.startsWith("webpack://")) return source; source = cachedAbsolutify(source.slice(10)); const module = compilation.findModule(source); @@ -179,7 +179,7 @@ class SourceMapDevToolPlugin { options ); - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); compilation.hooks.processAssets.tapAsync( @@ -348,7 +348,7 @@ class SourceMapDevToolPlugin { callback(); }); }, - err => { + (err) => { if (err) { return callback(err); } @@ -431,7 +431,7 @@ class SourceMapDevToolPlugin { "attach SourceMap" ); - const moduleFilenames = modules.map(m => + const moduleFilenames = modules.map((m) => moduleToSourceNameMapping.get(m) ); sourceMap.sources = /** @type {string[]} */ (moduleFilenames); @@ -454,7 +454,7 @@ class SourceMapDevToolPlugin { : quoteMeta(contenthash); sourceMap.file = sourceMap.file.replace( new RegExp(pattern, "g"), - m => "x".repeat(m.length) + (m) => "x".repeat(m.length) ); } @@ -584,7 +584,7 @@ class SourceMapDevToolPlugin { compilation.updateAsset(file, asset); } - task.cacheItem.store({ assets, assetsInfo }, err => { + task.cacheItem.store({ assets, assetsInfo }, (err) => { reportProgress( 0.5 + (0.5 * ++taskIndex) / tasks.length, task.file, @@ -597,7 +597,7 @@ class SourceMapDevToolPlugin { callback(); }); }, - err => { + (err) => { reportProgress(1); callback(err); } diff --git a/lib/Stats.js b/lib/Stats.js index 22a36632a97..2a883796269 100644 --- a/lib/Stats.js +++ b/lib/Stats.js @@ -36,7 +36,7 @@ class Stats { hasWarnings() { return ( this.compilation.getWarnings().length > 0 || - this.compilation.children.some(child => child.getStats().hasWarnings()) + this.compilation.children.some((child) => child.getStats().hasWarnings()) ); } @@ -46,7 +46,7 @@ class Stats { hasErrors() { return ( this.compilation.errors.length > 0 || - this.compilation.children.some(child => child.getStats().hasErrors()) + this.compilation.children.some((child) => child.getStats().hasErrors()) ); } diff --git a/lib/Template.js b/lib/Template.js index 9b91ac0f040..f8b60e3becb 100644 --- a/lib/Template.js +++ b/lib/Template.js @@ -296,7 +296,7 @@ class Template { return null; } /** @type {{id: string|number, source: Source|string}[]} */ - const allModules = modules.map(module => ({ + const allModules = modules.map((module) => ({ id: /** @type {ModuleId} */ (chunkGraph.getModuleId(module)), source: renderModule(module) || "false" })); diff --git a/lib/TemplatedPathPlugin.js b/lib/TemplatedPathPlugin.js index 3439bfd4b46..0afb5aff26a 100644 --- a/lib/TemplatedPathPlugin.js +++ b/lib/TemplatedPathPlugin.js @@ -24,7 +24,7 @@ const REGEXP = /\[\\*([\w:]+)\\*\]/gi; * @param {string | number} id id * @returns {string | number} result */ -const prepareId = id => { +const prepareId = (id) => { if (typeof id !== "string") return id; if (/^"\s\+*.*\+\s*"$/.test(id)) { @@ -389,7 +389,7 @@ class TemplatedPathPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(plugin, compilation => { + compiler.hooks.compilation.tap(plugin, (compilation) => { compilation.hooks.assetPath.tap(plugin, replacePathVariables); }); } diff --git a/lib/UseStrictPlugin.js b/lib/UseStrictPlugin.js index 3db3daa8f62..ea1d87fbebb 100644 --- a/lib/UseStrictPlugin.js +++ b/lib/UseStrictPlugin.js @@ -36,7 +36,7 @@ class UseStrictPlugin { * @param {JavascriptParserOptions} parserOptions the javascript parser options */ const handler = (parser, parserOptions) => { - parser.hooks.program.tap(PLUGIN_NAME, ast => { + parser.hooks.program.tap(PLUGIN_NAME, (ast) => { const firstNode = ast.body[0]; if ( firstNode && diff --git a/lib/WarnCaseSensitiveModulesPlugin.js b/lib/WarnCaseSensitiveModulesPlugin.js index 5badc2229c4..a272cff0503 100644 --- a/lib/WarnCaseSensitiveModulesPlugin.js +++ b/lib/WarnCaseSensitiveModulesPlugin.js @@ -20,7 +20,7 @@ class WarnCaseSensitiveModulesPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.seal.tap(PLUGIN_NAME, () => { /** @type {Map>} */ const moduleWithoutCase = new Map(); diff --git a/lib/WarnDeprecatedOptionPlugin.js b/lib/WarnDeprecatedOptionPlugin.js index 96183768788..5afe80e9c19 100644 --- a/lib/WarnDeprecatedOptionPlugin.js +++ b/lib/WarnDeprecatedOptionPlugin.js @@ -30,7 +30,7 @@ class WarnDeprecatedOptionPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.warnings.push( new DeprecatedOptionWarning(this.option, this.value, this.suggestion) ); diff --git a/lib/WarnNoModeSetPlugin.js b/lib/WarnNoModeSetPlugin.js index 7eaee450bc4..3eaae89bc34 100644 --- a/lib/WarnNoModeSetPlugin.js +++ b/lib/WarnNoModeSetPlugin.js @@ -18,7 +18,7 @@ class WarnNoModeSetPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.warnings.push(new NoModeWarning()); }); } diff --git a/lib/WatchIgnorePlugin.js b/lib/WatchIgnorePlugin.js index 0840575fc23..b47b1cdefd6 100644 --- a/lib/WatchIgnorePlugin.js +++ b/lib/WatchIgnorePlugin.js @@ -45,8 +45,8 @@ class IgnoringWatchFileSystem { * @param {string} path path to check * @returns {boolean} true, if path is ignored */ - const ignored = path => - this.paths.some(p => + const ignored = (path) => + this.paths.some((p) => p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0 ); diff --git a/lib/Watching.js b/lib/Watching.js index a047f257b20..c3e9bc915bf 100644 --- a/lib/Watching.js +++ b/lib/Watching.js @@ -159,14 +159,14 @@ class Watching { const run = () => { if (this.compiler.idle) { - return this.compiler.cache.endIdle(err => { + return this.compiler.cache.endIdle((err) => { if (err) return this._done(err); this.compiler.idle = false; run(); }); } if (this._needRecords) { - return this.compiler.readRecords(err => { + return this.compiler.readRecords((err) => { if (err) return this._done(err); this._needRecords = false; @@ -175,7 +175,7 @@ class Watching { } this.invalid = false; this._invalidReported = false; - this.compiler.hooks.watchRun.callAsync(this.compiler, err => { + this.compiler.hooks.watchRun.callAsync(this.compiler, (err) => { if (err) return this._done(err); /** * @param {Error | null} err error @@ -196,13 +196,13 @@ class Watching { process.nextTick(() => { const logger = compilation.getLogger("webpack.Compiler"); logger.time("emitAssets"); - this.compiler.emitAssets(compilation, err => { + this.compiler.emitAssets(compilation, (err) => { logger.timeEnd("emitAssets"); if (err) return this._done(err, compilation); if (this.invalid) return this._done(null, compilation); logger.time("emitRecords"); - this.compiler.emitRecords(err => { + this.compiler.emitRecords((err) => { logger.timeEnd("emitRecords"); if (err) return this._done(err, compilation); @@ -215,11 +215,11 @@ class Watching { compilation.endTime = Date.now(); logger.time("done hook"); const stats = new Stats(compilation); - this.compiler.hooks.done.callAsync(stats, err => { + this.compiler.hooks.done.callAsync(stats, (err) => { logger.timeEnd("done hook"); if (err) return this._done(err, compilation); - this.compiler.hooks.additionalPass.callAsync(err => { + this.compiler.hooks.additionalPass.callAsync((err) => { if (err) return this._done(err, compilation); this.compiler.compile(onCompiled); }); @@ -288,7 +288,7 @@ class Watching { logger.time("storeBuildDependencies"); this.compiler.cache.storeBuildDependencies( compilation.buildDependencies, - err => { + (err) => { logger.timeEnd("storeBuildDependencies"); if (err) return handleError(err); this._go(); @@ -311,7 +311,7 @@ class Watching { const cbs = this.callbacks; this.callbacks = []; logger.time("done hook"); - this.compiler.hooks.done.callAsync(/** @type {Stats} */ (stats), err => { + this.compiler.hooks.done.callAsync(/** @type {Stats} */ (stats), (err) => { logger.timeEnd("done hook"); if (err) return handleError(err, cbs); this.handler(null, stats); @@ -319,7 +319,7 @@ class Watching { this.compiler.cache.storeBuildDependencies( /** @type {Compilation} */ (compilation).buildDependencies, - err => { + (err) => { logger.timeEnd("storeBuildDependencies"); if (err) return handleError(err, cbs); logger.time("beginIdle"); @@ -480,7 +480,7 @@ class Watching { /** * @param {WebpackError | null} err error if any */ - const shutdown = err => { + const shutdown = (err) => { this.compiler.hooks.watchClose.call(); const closeCallbacks = /** @type {Callback[]} */ @@ -493,7 +493,7 @@ class Watching { logger.time("storeBuildDependencies"); this.compiler.cache.storeBuildDependencies( compilation.buildDependencies, - err2 => { + (err2) => { logger.timeEnd("storeBuildDependencies"); shutdown(err || err2); } diff --git a/lib/WebpackIsIncludedPlugin.js b/lib/WebpackIsIncludedPlugin.js index 4b18790b2e5..3625901147d 100644 --- a/lib/WebpackIsIncludedPlugin.js +++ b/lib/WebpackIsIncludedPlugin.js @@ -47,10 +47,10 @@ class WebpackIsIncludedPlugin { * @param {JavascriptParser} parser the parser * @returns {void} */ - const handler = parser => { + const handler = (parser) => { parser.hooks.call .for("__webpack_is_included__") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { if ( expr.type !== "CallExpression" || expr.arguments.length !== 1 || diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index 9ebdaa6dc91..906451d35ca 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -858,7 +858,7 @@ class WebpackOptionsApply extends OptionsApply { } compiler.resolverFactory.hooks.resolveOptions .for("normal") - .tap(CLASS_NAME, resolveOptions => { + .tap(CLASS_NAME, (resolveOptions) => { resolveOptions = cleverMerge(options.resolve, resolveOptions); resolveOptions.fileSystem = /** @type {InputFileSystem} */ @@ -867,7 +867,7 @@ class WebpackOptionsApply extends OptionsApply { }); compiler.resolverFactory.hooks.resolveOptions .for("context") - .tap(CLASS_NAME, resolveOptions => { + .tap(CLASS_NAME, (resolveOptions) => { resolveOptions = cleverMerge(options.resolve, resolveOptions); resolveOptions.fileSystem = /** @type {InputFileSystem} */ @@ -877,7 +877,7 @@ class WebpackOptionsApply extends OptionsApply { }); compiler.resolverFactory.hooks.resolveOptions .for("loader") - .tap(CLASS_NAME, resolveOptions => { + .tap(CLASS_NAME, (resolveOptions) => { resolveOptions = cleverMerge(options.resolveLoader, resolveOptions); resolveOptions.fileSystem = /** @type {InputFileSystem} */ diff --git a/lib/asset/AssetGenerator.js b/lib/asset/AssetGenerator.js index 90cb71b23ae..f1e1c025045 100644 --- a/lib/asset/AssetGenerator.js +++ b/lib/asset/AssetGenerator.js @@ -152,7 +152,7 @@ const encodeDataUri = (encoding, source) => { (encodedContent) ).replace( /[!'()*]/g, - character => + (character) => `%${/** @type {number} */ (character.codePointAt(0)).toString(16)}` ); break; diff --git a/lib/asset/AssetModulesPlugin.js b/lib/asset/AssetModulesPlugin.js index 7ee4370e0f5..7b317cf5523 100644 --- a/lib/asset/AssetModulesPlugin.js +++ b/lib/asset/AssetModulesPlugin.js @@ -31,7 +31,7 @@ const memoize = require("../util/memoize"); * @param {string} name name of definitions * @returns {Schema} definition */ -const getSchema = name => { +const getSchema = (name) => { const { definitions } = require("../../schemas/WebpackOptions.json"); return { @@ -93,7 +93,7 @@ class AssetModulesPlugin { (compilation, { normalModuleFactory }) => { normalModuleFactory.hooks.createParser .for(ASSET_MODULE_TYPE) - .tap(PLUGIN_NAME, parserOptions => { + .tap(PLUGIN_NAME, (parserOptions) => { validateParserOptions(parserOptions); parserOptions = cleverMerge( /** @type {AssetParserOptions} */ @@ -115,21 +115,21 @@ class AssetModulesPlugin { }); normalModuleFactory.hooks.createParser .for(ASSET_MODULE_TYPE_INLINE) - .tap(PLUGIN_NAME, _parserOptions => { + .tap(PLUGIN_NAME, (_parserOptions) => { const AssetParser = getAssetParser(); return new AssetParser(true); }); normalModuleFactory.hooks.createParser .for(ASSET_MODULE_TYPE_RESOURCE) - .tap(PLUGIN_NAME, _parserOptions => { + .tap(PLUGIN_NAME, (_parserOptions) => { const AssetParser = getAssetParser(); return new AssetParser(false); }); normalModuleFactory.hooks.createParser .for(ASSET_MODULE_TYPE_SOURCE) - .tap(PLUGIN_NAME, _parserOptions => { + .tap(PLUGIN_NAME, (_parserOptions) => { const AssetSourceParser = getAssetSourceParser(); return new AssetSourceParser(); @@ -142,7 +142,7 @@ class AssetModulesPlugin { ]) { normalModuleFactory.hooks.createGenerator .for(type) - .tap(PLUGIN_NAME, generatorOptions => { + .tap(PLUGIN_NAME, (generatorOptions) => { validateGeneratorOptions[type](generatorOptions); let dataUrl; diff --git a/lib/async-modules/AsyncModuleHelpers.js b/lib/async-modules/AsyncModuleHelpers.js index e0c69bb60eb..df45deca503 100644 --- a/lib/async-modules/AsyncModuleHelpers.js +++ b/lib/async-modules/AsyncModuleHelpers.js @@ -32,7 +32,7 @@ const getOutgoingAsyncModules = (moduleGraph, module) => { for (const [module, connections] of outgoingConnectionMap) { if ( connections.some( - c => + (c) => c.dependency instanceof HarmonyImportDependency && c.isTargetActive(undefined) ) && diff --git a/lib/async-modules/AwaitDependenciesInitFragment.js b/lib/async-modules/AwaitDependenciesInitFragment.js index 178834b06e7..0928d59271e 100644 --- a/lib/async-modules/AwaitDependenciesInitFragment.js +++ b/lib/async-modules/AwaitDependenciesInitFragment.js @@ -17,16 +17,16 @@ const Template = require("../Template"); */ class AwaitDependenciesInitFragment extends InitFragment { /** - * @param {Set} promises the promises that should be awaited + * @param {Map} dependencies maps an import var to an async module that needs to be awaited */ - constructor(promises) { + constructor(dependencies) { super( undefined, InitFragment.STAGE_ASYNC_DEPENDENCIES, 0, "await-dependencies" ); - this.promises = promises; + this.dependencies = dependencies; } /** @@ -34,38 +34,50 @@ class AwaitDependenciesInitFragment extends InitFragment { * @returns {AwaitDependenciesInitFragment} AwaitDependenciesInitFragment */ merge(other) { - const promises = new Set(other.promises); - for (const p of this.promises) { - promises.add(p); + const dependencies = new Map(other.dependencies); + for (const [key, value] of this.dependencies) { + dependencies.set(key, value); } - return new AwaitDependenciesInitFragment(promises); + return new AwaitDependenciesInitFragment(dependencies); } /** * @param {GenerateContext} context context * @returns {string | Source | undefined} the source code that will be included as initialization code */ - getContent({ runtimeRequirements }) { + getContent({ runtimeRequirements, runtimeTemplate }) { runtimeRequirements.add(RuntimeGlobals.module); - const promises = this.promises; - if (promises.size === 0) { + if (this.dependencies.size === 0) { return ""; } - if (promises.size === 1) { - const [p] = promises; - return Template.asString([ - `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${p}]);`, - `${p} = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];`, - "" - ]); + + const importVars = [...this.dependencies.keys()]; + const asyncModuleValues = [...this.dependencies.values()].join(", "); + + const templateInput = [ + `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${asyncModuleValues}]);` + ]; + + if ( + this.dependencies.size === 1 || + !runtimeTemplate.supportsDestructuring() + ) { + for (const [index, importVar] of importVars.entries()) { + templateInput.push( + `${importVar} = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[${index}];` + ); + } + } else { + const importVarsStr = importVars.join(", "); + + templateInput.push( + `([${importVarsStr}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);` + ); } - const sepPromises = [...promises].join(", "); - // TODO check if destructuring is supported - return Template.asString([ - `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${sepPromises}]);`, - `([${sepPromises}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);`, - "" - ]); + + templateInput.push(""); + + return Template.asString(templateInput); } } diff --git a/lib/async-modules/InferAsyncModulesPlugin.js b/lib/async-modules/InferAsyncModulesPlugin.js index f585aac5c98..3ced0bcc63d 100644 --- a/lib/async-modules/InferAsyncModulesPlugin.js +++ b/lib/async-modules/InferAsyncModulesPlugin.js @@ -19,9 +19,9 @@ class InferAsyncModulesPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const { moduleGraph } = compilation; - compilation.hooks.finishModules.tap(PLUGIN_NAME, modules => { + compilation.hooks.finishModules.tap(PLUGIN_NAME, (modules) => { /** @type {Set} */ const queue = new Set(); for (const module of modules) { @@ -37,7 +37,7 @@ class InferAsyncModulesPlugin { ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { if ( connections.some( - c => + (c) => c.dependency instanceof HarmonyImportDependency && c.isTargetActive(undefined) ) diff --git a/lib/buildChunkGraph.js b/lib/buildChunkGraph.js index 9cd54164b96..117e98ed394 100644 --- a/lib/buildChunkGraph.js +++ b/lib/buildChunkGraph.js @@ -269,7 +269,7 @@ const visitModules = ( * @param {Module} module The module to look up * @returns {number} The ordinal of the module in masks */ - const getModuleOrdinal = module => { + const getModuleOrdinal = (module) => { let ordinal = ordinalByModule.get(module); if (ordinal === undefined) { ordinal = ordinalByModule.size; @@ -486,7 +486,7 @@ const visitModules = ( * @param {AsyncDependenciesBlock} b iterating over each Async DepBlock * @returns {void} */ - const iteratorBlock = b => { + const iteratorBlock = (b) => { // 1. We create a chunk group with single chunk in it for this Block // but only once (blockChunkGroups map) /** @type {ChunkGroupInfo | undefined} */ @@ -673,7 +673,7 @@ const visitModules = ( * @param {DependenciesBlock} block the block * @returns {void} */ - const processBlock = block => { + const processBlock = (block) => { statProcessedBlocks++; // get prepared block info const blockModules = getBlockModules(block, chunkGroupInfo.runtime); @@ -765,7 +765,7 @@ const visitModules = ( * @param {DependenciesBlock} block the block * @returns {void} */ - const processEntryBlock = block => { + const processEntryBlock = (block) => { statProcessedBlocks++; // get prepared block info const blockModules = getBlockModules(block, chunkGroupInfo.runtime); @@ -892,7 +892,7 @@ const visitModules = ( * @param {ChunkGroupInfo} chunkGroupInfo The info object for the chunk group * @returns {bigint} The mask of available modules after the chunk group */ - const calculateResultingAvailableModules = chunkGroupInfo => { + const calculateResultingAvailableModules = (chunkGroupInfo) => { if (chunkGroupInfo.resultingAvailableModules !== undefined) { return chunkGroupInfo.resultingAvailableModules; } diff --git a/lib/cache/AddBuildDependenciesPlugin.js b/lib/cache/AddBuildDependenciesPlugin.js index 7d8b1d0775b..7d271e26a5d 100644 --- a/lib/cache/AddBuildDependenciesPlugin.js +++ b/lib/cache/AddBuildDependenciesPlugin.js @@ -23,7 +23,7 @@ class AddBuildDependenciesPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.buildDependencies.addAll(this.buildDependencies); }); } diff --git a/lib/cache/IdleFileCachePlugin.js b/lib/cache/IdleFileCachePlugin.js index 90708076574..78ef83b9964 100644 --- a/lib/cache/IdleFileCachePlugin.js +++ b/lib/cache/IdleFileCachePlugin.js @@ -68,7 +68,7 @@ class IdleFileCachePlugin { { name: PLUGIN_NAME, stage: Cache.STAGE_DISK }, (identifier, etag, gotHandlers) => { const restore = () => - strategy.restore(identifier, etag).then(cacheEntry => { + strategy.restore(identifier, etag).then((cacheEntry) => { if (cacheEntry === undefined) { gotHandlers.push((result, callback) => { if (result !== undefined) { @@ -93,7 +93,7 @@ class IdleFileCachePlugin { compiler.cache.hooks.storeBuildDependencies.tap( { name: PLUGIN_NAME, stage: Cache.STAGE_DISK }, - dependencies => { + (dependencies) => { pendingIdleTasks.set(BUILD_DEPENDENCIES_KEY, () => Promise.resolve().then(() => strategy.storeBuildDependencies(dependencies) @@ -113,7 +113,7 @@ class IdleFileCachePlugin { const reportProgress = ProgressPlugin.getReporter(compiler); const jobs = [...pendingIdleTasks.values()]; if (reportProgress) reportProgress(0, "process pending cache items"); - const promises = jobs.map(fn => fn()); + const promises = jobs.map((fn) => fn()); pendingIdleTasks.clear(); promises.push(currentIdlePromise); const promise = Promise.all(promises); @@ -168,7 +168,7 @@ class IdleFileCachePlugin { timeSpendInStore = 0; timeSpendInBuild = 0; }) - .catch(err => { + .catch((err) => { const logger = compiler.getInfrastructureLogger(PLUGIN_NAME); logger.warn(`Background tasks during idle failed: ${err.message}`); logger.debug(err.stack); @@ -229,7 +229,7 @@ class IdleFileCachePlugin { isIdle = false; } ); - compiler.hooks.done.tap(PLUGIN_NAME, stats => { + compiler.hooks.done.tap(PLUGIN_NAME, (stats) => { // 10% build overhead is ignored, as it's not cacheable timeSpendInBuild *= 0.9; timeSpendInBuild += diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index 29bcf18e55a..0c8ab23e926 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -330,7 +330,7 @@ class Pack { `${itemsCount} fresh items in cache put into pack ${ packs.length > 1 ? packs - .map(pack => `${pack.loc} (${pack.items.size} items)`) + .map((pack) => `${pack.loc} (${pack.items.size} items)`) .join(", ") : packs[0].loc }` @@ -407,7 +407,7 @@ class Pack { for (const identifier of content.used) { mergedUsedItems.add(identifier); } - addToMergedMap.push(async map => { + addToMergedMap.push(async (map) => { // unpack existing content // after that values are accessible in .content await content.unpack( @@ -433,7 +433,7 @@ class Pack { memoize(async () => { /** @type {Content} */ const map = new Map(); - await Promise.all(addToMergedMap.map(fn => fn(map))); + await Promise.all(addToMergedMap.map((fn) => fn(map))); return new PackContentItems(map); }) ); @@ -603,7 +603,7 @@ class Pack { const content = this.content[i]; if (content !== undefined) { write(content.items); - content.writeLazy(lazy => + content.writeLazy((lazy) => /** @type {NonNullable} */ (writeSeparate)(lazy, { name: `${i}` }) ); @@ -627,7 +627,7 @@ class Pack { item = read(); } this.itemInfo.clear(); - const infoItems = items.map(identifier => { + const infoItems = items.map((identifier) => { const info = new PackItemInfo(identifier, undefined, undefined); this.itemInfo.set(identifier, info); return info; @@ -875,7 +875,7 @@ class PackContent { } const value = /** @type {LazyFunction} */ (this.lazy)(); if ("then" in value) { - return value.then(data => { + return value.then((data) => { const map = data.map; if (timeMessage) { logger.timeEnd(timeMessage); @@ -927,7 +927,7 @@ class PackContent { /** @type {PackContentItems | Promise} */ (this.lazy()); if ("then" in value) { - return value.then(data => { + return value.then((data) => { if (timeMessage) { logger.timeEnd(timeMessage); } @@ -1022,7 +1022,7 @@ class PackContent { if ("then" in value) { // Move to state B1 this.lazy = write(() => - value.then(data => { + value.then((data) => { if (timeMessage) { logger.timeEnd(timeMessage); } @@ -1060,7 +1060,7 @@ class PackContent { * @param {Buffer} buf buffer * @returns {Buffer} buffer that can be collected */ -const allowCollectingMemory = buf => { +const allowCollectingMemory = (buf) => { const wasted = buf.buffer.byteLength - buf.byteLength; if (wasted > 8192 && (wasted > 1048576 || wasted > buf.byteLength)) { return Buffer.from(buf); @@ -1178,7 +1178,7 @@ class PackFileCacheStrategy { ? allowCollectingMemory : undefined }) - .catch(err => { + .catch((err) => { if (err.code !== "ENOENT") { logger.warn( `Restoring pack failed from ${cacheLocation}${this._extension}: ${err}` @@ -1191,7 +1191,7 @@ class PackFileCacheStrategy { } return undefined; }) - .then(packContainer => { + .then((packContainer) => { logger.timeEnd("restore cache container"); if (!packContainer) return; if (!(packContainer instanceof PackContainer)) { @@ -1277,7 +1277,7 @@ class PackFileCacheStrategy { ); }) ]) - .catch(err => { + .catch((err) => { logger.timeEnd("check build dependencies"); throw err; }) @@ -1292,7 +1292,7 @@ class PackFileCacheStrategy { return undefined; }); }) - .then(pack => { + .then((pack) => { if (pack) { pack.maxAge = this.maxAge; this.buildSnapshot = buildSnapshot; @@ -1307,7 +1307,7 @@ class PackFileCacheStrategy { } return new Pack(logger, this.maxAge); }) - .catch(err => { + .catch((err) => { this.logger.warn( `Restoring pack from ${cacheLocation}${this._extension} failed: ${err}` ); @@ -1325,7 +1325,7 @@ class PackFileCacheStrategy { store(identifier, etag, data) { if (this.readonly) return Promise.resolve(); - return this._getPack().then(pack => { + return this._getPack().then((pack) => { pack.set(identifier, etag === null ? null : etag.toString(), data); }); } @@ -1337,10 +1337,10 @@ class PackFileCacheStrategy { */ restore(identifier, etag) { return this._getPack() - .then(pack => + .then((pack) => pack.get(identifier, etag === null ? null : etag.toString()) ) - .catch(err => { + .catch((err) => { if (err && err.code !== "ENOENT") { this.logger.warn( `Restoring failed for ${identifier} from pack: ${err}` @@ -1363,7 +1363,7 @@ class PackFileCacheStrategy { if (packPromise === undefined) return Promise.resolve(); const reportProgress = ProgressPlugin.getReporter(this.compiler); return (this.storePromise = packPromise - .then(pack => { + .then((pack) => { pack.stopCapturingRequests(); if (!pack.invalid) return; this.packPromise = undefined; @@ -1526,14 +1526,14 @@ class PackFileCacheStrategy { Math.round(stats.size / 1024 / 1024) ); }) - .catch(err => { + .catch((err) => { this.logger.timeEnd("store pack"); this.logger.warn(`Caching failed for pack: ${err}`); this.logger.debug(err.stack); }); }); }) - .catch(err => { + .catch((err) => { this.logger.warn(`Caching failed for pack: ${err}`); this.logger.debug(err.stack); })); diff --git a/lib/cache/ResolverCachePlugin.js b/lib/cache/ResolverCachePlugin.js index 8e918546a02..e28a8896c4a 100644 --- a/lib/cache/ResolverCachePlugin.js +++ b/lib/cache/ResolverCachePlugin.js @@ -115,7 +115,7 @@ class ResolverCachePlugin { let cachedResolves = 0; let cacheInvalidResolves = 0; let concurrentResolves = 0; - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { snapshotOptions = compilation.options.snapshot.resolve; fileSystemInfo = compilation.fileSystemInfo; compilation.hooks.finishModules.tap(PLUGIN_NAME, () => { @@ -176,14 +176,14 @@ class ResolverCachePlugin { if (typeof newResolveContext.yield === "function") { yieldResult = []; withYield = true; - newResolveContext.yield = obj => + newResolveContext.yield = (obj) => /** @type {ResolveRequest[]} */ (yieldResult).push(obj); } /** * @param {"fileDependencies" | "contextDependencies" | "missingDependencies"} key key */ - const propagate = key => { + const propagate = (key) => { if (resolveContext[key]) { addAllToSet( /** @type {Set} */ (resolveContext[key]), @@ -239,7 +239,7 @@ class ResolverCachePlugin { (resolveResult), snapshot ), - storeErr => { + (storeErr) => { if (storeErr) return callback(storeErr); if (resolveResult) { return callback( diff --git a/lib/cli.js b/lib/cli.js index 642bde742c3..1d38af32bc8 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -6,6 +6,7 @@ "use strict"; const path = require("path"); +const tty = require("tty"); const webpackSchema = require("../schemas/WebpackOptions.json"); /** @typedef {import("json-schema").JSONSchema4} JSONSchema4 */ @@ -82,7 +83,7 @@ const getArguments = (schema = webpackSchema) => { * @param {string} input input * @returns {string} result */ - const pathToArgumentName = input => + const pathToArgumentName = (input) => input .replace(/\./g, "-") .replace(/\[\]/g, "") @@ -97,7 +98,7 @@ const getArguments = (schema = webpackSchema) => { * @param {string} path path * @returns {Schema} schema part */ - const getSchemaPart = path => { + const getSchemaPart = (path) => { const newPath = path.split("/"); let schemaPart = schema; @@ -119,7 +120,7 @@ const getArguments = (schema = webpackSchema) => { * @param {PathItem[]} path path in the schema * @returns {string | undefined} description */ - const getDescription = path => { + const getDescription = (path) => { for (const { schema } of path) { if (schema.cli) { if (schema.cli.helper) continue; @@ -133,7 +134,7 @@ const getArguments = (schema = webpackSchema) => { * @param {PathItem[]} path path in the schema * @returns {string | undefined} negative description */ - const getNegatedDescription = path => { + const getNegatedDescription = (path) => { for (const { schema } of path) { if (schema.cli) { if (schema.cli.helper) continue; @@ -146,7 +147,7 @@ const getArguments = (schema = webpackSchema) => { * @param {PathItem[]} path path in the schema * @returns {string | undefined} reset description */ - const getResetDescription = path => { + const getResetDescription = (path) => { for (const { schema } of path) { if (schema.cli) { if (schema.cli.helper) continue; @@ -159,7 +160,7 @@ const getArguments = (schema = webpackSchema) => { * @param {Schema} schemaPart schema * @returns {Pick | undefined} partial argument config */ - const schemaToArgumentConfig = schemaPart => { + const schemaToArgumentConfig = (schemaPart) => { if (schemaPart.enum) { return { type: "enum", @@ -192,7 +193,7 @@ const getArguments = (schema = webpackSchema) => { * @param {PathItem[]} path path in the schema * @returns {void} */ - const addResetFlag = path => { + const addResetFlag = (path) => { const schemaPath = path[0].path; const name = pathToArgumentName(`${schemaPath}.reset`); const description = @@ -253,7 +254,7 @@ const getArguments = (schema = webpackSchema) => { if ( flags[name].configs.some( - item => JSON.stringify(item) === JSON.stringify(argConfig) + (item) => JSON.stringify(item) === JSON.stringify(argConfig) ) ) { return 0; @@ -261,7 +262,7 @@ const getArguments = (schema = webpackSchema) => { if ( flags[name].configs.some( - item => item.type === argConfig.type && item.multiple !== multiple + (item) => item.type === argConfig.type && item.multiple !== multiple ) ) { if (multiple) { @@ -411,8 +412,8 @@ const getArguments = (schema = webpackSchema) => { /** @type {NonNullable} */ (argConfig.values); - if (values.every(v => typeof v === "boolean")) type = "boolean"; - if (values.every(v => typeof v === "number")) type = "number"; + if (values.every((v) => typeof v === "boolean")) type = "boolean"; + if (values.every((v) => typeof v === "number")) type = "number"; break; } } @@ -420,7 +421,7 @@ const getArguments = (schema = webpackSchema) => { return t === type ? t : "string"; }, /** @type {SimpleType | undefined} */ (undefined)) ); - argument.multiple = argument.configs.some(c => c.multiple); + argument.multiple = argument.configs.some((c) => c.multiple); } return flags; @@ -580,7 +581,7 @@ const processArgumentConfig = (argConfig, config, value, index) => { * @param {ArgumentConfig} argConfig processing instructions * @returns {string | undefined} expected message */ -const getExpectedValue = argConfig => { +const getExpectedValue = (argConfig) => { switch (argConfig.type) { case "boolean": return "true | false"; @@ -590,7 +591,7 @@ const getExpectedValue = argConfig => { return /** @type {NonNullable} */ ( argConfig.values ) - .map(v => `${v}`) + .map((v) => `${v}`) .join(" | "); case "reset": return "true (will reset the previous value to an empty array)"; @@ -712,5 +713,186 @@ const processArguments = (args, config, values) => { return problems; }; +/** + * @returns {boolean} true when colors supported, otherwise false + */ +const isColorSupported = () => { + const { env = {}, argv = [], platform = "" } = process; + + const isDisabled = "NO_COLOR" in env || argv.includes("--no-color"); + const isForced = "FORCE_COLOR" in env || argv.includes("--color"); + const isWindows = platform === "win32"; + const isDumbTerminal = env.TERM === "dumb"; + + const isCompatibleTerminal = tty.isatty(1) && env.TERM && !isDumbTerminal; + + const isCI = + "CI" in env && + ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env); + + return ( + !isDisabled && + (isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI) + ); +}; + +/** + * @param {number} index index + * @param {string} string string + * @param {string} close close + * @param {string=} replace replace + * @param {string=} head head + * @param {string=} tail tail + * @param {number=} next next + * @returns {string} result + */ +const replaceClose = ( + index, + string, + close, + replace, + head = string.slice(0, Math.max(0, index)) + replace, + tail = string.slice(Math.max(0, index + close.length)), + next = tail.indexOf(close) +) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace)); + +/** + * @param {number} index index to replace + * @param {string} string string + * @param {string} open open string + * @param {string} close close string + * @param {string=} replace extra replace + * @returns {string} result + */ +const clearBleed = (index, string, open, close, replace) => + index < 0 + ? open + string + close + : open + replaceClose(index, string, close, replace) + close; + +/** @typedef {(value: EXPECTED_ANY) => string} PrintFunction */ + +/** + * @param {string} open open string + * @param {string} close close string + * @param {string=} replace extra replace + * @param {number=} at at + * @returns {PrintFunction} function to create color + */ +const filterEmpty = + (open, close, replace = open, at = open.length + 1) => + (string) => + string || !(string === "" || string === undefined) + ? clearBleed(`${string}`.indexOf(close, at), string, open, close, replace) + : ""; + +/** + * @param {number} open open code + * @param {number} close close code + * @param {string=} replace extra replace + * @returns {PrintFunction} result + */ +const init = (open, close, replace) => + filterEmpty(`\u001B[${open}m`, `\u001B[${close}m`, replace); + +/** + * @typedef {{ + * reset: PrintFunction + * bold: PrintFunction + * dim: PrintFunction + * italic: PrintFunction + * underline: PrintFunction + * inverse: PrintFunction + * hidden: PrintFunction + * strikethrough: PrintFunction + * black: PrintFunction + * red: PrintFunction + * green: PrintFunction + * yellow: PrintFunction + * blue: PrintFunction + * magenta: PrintFunction + * cyan: PrintFunction + * white: PrintFunction + * gray: PrintFunction + * bgBlack: PrintFunction + * bgRed: PrintFunction + * bgGreen: PrintFunction + * bgYellow: PrintFunction + * bgBlue: PrintFunction + * bgMagenta: PrintFunction + * bgCyan: PrintFunction + * bgWhite: PrintFunction + * blackBright: PrintFunction + * redBright: PrintFunction + * greenBright: PrintFunction + * yellowBright: PrintFunction + * blueBright: PrintFunction + * magentaBright: PrintFunction + * cyanBright: PrintFunction + * whiteBright: PrintFunction + * bgBlackBright: PrintFunction + * bgRedBright: PrintFunction + * bgGreenBright: PrintFunction + * bgYellowBright: PrintFunction + * bgBlueBright: PrintFunction + * bgMagentaBright: PrintFunction + * bgCyanBright: PrintFunction + * bgWhiteBright: PrintFunction + }} Colors */ + +/** + * @typedef {object} ColorsOptions + * @property {boolean=} useColor force use colors + */ + +/** + * @param {ColorsOptions=} options options + * @returns {Colors} colors + */ +const createColors = ({ useColor = isColorSupported() } = {}) => ({ + reset: useColor ? init(0, 0) : String, + bold: useColor ? init(1, 22, "\u001B[22m\u001B[1m") : String, + dim: useColor ? init(2, 22, "\u001B[22m\u001B[2m") : String, + italic: useColor ? init(3, 23) : String, + underline: useColor ? init(4, 24) : String, + inverse: useColor ? init(7, 27) : String, + hidden: useColor ? init(8, 28) : String, + strikethrough: useColor ? init(9, 29) : String, + black: useColor ? init(30, 39) : String, + red: useColor ? init(31, 39) : String, + green: useColor ? init(32, 39) : String, + yellow: useColor ? init(33, 39) : String, + blue: useColor ? init(34, 39) : String, + magenta: useColor ? init(35, 39) : String, + cyan: useColor ? init(36, 39) : String, + white: useColor ? init(37, 39) : String, + gray: useColor ? init(90, 39) : String, + bgBlack: useColor ? init(40, 49) : String, + bgRed: useColor ? init(41, 49) : String, + bgGreen: useColor ? init(42, 49) : String, + bgYellow: useColor ? init(43, 49) : String, + bgBlue: useColor ? init(44, 49) : String, + bgMagenta: useColor ? init(45, 49) : String, + bgCyan: useColor ? init(46, 49) : String, + bgWhite: useColor ? init(47, 49) : String, + blackBright: useColor ? init(90, 39) : String, + redBright: useColor ? init(91, 39) : String, + greenBright: useColor ? init(92, 39) : String, + yellowBright: useColor ? init(93, 39) : String, + blueBright: useColor ? init(94, 39) : String, + magentaBright: useColor ? init(95, 39) : String, + cyanBright: useColor ? init(96, 39) : String, + whiteBright: useColor ? init(97, 39) : String, + bgBlackBright: useColor ? init(100, 49) : String, + bgRedBright: useColor ? init(101, 49) : String, + bgGreenBright: useColor ? init(102, 49) : String, + bgYellowBright: useColor ? init(103, 49) : String, + bgBlueBright: useColor ? init(104, 49) : String, + bgMagentaBright: useColor ? init(105, 49) : String, + bgCyanBright: useColor ? init(106, 49) : String, + bgWhiteBright: useColor ? init(107, 49) : String +}); + +module.exports.createColors = createColors; module.exports.getArguments = getArguments; +module.exports.isColorSupported = isColorSupported; module.exports.processArguments = processArguments; diff --git a/lib/config/browserslistTargetHandler.js b/lib/config/browserslistTargetHandler.js index 09bf23dd336..196cfa143fe 100644 --- a/lib/config/browserslistTargetHandler.js +++ b/lib/config/browserslistTargetHandler.js @@ -74,14 +74,14 @@ const load = (input, context) => { * @param {string[]} browsers supported browsers list * @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties */ -const resolve = browsers => { +const resolve = (browsers) => { /** * Checks all against a version number * @param {Record} versions first supported version * @returns {boolean} true if supports */ - const rawChecker = versions => - browsers.every(v => { + const rawChecker = (versions) => + browsers.every((v) => { const [name, parsedVersion] = v.split(" "); if (!name) return false; const requiredVersion = versions[name]; @@ -100,8 +100,8 @@ const resolve = browsers => { ? Number(parserMinor) >= requiredVersion[1] : Number(parsedMajor) > requiredVersion[0]; }); - const anyNode = browsers.some(b => b.startsWith("node ")); - const anyBrowser = browsers.some(b => /^(?!node)/.test(b)); + const anyNode = browsers.some((b) => b.startsWith("node ")); + const anyBrowser = browsers.some((b) => /^(?!node)/.test(b)); const browserProperty = !anyBrowser ? false : anyNode ? null : true; const nodeProperty = !anyNode ? false : anyBrowser ? null : true; // Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features @@ -349,7 +349,7 @@ const resolve = browsers => { nodeBuiltins: nodeProperty, nodePrefixForCoreModules: nodeProperty && - !browsers.some(b => b.startsWith("node 15")) && + !browsers.some((b) => b.startsWith("node 15")) && rawChecker({ node: [14, 18] }), diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 3f4c4618a74..613968ab84f 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -159,7 +159,7 @@ const A = (obj, prop, factory) => { * @param {WebpackOptionsNormalized} options options to be modified * @returns {void} */ -const applyWebpackOptionsBaseDefaults = options => { +const applyWebpackOptionsBaseDefaults = (options) => { F(options, "context", () => process.cwd()); applyInfrastructureLoggingDefaults(options.infrastructureLogging); }; @@ -242,7 +242,7 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => { target === undefined || (typeof target === "string" && target.startsWith("browserslist")) || (Array.isArray(target) && - target.some(target => target.startsWith("browserslist"))), + target.some((target) => target.startsWith("browserslist"))), outputModule: /** @type {NonNullable} */ (options.experiments.outputModule), @@ -265,6 +265,9 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => { css: /** @type {NonNullable} */ (options.experiments.css), + deferImport: + /** @type {NonNullable} */ + (options.experiments.deferImport), futureDefaults, isNode: targetProperties && targetProperties.node === true, uniqueName: /** @type {string} */ (options.output.uniqueName), @@ -384,6 +387,7 @@ const applyExperimentsDefaults = ( D(experiments, "lazyCompilation", undefined); D(experiments, "buildHttp", undefined); D(experiments, "cacheUnaffected", experiments.futureDefaults); + D(experiments, "deferImport", false); F(experiments, "css", () => (experiments.futureDefaults ? true : undefined)); // TODO webpack 6: remove this. topLevelAwait should be enabled by default @@ -561,12 +565,13 @@ const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => { * @param {JavascriptParserOptions} parserOptions parser options * @param {object} options options * @param {boolean} options.futureDefaults is future defaults enabled + * @param {boolean} options.deferImport is defer import enabled * @param {boolean} options.isNode is node target platform * @returns {void} */ const applyJavascriptParserOptionsDefaults = ( parserOptions, - { futureDefaults, isNode } + { futureDefaults, deferImport, isNode } ) => { D(parserOptions, "unknownContextRequest", "."); D(parserOptions, "unknownContextRegExp", false); @@ -587,6 +592,7 @@ const applyJavascriptParserOptionsDefaults = ( D(parserOptions, "dynamicImportFetchPriority", false); D(parserOptions, "createRequire", isNode); D(parserOptions, "dynamicUrl", true); + D(parserOptions, "deferImport", deferImport); if (futureDefaults) D(parserOptions, "exportsPresence", "error"); }; @@ -594,7 +600,7 @@ const applyJavascriptParserOptionsDefaults = ( * @param {JsonGeneratorOptions} generatorOptions generator options * @returns {void} */ -const applyJsonGeneratorOptionsDefaults = generatorOptions => { +const applyJsonGeneratorOptionsDefaults = (generatorOptions) => { D(generatorOptions, "JSONParse", true); }; @@ -626,6 +632,7 @@ const applyCssGeneratorOptionsDefaults = ( * @param {boolean} options.futureDefaults is future defaults enabled * @param {string} options.uniqueName the unique name * @param {boolean} options.isNode is node target platform + * @param {boolean} options.deferImport is defer import enabled * @param {TargetProperties | false} options.targetProperties target properties * @param {Mode | undefined} options.mode mode * @returns {void} @@ -641,7 +648,8 @@ const applyModuleDefaults = ( isNode, uniqueName, targetProperties, - mode + mode, + deferImport } ) => { if (cache) { @@ -652,7 +660,7 @@ const applyModuleDefaults = ( * @param {Module} module module * @returns {boolean} true, if we want to cache the module */ - module => { + (module) => { const name = module.nameForCondition(); if (!name) { return false; @@ -699,6 +707,7 @@ const applyModuleDefaults = ( (module.parser.javascript), { futureDefaults, + deferImport, isNode } ); @@ -964,7 +973,7 @@ const applyOutputDefaults = ( * @param {Library=} library the library option * @returns {string} a readable library name */ - const getLibraryName = library => { + const getLibraryName = (library) => { const libraryName = typeof library === "object" && library && @@ -1015,7 +1024,7 @@ const applyOutputDefaults = ( * @param {boolean | undefined} v value * @returns {boolean} true, when v is truthy or undefined */ - const optimistic = v => v || v === undefined; + const optimistic = (v) => v || v === undefined; /** * @param {boolean | undefined} v value * @param {boolean | undefined} c condition @@ -1322,7 +1331,7 @@ const applyOutputDefaults = ( * @param {(entryDescription: EntryDescription) => void} fn iterator * @returns {void} */ - const forEachEntry = fn => { + const forEachEntry = (fn) => { for (const name of Object.keys(entry)) { fn(/** @type {{[k: string] : EntryDescription}} */ (entry)[name]); } @@ -1333,7 +1342,7 @@ const applyOutputDefaults = ( if (output.library) { enabledLibraryTypes.push(output.library.type); } - forEachEntry(desc => { + forEachEntry((desc) => { if (desc.library) { enabledLibraryTypes.push(desc.library.type); } @@ -1349,7 +1358,7 @@ const applyOutputDefaults = ( if (output.workerChunkLoading) { enabledChunkLoadingTypes.add(output.workerChunkLoading); } - forEachEntry(desc => { + forEachEntry((desc) => { if (desc.chunkLoading) { enabledChunkLoadingTypes.add(desc.chunkLoading); } @@ -1365,7 +1374,7 @@ const applyOutputDefaults = ( if (output.workerWasmLoading) { enabledWasmLoadingTypes.add(output.workerWasmLoading); } - forEachEntry(desc => { + forEachEntry((desc) => { if (desc.wasmLoading) { enabledWasmLoadingTypes.add(desc.wasmLoading); } @@ -1553,7 +1562,7 @@ const applyOptimizationDefaults = ( D(optimization, "minimize", production); A(optimization, "minimizer", () => [ { - apply: compiler => { + apply: (compiler) => { // Lazy load the Terser plugin const TerserPlugin = require("terser-webpack-plugin"); @@ -1735,7 +1744,7 @@ const getResolveLoaderDefaults = ({ cache }) => { * @param {InfrastructureLogging} infrastructureLogging options * @returns {void} */ -const applyInfrastructureLoggingDefaults = infrastructureLogging => { +const applyInfrastructureLoggingDefaults = (infrastructureLogging) => { F(infrastructureLogging, "stream", () => process.stderr); const tty = /** @type {NonNullable} */ diff --git a/lib/config/normalization.js b/lib/config/normalization.js index 04a7a2d4ab2..fbd001c349b 100644 --- a/lib/config/normalization.js +++ b/lib/config/normalization.js @@ -57,7 +57,7 @@ const nestedConfig = (value, fn) => * @param {T|undefined} value value or not * @returns {T} result value */ -const cloneObject = value => /** @type {T} */ ({ ...value }); +const cloneObject = (value) => /** @type {T} */ ({ ...value }); /** * @template T * @template R @@ -124,13 +124,13 @@ const keyedNestedConfig = (value, fn, customKeys) => { * @param {WebpackOptions} config input config * @returns {WebpackOptionsNormalized} normalized options */ -const getNormalizedWebpackOptions = config => ({ +const getNormalizedWebpackOptions = (config) => ({ amd: config.amd, bail: config.bail, cache: /** @type {NonNullable} */ ( - optionalNestedConfig(config.cache, cache => { + optionalNestedConfig(config.cache, (cache) => { if (cache === false) return false; if (cache === true) { return { @@ -173,7 +173,7 @@ const getNormalizedWebpackOptions = config => ({ ), context: config.context, dependencies: config.dependencies, - devServer: optionalNestedConfig(config.devServer, devServer => { + devServer: optionalNestedConfig(config.devServer, (devServer) => { if (devServer === false) return false; return { ...devServer }; }), @@ -183,25 +183,25 @@ const getNormalizedWebpackOptions = config => ({ ? { main: {} } : typeof config.entry === "function" ? ( - fn => () => + (fn) => () => Promise.resolve().then(fn).then(getNormalizedEntryStatic) )(config.entry) : getNormalizedEntryStatic(config.entry), - experiments: nestedConfig(config.experiments, experiments => ({ + experiments: nestedConfig(config.experiments, (experiments) => ({ ...experiments, - buildHttp: optionalNestedConfig(experiments.buildHttp, options => + buildHttp: optionalNestedConfig(experiments.buildHttp, (options) => Array.isArray(options) ? { allowedUris: options } : options ), lazyCompilation: optionalNestedConfig( experiments.lazyCompilation, - options => (options === true ? {} : options) + (options) => (options === true ? {} : options) ) })), externals: /** @type {NonNullable} */ (config.externals), externalsPresets: cloneObject(config.externalsPresets), externalsType: config.externalsType, ignoreWarnings: config.ignoreWarnings - ? config.ignoreWarnings.map(ignore => { + ? config.ignoreWarnings.map((ignore) => { if (typeof ignore === "function") return ignore; const i = ignore instanceof RegExp ? { message: ignore } : ignore; return (warning, { requestShortener }) => { @@ -236,11 +236,11 @@ const getNormalizedWebpackOptions = config => ({ module: /** @type {ModuleOptionsNormalized} */ ( - nestedConfig(config.module, module => ({ + nestedConfig(config.module, (module) => ({ noParse: module.noParse, unsafeCache: module.unsafeCache, parser: keyedNestedConfig(module.parser, cloneObject, { - javascript: parserOptions => ({ + javascript: (parserOptions) => ({ unknownContextRequest: module.unknownContextRequest, unknownContextRegExp: module.unknownContextRegExp, unknownContextRecursive: module.unknownContextRecursive, @@ -259,26 +259,26 @@ const getNormalizedWebpackOptions = config => ({ }) }), generator: cloneObject(module.generator), - defaultRules: optionalNestedArray(module.defaultRules, r => [...r]), - rules: nestedArray(module.rules, r => [...r]) + defaultRules: optionalNestedArray(module.defaultRules, (r) => [...r]), + rules: nestedArray(module.rules, (r) => [...r]) })) ), name: config.name, node: nestedConfig( config.node, - node => + (node) => node && { ...node } ), - optimization: nestedConfig(config.optimization, optimization => ({ + optimization: nestedConfig(config.optimization, (optimization) => ({ ...optimization, runtimeChunk: getNormalizedOptimizationRuntimeChunk( optimization.runtimeChunk ), splitChunks: nestedConfig( optimization.splitChunks, - splitChunks => + (splitChunks) => splitChunks && { ...splitChunks, defaultSizeTypes: splitChunks.defaultSizeTypes @@ -295,7 +295,7 @@ const getNormalizedWebpackOptions = config => ({ ) : optimization.emitOnErrors })), - output: nestedConfig(config.output, output => { + output: nestedConfig(config.output, (output) => { const { library } = output; const libraryAsName = /** @type {LibraryName} */ (library); const libraryBase = @@ -384,13 +384,16 @@ const getNormalizedWebpackOptions = config => ({ sourcePrefix: output.sourcePrefix, strictModuleErrorHandling: output.strictModuleErrorHandling, strictModuleExceptionHandling: output.strictModuleExceptionHandling, - trustedTypes: optionalNestedConfig(output.trustedTypes, trustedTypes => { - if (trustedTypes === true) return {}; - if (typeof trustedTypes === "string") { - return { policyName: trustedTypes }; + trustedTypes: optionalNestedConfig( + output.trustedTypes, + (trustedTypes) => { + if (trustedTypes === true) return {}; + if (typeof trustedTypes === "string") { + return { policyName: trustedTypes }; + } + return { ...trustedTypes }; } - return { ...trustedTypes }; - }), + ), uniqueName: output.uniqueName, wasmLoading: output.wasmLoading, webassemblyModuleFilename: output.webassemblyModuleFilename, @@ -401,13 +404,13 @@ const getNormalizedWebpackOptions = config => ({ return result; }), parallelism: config.parallelism, - performance: optionalNestedConfig(config.performance, performance => { + performance: optionalNestedConfig(config.performance, (performance) => { if (performance === false) return false; return { ...performance }; }), - plugins: /** @type {Plugins} */ (nestedArray(config.plugins, p => [...p])), + plugins: /** @type {Plugins} */ (nestedArray(config.plugins, (p) => [...p])), profile: config.profile, recordsInputPath: config.recordsInputPath !== undefined @@ -417,39 +420,39 @@ const getNormalizedWebpackOptions = config => ({ config.recordsOutputPath !== undefined ? config.recordsOutputPath : config.recordsPath, - resolve: nestedConfig(config.resolve, resolve => ({ + resolve: nestedConfig(config.resolve, (resolve) => ({ ...resolve, byDependency: keyedNestedConfig(resolve.byDependency, cloneObject) })), resolveLoader: cloneObject(config.resolveLoader), - snapshot: nestedConfig(config.snapshot, snapshot => ({ + snapshot: nestedConfig(config.snapshot, (snapshot) => ({ resolveBuildDependencies: optionalNestedConfig( snapshot.resolveBuildDependencies, - resolveBuildDependencies => ({ + (resolveBuildDependencies) => ({ timestamp: resolveBuildDependencies.timestamp, hash: resolveBuildDependencies.hash }) ), buildDependencies: optionalNestedConfig( snapshot.buildDependencies, - buildDependencies => ({ + (buildDependencies) => ({ timestamp: buildDependencies.timestamp, hash: buildDependencies.hash }) ), - resolve: optionalNestedConfig(snapshot.resolve, resolve => ({ + resolve: optionalNestedConfig(snapshot.resolve, (resolve) => ({ timestamp: resolve.timestamp, hash: resolve.hash })), - module: optionalNestedConfig(snapshot.module, module => ({ + module: optionalNestedConfig(snapshot.module, (module) => ({ timestamp: module.timestamp, hash: module.hash })), - immutablePaths: optionalNestedArray(snapshot.immutablePaths, p => [...p]), - managedPaths: optionalNestedArray(snapshot.managedPaths, p => [...p]), - unmanagedPaths: optionalNestedArray(snapshot.unmanagedPaths, p => [...p]) + immutablePaths: optionalNestedArray(snapshot.immutablePaths, (p) => [...p]), + managedPaths: optionalNestedArray(snapshot.managedPaths, (p) => [...p]), + unmanagedPaths: optionalNestedArray(snapshot.unmanagedPaths, (p) => [...p]) })), - stats: nestedConfig(config.stats, stats => { + stats: nestedConfig(config.stats, (stats) => { if (stats === false) { return { preset: "none" @@ -478,7 +481,7 @@ const getNormalizedWebpackOptions = config => ({ * @param {EntryStatic} entry static entry options * @returns {EntryStaticNormalized} normalized static entry options */ -const getNormalizedEntryStatic = entry => { +const getNormalizedEntryStatic = (entry) => { if (typeof entry === "string") { return { main: { @@ -540,7 +543,7 @@ const getNormalizedEntryStatic = entry => { * @param {OptimizationRuntimeChunk=} runtimeChunk runtimeChunk option * @returns {OptimizationRuntimeChunkNormalized=} normalized runtimeChunk option */ -const getNormalizedOptimizationRuntimeChunk = runtimeChunk => { +const getNormalizedOptimizationRuntimeChunk = (runtimeChunk) => { if (runtimeChunk === undefined) return; if (runtimeChunk === false) return false; if (runtimeChunk === "single") { @@ -550,7 +553,7 @@ const getNormalizedOptimizationRuntimeChunk = runtimeChunk => { } if (runtimeChunk === true || runtimeChunk === "multiple") { return { - name: entrypoint => `runtime~${entrypoint.name}` + name: (entrypoint) => `runtime~${entrypoint.name}` }; } const { name } = runtimeChunk; diff --git a/lib/config/target.js b/lib/config/target.js index 235019d665c..e8bb48d0069 100644 --- a/lib/config/target.js +++ b/lib/config/target.js @@ -15,7 +15,7 @@ const getBrowserslistTargetHandler = memoize(() => * @param {string} context the context directory * @returns {string} default target */ -const getDefaultTarget = context => { +const getDefaultTarget = (context) => { const browsers = getBrowserslistTargetHandler().load(null, context); return browsers ? "browserslist" : "web"; }; @@ -287,7 +287,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis "esX", "EcmaScript in this version. Examples: es2020, es5.", /^es(\d+)$/, - version => { + (version) => { let v = Number(version); if (v < 1000) v += 2009; return { @@ -333,7 +333,7 @@ const getTargetProperties = (target, context) => { * @param {TargetProperties[]} targetProperties array of target properties * @returns {TargetProperties} merged target properties */ -const mergeTargetProperties = targetProperties => { +const mergeTargetProperties = (targetProperties) => { /** @type {Set} */ const keys = new Set(); for (const tp of targetProperties) { @@ -371,7 +371,7 @@ const mergeTargetProperties = targetProperties => { * @returns {TargetProperties} target properties */ const getTargetsProperties = (targets, context) => - mergeTargetProperties(targets.map(t => getTargetProperties(t, context))); + mergeTargetProperties(targets.map((t) => getTargetProperties(t, context))); module.exports.getDefaultTarget = getDefaultTarget; module.exports.getTargetProperties = getTargetProperties; diff --git a/lib/container/ContainerEntryModule.js b/lib/container/ContainerEntryModule.js index 0395372e84e..37a2298491e 100644 --- a/lib/container/ContainerEntryModule.js +++ b/lib/container/ContainerEntryModule.js @@ -159,7 +159,7 @@ class ContainerEntryModule extends Module { for (const block of this.blocks) { const { dependencies } = block; - const modules = dependencies.map(dependency => { + const modules = dependencies.map((dependency) => { const dep = /** @type {ContainerExposedDependency} */ (dependency); return { name: dep.exposedName, @@ -170,9 +170,9 @@ class ContainerEntryModule extends Module { let str; - if (modules.some(m => !m.module)) { + if (modules.some((m) => !m.module)) { str = runtimeTemplate.throwMissingModuleErrorBlock({ - request: modules.map(m => m.request).join(", ") + request: modules.map((m) => m.request).join(", ") }); } else { str = `return ${runtimeTemplate.blockPromise({ diff --git a/lib/container/ContainerPlugin.js b/lib/container/ContainerPlugin.js index 9a497fc5ad8..7a725dc844c 100644 --- a/lib/container/ContainerPlugin.js +++ b/lib/container/ContainerPlugin.js @@ -51,11 +51,11 @@ class ContainerPlugin { exposes: /** @type {ExposesList} */ ( parseOptions( options.exposes, - item => ({ + (item) => ({ import: Array.isArray(item) ? item : [item], name: undefined }), - item => ({ + (item) => ({ import: Array.isArray(item.import) ? item.import : [item.import], name: item.name || undefined }) @@ -91,7 +91,7 @@ class ContainerPlugin { runtime, library }, - error => { + (error) => { if (error) return callback(error); hooks.addContainerEntryDependency.call(dep); callback(); diff --git a/lib/container/ContainerReferencePlugin.js b/lib/container/ContainerReferencePlugin.js index 207329afe61..95efc51b99d 100644 --- a/lib/container/ContainerReferencePlugin.js +++ b/lib/container/ContainerReferencePlugin.js @@ -43,11 +43,11 @@ class ContainerReferencePlugin { this._remoteType = options.remoteType; this._remotes = parseOptions( options.remotes, - item => ({ + (item) => ({ external: Array.isArray(item) ? item : [item], shareScope: options.shareScope || "default" }), - item => ({ + (item) => ({ external: Array.isArray(item.external) ? item.external : [item.external], @@ -97,7 +97,7 @@ class ContainerReferencePlugin { new FallbackModuleFactory() ); - normalModuleFactory.hooks.factorize.tap(PLUGIN_NAME, data => { + normalModuleFactory.hooks.factorize.tap(PLUGIN_NAME, (data) => { if (!data.request.includes("!")) { for (const [key, config] of remotes) { if ( diff --git a/lib/container/FallbackModule.js b/lib/container/FallbackModule.js index 7e0be846aa9..be757f0e061 100644 --- a/lib/container/FallbackModule.js +++ b/lib/container/FallbackModule.js @@ -131,7 +131,7 @@ class FallbackModule extends Module { * @returns {CodeGenerationResult} result */ codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { - const ids = this.dependencies.map(dep => + const ids = this.dependencies.map((dep) => chunkGraph.getModuleId(/** @type {Module} */ (moduleGraph.getModule(dep))) ); const code = Template.asString([ diff --git a/lib/container/HoistContainerReferencesPlugin.js b/lib/container/HoistContainerReferencesPlugin.js index 669dcccddca..238bb32805b 100644 --- a/lib/container/HoistContainerReferencesPlugin.js +++ b/lib/container/HoistContainerReferencesPlugin.js @@ -31,19 +31,19 @@ class HoistContainerReferences { * @param {Compiler} compiler The webpack compiler instance. */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const hooks = getModuleFederationPlugin().getCompilationHooks(compilation); const depsToTrace = new Set(); const entryExternalsToHoist = new Set(); - hooks.addContainerEntryDependency.tap(PLUGIN_NAME, dep => { + hooks.addContainerEntryDependency.tap(PLUGIN_NAME, (dep) => { depsToTrace.add(dep); }); - hooks.addFederationRuntimeDependency.tap(PLUGIN_NAME, dep => { + hooks.addFederationRuntimeDependency.tap(PLUGIN_NAME, (dep) => { depsToTrace.add(dep); }); - compilation.hooks.addEntry.tap(PLUGIN_NAME, entryDep => { + compilation.hooks.addEntry.tap(PLUGIN_NAME, (entryDep) => { if (entryDep.type === "entry") { entryExternalsToHoist.add(entryDep); } @@ -56,7 +56,7 @@ class HoistContainerReferences { // advanced stage is where SplitChunksPlugin runs. stage: STAGE_ADVANCED + 1 }, - _chunks => { + (_chunks) => { this.hoistModulesInChunks( compilation, depsToTrace, @@ -92,7 +92,7 @@ class HoistContainerReferences { const runtimes = new Set(); for (const runtimeSpec of containerRuntimes) { - forEachRuntime(runtimeSpec, runtimeKey => { + forEachRuntime(runtimeSpec, (runtimeKey) => { if (runtimeKey) { runtimes.add(runtimeKey); } @@ -139,7 +139,7 @@ class HoistContainerReferences { const runtimes = new Set(); for (const runtimeSpec of containerRuntimes) { - forEachRuntime(runtimeSpec, runtimeKey => { + forEachRuntime(runtimeSpec, (runtimeKey) => { if (runtimeKey) { runtimes.add(runtimeKey); } diff --git a/lib/container/options.js b/lib/container/options.js index 367d622613e..953aea64c76 100644 --- a/lib/container/options.js +++ b/lib/container/options.js @@ -28,7 +28,7 @@ const process = (options, normalizeSimple, normalizeOptions, fn) => { /** * @param {(string | Item)[]} items items */ - const array = items => { + const array = (items) => { for (const item of items) { if (typeof item === "string") { fn(item, normalizeSimple(item, item)); @@ -42,7 +42,7 @@ const process = (options, normalizeSimple, normalizeOptions, fn) => { /** * @param {Item} obj an object */ - const object = obj => { + const object = (obj) => { for (const [key, value] of Object.entries(obj)) { if (typeof value === "string" || Array.isArray(value)) { fn(key, normalizeSimple(value, key)); @@ -90,8 +90,8 @@ const scope = (scope, options) => { const obj = {}; process( options, - item => /** @type {string | string[] | T} */ (item), - item => /** @type {string | string[] | T} */ (item), + (item) => /** @type {string | string[] | T} */ (item), + (item) => /** @type {string | string[] | T} */ (item), (key, value) => { obj[ key.startsWith("./") ? `${scope}${key.slice(1)}` : `${scope}/${key}` diff --git a/lib/css/CssGenerator.js b/lib/css/CssGenerator.js index a40ca9ad59f..56cbc5d607f 100644 --- a/lib/css/CssGenerator.js +++ b/lib/css/CssGenerator.js @@ -18,6 +18,7 @@ const { } = require("../ModuleSourceTypesConstants"); const RuntimeGlobals = require("../RuntimeGlobals"); const Template = require("../Template"); +const memoize = require("../util/memoize"); /** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("../../declarations/WebpackOptions").CssAutoGeneratorOptions} CssAutoGeneratorOptions */ @@ -37,6 +38,8 @@ const Template = require("../Template"); /** @typedef {import("../NormalModule")} NormalModule */ /** @typedef {import("../util/Hash")} Hash */ +const getPropertyName = memoize(() => require("../util/propertyName")); + class CssGenerator extends Generator { /** * @param {CssAutoGeneratorOptions | CssGlobalGeneratorOptions | CssModuleGeneratorOptions} options options @@ -119,7 +122,7 @@ class CssGenerator extends Generator { /** * @param {Dependency} dependency dependency */ - const handleDependency = dependency => { + const handleDependency = (dependency) => { const constructor = /** @type {new (...args: EXPECTED_ANY[]) => Dependency} */ (dependency.constructor); @@ -147,6 +150,7 @@ class CssGenerator extends Generator { if (generateContext.concatenationScope) { const source = new ConcatSource(); const usedIdentifiers = new Set(); + const { RESERVED_IDENTIFIER } = getPropertyName(); for (const [name, v] of cssData.exports) { const usedName = generateContext.moduleGraph .getExportInfo(module, name) @@ -156,8 +160,6 @@ class CssGenerator extends Generator { } let identifier = Template.toIdentifier(usedName); - const { RESERVED_IDENTIFIER } = require("../util/propertyName"); - if (RESERVED_IDENTIFIER.has(identifier)) { identifier = `_${identifier}`; } diff --git a/lib/css/CssLoadingRuntimeModule.js b/lib/css/CssLoadingRuntimeModule.js index 1c46eebe552..ce2a9b13d88 100644 --- a/lib/css/CssLoadingRuntimeModule.js +++ b/lib/css/CssLoadingRuntimeModule.js @@ -181,7 +181,7 @@ class CssLoadingRuntimeModule extends RuntimeModule { stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" }{`, Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 0`).join( ",\n" ) ), diff --git a/lib/css/CssModulesPlugin.js b/lib/css/CssModulesPlugin.js index 9dfc70d897b..9c5be4c1387 100644 --- a/lib/css/CssModulesPlugin.js +++ b/lib/css/CssModulesPlugin.js @@ -98,7 +98,7 @@ const getCssLoadingRuntimeModule = memoize(() => * @param {string} name name * @returns {{ oneOf: [{ $ref: string }], definitions: import("../../schemas/WebpackOptions.json")["definitions"] }} schema */ -const getSchema = name => { +const getSchema = (name) => { const { definitions } = require("../../schemas/WebpackOptions.json"); return { @@ -264,7 +264,7 @@ class CssModulesPlugin { ]) { normalModuleFactory.hooks.createParser .for(type) - .tap(PLUGIN_NAME, parserOptions => { + .tap(PLUGIN_NAME, (parserOptions) => { validateParserOptions[type](parserOptions); const { url, import: importOption, namedExports } = parserOptions; @@ -300,7 +300,7 @@ class CssModulesPlugin { }); normalModuleFactory.hooks.createGenerator .for(type) - .tap(PLUGIN_NAME, generatorOptions => { + .tap(PLUGIN_NAME, (generatorOptions) => { validateGeneratorOptions[type](generatorOptions); return new CssGenerator( @@ -442,7 +442,7 @@ class CssModulesPlugin { compilation.hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash, context) => { hooks.chunkHash.call(chunk, hash, context); }); - compilation.hooks.contentHash.tap(PLUGIN_NAME, chunk => { + compilation.hooks.contentHash.tap(PLUGIN_NAME, (chunk) => { const { chunkGraph, codeGenerationResults, @@ -533,7 +533,7 @@ class CssModulesPlugin { * @param {Chunk} chunk the chunk * @returns {boolean} true, when enabled */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const chunkLoading = options && options.chunkLoading !== undefined @@ -566,7 +566,7 @@ class CssModulesPlugin { if ( !chunkGraph.hasModuleInGraph( chunk, - m => + (m) => m.type === CSS_MODULE_TYPE || m.type === CSS_MODULE_TYPE_GLOBAL || m.type === CSS_MODULE_TYPE_MODULE || @@ -587,7 +587,7 @@ class CssModulesPlugin { if ( !chunkGraph.hasModuleInGraph( chunk, - m => + (m) => m.type === CSS_MODULE_TYPE || m.type === CSS_MODULE_TYPE_GLOBAL || m.type === CSS_MODULE_TYPE_MODULE || @@ -617,21 +617,24 @@ class CssModulesPlugin { // Get ordered list of modules per chunk group // Lists are in reverse order to allow to use Array.pop() - const modulesByChunkGroup = Array.from(chunk.groupsIterable, chunkGroup => { - const sortedModules = modulesList - .map(module => ({ - module, - index: chunkGroup.getModulePostOrderIndex(module) - })) - .filter(item => item.index !== undefined) - .sort( - (a, b) => - /** @type {number} */ (b.index) - /** @type {number} */ (a.index) - ) - .map(item => item.module); - - return { list: sortedModules, set: new Set(sortedModules) }; - }); + const modulesByChunkGroup = Array.from( + chunk.groupsIterable, + (chunkGroup) => { + const sortedModules = modulesList + .map((module) => ({ + module, + index: chunkGroup.getModulePostOrderIndex(module) + })) + .filter((item) => item.index !== undefined) + .sort( + (a, b) => + /** @type {number} */ (b.index) - /** @type {number} */ (a.index) + ) + .map((item) => item.module); + + return { list: sortedModules, set: new Set(sortedModules) }; + } + ); if (modulesByChunkGroup.length === 1) { return modulesByChunkGroup[0].list.reverse(); diff --git a/lib/css/CssParser.js b/lib/css/CssParser.js index 7d19ba4def3..b8b430bc7a7 100644 --- a/lib/css/CssParser.js +++ b/lib/css/CssParser.js @@ -76,7 +76,7 @@ const normalizeUrl = (str, isString) => { // Remove unnecessary spaces from `url(" img.png ")` .replace(TRIM_WHITE_SPACES, "") // Unescape - .replace(UNESCAPE, match => { + .replace(UNESCAPE, (match) => { if (match.length > 2) { return String.fromCharCode(Number.parseInt(match.slice(1).trim(), 16)); } @@ -108,7 +108,7 @@ const regexExcessiveSpaces = * @param {string} str string * @returns {string} escaped identifier */ -const escapeIdentifier = str => { +const escapeIdentifier = (str) => { let output = ""; let counter = 0; @@ -161,7 +161,7 @@ const CONTAINS_ESCAPE = /\\/; * @param {string} str string * @returns {[string, number] | undefined} hex */ -const gobbleHex = str => { +const gobbleHex = (str) => { const lower = str.toLowerCase(); let hex = ""; let spaceTerminated = false; @@ -198,7 +198,7 @@ const gobbleHex = str => { * @param {string} str string * @returns {string} unescaped string */ -const unescapeIdentifier = str => { +const unescapeIdentifier = (str) => { const needToProcess = CONTAINS_ESCAPE.test(str); if (!needToProcess) return str; let ret = ""; @@ -646,7 +646,7 @@ class CssParser extends Parser { /** * @param {string} input input */ - const processDeclarationValueDone = input => { + const processDeclarationValueDone = (input) => { if (inAnimationProperty && lastIdentifier) { const { line: sl, column: sc } = locConverter.get(lastIdentifier[0]); const { line: el, column: ec } = locConverter.get(lastIdentifier[1]); diff --git a/lib/css/walkCssTokens.js b/lib/css/walkCssTokens.js index f6b8b042bda..bfdc05b10e2 100644 --- a/lib/css/walkCssTokens.js +++ b/lib/css/walkCssTokens.js @@ -98,7 +98,7 @@ const consumeSpace = (input, pos, _callbacks) => { * @param {number} cc char code * @returns {boolean} true, if cc is a newline */ -const _isNewline = cc => +const _isNewline = (cc) => cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED; /** @@ -119,13 +119,13 @@ const consumeExtraNewline = (cc, input, pos) => { * @param {number} cc char code * @returns {boolean} true, if cc is a space (U+0009 CHARACTER TABULATION or U+0020 SPACE) */ -const _isSpace = cc => cc === CC_TAB || cc === CC_SPACE; +const _isSpace = (cc) => cc === CC_TAB || cc === CC_SPACE; /** * @param {number} cc char code * @returns {boolean} true, if cc is a whitespace */ -const _isWhiteSpace = cc => _isNewline(cc) || _isSpace(cc); +const _isWhiteSpace = (cc) => _isNewline(cc) || _isSpace(cc); /** * ident-start code point @@ -134,7 +134,7 @@ const _isWhiteSpace = cc => _isNewline(cc) || _isSpace(cc); * @param {number} cc char code * @returns {boolean} true, if cc is a start code point of an identifier */ -const isIdentStartCodePoint = cc => +const isIdentStartCodePoint = (cc) => (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) || cc === CC_LOW_LINE || @@ -189,7 +189,7 @@ const consumeComments = (input, pos, callbacks) => { * @param {number} cc char code * @returns {boolean} true, if cc is a hex digit */ -const _isHexDigit = cc => +const _isHexDigit = (cc) => _isDigit(cc) || (cc >= CC_UPPER_A && cc <= CC_UPPER_F) || (cc >= CC_LOWER_A && cc <= CC_LOWER_F); @@ -325,7 +325,7 @@ const isNonASCIICodePoint = (cc, q) => * @param {number} cc char code * @returns {boolean} is letter */ -const isLetter = cc => +const isLetter = (cc) => (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) || (cc >= CC_UPPER_A && cc <= CC_UPPER_Z); @@ -348,7 +348,7 @@ const _isIdentCodePoint = (cc, q) => * @param {number} cc char code * @returns {boolean} is digit */ -const _isDigit = cc => cc >= CC_0 && cc <= CC_9; +const _isDigit = (cc) => cc >= CC_0 && cc <= CC_9; /** * @param {string} input input @@ -799,7 +799,7 @@ const _consumeAnIdentSequence = (input, pos) => { * @param {number} cc char code * @returns {boolean} true, when cc is the non-printable code point, otherwise false */ -const _isNonPrintableCodePoint = cc => +const _isNonPrintableCodePoint = (cc) => (cc >= 0x00 && cc <= 0x08) || cc === 0x0b || (cc >= 0x0e && cc <= 0x1f) || @@ -1584,7 +1584,7 @@ const eatIdentSequenceOrString = (input, pos) => { * @param {string} chars characters * @returns {(input: string, pos: number) => number} function to eat characters */ -const eatUntil = chars => { +const eatUntil = (chars) => { const charCodes = Array.from({ length: chars.length }, (_, i) => chars.charCodeAt(i) ); diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js index 7a0f648217b..eff5240ae09 100644 --- a/lib/debug/ProfilingPlugin.js +++ b/lib/debug/ProfilingPlugin.js @@ -203,7 +203,7 @@ const createTrace = (fs, outputPath) => { trace, counter, profiler, - end: callback => { + end: (callback) => { trace.push("]"); // Wait until the write stream finishes. fsStream.on("close", () => { @@ -288,7 +288,7 @@ class ProfilingPlugin { }, (stats, callback) => { if (compiler.watchMode) return callback(); - tracer.profiler.stopProfiling().then(parsedResults => { + tracer.profiler.stopProfiling().then((parsedResults) => { if (parsedResults === undefined) { tracer.profiler.destroy(); tracer.end(callback); @@ -443,12 +443,12 @@ const interceptAllCssModulesPluginHooks = (compilation, tracer) => { * @param {Trace} tracer tracer * @returns {(hookName: string) => TODO} interceptor */ -const makeInterceptorFor = (instance, tracer) => hookName => ({ +const makeInterceptorFor = (instance, tracer) => (hookName) => ({ /** * @param {FullTap} tapInfo tap info * @returns {FullTap} modified full tap */ - register: tapInfo => { + register: (tapInfo) => { const { name, type, fn: internalFn } = tapInfo; const newFn = // Don't tap our own hooks to ensure stream can close cleanly @@ -487,7 +487,7 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => { const promise = /** @type {Promise<(...args: EXPECTED_ANY[]) => EXPECTED_ANY>} */ (fn(...args)); - return promise.then(r => { + return promise.then((r) => { tracer.trace.end({ name, id, diff --git a/lib/dependencies/AMDDefineDependencyParserPlugin.js b/lib/dependencies/AMDDefineDependencyParserPlugin.js index 43bb2763e30..56cab2a8219 100644 --- a/lib/dependencies/AMDDefineDependencyParserPlugin.js +++ b/lib/dependencies/AMDDefineDependencyParserPlugin.js @@ -36,7 +36,7 @@ const { addLocalModule, getLocalModule } = require("./LocalModulesHelpers"); * @param {Expression | SpreadElement} expr expression * @returns {expr is CallExpression} true if it's a bound function expression */ -const isBoundFunctionExpression = expr => { +const isBoundFunctionExpression = (expr) => { if (expr.type !== "CallExpression") return false; if (expr.callee.type !== "MemberExpression") return false; if (expr.callee.computed) return false; @@ -52,7 +52,7 @@ const isBoundFunctionExpression = expr => { * @param {Expression | SpreadElement} expr expression * @returns {expr is FunctionExpression | ArrowFunctionExpression} true when unbound function expression */ -const isUnboundFunctionExpression = expr => { +const isUnboundFunctionExpression = (expr) => { if (expr.type === "FunctionExpression") return true; if (expr.type === "ArrowFunctionExpression") return true; return false; @@ -62,7 +62,7 @@ const isUnboundFunctionExpression = expr => { * @param {Expression | SpreadElement} expr expression * @returns {expr is FunctionExpression | ArrowFunctionExpression | CallExpression} true when callable */ -const isCallable = expr => { +const isCallable = (expr) => { if (isUnboundFunctionExpression(expr)) return true; if (isBoundFunctionExpression(expr)) return true; return false; @@ -410,7 +410,7 @@ class AMDDefineDependencyParserPlugin { parser.inScope( /** @type {Identifier[]} */ (object.params).filter( - i => !["require", "module", "exports"].includes(i.name) + (i) => !["require", "module", "exports"].includes(i.name) ), () => { for (const [name, varInfo] of fnRenames) { diff --git a/lib/dependencies/AMDPlugin.js b/lib/dependencies/AMDPlugin.js index 9c8a12f6a0a..add34161d7d 100644 --- a/lib/dependencies/AMDPlugin.js +++ b/lib/dependencies/AMDPlugin.js @@ -156,7 +156,7 @@ class AMDPlugin { ); parser.hooks.evaluateIdentifier .for(optionExpr) - .tap(PLUGIN_NAME, expr => + .tap(PLUGIN_NAME, (expr) => evaluateToIdentifier( optionExpr, rootName, @@ -188,7 +188,7 @@ class AMDPlugin { () => [] ); - parser.hooks.expression.for("define").tap(PLUGIN_NAME, expr => { + parser.hooks.expression.for("define").tap(PLUGIN_NAME, (expr) => { const dep = new ConstDependency( RuntimeGlobals.amdDefine, /** @type {Range} */ (expr.range), @@ -208,7 +208,7 @@ class AMDPlugin { .for("define") .tap(PLUGIN_NAME, evaluateToString("function")); parser.hooks.canRename.for("define").tap(PLUGIN_NAME, approve); - parser.hooks.rename.for("define").tap(PLUGIN_NAME, expr => { + parser.hooks.rename.for("define").tap(PLUGIN_NAME, (expr) => { const dep = new ConstDependency( RuntimeGlobals.amdDefine, /** @type {Range} */ (expr.range), diff --git a/lib/dependencies/AMDRequireArrayDependency.js b/lib/dependencies/AMDRequireArrayDependency.js index 1df80723d10..0740025fefa 100644 --- a/lib/dependencies/AMDRequireArrayDependency.js +++ b/lib/dependencies/AMDRequireArrayDependency.js @@ -89,7 +89,7 @@ AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate ext * @returns {string} content */ getContent(dep, templateContext) { - const requires = dep.depsArray.map(dependency => + const requires = dep.depsArray.map((dependency) => this.contentForDependency(dependency, templateContext) ); return `[${requires.join(", ")}]`; diff --git a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js index e0bbf60b926..0d28b8b9f17 100644 --- a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +++ b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js @@ -52,7 +52,7 @@ class AMDRequireDependenciesBlockParserPlugin { if (fnData) { parser.inScope( fnData.fn.params.filter( - i => + (i) => !["require", "module", "exports"].includes( /** @type {Identifier} */ (i).name ) @@ -236,7 +236,7 @@ class AMDRequireDependenciesBlockParserPlugin { if (param.isArray()) { const result = /** @type {BasicEvaluatedExpression[]} */ - (param.items).map(item => this.processItemForRequestString(item)); + (param.items).map((item) => this.processItemForRequestString(item)); if (result.every(Boolean)) return result.join(" "); } else if (param.isConstArray()) { return /** @type {string[]} */ (param.array).join(" "); @@ -251,7 +251,7 @@ class AMDRequireDependenciesBlockParserPlugin { if (param.isConditional()) { const result = /** @type {BasicEvaluatedExpression[]} */ - (param.options).map(item => this.processItemForRequestString(item)); + (param.options).map((item) => this.processItemForRequestString(item)); if (result.every(Boolean)) return result.join("|"); } else if (param.isString()) { return param.string; diff --git a/lib/dependencies/CommonJsExportRequireDependency.js b/lib/dependencies/CommonJsExportRequireDependency.js index 3f7c66cf3bc..fc16baab9e1 100644 --- a/lib/dependencies/CommonJsExportRequireDependency.js +++ b/lib/dependencies/CommonJsExportRequireDependency.js @@ -131,7 +131,7 @@ class CommonJsExportRequireDependency extends ModuleDependency { false ); } - return referencedExports.map(name => ({ + return referencedExports.map((name) => ({ name, canMangle: false })); @@ -190,7 +190,7 @@ class CommonJsExportRequireDependency extends ModuleDependency { exports: Array.from( /** @type {Set} */ (reexportInfo.exports), - name => ({ + (name) => ({ name, from, export: [...ids, name], diff --git a/lib/dependencies/CommonJsExportsParserPlugin.js b/lib/dependencies/CommonJsExportsParserPlugin.js index 400882c2999..2592aa9816b 100644 --- a/lib/dependencies/CommonJsExportsParserPlugin.js +++ b/lib/dependencies/CommonJsExportsParserPlugin.js @@ -47,7 +47,7 @@ const ModuleDecoratorDependency = require("./ModuleDecoratorDependency"); * @param {Expression} expr expression * @returns {Expression | undefined} returns the value of property descriptor */ -const getValueOfPropertyDescription = expr => { +const getValueOfPropertyDescription = (expr) => { if (expr.type !== "ObjectExpression") return; for (const property of expr.properties) { if (property.type === "SpreadElement" || property.computed) continue; @@ -64,7 +64,7 @@ const getValueOfPropertyDescription = expr => { * @param {Expression} expr expression being checked * @returns {boolean} true, when the expression is a truthy literal */ -const isTruthyLiteral = expr => { +const isTruthyLiteral = (expr) => { switch (expr.type) { case "Literal": return Boolean(expr.value); @@ -81,7 +81,7 @@ const isTruthyLiteral = expr => { * @param {Expression} expr expression being checked * @returns {boolean} true, when the expression is a falsy literal */ -const isFalsyLiteral = expr => { +const isFalsyLiteral = (expr) => { switch (expr.type) { case "Literal": return !expr.value; @@ -163,14 +163,14 @@ class CommonJsExportsParserPlugin { /** * @param {string=} reason reason */ - const bailout = reason => { + const bailout = (reason) => { DynamicExports.bailout(parser.state); if (reason) bailoutHint(reason); }; /** * @param {string} reason reason */ - const bailoutHint = reason => { + const bailoutHint = (reason) => { this.moduleGraph .getOptimizationBailout(parser.state.module) .push(`CommonJS bailout: ${reason}`); @@ -258,7 +258,7 @@ class CommonJsExportsParserPlugin { }); parser.hooks.call .for("Object.defineProperty") - .tap(PLUGIN_NAME, expression => { + .tap(PLUGIN_NAME, (expression) => { const expr = /** @type {CallExpression} */ (expression); if (!parser.isStatementLevelExpression(expr)) return; if (expr.arguments.length !== 3) return; @@ -350,7 +350,7 @@ class CommonJsExportsParserPlugin { ); parser.hooks.expression .for("exports") - .tap(PLUGIN_NAME, expr => handleAccessExport(expr, "exports", [])); + .tap(PLUGIN_NAME, (expr) => handleAccessExport(expr, "exports", [])); parser.hooks.callMemberChain .for("module") .tap(PLUGIN_NAME, (expr, members) => { @@ -370,7 +370,9 @@ class CommonJsExportsParserPlugin { }); parser.hooks.expression .for("module.exports") - .tap(PLUGIN_NAME, expr => handleAccessExport(expr, "module.exports", [])); + .tap(PLUGIN_NAME, (expr) => + handleAccessExport(expr, "module.exports", []) + ); parser.hooks.callMemberChain .for("this") .tap(PLUGIN_NAME, (expr, members) => { @@ -383,13 +385,13 @@ class CommonJsExportsParserPlugin { if (!parser.scope.topLevelScope) return; return handleAccessExport(expr, "this", members); }); - parser.hooks.expression.for("this").tap(PLUGIN_NAME, expr => { + parser.hooks.expression.for("this").tap(PLUGIN_NAME, (expr) => { if (!parser.scope.topLevelScope) return; return handleAccessExport(expr, "this", []); }); // Bailouts // - parser.hooks.expression.for("module").tap(PLUGIN_NAME, expr => { + parser.hooks.expression.for("module").tap(PLUGIN_NAME, (expr) => { bailout(); const isHarmony = HarmonyExports.isEnabled(parser.state); const dep = new ModuleDecoratorDependency( diff --git a/lib/dependencies/CommonJsImportsParserPlugin.js b/lib/dependencies/CommonJsImportsParserPlugin.js index 82962ce7cda..9bb81115c81 100644 --- a/lib/dependencies/CommonJsImportsParserPlugin.js +++ b/lib/dependencies/CommonJsImportsParserPlugin.js @@ -91,7 +91,7 @@ class CommonJsImportsParserPlugin { /** * @param {string | symbol} tag tag */ - const tapRequireExpressionTag = tag => { + const tapRequireExpressionTag = (tag) => { parser.hooks.typeof .for(tag) .tap( @@ -108,7 +108,7 @@ class CommonJsImportsParserPlugin { // #endregion // Weird stuff // - parser.hooks.assign.for("require").tap(PLUGIN_NAME, expr => { + parser.hooks.assign.for("require").tap(PLUGIN_NAME, (expr) => { // to not leak to global "require", we need to define a local require here. const dep = new ConstDependency("var require;", 0); dep.loc = /** @type {DependencyLocation} */ (expr.loc); @@ -160,7 +160,7 @@ class CommonJsImportsParserPlugin { * @param {Expression} expr expression * @returns {boolean} true when set undefined */ - const defineUndefined = expr => { + const defineUndefined = (expr) => { // To avoid "not defined" error, replace the value with undefined const dep = new ConstDependency( "undefined", @@ -193,7 +193,7 @@ class CommonJsImportsParserPlugin { * @param {Expression} expr expression * @returns {boolean} true when handled */ - const requireAsExpressionHandler = expr => { + const requireAsExpressionHandler = (expr) => { const dep = new CommonJsRequireContextDependency( { request: /** @type {string} */ (options.unknownContextRequest), @@ -267,7 +267,7 @@ class CommonJsImportsParserPlugin { * @param {boolean} callNew true, when require is called with new * @returns {(expr: CallExpression | NewExpression) => (boolean | void)} handler */ - const createRequireHandler = callNew => expr => { + const createRequireHandler = (callNew) => (expr) => { if (options.commonjsMagicComments) { const { options: requireOptions, errors: commentErrors } = parser.parseCommentOptions(/** @type {Range} */ (expr.range)); @@ -567,10 +567,10 @@ class CommonJsImportsParserPlugin { parser.hooks.call .for("require.resolve") - .tap(PLUGIN_NAME, expr => processResolve(expr, false)); + .tap(PLUGIN_NAME, (expr) => processResolve(expr, false)); parser.hooks.call .for("require.resolveWeak") - .tap(PLUGIN_NAME, expr => processResolve(expr, true)); + .tap(PLUGIN_NAME, (expr) => processResolve(expr, true)); // #endregion // #region Create require @@ -607,7 +607,7 @@ class CommonJsImportsParserPlugin { tapRequireExpressionTag(createRequireSpecifierTag); parser.hooks.evaluateCallExpression .for(createRequireSpecifierTag) - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { const context = parseCreateRequireArguments(expr); if (context === undefined) return; const ident = parser.evaluatedVariable({ @@ -648,7 +648,7 @@ class CommonJsImportsParserPlugin { * @param {CallExpression} expr call expression * @returns {string | void} context */ - const parseCreateRequireArguments = expr => { + const parseCreateRequireArguments = (expr) => { const args = expr.arguments; if (args.length !== 1) { const err = new WebpackError( @@ -715,7 +715,7 @@ class CommonJsImportsParserPlugin { return true; } ); - parser.hooks.preDeclarator.tap(PLUGIN_NAME, declarator => { + parser.hooks.preDeclarator.tap(PLUGIN_NAME, (declarator) => { if ( declarator.id.type !== "Identifier" || !declarator.init || @@ -784,15 +784,17 @@ class CommonJsImportsParserPlugin { return processResolve(expr, false); } }); - parser.hooks.call.for(createRequireSpecifierTag).tap(PLUGIN_NAME, expr => { - const clearDep = new ConstDependency( - "/* createRequire() */ undefined", - /** @type {Range} */ (expr.range) - ); - clearDep.loc = /** @type {DependencyLocation} */ (expr.loc); - parser.state.module.addPresentationalDependency(clearDep); - return true; - }); + parser.hooks.call + .for(createRequireSpecifierTag) + .tap(PLUGIN_NAME, (expr) => { + const clearDep = new ConstDependency( + "/* createRequire() */ undefined", + /** @type {Range} */ (expr.range) + ); + clearDep.loc = /** @type {DependencyLocation} */ (expr.loc); + parser.state.module.addPresentationalDependency(clearDep); + return true; + }); // #endregion } } diff --git a/lib/dependencies/CommonJsPlugin.js b/lib/dependencies/CommonJsPlugin.js index 97b8695872a..194a16c77e5 100644 --- a/lib/dependencies/CommonJsPlugin.js +++ b/lib/dependencies/CommonJsPlugin.js @@ -200,7 +200,7 @@ class CommonJsPlugin { ); parser.hooks.expression .for(RuntimeGlobals.moduleLoaded) - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { /** @type {BuildInfo} */ (parser.state.module.buildInfo).moduleConcatenationBailout = RuntimeGlobals.moduleLoaded; @@ -214,7 +214,7 @@ class CommonJsPlugin { parser.hooks.expression .for(RuntimeGlobals.moduleId) - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { /** @type {BuildInfo} */ (parser.state.module.buildInfo).moduleConcatenationBailout = RuntimeGlobals.moduleId; diff --git a/lib/dependencies/ContextDependency.js b/lib/dependencies/ContextDependency.js index e1d94b5ece7..bcec13d18d5 100644 --- a/lib/dependencies/ContextDependency.js +++ b/lib/dependencies/ContextDependency.js @@ -27,7 +27,7 @@ const getCriticalDependencyWarning = memoize(() => * @param {RegExp | null | undefined} r regexp * @returns {string} stringified regexp */ -const regExpToString = r => (r ? String(r) : ""); +const regExpToString = (r) => (r ? String(r) : ""); class ContextDependency extends Dependency { /** diff --git a/lib/dependencies/ContextDependencyHelpers.js b/lib/dependencies/ContextDependencyHelpers.js index 6f18e062ca8..a0e713bff3e 100644 --- a/lib/dependencies/ContextDependencyHelpers.js +++ b/lib/dependencies/ContextDependencyHelpers.js @@ -22,13 +22,13 @@ const { parseResource } = require("../util/identifier"); * @param {string} str String to quote * @returns {string} Escaped string */ -const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); /** * @param {string} prefix prefix * @returns {{prefix: string, context: string}} result */ -const splitContextFromPrefix = prefix => { +const splitContextFromPrefix = (prefix) => { const idx = prefix.lastIndexOf("/"); let context = "."; if (idx >= 0) { @@ -87,7 +87,7 @@ module.exports.create = ( /** @type {RegExp} */ (options.wrappedContextRegExp).source + innerQuasis .map( - q => + (q) => quoteMeta(/** @type {string} */ (q.string)) + /** @type {RegExp} */ (options.wrappedContextRegExp).source ) diff --git a/lib/dependencies/CssIcssExportDependency.js b/lib/dependencies/CssIcssExportDependency.js index 5b03b9ff6bb..a4bb379c91b 100644 --- a/lib/dependencies/CssIcssExportDependency.js +++ b/lib/dependencies/CssIcssExportDependency.js @@ -65,7 +65,7 @@ class CssIcssExportDependency extends NullDependency { (generator.convention) ); return { - exports: names.map(name => ({ + exports: names.map((name) => ({ name, canMangle: true })), @@ -139,7 +139,7 @@ CssIcssExportDependency.Template = class CssIcssExportDependencyTemplate extends /** @type {string[]} */ ( names - .map(name => + .map((name) => moduleGraph.getExportInfo(module, name).getUsedName(name, runtime) ) .filter(Boolean) diff --git a/lib/dependencies/CssLocalIdentifierDependency.js b/lib/dependencies/CssLocalIdentifierDependency.js index 4592c45b1df..3be3ef0388f 100644 --- a/lib/dependencies/CssLocalIdentifierDependency.js +++ b/lib/dependencies/CssLocalIdentifierDependency.js @@ -127,7 +127,7 @@ class CssLocalIdentifierDependency extends NullDependency { /** @type {CssGeneratorExportsConvention} */ (generator.convention) ); return { - exports: names.map(name => ({ + exports: names.map((name) => ({ name, canMangle: true })), @@ -225,7 +225,7 @@ CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTempla /** @type {string[]} */ ( names - .map(name => + .map((name) => moduleGraph.getExportInfo(module, name).getUsedName(name, runtime) ) .filter(Boolean) diff --git a/lib/dependencies/CssUrlDependency.js b/lib/dependencies/CssUrlDependency.js index ad3ec31feef..a7cb4349cd4 100644 --- a/lib/dependencies/CssUrlDependency.js +++ b/lib/dependencies/CssUrlDependency.js @@ -82,7 +82,7 @@ class CssUrlDependency extends ModuleDependency { * @param {string} str string * @returns {string} string in quotes if needed */ -const cssEscapeString = str => { +const cssEscapeString = (str) => { let countWhiteOrBracket = 0; let countQuotation = 0; let countApostrophe = 0; @@ -105,11 +105,11 @@ const cssEscapeString = str => { } } if (countWhiteOrBracket < 2) { - return str.replace(/[\n\t ()'"\\]/g, m => `\\${m}`); + return str.replace(/[\n\t ()'"\\]/g, (m) => `\\${m}`); } else if (countQuotation <= countApostrophe) { - return `"${str.replace(/[\n"\\]/g, m => `\\${m}`)}"`; + return `"${str.replace(/[\n"\\]/g, (m) => `\\${m}`)}"`; } - return `'${str.replace(/[\n'\\]/g, m => `\\${m}`)}'`; + return `'${str.replace(/[\n'\\]/g, (m) => `\\${m}`)}'`; }; CssUrlDependency.Template = class CssUrlDependencyTemplate extends ( diff --git a/lib/dependencies/DynamicExports.js b/lib/dependencies/DynamicExports.js index 4e983ddbddb..1d97fa5a90c 100644 --- a/lib/dependencies/DynamicExports.js +++ b/lib/dependencies/DynamicExports.js @@ -15,7 +15,7 @@ const parserStateExportsState = new WeakMap(); * @param {ParserState} parserState parser state * @returns {void} */ -module.exports.bailout = parserState => { +module.exports.bailout = (parserState) => { const value = parserStateExportsState.get(parserState); parserStateExportsState.set(parserState, false); if (value === true) { @@ -29,7 +29,7 @@ module.exports.bailout = parserState => { * @param {ParserState} parserState parser state * @returns {void} */ -module.exports.enable = parserState => { +module.exports.enable = (parserState) => { const value = parserStateExportsState.get(parserState); if (value === false) return; parserStateExportsState.set(parserState, true); @@ -44,7 +44,7 @@ module.exports.enable = parserState => { * @param {ParserState} parserState parser state * @returns {boolean} true, when enabled */ -module.exports.isEnabled = parserState => { +module.exports.isEnabled = (parserState) => { const value = parserStateExportsState.get(parserState); return value === true; }; @@ -53,7 +53,7 @@ module.exports.isEnabled = parserState => { * @param {ParserState} parserState parser state * @returns {void} */ -module.exports.setDynamic = parserState => { +module.exports.setDynamic = (parserState) => { const value = parserStateExportsState.get(parserState); if (value !== true) return; /** @type {BuildMeta} */ @@ -64,7 +64,7 @@ module.exports.setDynamic = parserState => { * @param {ParserState} parserState parser state * @returns {void} */ -module.exports.setFlagged = parserState => { +module.exports.setFlagged = (parserState) => { const value = parserStateExportsState.get(parserState); if (value !== true) return; const buildMeta = /** @type {BuildMeta} */ (parserState.module.buildMeta); diff --git a/lib/dependencies/HarmonyAcceptDependency.js b/lib/dependencies/HarmonyAcceptDependency.js index 4817b722d7e..d236d4f887c 100644 --- a/lib/dependencies/HarmonyAcceptDependency.js +++ b/lib/dependencies/HarmonyAcceptDependency.js @@ -6,6 +6,7 @@ "use strict"; const Template = require("../Template"); +const AwaitDependenciesInitFragment = require("../async-modules/AwaitDependenciesInitFragment"); const makeSerializable = require("../util/makeSerializable"); const HarmonyImportDependency = require("./HarmonyImportDependency"); const NullDependency = require("./NullDependency"); @@ -82,8 +83,25 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends moduleGraph, chunkGraph } = templateContext; - const content = dep.dependencies - .map(dependency => { + + /** @type {HarmonyAcceptImportDependency[]} */ + const syncDeps = []; + + /** @type {HarmonyAcceptImportDependency[]} */ + const asyncDeps = []; + + for (const dependency of dep.dependencies) { + const connection = moduleGraph.getConnection(dependency); + + if (connection && moduleGraph.isAsync(connection.module)) { + asyncDeps.push(dependency); + } else { + syncDeps.push(dependency); + } + } + + let content = syncDeps + .map((dependency) => { const referencedModule = moduleGraph.getModule(dependency); return { dependency, @@ -112,17 +130,33 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends }) .join(""); + const promises = new Map( + asyncDeps.map((dependency) => [ + dependency.getImportVar(moduleGraph), + dependency.getModuleExports(templateContext) + ]) + ); + + let optAsync = ""; + if (promises.size !== 0) { + optAsync = "async "; + content += new AwaitDependenciesInitFragment(promises).getContent({ + ...templateContext, + type: "javascript" + }); + } + if (dep.hasCallback) { if (runtimeTemplate.supportsArrowFunction()) { source.insert( dep.range[0], - `__WEBPACK_OUTDATED_DEPENDENCIES__ => { ${content}(` + `${optAsync}__WEBPACK_OUTDATED_DEPENDENCIES__ => { ${content} return (` ); source.insert(dep.range[1], ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }"); } else { source.insert( dep.range[0], - `function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content}(` + `${optAsync}function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content} return (` ); source.insert( dep.range[1], @@ -135,7 +169,7 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends const arrow = runtimeTemplate.supportsArrowFunction(); source.insert( dep.range[1] - 0.5, - `, ${arrow ? "() =>" : "function()"} { ${content} }` + `, ${arrow ? `${optAsync}() =>` : `${optAsync}function()`} { ${content} }` ); } }; diff --git a/lib/dependencies/HarmonyDetectionParserPlugin.js b/lib/dependencies/HarmonyDetectionParserPlugin.js index dcb2d145c20..7edd8dd5d59 100644 --- a/lib/dependencies/HarmonyDetectionParserPlugin.js +++ b/lib/dependencies/HarmonyDetectionParserPlugin.js @@ -31,13 +31,13 @@ module.exports = class HarmonyDetectionParserPlugin { * @returns {void} */ apply(parser) { - parser.hooks.program.tap(PLUGIN_NAME, ast => { + parser.hooks.program.tap(PLUGIN_NAME, (ast) => { const isStrictHarmony = parser.state.module.type === JAVASCRIPT_MODULE_TYPE_ESM; const isHarmony = isStrictHarmony || ast.body.some( - statement => + (statement) => statement.type === "ImportDeclaration" || statement.type === "ExportDefaultDeclaration" || statement.type === "ExportNamedDeclaration" || diff --git a/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/lib/dependencies/HarmonyExportDependencyParserPlugin.js index 4349b0b26f5..be2056fee9f 100644 --- a/lib/dependencies/HarmonyExportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyExportDependencyParserPlugin.js @@ -33,9 +33,8 @@ const PLUGIN_NAME = "HarmonyExportDependencyParserPlugin"; module.exports = class HarmonyExportDependencyParserPlugin { /** * @param {import("../../declarations/WebpackOptions").JavascriptParserOptions} options options - * @param {boolean=} deferImport defer import enabled */ - constructor(options, deferImport) { + constructor(options) { this.exportPresenceMode = options.reexportExportsPresence !== undefined ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence) @@ -44,7 +43,7 @@ module.exports = class HarmonyExportDependencyParserPlugin { : options.strictExportPresence ? ExportPresenceModes.ERROR : ExportPresenceModes.AUTO; - this.deferImport = deferImport; + this.deferImport = options.deferImport; } /** @@ -53,7 +52,7 @@ module.exports = class HarmonyExportDependencyParserPlugin { */ apply(parser) { const { exportPresenceMode } = this; - parser.hooks.export.tap(PLUGIN_NAME, statement => { + parser.hooks.export.tap(PLUGIN_NAME, (statement) => { const dep = new HarmonyExportHeaderDependency( /** @type {Range | false} */ ( statement.declaration && statement.declaration.range @@ -77,13 +76,16 @@ module.exports = class HarmonyExportDependencyParserPlugin { clearDep.loc = /** @type {DependencyLocation} */ (statement.loc); clearDep.loc.index = -1; parser.state.module.addPresentationalDependency(clearDep); - const { defer } = getImportMode(parser, statement); - if (defer) { - const error = new WebpackError( - "Deferred re-export (`export defer * as namespace from '...'`) is not a part of the Import Defer proposal.\nUse the following code instead:\n import defer * as namespace from '...';\n export { namespace };" - ); - error.loc = statement.loc || undefined; - parser.state.current.addError(error); + let defer = false; + if (this.deferImport) { + ({ defer } = getImportMode(parser, statement)); + if (defer) { + const error = new WebpackError( + "Deferred re-export (`export defer * as namespace from '...'`) is not a part of the Import Defer proposal.\nUse the following code instead:\n import defer * as namespace from '...';\n export { namespace };" + ); + error.loc = statement.loc || undefined; + parser.state.current.addError(error); + } } const sideEffectDep = new HarmonyImportSideEffectDependency( /** @type {string} */ (source), @@ -107,7 +109,7 @@ module.exports = class HarmonyExportDependencyParserPlugin { exprRange, statementRange, comments - .map(c => { + .map((c) => { switch (c.type) { case "Block": return `/*${c.value}*/`; @@ -202,7 +204,9 @@ module.exports = class HarmonyExportDependencyParserPlugin { parser.state.harmonyStarExports || new HarmonyStarExportsList(); } const attributes = getImportAttributes(statement); - const { defer } = getImportMode(parser, statement); + const defer = this.deferImport + ? getImportMode(parser, statement).defer + : false; const dep = new HarmonyExportImportedSpecifierDependency( /** @type {string} */ (source), diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index 07fad95ccd4..84eabafe3f4 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -334,7 +334,7 @@ const getMode = (moduleGraph, dep, runtimeKey) => { mode.items = Array.from( exports, - exportName => + (exportName) => new NormalReexportItem( exportName, [exportName], @@ -378,7 +378,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { * @param {ExportPresenceMode} exportPresenceMode mode of checking export names * @param {HarmonyStarExportsList | null} allStarExports all star exports in the module * @param {ImportAttributes=} attributes import attributes - * @param {boolean=} deferEvaluation defer evaluation + * @param {boolean=} defer is defer phase */ constructor( request, @@ -390,9 +390,9 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { exportPresenceMode, allStarExports, attributes, - deferEvaluation + defer ) { - super(request, sourceOrder, attributes); + super(request, sourceOrder, attributes, defer); this.ids = ids; this.name = name; @@ -400,7 +400,6 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { this.otherStarExports = otherStarExports; this.exportPresenceMode = exportPresenceMode; this.allStarExports = allStarExports; - this.defer = deferEvaluation; } /** @@ -722,7 +721,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { return { exports: Array.from( /** @type {NormalReexportItem[]} */ (mode.items), - item => ({ + (item) => ({ name: item.name, from, export: item.ids, @@ -930,7 +929,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { }' contains conflicting star exports for the ${ exports.length > 1 ? "names" : "name" } ${exports - .map(e => `'${e}'`) + .map((e) => `'${e}'`) .join(", ")} with the previous requested module '${request}'` ) ); @@ -1190,7 +1189,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS const runtimeCondition = dep.weak ? false : connection - ? filterRuntime(runtime, r => connection.isTargetActive(r)) + ? filterRuntime(runtime, (r) => connection.isTargetActive(r)) : true; initFragments.push( new ConditionalInitFragment( diff --git a/lib/dependencies/HarmonyExportInitFragment.js b/lib/dependencies/HarmonyExportInitFragment.js index 9b4b025c145..d81cbad9227 100644 --- a/lib/dependencies/HarmonyExportInitFragment.js +++ b/lib/dependencies/HarmonyExportInitFragment.js @@ -17,7 +17,7 @@ const { propertyName } = require("../util/propertyName"); * @param {Iterable} iterable iterable strings * @returns {string} result */ -const joinIterableWithComma = iterable => { +const joinIterableWithComma = (iterable) => { // This is more performant than Array.from().join(", ") // as it doesn't create an array let str = ""; diff --git a/lib/dependencies/HarmonyExports.js b/lib/dependencies/HarmonyExports.js index 1f6e6d4acb9..fe1b28d4e36 100644 --- a/lib/dependencies/HarmonyExports.js +++ b/lib/dependencies/HarmonyExports.js @@ -40,7 +40,7 @@ module.exports.enable = (parserState, isStrictHarmony) => { * @param {ParserState} parserState parser state * @returns {boolean} true, when enabled */ -module.exports.isEnabled = parserState => { +module.exports.isEnabled = (parserState) => { const value = parserStateExportsState.get(parserState); return value === true; }; diff --git a/lib/dependencies/HarmonyImportDependency.js b/lib/dependencies/HarmonyImportDependency.js index 4ac805c8031..71bc6973572 100644 --- a/lib/dependencies/HarmonyImportDependency.js +++ b/lib/dependencies/HarmonyImportDependency.js @@ -64,11 +64,13 @@ class HarmonyImportDependency extends ModuleDependency { * @param {string} request request string * @param {number} sourceOrder source order * @param {ImportAttributes=} attributes import attributes + * @param {boolean=} defer import attributes */ - constructor(request, sourceOrder, attributes) { + constructor(request, sourceOrder, attributes, defer) { super(request); this.sourceOrder = sourceOrder; this.assertions = attributes; + this.defer = defer; } get category() { @@ -112,6 +114,24 @@ class HarmonyImportDependency extends ModuleDependency { return importVar; } + /** + * @param {DependencyTemplateContext} context the template context + * @returns {string} the expression + */ + getModuleExports({ + runtimeTemplate, + moduleGraph, + chunkGraph, + runtimeRequirements + }) { + return runtimeTemplate.moduleExports({ + module: moduleGraph.getModule(this), + chunkGraph, + request: this.request, + runtimeRequirements + }); + } + /** * @param {boolean} update create new variables or update existing one * @param {DependencyTemplateContext} templateContext the template context @@ -183,7 +203,7 @@ class HarmonyImportDependency extends ModuleDependency { new HarmonyLinkingError( `export ${ids .slice(0, pos) - .map(id => `'${id}'`) + .map((id) => `'${id}'`) .join(".")} ${additionalMessage} was not found in '${ this.userRequest }'${moreInfo}` @@ -199,7 +219,7 @@ class HarmonyImportDependency extends ModuleDependency { return [ new HarmonyLinkingError( `export ${ids - .map(id => `'${id}'`) + .map((id) => `'${id}'`) .join(".")} ${additionalMessage} was not found in '${ this.userRequest }'` @@ -215,7 +235,7 @@ class HarmonyImportDependency extends ModuleDependency { return [ new HarmonyLinkingError( `Can't import the named export ${ids - .map(id => `'${id}'`) + .map((id) => `'${id}'`) .join( "." )} ${additionalMessage} from default-exporting module (only default export is available)` @@ -236,7 +256,7 @@ class HarmonyImportDependency extends ModuleDependency { return [ new HarmonyLinkingError( `Should not import the named export ${ids - .map(id => `'${id}'`) + .map((id) => `'${id}'`) .join( "." )} ${additionalMessage} from default-exporting module (only default export is available soon)` @@ -310,7 +330,7 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends const runtimeCondition = dep.weak ? false : connection - ? filterRuntime(runtime, r => connection.isTargetActive(r)) + ? filterRuntime(runtime, (r) => connection.isTargetActive(r)) : true; if (module && referencedModule) { @@ -348,10 +368,9 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends runtimeCondition ) ); + const importVar = dep.getImportVar(templateContext.moduleGraph); templateContext.initFragments.push( - new AwaitDependenciesInitFragment( - new Set([dep.getImportVar(templateContext.moduleGraph)]) - ) + new AwaitDependenciesInitFragment(new Map([[importVar, importVar]])) ); templateContext.initFragments.push( new ConditionalInitFragment( diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index 007c4261f7a..a54a4542c07 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -59,9 +59,8 @@ const PLUGIN_NAME = "HarmonyImportDependencyParserPlugin"; module.exports = class HarmonyImportDependencyParserPlugin { /** * @param {JavascriptParserOptions} options options - * @param {boolean | undefined} deferImport defer import enabled */ - constructor(options, deferImport) { + constructor(options) { this.exportPresenceMode = options.importExportsPresence !== undefined ? ExportPresenceModes.fromUserOption(options.importExportsPresence) @@ -71,7 +70,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { ? ExportPresenceModes.ERROR : ExportPresenceModes.AUTO; this.strictThisContextOnImports = options.strictThisContextOnImports; - this.deferImport = deferImport; + this.deferImport = options.deferImport; } /** @@ -102,7 +101,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { return node; } - parser.hooks.isPure.for("Identifier").tap(PLUGIN_NAME, expression => { + parser.hooks.isPure.for("Identifier").tap(PLUGIN_NAME, (expression) => { const expr = /** @type {Identifier} */ (expression); if ( parser.isVariableDefined(expr.name) || @@ -124,17 +123,20 @@ module.exports = class HarmonyImportDependencyParserPlugin { parser.state.module.addPresentationalDependency(clearDep); parser.unsetAsiPosition(/** @type {Range} */ (statement.range)[1]); const attributes = getImportAttributes(statement); - const { defer } = getImportMode(parser, statement); - if ( - defer && - (statement.specifiers.length !== 1 || - statement.specifiers[0].type !== "ImportNamespaceSpecifier") - ) { - const error = new WebpackError( - "Deferred import can only be used with `import * as namespace from '...'` syntax." - ); - error.loc = statement.loc || undefined; - parser.state.current.addError(error); + let defer = false; + if (this.deferImport) { + ({ defer } = getImportMode(parser, statement)); + if ( + defer && + (statement.specifiers.length !== 1 || + statement.specifiers[0].type !== "ImportNamespaceSpecifier") + ) { + const error = new WebpackError( + "Deferred import can only be used with `import * as namespace from '...'` syntax." + ); + error.loc = statement.loc || undefined; + parser.state.current.addError(error); + } } const sideEffectDep = new HarmonyImportSideEffectDependency( /** @type {string} */ (source), @@ -150,7 +152,9 @@ module.exports = class HarmonyImportDependencyParserPlugin { PLUGIN_NAME, (statement, source, id, name) => { const ids = id === null ? [] : [id]; - const { defer } = getImportMode(parser, statement); + const defer = this.deferImport + ? getImportMode(parser, statement).defer + : false; parser.tagVariable(name, harmonySpecifierTag, { name, source, @@ -162,7 +166,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { return true; } ); - parser.hooks.binaryExpression.tap(PLUGIN_NAME, expression => { + parser.hooks.binaryExpression.tap(PLUGIN_NAME, (expression) => { if (expression.operator !== "in") return; const leftPartEvaluated = parser.evaluateExpression(expression.left); @@ -204,34 +208,38 @@ module.exports = class HarmonyImportDependencyParserPlugin { ); dep.loc = /** @type {DependencyLocation} */ (expression.loc); parser.state.module.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - parser.hooks.expression.for(harmonySpecifierTag).tap(PLUGIN_NAME, expr => { - const settings = /** @type {HarmonySettings} */ (parser.currentTagData); - const dep = new HarmonyImportSpecifierDependency( - settings.source, - settings.sourceOrder, - settings.ids, - settings.name, - /** @type {Range} */ - (expr.range), - exportPresenceMode, - settings.attributes, - [], - settings.defer - ); - dep.referencedPropertiesInDestructuring = - parser.destructuringAssignmentPropertiesFor(expr); - dep.shorthand = parser.scope.inShorthand; - dep.directImport = true; - dep.asiSafe = !parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]); - dep.loc = /** @type {DependencyLocation} */ (expr.loc); - dep.call = parser.scope.inTaggedTemplateTag; - parser.state.module.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e)); return true; }); + parser.hooks.expression + .for(harmonySpecifierTag) + .tap(PLUGIN_NAME, (expr) => { + const settings = /** @type {HarmonySettings} */ (parser.currentTagData); + const dep = new HarmonyImportSpecifierDependency( + settings.source, + settings.sourceOrder, + settings.ids, + settings.name, + /** @type {Range} */ + (expr.range), + exportPresenceMode, + settings.attributes, + [], + settings.defer + ); + dep.referencedPropertiesInDestructuring = + parser.destructuringAssignmentPropertiesFor(expr); + dep.shorthand = parser.scope.inShorthand; + dep.directImport = true; + dep.asiSafe = !parser.isAsiPosition( + /** @type {Range} */ (expr.range)[0] + ); + dep.loc = /** @type {DependencyLocation} */ (expr.loc); + dep.call = parser.scope.inTaggedTemplateTag; + parser.state.module.addDependency(dep); + InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e)); + return true; + }); parser.hooks.expressionMemberChain .for(harmonySpecifierTag) .tap( @@ -277,7 +285,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { ); dep.loc = /** @type {DependencyLocation} */ (expr.loc); parser.state.module.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e)); return true; } ); @@ -331,7 +339,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { dep.loc = /** @type {DependencyLocation} */ (expr.loc); parser.state.module.addDependency(dep); if (args) parser.walkExpressions(args); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e)); return true; } ); @@ -342,7 +350,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { // This is not a harmony module, skip it return; } - const dependencies = requests.map(request => { + const dependencies = requests.map((request) => { const dep = new HarmonyAcceptImportDependency(request); dep.loc = /** @type {DependencyLocation} */ (expr.loc); parser.state.module.addDependency(dep); @@ -364,7 +372,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { // This is not a harmony module, skip it return; } - const dependencies = requests.map(request => { + const dependencies = requests.map((request) => { const dep = new HarmonyAcceptImportDependency(request); dep.loc = /** @type {DependencyLocation} */ (expr.loc); parser.state.module.addDependency(dep); @@ -387,7 +395,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { /** * @param {JavascriptParser} parser parser * @param {ExportNamedDeclaration | ExportAllDeclaration | ImportDeclaration} node node - * @returns {{defer: boolean}} import attributes + * @returns {{ defer: boolean }} import attributes */ function getImportMode(parser, node) { const result = { defer: "phase" in node && node.phase === "defer" }; diff --git a/lib/dependencies/HarmonyImportSideEffectDependency.js b/lib/dependencies/HarmonyImportSideEffectDependency.js index 5911c5b3386..9db49f07ddb 100644 --- a/lib/dependencies/HarmonyImportSideEffectDependency.js +++ b/lib/dependencies/HarmonyImportSideEffectDependency.js @@ -26,11 +26,10 @@ class HarmonyImportSideEffectDependency extends HarmonyImportDependency { * @param {string} request the request string * @param {number} sourceOrder source order * @param {ImportAttributes=} attributes import attributes - * @param {boolean=} deferred deferred + * @param {boolean=} defer is defer phase */ - constructor(request, sourceOrder, attributes, deferred) { - super(request, sourceOrder, attributes); - this.defer = deferred; + constructor(request, sourceOrder, attributes, defer) { + super(request, sourceOrder, attributes, defer); } get type() { @@ -42,7 +41,7 @@ class HarmonyImportSideEffectDependency extends HarmonyImportDependency { * @returns {null | false | GetConditionFn} function to determine if the connection is active */ getCondition(moduleGraph) { - return connection => { + return (connection) => { const refModule = connection.resolvedModule; if (!refModule) return true; return refModule.getSideEffectsConnectionState(moduleGraph); diff --git a/lib/dependencies/HarmonyImportSpecifierDependency.js b/lib/dependencies/HarmonyImportSpecifierDependency.js index a6d0c140de2..bf3f7070d40 100644 --- a/lib/dependencies/HarmonyImportSpecifierDependency.js +++ b/lib/dependencies/HarmonyImportSpecifierDependency.js @@ -51,7 +51,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { * @param {ExportPresenceMode} exportPresenceMode export presence mode * @param {ImportAttributes | undefined} attributes import attributes * @param {Range[] | undefined} idRanges ranges for members of ids; the two arrays are right-aligned - * @param {boolean=} deferred deferred + * @param {boolean=} defer is defer phase */ constructor( request, @@ -62,9 +62,9 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { exportPresenceMode, attributes, idRanges, // TODO webpack 6 make this non-optional. It must always be set to properly trim ids. - deferred + defer ) { - super(request, sourceOrder, attributes); + super(request, sourceOrder, attributes, defer); this.ids = ids; this.name = name; this.range = range; @@ -79,7 +79,6 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { this.usedByExports = undefined; /** @type {Set | undefined} */ this.referencedPropertiesInDestructuring = undefined; - this.defer = deferred; } // TODO webpack 6 remove diff --git a/lib/dependencies/HarmonyModulesPlugin.js b/lib/dependencies/HarmonyModulesPlugin.js index 77d3d9c3dc9..3d2bf7230a0 100644 --- a/lib/dependencies/HarmonyModulesPlugin.js +++ b/lib/dependencies/HarmonyModulesPlugin.js @@ -135,14 +135,8 @@ class HarmonyModulesPlugin { } new HarmonyDetectionParserPlugin(this.options).apply(parser); - new HarmonyImportDependencyParserPlugin( - parserOptions, - this.options.deferImport - ).apply(parser); - new HarmonyExportDependencyParserPlugin( - parserOptions, - this.options.deferImport - ).apply(parser); + new HarmonyImportDependencyParserPlugin(parserOptions).apply(parser); + new HarmonyExportDependencyParserPlugin(parserOptions).apply(parser); new HarmonyTopLevelThisParserPlugin().apply(parser); }; diff --git a/lib/dependencies/HarmonyTopLevelThisParserPlugin.js b/lib/dependencies/HarmonyTopLevelThisParserPlugin.js index c8a3061a0be..5039eb9da7f 100644 --- a/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +++ b/lib/dependencies/HarmonyTopLevelThisParserPlugin.js @@ -20,7 +20,7 @@ class HarmonyTopLevelThisParserPlugin { * @returns {void} */ apply(parser) { - parser.hooks.expression.for("this").tap(PLUGIN_NAME, node => { + parser.hooks.expression.for("this").tap(PLUGIN_NAME, (node) => { if (!parser.scope.topLevelScope) return; if (HarmonyExports.isEnabled(parser.state)) { const dep = new ConstDependency( diff --git a/lib/dependencies/ImportMetaContextDependencyParserPlugin.js b/lib/dependencies/ImportMetaContextDependencyParserPlugin.js index 6b5c2bb6aaa..d52c09d5ccf 100644 --- a/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +++ b/lib/dependencies/ImportMetaContextDependencyParserPlugin.js @@ -62,7 +62,7 @@ module.exports = class ImportMetaContextDependencyParserPlugin { apply(parser) { parser.hooks.evaluateIdentifier .for("import.meta.webpackContext") - .tap(PLUGIN_NAME, expr => + .tap(PLUGIN_NAME, (expr) => evaluateToIdentifier( "import.meta.webpackContext", "import.meta", @@ -72,7 +72,7 @@ module.exports = class ImportMetaContextDependencyParserPlugin { ); parser.hooks.call .for("import.meta.webpackContext") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { if (expr.arguments.length < 1 || expr.arguments.length > 2) return; const [directoryNode, optionsNode] = expr.arguments; if (optionsNode && optionsNode.type !== "ObjectExpression") return; @@ -178,11 +178,11 @@ module.exports = class ImportMetaContextDependencyParserPlugin { /** @type {BasicEvaluatedExpression[]} */ (expr.items); if ( - items.every(i => { + items.every((i) => { if (!i.isArray()) return false; const innerItems = /** @type {BasicEvaluatedExpression[]} */ (i.items); - return innerItems.every(i => i.isString()); + return innerItems.every((i) => i.isString()); }) ) { exports = []; diff --git a/lib/dependencies/ImportMetaPlugin.js b/lib/dependencies/ImportMetaPlugin.js index 779f44b921f..17817f7de21 100644 --- a/lib/dependencies/ImportMetaPlugin.js +++ b/lib/dependencies/ImportMetaPlugin.js @@ -49,7 +49,7 @@ class ImportMetaPlugin { * @param {NormalModule} module module * @returns {string} file url */ - const getUrl = module => pathToFileURL(module.resource).toString(); + const getUrl = (module) => pathToFileURL(module.resource).toString(); /** * @param {Parser} parser parser parser * @param {JavascriptParserOptions} parserOptions parserOptions @@ -62,7 +62,7 @@ class ImportMetaPlugin { parser.hooks.expression .for("import.meta") - .tap(PLUGIN_NAME, metaProperty => { + .tap(PLUGIN_NAME, (metaProperty) => { const dep = new ConstDependency( /** @type {string} */ (importMetaName), /** @type {Range} */ (metaProperty.range) @@ -86,7 +86,7 @@ class ImportMetaPlugin { * @param {string[]} members members * @returns {string} error message */ - const importMetaUnknownProperty = members => + const importMetaUnknownProperty = (members) => `${Template.toNormalComment( `unsupported import.meta.${members.join(".")}` )} undefined${propertyAccess(members, 1)}`; @@ -98,7 +98,7 @@ class ImportMetaPlugin { ); parser.hooks.expression .for("import.meta") - .tap(PLUGIN_NAME, metaProperty => { + .tap(PLUGIN_NAME, (metaProperty) => { const referencedPropertiesInDestructuring = parser.destructuringAssignmentPropertiesFor(metaProperty); if (!referencedPropertiesInDestructuring) { @@ -169,7 +169,7 @@ class ImportMetaPlugin { ); parser.hooks.expression .for("import.meta.url") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { const dep = new ConstDependency( importMetaUrl(), /** @type {Range} */ (expr.range) @@ -183,7 +183,7 @@ class ImportMetaPlugin { .tap(PLUGIN_NAME, evaluateToString("string")); parser.hooks.evaluateIdentifier .for("import.meta.url") - .tap(PLUGIN_NAME, expr => + .tap(PLUGIN_NAME, (expr) => new BasicEvaluatedExpression() .setString(getUrl(parser.state.module)) .setRange(/** @type {Range} */ (expr.range)) @@ -223,7 +223,7 @@ class ImportMetaPlugin { }); parser.hooks.evaluate .for("MemberExpression") - .tap(PLUGIN_NAME, expression => { + .tap(PLUGIN_NAME, (expression) => { const expr = /** @type {MemberExpression} */ (expression); if ( expr.object.type === "MetaProperty" && diff --git a/lib/dependencies/ImportParserPlugin.js b/lib/dependencies/ImportParserPlugin.js index b41e43dd683..8ad5da34b24 100644 --- a/lib/dependencies/ImportParserPlugin.js +++ b/lib/dependencies/ImportParserPlugin.js @@ -44,9 +44,9 @@ class ImportParserPlugin { * @param {Iterable} enumerable enumerable * @returns {T[][]} array of array */ - const exportsFromEnumerable = enumerable => - Array.from(enumerable, e => [e]); - parser.hooks.importCall.tap(PLUGIN_NAME, expr => { + const exportsFromEnumerable = (enumerable) => + Array.from(enumerable, (e) => [e]); + parser.hooks.importCall.tap(PLUGIN_NAME, (expr) => { const param = parser.evaluateExpression(expr.source); let chunkName = null; @@ -240,7 +240,7 @@ class ImportParserPlugin { typeof importOptions.webpackExports === "string" || (Array.isArray(importOptions.webpackExports) && /** @type {string[]} */ (importOptions.webpackExports).every( - item => typeof item === "string" + (item) => typeof item === "string" )) ) ) { diff --git a/lib/dependencies/JsonExportsDependency.js b/lib/dependencies/JsonExportsDependency.js index 08e062ab300..b283eb7419f 100644 --- a/lib/dependencies/JsonExportsDependency.js +++ b/lib/dependencies/JsonExportsDependency.js @@ -30,7 +30,7 @@ const NullDependency = require("./NullDependency"); * @param {number} exportsDepth exportsDepth * @returns {GetExportsFromDataFn} value */ -const getExportsWithDepth = exportsDepth => +const getExportsWithDepth = (exportsDepth) => /** @type {GetExportsFromDataFn} */ function getExportsFromData(data, curDepth = 1) { if (curDepth > exportsDepth) { diff --git a/lib/dependencies/LoaderPlugin.js b/lib/dependencies/LoaderPlugin.js index b61bfa303e1..c57250eae5d 100644 --- a/lib/dependencies/LoaderPlugin.js +++ b/lib/dependencies/LoaderPlugin.js @@ -54,11 +54,11 @@ class LoaderPlugin { } ); - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const moduleGraph = compilation.moduleGraph; NormalModule.getCompilationHooks(compilation).loader.tap( PLUGIN_NAME, - loaderContext => { + (loaderContext) => { loaderContext.loadModule = (request, callback) => { const dep = new LoaderDependency(request); dep.loc = { @@ -91,7 +91,7 @@ class LoaderPlugin { context: loaderContext.context, recursive: false }, - err => { + (err) => { compilation.factorizeQueue.setContext(oldFactorizeQueueContext); compilation.addModuleQueue.setContext(oldAddModuleQueueContext); compilation.buildQueue.decreaseParallelism(); @@ -196,7 +196,7 @@ class LoaderPlugin { connectOrigin: false, checkCycle: true }, - err => { + (err) => { compilation.factorizeQueue.setContext(oldFactorizeQueueContext); compilation.addModuleQueue.setContext(oldAddModuleQueueContext); compilation.buildQueue.decreaseParallelism(); diff --git a/lib/dependencies/ProvidedDependency.js b/lib/dependencies/ProvidedDependency.js index 9f1d3f6e7dc..422e1b63d65 100644 --- a/lib/dependencies/ProvidedDependency.js +++ b/lib/dependencies/ProvidedDependency.js @@ -29,9 +29,9 @@ const ModuleDependency = require("./ModuleDependency"); * @param {string[]|null} path the property path array * @returns {string} the converted path */ -const pathToString = path => +const pathToString = (path) => path !== null && path.length > 0 - ? path.map(part => `[${JSON.stringify(part)}]`).join("") + ? path.map((part) => `[${JSON.stringify(part)}]`).join("") : ""; class ProvidedDependency extends ModuleDependency { diff --git a/lib/dependencies/PureExpressionDependency.js b/lib/dependencies/PureExpressionDependency.js index 3c4312c9847..1df2517db1a 100644 --- a/lib/dependencies/PureExpressionDependency.js +++ b/lib/dependencies/PureExpressionDependency.js @@ -47,7 +47,7 @@ class PureExpressionDependency extends NullDependency { /** @type {Module} */ (moduleGraph.getParentModule(this)); const exportsInfo = moduleGraph.getExportsInfo(selfModule); - const runtimeCondition = filterRuntime(runtime, runtime => { + const runtimeCondition = filterRuntime(runtime, (runtime) => { for (const exportName of usedByExports) { if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { return true; diff --git a/lib/dependencies/RequireContextDependencyParserPlugin.js b/lib/dependencies/RequireContextDependencyParserPlugin.js index 9f794ba6dbc..08ac21631d8 100644 --- a/lib/dependencies/RequireContextDependencyParserPlugin.js +++ b/lib/dependencies/RequireContextDependencyParserPlugin.js @@ -20,7 +20,7 @@ module.exports = class RequireContextDependencyParserPlugin { * @returns {void} */ apply(parser) { - parser.hooks.call.for("require.context").tap(PLUGIN_NAME, expr => { + parser.hooks.call.for("require.context").tap(PLUGIN_NAME, (expr) => { let regExp = /^\.\/.*$/; let recursive = true; /** @type {ContextMode} */ diff --git a/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js b/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js index 9f9bc0c0ac1..9c9a9c68699 100644 --- a/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +++ b/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js @@ -25,7 +25,7 @@ module.exports = class RequireEnsureDependenciesBlockParserPlugin { * @returns {void} */ apply(parser) { - parser.hooks.call.for("require.ensure").tap(PLUGIN_NAME, expr => { + parser.hooks.call.for("require.ensure").tap(PLUGIN_NAME, (expr) => { /** @type {string | GroupOptions | null} */ let chunkName = null; let errorExpressionArg = null; diff --git a/lib/dependencies/RequireIncludeDependencyParserPlugin.js b/lib/dependencies/RequireIncludeDependencyParserPlugin.js index ede50250dff..d6f59bf7222 100644 --- a/lib/dependencies/RequireIncludeDependencyParserPlugin.js +++ b/lib/dependencies/RequireIncludeDependencyParserPlugin.js @@ -33,7 +33,7 @@ module.exports = class RequireIncludeDependencyParserPlugin { */ apply(parser) { const { warn } = this; - parser.hooks.call.for("require.include").tap(PLUGIN_NAME, expr => { + parser.hooks.call.for("require.include").tap(PLUGIN_NAME, (expr) => { if (expr.arguments.length !== 1) return; const param = parser.evaluateExpression(expr.arguments[0]); if (!param.isString()) return; @@ -57,7 +57,7 @@ module.exports = class RequireIncludeDependencyParserPlugin { }); parser.hooks.evaluateTypeof .for("require.include") - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { if (warn) { parser.state.module.addWarning( new RequireIncludeDeprecationWarning( @@ -67,7 +67,7 @@ module.exports = class RequireIncludeDependencyParserPlugin { } return evaluateToString("function")(expr); }); - parser.hooks.typeof.for("require.include").tap(PLUGIN_NAME, expr => { + parser.hooks.typeof.for("require.include").tap(PLUGIN_NAME, (expr) => { if (warn) { parser.state.module.addWarning( new RequireIncludeDeprecationWarning( diff --git a/lib/dependencies/SystemPlugin.js b/lib/dependencies/SystemPlugin.js index b0e09fd1bc0..bd0ca25585b 100644 --- a/lib/dependencies/SystemPlugin.js +++ b/lib/dependencies/SystemPlugin.js @@ -63,7 +63,7 @@ class SystemPlugin { /** * @param {string} name name */ - const setNotSupported = name => { + const setNotSupported = (name) => { parser.hooks.evaluateTypeof .for(name) .tap(PLUGIN_NAME, evaluateToString("undefined")); @@ -101,7 +101,7 @@ class SystemPlugin { setNotSupported("System.get"); setNotSupported("System.register"); - parser.hooks.expression.for("System").tap(PLUGIN_NAME, expr => { + parser.hooks.expression.for("System").tap(PLUGIN_NAME, (expr) => { const dep = new ConstDependency( RuntimeGlobals.system, /** @type {Range} */ (expr.range), @@ -112,7 +112,7 @@ class SystemPlugin { return true; }); - parser.hooks.call.for("System.import").tap(PLUGIN_NAME, expr => { + parser.hooks.call.for("System.import").tap(PLUGIN_NAME, (expr) => { parser.state.module.addWarning( new SystemImportDeprecationWarning( /** @type {DependencyLocation} */ (expr.loc) diff --git a/lib/dependencies/WorkerPlugin.js b/lib/dependencies/WorkerPlugin.js index 8aea2db264d..6d28cfbe0ba 100644 --- a/lib/dependencies/WorkerPlugin.js +++ b/lib/dependencies/WorkerPlugin.js @@ -54,7 +54,7 @@ const WorkerDependency = require("./WorkerDependency"); * @param {NormalModule} module module * @returns {string} url */ -const getUrl = module => pathToFileURL(module.resource).toString(); +const getUrl = (module) => pathToFileURL(module.resource).toString(); const WorkerSpecifierTag = Symbol("worker specifier tag"); @@ -253,7 +253,7 @@ class WorkerPlugin { * @param {CallExpression} expr expression * @returns {boolean | void} true when handled */ - const handleNewWorker = expr => { + const handleNewWorker = (expr) => { if (expr.arguments.length === 0 || expr.arguments.length > 2) { return; } @@ -483,7 +483,7 @@ class WorkerPlugin { /** * @param {string} item item */ - const processItem = item => { + const processItem = (item) => { if ( item.startsWith("*") && item.includes(".") && @@ -505,7 +505,7 @@ class WorkerPlugin { } } ); - parser.hooks.pattern.for(pattern).tap(PLUGIN_NAME, pattern => { + parser.hooks.pattern.for(pattern).tap(PLUGIN_NAME, (pattern) => { parser.tagVariable(pattern.name, WorkerSpecifierTag); return true; }); @@ -530,7 +530,7 @@ class WorkerPlugin { const source = match[3]; (call ? parser.hooks.call : parser.hooks.new) .for(harmonySpecifierTag) - .tap(PLUGIN_NAME, expr => { + .tap(PLUGIN_NAME, (expr) => { const settings = /** @type {HarmonySettings} */ ( parser.currentTagData ); diff --git a/lib/dependencies/getFunctionExpression.js b/lib/dependencies/getFunctionExpression.js index f4495b500ff..e213fa6cedd 100644 --- a/lib/dependencies/getFunctionExpression.js +++ b/lib/dependencies/getFunctionExpression.js @@ -14,7 +14,7 @@ * @param {Expression | SpreadElement} expr expressions * @returns {{fn: FunctionExpression | ArrowFunctionExpression, expressions: (Expression | SpreadElement)[], needThis: boolean | undefined } | undefined} function expression with additional information */ -module.exports = expr => { +module.exports = (expr) => { // if ( expr.type === "FunctionExpression" || diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index 61c18ed15eb..8d26a4314b8 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -119,7 +119,7 @@ class ModuleChunkFormatPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.additionalChunkRuntimeRequirements.tap( PLUGIN_NAME, (chunk, set) => { @@ -196,17 +196,17 @@ class ModuleChunkFormatPlugin { const hotUpdateChunk = chunk instanceof HotUpdateChunk ? chunk : null; const source = new ConcatSource(); source.add( - `export const __webpack_id__ = ${JSON.stringify(chunk.id)};\n` + `export const ${RuntimeGlobals.esmId} = ${JSON.stringify(chunk.id)};\n` ); source.add( - `export const __webpack_ids__ = ${JSON.stringify(chunk.ids)};\n` + `export const ${RuntimeGlobals.esmIds} = ${JSON.stringify(chunk.ids)};\n` ); - source.add("export const __webpack_modules__ = "); + source.add(`export const ${RuntimeGlobals.esmModules} = `); source.add(modules); source.add(";\n"); const runtimeModules = chunkGraph.getChunkRuntimeModulesInOrder(chunk); if (runtimeModules.length > 0) { - source.add("export const __webpack_runtime__ =\n"); + source.add(`export const ${RuntimeGlobals.esmRuntime} =\n`); source.add( Template.renderChunkRuntimeModules(runtimeModules, renderContext) ); diff --git a/lib/esm/ModuleChunkLoadingPlugin.js b/lib/esm/ModuleChunkLoadingPlugin.js index a34f990a290..01ff5ae05eb 100644 --- a/lib/esm/ModuleChunkLoadingPlugin.js +++ b/lib/esm/ModuleChunkLoadingPlugin.js @@ -21,13 +21,13 @@ class ModuleChunkLoadingPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalChunkLoading = compilation.outputOptions.chunkLoading; /** * @param {Chunk} chunk chunk to check * @returns {boolean} true, when the plugin is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const chunkLoading = options && options.chunkLoading !== undefined diff --git a/lib/esm/ModuleChunkLoadingRuntimeModule.js b/lib/esm/ModuleChunkLoadingRuntimeModule.js index 7c3e94d136a..3df1e1e3a95 100644 --- a/lib/esm/ModuleChunkLoadingRuntimeModule.js +++ b/lib/esm/ModuleChunkLoadingRuntimeModule.js @@ -159,7 +159,7 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" }{`, Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 0`).join( ",\n" ) ), @@ -168,29 +168,33 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { withLoading || withExternalInstallChunk ? `var installChunk = ${runtimeTemplate.basicFunction("data", [ runtimeTemplate.destructureObject( - ["__webpack_ids__", "__webpack_modules__", "__webpack_runtime__"], + [ + RuntimeGlobals.esmIds, + RuntimeGlobals.esmModules, + RuntimeGlobals.esmRuntime + ], "data" ), '// add "modules" to the modules object,', '// then flag all "ids" as loaded and fire callback', "var moduleId, chunkId, i = 0;", - "for(moduleId in __webpack_modules__) {", + `for(moduleId in ${RuntimeGlobals.esmModules}) {`, Template.indent([ - `if(${RuntimeGlobals.hasOwnProperty}(__webpack_modules__, moduleId)) {`, + `if(${RuntimeGlobals.hasOwnProperty}(${RuntimeGlobals.esmModules}, moduleId)) {`, Template.indent( - `${RuntimeGlobals.moduleFactories}[moduleId] = __webpack_modules__[moduleId];` + `${RuntimeGlobals.moduleFactories}[moduleId] = ${RuntimeGlobals.esmModules}[moduleId];` ), "}" ]), "}", - `if(__webpack_runtime__) __webpack_runtime__(${RuntimeGlobals.require});`, - "for(;i < __webpack_ids__.length; i++) {", + `if(${RuntimeGlobals.esmRuntime}) ${RuntimeGlobals.esmRuntime}(${RuntimeGlobals.require});`, + `for(;i < ${RuntimeGlobals.esmIds}.length; i++) {`, Template.indent([ - "chunkId = __webpack_ids__[i];", + `chunkId = ${RuntimeGlobals.esmIds}[i];`, `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`, Template.indent("installedChunks[chunkId][0]();"), "}", - "installedChunks[__webpack_ids__[i]] = 0;" + `installedChunks[${RuntimeGlobals.esmIds}[i]] = 0;` ]), "}", withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" @@ -365,8 +369,8 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { "// start update chunk loading", `var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId);`, `var onResolve = ${runtimeTemplate.basicFunction("obj", [ - "var updatedModules = obj.__webpack_modules__;", - "var updatedRuntime = obj.__webpack_runtime__;", + `var updatedModules = obj.${RuntimeGlobals.esmModules};`, + `var updatedRuntime = obj.${RuntimeGlobals.esmRuntime};`, "if(updatedRuntime) currentUpdateRuntime.push(updatedRuntime);", "for(var moduleId in updatedModules) {", Template.indent([ diff --git a/lib/formatLocation.js b/lib/formatLocation.js index 780d4a475ca..f75bc73ede1 100644 --- a/lib/formatLocation.js +++ b/lib/formatLocation.js @@ -12,7 +12,7 @@ * @param {SourcePosition} pos position * @returns {string} formatted position */ -const formatPosition = pos => { +const formatPosition = (pos) => { if (pos && typeof pos === "object") { if ("line" in pos && "column" in pos) { return `${pos.line}:${pos.column}`; @@ -27,7 +27,7 @@ const formatPosition = pos => { * @param {DependencyLocation} loc location * @returns {string} formatted location */ -const formatLocation = loc => { +const formatLocation = (loc) => { if (loc && typeof loc === "object") { if ("start" in loc && loc.start && "end" in loc && loc.end) { if ( diff --git a/lib/hmr/HotModuleReplacement.runtime.js b/lib/hmr/HotModuleReplacement.runtime.js index cb6d22d1562..5f297710e13 100644 --- a/lib/hmr/HotModuleReplacement.runtime.js +++ b/lib/hmr/HotModuleReplacement.runtime.js @@ -354,38 +354,50 @@ module.exports = function () { }; var outdatedModules = []; - results.forEach(function (result) { - if (result.apply) { - var modules = result.apply(reportError); - if (modules) { - for (var i = 0; i < modules.length; i++) { - outdatedModules.push(modules[i]); - } - } - } - }); - return Promise.all([disposePromise, applyPromise]).then(function () { - // handle errors in accept handlers and self accepted module load - if (error) { - return setStatus("fail").then(function () { - throw error; - }); - } + var onAccepted = function () { + return Promise.all([disposePromise, applyPromise]).then(function () { + // handle errors in accept handlers and self accepted module load + if (error) { + return setStatus("fail").then(function () { + throw error; + }); + } - if (queuedInvalidatedModules) { - return internalApply(options).then(function (list) { - outdatedModules.forEach(function (moduleId) { - if (list.indexOf(moduleId) < 0) list.push(moduleId); + if (queuedInvalidatedModules) { + return internalApply(options).then(function (list) { + outdatedModules.forEach(function (moduleId) { + if (list.indexOf(moduleId) < 0) list.push(moduleId); + }); + return list; }); - return list; - }); - } + } - return setStatus("idle").then(function () { - return outdatedModules; + return setStatus("idle").then(function () { + return outdatedModules; + }); }); - }); + }; + + return Promise.all( + results + .filter(function (result) { + return result.apply; + }) + .map(function (result) { + return result.apply(reportError); + }) + ) + .then(function (applyResults) { + applyResults.forEach(function (modules) { + if (modules) { + for (var i = 0; i < modules.length; i++) { + outdatedModules.push(modules[i]); + } + } + }); + }) + .then(onAccepted); } function applyInvalidatedModules() { diff --git a/lib/hmr/JavascriptHotModuleReplacement.runtime.js b/lib/hmr/JavascriptHotModuleReplacement.runtime.js index 109a2cea695..fecf52e5c0c 100644 --- a/lib/hmr/JavascriptHotModuleReplacement.runtime.js +++ b/lib/hmr/JavascriptHotModuleReplacement.runtime.js @@ -281,6 +281,7 @@ module.exports = function () { } }, apply: function (reportError) { + var acceptPromises = []; // insert new code for (var updateModuleId in appliedUpdate) { if ($hasOwnProperty$(appliedUpdate, updateModuleId)) { @@ -317,8 +318,9 @@ module.exports = function () { } } for (var k = 0; k < callbacks.length; k++) { + var result; try { - callbacks[k].call(null, moduleOutdatedDependencies); + result = callbacks[k].call(null, moduleOutdatedDependencies); } catch (err) { if (typeof errorHandlers[k] === "function") { try { @@ -355,54 +357,63 @@ module.exports = function () { } } } + if (result && typeof result.then === "function") { + acceptPromises.push(result); + } } } } } - // Load self accepted modules - for (var o = 0; o < outdatedSelfAcceptedModules.length; o++) { - var item = outdatedSelfAcceptedModules[o]; - var moduleId = item.module; - try { - item.require(moduleId); - } catch (err) { - if (typeof item.errorHandler === "function") { - try { - item.errorHandler(err, { - moduleId: moduleId, - module: $moduleCache$[moduleId] - }); - } catch (err1) { + var onAccepted = function () { + // Load self accepted modules + for (var o = 0; o < outdatedSelfAcceptedModules.length; o++) { + var item = outdatedSelfAcceptedModules[o]; + var moduleId = item.module; + try { + item.require(moduleId); + } catch (err) { + if (typeof item.errorHandler === "function") { + try { + item.errorHandler(err, { + moduleId: moduleId, + module: $moduleCache$[moduleId] + }); + } catch (err1) { + if (options.onErrored) { + options.onErrored({ + type: "self-accept-error-handler-errored", + moduleId: moduleId, + error: err1, + originalError: err + }); + } + if (!options.ignoreErrored) { + reportError(err1); + reportError(err); + } + } + } else { if (options.onErrored) { options.onErrored({ - type: "self-accept-error-handler-errored", + type: "self-accept-errored", moduleId: moduleId, - error: err1, - originalError: err + error: err }); } if (!options.ignoreErrored) { - reportError(err1); reportError(err); } } - } else { - if (options.onErrored) { - options.onErrored({ - type: "self-accept-errored", - moduleId: moduleId, - error: err - }); - } - if (!options.ignoreErrored) { - reportError(err); - } } } - } + }; - return outdatedModules; + return Promise.all(acceptPromises) + .then(onAccepted) + .then(function () { + return outdatedModules; + }); } }; } diff --git a/lib/hmr/JavascriptHotModuleReplacementHelper.js b/lib/hmr/JavascriptHotModuleReplacementHelper.js index 9974735732b..935fce0cc7e 100644 --- a/lib/hmr/JavascriptHotModuleReplacementHelper.js +++ b/lib/hmr/JavascriptHotModuleReplacementHelper.js @@ -13,7 +13,7 @@ const Template = require("../Template"); * @param {string} type unique identifier used for HMR runtime properties * @returns {string} HMR runtime code */ -const generateJavascriptHMR = type => +const generateJavascriptHMR = (type) => Template.getFunctionContent( require("../hmr/JavascriptHotModuleReplacement.runtime") ) diff --git a/lib/hmr/LazyCompilationPlugin.js b/lib/hmr/LazyCompilationPlugin.js index e4b4edc6dd1..b37ff4b5974 100644 --- a/lib/hmr/LazyCompilationPlugin.js +++ b/lib/hmr/LazyCompilationPlugin.js @@ -382,7 +382,7 @@ class LazyCompilationPlugin { callback(); }); if (promise && promise.then) { - promise.then(b => { + promise.then((b) => { backend = b; callback(); }, callback); @@ -395,7 +395,7 @@ class LazyCompilationPlugin { PLUGIN_NAME, (module, createData, resolveData) => { if ( - resolveData.dependencies.every(dep => + resolveData.dependencies.every((dep) => HMR_DEPENDENCY_TYPES.has(dep.type) ) ) { @@ -406,9 +406,9 @@ class LazyCompilationPlugin { /** @type {Module} */ (compilation.moduleGraph.getParentModule(hmrDep)); const isReferringToDynamicImport = originModule.blocks.some( - block => + (block) => block.dependencies.some( - dep => + (dep) => dep.type === "import()" && /** @type {HarmonyImportDependency} */ (dep).request === hmrDep.request @@ -417,7 +417,7 @@ class LazyCompilationPlugin { if (!isReferringToDynamicImport) return module; } else if ( !resolveData.dependencies.every( - dep => + (dep) => HMR_DEPENDENCY_TYPES.has(dep.type) || (this.imports && (dep.type === "import()" || @@ -455,7 +455,7 @@ class LazyCompilationPlugin { ); } ); - compiler.hooks.shutdown.tapAsync(PLUGIN_NAME, callback => { + compiler.hooks.shutdown.tapAsync(PLUGIN_NAME, (callback) => { backend.dispose(callback); }); } diff --git a/lib/hmr/lazyCompilationBackend.js b/lib/hmr/lazyCompilationBackend.js index 31b8ced3b3f..c5fbbbf72ad 100644 --- a/lib/hmr/lazyCompilationBackend.js +++ b/lib/hmr/lazyCompilationBackend.js @@ -22,7 +22,7 @@ * @param {Omit & { client: NonNullable}} options additional options for the backend * @returns {BackendHandler} backend */ -module.exports = options => (compiler, callback) => { +module.exports = (options) => (compiler, callback) => { const logger = compiler.getInfrastructureLogger("LazyCompilationBackend"); const activeModules = new Map(); const prefix = "/lazy-compilation-using-"; @@ -47,7 +47,7 @@ module.exports = options => (compiler, callback) => { const listen = typeof options.listen === "function" ? options.listen - : server => { + : (server) => { let listen = options.listen; if (typeof listen === "object" && !("port" in listen)) { listen = { ...listen, port: undefined }; @@ -100,14 +100,14 @@ module.exports = options => (compiler, callback) => { let isClosing = false; /** @type {Set} */ const sockets = new Set(); - server.on("connection", socket => { + server.on("connection", (socket) => { sockets.add(socket); socket.on("close", () => { sockets.delete(socket); }); if (isClosing) socket.destroy(); }); - server.on("clientError", e => { + server.on("clientError", (e) => { if (e.message !== "Server is disposing") logger.warn(e); }); @@ -117,7 +117,7 @@ module.exports = options => (compiler, callback) => { * @param {Error} err error * @returns {void} */ - err => { + (err) => { if (err) return callback(err); const _addr = server.address(); if (typeof _addr === "string") { @@ -138,7 +138,7 @@ module.exports = options => (compiler, callback) => { isClosing = true; // Removing the listener is a workaround for a memory leak in node.js server.off("request", requestListener); - server.close(err => { + server.close((err) => { callback(err); }); for (const socket of sockets) { diff --git a/lib/ids/ChunkModuleIdRangePlugin.js b/lib/ids/ChunkModuleIdRangePlugin.js index 3a62447d0a1..a3233bb969c 100644 --- a/lib/ids/ChunkModuleIdRangePlugin.js +++ b/lib/ids/ChunkModuleIdRangePlugin.js @@ -39,13 +39,13 @@ class ChunkModuleIdRangePlugin { */ apply(compiler) { const options = this.options; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const moduleGraph = compilation.moduleGraph; - compilation.hooks.moduleIds.tap(PLUGIN_NAME, modules => { + compilation.hooks.moduleIds.tap(PLUGIN_NAME, (modules) => { const chunkGraph = compilation.chunkGraph; const chunk = find( compilation.chunks, - chunk => chunk.name === options.name + (chunk) => chunk.name === options.name ); if (!chunk) { throw new Error( @@ -72,7 +72,7 @@ class ChunkModuleIdRangePlugin { chunkModules = chunkGraph.getOrderedChunkModules(chunk, cmpFn); } else { chunkModules = [...modules] - .filter(m => chunkGraph.isModuleInChunk(m, chunk)) + .filter((m) => chunkGraph.isModuleInChunk(m, chunk)) .sort(compareModulesByPreOrderIndexOrIdentifier(moduleGraph)); } diff --git a/lib/ids/DeterministicChunkIdsPlugin.js b/lib/ids/DeterministicChunkIdsPlugin.js index b4fa8ca2151..d06b7b3a7ec 100644 --- a/lib/ids/DeterministicChunkIdsPlugin.js +++ b/lib/ids/DeterministicChunkIdsPlugin.js @@ -37,8 +37,8 @@ class DeterministicChunkIdsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { - compilation.hooks.chunkIds.tap(PLUGIN_NAME, chunks => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { + compilation.hooks.chunkIds.tap(PLUGIN_NAME, (chunks) => { const chunkGraph = compilation.chunkGraph; const context = this.options.context ? this.options.context @@ -49,8 +49,9 @@ class DeterministicChunkIdsPlugin { const usedIds = getUsedChunkIds(compilation); assignDeterministicIds( - [...chunks].filter(chunk => chunk.id === null), - chunk => getFullChunkName(chunk, chunkGraph, context, compiler.root), + [...chunks].filter((chunk) => chunk.id === null), + (chunk) => + getFullChunkName(chunk, chunkGraph, context, compiler.root), compareNatural, (chunk, id) => { const size = usedIds.size; diff --git a/lib/ids/DeterministicModuleIdsPlugin.js b/lib/ids/DeterministicModuleIdsPlugin.js index 813ab8729c3..7ed80a67ef5 100644 --- a/lib/ids/DeterministicModuleIdsPlugin.js +++ b/lib/ids/DeterministicModuleIdsPlugin.js @@ -43,7 +43,7 @@ class DeterministicModuleIdsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => { const chunkGraph = compilation.chunkGraph; const context = this.options.context @@ -61,7 +61,7 @@ class DeterministicModuleIdsPlugin { ); assignDeterministicIds( modules, - module => getFullModuleName(module, context, compiler.root), + (module) => getFullModuleName(module, context, compiler.root), failOnConflict ? () => 0 : compareModulesByPreOrderIndexOrIdentifier( diff --git a/lib/ids/HashedModuleIdsPlugin.js b/lib/ids/HashedModuleIdsPlugin.js index a67f6e382b8..3944f8d2747 100644 --- a/lib/ids/HashedModuleIdsPlugin.js +++ b/lib/ids/HashedModuleIdsPlugin.js @@ -54,7 +54,7 @@ class HashedModuleIdsPlugin { */ apply(compiler) { const options = this.options; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => { const chunkGraph = compilation.chunkGraph; const context = this.options.context diff --git a/lib/ids/IdHelpers.js b/lib/ids/IdHelpers.js index 2e97a015ee8..142af991bfd 100644 --- a/lib/ids/IdHelpers.js +++ b/lib/ids/IdHelpers.js @@ -33,7 +33,7 @@ const getHash = (str, len, hashFunction) => { * @param {string} str the string * @returns {string} string prefixed by an underscore if it is a number */ -const avoidNumber = str => { +const avoidNumber = (str) => { // max length of a number is 21 chars, bigger numbers a written as "...e+xx" if (str.length > 21) return str; const firstChar = str.charCodeAt(0); @@ -54,7 +54,7 @@ const avoidNumber = str => { * @param {string} request the request * @returns {string} id representation */ -const requestToId = request => +const requestToId = (request) => request.replace(/^(\.\.?\/)+/, "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); /** @@ -136,7 +136,7 @@ const getShortChunkName = ( associatedObjectForCache ) => { const modules = chunkGraph.getChunkRootModules(chunk); - const shortModuleNames = modules.map(m => + const shortModuleNames = modules.map((m) => requestToId(getShortModuleName(m, context, associatedObjectForCache)) ); chunk.idNameHints.sort(); @@ -164,10 +164,10 @@ const getLongChunkName = ( associatedObjectForCache ) => { const modules = chunkGraph.getChunkRootModules(chunk); - const shortModuleNames = modules.map(m => + const shortModuleNames = modules.map((m) => requestToId(getShortModuleName(m, context, associatedObjectForCache)) ); - const longModuleNames = modules.map(m => + const longModuleNames = modules.map((m) => requestToId( getLongModuleName("", m, context, hashFunction, associatedObjectForCache) ) @@ -198,7 +198,7 @@ const getFullChunkName = ( ) => { if (chunk.name) return chunk.name; const modules = chunkGraph.getChunkRootModules(chunk); - const fullModuleNames = modules.map(m => + const fullModuleNames = modules.map((m) => makePathsRelative(context, m.identifier(), associatedObjectForCache) ); return fullModuleNames.join(); @@ -259,7 +259,7 @@ const getUsedModuleIdsAndModules = (compilation, filter) => { * @param {Compilation} compilation the compilation * @returns {Set} used chunk ids as strings */ -const getUsedChunkIds = compilation => { +const getUsedChunkIds = (compilation) => { /** @type {Set} */ const usedIds = new Set(); if (compilation.usedChunkIds) { @@ -413,7 +413,7 @@ const assignAscendingModuleIds = (usedIds, modules, compilation) => { /** * @param {Module} module the module */ - assignId = module => { + assignId = (module) => { if (chunkGraph.getModuleId(module) === null) { while (usedIds.has(String(nextId))) nextId++; chunkGraph.setModuleId(module, nextId++); @@ -423,7 +423,7 @@ const assignAscendingModuleIds = (usedIds, modules, compilation) => { /** * @param {Module} module the module */ - assignId = module => { + assignId = (module) => { if (chunkGraph.getModuleId(module) === null) { chunkGraph.setModuleId(module, nextId++); } diff --git a/lib/ids/NamedChunkIdsPlugin.js b/lib/ids/NamedChunkIdsPlugin.js index 7d4337d45ad..139d4793377 100644 --- a/lib/ids/NamedChunkIdsPlugin.js +++ b/lib/ids/NamedChunkIdsPlugin.js @@ -42,24 +42,24 @@ class NamedChunkIdsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const hashFunction = /** @type {NonNullable} */ (compilation.outputOptions.hashFunction); - compilation.hooks.chunkIds.tap(PLUGIN_NAME, chunks => { + compilation.hooks.chunkIds.tap(PLUGIN_NAME, (chunks) => { const chunkGraph = compilation.chunkGraph; const context = this.context ? this.context : compiler.context; const delimiter = this.delimiter; const unnamedChunks = assignNames( - [...chunks].filter(chunk => { + [...chunks].filter((chunk) => { if (chunk.name) { chunk.id = chunk.name; chunk.ids = [chunk.name]; } return chunk.id === null; }), - chunk => + (chunk) => getShortChunkName( chunk, chunkGraph, @@ -68,7 +68,7 @@ class NamedChunkIdsPlugin { hashFunction, compiler.root ), - chunk => + (chunk) => getLongChunkName( chunk, chunkGraph, diff --git a/lib/ids/NamedModuleIdsPlugin.js b/lib/ids/NamedModuleIdsPlugin.js index 9922516cb09..8ac07eea8df 100644 --- a/lib/ids/NamedModuleIdsPlugin.js +++ b/lib/ids/NamedModuleIdsPlugin.js @@ -40,7 +40,7 @@ class NamedModuleIdsPlugin { */ apply(compiler) { const { root } = compiler; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const hashFunction = /** @type {NonNullable} */ (compilation.outputOptions.hashFunction); @@ -53,7 +53,7 @@ class NamedModuleIdsPlugin { const [usedIds, modules] = getUsedModuleIdsAndModules(compilation); const unnamedModules = assignNames( modules, - m => getShortModuleName(m, context, root), + (m) => getShortModuleName(m, context, root), (m, shortName) => getLongModuleName(shortName, m, context, hashFunction, root), compareModulesByIdentifier, diff --git a/lib/ids/NaturalChunkIdsPlugin.js b/lib/ids/NaturalChunkIdsPlugin.js index a45e6c7fbd6..b6f2fd7fdcb 100644 --- a/lib/ids/NaturalChunkIdsPlugin.js +++ b/lib/ids/NaturalChunkIdsPlugin.js @@ -21,8 +21,8 @@ class NaturalChunkIdsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { - compilation.hooks.chunkIds.tap(PLUGIN_NAME, chunks => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { + compilation.hooks.chunkIds.tap(PLUGIN_NAME, (chunks) => { const chunkGraph = compilation.chunkGraph; const compareNatural = compareChunksNatural(chunkGraph); /** @type {Chunk[]} */ diff --git a/lib/ids/NaturalModuleIdsPlugin.js b/lib/ids/NaturalModuleIdsPlugin.js index 8dc9ae473b7..8915b3f2810 100644 --- a/lib/ids/NaturalModuleIdsPlugin.js +++ b/lib/ids/NaturalModuleIdsPlugin.js @@ -25,7 +25,7 @@ class NaturalModuleIdsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => { const [usedIds, modulesInNaturalOrder] = getUsedModuleIdsAndModules(compilation); diff --git a/lib/ids/OccurrenceChunkIdsPlugin.js b/lib/ids/OccurrenceChunkIdsPlugin.js index b37703db2a6..2cb6c9b61f8 100644 --- a/lib/ids/OccurrenceChunkIdsPlugin.js +++ b/lib/ids/OccurrenceChunkIdsPlugin.js @@ -41,8 +41,8 @@ class OccurrenceChunkIdsPlugin { */ apply(compiler) { const prioritiseInitial = this.options.prioritiseInitial; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { - compilation.hooks.chunkIds.tap(PLUGIN_NAME, chunks => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { + compilation.hooks.chunkIds.tap(PLUGIN_NAME, (chunks) => { const chunkGraph = compilation.chunkGraph; /** @type {Map} */ diff --git a/lib/ids/OccurrenceModuleIdsPlugin.js b/lib/ids/OccurrenceModuleIdsPlugin.js index 71ca1cc1194..45ce2b599d1 100644 --- a/lib/ids/OccurrenceModuleIdsPlugin.js +++ b/lib/ids/OccurrenceModuleIdsPlugin.js @@ -46,7 +46,7 @@ class OccurrenceModuleIdsPlugin { */ apply(compiler) { const prioritiseInitial = this.options.prioritiseInitial; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const moduleGraph = compilation.moduleGraph; compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => { @@ -75,14 +75,14 @@ class OccurrenceModuleIdsPlugin { * @param {Module} module module * @returns {number} count of occurs */ - const countOccursInEntry = module => { + const countOccursInEntry = (module) => { let sum = 0; for (const [ originModule, connections ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { if (!originModule) continue; - if (!connections.some(c => c.isTargetActive(undefined))) continue; + if (!connections.some((c) => c.isTargetActive(undefined))) continue; sum += initialChunkChunkMap.get(originModule) || 0; } return sum; @@ -92,7 +92,7 @@ class OccurrenceModuleIdsPlugin { * @param {Module} module module * @returns {number} count of occurs */ - const countOccurs = module => { + const countOccurs = (module) => { let sum = 0; for (const [ originModule, diff --git a/lib/ids/SyncModuleIdsPlugin.js b/lib/ids/SyncModuleIdsPlugin.js index 349a69dc8b9..6b667390447 100644 --- a/lib/ids/SyncModuleIdsPlugin.js +++ b/lib/ids/SyncModuleIdsPlugin.js @@ -46,7 +46,7 @@ class SyncModuleIdsPlugin { let data; let dataChanged = false; if (this._read) { - compiler.hooks.readRecords.tapAsync(plugin, callback => { + compiler.hooks.readRecords.tapAsync(plugin, (callback) => { const fs = /** @type {IntermediateFileSystem} */ (compiler.intermediateFileSystem); @@ -68,7 +68,7 @@ class SyncModuleIdsPlugin { }); } if (this._write) { - compiler.hooks.emitRecords.tapAsync(plugin, callback => { + compiler.hooks.emitRecords.tapAsync(plugin, (callback) => { if (!data || !dataChanged) return callback(); /** @type {{[key: string]: string | number}} */ const json = {}; @@ -82,7 +82,7 @@ class SyncModuleIdsPlugin { fs.writeFile(this._path, JSON.stringify(json), callback); }); } - compiler.hooks.thisCompilation.tap(plugin, compilation => { + compiler.hooks.thisCompilation.tap(plugin, (compilation) => { const associatedObjectForCache = compiler.root; const context = this._context || compiler.context; if (this._read) { @@ -114,7 +114,7 @@ class SyncModuleIdsPlugin { }); } if (this._write) { - compilation.hooks.recordModules.tap(plugin, modules => { + compilation.hooks.recordModules.tap(plugin, (modules) => { const { chunkGraph } = compilation; let oldData = data; if (!oldData) { diff --git a/lib/index.js b/lib/index.js index 8caa003198d..a4003a0f0ec 100644 --- a/lib/index.js +++ b/lib/index.js @@ -49,7 +49,9 @@ const memoize = require("./util/memoize"); /** @typedef {import("./Compiler").AssetEmittedInfo} AssetEmittedInfo */ /** @typedef {import("./Entrypoint")} Entrypoint */ /** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */ +/** @typedef {import("./MultiCompiler").MultiWebpackOptions} MultiConfiguration */ /** @typedef {import("./MultiStats")} MultiStats */ +/** @typedef {import("./MultiStats").MultiStatsOptions} MultiStatsOptions */ /** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */ /** @typedef {import("./Parser").ParserState} ParserState */ /** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */ @@ -57,6 +59,8 @@ const memoize = require("./util/memoize"); /** @typedef {import("./Watching")} Watching */ /** @typedef {import("./cli").Argument} Argument */ /** @typedef {import("./cli").Problem} Problem */ +/** @typedef {import("./cli").Colors} Colors */ +/** @typedef {import("./cli").ColorsOptions} ColorsOptions */ /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */ @@ -79,7 +83,7 @@ const memoize = require("./util/memoize"); * @param {() => T} factory factory function * @returns {T} function */ -const lazyFunction = factory => { +const lazyFunction = (factory) => { const fac = memoize(factory); const f = /** @type {unknown} */ ( /** @@ -132,25 +136,25 @@ module.exports = mergeExports(fn, { return require("./webpack"); }, /** - * @returns {(configuration: Configuration | Configuration[]) => void} validate fn + * @returns {(configuration: Configuration | MultiConfiguration) => void} validate fn */ get validate() { const webpackOptionsSchemaCheck = - /** @type {(configuration: Configuration | Configuration[]) => boolean} */ + /** @type {(configuration: Configuration | MultiConfiguration) => boolean} */ (require("../schemas/WebpackOptions.check")); const getRealValidate = memoize( /** - * @returns {(configuration: Configuration | Configuration[]) => void} validate fn + * @returns {(configuration: Configuration | MultiConfiguration) => void} validate fn */ () => { const validateSchema = require("./validateSchema"); const webpackOptionsSchema = require("../schemas/WebpackOptions.json"); - return options => validateSchema(webpackOptionsSchema, options); + return (options) => validateSchema(webpackOptionsSchema, options); } ); - return options => { + return (options) => { if (!webpackOptionsSchemaCheck(options)) { getRealValidate()(options); } diff --git a/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js b/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js index df4d6a55509..c9b68c38a6c 100644 --- a/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +++ b/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js @@ -27,7 +27,7 @@ class ArrayPushCallbackChunkFormatPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.additionalChunkRuntimeRequirements.tap( PLUGIN_NAME, (chunk, set, { chunkGraph }) => { diff --git a/lib/javascript/BasicEvaluatedExpression.js b/lib/javascript/BasicEvaluatedExpression.js index e322bf9b5c4..2318c8f91fb 100644 --- a/lib/javascript/BasicEvaluatedExpression.js +++ b/lib/javascript/BasicEvaluatedExpression.js @@ -463,7 +463,7 @@ class BasicEvaluatedExpression { setItems(items) { this.type = TypeArray; this.items = items; - this.sideEffects = items.some(i => i.couldHaveSideEffects()); + this.sideEffects = items.some((i) => i.couldHaveSideEffects()); return this; } @@ -492,7 +492,7 @@ class BasicEvaluatedExpression { this.quasis = quasis; this.parts = parts; this.templateStringKind = kind; - this.sideEffects = parts.some(p => p.sideEffects); + this.sideEffects = parts.some((p) => p.sideEffects); return this; } @@ -557,7 +557,7 @@ class BasicEvaluatedExpression { * @param {string} flags regexp flags * @returns {boolean} is valid flags */ -BasicEvaluatedExpression.isValidRegExpFlags = flags => { +BasicEvaluatedExpression.isValidRegExpFlags = (flags) => { const len = flags.length; if (len === 0) return true; diff --git a/lib/javascript/CommonJsChunkFormatPlugin.js b/lib/javascript/CommonJsChunkFormatPlugin.js index 48b4dce8c43..728b620a121 100644 --- a/lib/javascript/CommonJsChunkFormatPlugin.js +++ b/lib/javascript/CommonJsChunkFormatPlugin.js @@ -31,7 +31,7 @@ class CommonJsChunkFormatPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.additionalChunkRuntimeRequirements.tap( PLUGIN_NAME, (chunk, set, { chunkGraph }) => { diff --git a/lib/javascript/EnableChunkLoadingPlugin.js b/lib/javascript/EnableChunkLoadingPlugin.js index a06ba03259f..f19c18f32ce 100644 --- a/lib/javascript/EnableChunkLoadingPlugin.js +++ b/lib/javascript/EnableChunkLoadingPlugin.js @@ -15,7 +15,7 @@ const enabledTypes = new WeakMap(); * @param {Compiler} compiler compiler * @returns {Set} enabled types */ -const getEnabledTypes = compiler => { +const getEnabledTypes = (compiler) => { let set = enabledTypes.get(compiler); if (set === undefined) { set = new Set(); diff --git a/lib/javascript/JavascriptGenerator.js b/lib/javascript/JavascriptGenerator.js index 3f50e39ae88..775fbf53b7e 100644 --- a/lib/javascript/JavascriptGenerator.js +++ b/lib/javascript/JavascriptGenerator.js @@ -88,7 +88,7 @@ class JavascriptGenerator extends Generator { module.buildMeta.exportsType !== "namespace" || module.presentationalDependencies === undefined || !module.presentationalDependencies.some( - d => d instanceof HarmonyCompatibilityDependency + (d) => d instanceof HarmonyCompatibilityDependency ) ) { return "Module is not an ECMAScript module"; diff --git a/lib/javascript/JavascriptModulesPlugin.js b/lib/javascript/JavascriptModulesPlugin.js index 81ce7b8cf4b..783e35183fe 100644 --- a/lib/javascript/JavascriptModulesPlugin.js +++ b/lib/javascript/JavascriptModulesPlugin.js @@ -186,7 +186,7 @@ const printGeneratedCodeForStack = (module, code) => { * @property {SyncWaterfallHook<[Source, RenderContext]>} render * @property {SyncWaterfallHook<[Source, Module, StartupRenderContext]>} renderStartup * @property {SyncWaterfallHook<[string, RenderBootstrapContext]>} renderRequire - * @property {SyncBailHook<[Module, RenderBootstrapContext], string | void>} inlineInRuntimeBailout + * @property {SyncBailHook<[Module, Partial], string | void>} inlineInRuntimeBailout * @property {SyncBailHook<[Module, RenderContext], string | void>} embedInRuntimeBailout * @property {SyncBailHook<[RenderContext], string | void>} strictRuntimeBailout * @property {SyncHook<[Chunk, Hash, ChunkHashContext]>} chunkHash @@ -274,7 +274,7 @@ class JavascriptModulesPlugin { ]) { normalModuleFactory.hooks.createParser .for(type) - .tap(PLUGIN_NAME, _options => { + .tap(PLUGIN_NAME, (_options) => { switch (type) { case JAVASCRIPT_MODULE_TYPE_AUTO: { return new JavascriptParser("auto"); @@ -417,7 +417,7 @@ class JavascriptModulesPlugin { ); } }); - compilation.hooks.contentHash.tap(PLUGIN_NAME, chunk => { + compilation.hooks.contentHash.tap(PLUGIN_NAME, (chunk) => { const { chunkGraph, codeGenerationResults, @@ -713,7 +713,7 @@ class JavascriptModulesPlugin { let allStrict = renderContext.strictMode; if ( !allStrict && - allModules.every(m => /** @type {BuildInfo} */ (m.buildInfo).strict) + allModules.every((m) => /** @type {BuildInfo} */ (m.buildInfo).strict) ) { const strictBailout = hooks.strictRuntimeBailout.call(renderContext); strictHeader = strictBailout @@ -728,7 +728,7 @@ class JavascriptModulesPlugin { strictMode: allStrict }; const moduleSources = - Template.renderChunkModules(chunkRenderContext, allModules, module => + Template.renderChunkModules(chunkRenderContext, allModules, (module) => this.renderModule(module, chunkRenderContext, hooks, true) ) || new RawSource("{}"); let source = tryRunOrWebpackError( @@ -812,7 +812,7 @@ class JavascriptModulesPlugin { let allStrict = renderContext.strictMode; if ( !allStrict && - allModules.every(m => /** @type {BuildInfo} */ (m.buildInfo).strict) + allModules.every((m) => /** @type {BuildInfo} */ (m.buildInfo).strict) ) { const strictBailout = hooks.strictRuntimeBailout.call(renderContext); if (strictBailout) { @@ -838,10 +838,10 @@ class JavascriptModulesPlugin { chunkRenderContext, inlinedModules ? allModules.filter( - m => !(/** @type {Set} */ (inlinedModules).has(m)) + (m) => !(/** @type {Set} */ (inlinedModules).has(m)) ) : allModules, - module => this.renderModule(module, chunkRenderContext, hooks, true), + (module) => this.renderModule(module, chunkRenderContext, hooks, true), prefix ); if ( @@ -1011,7 +1011,7 @@ class JavascriptModulesPlugin { const toSource = useSourceMap ? (content, name) => new OriginalSource(Template.asString(content), name) - : content => new RawSource(Template.asString(content)); + : (content) => new RawSource(Template.asString(content)); source.add( new PrefixSource( prefix, @@ -1229,7 +1229,7 @@ class JavascriptModulesPlugin { } const chunks = /** @type {Entrypoint} */ - (entrypoint).chunks.filter(c => c !== chunk); + (entrypoint).chunks.filter((c) => c !== chunk); if (result.allowInlineStartup && chunks.length > 0) { buf2.push( "// This entry module depends on other loaded chunks and execution need to be delayed" @@ -1242,10 +1242,10 @@ class JavascriptModulesPlugin { moduleGraph.getIncomingConnectionsByOriginModule(entryModule), ([originModule, connections]) => originModule && - connections.some(c => c.isTargetActive(chunk.runtime)) && + connections.some((c) => c.isTargetActive(chunk.runtime)) && someInIterable( chunkGraph.getModuleRuntimes(originModule), - runtime => + (runtime) => intersectRuntime(runtime, chunk.runtime) !== undefined ) ) @@ -1309,7 +1309,7 @@ class JavascriptModulesPlugin { `${i === 0 ? `var ${RuntimeGlobals.exports} = ` : ""}${ RuntimeGlobals.onChunksLoaded }(undefined, ${JSON.stringify( - chunks.map(c => c.id) + chunks.map((c) => c.id) )}, ${runtimeTemplate.returningFunction( `${RuntimeGlobals.require}(${moduleIdExpr})` )})` @@ -1554,7 +1554,7 @@ class JavascriptModulesPlugin { ) { const innerStrict = !allStrict && - allModules.every(m => /** @type {BuildInfo} */ (m.buildInfo).strict); + allModules.every((m) => /** @type {BuildInfo} */ (m.buildInfo).strict); const isMultipleEntries = inlinedModules.size > 1; const singleEntryWithModules = inlinedModules.size === 1 && hasChunkModules; @@ -1639,7 +1639,7 @@ class JavascriptModulesPlugin { const info = /** @type {Info} */ (inlinedModulesToInfo.get(m)); const allUsedNames = new Set( - Array.from(info.through, v => v.identifier.name) + Array.from(info.through, (v) => v.identifier.name) ); for (const variable of usedInNonInlined) { @@ -1660,7 +1660,7 @@ class JavascriptModulesPlugin { if (allUsedNames.has(name) || usedNames.has(name)) { const references = getAllReferences(variable); const allIdentifiers = new Set([ - ...references.map(r => r.identifier), + ...references.map((r) => r.identifier), ...variable.identifiers ]); for (const ref of references) { diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index 474cf42f149..23a8cad1346 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -118,7 +118,7 @@ const ALLOWED_MEMBER_TYPES_ALL = 0b11; const LEGACY_ASSERT_ATTRIBUTES = Symbol("assert"); /** @type {(BaseParser: typeof AcornParser) => typeof AcornParser} */ -const importAssertions = Parser => +const importAssertions = (Parser) => class extends Parser { /** * @this {InstanceType} @@ -189,7 +189,7 @@ let parser = AcornParser.extend(importAssertions); * @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpression} node node with assertions * @returns {ImportAttributes | undefined} import attributes */ -const getImportAttributes = node => { +const getImportAttributes = (node) => { if (node.type === "ImportExpression") { if ( node.options && @@ -361,7 +361,7 @@ const objectAndMembersToName = (object, membersReversed) => { * @param {Expression | SpreadElement | Super} expression expression * @returns {string | "this" | undefined} name or variable info */ -const getRootName = expression => { +const getRootName = (expression) => { switch (expression.type) { case "Identifier": return expression.name; @@ -607,7 +607,7 @@ class JavascriptParser extends Parser { } _initializeEvaluating() { - this.hooks.evaluate.for("Literal").tap(CLASS_NAME, _expr => { + this.hooks.evaluate.for("Literal").tap(CLASS_NAME, (_expr) => { const expr = /** @type {Literal} */ (_expr); switch (typeof expr.value) { @@ -639,7 +639,7 @@ class JavascriptParser extends Parser { .setRange(/** @type {Range} */ (expr.range)); } }); - this.hooks.evaluate.for("NewExpression").tap(CLASS_NAME, _expr => { + this.hooks.evaluate.for("NewExpression").tap(CLASS_NAME, (_expr) => { const expr = /** @type {NewExpression} */ (_expr); const callee = expr.callee; if (callee.type !== "Identifier") return; @@ -704,7 +704,7 @@ class JavascriptParser extends Parser { .setRegExp(flags ? new RegExp(regExp, flags) : new RegExp(regExp)) .setRange(/** @type {Range} */ (expr.range)); }); - this.hooks.evaluate.for("LogicalExpression").tap(CLASS_NAME, _expr => { + this.hooks.evaluate.for("LogicalExpression").tap(CLASS_NAME, (_expr) => { const expr = /** @type {LogicalExpression} */ (_expr); const left = this.evaluateExpression(expr.left); @@ -822,7 +822,7 @@ class JavascriptParser extends Parser { } }; - this.hooks.evaluate.for("BinaryExpression").tap(CLASS_NAME, _expr => { + this.hooks.evaluate.for("BinaryExpression").tap(CLASS_NAME, (_expr) => { const expr = /** @type {BinaryExpression} */ (_expr); /** @@ -831,7 +831,7 @@ class JavascriptParser extends Parser { * @param {(leftOperand: T, rightOperand: T) => boolean | number | bigint | string} operandHandler the handler for the operation (e.g. (a, b) => a + b) * @returns {BasicEvaluatedExpression | undefined} the evaluated expression */ - const handleConstOperation = operandHandler => { + const handleConstOperation = (operandHandler) => { const left = this.evaluateExpression(expr.left); if (!left.isCompileTimeValue()) return; @@ -871,7 +871,7 @@ class JavascriptParser extends Parser { * @param {BasicEvaluatedExpression[]} parts parts * @returns {string} value */ - const getPrefix = parts => { + const getPrefix = (parts) => { let value = ""; for (const p of parts) { const v = p.asString(); @@ -884,7 +884,7 @@ class JavascriptParser extends Parser { * @param {BasicEvaluatedExpression[]} parts parts * @returns {string} value */ - const getSuffix = parts => { + const getSuffix = (parts) => { let value = ""; for (let i = parts.length - 1; i >= 0; i--) { const v = parts[i].asString(); @@ -927,7 +927,7 @@ class JavascriptParser extends Parser { * @param {boolean} eql true for "===" and false for "!==" * @returns {BasicEvaluatedExpression | undefined} the evaluated expression */ - const handleStrictEqualityComparison = eql => { + const handleStrictEqualityComparison = (eql) => { const left = this.evaluateExpression(expr.left); const right = this.evaluateExpression(expr.right); const res = new BasicEvaluatedExpression(); @@ -989,7 +989,7 @@ class JavascriptParser extends Parser { * @param {boolean} eql true for "==" and false for "!=" * @returns {BasicEvaluatedExpression | undefined} the evaluated expression */ - const handleAbstractEqualityComparison = eql => { + const handleAbstractEqualityComparison = (eql) => { const left = this.evaluateExpression(expr.left); const right = this.evaluateExpression(expr.right); const res = new BasicEvaluatedExpression(); @@ -1225,7 +1225,7 @@ class JavascriptParser extends Parser { return handleConstOperation((l, r) => l >= r); } }); - this.hooks.evaluate.for("UnaryExpression").tap(CLASS_NAME, _expr => { + this.hooks.evaluate.for("UnaryExpression").tap(CLASS_NAME, (_expr) => { const expr = /** @type {UnaryExpression} */ (_expr); /** @@ -1234,7 +1234,7 @@ class JavascriptParser extends Parser { * @param {(operand: T) => boolean | number | bigint | string} operandHandler handler for the operand * @returns {BasicEvaluatedExpression | undefined} evaluated expression */ - const handleConstOperation = operandHandler => { + const handleConstOperation = (operandHandler) => { const argument = this.evaluateExpression(expr.argument); if (!argument.isCompileTimeValue()) return; const result = operandHandler( @@ -1341,22 +1341,22 @@ class JavascriptParser extends Parser { .setSideEffects(argument.couldHaveSideEffects()) .setRange(/** @type {Range} */ (expr.range)); } else if (expr.operator === "~") { - return handleConstOperation(v => ~v); + return handleConstOperation((v) => ~v); } else if (expr.operator === "+") { // eslint-disable-next-line no-implicit-coercion - return handleConstOperation(v => +v); + return handleConstOperation((v) => +v); } else if (expr.operator === "-") { - return handleConstOperation(v => -v); + return handleConstOperation((v) => -v); } }); this.hooks.evaluateTypeof .for("undefined") - .tap(CLASS_NAME, expr => + .tap(CLASS_NAME, (expr) => new BasicEvaluatedExpression() .setString("undefined") .setRange(/** @type {Range} */ (expr.range)) ); - this.hooks.evaluate.for("Identifier").tap(CLASS_NAME, expr => { + this.hooks.evaluate.for("Identifier").tap(CLASS_NAME, (expr) => { if (/** @type {Identifier} */ (expr).name === "undefined") { return new BasicEvaluatedExpression() .setUndefined() @@ -1373,7 +1373,7 @@ class JavascriptParser extends Parser { let cachedExpression; /** @type {GetInfoResult | undefined} */ let cachedInfo; - this.hooks.evaluate.for(exprType).tap(CLASS_NAME, expr => { + this.hooks.evaluate.for(exprType).tap(CLASS_NAME, (expr) => { const expression = /** @type {Identifier | ThisExpression | MemberExpression} */ (expr); @@ -1382,12 +1382,12 @@ class JavascriptParser extends Parser { return this.callHooksForInfoWithFallback( this.hooks.evaluateIdentifier, info.name, - _name => { + (_name) => { cachedExpression = expression; cachedInfo = info; return undefined; }, - name => { + (name) => { const hook = this.hooks.evaluateDefinedIdentifier.get(name); if (hook !== undefined) { return hook.call(expression); @@ -1399,7 +1399,7 @@ class JavascriptParser extends Parser { }); this.hooks.evaluate .for(exprType) - .tap({ name: CLASS_NAME, stage: 100 }, expr => { + .tap({ name: CLASS_NAME, stage: 100 }, (expr) => { const expression = /** @type {Identifier | ThisExpression | MemberExpression} */ (expr); @@ -1422,7 +1422,7 @@ class JavascriptParser extends Parser { cachedExpression = cachedInfo = undefined; }); }; - tapEvaluateWithVariableInfo("Identifier", expr => { + tapEvaluateWithVariableInfo("Identifier", (expr) => { const info = this.getVariableInfo(/** @type {Identifier} */ (expr).name); if ( typeof info === "string" || @@ -1437,7 +1437,7 @@ class JavascriptParser extends Parser { }; } }); - tapEvaluateWithVariableInfo("ThisExpression", _expr => { + tapEvaluateWithVariableInfo("ThisExpression", (_expr) => { const info = this.getVariableInfo("this"); if ( typeof info === "string" || @@ -1452,7 +1452,7 @@ class JavascriptParser extends Parser { }; } }); - this.hooks.evaluate.for("MetaProperty").tap(CLASS_NAME, expr => { + this.hooks.evaluate.for("MetaProperty").tap(CLASS_NAME, (expr) => { const metaProperty = /** @type {MetaProperty} */ (expr); return this.callHooksForName( @@ -1462,14 +1462,14 @@ class JavascriptParser extends Parser { metaProperty ); }); - tapEvaluateWithVariableInfo("MemberExpression", expr => + tapEvaluateWithVariableInfo("MemberExpression", (expr) => this.getMemberExpressionInfo( /** @type {MemberExpression} */ (expr), ALLOWED_MEMBER_TYPES_EXPRESSION ) ); - this.hooks.evaluate.for("CallExpression").tap(CLASS_NAME, _expr => { + this.hooks.evaluate.for("CallExpression").tap(CLASS_NAME, (_expr) => { const expr = /** @type {CallExpression} */ (_expr); if ( expr.callee.type === "MemberExpression" && @@ -1641,7 +1641,7 @@ class JavascriptParser extends Parser { }; }; - this.hooks.evaluate.for("TemplateLiteral").tap(CLASS_NAME, _node => { + this.hooks.evaluate.for("TemplateLiteral").tap(CLASS_NAME, (_node) => { const node = /** @type {TemplateLiteral} */ (_node); const { quasis, parts } = getSimplifiedTemplateResult("cooked", node); @@ -1654,7 +1654,7 @@ class JavascriptParser extends Parser { }); this.hooks.evaluate .for("TaggedTemplateExpression") - .tap(CLASS_NAME, _node => { + .tap(CLASS_NAME, (_node) => { const node = /** @type {TaggedTemplateExpression} */ (_node); const tag = this.evaluateExpression(node.tag); @@ -1767,44 +1767,46 @@ class JavascriptParser extends Parser { .setSideEffects(param.couldHaveSideEffects()) .setRange(/** @type {Range} */ (expr.range)); }); - this.hooks.evaluate.for("ConditionalExpression").tap(CLASS_NAME, _expr => { - const expr = /** @type {ConditionalExpression} */ (_expr); - - const condition = this.evaluateExpression(expr.test); - const conditionValue = condition.asBool(); - let res; - if (conditionValue === undefined) { - const consequent = this.evaluateExpression(expr.consequent); - const alternate = this.evaluateExpression(expr.alternate); - res = new BasicEvaluatedExpression(); - if (consequent.isConditional()) { - res.setOptions( - /** @type {BasicEvaluatedExpression[]} */ (consequent.options) - ); + this.hooks.evaluate + .for("ConditionalExpression") + .tap(CLASS_NAME, (_expr) => { + const expr = /** @type {ConditionalExpression} */ (_expr); + + const condition = this.evaluateExpression(expr.test); + const conditionValue = condition.asBool(); + let res; + if (conditionValue === undefined) { + const consequent = this.evaluateExpression(expr.consequent); + const alternate = this.evaluateExpression(expr.alternate); + res = new BasicEvaluatedExpression(); + if (consequent.isConditional()) { + res.setOptions( + /** @type {BasicEvaluatedExpression[]} */ (consequent.options) + ); + } else { + res.setOptions([consequent]); + } + if (alternate.isConditional()) { + res.addOptions( + /** @type {BasicEvaluatedExpression[]} */ (alternate.options) + ); + } else { + res.addOptions([alternate]); + } } else { - res.setOptions([consequent]); - } - if (alternate.isConditional()) { - res.addOptions( - /** @type {BasicEvaluatedExpression[]} */ (alternate.options) + res = this.evaluateExpression( + conditionValue ? expr.consequent : expr.alternate ); - } else { - res.addOptions([alternate]); + if (condition.couldHaveSideEffects()) res.setSideEffects(); } - } else { - res = this.evaluateExpression( - conditionValue ? expr.consequent : expr.alternate - ); - if (condition.couldHaveSideEffects()) res.setSideEffects(); - } - res.setRange(/** @type {Range} */ (expr.range)); - return res; - }); - this.hooks.evaluate.for("ArrayExpression").tap(CLASS_NAME, _expr => { + res.setRange(/** @type {Range} */ (expr.range)); + return res; + }); + this.hooks.evaluate.for("ArrayExpression").tap(CLASS_NAME, (_expr) => { const expr = /** @type {ArrayExpression} */ (_expr); const items = expr.elements.map( - element => + (element) => element !== null && element.type !== "SpreadElement" && this.evaluateExpression(element) @@ -1814,7 +1816,7 @@ class JavascriptParser extends Parser { .setItems(/** @type {BasicEvaluatedExpression[]} */ (items)) .setRange(/** @type {Range} */ (expr.range)); }); - this.hooks.evaluate.for("ChainExpression").tap(CLASS_NAME, _expr => { + this.hooks.evaluate.for("ChainExpression").tap(CLASS_NAME, (_expr) => { const expr = /** @type {ChainExpression} */ (_expr); /** @type {Expression[]} */ const optionalExpressionsStack = []; @@ -2680,7 +2682,7 @@ class JavascriptParser extends Parser { this.prevStatement = prev; this.blockPreWalkStatement(statement.declaration); let index = 0; - this.enterDeclaration(statement.declaration, def => { + this.enterDeclaration(statement.declaration, (def) => { this.hooks.exportSpecifier.call(statement, def, def, index++); }); } @@ -3061,7 +3063,7 @@ class JavascriptParser extends Parser { this.inBlockScope(() => { // Error binding is optional in catch clause since ECMAScript 2019 if (catchClause.param !== null) { - this.enterPattern(catchClause.param, ident => { + this.enterPattern(catchClause.param, (ident) => { this.defineVariable(ident); }); this.walkPattern(catchClause.param); @@ -3620,7 +3622,7 @@ class JavascriptParser extends Parser { * @param {Expression | SpreadElement} argOrThis arg or this * @returns {string | VariableInfo | undefined} var info */ - const getVarInfo = argOrThis => { + const getVarInfo = (argOrThis) => { const renameIdentifier = this.getRenameIdentifier(argOrThis); if ( renameIdentifier && @@ -3702,8 +3704,8 @@ class JavascriptParser extends Parser { * @param {FunctionExpression | ArrowFunctionExpression} fn function * @returns {boolean} true when simple function */ - const isSimpleFunction = fn => - fn.params.every(p => p.type === "Identifier"); + const isSimpleFunction = (fn) => + fn.params.every((p) => p.type === "Identifier"); if ( expression.callee.type === "MemberExpression" && expression.callee.object.type.endsWith("FunctionExpression") && @@ -3976,7 +3978,7 @@ class JavascriptParser extends Parser { hookMap, members.length === 0 ? exprName.rootInfo : exprName.name, fallback && - (name => fallback(name, exprName.rootInfo, exprName.getMembers)), + ((name) => fallback(name, exprName.rootInfo, exprName.getMembers)), defined && (() => defined(exprName.name)), ...args ); @@ -4110,7 +4112,7 @@ class JavascriptParser extends Parser { this.undefineVariable("this"); - this.enterPatterns(params, ident => { + this.enterPatterns(params, (ident) => { this.defineVariable(ident); }); @@ -4142,7 +4144,7 @@ class JavascriptParser extends Parser { this.undefineVariable("this"); } - this.enterPatterns(params, ident => { + this.enterPatterns(params, (ident) => { this.defineVariable(ident); }); @@ -4174,7 +4176,7 @@ class JavascriptParser extends Parser { this.undefineVariable("this"); } - this.enterPatterns(params, ident => { + this.enterPatterns(params, (ident) => { this.defineVariable(ident); }); @@ -4513,7 +4515,7 @@ class JavascriptParser extends Parser { ast = JavascriptParser._parse(source, { sourceType: this.sourceType, onComment: comments, - onInsertedSemicolon: pos => semicolons.add(pos) + onInsertedSemicolon: (pos) => semicolons.add(pos) }); } @@ -4596,7 +4598,7 @@ class JavascriptParser extends Parser { return false; } const items = expr.body.body; - return items.every(item => { + return items.every((item) => { if (item.type === "StaticBlock") { return false; } @@ -4649,7 +4651,7 @@ class JavascriptParser extends Parser { return true; case "VariableDeclaration": - return expr.declarations.every(decl => + return expr.declarations.every((decl) => this.isPure(decl.init, /** @type {Range} */ (decl.range)[0]) ); @@ -4673,7 +4675,7 @@ class JavascriptParser extends Parser { ); case "SequenceExpression": - return expr.expressions.every(expr => { + return expr.expressions.every((expr) => { const pureFlag = this.isPure(expr, commentsStartPos); commentsStartPos = /** @type {Range} */ (expr.range)[1]; return pureFlag; @@ -4686,13 +4688,13 @@ class JavascriptParser extends Parser { commentsStartPos, /** @type {Range} */ (expr.range)[0] ]).some( - comment => + (comment) => comment.type === "Block" && /^\s*(#|@)__PURE__\s*$/.test(comment.value) ); if (!pureFlag) return false; commentsStartPos = /** @type {Range} */ (expr.callee.range)[1]; - return expr.arguments.every(arg => { + return expr.arguments.every((arg) => { if (arg.type === "SpreadElement") return false; const pureFlag = this.isPure(arg, commentsStartPos); commentsStartPos = /** @type {Range} */ (arg.range)[1]; diff --git a/lib/javascript/JavascriptParserHelpers.js b/lib/javascript/JavascriptParserHelpers.js index 5ccd4e6fdbc..03628beabfb 100644 --- a/lib/javascript/JavascriptParserHelpers.js +++ b/lib/javascript/JavascriptParserHelpers.js @@ -21,7 +21,7 @@ module.exports.approve = () => true; * @param {boolean} value the boolean value * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function */ -module.exports.evaluateToBoolean = value => +module.exports.evaluateToBoolean = (value) => function booleanExpression(expr) { return new BasicEvaluatedExpression() .setBoolean(value) @@ -65,7 +65,7 @@ module.exports.evaluateToIdentifier = ( * @param {number} value the number value * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function */ -module.exports.evaluateToNumber = value => +module.exports.evaluateToNumber = (value) => function stringExpression(expr) { return new BasicEvaluatedExpression() .setNumber(value) @@ -76,7 +76,7 @@ module.exports.evaluateToNumber = value => * @param {string} value the string value * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function */ -module.exports.evaluateToString = value => +module.exports.evaluateToString = (value) => function stringExpression(expr) { return new BasicEvaluatedExpression() .setString(value) diff --git a/lib/javascript/StartupHelpers.js b/lib/javascript/StartupHelpers.js index b06479527b5..94f1adf299b 100644 --- a/lib/javascript/StartupHelpers.js +++ b/lib/javascript/StartupHelpers.js @@ -54,7 +54,7 @@ module.exports.generateEntryStartup = ( * @param {ModuleId} id id * @returns {string} fn to execute */ - const runModule = id => `__webpack_exec__(${JSON.stringify(id)})`; + const runModule = (id) => `__webpack_exec__(${JSON.stringify(id)})`; /** * @param {Chunks} chunks chunks * @param {ModuleIds} moduleIds module ids @@ -74,7 +74,7 @@ module.exports.generateEntryStartup = ( passive ? RuntimeGlobals.onChunksLoaded : RuntimeGlobals.startupEntrypoint - }(0, ${JSON.stringify(Array.from(chunks, c => c.id))}, ${fn});` + }(0, ${JSON.stringify(Array.from(chunks, (c) => c.id))}, ${fn});` ); if (final && passive) { runtime.push(`${EXPORT_PREFIX}${RuntimeGlobals.onChunksLoaded}();`); diff --git a/lib/json/JsonGenerator.js b/lib/json/JsonGenerator.js index a61e514c53d..b53201928f7 100644 --- a/lib/json/JsonGenerator.js +++ b/lib/json/JsonGenerator.js @@ -29,13 +29,13 @@ const RuntimeGlobals = require("../RuntimeGlobals"); * @param {JsonValue} data Raw JSON data * @returns {undefined|string} stringified data */ -const stringifySafe = data => { +const stringifySafe = (data) => { const stringified = JSON.stringify(data); if (!stringified) { return; // Invalid JSON } - return stringified.replace(/\u2028|\u2029/g, str => + return stringified.replace(/\u2028|\u2029/g, (str) => str === "\u2029" ? "\\u2029" : "\\u2028" ); // invalid in JavaScript but valid JSON }; diff --git a/lib/json/JsonModulesPlugin.js b/lib/json/JsonModulesPlugin.js index f1850a28532..df97ca7b32d 100644 --- a/lib/json/JsonModulesPlugin.js +++ b/lib/json/JsonModulesPlugin.js @@ -51,13 +51,13 @@ class JsonModulesPlugin { (compilation, { normalModuleFactory }) => { normalModuleFactory.hooks.createParser .for(JSON_MODULE_TYPE) - .tap(PLUGIN_NAME, parserOptions => { + .tap(PLUGIN_NAME, (parserOptions) => { validate(parserOptions); return new JsonParser(parserOptions); }); normalModuleFactory.hooks.createGenerator .for(JSON_MODULE_TYPE) - .tap(PLUGIN_NAME, generatorOptions => { + .tap(PLUGIN_NAME, (generatorOptions) => { validateGenerator(generatorOptions); return new JsonGenerator(generatorOptions); }); diff --git a/lib/library/AbstractLibraryPlugin.js b/lib/library/AbstractLibraryPlugin.js index ec6a3c135d3..1c0efeba961 100644 --- a/lib/library/AbstractLibraryPlugin.js +++ b/lib/library/AbstractLibraryPlugin.js @@ -58,7 +58,7 @@ class AbstractLibraryPlugin { */ apply(compiler) { const { _pluginName } = this; - compiler.hooks.thisCompilation.tap(_pluginName, compilation => { + compiler.hooks.thisCompilation.tap(_pluginName, (compilation) => { compilation.hooks.finishModules.tap( { name: _pluginName, stage: 10 }, () => { @@ -95,7 +95,7 @@ class AbstractLibraryPlugin { * @param {Chunk} chunk chunk * @returns {T | false} options for the chunk */ - const getOptionsForChunk = chunk => { + const getOptionsForChunk = (chunk) => { if (compilation.chunkGraph.getNumberOfEntryModules(chunk) === 0) { return false; } @@ -162,7 +162,7 @@ class AbstractLibraryPlugin { this.strictRuntimeBailout !== AbstractLibraryPlugin.prototype.strictRuntimeBailout ) { - hooks.strictRuntimeBailout.tap(_pluginName, renderContext => { + hooks.strictRuntimeBailout.tap(_pluginName, (renderContext) => { const options = getOptionsForChunk(renderContext.chunk); if (options === false) return; return this.strictRuntimeBailout(renderContext, { diff --git a/lib/library/AmdLibraryPlugin.js b/lib/library/AmdLibraryPlugin.js index d604c036c77..e8afbfe8cc4 100644 --- a/lib/library/AmdLibraryPlugin.js +++ b/lib/library/AmdLibraryPlugin.js @@ -85,13 +85,13 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin { const modules = chunkGraph .getChunkModules(chunk) .filter( - m => + (m) => m instanceof ExternalModule && (m.externalType === "amd" || m.externalType === "amd-require") ); const externals = /** @type {ExternalModule[]} */ (modules); const externalsDepsArray = JSON.stringify( - externals.map(m => + externals.map((m) => typeof m.request === "object" && !Array.isArray(m.request) ? m.request.amd : m.request @@ -99,7 +99,7 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin { ); const externalsArguments = externals .map( - m => + (m) => `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( `${chunkGraph.getModuleId(m)}` )}__` diff --git a/lib/library/AssignLibraryPlugin.js b/lib/library/AssignLibraryPlugin.js index 80f75fa28f4..afe85578424 100644 --- a/lib/library/AssignLibraryPlugin.js +++ b/lib/library/AssignLibraryPlugin.js @@ -35,7 +35,7 @@ const IDENTIFIER_REGEX = * @param {string} name name to be validated * @returns {boolean} true, when valid */ -const isNameValid = name => +const isNameValid = (name) => !KEYWORD_REGEX.test(name) && IDENTIFIER_REGEX.test(name); /** @@ -197,7 +197,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin { ...(Array.isArray(options.name) ? options.name : [options.name]) ] : prefix; - return fullName.map(n => + return fullName.map((n) => compilation.getPath(n, { chunk }) diff --git a/lib/library/EnableLibraryPlugin.js b/lib/library/EnableLibraryPlugin.js index 4369076e422..a21d6a5ae47 100644 --- a/lib/library/EnableLibraryPlugin.js +++ b/lib/library/EnableLibraryPlugin.js @@ -21,7 +21,7 @@ const enabledTypes = new WeakMap(); * @param {Compiler} compiler the compiler instance * @returns {Set} enabled types */ -const getEnabledTypes = compiler => { +const getEnabledTypes = (compiler) => { let set = enabledTypes.get(compiler); if (set === undefined) { set = new Set(); @@ -243,7 +243,7 @@ class EnableLibraryPlugin { apply(compiler) { compiler.hooks.thisCompilation.tap( "WarnFalseIifeUmdPlugin", - compilation => { + (compilation) => { const FalseIIFEUmdWarning = require("../FalseIIFEUmdWarning"); compilation.warnings.push(new FalseIIFEUmdWarning()); diff --git a/lib/library/ModuleLibraryPlugin.js b/lib/library/ModuleLibraryPlugin.js index e6af67615e1..6fd9faa8c58 100644 --- a/lib/library/ModuleLibraryPlugin.js +++ b/lib/library/ModuleLibraryPlugin.js @@ -8,6 +8,7 @@ const { ConcatSource } = require("webpack-sources"); const RuntimeGlobals = require("../RuntimeGlobals"); const Template = require("../Template"); +const JavascriptModulesPlugin = require("../javascript/JavascriptModulesPlugin"); const ConcatenatedModule = require("../optimize/ConcatenatedModule"); const propertyAccess = require("../util/propertyAccess"); const AbstractLibraryPlugin = require("./AbstractLibraryPlugin"); @@ -64,10 +65,14 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin { apply(compiler) { super.apply(compiler); - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const { exportsDefinitions } = ConcatenatedModule.getCompilationHooks(compilation); exportsDefinitions.tap(PLUGIN_NAME, (definitions, module) => { + const bailout = JavascriptModulesPlugin.getCompilationHooks( + compilation + ).inlineInRuntimeBailout.call(module, {}); + if (bailout) return false; // If we have connections not all modules were concatenated, so we need the wrapper const connections = compilation.moduleGraph.getIncomingConnections(module); @@ -159,7 +164,7 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin { let shouldContinue = false; - const reexport = exportInfo.findTarget(moduleGraph, _m => true); + const reexport = exportInfo.findTarget(moduleGraph, (_m) => true); if (reexport) { const exp = moduleGraph.getExportsInfo(reexport.module); diff --git a/lib/library/SystemLibraryPlugin.js b/lib/library/SystemLibraryPlugin.js index 701b870d5ea..7f06287c25b 100644 --- a/lib/library/SystemLibraryPlugin.js +++ b/lib/library/SystemLibraryPlugin.js @@ -73,7 +73,9 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin { render(source, { chunkGraph, moduleGraph, chunk }, { options, compilation }) { const modules = chunkGraph .getChunkModules(chunk) - .filter(m => m instanceof ExternalModule && m.externalType === "system"); + .filter( + (m) => m instanceof ExternalModule && m.externalType === "system" + ); const externals = /** @type {ExternalModule[]} */ (modules); // The name this bundle should be registered as with System @@ -83,7 +85,7 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin { // The array of dependencies that are external to webpack and will be provided by System const systemDependencies = JSON.stringify( - externals.map(m => + externals.map((m) => typeof m.request === "object" && !Array.isArray(m.request) ? m.request.amd : m.request @@ -95,7 +97,7 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin { // An array of the internal variable names for the webpack externals const externalWebpackNames = externals.map( - m => + (m) => `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( `${chunkGraph.getModuleId(m)}` )}__` @@ -103,7 +105,7 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin { // Declaring variables for the internal variable names for the webpack externals const externalVarDeclarations = externalWebpackNames - .map(name => `var ${name} = {};`) + .map((name) => `var ${name} = {};`) .join("\n"); // Define __esModule flag on all internal variables and helpers diff --git a/lib/library/UmdLibraryPlugin.js b/lib/library/UmdLibraryPlugin.js index d2676aae78c..2d33f0f165d 100644 --- a/lib/library/UmdLibraryPlugin.js +++ b/lib/library/UmdLibraryPlugin.js @@ -30,8 +30,8 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin"); * @param {string[]} accessor the accessor to convert to path * @returns {string} the path */ -const accessorToObjectAccess = accessor => - accessor.map(a => `[${JSON.stringify(a)}]`).join(""); +const accessorToObjectAccess = (accessor) => + accessor.map((a) => `[${JSON.stringify(a)}]`).join(""); /** * @param {string|undefined} base the path prefix @@ -131,7 +131,7 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { const modules = chunkGraph .getChunkModules(chunk) .filter( - m => + (m) => m instanceof ExternalModule && (m.externalType === "umd" || m.externalType === "umd2") ); @@ -157,7 +157,7 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { * @param {string} str the string to replace * @returns {string} the replaced keys */ - const replaceKeys = str => + const replaceKeys = (str) => compilation.getPath(str, { chunk }); @@ -166,10 +166,10 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { * @param {ExternalModule[]} modules external modules * @returns {string} result */ - const externalsDepsArray = modules => + const externalsDepsArray = (modules) => `[${replaceKeys( modules - .map(m => + .map((m) => JSON.stringify( typeof m.request === "object" ? /** @type {RequestRecord} */ @@ -184,10 +184,10 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { * @param {ExternalModule[]} modules external modules * @returns {string} result */ - const externalsRootArray = modules => + const externalsRootArray = (modules) => replaceKeys( modules - .map(m => { + .map((m) => { let request = m.request; if (typeof request === "object") { request = @@ -206,10 +206,10 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { * @param {string} type the type * @returns {string} external require array */ - const externalsRequireArray = type => + const externalsRequireArray = (type) => replaceKeys( externals - .map(m => { + .map((m) => { let expr; let request = m.request; if (typeof request === "object") { @@ -239,10 +239,10 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { * @param {ExternalModule[]} modules external modules * @returns {string} arguments */ - const externalsArguments = modules => + const externalsArguments = (modules) => modules .map( - m => + (m) => `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier( `${chunkGraph.getModuleId(m)}` )}__` @@ -253,7 +253,7 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { * @param {string| string[]} library library name * @returns {string} stringified library name */ - const libraryName = library => + const libraryName = (library) => JSON.stringify( replaceKeys( /** @type {string} */ @@ -287,7 +287,7 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { * @param {keyof LibraryCustomUmdCommentObject} type type * @returns {string} comment */ - const getAuxiliaryComment = type => { + const getAuxiliaryComment = (type) => { if (auxiliaryComment) { if (typeof auxiliaryComment === "string") { return `\t//${auxiliaryComment}\n`; diff --git a/lib/logging/createConsoleLogger.js b/lib/logging/createConsoleLogger.js index 230ec7ccb37..072ce19aed8 100644 --- a/lib/logging/createConsoleLogger.js +++ b/lib/logging/createConsoleLogger.js @@ -43,15 +43,15 @@ const { LogType } = require("./Logger"); * @param {FilterItemTypes} item an input item * @returns {FilterFunction | undefined} filter function */ -const filterToFunction = item => { +const filterToFunction = (item) => { if (typeof item === "string") { const regExp = new RegExp( `[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)` ); - return ident => regExp.test(ident); + return (ident) => regExp.test(ident); } if (item && typeof item === "object" && typeof item.test === "function") { - return ident => item.test(ident); + return (ident) => item.test(ident); } if (typeof item === "function") { return item; @@ -107,7 +107,7 @@ module.exports = ({ level = "info", debug = false, console }) => { } return []; }; - const debug = debugFilters.some(f => f(name)); + const debug = debugFilters.some((f) => f(name)); switch (type) { case LogType.debug: if (!debug) return; diff --git a/lib/logging/runtime.js b/lib/logging/runtime.js index 5fb33701577..a153064d66b 100644 --- a/lib/logging/runtime.js +++ b/lib/logging/runtime.js @@ -21,7 +21,7 @@ let currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions); * @param {createConsoleLogger.LoggerOptions} options new options, merge with old options * @returns {void} */ -module.exports.configureDefaultLogger = options => { +module.exports.configureDefaultLogger = (options) => { Object.assign(currentDefaultLoggerOptions, options); currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions); }; @@ -30,14 +30,14 @@ module.exports.configureDefaultLogger = options => { * @param {string} name name of the logger * @returns {Logger} a logger */ -module.exports.getLogger = name => +module.exports.getLogger = (name) => new Logger( (type, args) => { if (module.exports.hooks.log.call(name, type, args) === undefined) { currentDefaultLogger(name, type, args); } }, - childName => module.exports.getLogger(`${name}/${childName}`) + (childName) => module.exports.getLogger(`${name}/${childName}`) ); module.exports.hooks = { diff --git a/lib/logging/truncateArgs.js b/lib/logging/truncateArgs.js index 148ac7ae12b..800f8d85b45 100644 --- a/lib/logging/truncateArgs.js +++ b/lib/logging/truncateArgs.js @@ -9,7 +9,7 @@ * @param {Array} array array of numbers * @returns {number} sum of all numbers in array */ -const arraySum = array => { +const arraySum = (array) => { let sum = 0; for (const item of array) sum += item; return sum; @@ -21,7 +21,7 @@ const arraySum = array => { * @returns {string[]} truncated args */ const truncateArgs = (args, maxLength) => { - const lengths = args.map(a => `${a}`.length); + const lengths = args.map((a) => `${a}`.length); const availableLength = maxLength - lengths.length + 1; if (availableLength > 0 && args.length === 1) { @@ -34,7 +34,7 @@ const truncateArgs = (args, maxLength) => { } // Check if there is space for at least 4 chars per arg - if (availableLength < arraySum(lengths.map(i => Math.min(i, 6)))) { + if (availableLength < arraySum(lengths.map((i) => Math.min(i, 6)))) { // remove args if (args.length > 1) return truncateArgs(args.slice(0, -1), maxLength); return []; @@ -48,7 +48,7 @@ const truncateArgs = (args, maxLength) => { // Try to remove chars from the longest items until it fits while (currentLength > availableLength) { const maxLength = Math.max(...lengths); - const shorterItems = lengths.filter(l => l !== maxLength); + const shorterItems = lengths.filter((l) => l !== maxLength); const nextToMaxLength = shorterItems.length > 0 ? Math.max(...shorterItems) : 0; const maxReduce = maxLength - nextToMaxLength; diff --git a/lib/node/CommonJsChunkLoadingPlugin.js b/lib/node/CommonJsChunkLoadingPlugin.js index c008a7be3ab..f039772d9e0 100644 --- a/lib/node/CommonJsChunkLoadingPlugin.js +++ b/lib/node/CommonJsChunkLoadingPlugin.js @@ -42,13 +42,13 @@ class CommonJsChunkLoadingPlugin { chunkLoading: chunkLoadingValue, asyncChunkLoading: this._asyncChunkLoading }).apply(compiler); - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalChunkLoading = compilation.outputOptions.chunkLoading; /** * @param {Chunk} chunk chunk * @returns {boolean} true, if wasm loading is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const chunkLoading = options && options.chunkLoading !== undefined diff --git a/lib/node/NodeEnvironmentPlugin.js b/lib/node/NodeEnvironmentPlugin.js index c9474b90e0c..96e90debf33 100644 --- a/lib/node/NodeEnvironmentPlugin.js +++ b/lib/node/NodeEnvironmentPlugin.js @@ -57,7 +57,7 @@ class NodeEnvironmentPlugin { compiler.outputFileSystem = fs; compiler.intermediateFileSystem = fs; compiler.watchFileSystem = new NodeWatchFileSystem(inputFileSystem); - compiler.hooks.beforeRun.tap(PLUGIN_NAME, compiler => { + compiler.hooks.beforeRun.tap(PLUGIN_NAME, (compiler) => { if ( compiler.inputFileSystem === inputFileSystem && inputFileSystem.purge diff --git a/lib/node/ReadFileChunkLoadingRuntimeModule.js b/lib/node/ReadFileChunkLoadingRuntimeModule.js index 632c5eaa487..dcf763d67ff 100644 --- a/lib/node/ReadFileChunkLoadingRuntimeModule.js +++ b/lib/node/ReadFileChunkLoadingRuntimeModule.js @@ -21,6 +21,7 @@ const { getUndoPath } = require("../util/identifier"); /** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ /** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { @@ -36,15 +37,16 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { * @private * @param {Chunk} chunk chunk * @param {string} rootOutputDir root output directory + * @param {RuntimeTemplate} runtimeTemplate the runtime template * @returns {string} generated code */ - _generateBaseUri(chunk, rootOutputDir) { + _generateBaseUri(chunk, rootOutputDir, runtimeTemplate) { const options = chunk.getEntryOptions(); if (options && options.baseUri) { return `${RuntimeGlobals.baseURI} = ${JSON.stringify(options.baseUri)};`; } - return `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ + return `${RuntimeGlobals.baseURI} = require(${runtimeTemplate.renderNodePrefixForCoreModule("url")}).pathToFileURL(${ rootOutputDir ? `__dirname + ${JSON.stringify(`/${rootOutputDir}`)}` : "__filename" @@ -99,7 +101,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { return Template.asString([ withBaseURI - ? this._generateBaseUri(chunk, rootOutputDir) + ? this._generateBaseUri(chunk, rootOutputDir, runtimeTemplate) : "// no baseURI", "", "// object to store loaded chunks", @@ -108,7 +110,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" }{`, Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 0`).join( ",\n" ) ), @@ -171,17 +173,17 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { "var promise = new Promise(function(resolve, reject) {", Template.indent([ "installedChunkData = installedChunks[chunkId] = [resolve, reject];", - `var filename = require('path').join(__dirname, ${JSON.stringify( + `var filename = require(${runtimeTemplate.renderNodePrefixForCoreModule("path")}).join(__dirname, ${JSON.stringify( rootOutputDir )} + ${ RuntimeGlobals.getChunkScriptFilename }(chunkId));`, - "require('fs').readFile(filename, 'utf-8', function(err, content) {", + `require(${runtimeTemplate.renderNodePrefixForCoreModule("fs")}).readFile(filename, 'utf-8', function(err, content) {`, Template.indent([ "if(err) return reject(err);", "var chunk = {};", - "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + - "(chunk, require, require('path').dirname(filename), filename);", + `require(${runtimeTemplate.renderNodePrefixForCoreModule("vm")}).runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)` + + `(chunk, require, require(${runtimeTemplate.renderNodePrefixForCoreModule("path")}).dirname(filename), filename);`, "installChunk(chunk);" ]), "});" @@ -215,15 +217,15 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { Template.indent([ "return new Promise(function(resolve, reject) {", Template.indent([ - `var filename = require('path').join(__dirname, ${JSON.stringify( + `var filename = require(${runtimeTemplate.renderNodePrefixForCoreModule("path")}).join(__dirname, ${JSON.stringify( rootOutputDir )} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId));`, - "require('fs').readFile(filename, 'utf-8', function(err, content) {", + `require(${runtimeTemplate.renderNodePrefixForCoreModule("fs")}).readFile(filename, 'utf-8', function(err, content) {`, Template.indent([ "if(err) return reject(err);", "var update = {};", - "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + - "(update, require, require('path').dirname(filename), filename);", + `require(${runtimeTemplate.renderNodePrefixForCoreModule("vm")}).runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)` + + `(update, require, require(${runtimeTemplate.renderNodePrefixForCoreModule("path")}).dirname(filename), filename);`, "var updatedModules = update.modules;", "var runtime = update.runtime;", "for(var moduleId in updatedModules) {", @@ -255,10 +257,10 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { Template.indent([ "return new Promise(function(resolve, reject) {", Template.indent([ - `var filename = require('path').join(__dirname, ${JSON.stringify( + `var filename = require(${runtimeTemplate.renderNodePrefixForCoreModule("path")}).join(__dirname, ${JSON.stringify( rootOutputDir )} + ${RuntimeGlobals.getUpdateManifestFilename}());`, - "require('fs').readFile(filename, 'utf-8', function(err, content) {", + `require(${runtimeTemplate.renderNodePrefixForCoreModule("fs")}).readFile(filename, 'utf-8', function(err, content) {`, Template.indent([ "if(err) {", Template.indent([ diff --git a/lib/node/ReadFileCompileAsyncWasmPlugin.js b/lib/node/ReadFileCompileAsyncWasmPlugin.js index 57da42bf446..bf8f273d813 100644 --- a/lib/node/ReadFileCompileAsyncWasmPlugin.js +++ b/lib/node/ReadFileCompileAsyncWasmPlugin.js @@ -34,13 +34,13 @@ class ReadFileCompileAsyncWasmPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalWasmLoading = compilation.outputOptions.wasmLoading; /** * @param {Chunk} chunk chunk * @returns {boolean} true, if wasm loading is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const wasmLoading = options && options.wasmLoading !== undefined @@ -53,7 +53,7 @@ class ReadFileCompileAsyncWasmPlugin { * @type {(path: string) => string} callback to generate code to load the wasm file */ const generateLoadBinaryCode = this._import - ? path => + ? (path) => Template.asString([ "Promise.all([import('fs'), import('url')]).then(([{ readFile }, { URL }]) => new Promise((resolve, reject) => {", Template.indent([ @@ -70,14 +70,14 @@ class ReadFileCompileAsyncWasmPlugin { ]), "}))" ]) - : path => + : (path) => Template.asString([ "new Promise(function (resolve, reject) {", Template.indent([ "try {", Template.indent([ - "var { readFile } = require('fs');", - "var { join } = require('path');", + `var { readFile } = require(${compilation.runtimeTemplate.renderNodePrefixForCoreModule("fs")});`, + `var { join } = require(${compilation.runtimeTemplate.renderNodePrefixForCoreModule("path")});`, "", `readFile(join(__dirname, ${path}), function(err, buffer){`, Template.indent([ @@ -102,7 +102,7 @@ class ReadFileCompileAsyncWasmPlugin { if ( !chunkGraph.hasModuleInGraph( chunk, - m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC + (m) => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC ) ) { return; diff --git a/lib/node/ReadFileCompileWasmPlugin.js b/lib/node/ReadFileCompileWasmPlugin.js index 5ef4feb3f6b..bbc1f4dd7de 100644 --- a/lib/node/ReadFileCompileWasmPlugin.js +++ b/lib/node/ReadFileCompileWasmPlugin.js @@ -37,13 +37,13 @@ class ReadFileCompileWasmPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalWasmLoading = compilation.outputOptions.wasmLoading; /** * @param {Chunk} chunk chunk * @returns {boolean} true, when wasm loading is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const wasmLoading = options && options.wasmLoading !== undefined @@ -56,7 +56,7 @@ class ReadFileCompileWasmPlugin { * @type {(path: string) => string} callback to generate code to load the wasm file */ const generateLoadBinaryCode = this.options.import - ? path => + ? (path) => Template.asString([ "Promise.all([import('fs'), import('url')]).then(([{ readFile }, { URL }]) => new Promise((resolve, reject) => {", Template.indent([ @@ -73,12 +73,12 @@ class ReadFileCompileWasmPlugin { ]), "}))" ]) - : path => + : (path) => Template.asString([ "new Promise(function (resolve, reject) {", Template.indent([ - "var { readFile } = require('fs');", - "var { join } = require('path');", + `var { readFile } = require(${compilation.runtimeTemplate.renderNodePrefixForCoreModule("fs")});`, + `var { join } = require(${compilation.runtimeTemplate.renderNodePrefixForCoreModule("path")});`, "", "try {", Template.indent([ @@ -105,7 +105,7 @@ class ReadFileCompileWasmPlugin { if ( !chunkGraph.hasModuleInGraph( chunk, - m => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC + (m) => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC ) ) { return; diff --git a/lib/node/RequireChunkLoadingRuntimeModule.js b/lib/node/RequireChunkLoadingRuntimeModule.js index c54cbac6268..52fda8aebc2 100644 --- a/lib/node/RequireChunkLoadingRuntimeModule.js +++ b/lib/node/RequireChunkLoadingRuntimeModule.js @@ -21,6 +21,7 @@ const { getUndoPath } = require("../util/identifier"); /** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../Compilation")} Compilation */ +/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ /** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */ class RequireChunkLoadingRuntimeModule extends RuntimeModule { @@ -36,15 +37,16 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule { * @private * @param {Chunk} chunk chunk * @param {string} rootOutputDir root output directory + * @param {RuntimeTemplate} runtimeTemplate the runtime template * @returns {string} generated code */ - _generateBaseUri(chunk, rootOutputDir) { + _generateBaseUri(chunk, rootOutputDir, runtimeTemplate) { const options = chunk.getEntryOptions(); if (options && options.baseUri) { return `${RuntimeGlobals.baseURI} = ${JSON.stringify(options.baseUri)};`; } - return `${RuntimeGlobals.baseURI} = require("url").pathToFileURL(${ + return `${RuntimeGlobals.baseURI} = require(${runtimeTemplate.renderNodePrefixForCoreModule("url")}).pathToFileURL(${ rootOutputDir !== "./" ? `__dirname + ${JSON.stringify(`/${rootOutputDir}`)}` : "__filename" @@ -99,7 +101,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule { return Template.asString([ withBaseURI - ? this._generateBaseUri(chunk, rootOutputDir) + ? this._generateBaseUri(chunk, rootOutputDir, runtimeTemplate) : "// no baseURI", "", "// object to store loaded chunks", @@ -108,7 +110,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule { stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" }{`, Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( + Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 1`).join( ",\n" ) ), diff --git a/lib/node/nodeConsole.js b/lib/node/nodeConsole.js index 8c25c60cb62..2ba080ca46c 100644 --- a/lib/node/nodeConsole.js +++ b/lib/node/nodeConsole.js @@ -130,8 +130,8 @@ module.exports = ({ colors, appendOnly, stream }) => { currentIndent = currentIndent.slice(0, -2); } }, - profile: console.profile && (name => console.profile(name)), - profileEnd: console.profileEnd && (name => console.profileEnd(name)), + profile: console.profile && ((name) => console.profile(name)), + profileEnd: console.profileEnd && ((name) => console.profileEnd(name)), clear: /** @type {() => void} */ ( diff --git a/lib/optimize/AggressiveMergingPlugin.js b/lib/optimize/AggressiveMergingPlugin.js index a759a03e8bd..f2b7698e217 100644 --- a/lib/optimize/AggressiveMergingPlugin.js +++ b/lib/optimize/AggressiveMergingPlugin.js @@ -42,13 +42,13 @@ class AggressiveMergingPlugin { const options = this.options; const minSizeReduce = options.minSizeReduce || 1.5; - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.optimizeChunks.tap( { name: PLUGIN_NAME, stage: STAGE_ADVANCED }, - chunks => { + (chunks) => { const chunkGraph = compilation.chunkGraph; /** @type {{a: Chunk, b: Chunk, improvement: number}[]} */ const combinations = []; diff --git a/lib/optimize/AggressiveSplittingPlugin.js b/lib/optimize/AggressiveSplittingPlugin.js index 0a01b066dfc..fa99181a2ec 100644 --- a/lib/optimize/AggressiveSplittingPlugin.js +++ b/lib/optimize/AggressiveSplittingPlugin.js @@ -36,7 +36,7 @@ const validate = createSchemaValidation( * @param {Chunk} newChunk the new chunk * @returns {(module: Module) => void} function to move module between chunks */ -const moveModuleBetween = (chunkGraph, oldChunk, newChunk) => module => { +const moveModuleBetween = (chunkGraph, oldChunk, newChunk) => (module) => { chunkGraph.disconnectChunkAndModule(oldChunk, module); chunkGraph.connectChunkAndModule(newChunk, module); }; @@ -46,7 +46,7 @@ const moveModuleBetween = (chunkGraph, oldChunk, newChunk) => module => { * @param {Chunk} chunk the chunk * @returns {(module: Module) => boolean} filter for entry module */ -const isNotAEntryModule = (chunkGraph, chunk) => module => +const isNotAEntryModule = (chunkGraph, chunk) => (module) => !chunkGraph.isEntryModuleInChunk(module, chunk); /** @typedef {{ id?: NonNullable, hash?: NonNullable, modules: Module[], size: number }} SplitData */ @@ -92,7 +92,7 @@ class AggressiveSplittingPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { let needAdditionalSeal = false; /** @type {SplitData[]} */ let newSplits; @@ -110,7 +110,7 @@ class AggressiveSplittingPlugin { name: PLUGIN_NAME, stage: STAGE_ADVANCED }, - chunks => { + (chunks) => { const chunkGraph = compilation.chunkGraph; // Precompute stuff const nameToModuleMap = new Map(); @@ -145,14 +145,14 @@ class AggressiveSplittingPlugin { * @param {SplitData} splitData split data * @returns {boolean} true when applied, otherwise false */ - const applySplit = splitData => { + const applySplit = (splitData) => { // Cannot split if id is already taken if (splitData.id !== undefined && usedIds.has(splitData.id)) { return false; } // Get module objects from names - const selectedModules = splitData.modules.map(name => + const selectedModules = splitData.modules.map((name) => nameToModuleMap.get(name) ); @@ -167,7 +167,7 @@ class AggressiveSplittingPlugin { // get chunks with all modules const selectedChunks = intersect( selectedModules.map( - m => new Set(chunkGraph.getModuleChunksIterable(m)) + (m) => new Set(chunkGraph.getModuleChunksIterable(m)) ) ); @@ -253,7 +253,7 @@ class AggressiveSplittingPlugin { /** @type {SplitData} */ const splitData = { modules: selectedModules - .map(m => moduleToNameMap.get(m)) + .map((m) => moduleToNameMap.get(m)) .sort(), size: selectedModulesSize }; @@ -267,7 +267,7 @@ class AggressiveSplittingPlugin { if (changed) return true; } ); - compilation.hooks.recordHash.tap(PLUGIN_NAME, records => { + compilation.hooks.recordHash.tap(PLUGIN_NAME, (records) => { // 4. save made splittings to records const allSplits = new Set(); /** @type {Set} */ @@ -292,7 +292,7 @@ class AggressiveSplittingPlugin { records.aggressiveSplits = /** @type {SplitData[]} */ (records.aggressiveSplits).filter( - splitData => !invalidSplits.has(splitData) + (splitData) => !invalidSplits.has(splitData) ); needAdditionalSeal = true; } else { diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index 3f416761274..f1703343e2e 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -66,6 +66,7 @@ const { /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../DependencyTemplates")} DependencyTemplates */ /** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ +/** @typedef {import("../ExternalModule")} ExternalModule */ /** @typedef {import("../Module").BuildCallback} BuildCallback */ /** @typedef {import("../Module").BuildInfo} BuildInfo */ /** @typedef {import("../Module").BuildMeta} BuildMeta */ @@ -94,7 +95,6 @@ const { /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ /** @typedef {import("../util/identifier").AssociatedObjectForCache} AssociatedObjectForCache */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ - /** * @template T * @typedef {import("../InitFragment")} InitFragment @@ -159,6 +159,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) { * @property {Map | undefined} rawExportMap * @property {string=} namespaceExportSymbol * @property {string | undefined} namespaceObjectName + * @property {ConcatenationScope | undefined} concatenationScope * @property {boolean} interopNamespaceObjectUsed "default-with-named" namespace * @property {string | undefined} interopNamespaceObjectName "default-with-named" namespace * @property {boolean} interopNamespaceObject2Used "default-only" namespace @@ -241,7 +242,7 @@ const moveDeferToLast = ( * @param {Iterable} iterable iterable object * @returns {string} joined iterable object */ -const joinIterableWithComma = iterable => { +const joinIterableWithComma = (iterable) => { // This is more performant than Array.from().join(", ") // as it doesn't create an array let str = ""; @@ -503,7 +504,7 @@ const getFinalBinding = ( exportName }; } - const reexport = exportInfo.findTarget(moduleGraph, module => + const reexport = exportInfo.findTarget(moduleGraph, (module) => moduleToInfoMap.has(module) ); if (reexport === false) { @@ -668,6 +669,7 @@ const getFinalName = ( /** * @typedef {object} ConcatenateModuleHooks * @property {SyncBailHook<[Record, ConcatenatedModule], boolean | void>} exportsDefinitions + * @property {SyncBailHook<[Partial, ConcatenatedModuleInfo], boolean | void>} concatenatedModuleInfo */ /** @type {WeakMap} */ @@ -714,7 +716,11 @@ class ConcatenatedModule extends Module { let hooks = compilationHooksMap.get(compilation); if (hooks === undefined) { hooks = { - exportsDefinitions: new SyncBailHook(["definitions", "module"]) + exportsDefinitions: new SyncBailHook(["definitions", "module"]), + concatenatedModuleInfo: new SyncBailHook([ + "updatedInfo", + "concatenatedModuleInfo" + ]) }; compilationHooksMap.set(compilation, hooks); } @@ -848,7 +854,7 @@ class ConcatenatedModule extends Module { // populate dependencies for (const d of m.dependencies.filter( - dep => + (dep) => !(dep instanceof HarmonyImportDependency) || !this._modules.has( /** @type {Module} */ @@ -945,13 +951,14 @@ class ConcatenatedModule extends Module { /** @type {Map} */ const existingEntries = new Map(); const deferEnabled = - this.compilation && this.compilation.options.experiments.deferImport; + /** @type {Compilation} */ + (this.compilation).options.experiments.deferImport; /** * @param {Module} module a module * @returns {Iterable<{ connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} imported modules in order */ - const getConcatenatedImports = module => { + const getConcatenatedImports = (module) => { const connections = [...moduleGraph.getOutgoingConnections(module)]; if (module === rootModule) { for (const c of moduleGraph.getOutgoingConnections(this)) { @@ -962,7 +969,7 @@ class ConcatenatedModule extends Module { * @type {Array<{ connection: ModuleGraphConnection, sourceOrder: number, rangeStart: number, defer?: boolean }>} */ const references = connections - .filter(connection => { + .filter((connection) => { if (!(connection.dependency instanceof HarmonyImportDependency)) { return false; } @@ -973,7 +980,7 @@ class ConcatenatedModule extends Module { connection.isTargetActive(runtime) ); }) - .map(connection => { + .map((connection) => { const dep = /** @type {HarmonyImportDependency} */ ( connection.dependency ); @@ -1009,7 +1016,7 @@ class ConcatenatedModule extends Module { /** @type {Map} */ const referencesMap = new Map(); for (const { connection } of references) { - const runtimeCondition = filterRuntime(runtime, r => + const runtimeCondition = filterRuntime(runtime, (r) => connection.isTargetActive(r) ); if (runtimeCondition === false) continue; @@ -1180,6 +1187,10 @@ class ConcatenatedModule extends Module { runtime: generationRuntime, codeGenerationResults }) { + const { concatenatedModuleInfo } = ConcatenatedModule.getCompilationHooks( + /** @type {Compilation} */ (this.compilation) + ); + /** @type {RuntimeRequirements} */ const runtimeRequirements = new Set(); const runtime = intersectRuntime(generationRuntime, this._runtime); @@ -1195,6 +1206,9 @@ class ConcatenatedModule extends Module { /** @type {Set} */ const neededNamespaceObjects = new Set(); + // List of all used names to avoid conflicts + const allUsedNames = new Set(RESERVED_NAMES); + // Generate source code and analyse scopes // Prepare a ReplaceSource for the final source for (const info of moduleToInfoMap.values()) { @@ -1207,12 +1221,11 @@ class ConcatenatedModule extends Module { chunkGraph, runtime, /** @type {CodeGenerationResults} */ - (codeGenerationResults) + (codeGenerationResults), + allUsedNames ); } - // List of all used names to avoid conflicts - const allUsedNames = new Set(RESERVED_NAMES); // Updated Top level declarations are created by renaming /** @type {Set} */ const topLevelDeclarations = new Set(); @@ -1240,7 +1253,7 @@ class ConcatenatedModule extends Module { * @param {Scope} scope scope * @returns {{ range: Range, variables: Variable[] }[]} result */ - const getSuperClassExpressions = scope => { + const getSuperClassExpressions = (scope) => { const cacheEntry = superClassCache.get(scope); if (cacheEntry !== undefined) return cacheEntry; const superClassExpressions = []; @@ -1321,6 +1334,75 @@ class ConcatenatedModule extends Module { } } + /** + * @param {string} name the name to find a new name for + * @param {ConcatenatedModuleInfo} info the info of the module + * @param {Reference[]} references the references to the name + * @returns {string|undefined} the new name or undefined if the name is not found + */ + const _findNewName = (name, info, references) => { + const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo( + usedNamesInScopeInfo, + info.module.identifier(), + name + ); + if (allUsedNames.has(name) || usedNames.has(name)) { + for (const ref of references) { + addScopeSymbols( + ref.from, + usedNames, + alreadyCheckedScopes, + ignoredScopes + ); + } + const newName = findNewName( + name, + allUsedNames, + usedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(newName); + info.internalNames.set(name, newName); + topLevelDeclarations.add(newName); + return newName; + } + }; + + /** + * @param {string} name the name to find a new name for + * @param {ConcatenatedModuleInfo} info the info of the module + * @param {Reference[]} references the references to the name + * @returns {string|undefined} the new name or undefined if the name is not found + */ + const _findNewNameForSpecifier = (name, info, references) => { + const { usedNames: moduleUsedNames, alreadyCheckedScopes } = + getUsedNamesInScopeInfo( + usedNamesInScopeInfo, + info.module.identifier(), + name + ); + const referencesUsedNames = new Set(); + for (const ref of references) { + addScopeSymbols( + ref.from, + referencesUsedNames, + alreadyCheckedScopes, + ignoredScopes + ); + } + if (moduleUsedNames.has(name) || referencesUsedNames.has(name)) { + const newName = findNewName( + name, + allUsedNames, + new Set([...moduleUsedNames, ...referencesUsedNames]), + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(newName); + topLevelDeclarations.add(newName); + return newName; + } + }; + // generate names for symbols for (const info of moduleToInfoMap.values()) { const { usedNames: namespaceObjectUsedNames } = getUsedNamesInScopeInfo( @@ -1333,33 +1415,12 @@ class ConcatenatedModule extends Module { const variables = /** @type {Scope} */ (info.moduleScope).variables; for (const variable of variables) { const name = variable.name; - const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo( - usedNamesInScopeInfo, - info.module.identifier(), - name - ); - if (allUsedNames.has(name) || usedNames.has(name)) { - const references = getAllReferences(variable); - for (const ref of references) { - addScopeSymbols( - ref.from, - usedNames, - alreadyCheckedScopes, - ignoredScopes - ); - } - const newName = findNewName( - name, - allUsedNames, - usedNames, - info.module.readableIdentifier(requestShortener) - ); - allUsedNames.add(newName); - info.internalNames.set(name, newName); - topLevelDeclarations.add(newName); + const references = getAllReferences(variable); + const newName = _findNewName(name, info, references); + if (newName) { const source = /** @type {ReplaceSource} */ (info.source); const allIdentifiers = new Set([ - ...references.map(r => r.identifier), + ...references.map((r) => r.identifier), ...variable.identifiers ]); for (const identifier of allIdentifiers) { @@ -1493,14 +1554,48 @@ class ConcatenatedModule extends Module { for (const info of moduleToInfoMap.values()) { if (info.type === "concatenated") { const globalScope = /** @type {Scope} */ (info.globalScope); + // group references by name + const referencesByName = new Map(); for (const reference of globalScope.through) { const name = reference.identifier.name; + if (!referencesByName.has(name)) { + referencesByName.set(name, []); + } + referencesByName.get(name).push(reference); + } + for (const [name, references] of referencesByName) { const match = ConcatenationScope.matchModuleReference(name); if (match) { const referencedInfo = modulesWithInfo[match.index]; if (referencedInfo.type === "reference") { throw new Error("Module reference can't point to a reference"); } + const concatenationScope = /** @type {ConcatenatedModuleInfo} */ ( + referencedInfo + ).concatenationScope; + const exportId = match.ids[0]; + const specifier = + concatenationScope && concatenationScope.getRawExport(exportId); + if (specifier) { + const newName = _findNewNameForSpecifier( + specifier, + info, + references + ); + const initFragmentChanged = + newName && + concatenatedModuleInfo.call( + { + rawExportMap: new Map([ + [exportId, /** @type {string} */ (newName)] + ]) + }, + /** @type {ConcatenatedModuleInfo} */ (referencedInfo) + ); + if (initFragmentChanged) { + concatenationScope.setRawExportMap(exportId, newName); + } + } const finalName = getFinalName( moduleGraph, referencedInfo, @@ -1517,10 +1612,13 @@ class ConcatenatedModule extends Module { (info.module.buildMeta).strictHarmonyModule, match.asiSafe ); - const r = /** @type {Range} */ (reference.identifier.range); - const source = /** @type {ReplaceSource} */ (info.source); - // range is extended by 2 chars to cover the appended "._" - source.replace(r[0], r[1] + 1, finalName); + + for (const reference of references) { + const r = /** @type {Range} */ (reference.identifier.range); + const source = /** @type {ReplaceSource} */ (info.source); + // range is extended by 2 chars to cover the appended "._" + source.replace(r[0], r[1] + 1, finalName); + } } } } @@ -1551,7 +1649,7 @@ class ConcatenatedModule extends Module { unusedExports.add(name); continue; } - exportsMap.set(used, requestShortener => { + exportsMap.set(used, (requestShortener) => { try { const finalName = getFinalName( moduleGraph, @@ -1712,7 +1810,8 @@ ${defineGetters}` /** @type {InitFragment[]} */ const chunkInitFragments = []; const deferEnabled = - this.compilation && this.compilation.options.experiments.deferImport; + /** @type {Compilation} */ + (this.compilation).options.experiments.deferImport; // evaluate modules in order for (const rawInfo of modulesWithInfo) { @@ -1738,7 +1837,8 @@ ${defineGetters}` if (moduleGraph.isDeferred(referredModule)) { const deferredModuleInfo = /** @type {ExternalModuleInfo} */ ( modulesWithInfo.find( - i => i.type === "external" && i.module === referredModule + (i) => + i.type === "external" && i.module === referredModule ) ); if (!deferredModuleInfo) continue; @@ -1787,18 +1887,19 @@ ${defineGetters}` runtimeTemplate, info.module.getExportsType( moduleGraph, - this.rootModule.buildMeta && - this.rootModule.buildMeta.strictHarmonyModule + /** @type {BuildMeta} */ + (this.rootModule.buildMeta).strictHarmonyModule ), moduleId, // an async module will opt-out of the concat module optimization. [] ); result.add(`var ${info.deferredName} = ${loader};`); + name = info.deferredName; } else { result.add(`var ${info.name} = __webpack_require__(${moduleId});`); + name = info.name; } - name = info.name; break; } default: @@ -1865,6 +1966,7 @@ ${defineGetters}` * @param {ChunkGraph} chunkGraph chunkGraph * @param {RuntimeSpec} runtime runtime * @param {CodeGenerationResults} codeGenerationResults codeGenerationResults + * @param {Set} usedNames used names */ _analyseModule( modulesMap, @@ -1874,13 +1976,18 @@ ${defineGetters}` moduleGraph, chunkGraph, runtime, - codeGenerationResults + codeGenerationResults, + usedNames ) { if (info.type === "concatenated") { const m = info.module; try { // Create a concatenation scope to track and capture information - const concatenationScope = new ConcatenationScope(modulesMap, info); + const concatenationScope = new ConcatenationScope( + modulesMap, + info, + usedNames + ); // TODO cache codeGeneration results const codeGenResult = m.codeGeneration({ @@ -1940,6 +2047,7 @@ ${defineGetters}` info.chunkInitFragments = chunkInitFragments; info.globalScope = globalScope; info.moduleScope = moduleScope; + info.concatenationScope = concatenationScope; } catch (err) { /** @type {Error} */ (err).message += @@ -1988,7 +2096,8 @@ ${defineGetters}` interopNamespaceObject2Used: false, interopNamespaceObject2Name: undefined, interopDefaultAccessUsed: false, - interopDefaultAccessName: undefined + interopDefaultAccessName: undefined, + concatenationScope: undefined }; break; case "external": diff --git a/lib/optimize/EnsureChunkConditionsPlugin.js b/lib/optimize/EnsureChunkConditionsPlugin.js index ab740727b5a..d6210f18798 100644 --- a/lib/optimize/EnsureChunkConditionsPlugin.js +++ b/lib/optimize/EnsureChunkConditionsPlugin.js @@ -20,11 +20,11 @@ class EnsureChunkConditionsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { /** * @param {Iterable} chunks the chunks */ - const handler = chunks => { + const handler = (chunks) => { const chunkGraph = compilation.chunkGraph; // These sets are hoisted here to save memory // They are cleared at the end of every loop diff --git a/lib/optimize/FlagIncludedChunksPlugin.js b/lib/optimize/FlagIncludedChunksPlugin.js index 96a3ed2df0d..78e74d47fea 100644 --- a/lib/optimize/FlagIncludedChunksPlugin.js +++ b/lib/optimize/FlagIncludedChunksPlugin.js @@ -21,8 +21,8 @@ class FlagIncludedChunksPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { - compilation.hooks.optimizeChunkIds.tap(PLUGIN_NAME, chunks => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { + compilation.hooks.optimizeChunkIds.tap(PLUGIN_NAME, (chunks) => { const chunkGraph = compilation.chunkGraph; // prepare two bit integers for each module diff --git a/lib/optimize/InnerGraph.js b/lib/optimize/InnerGraph.js index a4dbfddede0..78350f746ad 100644 --- a/lib/optimize/InnerGraph.js +++ b/lib/optimize/InnerGraph.js @@ -95,7 +95,7 @@ module.exports.addVariableUsage = (parser, name, usage) => { * @param {ParserState} parserState parser state * @returns {void} */ -module.exports.bailout = parserState => { +module.exports.bailout = (parserState) => { parserStateMap.set(parserState, false); }; @@ -103,7 +103,7 @@ module.exports.bailout = parserState => { * @param {ParserState} parserState parser state * @returns {void} */ -module.exports.enable = parserState => { +module.exports.enable = (parserState) => { const state = parserStateMap.get(parserState); if (state === false) { return; @@ -148,7 +148,7 @@ module.exports.getDependencyUsedByExportsCondition = ( * @param {ParserState} state parser state * @returns {TopLevelSymbol|void} usage data */ -module.exports.getTopLevelSymbol = state => { +module.exports.getTopLevelSymbol = (state) => { const innerGraphState = getState(state); if (innerGraphState) { @@ -160,7 +160,7 @@ module.exports.getTopLevelSymbol = state => { * @param {ParserState} state parser state * @returns {void} */ -module.exports.inferDependencyUsage = state => { +module.exports.inferDependencyUsage = (state) => { const innerGraphState = getState(state); if (!innerGraphState) { @@ -286,7 +286,7 @@ module.exports.isDependencyUsedByExports = ( * @param {ParserState} parserState parser state * @returns {boolean} true, when enabled */ -module.exports.isEnabled = parserState => { +module.exports.isEnabled = (parserState) => { const state = parserStateMap.get(parserState); return Boolean(state); }; diff --git a/lib/optimize/InnerGraphPlugin.js b/lib/optimize/InnerGraphPlugin.js index 0b70503d9b6..aee400627c0 100644 --- a/lib/optimize/InnerGraphPlugin.js +++ b/lib/optimize/InnerGraphPlugin.js @@ -59,8 +59,8 @@ class InnerGraphPlugin { /** * @param {Expression} sup sup */ - const onUsageSuper = sup => { - InnerGraph.onUsage(parser.state, usedByExports => { + const onUsageSuper = (sup) => { + InnerGraph.onUsage(parser.state, (usedByExports) => { switch (usedByExports) { case undefined: case true: @@ -115,7 +115,7 @@ class InnerGraphPlugin { // The following hooks are used during prewalking: - parser.hooks.preStatement.tap(PLUGIN_NAME, statement => { + parser.hooks.preStatement.tap(PLUGIN_NAME, (statement) => { if (!InnerGraph.isEnabled(parser.state)) return; if ( @@ -131,7 +131,7 @@ class InnerGraphPlugin { } }); - parser.hooks.blockPreStatement.tap(PLUGIN_NAME, statement => { + parser.hooks.blockPreStatement.tap(PLUGIN_NAME, (statement) => { if (!InnerGraph.isEnabled(parser.state)) return; if (parser.scope.topLevelScope === true) { @@ -250,7 +250,7 @@ class InnerGraphPlugin { // The following hooks are called during walking: - parser.hooks.statement.tap(PLUGIN_NAME, statement => { + parser.hooks.statement.tap(PLUGIN_NAME, (statement) => { if (!InnerGraph.isEnabled(parser.state)) return; if (parser.scope.topLevelScope === true) { InnerGraph.setTopLevelSymbol(parser.state, undefined); @@ -260,7 +260,7 @@ class InnerGraphPlugin { InnerGraph.setTopLevelSymbol(parser.state, fn); const purePart = statementPurePart.get(statement); if (purePart) { - InnerGraph.onUsage(parser.state, usedByExports => { + InnerGraph.onUsage(parser.state, (usedByExports) => { switch (usedByExports) { case undefined: case true: @@ -336,7 +336,7 @@ class InnerGraphPlugin { ) { InnerGraph.setTopLevelSymbol(parser.state, fn); if (element.type !== "MethodDefinition" && element.static) { - InnerGraph.onUsage(parser.state, usedByExports => { + InnerGraph.onUsage(parser.state, (usedByExports) => { switch (usedByExports) { case undefined: case true: @@ -378,7 +378,7 @@ class InnerGraphPlugin { onUsageSuper(decl.init.superClass); } } else { - InnerGraph.onUsage(parser.state, usedByExports => { + InnerGraph.onUsage(parser.state, (usedByExports) => { switch (usedByExports) { case undefined: case true: @@ -433,10 +433,12 @@ class InnerGraphPlugin { currentTopLevelSymbol || true ); }); - parser.hooks.assign.for(topLevelSymbolTag).tap(PLUGIN_NAME, expr => { - if (!InnerGraph.isEnabled(parser.state)) return; - if (expr.operator === "=") return true; - }); + parser.hooks.assign + .for(topLevelSymbolTag) + .tap(PLUGIN_NAME, (expr) => { + if (!InnerGraph.isEnabled(parser.state)) return; + if (expr.operator === "=") return true; + }); }; normalModuleFactory.hooks.parser .for(JAVASCRIPT_MODULE_TYPE_AUTO) diff --git a/lib/optimize/LimitChunkCountPlugin.js b/lib/optimize/LimitChunkCountPlugin.js index 74e1285f7f6..74ed24815e9 100644 --- a/lib/optimize/LimitChunkCountPlugin.js +++ b/lib/optimize/LimitChunkCountPlugin.js @@ -68,13 +68,13 @@ class LimitChunkCountPlugin { */ apply(compiler) { const options = this.options; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.optimizeChunks.tap( { name: PLUGIN_NAME, stage: STAGE_ADVANCED }, - chunks => { + (chunks) => { const chunkGraph = compilation.chunkGraph; const maxChunks = options.maxChunks; if (!maxChunks) return; @@ -95,7 +95,7 @@ class LimitChunkCountPlugin { /** @type {LazyBucketSortedSet} */ const combinations = new LazyBucketSortedSet( // Layer 1: ordered by largest size benefit - c => c.sizeDiff, + (c) => c.sizeDiff, (a, b) => b - a, // Layer 2: ordered by smallest combined size @@ -103,7 +103,7 @@ class LimitChunkCountPlugin { * @param {ChunkCombination} c combination * @returns {number} integrated size */ - c => c.integratedSize, + (c) => c.integratedSize, /** * @param {number} a a * @param {number} b b @@ -116,7 +116,7 @@ class LimitChunkCountPlugin { * @param {ChunkCombination} c combination * @returns {number} position difference */ - c => c.bIdx - c.aIdx, + (c) => c.bIdx - c.aIdx, /** * @param {number} a a * @param {number} b b diff --git a/lib/optimize/MangleExportsPlugin.js b/lib/optimize/MangleExportsPlugin.js index f99424ae4fd..39383da8f75 100644 --- a/lib/optimize/MangleExportsPlugin.js +++ b/lib/optimize/MangleExportsPlugin.js @@ -22,7 +22,7 @@ const { compareSelect, compareStringsNumeric } = require("../util/comparators"); * @param {ExportsInfo} exportsInfo exports info * @returns {boolean} mangle is possible */ -const canMangle = exportsInfo => { +const canMangle = (exportsInfo) => { if (exportsInfo.otherExportsInfo.getUsed(undefined) !== UsageState.Unused) { return false; } @@ -36,7 +36,7 @@ const canMangle = exportsInfo => { }; // Sort by name -const comparator = compareSelect(e => e.name, compareStringsNumeric); +const comparator = compareSelect((e) => e.name, compareStringsNumeric); /** * @param {boolean} deterministic use deterministic names * @param {ExportsInfo} exportsInfo exports info @@ -100,7 +100,7 @@ const mangleExportsInfo = (deterministic, exportsInfo, isNamespace) => { if (deterministic) { assignDeterministicIds( mangleableExports, - e => e.name, + (e) => e.name, comparator, (e, id) => { const name = numberToIdentifier(id); @@ -160,9 +160,9 @@ class MangleExportsPlugin { */ apply(compiler) { const { _deterministic: deterministic } = this; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const moduleGraph = compilation.moduleGraph; - compilation.hooks.optimizeCodeGeneration.tap(PLUGIN_NAME, modules => { + compilation.hooks.optimizeCodeGeneration.tap(PLUGIN_NAME, (modules) => { if (compilation.moduleMemCaches) { throw new Error( "optimization.mangleExports can't be used with cacheUnaffected as export mangling is a global effect" diff --git a/lib/optimize/MergeDuplicateChunksPlugin.js b/lib/optimize/MergeDuplicateChunksPlugin.js index b37fbd891e7..f0adc666cc4 100644 --- a/lib/optimize/MergeDuplicateChunksPlugin.js +++ b/lib/optimize/MergeDuplicateChunksPlugin.js @@ -38,13 +38,13 @@ class MergeDuplicateChunksPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.optimizeChunks.tap( { name: PLUGIN_NAME, stage: this.options.stage }, - chunks => { + (chunks) => { const { chunkGraph, moduleGraph } = compilation; // remember already tested chunks for performance diff --git a/lib/optimize/MinChunkSizePlugin.js b/lib/optimize/MinChunkSizePlugin.js index 6d5024b5e35..d00f7a6c915 100644 --- a/lib/optimize/MinChunkSizePlugin.js +++ b/lib/optimize/MinChunkSizePlugin.js @@ -40,13 +40,13 @@ class MinChunkSizePlugin { apply(compiler) { const options = this.options; const minChunkSize = options.minChunkSize; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.optimizeChunks.tap( { name: PLUGIN_NAME, stage: STAGE_ADVANCED }, - chunks => { + (chunks) => { const chunkGraph = compilation.chunkGraph; const equalOptions = { chunkOverhead: 1, @@ -81,7 +81,7 @@ class MinChunkSizePlugin { } const sortedSizeFilteredExtendedPairCombinations = combinations - .map(pair => { + .map((pair) => { // extend combination pairs with size and integrated size const a = chunkSizesMap.get(pair[0]); const b = chunkSizesMap.get(pair[1]); diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index 383bbcbc410..8d9618df01b 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -46,7 +46,7 @@ const ConcatenatedModule = require("./ConcatenatedModule"); * @param {string} msg message * @returns {string} formatted message */ -const formatBailoutReason = msg => `ModuleConcatenation bailout: ${msg}`; +const formatBailoutReason = (msg) => `ModuleConcatenation bailout: ${msg}`; const PLUGIN_NAME = "ModuleConcatenationPlugin"; @@ -58,7 +58,7 @@ class ModuleConcatenationPlugin { */ apply(compiler) { const { _backCompat: backCompat } = compiler; - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { if (compilation.moduleMemCaches) { throw new Error( "optimization.concatenateModules can't be used with cacheUnaffected as module concatenation is a global effect" @@ -78,7 +78,7 @@ class ModuleConcatenationPlugin { .getOptimizationBailout(module) .push( typeof reason === "function" - ? rs => formatBailoutReason(reason(rs)) + ? (rs) => formatBailoutReason(reason(rs)) : formatBailoutReason(reason) ); }; @@ -107,7 +107,7 @@ class ModuleConcatenationPlugin { * @param {Module | ((requestShortener: RequestShortener) => string)} problem the problem * @returns {(requestShortener: RequestShortener) => string} the reason */ - const formatBailoutWarning = (module, problem) => requestShortener => { + const formatBailoutWarning = (module, problem) => (requestShortener) => { if (typeof problem === "function") { return formatBailoutReason( `Cannot concat with ${module.readableIdentifier( @@ -149,6 +149,7 @@ class ModuleConcatenationPlugin { chunkGraph, moduleGraph }; + const deferEnabled = compilation.options.experiments.deferImport; logger.time("select relevant modules"); for (const module of modules) { let canBeRoot = true; @@ -182,7 +183,7 @@ class ModuleConcatenationPlugin { const exportsInfo = moduleGraph.getExportsInfo(module); const relevantExports = exportsInfo.getRelevantExports(undefined); const unknownReexports = relevantExports.filter( - exportInfo => + (exportInfo) => exportInfo.isReexport() && !exportInfo.getTarget(moduleGraph) ); if (unknownReexports.length > 0) { @@ -190,7 +191,7 @@ class ModuleConcatenationPlugin { module, `Reexports in this module do not have a static target (${Array.from( unknownReexports, - exportInfo => + (exportInfo) => `${ exportInfo.name || "other exports" }: ${exportInfo.getUsedInfo()}` @@ -201,14 +202,14 @@ class ModuleConcatenationPlugin { // Root modules must have a static list of exports const unknownProvidedExports = relevantExports.filter( - exportInfo => exportInfo.provided !== true + (exportInfo) => exportInfo.provided !== true ); if (unknownProvidedExports.length > 0) { setBailoutReason( module, `List of module exports is dynamic (${Array.from( unknownProvidedExports, - exportInfo => + (exportInfo) => `${ exportInfo.name || "other exports" }: ${exportInfo.getProvidedInfo()} and ${exportInfo.getUsedInfo()}` @@ -223,7 +224,7 @@ class ModuleConcatenationPlugin { canBeInner = false; } - if (moduleGraph.isDeferred(module)) { + if (deferEnabled && moduleGraph.isDeferred(module)) { setInnerBailoutReason(module, "Module is deferred"); canBeInner = false; } @@ -277,7 +278,7 @@ class ModuleConcatenationPlugin { chunkRuntime = mergeRuntimeOwned(chunkRuntime, r); } const exportsInfo = moduleGraph.getExportsInfo(currentRoot); - const filteredRuntime = filterRuntime(chunkRuntime, r => + const filteredRuntime = filterRuntime(chunkRuntime, (r) => exportsInfo.isModuleUsed(r) ); const activeRuntime = @@ -407,7 +408,7 @@ class ModuleConcatenationPlugin { (null), /** @type {EXPECTED_ANY} */ (null), - err => { + (err) => { if (err) { if (!err.module) { err.module = newModule; @@ -441,7 +442,7 @@ class ModuleConcatenationPlugin { moduleGraph.copyOutgoingModuleConnections( m, newModule, - c => + (c) => c.originModule === m && !( c.dependency instanceof HarmonyImportDependency && @@ -477,14 +478,18 @@ class ModuleConcatenationPlugin { // remove module from chunk chunkGraph.replaceModule(rootModule, newModule); // replace module references with the concatenated module - moduleGraph.moveModuleConnections(rootModule, newModule, c => { - const otherModule = - c.module === rootModule ? c.originModule : c.module; - const innerConnection = - c.dependency instanceof HarmonyImportDependency && - modules.has(/** @type {Module} */ (otherModule)); - return !innerConnection; - }); + moduleGraph.moveModuleConnections( + rootModule, + newModule, + (c) => { + const otherModule = + c.module === rootModule ? c.originModule : c.module; + const innerConnection = + c.dependency instanceof HarmonyImportDependency && + modules.has(/** @type {Module} */ (otherModule)); + return !innerConnection; + } + ); // add concatenated module to the compilation compilation.modules.add(newModule); @@ -493,7 +498,7 @@ class ModuleConcatenationPlugin { build(); }, - err => { + (err) => { logger.timeEnd("create concatenated modules"); process.nextTick(callback.bind(null, err)); } @@ -532,7 +537,7 @@ class ModuleConcatenationPlugin { ); if ( - importedNames.every(i => + importedNames.every((i) => Array.isArray(i) ? i.length > 0 : i.name.length > 0 ) || Array.isArray(moduleGraph.getProvidedExports(module)) @@ -592,22 +597,22 @@ class ModuleConcatenationPlugin { // Module must be in the correct chunks const missingChunks = [ ...chunkGraph.getModuleChunksIterable(config.rootModule) - ].filter(chunk => !chunkGraph.isModuleInChunk(module, chunk)); + ].filter((chunk) => !chunkGraph.isModuleInChunk(module, chunk)); if (missingChunks.length > 0) { /** * @param {RequestShortener} requestShortener request shortener * @returns {string} problem description */ - const problem = requestShortener => { + const problem = (requestShortener) => { const missingChunksList = [ ...new Set( - missingChunks.map(chunk => chunk.name || "unnamed chunk(s)") + missingChunks.map((chunk) => chunk.name || "unnamed chunk(s)") ) ].sort(); const chunks = [ ...new Set( [...chunkGraph.getModuleChunksIterable(module)].map( - chunk => chunk.name || "unnamed chunk(s)" + (chunk) => chunk.name || "unnamed chunk(s)" ) ) ].sort(); @@ -631,7 +636,7 @@ class ModuleConcatenationPlugin { incomingConnections.get(null) || incomingConnections.get(undefined); if (incomingConnectionsFromNonModules) { const activeNonModulesConnections = - incomingConnectionsFromNonModules.filter(connection => + incomingConnectionsFromNonModules.filter((connection) => // We are not interested in inactive connections // or connections without dependency connection.isActive(runtime) @@ -641,9 +646,11 @@ class ModuleConcatenationPlugin { * @param {RequestShortener} requestShortener request shortener * @returns {string} problem description */ - const problem = requestShortener => { + const problem = (requestShortener) => { const importingExplanations = new Set( - activeNonModulesConnections.map(c => c.explanation).filter(Boolean) + activeNonModulesConnections + .map((c) => c.explanation) + .filter(Boolean) ); const explanations = [...importingExplanations].sort(); return `Module ${module.readableIdentifier( @@ -676,7 +683,7 @@ class ModuleConcatenationPlugin { if (!intersectRuntime(runtime, originRuntime)) continue; // We are not interested in inactive connections - const activeConnections = connections.filter(connection => + const activeConnections = connections.filter((connection) => connection.isActive(runtime) ); if (activeConnections.length > 0) { @@ -688,7 +695,7 @@ class ModuleConcatenationPlugin { const incomingModules = [...incomingConnectionsFromModules.keys()]; // Module must be in the same chunks like the referencing module - const otherChunkModules = incomingModules.filter(originModule => { + const otherChunkModules = incomingModules.filter((originModule) => { for (const chunk of chunkGraph.getModuleChunksIterable( config.rootModule )) { @@ -703,9 +710,9 @@ class ModuleConcatenationPlugin { * @param {RequestShortener} requestShortener request shortener * @returns {string} problem description */ - const problem = requestShortener => { + const problem = (requestShortener) => { const names = otherChunkModules - .map(m => m.readableIdentifier(requestShortener)) + .map((m) => m.readableIdentifier(requestShortener)) .sort(); return `Module ${module.readableIdentifier( requestShortener @@ -722,7 +729,7 @@ class ModuleConcatenationPlugin { const nonHarmonyConnections = new Map(); for (const [originModule, connections] of incomingConnectionsFromModules) { const selected = connections.filter( - connection => + (connection) => !connection.dependency || !(connection.dependency instanceof HarmonyImportDependency) ); @@ -735,7 +742,7 @@ class ModuleConcatenationPlugin { * @param {RequestShortener} requestShortener request shortener * @returns {string} problem description */ - const problem = requestShortener => { + const problem = (requestShortener) => { const names = [...nonHarmonyConnections] .map( ([originModule, connections]) => @@ -744,7 +751,7 @@ class ModuleConcatenationPlugin { )} (referenced with ${[ ...new Set( connections - .map(c => c.dependency && c.dependency.type) + .map((c) => c.dependency && c.dependency.type) .filter(Boolean) ) ] @@ -774,7 +781,7 @@ class ModuleConcatenationPlugin { /** @type {false | RuntimeSpec} */ let currentRuntimeCondition = false; for (const connection of connections) { - const runtimeCondition = filterRuntime(runtime, runtime => + const runtimeCondition = filterRuntime(runtime, (runtime) => connection.isTargetActive(runtime) ); if (runtimeCondition === false) continue; @@ -796,7 +803,7 @@ class ModuleConcatenationPlugin { * @param {RequestShortener} requestShortener request shortener * @returns {string} problem description */ - const problem = requestShortener => + const problem = (requestShortener) => `Module ${module.readableIdentifier( requestShortener )} is runtime-dependent referenced by these modules: ${Array.from( diff --git a/lib/optimize/RealContentHashPlugin.js b/lib/optimize/RealContentHashPlugin.js index 1a69674e13c..8f03316eece 100644 --- a/lib/optimize/RealContentHashPlugin.js +++ b/lib/optimize/RealContentHashPlugin.js @@ -61,7 +61,7 @@ const mapAndDeduplicateBuffers = (input, fn) => { * @param {string} str String to quote * @returns {string} Escaped string */ -const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); const cachedSourceMap = new WeakMap(); @@ -69,7 +69,7 @@ const cachedSourceMap = new WeakMap(); * @param {Source} source source * @returns {CachedSource} cached source */ -const toCachedSource = source => { +const toCachedSource = (source) => { if (source instanceof CachedSource) { return source; } @@ -150,7 +150,7 @@ class RealContentHashPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { const cacheAnalyse = compilation.getCache( "RealContentHashPlugin|analyse" ); @@ -205,7 +205,7 @@ class RealContentHashPlugin { "g" ); await Promise.all( - assetsWithInfo.map(async asset => { + assetsWithInfo.map(async (asset) => { const { name, source, content, hashes } = asset; if (Buffer.isBuffer(content)) { asset.referencedHashes = EMPTY_SET; @@ -238,10 +238,10 @@ class RealContentHashPlugin { * @param {string} hash the hash * @returns {undefined | ReferencedHashes} the referenced hashes */ - const getDependencies = hash => { + const getDependencies = (hash) => { const assets = hashToAssets.get(hash); if (!assets) { - const referencingAssets = assetsWithInfo.filter(asset => + const referencingAssets = assetsWithInfo.filter((asset) => /** @type {ReferencedHashes} */ (asset.referencedHashes).has( hash ) @@ -252,7 +252,7 @@ An asset was cached with a reference to another asset (${hash}) that's not in th Either the asset was incorrectly cached, or the referenced asset should also be restored from cache. Referenced by: ${referencingAssets - .map(a => { + .map((a) => { const match = new RegExp(`.{0,20}${quoteMeta(hash)}.{0,20}`).exec( a.content ); @@ -281,11 +281,11 @@ ${referencingAssets * @param {string} hash the hash * @returns {string} the hash info */ - const hashInfo = hash => { + const hashInfo = (hash) => { const assets = hashToAssets.get(hash); return `${hash} (${Array.from( /** @type {AssetInfoForRealContentHash[]} */ (assets), - a => a.name + (a) => a.name )})`; }; /** @type {Set} */ @@ -323,26 +323,26 @@ ${referencingAssets * @param {AssetInfoForRealContentHash} asset asset info * @returns {Etag} etag */ - const getEtag = asset => + const getEtag = (asset) => cacheGenerate.mergeEtags( cacheGenerate.getLazyHashedEtag(asset.source), Array.from( /** @type {ReferencedHashes} */ (asset.referencedHashes), - hash => hashToNewHash.get(hash) + (hash) => hashToNewHash.get(hash) ).join("|") ); /** * @param {AssetInfoForRealContentHash} asset asset info * @returns {Promise} */ - const computeNewContent = asset => { + const computeNewContent = (asset) => { if (asset.contentComputePromise) return asset.contentComputePromise; return (asset.contentComputePromise = (async () => { if ( /** @type {OwnHashes} */ (asset.ownHashes).size > 0 || [ .../** @type {ReferencedHashes} */ (asset.referencedHashes) - ].some(hash => hashToNewHash.get(hash) !== hash) + ].some((hash) => hashToNewHash.get(hash) !== hash) ) { const identifier = asset.name; const etag = getEtag(asset); @@ -352,7 +352,7 @@ ${referencingAssets () => { const newContent = asset.content.replace( hashRegExp, - hash => /** @type {string} */ (hashToNewHash.get(hash)) + (hash) => /** @type {string} */ (hashToNewHash.get(hash)) ); return new RawSource(newContent); } @@ -364,7 +364,7 @@ ${referencingAssets * @param {AssetInfoForRealContentHash} asset asset info * @returns {Promise} */ - const computeNewContentWithoutOwn = asset => { + const computeNewContentWithoutOwn = (asset) => { if (asset.contentComputeWithoutOwnPromise) { return asset.contentComputeWithoutOwnPromise; } @@ -373,7 +373,7 @@ ${referencingAssets /** @type {OwnHashes} */ (asset.ownHashes).size > 0 || [ .../** @type {ReferencedHashes} */ (asset.referencedHashes) - ].some(hash => hashToNewHash.get(hash) !== hash) + ].some((hash) => hashToNewHash.get(hash) !== hash) ) { const identifier = `${asset.name}|without-own`; const etag = getEtag(asset); @@ -383,7 +383,7 @@ ${referencingAssets () => { const newContent = asset.content.replace( hashRegExp, - hash => { + (hash) => { if ( /** @type {OwnHashes} */ (asset.ownHashes).has(hash) @@ -399,20 +399,20 @@ ${referencingAssets } })()); }; - const comparator = compareSelect(a => a.name, compareStrings); + const comparator = compareSelect((a) => a.name, compareStrings); for (const oldHash of hashesInOrder) { const assets = /** @type {AssetInfoForRealContentHash[]} */ (hashToAssets.get(oldHash)); assets.sort(comparator); await Promise.all( - assets.map(asset => + assets.map((asset) => /** @type {OwnHashes} */ (asset.ownHashes).has(oldHash) ? computeNewContentWithoutOwn(asset) : computeNewContent(asset) ) ); - const assetsContent = mapAndDeduplicateBuffers(assets, asset => { + const assetsContent = mapAndDeduplicateBuffers(assets, (asset) => { if (/** @type {OwnHashes} */ (asset.ownHashes).has(oldHash)) { return asset.newSourceWithoutOwn ? asset.newSourceWithoutOwn.buffer() @@ -437,18 +437,18 @@ ${referencingAssets hashToNewHash.set(oldHash, newHash); } await Promise.all( - assetsWithInfo.map(async asset => { + assetsWithInfo.map(async (asset) => { await computeNewContent(asset); const newName = asset.name.replace( hashRegExp, - hash => /** @type {string} */ (hashToNewHash.get(hash)) + (hash) => /** @type {string} */ (hashToNewHash.get(hash)) ); const infoUpdate = {}; const hash = /** @type {string} */ (asset.info.contenthash); infoUpdate.contenthash = Array.isArray(hash) ? hash.map( - hash => /** @type {string} */ (hashToNewHash.get(hash)) + (hash) => /** @type {string} */ (hashToNewHash.get(hash)) ) : /** @type {string} */ (hashToNewHash.get(hash)); diff --git a/lib/optimize/RemoveEmptyChunksPlugin.js b/lib/optimize/RemoveEmptyChunksPlugin.js index 3bc0cd4a4ff..d6986acdb4b 100644 --- a/lib/optimize/RemoveEmptyChunksPlugin.js +++ b/lib/optimize/RemoveEmptyChunksPlugin.js @@ -19,12 +19,12 @@ class RemoveEmptyChunksPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { /** * @param {Iterable} chunks the chunks array * @returns {void} */ - const handler = chunks => { + const handler = (chunks) => { const chunkGraph = compilation.chunkGraph; for (const chunk of chunks) { if ( diff --git a/lib/optimize/RemoveParentModulesPlugin.js b/lib/optimize/RemoveParentModulesPlugin.js index 1f38c0f4b8a..28b1e6921ab 100644 --- a/lib/optimize/RemoveParentModulesPlugin.js +++ b/lib/optimize/RemoveParentModulesPlugin.js @@ -67,7 +67,7 @@ class RemoveParentModulesPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { /** * @param {Iterable} chunks the chunks * @param {ChunkGroup[]} chunkGroups the chunk groups @@ -87,7 +87,7 @@ class RemoveParentModulesPlugin { * @param {Module} mod the module to get the mask for * @returns {bigint} the module mask to uniquely identify the module */ - const getOrCreateModuleMask = mod => { + const getOrCreateModuleMask = (mod) => { let id = maskByModule.get(mod); if (id === undefined) { id = nextModuleMask; @@ -177,7 +177,7 @@ class RemoveParentModulesPlugin { const availableModulesSets = Array.from( chunk.groupsIterable, - chunkGroup => availableModulesMap.get(chunkGroup) + (chunkGroup) => availableModulesMap.get(chunkGroup) ); if (availableModulesSets.includes(undefined)) continue; // No info about this chunk group diff --git a/lib/optimize/RuntimeChunkPlugin.js b/lib/optimize/RuntimeChunkPlugin.js index a51cd693a65..061a0fb6c68 100644 --- a/lib/optimize/RuntimeChunkPlugin.js +++ b/lib/optimize/RuntimeChunkPlugin.js @@ -20,7 +20,7 @@ class RuntimeChunkPlugin { constructor(options) { this.options = { /** @type {RuntimeChunkFunction} */ - name: entrypoint => `runtime~${entrypoint.name}`, + name: (entrypoint) => `runtime~${entrypoint.name}`, ...options }; } @@ -31,7 +31,7 @@ class RuntimeChunkPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.addEntry.tap(PLUGIN_NAME, (_, { name: entryName }) => { if (entryName === undefined) return; const data = diff --git a/lib/optimize/SideEffectsFlagPlugin.js b/lib/optimize/SideEffectsFlagPlugin.js index 1c882ef79e3..f66eaadda1d 100644 --- a/lib/optimize/SideEffectsFlagPlugin.js +++ b/lib/optimize/SideEffectsFlagPlugin.js @@ -131,7 +131,7 @@ class SideEffectsFlagPlugin { * @param {JavascriptParser} parser the parser * @returns {void} */ - const parserHandler = parser => { + const parserHandler = (parser) => { /** @type {undefined | Statement | ModuleDeclaration | MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration} */ let sideEffectsStatement; parser.hooks.program.tap(PLUGIN_NAME, () => { @@ -139,7 +139,7 @@ class SideEffectsFlagPlugin { }); parser.hooks.statement.tap( { name: PLUGIN_NAME, stage: -100 }, - statement => { + (statement) => { if (sideEffectsStatement) return; if (parser.scope.topLevelScope !== true) return; switch (statement.type) { @@ -277,7 +277,7 @@ class SideEffectsFlagPlugin { name: PLUGIN_NAME, stage: STAGE_DEFAULT }, - modules => { + (modules) => { const logger = compilation.getLogger( "webpack.SideEffectsFlagPlugin" ); @@ -289,7 +289,7 @@ class SideEffectsFlagPlugin { /** * @param {Module} module module */ - const optimizeIncomingConnections = module => { + const optimizeIncomingConnections = (module) => { if (optimizedModules.has(module)) return; optimizedModules.add(module); if (module.getSideEffectsConnectionState(moduleGraph) === false) { @@ -410,7 +410,7 @@ class SideEffectsFlagPlugin { case "string": return globToRegexp(flagValue, cache).test(moduleName); case "object": - return flagValue.some(glob => + return flagValue.some((glob) => SideEffectsFlagPlugin.moduleHasSideEffects(moduleName, glob, cache) ); } diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index 08512518c45..747f2dada4d 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -195,7 +195,7 @@ const hashFilename = (name, outputOptions) => { * @param {Chunk} chunk the chunk * @returns {number} the number of requests */ -const getRequests = chunk => { +const getRequests = (chunk) => { let requests = 0; for (const chunkGroup of chunk.groupsIterable) { requests = Math.max(requests, chunkGroup.chunks.length); @@ -272,17 +272,17 @@ const compareEntries = (a, b) => { * @param {Chunk} chunk the chunk * @returns {boolean} true, if the chunk is an entry chunk */ -const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial(); +const INITIAL_CHUNK_FILTER = (chunk) => chunk.canBeInitial(); /** * @param {Chunk} chunk the chunk * @returns {boolean} true, if the chunk is an async chunk */ -const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial(); +const ASYNC_CHUNK_FILTER = (chunk) => !chunk.canBeInitial(); /** * @param {Chunk} _chunk the chunk * @returns {boolean} always true */ -const ALL_CHUNK_FILTER = _chunk => true; +const ALL_CHUNK_FILTER = (_chunk) => true; /** * @param {OptimizationSplitChunksSizes | undefined} value the sizes @@ -318,7 +318,7 @@ const mergeSizes = (...sizes) => { * @param {SplitChunksSizes} sizes the sizes * @returns {boolean} true, if there are sizes > 0 */ -const hasNonZeroSizes = sizes => { +const hasNonZeroSizes = (sizes) => { for (const key of Object.keys(sizes)) { if (sizes[key] > 0) return true; } @@ -398,7 +398,7 @@ const getViolatingMinSizes = (sizes, minSize) => { * @param {SplitChunksSizes} sizes the sizes * @returns {number} the total size */ -const totalSize = sizes => { +const totalSize = (sizes) => { let size = 0; for (const key of Object.keys(sizes)) { size += sizes[key]; @@ -410,7 +410,7 @@ const totalSize = sizes => { * @param {OptimizationSplitChunksCacheGroup["name"]} name the chunk name * @returns {GetName | undefined} a function to get the name of the chunk */ -const normalizeName = name => { +const normalizeName = (name) => { if (typeof name === "string") { return () => name; } @@ -423,7 +423,7 @@ const normalizeName = name => { * @param {OptimizationSplitChunksCacheGroup["chunks"]} chunks the chunk filter option * @returns {ChunkFilterFunction | undefined} the chunk filter function */ -const normalizeChunksFilter = chunks => { +const normalizeChunksFilter = (chunks) => { if (chunks === "initial") { return INITIAL_CHUNK_FILTER; } @@ -434,7 +434,7 @@ const normalizeChunksFilter = chunks => { return ALL_CHUNK_FILTER; } if (chunks instanceof RegExp) { - return chunk => (chunk.name ? chunks.test(chunk.name) : false); + return (chunk) => (chunk.name ? chunks.test(chunk.name) : false); } if (typeof chunks === "function") { return chunks; @@ -824,7 +824,7 @@ module.exports = class SplitChunksPlugin { compiler.context, compiler.root ); - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const logger = compilation.getLogger(`webpack.${PLUGIN_NAME}`); let alreadyOptimized = false; compilation.hooks.unseal.tap(PLUGIN_NAME, () => { @@ -835,7 +835,7 @@ module.exports = class SplitChunksPlugin { name: PLUGIN_NAME, stage: STAGE_ADVANCED }, - chunks => { + (chunks) => { if (alreadyOptimized) return; alreadyOptimized = true; logger.time("prepare"); @@ -859,7 +859,7 @@ module.exports = class SplitChunksPlugin { * @param {Iterable} chunks list of chunks * @returns {bigint | Chunk} key of the chunks */ - const getKey = chunks => { + const getKey = (chunks) => { const iterator = chunks[Symbol.iterator](); let result = iterator.next(); if (result.done) return ZERO; @@ -879,7 +879,7 @@ module.exports = class SplitChunksPlugin { * @param {bigint | Chunk} key key of the chunks * @returns {string} stringified key */ - const keyToString = key => { + const keyToString = (key) => { if (typeof key === "bigint") return key.toString(16); return /** @type {bigint} */ (chunkIndexMap.get(key)).toString(16); }; @@ -907,7 +907,7 @@ module.exports = class SplitChunksPlugin { * @param {Module} module the module * @returns {Iterable} groups of chunks with equal exports */ - const groupChunksByExports = module => { + const groupChunksByExports = (module) => { const exportsInfo = moduleGraph.getExportsInfo(module); const groupedByUsedExports = new Map(); for (const chunk of chunkGraph.getModuleChunksIterable(module)) { @@ -954,7 +954,7 @@ module.exports = class SplitChunksPlugin { * @param {IterableIterator>} chunkSets set of sets of chunks * @returns {Map>>} map of sets of chunks by count */ - const groupChunkSetsByCount = chunkSets => { + const groupChunkSetsByCount = (chunkSets) => { /** @type {Map>>} */ const chunkSetsByCount = new Map(); for (const chunksSet of chunkSets) { @@ -994,7 +994,7 @@ module.exports = class SplitChunksPlugin { /** @type {Map | Chunk)[]>} */ const combinationsCache = new Map(); - return key => { + return (key) => { const cacheEntry = combinationsCache.get(key); if (cacheEntry !== undefined) return cacheEntry; if (key instanceof Chunk) { @@ -1040,7 +1040,7 @@ module.exports = class SplitChunksPlugin { * @param {bigint | Chunk} key key * @returns {(Set | Chunk)[]} combinations by key */ - const getCombinations = key => getCombinationsFactory()(key); + const getCombinations = (key) => getCombinationsFactory()(key); const getExportsCombinationsFactory = memoize(() => { const { chunkSetsInGraph, singleChunkSets } = @@ -1055,7 +1055,7 @@ module.exports = class SplitChunksPlugin { * @param {bigint | Chunk} key key * @returns {(Set | Chunk)[]} exports combinations by key */ - const getExportsCombinations = key => + const getExportsCombinations = (key) => getExportsCombinationsFactory()(key); /** @@ -1321,7 +1321,7 @@ module.exports = class SplitChunksPlugin { const removeModulesWithSourceType = (info, sourceTypes) => { for (const module of info.modules) { const types = module.getSourceTypes(); - if (sourceTypes.some(type => types.has(type))) { + if (sourceTypes.some((type) => types.has(type))) { info.modules.delete(module); for (const type of types) { info.sizes[type] -= module.size(type); @@ -1334,7 +1334,7 @@ module.exports = class SplitChunksPlugin { * @param {ChunksInfoItem} info entry * @returns {boolean} true, if entry become empty */ - const removeMinSizeViolatingModules = info => { + const removeMinSizeViolatingModules = (info) => { if (!info.cacheGroup._validateSize) return false; const violatingSizes = getViolatingMinSizes( info.sizes, diff --git a/lib/performance/AssetsOverSizeLimitWarning.js b/lib/performance/AssetsOverSizeLimitWarning.js index 5b414fc0dfd..35c63c32a49 100644 --- a/lib/performance/AssetsOverSizeLimitWarning.js +++ b/lib/performance/AssetsOverSizeLimitWarning.js @@ -17,7 +17,7 @@ module.exports = class AssetsOverSizeLimitWarning extends WebpackError { */ constructor(assetsOverSizeLimit, assetLimit) { const assetLists = assetsOverSizeLimit - .map(asset => `\n ${asset.name} (${formatSize(asset.size)})`) + .map((asset) => `\n ${asset.name} (${formatSize(asset.size)})`) .join(""); super(`asset size limit: The following asset(s) exceed the recommended size limit (${formatSize( diff --git a/lib/performance/EntrypointsOverSizeLimitWarning.js b/lib/performance/EntrypointsOverSizeLimitWarning.js index 270e8aaa708..4f4d986bfd2 100644 --- a/lib/performance/EntrypointsOverSizeLimitWarning.js +++ b/lib/performance/EntrypointsOverSizeLimitWarning.js @@ -18,10 +18,10 @@ module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError { constructor(entrypoints, entrypointLimit) { const entrypointList = entrypoints .map( - entrypoint => + (entrypoint) => `\n ${entrypoint.name} (${formatSize( entrypoint.size - )})\n${entrypoint.files.map(asset => ` ${asset}`).join("\n")}` + )})\n${entrypoint.files.map((asset) => ` ${asset}`).join("\n")}` ) .join(""); super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${formatSize( diff --git a/lib/performance/SizeLimitsPlugin.js b/lib/performance/SizeLimitsPlugin.js index 19b2dcdc6e3..a57f2a79754 100644 --- a/lib/performance/SizeLimitsPlugin.js +++ b/lib/performance/SizeLimitsPlugin.js @@ -73,7 +73,7 @@ module.exports = class SizeLimitsPlugin { const hints = this.hints; const assetFilter = this.assetFilter || excludeSourceMap; - compiler.hooks.afterEmit.tap(PLUGIN_NAME, compilation => { + compiler.hooks.afterEmit.tap(PLUGIN_NAME, (compilation) => { /** @type {WebpackError[]} */ const warnings = []; @@ -81,7 +81,7 @@ module.exports = class SizeLimitsPlugin { * @param {Entrypoint} entrypoint an entrypoint * @returns {number} the size of the entrypoint */ - const getEntrypointSize = entrypoint => { + const getEntrypointSize = (entrypoint) => { let size = 0; for (const file of entrypoint.getFiles()) { const asset = compilation.getAsset(file); @@ -117,7 +117,7 @@ module.exports = class SizeLimitsPlugin { * @param {Asset["name"]} name the name * @returns {boolean | undefined} result */ - const fileFilter = name => { + const fileFilter = (name) => { const asset = compilation.getAsset(name); return asset && assetFilter(asset.name, asset.source, asset.info); }; @@ -162,7 +162,7 @@ module.exports = class SizeLimitsPlugin { if (warnings.length > 0) { const someAsyncChunk = find( compilation.chunks, - chunk => !chunk.canBeInitial() + (chunk) => !chunk.canBeInitial() ); if (!someAsyncChunk) { diff --git a/lib/prefetch/ChunkPrefetchPreloadPlugin.js b/lib/prefetch/ChunkPrefetchPreloadPlugin.js index e475f082c0e..f992bfd1f25 100644 --- a/lib/prefetch/ChunkPrefetchPreloadPlugin.js +++ b/lib/prefetch/ChunkPrefetchPreloadPlugin.js @@ -23,7 +23,7 @@ class ChunkPrefetchPreloadPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.additionalChunkRuntimeRequirements.tap( PLUGIN_NAME, (chunk, set, { chunkGraph }) => { diff --git a/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js b/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js index 740bbe8c3c1..9deff8ced58 100644 --- a/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +++ b/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js @@ -34,16 +34,16 @@ class ChunkPrefetchStartupRuntimeModule extends RuntimeModule { ({ onChunks, chunks }) => `${RuntimeGlobals.onChunksLoaded}(0, ${JSON.stringify( // This need to include itself to delay execution after this chunk has been fully loaded - onChunks.filter(c => c === chunk).map(c => c.id) + onChunks.filter((c) => c === chunk).map((c) => c.id) )}, ${runtimeTemplate.basicFunction( "", chunks.size < 3 ? Array.from( chunks, - c => + (c) => `${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)});` ) - : `${JSON.stringify(Array.from(chunks, c => c.id))}.map(${ + : `${JSON.stringify(Array.from(chunks, (c) => c.id))}.map(${ RuntimeGlobals.prefetchChunk });` )}, 5);` diff --git a/lib/rules/BasicMatcherRulePlugin.js b/lib/rules/BasicMatcherRulePlugin.js index b2cbfb7ea92..3e20878a9b0 100644 --- a/lib/rules/BasicMatcherRulePlugin.js +++ b/lib/rules/BasicMatcherRulePlugin.js @@ -56,7 +56,7 @@ class BasicMatcherRulePlugin { matchWhenEmpty: this.invert ? !condition.matchWhenEmpty : condition.matchWhenEmpty, - fn: this.invert ? v => !fn(v) : fn + fn: this.invert ? (v) => !fn(v) : fn }); } } diff --git a/lib/rules/RuleSetCompiler.js b/lib/rules/RuleSetCompiler.js index c7b97930108..9054026aa14 100644 --- a/lib/rules/RuleSetCompiler.js +++ b/lib/rules/RuleSetCompiler.js @@ -183,7 +183,7 @@ class RuleSetCompiler { return { references: refs, - exec: data => { + exec: (data) => { /** @type {Effect[]} */ const effects = []; for (const rule of rules) { @@ -222,7 +222,7 @@ class RuleSetCompiler { /** @type {Set} */ const unhandledProperties = new Set( Object.keys(rule).filter( - key => rule[/** @type {keyof RuleSetRule} */ (key)] !== undefined + (key) => rule[/** @type {keyof RuleSetRule} */ (key)] !== undefined ) ); @@ -274,7 +274,7 @@ class RuleSetCompiler { if (condition === "") { return { matchWhenEmpty: true, - fn: str => str === "" + fn: (str) => str === "" }; } if (!condition) { @@ -287,7 +287,7 @@ class RuleSetCompiler { if (typeof condition === "string") { return { matchWhenEmpty: condition.length === 0, - fn: str => typeof str === "string" && str.startsWith(condition) + fn: (str) => typeof str === "string" && str.startsWith(condition) }; } if (typeof condition === "function") { @@ -307,7 +307,7 @@ class RuleSetCompiler { if (condition instanceof RegExp) { return { matchWhenEmpty: condition.test(""), - fn: v => typeof v === "string" && condition.test(v) + fn: (v) => typeof v === "string" && condition.test(v) }; } if (Array.isArray(condition)) { @@ -363,7 +363,7 @@ class RuleSetCompiler { const fn = matcher.fn; conditions.push({ matchWhenEmpty: !matcher.matchWhenEmpty, - fn: /** @type {RuleConditionFunction} */ (v => !fn(v)) + fn: /** @type {RuleConditionFunction} */ ((v) => !fn(v)) }); } break; @@ -399,8 +399,8 @@ class RuleSetCompiler { return conditions[0]; } return { - matchWhenEmpty: conditions.some(c => c.matchWhenEmpty), - fn: v => conditions.some(c => c.fn(v)) + matchWhenEmpty: conditions.some((c) => c.matchWhenEmpty), + fn: (v) => conditions.some((c) => c.fn(v)) }; } @@ -418,8 +418,8 @@ class RuleSetCompiler { return conditions[0]; } return { - matchWhenEmpty: conditions.every(c => c.matchWhenEmpty), - fn: v => conditions.every(c => c.fn(v)) + matchWhenEmpty: conditions.every((c) => c.matchWhenEmpty), + fn: (v) => conditions.every((c) => c.fn(v)) }; } diff --git a/lib/rules/UseEffectRulePlugin.js b/lib/rules/UseEffectRulePlugin.js index 36d568c69dc..e90d10bab88 100644 --- a/lib/rules/UseEffectRulePlugin.js +++ b/lib/rules/UseEffectRulePlugin.js @@ -65,7 +65,7 @@ class UseEffectRulePlugin { */ const useToEffect = (path, defaultIdent, item) => { if (typeof item === "function") { - return data => + return (data) => useToEffectsWithoutIdent( path, /** @type {RuleSetUseItem | RuleSetUseItem[]} */ @@ -165,7 +165,7 @@ class UseEffectRulePlugin { }; if (typeof use === "function") { - result.effects.push(data => + result.effects.push((data) => useToEffectsWithoutIdent(`${path}.use`, use(data)) ); } else { diff --git a/lib/runtime/GetChunkFilenameRuntimeModule.js b/lib/runtime/GetChunkFilenameRuntimeModule.js index 5058b853ca2..88f8b90e171 100644 --- a/lib/runtime/GetChunkFilenameRuntimeModule.js +++ b/lib/runtime/GetChunkFilenameRuntimeModule.js @@ -53,7 +53,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { * @param {Chunk} c the chunk * @returns {void} */ - const addChunk = c => { + const addChunk = (c) => { const chunkFilename = getFilenameForChunk(c); if (chunkFilename) { let set = chunkFilenames.get(chunkFilename); @@ -128,7 +128,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { * @param {string | number} value a value * @returns {string} string to put in quotes */ - const unquotedStringify = value => { + const unquotedStringify = (value) => { const str = `${value}`; if (str.length >= 5 && str === `${c.id}`) { // This is shorter and generates the same result @@ -141,7 +141,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { * @param {string} value string * @returns {(length: number) => string} string to put in quotes with length */ - const unquotedStringifyWithLength = value => length => + const unquotedStringifyWithLength = (value) => (length) => unquotedStringify(`${value}`.slice(0, length)); const chunkFilenameValue = typeof chunkFilename === "function" @@ -154,7 +154,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { : JSON.stringify(chunkFilename); const staticChunkFilename = compilation.getPath(chunkFilenameValue, { hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => + hashWithLength: (length) => `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, chunk: { id: unquotedStringify(/** @type {ChunkId} */ (c.id)), @@ -193,7 +193,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { * @param {(chunk: Chunk) => string | number} fn function from chunk to value * @returns {string} code with static mapping of results of fn */ - const createMap = fn => { + const createMap = (fn) => { /** @type {Record} */ const obj = {}; let useId = false; @@ -227,33 +227,33 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { * @param {(chunk: Chunk) => string | number} fn function from chunk to value * @returns {string} code with static mapping of results of fn for including in quoted string */ - const mapExpr = fn => `" + ${createMap(fn)} + "`; + const mapExpr = (fn) => `" + ${createMap(fn)} + "`; /** * @param {(chunk: Chunk) => string | number} fn function from chunk to value * @returns {(length: number) => string} function which generates code with static mapping of results of fn for including in quoted string for specific length */ - const mapExprWithLength = fn => length => - `" + ${createMap(c => `${fn(c)}`.slice(0, length))} + "`; + const mapExprWithLength = (fn) => (length) => + `" + ${createMap((c) => `${fn(c)}`.slice(0, length))} + "`; const url = dynamicFilename && compilation.getPath(JSON.stringify(dynamicFilename), { hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => + hashWithLength: (length) => `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, chunk: { id: '" + chunkId + "', - hash: mapExpr(c => /** @type {string} */ (c.renderedHash)), + hash: mapExpr((c) => /** @type {string} */ (c.renderedHash)), hashWithLength: mapExprWithLength( - c => /** @type {string} */ (c.renderedHash) + (c) => /** @type {string} */ (c.renderedHash) ), - name: mapExpr(c => c.name || /** @type {number | string} */ (c.id)), + name: mapExpr((c) => c.name || /** @type {number | string} */ (c.id)), contentHash: { - [contentType]: mapExpr(c => c.contentHash[contentType]) + [contentType]: mapExpr((c) => c.contentHash[contentType]) }, contentHashWithLength: { - [contentType]: mapExprWithLength(c => c.contentHash[contentType]) + [contentType]: mapExprWithLength((c) => c.contentHash[contentType]) } }, contentHashType: contentType @@ -277,7 +277,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { ? `chunkId === ${JSON.stringify(first(ids))}` : `{${Array.from( ids, - id => `${JSON.stringify(id)}:1` + (id) => `${JSON.stringify(id)}:1` ).join(",")}}[chunkId]`; return `if (${condition}) return ${url};`; }) diff --git a/lib/runtime/GetMainFilenameRuntimeModule.js b/lib/runtime/GetMainFilenameRuntimeModule.js index 0a9fdf50bb8..f280163b5d7 100644 --- a/lib/runtime/GetMainFilenameRuntimeModule.js +++ b/lib/runtime/GetMainFilenameRuntimeModule.js @@ -33,7 +33,7 @@ class GetMainFilenameRuntimeModule extends RuntimeModule { const { runtimeTemplate } = compilation; const url = compilation.getPath(JSON.stringify(filename), { hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => + hashWithLength: (length) => `" + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + "`, chunk, runtime: chunk.runtime diff --git a/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js b/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js index e8342b3431c..27bb3750885 100644 --- a/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +++ b/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js @@ -69,7 +69,7 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule { `policy = trustedTypes.createPolicy(${JSON.stringify( trustedTypes.policyName )}, policy);` - ].map(line => + ].map((line) => wrapPolicyCreationInTryCatch ? Template.indent(line) : line ), ...(wrapPolicyCreationInTryCatch diff --git a/lib/runtime/MakeDeferredNamespaceObjectRuntime.js b/lib/runtime/MakeDeferredNamespaceObjectRuntime.js index e3e5899e31c..b1d91e422fd 100644 --- a/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +++ b/lib/runtime/MakeDeferredNamespaceObjectRuntime.js @@ -54,7 +54,7 @@ function getOptimizedDeferredModule( isAsync ? `[${ RuntimeGlobals.makeDeferredNamespaceObjectSymbol - }]: ${JSON.stringify(asyncDepsIds.filter(x => x !== null))}` + }]: ${JSON.stringify(asyncDepsIds.filter((x) => x !== null))}` : "" ]; return Template.asString(["{", Template.indent(props), "}"]); diff --git a/lib/runtime/StartupChunkDependenciesPlugin.js b/lib/runtime/StartupChunkDependenciesPlugin.js index 871a3ba3a78..b37d7e72f91 100644 --- a/lib/runtime/StartupChunkDependenciesPlugin.js +++ b/lib/runtime/StartupChunkDependenciesPlugin.js @@ -38,13 +38,13 @@ class StartupChunkDependenciesPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalChunkLoading = compilation.outputOptions.chunkLoading; /** * @param {Chunk} chunk chunk to check * @returns {boolean} true, when the plugin is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const chunkLoading = options && options.chunkLoading !== undefined diff --git a/lib/runtime/StartupChunkDependenciesRuntimeModule.js b/lib/runtime/StartupChunkDependenciesRuntimeModule.js index 1a834bd9f8c..7ff03978353 100644 --- a/lib/runtime/StartupChunkDependenciesRuntimeModule.js +++ b/lib/runtime/StartupChunkDependenciesRuntimeModule.js @@ -30,7 +30,7 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule { const chunk = /** @type {Chunk} */ (this.chunk); const chunkIds = [ ...chunkGraph.getChunkEntryDependentChunksIterable(chunk) - ].map(chunk => chunk.id); + ].map((chunk) => chunk.id); const compilation = /** @type {Compilation} */ (this.compilation); const { runtimeTemplate } = compilation; return Template.asString([ @@ -40,7 +40,7 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule { !this.asyncChunkLoading ? [ ...chunkIds.map( - id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)});` + (id) => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)});` ), "return next();" ] @@ -61,7 +61,7 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule { Template.indent( chunkIds .map( - id => + (id) => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})` ) .join(",\n") diff --git a/lib/schemes/DataUriPlugin.js b/lib/schemes/DataUriPlugin.js index 3fd44f31292..0be6c64c593 100644 --- a/lib/schemes/DataUriPlugin.js +++ b/lib/schemes/DataUriPlugin.js @@ -17,7 +17,7 @@ const URIRegEx = /^data:([^;,]+)?((?:;[^;,]+)*?)(?:;(base64)?)?,(.*)$/i; * @param {string} uri data URI * @returns {Buffer | null} decoded data */ -const decodeDataURI = uri => { +const decodeDataURI = (uri) => { const match = URIRegEx.exec(uri); if (!match) return null; @@ -51,7 +51,7 @@ class DataUriPlugin { (compilation, { normalModuleFactory }) => { normalModuleFactory.hooks.resolveForScheme .for("data") - .tap(PLUGIN_NAME, resourceData => { + .tap(PLUGIN_NAME, (resourceData) => { const match = URIRegEx.exec(resourceData.resource); if (match) { resourceData.data.mimetype = match[1] || ""; @@ -64,7 +64,7 @@ class DataUriPlugin { }); NormalModule.getCompilationHooks(compilation) .readResourceForScheme.for("data") - .tap(PLUGIN_NAME, resource => decodeDataURI(resource)); + .tap(PLUGIN_NAME, (resource) => decodeDataURI(resource)); } ); } diff --git a/lib/schemes/FileUriPlugin.js b/lib/schemes/FileUriPlugin.js index e870e1b6b60..9d64ef807a1 100644 --- a/lib/schemes/FileUriPlugin.js +++ b/lib/schemes/FileUriPlugin.js @@ -24,7 +24,7 @@ class FileUriPlugin { (compilation, { normalModuleFactory }) => { normalModuleFactory.hooks.resolveForScheme .for("file") - .tap(PLUGIN_NAME, resourceData => { + .tap(PLUGIN_NAME, (resourceData) => { const url = new URL(resourceData.resource); const path = fileURLToPath(url); const query = url.search; diff --git a/lib/schemes/HttpUriPlugin.js b/lib/schemes/HttpUriPlugin.js index 0dad3db3d0f..85e3834fd5a 100644 --- a/lib/schemes/HttpUriPlugin.js +++ b/lib/schemes/HttpUriPlugin.js @@ -46,7 +46,7 @@ const proxyFetch = (request, proxy) => (url, options, callback) => { * @param {Socket=} socket socket * @returns {void} */ - const doRequest = socket => { + const doRequest = (socket) => { request .get(url, { ...options, ...(socket && { socket }) }, callback) .on("error", eventEmitter.emit.bind(eventEmitter, "error")); @@ -68,7 +68,7 @@ const proxyFetch = (request, proxy) => (url, options, callback) => { doRequest(socket); } }) - .on("error", err => { + .on("error", (err) => { eventEmitter.emit( "error", new Error( @@ -101,7 +101,7 @@ const validate = createSchemaValidation( * @param {string} str path * @returns {string} safe path */ -const toSafePath = str => +const toSafePath = (str) => str .replace(/^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$/g, "") .replace(/[^a-zA-Z0-9._-]+/g, "_"); @@ -110,7 +110,7 @@ const toSafePath = str => * @param {Buffer} content content * @returns {string} integrity */ -const computeIntegrity = content => { +const computeIntegrity = (content) => { const hash = createHash("sha512"); hash.update(content); const integrity = `sha512-${hash.digest("base64")}`; @@ -131,7 +131,7 @@ const verifyIntegrity = (content, integrity) => { * @param {string} str input * @returns {Record} parsed */ -const parseKeyValuePairs = str => { +const parseKeyValuePairs = (str) => { /** @type {Record} */ const result = {}; for (const item of str.split(",")) { @@ -197,7 +197,7 @@ const areLockfileEntriesEqual = (a, b) => * @param {LockfileEntry} entry lockfile entry * @returns {`resolved: ${string}, integrity: ${string}, contentType: ${string}`} stringified entry */ -const entryToString = entry => +const entryToString = (entry) => `resolved: ${entry.resolved}, integrity: ${entry.integrity}, contentType: ${entry.contentType}`; class Lockfile { @@ -273,7 +273,7 @@ class Lockfile { * @param {FnWithoutKey} fn function * @returns {FnWithoutKey} cached function */ -const cachedWithoutKey = fn => { +const cachedWithoutKey = (fn) => { let inFlight = false; /** @type {Error | undefined} */ let cachedError; @@ -281,7 +281,7 @@ const cachedWithoutKey = fn => { let cachedResult; /** @type {FnWithoutKeyCallback[] | undefined} */ let cachedCallbacks; - return callback => { + return (callback) => { if (inFlight) { if (cachedResult !== undefined) return callback(null, cachedResult); if (cachedError !== undefined) return callback(cachedError); @@ -487,7 +487,7 @@ class HttpUriPlugin { * @param {string} url the url * @returns {string} the key */ - const getCacheKey = url => { + const getCacheKey = (url) => { const cachedResult = cacheKeyCache.get(url); if (cachedResult !== undefined) return cachedResult; const result = _getCacheKey(url); @@ -499,7 +499,7 @@ class HttpUriPlugin { * @param {string} url the url * @returns {string} the key */ - const _getCacheKey = url => { + const _getCacheKey = (url) => { const parsedUrl = new URL(url); const folder = toSafePath(parsedUrl.origin); const name = toSafePath(parsedUrl.pathname); @@ -520,7 +520,7 @@ class HttpUriPlugin { * @param {(err: Error | null, lockfile?: Lockfile) => void} callback callback * @returns {void} */ - callback => { + (callback) => { const readLockfile = () => { intermediateFs.readFile(lockfileLocation, (err, buffer) => { if (err && err.code !== "ENOENT") { @@ -622,9 +622,9 @@ class HttpUriPlugin { } const key = getCacheKey(result.entry.resolved); const filePath = join(intermediateFs, cacheLocation, key); - mkdirp(intermediateFs, dirname(intermediateFs, filePath), err => { + mkdirp(intermediateFs, dirname(intermediateFs, filePath), (err) => { if (err) return callback(err); - intermediateFs.writeFile(filePath, result.content, err => { + intermediateFs.writeFile(filePath, result.content, (err) => { if (err) return callback(err); callback(null, result); }); @@ -706,7 +706,7 @@ class HttpUriPlugin { headers["if-none-match"] = cachedResult.etag; } - fetch(new URL(url), { headers }, res => { + fetch(new URL(url), { headers }, (res) => { const etag = res.headers.etag; const location = res.headers.location; const cacheControl = res.headers["cache-control"]; @@ -718,7 +718,7 @@ class HttpUriPlugin { * @param {Partial> & (Pick | Pick)} partialResult result * @returns {void} */ - const finishWith = partialResult => { + const finishWith = (partialResult) => { if ("location" in partialResult) { logger.debug( `GET ${url} [${res.statusCode}] -> ${partialResult.location}` @@ -751,7 +751,7 @@ class HttpUriPlugin { ...result, fresh: false }, - err => { + (err) => { if (err) { logger.warn( `${url} can't be stored in cache: ${err.message}` @@ -820,7 +820,7 @@ class HttpUriPlugin { stream = stream.pipe(createInflate()); } - stream.on("data", chunk => { + stream.on("data", (chunk) => { bufferArr.push(chunk); }); @@ -851,7 +851,7 @@ class HttpUriPlugin { content }); }); - }).on("error", err => { + }).on("error", (err) => { logger.log(`GET ${url} (error)`); err.message += `\nwhile fetching ${url}`; callback(err); @@ -881,7 +881,7 @@ class HttpUriPlugin { * @param {string} uri uri * @returns {boolean} true when allowed, otherwise false */ - const isAllowed = uri => { + const isAllowed = (uri) => { for (const allowed of allowedUris) { if (typeof allowed === "string") { if (uri.startsWith(allowed)) return true; @@ -908,7 +908,7 @@ class HttpUriPlugin { return callback( new Error( `${url} doesn't match the allowedUris policy. These URIs are allowed:\n${allowedUris - .map(uri => ` - ${uri}`) + .map((uri) => ` - ${uri}`) .join("\n")}` ) ); @@ -972,7 +972,7 @@ Remove this line from the lockfile to force upgrading.` /** * @param {Buffer=} lockedContent locked content */ - const doFetch = lockedContent => { + const doFetch = (lockedContent) => { resolveContent(url, entry.integrity, (err, _result) => { if (err) { if (lockedContent) { @@ -1053,7 +1053,7 @@ Remove this line from the lockfile to force upgrading.` * @param {Buffer | undefined} _result result * @returns {void} */ - const continueWithCachedContent = _result => { + const continueWithCachedContent = (_result) => { if (!upgrade) { // When not in upgrade mode, we accept the result from the lockfile cache return callback(null, { entry, content }); @@ -1101,7 +1101,7 @@ This will avoid that the end of line sequence is changed by git on Windows.`; filePath, /** @type {Buffer} */ (contentWithChangedEol), - err => { + (err) => { if (err) return callback(err); continueWithCachedContent( /** @type {Buffer} */ @@ -1260,15 +1260,10 @@ Run build with un-frozen lockfile to automatically fix lockfile.` )) { lockfile.entries.set(key, value); } - intermediateFs.writeFile(tempFile, lockfile.toString(), err => { - if (err) { - writeDone(); - return ( - /** @type {NonNullable} */ - (intermediateFs.unlink)(tempFile, () => callback(err)) - ); - } - intermediateFs.rename(tempFile, lockfileLocation, err => { + intermediateFs.writeFile( + tempFile, + lockfile.toString(), + (err) => { if (err) { writeDone(); return ( @@ -1276,10 +1271,19 @@ Run build with un-frozen lockfile to automatically fix lockfile.` (intermediateFs.unlink)(tempFile, () => callback(err)) ); } - writeDone(); - callback(); - }); - }); + intermediateFs.rename(tempFile, lockfileLocation, (err) => { + if (err) { + writeDone(); + return ( + /** @type {NonNullable} */ + (intermediateFs.unlink)(tempFile, () => callback(err)) + ); + } + writeDone(); + callback(); + }); + } + ); }); }; if (inProgressWrite) { diff --git a/lib/schemes/VirtualUrlPlugin.js b/lib/schemes/VirtualUrlPlugin.js index 49895bb6e71..7f405c80b5e 100644 --- a/lib/schemes/VirtualUrlPlugin.js +++ b/lib/schemes/VirtualUrlPlugin.js @@ -124,7 +124,7 @@ class VirtualUrlPlugin { (compilation, { normalModuleFactory }) => { normalModuleFactory.hooks.resolveForScheme .for(scheme) - .tap(PLUGIN_NAME, resourceData => { + .tap(PLUGIN_NAME, (resourceData) => { const virtualConfig = this.findVirtualModuleConfigById( resourceData.resource ); diff --git a/lib/serialization/BinaryMiddleware.js b/lib/serialization/BinaryMiddleware.js index 02060b1fbb2..d6eb71ac492 100644 --- a/lib/serialization/BinaryMiddleware.js +++ b/lib/serialization/BinaryMiddleware.js @@ -117,7 +117,7 @@ const MEASURE_END_OPERATION = Symbol("MEASURE_END_OPERATION"); * @param {number} n number * @returns {0 | 1 | 2} type of number for serialization */ -const identifyNumber = n => { +const identifyNumber = (n) => { if (n === (n | 0)) { if (n <= 127 && n >= -128) return 0; if (n <= 2147483647 && n >= -2147483648) return 1; @@ -129,7 +129,7 @@ const identifyNumber = n => { * @param {bigint} n bigint * @returns {0 | 1 | 2} type of bigint for serialization */ -const identifyBigInt = n => { +const identifyBigInt = (n) => { if (n <= BigInt(127) && n >= BigInt(-128)) return 0; if (n <= BigInt(2147483647) && n >= BigInt(-2147483648)) return 1; return 2; @@ -164,7 +164,7 @@ class BinaryMiddleware extends SerializerMiddleware { * @returns {LazyFunction} new lazy */ _serializeLazy(fn, context) { - return SerializerMiddleware.serializeLazy(fn, data => + return SerializerMiddleware.serializeLazy(fn, (data) => this._serialize(data, context) ); } @@ -198,7 +198,7 @@ class BinaryMiddleware extends SerializerMiddleware { /** * @param {number} bytesNeeded bytes needed */ - const allocate = bytesNeeded => { + const allocate = (bytesNeeded) => { if (currentBuffer !== null) { if (currentBuffer.length - currentPosition >= bytesNeeded) return; flush(); @@ -248,14 +248,14 @@ class BinaryMiddleware extends SerializerMiddleware { /** * @param {number} byte byte */ - const writeU8 = byte => { + const writeU8 = (byte) => { /** @type {Buffer} */ (currentBuffer).writeUInt8(byte, currentPosition++); }; /** * @param {number} ui32 ui32 */ - const writeU32 = ui32 => { + const writeU32 = (ui32) => { /** @type {Buffer} */ (currentBuffer).writeUInt32LE(ui32, currentPosition); currentPosition += 4; @@ -679,7 +679,7 @@ class BinaryMiddleware extends SerializerMiddleware { * @returns {LazyFunction} new lazy */ _deserializeLazy(fn, context) { - return SerializerMiddleware.deserializeLazy(fn, data => + return SerializerMiddleware.deserializeLazy(fn, (data) => this._deserialize(data, context) ); } @@ -696,7 +696,7 @@ class BinaryMiddleware extends SerializerMiddleware { let currentIsBuffer = Buffer.isBuffer(currentBuffer); let currentPosition = 0; - const retainedBuffer = context.retainedBuffer || (x => x); + const retainedBuffer = context.retainedBuffer || ((x) => x); const checkOverflow = () => { if (currentPosition >= /** @type {Buffer} */ (currentBuffer).length) { @@ -711,7 +711,7 @@ class BinaryMiddleware extends SerializerMiddleware { * @param {number} n n * @returns {boolean} true when in current buffer, otherwise false */ - const isInCurrentBuffer = n => + const isInCurrentBuffer = (n) => currentIsBuffer && n + currentPosition <= /** @type {Buffer} */ (currentBuffer).length; const ensureBuffer = () => { @@ -728,7 +728,7 @@ class BinaryMiddleware extends SerializerMiddleware { * @param {number} n amount of bytes to read * @returns {Buffer} buffer with bytes */ - const read = n => { + const read = (n) => { ensureBuffer(); const rem = /** @type {Buffer} */ (currentBuffer).length - currentPosition; @@ -760,7 +760,7 @@ class BinaryMiddleware extends SerializerMiddleware { * @param {number} n amount of bytes to read * @returns {Buffer} buffer with bytes */ - const readUpTo = n => { + const readUpTo = (n) => { ensureBuffer(); const rem = /** @type {Buffer} */ diff --git a/lib/serialization/FileMiddleware.js b/lib/serialization/FileMiddleware.js index 41b7da48391..16b0aa947b8 100644 --- a/lib/serialization/FileMiddleware.js +++ b/lib/serialization/FileMiddleware.js @@ -149,7 +149,7 @@ const serialize = async ( (options && options.name) || true, writeFile, hashFunction - ).then(result => { + ).then((result) => { /** @type {LazyOptions} */ (item.options).size = result.size; resultToLazy.set(result, item); @@ -175,7 +175,7 @@ const serialize = async ( } /** @type {BackgroundJob[]} */ const backgroundJobs = []; - const resolvedData = (await Promise.all(processedData)).map(item => { + const resolvedData = (await Promise.all(processedData)).map((item) => { if (Array.isArray(item) || Buffer.isBuffer(item)) return item; backgroundJobs.push( @@ -265,7 +265,7 @@ const deserialize = async (middleware, name, readFile) => { /** * @param {number} n number of bytes to ensure */ - const ensureData = n => { + const ensureData = (n) => { if (contentPosition === contentItemLength) { nextContent(); } @@ -314,7 +314,7 @@ const deserialize = async (middleware, name, readFile) => { * @param {number} l length * @returns {Buffer} buffer */ - const readSlice = l => { + const readSlice = (l) => { ensureData(l); if (contentPosition === 0 && contentItemLength === l) { const result = contentItem; @@ -448,7 +448,7 @@ class FileMiddleware extends SerializerMiddleware { serialize(data, context) { const { filename, extension = "" } = context; return new Promise((resolve, reject) => { - mkdirp(this.fs, dirname(this.fs, filename), err => { + mkdirp(this.fs, dirname(this.fs, filename), (err) => { if (err) return reject(err); // It's important that we don't touch existing files during serialization @@ -493,7 +493,7 @@ class FileMiddleware extends SerializerMiddleware { stream = compression; stream.on("finish", () => resolve()); } else { - stream.on("error", err => reject(err)); + stream.on("error", (err) => reject(err)); stream.on("finish", () => resolve()); } // split into chunks for WRITE_LIMIT_CHUNK size @@ -514,7 +514,7 @@ class FileMiddleware extends SerializerMiddleware { /** * @param {(Error | null)=} err err */ - const batchWrite = err => { + const batchWrite = (err) => { // will be handled in "on" error handler if (err) return; @@ -553,8 +553,8 @@ class FileMiddleware extends SerializerMiddleware { /** * @param {(value?: undefined) => void} resolve resolve */ - resolve => { - this.fs.rename(filename, `${filename}.old`, _err => { + (resolve) => { + this.fs.rename(filename, `${filename}.old`, (_err) => { resolve(); }); } @@ -564,7 +564,7 @@ class FileMiddleware extends SerializerMiddleware { await Promise.all( Array.from( allWrittenFiles, - file => + (file) => new Promise( /** * @param {(value?: undefined) => void} resolve resolve @@ -572,7 +572,7 @@ class FileMiddleware extends SerializerMiddleware { * @returns {void} */ (resolve, reject) => { - this.fs.rename(`${file}_`, file, err => { + this.fs.rename(`${file}_`, file, (err) => { if (err) return reject(err); resolve(); }); @@ -587,8 +587,8 @@ class FileMiddleware extends SerializerMiddleware { * @param {(value?: undefined) => void} resolve resolve * @returns {void} */ - resolve => { - this.fs.rename(`${filename}_`, filename, err => { + (resolve) => { + this.fs.rename(`${filename}_`, filename, (err) => { if (err) return reject(err); resolve(); }); @@ -613,7 +613,7 @@ class FileMiddleware extends SerializerMiddleware { * @param {string | boolean} name name * @returns {Promise} result */ - const readFile = name => + const readFile = (name) => new Promise((resolve, reject) => { const file = name ? join(this.fs, filename, `../${name}${extension}`) @@ -661,9 +661,9 @@ class FileMiddleware extends SerializerMiddleware { * @param {(reason?: Error) => void} reject reject */ (resolve, reject) => { - decompression.on("data", chunk => buf.push(chunk)); + decompression.on("data", (chunk) => buf.push(chunk)); decompression.on("end", () => resolve()); - decompression.on("error", err => reject(err)); + decompression.on("error", (err) => reject(err)); } ) ]).then(() => buf) @@ -735,7 +735,7 @@ class FileMiddleware extends SerializerMiddleware { if (decompression) { decompression.end(); } - this.fs.close(fd, err => { + this.fs.close(fd, (err) => { if (err) { reject(err); return; diff --git a/lib/serialization/ObjectMiddleware.js b/lib/serialization/ObjectMiddleware.js index affa9306b48..9a414cd2c85 100644 --- a/lib/serialization/ObjectMiddleware.js +++ b/lib/serialization/ObjectMiddleware.js @@ -343,7 +343,7 @@ class ObjectMiddleware extends SerializerMiddleware { /** * @param {ReferenceableItem} item referenceable item */ - const addReferenceable = item => { + const addReferenceable = (item) => { referenceable.set(item, currentPos++); }; let bufferDedupeMap = new Map(); @@ -351,7 +351,7 @@ class ObjectMiddleware extends SerializerMiddleware { * @param {Buffer} buf buffer * @returns {Buffer} deduped buffer */ - const dedupeBuffer = buf => { + const dedupeBuffer = (buf) => { const len = buf.length; const entry = bufferDedupeMap.get(len); if (entry === undefined) { @@ -415,11 +415,11 @@ class ObjectMiddleware extends SerializerMiddleware { * @param {Value} item item to stack * @returns {string} stack */ - const stackToString = item => { + const stackToString = (item) => { const arr = [...cycleStack]; arr.push(item); return arr - .map(item => { + .map((item) => { if (typeof item === "string") { if (item.length > 100) { return `String ${JSON.stringify(item.slice(0, 100)).slice( @@ -513,7 +513,7 @@ class ObjectMiddleware extends SerializerMiddleware { /** * @param {Value} item item to serialize */ - const process = item => { + const process = (item) => { if (Buffer.isBuffer(item)) { // check if we can emit a reference const ref = referenceable.get(item); @@ -616,7 +616,7 @@ class ObjectMiddleware extends SerializerMiddleware { } else if (SerializerMiddleware.isLazy(item, this)) { throw new Error("Not implemented"); } else { - const data = SerializerMiddleware.serializeLazy(item, data => + const data = SerializerMiddleware.serializeLazy(item, (data) => this.serialize([data], context) ); SerializerMiddleware.setLazySerializedValue(item, data); @@ -679,7 +679,7 @@ class ObjectMiddleware extends SerializerMiddleware { /** * @param {Value} item referenceable item */ - const addReferenceable = item => { + const addReferenceable = (item) => { referenceable.push(item); currentPos++; }; @@ -811,7 +811,7 @@ class ObjectMiddleware extends SerializerMiddleware { } else if (typeof item === "function") { return SerializerMiddleware.deserializeLazy( item, - data => + (data) => /** @type {[DeserializedType]} */ (this.deserialize(data, context))[0] ); diff --git a/lib/serialization/Serializer.js b/lib/serialization/Serializer.js index cf4a68a5222..a3cafc3b3b5 100644 --- a/lib/serialization/Serializer.js +++ b/lib/serialization/Serializer.js @@ -42,7 +42,7 @@ class Serializer { ) { current = /** @type {Promise} */ - (current).then(data => data && middleware.serialize(data, ctx)); + (current).then((data) => data && middleware.serialize(data, ctx)); } else if (current) { try { current = middleware.serialize(current, ctx); @@ -70,7 +70,7 @@ class Serializer { current && typeof (/** @type {Promise} */ (current).then) === "function" - ? /** @type {Promise} */ (current).then(data => + ? /** @type {Promise} */ (current).then((data) => middleware.deserialize(data, ctx) ) : middleware.deserialize(current, ctx); diff --git a/lib/serialization/SerializerMiddleware.js b/lib/serialization/SerializerMiddleware.js index fce70d10a9d..91e8bdff9df 100644 --- a/lib/serialization/SerializerMiddleware.js +++ b/lib/serialization/SerializerMiddleware.js @@ -153,7 +153,7 @@ class SerializerMiddleware { ) { return ( /** @type {Promise} */ - (r).then(data => data && serialize(data)) + (r).then((data) => data && serialize(data)) ); } return serialize(/** @type {TLazyInputValue} */ (r)); @@ -187,7 +187,7 @@ class SerializerMiddleware { ) { return ( /** @type {Promise} */ - (r).then(data => deserialize(data)) + (r).then((data) => deserialize(data)) ); } return deserialize(/** @type {TLazyInputValue} */ (r)); diff --git a/lib/sharing/ConsumeSharedPlugin.js b/lib/sharing/ConsumeSharedPlugin.js index c1611259c86..767fcd126c5 100644 --- a/lib/sharing/ConsumeSharedPlugin.js +++ b/lib/sharing/ConsumeSharedPlugin.js @@ -148,7 +148,7 @@ class ConsumeSharedPlugin { /** * @param {string} details details */ - const requiredVersionWarning = details => { + const requiredVersionWarning = (details) => { const error = new WebpackError( `No required version specified and unable to automatically determine one. ${details}` ); @@ -163,7 +163,7 @@ class ConsumeSharedPlugin { /** * @param {(value?: string) => void} resolve resolve */ - resolve => { + (resolve) => { if (!config.import) { resolve(); return; @@ -208,7 +208,7 @@ class ConsumeSharedPlugin { /** * @param {(value?: SemVerRange) => void} resolve resolve */ - resolve => { + (resolve) => { if (config.requiredVersion !== undefined) { resolve(/** @type {SemVerRange} */ (config.requiredVersion)); return; @@ -276,7 +276,7 @@ class ConsumeSharedPlugin { resolve(); }, - result => { + (result) => { if (!result) return false; const maybeRequiredVersion = getRequiredVersionFromDescriptionFile( diff --git a/lib/sharing/ProvideSharedPlugin.js b/lib/sharing/ProvideSharedPlugin.js index d08c4693b23..5ad4c3d08ea 100644 --- a/lib/sharing/ProvideSharedPlugin.js +++ b/lib/sharing/ProvideSharedPlugin.js @@ -48,7 +48,7 @@ class ProvideSharedPlugin { this._provides = /** @type {[string, ProvideOptions][]} */ ( parseOptions( options.provides, - item => { + (item) => { if (Array.isArray(item)) { throw new Error("Unexpected array of provides"); } @@ -61,7 +61,7 @@ class ProvideSharedPlugin { }; return result; }, - item => ({ + (item) => ({ shareKey: item.shareKey, version: item.version, shareScope: item.shareScope || options.shareScope || "default", @@ -199,7 +199,7 @@ class ProvideSharedPlugin { ); } ); - compiler.hooks.finishMake.tapPromise(PLUGIN_NAME, compilation => { + compiler.hooks.finishMake.tapPromise(PLUGIN_NAME, (compilation) => { const resolvedProvideMap = compilationData.get(compilation); if (!resolvedProvideMap) return Promise.resolve(); return Promise.all( @@ -219,7 +219,7 @@ class ProvideSharedPlugin { { name: undefined }, - err => { + (err) => { if (err) return reject(err); resolve(null); } diff --git a/lib/sharing/SharePlugin.js b/lib/sharing/SharePlugin.js index 0c2c610a9be..d447cdbc742 100644 --- a/lib/sharing/SharePlugin.js +++ b/lib/sharing/SharePlugin.js @@ -42,7 +42,7 @@ class SharePlugin { }; return config; }, - item => item + (item) => item ); /** @type {Record[]} */ const consumes = sharedOptions.map(([key, options]) => ({ diff --git a/lib/sharing/resolveMatchedConfigs.js b/lib/sharing/resolveMatchedConfigs.js index a54a76abb41..7fd74655218 100644 --- a/lib/sharing/resolveMatchedConfigs.js +++ b/lib/sharing/resolveMatchedConfigs.js @@ -51,7 +51,7 @@ module.exports.resolveMatchedConfigs = (compilation, configs) => { configs.map(([request, config]) => { if (/^\.\.?(\/|$)/.test(request)) { // relative request - return new Promise(resolve => { + return new Promise((resolve) => { resolver.resolve( {}, context, diff --git a/lib/stats/DefaultStatsFactoryPlugin.js b/lib/stats/DefaultStatsFactoryPlugin.js index 2e71085ad3b..28d3d333f6d 100644 --- a/lib/stats/DefaultStatsFactoryPlugin.js +++ b/lib/stats/DefaultStatsFactoryPlugin.js @@ -64,7 +64,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsCompilation & Record} StatsCompilation */ /** * @typedef {object} KnownStatsCompilation - * @property {Record=} env + * @property {EXPECTED_ANY=} env * @property {string=} name * @property {string=} hash * @property {string=} version @@ -556,19 +556,19 @@ const SIMPLE_EXTRACTORS = { } if (!context.cachedGetErrors) { const map = new WeakMap(); - context.cachedGetErrors = compilation => + context.cachedGetErrors = (compilation) => map.get(compilation) || // eslint-disable-next-line no-sequences - (errors => (map.set(compilation, errors), errors))( + ((errors) => (map.set(compilation, errors), errors))( compilation.getErrors() ); } if (!context.cachedGetWarnings) { const map = new WeakMap(); - context.cachedGetWarnings = compilation => + context.cachedGetWarnings = (compilation) => map.get(compilation) || // eslint-disable-next-line no-sequences - (warnings => (map.set(compilation, warnings), warnings))( + ((warnings) => (map.set(compilation, warnings), warnings))( compilation.getWarnings() ); } @@ -639,7 +639,7 @@ const SIMPLE_EXTRACTORS = { ); let depthInCollapsedGroup = 0; for (const [origin, logEntries] of compilation.logging) { - const debugMode = loggingDebug.some(fn => fn(origin)); + const debugMode = loggingDebug.some((fn) => fn(origin)); if (logging === false && !debugMode) continue; /** @type {KnownStatsLoggingEntry[]} */ const groupStack = []; @@ -724,7 +724,7 @@ const SIMPLE_EXTRACTORS = { hash: (object, compilation) => { object.hash = /** @type {string} */ (compilation.hash); }, - version: object => { + version: (object) => { object.version = require("../../package.json").version; }, env: (object, compilation, context, { _env }) => { @@ -913,7 +913,7 @@ const SIMPLE_EXTRACTORS = { let filtered = 0; if (options.errorDetails === "auto" && rawErrors.length >= 3) { filtered = rawErrors - .map(e => typeof e !== "string" && e.details) + .map((e) => typeof e !== "string" && e.details) .filter(Boolean).length; } if ( @@ -933,7 +933,7 @@ const SIMPLE_EXTRACTORS = { object.errors = errors; }, errorsCount: (object, compilation, { cachedGetErrors }) => { - object.errorsCount = countWithChildren(compilation, c => + object.errorsCount = countWithChildren(compilation, (c) => cachedGetErrors(c) ); }, @@ -947,7 +947,7 @@ const SIMPLE_EXTRACTORS = { let filtered = 0; if (options.errorDetails === "auto") { filtered = cachedGetWarnings(compilation) - .map(e => typeof e !== "string" && e.details) + .map((e) => typeof e !== "string" && e.details) .filter(Boolean).length; } if ( @@ -990,14 +990,14 @@ const SIMPLE_EXTRACTORS = { * @param {StatsError} warning warning * @returns {boolean} result */ - warning => { + (warning) => { const warningString = Object.keys(warning) .map( - key => + (key) => `${warning[/** @type {keyof KnownStatsError} */ (key)]}` ) .join("\n"); - return !warningsFilter.some(filter => + return !warningsFilter.some((filter) => filter(warning, warningString) ); } @@ -1045,22 +1045,22 @@ const SIMPLE_EXTRACTORS = { compilationAuxiliaryFileToChunks.get(asset.name) || []; object.chunkNames = uniqueOrderedArray( chunks, - c => (c.name ? [c.name] : []), + (c) => (c.name ? [c.name] : []), compareIds ); object.chunkIdHints = uniqueOrderedArray( chunks, - c => [...c.idNameHints], + (c) => [...c.idNameHints], compareIds ); object.auxiliaryChunkNames = uniqueOrderedArray( auxiliaryChunks, - c => (c.name ? [c.name] : []), + (c) => (c.name ? [c.name] : []), compareIds ); object.auxiliaryChunkIdHints = uniqueOrderedArray( auxiliaryChunks, - c => [...c.idNameHints], + (c) => [...c.idNameHints], compareIds ); object.filteredRelated = asset.related ? asset.related.length : undefined; @@ -1087,12 +1087,12 @@ const SIMPLE_EXTRACTORS = { compilationAuxiliaryFileToChunks.get(asset.name) || []; object.chunks = uniqueOrderedArray( chunks, - c => /** @type {ChunkId[]} */ (c.ids), + (c) => /** @type {ChunkId[]} */ (c.ids), compareIds ); object.auxiliaryChunks = uniqueOrderedArray( auxiliaryChunks, - c => /** @type {ChunkId[]} */ (c.ids), + (c) => /** @type {ChunkId[]} */ (c.ids), compareIds ); }, @@ -1114,7 +1114,7 @@ const SIMPLE_EXTRACTORS = { * @param {string} name Name * @returns {{ name: string, size: number }} Asset object */ - const toAsset = name => { + const toAsset = (name) => { const asset = compilation.getAsset(name); return { name, @@ -1123,10 +1123,12 @@ const SIMPLE_EXTRACTORS = { }; /** @type {(total: number, asset: { size: number }) => number} */ const sizeReducer = (total, { size }) => total + size; - const assets = uniqueArray(chunkGroup.chunks, c => c.files).map(toAsset); + const assets = uniqueArray(chunkGroup.chunks, (c) => c.files).map( + toAsset + ); const auxiliaryAssets = uniqueOrderedArray( chunkGroup.chunks, - c => c.auxiliaryFiles, + (c) => c.auxiliaryFiles, compareIds ).map(toAsset); const assetsSize = assets.reduce(sizeReducer, 0); @@ -1135,7 +1137,7 @@ const SIMPLE_EXTRACTORS = { const statsChunkGroup = { name, chunks: ids - ? /** @type {ChunkId[]} */ (chunkGroup.chunks.map(c => c.id)) + ? /** @type {ChunkId[]} */ (chunkGroup.chunks.map((c) => c.id)) : undefined, assets: assets.length <= chunkGroupMaxAssets ? assets : undefined, filteredAssets: @@ -1151,14 +1153,14 @@ const SIMPLE_EXTRACTORS = { : auxiliaryAssets.length, auxiliaryAssetsSize, children: children - ? mapObject(children, groups => - groups.map(group => { - const assets = uniqueArray(group.chunks, c => c.files).map( + ? mapObject(children, (groups) => + groups.map((group) => { + const assets = uniqueArray(group.chunks, (c) => c.files).map( toAsset ); const auxiliaryAssets = uniqueOrderedArray( group.chunks, - c => c.auxiliaryFiles, + (c) => c.auxiliaryFiles, compareIds ).map(toAsset); @@ -1167,7 +1169,7 @@ const SIMPLE_EXTRACTORS = { name: group.name, chunks: ids ? /** @type {ChunkId[]} */ - (group.chunks.map(c => c.id)) + (group.chunks.map((c) => c.id)) : undefined, assets: assets.length <= chunkGroupMaxAssets ? assets : undefined, @@ -1190,7 +1192,7 @@ const SIMPLE_EXTRACTORS = { ) : undefined, childAssets: children - ? mapObject(children, groups => { + ? mapObject(children, (groups) => { /** @type {Set} */ const set = new Set(); for (const group of groups) { @@ -1314,7 +1316,7 @@ const SIMPLE_EXTRACTORS = { module, compareChunksById ), - chunk => chunk.id + (chunk) => chunk.id ) ); }, @@ -1369,7 +1371,7 @@ const SIMPLE_EXTRACTORS = { ) => { object.optimizationBailout = moduleGraph .getOptimizationBailout(module) - .map(item => { + .map((item) => { if (typeof item === "function") return item(requestShortener); return item; }); @@ -1579,7 +1581,7 @@ const SIMPLE_EXTRACTORS = { for (const g of chunk.groupsIterable) { origins.push(...g.origins); } - const array = origins.filter(origin => { + const array = origins.filter((origin) => { const key = [ origin.module ? chunkGraph.getModuleId(origin.module) : undefined, formatLocation(origin.loc), @@ -1626,8 +1628,8 @@ const SIMPLE_EXTRACTORS = { object.moduleIdentifier = module.identifier(); object.moduleName = module.readableIdentifier(requestShortener); const dependencies = [...moduleGraph.getIncomingConnections(module)] - .filter(c => c.resolvedOriginModule === origin && c.dependency) - .map(c => c.dependency); + .filter((c) => c.resolvedOriginModule === origin && c.dependency) + .map((c) => c.dependency); object.dependencies = factory.create( `${type}.dependencies`, /** @type {Dependency[]} */ @@ -1671,9 +1673,11 @@ const FILTER_RESULTS = { warningsFilter: util.deprecate( (warning, context, { warningsFilter }) => { const warningString = Object.keys(warning) - .map(key => `${warning[/** @type {keyof KnownStatsError} */ (key)]}`) + .map( + (key) => `${warning[/** @type {keyof KnownStatsError} */ (key)]}` + ) .join("\n"); - return !warningsFilter.some(filter => filter(warning, warningString)); + return !warningsFilter.some((filter) => filter(warning, warningString)); }, "config.stats.warningsFilter is deprecated in favor of config.ignoreWarnings", "DEP_WEBPACK_STATS_WARNINGS_FILTER" @@ -1685,9 +1689,9 @@ const FILTER_RESULTS = { const MODULES_SORTER = { _: (comparators, { compilation: { moduleGraph } }) => { comparators.push( - compareSelect(m => moduleGraph.getDepth(m), compareNumbers), - compareSelect(m => moduleGraph.getPreOrderIndex(m), compareNumbers), - compareSelect(m => m.identifier(), compareIds) + compareSelect((m) => moduleGraph.getDepth(m), compareNumbers), + compareSelect((m) => moduleGraph.getPreOrderIndex(m), compareNumbers), + compareSelect((m) => m.identifier(), compareIds) ); } }; @@ -1695,8 +1699,8 @@ const MODULES_SORTER = { /** @type {Record[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>>} */ const SORTERS = { "compilation.chunks": { - _: comparators => { - comparators.push(compareSelect(c => c.id, compareIds)); + _: (comparators) => { + comparators.push(compareSelect((c) => c.id, compareIds)); } }, "compilation.modules": MODULES_SORTER, @@ -1706,24 +1710,24 @@ const SORTERS = { "module.reasons": { _: (comparators, _context) => { comparators.push( - compareSelect(x => x.originModule, compareModulesByIdentifier) + compareSelect((x) => x.originModule, compareModulesByIdentifier) ); comparators.push( - compareSelect(x => x.resolvedOriginModule, compareModulesByIdentifier) + compareSelect((x) => x.resolvedOriginModule, compareModulesByIdentifier) ); comparators.push( compareSelect( - x => x.dependency, + (x) => x.dependency, concatComparators( compareSelect( /** * @param {Dependency} x dependency * @returns {DependencyLocation} location */ - x => x.loc, + (x) => x.loc, compareLocations ), - compareSelect(x => x.type, compareIds) + compareSelect((x) => x.type, compareIds) ) ) ); @@ -1733,12 +1737,12 @@ const SORTERS = { _: (comparators, { compilation: { chunkGraph } }) => { comparators.push( compareSelect( - origin => + (origin) => origin.module ? chunkGraph.getModuleId(origin.module) : undefined, compareIds ), - compareSelect(origin => formatLocation(origin.loc), compareIds), - compareSelect(origin => origin.request, compareIds) + compareSelect((origin) => formatLocation(origin.loc), compareIds), + compareSelect((origin) => origin.request, compareIds) ); } } @@ -1754,7 +1758,7 @@ const SORTERS = { * @param {Children} item item * @returns {number} item size */ -const getItemSize = item => +const getItemSize = (item) => // Each item takes 1 line // + the size of the children // + 1 extra line when it has children and filteredChildren @@ -1769,7 +1773,7 @@ const getItemSize = item => * @param {Children[]} children children * @returns {number} total size */ -const getTotalSize = children => { +const getTotalSize = (children) => { let size = 0; for (const child of children) { size += getItemSize(child); @@ -1782,7 +1786,7 @@ const getTotalSize = children => { * @param {Children[]} children children * @returns {number} total items */ -const getTotalItems = children => { +const getTotalItems = (children) => { let count = 0; for (const child of children) { if (!child.children && !child.filteredChildren) { @@ -1800,7 +1804,7 @@ const getTotalItems = children => { * @param {Children[]} children children * @returns {Children[]} collapsed children */ -const collapse = children => { +const collapse = (children) => { // After collapse each child must take exactly one line const newChildren = []; for (const child of children) { @@ -1957,7 +1961,7 @@ const errorsSpaceLimit = (errors, max) => { // print only messages if (errors.length + 1 >= max) { return [ - errors.map(error => { + errors.map((error) => { if (typeof error === "string" || !error.details) return error; filtered++; return { ...error, details: "" }; @@ -2076,7 +2080,7 @@ const ASSETS_GROUPERS = { */ const groupByFlag = (name, exclude) => { groupConfigs.push({ - getKeys: asset => (asset[name] ? ["1"] : undefined), + getKeys: (asset) => (asset[name] ? ["1"] : undefined), getOptions: () => ({ groupChildren: !exclude, force: exclude @@ -2112,7 +2116,7 @@ const ASSETS_GROUPERS = { } if (groupAssetsByPath || groupAssetsByExtension) { groupConfigs.push({ - getKeys: asset => { + getKeys: (asset) => { const extensionMatch = groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name); const extension = extensionMatch ? extensionMatch[1] : ""; @@ -2152,9 +2156,10 @@ const ASSETS_GROUPERS = { /** * @param {string} name name */ - const groupByAssetInfoFlag = name => { + const groupByAssetInfoFlag = (name) => { groupConfigs.push({ - getKeys: asset => (asset.info && asset.info[name] ? ["1"] : undefined), + getKeys: (asset) => + asset.info && asset.info[name] ? ["1"] : undefined, createGroup: (key, children, assets) => ({ type: "assets by info", info: { @@ -2173,9 +2178,9 @@ const ASSETS_GROUPERS = { /** * @param {keyof KnownStatsAsset} name name */ - const groupByNames = name => { + const groupByNames = (name) => { groupConfigs.push({ - getKeys: asset => /** @type {string[]} */ (asset[name]), + getKeys: (asset) => /** @type {string[]} */ (asset[name]), createGroup: (key, children, assets) => ({ type: "assets by chunk", [name]: [key], @@ -2191,9 +2196,9 @@ const ASSETS_GROUPERS = { }, excludeAssets: (groupConfigs, context, { excludeAssets }) => { groupConfigs.push({ - getKeys: asset => { + getKeys: (asset) => { const ident = asset.name; - const excluded = excludeAssets.some(fn => fn(ident, asset)); + const excluded = excludeAssets.some((fn) => fn(ident, asset)); if (excluded) return ["excluded"]; }, getOptions: () => ({ @@ -2212,7 +2217,7 @@ const ASSETS_GROUPERS = { /** @typedef {Record[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>} ModulesGroupers */ /** @type {(type: ExcludeModulesType) => ModulesGroupers} */ -const MODULES_GROUPERS = type => ({ +const MODULES_GROUPERS = (type) => ({ _: (groupConfigs, context, options) => { /** * @param {keyof KnownStatsModule} name name @@ -2221,7 +2226,7 @@ const MODULES_GROUPERS = type => ({ */ const groupByFlag = (name, type, exclude) => { groupConfigs.push({ - getKeys: module => (module[name] ? ["1"] : undefined), + getKeys: (module) => (module[name] ? ["1"] : undefined), getOptions: () => ({ groupChildren: !exclude, force: exclude @@ -2264,7 +2269,7 @@ const MODULES_GROUPERS = type => ({ } if (groupModulesByType || !options.runtimeModules) { groupConfigs.push({ - getKeys: module => { + getKeys: (module) => { if (!module.moduleType) return; if (groupModulesByType) { return [module.moduleType.split("/", 1)[0]]; @@ -2272,7 +2277,7 @@ const MODULES_GROUPERS = type => ({ return [WEBPACK_MODULE_TYPE_RUNTIME]; } }, - getOptions: key => { + getOptions: (key) => { const exclude = key === WEBPACK_MODULE_TYPE_RUNTIME && !options.runtimeModules; return { @@ -2294,7 +2299,7 @@ const MODULES_GROUPERS = type => ({ } if (groupModulesByLayer) { groupConfigs.push({ - getKeys: module => /** @type {string[]} */ ([module.layer]), + getKeys: (module) => /** @type {string[]} */ ([module.layer]), createGroup: (key, children, modules) => ({ type: "modules by layer", layer: key, @@ -2305,7 +2310,7 @@ const MODULES_GROUPERS = type => ({ } if (groupModulesByPath || groupModulesByExtension) { groupConfigs.push({ - getKeys: module => { + getKeys: (module) => { if (!module.name) return; const resource = parseResource( /** @type {string} */ (module.name.split("!").pop()) @@ -2354,10 +2359,10 @@ const MODULES_GROUPERS = type => ({ }, excludeModules: (groupConfigs, context, { excludeModules }) => { groupConfigs.push({ - getKeys: module => { + getKeys: (module) => { const name = module.name; if (name) { - const excluded = excludeModules.some(fn => fn(name, module, type)); + const excluded = excludeModules.some((fn) => fn(name, module, type)); if (excluded) return ["1"]; } }, @@ -2378,9 +2383,9 @@ const MODULES_GROUPERS = type => ({ /** @type {ModuleReasonsGroupers} */ const MODULE_REASONS_GROUPERS = { - groupReasonsByOrigin: groupConfigs => { + groupReasonsByOrigin: (groupConfigs) => { groupConfigs.push({ - getKeys: reason => /** @type {string[]} */ ([reason.module]), + getKeys: (reason) => /** @type {string[]} */ ([reason.module]), createGroup: (key, children, reasons) => ({ type: "from origin", module: key, @@ -2407,7 +2412,7 @@ const RESULT_GROUPERS = { * @param {string} field a field name * @returns {field} normalized field */ -const normalizeFieldKey = field => { +const normalizeFieldKey = (field) => { if (field[0] === "!") { return field.slice(1); } @@ -2419,7 +2424,7 @@ const normalizeFieldKey = field => { * @param {string} field a field name * @returns {boolean} result */ -const sortOrderRegular = field => { +const sortOrderRegular = (field) => { if (field[0] === "!") { return false; } @@ -2431,7 +2436,7 @@ const sortOrderRegular = field => { * @param {string | false} field field name * @returns {(a: T, b: T) => 0 | 1 | -1} comparators */ -const sortByField = field => { +const sortByField = (field) => { if (!field) { /** * @param {T} a first @@ -2444,7 +2449,7 @@ const sortByField = field => { const fieldKey = normalizeFieldKey(field); - let sortFn = compareSelect(m => m[fieldKey], compareIds); + let sortFn = compareSelect((m) => m[fieldKey], compareIds); // if a field is prefixed with a "!" the sort is reversed! const sortIsRegular = sortOrderRegular(field); @@ -2462,8 +2467,8 @@ const ASSET_SORTERS = { assetsSort: (comparators, context, { assetsSort }) => { comparators.push(sortByField(assetsSort)); }, - _: comparators => { - comparators.push(compareSelect(a => a.name, compareIds)); + _: (comparators) => { + comparators.push(compareSelect((a) => a.name, compareIds)); } }; @@ -2557,7 +2562,7 @@ const ITEM_NAMES = { * @param {T[]} items items to be merged * @returns {NamedObject} an object */ -const mergeToObject = items => { +const mergeToObject = (items) => { const obj = Object.create(null); for (const item of items) { obj[item.name] = item; @@ -2583,7 +2588,7 @@ class DefaultStatsFactoryPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.statsFactory.tap( PLUGIN_NAME, /** diff --git a/lib/stats/DefaultStatsPresetPlugin.js b/lib/stats/DefaultStatsPresetPlugin.js index 7d5ed61db7f..016e7d5064a 100644 --- a/lib/stats/DefaultStatsPresetPlugin.js +++ b/lib/stats/DefaultStatsPresetPlugin.js @@ -144,31 +144,31 @@ const NAMED_PRESETS = { }; /** - * @param {Partial} all stats option + * @param {Partial} all stats options * @returns {boolean} true when enabled, otherwise false */ const NORMAL_ON = ({ all }) => all !== false; /** - * @param {Partial} all stats option + * @param {Partial} all stats options * @returns {boolean} true when enabled, otherwise false */ const NORMAL_OFF = ({ all }) => all === true; /** - * @param {Partial} all stats option + * @param {Partial} all stats options * @param {CreateStatsOptionsContext} forToString stats options context * @returns {boolean} true when enabled, otherwise false */ const ON_FOR_TO_STRING = ({ all }, { forToString }) => forToString ? all !== false : all === true; /** - * @param {Partial} all stats option + * @param {Partial} all stats options * @param {CreateStatsOptionsContext} forToString stats options context * @returns {boolean} true when enabled, otherwise false */ const OFF_FOR_TO_STRING = ({ all }, { forToString }) => forToString ? all === true : all !== false; /** - * @param {Partial} all stats option + * @param {Partial} all stats options * @param {CreateStatsOptionsContext} forToString stats options context * @returns {boolean | "auto"} true when enabled, otherwise false */ @@ -289,15 +289,15 @@ const DEFAULTS = { * @param {string | ({ test: (value: T) => boolean }) | ((value: T, ...args: EXPECTED_ANY[]) => boolean) | boolean} item item to normalize * @returns {(value: T, ...args: EXPECTED_ANY[]) => boolean} normalize fn */ -const normalizeFilter = item => { +const normalizeFilter = (item) => { if (typeof item === "string") { const regExp = new RegExp( `[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)` ); - return ident => regExp.test(/** @type {T} */ (ident)); + return (ident) => regExp.test(/** @type {T} */ (ident)); } if (item && typeof item === "object" && typeof item.test === "function") { - return ident => item.test(ident); + return (ident) => item.test(ident); } if (typeof item === "boolean") { return () => item; @@ -311,7 +311,7 @@ const normalizeFilter = item => { /** @type {Normalizers} */ const NORMALIZER = { - excludeModules: value => { + excludeModules: (value) => { if (!Array.isArray(value)) { value = value ? /** @type {KnownNormalizedStatsOptions["excludeModules"]} */ ([value]) @@ -319,13 +319,13 @@ const NORMALIZER = { } return value.map(normalizeFilter); }, - excludeAssets: value => { + excludeAssets: (value) => { if (!Array.isArray(value)) { value = value ? [value] : []; } return value.map(normalizeFilter); }, - warningsFilter: value => { + warningsFilter: (value) => { if (!Array.isArray(value)) { value = value ? [value] : []; } @@ -340,7 +340,7 @@ const NORMALIZER = { * @param {StatsOptions["warningsFilter"]} filter a warning filter * @returns {WarningFilterFn} result */ - filter => { + (filter) => { if (typeof filter === "string") { return (warning, warningString) => warningString.includes(filter); } @@ -356,11 +356,11 @@ const NORMALIZER = { } ); }, - logging: value => { + logging: (value) => { if (value === true) value = "log"; return /** @type {KnownNormalizedStatsOptions["logging"]} */ (value); }, - loggingDebug: value => { + loggingDebug: (value) => { if (!Array.isArray(value)) { value = value ? /** @type {KnownNormalizedStatsOptions["loggingDebug"]} */ ([value]) @@ -379,7 +379,7 @@ class DefaultStatsPresetPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { for (const key of Object.keys(NAMED_PRESETS)) { const defaults = NAMED_PRESETS[/** @type {keyof NamedPresets} */ (key)]; compilation.hooks.statsPreset diff --git a/lib/stats/DefaultStatsPrinterPlugin.js b/lib/stats/DefaultStatsPrinterPlugin.js index accddc5d287..86c5c45deee 100644 --- a/lib/stats/DefaultStatsPrinterPlugin.js +++ b/lib/stats/DefaultStatsPrinterPlugin.js @@ -51,10 +51,10 @@ const plural = (n, singular, plural) => (n === 1 ? singular : plural); * @param {StatsPrinterContext} options options * @returns {string | undefined} text */ -const printSizes = (sizes, { formatSize = n => `${n}` }) => { +const printSizes = (sizes, { formatSize = (n) => `${n}` }) => { const keys = Object.keys(sizes); if (keys.length > 1) { - return keys.map(key => `${formatSize(sizes[key])} (${key})`).join(" "); + return keys.map((key) => `${formatSize(sizes[key])} (${key})`).join(" "); } else if (keys.length === 1) { return formatSize(sizes[keys[0]]); } @@ -64,7 +64,7 @@ const printSizes = (sizes, { formatSize = n => `${n}` }) => { * @param {string | null} resource resource * @returns {string} resource name for display */ -const getResourceName = resource => { +const getResourceName = (resource) => { if (!resource) return ""; const dataUrl = /^data:[^,]+,/.exec(resource); if (!dataUrl) return resource; @@ -81,7 +81,7 @@ const getResourceName = resource => { * @param {string} name module name * @returns {[string,string]} prefix and module name */ -const getModuleName = name => { +const getModuleName = (name) => { const [, prefix, resource] = /** @type {[string, string, string]} */ (/** @type {unknown} */ (/^(.*!)?([^!]*)$/.exec(name))); @@ -112,13 +112,13 @@ const mapLines = (str, fn) => str.split("\n").map(fn).join("\n"); * @param {number} n a number * @returns {string} number as two digit string, leading 0 */ -const twoDigit = n => (n >= 10 ? `${n}` : `0${n}`); +const twoDigit = (n) => (n >= 10 ? `${n}` : `0${n}`); /** * @param {string | number | null} id an id * @returns {id is string | number} is i */ -const isValidId = id => { +const isValidId = (id) => { if (typeof id === "number" || id) { return true; } @@ -281,7 +281,7 @@ const COMPILATION_SIMPLE_PRINTERS = { return `${builtAtMessage}${subjectMessage} ${statusMessage}${timeMessage}${hashMessage}`; } }, - "compilation.filteredWarningDetailsCount": count => + "compilation.filteredWarningDetailsCount": (count) => count ? `${count} ${plural( count, @@ -320,7 +320,7 @@ const COMPILATION_SIMPLE_PRINTERS = { let chunkGroups = Object.values(namedChunkGroups); if (entrypoints) { chunkGroups = chunkGroups.filter( - group => + (group) => !Object.prototype.hasOwnProperty.call( entrypoints, /** @type {string} */ @@ -428,7 +428,7 @@ const COMPILATION_SIMPLE_PRINTERS = { /** @type {AssetSimplePrinters} */ const ASSET_SIMPLE_PRINTERS = { - "asset.type": type => type, + "asset.type": (type) => type, "asset.name": (name, { formatFilename, asset: { isOverSizeLimit } }) => formatFilename(name, isOverSizeLimit), "asset.size": (size, { asset: { isOverSizeLimit }, yellow, formatSize }) => @@ -474,8 +474,8 @@ const ASSET_SIMPLE_PRINTERS = { assetChunk: (id, { formatChunkId }) => formatChunkId(id), - assetChunkName: name => name || undefined, - assetChunkIdHint: name => name || undefined + assetChunkName: (name) => name || undefined, + assetChunkIdHint: (name) => name || undefined }; /** @@ -487,14 +487,14 @@ const ASSET_SIMPLE_PRINTERS = { /** @type {ModuleSimplePrinters} */ const MODULE_SIMPLE_PRINTERS = { - "module.type": type => (type !== "module" ? type : undefined), + "module.type": (type) => (type !== "module" ? type : undefined), "module.id": (id, { formatModuleId }) => isValidId(id) ? formatModuleId(id) : undefined, "module.name": (name, { bold }) => { const [prefix, resource] = getModuleName(name); return `${prefix || ""}${bold(resource || "")}`; }, - "module.identifier": _identifier => undefined, + "module.identifier": (_identifier) => undefined, "module.layer": (layer, { formatLayer }) => layer ? formatLayer(layer) : undefined, "module.sizes": printSizes, @@ -571,7 +571,7 @@ const MODULE_SIMPLE_PRINTERS = { yellow(optimizationBailout), "module.issuerPath": (issuerPath, { module }) => module.profile ? undefined : "", - "module.profile": _profile => undefined, + "module.profile": (_profile) => undefined, "module.filteredModules": (filteredModules, { module: { modules } }) => filteredModules > 0 ? `${moreCount(modules, filteredModules)} nested ${plural( @@ -617,14 +617,14 @@ const MODULE_ISSUER_PRINTERS = { /** @type {ModuleReasonsPrinters} */ const MODULE_REASON_PRINTERS = { - "moduleReason.type": type => type || undefined, + "moduleReason.type": (type) => type || undefined, "moduleReason.userRequest": (userRequest, { cyan }) => cyan(getResourceName(userRequest)), "moduleReason.moduleId": (moduleId, { formatModuleId }) => isValidId(moduleId) ? formatModuleId(moduleId) : undefined, "moduleReason.module": (module, { magenta }) => module ? magenta(module) : undefined, - "moduleReason.loc": loc => loc || undefined, + "moduleReason.loc": (loc) => loc || undefined, "moduleReason.explanation": (explanation, { cyan }) => explanation ? cyan(explanation) : undefined, "moduleReason.active": (active, { formatFlag }) => @@ -716,17 +716,17 @@ const CHUNK_GROUP_PRINTERS = { ? undefined : printer.print( context.type, - Object.keys(children).map(key => ({ + Object.keys(children).map((key) => ({ type: key, children: children[key] })), context ), - "chunkGroupChildGroup.type": type => `${type}:`, + "chunkGroupChildGroup.type": (type) => `${type}:`, "chunkGroupChild.assets[]": (file, { formatFilename }) => formatFilename(file), "chunkGroupChild.chunks[]": (id, { formatChunkId }) => formatChunkId(id), - "chunkGroupChild.name": name => (name ? `(name: ${name})` : undefined) + "chunkGroupChild.name": (name) => (name ? `(name: ${name})` : undefined) }; /** @@ -741,9 +741,9 @@ const CHUNK_GROUP_PRINTERS = { const CHUNK_PRINTERS = { "chunk.id": (id, { formatChunkId }) => formatChunkId(id), "chunk.files[]": (file, { formatFilename }) => formatFilename(file), - "chunk.names[]": name => name, - "chunk.idHints[]": name => name, - "chunk.runtime[]": name => name, + "chunk.names[]": (name) => name, + "chunk.idHints[]": (name) => name, + "chunk.runtime[]": (name) => name, "chunk.sizes": (sizes, context) => printSizes(sizes, context), "chunk.parents[]": (parents, context) => context.formatChunkId(parents, "parent"), @@ -756,13 +756,13 @@ const CHUNK_PRINTERS = { ? undefined : printer.print( context.type, - Object.keys(childrenByOrder).map(key => ({ + Object.keys(childrenByOrder).map((key) => ({ type: key, children: childrenByOrder[key] })), context ), - "chunk.childrenByOrder[].type": type => `${type}:`, + "chunk.childrenByOrder[].type": (type) => `${type}:`, "chunk.childrenByOrder[].children[]": (id, { formatChunkId }) => isValidId(id) ? formatChunkId(id) : undefined, "chunk.entry": (entry, { formatFlag, yellow }) => @@ -784,11 +784,11 @@ const CHUNK_PRINTERS = { : undefined, "chunk.separator!": () => "\n", - "chunkOrigin.request": request => request, + "chunkOrigin.request": (request) => request, "chunkOrigin.moduleId": (moduleId, { formatModuleId }) => isValidId(moduleId) ? formatModuleId(moduleId) : undefined, "chunkOrigin.moduleName": (moduleName, { bold }) => bold(moduleName), - "chunkOrigin.loc": loc => loc + "chunkOrigin.loc": (loc) => loc }; /** @@ -818,9 +818,9 @@ const ERROR_PRINTERS = { "error.message": (message, { bold, formatError }) => message.includes("\u001B[") ? message : bold(formatError(message)), "error.details": (details, { formatError }) => formatError(details), - "error.filteredDetails": filteredDetails => + "error.filteredDetails": (filteredDetails) => filteredDetails ? `+ ${filteredDetails} hidden lines` : undefined, - "error.stack": stack => stack, + "error.stack": (stack) => stack, "error.cause": (cause, context, printer) => cause ? indent( @@ -831,7 +831,7 @@ const ERROR_PRINTERS = { " " ) : undefined, - "error.moduleTrace": _moduleTrace => undefined, + "error.moduleTrace": (_moduleTrace) => undefined, "error.separator!": () => "\n" }; @@ -847,40 +847,40 @@ const ERROR_PRINTERS = { /** @type {LogEntryPrinters} */ const LOG_ENTRY_PRINTERS = { "loggingEntry(error).loggingEntry.message": (message, { red }) => - mapLines(message, x => ` ${red(x)}`), + mapLines(message, (x) => ` ${red(x)}`), "loggingEntry(warn).loggingEntry.message": (message, { yellow }) => - mapLines(message, x => ` ${yellow(x)}`), + mapLines(message, (x) => ` ${yellow(x)}`), "loggingEntry(info).loggingEntry.message": (message, { green }) => - mapLines(message, x => ` ${green(x)}`), + mapLines(message, (x) => ` ${green(x)}`), "loggingEntry(log).loggingEntry.message": (message, { bold }) => - mapLines(message, x => ` ${bold(x)}`), - "loggingEntry(debug).loggingEntry.message": message => - mapLines(message, x => ` ${x}`), - "loggingEntry(trace).loggingEntry.message": message => - mapLines(message, x => ` ${x}`), + mapLines(message, (x) => ` ${bold(x)}`), + "loggingEntry(debug).loggingEntry.message": (message) => + mapLines(message, (x) => ` ${x}`), + "loggingEntry(trace).loggingEntry.message": (message) => + mapLines(message, (x) => ` ${x}`), "loggingEntry(status).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => ` ${magenta(x)}`), + mapLines(message, (x) => ` ${magenta(x)}`), "loggingEntry(profile).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => `

${magenta(x)}`), + mapLines(message, (x) => `

${magenta(x)}`), "loggingEntry(profileEnd).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => `

${magenta(x)}`), + mapLines(message, (x) => `

${magenta(x)}`), "loggingEntry(time).loggingEntry.message": (message, { magenta }) => - mapLines(message, x => ` ${magenta(x)}`), + mapLines(message, (x) => ` ${magenta(x)}`), "loggingEntry(group).loggingEntry.message": (message, { cyan }) => - mapLines(message, x => `<-> ${cyan(x)}`), + mapLines(message, (x) => `<-> ${cyan(x)}`), "loggingEntry(groupCollapsed).loggingEntry.message": (message, { cyan }) => - mapLines(message, x => `<+> ${cyan(x)}`), + mapLines(message, (x) => `<+> ${cyan(x)}`), "loggingEntry(clear).loggingEntry": () => " -------", "loggingEntry(groupCollapsed).loggingEntry.children": () => "", - "loggingEntry.trace[]": trace => - trace ? mapLines(trace, x => `| ${x}`) : undefined, + "loggingEntry.trace[]": (trace) => + trace ? mapLines(trace, (x) => `| ${x}`) : undefined, - loggingGroup: loggingGroup => + loggingGroup: (loggingGroup) => loggingGroup.entries.length === 0 ? "" : undefined, "loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined), "loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`), "loggingGroup.separator!": () => "\n", - "loggingGroup.filteredEntries": filteredEntries => + "loggingGroup.filteredEntries": (filteredEntries) => filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined }; @@ -888,14 +888,14 @@ const LOG_ENTRY_PRINTERS = { /** @type {ModuleTraceItemPrinters} */ const MODULE_TRACE_ITEM_PRINTERS = { - "moduleTraceItem.originName": originName => originName + "moduleTraceItem.originName": (originName) => originName }; /** @typedef {Printers} ModuleTraceDependencyPrinters */ /** @type {ModuleTraceDependencyPrinters} */ const MODULE_TRACE_DEPENDENCY_PRINTERS = { - "moduleTraceDependency.loc": loc => loc + "moduleTraceDependency.loc": (loc) => loc }; /** @@ -932,9 +932,9 @@ const ITEM_NAMES = { "module.issuerPath[]": "moduleIssuer", "chunk.origins[]": "chunkOrigin", "chunk.modules[]": "module", - "loggingGroup.entries[]": logEntry => + "loggingGroup.entries[]": (logEntry) => `loggingEntry(${logEntry.type}).loggingEntry`, - "loggingEntry.children[]": logEntry => + "loggingEntry.children[]": (logEntry) => `loggingEntry(${logEntry.type}).loggingEntry`, "error.moduleTrace[]": "moduleTraceItem", "error.errors[]": "error", @@ -1135,19 +1135,19 @@ const PREFERRED_ORDERS = { /** @typedef {(items: string[]) => string | undefined} SimpleItemsJoiner */ /** @type {SimpleItemsJoiner} */ -const itemsJoinOneLine = items => items.filter(Boolean).join(" "); +const itemsJoinOneLine = (items) => items.filter(Boolean).join(" "); /** @type {SimpleItemsJoiner} */ -const itemsJoinOneLineBrackets = items => +const itemsJoinOneLineBrackets = (items) => items.length > 0 ? `(${items.filter(Boolean).join(" ")})` : undefined; /** @type {SimpleItemsJoiner} */ -const itemsJoinMoreSpacing = items => items.filter(Boolean).join("\n\n"); +const itemsJoinMoreSpacing = (items) => items.filter(Boolean).join("\n\n"); /** @type {SimpleItemsJoiner} */ -const itemsJoinComma = items => items.filter(Boolean).join(", "); +const itemsJoinComma = (items) => items.filter(Boolean).join(", "); /** @type {SimpleItemsJoiner} */ -const itemsJoinCommaBrackets = items => +const itemsJoinCommaBrackets = (items) => items.length > 0 ? `(${items.filter(Boolean).join(", ")})` : undefined; /** @type {(item: string) => SimpleItemsJoiner} */ -const itemsJoinCommaBracketsWithName = name => items => +const itemsJoinCommaBracketsWithName = (name) => (items) => items.length > 0 ? `(${name}: ${items.filter(Boolean).join(", ")})` : undefined; @@ -1176,18 +1176,18 @@ const SIMPLE_ITEMS_JOINER = { "asset.auxiliaryChunkIdHints": itemsJoinCommaBracketsWithName("auxiliary id hint"), "module.chunks": itemsJoinOneLine, - "module.issuerPath": items => + "module.issuerPath": (items) => items .filter(Boolean) - .map(item => `${item} ->`) + .map((item) => `${item} ->`) .join(" "), "compilation.errors": itemsJoinMoreSpacing, "compilation.warnings": itemsJoinMoreSpacing, "compilation.logging": itemsJoinMoreSpacing, - "compilation.children": items => + "compilation.children": (items) => indent(/** @type {string} */ (itemsJoinMoreSpacing(items)), " "), "moduleTraceItem.dependencies": itemsJoinOneLine, - "loggingEntry.children": items => + "loggingEntry.children": (items) => indent(items.filter(Boolean).join("\n"), " ", false) }; @@ -1195,9 +1195,9 @@ const SIMPLE_ITEMS_JOINER = { * @param {Item[]} items items * @returns {string} result */ -const joinOneLine = items => +const joinOneLine = (items) => items - .map(item => item.content) + .map((item) => item.content) .filter(Boolean) .join(" "); @@ -1205,7 +1205,7 @@ const joinOneLine = items => * @param {Item[]} items items * @returns {string} result */ -const joinInBrackets = items => { +const joinInBrackets = (items) => { const res = []; let mode = 0; for (const item of items) { @@ -1269,7 +1269,7 @@ const joinExplicitNewLine = (items, indenter) => { let firstInLine = true; let first = true; return items - .map(item => { + .map((item) => { if (!item || !item.content) return; let content = indent(item.content, first ? "" : indenter, !firstInLine); if (firstInLine) { @@ -1291,7 +1291,7 @@ const joinExplicitNewLine = (items, indenter) => { * @returns {SimpleElementJoiner} joiner */ const joinError = - error => + (error) => /** * @param {Item[]} items items * @param {StatsPrinterContextWithExtra} ctx context @@ -1308,7 +1308,7 @@ const joinError = /** @type {Record} */ const SIMPLE_ELEMENT_JOINERS = { - compilation: items => { + compilation: (items) => { const result = []; let lastNeedMore = false; for (const item of items) { @@ -1328,9 +1328,9 @@ const SIMPLE_ELEMENT_JOINERS = { if (lastNeedMore) result.push("\n"); return result.join(""); }, - asset: items => + asset: (items) => joinExplicitNewLine( - items.map(item => { + items.map((item) => { if ( (item.element === "related" || item.element === "children") && item.content @@ -1348,7 +1348,7 @@ const SIMPLE_ELEMENT_JOINERS = { module: (items, { module }) => { let hasName = false; return joinExplicitNewLine( - items.map(item => { + items.map((item) => { switch (item.element) { case "id": if (module.id === module.name) { @@ -1381,10 +1381,10 @@ const SIMPLE_ELEMENT_JOINERS = { " " ); }, - chunk: items => { + chunk: (items) => { let hasEntry = false; return `chunk ${joinExplicitNewLine( - items.filter(item => { + items.filter((item) => { switch (item.element) { case "entry": if (item.content) hasEntry = true; @@ -1398,15 +1398,15 @@ const SIMPLE_ELEMENT_JOINERS = { " " )}`; }, - "chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`, - chunkGroup: items => joinExplicitNewLine(items, " "), + "chunk.childrenByOrder[]": (items) => `(${joinOneLine(items)})`, + chunkGroup: (items) => joinExplicitNewLine(items, " "), chunkGroupAsset: joinOneLine, chunkGroupChildGroup: joinOneLine, chunkGroupChild: joinOneLine, moduleReason: (items, { moduleReason }) => { let hasName = false; return joinExplicitNewLine( - items.map(item => { + items.map((item) => { switch (item.element) { case "moduleId": if (moduleReason.moduleId === moduleReason.module && item.content) { @@ -1437,14 +1437,14 @@ const SIMPLE_ELEMENT_JOINERS = { }, "module.profile": joinInBrackets, moduleIssuer: joinOneLine, - chunkOrigin: items => `> ${joinOneLine(items)}`, + chunkOrigin: (items) => `> ${joinOneLine(items)}`, "errors[].error": joinError(true), "warnings[].error": joinError(false), - error: items => joinExplicitNewLine(items, ""), - "error.errors[].error": items => + error: (items) => joinExplicitNewLine(items, ""), + "error.errors[].error": (items) => indent(`[errors]: ${joinExplicitNewLine(items, "")}`, " "), - loggingGroup: items => joinExplicitNewLine(items, "").trimEnd(), - moduleTraceItem: items => ` @ ${joinOneLine(items)}`, + loggingGroup: (items) => joinExplicitNewLine(items, "").trimEnd(), + moduleTraceItem: (items) => ` @ ${joinOneLine(items)}`, moduleTraceDependency: joinOneLine }; @@ -1479,11 +1479,11 @@ const AVAILABLE_FORMATS = { return `{${yellow(id)}}`; } }, - formatModuleId: id => `[${id}]`, + formatModuleId: (id) => `[${id}]`, formatFilename: (filename, { green, yellow }, oversize) => (oversize ? yellow : green)(filename), - formatFlag: flag => `[${flag}]`, - formatLayer: layer => `(in ${layer})`, + formatFlag: (flag) => `[${flag}]`, + formatLayer: (layer) => `(in ${layer})`, formatSize: require("../SizeFormatHelpers").formatSize, formatDateTime: (dateTime, { bold }) => { const d = new Date(dateTime); @@ -1559,7 +1559,7 @@ const AVAILABLE_FORMATS = { /** @typedef {(result: string) => string} ResultModifierFn */ /** @type {Record} */ const RESULT_MODIFIER = { - "module.modules": result => indent(result, "| ") + "module.modules": (result) => indent(result, "| ") }; /** @@ -1597,7 +1597,7 @@ class DefaultStatsPrinterPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (stats, options) => { // Put colors into context stats.hooks.print @@ -1621,7 +1621,7 @@ class DefaultStatsPrinterPlugin { } if (start) { /** @type {ColorFunction} */ - context[color] = str => + context[color] = (str) => `${start}${ typeof str === "string" ? str.replace( @@ -1636,7 +1636,7 @@ class DefaultStatsPrinterPlugin { * @param {string} str string * @returns {string} str string */ - context[color] = str => str; + context[color] = (str) => str; } } for (const _format of Object.keys(AVAILABLE_FORMATS)) { diff --git a/lib/stats/StatsFactory.js b/lib/stats/StatsFactory.js index c59d660eaa2..4a3ada223d6 100644 --- a/lib/stats/StatsFactory.js +++ b/lib/stats/StatsFactory.js @@ -273,7 +273,7 @@ class StatsFactory { // sort items /** @type {Comparator[]} */ const comparators = []; - this._forEachLevel(this.hooks.sort, this._caches.sort, type, h => + this._forEachLevel(this.hooks.sort, this._caches.sort, type, (h) => h.call(comparators, context) ); if (comparators.length > 0) { @@ -306,7 +306,7 @@ class StatsFactory { this.hooks.getItemName, this._caches.getItemName, `${type}[]`, - h => h.call(item, itemContext) + (h) => h.call(item, itemContext) ); if (itemName) itemContext[itemName] = item; const innerType = itemName ? `${type}[].${itemName}` : `${type}[]`; @@ -317,7 +317,7 @@ class StatsFactory { this.hooks.getItemFactory, this._caches.getItemFactory, innerType, - h => h.call(item, itemContext) + (h) => h.call(item, itemContext) ) || this; // run item factory @@ -331,7 +331,7 @@ class StatsFactory { this.hooks.sortResults, this._caches.sortResults, type, - h => h.call(comparators2, context) + (h) => h.call(comparators2, context) ); if (comparators2.length > 0) { resultItems.sort( @@ -347,7 +347,7 @@ class StatsFactory { this.hooks.groupResults, this._caches.groupResults, type, - h => h.call(groupConfigs, context) + (h) => h.call(groupConfigs, context) ); if (groupConfigs.length > 0) { resultItems = smartGrouping(resultItems, groupConfigs); @@ -368,7 +368,7 @@ class StatsFactory { this.hooks.merge, this._caches.merge, type, - h => h.call(finalResultItems, context) + (h) => h.call(finalResultItems, context) ); if (result === undefined) result = finalResultItems; @@ -385,7 +385,7 @@ class StatsFactory { const object = {}; // run extract on value - this._forEachLevel(this.hooks.extract, this._caches.extract, type, h => + this._forEachLevel(this.hooks.extract, this._caches.extract, type, (h) => h.call(object, data, context) ); diff --git a/lib/stats/StatsPrinter.js b/lib/stats/StatsPrinter.js index 3672ed1fe18..621dd9a2d77 100644 --- a/lib/stats/StatsPrinter.js +++ b/lib/stats/StatsPrinter.js @@ -210,13 +210,13 @@ class StatsPrinter { }; /** @type {string | undefined} */ - let printResult = this._forEachLevel(this.hooks.print, type, hook => + let printResult = this._forEachLevel(this.hooks.print, type, (hook) => hook.call(object, context) ); if (printResult === undefined) { if (Array.isArray(object)) { const sortedItems = [...object]; - this._forEachLevel(this.hooks.sortItems, type, h => + this._forEachLevel(this.hooks.sortItems, type, (h) => h.call( sortedItems, /** @type {StatsPrinterContextWithExtra} */ @@ -233,7 +233,7 @@ class StatsPrinter { const itemName = this._forEachLevel( this.hooks.getItemName, `${type}[]`, - h => h.call(item, itemContext) + (h) => h.call(item, itemContext) ); if (itemName) itemContext[itemName] = item; return this.print( @@ -242,7 +242,7 @@ class StatsPrinter { itemContext ); }); - printResult = this._forEachLevel(this.hooks.printItems, type, h => + printResult = this._forEachLevel(this.hooks.printItems, type, (h) => h.call( /** @type {string[]} */ (printedItems), /** @type {StatsPrinterContextWithExtra} */ @@ -255,16 +255,16 @@ class StatsPrinter { } } else if (object !== null && typeof object === "object") { const elements = Object.keys(object).filter( - key => object[key] !== undefined + (key) => object[key] !== undefined ); - this._forEachLevel(this.hooks.sortElements, type, h => + this._forEachLevel(this.hooks.sortElements, type, (h) => h.call( elements, /** @type {StatsPrinterContextWithExtra} */ (context) ) ); - const printedElements = elements.map(element => { + const printedElements = elements.map((element) => { const content = this.print(`${type}.${element}`, object[element], { ...context, _parent: object, @@ -273,7 +273,7 @@ class StatsPrinter { }); return { element, content }; }); - printResult = this._forEachLevel(this.hooks.printElements, type, h => + printResult = this._forEachLevel(this.hooks.printElements, type, (h) => h.call( printedElements, /** @type {StatsPrinterContextWithExtra} */ @@ -281,7 +281,7 @@ class StatsPrinter { ) ); if (printResult === undefined) { - const result = printedElements.map(e => e.content).filter(Boolean); + const result = printedElements.map((e) => e.content).filter(Boolean); if (result.length > 0) printResult = result.join("\n"); } } diff --git a/lib/url/URLParserPlugin.js b/lib/url/URLParserPlugin.js index 24c6eab2ab8..7a864134edb 100644 --- a/lib/url/URLParserPlugin.js +++ b/lib/url/URLParserPlugin.js @@ -33,7 +33,7 @@ const PLUGIN_NAME = "URLParserPlugin"; * @param {NormalModule} module module * @returns {URL} file url */ -const getUrl = module => pathToFileURL(module.resource); +const getUrl = (module) => pathToFileURL(module.resource); /** * @param {Parser} parser parser parser @@ -108,7 +108,7 @@ class URLParserPlugin { const relative = this.options.url === "relative"; parser.hooks.canRename.for("URL").tap(PLUGIN_NAME, approve); - parser.hooks.evaluateNewExpression.for("URL").tap(PLUGIN_NAME, expr => { + parser.hooks.evaluateNewExpression.for("URL").tap(PLUGIN_NAME, (expr) => { const evaluatedExpr = getEvaluatedExpr(expr, parser); const request = evaluatedExpr && evaluatedExpr.asString(); @@ -119,7 +119,7 @@ class URLParserPlugin { .setString(url.toString()) .setRange(/** @type {Range} */ (expr.range)); }); - parser.hooks.new.for("URL").tap(PLUGIN_NAME, _expr => { + parser.hooks.new.for("URL").tap(PLUGIN_NAME, (_expr) => { const expr = /** @type {NewExpressionNode} */ (_expr); const { options: importOptions, errors: commentErrors } = parser.parseCommentOptions(/** @type {Range} */ (expr.range)); @@ -185,7 +185,7 @@ class URLParserPlugin { ); dep.loc = /** @type {DependencyLocation} */ (expr.loc); parser.state.current.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e)); return true; } @@ -248,7 +248,7 @@ class URLParserPlugin { parser.state.current.addDependency(dep); return true; }); - parser.hooks.isPure.for("NewExpression").tap(PLUGIN_NAME, _expr => { + parser.hooks.isPure.for("NewExpression").tap(PLUGIN_NAME, (_expr) => { const expr = /** @type {NewExpressionNode} */ (_expr); const { callee } = expr; if (callee.type !== "Identifier") return; diff --git a/lib/util/AsyncQueue.js b/lib/util/AsyncQueue.js index 2ae918b74fb..1bbdc8a52da 100644 --- a/lib/util/AsyncQueue.js +++ b/lib/util/AsyncQueue.js @@ -80,7 +80,7 @@ class AsyncQueue { this._processor = processor; this._getKey = getKey || - /** @type {getKey} */ (item => /** @type {T & K} */ (item)); + /** @type {getKey} */ ((item) => /** @type {T & K} */ (item)); /** @type {Map>} */ this._entries = new Map(); /** @type {ArrayQueue>} */ @@ -138,7 +138,7 @@ class AsyncQueue { */ add(item, callback) { if (this._stopped) return callback(new WebpackError("Queue was stopped")); - this.hooks.beforeAdd.callAsync(item, err => { + this.hooks.beforeAdd.callAsync(item, (err) => { if (err) { callback( makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeAdd`) @@ -327,7 +327,7 @@ class AsyncQueue { * @returns {void} */ _startProcessing(entry) { - this.hooks.beforeStart.callAsync(entry.item, err => { + this.hooks.beforeStart.callAsync(entry.item, (err) => { if (err) { this._handleResult( entry, @@ -356,7 +356,7 @@ class AsyncQueue { * @returns {void} */ _handleResult(entry, err, result) { - this.hooks.result.callAsync(entry.item, err, result, hookError => { + this.hooks.result.callAsync(entry.item, err, result, (hookError) => { const error = hookError ? makeWebpackError(hookError, `AsyncQueue(${this._name}).hooks.result`) : err; diff --git a/lib/util/IterableHelpers.js b/lib/util/IterableHelpers.js index c90f64e21d0..ef56089fb6a 100644 --- a/lib/util/IterableHelpers.js +++ b/lib/util/IterableHelpers.js @@ -10,7 +10,7 @@ * @param {Iterable} set a set * @returns {T | undefined} last item */ -const last = set => { +const last = (set) => { let last; for (const item of set) last = item; return last; @@ -34,7 +34,7 @@ const someInIterable = (iterable, filter) => { * @param {Iterable} iterable an iterable * @returns {number} count of items */ -const countIterable = iterable => { +const countIterable = (iterable) => { let i = 0; for (const _ of iterable) i++; return i; diff --git a/lib/util/LazyBucketSortedSet.js b/lib/util/LazyBucketSortedSet.js index 74030ce9242..26188756a16 100644 --- a/lib/util/LazyBucketSortedSet.js +++ b/lib/util/LazyBucketSortedSet.js @@ -162,7 +162,7 @@ class LazyBucketSortedSet { */ startUpdate(item) { if (this._unsortedItems.has(item)) { - return remove => { + return (remove) => { if (remove) { this._unsortedItems.delete(item); this.size--; @@ -172,7 +172,7 @@ class LazyBucketSortedSet { const key = this._getKey(item); if (this._leaf) { const oldEntry = /** @type {SortableSet} */ (this._map.get(key)); - return remove => { + return (remove) => { if (remove) { this.size--; oldEntry.delete(item); @@ -198,7 +198,7 @@ class LazyBucketSortedSet { /** @type {LazyBucketSortedSet} */ (this._map.get(key)); const finishUpdate = oldEntry.startUpdate(item); - return remove => { + return (remove) => { if (remove) { this.size--; finishUpdate(true); diff --git a/lib/util/SetHelpers.js b/lib/util/SetHelpers.js index aa5753c25a4..9691d9ab7a1 100644 --- a/lib/util/SetHelpers.js +++ b/lib/util/SetHelpers.js @@ -11,7 +11,7 @@ * @param {Set[]} sets an array of sets being checked for shared elements * @returns {Set} returns a new Set containing the intersecting items */ -const intersect = sets => { +const intersect = (sets) => { if (sets.length === 0) return new Set(); if (sets.length === 1) return new Set(sets[0]); let minSize = Infinity; @@ -68,7 +68,7 @@ const find = (set, fn) => { * @param {Set | ReadonlySet} set a set * @returns {T | undefined} first item */ -const first = set => { +const first = (set) => { const entry = set.values().next(); return entry.done ? undefined : entry.value; }; diff --git a/lib/util/StackedCacheMap.js b/lib/util/StackedCacheMap.js index 735573610a0..781aa86d694 100644 --- a/lib/util/StackedCacheMap.js +++ b/lib/util/StackedCacheMap.js @@ -124,7 +124,7 @@ class StackedCacheMap { * @returns {Iterator<[K, V]>} iterator */ [Symbol.iterator]() { - const iterators = this.stack.map(map => map[Symbol.iterator]()); + const iterators = this.stack.map((map) => map[Symbol.iterator]()); let current = this.map[Symbol.iterator](); return { next() { diff --git a/lib/util/StackedMap.js b/lib/util/StackedMap.js index 9797713b4da..d515db21712 100644 --- a/lib/util/StackedMap.js +++ b/lib/util/StackedMap.js @@ -24,7 +24,7 @@ const UNDEFINED_MARKER = Symbol("undefined"); * @param {[K, InternalCell]} pair the internal cell * @returns {[K, Cell]} its “safe” representation */ -const extractPair = pair => { +const extractPair = (pair) => { const key = pair[0]; const val = pair[1]; if (val === UNDEFINED_MARKER || val === TOMBSTONE) { diff --git a/lib/util/TupleSet.js b/lib/util/TupleSet.js index 3fba7f7a41c..1916ff4d914 100644 --- a/lib/util/TupleSet.js +++ b/lib/util/TupleSet.js @@ -125,7 +125,7 @@ class TupleSet { * @param {MapIterator<[T, InnerMap | Set]>} it iterator * @returns {boolean} result */ - const next = it => { + const next = (it) => { const result = it.next(); if (result.done) { if (iteratorStack.length === 0) return false; diff --git a/lib/util/WeakTupleMap.js b/lib/util/WeakTupleMap.js index 5e0068f982e..563a8dd7016 100644 --- a/lib/util/WeakTupleMap.js +++ b/lib/util/WeakTupleMap.js @@ -21,7 +21,7 @@ * @param {EXPECTED_ANY} thing thing * @returns {boolean} true if is weak */ -const isWeakKey = thing => typeof thing === "object" && thing !== null; +const isWeakKey = (thing) => typeof thing === "object" && thing !== null; /** * @template {unknown[]} T diff --git a/lib/util/cleverMerge.js b/lib/util/cleverMerge.js index 88d0b8b06db..7e3fbbb71ae 100644 --- a/lib/util/cleverMerge.js +++ b/lib/util/cleverMerge.js @@ -123,7 +123,7 @@ const parseCache = new WeakMap(); * @param {T} obj the object * @returns {ParsedObject} parsed object */ -const cachedParseObject = obj => { +const cachedParseObject = (obj) => { const entry = parseCache.get(/** @type {EXPECTED_OBJECT} */ (obj)); if (entry !== undefined) return entry; const result = parseObject(obj); @@ -138,7 +138,7 @@ const cachedParseObject = obj => { * @param {T} obj the object * @returns {ParsedObject} parsed object */ -const parseObject = obj => { +const parseObject = (obj) => { /** @type {ParsedObjectStatic} */ const info = new Map(); /** @type {ParsedObjectDynamic | undefined} */ @@ -147,7 +147,7 @@ const parseObject = obj => { * @param {keyof T} p path * @returns {Partial>} object parsed property entry */ - const getInfo = p => { + const getInfo = (p) => { const entry = info.get(p); if (entry !== undefined) return entry; const newEntry = { @@ -275,7 +275,7 @@ const VALUE_TYPE_DELETE = 4; * @param {T} value a single value * @returns {VALUE_TYPE_UNDEFINED | VALUE_TYPE_ATOM | VALUE_TYPE_ARRAY_EXTEND | VALUE_TYPE_OBJECT | VALUE_TYPE_DELETE} value type */ -const getValueType = value => { +const getValueType = (value) => { if (value === undefined) { return VALUE_TYPE_UNDEFINED; } else if (value === DELETE) { @@ -457,7 +457,7 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => { } if ( [.../** @type {ByValues} */ (firstEntry.byValues).values()].every( - value => { + (value) => { const type = getValueType(value); return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE; } @@ -555,7 +555,7 @@ const mergeSingleValue = (a, b, internalCaching) => { case VALUE_TYPE_UNDEFINED: return b; case VALUE_TYPE_DELETE: - return /** @type {B[]} */ (b).filter(item => item !== "..."); + return /** @type {B[]} */ (b).filter((item) => item !== "..."); case VALUE_TYPE_ARRAY_EXTEND: { /** @type {(A | B)[]} */ const newArray = []; @@ -571,7 +571,7 @@ const mergeSingleValue = (a, b, internalCaching) => { return newArray; } case VALUE_TYPE_OBJECT: - return /** @type {(A | B)[]} */ (b).map(item => + return /** @type {(A | B)[]} */ (b).map((item) => item === "..." ? /** @type {A} */ (a) : item ); default: @@ -618,7 +618,7 @@ const removeOperations = (obj, keysToKeepOriginalValue = []) => { /** @type {T[keyof T]} */ ( /** @type {EXPECTED_ANY[]} */ - (value).filter(i => i !== "...") + (value).filter((i) => i !== "...") ); break; default: diff --git a/lib/util/comparators.js b/lib/util/comparators.js index 034a1740460..5e8004c83dd 100644 --- a/lib/util/comparators.js +++ b/lib/util/comparators.js @@ -46,10 +46,10 @@ const { compareRuntime } = require("./runtime"); * @param {RawParameterizedComparator} fn comparator with argument * @returns {ParameterizedComparator} comparator */ -const createCachedParameterizedComparator = fn => { +const createCachedParameterizedComparator = (fn) => { /** @type {WeakMap>} */ const map = new WeakMap(); - return arg => { + return (arg) => { const cachedResult = map.get(/** @type {EXPECTED_OBJECT} */ (arg)); if (cachedResult !== undefined) return cachedResult; /** @@ -82,7 +82,7 @@ const compareIds = (a, b) => { * @param {Comparator} elementComparator comparator for elements * @returns {Comparator>} comparator for iterables of elements */ -const compareIterables = elementComparator => { +const compareIterables = (elementComparator) => { const cacheEntry = compareIteratorsCache.get(elementComparator); if (cacheEntry !== undefined) return cacheEntry; /** @@ -468,7 +468,7 @@ const compareIteratorsCache = new WeakMap(); * @param {Iterable} iterable original ordered list * @returns {Comparator} comparator */ -const keepOriginalOrder = iterable => { +const keepOriginalOrder = (iterable) => { /** @type {Map} */ const map = new Map(); let i = 0; @@ -486,21 +486,21 @@ const keepOriginalOrder = iterable => { * @param {ChunkGraph} chunkGraph the chunk graph * @returns {Comparator} comparator */ -const compareChunksNatural = chunkGraph => { +const compareChunksNatural = (chunkGraph) => { const cmpFn = module.exports.compareModulesById(chunkGraph); const cmpIterableFn = compareIterables(cmpFn); return concatComparators( compareSelect( - chunk => /** @type {string|number} */ (chunk.name), + (chunk) => /** @type {string|number} */ (chunk.name), compareIds ), - compareSelect(chunk => chunk.runtime, compareRuntime), + compareSelect((chunk) => chunk.runtime, compareRuntime), compareSelect( /** * @param {Chunk} chunk a chunk * @returns {Iterable} modules */ - chunk => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn), + (chunk) => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn), cmpIterableFn ) ); @@ -519,7 +519,7 @@ const sortWithSourceOrder = (dependencies, dependencySourceOrderMap) => { * @param {Dependency} dep dependency * @returns {number} source order */ - const getSourceOrder = dep => { + const getSourceOrder = (dep) => { if (dependencySourceOrderMap.has(dep)) { const { main } = /** @type {DependencySourceOrder} */ ( dependencySourceOrderMap.get(dep) @@ -536,7 +536,7 @@ const sortWithSourceOrder = (dependencies, dependencySourceOrderMap) => { * @param {number | undefined} sourceOrder sourceOrder * @returns {boolean} needReSort */ - const needReSort = sourceOrder => { + const needReSort = (sourceOrder) => { if (typeof sourceOrder === "number") { return true; } diff --git a/lib/util/compileBooleanMatcher.js b/lib/util/compileBooleanMatcher.js index ca17d55b2a7..551675d764d 100644 --- a/lib/util/compileBooleanMatcher.js +++ b/lib/util/compileBooleanMatcher.js @@ -9,13 +9,13 @@ * @param {string} str string * @returns {string} quoted meta */ -const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); /** * @param {string} str string * @returns {string} string */ -const toSimpleString = str => { +const toSimpleString = (str) => { if (`${Number(str)}` === str) { return str; } @@ -26,9 +26,9 @@ const toSimpleString = str => { * @param {Record} map value map * @returns {boolean | ((value: string) => string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime */ -const compileBooleanMatcher = map => { - const positiveItems = Object.keys(map).filter(i => map[i]); - const negativeItems = Object.keys(map).filter(i => !map[i]); +const compileBooleanMatcher = (map) => { + const positiveItems = Object.keys(map).filter((i) => map[i]); + const negativeItems = Object.keys(map).filter((i) => !map[i]); if (positiveItems.length === 0) return false; if (negativeItems.length === 0) return true; return compileBooleanMatcherFromLists(positiveItems, negativeItems); @@ -43,17 +43,17 @@ const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => { if (positiveItems.length === 0) return () => "false"; if (negativeItems.length === 0) return () => "true"; if (positiveItems.length === 1) { - return value => `${toSimpleString(positiveItems[0])} == ${value}`; + return (value) => `${toSimpleString(positiveItems[0])} == ${value}`; } if (negativeItems.length === 1) { - return value => `${toSimpleString(negativeItems[0])} != ${value}`; + return (value) => `${toSimpleString(negativeItems[0])} != ${value}`; } const positiveRegexp = itemsToRegexp(positiveItems); const negativeRegexp = itemsToRegexp(negativeItems); if (positiveRegexp.length <= negativeRegexp.length) { - return value => `/^${positiveRegexp}$/.test(${value})`; + return (value) => `/^${positiveRegexp}$/.test(${value})`; } - return value => `!/^${negativeRegexp}$/.test(${value})`; + return (value) => `!/^${negativeRegexp}$/.test(${value})`; }; /** @@ -94,7 +94,7 @@ const popCommonItems = (itemsSet, getKey, condition) => { * @param {Array} items items * @returns {string} common prefix */ -const getCommonPrefix = items => { +const getCommonPrefix = (items) => { let prefix = items[0]; for (let i = 1; i < items.length; i++) { const item = items[i]; @@ -112,7 +112,7 @@ const getCommonPrefix = items => { * @param {Array} items items * @returns {string} common suffix */ -const getCommonSuffix = items => { +const getCommonSuffix = (items) => { let suffix = items[0]; for (let i = 1; i < items.length; i++) { const item = items[i]; @@ -130,7 +130,7 @@ const getCommonSuffix = items => { * @param {Array} itemsArr array of items * @returns {string} regexp */ -const itemsToRegexp = itemsArr => { +const itemsToRegexp = (itemsArr) => { if (itemsArr.length === 1) { return quoteMeta(itemsArr[0]); } @@ -165,11 +165,11 @@ const itemsToRegexp = itemsArr => { if (finishedItems.length === 0 && items.size === 2) { const prefix = getCommonPrefix(itemsArr); const suffix = getCommonSuffix( - itemsArr.map(item => item.slice(prefix.length)) + itemsArr.map((item) => item.slice(prefix.length)) ); if (prefix.length > 0 || suffix.length > 0) { return `${quoteMeta(prefix)}${itemsToRegexp( - itemsArr.map(i => i.slice(prefix.length, -suffix.length || undefined)) + itemsArr.map((i) => i.slice(prefix.length, -suffix.length || undefined)) )}${quoteMeta(suffix)}`; } } @@ -190,8 +190,8 @@ const itemsToRegexp = itemsArr => { // find common prefix: (a1|a2|a3|a4|b5) => (a(1|2|3|4)|b5) const prefixed = popCommonItems( items, - item => (item.length >= 1 ? item[0] : false), - list => { + (item) => (item.length >= 1 ? item[0] : false), + (list) => { if (list.length >= 3) return true; if (list.length <= 1) return false; return list[0][1] === list[1][1]; @@ -201,7 +201,7 @@ const itemsToRegexp = itemsArr => { const prefix = getCommonPrefix(prefixedItems); finishedItems.push( `${quoteMeta(prefix)}${itemsToRegexp( - prefixedItems.map(i => i.slice(prefix.length)) + prefixedItems.map((i) => i.slice(prefix.length)) )}` ); } @@ -209,8 +209,8 @@ const itemsToRegexp = itemsArr => { // find common suffix: (a1|b1|c1|d1|e2) => ((a|b|c|d)1|e2) const suffixed = popCommonItems( items, - item => (item.length >= 1 ? item.slice(-1) : false), - list => { + (item) => (item.length >= 1 ? item.slice(-1) : false), + (list) => { if (list.length >= 3) return true; if (list.length <= 1) return false; return list[0].slice(-2) === list[1].slice(-2); @@ -220,7 +220,7 @@ const itemsToRegexp = itemsArr => { const suffix = getCommonSuffix(suffixedItems); finishedItems.push( `${itemsToRegexp( - suffixedItems.map(i => i.slice(0, -suffix.length)) + suffixedItems.map((i) => i.slice(0, -suffix.length)) )}${quoteMeta(suffix)}` ); } diff --git a/lib/util/concatenate.js b/lib/util/concatenate.js index db799b8891d..7dc16cf1304 100644 --- a/lib/util/concatenate.js +++ b/lib/util/concatenate.js @@ -22,13 +22,13 @@ const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__"; * @param {Variable} variable variable * @returns {Reference[]} references */ -const getAllReferences = variable => { +const getAllReferences = (variable) => { let set = variable.references; // Look for inner scope variables too (like in class Foo { t() { Foo } }) const identifiers = new Set(variable.identifiers); for (const scope of variable.scope.childScopes) { for (const innerVar of scope.variables) { - if (innerVar.identifiers.some(id => identifiers.has(id))) { + if (innerVar.identifiers.some((id) => identifiers.has(id))) { set = [...set, ...innerVar.references]; break; } @@ -53,7 +53,7 @@ const getPathInAst = (ast, node) => { * @param {Node} n node * @returns {Node[] | undefined} result */ - const enterNode = n => { + const enterNode = (n) => { if (!n) return; const r = n.range; if (r && r[0] <= nr[0] && r[1] >= nr[1]) { diff --git a/lib/util/conventions.js b/lib/util/conventions.js index b1ad4ea9e95..f60517870c9 100644 --- a/lib/util/conventions.js +++ b/lib/util/conventions.js @@ -11,7 +11,7 @@ * @param {string} string string * @returns {string} result */ -const preserveCamelCase = string => { +const preserveCamelCase = (string) => { let result = string; let isLastCharLower = false; let isLastCharUpper = false; @@ -54,7 +54,7 @@ const preserveCamelCase = string => { * @param {string} input input * @returns {string} result */ -module.exports.camelCase = input => { +module.exports.camelCase = (input) => { let result = input.trim(); if (result.length === 0) { @@ -75,7 +75,7 @@ module.exports.camelCase = input => { .replace(/^[_.\- ]+/, "") .toLowerCase() .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toUpperCase()) - .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toUpperCase()); + .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, (m) => m.toUpperCase()); }; /** @@ -121,5 +121,5 @@ module.exports.cssExportConvention = (input, convention) => { * @param {string} input input * @returns {string} result */ -module.exports.dashesCamelCase = input => +module.exports.dashesCamelCase = (input) => input.replace(/-+(\w)/g, (match, firstLetter) => firstLetter.toUpperCase()); diff --git a/lib/util/create-schema-validation.js b/lib/util/create-schema-validation.js index be9f38ca3d1..6364eda65ff 100644 --- a/lib/util/create-schema-validation.js +++ b/lib/util/create-schema-validation.js @@ -22,7 +22,7 @@ const getValidate = memoize(() => require("schema-utils").validate); */ const createSchemaValidation = (check, getSchema, options) => { getSchema = memoize(getSchema); - return value => { + return (value) => { if (check && value && !check(value)) { getValidate()( getSchema(), diff --git a/lib/util/createHash.js b/lib/util/createHash.js index a3ad731cb85..2ff475af8f2 100644 --- a/lib/util/createHash.js +++ b/lib/util/createHash.js @@ -154,7 +154,7 @@ let BatchedHash; * @param {HashFunction} algorithm the algorithm name or a constructor creating a hash * @returns {Hash} the hash */ -module.exports = algorithm => { +module.exports = (algorithm) => { if (typeof algorithm === "function") { // eslint-disable-next-line new-cap return new BulkUpdateDecorator(() => new algorithm()); diff --git a/lib/util/deprecation.js b/lib/util/deprecation.js index 68537a721b1..5d3b61b31d3 100644 --- a/lib/util/deprecation.js +++ b/lib/util/deprecation.js @@ -146,7 +146,7 @@ module.exports.arrayToSetDeprecation = (set, name) => { * @param {number} index index * @returns {() => T | undefined} value */ - const createIndexGetter = index => { + const createIndexGetter = (index) => { /** * @this {Set} a Set * @returns {T | undefined} the value at this location @@ -164,7 +164,7 @@ module.exports.arrayToSetDeprecation = (set, name) => { /** * @param {number} index index */ - const defineIndexGetter = index => { + const defineIndexGetter = (index) => { Object.defineProperty(set, index, { get: createIndexGetter(index), set(value) { @@ -199,7 +199,7 @@ module.exports.arrayToSetDeprecation = (set, name) => { * @param {string} name name * @returns {{ new (values?: readonly T[] | null): SetDeprecatedArray }} SetDeprecatedArray */ -module.exports.createArrayToSetDeprecationSet = name => { +module.exports.createArrayToSetDeprecationSet = (name) => { let initialized = false; /** @@ -275,7 +275,7 @@ const deprecateAllProperties = (obj, message, code) => { * @param {T} v value * @returns {T} result */ - v => (value = v), + (v) => (value = v), message, code ) diff --git a/lib/util/deterministicGrouping.js b/lib/util/deterministicGrouping.js index ea289983bfd..4331a3e47f4 100644 --- a/lib/util/deterministicGrouping.js +++ b/lib/util/deterministicGrouping.js @@ -97,7 +97,7 @@ const subtractSizeFrom = (total, size) => { * @param {Iterable>} nodes some nodes * @returns {Record} total size */ -const sumSize = nodes => { +const sumSize = (nodes) => { const sum = Object.create(null); for (const node of nodes) { addSizeTo(sum, node.size); @@ -249,7 +249,7 @@ class Group { * @param {Iterable>} nodes nodes * @returns {number[]} similarities */ -const getSimilarities = nodes => { +const getSimilarities = (nodes) => { // calculate similarities between lexically adjacent nodes /** @type {number[]} */ const similarities = []; @@ -292,7 +292,7 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => { const nodes = Array.from( items, - item => new Node(item, getKey(item), getSize(item)) + (item) => new Node(item, getKey(item), getSize(item)) ); /** @type {Node[]} */ @@ -329,12 +329,12 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => { // We hit an edge case where the working set is already smaller than minSize // We merge problematic nodes with the smallest result node to keep minSize intact const problemNodes = group.popNodes( - n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 + (n) => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 ); if (problemNodes === undefined) return false; // Only merge it with result nodes that have the problematic size type const possibleResultGroups = result.filter( - n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 + (n) => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0 ); if (possibleResultGroups.length > 0) { const bestGroup = possibleResultGroups.reduce((min, group) => { @@ -531,11 +531,11 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => { // return the results return result.map( - group => + (group) => /** @type {GroupedItems} */ ({ key: group.key, - items: group.nodes.map(node => node.item), + items: group.nodes.map((node) => node.item), size: group.size }) ); diff --git a/lib/util/findGraphRoots.js b/lib/util/findGraphRoots.js index 8b674a8c79d..d7d02e49f3b 100644 --- a/lib/util/findGraphRoots.js +++ b/lib/util/findGraphRoots.js @@ -224,7 +224,7 @@ module.exports = (items, getDependencies) => { // When roots were found, return them if (roots.size > 0) { - return Array.from(roots, r => r.item); + return Array.from(roots, (r) => r.item); } throw new Error("Implementation of findGraphRoots is broken"); diff --git a/lib/util/fs.js b/lib/util/fs.js index f6646ddb6be..267e1d14aa6 100644 --- a/lib/util/fs.js +++ b/lib/util/fs.js @@ -523,7 +523,7 @@ const dirname = (fs, absPath) => { * @returns {void} */ const mkdirp = (fs, p, callback) => { - fs.mkdir(p, err => { + fs.mkdir(p, (err) => { if (err) { if (err.code === "ENOENT") { const dir = dirname(fs, p); @@ -531,12 +531,12 @@ const mkdirp = (fs, p, callback) => { callback(err); return; } - mkdirp(fs, dir, err => { + mkdirp(fs, dir, (err) => { if (err) { callback(err); return; } - fs.mkdir(p, err => { + fs.mkdir(p, (err) => { if (err) { if (err.code === "EEXIST") { callback(); diff --git a/lib/util/identifier.js b/lib/util/identifier.js index b53efcd842a..1bcdc51a077 100644 --- a/lib/util/identifier.js +++ b/lib/util/identifier.js @@ -14,7 +14,7 @@ const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; * @param {string} relativePath relative path * @returns {string} request */ -const relativePathToRequest = relativePath => { +const relativePathToRequest = (relativePath) => { if (relativePath === "") return "./."; if (relativePath === "..") return "../."; if (relativePath.startsWith("../")) return relativePath; @@ -103,7 +103,7 @@ const requestToAbsolute = (context, relativePath) => { * @param {((value: string) => T)} realFn real function * @returns {MakeCacheableResult & { bindCache: BindCache }} cacheable function */ -const makeCacheable = realFn => { +const makeCacheable = (realFn) => { /** * @template T * @typedef {Map} CacheItem @@ -115,7 +115,7 @@ const makeCacheable = realFn => { * @param {AssociatedObjectForCache} associatedObjectForCache an object to which the cache will be attached * @returns {CacheItem} cache item */ - const getCache = associatedObjectForCache => { + const getCache = (associatedObjectForCache) => { const entry = cache.get(associatedObjectForCache); if (entry !== undefined) return entry; /** @type {Map} */ @@ -136,13 +136,13 @@ const makeCacheable = realFn => { }; /** @type {BindCache} */ - fn.bindCache = associatedObjectForCache => { + fn.bindCache = (associatedObjectForCache) => { const cache = getCache(associatedObjectForCache); /** * @param {string} str string * @returns {T} value */ - return str => { + return (str) => { const entry = cache.get(str); if (entry !== undefined) return entry; const result = realFn(str); @@ -164,7 +164,7 @@ const makeCacheable = realFn => { * @param {(context: string, identifier: string) => string} fn function * @returns {MakeCacheableWithContextResult & { bindCache: BindCacheForContext, bindContextCache: BindContextCacheForContext }} cacheable function with context */ -const makeCacheableWithContext = fn => { +const makeCacheableWithContext = (fn) => { /** @type {WeakMap>>} */ const cache = new WeakMap(); @@ -195,7 +195,7 @@ const makeCacheableWithContext = fn => { }; /** @type {BindCacheForContext} */ - cachedFn.bindCache = associatedObjectForCache => { + cachedFn.bindCache = (associatedObjectForCache) => { let innerCache; if (associatedObjectForCache) { innerCache = cache.get(associatedObjectForCache); @@ -254,7 +254,7 @@ const makeCacheableWithContext = fn => { * @param {string} identifier identifier used to create relative path * @returns {string} the returned relative path */ - const boundFn = identifier => { + const boundFn = (identifier) => { const cachedResult = innerSubCache.get(identifier); if (cachedResult !== undefined) { return cachedResult; @@ -278,7 +278,7 @@ const makeCacheableWithContext = fn => { const _makePathsRelative = (context, identifier) => identifier .split(SEGMENTS_SPLIT_REGEXP) - .map(str => absoluteToRequest(context, str)) + .map((str) => absoluteToRequest(context, str)) .join(""); /** @@ -289,7 +289,7 @@ const _makePathsRelative = (context, identifier) => const _makePathsAbsolute = (context, identifier) => identifier .split(SEGMENTS_SPLIT_REGEXP) - .map(str => requestToAbsolute(context, str)) + .map((str) => requestToAbsolute(context, str)) .join(""); /** @@ -300,7 +300,7 @@ const _makePathsAbsolute = (context, identifier) => const _contextify = (context, request) => request .split("!") - .map(r => absoluteToRequest(context, r)) + .map((r) => absoluteToRequest(context, r)) .join("!"); const contextify = makeCacheableWithContext(_contextify); @@ -313,7 +313,7 @@ const contextify = makeCacheableWithContext(_contextify); const _absolutify = (context, request) => request .split("!") - .map(r => requestToAbsolute(context, r)) + .map((r) => requestToAbsolute(context, r)) .join("!"); const absolutify = makeCacheableWithContext(_absolutify); @@ -329,7 +329,7 @@ const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/; * @param {string} str the path with query and fragment * @returns {ParsedResource} parsed parts */ -const _parseResource = str => { +const _parseResource = (str) => { const match = /** @type {[string, string, string | undefined, string | undefined]} */ (/** @type {unknown} */ (PATH_QUERY_FRAGMENT_REGEXP.exec(str))); @@ -346,7 +346,7 @@ const _parseResource = str => { * @param {string} str the path with query and fragment * @returns {ParsedResourceWithoutFragment} parsed parts */ -const _parseResourceWithoutFragment = str => { +const _parseResourceWithoutFragment = (str) => { const match = /** @type {[string, string, string | undefined]} */ (/** @type {unknown} */ (PATH_QUERY_REGEXP.exec(str))); diff --git a/lib/util/magicComment.js b/lib/util/magicComment.js index 6abac1ed0b4..173dfe53f86 100644 --- a/lib/util/magicComment.js +++ b/lib/util/magicComment.js @@ -5,9 +5,13 @@ "use strict"; +const memoize = require("./memoize"); + +const getVm = memoize(() => require("vm")); + // regexp to match at least one "magic comment" module.exports.createMagicCommentContext = () => - require("vm").createContext(undefined, { + getVm().createContext(undefined, { name: "Webpack Magic Comment Parser", codeGeneration: { strings: false, wasm: false } }); diff --git a/lib/util/memoize.js b/lib/util/memoize.js index 5c58015f954..478d6709651 100644 --- a/lib/util/memoize.js +++ b/lib/util/memoize.js @@ -14,7 +14,7 @@ * @param {FunctionReturning} fn memorized function * @returns {FunctionReturning} new function */ -const memoize = fn => { +const memoize = (fn) => { let cache = false; /** @type {T | undefined} */ let result; diff --git a/lib/util/processAsyncTree.js b/lib/util/processAsyncTree.js index 41980c63a7a..de3cf2aee84 100644 --- a/lib/util/processAsyncTree.js +++ b/lib/util/processAsyncTree.js @@ -24,7 +24,7 @@ const processAsyncTree = (items, concurrency, processor, callback) => { /** * @param {T} item item */ - const push = item => { + const push = (item) => { queue.push(item); if (!processScheduled && processing < concurrency) { processScheduled = true; @@ -35,7 +35,7 @@ const processAsyncTree = (items, concurrency, processor, callback) => { /** * @param {E | null | undefined} err error */ - const processorCallback = err => { + const processorCallback = (err) => { processing--; if (err && !finished) { finished = true; diff --git a/lib/util/propertyName.js b/lib/util/propertyName.js index a5dab15817b..b2d8a8f72eb 100644 --- a/lib/util/propertyName.js +++ b/lib/util/propertyName.js @@ -66,7 +66,7 @@ const RESERVED_IDENTIFIER = new Set([ * @param {string} prop property name to analyze * @returns {string} valid JS property name */ -const propertyName = prop => { +const propertyName = (prop) => { if (SAFE_IDENTIFIER.test(prop) && !RESERVED_IDENTIFIER.has(prop)) { return prop; } diff --git a/lib/util/removeBOM.js b/lib/util/removeBOM.js index 6ac60dfbd97..55cd64aac10 100644 --- a/lib/util/removeBOM.js +++ b/lib/util/removeBOM.js @@ -9,7 +9,7 @@ * @param {string | Buffer} strOrBuffer string or buffer * @returns {string | Buffer} result without BOM */ -module.exports = strOrBuffer => { +module.exports = (strOrBuffer) => { if (typeof strOrBuffer === "string" && strOrBuffer.charCodeAt(0) === 0xfeff) { return strOrBuffer.slice(1); } else if ( diff --git a/lib/util/runtime.js b/lib/util/runtime.js index d3c9ec2c48d..5a0a5078f6e 100644 --- a/lib/util/runtime.js +++ b/lib/util/runtime.js @@ -74,7 +74,7 @@ const forEachRuntime = (runtime, fn, deterministicOrder = false) => { * @param {SortableSet} set set * @returns {string} runtime key */ -const getRuntimesKey = set => { +const getRuntimesKey = (set) => { set.sort(); return [...set].join("\n"); }; @@ -83,7 +83,7 @@ const getRuntimesKey = set => { * @param {RuntimeSpec} runtime runtime(s) * @returns {string} key of runtimes */ -const getRuntimeKey = runtime => { +const getRuntimeKey = (runtime) => { if (runtime === undefined) return "*"; if (typeof runtime === "string") return runtime; return runtime.getFromUnorderedCache(getRuntimesKey); @@ -93,7 +93,7 @@ const getRuntimeKey = runtime => { * @param {string} key key of runtimes * @returns {RuntimeSpec} runtime(s) */ -const keyToRuntime = key => { +const keyToRuntime = (key) => { if (key === "*") return; const items = key.split("\n"); if (items.length === 1) return items[0]; @@ -105,7 +105,7 @@ const keyToRuntime = key => { * @param {SortableSet} set set * @returns {string} runtime string */ -const getRuntimesString = set => { +const getRuntimesString = (set) => { set.sort(); return [...set].join("+"); }; @@ -114,7 +114,7 @@ const getRuntimesString = set => { * @param {RuntimeSpec} runtime runtime(s) * @returns {string} readable version */ -const runtimeToString = runtime => { +const runtimeToString = (runtime) => { if (runtime === undefined) return "*"; if (typeof runtime === "string") return runtime; return runtime.getFromUnorderedCache(getRuntimesString); @@ -124,7 +124,7 @@ const runtimeToString = runtime => { * @param {RuntimeCondition} runtimeCondition runtime condition * @returns {string} readable version */ -const runtimeConditionToString = runtimeCondition => { +const runtimeConditionToString = (runtimeCondition) => { if (runtimeCondition === true) return "true"; if (runtimeCondition === false) return "false"; return runtimeToString(runtimeCondition); diff --git a/lib/util/semver.js b/lib/util/semver.js index d52fe5ce776..f64af49fa42 100644 --- a/lib/util/semver.js +++ b/lib/util/semver.js @@ -13,7 +13,7 @@ * @param {string} str version string * @returns {SemVerRange} parsed version */ -const parseVersion = str => { +const parseVersion = (str) => { /** * @param {str} str str * @returns {(string | number)[]} result @@ -100,15 +100,15 @@ module.exports.versionLt = versionLt; * @param {string} str range string * @returns {SemVerRange} parsed range */ -module.exports.parseRange = str => { +module.exports.parseRange = (str) => { /** * @param {string} str str * @returns {(string | number)[]} result */ - const splitAndConvert = str => { + const splitAndConvert = (str) => { return str .split(".") - .map(item => (item !== "NaN" && `${+item}` === item ? +item : item)); + .map((item) => (item !== "NaN" && `${+item}` === item ? +item : item)); }; // see https://docs.npmjs.com/misc/semver#range-grammar for grammar @@ -116,7 +116,7 @@ module.exports.parseRange = str => { * @param {string} str str * @returns {SemVerRangeItem[]} */ - const parsePartial = str => { + const parsePartial = (str) => { const match = /** @type {RegExpExecArray} */ (/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str)); @@ -146,7 +146,7 @@ module.exports.parseRange = str => { * @param {SemVerRangeItem[]} range range * @returns {SemVerRangeItem[]} */ - const toFixed = range => { + const toFixed = (range) => { if (range.length === 1) { // Special case for "*" is "x.x.x" instead of "=" return [0]; @@ -166,7 +166,7 @@ module.exports.parseRange = str => { * @param {SemVerRangeItem[]} range * @returns {SemVerRangeItem[]} result */ - const negate = range => { + const negate = (range) => { return [-(/** @type { [number]} */ (range)[0]) - 1, ...range.slice(1)]; }; @@ -174,7 +174,7 @@ module.exports.parseRange = str => { * @param {string} str str * @returns {SemVerRange} */ - const parseSimple = str => { + const parseSimple = (str) => { // simple ::= primitive | partial | tilde | caret // primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | '!' ) ( ' ' ) * partial // tilde ::= '~' ( ' ' ) * partial @@ -253,7 +253,7 @@ module.exports.parseRange = str => { * @param {string} str str * @returns {SemVerRange} */ - const parseRange = str => { + const parseRange = (str) => { // range ::= hyphen | simple ( ' ' ( ' ' ) * simple ) * | '' // hyphen ::= partial ( ' ' ) * ' - ' ( ' ' ) * partial const items = str.split(/\s+-\s+/); @@ -292,7 +292,7 @@ module.exports.parseRange = str => { * @param {string} str str * @returns {SemVerRange} */ - const parseLogicalOr = str => { + const parseLogicalOr = (str) => { // range-set ::= range ( logical-or range ) * // logical-or ::= ( ' ' ) * '||' ( ' ' ) * const items = @@ -310,7 +310,7 @@ module.exports.parseRange = str => { * @param {SemVerRange} range * @returns {string} */ -const rangeToString = range => { +const rangeToString = (range) => { var fixCount = /** @type {number} */ (range[0]); var str = ""; if (range.length === 1) { @@ -532,7 +532,7 @@ module.exports.satisfy = satisfy; * @param {SemVerRange | string | number | false | undefined} json * @returns {string} */ -module.exports.stringifyHoley = json => { +module.exports.stringifyHoley = (json) => { switch (typeof json) { case "undefined": return ""; @@ -558,7 +558,7 @@ module.exports.stringifyHoley = json => { * @param {RuntimeTemplate} runtimeTemplate * @returns {string} */ -exports.parseVersionRuntimeCode = runtimeTemplate => +exports.parseVersionRuntimeCode = (runtimeTemplate) => `var parseVersion = ${runtimeTemplate.basicFunction("str", [ "// see webpack/lib/util/semver.js for original code", `var p=${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return p.split(".").map(${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return+p==p?+p:p})},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;` @@ -570,7 +570,7 @@ exports.parseVersionRuntimeCode = runtimeTemplate => * @param {RuntimeTemplate} runtimeTemplate * @returns {string} */ -exports.versionLtRuntimeCode = runtimeTemplate => +exports.versionLtRuntimeCode = (runtimeTemplate) => `var versionLt = ${runtimeTemplate.basicFunction("a, b", [ "// see webpack/lib/util/semver.js for original code", 'a=parseVersion(a),b=parseVersion(b);for(var r=0;;){if(r>=a.length)return r=b.length)return"u"==n;var t=b[r],f=(typeof t)[0];if(n!=f)return"o"==n&&"n"==f||("s"==f||"u"==n);if("o"!=n&&"u"!=n&&e!=t)return e * @param {RuntimeTemplate} runtimeTemplate * @returns {string} */ -exports.rangeToStringRuntimeCode = runtimeTemplate => +exports.rangeToStringRuntimeCode = (runtimeTemplate) => `var rangeToString = ${runtimeTemplate.basicFunction("range", [ "// see webpack/lib/util/semver.js for original code", 'var r=range[0],n="";if(1===range.length)return"*";if(r+.5){n+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a * @param {RuntimeTemplate} runtimeTemplate * @returns {string} */ -exports.satisfyRuntimeCode = runtimeTemplate => +exports.satisfyRuntimeCode = (runtimeTemplate) => `var satisfy = ${runtimeTemplate.basicFunction("range, version", [ "// see webpack/lib/util/semver.js for original code", 'if(0 in range){version=parseVersion(version);var e=range[0],r=e<0;r&&(e=-e-1);for(var n=0,i=1,a=!0;;i++,n++){var f,s,g=i=version.length||"o"==(s=(typeof(f=version[n]))[0]))return!a||("u"==g?i>e&&!r:""==g!=r);if("u"==s){if(!a||"u"!=g)return!1}else if(a)if(g==s)if(i<=e){if(f!=range[i])return!1}else{if(r?f>range[i]:f { // This allows bundling all internal serializers const internalSerializables = require("./internalSerializables"); - getObjectMiddleware().registerLoader(/^webpack\/lib\//, req => { + getObjectMiddleware().registerLoader(/^webpack\/lib\//, (req) => { const loader = internalSerializables[ /** @type {keyof import("./internalSerializables")} */ @@ -95,9 +95,9 @@ module.exports = { return /** @type {Serializer} */ ( buffersSerializer = new Serializer([ new SingleItemMiddleware(), - new (getObjectMiddleware())(context => { + new (getObjectMiddleware())((context) => { if ("write" in context) { - context.writeLazy = value => { + context.writeLazy = (value) => { context.write( SerializerMiddleware.createLazy(value, binaryMiddleware) ); @@ -127,9 +127,9 @@ module.exports = { return /** @type {Serializer} */ ( new Serializer([ new SingleItemMiddleware(), - new (getObjectMiddleware())(context => { + new (getObjectMiddleware())((context) => { if ("write" in context) { - context.writeLazy = value => { + context.writeLazy = (value) => { context.write( SerializerMiddleware.createLazy(value, binaryMiddleware) ); diff --git a/lib/util/smartGrouping.js b/lib/util/smartGrouping.js index 7be36a5c602..7b6360a7f85 100644 --- a/lib/util/smartGrouping.js +++ b/lib/util/smartGrouping.js @@ -81,7 +81,7 @@ const smartGrouping = (items, groupConfigs) => { * @param {Set>} itemsWithGroups input items with groups * @returns {(T | R)[]} groups items */ - const runGrouping = itemsWithGroups => { + const runGrouping = (itemsWithGroups) => { const totalSize = itemsWithGroups.size; for (const entry of itemsWithGroups) { for (const group of entry.groups) { diff --git a/lib/validateSchema.js b/lib/validateSchema.js index d10f3454ba6..7091887e9a8 100644 --- a/lib/validateSchema.js +++ b/lib/validateSchema.js @@ -85,7 +85,7 @@ const validateSchema = (schema, options, validationConfiguration) => { if ( children && children.some( - child => + (child) => child.keyword === "absolutePath" && child.instancePath === "/output/filename" ) @@ -96,7 +96,7 @@ const validateSchema = (schema, options, validationConfiguration) => { if ( children && children.some( - child => + (child) => child.keyword === "pattern" && child.instancePath === "/devtool" ) ) { diff --git a/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js b/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js index 472b7513ea9..20a65973ebc 100644 --- a/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +++ b/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js @@ -50,7 +50,7 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule { JSON.stringify(outputOptions.webassemblyModuleFilename), { hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => + hashWithLength: (length) => `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, module: { id: '" + wasmModuleId + "', diff --git a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js index cb8b47108dc..ab15a20ec23 100644 --- a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +++ b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js @@ -120,7 +120,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator { const importObjRequestItems = Array.from( wasmDepsByRequest, ([request, deps]) => { - const exportItems = deps.map(dep => { + const exportItems = deps.map((dep) => { const importedModule = /** @type {Module} */ (moduleGraph.getModule(dep)); diff --git a/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js b/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js index 7d5fedf8b93..043888c0e7c 100644 --- a/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +++ b/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js @@ -22,13 +22,13 @@ class UniversalCompileAsyncWasmPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalWasmLoading = compilation.outputOptions.wasmLoading; /** * @param {Chunk} chunk chunk * @returns {boolean} true, if wasm loading is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const wasmLoading = options && options.wasmLoading !== undefined @@ -46,7 +46,7 @@ class UniversalCompileAsyncWasmPlugin { * @param {string} path path * @returns {string} code */ - const generateBeforeLoadBinaryCode = path => + const generateBeforeLoadBinaryCode = (path) => Template.asString([ "var useFetch = typeof document !== 'undefined' || typeof self !== 'undefined';", `var wasmUrl = ${path};` @@ -85,7 +85,7 @@ class UniversalCompileAsyncWasmPlugin { if ( !chunkGraph.hasModuleInGraph( chunk, - m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC + (m) => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC ) ) { return; diff --git a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js index 4cd53204313..6be0788886d 100644 --- a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +++ b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js @@ -139,7 +139,9 @@ const generateImportObject = ( importObject = [ "return {", Template.indent([ - properties.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") + properties + .map((p) => `${JSON.stringify(p.name)}: ${p.value}`) + .join(",\n") ]), "};" ]; @@ -160,7 +162,9 @@ const generateImportObject = ( Template.asString([ `${JSON.stringify(module)}: {`, Template.indent([ - list.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") + list + .map((p) => `${JSON.stringify(p.name)}: ${p.value}`) + .join(",\n") ]), "}" ]) @@ -187,7 +191,7 @@ const generateImportObject = ( } else if (waitForInstances.size > 0) { const promises = Array.from( waitForInstances.values(), - id => `installedWasmModules[${JSON.stringify(id)}]` + (id) => `installedWasmModules[${JSON.stringify(id)}]` ).join(", "); const variables = Array.from( waitForInstances.keys(), @@ -251,7 +255,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule { const { mangleImports } = this; /** @type {string[]} */ const declarations = []; - const importObjects = wasmModules.map(module => + const importObjects = wasmModules.map((module) => generateImportObject( chunkGraph, module, @@ -260,14 +264,14 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule { chunk.runtime ) ); - const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, m => + const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, (m) => m.type.startsWith("webassembly") ); /** * @param {string} content content * @returns {string} created import object */ - const createImportObject = content => + const createImportObject = (content) => mangleImports ? `{ ${JSON.stringify(WebAssemblyUtils.MANGLED_MODULE)}: ${content} }` : content; @@ -275,12 +279,12 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule { JSON.stringify(outputOptions.webassemblyModuleFilename), { hash: `" + ${RuntimeGlobals.getFullHash}() + "`, - hashWithLength: length => + hashWithLength: (length) => `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`, module: { id: '" + wasmModuleId + "', hash: `" + ${JSON.stringify( - chunkGraph.getChunkModuleRenderedHashMap(chunk, m => + chunkGraph.getChunkModuleRenderedHashMap(chunk, (m) => m.type.startsWith("webassembly") ) )}[chunkId][wasmModuleId] + "`, @@ -288,7 +292,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule { return `" + ${JSON.stringify( chunkGraph.getChunkModuleRenderedHashMap( chunk, - m => m.type.startsWith("webassembly"), + (m) => m.type.startsWith("webassembly"), length ) )}[chunkId][wasmModuleId] + "`; diff --git a/lib/wasm-sync/WasmFinalizeExportsPlugin.js b/lib/wasm-sync/WasmFinalizeExportsPlugin.js index c274b02fd81..4980ec47e43 100644 --- a/lib/wasm-sync/WasmFinalizeExportsPlugin.js +++ b/lib/wasm-sync/WasmFinalizeExportsPlugin.js @@ -22,8 +22,8 @@ class WasmFinalizeExportsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { - compilation.hooks.finishModules.tap(PLUGIN_NAME, modules => { + compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { + compilation.hooks.finishModules.tap(PLUGIN_NAME, (modules) => { for (const module of modules) { // 1. if a WebAssembly module if (module.type.startsWith("webassembly") === true) { diff --git a/lib/wasm-sync/WebAssemblyGenerator.js b/lib/wasm-sync/WebAssemblyGenerator.js index 5028a622e59..5f97e0bdf81 100644 --- a/lib/wasm-sync/WebAssemblyGenerator.js +++ b/lib/wasm-sync/WebAssemblyGenerator.js @@ -47,8 +47,8 @@ const WebAssemblyUtils = require("./WebAssemblyUtils"); */ const compose = (...fns) => fns.reduce( - (prevFn, nextFn) => value => nextFn(prevFn(value)), - value => value + (prevFn, nextFn) => (value) => nextFn(prevFn(value)), + (value) => value ); /** @@ -57,7 +57,7 @@ const compose = (...fns) => * @param {AST} state.ast Module's ast * @returns {ArrayBufferTransform} transform */ -const removeStartFunc = state => bin => +const removeStartFunc = (state) => (bin) => editWithAST(state.ast, bin, { Start(path) { path.remove(); @@ -69,7 +69,7 @@ const removeStartFunc = state => bin => * @param {AST} ast Module's AST * @returns {t.ModuleImport[]} - nodes */ -const getImportedGlobals = ast => { +const getImportedGlobals = (ast) => { /** @type {t.ModuleImport[]} */ const importedGlobals = []; @@ -89,7 +89,7 @@ const getImportedGlobals = ast => { * @param {AST} ast Module's AST * @returns {number} - count */ -const getCountImportedFunc = ast => { +const getCountImportedFunc = (ast) => { let count = 0; t.traverse(ast, { @@ -108,7 +108,7 @@ const getCountImportedFunc = ast => { * @param {AST} ast Module's AST * @returns {t.Index} - index */ -const getNextTypeIndex = ast => { +const getNextTypeIndex = (ast) => { const typeSectionMetadata = t.getSectionMetadata(ast, "type"); if (typeSectionMetadata === undefined) { @@ -144,7 +144,7 @@ const getNextFuncIndex = (ast, countImportedFunc) => { * @param {t.GlobalType} globalType the global type * @returns {t.Instruction} init expression */ -const createDefaultInitForGlobal = globalType => { +const createDefaultInitForGlobal = (globalType) => { if (globalType.valtype[0] === "i") { // create NumberLiteral global initializer return t.objectInstruction("const", globalType.valtype, [ @@ -173,7 +173,7 @@ const createDefaultInitForGlobal = globalType => { * @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function * @returns {ArrayBufferTransform} transform */ -const rewriteImportedGlobals = state => bin => { +const rewriteImportedGlobals = (state) => (bin) => { const additionalInitCode = state.additionalInitCode; /** @type {Array} */ const newGlobals = []; @@ -250,7 +250,7 @@ const rewriteImportedGlobals = state => bin => { */ const rewriteExportNames = ({ ast, moduleGraph, module, externalExports, runtime }) => - bin => + (bin) => editWithAST(ast, bin, { /** * @param {NodePath} path path @@ -281,7 +281,7 @@ const rewriteExportNames = */ const rewriteImports = ({ ast, usedDependencyMap }) => - bin => + (bin) => editWithAST(ast, bin, { /** * @param {NodePath} path path @@ -322,8 +322,8 @@ const addInitFunction = nextFuncIndex, nextTypeIndex }) => - bin => { - const funcParams = importedGlobals.map(importedGlobal => { + (bin) => { + const funcParams = importedGlobals.map((importedGlobal) => { // used for debugging const id = t.identifier( `${importedGlobal.module}.${importedGlobal.name}` @@ -473,8 +473,8 @@ class WebAssemblyGenerator extends Generator { ); const externalExports = new Set( module.dependencies - .filter(d => d instanceof WebAssemblyExportImportedDependency) - .map(d => { + .filter((d) => d instanceof WebAssemblyExportImportedDependency) + .map((d) => { const wasmDep = /** @type {WebAssemblyExportImportedDependency} */ ( d ); diff --git a/lib/wasm-sync/WebAssemblyInInitialChunkError.js b/lib/wasm-sync/WebAssemblyInInitialChunkError.js index 1c09c4a2b54..099c821734f 100644 --- a/lib/wasm-sync/WebAssemblyInInitialChunkError.js +++ b/lib/wasm-sync/WebAssemblyInInitialChunkError.js @@ -42,7 +42,9 @@ const getInitialModuleChains = ( for (const connection of moduleGraph.getIncomingConnections(head)) { const newHead = connection.originModule; if (newHead) { - if (!chunkGraph.getModuleChunks(newHead).some(c => c.canBeInitial())) { + if ( + !chunkGraph.getModuleChunks(newHead).some((c) => c.canBeInitial()) + ) { continue; } final = false; @@ -97,7 +99,7 @@ module.exports = class WebAssemblyInInitialChunkError extends WebpackError { const message = `WebAssembly module is included in initial chunk. This is not allowed, because WebAssembly download and compilation must happen asynchronous. Add an async split point (i. e. import()) somewhere between your entrypoint and the WebAssembly module: -${moduleChains.map(s => `* ${s}`).join("\n")}`; +${moduleChains.map((s) => `* ${s}`).join("\n")}`; super(message); this.name = "WebAssemblyInInitialChunkError"; diff --git a/lib/wasm-sync/WebAssemblyParser.js b/lib/wasm-sync/WebAssemblyParser.js index 5dd887dfdc7..8e980ad8230 100644 --- a/lib/wasm-sync/WebAssemblyParser.js +++ b/lib/wasm-sync/WebAssemblyParser.js @@ -27,7 +27,7 @@ const JS_COMPAT_TYPES = new Set(["i32", "i64", "f32", "f64", "externref"]); * @param {t.Signature} signature the func signature * @returns {null | string} the type incompatible with js types */ -const getJsIncompatibleType = signature => { +const getJsIncompatibleType = (signature) => { for (const param of signature.params) { if (!JS_COMPAT_TYPES.has(param.valtype)) { return `${param.valtype} as parameter`; @@ -44,7 +44,7 @@ const getJsIncompatibleType = signature => { * @param {t.FuncSignature} signature the func signature * @returns {null | string} the type incompatible with js types */ -const getJsIncompatibleTypeOfFuncSignature = signature => { +const getJsIncompatibleTypeOfFuncSignature = (signature) => { for (const param of signature.args) { if (!JS_COMPAT_TYPES.has(param)) { return `${param} as parameter`; diff --git a/lib/wasm/EnableWasmLoadingPlugin.js b/lib/wasm/EnableWasmLoadingPlugin.js index dc0b314bdb2..365438d07bd 100644 --- a/lib/wasm/EnableWasmLoadingPlugin.js +++ b/lib/wasm/EnableWasmLoadingPlugin.js @@ -16,7 +16,7 @@ const enabledTypes = new WeakMap(); * @param {Compiler} compiler compiler instance * @returns {Set} enabled types */ -const getEnabledTypes = compiler => { +const getEnabledTypes = (compiler) => { let set = enabledTypes.get(compiler); if (set === undefined) { set = new Set(); diff --git a/lib/web/FetchCompileAsyncWasmPlugin.js b/lib/web/FetchCompileAsyncWasmPlugin.js index dca39338c2b..088b7b583f9 100644 --- a/lib/web/FetchCompileAsyncWasmPlugin.js +++ b/lib/web/FetchCompileAsyncWasmPlugin.js @@ -21,13 +21,13 @@ class FetchCompileAsyncWasmPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalWasmLoading = compilation.outputOptions.wasmLoading; /** * @param {Chunk} chunk chunk * @returns {boolean} true, if wasm loading is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const wasmLoading = options && options.wasmLoading !== undefined @@ -39,7 +39,7 @@ class FetchCompileAsyncWasmPlugin { * @param {string} path path to the wasm file * @returns {string} code to load the wasm file */ - const generateLoadBinaryCode = path => + const generateLoadBinaryCode = (path) => `fetch(${RuntimeGlobals.publicPath} + ${path})`; compilation.hooks.runtimeRequirementInTree @@ -49,7 +49,7 @@ class FetchCompileAsyncWasmPlugin { if ( !chunkGraph.hasModuleInGraph( chunk, - m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC + (m) => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC ) ) { return; diff --git a/lib/web/FetchCompileWasmPlugin.js b/lib/web/FetchCompileWasmPlugin.js index d9461ef710d..91edf0928e6 100644 --- a/lib/web/FetchCompileWasmPlugin.js +++ b/lib/web/FetchCompileWasmPlugin.js @@ -35,13 +35,13 @@ class FetchCompileWasmPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalWasmLoading = compilation.outputOptions.wasmLoading; /** * @param {Chunk} chunk chunk * @returns {boolean} true, if wasm loading is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const wasmLoading = options && options.wasmLoading !== undefined @@ -53,7 +53,7 @@ class FetchCompileWasmPlugin { * @param {string} path path to the wasm file * @returns {string} code to load the wasm file */ - const generateLoadBinaryCode = path => + const generateLoadBinaryCode = (path) => `fetch(${RuntimeGlobals.publicPath} + ${path})`; compilation.hooks.runtimeRequirementInTree @@ -63,7 +63,7 @@ class FetchCompileWasmPlugin { if ( !chunkGraph.hasModuleInGraph( chunk, - m => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC + (m) => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC ) ) { return; diff --git a/lib/web/JsonpChunkLoadingPlugin.js b/lib/web/JsonpChunkLoadingPlugin.js index 6bc1f6d0691..49fbd33f322 100644 --- a/lib/web/JsonpChunkLoadingPlugin.js +++ b/lib/web/JsonpChunkLoadingPlugin.js @@ -20,13 +20,13 @@ class JsonpChunkLoadingPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalChunkLoading = compilation.outputOptions.chunkLoading; /** * @param {Chunk} chunk chunk * @returns {boolean} true, if wasm loading is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const chunkLoading = options && options.chunkLoading !== undefined diff --git a/lib/web/JsonpChunkLoadingRuntimeModule.js b/lib/web/JsonpChunkLoadingRuntimeModule.js index b4fc76d4ac2..d043dd93e8a 100644 --- a/lib/web/JsonpChunkLoadingRuntimeModule.js +++ b/lib/web/JsonpChunkLoadingRuntimeModule.js @@ -139,7 +139,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" }{`, Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join( + Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 0`).join( ",\n" ) ), diff --git a/lib/webpack.js b/lib/webpack.js index 3b45001de0e..75b93687bd0 100644 --- a/lib/webpack.js +++ b/lib/webpack.js @@ -23,6 +23,7 @@ const memoize = require("./util/memoize"); /** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ /** @typedef {import("./Compiler").WatchOptions} WatchOptions */ /** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */ +/** @typedef {import("./MultiCompiler").MultiWebpackOptions} MultiWebpackOptions */ /** @typedef {import("./MultiStats")} MultiStats */ /** @typedef {import("./Stats")} Stats */ @@ -100,14 +101,14 @@ const createCompiler = (rawOptions, compilerIndex) => { * @callback WebpackFunctionSingle * @param {WebpackOptions} options options object * @param {Callback=} callback callback - * @returns {Compiler} the compiler object + * @returns {Compiler | null} the compiler object */ /** * @callback WebpackFunctionMulti - * @param {ReadonlyArray & MultiCompilerOptions} options options objects + * @param {MultiWebpackOptions} options options objects * @param {Callback=} callback callback - * @returns {MultiCompiler} the multi compiler object + * @returns {MultiCompiler | null} the multi compiler object */ /** @@ -115,14 +116,18 @@ const createCompiler = (rawOptions, compilerIndex) => { * @param {Array | T} options options * @returns {Array} array of options */ -const asArray = options => (Array.isArray(options) ? [...options] : [options]); +const asArray = (options) => + Array.isArray(options) ? [...options] : [options]; + +/** + * @callback WebpackCallback + * @param {WebpackOptions | MultiWebpackOptions} options options + * @param {Callback & Callback=} callback callback + * @returns {Compiler | MultiCompiler | null} Compiler or MultiCompiler + */ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ ( - /** - * @param {WebpackOptions | (ReadonlyArray & MultiCompilerOptions)} options options - * @param {Callback & Callback=} callback callback - * @returns {Compiler | MultiCompiler | null} Compiler or MultiCompiler - */ + /** @type {WebpackCallback} */ (options, callback) => { const create = () => { if (!asArray(options).every(webpackOptionsSchemaCheck)) { @@ -145,8 +150,8 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ ( options, /** @type {MultiCompilerOptions} */ (options) ); - watch = options.some(options => options.watch); - watchOptions = options.map(options => options.watchOptions || {}); + watch = options.some((options) => options.watch); + watchOptions = options.map((options) => options.watchOptions || {}); } else { const webpackOptions = /** @type {WebpackOptions} */ (options); /** @type {Compiler} */ @@ -163,7 +168,7 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ ( compiler.watch(watchOptions, callback); } else { compiler.run((err, stats) => { - compiler.close(err2 => { + compiler.close((err2) => { callback( err || err2, /** @type {options extends WebpackOptions ? Stats : MultiStats} */ diff --git a/lib/webworker/ImportScriptsChunkLoadingPlugin.js b/lib/webworker/ImportScriptsChunkLoadingPlugin.js index 60b15ce27a3..661df29616e 100644 --- a/lib/webworker/ImportScriptsChunkLoadingPlugin.js +++ b/lib/webworker/ImportScriptsChunkLoadingPlugin.js @@ -25,13 +25,13 @@ class ImportScriptsChunkLoadingPlugin { chunkLoading: "import-scripts", asyncChunkLoading: true }).apply(compiler); - compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { const globalChunkLoading = compilation.outputOptions.chunkLoading; /** * @param {Chunk} chunk chunk * @returns {boolean} true, if wasm loading is enabled for the chunk */ - const isEnabledForChunk = chunk => { + const isEnabledForChunk = (chunk) => { const options = chunk.getEntryOptions(); const chunkLoading = options && options.chunkLoading !== undefined diff --git a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js index 81ab1923cec..4ec9b34b165 100644 --- a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +++ b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js @@ -107,7 +107,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { stateExpression ? `${stateExpression} = ${stateExpression} || ` : "" }{`, Template.indent( - Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join( + Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 1`).join( ",\n" ) ), diff --git a/package.json b/package.json index 56b9a1a452f..1336dca67a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack", - "version": "5.100.2", + "version": "5.101.0", "description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", "homepage": "https://github.com/webpack/webpack", "bugs": "https://github.com/webpack/webpack/issues", @@ -110,15 +110,15 @@ "devDependencies": { "@babel/core": "^7.27.1", "@babel/preset-react": "^7.27.1", - "@codspeed/tinybench-plugin": "^4.0.1", + "@codspeed/core": "^4.0.1", "@eslint/js": "^9.29.0", - "@eslint/markdown": "^7.0.0", - "@stylistic/eslint-plugin": "^5.0.0", + "@eslint/markdown": "^7.1.0", + "@stylistic/eslint-plugin": "^5.2.2", "@types/glob-to-regexp": "^0.4.4", "@types/graceful-fs": "^4.1.9", "@types/jest": "^30.0.0", "@types/mime-types": "^2.1.4", - "@types/node": "^24.0.13", + "@types/node": "^24.1.0", "@types/xxhashjs": "^0.2.4", "assemblyscript": "^0.28.2", "babel-loader": "^10.0.0", @@ -133,24 +133,24 @@ "es6-promise-polyfill": "^1.2.0", "eslint": "^9.29.0", "eslint-config-prettier": "^10.1.1", - "eslint-config-webpack": "^4.3.0", + "eslint-config-webpack": "^4.5.1", "eslint-plugin-import": "^2.32.0", "eslint-plugin-jest": "^29.0.1", "eslint-plugin-jsdoc": "^51.2.3", "eslint-plugin-n": "^17.21.0", "eslint-plugin-prettier": "^5.5.0", - "eslint-plugin-unicorn": "^59.0.1", + "eslint-plugin-unicorn": "^60.0.0", "file-loader": "^6.0.0", "fork-ts-checker-webpack-plugin": "^9.0.2", "globals": "^16.0.0", "hash-wasm": "^4.9.0", "husky": "^9.0.11", "istanbul": "^0.4.5", - "jest": "^30.0.3", - "jest-circus": "^30.0.3", - "jest-cli": "^30.0.3", - "jest-diff": "^30.0.3", - "jest-environment-node": "^30.0.2", + "jest": "^30.0.5", + "jest-circus": "^30.0.5", + "jest-cli": "^30.0.5", + "jest-diff": "^30.0.5", + "jest-environment-node": "^30.0.5", "jest-junit": "^16.0.0", "json-loader": "^0.5.7", "json5": "^2.1.3", @@ -167,7 +167,7 @@ "open-cli": "^8.0.0", "prettier": "^3.6.0", "prettier-2": "npm:prettier@^2", - "pretty-format": "^30.0.2", + "pretty-format": "^30.0.5", "pug": "^3.0.3", "pug-loader": "^2.4.0", "raw-loader": "^4.0.1", diff --git a/schemas/WebpackOptions.check.js b/schemas/WebpackOptions.check.js index 25c08ef4cc1..dd3d720b1fb 100644 --- a/schemas/WebpackOptions.check.js +++ b/schemas/WebpackOptions.check.js @@ -3,4 +3,4 @@ * DO NOT MODIFY BY HAND. * Run `yarn fix:special` to update */ -const e=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;module.exports=_e,module.exports.default=_e;const t={definitions:{Amd:{anyOf:[{enum:[!1]},{type:"object"}]},AmdContainer:{type:"string",minLength:1},AssetFilterItemTypes:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!1},{instanceof:"Function"}]},AssetFilterTypes:{anyOf:[{type:"array",items:{oneOf:[{$ref:"#/definitions/AssetFilterItemTypes"}]}},{$ref:"#/definitions/AssetFilterItemTypes"}]},AssetGeneratorDataUrl:{anyOf:[{$ref:"#/definitions/AssetGeneratorDataUrlOptions"},{$ref:"#/definitions/AssetGeneratorDataUrlFunction"}]},AssetGeneratorDataUrlFunction:{instanceof:"Function"},AssetGeneratorDataUrlOptions:{type:"object",additionalProperties:!1,properties:{encoding:{enum:[!1,"base64"]},mimetype:{type:"string"}}},AssetGeneratorOptions:{type:"object",additionalProperties:!1,properties:{binary:{type:"boolean"},dataUrl:{$ref:"#/definitions/AssetGeneratorDataUrl"},emit:{type:"boolean"},filename:{$ref:"#/definitions/FilenameTemplate"},outputPath:{$ref:"#/definitions/AssetModuleOutputPath"},publicPath:{$ref:"#/definitions/RawPublicPath"}}},AssetInlineGeneratorOptions:{type:"object",additionalProperties:!1,properties:{binary:{type:"boolean"},dataUrl:{$ref:"#/definitions/AssetGeneratorDataUrl"}}},AssetModuleFilename:{anyOf:[{type:"string",absolutePath:!1},{instanceof:"Function"}]},AssetModuleOutputPath:{anyOf:[{type:"string",absolutePath:!1},{instanceof:"Function"}]},AssetParserDataUrlFunction:{instanceof:"Function"},AssetParserDataUrlOptions:{type:"object",additionalProperties:!1,properties:{maxSize:{type:"number"}}},AssetParserOptions:{type:"object",additionalProperties:!1,properties:{dataUrlCondition:{anyOf:[{$ref:"#/definitions/AssetParserDataUrlOptions"},{$ref:"#/definitions/AssetParserDataUrlFunction"}]}}},AssetResourceGeneratorOptions:{type:"object",additionalProperties:!1,properties:{binary:{type:"boolean"},emit:{type:"boolean"},filename:{$ref:"#/definitions/FilenameTemplate"},outputPath:{$ref:"#/definitions/AssetModuleOutputPath"},publicPath:{$ref:"#/definitions/RawPublicPath"}}},AuxiliaryComment:{anyOf:[{type:"string"},{$ref:"#/definitions/LibraryCustomUmdCommentObject"}]},Bail:{type:"boolean"},CacheOptions:{anyOf:[{enum:[!0]},{$ref:"#/definitions/CacheOptionsNormalized"}]},CacheOptionsNormalized:{anyOf:[{enum:[!1]},{$ref:"#/definitions/MemoryCacheOptions"},{$ref:"#/definitions/FileCacheOptions"}]},Charset:{type:"boolean"},ChunkFilename:{oneOf:[{$ref:"#/definitions/FilenameTemplate"}]},ChunkFormat:{anyOf:[{enum:["array-push","commonjs","module",!1]},{type:"string"}]},ChunkLoadTimeout:{type:"number"},ChunkLoading:{anyOf:[{enum:[!1]},{$ref:"#/definitions/ChunkLoadingType"}]},ChunkLoadingGlobal:{type:"string"},ChunkLoadingType:{anyOf:[{enum:["jsonp","import-scripts","require","async-node","import"]},{type:"string"}]},Clean:{anyOf:[{type:"boolean"},{$ref:"#/definitions/CleanOptions"}]},CleanOptions:{type:"object",additionalProperties:!1,properties:{dry:{type:"boolean"},keep:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!1},{instanceof:"Function"}]}}},CompareBeforeEmit:{type:"boolean"},Context:{type:"string",absolutePath:!0},CrossOriginLoading:{enum:[!1,"anonymous","use-credentials"]},CssAutoGeneratorOptions:{type:"object",additionalProperties:!1,properties:{esModule:{$ref:"#/definitions/CssGeneratorEsModule"},exportsConvention:{$ref:"#/definitions/CssGeneratorExportsConvention"},exportsOnly:{$ref:"#/definitions/CssGeneratorExportsOnly"},localIdentName:{$ref:"#/definitions/CssGeneratorLocalIdentName"}}},CssAutoParserOptions:{type:"object",additionalProperties:!1,properties:{import:{$ref:"#/definitions/CssParserImport"},namedExports:{$ref:"#/definitions/CssParserNamedExports"},url:{$ref:"#/definitions/CssParserUrl"}}},CssChunkFilename:{oneOf:[{$ref:"#/definitions/FilenameTemplate"}]},CssFilename:{oneOf:[{$ref:"#/definitions/FilenameTemplate"}]},CssGeneratorEsModule:{type:"boolean"},CssGeneratorExportsConvention:{anyOf:[{enum:["as-is","camel-case","camel-case-only","dashes","dashes-only"]},{instanceof:"Function"}]},CssGeneratorExportsOnly:{type:"boolean"},CssGeneratorLocalIdentName:{type:"string"},CssGeneratorOptions:{type:"object",additionalProperties:!1,properties:{esModule:{$ref:"#/definitions/CssGeneratorEsModule"},exportsOnly:{$ref:"#/definitions/CssGeneratorExportsOnly"}}},CssGlobalGeneratorOptions:{type:"object",additionalProperties:!1,properties:{esModule:{$ref:"#/definitions/CssGeneratorEsModule"},exportsConvention:{$ref:"#/definitions/CssGeneratorExportsConvention"},exportsOnly:{$ref:"#/definitions/CssGeneratorExportsOnly"},localIdentName:{$ref:"#/definitions/CssGeneratorLocalIdentName"}}},CssGlobalParserOptions:{type:"object",additionalProperties:!1,properties:{import:{$ref:"#/definitions/CssParserImport"},namedExports:{$ref:"#/definitions/CssParserNamedExports"},url:{$ref:"#/definitions/CssParserUrl"}}},CssModuleGeneratorOptions:{type:"object",additionalProperties:!1,properties:{esModule:{$ref:"#/definitions/CssGeneratorEsModule"},exportsConvention:{$ref:"#/definitions/CssGeneratorExportsConvention"},exportsOnly:{$ref:"#/definitions/CssGeneratorExportsOnly"},localIdentName:{$ref:"#/definitions/CssGeneratorLocalIdentName"}}},CssModuleParserOptions:{type:"object",additionalProperties:!1,properties:{import:{$ref:"#/definitions/CssParserImport"},namedExports:{$ref:"#/definitions/CssParserNamedExports"},url:{$ref:"#/definitions/CssParserUrl"}}},CssParserImport:{type:"boolean"},CssParserNamedExports:{type:"boolean"},CssParserOptions:{type:"object",additionalProperties:!1,properties:{import:{$ref:"#/definitions/CssParserImport"},namedExports:{$ref:"#/definitions/CssParserNamedExports"},url:{$ref:"#/definitions/CssParserUrl"}}},CssParserUrl:{type:"boolean"},DeferImportExperimentOptions:{type:"boolean",required:["asyncModule"]},Dependencies:{type:"array",items:{type:"string"}},DevServer:{anyOf:[{enum:[!1]},{type:"object"}]},DevTool:{anyOf:[{enum:[!1,"eval"]},{type:"string",pattern:"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$"}]},DevtoolFallbackModuleFilenameTemplate:{anyOf:[{type:"string"},{instanceof:"Function"}]},DevtoolModuleFilenameTemplate:{anyOf:[{type:"string"},{instanceof:"Function"}]},DevtoolNamespace:{type:"string"},EmptyGeneratorOptions:{type:"object",additionalProperties:!1},EmptyParserOptions:{type:"object",additionalProperties:!1},EnabledChunkLoadingTypes:{type:"array",items:{$ref:"#/definitions/ChunkLoadingType"}},EnabledLibraryTypes:{type:"array",items:{$ref:"#/definitions/LibraryType"}},EnabledWasmLoadingTypes:{type:"array",items:{$ref:"#/definitions/WasmLoadingType"}},Entry:{anyOf:[{$ref:"#/definitions/EntryDynamic"},{$ref:"#/definitions/EntryStatic"}]},EntryDescription:{type:"object",additionalProperties:!1,properties:{asyncChunks:{type:"boolean"},baseUri:{type:"string"},chunkLoading:{$ref:"#/definitions/ChunkLoading"},dependOn:{anyOf:[{type:"array",items:{type:"string",minLength:1},minItems:1,uniqueItems:!0},{type:"string",minLength:1}]},filename:{$ref:"#/definitions/EntryFilename"},import:{$ref:"#/definitions/EntryItem"},layer:{$ref:"#/definitions/Layer"},library:{$ref:"#/definitions/LibraryOptions"},publicPath:{$ref:"#/definitions/PublicPath"},runtime:{$ref:"#/definitions/EntryRuntime"},wasmLoading:{$ref:"#/definitions/WasmLoading"}},required:["import"]},EntryDescriptionNormalized:{type:"object",additionalProperties:!1,properties:{asyncChunks:{type:"boolean"},baseUri:{type:"string"},chunkLoading:{$ref:"#/definitions/ChunkLoading"},dependOn:{type:"array",items:{type:"string",minLength:1},minItems:1,uniqueItems:!0},filename:{$ref:"#/definitions/Filename"},import:{type:"array",items:{type:"string",minLength:1},minItems:1,uniqueItems:!0},layer:{$ref:"#/definitions/Layer"},library:{$ref:"#/definitions/LibraryOptions"},publicPath:{$ref:"#/definitions/PublicPath"},runtime:{$ref:"#/definitions/EntryRuntime"},wasmLoading:{$ref:"#/definitions/WasmLoading"}}},EntryDynamic:{instanceof:"Function"},EntryDynamicNormalized:{instanceof:"Function"},EntryFilename:{oneOf:[{$ref:"#/definitions/FilenameTemplate"}]},EntryItem:{anyOf:[{type:"array",items:{type:"string",minLength:1},minItems:1,uniqueItems:!0},{type:"string",minLength:1}]},EntryNormalized:{anyOf:[{$ref:"#/definitions/EntryDynamicNormalized"},{$ref:"#/definitions/EntryStaticNormalized"}]},EntryObject:{type:"object",additionalProperties:{anyOf:[{$ref:"#/definitions/EntryItem"},{$ref:"#/definitions/EntryDescription"}]}},EntryRuntime:{anyOf:[{enum:[!1]},{type:"string",minLength:1}]},EntryStatic:{anyOf:[{$ref:"#/definitions/EntryObject"},{$ref:"#/definitions/EntryUnnamed"}]},EntryStaticNormalized:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/EntryDescriptionNormalized"}]}},EntryUnnamed:{oneOf:[{$ref:"#/definitions/EntryItem"}]},Environment:{type:"object",additionalProperties:!1,properties:{arrowFunction:{type:"boolean"},asyncFunction:{type:"boolean"},bigIntLiteral:{type:"boolean"},const:{type:"boolean"},destructuring:{type:"boolean"},document:{type:"boolean"},dynamicImport:{type:"boolean"},dynamicImportInWorker:{type:"boolean"},forOf:{type:"boolean"},globalThis:{type:"boolean"},module:{type:"boolean"},nodePrefixForCoreModules:{type:"boolean"},optionalChaining:{type:"boolean"},templateLiteral:{type:"boolean"}}},Experiments:{type:"object",additionalProperties:!1,properties:{asyncWebAssembly:{type:"boolean"},backCompat:{type:"boolean"},buildHttp:{anyOf:[{$ref:"#/definitions/HttpUriAllowedUris"},{$ref:"#/definitions/HttpUriOptions"}]},cacheUnaffected:{type:"boolean"},css:{type:"boolean"},deferImport:{type:"boolean"},futureDefaults:{type:"boolean"},layers:{type:"boolean"},lazyCompilation:{anyOf:[{type:"boolean"},{$ref:"#/definitions/LazyCompilationOptions"}]},outputModule:{type:"boolean"},syncWebAssembly:{type:"boolean"},topLevelAwait:{type:"boolean"}}},ExperimentsCommon:{type:"object",additionalProperties:!1,properties:{asyncWebAssembly:{type:"boolean"},backCompat:{type:"boolean"},cacheUnaffected:{type:"boolean"},futureDefaults:{type:"boolean"},layers:{type:"boolean"},outputModule:{type:"boolean"},syncWebAssembly:{type:"boolean"},topLevelAwait:{type:"boolean"}}},ExperimentsNormalized:{type:"object",additionalProperties:!1,properties:{asyncWebAssembly:{type:"boolean"},backCompat:{type:"boolean"},buildHttp:{oneOf:[{$ref:"#/definitions/HttpUriOptions"}]},cacheUnaffected:{type:"boolean"},css:{type:"boolean"},deferImport:{type:"boolean"},futureDefaults:{type:"boolean"},layers:{type:"boolean"},lazyCompilation:{anyOf:[{enum:[!1]},{$ref:"#/definitions/LazyCompilationOptions"}]},outputModule:{type:"boolean"},syncWebAssembly:{type:"boolean"},topLevelAwait:{type:"boolean"}}},Extends:{anyOf:[{type:"array",items:{$ref:"#/definitions/ExtendsItem"}},{$ref:"#/definitions/ExtendsItem"}]},ExtendsItem:{type:"string"},ExternalItem:{anyOf:[{instanceof:"RegExp"},{type:"string"},{type:"object",additionalProperties:{$ref:"#/definitions/ExternalItemValue"},properties:{byLayer:{anyOf:[{type:"object",additionalProperties:{$ref:"#/definitions/ExternalItem"}},{instanceof:"Function"}]}}},{$ref:"#/definitions/ExternalItemFunction"}]},ExternalItemFunction:{anyOf:[{$ref:"#/definitions/ExternalItemFunctionCallback"},{$ref:"#/definitions/ExternalItemFunctionPromise"}]},ExternalItemFunctionCallback:{instanceof:"Function"},ExternalItemFunctionData:{type:"object",additionalProperties:!1,properties:{context:{type:"string"},contextInfo:{type:"object"},dependencyType:{type:"string"},getResolve:{$ref:"#/definitions/ExternalItemFunctionDataGetResolve"},request:{type:"string"}}},ExternalItemFunctionDataGetResolve:{instanceof:"Function"},ExternalItemFunctionDataGetResolveCallbackResult:{instanceof:"Function"},ExternalItemFunctionDataGetResolveResult:{instanceof:"Function"},ExternalItemFunctionPromise:{instanceof:"Function"},ExternalItemValue:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{type:"boolean"},{type:"string"},{type:"object"}]},Externals:{anyOf:[{type:"array",items:{$ref:"#/definitions/ExternalItem"}},{$ref:"#/definitions/ExternalItem"}]},ExternalsPresets:{type:"object",additionalProperties:!1,properties:{electron:{type:"boolean"},electronMain:{type:"boolean"},electronPreload:{type:"boolean"},electronRenderer:{type:"boolean"},node:{type:"boolean"},nwjs:{type:"boolean"},web:{type:"boolean"},webAsync:{type:"boolean"}}},ExternalsType:{enum:["var","module","assign","this","window","self","global","commonjs","commonjs2","commonjs-module","commonjs-static","amd","amd-require","umd","umd2","jsonp","system","promise","import","module-import","script","node-commonjs"]},Falsy:{enum:[!1,0,"",null],undefinedAsNull:!0},FileCacheOptions:{type:"object",additionalProperties:!1,properties:{allowCollectingMemory:{type:"boolean"},buildDependencies:{type:"object",additionalProperties:{type:"array",items:{type:"string",minLength:1}}},cacheDirectory:{type:"string",absolutePath:!0},cacheLocation:{type:"string",absolutePath:!0},compression:{enum:[!1,"gzip","brotli"]},hashAlgorithm:{type:"string"},idleTimeout:{type:"number",minimum:0},idleTimeoutAfterLargeChanges:{type:"number",minimum:0},idleTimeoutForInitialStore:{type:"number",minimum:0},immutablePaths:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0,minLength:1}]}},managedPaths:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0,minLength:1}]}},maxAge:{type:"number",minimum:0},maxMemoryGenerations:{type:"number",minimum:0},memoryCacheUnaffected:{type:"boolean"},name:{type:"string"},profile:{type:"boolean"},readonly:{type:"boolean"},store:{enum:["pack"]},type:{enum:["filesystem"]},version:{type:"string"}},required:["type"]},Filename:{oneOf:[{$ref:"#/definitions/FilenameTemplate"}]},FilenameTemplate:{anyOf:[{type:"string",absolutePath:!1,minLength:1},{instanceof:"Function"}]},FilterItemTypes:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!1},{instanceof:"Function"}]},FilterTypes:{anyOf:[{type:"array",items:{oneOf:[{$ref:"#/definitions/FilterItemTypes"}]}},{$ref:"#/definitions/FilterItemTypes"}]},GeneratorOptionsByModuleType:{type:"object",additionalProperties:{type:"object",additionalProperties:!0},properties:{asset:{$ref:"#/definitions/AssetGeneratorOptions"},"asset/inline":{$ref:"#/definitions/AssetInlineGeneratorOptions"},"asset/resource":{$ref:"#/definitions/AssetResourceGeneratorOptions"},css:{$ref:"#/definitions/CssGeneratorOptions"},"css/auto":{$ref:"#/definitions/CssAutoGeneratorOptions"},"css/global":{$ref:"#/definitions/CssGlobalGeneratorOptions"},"css/module":{$ref:"#/definitions/CssModuleGeneratorOptions"},javascript:{$ref:"#/definitions/EmptyGeneratorOptions"},"javascript/auto":{$ref:"#/definitions/EmptyGeneratorOptions"},"javascript/dynamic":{$ref:"#/definitions/EmptyGeneratorOptions"},"javascript/esm":{$ref:"#/definitions/EmptyGeneratorOptions"},json:{$ref:"#/definitions/JsonGeneratorOptions"}}},GlobalObject:{type:"string",minLength:1},HashDigest:{type:"string"},HashDigestLength:{type:"number",minimum:1},HashFunction:{anyOf:[{type:"string",minLength:1},{instanceof:"Function"}]},HashSalt:{type:"string",minLength:1},HotUpdateChunkFilename:{type:"string",absolutePath:!1},HotUpdateGlobal:{type:"string"},HotUpdateMainFilename:{type:"string",absolutePath:!1},HttpUriAllowedUris:{oneOf:[{$ref:"#/definitions/HttpUriOptionsAllowedUris"}]},HttpUriOptions:{type:"object",additionalProperties:!1,properties:{allowedUris:{$ref:"#/definitions/HttpUriOptionsAllowedUris"},cacheLocation:{anyOf:[{enum:[!1]},{type:"string",absolutePath:!0}]},frozen:{type:"boolean"},lockfileLocation:{type:"string",absolutePath:!0},proxy:{type:"string"},upgrade:{type:"boolean"}},required:["allowedUris"]},HttpUriOptionsAllowedUris:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",pattern:"^https?://"},{instanceof:"Function"}]}},IgnoreWarnings:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"object",additionalProperties:!1,properties:{file:{instanceof:"RegExp"},message:{instanceof:"RegExp"},module:{instanceof:"RegExp"}}},{instanceof:"Function"}]}},IgnoreWarningsNormalized:{type:"array",items:{instanceof:"Function"}},Iife:{type:"boolean"},ImportFunctionName:{type:"string"},ImportMetaName:{type:"string"},InfrastructureLogging:{type:"object",additionalProperties:!1,properties:{appendOnly:{type:"boolean"},colors:{type:"boolean"},console:{},debug:{anyOf:[{type:"boolean"},{$ref:"#/definitions/FilterTypes"}]},level:{enum:["none","error","warn","info","log","verbose"]},stream:{}}},JavascriptParserOptions:{type:"object",additionalProperties:!0,properties:{amd:{$ref:"#/definitions/Amd"},browserify:{type:"boolean"},commonjs:{type:"boolean"},commonjsMagicComments:{type:"boolean"},createRequire:{anyOf:[{type:"boolean"},{type:"string"}]},dynamicImportFetchPriority:{enum:["low","high","auto",!1]},dynamicImportMode:{enum:["eager","weak","lazy","lazy-once"]},dynamicImportPrefetch:{anyOf:[{type:"number"},{type:"boolean"}]},dynamicImportPreload:{anyOf:[{type:"number"},{type:"boolean"}]},dynamicUrl:{type:"boolean"},exportsPresence:{enum:["error","warn","auto",!1]},exprContextCritical:{type:"boolean"},exprContextRecursive:{type:"boolean"},exprContextRegExp:{anyOf:[{instanceof:"RegExp"},{type:"boolean"}]},exprContextRequest:{type:"string"},harmony:{type:"boolean"},import:{type:"boolean"},importExportsPresence:{enum:["error","warn","auto",!1]},importMeta:{type:"boolean"},importMetaContext:{type:"boolean"},node:{$ref:"#/definitions/Node"},overrideStrict:{enum:["strict","non-strict"]},reexportExportsPresence:{enum:["error","warn","auto",!1]},requireContext:{type:"boolean"},requireEnsure:{type:"boolean"},requireInclude:{type:"boolean"},requireJs:{type:"boolean"},strictExportPresence:{type:"boolean"},strictThisContextOnImports:{type:"boolean"},system:{type:"boolean"},unknownContextCritical:{type:"boolean"},unknownContextRecursive:{type:"boolean"},unknownContextRegExp:{anyOf:[{instanceof:"RegExp"},{type:"boolean"}]},unknownContextRequest:{type:"string"},url:{anyOf:[{enum:["relative"]},{type:"boolean"}]},worker:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{type:"boolean"}]},wrappedContextCritical:{type:"boolean"},wrappedContextRecursive:{type:"boolean"},wrappedContextRegExp:{instanceof:"RegExp"}}},JsonGeneratorOptions:{type:"object",additionalProperties:!1,properties:{JSONParse:{type:"boolean"}}},JsonParserOptions:{type:"object",additionalProperties:!1,properties:{exportsDepth:{type:"number"},parse:{instanceof:"Function"}}},Layer:{anyOf:[{enum:[null]},{type:"string",minLength:1}]},LazyCompilationDefaultBackendOptions:{type:"object",additionalProperties:!1,properties:{client:{type:"string"},listen:{anyOf:[{type:"number"},{type:"object",additionalProperties:!0,properties:{host:{type:"string"},port:{type:"number"}}},{instanceof:"Function"}]},protocol:{enum:["http","https"]},server:{anyOf:[{type:"object",additionalProperties:!0,properties:{}},{instanceof:"Function"}]}}},LazyCompilationOptions:{type:"object",additionalProperties:!1,properties:{backend:{anyOf:[{instanceof:"Function"},{$ref:"#/definitions/LazyCompilationDefaultBackendOptions"}]},entries:{type:"boolean"},imports:{type:"boolean"},test:{anyOf:[{instanceof:"RegExp"},{type:"string"},{instanceof:"Function"}]}}},Library:{anyOf:[{$ref:"#/definitions/LibraryName"},{$ref:"#/definitions/LibraryOptions"}]},LibraryCustomUmdCommentObject:{type:"object",additionalProperties:!1,properties:{amd:{type:"string"},commonjs:{type:"string"},commonjs2:{type:"string"},root:{type:"string"}}},LibraryCustomUmdObject:{type:"object",additionalProperties:!1,properties:{amd:{type:"string",minLength:1},commonjs:{type:"string",minLength:1},root:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{type:"string",minLength:1}]}}},LibraryExport:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{type:"string",minLength:1}]},LibraryName:{anyOf:[{type:"array",items:{type:"string",minLength:1},minItems:1},{type:"string",minLength:1},{$ref:"#/definitions/LibraryCustomUmdObject"}]},LibraryOptions:{type:"object",additionalProperties:!1,properties:{amdContainer:{$ref:"#/definitions/AmdContainer"},auxiliaryComment:{$ref:"#/definitions/AuxiliaryComment"},export:{$ref:"#/definitions/LibraryExport"},name:{$ref:"#/definitions/LibraryName"},type:{$ref:"#/definitions/LibraryType"},umdNamedDefine:{$ref:"#/definitions/UmdNamedDefine"}},required:["type"]},LibraryType:{anyOf:[{enum:["var","module","assign","assign-properties","this","window","self","global","commonjs","commonjs2","commonjs-module","commonjs-static","amd","amd-require","umd","umd2","jsonp","system"]},{type:"string"}]},Loader:{type:"object"},MemoryCacheOptions:{type:"object",additionalProperties:!1,properties:{cacheUnaffected:{type:"boolean"},maxGenerations:{type:"number",minimum:1},type:{enum:["memory"]}},required:["type"]},Mode:{enum:["development","production","none"]},ModuleFilterItemTypes:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!1},{instanceof:"Function"}]},ModuleFilterTypes:{anyOf:[{type:"array",items:{oneOf:[{$ref:"#/definitions/ModuleFilterItemTypes"}]}},{$ref:"#/definitions/ModuleFilterItemTypes"}]},ModuleOptions:{type:"object",additionalProperties:!1,properties:{defaultRules:{oneOf:[{$ref:"#/definitions/RuleSetRules"}]},exprContextCritical:{type:"boolean"},exprContextRecursive:{type:"boolean"},exprContextRegExp:{anyOf:[{instanceof:"RegExp"},{type:"boolean"}]},exprContextRequest:{type:"string"},generator:{$ref:"#/definitions/GeneratorOptionsByModuleType"},noParse:{$ref:"#/definitions/NoParse"},parser:{$ref:"#/definitions/ParserOptionsByModuleType"},rules:{oneOf:[{$ref:"#/definitions/RuleSetRules"}]},strictExportPresence:{type:"boolean"},strictThisContextOnImports:{type:"boolean"},unknownContextCritical:{type:"boolean"},unknownContextRecursive:{type:"boolean"},unknownContextRegExp:{anyOf:[{instanceof:"RegExp"},{type:"boolean"}]},unknownContextRequest:{type:"string"},unsafeCache:{anyOf:[{type:"boolean"},{instanceof:"Function"}]},wrappedContextCritical:{type:"boolean"},wrappedContextRecursive:{type:"boolean"},wrappedContextRegExp:{instanceof:"RegExp"}}},ModuleOptionsNormalized:{type:"object",additionalProperties:!1,properties:{defaultRules:{oneOf:[{$ref:"#/definitions/RuleSetRules"}]},generator:{$ref:"#/definitions/GeneratorOptionsByModuleType"},noParse:{$ref:"#/definitions/NoParse"},parser:{$ref:"#/definitions/ParserOptionsByModuleType"},rules:{oneOf:[{$ref:"#/definitions/RuleSetRules"}]},unsafeCache:{anyOf:[{type:"boolean"},{instanceof:"Function"}]}},required:["defaultRules","generator","parser","rules"]},Name:{type:"string"},NoParse:{anyOf:[{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0},{instanceof:"Function"}]},minItems:1},{instanceof:"RegExp"},{type:"string",absolutePath:!0},{instanceof:"Function"}]},Node:{anyOf:[{enum:[!1]},{$ref:"#/definitions/NodeOptions"}]},NodeOptions:{type:"object",additionalProperties:!1,properties:{__dirname:{enum:[!1,!0,"warn-mock","mock","node-module","eval-only"]},__filename:{enum:[!1,!0,"warn-mock","mock","node-module","eval-only"]},global:{enum:[!1,!0,"warn"]}}},Optimization:{type:"object",additionalProperties:!1,properties:{avoidEntryIife:{type:"boolean"},checkWasmTypes:{type:"boolean"},chunkIds:{enum:["natural","named","deterministic","size","total-size",!1]},concatenateModules:{type:"boolean"},emitOnErrors:{type:"boolean"},flagIncludedChunks:{type:"boolean"},innerGraph:{type:"boolean"},mangleExports:{anyOf:[{enum:["size","deterministic"]},{type:"boolean"}]},mangleWasmImports:{type:"boolean"},mergeDuplicateChunks:{type:"boolean"},minimize:{type:"boolean"},minimizer:{type:"array",items:{anyOf:[{enum:["..."]},{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/WebpackPluginInstance"},{$ref:"#/definitions/WebpackPluginFunction"}]}},moduleIds:{enum:["natural","named","hashed","deterministic","size",!1]},noEmitOnErrors:{type:"boolean"},nodeEnv:{anyOf:[{enum:[!1]},{type:"string"}]},portableRecords:{type:"boolean"},providedExports:{type:"boolean"},realContentHash:{type:"boolean"},removeAvailableModules:{type:"boolean"},removeEmptyChunks:{type:"boolean"},runtimeChunk:{$ref:"#/definitions/OptimizationRuntimeChunk"},sideEffects:{anyOf:[{enum:["flag"]},{type:"boolean"}]},splitChunks:{anyOf:[{enum:[!1]},{$ref:"#/definitions/OptimizationSplitChunksOptions"}]},usedExports:{anyOf:[{enum:["global"]},{type:"boolean"}]}}},OptimizationNormalized:{type:"object",additionalProperties:!1,properties:{avoidEntryIife:{type:"boolean"},checkWasmTypes:{type:"boolean"},chunkIds:{enum:["natural","named","deterministic","size","total-size",!1]},concatenateModules:{type:"boolean"},emitOnErrors:{type:"boolean"},flagIncludedChunks:{type:"boolean"},innerGraph:{type:"boolean"},mangleExports:{anyOf:[{enum:["size","deterministic"]},{type:"boolean"}]},mangleWasmImports:{type:"boolean"},mergeDuplicateChunks:{type:"boolean"},minimize:{type:"boolean"},minimizer:{type:"array",items:{anyOf:[{enum:["..."]},{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/WebpackPluginInstance"},{$ref:"#/definitions/WebpackPluginFunction"}]}},moduleIds:{enum:["natural","named","hashed","deterministic","size",!1]},noEmitOnErrors:{type:"boolean"},nodeEnv:{anyOf:[{enum:[!1]},{type:"string"}]},portableRecords:{type:"boolean"},providedExports:{type:"boolean"},realContentHash:{type:"boolean"},removeAvailableModules:{type:"boolean"},removeEmptyChunks:{type:"boolean"},runtimeChunk:{$ref:"#/definitions/OptimizationRuntimeChunkNormalized"},sideEffects:{anyOf:[{enum:["flag"]},{type:"boolean"}]},splitChunks:{anyOf:[{enum:[!1]},{$ref:"#/definitions/OptimizationSplitChunksOptions"}]},usedExports:{anyOf:[{enum:["global"]},{type:"boolean"}]}}},OptimizationRuntimeChunk:{anyOf:[{enum:["single","multiple"]},{type:"boolean"},{type:"object",additionalProperties:!1,properties:{name:{anyOf:[{type:"string"},{instanceof:"Function"}]}}}]},OptimizationRuntimeChunkNormalized:{anyOf:[{enum:[!1]},{type:"object",additionalProperties:!1,properties:{name:{instanceof:"Function"}}}]},OptimizationSplitChunksCacheGroup:{type:"object",additionalProperties:!1,properties:{automaticNameDelimiter:{type:"string",minLength:1},chunks:{anyOf:[{enum:["initial","async","all"]},{instanceof:"RegExp"},{instanceof:"Function"}]},enforce:{type:"boolean"},enforceSizeThreshold:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},filename:{anyOf:[{type:"string",absolutePath:!1,minLength:1},{instanceof:"Function"}]},idHint:{type:"string"},layer:{anyOf:[{instanceof:"RegExp"},{type:"string"},{instanceof:"Function"}]},maxAsyncRequests:{type:"number",minimum:1},maxAsyncSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},maxInitialRequests:{type:"number",minimum:1},maxInitialSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},maxSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},minChunks:{type:"number",minimum:1},minRemainingSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},minSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},minSizeReduction:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},name:{anyOf:[{enum:[!1]},{type:"string"},{instanceof:"Function"}]},priority:{type:"number"},reuseExistingChunk:{type:"boolean"},test:{anyOf:[{instanceof:"RegExp"},{type:"string"},{instanceof:"Function"}]},type:{anyOf:[{instanceof:"RegExp"},{type:"string"},{instanceof:"Function"}]},usedExports:{type:"boolean"}}},OptimizationSplitChunksGetCacheGroups:{instanceof:"Function"},OptimizationSplitChunksOptions:{type:"object",additionalProperties:!1,properties:{automaticNameDelimiter:{type:"string",minLength:1},cacheGroups:{type:"object",additionalProperties:{anyOf:[{enum:[!1]},{instanceof:"RegExp"},{type:"string"},{$ref:"#/definitions/OptimizationSplitChunksGetCacheGroups"},{$ref:"#/definitions/OptimizationSplitChunksCacheGroup"}]},not:{type:"object",additionalProperties:!0,properties:{test:{anyOf:[{instanceof:"RegExp"},{type:"string"},{$ref:"#/definitions/OptimizationSplitChunksGetCacheGroups"}]}},required:["test"]}},chunks:{anyOf:[{enum:["initial","async","all"]},{instanceof:"RegExp"},{instanceof:"Function"}]},defaultSizeTypes:{type:"array",items:{type:"string"},minItems:1},enforceSizeThreshold:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},fallbackCacheGroup:{type:"object",additionalProperties:!1,properties:{automaticNameDelimiter:{type:"string",minLength:1},chunks:{anyOf:[{enum:["initial","async","all"]},{instanceof:"RegExp"},{instanceof:"Function"}]},maxAsyncSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},maxInitialSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},maxSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},minSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},minSizeReduction:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]}}},filename:{anyOf:[{type:"string",absolutePath:!1,minLength:1},{instanceof:"Function"}]},hidePathInfo:{type:"boolean"},maxAsyncRequests:{type:"number",minimum:1},maxAsyncSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},maxInitialRequests:{type:"number",minimum:1},maxInitialSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},maxSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},minChunks:{type:"number",minimum:1},minRemainingSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},minSize:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},minSizeReduction:{oneOf:[{$ref:"#/definitions/OptimizationSplitChunksSizes"}]},name:{anyOf:[{enum:[!1]},{type:"string"},{instanceof:"Function"}]},usedExports:{type:"boolean"}}},OptimizationSplitChunksSizes:{anyOf:[{type:"number",minimum:0},{type:"object",additionalProperties:{type:"number"}}]},Output:{type:"object",additionalProperties:!1,properties:{amdContainer:{oneOf:[{$ref:"#/definitions/AmdContainer"}]},assetModuleFilename:{$ref:"#/definitions/AssetModuleFilename"},asyncChunks:{type:"boolean"},auxiliaryComment:{oneOf:[{$ref:"#/definitions/AuxiliaryComment"}]},charset:{$ref:"#/definitions/Charset"},chunkFilename:{$ref:"#/definitions/ChunkFilename"},chunkFormat:{$ref:"#/definitions/ChunkFormat"},chunkLoadTimeout:{$ref:"#/definitions/ChunkLoadTimeout"},chunkLoading:{$ref:"#/definitions/ChunkLoading"},chunkLoadingGlobal:{$ref:"#/definitions/ChunkLoadingGlobal"},clean:{$ref:"#/definitions/Clean"},compareBeforeEmit:{$ref:"#/definitions/CompareBeforeEmit"},crossOriginLoading:{$ref:"#/definitions/CrossOriginLoading"},cssChunkFilename:{$ref:"#/definitions/CssChunkFilename"},cssFilename:{$ref:"#/definitions/CssFilename"},devtoolFallbackModuleFilenameTemplate:{$ref:"#/definitions/DevtoolFallbackModuleFilenameTemplate"},devtoolModuleFilenameTemplate:{$ref:"#/definitions/DevtoolModuleFilenameTemplate"},devtoolNamespace:{$ref:"#/definitions/DevtoolNamespace"},enabledChunkLoadingTypes:{$ref:"#/definitions/EnabledChunkLoadingTypes"},enabledLibraryTypes:{$ref:"#/definitions/EnabledLibraryTypes"},enabledWasmLoadingTypes:{$ref:"#/definitions/EnabledWasmLoadingTypes"},environment:{$ref:"#/definitions/Environment"},filename:{$ref:"#/definitions/Filename"},globalObject:{$ref:"#/definitions/GlobalObject"},hashDigest:{$ref:"#/definitions/HashDigest"},hashDigestLength:{$ref:"#/definitions/HashDigestLength"},hashFunction:{$ref:"#/definitions/HashFunction"},hashSalt:{$ref:"#/definitions/HashSalt"},hotUpdateChunkFilename:{$ref:"#/definitions/HotUpdateChunkFilename"},hotUpdateGlobal:{$ref:"#/definitions/HotUpdateGlobal"},hotUpdateMainFilename:{$ref:"#/definitions/HotUpdateMainFilename"},ignoreBrowserWarnings:{type:"boolean"},iife:{$ref:"#/definitions/Iife"},importFunctionName:{$ref:"#/definitions/ImportFunctionName"},importMetaName:{$ref:"#/definitions/ImportMetaName"},library:{$ref:"#/definitions/Library"},libraryExport:{oneOf:[{$ref:"#/definitions/LibraryExport"}]},libraryTarget:{oneOf:[{$ref:"#/definitions/LibraryType"}]},module:{$ref:"#/definitions/OutputModule"},path:{$ref:"#/definitions/Path"},pathinfo:{$ref:"#/definitions/Pathinfo"},publicPath:{$ref:"#/definitions/PublicPath"},scriptType:{$ref:"#/definitions/ScriptType"},sourceMapFilename:{$ref:"#/definitions/SourceMapFilename"},sourcePrefix:{$ref:"#/definitions/SourcePrefix"},strictModuleErrorHandling:{$ref:"#/definitions/StrictModuleErrorHandling"},strictModuleExceptionHandling:{$ref:"#/definitions/StrictModuleExceptionHandling"},trustedTypes:{anyOf:[{enum:[!0]},{type:"string",minLength:1},{$ref:"#/definitions/TrustedTypes"}]},umdNamedDefine:{oneOf:[{$ref:"#/definitions/UmdNamedDefine"}]},uniqueName:{$ref:"#/definitions/UniqueName"},wasmLoading:{$ref:"#/definitions/WasmLoading"},webassemblyModuleFilename:{$ref:"#/definitions/WebassemblyModuleFilename"},workerChunkLoading:{$ref:"#/definitions/ChunkLoading"},workerPublicPath:{$ref:"#/definitions/WorkerPublicPath"},workerWasmLoading:{$ref:"#/definitions/WasmLoading"}}},OutputModule:{type:"boolean"},OutputNormalized:{type:"object",additionalProperties:!1,properties:{assetModuleFilename:{$ref:"#/definitions/AssetModuleFilename"},asyncChunks:{type:"boolean"},charset:{$ref:"#/definitions/Charset"},chunkFilename:{$ref:"#/definitions/ChunkFilename"},chunkFormat:{$ref:"#/definitions/ChunkFormat"},chunkLoadTimeout:{$ref:"#/definitions/ChunkLoadTimeout"},chunkLoading:{$ref:"#/definitions/ChunkLoading"},chunkLoadingGlobal:{$ref:"#/definitions/ChunkLoadingGlobal"},clean:{$ref:"#/definitions/Clean"},compareBeforeEmit:{$ref:"#/definitions/CompareBeforeEmit"},crossOriginLoading:{$ref:"#/definitions/CrossOriginLoading"},cssChunkFilename:{$ref:"#/definitions/CssChunkFilename"},cssFilename:{$ref:"#/definitions/CssFilename"},devtoolFallbackModuleFilenameTemplate:{$ref:"#/definitions/DevtoolFallbackModuleFilenameTemplate"},devtoolModuleFilenameTemplate:{$ref:"#/definitions/DevtoolModuleFilenameTemplate"},devtoolNamespace:{$ref:"#/definitions/DevtoolNamespace"},enabledChunkLoadingTypes:{$ref:"#/definitions/EnabledChunkLoadingTypes"},enabledLibraryTypes:{$ref:"#/definitions/EnabledLibraryTypes"},enabledWasmLoadingTypes:{$ref:"#/definitions/EnabledWasmLoadingTypes"},environment:{$ref:"#/definitions/Environment"},filename:{$ref:"#/definitions/Filename"},globalObject:{$ref:"#/definitions/GlobalObject"},hashDigest:{$ref:"#/definitions/HashDigest"},hashDigestLength:{$ref:"#/definitions/HashDigestLength"},hashFunction:{$ref:"#/definitions/HashFunction"},hashSalt:{$ref:"#/definitions/HashSalt"},hotUpdateChunkFilename:{$ref:"#/definitions/HotUpdateChunkFilename"},hotUpdateGlobal:{$ref:"#/definitions/HotUpdateGlobal"},hotUpdateMainFilename:{$ref:"#/definitions/HotUpdateMainFilename"},ignoreBrowserWarnings:{type:"boolean"},iife:{$ref:"#/definitions/Iife"},importFunctionName:{$ref:"#/definitions/ImportFunctionName"},importMetaName:{$ref:"#/definitions/ImportMetaName"},library:{$ref:"#/definitions/LibraryOptions"},module:{$ref:"#/definitions/OutputModule"},path:{$ref:"#/definitions/Path"},pathinfo:{$ref:"#/definitions/Pathinfo"},publicPath:{$ref:"#/definitions/PublicPath"},scriptType:{$ref:"#/definitions/ScriptType"},sourceMapFilename:{$ref:"#/definitions/SourceMapFilename"},sourcePrefix:{$ref:"#/definitions/SourcePrefix"},strictModuleErrorHandling:{$ref:"#/definitions/StrictModuleErrorHandling"},strictModuleExceptionHandling:{$ref:"#/definitions/StrictModuleExceptionHandling"},trustedTypes:{$ref:"#/definitions/TrustedTypes"},uniqueName:{$ref:"#/definitions/UniqueName"},wasmLoading:{$ref:"#/definitions/WasmLoading"},webassemblyModuleFilename:{$ref:"#/definitions/WebassemblyModuleFilename"},workerChunkLoading:{$ref:"#/definitions/ChunkLoading"},workerPublicPath:{$ref:"#/definitions/WorkerPublicPath"},workerWasmLoading:{$ref:"#/definitions/WasmLoading"}},required:["environment","enabledChunkLoadingTypes","enabledLibraryTypes","enabledWasmLoadingTypes"]},Parallelism:{type:"number",minimum:1},ParserOptionsByModuleType:{type:"object",additionalProperties:{type:"object",additionalProperties:!0},properties:{asset:{$ref:"#/definitions/AssetParserOptions"},"asset/inline":{$ref:"#/definitions/EmptyParserOptions"},"asset/resource":{$ref:"#/definitions/EmptyParserOptions"},"asset/source":{$ref:"#/definitions/EmptyParserOptions"},css:{$ref:"#/definitions/CssParserOptions"},"css/auto":{$ref:"#/definitions/CssAutoParserOptions"},"css/global":{$ref:"#/definitions/CssGlobalParserOptions"},"css/module":{$ref:"#/definitions/CssModuleParserOptions"},javascript:{$ref:"#/definitions/JavascriptParserOptions"},"javascript/auto":{$ref:"#/definitions/JavascriptParserOptions"},"javascript/dynamic":{$ref:"#/definitions/JavascriptParserOptions"},"javascript/esm":{$ref:"#/definitions/JavascriptParserOptions"},json:{$ref:"#/definitions/JsonParserOptions"}}},Path:{type:"string",absolutePath:!0},Pathinfo:{anyOf:[{enum:["verbose"]},{type:"boolean"}]},Performance:{anyOf:[{enum:[!1]},{$ref:"#/definitions/PerformanceOptions"}]},PerformanceOptions:{type:"object",additionalProperties:!1,properties:{assetFilter:{instanceof:"Function"},hints:{enum:[!1,"warning","error"]},maxAssetSize:{type:"number"},maxEntrypointSize:{type:"number"}}},Plugins:{type:"array",items:{anyOf:[{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/WebpackPluginInstance"},{$ref:"#/definitions/WebpackPluginFunction"}]}},Profile:{type:"boolean"},PublicPath:{anyOf:[{enum:["auto"]},{$ref:"#/definitions/RawPublicPath"}]},RawPublicPath:{anyOf:[{type:"string"},{instanceof:"Function"}]},RecordsInputPath:{anyOf:[{enum:[!1]},{type:"string",absolutePath:!0}]},RecordsOutputPath:{anyOf:[{enum:[!1]},{type:"string",absolutePath:!0}]},RecordsPath:{anyOf:[{enum:[!1]},{type:"string",absolutePath:!0}]},Resolve:{oneOf:[{$ref:"#/definitions/ResolveOptions"}]},ResolveAlias:{anyOf:[{type:"array",items:{type:"object",additionalProperties:!1,properties:{alias:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{enum:[!1]},{type:"string",minLength:1}]},name:{type:"string"},onlyModule:{type:"boolean"}},required:["alias","name"]}},{type:"object",additionalProperties:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{enum:[!1]},{type:"string",minLength:1}]}}]},ResolveLoader:{oneOf:[{$ref:"#/definitions/ResolveOptions"}]},ResolveOptions:{type:"object",additionalProperties:!1,properties:{alias:{$ref:"#/definitions/ResolveAlias"},aliasFields:{type:"array",items:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{type:"string",minLength:1}]}},byDependency:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/ResolveOptions"}]}},cache:{type:"boolean"},cachePredicate:{instanceof:"Function"},cacheWithContext:{type:"boolean"},conditionNames:{type:"array",items:{type:"string"}},descriptionFiles:{type:"array",items:{type:"string",minLength:1}},enforceExtension:{type:"boolean"},exportsFields:{type:"array",items:{type:"string"}},extensionAlias:{type:"object",additionalProperties:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{type:"string",minLength:1}]}},extensions:{type:"array",items:{type:"string"}},fallback:{oneOf:[{$ref:"#/definitions/ResolveAlias"}]},fileSystem:{},fullySpecified:{type:"boolean"},importsFields:{type:"array",items:{type:"string"}},mainFields:{type:"array",items:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{type:"string",minLength:1}]}},mainFiles:{type:"array",items:{type:"string",minLength:1}},modules:{type:"array",items:{type:"string",minLength:1}},plugins:{type:"array",items:{anyOf:[{enum:["..."]},{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/ResolvePluginInstance"}]}},preferAbsolute:{type:"boolean"},preferRelative:{type:"boolean"},resolver:{},restrictions:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0,minLength:1}]}},roots:{type:"array",items:{type:"string"}},symlinks:{type:"boolean"},unsafeCache:{anyOf:[{type:"boolean"},{type:"object",additionalProperties:!0}]},useSyncFileSystemCalls:{type:"boolean"}}},ResolvePluginInstance:{anyOf:[{type:"object",additionalProperties:!0,properties:{apply:{instanceof:"Function"}},required:["apply"]},{instanceof:"Function"}]},RuleSetCondition:{anyOf:[{instanceof:"RegExp"},{type:"string"},{instanceof:"Function"},{$ref:"#/definitions/RuleSetLogicalConditions"},{$ref:"#/definitions/RuleSetConditions"}]},RuleSetConditionAbsolute:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0},{instanceof:"Function"},{$ref:"#/definitions/RuleSetLogicalConditionsAbsolute"},{$ref:"#/definitions/RuleSetConditionsAbsolute"}]},RuleSetConditionOrConditions:{anyOf:[{$ref:"#/definitions/RuleSetCondition"},{$ref:"#/definitions/RuleSetConditions"}]},RuleSetConditionOrConditionsAbsolute:{anyOf:[{$ref:"#/definitions/RuleSetConditionAbsolute"},{$ref:"#/definitions/RuleSetConditionsAbsolute"}]},RuleSetConditions:{type:"array",items:{oneOf:[{$ref:"#/definitions/RuleSetCondition"}]}},RuleSetConditionsAbsolute:{type:"array",items:{oneOf:[{$ref:"#/definitions/RuleSetConditionAbsolute"}]}},RuleSetLoader:{type:"string",minLength:1},RuleSetLoaderOptions:{anyOf:[{type:"string"},{type:"object"}]},RuleSetLogicalConditions:{type:"object",additionalProperties:!1,properties:{and:{oneOf:[{$ref:"#/definitions/RuleSetConditions"}]},not:{oneOf:[{$ref:"#/definitions/RuleSetCondition"}]},or:{oneOf:[{$ref:"#/definitions/RuleSetConditions"}]}}},RuleSetLogicalConditionsAbsolute:{type:"object",additionalProperties:!1,properties:{and:{oneOf:[{$ref:"#/definitions/RuleSetConditionsAbsolute"}]},not:{oneOf:[{$ref:"#/definitions/RuleSetConditionAbsolute"}]},or:{oneOf:[{$ref:"#/definitions/RuleSetConditionsAbsolute"}]}}},RuleSetRule:{type:"object",additionalProperties:!1,properties:{assert:{type:"object",additionalProperties:{$ref:"#/definitions/RuleSetConditionOrConditions"}},compiler:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditions"}]},dependency:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditions"}]},descriptionData:{type:"object",additionalProperties:{$ref:"#/definitions/RuleSetConditionOrConditions"}},enforce:{enum:["pre","post"]},exclude:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditionsAbsolute"}]},generator:{type:"object"},include:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditionsAbsolute"}]},issuer:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditionsAbsolute"}]},issuerLayer:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditions"}]},layer:{type:"string"},loader:{oneOf:[{$ref:"#/definitions/RuleSetLoader"}]},mimetype:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditions"}]},oneOf:{type:"array",items:{anyOf:[{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/RuleSetRule"}]}},options:{oneOf:[{$ref:"#/definitions/RuleSetLoaderOptions"}]},parser:{type:"object",additionalProperties:!0},realResource:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditionsAbsolute"}]},resolve:{type:"object",oneOf:[{$ref:"#/definitions/ResolveOptions"}]},resource:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditionsAbsolute"}]},resourceFragment:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditions"}]},resourceQuery:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditions"}]},rules:{type:"array",items:{anyOf:[{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/RuleSetRule"}]}},scheme:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditions"}]},sideEffects:{type:"boolean"},test:{oneOf:[{$ref:"#/definitions/RuleSetConditionOrConditionsAbsolute"}]},type:{type:"string"},use:{oneOf:[{$ref:"#/definitions/RuleSetUse"}]},with:{type:"object",additionalProperties:{$ref:"#/definitions/RuleSetConditionOrConditions"}}}},RuleSetRules:{type:"array",items:{anyOf:[{enum:["..."]},{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/RuleSetRule"}]}},RuleSetUse:{anyOf:[{type:"array",items:{anyOf:[{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/RuleSetUseItem"}]}},{$ref:"#/definitions/RuleSetUseFunction"},{$ref:"#/definitions/RuleSetUseItem"}]},RuleSetUseFunction:{instanceof:"Function"},RuleSetUseItem:{anyOf:[{type:"object",additionalProperties:!1,properties:{ident:{type:"string"},loader:{oneOf:[{$ref:"#/definitions/RuleSetLoader"}]},options:{oneOf:[{$ref:"#/definitions/RuleSetLoaderOptions"}]}}},{$ref:"#/definitions/RuleSetUseFunction"},{$ref:"#/definitions/RuleSetLoader"}]},ScriptType:{enum:[!1,"text/javascript","module"]},SnapshotOptions:{type:"object",additionalProperties:!1,properties:{buildDependencies:{type:"object",additionalProperties:!1,properties:{hash:{type:"boolean"},timestamp:{type:"boolean"}}},immutablePaths:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0,minLength:1}]}},managedPaths:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0,minLength:1}]}},module:{type:"object",additionalProperties:!1,properties:{hash:{type:"boolean"},timestamp:{type:"boolean"}}},resolve:{type:"object",additionalProperties:!1,properties:{hash:{type:"boolean"},timestamp:{type:"boolean"}}},resolveBuildDependencies:{type:"object",additionalProperties:!1,properties:{hash:{type:"boolean"},timestamp:{type:"boolean"}}},unmanagedPaths:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0,minLength:1}]}}}},SourceMapFilename:{type:"string",absolutePath:!1},SourcePrefix:{type:"string"},StatsOptions:{type:"object",additionalProperties:!1,properties:{all:{type:"boolean"},assets:{type:"boolean"},assetsSort:{anyOf:[{enum:[!1]},{type:"string"}]},assetsSpace:{type:"number"},builtAt:{type:"boolean"},cached:{type:"boolean"},cachedAssets:{type:"boolean"},cachedModules:{type:"boolean"},children:{type:"boolean"},chunkGroupAuxiliary:{type:"boolean"},chunkGroupChildren:{type:"boolean"},chunkGroupMaxAssets:{type:"number"},chunkGroups:{type:"boolean"},chunkModules:{type:"boolean"},chunkModulesSpace:{type:"number"},chunkOrigins:{type:"boolean"},chunkRelations:{type:"boolean"},chunks:{type:"boolean"},chunksSort:{anyOf:[{enum:[!1]},{type:"string"}]},colors:{anyOf:[{type:"boolean"},{type:"object",additionalProperties:!1,properties:{bold:{type:"string"},cyan:{type:"string"},green:{type:"string"},magenta:{type:"string"},red:{type:"string"},yellow:{type:"string"}}}]},context:{type:"string",absolutePath:!0},dependentModules:{type:"boolean"},depth:{type:"boolean"},entrypoints:{anyOf:[{enum:["auto"]},{type:"boolean"}]},env:{type:"boolean"},errorCause:{anyOf:[{enum:["auto"]},{type:"boolean"}]},errorDetails:{anyOf:[{enum:["auto"]},{type:"boolean"}]},errorErrors:{anyOf:[{enum:["auto"]},{type:"boolean"}]},errorStack:{type:"boolean"},errors:{type:"boolean"},errorsCount:{type:"boolean"},errorsSpace:{type:"number"},exclude:{anyOf:[{type:"boolean"},{$ref:"#/definitions/ModuleFilterTypes"}]},excludeAssets:{oneOf:[{$ref:"#/definitions/AssetFilterTypes"}]},excludeModules:{anyOf:[{type:"boolean"},{$ref:"#/definitions/ModuleFilterTypes"}]},groupAssetsByChunk:{type:"boolean"},groupAssetsByEmitStatus:{type:"boolean"},groupAssetsByExtension:{type:"boolean"},groupAssetsByInfo:{type:"boolean"},groupAssetsByPath:{type:"boolean"},groupModulesByAttributes:{type:"boolean"},groupModulesByCacheStatus:{type:"boolean"},groupModulesByExtension:{type:"boolean"},groupModulesByLayer:{type:"boolean"},groupModulesByPath:{type:"boolean"},groupModulesByType:{type:"boolean"},groupReasonsByOrigin:{type:"boolean"},hash:{type:"boolean"},ids:{type:"boolean"},logging:{anyOf:[{enum:["none","error","warn","info","log","verbose"]},{type:"boolean"}]},loggingDebug:{anyOf:[{type:"boolean"},{$ref:"#/definitions/FilterTypes"}]},loggingTrace:{type:"boolean"},moduleAssets:{type:"boolean"},moduleTrace:{type:"boolean"},modules:{type:"boolean"},modulesSort:{anyOf:[{enum:[!1]},{type:"string"}]},modulesSpace:{type:"number"},nestedModules:{type:"boolean"},nestedModulesSpace:{type:"number"},optimizationBailout:{type:"boolean"},orphanModules:{type:"boolean"},outputPath:{type:"boolean"},performance:{type:"boolean"},preset:{anyOf:[{type:"boolean"},{type:"string"}]},providedExports:{type:"boolean"},publicPath:{type:"boolean"},reasons:{type:"boolean"},reasonsSpace:{type:"number"},relatedAssets:{type:"boolean"},runtime:{type:"boolean"},runtimeModules:{type:"boolean"},source:{type:"boolean"},timings:{type:"boolean"},usedExports:{type:"boolean"},version:{type:"boolean"},warnings:{type:"boolean"},warningsCount:{type:"boolean"},warningsFilter:{oneOf:[{$ref:"#/definitions/WarningFilterTypes"}]},warningsSpace:{type:"number"}}},StatsValue:{anyOf:[{enum:["none","summary","errors-only","errors-warnings","minimal","normal","detailed","verbose"]},{type:"boolean"},{$ref:"#/definitions/StatsOptions"}]},StrictModuleErrorHandling:{type:"boolean"},StrictModuleExceptionHandling:{type:"boolean"},Target:{anyOf:[{type:"array",items:{type:"string",minLength:1},minItems:1},{enum:[!1]},{type:"string",minLength:1}]},TrustedTypes:{type:"object",additionalProperties:!1,properties:{onPolicyCreationFailure:{enum:["continue","stop"]},policyName:{type:"string",minLength:1}}},UmdNamedDefine:{type:"boolean"},UniqueName:{type:"string",minLength:1},WarningFilterItemTypes:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!1},{instanceof:"Function"}]},WarningFilterTypes:{anyOf:[{type:"array",items:{oneOf:[{$ref:"#/definitions/WarningFilterItemTypes"}]}},{$ref:"#/definitions/WarningFilterItemTypes"}]},WasmLoading:{anyOf:[{enum:[!1]},{$ref:"#/definitions/WasmLoadingType"}]},WasmLoadingType:{anyOf:[{enum:["fetch","async-node"]},{type:"string"}]},Watch:{type:"boolean"},WatchOptions:{type:"object",additionalProperties:!1,properties:{aggregateTimeout:{type:"number"},followSymlinks:{type:"boolean"},ignored:{anyOf:[{type:"array",items:{type:"string",minLength:1}},{instanceof:"RegExp"},{type:"string",minLength:1}]},poll:{anyOf:[{type:"number"},{type:"boolean"}]},stdin:{type:"boolean"}}},WebassemblyModuleFilename:{type:"string",absolutePath:!1},WebpackOptionsNormalized:{type:"object",additionalProperties:!1,properties:{amd:{$ref:"#/definitions/Amd"},bail:{$ref:"#/definitions/Bail"},cache:{$ref:"#/definitions/CacheOptionsNormalized"},context:{$ref:"#/definitions/Context"},dependencies:{$ref:"#/definitions/Dependencies"},devServer:{$ref:"#/definitions/DevServer"},devtool:{$ref:"#/definitions/DevTool"},entry:{$ref:"#/definitions/EntryNormalized"},experiments:{$ref:"#/definitions/ExperimentsNormalized"},externals:{$ref:"#/definitions/Externals"},externalsPresets:{$ref:"#/definitions/ExternalsPresets"},externalsType:{$ref:"#/definitions/ExternalsType"},ignoreWarnings:{$ref:"#/definitions/IgnoreWarningsNormalized"},infrastructureLogging:{$ref:"#/definitions/InfrastructureLogging"},loader:{$ref:"#/definitions/Loader"},mode:{$ref:"#/definitions/Mode"},module:{$ref:"#/definitions/ModuleOptionsNormalized"},name:{$ref:"#/definitions/Name"},node:{$ref:"#/definitions/Node"},optimization:{$ref:"#/definitions/OptimizationNormalized"},output:{$ref:"#/definitions/OutputNormalized"},parallelism:{$ref:"#/definitions/Parallelism"},performance:{$ref:"#/definitions/Performance"},plugins:{$ref:"#/definitions/Plugins"},profile:{$ref:"#/definitions/Profile"},recordsInputPath:{$ref:"#/definitions/RecordsInputPath"},recordsOutputPath:{$ref:"#/definitions/RecordsOutputPath"},resolve:{$ref:"#/definitions/Resolve"},resolveLoader:{$ref:"#/definitions/ResolveLoader"},snapshot:{$ref:"#/definitions/SnapshotOptions"},stats:{$ref:"#/definitions/StatsValue"},target:{$ref:"#/definitions/Target"},watch:{$ref:"#/definitions/Watch"},watchOptions:{$ref:"#/definitions/WatchOptions"}},required:["cache","snapshot","entry","experiments","externals","externalsPresets","infrastructureLogging","module","node","optimization","output","plugins","resolve","resolveLoader","stats","watchOptions"]},WebpackPluginFunction:{instanceof:"Function"},WebpackPluginInstance:{type:"object",additionalProperties:!0,properties:{apply:{instanceof:"Function"}},required:["apply"]},WorkerPublicPath:{type:"string"}},type:"object",additionalProperties:!1,properties:{amd:{$ref:"#/definitions/Amd"},bail:{$ref:"#/definitions/Bail"},cache:{$ref:"#/definitions/CacheOptions"},context:{$ref:"#/definitions/Context"},dependencies:{$ref:"#/definitions/Dependencies"},devServer:{$ref:"#/definitions/DevServer"},devtool:{$ref:"#/definitions/DevTool"},entry:{$ref:"#/definitions/Entry"},experiments:{$ref:"#/definitions/Experiments"},extends:{$ref:"#/definitions/Extends"},externals:{$ref:"#/definitions/Externals"},externalsPresets:{$ref:"#/definitions/ExternalsPresets"},externalsType:{$ref:"#/definitions/ExternalsType"},ignoreWarnings:{$ref:"#/definitions/IgnoreWarnings"},infrastructureLogging:{$ref:"#/definitions/InfrastructureLogging"},loader:{$ref:"#/definitions/Loader"},mode:{$ref:"#/definitions/Mode"},module:{$ref:"#/definitions/ModuleOptions"},name:{$ref:"#/definitions/Name"},node:{$ref:"#/definitions/Node"},optimization:{$ref:"#/definitions/Optimization"},output:{$ref:"#/definitions/Output"},parallelism:{$ref:"#/definitions/Parallelism"},performance:{$ref:"#/definitions/Performance"},plugins:{$ref:"#/definitions/Plugins"},profile:{$ref:"#/definitions/Profile"},recordsInputPath:{$ref:"#/definitions/RecordsInputPath"},recordsOutputPath:{$ref:"#/definitions/RecordsOutputPath"},recordsPath:{$ref:"#/definitions/RecordsPath"},resolve:{$ref:"#/definitions/Resolve"},resolveLoader:{$ref:"#/definitions/ResolveLoader"},snapshot:{$ref:"#/definitions/SnapshotOptions"},stats:{$ref:"#/definitions/StatsValue"},target:{$ref:"#/definitions/Target"},watch:{$ref:"#/definitions/Watch"},watchOptions:{$ref:"#/definitions/WatchOptions"}}},n=Object.prototype.hasOwnProperty,r={type:"object",additionalProperties:!1,properties:{allowCollectingMemory:{type:"boolean"},buildDependencies:{type:"object",additionalProperties:{type:"array",items:{type:"string",minLength:1}}},cacheDirectory:{type:"string",absolutePath:!0},cacheLocation:{type:"string",absolutePath:!0},compression:{enum:[!1,"gzip","brotli"]},hashAlgorithm:{type:"string"},idleTimeout:{type:"number",minimum:0},idleTimeoutAfterLargeChanges:{type:"number",minimum:0},idleTimeoutForInitialStore:{type:"number",minimum:0},immutablePaths:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0,minLength:1}]}},managedPaths:{type:"array",items:{anyOf:[{instanceof:"RegExp"},{type:"string",absolutePath:!0,minLength:1}]}},maxAge:{type:"number",minimum:0},maxMemoryGenerations:{type:"number",minimum:0},memoryCacheUnaffected:{type:"boolean"},name:{type:"string"},profile:{type:"boolean"},readonly:{type:"boolean"},store:{enum:["pack"]},type:{enum:["filesystem"]},version:{type:"string"}},required:["type"]};function o(t,{instancePath:s="",parentData:i,parentDataProperty:a,rootData:l=t}={}){let p=null,f=0;const u=f;let c=!1;const y=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var m=y===f;if(c=c||m,!c){const o=f;if(f==f)if(t&&"object"==typeof t&&!Array.isArray(t)){let e;if(void 0===t.type&&(e="type")){const t={params:{missingProperty:e}};null===p?p=[t]:p.push(t),f++}else{const e=f;for(const e in t)if("cacheUnaffected"!==e&&"maxGenerations"!==e&&"type"!==e){const t={params:{additionalProperty:e}};null===p?p=[t]:p.push(t),f++;break}if(e===f){if(void 0!==t.cacheUnaffected){const e=f;if("boolean"!=typeof t.cacheUnaffected){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}var d=e===f}else d=!0;if(d){if(void 0!==t.maxGenerations){let e=t.maxGenerations;const n=f;if(f===n)if("number"==typeof e){if(e<1||isNaN(e)){const e={params:{comparison:">=",limit:1}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d)if(void 0!==t.type){const e=f;if("memory"!==t.type){const e={params:{}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0}}}}else{const e={params:{type:"object"}};null===p?p=[e]:p.push(e),f++}if(m=o===f,c=c||m,!c){const o=f;if(f==f)if(t&&"object"==typeof t&&!Array.isArray(t)){let o;if(void 0===t.type&&(o="type")){const e={params:{missingProperty:o}};null===p?p=[e]:p.push(e),f++}else{const o=f;for(const e in t)if(!n.call(r.properties,e)){const t={params:{additionalProperty:e}};null===p?p=[t]:p.push(t),f++;break}if(o===f){if(void 0!==t.allowCollectingMemory){const e=f;if("boolean"!=typeof t.allowCollectingMemory){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}var h=e===f}else h=!0;if(h){if(void 0!==t.buildDependencies){let e=t.buildDependencies;const n=f;if(f===n)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=f;if(f===r)if(Array.isArray(n)){const e=n.length;for(let t=0;t=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.idleTimeoutAfterLargeChanges){let e=t.idleTimeoutAfterLargeChanges;const n=f;if(f===n)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.idleTimeoutForInitialStore){let e=t.idleTimeoutForInitialStore;const n=f;if(f===n)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.immutablePaths){let n=t.immutablePaths;const r=f;if(f===r)if(Array.isArray(n)){const t=n.length;for(let r=0;r=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.maxMemoryGenerations){let e=t.maxMemoryGenerations;const n=f;if(f===n)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.memoryCacheUnaffected){const e=f;if("boolean"!=typeof t.memoryCacheUnaffected){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.name){const e=f;if("string"!=typeof t.name){const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.profile){const e=f;if("boolean"!=typeof t.profile){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.readonly){const e=f;if("boolean"!=typeof t.readonly){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.store){const e=f;if("pack"!==t.store){const e={params:{}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.type){const e=f;if("filesystem"!==t.type){const e={params:{}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h)if(void 0!==t.version){const e=f;if("string"!=typeof t.version){const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0}}}}}}}}}}}}}}}}}}}}}else{const e={params:{type:"object"}};null===p?p=[e]:p.push(e),f++}m=o===f,c=c||m}}if(!c){const e={params:{}};return null===p?p=[e]:p.push(e),f++,o.errors=p,!1}return f=u,null!==p&&(u?p.length=u:p=null),o.errors=p,0===f}function s(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,l=0;const p=l;let f=!1;const u=l;if(!0!==e){const e={params:{}};null===a?a=[e]:a.push(e),l++}var c=u===l;if(f=f||c,!f){const s=l;o(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:i})||(a=null===a?o.errors:a.concat(o.errors),l=a.length),c=s===l,f=f||c}if(!f){const e={params:{}};return null===a?a=[e]:a.push(e),l++,s.errors=a,!1}return l=p,null!==a&&(p?a.length=p:a=null),s.errors=a,0===l}const i={type:"object",additionalProperties:!1,properties:{asyncChunks:{type:"boolean"},baseUri:{type:"string"},chunkLoading:{$ref:"#/definitions/ChunkLoading"},dependOn:{anyOf:[{type:"array",items:{type:"string",minLength:1},minItems:1,uniqueItems:!0},{type:"string",minLength:1}]},filename:{$ref:"#/definitions/EntryFilename"},import:{$ref:"#/definitions/EntryItem"},layer:{$ref:"#/definitions/Layer"},library:{$ref:"#/definitions/LibraryOptions"},publicPath:{$ref:"#/definitions/PublicPath"},runtime:{$ref:"#/definitions/EntryRuntime"},wasmLoading:{$ref:"#/definitions/WasmLoading"}},required:["import"]};function a(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const l=i;let p=!1;const f=i;if(!1!==e){const e={params:{}};null===s?s=[e]:s.push(e),i++}var u=f===i;if(p=p||u,!p){const t=i,n=i;let r=!1;const o=i;if("jsonp"!==e&&"import-scripts"!==e&&"require"!==e&&"async-node"!==e&&"import"!==e){const e={params:{}};null===s?s=[e]:s.push(e),i++}var c=o===i;if(r=r||c,!r){const t=i;if("string"!=typeof e){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}c=t===i,r=r||c}if(r)i=n,null!==s&&(n?s.length=n:s=null);else{const e={params:{}};null===s?s=[e]:s.push(e),i++}u=t===i,p=p||u}if(!p){const e={params:{}};return null===s?s=[e]:s.push(e),i++,a.errors=s,!1}return i=l,null!==s&&(l?s.length=l:s=null),a.errors=s,0===i}function l(t,{instancePath:n="",parentData:r,parentDataProperty:o,rootData:s=t}={}){let i=null,a=0;const p=a;let f=!1,u=null;const c=a,y=a;let m=!1;const d=a;if(a===d)if("string"==typeof t){if(t.includes("!")||!1!==e.test(t)){const e={params:{}};null===i?i=[e]:i.push(e),a++}else if(t.length<1){const e={params:{}};null===i?i=[e]:i.push(e),a++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),a++}var h=d===a;if(m=m||h,!m){const e=a;if(!(t instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),a++}h=e===a,m=m||h}if(m)a=y,null!==i&&(y?i.length=y:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),a++}if(c===a&&(f=!0,u=0),!f){const e={params:{passingSchemas:u}};return null===i?i=[e]:i.push(e),a++,l.errors=i,!1}return a=p,null!==i&&(p?i.length=p:i=null),l.errors=i,0===a}function p(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1;const f=i;if("string"!=typeof e){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}var u=f===i;if(l=l||u,!l){const t=i;if(i==i)if(e&&"object"==typeof e&&!Array.isArray(e)){const t=i;for(const t in e)if("amd"!==t&&"commonjs"!==t&&"commonjs2"!==t&&"root"!==t){const e={params:{additionalProperty:t}};null===s?s=[e]:s.push(e),i++;break}if(t===i){if(void 0!==e.amd){const t=i;if("string"!=typeof e.amd){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}var c=t===i}else c=!0;if(c){if(void 0!==e.commonjs){const t=i;if("string"!=typeof e.commonjs){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}c=t===i}else c=!0;if(c){if(void 0!==e.commonjs2){const t=i;if("string"!=typeof e.commonjs2){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}c=t===i}else c=!0;if(c)if(void 0!==e.root){const t=i;if("string"!=typeof e.root){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}c=t===i}else c=!0}}}}else{const e={params:{type:"object"}};null===s?s=[e]:s.push(e),i++}u=t===i,l=l||u}if(!l){const e={params:{}};return null===s?s=[e]:s.push(e),i++,p.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),p.errors=s,0===i}function f(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1;const p=i;if(i===p)if(Array.isArray(e))if(e.length<1){const e={params:{limit:1}};null===s?s=[e]:s.push(e),i++}else{const t=e.length;for(let n=0;n1){const r={};for(;n--;){let o=t[n];if("string"==typeof o){if("number"==typeof r[o]){e=r[o];const t={params:{i:n,j:e}};null===p?p=[t]:p.push(t),f++;break}r[o]=n}}}}}else{const e={params:{type:"array"}};null===p?p=[e]:p.push(e),f++}var b=s===f;if(o=o||b,!o){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}b=e===f,o=o||b}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),d=n===f}else d=!0;if(d){if(void 0!==e.filename){const n=f;l(e.filename,{instancePath:t+"/filename",parentData:e,parentDataProperty:"filename",rootData:s})||(p=null===p?l.errors:p.concat(l.errors),f=p.length),d=n===f}else d=!0;if(d){if(void 0!==e.import){let t=e.import;const n=f,r=f;let o=!1;const s=f;if(f===s)if(Array.isArray(t))if(t.length<1){const e={params:{limit:1}};null===p?p=[e]:p.push(e),f++}else{var g=!0;const e=t.length;for(let n=0;n1){const r={};for(;n--;){let o=t[n];if("string"==typeof o){if("number"==typeof r[o]){e=r[o];const t={params:{i:n,j:e}};null===p?p=[t]:p.push(t),f++;break}r[o]=n}}}}}else{const e={params:{type:"array"}};null===p?p=[e]:p.push(e),f++}var v=s===f;if(o=o||v,!o){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}v=e===f,o=o||v}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),d=n===f}else d=!0;if(d){if(void 0!==e.layer){let t=e.layer;const n=f,r=f;let o=!1;const s=f;if(null!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var P=s===f;if(o=o||P,!o){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}P=e===f,o=o||P}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),d=n===f}else d=!0;if(d){if(void 0!==e.library){const n=f;u(e.library,{instancePath:t+"/library",parentData:e,parentDataProperty:"library",rootData:s})||(p=null===p?u.errors:p.concat(u.errors),f=p.length),d=n===f}else d=!0;if(d){if(void 0!==e.publicPath){const n=f;c(e.publicPath,{instancePath:t+"/publicPath",parentData:e,parentDataProperty:"publicPath",rootData:s})||(p=null===p?c.errors:p.concat(c.errors),f=p.length),d=n===f}else d=!0;if(d){if(void 0!==e.runtime){let t=e.runtime;const n=f,r=f;let o=!1;const s=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var D=s===f;if(o=o||D,!o){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}D=e===f,o=o||D}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),d=n===f}else d=!0;if(d)if(void 0!==e.wasmLoading){const n=f;y(e.wasmLoading,{instancePath:t+"/wasmLoading",parentData:e,parentDataProperty:"wasmLoading",rootData:s})||(p=null===p?y.errors:p.concat(y.errors),f=p.length),d=n===f}else d=!0}}}}}}}}}}}}}return m.errors=p,0===f}function d(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;if(0===i){if(!e||"object"!=typeof e||Array.isArray(e))return d.errors=[{params:{type:"object"}}],!1;for(const n in e){let r=e[n];const f=i,u=i;let c=!1;const y=i,h=i;let b=!1;const g=i;if(i===g)if(Array.isArray(r))if(r.length<1){const e={params:{limit:1}};null===s?s=[e]:s.push(e),i++}else{var a=!0;const e=r.length;for(let t=0;t1){const n={};for(;t--;){let o=r[t];if("string"==typeof o){if("number"==typeof n[o]){e=n[o];const r={params:{i:t,j:e}};null===s?s=[r]:s.push(r),i++;break}n[o]=t}}}}}else{const e={params:{type:"array"}};null===s?s=[e]:s.push(e),i++}var l=g===i;if(b=b||l,!b){const e=i;if(i===e)if("string"==typeof r){if(r.length<1){const e={params:{}};null===s?s=[e]:s.push(e),i++}}else{const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}l=e===i,b=b||l}if(b)i=h,null!==s&&(h?s.length=h:s=null);else{const e={params:{}};null===s?s=[e]:s.push(e),i++}var p=y===i;if(c=c||p,!c){const a=i;m(r,{instancePath:t+"/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:n,rootData:o})||(s=null===s?m.errors:s.concat(m.errors),i=s.length),p=a===i,c=c||p}if(!c){const e={params:{}};return null===s?s=[e]:s.push(e),i++,d.errors=s,!1}if(i=u,null!==s&&(u?s.length=u:s=null),f!==i)break}}return d.errors=s,0===i}function h(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1,p=null;const f=i,u=i;let c=!1;const y=i;if(i===y)if(Array.isArray(e))if(e.length<1){const e={params:{limit:1}};null===s?s=[e]:s.push(e),i++}else{var m=!0;const t=e.length;for(let n=0;n1){const r={};for(;n--;){let o=e[n];if("string"==typeof o){if("number"==typeof r[o]){t=r[o];const e={params:{i:n,j:t}};null===s?s=[e]:s.push(e),i++;break}r[o]=n}}}}}else{const e={params:{type:"array"}};null===s?s=[e]:s.push(e),i++}var d=y===i;if(c=c||d,!c){const t=i;if(i===t)if("string"==typeof e){if(e.length<1){const e={params:{}};null===s?s=[e]:s.push(e),i++}}else{const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}d=t===i,c=c||d}if(c)i=u,null!==s&&(u?s.length=u:s=null);else{const e={params:{}};null===s?s=[e]:s.push(e),i++}if(f===i&&(l=!0,p=0),!l){const e={params:{passingSchemas:p}};return null===s?s=[e]:s.push(e),i++,h.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),h.errors=s,0===i}function b(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1;const p=i;d(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o})||(s=null===s?d.errors:s.concat(d.errors),i=s.length);var f=p===i;if(l=l||f,!l){const a=i;h(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o})||(s=null===s?h.errors:s.concat(h.errors),i=s.length),f=a===i,l=l||f}if(!l){const e={params:{}};return null===s?s=[e]:s.push(e),i++,b.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),b.errors=s,0===i}function g(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1;const p=i;if(!(e instanceof Function)){const e={params:{}};null===s?s=[e]:s.push(e),i++}var f=p===i;if(l=l||f,!l){const a=i;b(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o})||(s=null===s?b.errors:s.concat(b.errors),i=s.length),f=a===i,l=l||f}if(!l){const e={params:{}};return null===s?s=[e]:s.push(e),i++,g.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),g.errors=s,0===i}const v={type:"object",additionalProperties:!1,properties:{asyncWebAssembly:{type:"boolean"},backCompat:{type:"boolean"},buildHttp:{anyOf:[{$ref:"#/definitions/HttpUriAllowedUris"},{$ref:"#/definitions/HttpUriOptions"}]},cacheUnaffected:{type:"boolean"},css:{type:"boolean"},deferImport:{type:"boolean"},futureDefaults:{type:"boolean"},layers:{type:"boolean"},lazyCompilation:{anyOf:[{type:"boolean"},{$ref:"#/definitions/LazyCompilationOptions"}]},outputModule:{type:"boolean"},syncWebAssembly:{type:"boolean"},topLevelAwait:{type:"boolean"}}},P=new RegExp("^https?://","u");function D(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1,p=null;const f=i;if(i==i)if(Array.isArray(e)){const t=e.length;for(let n=0;n=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var u=y===l;if(c=c||u,!c){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}u=t===l,c=c||u}if(c)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.filename){let n=t.filename;const r=l,o=l;let s=!1;const i=l;if(l===i)if("string"==typeof n){if(n.includes("!")||!1!==e.test(n)){const e={params:{}};null===a?a=[e]:a.push(e),l++}else if(n.length<1){const e={params:{}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}var c=i===l;if(s=s||c,!s){const e=l;if(!(n instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}c=e===l,s=s||c}if(!s){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=o,null!==a&&(o?a.length=o:a=null),p=r===l}else p=!0;if(p){if(void 0!==t.idHint){const e=l;if("string"!=typeof t.idHint)return De.errors=[{params:{type:"string"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.layer){let e=t.layer;const n=l,r=l;let o=!1;const s=l;if(!(e instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}var y=s===l;if(o=o||y,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(y=t===l,o=o||y,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}y=t===l,o=o||y}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncRequests){let e=t.maxAsyncRequests;const n=l;if(l===n){if("number"!=typeof e)return De.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return De.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncSize){let e=t.maxAsyncSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var m=c===l;if(u=u||m,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}m=t===l,u=u||m}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialRequests){let e=t.maxInitialRequests;const n=l;if(l===n){if("number"!=typeof e)return De.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return De.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialSize){let e=t.maxInitialSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var d=c===l;if(u=u||d,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}d=t===l,u=u||d}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxSize){let e=t.maxSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var h=c===l;if(u=u||h,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}h=t===l,u=u||h}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minChunks){let e=t.minChunks;const n=l;if(l===n){if("number"!=typeof e)return De.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return De.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.minRemainingSize){let e=t.minRemainingSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var b=c===l;if(u=u||b,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}b=t===l,u=u||b}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSize){let e=t.minSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var g=c===l;if(u=u||g,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}g=t===l,u=u||g}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSizeReduction){let e=t.minSizeReduction;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var v=c===l;if(u=u||v,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}v=t===l,u=u||v}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.name){let e=t.name;const n=l,r=l;let o=!1;const s=l;if(!1!==e){const e={params:{}};null===a?a=[e]:a.push(e),l++}var P=s===l;if(o=o||P,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(P=t===l,o=o||P,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}P=t===l,o=o||P}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.priority){const e=l;if("number"!=typeof t.priority)return De.errors=[{params:{type:"number"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.reuseExistingChunk){const e=l;if("boolean"!=typeof t.reuseExistingChunk)return De.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.test){let e=t.test;const n=l,r=l;let o=!1;const s=l;if(!(e instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}var D=s===l;if(o=o||D,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(D=t===l,o=o||D,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}D=t===l,o=o||D}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.type){let e=t.type;const n=l,r=l;let o=!1;const s=l;if(!(e instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}var O=s===l;if(o=o||O,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(O=t===l,o=o||O,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}O=t===l,o=o||O}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p)if(void 0!==t.usedExports){const e=l;if("boolean"!=typeof t.usedExports)return De.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}}}}}return De.errors=a,0===l}function Oe(t,{instancePath:r="",parentData:o,parentDataProperty:s,rootData:i=t}={}){let a=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return Oe.errors=[{params:{type:"object"}}],!1;{const o=l;for(const e in t)if(!n.call(ve.properties,e))return Oe.errors=[{params:{additionalProperty:e}}],!1;if(o===l){if(void 0!==t.automaticNameDelimiter){let e=t.automaticNameDelimiter;const n=l;if(l===n){if("string"!=typeof e)return Oe.errors=[{params:{type:"string"}}],!1;if(e.length<1)return Oe.errors=[{params:{}}],!1}var p=n===l}else p=!0;if(p){if(void 0!==t.cacheGroups){let e=t.cacheGroups;const n=l,o=l,s=l;if(l===s)if(e&&"object"==typeof e&&!Array.isArray(e)){let t;if(void 0===e.test&&(t="test")){const e={};null===a?a=[e]:a.push(e),l++}else if(void 0!==e.test){let t=e.test;const n=l;let r=!1;const o=l;if(!(t instanceof RegExp)){const e={};null===a?a=[e]:a.push(e),l++}var f=o===l;if(r=r||f,!r){const e=l;if("string"!=typeof t){const e={};null===a?a=[e]:a.push(e),l++}if(f=e===l,r=r||f,!r){const e=l;if(!(t instanceof Function)){const e={};null===a?a=[e]:a.push(e),l++}f=e===l,r=r||f}}if(r)l=n,null!==a&&(n?a.length=n:a=null);else{const e={};null===a?a=[e]:a.push(e),l++}}}else{const e={};null===a?a=[e]:a.push(e),l++}if(s===l)return Oe.errors=[{params:{}}],!1;if(l=o,null!==a&&(o?a.length=o:a=null),l===n){if(!e||"object"!=typeof e||Array.isArray(e))return Oe.errors=[{params:{type:"object"}}],!1;for(const t in e){let n=e[t];const o=l,s=l;let p=!1;const f=l;if(!1!==n){const e={params:{}};null===a?a=[e]:a.push(e),l++}var u=f===l;if(p=p||u,!p){const o=l;if(!(n instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}if(u=o===l,p=p||u,!p){const o=l;if("string"!=typeof n){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(u=o===l,p=p||u,!p){const o=l;if(!(n instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}if(u=o===l,p=p||u,!p){const o=l;De(n,{instancePath:r+"/cacheGroups/"+t.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:t,rootData:i})||(a=null===a?De.errors:a.concat(De.errors),l=a.length),u=o===l,p=p||u}}}}if(!p){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}if(l=s,null!==a&&(s?a.length=s:a=null),o!==l)break}}p=n===l}else p=!0;if(p){if(void 0!==t.chunks){let e=t.chunks;const n=l,r=l;let o=!1;const s=l;if("initial"!==e&&"async"!==e&&"all"!==e){const e={params:{}};null===a?a=[e]:a.push(e),l++}var c=s===l;if(o=o||c,!o){const t=l;if(!(e instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}if(c=t===l,o=o||c,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}c=t===l,o=o||c}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.defaultSizeTypes){let e=t.defaultSizeTypes;const n=l;if(l===n){if(!Array.isArray(e))return Oe.errors=[{params:{type:"array"}}],!1;if(e.length<1)return Oe.errors=[{params:{limit:1}}],!1;{const t=e.length;for(let n=0;n=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var y=c===l;if(u=u||y,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}y=t===l,u=u||y}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.fallbackCacheGroup){let e=t.fallbackCacheGroup;const n=l;if(l===n){if(!e||"object"!=typeof e||Array.isArray(e))return Oe.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in e)if("automaticNameDelimiter"!==t&&"chunks"!==t&&"maxAsyncSize"!==t&&"maxInitialSize"!==t&&"maxSize"!==t&&"minSize"!==t&&"minSizeReduction"!==t)return Oe.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==e.automaticNameDelimiter){let t=e.automaticNameDelimiter;const n=l;if(l===n){if("string"!=typeof t)return Oe.errors=[{params:{type:"string"}}],!1;if(t.length<1)return Oe.errors=[{params:{}}],!1}var m=n===l}else m=!0;if(m){if(void 0!==e.chunks){let t=e.chunks;const n=l,r=l;let o=!1;const s=l;if("initial"!==t&&"async"!==t&&"all"!==t){const e={params:{}};null===a?a=[e]:a.push(e),l++}var d=s===l;if(o=o||d,!o){const e=l;if(!(t instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}if(d=e===l,o=o||d,!o){const e=l;if(!(t instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}d=e===l,o=o||d}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxAsyncSize){let t=e.maxAsyncSize;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var h=u===l;if(f=f||h,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}h=e===l,f=f||h}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxInitialSize){let t=e.maxInitialSize;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var b=u===l;if(f=f||b,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}b=e===l,f=f||b}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxSize){let t=e.maxSize;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var g=u===l;if(f=f||g,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}g=e===l,f=f||g}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m){if(void 0!==e.minSize){let t=e.minSize;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var v=u===l;if(f=f||v,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}v=e===l,f=f||v}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m)if(void 0!==e.minSizeReduction){let t=e.minSizeReduction;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var P=u===l;if(f=f||P,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}P=e===l,f=f||P}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0}}}}}}}}p=n===l}else p=!0;if(p){if(void 0!==t.filename){let n=t.filename;const r=l,o=l;let s=!1;const i=l;if(l===i)if("string"==typeof n){if(n.includes("!")||!1!==e.test(n)){const e={params:{}};null===a?a=[e]:a.push(e),l++}else if(n.length<1){const e={params:{}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}var D=i===l;if(s=s||D,!s){const e=l;if(!(n instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}D=e===l,s=s||D}if(!s){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=o,null!==a&&(o?a.length=o:a=null),p=r===l}else p=!0;if(p){if(void 0!==t.hidePathInfo){const e=l;if("boolean"!=typeof t.hidePathInfo)return Oe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.maxAsyncRequests){let e=t.maxAsyncRequests;const n=l;if(l===n){if("number"!=typeof e)return Oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return Oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncSize){let e=t.maxAsyncSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var O=c===l;if(u=u||O,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}O=t===l,u=u||O}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialRequests){let e=t.maxInitialRequests;const n=l;if(l===n){if("number"!=typeof e)return Oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return Oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialSize){let e=t.maxInitialSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var C=c===l;if(u=u||C,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}C=t===l,u=u||C}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxSize){let e=t.maxSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var x=c===l;if(u=u||x,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}x=t===l,u=u||x}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minChunks){let e=t.minChunks;const n=l;if(l===n){if("number"!=typeof e)return Oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return Oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.minRemainingSize){let e=t.minRemainingSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var $=c===l;if(u=u||$,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}$=t===l,u=u||$}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSize){let e=t.minSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var A=c===l;if(u=u||A,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}A=t===l,u=u||A}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSizeReduction){let e=t.minSizeReduction;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var k=c===l;if(u=u||k,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}k=t===l,u=u||k}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.name){let e=t.name;const n=l,r=l;let o=!1;const s=l;if(!1!==e){const e={params:{}};null===a?a=[e]:a.push(e),l++}var j=s===l;if(o=o||j,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(j=t===l,o=o||j,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}j=t===l,o=o||j}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p)if(void 0!==t.usedExports){const e=l;if("boolean"!=typeof t.usedExports)return Oe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}}return Oe.errors=a,0===l}function Ce(e,{instancePath:t="",parentData:r,parentDataProperty:o,rootData:s=e}={}){let i=null,a=0;if(0===a){if(!e||"object"!=typeof e||Array.isArray(e))return Ce.errors=[{params:{type:"object"}}],!1;{const r=a;for(const t in e)if(!n.call(ge.properties,t))return Ce.errors=[{params:{additionalProperty:t}}],!1;if(r===a){if(void 0!==e.avoidEntryIife){const t=a;if("boolean"!=typeof e.avoidEntryIife)return Ce.errors=[{params:{type:"boolean"}}],!1;var l=t===a}else l=!0;if(l){if(void 0!==e.checkWasmTypes){const t=a;if("boolean"!=typeof e.checkWasmTypes)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.chunkIds){let t=e.chunkIds;const n=a;if("natural"!==t&&"named"!==t&&"deterministic"!==t&&"size"!==t&&"total-size"!==t&&!1!==t)return Ce.errors=[{params:{}}],!1;l=n===a}else l=!0;if(l){if(void 0!==e.concatenateModules){const t=a;if("boolean"!=typeof e.concatenateModules)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.emitOnErrors){const t=a;if("boolean"!=typeof e.emitOnErrors)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.flagIncludedChunks){const t=a;if("boolean"!=typeof e.flagIncludedChunks)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.innerGraph){const t=a;if("boolean"!=typeof e.innerGraph)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.mangleExports){let t=e.mangleExports;const n=a,r=a;let o=!1;const s=a;if("size"!==t&&"deterministic"!==t){const e={params:{}};null===i?i=[e]:i.push(e),a++}var p=s===a;if(o=o||p,!o){const e=a;if("boolean"!=typeof t){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),a++}p=e===a,o=o||p}if(!o){const e={params:{}};return null===i?i=[e]:i.push(e),a++,Ce.errors=i,!1}a=r,null!==i&&(r?i.length=r:i=null),l=n===a}else l=!0;if(l){if(void 0!==e.mangleWasmImports){const t=a;if("boolean"!=typeof e.mangleWasmImports)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.mergeDuplicateChunks){const t=a;if("boolean"!=typeof e.mergeDuplicateChunks)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.minimize){const t=a;if("boolean"!=typeof e.minimize)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.minimizer){let t=e.minimizer;const n=a;if(a===n){if(!Array.isArray(t))return Ce.errors=[{params:{type:"array"}}],!1;{const e=t.length;for(let n=0;n=",limit:1}}],!1}u=n===f}else u=!0;if(u){if(void 0!==t.hashFunction){let e=t.hashFunction;const n=f,r=f;let o=!1;const s=f;if(f===s)if("string"==typeof e){if(e.length<1){const e={params:{}};null===l?l=[e]:l.push(e),f++}}else{const e={params:{type:"string"}};null===l?l=[e]:l.push(e),f++}var v=s===f;if(o=o||v,!o){const t=f;if(!(e instanceof Function)){const e={params:{}};null===l?l=[e]:l.push(e),f++}v=t===f,o=o||v}if(!o){const e={params:{}};return null===l?l=[e]:l.push(e),f++,Me.errors=l,!1}f=r,null!==l&&(r?l.length=r:l=null),u=n===f}else u=!0;if(u){if(void 0!==t.hashSalt){let e=t.hashSalt;const n=f;if(f==f){if("string"!=typeof e)return Me.errors=[{params:{type:"string"}}],!1;if(e.length<1)return Me.errors=[{params:{}}],!1}u=n===f}else u=!0;if(u){if(void 0!==t.hotUpdateChunkFilename){let n=t.hotUpdateChunkFilename;const r=f;if(f==f){if("string"!=typeof n)return Me.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return Me.errors=[{params:{}}],!1}u=r===f}else u=!0;if(u){if(void 0!==t.hotUpdateGlobal){const e=f;if("string"!=typeof t.hotUpdateGlobal)return Me.errors=[{params:{type:"string"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.hotUpdateMainFilename){let n=t.hotUpdateMainFilename;const r=f;if(f==f){if("string"!=typeof n)return Me.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return Me.errors=[{params:{}}],!1}u=r===f}else u=!0;if(u){if(void 0!==t.ignoreBrowserWarnings){const e=f;if("boolean"!=typeof t.ignoreBrowserWarnings)return Me.errors=[{params:{type:"boolean"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.iife){const e=f;if("boolean"!=typeof t.iife)return Me.errors=[{params:{type:"boolean"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.importFunctionName){const e=f;if("string"!=typeof t.importFunctionName)return Me.errors=[{params:{type:"string"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.importMetaName){const e=f;if("string"!=typeof t.importMetaName)return Me.errors=[{params:{type:"string"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.library){const e=f;ze(t.library,{instancePath:r+"/library",parentData:t,parentDataProperty:"library",rootData:i})||(l=null===l?ze.errors:l.concat(ze.errors),f=l.length),u=e===f}else u=!0;if(u){if(void 0!==t.libraryExport){let e=t.libraryExport;const n=f,r=f;let o=!1,s=null;const i=f,a=f;let p=!1;const c=f;if(f===c)if(Array.isArray(e)){const t=e.length;for(let n=0;n=",limit:1}}],!1}c=t===f}else c=!0;if(c){if(void 0!==r.performance){const e=f;we(r.performance,{instancePath:o+"/performance",parentData:r,parentDataProperty:"performance",rootData:l})||(p=null===p?we.errors:p.concat(we.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.plugins){const e=f;Ie(r.plugins,{instancePath:o+"/plugins",parentData:r,parentDataProperty:"plugins",rootData:l})||(p=null===p?Ie.errors:p.concat(Ie.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.profile){const e=f;if("boolean"!=typeof r.profile)return _e.errors=[{params:{type:"boolean"}}],!1;c=e===f}else c=!0;if(c){if(void 0!==r.recordsInputPath){let t=r.recordsInputPath;const n=f,o=f;let s=!1;const i=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var v=i===f;if(s=s||v,!s){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}v=n===f,s=s||v}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,_e.errors=p,!1}f=o,null!==p&&(o?p.length=o:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.recordsOutputPath){let t=r.recordsOutputPath;const n=f,o=f;let s=!1;const i=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var P=i===f;if(s=s||P,!s){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}P=n===f,s=s||P}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,_e.errors=p,!1}f=o,null!==p&&(o?p.length=o:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.recordsPath){let t=r.recordsPath;const n=f,o=f;let s=!1;const i=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var D=i===f;if(s=s||D,!s){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}D=n===f,s=s||D}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,_e.errors=p,!1}f=o,null!==p&&(o?p.length=o:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.resolve){const e=f;Te(r.resolve,{instancePath:o+"/resolve",parentData:r,parentDataProperty:"resolve",rootData:l})||(p=null===p?Te.errors:p.concat(Te.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.resolveLoader){const e=f;Ne(r.resolveLoader,{instancePath:o+"/resolveLoader",parentData:r,parentDataProperty:"resolveLoader",rootData:l})||(p=null===p?Ne.errors:p.concat(Ne.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.snapshot){let t=r.snapshot;const n=f;if(f==f){if(!t||"object"!=typeof t||Array.isArray(t))return _e.errors=[{params:{type:"object"}}],!1;{const n=f;for(const e in t)if("buildDependencies"!==e&&"immutablePaths"!==e&&"managedPaths"!==e&&"module"!==e&&"resolve"!==e&&"resolveBuildDependencies"!==e&&"unmanagedPaths"!==e)return _e.errors=[{params:{additionalProperty:e}}],!1;if(n===f){if(void 0!==t.buildDependencies){let e=t.buildDependencies;const n=f;if(f===n){if(!e||"object"!=typeof e||Array.isArray(e))return _e.errors=[{params:{type:"object"}}],!1;{const t=f;for(const t in e)if("hash"!==t&&"timestamp"!==t)return _e.errors=[{params:{additionalProperty:t}}],!1;if(t===f){if(void 0!==e.hash){const t=f;if("boolean"!=typeof e.hash)return _e.errors=[{params:{type:"boolean"}}],!1;var O=t===f}else O=!0;if(O)if(void 0!==e.timestamp){const t=f;if("boolean"!=typeof e.timestamp)return _e.errors=[{params:{type:"boolean"}}],!1;O=t===f}else O=!0}}}var C=n===f}else C=!0;if(C){if(void 0!==t.immutablePaths){let n=t.immutablePaths;const r=f;if(f===r){if(!Array.isArray(n))return _e.errors=[{params:{type:"array"}}],!1;{const t=n.length;for(let r=0;r=",limit:1}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d)if(void 0!==t.type){const e=f;if("memory"!==t.type){const e={params:{}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0}}}}else{const e={params:{type:"object"}};null===p?p=[e]:p.push(e),f++}if(m=o===f,c=c||m,!c){const o=f;if(f==f)if(t&&"object"==typeof t&&!Array.isArray(t)){let o;if(void 0===t.type&&(o="type")){const e={params:{missingProperty:o}};null===p?p=[e]:p.push(e),f++}else{const o=f;for(const e in t)if(!n.call(r.properties,e)){const t={params:{additionalProperty:e}};null===p?p=[t]:p.push(t),f++;break}if(o===f){if(void 0!==t.allowCollectingMemory){const e=f;if("boolean"!=typeof t.allowCollectingMemory){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}var h=e===f}else h=!0;if(h){if(void 0!==t.buildDependencies){let e=t.buildDependencies;const n=f;if(f===n)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=f;if(f===r)if(Array.isArray(n)){const e=n.length;for(let t=0;t=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.idleTimeoutAfterLargeChanges){let e=t.idleTimeoutAfterLargeChanges;const n=f;if(f===n)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.idleTimeoutForInitialStore){let e=t.idleTimeoutForInitialStore;const n=f;if(f===n)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.immutablePaths){let n=t.immutablePaths;const r=f;if(f===r)if(Array.isArray(n)){const t=n.length;for(let r=0;r=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.maxMemoryGenerations){let e=t.maxMemoryGenerations;const n=f;if(f===n)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h){if(void 0!==t.memoryCacheUnaffected){const e=f;if("boolean"!=typeof t.memoryCacheUnaffected){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.name){const e=f;if("string"!=typeof t.name){const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.profile){const e=f;if("boolean"!=typeof t.profile){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.readonly){const e=f;if("boolean"!=typeof t.readonly){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.store){const e=f;if("pack"!==t.store){const e={params:{}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h){if(void 0!==t.type){const e=f;if("filesystem"!==t.type){const e={params:{}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0;if(h)if(void 0!==t.version){const e=f;if("string"!=typeof t.version){const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0}}}}}}}}}}}}}}}}}}}}}else{const e={params:{type:"object"}};null===p?p=[e]:p.push(e),f++}m=o===f,c=c||m}}if(!c){const e={params:{}};return null===p?p=[e]:p.push(e),f++,o.errors=p,!1}return f=u,null!==p&&(u?p.length=u:p=null),o.errors=p,0===f}function s(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,l=0;const p=l;let f=!1;const u=l;if(!0!==e){const e={params:{}};null===a?a=[e]:a.push(e),l++}var c=u===l;if(f=f||c,!f){const s=l;o(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:i})||(a=null===a?o.errors:a.concat(o.errors),l=a.length),c=s===l,f=f||c}if(!f){const e={params:{}};return null===a?a=[e]:a.push(e),l++,s.errors=a,!1}return l=p,null!==a&&(p?a.length=p:a=null),s.errors=a,0===l}const i={type:"object",additionalProperties:!1,properties:{asyncChunks:{type:"boolean"},baseUri:{type:"string"},chunkLoading:{$ref:"#/definitions/ChunkLoading"},dependOn:{anyOf:[{type:"array",items:{type:"string",minLength:1},minItems:1,uniqueItems:!0},{type:"string",minLength:1}]},filename:{$ref:"#/definitions/EntryFilename"},import:{$ref:"#/definitions/EntryItem"},layer:{$ref:"#/definitions/Layer"},library:{$ref:"#/definitions/LibraryOptions"},publicPath:{$ref:"#/definitions/PublicPath"},runtime:{$ref:"#/definitions/EntryRuntime"},wasmLoading:{$ref:"#/definitions/WasmLoading"}},required:["import"]};function a(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const l=i;let p=!1;const f=i;if(!1!==e){const e={params:{}};null===s?s=[e]:s.push(e),i++}var u=f===i;if(p=p||u,!p){const t=i,n=i;let r=!1;const o=i;if("jsonp"!==e&&"import-scripts"!==e&&"require"!==e&&"async-node"!==e&&"import"!==e){const e={params:{}};null===s?s=[e]:s.push(e),i++}var c=o===i;if(r=r||c,!r){const t=i;if("string"!=typeof e){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}c=t===i,r=r||c}if(r)i=n,null!==s&&(n?s.length=n:s=null);else{const e={params:{}};null===s?s=[e]:s.push(e),i++}u=t===i,p=p||u}if(!p){const e={params:{}};return null===s?s=[e]:s.push(e),i++,a.errors=s,!1}return i=l,null!==s&&(l?s.length=l:s=null),a.errors=s,0===i}function l(t,{instancePath:n="",parentData:r,parentDataProperty:o,rootData:s=t}={}){let i=null,a=0;const p=a;let f=!1,u=null;const c=a,y=a;let m=!1;const d=a;if(a===d)if("string"==typeof t){if(t.includes("!")||!1!==e.test(t)){const e={params:{}};null===i?i=[e]:i.push(e),a++}else if(t.length<1){const e={params:{}};null===i?i=[e]:i.push(e),a++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),a++}var h=d===a;if(m=m||h,!m){const e=a;if(!(t instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),a++}h=e===a,m=m||h}if(m)a=y,null!==i&&(y?i.length=y:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),a++}if(c===a&&(f=!0,u=0),!f){const e={params:{passingSchemas:u}};return null===i?i=[e]:i.push(e),a++,l.errors=i,!1}return a=p,null!==i&&(p?i.length=p:i=null),l.errors=i,0===a}function p(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1;const f=i;if("string"!=typeof e){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}var u=f===i;if(l=l||u,!l){const t=i;if(i==i)if(e&&"object"==typeof e&&!Array.isArray(e)){const t=i;for(const t in e)if("amd"!==t&&"commonjs"!==t&&"commonjs2"!==t&&"root"!==t){const e={params:{additionalProperty:t}};null===s?s=[e]:s.push(e),i++;break}if(t===i){if(void 0!==e.amd){const t=i;if("string"!=typeof e.amd){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}var c=t===i}else c=!0;if(c){if(void 0!==e.commonjs){const t=i;if("string"!=typeof e.commonjs){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}c=t===i}else c=!0;if(c){if(void 0!==e.commonjs2){const t=i;if("string"!=typeof e.commonjs2){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}c=t===i}else c=!0;if(c)if(void 0!==e.root){const t=i;if("string"!=typeof e.root){const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}c=t===i}else c=!0}}}}else{const e={params:{type:"object"}};null===s?s=[e]:s.push(e),i++}u=t===i,l=l||u}if(!l){const e={params:{}};return null===s?s=[e]:s.push(e),i++,p.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),p.errors=s,0===i}function f(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1;const p=i;if(i===p)if(Array.isArray(e))if(e.length<1){const e={params:{limit:1}};null===s?s=[e]:s.push(e),i++}else{const t=e.length;for(let n=0;n1){const r={};for(;n--;){let o=t[n];if("string"==typeof o){if("number"==typeof r[o]){e=r[o];const t={params:{i:n,j:e}};null===p?p=[t]:p.push(t),f++;break}r[o]=n}}}}}else{const e={params:{type:"array"}};null===p?p=[e]:p.push(e),f++}var b=s===f;if(o=o||b,!o){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}b=e===f,o=o||b}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),d=n===f}else d=!0;if(d){if(void 0!==e.filename){const n=f;l(e.filename,{instancePath:t+"/filename",parentData:e,parentDataProperty:"filename",rootData:s})||(p=null===p?l.errors:p.concat(l.errors),f=p.length),d=n===f}else d=!0;if(d){if(void 0!==e.import){let t=e.import;const n=f,r=f;let o=!1;const s=f;if(f===s)if(Array.isArray(t))if(t.length<1){const e={params:{limit:1}};null===p?p=[e]:p.push(e),f++}else{var g=!0;const e=t.length;for(let n=0;n1){const r={};for(;n--;){let o=t[n];if("string"==typeof o){if("number"==typeof r[o]){e=r[o];const t={params:{i:n,j:e}};null===p?p=[t]:p.push(t),f++;break}r[o]=n}}}}}else{const e={params:{type:"array"}};null===p?p=[e]:p.push(e),f++}var v=s===f;if(o=o||v,!o){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}v=e===f,o=o||v}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),d=n===f}else d=!0;if(d){if(void 0!==e.layer){let t=e.layer;const n=f,r=f;let o=!1;const s=f;if(null!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var P=s===f;if(o=o||P,!o){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}P=e===f,o=o||P}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),d=n===f}else d=!0;if(d){if(void 0!==e.library){const n=f;u(e.library,{instancePath:t+"/library",parentData:e,parentDataProperty:"library",rootData:s})||(p=null===p?u.errors:p.concat(u.errors),f=p.length),d=n===f}else d=!0;if(d){if(void 0!==e.publicPath){const n=f;c(e.publicPath,{instancePath:t+"/publicPath",parentData:e,parentDataProperty:"publicPath",rootData:s})||(p=null===p?c.errors:p.concat(c.errors),f=p.length),d=n===f}else d=!0;if(d){if(void 0!==e.runtime){let t=e.runtime;const n=f,r=f;let o=!1;const s=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var D=s===f;if(o=o||D,!o){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}D=e===f,o=o||D}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),d=n===f}else d=!0;if(d)if(void 0!==e.wasmLoading){const n=f;y(e.wasmLoading,{instancePath:t+"/wasmLoading",parentData:e,parentDataProperty:"wasmLoading",rootData:s})||(p=null===p?y.errors:p.concat(y.errors),f=p.length),d=n===f}else d=!0}}}}}}}}}}}}}return m.errors=p,0===f}function d(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;if(0===i){if(!e||"object"!=typeof e||Array.isArray(e))return d.errors=[{params:{type:"object"}}],!1;for(const n in e){let r=e[n];const f=i,u=i;let c=!1;const y=i,h=i;let b=!1;const g=i;if(i===g)if(Array.isArray(r))if(r.length<1){const e={params:{limit:1}};null===s?s=[e]:s.push(e),i++}else{var a=!0;const e=r.length;for(let t=0;t1){const n={};for(;t--;){let o=r[t];if("string"==typeof o){if("number"==typeof n[o]){e=n[o];const r={params:{i:t,j:e}};null===s?s=[r]:s.push(r),i++;break}n[o]=t}}}}}else{const e={params:{type:"array"}};null===s?s=[e]:s.push(e),i++}var l=g===i;if(b=b||l,!b){const e=i;if(i===e)if("string"==typeof r){if(r.length<1){const e={params:{}};null===s?s=[e]:s.push(e),i++}}else{const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}l=e===i,b=b||l}if(b)i=h,null!==s&&(h?s.length=h:s=null);else{const e={params:{}};null===s?s=[e]:s.push(e),i++}var p=y===i;if(c=c||p,!c){const a=i;m(r,{instancePath:t+"/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:n,rootData:o})||(s=null===s?m.errors:s.concat(m.errors),i=s.length),p=a===i,c=c||p}if(!c){const e={params:{}};return null===s?s=[e]:s.push(e),i++,d.errors=s,!1}if(i=u,null!==s&&(u?s.length=u:s=null),f!==i)break}}return d.errors=s,0===i}function h(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1,p=null;const f=i,u=i;let c=!1;const y=i;if(i===y)if(Array.isArray(e))if(e.length<1){const e={params:{limit:1}};null===s?s=[e]:s.push(e),i++}else{var m=!0;const t=e.length;for(let n=0;n1){const r={};for(;n--;){let o=e[n];if("string"==typeof o){if("number"==typeof r[o]){t=r[o];const e={params:{i:n,j:t}};null===s?s=[e]:s.push(e),i++;break}r[o]=n}}}}}else{const e={params:{type:"array"}};null===s?s=[e]:s.push(e),i++}var d=y===i;if(c=c||d,!c){const t=i;if(i===t)if("string"==typeof e){if(e.length<1){const e={params:{}};null===s?s=[e]:s.push(e),i++}}else{const e={params:{type:"string"}};null===s?s=[e]:s.push(e),i++}d=t===i,c=c||d}if(c)i=u,null!==s&&(u?s.length=u:s=null);else{const e={params:{}};null===s?s=[e]:s.push(e),i++}if(f===i&&(l=!0,p=0),!l){const e={params:{passingSchemas:p}};return null===s?s=[e]:s.push(e),i++,h.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),h.errors=s,0===i}function b(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1;const p=i;d(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o})||(s=null===s?d.errors:s.concat(d.errors),i=s.length);var f=p===i;if(l=l||f,!l){const a=i;h(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o})||(s=null===s?h.errors:s.concat(h.errors),i=s.length),f=a===i,l=l||f}if(!l){const e={params:{}};return null===s?s=[e]:s.push(e),i++,b.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),b.errors=s,0===i}function g(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1;const p=i;if(!(e instanceof Function)){const e={params:{}};null===s?s=[e]:s.push(e),i++}var f=p===i;if(l=l||f,!l){const a=i;b(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o})||(s=null===s?b.errors:s.concat(b.errors),i=s.length),f=a===i,l=l||f}if(!l){const e={params:{}};return null===s?s=[e]:s.push(e),i++,g.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),g.errors=s,0===i}const v={type:"object",additionalProperties:!1,properties:{asyncWebAssembly:{type:"boolean"},backCompat:{type:"boolean"},buildHttp:{anyOf:[{$ref:"#/definitions/HttpUriAllowedUris"},{$ref:"#/definitions/HttpUriOptions"}]},cacheUnaffected:{type:"boolean"},css:{type:"boolean"},deferImport:{type:"boolean"},futureDefaults:{type:"boolean"},layers:{type:"boolean"},lazyCompilation:{anyOf:[{type:"boolean"},{$ref:"#/definitions/LazyCompilationOptions"}]},outputModule:{type:"boolean"},syncWebAssembly:{type:"boolean"},topLevelAwait:{type:"boolean"}}},P=new RegExp("^https?://","u");function D(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e}={}){let s=null,i=0;const a=i;let l=!1,p=null;const f=i;if(i==i)if(Array.isArray(e)){const t=e.length;for(let n=0;n=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var u=y===l;if(c=c||u,!c){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}u=t===l,c=c||u}if(c)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.filename){let n=t.filename;const r=l,o=l;let s=!1;const i=l;if(l===i)if("string"==typeof n){if(n.includes("!")||!1!==e.test(n)){const e={params:{}};null===a?a=[e]:a.push(e),l++}else if(n.length<1){const e={params:{}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}var c=i===l;if(s=s||c,!s){const e=l;if(!(n instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}c=e===l,s=s||c}if(!s){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=o,null!==a&&(o?a.length=o:a=null),p=r===l}else p=!0;if(p){if(void 0!==t.idHint){const e=l;if("string"!=typeof t.idHint)return De.errors=[{params:{type:"string"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.layer){let e=t.layer;const n=l,r=l;let o=!1;const s=l;if(!(e instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}var y=s===l;if(o=o||y,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(y=t===l,o=o||y,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}y=t===l,o=o||y}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncRequests){let e=t.maxAsyncRequests;const n=l;if(l===n){if("number"!=typeof e)return De.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return De.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncSize){let e=t.maxAsyncSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var m=c===l;if(u=u||m,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}m=t===l,u=u||m}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialRequests){let e=t.maxInitialRequests;const n=l;if(l===n){if("number"!=typeof e)return De.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return De.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialSize){let e=t.maxInitialSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var d=c===l;if(u=u||d,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}d=t===l,u=u||d}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxSize){let e=t.maxSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var h=c===l;if(u=u||h,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}h=t===l,u=u||h}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minChunks){let e=t.minChunks;const n=l;if(l===n){if("number"!=typeof e)return De.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return De.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.minRemainingSize){let e=t.minRemainingSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var b=c===l;if(u=u||b,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}b=t===l,u=u||b}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSize){let e=t.minSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var g=c===l;if(u=u||g,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}g=t===l,u=u||g}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSizeReduction){let e=t.minSizeReduction;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var v=c===l;if(u=u||v,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}v=t===l,u=u||v}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.name){let e=t.name;const n=l,r=l;let o=!1;const s=l;if(!1!==e){const e={params:{}};null===a?a=[e]:a.push(e),l++}var P=s===l;if(o=o||P,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(P=t===l,o=o||P,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}P=t===l,o=o||P}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.priority){const e=l;if("number"!=typeof t.priority)return De.errors=[{params:{type:"number"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.reuseExistingChunk){const e=l;if("boolean"!=typeof t.reuseExistingChunk)return De.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.test){let e=t.test;const n=l,r=l;let o=!1;const s=l;if(!(e instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}var D=s===l;if(o=o||D,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(D=t===l,o=o||D,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}D=t===l,o=o||D}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.type){let e=t.type;const n=l,r=l;let o=!1;const s=l;if(!(e instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}var O=s===l;if(o=o||O,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(O=t===l,o=o||O,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}O=t===l,o=o||O}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p)if(void 0!==t.usedExports){const e=l;if("boolean"!=typeof t.usedExports)return De.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}}}}}return De.errors=a,0===l}function Oe(t,{instancePath:r="",parentData:o,parentDataProperty:s,rootData:i=t}={}){let a=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return Oe.errors=[{params:{type:"object"}}],!1;{const o=l;for(const e in t)if(!n.call(ve.properties,e))return Oe.errors=[{params:{additionalProperty:e}}],!1;if(o===l){if(void 0!==t.automaticNameDelimiter){let e=t.automaticNameDelimiter;const n=l;if(l===n){if("string"!=typeof e)return Oe.errors=[{params:{type:"string"}}],!1;if(e.length<1)return Oe.errors=[{params:{}}],!1}var p=n===l}else p=!0;if(p){if(void 0!==t.cacheGroups){let e=t.cacheGroups;const n=l,o=l,s=l;if(l===s)if(e&&"object"==typeof e&&!Array.isArray(e)){let t;if(void 0===e.test&&(t="test")){const e={};null===a?a=[e]:a.push(e),l++}else if(void 0!==e.test){let t=e.test;const n=l;let r=!1;const o=l;if(!(t instanceof RegExp)){const e={};null===a?a=[e]:a.push(e),l++}var f=o===l;if(r=r||f,!r){const e=l;if("string"!=typeof t){const e={};null===a?a=[e]:a.push(e),l++}if(f=e===l,r=r||f,!r){const e=l;if(!(t instanceof Function)){const e={};null===a?a=[e]:a.push(e),l++}f=e===l,r=r||f}}if(r)l=n,null!==a&&(n?a.length=n:a=null);else{const e={};null===a?a=[e]:a.push(e),l++}}}else{const e={};null===a?a=[e]:a.push(e),l++}if(s===l)return Oe.errors=[{params:{}}],!1;if(l=o,null!==a&&(o?a.length=o:a=null),l===n){if(!e||"object"!=typeof e||Array.isArray(e))return Oe.errors=[{params:{type:"object"}}],!1;for(const t in e){let n=e[t];const o=l,s=l;let p=!1;const f=l;if(!1!==n){const e={params:{}};null===a?a=[e]:a.push(e),l++}var u=f===l;if(p=p||u,!p){const o=l;if(!(n instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}if(u=o===l,p=p||u,!p){const o=l;if("string"!=typeof n){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(u=o===l,p=p||u,!p){const o=l;if(!(n instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}if(u=o===l,p=p||u,!p){const o=l;De(n,{instancePath:r+"/cacheGroups/"+t.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:t,rootData:i})||(a=null===a?De.errors:a.concat(De.errors),l=a.length),u=o===l,p=p||u}}}}if(!p){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}if(l=s,null!==a&&(s?a.length=s:a=null),o!==l)break}}p=n===l}else p=!0;if(p){if(void 0!==t.chunks){let e=t.chunks;const n=l,r=l;let o=!1;const s=l;if("initial"!==e&&"async"!==e&&"all"!==e){const e={params:{}};null===a?a=[e]:a.push(e),l++}var c=s===l;if(o=o||c,!o){const t=l;if(!(e instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}if(c=t===l,o=o||c,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}c=t===l,o=o||c}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.defaultSizeTypes){let e=t.defaultSizeTypes;const n=l;if(l===n){if(!Array.isArray(e))return Oe.errors=[{params:{type:"array"}}],!1;if(e.length<1)return Oe.errors=[{params:{limit:1}}],!1;{const t=e.length;for(let n=0;n=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var y=c===l;if(u=u||y,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}y=t===l,u=u||y}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.fallbackCacheGroup){let e=t.fallbackCacheGroup;const n=l;if(l===n){if(!e||"object"!=typeof e||Array.isArray(e))return Oe.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in e)if("automaticNameDelimiter"!==t&&"chunks"!==t&&"maxAsyncSize"!==t&&"maxInitialSize"!==t&&"maxSize"!==t&&"minSize"!==t&&"minSizeReduction"!==t)return Oe.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==e.automaticNameDelimiter){let t=e.automaticNameDelimiter;const n=l;if(l===n){if("string"!=typeof t)return Oe.errors=[{params:{type:"string"}}],!1;if(t.length<1)return Oe.errors=[{params:{}}],!1}var m=n===l}else m=!0;if(m){if(void 0!==e.chunks){let t=e.chunks;const n=l,r=l;let o=!1;const s=l;if("initial"!==t&&"async"!==t&&"all"!==t){const e={params:{}};null===a?a=[e]:a.push(e),l++}var d=s===l;if(o=o||d,!o){const e=l;if(!(t instanceof RegExp)){const e={params:{}};null===a?a=[e]:a.push(e),l++}if(d=e===l,o=o||d,!o){const e=l;if(!(t instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}d=e===l,o=o||d}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxAsyncSize){let t=e.maxAsyncSize;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var h=u===l;if(f=f||h,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}h=e===l,f=f||h}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxInitialSize){let t=e.maxInitialSize;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var b=u===l;if(f=f||b,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}b=e===l,f=f||b}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxSize){let t=e.maxSize;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var g=u===l;if(f=f||g,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}g=e===l,f=f||g}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m){if(void 0!==e.minSize){let t=e.minSize;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var v=u===l;if(f=f||v,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}v=e===l,f=f||v}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0;if(m)if(void 0!==e.minSizeReduction){let t=e.minSizeReduction;const n=l,r=l;let o=!1,s=null;const i=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var P=u===l;if(f=f||P,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){const n=l;if("number"!=typeof t[e]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}P=e===l,f=f||P}if(f)l=p,null!==a&&(p?a.length=p:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),m=n===l}else m=!0}}}}}}}}p=n===l}else p=!0;if(p){if(void 0!==t.filename){let n=t.filename;const r=l,o=l;let s=!1;const i=l;if(l===i)if("string"==typeof n){if(n.includes("!")||!1!==e.test(n)){const e={params:{}};null===a?a=[e]:a.push(e),l++}else if(n.length<1){const e={params:{}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}var D=i===l;if(s=s||D,!s){const e=l;if(!(n instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}D=e===l,s=s||D}if(!s){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=o,null!==a&&(o?a.length=o:a=null),p=r===l}else p=!0;if(p){if(void 0!==t.hidePathInfo){const e=l;if("boolean"!=typeof t.hidePathInfo)return Oe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.maxAsyncRequests){let e=t.maxAsyncRequests;const n=l;if(l===n){if("number"!=typeof e)return Oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return Oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncSize){let e=t.maxAsyncSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var O=c===l;if(u=u||O,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}O=t===l,u=u||O}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialRequests){let e=t.maxInitialRequests;const n=l;if(l===n){if("number"!=typeof e)return Oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return Oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialSize){let e=t.maxInitialSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var C=c===l;if(u=u||C,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}C=t===l,u=u||C}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxSize){let e=t.maxSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var x=c===l;if(u=u||x,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}x=t===l,u=u||x}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minChunks){let e=t.minChunks;const n=l;if(l===n){if("number"!=typeof e)return Oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return Oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.minRemainingSize){let e=t.minRemainingSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var $=c===l;if(u=u||$,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}$=t===l,u=u||$}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSize){let e=t.minSize;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var A=c===l;if(u=u||A,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}A=t===l,u=u||A}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSizeReduction){let e=t.minSizeReduction;const n=l,r=l;let o=!1,s=null;const i=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===a?a=[e]:a.push(e),l++}}else{const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}var k=c===l;if(u=u||k,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){const n=l;if("number"!=typeof e[t]){const e={params:{type:"number"}};null===a?a=[e]:a.push(e),l++}if(n!==l)break}else{const e={params:{type:"object"}};null===a?a=[e]:a.push(e),l++}k=t===l,u=u||k}if(u)l=f,null!==a&&(f?a.length=f:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),l++}if(i===l&&(o=!0,s=0),!o){const e={params:{passingSchemas:s}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p){if(void 0!==t.name){let e=t.name;const n=l,r=l;let o=!1;const s=l;if(!1!==e){const e={params:{}};null===a?a=[e]:a.push(e),l++}var j=s===l;if(o=o||j,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(j=t===l,o=o||j,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}j=t===l,o=o||j}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,Oe.errors=a,!1}l=r,null!==a&&(r?a.length=r:a=null),p=n===l}else p=!0;if(p)if(void 0!==t.usedExports){const e=l;if("boolean"!=typeof t.usedExports)return Oe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}}return Oe.errors=a,0===l}function Ce(e,{instancePath:t="",parentData:r,parentDataProperty:o,rootData:s=e}={}){let i=null,a=0;if(0===a){if(!e||"object"!=typeof e||Array.isArray(e))return Ce.errors=[{params:{type:"object"}}],!1;{const r=a;for(const t in e)if(!n.call(ge.properties,t))return Ce.errors=[{params:{additionalProperty:t}}],!1;if(r===a){if(void 0!==e.avoidEntryIife){const t=a;if("boolean"!=typeof e.avoidEntryIife)return Ce.errors=[{params:{type:"boolean"}}],!1;var l=t===a}else l=!0;if(l){if(void 0!==e.checkWasmTypes){const t=a;if("boolean"!=typeof e.checkWasmTypes)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.chunkIds){let t=e.chunkIds;const n=a;if("natural"!==t&&"named"!==t&&"deterministic"!==t&&"size"!==t&&"total-size"!==t&&!1!==t)return Ce.errors=[{params:{}}],!1;l=n===a}else l=!0;if(l){if(void 0!==e.concatenateModules){const t=a;if("boolean"!=typeof e.concatenateModules)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.emitOnErrors){const t=a;if("boolean"!=typeof e.emitOnErrors)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.flagIncludedChunks){const t=a;if("boolean"!=typeof e.flagIncludedChunks)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.innerGraph){const t=a;if("boolean"!=typeof e.innerGraph)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.mangleExports){let t=e.mangleExports;const n=a,r=a;let o=!1;const s=a;if("size"!==t&&"deterministic"!==t){const e={params:{}};null===i?i=[e]:i.push(e),a++}var p=s===a;if(o=o||p,!o){const e=a;if("boolean"!=typeof t){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),a++}p=e===a,o=o||p}if(!o){const e={params:{}};return null===i?i=[e]:i.push(e),a++,Ce.errors=i,!1}a=r,null!==i&&(r?i.length=r:i=null),l=n===a}else l=!0;if(l){if(void 0!==e.mangleWasmImports){const t=a;if("boolean"!=typeof e.mangleWasmImports)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.mergeDuplicateChunks){const t=a;if("boolean"!=typeof e.mergeDuplicateChunks)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.minimize){const t=a;if("boolean"!=typeof e.minimize)return Ce.errors=[{params:{type:"boolean"}}],!1;l=t===a}else l=!0;if(l){if(void 0!==e.minimizer){let t=e.minimizer;const n=a;if(a===n){if(!Array.isArray(t))return Ce.errors=[{params:{type:"array"}}],!1;{const e=t.length;for(let n=0;n=",limit:1}}],!1}u=n===f}else u=!0;if(u){if(void 0!==t.hashFunction){let e=t.hashFunction;const n=f,r=f;let o=!1;const s=f;if(f===s)if("string"==typeof e){if(e.length<1){const e={params:{}};null===l?l=[e]:l.push(e),f++}}else{const e={params:{type:"string"}};null===l?l=[e]:l.push(e),f++}var v=s===f;if(o=o||v,!o){const t=f;if(!(e instanceof Function)){const e={params:{}};null===l?l=[e]:l.push(e),f++}v=t===f,o=o||v}if(!o){const e={params:{}};return null===l?l=[e]:l.push(e),f++,Me.errors=l,!1}f=r,null!==l&&(r?l.length=r:l=null),u=n===f}else u=!0;if(u){if(void 0!==t.hashSalt){let e=t.hashSalt;const n=f;if(f==f){if("string"!=typeof e)return Me.errors=[{params:{type:"string"}}],!1;if(e.length<1)return Me.errors=[{params:{}}],!1}u=n===f}else u=!0;if(u){if(void 0!==t.hotUpdateChunkFilename){let n=t.hotUpdateChunkFilename;const r=f;if(f==f){if("string"!=typeof n)return Me.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return Me.errors=[{params:{}}],!1}u=r===f}else u=!0;if(u){if(void 0!==t.hotUpdateGlobal){const e=f;if("string"!=typeof t.hotUpdateGlobal)return Me.errors=[{params:{type:"string"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.hotUpdateMainFilename){let n=t.hotUpdateMainFilename;const r=f;if(f==f){if("string"!=typeof n)return Me.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return Me.errors=[{params:{}}],!1}u=r===f}else u=!0;if(u){if(void 0!==t.ignoreBrowserWarnings){const e=f;if("boolean"!=typeof t.ignoreBrowserWarnings)return Me.errors=[{params:{type:"boolean"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.iife){const e=f;if("boolean"!=typeof t.iife)return Me.errors=[{params:{type:"boolean"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.importFunctionName){const e=f;if("string"!=typeof t.importFunctionName)return Me.errors=[{params:{type:"string"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.importMetaName){const e=f;if("string"!=typeof t.importMetaName)return Me.errors=[{params:{type:"string"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.library){const e=f;ze(t.library,{instancePath:r+"/library",parentData:t,parentDataProperty:"library",rootData:i})||(l=null===l?ze.errors:l.concat(ze.errors),f=l.length),u=e===f}else u=!0;if(u){if(void 0!==t.libraryExport){let e=t.libraryExport;const n=f,r=f;let o=!1,s=null;const i=f,a=f;let p=!1;const c=f;if(f===c)if(Array.isArray(e)){const t=e.length;for(let n=0;n=",limit:1}}],!1}c=t===f}else c=!0;if(c){if(void 0!==r.performance){const e=f;we(r.performance,{instancePath:o+"/performance",parentData:r,parentDataProperty:"performance",rootData:l})||(p=null===p?we.errors:p.concat(we.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.plugins){const e=f;Ie(r.plugins,{instancePath:o+"/plugins",parentData:r,parentDataProperty:"plugins",rootData:l})||(p=null===p?Ie.errors:p.concat(Ie.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.profile){const e=f;if("boolean"!=typeof r.profile)return _e.errors=[{params:{type:"boolean"}}],!1;c=e===f}else c=!0;if(c){if(void 0!==r.recordsInputPath){let t=r.recordsInputPath;const n=f,o=f;let s=!1;const i=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var v=i===f;if(s=s||v,!s){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}v=n===f,s=s||v}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,_e.errors=p,!1}f=o,null!==p&&(o?p.length=o:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.recordsOutputPath){let t=r.recordsOutputPath;const n=f,o=f;let s=!1;const i=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var P=i===f;if(s=s||P,!s){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}P=n===f,s=s||P}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,_e.errors=p,!1}f=o,null!==p&&(o?p.length=o:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.recordsPath){let t=r.recordsPath;const n=f,o=f;let s=!1;const i=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var D=i===f;if(s=s||D,!s){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}D=n===f,s=s||D}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,_e.errors=p,!1}f=o,null!==p&&(o?p.length=o:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.resolve){const e=f;Te(r.resolve,{instancePath:o+"/resolve",parentData:r,parentDataProperty:"resolve",rootData:l})||(p=null===p?Te.errors:p.concat(Te.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.resolveLoader){const e=f;Ne(r.resolveLoader,{instancePath:o+"/resolveLoader",parentData:r,parentDataProperty:"resolveLoader",rootData:l})||(p=null===p?Ne.errors:p.concat(Ne.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.snapshot){let t=r.snapshot;const n=f;if(f==f){if(!t||"object"!=typeof t||Array.isArray(t))return _e.errors=[{params:{type:"object"}}],!1;{const n=f;for(const e in t)if("buildDependencies"!==e&&"immutablePaths"!==e&&"managedPaths"!==e&&"module"!==e&&"resolve"!==e&&"resolveBuildDependencies"!==e&&"unmanagedPaths"!==e)return _e.errors=[{params:{additionalProperty:e}}],!1;if(n===f){if(void 0!==t.buildDependencies){let e=t.buildDependencies;const n=f;if(f===n){if(!e||"object"!=typeof e||Array.isArray(e))return _e.errors=[{params:{type:"object"}}],!1;{const t=f;for(const t in e)if("hash"!==t&&"timestamp"!==t)return _e.errors=[{params:{additionalProperty:t}}],!1;if(t===f){if(void 0!==e.hash){const t=f;if("boolean"!=typeof e.hash)return _e.errors=[{params:{type:"boolean"}}],!1;var O=t===f}else O=!0;if(O)if(void 0!==e.timestamp){const t=f;if("boolean"!=typeof e.timestamp)return _e.errors=[{params:{type:"boolean"}}],!1;O=t===f}else O=!0}}}var C=n===f}else C=!0;if(C){if(void 0!==t.immutablePaths){let n=t.immutablePaths;const r=f;if(f===r){if(!Array.isArray(n))return _e.errors=[{params:{type:"array"}}],!1;{const t=n.length;for(let r=0;r { + .then(async (hasSymlink) => { if (!hasSymlink) { await ensureYarnInstalledAsync(); await runSetupSymlinkAsync(); @@ -24,7 +24,7 @@ function setup() { .then(() => { process.exitCode = 0; }) - .catch(err => { + .catch((err) => { console.error(err); process.exitCode = 1; }); @@ -43,7 +43,7 @@ async function runSetupSymlinkAsync() { * @returns {Promise} result */ function checkSymlinkExistsAsync() { - return new Promise(resolve => { + return new Promise((resolve) => { if ( fs.existsSync(nodeModulesFolder) && fs.existsSync(webpackDependencyFolder) && @@ -94,10 +94,10 @@ function exec(command, args, description) { shell: true }); - cp.on("error", error => { + cp.on("error", (error) => { reject(new Error(`${description} failed with ${error}`)); }); - cp.on("exit", exitCode => { + cp.on("exit", (exitCode) => { if (exitCode) { reject(new Error(`${description} failed with exit code ${exitCode}`)); } else { @@ -122,10 +122,10 @@ function execGetOutput(command, args, description) { shell: true }); - cp.on("error", error => { + cp.on("error", (error) => { reject(new Error(`${description} failed with ${error}`)); }); - cp.on("exit", exitCode => { + cp.on("exit", (exitCode) => { if (exitCode) { reject(new Error(`${description} failed with exit code ${exitCode}`)); } else { @@ -134,7 +134,7 @@ function execGetOutput(command, args, description) { }); /** @type {Buffer[]} */ const buffers = []; - cp.stdout.on("data", data => buffers.push(data)); + cp.stdout.on("data", (data) => buffers.push(data)); }); } diff --git a/test/ArrayHelpers.unittest.js b/test/ArrayHelpers.unittest.js index d34c6f9ec1c..ea8de6bb05e 100644 --- a/test/ArrayHelpers.unittest.js +++ b/test/ArrayHelpers.unittest.js @@ -5,7 +5,7 @@ const ArrayHelpers = require("../lib/util/ArrayHelpers"); describe("ArrayHelpers", () => { it("groupBy should partition into two arrays", () => { expect( - ArrayHelpers.groupBy([1, 2, 3, 4, 5, 6], x => x % 2 === 0) + ArrayHelpers.groupBy([1, 2, 3, 4, 5, 6], (x) => x % 2 === 0) ).toStrictEqual([ [2, 4, 6], [1, 3, 5] @@ -13,6 +13,9 @@ describe("ArrayHelpers", () => { }); it("groupBy works with empty array", () => { - expect(ArrayHelpers.groupBy([], x => x % 2 === 0)).toStrictEqual([[], []]); + expect(ArrayHelpers.groupBy([], (x) => x % 2 === 0)).toStrictEqual([ + [], + [] + ]); }); }); diff --git a/test/BannerPlugin.test.js b/test/BannerPlugin.test.js index 0395467e0c7..8f6f314199a 100644 --- a/test/BannerPlugin.test.js +++ b/test/BannerPlugin.test.js @@ -9,7 +9,7 @@ const pluginDir = path.join(__dirname, "js", "BannerPlugin"); const outputDir = path.join(pluginDir, "output"); describe("BannerPlugin", () => { - it("should cache assets", done => { + it("should cache assets", (done) => { const entry1File = path.join(pluginDir, "entry1.js"); const entry2File = path.join(pluginDir, "entry2.js"); const outputFile = path.join(outputDir, "entry1.js"); @@ -33,21 +33,23 @@ describe("BannerPlugin", () => { }); fs.writeFileSync(entry1File, "1", "utf8"); fs.writeFileSync(entry2File, "1", "utf8"); - compiler.run(err => { + compiler.run((err) => { if (err) return done(err); const footerFileResults = fs.readFileSync(outputFile, "utf8").split("\n"); expect(footerFileResults[0]).toBe("/*! banner is a string */"); fs.writeFileSync(entry2File, "2", "utf8"); compiler.run((err, stats) => { const { assets } = stats.toJson(); - expect(assets.find(as => as.name === "entry1.js").emitted).toBe(false); - expect(assets.find(as => as.name === "entry2.js").emitted).toBe(true); + expect(assets.find((as) => as.name === "entry1.js").emitted).toBe( + false + ); + expect(assets.find((as) => as.name === "entry2.js").emitted).toBe(true); done(err); }); }); }); - it("can place banner as footer", done => { + it("can place banner as footer", (done) => { const footerFile = path.join(pluginDir, "footerFile.js"); const outputFile = path.join(outputDir, "footerFile.js"); try { @@ -73,7 +75,7 @@ describe("BannerPlugin", () => { ] }); fs.writeFileSync(footerFile, "footer", "utf8"); - compiler.run(err => { + compiler.run((err) => { if (err) return done(err); const footerFileResults = fs.readFileSync(outputFile, "utf8").split("\n"); expect(footerFileResults.pop()).toBe("/*! banner is a string */"); @@ -81,7 +83,7 @@ describe("BannerPlugin", () => { }); }); - it("should allow to change stage", done => { + it("should allow to change stage", (done) => { const entryFile = path.join(pluginDir, "entry3.js"); const outputFile = path.join(outputDir, "entry3.js"); try { @@ -108,7 +110,7 @@ describe("BannerPlugin", () => { ] }); fs.writeFileSync(entryFile, "console.log(1 + 1);", "utf8"); - compiler.run(err => { + compiler.run((err) => { if (err) return done(err); const fileResult = fs.readFileSync(outputFile, "utf8").split("\n"); expect(fileResult[0]).toBe("/* banner is a string */"); diff --git a/test/BenchmarkTestCases.benchmark.mjs b/test/BenchmarkTestCases.benchmark.mjs index 16ef2b112cf..cd19c0f85f1 100644 --- a/test/BenchmarkTestCases.benchmark.mjs +++ b/test/BenchmarkTestCases.benchmark.mjs @@ -2,7 +2,6 @@ import { constants, writeFile } from "fs"; import fs from "fs/promises"; import path from "path"; import { fileURLToPath, pathToFileURL } from "url"; -import { withCodSpeed } from "@codspeed/tinybench-plugin"; import { simpleGit } from "simple-git"; import { Bench, hrtimeNow } from "tinybench"; @@ -42,7 +41,7 @@ const checkV8Flags = () => { const requiredFlags = getV8Flags(); const actualFlags = process.execArgv; const missingFlags = requiredFlags.filter( - flag => !actualFlags.includes(flag) + (flag) => !actualFlags.includes(flag) ); if (missingFlags.length > 0) { console.warn(`Missing required flags: ${missingFlags.join(", ")}`); @@ -277,11 +276,15 @@ function buildConfiguration( `baseline-${baseline.name}` ); config.plugins = config.plugins || []; - if (config.cache) { config.cache.cacheDirectory = path.resolve(config.output.path, ".cache"); } - + if (watch) { + config.cache = { + type: "memory", + maxGenerations: 1 + }; + } return config; } @@ -319,12 +322,120 @@ const scenarios = [ const baseOutputPath = path.join(__dirname, "js", "benchmark"); -const bench = withCodSpeed( +const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => { + const { Measurement, getGitDir, mongoMeasurement, setupCore, teardownCore } = + await import("@codspeed/core"); + + if (!Measurement.isInstrumented()) { + const rawRun = bench.run; + bench.run = async () => { + console.warn( + `[CodSpeed] ${bench.tasks.length} benches detected but no instrumentation found, falling back to tinybench` + ); + return await rawRun.bind(bench)(); + }; + return bench; + } + + const getStackTrace = (belowFn) => { + const oldLimit = Error.stackTraceLimit; + Error.stackTraceLimit = Infinity; + const dummyObject = {}; + const v8Handler = Error.prepareStackTrace; + Error.prepareStackTrace = (dummyObject, v8StackTrace) => v8StackTrace; + Error.captureStackTrace(dummyObject, belowFn || getStackTrace); + const v8StackTrace = dummyObject.stack; + Error.prepareStackTrace = v8Handler; + Error.stackTraceLimit = oldLimit; + return v8StackTrace; + }; + + const getCallingFile = () => { + const stack = getStackTrace(); + let callingFile = stack[2].getFileName(); // [here, withCodSpeed, actual caller] + const gitDir = getGitDir(callingFile); + if (gitDir === undefined) { + throw new Error("Could not find a git repository"); + } + if (callingFile.startsWith("file://")) { + callingFile = fileURLToPath(callingFile); + } + return path.relative(gitDir, callingFile); + }; + + const rawAdd = bench.add; + bench.add = (name, fn, opts) => { + const callingFile = getCallingFile(); + const uri = `${callingFile}::${name}`; + const options = { ...opts, uri }; + return rawAdd.bind(bench)(name, fn, options); + }; + const rootCallingFile = getCallingFile(); + bench.run = async function run() { + const iterations = bench.opts.iterations - 1; + console.log("[CodSpeed] running"); + setupCore(); + for (const task of bench.tasks) { + await bench.opts.setup?.(task, "run"); + await task.fnOpts.beforeAll?.call(task); + const samples = []; + async function iteration() { + try { + await task.fnOpts.beforeEach?.call(task, "run"); + const start = bench.opts.now(); + await task.fn(); + samples.push(bench.opts.now() - start || 0); + await task.fnOpts.afterEach?.call(this, "run"); + } catch (err) { + if (bench.opts.throws) { + throw err; + } + } + } + while (samples.length < iterations) { + await iteration(); + } + // Codspeed Measure + const uri = + task.opts && "uri" in task.options + ? task.opts.uri + : `${rootCallingFile}::${task.name}`; + await task.fnOpts.beforeEach?.call(task); + await mongoMeasurement.start(uri); + await (async function __codspeed_root_frame__() { + Measurement.startInstrumentation(); + await task.fn(); + Measurement.stopInstrumentation(uri); + })(); + await mongoMeasurement.stop(uri); + await task.fnOpts.afterEach?.call(task); + console.log(`[Codspeed] ✔ Measured ${uri}`); + await task.fnOpts.afterAll?.call(task); + + await bench.opts.teardown?.(task, "run"); + task.processRunResult({ latencySamples: samples }); + } + teardownCore(); + console.log(`[CodSpeed] Done running ${bench.tasks.length} benches.`); + return bench.tasks; + }; + return bench; +}; + +const bench = await withCodSpeed( new Bench({ now: hrtimeNow, throws: true, warmup: true, - time: 30000 + warmupIterations: 2, + iterations: 8, + setup(task, mode) { + global.gc(); + console.log(`Setup (${mode} mode): ${task.name}`); + }, + teardown(task, mode) { + console.log(`Teardown (${mode} mode): ${task.name}`); + } }) ); @@ -364,11 +475,11 @@ async function registerSuite(bench, test, baselines) { ).default; await Promise.all( - baselines.map(async baseline => { + baselines.map(async (baseline) => { const webpack = await baseline.webpack(); await Promise.all( - scenarios.map(async scenario => { + scenarios.map(async (scenario) => { const config = buildConfiguration( test, baseline, @@ -393,7 +504,9 @@ async function registerSuite(bench, test, baselines) { bench.add( benchName, async () => { - const watchingPromise = new Promise(res => { + console.time(`Time: ${benchName}`); + + const watchingPromise = new Promise((res) => { watchingResolve = res; }); @@ -401,15 +514,17 @@ async function registerSuite(bench, test, baselines) { writeFile( entry, `${originalEntryContent};console.log('watch test')`, - err => { + (err) => { if (err) { reject(err); } - watchingPromise.then(stats => { + watchingPromise.then((stats) => { + watchingResolve = undefined; + // Construct and print stats to be more accurate with real life projects stats.toString(); - + console.timeEnd(`Time: ${benchName}`); resolve(); }); } @@ -423,7 +538,7 @@ async function registerSuite(bench, test, baselines) { watching = await runWatch(webpack(config)); watching.compiler.hooks.afterDone.tap( "WatchingBenchmarkPlugin", - stats => { + (stats) => { if (watchingResolve) { watchingResolve(stats); } @@ -432,7 +547,7 @@ async function registerSuite(bench, test, baselines) { }, async afterEach() { await new Promise((resolve, reject) => { - writeFile(entry, originalEntryContent, err => { + writeFile(entry, originalEntryContent, (err) => { if (err) { reject(err); return; @@ -445,7 +560,7 @@ async function registerSuite(bench, test, baselines) { async afterAll() { await new Promise((resolve, reject) => { if (watching) { - watching.close(closeErr => { + watching.close((closeErr) => { if (closeErr) { reject(closeErr); return; @@ -463,6 +578,8 @@ async function registerSuite(bench, test, baselines) { benchName, async () => { await new Promise((resolve, reject) => { + console.time(`Time: ${benchName}`); + const baseCompiler = webpack(config); baseCompiler.run((err, stats) => { @@ -475,7 +592,7 @@ async function registerSuite(bench, test, baselines) { throw new Error(stats.toString()); } - baseCompiler.close(closeErr => { + baseCompiler.close((closeErr) => { if (closeErr) { reject(closeErr); return; @@ -483,7 +600,7 @@ async function registerSuite(bench, test, baselines) { // Construct and print stats to be more accurate with real life projects stats.toString(); - + console.timeEnd(`Time: ${benchName}`); resolve(); }); }); @@ -517,15 +634,15 @@ const NEGATIVE_FILTER = const casesPath = path.join(__dirname, "benchmarkCases"); const allBenchmarks = (await fs.readdir(casesPath)) .filter( - item => + (item) => !item.includes("_") && (FILTER ? FILTER.test(item) : true) && (NEGATIVE_FILTER ? !NEGATIVE_FILTER.test(item) : true) ) .sort((a, b) => a.localeCompare(b)); -const benchmarks = allBenchmarks.filter(item => !item.includes("-long")); -const longBenchmarks = allBenchmarks.filter(item => item.includes("-long")); +const benchmarks = allBenchmarks.filter((item) => !item.includes("-long")); +const longBenchmarks = allBenchmarks.filter((item) => item.includes("-long")); const i = Math.floor(benchmarks.length / longBenchmarks.length); for (const [index, value] of longBenchmarks.entries()) { @@ -534,7 +651,7 @@ for (const [index, value] of longBenchmarks.entries()) { const shard = typeof process.env.SHARD !== "undefined" - ? process.env.SHARD.split("/").map(item => Number.parseInt(item, 10)) + ? process.env.SHARD.split("/").map((item) => Number.parseInt(item, 10)) : [1, 1]; if ( @@ -568,7 +685,7 @@ if (countOfBenchmarks < shard[1]) { } await Promise.all( - splitToNChunks(benchmarks, shard[1])[shard[0] - 1].map(benchmark => + splitToNChunks(benchmarks, shard[1])[shard[0] - 1].map((benchmark) => registerSuite(bench, benchmark, baselines) ) ); @@ -607,7 +724,7 @@ function formatTime(value) { const statsByTests = new Map(); -bench.addEventListener("cycle", event => { +bench.addEventListener("cycle", (event) => { const task = event.task; const runs = task.runs; const nSqrt = Math.sqrt(runs); @@ -625,7 +742,7 @@ bench.addEventListener("cycle", event => { const collectBy = task.collectBy; const allStats = statsByTests.get(collectBy); - console.log(`Done: ${task.name} ${confidence} (${runs} runs sampled)`); + console.log(`Cycle: ${task.name} ${confidence} (${runs} runs sampled)`); const info = { ...latency, text, minConfidence, maxConfidence }; @@ -646,11 +763,4 @@ bench.addEventListener("cycle", event => { ); }); -// Fix for https://github.com/CodSpeedHQ/codspeed-node/issues/44 -for (const name of bench.tasks.map(task => task.name)) { - const task = bench.getTask(name); - - task.opts = task.fnOpts; -} - -await bench.run(); +bench.run(); diff --git a/test/BinaryMiddleware.unittest.js b/test/BinaryMiddleware.unittest.js index 813eab30310..f7132ced98b 100644 --- a/test/BinaryMiddleware.unittest.js +++ b/test/BinaryMiddleware.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const BinaryMiddleware = require("../lib/serialization/BinaryMiddleware"); const SerializerMiddleware = require("../lib/serialization/SerializerMiddleware"); @@ -12,7 +14,7 @@ const cont = (base, count) => { const mw = new BinaryMiddleware(); const other = { other: true }; -const resolveLazy = item => { +const resolveLazy = (item) => { if (SerializerMiddleware.isLazy(item)) { const data = item(); if (Array.isArray(data)) return { resolvesTo: data.map(resolveLazy) }; @@ -66,7 +68,7 @@ describe("BinaryMiddleware", () => { items.push(undefined); const cases = [ - ...itemsWithLazy.map(item => [item]), + ...itemsWithLazy.map((item) => [item]), [(true, true)], [false, true], [true, false], @@ -107,7 +109,7 @@ describe("BinaryMiddleware", () => { for (const append of items) { if (c > 1 && append !== undefined) continue; const data = [prepend, ...caseData, append].filter( - x => x !== undefined + (x) => x !== undefined ); if (data.length * c > 200000) continue; if (data.length === 0) continue; diff --git a/test/BuildDependencies.longtest.js b/test/BuildDependencies.longtest.js index f3e12faf695..7deb97f74b1 100644 --- a/test/BuildDependencies.longtest.js +++ b/test/BuildDependencies.longtest.js @@ -37,9 +37,9 @@ const exec = (n, options = {}) => } ); const chunks = []; - p.stderr.on("data", chunk => chunks.push(chunk)); - p.stdout.on("data", chunk => chunks.push(chunk)); - p.once("exit", code => { + p.stderr.on("data", (chunk) => chunks.push(chunk)); + p.stdout.on("data", (chunk) => chunks.push(chunk)); + p.once("exit", (code) => { const errors = []; const warnings = []; const rawStdout = chunks.join(""); @@ -61,7 +61,7 @@ const exec = (n, options = {}) => ); } for (const regexp of options.warnings || []) { - const idx = warnings.findIndex(w => regexp.test(w)); + const idx = warnings.findIndex((w) => regexp.test(w)); if (idx < 0) { return reject( new Error( @@ -89,7 +89,7 @@ const exec = (n, options = {}) => reject(new Error(`Code ${code}: ${stdout}`)); } }); - p.once("error", err => { + p.once("error", (err) => { const stdout = chunks.join(""); console.log(stdout); reject(err); @@ -99,7 +99,7 @@ const exec = (n, options = {}) => const supportsEsm = Number(process.versions.modules) >= 83; describe("BuildDependencies", () => { - beforeEach(done => { + beforeEach((done) => { rimraf(cacheDirectory, () => { rimraf(outputDirectory, () => { rimraf(inputDirectory, () => { diff --git a/test/ChangesAndRemovals.test.js b/test/ChangesAndRemovals.test.js index 64fca1015d0..11c3761ee66 100644 --- a/test/ChangesAndRemovals.test.js +++ b/test/ChangesAndRemovals.test.js @@ -7,7 +7,7 @@ const fs = require("graceful-fs"); const { Volume, createFsFromVolume } = require("memfs"); const rimraf = require("rimraf"); -const createCompiler = config => { +const createCompiler = (config) => { const webpack = require(".."); const compiler = webpack(config); @@ -37,7 +37,7 @@ const onceDone = (compiler, action) => { }); }; -const getChanges = compiler => { +const getChanges = (compiler) => { const modifiedFiles = compiler.modifiedFiles; const removedFiles = compiler.removedFiles; return { @@ -75,8 +75,8 @@ function createFiles() { jest.setTimeout(30000); describe("ChangesAndRemovals", () => { - beforeEach(done => { - cleanup(err => { + beforeEach((done) => { + cleanup((err) => { if (err) return done(err); createFiles(); // Wait 2.5s after creating the files, @@ -94,10 +94,10 @@ describe("ChangesAndRemovals", () => { return; } - it("should not track modified/removed files during initial watchRun", done => { + it("should not track modified/removed files during initial watchRun", (done) => { const compiler = createSingleCompiler(); - const watchRunFinished = new Promise(resolve => { - compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", compiler => { + const watchRunFinished = new Promise((resolve) => { + compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", (compiler) => { expect(getChanges(compiler)).toEqual({ removed: undefined, modified: undefined @@ -105,7 +105,7 @@ describe("ChangesAndRemovals", () => { resolve(); }); }); - const watcher = compiler.watch({ aggregateTimeout: 200 }, err => { + const watcher = compiler.watch({ aggregateTimeout: 200 }, (err) => { if (err) done(err); }); @@ -114,11 +114,11 @@ describe("ChangesAndRemovals", () => { }); }); - it("should track modified files when they've been modified", done => { + it("should track modified files when they've been modified", (done) => { const compiler = createSingleCompiler(); let watcher; - compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", compiler => { + compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", (compiler) => { if (!watcher) return; if (!compiler.modifiedFiles) return; expect(getChanges(compiler)).toEqual({ @@ -129,7 +129,7 @@ describe("ChangesAndRemovals", () => { watcher = null; }); - watcher = compiler.watch({ aggregateTimeout: 200 }, err => { + watcher = compiler.watch({ aggregateTimeout: 200 }, (err) => { if (err) done(err); }); @@ -138,11 +138,11 @@ describe("ChangesAndRemovals", () => { }); }); - it("should track removed file when removing file", done => { + it("should track removed file when removing file", (done) => { const compiler = createSingleCompiler(); let watcher; - compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", compiler => { + compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", (compiler) => { if (!watcher) return; if (!compiler.modifiedFiles) return; expect(getChanges(compiler)).toEqual({ @@ -153,7 +153,7 @@ describe("ChangesAndRemovals", () => { watcher = null; }); - watcher = compiler.watch({ aggregateTimeout: 200 }, err => { + watcher = compiler.watch({ aggregateTimeout: 200 }, (err) => { if (err) done(err); }); diff --git a/test/CleanPlugin.unittest.js b/test/CleanPlugin.unittest.js index 64dfb17b594..48d521d8d2e 100644 --- a/test/CleanPlugin.unittest.js +++ b/test/CleanPlugin.unittest.js @@ -1,10 +1,6 @@ "use strict"; -const { - _getDirectories, - _hasFile, - _isEqualPath -} = require("../lib/CleanPlugin"); +const { _getDirectories } = require("../lib/CleanPlugin"); describe("CleanPlugin", () => { describe("_getDirectories", () => { @@ -54,29 +50,4 @@ describe("CleanPlugin", () => { expect([...result]).toEqual([".", "./js", "./static/js", "./static"]); }); }); - - describe("_isEqualPath", () => { - it("should normalize paths before comparison", () => { - expect(_isEqualPath("this", "this")).toBe(true); - expect(_isEqualPath("this", "./this")).toBe(true); - expect(_isEqualPath("this/a", "./this/a")).toBe(true); - expect(_isEqualPath("this", "this/a")).toBe(false); - }); - }); - - describe("_hasFile", () => { - it("should find file in Set collection", () => { - const files = new Set(["this"]); - expect(_hasFile(files, "./this")).toBe(true); - expect(_hasFile(files, "this")).toBe(true); - expect(_hasFile(files, "this/a")).toBe(false); - }); - - it("should find file in Map collection", () => { - const files = new Map([["this", 0]]); - expect(_hasFile(files, "this")).toBe(true); - expect(_hasFile(files, "./this")).toBe(true); - expect(_hasFile(files, "this/a")).toBe(false); - }); - }); }); diff --git a/test/Cli.basictest.js b/test/Cli.basictest.js index c1a7ad40f7c..5eaf0c63b4c 100644 --- a/test/Cli.basictest.js +++ b/test/Cli.basictest.js @@ -1,88 +1,94 @@ -const { getArguments, processArguments } = require("../").cli; +"use strict"; + +const { createColors, getArguments, isColorSupported, processArguments } = + require("../").cli; describe("Cli", () => { - it("should generate the correct cli flags", () => { - expect(getArguments()).toMatchSnapshot(); - }); + describe("getArguments", () => { + it("should generate the correct cli flags", () => { + expect(getArguments()).toMatchSnapshot(); + }); - it("should generate the correct cli flags with custom schema", () => { - const schema = { - title: "custom CLI options", - type: "object", - additionalProperties: false, - properties: { - "with-reset-description": { - type: "array", - items: { - type: "string" + it("should generate the correct cli flags with custom schema", () => { + const schema = { + title: "custom CLI options", + type: "object", + additionalProperties: false, + properties: { + "with-reset-description": { + type: "array", + items: { + type: "string" + }, + description: "original description", + cli: { + resetDescription: "custom reset" + } }, - description: "original description", - cli: { - resetDescription: "custom reset" - } - }, - "with-cli-description": { - type: "string", - description: "original description", - cli: { - description: "description for CLI option" - } - }, - "with-negative-description": { - type: "boolean", - description: "original description", - cli: { - negatedDescription: "custom negative description" - } - }, - "with-both-cli-and-negative-description": { - type: "boolean", - description: "original description", - cli: { - description: "description for CLI option", - negatedDescription: "custom negative description" + "with-cli-description": { + type: "string", + description: "original description", + cli: { + description: "description for CLI option" + } + }, + "with-negative-description": { + type: "boolean", + description: "original description", + cli: { + negatedDescription: "custom negative description" + } + }, + "with-both-cli-and-negative-description": { + type: "boolean", + description: "original description", + cli: { + description: "description for CLI option", + negatedDescription: "custom negative description" + } } } - } - }; + }; - expect(getArguments(schema)).toMatchSnapshot(); + expect(getArguments(schema)).toMatchSnapshot(); + }); }); - const test = (name, values, config, fn) => { - it(`should correctly process arguments for ${name}`, () => { - const args = getArguments(); - const problems = processArguments(args, config, values); - fn(expect(problems || config)); - }); - }; + describe("processArguments", () => { + const test = (name, values, config, fn) => { + it(`should correctly process arguments for ${name}`, () => { + const args = getArguments(); + const problems = processArguments(args, config, values); + fn(expect(problems || config)); + }); + }; - test("none", {}, {}, e => e.toMatchInlineSnapshot("Object {}")); + test("none", {}, {}, (e) => e.toMatchInlineSnapshot("Object {}")); - test("root boolean", { bail: true }, {}, e => - e.toMatchInlineSnapshot(` + test("root boolean", { bail: true }, {}, (e) => + e.toMatchInlineSnapshot(` Object { "bail": true, } `) - ); + ); - test("root single item of multiple", { entry: "./a.js" }, {}, e => - e.toMatchInlineSnapshot(` + test("root single item of multiple", { entry: "./a.js" }, {}, (e) => + e.toMatchInlineSnapshot(` Object { "entry": Array [ "./a.js", ], } `) - ); + ); - test( - "root single item of multiple with existing item", - { entry: "./a.js" }, - { entry: "./old.js" }, - e => - e.toMatchInlineSnapshot(` + test( + "root single item of multiple with existing item", + { entry: "./a.js" }, + { entry: "./old.js" }, + (e) => + e.toMatchInlineSnapshot(` Object { "entry": Array [ "./old.js", @@ -90,14 +96,14 @@ describe("Cli", () => { ], } `) - ); + ); - test( - "root single item of multiple with existing items", - { entry: "./a.js" }, - { entry: ["./old1.js", "./old2.js"] }, - e => - e.toMatchInlineSnapshot(` + test( + "root single item of multiple with existing items", + { entry: "./a.js" }, + { entry: ["./old1.js", "./old2.js"] }, + (e) => + e.toMatchInlineSnapshot(` Object { "entry": Array [ "./old1.js", @@ -106,10 +112,10 @@ describe("Cli", () => { ], } `) - ); + ); - test("root multiple items", { entry: ["./a.js", "./b.js"] }, {}, e => - e.toMatchInlineSnapshot(` + test("root multiple items", { entry: ["./a.js", "./b.js"] }, {}, (e) => + e.toMatchInlineSnapshot(` Object { "entry": Array [ "./a.js", @@ -117,14 +123,14 @@ describe("Cli", () => { ], } `) - ); + ); - test( - "root multiple items with existing item", - { entry: ["./a.js", "./b.js"] }, - { entry: "./old.js" }, - e => - e.toMatchInlineSnapshot(` + test( + "root multiple items with existing item", + { entry: ["./a.js", "./b.js"] }, + { entry: "./old.js" }, + (e) => + e.toMatchInlineSnapshot(` Object { "entry": Array [ "./old.js", @@ -133,14 +139,14 @@ describe("Cli", () => { ], } `) - ); + ); - test( - "root multiple items with existing items", - { entry: ["./a.js", "./b.js"] }, - { entry: ["./old1.js", "./old2.js"] }, - e => - e.toMatchInlineSnapshot(` + test( + "root multiple items with existing items", + { entry: ["./a.js", "./b.js"] }, + { entry: ["./old1.js", "./old2.js"] }, + (e) => + e.toMatchInlineSnapshot(` Object { "entry": Array [ "./old1.js", @@ -150,24 +156,24 @@ describe("Cli", () => { ], } `) - ); + ); - test("nested boolean", { "experiments-top-level-await": true }, {}, e => - e.toMatchInlineSnapshot(` + test("nested boolean", { "experiments-top-level-await": true }, {}, (e) => + e.toMatchInlineSnapshot(` Object { "experiments": Object { "topLevelAwait": true, }, } `) - ); + ); - test( - "nested regexp", - { "stats-warnings-filter": ["/module/", "path"] }, - {}, - e => - e.toMatchInlineSnapshot(` + test( + "nested regexp", + { "stats-warnings-filter": ["/module/", "path"] }, + {}, + (e) => + e.toMatchInlineSnapshot(` Object { "stats": Object { "warningsFilter": Array [ @@ -177,17 +183,17 @@ describe("Cli", () => { }, } `) - ); - - test( - "nested multiple", - { - "module-rules-test": ["/\\.css$/", "/\\.js$/"], - "module-rules-use": ["css-loader", "babel-loader"] - }, - {}, - e => - e.toMatchInlineSnapshot(` + ); + + test( + "nested multiple", + { + "module-rules-test": ["/\\.css$/", "/\\.js$/"], + "module-rules-use": ["css-loader", "babel-loader"] + }, + {}, + (e) => + e.toMatchInlineSnapshot(` Object { "module": Object { "rules": Array [ @@ -203,30 +209,30 @@ describe("Cli", () => { }, } `) - ); - - test( - "reset array", - { - "stats-warnings-filter-reset": true, - "stats-warnings-filter": "path", - "module-rules-reset": true, - "module-rules-test": ["/\\.css$/", "/\\.js$/"], - "module-rules-use": ["css-loader", "babel-loader"] - }, - { - stats: { warningsFilter: [/a/, /b/] }, - module: { - rules: [ - { - test: /\.js$/, - use: "typescript-loader" - } - ] - } - }, - e => - e.toMatchInlineSnapshot(` + ); + + test( + "reset array", + { + "stats-warnings-filter-reset": true, + "stats-warnings-filter": "path", + "module-rules-reset": true, + "module-rules-test": ["/\\.css$/", "/\\.js$/"], + "module-rules-use": ["css-loader", "babel-loader"] + }, + { + stats: { warningsFilter: [/a/, /b/] }, + module: { + rules: [ + { + test: /\.js$/, + use: "typescript-loader" + } + ] + } + }, + (e) => + e.toMatchInlineSnapshot(` Object { "module": Object { "rules": Array [ @@ -247,18 +253,18 @@ describe("Cli", () => { }, } `) - ); - - test( - "numbers", - { - "watch-options-aggregate-timeout": 100, - "watch-options-poll": "100", - "output-chunk-load-timeout": "20000" - }, - {}, - e => - e.toMatchInlineSnapshot(` + ); + + test( + "numbers", + { + "watch-options-aggregate-timeout": 100, + "watch-options-poll": "100", + "output-chunk-load-timeout": "20000" + }, + {}, + (e) => + e.toMatchInlineSnapshot(` Object { "output": Object { "chunkLoadTimeout": 20000, @@ -269,22 +275,22 @@ describe("Cli", () => { }, } `) - ); - - test( - "booleans and enums", - { - "optimization-used-exports": true, - "output-compare-before-emit": false, - "output-iife": "true", - "output-library-name": ["hello", "world"], - "output-library-umd-named-define": "false", - "stats-logging": "verbose", - amd: "false" - }, - {}, - e => - e.toMatchInlineSnapshot(` + ); + + test( + "booleans and enums", + { + "optimization-used-exports": true, + "output-compare-before-emit": false, + "output-iife": "true", + "output-library-name": ["hello", "world"], + "output-library-umd-named-define": "false", + "stats-logging": "verbose", + amd: "false" + }, + {}, + (e) => + e.toMatchInlineSnapshot(` Object { "amd": false, "optimization": Object { @@ -306,28 +312,28 @@ describe("Cli", () => { }, } `) - ); - - // cspell:ignore filsystem - test( - "errors", - { - "output-library-name": "non-object", - "resolve-loader-unsafe-cache": [true, false], - "output-chunk-load-timeout": "20000x", - "cache-type": "filsystem", - "entry-reset": false, - "module-unknown-context-reg-exp": "ab?c*", - "module-wrapped-context-reg-exp": 123, - "my-argument": true - }, - { - output: { - library: "hello" - } - }, - e => - e.toMatchInlineSnapshot(` + ); + + // cspell:ignore filsystem + test( + "errors", + { + "output-library-name": "non-object", + "resolve-loader-unsafe-cache": [true, false], + "output-chunk-load-timeout": "20000x", + "cache-type": "filsystem", + "entry-reset": false, + "module-unknown-context-reg-exp": "ab?c*", + "module-wrapped-context-reg-exp": 123, + "my-argument": true + }, + { + output: { + library: "hello" + } + }, + (e) => + e.toMatchInlineSnapshot(` Array [ Object { "argument": "output-library-name", @@ -413,5 +419,187 @@ describe("Cli", () => { }, ] `) - ); + ); + }); + + describe("isColorSupported", () => { + const OLD_ENV = process.env; + + beforeEach(() => { + // Most important - it clears the cache + jest.resetModules(); + process.env = { ...OLD_ENV }; + // Prevent `process.env.FORCE_COLOR` from being auto set by `jest-worker` + if (OLD_ENV.FORCE_COLOR) { + delete process.env.FORCE_COLOR; + } + // Prevent `process.env.TERM` default value + if (OLD_ENV.TERM) { + delete process.env.TERM; + } + }); + + afterAll(() => { + process.env = OLD_ENV; + }); + + it("env NO_COLOR", () => { + process.env.NO_COLOR = "1"; + + expect(isColorSupported()).toBe(false); + }); + + it("env FORCE_COLOR", () => { + process.env.FORCE_COLOR = "1"; + + expect(isColorSupported()).toBe(true); + }); + + it("env TERM", () => { + const isCI = + "CI" in process.env && + ("GITHUB_ACTIONS" in process.env || + "GITLAB_CI" in process.env || + "CIRCLECI" in process.env); + + process.env.TERM = "dumb"; + + expect(isColorSupported()).toBe(isCI); + }); + + it("env GITHUB_ACTIONS", () => { + process.env.CI = "1"; + process.env.GITHUB_ACTIONS = "1"; + + expect(isColorSupported()).toBe(true); + }); + + it("env GITLAB_CI", () => { + process.env.CI = "1"; + process.env.GITLAB_CI = "1"; + + expect(isColorSupported()).toBe(true); + }); + + it("env CIRCLECI", () => { + process.env.CI = "1"; + process.env.CIRCLECI = "1"; + + expect(isColorSupported()).toBe(true); + }); + }); + + describe("createColors", () => { + const colorsMap = [ + ["reset", "\u001B[0m", "\u001B[0m"], + ["bold", "\u001B[1m", "\u001B[22m"], + ["dim", "\u001B[2m", "\u001B[22m"], + ["italic", "\u001B[3m", "\u001B[23m"], + ["underline", "\u001B[4m", "\u001B[24m"], + ["inverse", "\u001B[7m", "\u001B[27m"], + ["hidden", "\u001B[8m", "\u001B[28m"], + ["strikethrough", "\u001B[9m", "\u001B[29m"], + ["black", "\u001B[30m", "\u001B[39m"], + ["red", "\u001B[31m", "\u001B[39m"], + ["green", "\u001B[32m", "\u001B[39m"], + ["yellow", "\u001B[33m", "\u001B[39m"], + ["blue", "\u001B[34m", "\u001B[39m"], + ["magenta", "\u001B[35m", "\u001B[39m"], + ["cyan", "\u001B[36m", "\u001B[39m"], + ["white", "\u001B[37m", "\u001B[39m"], + ["gray", "\u001B[90m", "\u001B[39m"], + ["bgBlack", "\u001B[40m", "\u001B[49m"], + ["bgRed", "\u001B[41m", "\u001B[49m"], + ["bgGreen", "\u001B[42m", "\u001B[49m"], + ["bgYellow", "\u001B[43m", "\u001B[49m"], + ["bgBlue", "\u001B[44m", "\u001B[49m"], + ["bgMagenta", "\u001B[45m", "\u001B[49m"], + ["bgCyan", "\u001B[46m", "\u001B[49m"], + ["bgWhite", "\u001B[47m", "\u001B[49m"], + ["blackBright", "\u001B[90m", "\u001B[39m"], + ["redBright", "\u001B[91m", "\u001B[39m"], + ["greenBright", "\u001B[92m", "\u001B[39m"], + ["yellowBright", "\u001B[93m", "\u001B[39m"], + ["blueBright", "\u001B[94m", "\u001B[39m"], + ["magentaBright", "\u001B[95m", "\u001B[39m"], + ["cyanBright", "\u001B[96m", "\u001B[39m"], + ["whiteBright", "\u001B[97m", "\u001B[39m"], + ["bgBlackBright", "\u001B[100m", "\u001B[49m"], + ["bgRedBright", "\u001B[101m", "\u001B[49m"], + ["bgGreenBright", "\u001B[102m", "\u001B[49m"], + ["bgYellowBright", "\u001B[103m", "\u001B[49m"], + ["bgBlueBright", "\u001B[104m", "\u001B[49m"], + ["bgMagentaBright", "\u001B[105m", "\u001B[49m"], + ["bgCyanBright", "\u001B[106m", "\u001B[49m"], + ["bgWhiteBright", "\u001B[107m", "\u001B[49m"] + ]; + + const colors = createColors({ useColor: true }); + + it("simple", () => { + for (const [name, open, close] of colorsMap) { + expect(colors[name](name)).toBe(open + name + close); + } + }); + + it("nesting", () => { + expect( + colors.bold(`bold ${colors.red(`red ${colors.dim("dim")} red`)} bold`) + ).toBe( + /* cspell:disable-next-line */ + "\u001B[1mbold \u001B[31mred \u001B[2mdim\u001B[22m\u001B[1m red\u001B[39m bold\u001B[22m" + ); + expect( + colors.magenta( + `magenta ${colors.yellow( + `yellow ${colors.cyan("cyan")} ${colors.red("red")} ${colors.green( + "green" + )} yellow` + )} magenta` + ) + ).toBe( + /* cspell:disable-next-line */ + "\u001B[35mmagenta \u001B[33myellow \u001B[36mcyan\u001B[33m \u001B[31mred\u001B[33m \u001B[32mgreen\u001B[33m yellow\u001B[35m magenta\u001B[39m" + ); + }); + + it("numbers & others", () => { + for (const n of [new Date(), -1e10, -1, -0.1, 0, 0.1, 1, 1e10]) { + expect(colors.red(n)).toBe(`\u001B[31m${n}\u001B[39m`); + } + }); + + it("empty & falsy values", () => { + expect(colors.blue()).toBe(""); + expect(colors.blue("")).toBe(""); + expect(colors.blue(undefined)).toBe(""); + expect(colors.blue(0)).toBe("\u001B[34m0\u001B[39m"); + // eslint-disable-next-line unicorn/prefer-number-properties + expect(colors.blue(NaN)).toBe("\u001B[34mNaN\u001B[39m"); + expect(colors.blue(Number.NaN)).toBe("\u001B[34mNaN\u001B[39m"); + /* cspell:disable-next-line */ + expect(colors.blue(null)).toBe("\u001B[34mnull\u001B[39m"); + /* cspell:disable-next-line */ + expect(colors.blue(true)).toBe("\u001B[34mtrue\u001B[39m"); + /* cspell:disable-next-line */ + expect(colors.blue(false)).toBe("\u001B[34mfalse\u001B[39m"); + expect(colors.blue(Infinity)).toBe("\u001B[34mInfinity\u001B[39m"); + }); + + const noColors = createColors({ useColor: false }); + + it("simple (no colors)", () => { + for (const [name] of colorsMap) { + expect(noColors[name](name)).toBe(name); + } + }); + + const defaultColors = createColors(); + + it("simple (colors by default)", () => { + for (const [name, open, close] of colorsMap) { + expect(defaultColors[name](name)).toBe(open + name + close); + } + }); + }); }); diff --git a/test/Compiler-caching.test.js b/test/Compiler-caching.test.js index 69f0a99861f..859c3f0895e 100644 --- a/test/Compiler-caching.test.js +++ b/test/Compiler-caching.test.js @@ -49,7 +49,7 @@ describe("Compiler (caching)", () => { }; c.hooks.compilation.tap( "CompilerCachingTest", - compilation => (compilation.bail = true) + (compilation) => (compilation.bail = true) ); let compilerIteration = 1; @@ -129,7 +129,7 @@ describe("Compiler (caching)", () => { }; } - it("should cache single file (with manual 1s wait)", done => { + it("should cache single file (with manual 1s wait)", (done) => { const options = {}; const tempFixture = createTempFixture(); @@ -163,7 +163,7 @@ describe("Compiler (caching)", () => { }); }); - it("should cache single file (even with no timeout)", done => { + it("should cache single file (even with no timeout)", (done) => { const options = {}; const tempFixture = createTempFixture(); @@ -199,7 +199,7 @@ describe("Compiler (caching)", () => { }); }); - it("should only build when modified (with manual 2s wait)", done => { + it("should only build when modified (with manual 2s wait)", (done) => { const options = {}; const tempFixture = createTempFixture(); @@ -244,7 +244,7 @@ describe("Compiler (caching)", () => { }); }); - it("should build when modified (even with no timeout)", done => { + it("should build when modified (even with no timeout)", (done) => { const options = {}; const tempFixture = createTempFixture(); diff --git a/test/Compiler-filesystem-caching.test.js b/test/Compiler-filesystem-caching.test.js index 484d8b168d7..2958d41091d 100644 --- a/test/Compiler-filesystem-caching.test.js +++ b/test/Compiler-filesystem-caching.test.js @@ -53,7 +53,7 @@ describe("Compiler (filesystem caching)", () => { apply(compiler) { const name = "TestCachePlugin"; - compiler.hooks.thisCompilation.tap(name, compilation => { + compiler.hooks.thisCompilation.tap(name, (compilation) => { compilation.hooks.processAssets.tapPromise( { name, @@ -158,7 +158,7 @@ describe("Compiler (filesystem caching)", () => { const c = webpack(options); c.hooks.compilation.tap( "CompilerCachingTest", - compilation => (compilation.bail = true) + (compilation) => (compilation.bail = true) ); c.run((err, stats) => { if (err) throw err; @@ -224,14 +224,14 @@ describe("Compiler (filesystem caching)", () => { }; } - it("should compile again when cached asset has changed but loader output remains the same", done => { + it("should compile again when cached asset has changed but loader output remains the same", (done) => { const tempFixture = createTempFixture(); - const onError = error => done(error); + const onError = (error) => done(error); const helper = compile( tempFixture.usesAssetFilepath, - stats => { + (stats) => { // Not cached the first time expect(stats.assets[0].name).toBe("bundle.js"); expect(stats.assets[0].emitted).toBe(true); @@ -239,7 +239,7 @@ describe("Compiler (filesystem caching)", () => { expect(stats.assets[1].name).toMatch(/\w+\.svg$/); expect(stats.assets[0].emitted).toBe(true); - helper.runAgain(stats => { + helper.runAgain((stats) => { // Cached the second run expect(stats.assets[0].name).toBe("bundle.js"); expect(stats.assets[0].emitted).toBe(false); @@ -254,7 +254,7 @@ describe("Compiler (filesystem caching)", () => { fs.writeFileSync(tempFixture.svgFilepath, svgContent); - helper.runAgain(stats => { + helper.runAgain((stats) => { // Still cached after file modification because loader always returns empty expect(stats.assets[0].name).toBe("bundle.js"); expect(stats.assets[0].emitted).toBe(false); diff --git a/test/Compiler.test.js b/test/Compiler.test.js index 7eabfa723b4..44b6b23c963 100644 --- a/test/Compiler.test.js +++ b/test/Compiler.test.js @@ -49,7 +49,7 @@ describe("Compiler", () => { }; c.hooks.compilation.tap( "CompilerTest", - compilation => (compilation.bail = true) + (compilation) => (compilation.bail = true) ); c.run((err, stats) => { if (err) throw err; @@ -67,7 +67,7 @@ describe("Compiler", () => { throw stats.errors[0]; } stats.logs = logs; - c.close(err => { + c.close((err) => { if (err) return callback(err); callback(stats, files, compilation); }); @@ -76,7 +76,7 @@ describe("Compiler", () => { let compiler; - afterEach(callback => { + afterEach((callback) => { if (compiler) { compiler.close(callback); compiler = undefined; @@ -85,7 +85,7 @@ describe("Compiler", () => { } }); - it("should compile a single file to deep output", done => { + it("should compile a single file to deep output", (done) => { compile( "./c", { @@ -101,7 +101,7 @@ describe("Compiler", () => { ); }); - it("should compile a single file", done => { + it("should compile a single file", (done) => { compile("./c", {}, (stats, files) => { expect(Object.keys(files)).toEqual(["/main.js"]); const bundle = files["/main.js"]; @@ -119,7 +119,7 @@ describe("Compiler", () => { }); }); - it("should compile a complex file", done => { + it("should compile a complex file", (done) => { compile("./main1", {}, (stats, files) => { expect(Object.keys(files)).toEqual(["/main.js"]); const bundle = files["/main.js"]; @@ -140,7 +140,7 @@ describe("Compiler", () => { }); }); - it("should compile a file with transitive dependencies", done => { + it("should compile a file with transitive dependencies", (done) => { compile("./abc", {}, (stats, files) => { expect(Object.keys(files)).toEqual(["/main.js"]); const bundle = files["/main.js"]; @@ -163,7 +163,7 @@ describe("Compiler", () => { }); }); - it("should compile a file with multiple chunks", done => { + it("should compile a file with multiple chunks", (done) => { compile("./chunks", {}, (stats, files) => { expect(stats.chunks).toHaveLength(2); expect(Object.keys(files)).toEqual(["/main.js", "/78.js"]); @@ -189,7 +189,7 @@ describe("Compiler", () => { }); // cspell:word asmjs - it("should not evaluate constants in asm.js", done => { + it("should not evaluate constants in asm.js", (done) => { compile("./asmjs", {}, (stats, files) => { expect(Object.keys(files)).toEqual(["/main.js"]); const bundle = files["/main.js"]; @@ -224,7 +224,7 @@ describe("Compiler", () => { }); }); - afterEach(callback => { + afterEach((callback) => { if (compiler) { compiler.close(callback); compiler = undefined; @@ -233,7 +233,7 @@ describe("Compiler", () => { } }); - it("default platform info", done => { + it("default platform info", (done) => { const platform = compiler.platform; expect(platform.web).toBe(true); expect(platform.node).toBe(false); @@ -241,7 +241,7 @@ describe("Compiler", () => { }); describe("purgeInputFileSystem", () => { - it("invokes purge() if inputFileSystem.purge", done => { + it("invokes purge() if inputFileSystem.purge", (done) => { const mockPurge = jest.fn(); compiler.inputFileSystem = { purge: mockPurge @@ -251,7 +251,7 @@ describe("Compiler", () => { done(); }); - it("does NOT invoke purge() if !inputFileSystem.purge", done => { + it("does NOT invoke purge() if !inputFileSystem.purge", (done) => { const mockPurge = jest.fn(); compiler.inputFileSystem = null; compiler.purgeInputFileSystem(); @@ -261,7 +261,7 @@ describe("Compiler", () => { }); describe("isChild", () => { - it("returns booleanized this.parentCompilation", done => { + it("returns booleanized this.parentCompilation", (done) => { compiler.parentCompilation = "stringyStringString"; const response1 = compiler.isChild(); expect(response1).toBe(true); @@ -304,7 +304,7 @@ describe("Compiler", () => { }); }); - it("platformPlugin", done => { + it("platformPlugin", (done) => { const webpack = require(".."); const compiler = webpack({ @@ -315,7 +315,7 @@ describe("Compiler", () => { }, plugins: [ new (require("../lib/PlatformPlugin"))({ node: true }), - compiler => { + (compiler) => { compiler.hooks.afterEnvironment.tap("test", () => { const platform = compiler.platform; expect(platform.node).toBe(true); @@ -327,7 +327,7 @@ describe("Compiler", () => { compiler.close(done); }); - it("should not emit on errors", done => { + it("should not emit on errors", (done) => { const webpack = require(".."); compiler = webpack({ @@ -352,7 +352,7 @@ describe("Compiler", () => { it("should bubble up errors when wrapped in a promise and bail is true", async () => { let errored; try { - const createCompiler = options => + const createCompiler = (options) => new Promise((resolve, reject) => { const webpack = require(".."); @@ -392,7 +392,7 @@ describe("Compiler", () => { }); it("should not emit compilation errors in async (watch)", async () => { - const createStats = options => + const createStats = (options) => new Promise((resolve, reject) => { const webpack = require(".."); @@ -417,7 +417,7 @@ describe("Compiler", () => { expect(stats).toBeInstanceOf(Stats); }); - it("should not emit on errors (watch)", done => { + it("should not emit on errors (watch)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -440,7 +440,7 @@ describe("Compiler", () => { }); }); - it("should not be running twice at a time (run)", done => { + it("should not be running twice at a time (run)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -461,7 +461,7 @@ describe("Compiler", () => { }); }); - it("should not be running twice at a time (watch)", done => { + it("should not be running twice at a time (watch)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -482,7 +482,7 @@ describe("Compiler", () => { }); }); - it("should not be running twice at a time (run - watch)", done => { + it("should not be running twice at a time (run - watch)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -503,7 +503,7 @@ describe("Compiler", () => { }); }); - it("should not be running twice at a time (watch - run)", done => { + it("should not be running twice at a time (watch - run)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -524,7 +524,7 @@ describe("Compiler", () => { }); }); - it("should not be running twice at a time (instance cb)", done => { + it("should not be running twice at a time (instance cb)", (done) => { const webpack = require(".."); compiler = webpack( @@ -545,7 +545,7 @@ describe("Compiler", () => { }); }); - it("should run again correctly after first compilation", done => { + it("should run again correctly after first compilation", (done) => { const webpack = require(".."); compiler = webpack({ @@ -569,7 +569,7 @@ describe("Compiler", () => { }); }); - it("should watch again correctly after first compilation", done => { + it("should watch again correctly after first compilation", (done) => { const webpack = require(".."); compiler = webpack({ @@ -592,7 +592,7 @@ describe("Compiler", () => { }); }); - it("should run again correctly after first closed watch", done => { + it("should run again correctly after first closed watch", (done) => { const webpack = require(".."); compiler = webpack({ @@ -616,7 +616,7 @@ describe("Compiler", () => { }); }); - it("should set compiler.watching correctly", done => { + it("should set compiler.watching correctly", (done) => { const webpack = require(".."); compiler = webpack({ @@ -636,7 +636,7 @@ describe("Compiler", () => { expect(compiler.watching).toBe(watching); }); - it("should watch again correctly after first closed watch", done => { + it("should watch again correctly after first closed watch", (done) => { const webpack = require(".."); compiler = webpack({ @@ -660,7 +660,7 @@ describe("Compiler", () => { }); }); - it("should run again correctly inside afterDone hook", done => { + it("should run again correctly inside afterDone hook", (done) => { const webpack = require(".."); compiler = webpack({ @@ -687,7 +687,7 @@ describe("Compiler", () => { }); }); - it("should call afterDone hook after other callbacks (run)", done => { + it("should call afterDone hook after other callbacks (run)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -714,7 +714,7 @@ describe("Compiler", () => { }); }); - it("should call afterDone hook after other callbacks (instance cb)", done => { + it("should call afterDone hook after other callbacks (instance cb)", (done) => { const instanceCb = jest.fn(); const webpack = require(".."); @@ -744,7 +744,7 @@ describe("Compiler", () => { }); }); - it("should call afterDone hook after other callbacks (watch)", done => { + it("should call afterDone hook after other callbacks (watch)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -779,7 +779,7 @@ describe("Compiler", () => { }); }); - it("should call afterDone hook after other callbacks (watch close)", done => { + it("should call afterDone hook after other callbacks (watch close)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -814,7 +814,7 @@ describe("Compiler", () => { }); }); - it("should flag watchMode as true in watch", done => { + it("should flag watchMode as true in watch", (done) => { const webpack = require(".."); compiler = webpack({ @@ -829,7 +829,7 @@ describe("Compiler", () => { compiler.outputFileSystem = createFsFromVolume(new Volume()); - const watch = compiler.watch({}, err => { + const watch = compiler.watch({}, (err) => { if (err) return done(err); expect(compiler.watchMode).toBeTruthy(); watch.close(() => { @@ -839,7 +839,7 @@ describe("Compiler", () => { }); }); - it("should use cache on second run call", done => { + it("should use cache on second run call", (done) => { const webpack = require(".."); compiler = webpack({ @@ -864,7 +864,7 @@ describe("Compiler", () => { }); }); - it("should call the failed-hook on error", done => { + it("should call the failed-hook on error", (done) => { const failedSpy = jest.fn(); const webpack = require(".."); @@ -916,7 +916,7 @@ describe("Compiler", () => { capture.restore(); }); - const escapeAnsi = stringRaw => + const escapeAnsi = (stringRaw) => stringRaw .replace(/\u001B\[1m\u001B\[([0-9;]*)m/g, "") .replace(/\u001B\[1m/g, "") @@ -940,7 +940,7 @@ describe("Compiler", () => { } } - it("should log to the console (verbose)", done => { + it("should log to the console (verbose)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -973,7 +973,7 @@ describe("Compiler", () => { }); }); - it("should log to the console (debug mode)", done => { + it("should log to the console (debug mode)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -1008,7 +1008,7 @@ describe("Compiler", () => { }); }); - it("should log to the console (none)", done => { + it("should log to the console (none)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -1030,7 +1030,7 @@ describe("Compiler", () => { }); }); - it("should log to the console with colors (verbose)", done => { + it("should log to the console with colors (verbose)", (done) => { const webpack = require(".."); compiler = webpack({ @@ -1064,7 +1064,7 @@ describe("Compiler", () => { }); }); - it("should log to the console with colors (debug mode)", done => { + it("should log to the console with colors (debug mode)", (done) => { const webpack = require(".."); compiler = webpack({ diff --git a/test/ConfigCacheTestCases.longtest.js b/test/ConfigCacheTestCases.longtest.js index d9ec699e5ea..64f2d813d77 100644 --- a/test/ConfigCacheTestCases.longtest.js +++ b/test/ConfigCacheTestCases.longtest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./ConfigTestCases.template"); describeCases({ diff --git a/test/ConfigTestCases.basictest.js b/test/ConfigTestCases.basictest.js index 8c8e0933c66..8b242d85e82 100644 --- a/test/ConfigTestCases.basictest.js +++ b/test/ConfigTestCases.basictest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./ConfigTestCases.template"); describeCases({ diff --git a/test/ConfigTestCases.template.js b/test/ConfigTestCases.template.js index edaa2f8bd46..de6b8691b50 100644 --- a/test/ConfigTestCases.template.js +++ b/test/ConfigTestCases.template.js @@ -18,19 +18,19 @@ const prepareOptions = require("./helpers/prepareOptions"); const { TestRunner } = require("./runner"); const casesPath = path.join(__dirname, "configCases"); -const categories = fs.readdirSync(casesPath).map(cat => ({ +const categories = fs.readdirSync(casesPath).map((cat) => ({ name: cat, tests: fs .readdirSync(path.join(casesPath, cat)) - .filter(folder => !folder.startsWith("_")) + .filter((folder) => !folder.startsWith("_")) .sort() })); -const createLogger = appendTarget => ({ - log: l => appendTarget.push(l), - debug: l => appendTarget.push(l), - trace: l => appendTarget.push(l), - info: l => appendTarget.push(l), +const createLogger = (appendTarget) => ({ + log: (l) => appendTarget.push(l), + debug: (l) => appendTarget.push(l), + trace: (l) => appendTarget.push(l), + info: (l) => appendTarget.push(l), warn: console.warn.bind(console), error: console.error.bind(console), logTime: () => {}, @@ -43,7 +43,7 @@ const createLogger = appendTarget => ({ status: () => {} }); -const describeCases = config => { +const describeCases = (config) => { describe(config.name, () => { let stderr; @@ -203,7 +203,7 @@ const describeCases = config => { setTimeout(done, 200); }; if (config.cache) { - it(`${testName} should pre-compile to fill disk cache (1st)`, done => { + it(`${testName} should pre-compile to fill disk cache (1st)`, (done) => { rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); infraStructureLog.length = 0; @@ -211,7 +211,7 @@ const describeCases = config => { const compiler = require("..")(options); - compiler.run(err => { + compiler.run((err) => { deprecationTracker(); if (err) return handleFatalError(err, done); const infrastructureLogging = stderr.toString(); @@ -245,14 +245,14 @@ const describeCases = config => { ) { return; } - compiler.close(closeErr => { + compiler.close((closeErr) => { if (closeErr) return handleFatalError(closeErr, done); done(); }); }); }, 60000); - it(`${testName} should pre-compile to fill disk cache (2nd)`, done => { + it(`${testName} should pre-compile to fill disk cache (2nd)`, (done) => { rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); infraStructureLog.length = 0; @@ -287,7 +287,7 @@ const describeCases = config => { : modules; if ( allModules.some( - m => m.type !== "cached modules" && !m.cached + (m) => m.type !== "cached modules" && !m.cached ) ) { return done( @@ -322,7 +322,7 @@ const describeCases = config => { ) { return; } - compiler.close(closeErr => { + compiler.close((closeErr) => { if (closeErr) return handleFatalError(closeErr, done); done(); }); @@ -330,7 +330,7 @@ const describeCases = config => { }, 40000); } - it(`${testName} should compile`, done => { + it(`${testName} should compile`, (done) => { rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); infraStructureLog.length = 0; @@ -494,10 +494,10 @@ const describeCases = config => { try { const compiler = require("..")(options); - compiler.run(err => { + compiler.run((err) => { if (err) return handleFatalError(err, done); compiler.run((error, stats) => { - compiler.close(err => { + compiler.close((err) => { if (err) return handleFatalError(err, done); onCompiled(error, stats); }); diff --git a/test/ContextModuleFactory.unittest.js b/test/ContextModuleFactory.unittest.js index 4841dc6f8ee..c4d8e2c0bc0 100644 --- a/test/ContextModuleFactory.unittest.js +++ b/test/ContextModuleFactory.unittest.js @@ -13,7 +13,7 @@ describe("ContextModuleFactory", () => { memfs = createFsFromVolume(new Volume()); }); - it("should not report an error when ENOENT errors happen", done => { + it("should not report an error when ENOENT errors happen", (done) => { memfs.readdir = (dir, callback) => { setTimeout(() => callback(null, ["/file"])); }; @@ -38,7 +38,7 @@ describe("ContextModuleFactory", () => { ); }); - it("should report an error when non-ENOENT errors happen", done => { + it("should report an error when non-ENOENT errors happen", (done) => { memfs.readdir = (dir, callback) => { setTimeout(() => callback(null, ["/file"])); }; @@ -62,7 +62,7 @@ describe("ContextModuleFactory", () => { ); }); - it("should return callback with [] if circular symlinks exist", done => { + it("should return callback with [] if circular symlinks exist", (done) => { let statDirStatus = 0; memfs.readdir = (dir, callback) => { statDirStatus++; @@ -93,7 +93,7 @@ describe("ContextModuleFactory", () => { ); }); - it("should not return callback with [] if there are no circular symlinks", done => { + it("should not return callback with [] if there are no circular symlinks", (done) => { let statDirStatus = 0; memfs.readdir = (dir, callback) => { statDirStatus++; @@ -126,7 +126,7 @@ describe("ContextModuleFactory", () => { ); }); - it("should resolve correctly several resources", done => { + it("should resolve correctly several resources", (done) => { memfs.readdir = (dir, callback) => { if (dir === "/a") setTimeout(() => callback(null, ["/B"])); if (dir === "/b") setTimeout(() => callback(null, ["/A"])); @@ -153,12 +153,12 @@ describe("ContextModuleFactory", () => { (err, res) => { expect(res).not.toStrictEqual([]); expect(Array.isArray(res)).toBe(true); - expect(res.map(r => r.request)).toEqual([ + expect(res.map((r) => r.request)).toEqual([ "./B/a?query#hash", "./A/b?query#hash" ]); - expect(res.map(r => r.getContext())).toEqual(["/a", "/b"]); - expect(res.map(r => r.userRequest)).toEqual(["./B/a", "./A/b"]); + expect(res.map((r) => r.getContext())).toEqual(["/a", "/b"]); + expect(res.map((r) => r.userRequest)).toEqual(["./B/a", "./A/b"]); done(); } ); diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js index a51333d2065..31d50f2f576 100644 --- a/test/Defaults.unittest.js +++ b/test/Defaults.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + require("./helpers/warmup-webpack"); const path = require("path"); @@ -9,7 +11,7 @@ const stripVTControlCharacters = require("strip-ansi"); * @param {string} str String to quote * @returns {string} Escaped string */ -const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); const cwd = process.cwd(); const cwdRegExp = new RegExp( @@ -21,7 +23,7 @@ const escapedCwdRegExp = new RegExp( `${quoteMeta(escapedCwd)}((?:\\\\\\\\)?(?:[a-zA-Z.\\-_]+\\\\\\\\)*)`, "g" ); -const normalize = str => { +const normalize = (str) => { if (cwd.startsWith("/")) { str = str.replace(new RegExp(quoteMeta(cwd), "g"), ""); } else { @@ -59,7 +61,7 @@ expect.addSnapshotSerializer({ } }); -const getDefaultConfig = config => { +const getDefaultConfig = (config) => { const { applyWebpackOptionsDefaults, getNormalizedWebpackOptions } = require("..").config; @@ -95,6 +97,7 @@ describe("snapshots", () => { "buildHttp": undefined, "cacheUnaffected": false, "css": undefined, + "deferImport": false, "futureDefaults": false, "layers": false, "lazyCompilation": undefined, @@ -240,6 +243,7 @@ describe("snapshots", () => { }, "javascript": Object { "createRequire": false, + "deferImport": false, "dynamicImportFetchPriority": false, "dynamicImportMode": "lazy", "dynamicImportPrefetch": false, @@ -691,15 +695,15 @@ describe("snapshots", () => { }); }; - test("empty config", {}, e => + test("empty config", {}, (e) => e.toMatchInlineSnapshot("Compared values have no visual difference.") ); - test("none mode", { mode: "none" }, e => + test("none mode", { mode: "none" }, (e) => e.toMatchInlineSnapshot("Compared values have no visual difference.") ); - test("no mode provided", { mode: undefined }, e => + test("no mode provided", { mode: undefined }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -769,7 +773,7 @@ describe("snapshots", () => { `) ); - test("production", { mode: "production" }, e => + test("production", { mode: "production" }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -839,7 +843,7 @@ describe("snapshots", () => { `) ); - test("development", { mode: "development" }, e => + test("development", { mode: "development" }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -889,7 +893,7 @@ describe("snapshots", () => { `) ); - test("sync wasm", { experiments: { syncWebAssembly: true } }, e => + test("sync wasm", { experiments: { syncWebAssembly: true } }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -929,7 +933,7 @@ describe("snapshots", () => { `) ); - test("output module", { experiments: { outputModule: true } }, e => + test("output module", { experiments: { outputModule: true } }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -992,7 +996,7 @@ describe("snapshots", () => { `) ); - test("async wasm", { experiments: { asyncWebAssembly: true } }, e => + test("async wasm", { experiments: { asyncWebAssembly: true } }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1035,7 +1039,7 @@ describe("snapshots", () => { test( "both wasm", { experiments: { syncWebAssembly: true, asyncWebAssembly: true } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1078,7 +1082,7 @@ describe("snapshots", () => { `) ); - test("const filename", { output: { filename: "bundle.js" } }, e => + test("const filename", { output: { filename: "bundle.js" } }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1097,7 +1101,7 @@ describe("snapshots", () => { `) ); - test("function filename", { output: { filename: () => "bundle.js" } }, e => + test("function filename", { output: { filename: () => "bundle.js" } }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1116,7 +1120,7 @@ describe("snapshots", () => { `) ); - test("library", { output: { library: ["myLib", "awesome"] } }, e => + test("library", { output: { library: ["myLib", "awesome"] } }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1161,7 +1165,7 @@ describe("snapshots", () => { library: ["myLib", "[name]"] } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1209,7 +1213,7 @@ describe("snapshots", () => { } } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1260,7 +1264,7 @@ describe("snapshots", () => { } } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1312,7 +1316,7 @@ describe("snapshots", () => { } } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1353,7 +1357,7 @@ describe("snapshots", () => { `) ); - test("target node", { target: "node" }, e => + test("target node", { target: "node" }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1483,7 +1487,7 @@ describe("snapshots", () => { `) ); - test("target webworker", { target: "webworker" }, e => + test("target webworker", { target: "webworker" }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1507,7 +1511,7 @@ describe("snapshots", () => { `) ); - test("target electron-main", { target: "electron-main" }, e => + test("target electron-main", { target: "electron-main" }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1643,7 +1647,7 @@ describe("snapshots", () => { `) ); - test("target electron-main", { target: "electron-preload" }, e => + test("target electron-main", { target: "electron-preload" }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1777,7 +1781,7 @@ describe("snapshots", () => { `) ); - test("records", { recordsPath: "some-path" }, e => + test("records", { recordsPath: "some-path" }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1793,27 +1797,30 @@ describe("snapshots", () => { `) ); - test("ecmaVersion", { output: { ecmaVersion: 2020 } }, e => + test("ecmaVersion", { output: { ecmaVersion: 2020 } }, (e) => e.toMatchInlineSnapshot("Compared values have no visual difference.") ); - test("single runtimeChunk", { optimization: { runtimeChunk: "single" } }, e => - e.toMatchInlineSnapshot(` - - Expected - + Received - - @@ ... @@ - - "runtimeChunk": false, - + "runtimeChunk": Object { - + "name": [Function name], - + }, - `) + test( + "single runtimeChunk", + { optimization: { runtimeChunk: "single" } }, + (e) => + e.toMatchInlineSnapshot(` + - Expected + + Received + + @@ ... @@ + - "runtimeChunk": false, + + "runtimeChunk": Object { + + "name": [Function name], + + }, + `) ); test( "single runtimeChunk", { optimization: { runtimeChunk: "multiple" } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1826,7 +1833,7 @@ describe("snapshots", () => { `) ); - test("single runtimeChunk", { optimization: { runtimeChunk: true } }, e => + test("single runtimeChunk", { optimization: { runtimeChunk: true } }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1839,7 +1846,7 @@ describe("snapshots", () => { `) ); - test("cache true", { cache: true }, e => + test("cache true", { cache: true }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1863,7 +1870,7 @@ describe("snapshots", () => { `) ); - test("cache filesystem", { cache: { type: "filesystem" } }, e => + test("cache filesystem", { cache: { type: "filesystem" } }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1909,7 +1916,7 @@ describe("snapshots", () => { test( "cache filesystem development", { mode: "development", cache: { type: "filesystem" } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -1981,7 +1988,7 @@ describe("snapshots", () => { test( "cache filesystem and futureDefaults", { cache: { type: "filesystem" }, experiments: { futureDefaults: true } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2020,9 +2027,10 @@ describe("snapshots", () => { @@ ... @@ - "cacheUnaffected": false, - "css": undefined, - - "futureDefaults": false, + "cacheUnaffected": true, + "css": true, + @@ ... @@ + - "futureDefaults": false, + "futureDefaults": true, @@ ... @@ + }, @@ -2160,7 +2168,7 @@ describe("snapshots", () => { amd: false, optimization: { splitChunks: false } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2218,7 +2226,7 @@ describe("snapshots", () => { trustedTypes: true } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2243,7 +2251,7 @@ describe("snapshots", () => { `) ); - test("stats true", { stats: true }, e => + test("stats true", { stats: true }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2256,7 +2264,7 @@ describe("snapshots", () => { `) ); - test("stats false", { stats: false }, e => + test("stats false", { stats: false }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2269,7 +2277,7 @@ describe("snapshots", () => { `) ); - test("stats string", { stats: "minimal" }, e => + test("stats string", { stats: "minimal" }, (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2285,7 +2293,7 @@ describe("snapshots", () => { test( "browserslist", { context: path.resolve(__dirname, "fixtures/browserslist") }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2377,7 +2385,7 @@ describe("snapshots", () => { type: "filesystem" } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2454,7 +2462,7 @@ describe("snapshots", () => { enabledWasmLoadingTypes: ["...", "async-node"] } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2473,7 +2481,7 @@ describe("snapshots", () => { futureDefaults: true } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2486,9 +2494,10 @@ describe("snapshots", () => { @@ ... @@ - "cacheUnaffected": false, - "css": undefined, - - "futureDefaults": false, + "cacheUnaffected": true, + "css": true, + @@ ... @@ + - "futureDefaults": false, + "futureDefaults": true, @@ ... @@ + }, @@ -2619,7 +2628,7 @@ describe("snapshots", () => { futureDefaults: true } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received @@ -2632,9 +2641,10 @@ describe("snapshots", () => { @@ ... @@ - "cacheUnaffected": false, - "css": undefined, - - "futureDefaults": false, + "cacheUnaffected": true, + "css": false, + @@ ... @@ + - "futureDefaults": false, + "futureDefaults": true, @@ ... @@ + }, @@ -2692,7 +2702,7 @@ describe("snapshots", () => { test( "target node with ESM output", { target: "node14", experiments: { outputModule: true } }, - e => + (e) => e.toMatchInlineSnapshot(` - Expected + Received diff --git a/test/Errors.test.js b/test/Errors.test.js index 3f657464a35..91e4d91af41 100644 --- a/test/Errors.test.js +++ b/test/Errors.test.js @@ -120,7 +120,7 @@ async function compile(options) { if (bailedError) { return reject(bailedError); } - compiler.close(closeError => { + compiler.close((closeError) => { if (closeError) { return reject(closeError); } diff --git a/test/Examples.test.js b/test/Examples.test.js index 4ae46438839..d31e1092efa 100644 --- a/test/Examples.test.js +++ b/test/Examples.test.js @@ -18,7 +18,7 @@ describe("Examples", () => { if (fs.existsSync(filterPath) && !require(filterPath)()) { // eslint-disable-next-line jest/no-disabled-tests, jest/valid-describe-callback describe.skip(relativePath, () => - it("filtered", done => { + it("filtered", (done) => { done(); }) ); @@ -26,7 +26,7 @@ describe("Examples", () => { continue; } - it(`should compile ${relativePath}`, done => { + it(`should compile ${relativePath}`, (done) => { let options = {}; let webpackConfigPath = path.join(examplePath, "webpack.config.js"); webpackConfigPath = diff --git a/test/FileSystemInfo.unittest.js b/test/FileSystemInfo.unittest.js index f0c7d3c0c64..b76b0eb9489 100644 --- a/test/FileSystemInfo.unittest.js +++ b/test/FileSystemInfo.unittest.js @@ -132,7 +132,7 @@ describe("FileSystemInfo", () => { return fs; }; - const createFsInfo = fs => { + const createFsInfo = (fs) => { const logger = { error: (...args) => { throw new Error(util.format(...args)); @@ -154,7 +154,7 @@ describe("FileSystemInfo", () => { fsInfo.logs.push(`[${method}] ${msg}`); }; } - fsInfo.addFileTimestamps(new Map(ignored.map(i => [i, "ignore"]))); + fsInfo.addFileTimestamps(new Map(ignored.map((i) => [i, "ignore"]))); return fsInfo; }; @@ -186,7 +186,7 @@ describe("FileSystemInfo", () => { ); }; - const clone = object => { + const clone = (object) => { const serialized = buffersSerializer.serialize(object, {}); return buffersSerializer.deserialize(serialized, {}); }; @@ -198,7 +198,7 @@ describe("FileSystemInfo", () => { expected, callback ) => { - expectSnapshotState(fs, snapshot, expected, err => { + expectSnapshotState(fs, snapshot, expected, (err) => { if (err) return callback(err); if (!snapshot2) return callback(); expectSnapshotState(fs, snapshot2, expected, callback); @@ -207,7 +207,7 @@ describe("FileSystemInfo", () => { const expectSnapshotState = (fs, snapshot, expected, callback) => { const fsInfo = createFsInfo(fs); - const details = snapshot => `${fsInfo.logs.join("\n")} + const details = (snapshot) => `${fsInfo.logs.join("\n")} ${util.inspect(snapshot, false, Infinity, true)}`; fsInfo.checkSnapshotValid(snapshot, (err, valid) => { if (err) return callback(err); @@ -265,7 +265,7 @@ ${details(snapshot)}`) ["tsh", { timestamp: true, hash: true }] ]) { describe(`${name} mode`, () => { - it("should always accept an empty snapshot", done => { + it("should always accept an empty snapshot", (done) => { const fs = createFs(); const fsInfo = createFsInfo(fs); fsInfo.createSnapshot( @@ -282,7 +282,7 @@ ${details(snapshot)}`) ); }); - it("should accept a snapshot when fs is unchanged", done => { + it("should accept a snapshot when fs is unchanged", (done) => { const fs = createFs(); createSnapshot(fs, options, (err, snapshot, snapshot2) => { if (err) return done(err); @@ -319,7 +319,7 @@ ${details(snapshot)}`) ...(name !== "timestamp" ? ignoredFileChanges : []), ...(name === "hash" ? ["/path/context/sub/ignored.txt"] : []) ]) { - it(`should invalidate the snapshot when ${fileChange} is changed`, done => { + it(`should invalidate the snapshot when ${fileChange} is changed`, (done) => { const fs = createFs(); createSnapshot(fs, options, (err, snapshot, snapshot2) => { if (err) return done(err); @@ -338,7 +338,7 @@ ${details(snapshot)}`) ...(name === "timestamp" ? ignoredFileChanges : []), ...(name !== "hash" ? ["/path/context/sub/ignored.txt"] : []) ]) { - it(`should not invalidate the snapshot when ${fileChange} is changed`, done => { + it(`should not invalidate the snapshot when ${fileChange} is changed`, (done) => { const fs = createFs(); createSnapshot(fs, options, (err, snapshot, snapshot2) => { if (err) return done(err); @@ -354,7 +354,7 @@ ${details(snapshot)}`) "/path/context+files/file2.txt", "/path/node_modules/package.txt" ]) { - it(`should invalidate the snapshot when ${newFile} is created`, done => { + it(`should invalidate the snapshot when ${newFile} is created`, (done) => { const fs = createFs(); createSnapshot(fs, options, (err, snapshot, snapshot2) => { if (err) return done(err); @@ -370,7 +370,7 @@ ${details(snapshot)}`) "/path/cache/package-2345", "/path/ignored.txt" ]) { - it(`should not invalidate the snapshot when ${newFile} is created`, done => { + it(`should not invalidate the snapshot when ${newFile} is created`, (done) => { const fs = createFs(); createSnapshot(fs, options, (err, snapshot, snapshot2) => { if (err) return done(err); @@ -381,7 +381,7 @@ ${details(snapshot)}`) } if (name !== "timestamp") { - it("should not invalidate snapshot when only timestamps have changed", done => { + it("should not invalidate snapshot when only timestamps have changed", (done) => { const fs = createFs(); createSnapshot(fs, options, (err, snapshot, snapshot2) => { if (err) return done(err); @@ -412,7 +412,7 @@ ${details(snapshot)}`) ); } - it("should return same iterable for getFileIterable()", done => { + it("should return same iterable for getFileIterable()", (done) => { getSnapshot((err, snapshot) => { if (err) done(err); expect(snapshot.getFileIterable()).toEqual(snapshot.getFileIterable()); @@ -420,7 +420,7 @@ ${details(snapshot)}`) }); }); - it("should return same iterable for getContextIterable()", done => { + it("should return same iterable for getContextIterable()", (done) => { getSnapshot((err, snapshot) => { if (err) done(err); expect(snapshot.getContextIterable()).toEqual( @@ -430,7 +430,7 @@ ${details(snapshot)}`) }); }); - it("should return same iterable for getMissingIterable()", done => { + it("should return same iterable for getMissingIterable()", (done) => { getSnapshot((err, snapshot) => { if (err) done(err); expect(snapshot.getFileIterable()).toEqual(snapshot.getFileIterable()); @@ -440,7 +440,7 @@ ${details(snapshot)}`) }); describe("symlinks", () => { - it("should work with symlinks with errors", done => { + it("should work with symlinks with errors", (done) => { const fs = createFs(); fs.symlinkSync( @@ -473,7 +473,7 @@ ${details(snapshot)}`) ); }); - it("should work with symlinks with errors #1", done => { + it("should work with symlinks with errors #1", (done) => { const fs = createFs(); fs.symlinkSync( diff --git a/test/HotModuleReplacementPlugin.test.js b/test/HotModuleReplacementPlugin.test.js index fce2e387db5..43f0ccfc164 100644 --- a/test/HotModuleReplacementPlugin.test.js +++ b/test/HotModuleReplacementPlugin.test.js @@ -8,7 +8,7 @@ const webpack = require(".."); describe("HotModuleReplacementPlugin", () => { jest.setTimeout(20000); - it("should not have circular hashes but equal if unmodified", done => { + it("should not have circular hashes but equal if unmodified", (done) => { const entryFile = path.join( __dirname, "js", @@ -100,7 +100,7 @@ describe("HotModuleReplacementPlugin", () => { }); }, 120000); - it("output.clean=true should keep 1 last update", done => { + it("output.clean=true should keep 1 last update", (done) => { const outputPath = path.join(__dirname, "js", "HotModuleReplacementPlugin"); const entryFile = path.join(outputPath, "entry.js"); const recordsFile = path.join(outputPath, "records.json"); @@ -113,7 +113,7 @@ describe("HotModuleReplacementPlugin", () => { } fs.writeFileSync(entryFile, `${++step}`, "utf8"); const updates = new Set(); - const hasFile = file => { + const hasFile = (file) => { try { fs.statSync(path.join(outputPath, file)); return true; @@ -157,7 +157,7 @@ describe("HotModuleReplacementPlugin", () => { } return setTimeout(() => { fs.writeFileSync(entryFile, `${++step}`, "utf8"); - compiler.run(err => { + compiler.run((err) => { if (err) return done(err); for (const file of updates) { expect(hasFile(file)).toBe(false); @@ -175,7 +175,7 @@ describe("HotModuleReplacementPlugin", () => { compiler.run(callback); }, 20000); - it("should correct working when entry is Object and key is a number", done => { + it("should correct working when entry is Object and key is a number", (done) => { const outputPath = path.join(__dirname, "js", "HotModuleReplacementPlugin"); const entryFile = path.join(outputPath, "entry.js"); const statsFile3 = path.join( @@ -239,7 +239,7 @@ describe("HotModuleReplacementPlugin", () => { }); }); - it("should handle entryFile that contains path variable", done => { + it("should handle entryFile that contains path variable", (done) => { const entryFile = path.join( __dirname, "js", diff --git a/test/HotTestCases.template.js b/test/HotTestCases.template.js index e1b1468a72f..659d44acb69 100644 --- a/test/HotTestCases.template.js +++ b/test/HotTestCases.template.js @@ -12,15 +12,15 @@ const { TestRunner } = require("./runner"); const casesPath = path.join(__dirname, "hotCases"); let categories = fs .readdirSync(casesPath) - .filter(dir => fs.statSync(path.join(casesPath, dir)).isDirectory()); -categories = categories.map(cat => ({ + .filter((dir) => fs.statSync(path.join(casesPath, dir)).isDirectory()); +categories = categories.map((cat) => ({ name: cat, tests: fs .readdirSync(path.join(casesPath, cat)) - .filter(folder => !folder.includes("_")) + .filter((folder) => !folder.includes("_")) })); -const describeCases = config => { +const describeCases = (config) => { describe(config.name, () => { for (const category of categories) { describe(category.name, () => { @@ -39,12 +39,12 @@ const describeCases = config => { describe(testName, () => { let compiler; - afterAll(callback => { + afterAll((callback) => { compiler.close(callback); compiler = undefined; }); - it(`${testName} should compile`, done => { + it(`${testName} should compile`, (done) => { const webpack = require(".."); const outputDirectory = path.join( @@ -252,7 +252,7 @@ const describeCases = config => { done(); }, - err => { + (err) => { console.log(err); done(err); } diff --git a/test/HotTestCasesAsyncNode.test.js b/test/HotTestCasesAsyncNode.test.js index 64ed67adf41..d81ffb583e4 100644 --- a/test/HotTestCasesAsyncNode.test.js +++ b/test/HotTestCasesAsyncNode.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./HotTestCases.template"); describe("HotTestCases", () => { diff --git a/test/HotTestCasesNode.test.js b/test/HotTestCasesNode.test.js index 980198047d6..21fee77fd71 100644 --- a/test/HotTestCasesNode.test.js +++ b/test/HotTestCasesNode.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./HotTestCases.template"); describe("HotTestCases", () => { diff --git a/test/HotTestCasesWeb.test.js b/test/HotTestCasesWeb.test.js index 59052deac03..372188fe353 100644 --- a/test/HotTestCasesWeb.test.js +++ b/test/HotTestCasesWeb.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./HotTestCases.template"); describe("HotTestCases", () => { diff --git a/test/HotTestCasesWebWorker.test.js b/test/HotTestCasesWebWorker.test.js index 9aaeb189f5d..9cc4ee92bf5 100644 --- a/test/HotTestCasesWebWorker.test.js +++ b/test/HotTestCasesWebWorker.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./HotTestCases.template"); describe("HotTestCases", () => { diff --git a/test/JavascriptParser.unittest.js b/test/JavascriptParser.unittest.js index c34c545cd17..40aca5dd449 100644 --- a/test/JavascriptParser.unittest.js +++ b/test/JavascriptParser.unittest.js @@ -270,23 +270,27 @@ describe("JavascriptParser", () => { const testParser = new JavascriptParser({}); testParser.hooks.canRename .for("abc") - .tap("JavascriptParserTest", _expr => true); + .tap("JavascriptParserTest", (_expr) => true); testParser.hooks.canRename .for("ijk") - .tap("JavascriptParserTest", _expr => true); - testParser.hooks.call.for("abc").tap("JavascriptParserTest", expr => { + .tap("JavascriptParserTest", (_expr) => true); + testParser.hooks.call.for("abc").tap("JavascriptParserTest", (expr) => { if (!testParser.state.abc) testParser.state.abc = []; testParser.state.abc.push(testParser.parseString(expr.arguments[0])); return true; }); - testParser.hooks.call.for("cde.abc").tap("JavascriptParserTest", expr => { - if (!testParser.state.cdeabc) testParser.state.cdeabc = []; - testParser.state.cdeabc.push(testParser.parseString(expr.arguments[0])); - return true; - }); + testParser.hooks.call + .for("cde.abc") + .tap("JavascriptParserTest", (expr) => { + if (!testParser.state.cdeabc) testParser.state.cdeabc = []; + testParser.state.cdeabc.push( + testParser.parseString(expr.arguments[0]) + ); + return true; + }); testParser.hooks.call .for("cde.ddd.abc") - .tap("JavascriptParserTest", expr => { + .tap("JavascriptParserTest", (expr) => { if (!testParser.state.cdedddabc) testParser.state.cdedddabc = []; testParser.state.cdedddabc.push( testParser.parseString(expr.arguments[0]) @@ -295,7 +299,7 @@ describe("JavascriptParser", () => { }); testParser.hooks.expression .for("fgh") - .tap("JavascriptParserTest", _expr => { + .tap("JavascriptParserTest", (_expr) => { if (!testParser.state.fgh) testParser.state.fgh = []; testParser.state.fgh.push( [...testParser.scope.definitions.asSet()].join(" ") @@ -304,7 +308,7 @@ describe("JavascriptParser", () => { }); testParser.hooks.expression .for("fgh.sub") - .tap("JavascriptParserTest", _expr => { + .tap("JavascriptParserTest", (_expr) => { if (!testParser.state.fghsub) testParser.state.fghsub = []; testParser.state.fghsub.push( testParser.scope.inTry ? "try" : "notry" @@ -313,19 +317,19 @@ describe("JavascriptParser", () => { }); testParser.hooks.expression .for("ijk.sub") - .tap("JavascriptParserTest", _expr => { + .tap("JavascriptParserTest", (_expr) => { if (!testParser.state.ijksub) testParser.state.ijksub = []; testParser.state.ijksub.push("test"); return true; }); testParser.hooks.expression .for("memberExpr") - .tap("JavascriptParserTest", expr => { + .tap("JavascriptParserTest", (expr) => { if (!testParser.state.expressions) testParser.state.expressions = []; testParser.state.expressions.push(expr.name); return true; }); - testParser.hooks.new.for("xyz").tap("JavascriptParserTest", expr => { + testParser.hooks.new.for("xyz").tap("JavascriptParserTest", (expr) => { if (!testParser.state.xyz) testParser.state.xyz = []; testParser.state.xyz.push(testParser.parseString(expr.arguments[0])); return true; @@ -374,19 +378,19 @@ describe("JavascriptParser", () => { */ function evaluateInParser(source) { const parser = new JavascriptParser(); - parser.hooks.call.for("test").tap("JavascriptParserTest", expr => { + parser.hooks.call.for("test").tap("JavascriptParserTest", (expr) => { parser.state.result = parser.evaluateExpression(expr.arguments[0]); }); parser.hooks.evaluateIdentifier .for("aString") - .tap("JavascriptParserTest", expr => + .tap("JavascriptParserTest", (expr) => new BasicEvaluatedExpression() .setString("aString") .setRange(expr.range) ); parser.hooks.evaluateIdentifier .for("b.Number") - .tap("JavascriptParserTest", expr => + .tap("JavascriptParserTest", (expr) => new BasicEvaluatedExpression().setNumber(123).setRange(expr.range) ); return parser.parse(`test(${source});`, {}).result; @@ -671,11 +675,11 @@ describe("JavascriptParser", () => { }; const parser = new JavascriptParser(); - parser.hooks.call.for("require").tap("JavascriptParserTest", expr => { + parser.hooks.call.for("require").tap("JavascriptParserTest", (expr) => { const param = parser.evaluateExpression(expr.arguments[0]); parser.state.param = param.string; }); - parser.hooks.importCall.tap("JavascriptParserTest", expr => { + parser.hooks.importCall.tap("JavascriptParserTest", (expr) => { const param = parser.evaluateExpression(expr.source); parser.state.param = param.string; }); @@ -710,7 +714,7 @@ describe("JavascriptParser", () => { const parser = new JavascriptParser(); - parser.hooks.statement.tap("JavascriptParserTest", _expr => { + parser.hooks.statement.tap("JavascriptParserTest", (_expr) => { definitions = parser.scope.definitions; return true; }); diff --git a/test/LazySet.unittest.js b/test/LazySet.unittest.js index 92c829f7a33..9507a42f780 100644 --- a/test/LazySet.unittest.js +++ b/test/LazySet.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const LazySet = require("../lib/util/LazySet"); describe("LazySet", () => { diff --git a/test/MemoryLimitTestCases.test.js b/test/MemoryLimitTestCases.test.js index c44d544008e..9e361207e64 100644 --- a/test/MemoryLimitTestCases.test.js +++ b/test/MemoryLimitTestCases.test.js @@ -8,17 +8,17 @@ const rimraf = require("rimraf"); const webpack = require(".."); const captureStdio = require("./helpers/captureStdio"); -const toMiB = bytes => `${Math.round(bytes / 1024 / 1024)}MiB`; +const toMiB = (bytes) => `${Math.round(bytes / 1024 / 1024)}MiB`; const base = path.join(__dirname, "memoryLimitCases"); const outputBase = path.join(__dirname, "js", "memoryLimit"); const tests = fs .readdirSync(base) .filter( - testName => + (testName) => fs.existsSync(path.join(base, testName, "index.js")) || fs.existsSync(path.join(base, testName, "webpack.config.js")) ) - .filter(testName => { + .filter((testName) => { const testDirectory = path.join(base, testName); const filterPath = path.join(testDirectory, "test.filter.js"); if (fs.existsSync(filterPath) && !require(filterPath)()) { @@ -62,7 +62,7 @@ describe("MemoryLimitTestCases", () => { const size = toMiB(testConfig.heapSizeLimitBytes); // eslint-disable-next-line no-loop-func - it(`should build ${JSON.stringify(testName)} with heap limit of ${size}`, done => { + it(`should build ${JSON.stringify(testName)} with heap limit of ${size}`, (done) => { const outputDirectory = path.join(outputBase, testName); rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); diff --git a/test/MultiCompiler.test.js b/test/MultiCompiler.test.js index 3571d6cea80..306f3dc6152 100644 --- a/test/MultiCompiler.test.js +++ b/test/MultiCompiler.test.js @@ -6,7 +6,7 @@ const path = require("path"); const { Volume, createFsFromVolume } = require("memfs"); const webpack = require(".."); -const createMultiCompiler = options => { +const createMultiCompiler = (options) => { const compiler = webpack( Object.assign( [ @@ -34,12 +34,12 @@ const createMultiCompiler = options => { describe("MultiCompiler", () => { jest.setTimeout(20000); - it("should trigger 'run' for each child compiler", done => { + it("should trigger 'run' for each child compiler", (done) => { const compiler = createMultiCompiler(); let called = 0; compiler.hooks.run.tap("MultiCompiler test", () => called++); - compiler.run(err => { + compiler.run((err) => { if (err) { throw err; } @@ -48,12 +48,12 @@ describe("MultiCompiler", () => { }); }); - it("should trigger 'watchRun' for each child compiler", done => { + it("should trigger 'watchRun' for each child compiler", (done) => { const compiler = createMultiCompiler(); let called = 0; compiler.hooks.watchRun.tap("MultiCompiler test", () => called++); - compiler.watch(1000, err => { + compiler.watch(1000, (err) => { if (err) { throw err; } @@ -62,7 +62,7 @@ describe("MultiCompiler", () => { }); }); - it("should not be running twice at a time (run)", done => { + it("should not be running twice at a time (run)", (done) => { const compiler = createMultiCompiler(); compiler.run((err, _stats) => { if (err) return done(err); @@ -74,7 +74,7 @@ describe("MultiCompiler", () => { }); }); - it("should not be running twice at a time (watch)", done => { + it("should not be running twice at a time (watch)", (done) => { const compiler = createMultiCompiler(); compiler.watch({}, (err, _stats) => { if (err) return done(err); @@ -86,7 +86,7 @@ describe("MultiCompiler", () => { }); }); - it("should not be running twice at a time (run - watch)", done => { + it("should not be running twice at a time (run - watch)", (done) => { const compiler = createMultiCompiler(); compiler.run((err, _stats) => { if (err) return done(err); @@ -98,7 +98,7 @@ describe("MultiCompiler", () => { }); }); - it("should not be running twice at a time (watch - run)", done => { + it("should not be running twice at a time (watch - run)", (done) => { const compiler = createMultiCompiler(); compiler.watch({}, (err, _stats) => { if (err) return done(err); @@ -110,7 +110,7 @@ describe("MultiCompiler", () => { }); }); - it("should not be running twice at a time (instance cb)", done => { + it("should not be running twice at a time (instance cb)", (done) => { const compiler = webpack( { context: __dirname, @@ -131,7 +131,7 @@ describe("MultiCompiler", () => { }); }); - it("should run again correctly after first compilation", done => { + it("should run again correctly after first compilation", (done) => { const compiler = createMultiCompiler(); compiler.run((err, _stats) => { if (err) return done(err); @@ -143,7 +143,7 @@ describe("MultiCompiler", () => { }); }); - it("should watch again correctly after first compilation", done => { + it("should watch again correctly after first compilation", (done) => { const compiler = createMultiCompiler(); compiler.run((err, _stats) => { if (err) return done(err); @@ -155,7 +155,7 @@ describe("MultiCompiler", () => { }); }); - it("should run again correctly after first closed watch", done => { + it("should run again correctly after first closed watch", (done) => { const compiler = createMultiCompiler(); const watching = compiler.watch({}, (err, _stats) => { if (err) return done(err); @@ -168,7 +168,7 @@ describe("MultiCompiler", () => { }); }); - it("should watch again correctly after first closed watch", done => { + it("should watch again correctly after first closed watch", (done) => { const compiler = createMultiCompiler(); const watching = compiler.watch({}, (err, _stats) => { if (err) return done(err); @@ -181,7 +181,7 @@ describe("MultiCompiler", () => { }); }); - it("should respect parallelism and dependencies for running", done => { + it("should respect parallelism and dependencies for running", (done) => { const compiler = createMultiCompiler({ parallelism: 1, 2: { @@ -218,7 +218,7 @@ describe("MultiCompiler", () => { }); }); - it("should respect parallelism and dependencies for watching", done => { + it("should respect parallelism and dependencies for watching", (done) => { const compiler = webpack( Object.assign( [ @@ -390,7 +390,7 @@ describe("MultiCompiler", () => { }); }); - it("should respect parallelism when using invalidate", done => { + it("should respect parallelism when using invalidate", (done) => { const configs = [ { name: "a", @@ -425,7 +425,7 @@ describe("MultiCompiler", () => { compiler.outputFileSystem = createFsFromVolume(new Volume()); let state = 0; - const watching = compiler.watch({}, error => { + const watching = compiler.watch({}, (error) => { if (error) { done(error); return; @@ -443,7 +443,7 @@ describe("MultiCompiler", () => { `); events.length = 0; - watching.invalidate(err => { + watching.invalidate((err) => { try { if (err) return done(err); @@ -470,7 +470,7 @@ describe("MultiCompiler", () => { }); }, 2000); - it("should respect dependencies when using invalidate", done => { + it("should respect dependencies when using invalidate", (done) => { const compiler = webpack([ { name: "a", @@ -504,7 +504,7 @@ describe("MultiCompiler", () => { compiler.outputFileSystem = createFsFromVolume(new Volume()); let state = 0; - const watching = compiler.watch({}, error => { + const watching = compiler.watch({}, (error) => { if (error) { done(error); return; @@ -522,7 +522,7 @@ describe("MultiCompiler", () => { `); events.length = 0; - watching.invalidate(err => { + watching.invalidate((err) => { try { if (err) return done(err); @@ -549,7 +549,7 @@ describe("MultiCompiler", () => { }); }, 2000); - it("shouldn't hang when invalidating watchers", done => { + it("shouldn't hang when invalidating watchers", (done) => { const entriesA = { a: "./a.js" }; const entriesB = { b: "./b.js" }; const compiler = webpack([ @@ -570,7 +570,7 @@ describe("MultiCompiler", () => { compiler.watchFileSystem = { watch() {} }; compiler.outputFileSystem = createFsFromVolume(new Volume()); - const watching = compiler.watch({}, error => { + const watching = compiler.watch({}, (error) => { if (error) { done(error); return; @@ -579,14 +579,14 @@ describe("MultiCompiler", () => { entriesA.b = "./b.js"; entriesB.a = "./a.js"; - watching.invalidate(err => { + watching.invalidate((err) => { if (err) return done(err); compiler.close(done); }); }); }, 2000); - it("shouldn't hang when invalidating during build", done => { + it("shouldn't hang when invalidating during build", (done) => { const compiler = webpack( Object.assign([ { diff --git a/test/MultiItemCache.unittest.js b/test/MultiItemCache.unittest.js index 55fe56d373b..bee6e419f49 100644 --- a/test/MultiItemCache.unittest.js +++ b/test/MultiItemCache.unittest.js @@ -6,7 +6,7 @@ const { ItemCacheFacade, MultiItemCache } = require("../lib/CacheFacade"); describe("MultiItemCache", () => { it("throws when getting items from an empty Cache", () => { const multiItemCache = new MultiItemCache(generateItemCaches(0)); - expect(() => multiItemCache.get(_ => _())).toThrow(/_ is not a function/); + expect(() => multiItemCache.get((_) => _())).toThrow(/_ is not a function/); }); it("returns the single ItemCacheFacade when passed an array of length 1", () => { diff --git a/test/MultiStats.test.js b/test/MultiStats.test.js index d1757423bb7..6d1f4630b4c 100644 --- a/test/MultiStats.test.js +++ b/test/MultiStats.test.js @@ -4,11 +4,24 @@ require("./helpers/warmup-webpack"); const { Volume, createFsFromVolume } = require("memfs"); -describe("MultiStats", () => { - it("should create JSON of children stats", done => { +const compile = (options) => + new Promise((resolve, reject) => { const webpack = require(".."); - const compiler = webpack([ + const compiler = webpack(options); + compiler.outputFileSystem = createFsFromVolume(new Volume()); + compiler.run((err, stats) => { + if (err) { + reject(err); + } else { + resolve(stats); + } + }); + }); + +describe("MultiStats", () => { + it("should create JSON of children stats", async () => { + const stats = await compile([ { context: __dirname, entry: "./fixtures/a" @@ -18,19 +31,278 @@ describe("MultiStats", () => { entry: "./fixtures/b" } ]); - compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { - if (err) return done(err); - try { - const statsObject = stats.toJson(); - expect(statsObject).toEqual( - expect.objectContaining({ children: expect.any(Array) }) - ); - expect(statsObject.children).toHaveLength(2); - done(); - } catch (err) { - done(err); + + const statsObject = stats.toJson(); + expect(statsObject).toEqual( + expect.objectContaining({ children: expect.any(Array) }) + ); + expect(statsObject.children).toHaveLength(2); + }); + + it("should work with a boolean value", async () => { + const stats = await compile([ + { + context: __dirname, + entry: "./fixtures/a" + }, + { + context: __dirname, + entry: "./fixtures/b" } - }); + ]); + + expect(stats.toJson(false)).toMatchInlineSnapshot(` + Object { + "children": Array [ + Object { + "name": undefined, + }, + Object { + "name": undefined, + }, + ], + } + `); + expect(stats.toString(false)).toMatchInlineSnapshot('""'); + }); + + it("should work with a string value", async () => { + const stats = await compile([ + { + context: __dirname, + entry: "./fixtures/a" + }, + { + context: __dirname, + entry: "./fixtures/b" + } + ]); + + expect(stats.toJson("none")).toMatchInlineSnapshot(` + Object { + "children": Array [ + Object { + "name": undefined, + }, + Object { + "name": undefined, + }, + ], + } + `); + expect(stats.toString("none")).toMatchInlineSnapshot('""'); + }); + + it("should work with an object value", async () => { + const stats = await compile([ + { + context: __dirname, + entry: "./fixtures/a" + }, + { + context: __dirname, + entry: "./fixtures/b" + } + ]); + + expect( + stats.toJson({ + all: false, + version: false, + errorsCount: true, + warningsCount: true + }) + ).toMatchInlineSnapshot(` + Object { + "children": Array [ + Object { + "errorsCount": 0, + "name": undefined, + "warningsCount": 1, + }, + Object { + "errorsCount": 0, + "name": undefined, + "warningsCount": 1, + }, + ], + "errorsCount": 0, + "warningsCount": 2, + } + `); + expect( + stats.toString({ + all: false, + version: false, + errorsCount: true, + warningsCount: true + }) + ).toMatchInlineSnapshot(` + "webpack compiled with 1 warning + + webpack compiled with 1 warning" + `); + }); + + it("should work with a boolean value for each children", async () => { + const stats = await compile([ + { + context: __dirname, + entry: "./fixtures/a" + }, + { + context: __dirname, + entry: "./fixtures/b" + } + ]); + + const statsOptions = { + children: [false, false] + }; + + expect(stats.toJson(statsOptions)).toMatchInlineSnapshot(` + Object { + "children": Array [ + Object { + "name": undefined, + }, + Object { + "name": undefined, + }, + ], + } + `); + expect(stats.toString(statsOptions)).toMatchInlineSnapshot('""'); + }); + + it("should work with a string value for each children", async () => { + const stats = await compile([ + { + context: __dirname, + entry: "./fixtures/a" + }, + { + context: __dirname, + entry: "./fixtures/b" + } + ]); + + const statsOptions = { + children: ["none", "none"] + }; + + expect(stats.toJson(statsOptions)).toMatchInlineSnapshot(` + Object { + "children": Array [ + Object { + "name": undefined, + }, + Object { + "name": undefined, + }, + ], + } + `); + expect(stats.toString(statsOptions)).toMatchInlineSnapshot('""'); + }); + + it("should work with an object value for each children", async () => { + const stats = await compile([ + { + context: __dirname, + entry: "./fixtures/a" + }, + { + context: __dirname, + entry: "./fixtures/b" + } + ]); + + const statsOptions = { + children: [ + { + all: false, + publicPath: true, + version: false, + errorsCount: true, + warningsCount: true + }, + { + all: false, + version: false, + errorsCount: true, + warningsCount: true + } + ] + }; + + expect(stats.toJson(statsOptions)).toMatchInlineSnapshot(` + Object { + "children": Array [ + Object { + "errorsCount": 0, + "name": undefined, + "publicPath": "auto", + "warningsCount": 1, + }, + Object { + "errorsCount": 0, + "name": undefined, + "warningsCount": 1, + }, + ], + "errorsCount": 0, + "warningsCount": 2, + } + `); + expect(stats.toString(statsOptions)).toMatchInlineSnapshot(` + "PublicPath: auto + webpack compiled with 1 warning + + webpack compiled with 1 warning" + `); + }); + + it("should work with an mixed values for each children", async () => { + const stats = await compile([ + { + context: __dirname, + entry: "./fixtures/a" + }, + { + context: __dirname, + entry: "./fixtures/b" + } + ]); + + const statsOptions = { + children: [ + false, + { + all: false, + version: false, + errorsCount: true, + warningsCount: true + } + ] + }; + + expect(stats.toJson(statsOptions)).toMatchInlineSnapshot(` + Object { + "children": Array [ + Object { + "name": undefined, + }, + Object { + "errorsCount": 0, + "name": undefined, + "warningsCount": 1, + }, + ], + } + `); + expect(stats.toString(statsOptions)).toMatchInlineSnapshot( + '"webpack compiled with 1 warning"' + ); }); }); diff --git a/test/MultiWatching.unittest.js b/test/MultiWatching.unittest.js index d8f502be509..968d285b6c5 100644 --- a/test/MultiWatching.unittest.js +++ b/test/MultiWatching.unittest.js @@ -57,7 +57,7 @@ describe("MultiWatching", () => { describe("close", () => { let callback; - const callClosedFinishedCallback = watching => { + const callClosedFinishedCallback = (watching) => { watching.close.mock.calls[0][0](); }; diff --git a/test/NodeTemplatePlugin.test.js b/test/NodeTemplatePlugin.test.js index dadf6095409..bbe758092a8 100644 --- a/test/NodeTemplatePlugin.test.js +++ b/test/NodeTemplatePlugin.test.js @@ -8,7 +8,7 @@ const path = require("path"); describe("NodeTemplatePlugin", () => { jest.setTimeout(20000); - it("should compile and run a simple module", done => { + it("should compile and run a simple module", (done) => { const webpack = require(".."); webpack( @@ -34,9 +34,9 @@ describe("NodeTemplatePlugin", () => { expect(result.nextTick).toBe(process.nextTick); expect(result.fs).toBe(require("fs")); - result.loadChunk(456, chunk => { + result.loadChunk(456, (chunk) => { expect(chunk).toBe(123); - result.loadChunk(567, chunk => { + result.loadChunk(567, (chunk) => { expect(chunk).toEqual({ a: 1 }); @@ -47,7 +47,7 @@ describe("NodeTemplatePlugin", () => { ); }); - it("should compile and run a simple module in single mode", done => { + it("should compile and run a simple module in single mode", (done) => { const webpack = require(".."); webpack( @@ -79,10 +79,10 @@ describe("NodeTemplatePlugin", () => { expect(result.nextTick).toBe(process.nextTick); expect(result.fs).toBe(require("fs")); const sameTick = true; - result.loadChunk(456, chunk => { + result.loadChunk(456, (chunk) => { expect(chunk).toBe(123); expect(sameTick).toBe(true); - result.loadChunk(567, chunk => { + result.loadChunk(567, (chunk) => { expect(chunk).toEqual({ a: 1 }); diff --git a/test/PersistentCaching.test.js b/test/PersistentCaching.test.js index 5d7cf21ea40..b2dd5ac17be 100644 --- a/test/PersistentCaching.test.js +++ b/test/PersistentCaching.test.js @@ -1,3 +1,5 @@ +"use strict"; + require("./helpers/warmup-webpack"); const fs = require("fs"); @@ -46,11 +48,11 @@ describe("Persistent Caching", () => { } }; - beforeEach(done => { + beforeEach((done) => { rimraf(tempPath, done); }); - const updateSrc = async data => { + const updateSrc = async (data) => { const ts = new Date(Date.now() - 10000); await mkdir(srcPath, { recursive: true }); for (const key of Object.keys(data)) { @@ -82,7 +84,7 @@ describe("Persistent Caching", () => { const execute = () => { const cache = {}; - const require = name => { + const require = (name) => { if (cache[name]) return cache[name].exports; if (!name.endsWith(".js")) name += ".js"; const p = path.resolve(outputPath, name); @@ -159,7 +161,7 @@ export { style }; "e.js": 'import "lodash";' }; await updateSrc(data); - const c = items => { + const c = (items) => { const entry = {}; for (const item of items) entry[item] = `./src/${item}.js`; return compile({ entry, cache: { compression: false } }); @@ -231,7 +233,7 @@ sum([1,2,3]) const firstCacheFiles = (await readdir(cachePath)).sort(); // cSpell:words Mtimes const firstMtimes = firstCacheFiles.map( - f => fs.statSync(path.join(cachePath, f)).mtime + (f) => fs.statSync(path.join(cachePath, f)).mtime ); await updateSrc({ @@ -249,7 +251,7 @@ import 'lodash'; const cacheFiles = (await readdir(cachePath)).sort(); expect(cacheFiles).toStrictEqual(firstCacheFiles); expect( - firstCacheFiles.map(f => fs.statSync(path.join(cachePath, f)).mtime) + firstCacheFiles.map((f) => fs.statSync(path.join(cachePath, f)).mtime) // cSpell:words Mtimes ).toStrictEqual(firstMtimes); }, 20000); diff --git a/test/ProfilingPlugin.test.js b/test/ProfilingPlugin.test.js index 1af33d26cbd..9609e9f2e9e 100644 --- a/test/ProfilingPlugin.test.js +++ b/test/ProfilingPlugin.test.js @@ -9,7 +9,7 @@ const rimraf = require("rimraf"); describe("Profiling Plugin", () => { jest.setTimeout(120000); - it("should handle output path with folder creation", done => { + it("should handle output path with folder creation", (done) => { const webpack = require("../"); const outputPath = path.join(__dirname, "js/profilingPath"); @@ -53,7 +53,7 @@ describe("Profiling Plugin", () => { backCompat: false } }); - compiler.run(err => { + compiler.run((err) => { if (err) return done(err); const testDuration = process.hrtime(startTime); if (!fs.existsSync(outputPath)) { @@ -68,7 +68,7 @@ describe("Profiling Plugin", () => { expect(duration).toBeLessThan( testDuration[0] * 1000000 + testDuration[1] / 1000 ); - const cpuProfile = data.find(entry => entry.name === "CpuProfile"); + const cpuProfile = data.find((entry) => entry.name === "CpuProfile"); expect(cpuProfile).toBeTypeOf("object"); const profile = cpuProfile.args.data.cpuProfile; expect(profile.startTime).toBeGreaterThanOrEqual(minTs); diff --git a/test/ProgressPlugin.test.js b/test/ProgressPlugin.test.js index 5834bb42e1e..965af1d606f 100644 --- a/test/ProgressPlugin.test.js +++ b/test/ProgressPlugin.test.js @@ -31,7 +31,7 @@ const createMultiCompiler = (progressOptions, configOptions) => { return compiler; }; -const createSimpleCompiler = progressOptions => { +const createSimpleCompiler = (progressOptions) => { const compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a.js", @@ -51,7 +51,7 @@ const createSimpleCompiler = progressOptions => { return compiler; }; -const createSimpleCompilerWithCustomHandler = options => { +const createSimpleCompilerWithCustomHandler = (options) => { const compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a.js" @@ -68,11 +68,11 @@ const createSimpleCompilerWithCustomHandler = options => { return compiler; }; -const getLogs = logsStr => logsStr.split(/\r/).filter(v => v !== " "); +const getLogs = (logsStr) => logsStr.split(/\r/).filter((v) => v !== " "); -const runCompilerAsync = compiler => +const runCompilerAsync = (compiler) => new Promise((resolve, reject) => { - compiler.run(err => { + compiler.run((err) => { if (err) { reject(err); } else { @@ -97,7 +97,7 @@ describe("ProgressPlugin", () => { stdout && stdout.restore(); }); - const nanTest = createCompiler => () => { + const nanTest = (createCompiler) => () => { const compiler = createCompiler(); return runCompilerAsync(compiler).then(() => { @@ -121,7 +121,7 @@ describe("ProgressPlugin", () => { nanTest(() => createMultiCompiler(undefined, { parallelism: 1 })) ); - it("should start print only on call run/watch", done => { + it("should start print only on call run/watch", (done) => { const compiler = createSimpleCompiler(); const logs = getLogs(stderr.toString()); @@ -162,7 +162,7 @@ describe("ProgressPlugin", () => { }); }); - const monotonicTest = createCompiler => () => { + const monotonicTest = (createCompiler) => () => { const handlerCalls = []; const compiler = createCompiler({ handler: (p, ...args) => { @@ -195,7 +195,7 @@ describe("ProgressPlugin", () => { it( "should have monotonic increasing progress (multi compiler, parallelism)", - monotonicTest(o => createMultiCompiler(o, { parallelism: 1 })) + monotonicTest((o) => createMultiCompiler(o, { parallelism: 1 })) ); it("should not print lines longer than stderr.columns", () => { diff --git a/test/Queue.unittest.js b/test/Queue.unittest.js index cb234d2af29..97e941c10a0 100644 --- a/test/Queue.unittest.js +++ b/test/Queue.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const Queue = require("../lib/util/Queue"); describe("Queue", () => { diff --git a/test/SemVer.unittest.js b/test/SemVer.unittest.js index 7b8da21c9f4..9842e8c0d85 100644 --- a/test/SemVer.unittest.js +++ b/test/SemVer.unittest.js @@ -13,7 +13,7 @@ const { } = require("../lib/util/semver"); describe("SemVer", () => { - const createRuntimeFunction = runtimeCodeFunction => { + const createRuntimeFunction = (runtimeCodeFunction) => { const runtimeFunction = runtimeCodeFunction({ basicFunction: (args, body) => `(${args}) => {\n${body.join("\n")}\n}`, supportsArrowFunction: () => true diff --git a/test/Stats.test.js b/test/Stats.test.js index 3bb9b8f7687..a939161535b 100644 --- a/test/Stats.test.js +++ b/test/Stats.test.js @@ -4,7 +4,7 @@ require("./helpers/warmup-webpack"); const { Volume, createFsFromVolume } = require("memfs"); -const compile = options => +const compile = (options) => new Promise((resolve, reject) => { const webpack = require(".."); @@ -20,6 +20,52 @@ const compile = options => }); describe("Stats", () => { + it("should work with a boolean value", async () => { + const stats = await compile({ + context: __dirname, + entry: "./fixtures/a" + }); + expect(stats.toJson(false)).toMatchInlineSnapshot("Object {}"); + expect(stats.toString(false)).toMatchInlineSnapshot('""'); + }); + + it("should work with a string value", async () => { + const stats = await compile({ + context: __dirname, + entry: "./fixtures/a" + }); + expect(stats.toJson("none")).toMatchInlineSnapshot("Object {}"); + expect(stats.toString("none")).toMatchInlineSnapshot('""'); + }); + + it("should work with an object value", async () => { + const stats = await compile({ + context: __dirname, + entry: "./fixtures/a" + }); + expect( + stats.toJson({ + all: false, + version: false, + errorsCount: true, + warningsCount: true + }) + ).toMatchInlineSnapshot(` + Object { + "errorsCount": 0, + "warningsCount": 1, + } + `); + expect( + stats.toString({ + all: false, + version: false, + errorsCount: true, + warningsCount: true + }) + ).toMatchInlineSnapshot('"webpack compiled with 1 warning"'); + }); + it("should print env string in stats", async () => { const stats = await compile({ context: __dirname, diff --git a/test/StatsTestCases.basictest.js b/test/StatsTestCases.basictest.js index 97f1380dd2f..61a4df2d948 100644 --- a/test/StatsTestCases.basictest.js +++ b/test/StatsTestCases.basictest.js @@ -13,18 +13,18 @@ const captureStdio = require("./helpers/captureStdio"); * @param {string} str String to quote * @returns {string} Escaped string */ -const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); +const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); const base = path.join(__dirname, "statsCases"); const outputBase = path.join(__dirname, "js", "stats"); const tests = fs .readdirSync(base) .filter( - testName => + (testName) => fs.existsSync(path.join(base, testName, "index.js")) || fs.existsSync(path.join(base, testName, "webpack.config.js")) ) - .filter(testName => { + .filter((testName) => { const testDirectory = path.join(base, testName); const filterPath = path.join(testDirectory, "test.filter.js"); if (fs.existsSync(filterPath) && !require(filterPath)()) { @@ -50,7 +50,7 @@ describe("StatsTestCases", () => { for (const testName of tests) { // eslint-disable-next-line no-loop-func - it(`should print correct stats for ${testName}`, done => { + it(`should print correct stats for ${testName}`, (done) => { const outputDirectory = path.join(outputBase, testName); rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); @@ -118,7 +118,7 @@ describe("StatsTestCases", () => { } ]); }; - c.hooks.compilation.tap("StatsTestCasesTest", compilation => { + c.hooks.compilation.tap("StatsTestCasesTest", (compilation) => { for (const hook of [ "optimize", "optimizeModules", @@ -137,7 +137,7 @@ describe("StatsTestCases", () => { if (err) return done(err); for (const compilation of [ ...(stats.stats ? stats.stats : [stats]) - ].map(s => s.compilation)) { + ].map((s) => s.compilation)) { compilation.logging.delete("webpack.Compilation.ModuleProfile"); } expect(stats.hasErrors()).toBe(testName.endsWith("error")); @@ -179,7 +179,7 @@ describe("StatsTestCases", () => { hasColorSetting = typeof toStringOptions.colors !== "undefined"; } if (Array.isArray(c.options) && !toStringOptions.children) { - toStringOptions.children = c.options.map(o => o.stats); + toStringOptions.children = c.options.map((o) => o.stats); } // mock timestamps for (const { compilation: s } of stats.stats ? stats.stats : [stats]) { @@ -216,7 +216,7 @@ describe("StatsTestCases", () => { .replace(/[.0-9]+(\s?(bytes|KiB|MiB|GiB))/g, "X$1") .replace( /ms\s\([0-9a-f]{6,32}\)|(?![0-9]+-)[0-9a-f-]{6,32}\./g, - match => `${match.replace(/[0-9a-f]/g, "X")}` + (match) => `${match.replace(/[0-9a-f]/g, "X")}` ) // Normalize stack traces between Jest v27 and v30 // Jest v27: at Object..module.exports diff --git a/test/TestCases.template.js b/test/TestCases.template.js index f035711c55f..d85092decac 100644 --- a/test/TestCases.template.js +++ b/test/TestCases.template.js @@ -14,18 +14,18 @@ const { TestRunner } = require("./runner/index"); const casesPath = path.join(__dirname, "cases"); let categories = fs.readdirSync(casesPath); -categories = categories.map(cat => ({ +categories = categories.map((cat) => ({ name: cat, tests: fs .readdirSync(path.join(casesPath, cat)) - .filter(folder => !folder.includes("_")) + .filter((folder) => !folder.includes("_")) })); -const createLogger = appendTarget => ({ - log: l => appendTarget.push(l), - debug: l => appendTarget.push(l), - trace: l => appendTarget.push(l), - info: l => appendTarget.push(l), +const createLogger = (appendTarget) => ({ + log: (l) => appendTarget.push(l), + debug: (l) => appendTarget.push(l), + trace: (l) => appendTarget.push(l), + info: (l) => appendTarget.push(l), warn: console.warn.bind(console), error: console.error.bind(console), logTime: () => {}, @@ -38,7 +38,7 @@ const createLogger = appendTarget => ({ status: () => {} }); -const describeCases = config => { +const describeCases = (config) => { describe(config.name, () => { let stderr; @@ -55,7 +55,7 @@ const describeCases = config => { describe(category.name, () => { jest.setTimeout(30000); - for (const testName of category.tests.filter(test => { + for (const testName of category.tests.filter((test) => { const testDirectory = path.join(casesPath, category.name, test); const filterPath = path.join(testDirectory, "test.filter.js"); if (fs.existsSync(filterPath) && !require(filterPath)(config)) { @@ -190,7 +190,7 @@ const describeCases = config => { plugins: [ ...(config.plugins || []), function testCasesTest() { - this.hooks.compilation.tap("TestCasesTest", compilation => { + this.hooks.compilation.tap("TestCasesTest", (compilation) => { for (const hook of [ "optimize", "optimizeModules", @@ -217,7 +217,7 @@ const describeCases = config => { } }; - beforeAll(done => { + beforeAll((done) => { rimraf(cacheDirectory, done); }); @@ -232,7 +232,7 @@ const describeCases = config => { if (config.cache) { it( `${testName} should pre-compile to fill disk cache (1st)`, - done => { + (done) => { const oldPath = options.output.path; options.output.path = path.join( options.output.path, @@ -243,7 +243,7 @@ const describeCases = config => { const webpack = require(".."); - webpack(options, err => { + webpack(options, (err) => { deprecationTracker(); options.output.path = oldPath; if (err) return done(err); @@ -276,7 +276,7 @@ const describeCases = config => { it( `${testName} should pre-compile to fill disk cache (2nd)`, - done => { + (done) => { const oldPath = options.output.path; options.output.path = path.join( options.output.path, @@ -287,7 +287,7 @@ const describeCases = config => { const webpack = require(".."); - webpack(options, err => { + webpack(options, (err) => { deprecationTracker(); options.output.path = oldPath; if (err) return done(err); @@ -321,7 +321,7 @@ const describeCases = config => { it( `${testName} should compile`, - done => { + (done) => { infraStructureLog.length = 0; const webpack = require(".."); @@ -353,7 +353,7 @@ const describeCases = config => { ) { return; } - compiler.close(err => { + compiler.close((err) => { if (err) return done(err); const statOptions = { preset: "verbose", @@ -417,7 +417,7 @@ const describeCases = config => { if (config.cache) { // pre-compile to fill memory cache const deprecationTracker = deprecationTracking.start(); - compiler.run(err => { + compiler.run((err) => { deprecationTracker(); if (err) return done(err); run(); @@ -431,7 +431,7 @@ const describeCases = config => { (config.cache ? 20000 : 60000) ); - it(`${testName} should load the compiled tests`, done => { + it(`${testName} should load the compiled tests`, (done) => { const runner = new TestRunner({ target: options.target, outputDirectory, diff --git a/test/TestCasesAllCombined.longtest.js b/test/TestCasesAllCombined.longtest.js index f59ba3b4f73..802c1e05891 100644 --- a/test/TestCasesAllCombined.longtest.js +++ b/test/TestCasesAllCombined.longtest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { @@ -11,7 +13,7 @@ describe("TestCases", () => { chunkIds: "named" }, plugins: [ - c => { + (c) => { const webpack = require(".."); new webpack.HotModuleReplacementPlugin().apply(c); diff --git a/test/TestCasesCachePack.longtest.js b/test/TestCasesCachePack.longtest.js index a25219da6e4..efdecbc108d 100644 --- a/test/TestCasesCachePack.longtest.js +++ b/test/TestCasesCachePack.longtest.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const { describeCases } = require("./TestCases.template"); diff --git a/test/TestCasesDevelopment.test.js b/test/TestCasesDevelopment.test.js index e837012cb28..81f3cdfe69d 100644 --- a/test/TestCasesDevelopment.test.js +++ b/test/TestCasesDevelopment.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolCheapSourceMap.test.js b/test/TestCasesDevtoolCheapSourceMap.test.js index dd38edcab0b..63c81175de4 100644 --- a/test/TestCasesDevtoolCheapSourceMap.test.js +++ b/test/TestCasesDevtoolCheapSourceMap.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolEval.test.js b/test/TestCasesDevtoolEval.test.js index d03f129781d..2e9148d54e4 100644 --- a/test/TestCasesDevtoolEval.test.js +++ b/test/TestCasesDevtoolEval.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolEvalCheapModuleSourceMap.test.js b/test/TestCasesDevtoolEvalCheapModuleSourceMap.test.js index 62000c52138..d68e8e3ea6d 100644 --- a/test/TestCasesDevtoolEvalCheapModuleSourceMap.test.js +++ b/test/TestCasesDevtoolEvalCheapModuleSourceMap.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolEvalCheapSourceMap.test.js b/test/TestCasesDevtoolEvalCheapSourceMap.test.js index a891a1ba22c..99a90e30553 100644 --- a/test/TestCasesDevtoolEvalCheapSourceMap.test.js +++ b/test/TestCasesDevtoolEvalCheapSourceMap.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolEvalDeterministicModuleIds.test.js b/test/TestCasesDevtoolEvalDeterministicModuleIds.test.js index a120ac87f7a..b91356b3dce 100644 --- a/test/TestCasesDevtoolEvalDeterministicModuleIds.test.js +++ b/test/TestCasesDevtoolEvalDeterministicModuleIds.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolEvalNamedModules.test.js b/test/TestCasesDevtoolEvalNamedModules.test.js index 0074088f8d5..554ea8f5351 100644 --- a/test/TestCasesDevtoolEvalNamedModules.test.js +++ b/test/TestCasesDevtoolEvalNamedModules.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolEvalSourceMap.test.js b/test/TestCasesDevtoolEvalSourceMap.test.js index ced8658c239..a0ae72eaae7 100644 --- a/test/TestCasesDevtoolEvalSourceMap.test.js +++ b/test/TestCasesDevtoolEvalSourceMap.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolInlineCheapSourceMap.test.js b/test/TestCasesDevtoolInlineCheapSourceMap.test.js index 8c12230099c..c54b226d7a7 100644 --- a/test/TestCasesDevtoolInlineCheapSourceMap.test.js +++ b/test/TestCasesDevtoolInlineCheapSourceMap.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolInlineSourceMap.longtest.js b/test/TestCasesDevtoolInlineSourceMap.longtest.js index de3dc71272c..ace6d539f6c 100644 --- a/test/TestCasesDevtoolInlineSourceMap.longtest.js +++ b/test/TestCasesDevtoolInlineSourceMap.longtest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesDevtoolSourceMap.longtest.js b/test/TestCasesDevtoolSourceMap.longtest.js index a5f6b9152be..db49aa5ed29 100644 --- a/test/TestCasesDevtoolSourceMap.longtest.js +++ b/test/TestCasesDevtoolSourceMap.longtest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesHot.test.js b/test/TestCasesHot.test.js index e0bd6d04410..e3ce3f229d1 100644 --- a/test/TestCasesHot.test.js +++ b/test/TestCasesHot.test.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require(".."); const { describeCases } = require("./TestCases.template"); diff --git a/test/TestCasesMinimizedSourceMap.longtest.js b/test/TestCasesMinimizedSourceMap.longtest.js index 9ec3b57178b..2e3c9d6bb33 100644 --- a/test/TestCasesMinimizedSourceMap.longtest.js +++ b/test/TestCasesMinimizedSourceMap.longtest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesModule.test.js b/test/TestCasesModule.test.js index b99158ee493..2d328abaa4b 100644 --- a/test/TestCasesModule.test.js +++ b/test/TestCasesModule.test.js @@ -1,3 +1,5 @@ +"use strict"; + const vm = require("vm"); const { describeCases } = require("./TestCases.template"); diff --git a/test/TestCasesNormal.basictest.js b/test/TestCasesNormal.basictest.js index 9d975ad2882..07ac41b4dc7 100644 --- a/test/TestCasesNormal.basictest.js +++ b/test/TestCasesNormal.basictest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/TestCasesProdGlobalUsed.test.js b/test/TestCasesProdGlobalUsed.test.js index ee3d0fbb2c8..c76d3dd82d6 100644 --- a/test/TestCasesProdGlobalUsed.test.js +++ b/test/TestCasesProdGlobalUsed.test.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCasesProdGlobalUsed", () => { diff --git a/test/TestCasesProduction.longtest.js b/test/TestCasesProduction.longtest.js index 4e60190fa86..7fae43c19c3 100644 --- a/test/TestCasesProduction.longtest.js +++ b/test/TestCasesProduction.longtest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { diff --git a/test/URLAbsoluteSpecifier.unittest.js b/test/URLAbsoluteSpecifier.unittest.js index f02e110c449..4a83ee6fb4a 100644 --- a/test/URLAbsoluteSpecifier.unittest.js +++ b/test/URLAbsoluteSpecifier.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const { getProtocol, getScheme } = require("../lib/util/URLAbsoluteSpecifier"); /** diff --git a/test/Validation.test.js b/test/Validation.test.js index 22bc34fa6ba..313f1fe280d 100644 --- a/test/Validation.test.js +++ b/test/Validation.test.js @@ -51,7 +51,7 @@ describe("Validation", () => { }); }; - createTestCase("undefined configuration", undefined, msg => + createTestCase("undefined configuration", undefined, (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration should be an object: @@ -60,7 +60,7 @@ describe("Validation", () => { `) ); - createTestCase("null configuration", null, msg => + createTestCase("null configuration", null, (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration should be an object: @@ -74,7 +74,7 @@ describe("Validation", () => { { entry: "" }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.entry should be a non-empty string. @@ -89,7 +89,7 @@ describe("Validation", () => { bundle: [] } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.entry.bundle should be a non-empty array. @@ -105,7 +105,7 @@ describe("Validation", () => { wrappedContextRegExp: 1337 } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.module.wrappedContextRegExp should be an instance of RegExp. @@ -119,7 +119,7 @@ describe("Validation", () => { entry: "a", parallelism: 0 }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.parallelism should be >= 1. @@ -132,7 +132,7 @@ describe("Validation", () => { { entry: ["abc", "def", "abc"] }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.entry should not contain the item 'abc' twice. @@ -148,7 +148,7 @@ describe("Validation", () => { filename: /a/ } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.entry[0] should be a non-empty string. @@ -175,7 +175,7 @@ describe("Validation", () => { } } ], - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration[0].entry[0] should be a non-empty string. @@ -208,7 +208,7 @@ describe("Validation", () => { ] } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.module.rules[0].oneOf[0] has an unknown property 'passer'. These properties are valid: @@ -223,7 +223,7 @@ describe("Validation", () => { entry: "a", postcss: () => {} }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration has an unknown property 'postcss'. These properties are valid: @@ -250,7 +250,7 @@ describe("Validation", () => { entry: "a", devtool: true }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.devtool should be one of these: @@ -272,7 +272,7 @@ describe("Validation", () => { filename: "bar" } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.output.path: The provided value \\"/somepath/!test\\" contains exclamation mark (!) which is not allowed because it's reserved for loader syntax. @@ -288,7 +288,7 @@ describe("Validation", () => { filename: "/bar" } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.output.filename: A relative path is expected. However, the provided value \\"/bar\\" is an absolute path! @@ -305,7 +305,7 @@ describe("Validation", () => { }, context: "baz" }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.context: The provided value \\"baz\\" is not an absolute path! @@ -321,7 +321,7 @@ describe("Validation", () => { foobar: true } }, - msg => { + (msg) => { expect( msg .replace(/object \{ .* \}/g, "object {...}") @@ -341,7 +341,7 @@ describe("Validation", () => { entry: "foo.js", plugins: [true] }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.plugins[0] should be one of these: @@ -365,7 +365,7 @@ describe("Validation", () => { entry: "foo.js", plugins: [[]] }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.plugins[0] should be one of these: @@ -389,7 +389,7 @@ describe("Validation", () => { entry: "foo.js", plugins: ["abc123"] }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.plugins[0] should be one of these: @@ -413,7 +413,7 @@ describe("Validation", () => { entry: "foo.js", plugins: [12] }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.plugins[0] should be one of these: @@ -437,7 +437,7 @@ describe("Validation", () => { entry: "foo.js", plugins: [{}] }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.plugins[0] misses the property 'apply'. Should be: @@ -452,7 +452,7 @@ describe("Validation", () => { { mode: "protuction" }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.mode should be one of these: @@ -466,7 +466,7 @@ describe("Validation", () => { { debug: true }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration has an unknown property 'debug'. These properties are valid: @@ -494,7 +494,7 @@ describe("Validation", () => { } } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.optimization.splitChunks.cacheGroups should not be object { test, … }. @@ -514,7 +514,7 @@ describe("Validation", () => { "holey array", // eslint-disable-next-line no-sparse-arrays [{ mode: "production" }, , { mode: "development" }], - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration[1] should be an object: @@ -528,7 +528,7 @@ describe("Validation", () => { { output: { ecmaVersion: 2015 } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.output has an unknown property 'ecmaVersion'. These properties are valid: @@ -543,7 +543,7 @@ describe("Validation", () => { { devtool: "sourcemap" }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\". @@ -557,7 +557,7 @@ describe("Validation", () => { { devtool: "source-maps" }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\". @@ -571,7 +571,7 @@ describe("Validation", () => { { watchOptions: true }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.watchOptions should be an object: @@ -585,7 +585,7 @@ describe("Validation", () => { { devtool: "cheap-eval-nosource-source-map" }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\". @@ -599,7 +599,7 @@ describe("Validation", () => { { devtool: "cheap-eval-nosource-source-map" }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\". @@ -618,7 +618,7 @@ describe("Validation", () => { devtool: "unknown" } ], - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration[0].devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\". @@ -632,7 +632,7 @@ describe("Validation", () => { { rules: [] }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration has an unknown property 'rules'. These properties are valid: @@ -646,7 +646,7 @@ describe("Validation", () => { { splitChunks: false }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration has an unknown property 'splitChunks'. These properties are valid: @@ -660,7 +660,7 @@ describe("Validation", () => { { noParse: /a/ }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration has an unknown property 'noParse'. These properties are valid: @@ -676,7 +676,7 @@ describe("Validation", () => { hashedModuleIds: true } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.optimization has an unknown property 'hashedModuleIds'. These properties are valid: @@ -692,7 +692,7 @@ describe("Validation", () => { namedChunks: true } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.optimization has an unknown property 'namedChunks'. These properties are valid: @@ -708,7 +708,7 @@ describe("Validation", () => { occurrenceOrder: true } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.optimization has an unknown property 'occurrenceOrder'. These properties are valid: @@ -726,7 +726,7 @@ describe("Validation", () => { } } }, - msg => + (msg) => expect(msg).toMatchInlineSnapshot(` "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.optimization.splitChunks has an unknown property 'automaticNamePrefix'. These properties are valid: diff --git a/test/WasmHashes.unittest.js b/test/WasmHashes.unittest.js index b3f5323b471..24820255373 100644 --- a/test/WasmHashes.unittest.js +++ b/test/WasmHashes.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const { createHash, randomBytes } = require("crypto"); const wasmHashes = { diff --git a/test/Watch.test.js b/test/Watch.test.js index f7d13c2a0dc..bb865a94b8c 100644 --- a/test/Watch.test.js +++ b/test/Watch.test.js @@ -9,7 +9,7 @@ const webpack = require(".."); jest.setTimeout(10000); describe("Watch", () => { - it("should only compile a single time", done => { + it("should only compile a single time", (done) => { let counterBeforeCompile = 0; let counterDone = 0; let counterHandler = 0; @@ -34,7 +34,7 @@ describe("Watch", () => { ] }, plugins: [ - c => { + (c) => { c.hooks.beforeCompile.tap("test", () => { counterBeforeCompile++; }); diff --git a/test/WatchCacheUnaffectedTestCases.longtest.js b/test/WatchCacheUnaffectedTestCases.longtest.js index 3a9ab819e4c..8b5649240f0 100644 --- a/test/WatchCacheUnaffectedTestCases.longtest.js +++ b/test/WatchCacheUnaffectedTestCases.longtest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./WatchTestCases.template"); describeCases({ diff --git a/test/WatchClose.test.js b/test/WatchClose.test.js index bc590fb26e4..8ad845f0916 100644 --- a/test/WatchClose.test.js +++ b/test/WatchClose.test.js @@ -40,7 +40,7 @@ describe("WatchClose", () => { * @returns {Promise} */ function close(watcher, callback) { - return new Promise(res => { + return new Promise((res) => { const onClose = () => { callback(); res(); diff --git a/test/WatchDetection.test.js b/test/WatchDetection.test.js index e59ea707b40..1dcb195c378 100644 --- a/test/WatchDetection.test.js +++ b/test/WatchDetection.test.js @@ -53,7 +53,7 @@ describe("WatchDetection", () => { fs.writeFileSync(file2Path, "original", "utf8"); }); - afterAll(done => { + afterAll((done) => { setTimeout(() => { try { fs.unlinkSync(filePath); @@ -74,7 +74,7 @@ describe("WatchDetection", () => { }, 100); // cool down a bit }); - it("should build the bundle correctly", done => { + it("should build the bundle correctly", (done) => { const compiler = webpack({ mode: "development", entry: `${loaderPath}!${filePath}`, diff --git a/test/WatchSuspend.test.js b/test/WatchSuspend.test.js index 4f62156e8ce..f40982e806e 100644 --- a/test/WatchSuspend.test.js +++ b/test/WatchSuspend.test.js @@ -76,7 +76,7 @@ describe("WatchSuspend", () => { } }); - it("should compile successfully", done => { + it("should compile successfully", (done) => { onChange = () => { expect(fs.readFileSync(outputFile, "utf8")).toContain("'foo'"); onChange = null; @@ -84,7 +84,7 @@ describe("WatchSuspend", () => { }; }); - it("should suspend compilation", done => { + it("should suspend compilation", (done) => { onChange = jest.fn(); watching.suspend(); fs.writeFileSync(filePath, "'bar'", "utf8"); @@ -95,7 +95,7 @@ describe("WatchSuspend", () => { }, 1000); }); - it("should resume compilation", done => { + it("should resume compilation", (done) => { onChange = () => { expect(fs.readFileSync(outputFile, "utf8")).toContain("'bar'"); onChange = null; @@ -110,14 +110,14 @@ describe("WatchSuspend", () => { it(`should not ignore changes during resumed compilation (changeBefore: ${changeBefore}, delay: ${delay}ms)`, async () => { // aggregateTimeout must be long enough for this test // So set-up new watcher and wait when initial compilation is done - await new Promise(resolve => { + await new Promise((resolve) => { watching.close(() => { watching = compiler.watch({ aggregateTimeout: 1000 }, () => { resolve(); }); }); }); - return new Promise(resolve => { + return new Promise((resolve) => { if (changeBefore) fs.writeFileSync(filePath, "'bar'", "utf8"); setTimeout(() => { watching.suspend(); @@ -146,7 +146,7 @@ describe("WatchSuspend", () => { } } - it("should not drop changes when suspended", done => { + it("should not drop changes when suspended", (done) => { const aggregateTimeout = 50; // Trigger initial compilation with file2.js (assuming correct) fs.writeFileSync( diff --git a/test/WatchTestCases.longtest.js b/test/WatchTestCases.longtest.js index 14de99b424e..23e8f27837c 100644 --- a/test/WatchTestCases.longtest.js +++ b/test/WatchTestCases.longtest.js @@ -1,3 +1,5 @@ +"use strict"; + const { describeCases } = require("./WatchTestCases.template"); describeCases({ diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js index 449b7f60576..c027b336cf9 100644 --- a/test/WatchTestCases.template.js +++ b/test/WatchTestCases.template.js @@ -50,7 +50,7 @@ function copyDiff(src, dest, initial) { } } -const describeCases = config => { +const describeCases = (config) => { describe(config.name, () => { beforeAll(() => { let dest = path.join(__dirname, "js"); @@ -67,12 +67,12 @@ const describeCases = config => { } const casesPath = path.join(__dirname, "watchCases"); - const categories = fs.readdirSync(casesPath).map(cat => ({ + const categories = fs.readdirSync(casesPath).map((cat) => ({ name: cat, tests: fs .readdirSync(path.join(casesPath, cat)) - .filter(folder => !folder.includes("_")) - .filter(testName => { + .filter((folder) => !folder.includes("_")) + .filter((testName) => { const testDirectory = path.join(casesPath, cat, testName); const filterPath = path.join(testDirectory, "test.filter.js"); if (fs.existsSync(filterPath) && !require(filterPath)(config)) { @@ -113,16 +113,16 @@ const describeCases = config => { const runs = fs .readdirSync(testDirectory) .sort() - .filter(name => + .filter((name) => fs.statSync(path.join(testDirectory, name)).isDirectory() ) - .map(name => ({ name })); + .map((name) => ({ name })); - beforeAll(done => { + beforeAll((done) => { rimraf(tempDirectory, done); }); - it(`${testName} should compile`, done => { + it(`${testName} should compile`, (done) => { const outputDirectory = path.join( __dirname, "js", @@ -323,14 +323,14 @@ const describeCases = config => { }); const getBundle = (outputDirectory, module) => { if (Array.isArray(module)) { - return module.map(arg => + return module.map((arg) => path.join(outputDirectory, arg) ); } else if (module instanceof RegExp) { return fs .readdirSync(outputDirectory) - .filter(f => module.test(f)) - .map(f => path.join(outputDirectory, f)); + .filter((f) => module.test(f)) + .map((f) => path.join(outputDirectory, f)); } return [path.join(outputDirectory, module)]; }; @@ -356,7 +356,7 @@ const describeCases = config => { run.it( "should compile the next step", - done => { + (done) => { runIdx++; if (runIdx < runs.length) { run = runs[runIdx]; @@ -406,7 +406,7 @@ const describeCases = config => { run.it = _it; run.getNumberOfTests = getNumberOfTests; - it(`${run.name} should allow to read stats`, done => { + it(`${run.name} should allow to read stats`, (done) => { if (run.stats) { run.stats.toString({ all: true }); run.stats = undefined; diff --git a/test/WatcherEvents.test.js b/test/WatcherEvents.test.js index 2db8e930bee..059c6f0da6f 100644 --- a/test/WatcherEvents.test.js +++ b/test/WatcherEvents.test.js @@ -4,7 +4,7 @@ const path = require("path"); const { Volume, createFsFromVolume } = require("memfs"); const webpack = require(".."); -const createCompiler = config => { +const createCompiler = (config) => { const compiler = webpack(config); compiler.outputFileSystem = createFsFromVolume(new Volume()); return compiler; @@ -34,7 +34,7 @@ describe("WatcherEvents", () => { jest.setTimeout(10000); - it("should emit 'watch-close' when using single-compiler mode and the compiler is not running", done => { + it("should emit 'watch-close' when using single-compiler mode and the compiler is not running", (done) => { let called = false; const compiler = createSingleCompiler(); @@ -52,7 +52,7 @@ describe("WatcherEvents", () => { }); }); - it("should emit 'watch-close' when using multi-compiler mode and the compiler is not running", done => { + it("should emit 'watch-close' when using multi-compiler mode and the compiler is not running", (done) => { let called = false; const compiler = createMultiCompiler(); diff --git a/test/__snapshots__/Cli.basictest.js.snap b/test/__snapshots__/Cli.basictest.js.snap index 6aba60c2da1..eaaf87435b7 100644 --- a/test/__snapshots__/Cli.basictest.js.snap +++ b/test/__snapshots__/Cli.basictest.js.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`Cli should generate the correct cli flags 1`] = ` +exports[`Cli getArguments should generate the correct cli flags 1`] = ` Object { "amd": Object { "configs": Array [ @@ -1989,6 +1989,19 @@ Object { "multiple": false, "simpleType": "string", }, + "module-parser-javascript-auto-defer-import": Object { + "configs": Array [ + Object { + "description": "Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use.", + "multiple": false, + "path": "module.parser.javascript/auto.deferImport", + "type": "boolean", + }, + ], + "description": "Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use.", + "multiple": false, + "simpleType": "boolean", + }, "module-parser-javascript-auto-dynamic-import-fetch-priority": Object { "configs": Array [ Object { @@ -2638,6 +2651,19 @@ Object { "multiple": false, "simpleType": "string", }, + "module-parser-javascript-defer-import": Object { + "configs": Array [ + Object { + "description": "Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use.", + "multiple": false, + "path": "module.parser.javascript.deferImport", + "type": "boolean", + }, + ], + "description": "Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use.", + "multiple": false, + "simpleType": "boolean", + }, "module-parser-javascript-dynamic-amd": Object { "configs": Array [ Object { @@ -2712,6 +2738,19 @@ Object { "multiple": false, "simpleType": "string", }, + "module-parser-javascript-dynamic-defer-import": Object { + "configs": Array [ + Object { + "description": "Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use.", + "multiple": false, + "path": "module.parser.javascript/dynamic.deferImport", + "type": "boolean", + }, + ], + "description": "Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use.", + "multiple": false, + "simpleType": "boolean", + }, "module-parser-javascript-dynamic-dynamic-import-fetch-priority": Object { "configs": Array [ Object { @@ -3459,6 +3498,19 @@ Object { "multiple": false, "simpleType": "string", }, + "module-parser-javascript-esm-defer-import": Object { + "configs": Array [ + Object { + "description": "Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use.", + "multiple": false, + "path": "module.parser.javascript/esm.deferImport", + "type": "boolean", + }, + ], + "description": "Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use.", + "multiple": false, + "simpleType": "boolean", + }, "module-parser-javascript-esm-dynamic-import-fetch-priority": Object { "configs": Array [ Object { @@ -10385,7 +10437,7 @@ Object { } `; -exports[`Cli should generate the correct cli flags with custom schema 1`] = ` +exports[`Cli getArguments should generate the correct cli flags with custom schema 1`] = ` Object { "with-both-cli-and-negative-description": Object { "configs": Array [ diff --git a/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap b/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap index 3d5a1526b01..2d22d508fc2 100644 --- a/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap +++ b/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap @@ -3498,6 +3498,8 @@ exports[`ConfigCacheTestCases css css-modules-no-space exported tests should all exports[`ConfigCacheTestCases css css-order exported tests keep consistent css order 1`] = `".button-module { padding: 8px 16px; background-color: #007bff; color: white; border: none; border-radius: 4px;}.teaser-module { padding: 20px; border: 1px solid #ddd; border-radius: 8px; margin: 16px;}.teaser-module { background-color: orange;}"`; +exports[`ConfigCacheTestCases css css-order-concatenate-modules exported tests keep consistent css order 1`] = `".a { color: red;}.b{ color: green;}.c{ color: black;}"`; + exports[`ConfigCacheTestCases css css-order-reexport exported tests keep consistent css order 1`] = `".dependency2::before { content: \\"dependency2\\";}.dependency::before { content: \\"dependency\\";}"`; exports[`ConfigCacheTestCases css css-order2 exported tests keep consistent css order 1`] = `".dependency2::before { content: \\"dependency2\\";}.dependency::before { content: \\"dependency\\";}"`; @@ -10146,3 +10148,1095 @@ exports[`ConfigCacheTestCases css webpack-ignore exported tests should compile 1 " `; + +exports[`ConfigCacheTestCases library concatenate-modules-named-import-externals concatenate-modules-named-import-externals should compile 1`] = ` +"import { HomeLayout as lib_HomeLayout_0, a } from \\"externals0\\"; +import { HomeLayout as HomeLayout_0, a as a_0 } from \\"externals1\\"; +import { default as default_0 } from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import \\"externals4\\"; +/*!*****************************!*\\\\ + !*** ./test.js + 6 modules ***! + \\\\*****************************/ + +;// external \\"externals0\\" + +;// external \\"externals1\\" + +;// external \\"externals2\\" + +;// external \\"externals3\\" +const external_externals3_namespaceObject = __WEBPACK_EXTERNAL_MODULE_externals3__; +;// external \\"externals4\\" + +;// ./lib.js + + +const { HomeLayout: lib_HomeLayout = 123 } = {}; +console.log({ HomeLayout: lib_HomeLayout }); +{ + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + +;// ./test.js +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +HomeLayout_0; +a; +a_0; +default_0; +external_externals3_namespaceObject; +export { lib_HomeLayout as HomeLayout, a }; +" +`; + +exports[`ConfigCacheTestCases library concatenate-modules-named-import-externals concatenate-modules-named-import-externals should compile 2`] = ` +"import { HomeLayout as lib_HomeLayout_0, a } from \\"externals0\\"; +import { HomeLayout as HomeLayout_0, a as a_0 } from \\"externals1\\"; +import { default as default_0 } from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import \\"externals4\\"; +/*!*****************************!*\\\\ + !*** ./test.js + 6 modules ***! + \\\\*****************************/ + +;// external \\"externals0\\" + +;// external \\"externals1\\" + +;// external \\"externals2\\" + +;// external \\"externals3\\" +const external_externals3_namespaceObject = __WEBPACK_EXTERNAL_MODULE_externals3__; +;// external \\"externals4\\" + +;// ./lib.js + + +const { HomeLayout: lib_HomeLayout = 123 } = {}; +console.log({ HomeLayout: lib_HomeLayout }); +{ + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + +;// ./test.js +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +HomeLayout_0; +a; +a_0; +default_0; +external_externals3_namespaceObject; +export { lib_HomeLayout as HomeLayout, a }; +" +`; + +exports[`ConfigCacheTestCases library concatenate-modules-named-import-externals concatenate-modules-named-import-externals should pre-compile to fill disk cache (1st) 1`] = ` +"import { HomeLayout as lib_HomeLayout_0, a } from \\"externals0\\"; +import { HomeLayout as HomeLayout_0, a as a_0 } from \\"externals1\\"; +import { default as default_0 } from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import \\"externals4\\"; +/*!*****************************!*\\\\ + !*** ./test.js + 6 modules ***! + \\\\*****************************/ + +;// external \\"externals0\\" + +;// external \\"externals1\\" + +;// external \\"externals2\\" + +;// external \\"externals3\\" +const external_externals3_namespaceObject = __WEBPACK_EXTERNAL_MODULE_externals3__; +;// external \\"externals4\\" + +;// ./lib.js + + +const { HomeLayout: lib_HomeLayout = 123 } = {}; +console.log({ HomeLayout: lib_HomeLayout }); +{ + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + +;// ./test.js +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +HomeLayout_0; +a; +a_0; +default_0; +external_externals3_namespaceObject; +export { lib_HomeLayout as HomeLayout, a }; +" +`; + +exports[`ConfigCacheTestCases library concatenate-modules-named-import-externals concatenate-modules-named-import-externals should pre-compile to fill disk cache (2nd) 1`] = ` +"import { HomeLayout as lib_HomeLayout_0, a } from \\"externals0\\"; +import { HomeLayout as HomeLayout_0, a as a_0 } from \\"externals1\\"; +import { default as default_0 } from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import \\"externals4\\"; +/*!*****************************!*\\\\ + !*** ./test.js + 6 modules ***! + \\\\*****************************/ + +;// external \\"externals0\\" + +;// external \\"externals1\\" + +;// external \\"externals2\\" + +;// external \\"externals3\\" +const external_externals3_namespaceObject = __WEBPACK_EXTERNAL_MODULE_externals3__; +;// external \\"externals4\\" + +;// ./lib.js + + +const { HomeLayout: lib_HomeLayout = 123 } = {}; +console.log({ HomeLayout: lib_HomeLayout }); +{ + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + +;// ./test.js +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +HomeLayout_0; +a; +a_0; +default_0; +external_externals3_namespaceObject; +export { lib_HomeLayout as HomeLayout, a }; +" +`; + +exports[`ConfigCacheTestCases library modern-module-named-import-externals modern-module-named-import-externals should compile 1`] = ` +"import * as __WEBPACK_EXTERNAL_MODULE_externals0__ from \\"externals0\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals1__ from \\"externals1\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals2__ from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals4__ from \\"externals4\\"; +/******/ var __webpack_modules__ = ([ +/* 0 */, +/* 1 */, +/* 2 */ +/*!*****************************!*\\\\ + !*** external \\"externals0\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.a) }); + +/***/ }), +/* 3 */ +/*!*****************************!*\\\\ + !*** external \\"externals1\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.a) }); + +/***/ }), +/* 4 */ +/*!*****************************!*\\\\ + !*** external \\"externals2\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"default\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals2__[\\"default\\"]) }); + +/***/ }), +/* 5 */ +/*!*****************************!*\\\\ + !*** external \\"externals3\\" ***! + \\\\*****************************/ +/***/ ((module) => { + +module.exports = __WEBPACK_EXTERNAL_MODULE_externals3__; + +/***/ }), +/* 6 */ +/*!*****************************!*\\\\ + !*** external \\"externals4\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ }); + +/***/ }), +/* 7 */ +/*!****************!*\\\\ + !*** ./lib.js ***! + \\\\****************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* binding */ HomeLayout) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); + + +const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; +console.log({ HomeLayout }); +{ + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + + +/***/ }) +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { +/*!*****************!*\\\\ + !*** ./test.js ***! + \\\\*****************/ +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_5__.HomeLayout), +/* harmony export */ a: () => (/* reexport safe */ externals0__WEBPACK_IMPORTED_MODULE_0__.a) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); +/* harmony import */ var externals1__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! externals1 */ 3); +/* harmony import */ var externals2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! externals2 */ 4); +/* harmony import */ var externals3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! externals3 */ 5); +/* harmony import */ var externals4__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! externals4 */ 6); +/* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib */ 7); +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +externals1__WEBPACK_IMPORTED_MODULE_1__.HomeLayout; +externals0__WEBPACK_IMPORTED_MODULE_0__.a; +externals1__WEBPACK_IMPORTED_MODULE_1__.a; +externals2__WEBPACK_IMPORTED_MODULE_2__[\\"default\\"]; +externals3__WEBPACK_IMPORTED_MODULE_3__; +})(); + +const __webpack_exports__HomeLayout = __webpack_exports__.HomeLayout; +const __webpack_exports__a = __webpack_exports__.a; +export { __webpack_exports__HomeLayout as HomeLayout, __webpack_exports__a as a }; +" +`; + +exports[`ConfigCacheTestCases library modern-module-named-import-externals modern-module-named-import-externals should compile 2`] = ` +"import * as __WEBPACK_EXTERNAL_MODULE_externals0__ from \\"externals0\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals1__ from \\"externals1\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals2__ from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals4__ from \\"externals4\\"; +/******/ var __webpack_modules__ = ([ +/* 0 */, +/* 1 */, +/* 2 */ +/*!*****************************!*\\\\ + !*** external \\"externals0\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.a) }); + +/***/ }), +/* 3 */ +/*!*****************************!*\\\\ + !*** external \\"externals1\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.a) }); + +/***/ }), +/* 4 */ +/*!*****************************!*\\\\ + !*** external \\"externals2\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"default\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals2__[\\"default\\"]) }); + +/***/ }), +/* 5 */ +/*!*****************************!*\\\\ + !*** external \\"externals3\\" ***! + \\\\*****************************/ +/***/ ((module) => { + +module.exports = __WEBPACK_EXTERNAL_MODULE_externals3__; + +/***/ }), +/* 6 */ +/*!*****************************!*\\\\ + !*** external \\"externals4\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ }); + +/***/ }), +/* 7 */ +/*!****************!*\\\\ + !*** ./lib.js ***! + \\\\****************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* binding */ HomeLayout) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); + + +const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; +console.log({ HomeLayout }); +{ + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + + +/***/ }) +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { +/*!*****************!*\\\\ + !*** ./test.js ***! + \\\\*****************/ +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_5__.HomeLayout), +/* harmony export */ a: () => (/* reexport safe */ externals0__WEBPACK_IMPORTED_MODULE_0__.a) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); +/* harmony import */ var externals1__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! externals1 */ 3); +/* harmony import */ var externals2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! externals2 */ 4); +/* harmony import */ var externals3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! externals3 */ 5); +/* harmony import */ var externals4__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! externals4 */ 6); +/* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib */ 7); +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +externals1__WEBPACK_IMPORTED_MODULE_1__.HomeLayout; +externals0__WEBPACK_IMPORTED_MODULE_0__.a; +externals1__WEBPACK_IMPORTED_MODULE_1__.a; +externals2__WEBPACK_IMPORTED_MODULE_2__[\\"default\\"]; +externals3__WEBPACK_IMPORTED_MODULE_3__; +})(); + +const __webpack_exports__HomeLayout = __webpack_exports__.HomeLayout; +const __webpack_exports__a = __webpack_exports__.a; +export { __webpack_exports__HomeLayout as HomeLayout, __webpack_exports__a as a }; +" +`; + +exports[`ConfigCacheTestCases library modern-module-named-import-externals modern-module-named-import-externals should pre-compile to fill disk cache (1st) 1`] = ` +"import * as __WEBPACK_EXTERNAL_MODULE_externals0__ from \\"externals0\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals1__ from \\"externals1\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals2__ from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals4__ from \\"externals4\\"; +/******/ var __webpack_modules__ = ([ +/* 0 */, +/* 1 */, +/* 2 */ +/*!*****************************!*\\\\ + !*** external \\"externals0\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.a) }); + +/***/ }), +/* 3 */ +/*!*****************************!*\\\\ + !*** external \\"externals1\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.a) }); + +/***/ }), +/* 4 */ +/*!*****************************!*\\\\ + !*** external \\"externals2\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"default\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals2__[\\"default\\"]) }); + +/***/ }), +/* 5 */ +/*!*****************************!*\\\\ + !*** external \\"externals3\\" ***! + \\\\*****************************/ +/***/ ((module) => { + +module.exports = __WEBPACK_EXTERNAL_MODULE_externals3__; + +/***/ }), +/* 6 */ +/*!*****************************!*\\\\ + !*** external \\"externals4\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ }); + +/***/ }), +/* 7 */ +/*!****************!*\\\\ + !*** ./lib.js ***! + \\\\****************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* binding */ HomeLayout) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); + + +const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; +console.log({ HomeLayout }); +{ + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + + +/***/ }) +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { +/*!*****************!*\\\\ + !*** ./test.js ***! + \\\\*****************/ +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_5__.HomeLayout), +/* harmony export */ a: () => (/* reexport safe */ externals0__WEBPACK_IMPORTED_MODULE_0__.a) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); +/* harmony import */ var externals1__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! externals1 */ 3); +/* harmony import */ var externals2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! externals2 */ 4); +/* harmony import */ var externals3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! externals3 */ 5); +/* harmony import */ var externals4__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! externals4 */ 6); +/* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib */ 7); +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +externals1__WEBPACK_IMPORTED_MODULE_1__.HomeLayout; +externals0__WEBPACK_IMPORTED_MODULE_0__.a; +externals1__WEBPACK_IMPORTED_MODULE_1__.a; +externals2__WEBPACK_IMPORTED_MODULE_2__[\\"default\\"]; +externals3__WEBPACK_IMPORTED_MODULE_3__; +})(); + +const __webpack_exports__HomeLayout = __webpack_exports__.HomeLayout; +const __webpack_exports__a = __webpack_exports__.a; +export { __webpack_exports__HomeLayout as HomeLayout, __webpack_exports__a as a }; +" +`; + +exports[`ConfigCacheTestCases library modern-module-named-import-externals modern-module-named-import-externals should pre-compile to fill disk cache (2nd) 1`] = ` +"import * as __WEBPACK_EXTERNAL_MODULE_externals0__ from \\"externals0\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals1__ from \\"externals1\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals2__ from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals4__ from \\"externals4\\"; +/******/ var __webpack_modules__ = ([ +/* 0 */, +/* 1 */, +/* 2 */ +/*!*****************************!*\\\\ + !*** external \\"externals0\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.a) }); + +/***/ }), +/* 3 */ +/*!*****************************!*\\\\ + !*** external \\"externals1\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.a) }); + +/***/ }), +/* 4 */ +/*!*****************************!*\\\\ + !*** external \\"externals2\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"default\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals2__[\\"default\\"]) }); + +/***/ }), +/* 5 */ +/*!*****************************!*\\\\ + !*** external \\"externals3\\" ***! + \\\\*****************************/ +/***/ ((module) => { + +module.exports = __WEBPACK_EXTERNAL_MODULE_externals3__; + +/***/ }), +/* 6 */ +/*!*****************************!*\\\\ + !*** external \\"externals4\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ }); + +/***/ }), +/* 7 */ +/*!****************!*\\\\ + !*** ./lib.js ***! + \\\\****************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* binding */ HomeLayout) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); + + +const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; +console.log({ HomeLayout }); +{ + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + + +/***/ }) +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { +/*!*****************!*\\\\ + !*** ./test.js ***! + \\\\*****************/ +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_5__.HomeLayout), +/* harmony export */ a: () => (/* reexport safe */ externals0__WEBPACK_IMPORTED_MODULE_0__.a) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); +/* harmony import */ var externals1__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! externals1 */ 3); +/* harmony import */ var externals2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! externals2 */ 4); +/* harmony import */ var externals3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! externals3 */ 5); +/* harmony import */ var externals4__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! externals4 */ 6); +/* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib */ 7); +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +externals1__WEBPACK_IMPORTED_MODULE_1__.HomeLayout; +externals0__WEBPACK_IMPORTED_MODULE_0__.a; +externals1__WEBPACK_IMPORTED_MODULE_1__.a; +externals2__WEBPACK_IMPORTED_MODULE_2__[\\"default\\"]; +externals3__WEBPACK_IMPORTED_MODULE_3__; +})(); + +const __webpack_exports__HomeLayout = __webpack_exports__.HomeLayout; +const __webpack_exports__a = __webpack_exports__.a; +export { __webpack_exports__HomeLayout as HomeLayout, __webpack_exports__a as a }; +" +`; diff --git a/test/__snapshots__/ConfigTestCases.basictest.js.snap b/test/__snapshots__/ConfigTestCases.basictest.js.snap index fc6de606181..c281a612f2a 100644 --- a/test/__snapshots__/ConfigTestCases.basictest.js.snap +++ b/test/__snapshots__/ConfigTestCases.basictest.js.snap @@ -3498,6 +3498,8 @@ exports[`ConfigTestCases css css-modules-no-space exported tests should allow to exports[`ConfigTestCases css css-order exported tests keep consistent css order 1`] = `".button-module { padding: 8px 16px; background-color: #007bff; color: white; border: none; border-radius: 4px;}.teaser-module { padding: 20px; border: 1px solid #ddd; border-radius: 8px; margin: 16px;}.teaser-module { background-color: orange;}"`; +exports[`ConfigTestCases css css-order-concatenate-modules exported tests keep consistent css order 1`] = `".a { color: red;}.b{ color: green;}.c{ color: black;}"`; + exports[`ConfigTestCases css css-order-reexport exported tests keep consistent css order 1`] = `".dependency2::before { content: \\"dependency2\\";}.dependency::before { content: \\"dependency\\";}"`; exports[`ConfigTestCases css css-order2 exported tests keep consistent css order 1`] = `".dependency2::before { content: \\"dependency2\\";}.dependency::before { content: \\"dependency\\";}"`; @@ -10146,3 +10148,276 @@ exports[`ConfigTestCases css webpack-ignore exported tests should compile 1`] = " `; + +exports[`ConfigTestCases library concatenate-modules-named-import-externals concatenate-modules-named-import-externals should compile 1`] = ` +"import { HomeLayout as lib_HomeLayout_0, a } from \\"externals0\\"; +import { HomeLayout as HomeLayout_0, a as a_0 } from \\"externals1\\"; +import { default as default_0 } from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import \\"externals4\\"; +/*!*****************************!*\\\\ + !*** ./test.js + 6 modules ***! + \\\\*****************************/ + +;// external \\"externals0\\" + +;// external \\"externals1\\" + +;// external \\"externals2\\" + +;// external \\"externals3\\" +const external_externals3_namespaceObject = __WEBPACK_EXTERNAL_MODULE_externals3__; +;// external \\"externals4\\" + +;// ./lib.js + + +const { HomeLayout: lib_HomeLayout = 123 } = {}; +console.log({ HomeLayout: lib_HomeLayout }); +{ + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = lib_HomeLayout_0 } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + +;// ./test.js +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +HomeLayout_0; +a; +a_0; +default_0; +external_externals3_namespaceObject; +export { lib_HomeLayout as HomeLayout, a }; +" +`; + +exports[`ConfigTestCases library modern-module-named-import-externals modern-module-named-import-externals should compile 1`] = ` +"import * as __WEBPACK_EXTERNAL_MODULE_externals0__ from \\"externals0\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals1__ from \\"externals1\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals2__ from \\"externals2\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals3__ from \\"externals3\\"; +import * as __WEBPACK_EXTERNAL_MODULE_externals4__ from \\"externals4\\"; +/******/ var __webpack_modules__ = ([ +/* 0 */, +/* 1 */, +/* 2 */ +/*!*****************************!*\\\\ + !*** external \\"externals0\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals0__.a) }); + +/***/ }), +/* 3 */ +/*!*****************************!*\\\\ + !*** external \\"externals1\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"HomeLayout\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.HomeLayout), [\\"a\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals1__.a) }); + +/***/ }), +/* 4 */ +/*!*****************************!*\\\\ + !*** external \\"externals2\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ [\\"default\\"]: () => (__WEBPACK_EXTERNAL_MODULE_externals2__[\\"default\\"]) }); + +/***/ }), +/* 5 */ +/*!*****************************!*\\\\ + !*** external \\"externals3\\" ***! + \\\\*****************************/ +/***/ ((module) => { + +module.exports = __WEBPACK_EXTERNAL_MODULE_externals3__; + +/***/ }), +/* 6 */ +/*!*****************************!*\\\\ + !*** external \\"externals4\\" ***! + \\\\*****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +module.exports = x({ }); + +/***/ }), +/* 7 */ +/*!****************!*\\\\ + !*** ./lib.js ***! + \\\\****************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* binding */ HomeLayout) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); + + +const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; +console.log({ HomeLayout }); +{ + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = externals0__WEBPACK_IMPORTED_MODULE_0__.HomeLayout } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = \\"111\\" } = {} + console.log({ external_externals3_namespaceObject }); +} + + + +/***/ }) +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { +/*!*****************!*\\\\ + !*** ./test.js ***! + \\\\*****************/ +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HomeLayout: () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_5__.HomeLayout), +/* harmony export */ a: () => (/* reexport safe */ externals0__WEBPACK_IMPORTED_MODULE_0__.a) +/* harmony export */ }); +/* harmony import */ var externals0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! externals0 */ 2); +/* harmony import */ var externals1__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! externals1 */ 3); +/* harmony import */ var externals2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! externals2 */ 4); +/* harmony import */ var externals3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! externals3 */ 5); +/* harmony import */ var externals4__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! externals4 */ 6); +/* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib */ 7); +// re export + + +// named import +; + + +// default import + + +// namespace import + + +// side effect only import + + + + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +externals1__WEBPACK_IMPORTED_MODULE_1__.HomeLayout; +externals0__WEBPACK_IMPORTED_MODULE_0__.a; +externals1__WEBPACK_IMPORTED_MODULE_1__.a; +externals2__WEBPACK_IMPORTED_MODULE_2__[\\"default\\"]; +externals3__WEBPACK_IMPORTED_MODULE_3__; +})(); + +const __webpack_exports__HomeLayout = __webpack_exports__.HomeLayout; +const __webpack_exports__a = __webpack_exports__.a; +export { __webpack_exports__HomeLayout as HomeLayout, __webpack_exports__a as a }; +" +`; diff --git a/test/benchmarkCases/cache-filesystem/webpack.config.js b/test/benchmarkCases/cache-filesystem/webpack.config.js index 9d55f533c86..c8d2a58d3cf 100644 --- a/test/benchmarkCases/cache-filesystem/webpack.config.js +++ b/test/benchmarkCases/cache-filesystem/webpack.config.js @@ -1,7 +1,12 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index", cache: { - type: "filesystem" + type: "filesystem", + // For benchmark stability + maxMemoryGenerations: 0, + idleTimeoutForInitialStore: 0 } }; diff --git a/test/benchmarkCases/context-commonjs/webpack.config.js b/test/benchmarkCases/context-commonjs/webpack.config.js index 4c111be6a97..618e121cccd 100644 --- a/test/benchmarkCases/context-commonjs/webpack.config.js +++ b/test/benchmarkCases/context-commonjs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index" diff --git a/test/benchmarkCases/context-esm/webpack.config.js b/test/benchmarkCases/context-esm/webpack.config.js index 4c111be6a97..618e121cccd 100644 --- a/test/benchmarkCases/context-esm/webpack.config.js +++ b/test/benchmarkCases/context-esm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index" diff --git a/test/benchmarkCases/devtool-eval-source-map/webpack.config.js b/test/benchmarkCases/devtool-eval-source-map/webpack.config.js index 7c2042e3c95..e99f3af724a 100644 --- a/test/benchmarkCases/devtool-eval-source-map/webpack.config.js +++ b/test/benchmarkCases/devtool-eval-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/benchmarkCases/devtool-eval/webpack.config.js b/test/benchmarkCases/devtool-eval/webpack.config.js index 3f99d3bfc1b..2f4884315dd 100644 --- a/test/benchmarkCases/devtool-eval/webpack.config.js +++ b/test/benchmarkCases/devtool-eval/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/benchmarkCases/devtool-source-map/webpack.config.js b/test/benchmarkCases/devtool-source-map/webpack.config.js index eb6058c894f..560741f98a4 100644 --- a/test/benchmarkCases/devtool-source-map/webpack.config.js +++ b/test/benchmarkCases/devtool-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/benchmarkCases/future-defaults/webpack.config.js b/test/benchmarkCases/future-defaults/webpack.config.js index 77b0a2329a9..d80cbf11c7e 100644 --- a/test/benchmarkCases/future-defaults/webpack.config.js +++ b/test/benchmarkCases/future-defaults/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/benchmarkCases/lodash/webpack.config.js b/test/benchmarkCases/lodash/webpack.config.js index 4c111be6a97..618e121cccd 100644 --- a/test/benchmarkCases/lodash/webpack.config.js +++ b/test/benchmarkCases/lodash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index" diff --git a/test/benchmarkCases/many-chunks-commonjs/webpack.config.js b/test/benchmarkCases/many-chunks-commonjs/webpack.config.js index 4c111be6a97..618e121cccd 100644 --- a/test/benchmarkCases/many-chunks-commonjs/webpack.config.js +++ b/test/benchmarkCases/many-chunks-commonjs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index" diff --git a/test/benchmarkCases/many-chunks-esm/webpack.config.js b/test/benchmarkCases/many-chunks-esm/webpack.config.js index 4c111be6a97..618e121cccd 100644 --- a/test/benchmarkCases/many-chunks-esm/webpack.config.js +++ b/test/benchmarkCases/many-chunks-esm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index" diff --git a/test/benchmarkCases/many-modules-commonjs/webpack.config.js b/test/benchmarkCases/many-modules-commonjs/webpack.config.js index 4c111be6a97..618e121cccd 100644 --- a/test/benchmarkCases/many-modules-commonjs/webpack.config.js +++ b/test/benchmarkCases/many-modules-commonjs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index" diff --git a/test/benchmarkCases/many-modules-esm/webpack.config.js b/test/benchmarkCases/many-modules-esm/webpack.config.js index 4c111be6a97..618e121cccd 100644 --- a/test/benchmarkCases/many-modules-esm/webpack.config.js +++ b/test/benchmarkCases/many-modules-esm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index" diff --git a/test/benchmarkCases/md4-and-xxhash64-unit/index.bench.mjs b/test/benchmarkCases/md4-and-xxhash64-unit/index.bench.mjs deleted file mode 100644 index 3a7da1296dd..00000000000 --- a/test/benchmarkCases/md4-and-xxhash64-unit/index.bench.mjs +++ /dev/null @@ -1,62 +0,0 @@ -import crypto from "crypto"; -import createHash from "../../../lib/util/createHash.js"; - -function factoryXxhash64(longString) { - return function xxhash64String() { - const hash = createHash("xxhash64"); - hash.update(longString); - return hash.digest("hex"); - }; -} - -function factoryMd4(longString) { - return function md4String() { - const hash = createHash("md4"); - hash.update(longString); - return hash.digest("hex"); - }; -} - -export default function xxhash64AndMd4Benchmarks(suite) { - for (const size of [ - 1, 10, 20, 40, 60, 80, 100, 200, 400, 1000, 1001, 5000, 8183, 8184, 8185, - 10000, 20000, 32768, 32769, 50000, 100000, 200000 - ]) { - const longString = crypto.randomBytes(size).toString("hex"); - const subName1 = `string benchmark (length: ${longString.length})`; - - const fn1 = factoryXxhash64(longString); - const fn2 = factoryMd4(longString); - - suite.add(`xxhash64 ${subName1}`, fn1, { - beforeAll() { - this.collectBy = subName1; - } - }); - - suite.add(`md4 ${subName1}`, fn2, { - beforeAll() { - this.collectBy = subName1; - } - }); - - const bufferSize = size * 2; - const buffer = crypto.randomBytes(bufferSize); - const subName2 = `buffer benchmark (size: ${bufferSize})`; - - const fn3 = factoryXxhash64(buffer); - const fn4 = factoryMd4(buffer); - - suite.add(`xxhash64 ${subName2}`, fn3, { - beforeAll() { - this.collectBy = subName2; - } - }); - - suite.add(`md4 ${subName2}`, fn4, { - beforeAll() { - this.collectBy = subName2; - } - }); - } -} diff --git a/test/benchmarkCases/minimal/index.js b/test/benchmarkCases/minimal/index.js deleted file mode 100644 index b179ee95347..00000000000 --- a/test/benchmarkCases/minimal/index.js +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello world"); diff --git a/test/benchmarkCases/minimal/webpack.config.js b/test/benchmarkCases/minimal/webpack.config.js deleted file mode 100644 index 4c111be6a97..00000000000 --- a/test/benchmarkCases/minimal/webpack.config.js +++ /dev/null @@ -1,4 +0,0 @@ -/** @type {import("../../../").Configuration} */ -module.exports = { - entry: "./index" -}; diff --git a/test/benchmarkCases/react/webpack.config.js b/test/benchmarkCases/react/webpack.config.js index 4c111be6a97..618e121cccd 100644 --- a/test/benchmarkCases/react/webpack.config.js +++ b/test/benchmarkCases/react/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index" diff --git a/test/benchmarkCases/three-long/webpack.config.js b/test/benchmarkCases/three-long/webpack.config.js index 4c111be6a97..618e121cccd 100644 --- a/test/benchmarkCases/three-long/webpack.config.js +++ b/test/benchmarkCases/three-long/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index" diff --git a/test/benchmarkCases/typescript-long-on-schedule/webpack.config.js b/test/benchmarkCases/typescript-long-on-schedule/webpack.config.js index 9c5de9f777b..b00e71f5681 100644 --- a/test/benchmarkCases/typescript-long-on-schedule/webpack.config.js +++ b/test/benchmarkCases/typescript-long-on-schedule/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/cases/async-modules/micro-ticks-parents/test.filter.js b/test/cases/async-modules/micro-ticks-parents/test.filter.js index c27a08c369b..cf14b5a6812 100644 --- a/test/cases/async-modules/micro-ticks-parents/test.filter.js +++ b/test/cases/async-modules/micro-ticks-parents/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = () => // In node 10 v8 has a bug which inserts an additional micro-tick into async functions !process.version.startsWith("v10."); diff --git a/test/cases/chunks/destructuring-assignment/test.filter.js b/test/cases/chunks/destructuring-assignment/test.filter.js index 5619e2881a1..a8a402b15cf 100644 --- a/test/cases/chunks/destructuring-assignment/test.filter.js +++ b/test/cases/chunks/destructuring-assignment/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function filter(config) { // This test can't run in development mode return config.mode !== "development"; diff --git a/test/cases/chunks/destructuring-assignment/warnings.js b/test/cases/chunks/destructuring-assignment/warnings.js index f2a8d6f3837..08df36bcb9c 100644 --- a/test/cases/chunks/destructuring-assignment/warnings.js +++ b/test/cases/chunks/destructuring-assignment/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/`webpackExports` could not be used with destructuring assignment./] ]; diff --git a/test/cases/chunks/runtime/test.filter.js b/test/cases/chunks/runtime/test.filter.js index 9e95c3af542..1a40a4d9363 100644 --- a/test/cases/chunks/runtime/test.filter.js +++ b/test/cases/chunks/runtime/test.filter.js @@ -1,3 +1,5 @@ -module.exports = config => +"use strict"; + +module.exports = (config) => // This test can't run in development mode as it depends on the flagIncludedChunks optimization config.mode !== "development"; diff --git a/test/cases/chunks/runtime/webpack.config.js b/test/cases/chunks/runtime/webpack.config.js index eef5638fa54..3f5135038e2 100644 --- a/test/cases/chunks/runtime/webpack.config.js +++ b/test/cases/chunks/runtime/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { moduleIds: "named" diff --git a/test/cases/chunks/weird-reference-to-entry/errors.js b/test/cases/chunks/weird-reference-to-entry/errors.js index 0eda0fbec8e..fe646e641e2 100644 --- a/test/cases/chunks/weird-reference-to-entry/errors.js +++ b/test/cases/chunks/weird-reference-to-entry/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /It's not allowed to load an initial chunk on demand\. The chunk name "main" is already used by an entrypoint\./ diff --git a/test/cases/cjs-interop/non-existing-export/warnings.js b/test/cases/cjs-interop/non-existing-export/warnings.js index 1ecb811bf56..8ec92c8bc2e 100644 --- a/test/cases/cjs-interop/non-existing-export/warnings.js +++ b/test/cases/cjs-interop/non-existing-export/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /export 'named' \(imported as 'named'\) was not found in '\.\/module' \(possible exports: default\)/ diff --git a/test/cases/cjs-tree-shaking/mutate/warnings.js b/test/cases/cjs-tree-shaking/mutate/warnings.js index f875533c7eb..f949f2cd34a 100644 --- a/test/cases/cjs-tree-shaking/mutate/warnings.js +++ b/test/cases/cjs-tree-shaking/mutate/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/export 'a' \(imported as 'a'\) was not found/], [/export 'a' \(imported as 'a'\) was not found/] diff --git a/test/cases/compile/error-hide-stack/errors.js b/test/cases/compile/error-hide-stack/errors.js index 6d8bf4df7a7..58fc17ed518 100644 --- a/test/cases/compile/error-hide-stack/errors.js +++ b/test/cases/compile/error-hide-stack/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Module build failed( \(from [^)]+\))?:\nMessage/, { details: /Stack/ }] ]; diff --git a/test/cases/compile/error-hide-stack/infrastructure-log.js b/test/cases/compile/error-hide-stack/infrastructure-log.js index 83685aa57b3..a75f53fc0c0 100644 --- a/test/cases/compile/error-hide-stack/infrastructure-log.js +++ b/test/cases/compile/error-hide-stack/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /^Pack got invalid because of write to: Compilation\/modules.+loader\.js!$/ ]; diff --git a/test/cases/context/issue-5750/warnings.js b/test/cases/context/issue-5750/warnings.js index 957d94c627f..6ac56f3ca4d 100644 --- a/test/cases/context/issue-5750/warnings.js +++ b/test/cases/context/issue-5750/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags/] ]; diff --git a/test/cases/errors/case-sensitive/test.filter.js b/test/cases/errors/case-sensitive/test.filter.js index 1960f956b48..70256c4b1a0 100644 --- a/test/cases/errors/case-sensitive/test.filter.js +++ b/test/cases/errors/case-sensitive/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/test/cases/errors/case-sensitive/warnings.js b/test/cases/errors/case-sensitive/warnings.js index 1a2c38230f1..f8bdfa9a04a 100644 --- a/test/cases/errors/case-sensitive/warnings.js +++ b/test/cases/errors/case-sensitive/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /There are multiple modules with names that only differ in casing/, diff --git a/test/cases/errors/crash-missing-import/errors.js b/test/cases/errors/crash-missing-import/errors.js index d85236a2c74..3c4e17e881e 100644 --- a/test/cases/errors/crash-missing-import/errors.js +++ b/test/cases/errors/crash-missing-import/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Module not found/]]; diff --git a/test/cases/errors/harmony-import-missing/errors.js b/test/cases/errors/harmony-import-missing/errors.js index baab751255d..d788c598c7c 100644 --- a/test/cases/errors/harmony-import-missing/errors.js +++ b/test/cases/errors/harmony-import-missing/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Can't resolve '.\/missing'/]]; diff --git a/test/cases/errors/harmony-import-missing2/errors.js b/test/cases/errors/harmony-import-missing2/errors.js index 67d1f2321a3..bfc02f03a00 100644 --- a/test/cases/errors/harmony-import-missing2/errors.js +++ b/test/cases/errors/harmony-import-missing2/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Can't resolve '.\/missing1'/], [/Can't resolve '.\/missing2'/] diff --git a/test/cases/errors/load-module-error/errors.js b/test/cases/errors/load-module-error/errors.js index ce88c1bc32e..fd52cf72f99 100644 --- a/test/cases/errors/load-module-error/errors.js +++ b/test/cases/errors/load-module-error/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/err: abc/], [/The loaded module contains errors/]]; diff --git a/test/cases/errors/load-module-error/infrastructure-log.js b/test/cases/errors/load-module-error/infrastructure-log.js index 236f5a502ab..113d661ee6e 100644 --- a/test/cases/errors/load-module-error/infrastructure-log.js +++ b/test/cases/errors/load-module-error/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /^Pack got invalid because of write to: Compilation\/modules|json.+error-loader\.js!/ ]; diff --git a/test/cases/errors/loader-error-warning/errors.js b/test/cases/errors/loader-error-warning/errors.js index 16bfd86a57f..e663795d022 100644 --- a/test/cases/errors/loader-error-warning/errors.js +++ b/test/cases/errors/loader-error-warning/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/abc/, /Emitted value instead of an instance of Error/, /error-loader\.js/], [/def/, /Emitted value instead of an instance of Error/, /error-loader\.js/] diff --git a/test/cases/errors/loader-error-warning/warnings.js b/test/cases/errors/loader-error-warning/warnings.js index c776962fc05..7000d83e574 100644 --- a/test/cases/errors/loader-error-warning/warnings.js +++ b/test/cases/errors/loader-error-warning/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/xyz/, /Emitted value instead of an instance of Error/, /warning-loader\.js/] ]; diff --git a/test/cases/errors/mjs-non-fully-specified/errors.js b/test/cases/errors/mjs-non-fully-specified/errors.js index 48dc51c9f63..a4d29e32fff 100644 --- a/test/cases/errors/mjs-non-fully-specified/errors.js +++ b/test/cases/errors/mjs-non-fully-specified/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Can't resolve '.\/dependency'/, /Did you mean 'dependency\.js'\?/] ]; diff --git a/test/cases/errors/module-request/errors.js b/test/cases/errors/module-request/errors.js index 3a9f5a9a1dd..fd6ee7fe342 100644 --- a/test/cases/errors/module-request/errors.js +++ b/test/cases/errors/module-request/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Can't resolve 'dependency\.js'/, /Did you mean '\.\/dependency\.js'\?/] ]; diff --git a/test/cases/esm/import-meta/test.filter.js b/test/cases/esm/import-meta/test.filter.js index 3f0358f64f9..7b29ebe0054 100644 --- a/test/cases/esm/import-meta/test.filter.js +++ b/test/cases/esm/import-meta/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsRequireInModule = require("../../../helpers/supportsRequireInModule"); -module.exports = config => !config.module || supportsRequireInModule(); +module.exports = (config) => !config.module || supportsRequireInModule(); diff --git a/test/cases/esm/import-meta/warnings.js b/test/cases/esm/import-meta/warnings.js index d8fc384d81d..8b21f023680 100644 --- a/test/cases/esm/import-meta/warnings.js +++ b/test/cases/esm/import-meta/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Accessing import.meta directly is unsupported \(only property access or destructuring is supported\)/ diff --git a/test/cases/inner-graph/class-dynamic-props/test.filter.js b/test/cases/inner-graph/class-dynamic-props/test.filter.js index 138d995647f..aa94ec7b474 100644 --- a/test/cases/inner-graph/class-dynamic-props/test.filter.js +++ b/test/cases/inner-graph/class-dynamic-props/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsClassFields = require("../../../helpers/supportsClassFields"); module.exports = () => supportsClassFields(); diff --git a/test/cases/inner-graph/extend-class/test.filter.js b/test/cases/inner-graph/extend-class/test.filter.js index 23b06ffb2ff..ac4f784e281 100644 --- a/test/cases/inner-graph/extend-class/test.filter.js +++ b/test/cases/inner-graph/extend-class/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsClassStaticBlock = require("../../../helpers/supportsClassStaticBlock"); module.exports = () => supportsClassStaticBlock(); diff --git a/test/cases/inner-graph/extend-class2/test.filter.js b/test/cases/inner-graph/extend-class2/test.filter.js index 23b06ffb2ff..ac4f784e281 100644 --- a/test/cases/inner-graph/extend-class2/test.filter.js +++ b/test/cases/inner-graph/extend-class2/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsClassStaticBlock = require("../../../helpers/supportsClassStaticBlock"); module.exports = () => supportsClassStaticBlock(); diff --git a/test/cases/json/import-assertions-type-json/errors.js b/test/cases/json/import-assertions-type-json/errors.js index c5c7bd571c6..8bf7e660d0e 100644 --- a/test/cases/json/import-assertions-type-json/errors.js +++ b/test/cases/json/import-assertions-type-json/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [{ moduleName: /data.poison/, message: /Unexpected token .+ JSON/ }] ]; diff --git a/test/cases/json/import-assertions-type-json/infrastructure-log.js b/test/cases/json/import-assertions-type-json/infrastructure-log.js index 17279bf2b81..a1b07c6fd36 100644 --- a/test/cases/json/import-assertions-type-json/infrastructure-log.js +++ b/test/cases/json/import-assertions-type-json/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /^Pack got invalid because of write to: Compilation\/modules|json.+json\/data\/poison$/ ]; diff --git a/test/cases/json/import-by-name-with-concatenation/warnings.js b/test/cases/json/import-by-name-with-concatenation/warnings.js index 82fc687d927..5abf78d3ffb 100644 --- a/test/cases/json/import-by-name-with-concatenation/warnings.js +++ b/test/cases/json/import-by-name-with-concatenation/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Should not import the named export '2' \(imported as 'c'\) from default-exporting module \(only default export is available soon\)/ diff --git a/test/cases/json/import-by-name/warnings.js b/test/cases/json/import-by-name/warnings.js index 82fc687d927..5abf78d3ffb 100644 --- a/test/cases/json/import-by-name/warnings.js +++ b/test/cases/json/import-by-name/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Should not import the named export '2' \(imported as 'c'\) from default-exporting module \(only default export is available soon\)/ diff --git a/test/cases/json/import-with-type-json/errors.js b/test/cases/json/import-with-type-json/errors.js index c5c7bd571c6..8bf7e660d0e 100644 --- a/test/cases/json/import-with-type-json/errors.js +++ b/test/cases/json/import-with-type-json/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [{ moduleName: /data.poison/, message: /Unexpected token .+ JSON/ }] ]; diff --git a/test/cases/json/import-with-type-json/infrastructure-log.js b/test/cases/json/import-with-type-json/infrastructure-log.js index 17279bf2b81..a1b07c6fd36 100644 --- a/test/cases/json/import-with-type-json/infrastructure-log.js +++ b/test/cases/json/import-with-type-json/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /^Pack got invalid because of write to: Compilation\/modules|json.+json\/data\/poison$/ ]; diff --git a/test/cases/json/reexport/warnings.js b/test/cases/json/reexport/warnings.js index c9990f3c988..68c9dce3d2b 100644 --- a/test/cases/json/reexport/warnings.js +++ b/test/cases/json/reexport/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Should not import the named export 'named' \(reexported as 'fNamed'\) from default-exporting module \(only default export is available soon\)/ diff --git a/test/cases/large/big-assets/test.config.js b/test/cases/large/big-assets/test.config.js index 7ab4fa5eeff..a216fc58b73 100644 --- a/test/cases/large/big-assets/test.config.js +++ b/test/cases/large/big-assets/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { timeout: 120000 }; diff --git a/test/cases/large/big-assets/test.filter.js b/test/cases/large/big-assets/test.filter.js index 1338bc1e7b5..f1925767d11 100644 --- a/test/cases/large/big-assets/test.filter.js +++ b/test/cases/large/big-assets/test.filter.js @@ -1 +1,3 @@ +"use strict"; + module.exports = () => !process.env.CI; diff --git a/test/cases/large/many-replacements/test.config.js b/test/cases/large/many-replacements/test.config.js index 7ab4fa5eeff..a216fc58b73 100644 --- a/test/cases/large/many-replacements/test.config.js +++ b/test/cases/large/many-replacements/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { timeout: 120000 }; diff --git a/test/cases/large/many-replacements/test.filter.js b/test/cases/large/many-replacements/test.filter.js index 1338bc1e7b5..f1925767d11 100644 --- a/test/cases/large/many-replacements/test.filter.js +++ b/test/cases/large/many-replacements/test.filter.js @@ -1 +1,3 @@ +"use strict"; + module.exports = () => !process.env.CI; diff --git a/test/cases/loaders/_esm-loader-type/test.filter.js b/test/cases/loaders/_esm-loader-type/test.filter.js index 294c39f26f3..9092dfaef56 100644 --- a/test/cases/loaders/_esm-loader-type/test.filter.js +++ b/test/cases/loaders/_esm-loader-type/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = () => // TODO need fix in v8 https://github.com/nodejs/node/issues/35889 // TODO otherwise this test case cause segment fault diff --git a/test/cases/loaders/context/test.filter.js b/test/cases/loaders/context/test.filter.js index 3f0358f64f9..7b29ebe0054 100644 --- a/test/cases/loaders/context/test.filter.js +++ b/test/cases/loaders/context/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsRequireInModule = require("../../../helpers/supportsRequireInModule"); -module.exports = config => !config.module || supportsRequireInModule(); +module.exports = (config) => !config.module || supportsRequireInModule(); diff --git a/test/cases/loaders/emit-file/test.filter.js b/test/cases/loaders/emit-file/test.filter.js index e5009984cdb..49d755d43bb 100644 --- a/test/cases/loaders/emit-file/test.filter.js +++ b/test/cases/loaders/emit-file/test.filter.js @@ -1 +1,3 @@ -module.exports = config => !config.module; +"use strict"; + +module.exports = (config) => !config.module; diff --git a/test/cases/loaders/import-module/test.filter.js b/test/cases/loaders/import-module/test.filter.js index e5009984cdb..49d755d43bb 100644 --- a/test/cases/loaders/import-module/test.filter.js +++ b/test/cases/loaders/import-module/test.filter.js @@ -1 +1,3 @@ -module.exports = config => !config.module; +"use strict"; + +module.exports = (config) => !config.module; diff --git a/test/cases/loaders/no-string/errors.js b/test/cases/loaders/no-string/errors.js index 79aef6533f4..c00f47dcf5c 100644 --- a/test/cases/loaders/no-string/errors.js +++ b/test/cases/loaders/no-string/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ { diff --git a/test/cases/loaders/no-string/infrastructure-log.js b/test/cases/loaders/no-string/infrastructure-log.js index af316e72467..dd0f18a4ecd 100644 --- a/test/cases/loaders/no-string/infrastructure-log.js +++ b/test/cases/loaders/no-string/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /^Pack got invalid because of write to: Compilation\/modules.+no-string[/\\]loader\.js!.+no-string[/\\]file\.js$/ ]; diff --git a/test/cases/loaders/pug-loader/test.filter.js b/test/cases/loaders/pug-loader/test.filter.js index 3f0358f64f9..7b29ebe0054 100644 --- a/test/cases/loaders/pug-loader/test.filter.js +++ b/test/cases/loaders/pug-loader/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsRequireInModule = require("../../../helpers/supportsRequireInModule"); -module.exports = config => !config.module || supportsRequireInModule(); +module.exports = (config) => !config.module || supportsRequireInModule(); diff --git a/test/cases/mjs/non-enumerable/errors.js b/test/cases/mjs/non-enumerable/errors.js index 95a95c2df13..cf0578b529a 100644 --- a/test/cases/mjs/non-enumerable/errors.js +++ b/test/cases/mjs/non-enumerable/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /export '__esModule' \(imported as 'm1'\) was not found in '\.\/analyzable-module\.js'/ diff --git a/test/cases/mjs/non-enumerable/warnings.js b/test/cases/mjs/non-enumerable/warnings.js index d2ed9734d9d..89e5ccf47f7 100644 --- a/test/cases/mjs/non-enumerable/warnings.js +++ b/test/cases/mjs/non-enumerable/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /export '__esModule' \(imported as 'm1'\) was not found in '\.\/analyzable-module\.js'/ diff --git a/test/cases/optimize/side-effects-all-chain-unused/test.filter.js b/test/cases/optimize/side-effects-all-chain-unused/test.filter.js index 2d8fc7eb308..f6354eef95e 100644 --- a/test/cases/optimize/side-effects-all-chain-unused/test.filter.js +++ b/test/cases/optimize/side-effects-all-chain-unused/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.mode !== "development"; +"use strict"; + +module.exports = (config) => config.mode !== "development"; diff --git a/test/cases/optimize/side-effects-all-used/test.filter.js b/test/cases/optimize/side-effects-all-used/test.filter.js index 2d8fc7eb308..f6354eef95e 100644 --- a/test/cases/optimize/side-effects-all-used/test.filter.js +++ b/test/cases/optimize/side-effects-all-used/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.mode !== "development"; +"use strict"; + +module.exports = (config) => config.mode !== "development"; diff --git a/test/cases/optimize/side-effects-immediate-unused/test.filter.js b/test/cases/optimize/side-effects-immediate-unused/test.filter.js index 2d8fc7eb308..f6354eef95e 100644 --- a/test/cases/optimize/side-effects-immediate-unused/test.filter.js +++ b/test/cases/optimize/side-effects-immediate-unused/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.mode !== "development"; +"use strict"; + +module.exports = (config) => config.mode !== "development"; diff --git a/test/cases/optimize/side-effects-reexport-start-unknown/test.filter.js b/test/cases/optimize/side-effects-reexport-start-unknown/test.filter.js index 2d8fc7eb308..f6354eef95e 100644 --- a/test/cases/optimize/side-effects-reexport-start-unknown/test.filter.js +++ b/test/cases/optimize/side-effects-reexport-start-unknown/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.mode !== "development"; +"use strict"; + +module.exports = (config) => config.mode !== "development"; diff --git a/test/cases/optimize/side-effects-root-unused/test.filter.js b/test/cases/optimize/side-effects-root-unused/test.filter.js index 2d8fc7eb308..f6354eef95e 100644 --- a/test/cases/optimize/side-effects-root-unused/test.filter.js +++ b/test/cases/optimize/side-effects-root-unused/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.mode !== "development"; +"use strict"; + +module.exports = (config) => config.mode !== "development"; diff --git a/test/cases/optimize/side-effects-simple-unused/test.filter.js b/test/cases/optimize/side-effects-simple-unused/test.filter.js index 2d8fc7eb308..f6354eef95e 100644 --- a/test/cases/optimize/side-effects-simple-unused/test.filter.js +++ b/test/cases/optimize/side-effects-simple-unused/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.mode !== "development"; +"use strict"; + +module.exports = (config) => config.mode !== "development"; diff --git a/test/cases/optimize/side-effects-transitive-unused/test.filter.js b/test/cases/optimize/side-effects-transitive-unused/test.filter.js index 2d8fc7eb308..f6354eef95e 100644 --- a/test/cases/optimize/side-effects-transitive-unused/test.filter.js +++ b/test/cases/optimize/side-effects-transitive-unused/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.mode !== "development"; +"use strict"; + +module.exports = (config) => config.mode !== "development"; diff --git a/test/cases/parsing/asi/warnings.js b/test/cases/parsing/asi/warnings.js index 39b26d59cff..2f82ab9e45e 100644 --- a/test/cases/parsing/asi/warnings.js +++ b/test/cases/parsing/asi/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Critical dependency: Accessing import\.meta/]]; diff --git a/test/cases/parsing/chunks/test.filter.js b/test/cases/parsing/chunks/test.filter.js index a5052b0500b..e6814dfde4b 100644 --- a/test/cases/parsing/chunks/test.filter.js +++ b/test/cases/parsing/chunks/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsES6 = require("../../../helpers/supportsES6"); module.exports = () => supportsES6(); diff --git a/test/cases/parsing/class-properties/test.filter.js b/test/cases/parsing/class-properties/test.filter.js index 138d995647f..aa94ec7b474 100644 --- a/test/cases/parsing/class-properties/test.filter.js +++ b/test/cases/parsing/class-properties/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsClassFields = require("../../../helpers/supportsClassFields"); module.exports = () => supportsClassFields(); diff --git a/test/cases/parsing/class/test.filter.js b/test/cases/parsing/class/test.filter.js index a5052b0500b..e6814dfde4b 100644 --- a/test/cases/parsing/class/test.filter.js +++ b/test/cases/parsing/class/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsES6 = require("../../../helpers/supportsES6"); module.exports = () => supportsES6(); diff --git a/test/cases/parsing/complex-require/test.filter.js b/test/cases/parsing/complex-require/test.filter.js index 6a3c5ad04bd..94ce548e857 100644 --- a/test/cases/parsing/complex-require/test.filter.js +++ b/test/cases/parsing/complex-require/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsTemplateStrings = require("../../../helpers/supportsTemplateStrings"); module.exports = () => supportsTemplateStrings(); diff --git a/test/cases/parsing/context/errors.js b/test/cases/parsing/context/errors.js index ab18d4d5490..779f16992ad 100644 --- a/test/cases/parsing/context/errors.js +++ b/test/cases/parsing/context/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Module parse failed/, diff --git a/test/cases/parsing/context/infrastructure-log.js b/test/cases/parsing/context/infrastructure-log.js index e458f85280b..fe6c3fa6e94 100644 --- a/test/cases/parsing/context/infrastructure-log.js +++ b/test/cases/parsing/context/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /^Pack got invalid because of write to: Compilation\/modules|.+dump-file\.txt/ ]; diff --git a/test/cases/parsing/context/templates/templateLoader.js b/test/cases/parsing/context/templates/templateLoader.js index e2b1e898947..e541d7ec4e4 100644 --- a/test/cases/parsing/context/templates/templateLoader.js +++ b/test/cases/parsing/context/templates/templateLoader.js @@ -1,3 +1,6 @@ +/** + * @param {string} name + */ module.exports = function(name) { return require(name); } \ No newline at end of file diff --git a/test/cases/parsing/context/templates/templateLoaderIndirect.js b/test/cases/parsing/context/templates/templateLoaderIndirect.js index 89035fe1744..c7753680c55 100644 --- a/test/cases/parsing/context/templates/templateLoaderIndirect.js +++ b/test/cases/parsing/context/templates/templateLoaderIndirect.js @@ -1,3 +1,6 @@ +/** + * @param {string} name + */ module.exports = function(name) { var a = load(require, name); var r = require; @@ -6,6 +9,10 @@ module.exports = function(name) { return a; } +/** + * @param {Function} requireFunction + * @param {string} name + */ function load(requireFunction, name) { return requireFunction(name); } \ No newline at end of file diff --git a/test/cases/parsing/context/warnings.js b/test/cases/parsing/context/warnings.js index 695381d6862..e1f4aff31fa 100644 --- a/test/cases/parsing/context/warnings.js +++ b/test/cases/parsing/context/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Critical dependency/, { moduleName: /templateLoader\.js/ }], [/Critical dependency/, { moduleName: /templateLoaderIndirect\.js/ }], diff --git a/test/cases/parsing/es2020/test.filter.js b/test/cases/parsing/es2020/test.filter.js index 138d995647f..aa94ec7b474 100644 --- a/test/cases/parsing/es2020/test.filter.js +++ b/test/cases/parsing/es2020/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsClassFields = require("../../../helpers/supportsClassFields"); module.exports = () => supportsClassFields(); diff --git a/test/cases/parsing/es2022/test.filter.js b/test/cases/parsing/es2022/test.filter.js index ec8c61db6f9..1f02b2ab28d 100644 --- a/test/cases/parsing/es2022/test.filter.js +++ b/test/cases/parsing/es2022/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function (config) { try { eval("class A { static {} }"); diff --git a/test/cases/parsing/es6.nominimize/test.filter.js b/test/cases/parsing/es6.nominimize/test.filter.js index 7d7636a7748..5de30080464 100644 --- a/test/cases/parsing/es6.nominimize/test.filter.js +++ b/test/cases/parsing/es6.nominimize/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + var supportsES6 = require("../../../helpers/supportsES6"); module.exports = function (config) { diff --git a/test/cases/parsing/evaluate-nullish/test.filter.js b/test/cases/parsing/evaluate-nullish/test.filter.js index e1c1a296cd2..31fd9b925b1 100644 --- a/test/cases/parsing/evaluate-nullish/test.filter.js +++ b/test/cases/parsing/evaluate-nullish/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsNullishCoalescing = require("../../../helpers/supportsNullishCoalescing"); module.exports = () => supportsNullishCoalescing(); diff --git a/test/cases/parsing/extract-amd.nominimize/test.filter.js b/test/cases/parsing/extract-amd.nominimize/test.filter.js index 7d7636a7748..5de30080464 100644 --- a/test/cases/parsing/extract-amd.nominimize/test.filter.js +++ b/test/cases/parsing/extract-amd.nominimize/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + var supportsES6 = require("../../../helpers/supportsES6"); module.exports = function (config) { diff --git a/test/cases/parsing/extract-amd.nominimize/warnings.js b/test/cases/parsing/extract-amd.nominimize/warnings.js index aa20932a1d3..b67ffb5ff18 100644 --- a/test/cases/parsing/extract-amd.nominimize/warnings.js +++ b/test/cases/parsing/extract-amd.nominimize/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Module not found/, /Can't resolve '\.\/b' /, {details: /b\.js/}] ]; diff --git a/test/cases/parsing/extract-amd/warnings.js b/test/cases/parsing/extract-amd/warnings.js index 418492a70f6..f70e442d1b0 100644 --- a/test/cases/parsing/extract-amd/warnings.js +++ b/test/cases/parsing/extract-amd/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Module not found/, /Can't resolve '\.\/b' /, { details: /b\.js/ }] ]; diff --git a/test/cases/parsing/extract-require/errors.js b/test/cases/parsing/extract-require/errors.js index cb2596c1104..ce8b052316b 100644 --- a/test/cases/parsing/extract-require/errors.js +++ b/test/cases/parsing/extract-require/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Module not found/, diff --git a/test/cases/parsing/harmony-destructuring-assignment/test.filter.js b/test/cases/parsing/harmony-destructuring-assignment/test.filter.js index 1c043701ad1..ed0f0aa0f66 100644 --- a/test/cases/parsing/harmony-destructuring-assignment/test.filter.js +++ b/test/cases/parsing/harmony-destructuring-assignment/test.filter.js @@ -1,3 +1,5 @@ -module.exports = config => +"use strict"; + +module.exports = (config) => // This test can't run in development mode config.mode !== "development"; diff --git a/test/cases/parsing/harmony-duplicate-export/warnings.js b/test/cases/parsing/harmony-duplicate-export/warnings.js index c8d978d536e..912106db547 100644 --- a/test/cases/parsing/harmony-duplicate-export/warnings.js +++ b/test/cases/parsing/harmony-duplicate-export/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/name 'x'/, /\.\/a\?3/, /\.\/b\?3/], [/name 'x'/, /\.\/a\?4/, /\.\/b\?4/], diff --git a/test/cases/parsing/harmony-export-precedence/warnings.js b/test/cases/parsing/harmony-export-precedence/warnings.js index af730a435fd..f7b6b69e37d 100644 --- a/test/cases/parsing/harmony-export-precedence/warnings.js +++ b/test/cases/parsing/harmony-export-precedence/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /export 'default' \(imported as 'defaultImport'\) was not found in '.\/a' \(possible exports: a, b, c, d, e, f\)/ diff --git a/test/cases/parsing/harmony-info/warnings.js b/test/cases/parsing/harmony-info/warnings.js index d1b24b0fb83..c2a06f603b3 100644 --- a/test/cases/parsing/harmony-info/warnings.js +++ b/test/cases/parsing/harmony-info/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /export 'default' \(imported as 'def'\) was not found in '\.\/module' \(possible exports: b, c, d\)/ diff --git a/test/cases/parsing/harmony-star-conflict/warnings.js b/test/cases/parsing/harmony-star-conflict/warnings.js index 04bf49cc89e..d9609338477 100644 --- a/test/cases/parsing/harmony-star-conflict/warnings.js +++ b/test/cases/parsing/harmony-star-conflict/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /conflicting star exports/, diff --git a/test/cases/parsing/harmony-tdz/test.filter.js b/test/cases/parsing/harmony-tdz/test.filter.js index 2781bd3aca3..c814a32de48 100644 --- a/test/cases/parsing/harmony-tdz/test.filter.js +++ b/test/cases/parsing/harmony-tdz/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsBlockScoping = require("../../../helpers/supportsBlockScoping"); module.exports = () => supportsBlockScoping(); diff --git a/test/cases/parsing/iife/test.filter.js b/test/cases/parsing/iife/test.filter.js index a05dab2a42b..28f2f5414c9 100644 --- a/test/cases/parsing/iife/test.filter.js +++ b/test/cases/parsing/iife/test.filter.js @@ -1,3 +1,5 @@ -module.exports = config => +"use strict"; + +module.exports = (config) => // TODO fails due to minimizer bug: https://github.com/terser/terser/issues/880 !config.minimize; diff --git a/test/cases/parsing/issue-16763/test.filter.js b/test/cases/parsing/issue-16763/test.filter.js index 23b06ffb2ff..ac4f784e281 100644 --- a/test/cases/parsing/issue-16763/test.filter.js +++ b/test/cases/parsing/issue-16763/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsClassStaticBlock = require("../../../helpers/supportsClassStaticBlock"); module.exports = () => supportsClassStaticBlock(); diff --git a/test/cases/parsing/issue-2006/errors.js b/test/cases/parsing/issue-2006/errors.js index 2b82b710bf3..5d92e84e2c0 100644 --- a/test/cases/parsing/issue-2006/errors.js +++ b/test/cases/parsing/issue-2006/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Empty dependency/]]; diff --git a/test/cases/parsing/issue-2522/test.filter.js b/test/cases/parsing/issue-2522/test.filter.js index a5052b0500b..e6814dfde4b 100644 --- a/test/cases/parsing/issue-2522/test.filter.js +++ b/test/cases/parsing/issue-2522/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsES6 = require("../../../helpers/supportsES6"); module.exports = () => supportsES6(); diff --git a/test/cases/parsing/issue-2523/test.filter.js b/test/cases/parsing/issue-2523/test.filter.js index a5052b0500b..e6814dfde4b 100644 --- a/test/cases/parsing/issue-2523/test.filter.js +++ b/test/cases/parsing/issue-2523/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsES6 = require("../../../helpers/supportsES6"); module.exports = () => supportsES6(); diff --git a/test/cases/parsing/issue-2600/errors.js b/test/cases/parsing/issue-2600/errors.js index 9cd234c7331..84a3e56f402 100644 --- a/test/cases/parsing/issue-2600/errors.js +++ b/test/cases/parsing/issue-2600/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Can't resolve 'missing'/]]; diff --git a/test/cases/parsing/issue-2618/test.filter.js b/test/cases/parsing/issue-2618/test.filter.js index a5052b0500b..e6814dfde4b 100644 --- a/test/cases/parsing/issue-2618/test.filter.js +++ b/test/cases/parsing/issue-2618/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsES6 = require("../../../helpers/supportsES6"); module.exports = () => supportsES6(); diff --git a/test/cases/parsing/issue-2622/test.filter.js b/test/cases/parsing/issue-2622/test.filter.js index c7920056f0a..c149008f996 100644 --- a/test/cases/parsing/issue-2622/test.filter.js +++ b/test/cases/parsing/issue-2622/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsDefaultArgs = require("../../../helpers/supportsDefaultArgs"); module.exports = () => supportsDefaultArgs(); diff --git a/test/cases/parsing/issue-2641/errors.js b/test/cases/parsing/issue-2641/errors.js index 4c8eabefcdb..ec7564051dd 100644 --- a/test/cases/parsing/issue-2641/errors.js +++ b/test/cases/parsing/issue-2641/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Module not found/, /Can't resolve '\.\/missingModule' /]]; diff --git a/test/cases/parsing/issue-2895/test.filter.js b/test/cases/parsing/issue-2895/test.filter.js index 2781bd3aca3..c814a32de48 100644 --- a/test/cases/parsing/issue-2895/test.filter.js +++ b/test/cases/parsing/issue-2895/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsBlockScoping = require("../../../helpers/supportsBlockScoping"); module.exports = () => supportsBlockScoping(); diff --git a/test/cases/parsing/issue-3238/test.filter.js b/test/cases/parsing/issue-3238/test.filter.js index 5fdfc3bfa75..2141d5ffd60 100644 --- a/test/cases/parsing/issue-3238/test.filter.js +++ b/test/cases/parsing/issue-3238/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); module.exports = () => supportsIteratorDestructuring(); diff --git a/test/cases/parsing/issue-3252/test.filter.js b/test/cases/parsing/issue-3252/test.filter.js index ac62718aa04..d502775c6a0 100644 --- a/test/cases/parsing/issue-3252/test.filter.js +++ b/test/cases/parsing/issue-3252/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsDefaultAssignment = require("../../../helpers/supportDefaultAssignment"); module.exports = () => supportsDefaultAssignment(); diff --git a/test/cases/parsing/issue-3273/test.filter.js b/test/cases/parsing/issue-3273/test.filter.js index aba11ca2cec..bf36294789c 100644 --- a/test/cases/parsing/issue-3273/test.filter.js +++ b/test/cases/parsing/issue-3273/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsDefaultAssignment = require("../../../helpers/supportDefaultAssignment"); const supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); diff --git a/test/cases/parsing/issue-4357/test.filter.js b/test/cases/parsing/issue-4357/test.filter.js index c101b0f8aca..a3efcdbae4a 100644 --- a/test/cases/parsing/issue-4357/test.filter.js +++ b/test/cases/parsing/issue-4357/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); const supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); diff --git a/test/cases/parsing/issue-4608-1-non-strict/test.filter.js b/test/cases/parsing/issue-4608-1-non-strict/test.filter.js index e5009984cdb..49d755d43bb 100644 --- a/test/cases/parsing/issue-4608-1-non-strict/test.filter.js +++ b/test/cases/parsing/issue-4608-1-non-strict/test.filter.js @@ -1 +1,3 @@ -module.exports = config => !config.module; +"use strict"; + +module.exports = (config) => !config.module; diff --git a/test/cases/parsing/issue-4608-2/test.filter.js b/test/cases/parsing/issue-4608-2/test.filter.js index 4e356f55416..e25c68e824d 100644 --- a/test/cases/parsing/issue-4608-2/test.filter.js +++ b/test/cases/parsing/issue-4608-2/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsForOf = require("../../../helpers/supportsForOf"); module.exports = () => supportsForOf(); diff --git a/test/cases/parsing/issue-4870/test.filter.js b/test/cases/parsing/issue-4870/test.filter.js index d049615837b..c1f2e57aaa0 100644 --- a/test/cases/parsing/issue-4870/test.filter.js +++ b/test/cases/parsing/issue-4870/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); const supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); diff --git a/test/cases/parsing/issue-627/warnings.js b/test/cases/parsing/issue-627/warnings.js index f1a4bb46d11..3d97c41e27a 100644 --- a/test/cases/parsing/issue-627/warnings.js +++ b/test/cases/parsing/issue-627/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Critical dependency/]]; diff --git a/test/cases/parsing/issue-7519/test.filter.js b/test/cases/parsing/issue-7519/test.filter.js index 2d8fc7eb308..f6354eef95e 100644 --- a/test/cases/parsing/issue-7519/test.filter.js +++ b/test/cases/parsing/issue-7519/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.mode !== "development"; +"use strict"; + +module.exports = (config) => config.mode !== "development"; diff --git a/test/cases/parsing/issue-758/errors.js b/test/cases/parsing/issue-758/errors.js index 4c8eabefcdb..ec7564051dd 100644 --- a/test/cases/parsing/issue-758/errors.js +++ b/test/cases/parsing/issue-758/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Module not found/, /Can't resolve '\.\/missingModule' /]]; diff --git a/test/cases/parsing/logical-assignment/test.filter.js b/test/cases/parsing/logical-assignment/test.filter.js index 1cf3a4f5cd7..1417bb56243 100644 --- a/test/cases/parsing/logical-assignment/test.filter.js +++ b/test/cases/parsing/logical-assignment/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsLogicalAssignment = require("../../../helpers/supportsLogicalAssignment"); module.exports = () => supportsLogicalAssignment(); diff --git a/test/cases/parsing/missing-export-warning-nested/warnings.js b/test/cases/parsing/missing-export-warning-nested/warnings.js index fd18632ce2f..75ae543b291 100644 --- a/test/cases/parsing/missing-export-warning-nested/warnings.js +++ b/test/cases/parsing/missing-export-warning-nested/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /export 'A' \(imported as 'm'\) was not found in '.\/a' \(possible exports: a, x\)/ diff --git a/test/cases/parsing/nullish-coalescing/test.filter.js b/test/cases/parsing/nullish-coalescing/test.filter.js index e1c1a296cd2..31fd9b925b1 100644 --- a/test/cases/parsing/nullish-coalescing/test.filter.js +++ b/test/cases/parsing/nullish-coalescing/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsNullishCoalescing = require("../../../helpers/supportsNullishCoalescing"); module.exports = () => supportsNullishCoalescing(); diff --git a/test/cases/parsing/optional-catch-binding/test.filter.js b/test/cases/parsing/optional-catch-binding/test.filter.js index 0a2d97c9405..2415a49dfa7 100644 --- a/test/cases/parsing/optional-catch-binding/test.filter.js +++ b/test/cases/parsing/optional-catch-binding/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsOptionalCatchBinding = require("../../../helpers/supportsOptionalCatchBinding"); module.exports = () => supportsOptionalCatchBinding(); diff --git a/test/cases/parsing/optional-chaining/test.filter.js b/test/cases/parsing/optional-chaining/test.filter.js index 9486c09cf37..53cf6da0c34 100644 --- a/test/cases/parsing/optional-chaining/test.filter.js +++ b/test/cases/parsing/optional-chaining/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); module.exports = () => supportsOptionalChaining(); diff --git a/test/cases/parsing/spread/test.filter.js b/test/cases/parsing/spread/test.filter.js index a0dcbdf7dde..2d29d5a2441 100644 --- a/test/cases/parsing/spread/test.filter.js +++ b/test/cases/parsing/spread/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsSpread = require("../../../helpers/supportsSpread"); module.exports = () => supportsSpread(); diff --git a/test/cases/parsing/typeof-non-module/test.filter.js b/test/cases/parsing/typeof-non-module/test.filter.js index e5009984cdb..49d755d43bb 100644 --- a/test/cases/parsing/typeof-non-module/test.filter.js +++ b/test/cases/parsing/typeof-non-module/test.filter.js @@ -1 +1,3 @@ -module.exports = config => !config.module; +"use strict"; + +module.exports = (config) => !config.module; diff --git a/test/cases/parsing/typeof/warnings.js b/test/cases/parsing/typeof/warnings.js index 59637491241..14073052dbc 100644 --- a/test/cases/parsing/typeof/warnings.js +++ b/test/cases/parsing/typeof/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/require.include\(\) is deprecated and will be removed soon/], [/require.include\(\) is deprecated and will be removed soon/] diff --git a/test/cases/parsing/unsupported-amd/errors.js b/test/cases/parsing/unsupported-amd/errors.js index 05470a57dca..2ff503f1fec 100644 --- a/test/cases/parsing/unsupported-amd/errors.js +++ b/test/cases/parsing/unsupported-amd/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Cannot statically analyse/, /in line 4/], [/Cannot statically analyse/, /in line 12/] diff --git a/test/cases/parsing/using/test.filter.js b/test/cases/parsing/using/test.filter.js index 8707b455f60..1e4b52cd229 100644 --- a/test/cases/parsing/using/test.filter.js +++ b/test/cases/parsing/using/test.filter.js @@ -1,6 +1,8 @@ +"use strict"; + const supportsUsing = require("../../../helpers/supportsUsing"); -module.exports = config => { +module.exports = (config) => { // TODO https://github.com/terser/terser/issues/1625 if (config.minimize) { return false; diff --git a/test/cases/resolving/browser-field/errors.js b/test/cases/resolving/browser-field/errors.js index 43f6c3086fc..758f46b292a 100644 --- a/test/cases/resolving/browser-field/errors.js +++ b/test/cases/resolving/browser-field/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Module not found/, /recursive-file\/a/, /Recursion in resolving/], [/Module not found/, /recursive-file\/b/, /Recursion in resolving/], diff --git a/test/cases/resolving/issue-2986/errors.js b/test/cases/resolving/issue-2986/errors.js index a3760f3d06f..9e35b72bb53 100644 --- a/test/cases/resolving/issue-2986/errors.js +++ b/test/cases/resolving/issue-2986/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Can't resolve 'any' in/, /BREAKING CHANGE/, /any-loader/], [/Can't resolve 'other' in/] diff --git a/test/cases/runtime/error-handling/errors.js b/test/cases/runtime/error-handling/errors.js index 0332131095e..459201edd77 100644 --- a/test/cases/runtime/error-handling/errors.js +++ b/test/cases/runtime/error-handling/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Module not found/, diff --git a/test/cases/runtime/error-handling/warnings.js b/test/cases/runtime/error-handling/warnings.js index c005d4830f8..db37ab4bd63 100644 --- a/test/cases/runtime/error-handling/warnings.js +++ b/test/cases/runtime/error-handling/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Module not found/, diff --git a/test/cases/runtime/missing-module-exception-dynamic-import/warnings.js b/test/cases/runtime/missing-module-exception-dynamic-import/warnings.js index f0cafe0c42f..0aca9120cf0 100644 --- a/test/cases/runtime/missing-module-exception-dynamic-import/warnings.js +++ b/test/cases/runtime/missing-module-exception-dynamic-import/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Module not found/, /Can't resolve '\.\/fail-1' /], [/Module not found/, /Can't resolve '\.\/fail-2' /], diff --git a/test/cases/runtime/missing-module-exception-require/warnings.js b/test/cases/runtime/missing-module-exception-require/warnings.js index f0cafe0c42f..0aca9120cf0 100644 --- a/test/cases/runtime/missing-module-exception-require/warnings.js +++ b/test/cases/runtime/missing-module-exception-require/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Module not found/, /Can't resolve '\.\/fail-1' /], [/Module not found/, /Can't resolve '\.\/fail-2' /], diff --git a/test/cases/runtime/missing-module-syntax-error/errors.js b/test/cases/runtime/missing-module-syntax-error/errors.js index ced71bb9976..73329ef5a9a 100644 --- a/test/cases/runtime/missing-module-syntax-error/errors.js +++ b/test/cases/runtime/missing-module-syntax-error/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Module not found/, /Can't resolve '\.\/someModule' /]]; diff --git a/test/cases/scope-hoisting/inside-class/test.filter.js b/test/cases/scope-hoisting/inside-class/test.filter.js index a5052b0500b..e6814dfde4b 100644 --- a/test/cases/scope-hoisting/inside-class/test.filter.js +++ b/test/cases/scope-hoisting/inside-class/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsES6 = require("../../../helpers/supportsES6"); module.exports = () => supportsES6(); diff --git a/test/cases/scope-hoisting/json-reexport-6700/warnings.js b/test/cases/scope-hoisting/json-reexport-6700/warnings.js index 1bce6f573e7..f905ae87cdb 100644 --- a/test/cases/scope-hoisting/json-reexport-6700/warnings.js +++ b/test/cases/scope-hoisting/json-reexport-6700/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Should not import the named export 'a' \(reexported as 'a'\) from default-exporting module \(only default export is available soon\)/ diff --git a/test/cases/scope-hoisting/renaming-shorthand-5027/test.filter.js b/test/cases/scope-hoisting/renaming-shorthand-5027/test.filter.js index eeaa66291aa..798de077511 100644 --- a/test/cases/scope-hoisting/renaming-shorthand-5027/test.filter.js +++ b/test/cases/scope-hoisting/renaming-shorthand-5027/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportDefaultAssignment = require("../../../helpers/supportDefaultAssignment"); const supportsES6 = require("../../../helpers/supportsES6"); const supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); diff --git a/test/cases/side-effects/dynamic-reexports/warnings.js b/test/cases/side-effects/dynamic-reexports/warnings.js index 82181f096fe..ee82907fd75 100644 --- a/test/cases/side-effects/dynamic-reexports/warnings.js +++ b/test/cases/side-effects/dynamic-reexports/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /export 'default' \(imported as 'Default1'\) was not found in '\.\/direct-export'/ diff --git a/test/cases/side-effects/issue-11673/test.filter.js b/test/cases/side-effects/issue-11673/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/cases/side-effects/issue-11673/test.filter.js +++ b/test/cases/side-effects/issue-11673/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/cases/wasm/decoding/test.filter.js b/test/cases/wasm/decoding/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/decoding/test.filter.js +++ b/test/cases/wasm/decoding/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/export-imported-global/test.filter.js b/test/cases/wasm/export-imported-global/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/export-imported-global/test.filter.js +++ b/test/cases/wasm/export-imported-global/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/finalize-exports-issue-8261/test.filter.js b/test/cases/wasm/finalize-exports-issue-8261/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/finalize-exports-issue-8261/test.filter.js +++ b/test/cases/wasm/finalize-exports-issue-8261/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/global-refs-imported-global/test.filter.js b/test/cases/wasm/global-refs-imported-global/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/global-refs-imported-global/test.filter.js +++ b/test/cases/wasm/global-refs-imported-global/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/import-wasm-wasm/test.filter.js b/test/cases/wasm/import-wasm-wasm/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/import-wasm-wasm/test.filter.js +++ b/test/cases/wasm/import-wasm-wasm/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/imported-global-preserve-ordering/test.filter.js b/test/cases/wasm/imported-global-preserve-ordering/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/imported-global-preserve-ordering/test.filter.js +++ b/test/cases/wasm/imported-global-preserve-ordering/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/imported-global-preserve-type/test.filter.js b/test/cases/wasm/imported-global-preserve-type/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/imported-global-preserve-type/test.filter.js +++ b/test/cases/wasm/imported-global-preserve-type/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/imports-circular/test.filter.js b/test/cases/wasm/imports-circular/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/imports-circular/test.filter.js +++ b/test/cases/wasm/imports-circular/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/imports-complex-types/test.filter.js b/test/cases/wasm/imports-complex-types/test.filter.js index b432d673632..ad3939f9bb3 100644 --- a/test/cases/wasm/imports-complex-types/test.filter.js +++ b/test/cases/wasm/imports-complex-types/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supports = require("webassembly-feature"); module.exports = () => supports.simd(); diff --git a/test/cases/wasm/imports-many-direct/test.filter.js b/test/cases/wasm/imports-many-direct/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/imports-many-direct/test.filter.js +++ b/test/cases/wasm/imports-many-direct/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/imports-multiple/test.filter.js b/test/cases/wasm/imports-multiple/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/imports-multiple/test.filter.js +++ b/test/cases/wasm/imports-multiple/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/imports/test.filter.js b/test/cases/wasm/imports/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/imports/test.filter.js +++ b/test/cases/wasm/imports/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/memory/test.filter.js b/test/cases/wasm/memory/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/memory/test.filter.js +++ b/test/cases/wasm/memory/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/order/test.filter.js b/test/cases/wasm/order/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/order/test.filter.js +++ b/test/cases/wasm/order/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/simple/test.filter.js b/test/cases/wasm/simple/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/simple/test.filter.js +++ b/test/cases/wasm/simple/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/table/test.filter.js b/test/cases/wasm/table/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/table/test.filter.js +++ b/test/cases/wasm/table/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/two-files-loader/test.filter.js b/test/cases/wasm/two-files-loader/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/two-files-loader/test.filter.js +++ b/test/cases/wasm/two-files-loader/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/unused-export/test.filter.js b/test/cases/wasm/unused-export/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/unused-export/test.filter.js +++ b/test/cases/wasm/unused-export/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/v128/test.filter.js b/test/cases/wasm/v128/test.filter.js index 35ea01d79ff..d3b7dee1966 100644 --- a/test/cases/wasm/v128/test.filter.js +++ b/test/cases/wasm/v128/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + // const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); // const supportsFeature = require("webassembly-feature"); diff --git a/test/cases/wasm/wasm-explorer-examples-async/test.filter.js b/test/cases/wasm/wasm-explorer-examples-async/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/wasm-explorer-examples-async/test.filter.js +++ b/test/cases/wasm/wasm-explorer-examples-async/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/wasm-explorer-examples-sync/test.filter.js b/test/cases/wasm/wasm-explorer-examples-sync/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/cases/wasm/wasm-explorer-examples-sync/test.filter.js +++ b/test/cases/wasm/wasm-explorer-examples-sync/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/checkArrayExpectation.js b/test/checkArrayExpectation.js index 0b93c73fb54..6b082499e57 100644 --- a/test/checkArrayExpectation.js +++ b/test/checkArrayExpectation.js @@ -8,9 +8,9 @@ const check = (expected, actual) => { expected = { message: expected }; } if (Array.isArray(expected)) { - return expected.every(e => check(e, actual)); + return expected.every((e) => check(e, actual)); } - return Object.keys(expected).every(key => { + return Object.keys(expected).every((key) => { let value = actual[key]; if (typeof value === "object") { value = JSON.stringify(value); @@ -19,12 +19,12 @@ const check = (expected, actual) => { }); }; -const explain = object => { +const explain = (object) => { if (object instanceof RegExp) { object = { message: object }; } return Object.keys(object) - .map(key => { + .map((key) => { let value = object[key]; if (typeof value === "object" && !(value instanceof RegExp)) { value = JSON.stringify(value); @@ -55,11 +55,11 @@ const diffItems = (actual, expected, kind) => { const diff = []; if (missing.length > 0) { diff.push(`The following expected ${kind}s are missing: -${missing.map(item => `${explain(item)}`).join("\n\n")}`); +${missing.map((item) => `${explain(item)}`).join("\n\n")}`); } if (tooMuch.length > 0) { diff.push(`The following ${kind}s are unexpected: -${tooMuch.map(item => `${explain(item)}`).join("\n\n")}`); +${tooMuch.map((item) => `${explain(item)}`).join("\n\n")}`); } return diff.join("\n\n"); }; @@ -81,7 +81,7 @@ module.exports = function checkArrayExpectation( } let array = object[`${kind}s`]; if (Array.isArray(array) && kind === "warning") { - array = array.filter(item => !/from Terser/.test(item)); + array = array.filter((item) => !/from Terser/.test(item)); } if (fs.existsSync(path.join(testDirectory, `${filename}.js`))) { const expectedFilename = path.join(testDirectory, `${filename}.js`); diff --git a/test/compareLocations.unittest.js b/test/compareLocations.unittest.js index b5b4d4623c5..c9d09555a64 100644 --- a/test/compareLocations.unittest.js +++ b/test/compareLocations.unittest.js @@ -2,7 +2,7 @@ const { compareLocations } = require("../lib/util/comparators"); -const createPosition = overrides => ({ +const createPosition = (overrides) => ({ line: 10, column: 5, ...overrides diff --git a/test/compareSourceOrder.unittest.js b/test/compareSourceOrder.unittest.js index 06974832ec5..966a086f7c2 100644 --- a/test/compareSourceOrder.unittest.js +++ b/test/compareSourceOrder.unittest.js @@ -23,7 +23,7 @@ describe("sortWithSourceOrder", () => { sortWithSourceOrder(deps, dependencySourceOrderMap); - expect(deps.map(d => d.name)).toEqual(["c", "a", "d", "b"]); + expect(deps.map((d) => d.name)).toEqual(["c", "a", "d", "b"]); }); it("should sort dependencies by main order when both in map", () => { @@ -40,7 +40,7 @@ describe("sortWithSourceOrder", () => { sortWithSourceOrder(deps, dependencySourceOrderMap); - expect(deps.map(d => d.name)).toEqual(["c", "b", "a"]); + expect(deps.map((d) => d.name)).toEqual(["c", "b", "a"]); }); it("should sort by sub order when main order is same", () => { @@ -57,7 +57,7 @@ describe("sortWithSourceOrder", () => { sortWithSourceOrder(deps, dependencySourceOrderMap); - expect(deps.map(d => d.name)).toEqual(["a", "c", "b"]); + expect(deps.map((d) => d.name)).toEqual(["a", "c", "b"]); }); it("should sort mixed dependencies - some in map, some not", () => { @@ -72,7 +72,7 @@ describe("sortWithSourceOrder", () => { sortWithSourceOrder(deps, dependencySourceOrderMap); - expect(deps.map(d => d.name)).toEqual(["a", "b", "c"]); + expect(deps.map((d) => d.name)).toEqual(["a", "b", "c"]); }); it("should sort by sourceOrder when none in map", () => { @@ -84,7 +84,7 @@ describe("sortWithSourceOrder", () => { sortWithSourceOrder(deps, dependencySourceOrderMap); - expect(deps.map(d => d.name)).toEqual(["a", "b", "c"]); + expect(deps.map((d) => d.name)).toEqual(["a", "b", "c"]); }); it("should sort complex scenario with negative and decimal values", () => { @@ -106,7 +106,7 @@ describe("sortWithSourceOrder", () => { sortWithSourceOrder(deps, dependencySourceOrderMap); - expect(deps.map(d => d.name)).toEqual(["a", "b", "e", "c", "f", "d"]); + expect(deps.map((d) => d.name)).toEqual(["a", "b", "e", "c", "f", "d"]); }); it("should maintain stable sort for equal values", () => { @@ -118,6 +118,6 @@ describe("sortWithSourceOrder", () => { sortWithSourceOrder(deps, dependencySourceOrderMap); - expect(deps.map(d => d.name)).toEqual(["b", "a", "c"]); + expect(deps.map((d) => d.name)).toEqual(["b", "a", "c"]); }); }); diff --git a/test/compareStringsNumeric.unittest.js b/test/compareStringsNumeric.unittest.js index aa1716adf42..24ce1e6df63 100644 --- a/test/compareStringsNumeric.unittest.js +++ b/test/compareStringsNumeric.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const { compareStringsNumeric } = require("../lib/util/comparators"); /** diff --git a/test/compileBooleanMatcher.unittest.js b/test/compileBooleanMatcher.unittest.js index b2af43e6e6f..c01a70b614a 100644 --- a/test/compileBooleanMatcher.unittest.js +++ b/test/compileBooleanMatcher.unittest.js @@ -24,38 +24,38 @@ describe("itemsToRegexp", () => { } }); - expectCompiled("basic", ["abc", "def", "123", "45", "6"], e => + expectCompiled("basic", ["abc", "def", "123", "45", "6"], (e) => e.toMatchInlineSnapshot("(123|45|6|abc|def)") ); - expectCompiled("single chars", ["a", "b", "c", "1", "2", "3"], e => + expectCompiled("single chars", ["a", "b", "c", "1", "2", "3"], (e) => e.toMatchInlineSnapshot("[123abc]") ); expectCompiled( "prefixes", ["ab1", "ab2", "ab3", "ab4", "de5", "de6", "de7", "ef8", "ef9", "gh0"], - e => e.toMatchInlineSnapshot("(ab[1234]|de[567]|ef[89]|gh0)") + (e) => e.toMatchInlineSnapshot("(ab[1234]|de[567]|ef[89]|gh0)") ); - expectCompiled("short prefixes", "a,ab", e => + expectCompiled("short prefixes", "a,ab", (e) => e.toMatchInlineSnapshot("a(|b)") ); expectCompiled( "nested prefixes", ["a", "ab", "abc", "abcd", "abcde", "abcdef"], - e => e.toMatchInlineSnapshot("a(b(c(d(|e|ef)|)|)|)") + (e) => e.toMatchInlineSnapshot("a(b(c(d(|e|ef)|)|)|)") ); - expectCompiled("suffixes", "a1,b1,c1,d1,e1,a2,b2,c2", e => + expectCompiled("suffixes", "a1,b1,c1,d1,e1,a2,b2,c2", (e) => e.toMatchInlineSnapshot("([abcde]1|[abc]2)") ); expectCompiled( "common prod", "674,542,965,12,942,483,445,943,423,995,434,122,995,248,432,165,436,86,435,221", - e => + (e) => e.toMatchInlineSnapshot( "(1(2|22|65)|4(3[2456]|23|45|83)|9(42|43|65|95)|221|248|542|674|86)" ) @@ -73,7 +73,7 @@ describe("itemsToRegexp", () => { "./path/to/directory/with/module.css", "webpack/runtime/module" ], - e => + (e) => e.toMatchInlineSnapshot( "(\\.\\/path\\/to\\/(directory\\/with\\/(file\\.(js(|on)|css)|module\\.css)|file\\.(|m)js|other\\-file\\.js)|webpack\\/runtime\\/module)" ) @@ -85,7 +85,7 @@ describe("itemsToRegexp", () => { "webpack_sharing_consume_default_react_react", "webpack_sharing_consume_default_classnames_classnames-webpack_sharing_consume_default_react_react" ], - e => + (e) => e.toMatchInlineSnapshot( "webpack_sharing_consume_default_(|classnames_classnames\\-webpack_sharing_consume_default_)react_react" ) diff --git a/test/configCases/additional-pass/simple/webpack.config.js b/test/configCases/additional-pass/simple/webpack.config.js index aa5d36ce56d..fcb12991fdb 100644 --- a/test/configCases/additional-pass/simple/webpack.config.js +++ b/test/configCases/additional-pass/simple/webpack.config.js @@ -1,7 +1,9 @@ +"use strict"; + /** @type {import("../../../../").WebpackPluginFunction} */ function testPlugin() { let counter = 1; - this.hooks.compilation.tap("TestPlugin", compilation => { + this.hooks.compilation.tap("TestPlugin", (compilation) => { const nr = counter++; compilation.hooks.needAdditionalPass.tap("TestPlugin", () => { if (nr < 5) return true; diff --git a/test/configCases/amd/disabled/webpack.config.js b/test/configCases/amd/disabled/webpack.config.js index d28e3ce5a87..0571bde76f2 100644 --- a/test/configCases/amd/disabled/webpack.config.js +++ b/test/configCases/amd/disabled/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { amd: false diff --git a/test/configCases/asset-emitted/normal/webpack.config.js b/test/configCases/asset-emitted/normal/webpack.config.js index dcf5bbbce3b..0d60896cffd 100644 --- a/test/configCases/asset-emitted/normal/webpack.config.js +++ b/test/configCases/asset-emitted/normal/webpack.config.js @@ -1,10 +1,12 @@ +"use strict"; + const Source = require("webpack-sources").Source; const Compilation = require("../../../../").Compilation; /** @type {import("../../../../").Configuration} */ module.exports = { plugins: [ - compiler => { + (compiler) => { /** @type {Record} */ const files = {}; compiler.hooks.assetEmitted.tap( diff --git a/test/configCases/asset-modules/assetModuleFilename/webpack.config.js b/test/configCases/asset-modules/assetModuleFilename/webpack.config.js index d82e276a24f..eee4fee168a 100644 --- a/test/configCases/asset-modules/assetModuleFilename/webpack.config.js +++ b/test/configCases/asset-modules/assetModuleFilename/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/base-uri/webpack.config.js b/test/configCases/asset-modules/base-uri/webpack.config.js index fbec9a54399..d6a36335a4f 100644 --- a/test/configCases/asset-modules/base-uri/webpack.config.js +++ b/test/configCases/asset-modules/base-uri/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { mode: "development", target: "web", diff --git a/test/configCases/asset-modules/build-http/webpack.config.js b/test/configCases/asset-modules/build-http/webpack.config.js index 8884b9730bd..f3fa6ee1e17 100644 --- a/test/configCases/asset-modules/build-http/webpack.config.js +++ b/test/configCases/asset-modules/build-http/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/asset-modules/custom-condition/webpack.config.js b/test/configCases/asset-modules/custom-condition/webpack.config.js index ccdc354bf26..82d5f131ec7 100644 --- a/test/configCases/asset-modules/custom-condition/webpack.config.js +++ b/test/configCases/asset-modules/custom-condition/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const NormalModule = require("../../../../").NormalModule; diff --git a/test/configCases/asset-modules/custom-encoder/webpack.config.js b/test/configCases/asset-modules/custom-encoder/webpack.config.js index e6559778189..d79b9c9d6e3 100644 --- a/test/configCases/asset-modules/custom-encoder/webpack.config.js +++ b/test/configCases/asset-modules/custom-encoder/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/data-url-broken/errors.js b/test/configCases/asset-modules/data-url-broken/errors.js index 7eb520855ca..5eb76736879 100644 --- a/test/configCases/asset-modules/data-url-broken/errors.js +++ b/test/configCases/asset-modules/data-url-broken/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /You may need an additional plugin to handle "unknown:" URIs./ ]; diff --git a/test/configCases/asset-modules/data-url-broken/infrastructure-log.js b/test/configCases/asset-modules/data-url-broken/infrastructure-log.js index 10532afb6b2..951fafae256 100644 --- a/test/configCases/asset-modules/data-url-broken/infrastructure-log.js +++ b/test/configCases/asset-modules/data-url-broken/infrastructure-log.js @@ -1,4 +1,6 @@ -module.exports = options => { +"use strict"; + +module.exports = (options) => { if (options.cache && options.cache.type === "filesystem") { return [/Pack got invalid because of write to/]; } diff --git a/test/configCases/asset-modules/data-url-broken/webpack.config.js b/test/configCases/asset-modules/data-url-broken/webpack.config.js index ab9e619ce2f..ffd2bf5659b 100644 --- a/test/configCases/asset-modules/data-url-broken/webpack.config.js +++ b/test/configCases/asset-modules/data-url-broken/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/data-url-extract/webpack.config.js b/test/configCases/asset-modules/data-url-extract/webpack.config.js index 540e6dcb74a..ea18d656371 100644 --- a/test/configCases/asset-modules/data-url-extract/webpack.config.js +++ b/test/configCases/asset-modules/data-url-extract/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/data-url/webpack.config.js b/test/configCases/asset-modules/data-url/webpack.config.js index ab9e619ce2f..ffd2bf5659b 100644 --- a/test/configCases/asset-modules/data-url/webpack.config.js +++ b/test/configCases/asset-modules/data-url/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/different-query/webpack.config.js b/test/configCases/asset-modules/different-query/webpack.config.js index 2a2dd0d262f..3081027bc81 100644 --- a/test/configCases/asset-modules/different-query/webpack.config.js +++ b/test/configCases/asset-modules/different-query/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { mode: "development", target: "web" diff --git a/test/configCases/asset-modules/emit/webpack.config.js b/test/configCases/asset-modules/emit/webpack.config.js index f764349bb04..efd50f7a324 100644 --- a/test/configCases/asset-modules/emit/webpack.config.js +++ b/test/configCases/asset-modules/emit/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/entry-with-runtimeChunk/test.config.js b/test/configCases/asset-modules/entry-with-runtimeChunk/test.config.js index 48bb5fe37b6..e67555151bf 100644 --- a/test/configCases/asset-modules/entry-with-runtimeChunk/test.config.js +++ b/test/configCases/asset-modules/entry-with-runtimeChunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i, options) { const ext = options.output.module ? "mjs" : "js"; diff --git a/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js b/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js index 1a07a7561c5..2e88fc30b18 100644 --- a/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js +++ b/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); @@ -18,7 +20,7 @@ const common = { plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("Test", compilation => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-webpack-plugin", @@ -42,7 +44,7 @@ const common = { ], optimization: { runtimeChunk: { - name: entrypoint => `runtime~${entrypoint.name}` + name: (entrypoint) => `runtime~${entrypoint.name}` } } }; @@ -51,7 +53,7 @@ const common = { * @param {number} i index * @returns {import("../../../../").Configuration | undefined} configuration */ -const entry = i => { +const entry = (i) => { switch (i % 4) { case 0: return { @@ -89,7 +91,7 @@ const entry = i => { * @param {number} i index * @returns {import("../../../../").Configuration} configuration */ -const esm = i => ({ +const esm = (i) => ({ ...common, ...entry(i), output: { @@ -110,7 +112,7 @@ const esm = i => ({ * @param {number} i index * @returns {import("../../../../").Configuration} configuration */ -const node = i => ({ +const node = (i) => ({ ...common, ...entry(i), output: { @@ -127,7 +129,7 @@ const node = i => ({ * @param {number} i index * @returns {import("../../../../").Configuration} configuration */ -const web = i => ({ +const web = (i) => ({ ...common, ...entry(i), output: { @@ -143,9 +145,9 @@ const web = i => ({ /** @type {import("../../../../").Configuration[]} */ module.exports = [ // web - ...[0, 1, 2, 3].map(i => web(i)), + ...[0, 1, 2, 3].map((i) => web(i)), // node - ...[4, 5, 6, 7].map(i => node(i)), + ...[4, 5, 6, 7].map((i) => node(i)), // ESM - ...[8, 9, 10, 11].map(i => esm(i)) + ...[8, 9, 10, 11].map((i) => esm(i)) ]; diff --git a/test/configCases/asset-modules/errored/errors.js b/test/configCases/asset-modules/errored/errors.js index 6cc186c0ea2..6552ad5e91f 100644 --- a/test/configCases/asset-modules/errored/errors.js +++ b/test/configCases/asset-modules/errored/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [/Error from loader/]; diff --git a/test/configCases/asset-modules/errored/infrastructure-log.js b/test/configCases/asset-modules/errored/infrastructure-log.js index 10532afb6b2..951fafae256 100644 --- a/test/configCases/asset-modules/errored/infrastructure-log.js +++ b/test/configCases/asset-modules/errored/infrastructure-log.js @@ -1,4 +1,6 @@ -module.exports = options => { +"use strict"; + +module.exports = (options) => { if (options.cache && options.cache.type === "filesystem") { return [/Pack got invalid because of write to/]; } diff --git a/test/configCases/asset-modules/errored/test.config.js b/test/configCases/asset-modules/errored/test.config.js index 2fddc833b22..dd39bf2b2c9 100644 --- a/test/configCases/asset-modules/errored/test.config.js +++ b/test/configCases/asset-modules/errored/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/test/configCases/asset-modules/errored/webpack.config.js b/test/configCases/asset-modules/errored/webpack.config.js index febc2672cff..830fd2ba8bd 100644 --- a/test/configCases/asset-modules/errored/webpack.config.js +++ b/test/configCases/asset-modules/errored/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/file-loader/webpack.config.js b/test/configCases/asset-modules/file-loader/webpack.config.js index 835a3c38e5e..52326f7208b 100644 --- a/test/configCases/asset-modules/file-loader/webpack.config.js +++ b/test/configCases/asset-modules/file-loader/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/file-url/webpack.config.js b/test/configCases/asset-modules/file-url/webpack.config.js index 9536cf18b55..d6880ac5422 100644 --- a/test/configCases/asset-modules/file-url/webpack.config.js +++ b/test/configCases/asset-modules/file-url/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const { pathToFileURL } = require("url"); diff --git a/test/configCases/asset-modules/generator-asset-publicPath-hash/webpack.config.js b/test/configCases/asset-modules/generator-asset-publicPath-hash/webpack.config.js index f21eb61c884..0ac45304610 100644 --- a/test/configCases/asset-modules/generator-asset-publicPath-hash/webpack.config.js +++ b/test/configCases/asset-modules/generator-asset-publicPath-hash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/generator-asset-publicPath/webpack.config.js b/test/configCases/asset-modules/generator-asset-publicPath/webpack.config.js index 8dbee301fd5..3ae491d52ee 100644 --- a/test/configCases/asset-modules/generator-asset-publicPath/webpack.config.js +++ b/test/configCases/asset-modules/generator-asset-publicPath/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/global-options/webpack.config.js b/test/configCases/asset-modules/global-options/webpack.config.js index 5c9aaa2cec5..71060245496 100644 --- a/test/configCases/asset-modules/global-options/webpack.config.js +++ b/test/configCases/asset-modules/global-options/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const mimeTypes = require("mime-types"); const svgToMiniDataURI = require("mini-svg-data-uri"); diff --git a/test/configCases/asset-modules/http-url/errors.js b/test/configCases/asset-modules/http-url/errors.js index 4e46c194963..40669d69ec2 100644 --- a/test/configCases/asset-modules/http-url/errors.js +++ b/test/configCases/asset-modules/http-url/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /http:\/\/localhost:9990\/index\.css\?cache used to have no-cache lockfile entry and has content now, but lockfile is frozen/ diff --git a/test/configCases/asset-modules/http-url/test.config.js b/test/configCases/asset-modules/http-url/test.config.js index 718aa51dc5e..9677a678039 100644 --- a/test/configCases/asset-modules/http-url/test.config.js +++ b/test/configCases/asset-modules/http-url/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/test/configCases/asset-modules/http-url/webpack.config.js b/test/configCases/asset-modules/http-url/webpack.config.js index 426378bb04a..494f754d515 100644 --- a/test/configCases/asset-modules/http-url/webpack.config.js +++ b/test/configCases/asset-modules/http-url/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { experiments: { schemes: { HttpUriPlugin } diff --git a/test/configCases/asset-modules/ignore/webpack.config.js b/test/configCases/asset-modules/ignore/webpack.config.js index 760607d95cb..49b75fc2e43 100644 --- a/test/configCases/asset-modules/ignore/webpack.config.js +++ b/test/configCases/asset-modules/ignore/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/input-data-url-encoding/webpack.config.js b/test/configCases/asset-modules/input-data-url-encoding/webpack.config.js index dd1ef6a41d9..bbc41a80549 100644 --- a/test/configCases/asset-modules/input-data-url-encoding/webpack.config.js +++ b/test/configCases/asset-modules/input-data-url-encoding/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/input-data-url/webpack.config.js b/test/configCases/asset-modules/input-data-url/webpack.config.js index fa4618f8037..5ac891b1276 100644 --- a/test/configCases/asset-modules/input-data-url/webpack.config.js +++ b/test/configCases/asset-modules/input-data-url/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/keep-source-maps/webpack.config.js b/test/configCases/asset-modules/keep-source-maps/webpack.config.js index e18ec0545de..a162586feec 100644 --- a/test/configCases/asset-modules/keep-source-maps/webpack.config.js +++ b/test/configCases/asset-modules/keep-source-maps/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").GeneratorOptionsByModuleTypeKnown} GeneratorOptionsByModuleTypeKnown */ /** @type {import("../../../../").Configuration} */ @@ -23,7 +25,7 @@ module.exports = { /** @type {GeneratorOptionsByModuleTypeKnown['asset/resource']} */ generator: { binary: false, - filename: pathInfo => + filename: (pathInfo) => /** @type {string} */ (pathInfo.filename).replace(/\.scss/gi, ".css") }, diff --git a/test/configCases/asset-modules/only-entry/test.config.js b/test/configCases/asset-modules/only-entry/test.config.js index f48f8b79def..6f661b3d1eb 100644 --- a/test/configCases/asset-modules/only-entry/test.config.js +++ b/test/configCases/asset-modules/only-entry/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["test.js"]; diff --git a/test/configCases/asset-modules/only-entry/webpack.config.js b/test/configCases/asset-modules/only-entry/webpack.config.js index f196e1dee13..e956df2d37c 100644 --- a/test/configCases/asset-modules/only-entry/webpack.config.js +++ b/test/configCases/asset-modules/only-entry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); @@ -28,7 +30,7 @@ const common = (i, options) => ({ plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("Test", compilation => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-webpack-plugin", diff --git a/test/configCases/asset-modules/only-hash-url/webpack.config.js b/test/configCases/asset-modules/only-hash-url/webpack.config.js index 0da77aa0f7a..5b29ebfde1a 100644 --- a/test/configCases/asset-modules/only-hash-url/webpack.config.js +++ b/test/configCases/asset-modules/only-hash-url/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/opus/errors.js b/test/configCases/asset-modules/opus/errors.js index 878a9afe36d..b1adeee4fbc 100644 --- a/test/configCases/asset-modules/opus/errors.js +++ b/test/configCases/asset-modules/opus/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/DataUrl can't be generated automatically/]]; diff --git a/test/configCases/asset-modules/opus/webpack.config.js b/test/configCases/asset-modules/opus/webpack.config.js index 5a9c737db9b..7542f3b89f1 100644 --- a/test/configCases/asset-modules/opus/webpack.config.js +++ b/test/configCases/asset-modules/opus/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/overridePath/webpack.config.js b/test/configCases/asset-modules/overridePath/webpack.config.js index 47481e0aae4..35cd50da71a 100644 --- a/test/configCases/asset-modules/overridePath/webpack.config.js +++ b/test/configCases/asset-modules/overridePath/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/path/webpack.config.js b/test/configCases/asset-modules/path/webpack.config.js index 6255f718602..20e3170cb1e 100644 --- a/test/configCases/asset-modules/path/webpack.config.js +++ b/test/configCases/asset-modules/path/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/publicPath/webpack.config.js b/test/configCases/asset-modules/publicPath/webpack.config.js index d6363ec564d..501b53db6c3 100644 --- a/test/configCases/asset-modules/publicPath/webpack.config.js +++ b/test/configCases/asset-modules/publicPath/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/query-and-custom-condition/webpack.config.js b/test/configCases/asset-modules/query-and-custom-condition/webpack.config.js index 96dfc3ba940..8a24abf1a0e 100644 --- a/test/configCases/asset-modules/query-and-custom-condition/webpack.config.js +++ b/test/configCases/asset-modules/query-and-custom-condition/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").ParserOptionsByModuleTypeKnown} ParserOptionsByModuleTypeKnown */ /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/asset-modules/query-and-custom-encoder/webpack.config.js b/test/configCases/asset-modules/query-and-custom-encoder/webpack.config.js index 1c22670e597..8a62029612d 100644 --- a/test/configCases/asset-modules/query-and-custom-encoder/webpack.config.js +++ b/test/configCases/asset-modules/query-and-custom-encoder/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const mimeTypes = require("mime-types"); const svgToMiniDataURI = require("mini-svg-data-uri"); diff --git a/test/configCases/asset-modules/query/webpack.config.js b/test/configCases/asset-modules/query/webpack.config.js index 63b0636fec6..ab476db7e0d 100644 --- a/test/configCases/asset-modules/query/webpack.config.js +++ b/test/configCases/asset-modules/query/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/real-content-hash/webpack.config.js b/test/configCases/asset-modules/real-content-hash/webpack.config.js index 185587c1654..12cffe6a2c4 100644 --- a/test/configCases/asset-modules/real-content-hash/webpack.config.js +++ b/test/configCases/asset-modules/real-content-hash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/resource-from-data-uri/webpack.config.js b/test/configCases/asset-modules/resource-from-data-uri/webpack.config.js index 92bff82560f..c8018c1fe6a 100644 --- a/test/configCases/asset-modules/resource-from-data-uri/webpack.config.js +++ b/test/configCases/asset-modules/resource-from-data-uri/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/asset-modules/rule-generator-outputPath/webpack.config.js b/test/configCases/asset-modules/rule-generator-outputPath/webpack.config.js index dd65cf885dc..3ee6d41cf01 100644 --- a/test/configCases/asset-modules/rule-generator-outputPath/webpack.config.js +++ b/test/configCases/asset-modules/rule-generator-outputPath/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/rule-generator-publicPath-override/webpack.config.js b/test/configCases/asset-modules/rule-generator-publicPath-override/webpack.config.js index 75890c52181..a5ff73672f2 100644 --- a/test/configCases/asset-modules/rule-generator-publicPath-override/webpack.config.js +++ b/test/configCases/asset-modules/rule-generator-publicPath-override/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/rule-generator-publicPath/webpack.config.js b/test/configCases/asset-modules/rule-generator-publicPath/webpack.config.js index 9f8072e1fa4..e411d767cc7 100644 --- a/test/configCases/asset-modules/rule-generator-publicPath/webpack.config.js +++ b/test/configCases/asset-modules/rule-generator-publicPath/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/source/webpack.config.js b/test/configCases/asset-modules/source/webpack.config.js index 1d0399ec277..dc0802bbc81 100644 --- a/test/configCases/asset-modules/source/webpack.config.js +++ b/test/configCases/asset-modules/source/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/types/webpack.config.js b/test/configCases/asset-modules/types/webpack.config.js index 94be94f16e7..4d6bce57c4c 100644 --- a/test/configCases/asset-modules/types/webpack.config.js +++ b/test/configCases/asset-modules/types/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-modules/unsafe-cache-13827/webpack.config.js b/test/configCases/asset-modules/unsafe-cache-13827/webpack.config.js index 693c302c6c7..c00ba591413 100644 --- a/test/configCases/asset-modules/unsafe-cache-13827/webpack.config.js +++ b/test/configCases/asset-modules/unsafe-cache-13827/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-url/relative/webpack.config.js b/test/configCases/asset-url/relative/webpack.config.js index 8ac15349c22..b4db9ee19b2 100644 --- a/test/configCases/asset-url/relative/webpack.config.js +++ b/test/configCases/asset-url/relative/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-url/target-node1/webpack.config.js b/test/configCases/asset-url/target-node1/webpack.config.js index 315a9e60246..c95e9fcd9cc 100644 --- a/test/configCases/asset-url/target-node1/webpack.config.js +++ b/test/configCases/asset-url/target-node1/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-url/target-node2/webpack.config.js b/test/configCases/asset-url/target-node2/webpack.config.js index 14934d1135f..260476951dc 100644 --- a/test/configCases/asset-url/target-node2/webpack.config.js +++ b/test/configCases/asset-url/target-node2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-url/target-node3/webpack.config.js b/test/configCases/asset-url/target-node3/webpack.config.js index 499de2fe5d6..9224e7257a2 100644 --- a/test/configCases/asset-url/target-node3/webpack.config.js +++ b/test/configCases/asset-url/target-node3/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-url/target-web1/webpack.config.js b/test/configCases/asset-url/target-web1/webpack.config.js index 35e16e26f51..5610cb056cb 100644 --- a/test/configCases/asset-url/target-web1/webpack.config.js +++ b/test/configCases/asset-url/target-web1/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-url/target-web2/webpack.config.js b/test/configCases/asset-url/target-web2/webpack.config.js index 2cbfe9bddbf..2d4bf87faa4 100644 --- a/test/configCases/asset-url/target-web2/webpack.config.js +++ b/test/configCases/asset-url/target-web2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-url/target-webworker1/test.config.js b/test/configCases/asset-url/target-webworker1/test.config.js index 9429e689a15..f680194a909 100644 --- a/test/configCases/asset-url/target-webworker1/test.config.js +++ b/test/configCases/asset-url/target-webworker1/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { scope.self.location = "https://test.cases/custom/deep/path/main.js"; diff --git a/test/configCases/asset-url/target-webworker1/webpack.config.js b/test/configCases/asset-url/target-webworker1/webpack.config.js index 146b9da9c12..8c685029852 100644 --- a/test/configCases/asset-url/target-webworker1/webpack.config.js +++ b/test/configCases/asset-url/target-webworker1/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/asset-url/target-webworker2/webpack.config.js b/test/configCases/asset-url/target-webworker2/webpack.config.js index ef13370aa09..b7fadb6b661 100644 --- a/test/configCases/asset-url/target-webworker2/webpack.config.js +++ b/test/configCases/asset-url/target-webworker2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/assets/delete-asset/infrastructure-log.js b/test/configCases/assets/delete-asset/infrastructure-log.js index 9d9c6526e4a..d6dce058225 100644 --- a/test/configCases/assets/delete-asset/infrastructure-log.js +++ b/test/configCases/assets/delete-asset/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ // each time sets different assetsInfo object instance in webpack.config.js:54 // this prevents hit in inmemory cache diff --git a/test/configCases/assets/delete-asset/webpack.config.js b/test/configCases/assets/delete-asset/webpack.config.js index a0038acc014..8e35fcccc1b 100644 --- a/test/configCases/assets/delete-asset/webpack.config.js +++ b/test/configCases/assets/delete-asset/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const TerserPlugin = require("terser-webpack-plugin"); const { BannerPlugin, Compilation } = require("../../../../"); @@ -19,8 +21,8 @@ module.exports = { new BannerPlugin({ banner: "Test" }), - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "Test", diff --git a/test/configCases/assets/prevent-related-deletion/webpack.config.js b/test/configCases/assets/prevent-related-deletion/webpack.config.js index 5f55eeaca0a..b2d41131e5f 100644 --- a/test/configCases/assets/prevent-related-deletion/webpack.config.js +++ b/test/configCases/assets/prevent-related-deletion/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { Compilation } = require("../../../../"); /** @type {import("../../../../").Configuration} */ @@ -9,8 +11,8 @@ module.exports = { }, devtool: "source-map", plugins: [ - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "Test", diff --git a/test/configCases/async-commons-chunk/all-selected/webpack.config.js b/test/configCases/async-commons-chunk/all-selected/webpack.config.js index 4224dbc77bb..35eb1e4d960 100644 --- a/test/configCases/async-commons-chunk/all-selected/webpack.config.js +++ b/test/configCases/async-commons-chunk/all-selected/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/async-commons-chunk/duplicate/webpack.config.js b/test/configCases/async-commons-chunk/duplicate/webpack.config.js index 4224dbc77bb..35eb1e4d960 100644 --- a/test/configCases/async-commons-chunk/duplicate/webpack.config.js +++ b/test/configCases/async-commons-chunk/duplicate/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/async-commons-chunk/existing-name/webpack.config.js b/test/configCases/async-commons-chunk/existing-name/webpack.config.js index bf5d082bfa1..bbd9df87641 100644 --- a/test/configCases/async-commons-chunk/existing-name/webpack.config.js +++ b/test/configCases/async-commons-chunk/existing-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { performance: { diff --git a/test/configCases/async-commons-chunk/nested/webpack.config.js b/test/configCases/async-commons-chunk/nested/webpack.config.js index 4224dbc77bb..35eb1e4d960 100644 --- a/test/configCases/async-commons-chunk/nested/webpack.config.js +++ b/test/configCases/async-commons-chunk/nested/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/async-commons-chunk/node/webpack.config.js b/test/configCases/async-commons-chunk/node/webpack.config.js index d25903acd0d..5f1a08dd3e4 100644 --- a/test/configCases/async-commons-chunk/node/webpack.config.js +++ b/test/configCases/async-commons-chunk/node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "none", diff --git a/test/configCases/async-commons-chunk/simple/webpack.config.js b/test/configCases/async-commons-chunk/simple/webpack.config.js index 4224dbc77bb..35eb1e4d960 100644 --- a/test/configCases/async-commons-chunk/simple/webpack.config.js +++ b/test/configCases/async-commons-chunk/simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/async-library/0-create-library/test.config.js b/test/configCases/async-library/0-create-library/test.config.js index 04581a81040..67028ae7c8c 100644 --- a/test/configCases/async-library/0-create-library/test.config.js +++ b/test/configCases/async-library/0-create-library/test.config.js @@ -1 +1,3 @@ +"use strict"; + module.exports.noTests = true; diff --git a/test/configCases/async-library/0-create-library/webpack.config.js b/test/configCases/async-library/0-create-library/webpack.config.js index 0f5270b0881..4e6a9a80420 100644 --- a/test/configCases/async-library/0-create-library/webpack.config.js +++ b/test/configCases/async-library/0-create-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { entry: "./a.js", diff --git a/test/configCases/async-library/1-use-library/webpack.config.js b/test/configCases/async-library/1-use-library/webpack.config.js index 794b8747468..28b81cdb2fe 100644 --- a/test/configCases/async-library/1-use-library/webpack.config.js +++ b/test/configCases/async-library/1-use-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {(env: Env, options: TestOptions) => import("../../../../types").Configuration} */ diff --git a/test/configCases/async-module/environment-not-support-async-warning/test.filter.js b/test/configCases/async-module/environment-not-support-async-warning/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/configCases/async-module/environment-not-support-async-warning/test.filter.js +++ b/test/configCases/async-module/environment-not-support-async-warning/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/async-module/environment-not-support-async-warning/warnings.js b/test/configCases/async-module/environment-not-support-async-warning/warnings.js index e0bb2da70fe..0ac5a8c9c50 100644 --- a/test/configCases/async-module/environment-not-support-async-warning/warnings.js +++ b/test/configCases/async-module/environment-not-support-async-warning/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ { moduleName: /tla\.js/ }, diff --git a/test/configCases/async-module/environment-not-support-async-warning/webpack.config.js b/test/configCases/async-module/environment-not-support-async-warning/webpack.config.js index 81f034c466e..d7bae5b55f6 100644 --- a/test/configCases/async-module/environment-not-support-async-warning/webpack.config.js +++ b/test/configCases/async-module/environment-not-support-async-warning/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/cache-dependencies/managed-items-unsafe-cache/webpack.config.js b/test/configCases/cache-dependencies/managed-items-unsafe-cache/webpack.config.js index bbf2fa59a9f..042d1e75aa8 100644 --- a/test/configCases/cache-dependencies/managed-items-unsafe-cache/webpack.config.js +++ b/test/configCases/cache-dependencies/managed-items-unsafe-cache/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ @@ -6,7 +8,7 @@ module.exports = { managedPaths: [path.resolve(__dirname, "node_modules")] }, plugins: [ - compiler => { + (compiler) => { compiler.hooks.done.tap("Test", ({ compilation }) => { const fileDeps = [...compilation.fileDependencies]; expect(fileDeps).toContain( diff --git a/test/configCases/cache-dependencies/managed-items/webpack.config.js b/test/configCases/cache-dependencies/managed-items/webpack.config.js index bf1482c73d9..5e5b9f15ff7 100644 --- a/test/configCases/cache-dependencies/managed-items/webpack.config.js +++ b/test/configCases/cache-dependencies/managed-items/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ @@ -6,7 +8,7 @@ module.exports = { managedPaths: [path.resolve(__dirname, "node_modules")] }, plugins: [ - compiler => { + (compiler) => { compiler.hooks.done.tap("Test", ({ compilation }) => { const fileDeps = [...compilation.fileDependencies]; expect(fileDeps).toContain( diff --git a/test/configCases/cache-filesystem/multicompiler-mode-cache-3/warnings.js b/test/configCases/cache-filesystem/multicompiler-mode-cache-3/warnings.js index c6828833f80..493e8e1c91f 100644 --- a/test/configCases/cache-filesystem/multicompiler-mode-cache-3/warnings.js +++ b/test/configCases/cache-filesystem/multicompiler-mode-cache-3/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /Please set unique "cache\.name" option/, /Compiler with name "3rd compiler" doesn't use unique cache name/ diff --git a/test/configCases/cache-filesystem/multicompiler-mode-cache-4/warnings.js b/test/configCases/cache-filesystem/multicompiler-mode-cache-4/warnings.js index d0bff241879..a21fb971436 100644 --- a/test/configCases/cache-filesystem/multicompiler-mode-cache-4/warnings.js +++ b/test/configCases/cache-filesystem/multicompiler-mode-cache-4/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [/Please set unique "cache\.name" option/]; diff --git a/test/configCases/chunk-graph/issue-15173/test.config.js b/test/configCases/chunk-graph/issue-15173/test.config.js index 6b83bf35112..86d60992f00 100644 --- a/test/configCases/chunk-graph/issue-15173/test.config.js +++ b/test/configCases/chunk-graph/issue-15173/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["entryA.js"]; diff --git a/test/configCases/chunk-graph/issue-15173/webpack.config.js b/test/configCases/chunk-graph/issue-15173/webpack.config.js index b5e57a94a20..b791dd5a7eb 100644 --- a/test/configCases/chunk-graph/issue-15173/webpack.config.js +++ b/test/configCases/chunk-graph/issue-15173/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { entry: { entryA: "./entries/entryA.js", diff --git a/test/configCases/chunk-graph/issue-17989/test.config.js b/test/configCases/chunk-graph/issue-17989/test.config.js index e03ba4e8401..6cf32125760 100644 --- a/test/configCases/chunk-graph/issue-17989/test.config.js +++ b/test/configCases/chunk-graph/issue-17989/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["a.js", "b.js"]; diff --git a/test/configCases/chunk-graph/issue-17989/webpack.config.js b/test/configCases/chunk-graph/issue-17989/webpack.config.js index 0410aaf3e99..f5c815ce9cd 100644 --- a/test/configCases/chunk-graph/issue-17989/webpack.config.js +++ b/test/configCases/chunk-graph/issue-17989/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/chunk-graph/issue-9634/test.config.js b/test/configCases/chunk-graph/issue-9634/test.config.js index e03ba4e8401..6cf32125760 100644 --- a/test/configCases/chunk-graph/issue-9634/test.config.js +++ b/test/configCases/chunk-graph/issue-9634/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["a.js", "b.js"]; diff --git a/test/configCases/chunk-graph/issue-9634/webpack.config.js b/test/configCases/chunk-graph/issue-9634/webpack.config.js index 42a875cba48..838716029c5 100644 --- a/test/configCases/chunk-graph/issue-9634/webpack.config.js +++ b/test/configCases/chunk-graph/issue-9634/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/chunk-graph/rewalk-chunk/test.config.js b/test/configCases/chunk-graph/rewalk-chunk/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/chunk-graph/rewalk-chunk/test.config.js +++ b/test/configCases/chunk-graph/rewalk-chunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/chunk-graph/rewalk-chunk/webpack.config.js b/test/configCases/chunk-graph/rewalk-chunk/webpack.config.js index 57ec6f71520..b3554097a35 100644 --- a/test/configCases/chunk-graph/rewalk-chunk/webpack.config.js +++ b/test/configCases/chunk-graph/rewalk-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/chunk-index/issue-18008/test.config.js b/test/configCases/chunk-index/issue-18008/test.config.js index 4e1620b1056..ac9427f4bc8 100644 --- a/test/configCases/chunk-index/issue-18008/test.config.js +++ b/test/configCases/chunk-index/issue-18008/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js", "A.js", "shared.js", "B.js", "B-2.js"]; diff --git a/test/configCases/chunk-index/issue-18008/webpack.config.js b/test/configCases/chunk-index/issue-18008/webpack.config.js index 890cee2949f..3a338ae712d 100644 --- a/test/configCases/chunk-index/issue-18008/webpack.config.js +++ b/test/configCases/chunk-index/issue-18008/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../types").Compilation} Compilation */ /** @typedef {import("../../../../types").Module} Module */ /** @type {import("../../../../types").Configuration} */ @@ -18,7 +20,7 @@ module.exports = { * @param {Compilation} compilation compilation * @returns {void} */ - const handler = compilation => { + const handler = (compilation) => { compilation.hooks.afterSeal.tap("testcase", () => { /** @type {Record} */ const data = {}; diff --git a/test/configCases/chunk-index/order-multiple-entries/test.config.js b/test/configCases/chunk-index/order-multiple-entries/test.config.js index e4c2d7d4b4a..c5234ed761a 100644 --- a/test/configCases/chunk-index/order-multiple-entries/test.config.js +++ b/test/configCases/chunk-index/order-multiple-entries/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["entry1.js", "entry2.js"]; diff --git a/test/configCases/chunk-index/order-multiple-entries/webpack.config.js b/test/configCases/chunk-index/order-multiple-entries/webpack.config.js index 78db29f493f..a2c54eb021e 100644 --- a/test/configCases/chunk-index/order-multiple-entries/webpack.config.js +++ b/test/configCases/chunk-index/order-multiple-entries/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compilation} Compilation */ /** @typedef {import("../../../../").Module} Module */ @@ -19,7 +21,7 @@ module.exports = { * @param {Compilation} compilation compilation * @returns {void} */ - const handler = compilation => { + const handler = (compilation) => { const moduleGraph = compilation.moduleGraph; compilation.hooks.afterSeal.tap("testcase", () => { /** @type {Record} */ @@ -78,13 +80,13 @@ module.exports = { }); const indices = [...compilation.modules] .map( - m => + (m) => /** @type {[number, Module]} */ ([ moduleGraph.getPreOrderIndex(m), m ]) ) - .filter(p => typeof p[0] === "number") + .filter((p) => typeof p[0] === "number") .sort((a, b) => a[0] - b[0]) .map( ([i, m]) => @@ -93,13 +95,13 @@ module.exports = { .join(", "); const indices2 = [...compilation.modules] .map( - m => + (m) => /** @type {[number, Module]} */ ([ moduleGraph.getPostOrderIndex(m), m ]) ) - .filter(p => typeof p[0] === "number") + .filter((p) => typeof p[0] === "number") .sort((a, b) => a[0] - b[0]) .map( ([i, m]) => diff --git a/test/configCases/chunk-index/recalc-index/webpack.config.js b/test/configCases/chunk-index/recalc-index/webpack.config.js index 5dd70bdad07..540a4b9a2ea 100644 --- a/test/configCases/chunk-index/recalc-index/webpack.config.js +++ b/test/configCases/chunk-index/recalc-index/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../types").Compilation} Compilation */ /** @typedef {import("../../../../types").Module} Module */ /** @type {import("../../../../types").Configuration} */ @@ -14,7 +16,7 @@ module.exports = { * @param {Compilation} compilation compilation * @returns {void} */ - const handler = compilation => { + const handler = (compilation) => { compilation.hooks.afterSeal.tap("testcase", () => { /** @type {Record} */ const data = {}; diff --git a/test/configCases/clean/dry/webpack.config.js b/test/configCases/clean/dry/webpack.config.js index 7a1b1fb1d62..353ae5cff70 100644 --- a/test/configCases/clean/dry/webpack.config.js +++ b/test/configCases/clean/dry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const { RawSource } = require("webpack-sources"); @@ -11,9 +13,9 @@ module.exports = { } }, plugins: [ - compiler => { - compiler.hooks.thisCompilation.tap("Test", compilation => { - compilation.hooks.processAssets.tap("Test", assets => { + (compiler) => { + compiler.hooks.thisCompilation.tap("Test", (compilation) => { + compilation.hooks.processAssets.tap("Test", (assets) => { const outputPath = compilation.getPath(compiler.outputPath, {}); const customDir = path.join(outputPath, "this/dir/should/be/removed"); fs.mkdirSync(customDir, { recursive: true }); @@ -21,7 +23,7 @@ module.exports = { assets["this/dir/should/not/be/removed/file.ext"] = new RawSource(""); }); }); - compiler.hooks.afterEmit.tap("Test", compilation => { + compiler.hooks.afterEmit.tap("Test", (compilation) => { const outputPath = compilation.getPath(compiler.outputPath, {}); expect(readDir(outputPath)).toMatchInlineSnapshot(` Object { diff --git a/test/configCases/clean/enabled/webpack.config.js b/test/configCases/clean/enabled/webpack.config.js index 16575014af3..66e6fb82e3c 100644 --- a/test/configCases/clean/enabled/webpack.config.js +++ b/test/configCases/clean/enabled/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const { RawSource } = require("webpack-sources"); @@ -9,10 +11,10 @@ module.exports = { clean: true }, plugins: [ - compiler => { + (compiler) => { let once = true; - compiler.hooks.thisCompilation.tap("Test", compilation => { - compilation.hooks.processAssets.tap("Test", assets => { + compiler.hooks.thisCompilation.tap("Test", (compilation) => { + compilation.hooks.processAssets.tap("Test", (assets) => { if (once) { const outputPath = compilation.getPath(compiler.outputPath, {}); const customDir = path.join( @@ -26,7 +28,7 @@ module.exports = { assets["this/dir/should/not/be/removed/file.ext"] = new RawSource(""); }); }); - compiler.hooks.afterEmit.tap("Test", compilation => { + compiler.hooks.afterEmit.tap("Test", (compilation) => { const outputPath = compilation.getPath(compiler.outputPath, {}); expect(readDir(outputPath)).toMatchInlineSnapshot(` Object { diff --git a/test/configCases/clean/ignore-fn/webpack.config.js b/test/configCases/clean/ignore-fn/webpack.config.js index 9313802ace3..778d0ad4001 100644 --- a/test/configCases/clean/ignore-fn/webpack.config.js +++ b/test/configCases/clean/ignore-fn/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const { RawSource } = require("webpack-sources"); @@ -13,10 +15,10 @@ module.exports = { } }, plugins: [ - compiler => { + (compiler) => { let once = true; - compiler.hooks.thisCompilation.tap("Test", compilation => { - compilation.hooks.processAssets.tap("Test", assets => { + compiler.hooks.thisCompilation.tap("Test", (compilation) => { + compilation.hooks.processAssets.tap("Test", (assets) => { if (once) { const outputPath = compilation.getPath(compiler.outputPath, {}); const customDir = path.join( @@ -36,7 +38,7 @@ module.exports = { assets["this/dir/should/not/be/removed/file.ext"] = new RawSource(""); }); }); - compiler.hooks.afterEmit.tap("Test", compilation => { + compiler.hooks.afterEmit.tap("Test", (compilation) => { const outputPath = compilation.getPath(compiler.outputPath, {}); expect(readDir(outputPath)).toMatchInlineSnapshot(` Object { diff --git a/test/configCases/clean/ignore-hook/webpack.config.js b/test/configCases/clean/ignore-hook/webpack.config.js index 64bd3efded8..458b92cefdd 100644 --- a/test/configCases/clean/ignore-hook/webpack.config.js +++ b/test/configCases/clean/ignore-hook/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const { RawSource } = require("webpack-sources"); @@ -10,17 +12,17 @@ module.exports = { clean: true }, plugins: [ - compiler => { + (compiler) => { let once = true; - compiler.hooks.thisCompilation.tap("Test", compilation => { + compiler.hooks.thisCompilation.tap("Test", (compilation) => { webpack.CleanPlugin.getCompilationHooks(compilation).keep.tap( "Test", - asset => { + (asset) => { if (/[/\\]ignored[/\\]dir[/\\]/.test(asset)) return true; if (asset.includes("ignored/too")) return true; } ); - compilation.hooks.processAssets.tap("Test", assets => { + compilation.hooks.processAssets.tap("Test", (assets) => { if (once) { const outputPath = compilation.getPath(compiler.outputPath, {}); const customDir = path.join( @@ -46,7 +48,7 @@ module.exports = { assets["this/dir/should/not/be/removed/file.ext"] = new RawSource(""); }); }); - compiler.hooks.afterEmit.tap("Test", compilation => { + compiler.hooks.afterEmit.tap("Test", (compilation) => { const outputPath = compilation.getPath(compiler.outputPath, {}); expect(readDir(outputPath)).toMatchInlineSnapshot(` Object { diff --git a/test/configCases/clean/ignore-rx/webpack.config.js b/test/configCases/clean/ignore-rx/webpack.config.js index 82623ce620c..5b4291ed344 100644 --- a/test/configCases/clean/ignore-rx/webpack.config.js +++ b/test/configCases/clean/ignore-rx/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const { RawSource } = require("webpack-sources"); @@ -11,10 +13,10 @@ module.exports = { } }, plugins: [ - compiler => { + (compiler) => { let once = true; - compiler.hooks.thisCompilation.tap("Test", compilation => { - compilation.hooks.processAssets.tap("Test", assets => { + compiler.hooks.thisCompilation.tap("Test", (compilation) => { + compilation.hooks.processAssets.tap("Test", (assets) => { if (once) { const outputPath = compilation.getPath(compiler.outputPath, {}); const customDir = path.join( @@ -34,7 +36,7 @@ module.exports = { assets["this/dir/should/not/be/removed/file.ext"] = new RawSource(""); }); }); - compiler.hooks.afterEmit.tap("Test", compilation => { + compiler.hooks.afterEmit.tap("Test", (compilation) => { const outputPath = compilation.getPath(compiler.outputPath, {}); expect(readDir(outputPath)).toMatchInlineSnapshot(` Object { diff --git a/test/configCases/clean/lib-manifest-plugin/webpack.config.js b/test/configCases/clean/lib-manifest-plugin/webpack.config.js index fac31f113ce..1e3ae36eab3 100644 --- a/test/configCases/clean/lib-manifest-plugin/webpack.config.js +++ b/test/configCases/clean/lib-manifest-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); const readDir = require("./readdir"); @@ -8,15 +10,15 @@ module.exports = { clean: true }, plugins: [ - compiler => { - compiler.hooks.thisCompilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.thisCompilation.tap("Test", (compilation) => { const outputPath = compilation.getPath(compiler.outputPath, {}); new webpack.DllPlugin({ name: "[name]_dll", path: path.resolve(outputPath, "manifest.json") }).apply(compiler); }); - compiler.hooks.afterEmit.tap("Test", compilation => { + compiler.hooks.afterEmit.tap("Test", (compilation) => { const outputPath = compilation.getPath(compiler.outputPath, {}); expect(readDir(outputPath)).toMatchInlineSnapshot(` Object { diff --git a/test/configCases/clean/link/test.filter.js b/test/configCases/clean/link/test.filter.js index e627dbe1937..8ba5dc94751 100644 --- a/test/configCases/clean/link/test.filter.js +++ b/test/configCases/clean/link/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/test/configCases/clean/link/webpack.config.js b/test/configCases/clean/link/webpack.config.js index 463218c7eaa..db7deb809a7 100644 --- a/test/configCases/clean/link/webpack.config.js +++ b/test/configCases/clean/link/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const readDir = require("../enabled/readdir"); @@ -8,7 +10,7 @@ module.exports = { clean: true }, plugins: [ - compiler => { + (compiler) => { let once = true; compiler.hooks.environment.tap("Test", () => { if (once) { @@ -27,7 +29,7 @@ module.exports = { once = false; } }); - compiler.hooks.afterEmit.tap("Test", compilation => { + compiler.hooks.afterEmit.tap("Test", (compilation) => { const outputPath = compilation.getPath(compiler.outputPath, {}); expect(readDir(outputPath)).toMatchInlineSnapshot(` Object { diff --git a/test/configCases/code-generation/harmony-pure-default/webpack.config.js b/test/configCases/code-generation/harmony-pure-default/webpack.config.js index 2ec858900ac..0e3ca724282 100644 --- a/test/configCases/code-generation/harmony-pure-default/webpack.config.js +++ b/test/configCases/code-generation/harmony-pure-default/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/code-generation/import-export-format-2/webpack.config.js b/test/configCases/code-generation/import-export-format-2/webpack.config.js index 777d038c05b..bbcd401f715 100644 --- a/test/configCases/code-generation/import-export-format-2/webpack.config.js +++ b/test/configCases/code-generation/import-export-format-2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/code-generation/import-export-format/webpack.config.js b/test/configCases/code-generation/import-export-format/webpack.config.js index d68b9b7d455..9e7f400a932 100644 --- a/test/configCases/code-generation/import-export-format/webpack.config.js +++ b/test/configCases/code-generation/import-export-format/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { node: { diff --git a/test/configCases/code-generation/re-export-namespace-concat/test.filter.js b/test/configCases/code-generation/re-export-namespace-concat/test.filter.js index 9486c09cf37..53cf6da0c34 100644 --- a/test/configCases/code-generation/re-export-namespace-concat/test.filter.js +++ b/test/configCases/code-generation/re-export-namespace-concat/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); module.exports = () => supportsOptionalChaining(); diff --git a/test/configCases/code-generation/re-export-namespace-concat/webpack.config.js b/test/configCases/code-generation/re-export-namespace-concat/webpack.config.js index 7e1057f2f3c..989e9f705d3 100644 --- a/test/configCases/code-generation/re-export-namespace-concat/webpack.config.js +++ b/test/configCases/code-generation/re-export-namespace-concat/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { node: { diff --git a/test/configCases/code-generation/re-export-namespace/test.filter.js b/test/configCases/code-generation/re-export-namespace/test.filter.js index 9486c09cf37..53cf6da0c34 100644 --- a/test/configCases/code-generation/re-export-namespace/test.filter.js +++ b/test/configCases/code-generation/re-export-namespace/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); module.exports = () => supportsOptionalChaining(); diff --git a/test/configCases/code-generation/re-export-namespace/webpack.config.js b/test/configCases/code-generation/re-export-namespace/webpack.config.js index 5da817461a6..56c2272fe51 100644 --- a/test/configCases/code-generation/re-export-namespace/webpack.config.js +++ b/test/configCases/code-generation/re-export-namespace/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { node: { diff --git a/test/configCases/code-generation/require-context-id/warnings.js b/test/configCases/code-generation/require-context-id/warnings.js index 70fefa270fb..fdcecb3be97 100644 --- a/test/configCases/code-generation/require-context-id/warnings.js +++ b/test/configCases/code-generation/require-context-id/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/hashed/, /deprecated/]]; diff --git a/test/configCases/code-generation/require-context-id/webpack.config.js b/test/configCases/code-generation/require-context-id/webpack.config.js index e3f2e0b3bf3..ecd9cf88c1f 100644 --- a/test/configCases/code-generation/require-context-id/webpack.config.js +++ b/test/configCases/code-generation/require-context-id/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/code-generation/use-strict/webpack.config.js b/test/configCases/code-generation/use-strict/webpack.config.js index 877d7411e93..50b4230e7a4 100644 --- a/test/configCases/code-generation/use-strict/webpack.config.js +++ b/test/configCases/code-generation/use-strict/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { node: { diff --git a/test/configCases/compiletime/error-not-found/errors.js b/test/configCases/compiletime/error-not-found/errors.js index 59aab9d5ba7..fbebeba18d8 100644 --- a/test/configCases/compiletime/error-not-found/errors.js +++ b/test/configCases/compiletime/error-not-found/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [/not found/]; diff --git a/test/configCases/compiletime/error-not-found/webpack.config.js b/test/configCases/compiletime/error-not-found/webpack.config.js index e3128523e3e..15570222658 100644 --- a/test/configCases/compiletime/error-not-found/webpack.config.js +++ b/test/configCases/compiletime/error-not-found/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/compiletime/exports-presence/errors.js b/test/configCases/compiletime/exports-presence/errors.js index 257f6952694..ec92a757779 100644 --- a/test/configCases/compiletime/exports-presence/errors.js +++ b/test/configCases/compiletime/exports-presence/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { moduleName: /ccc/, diff --git a/test/configCases/compiletime/exports-presence/warnings.js b/test/configCases/compiletime/exports-presence/warnings.js index ca07ad2aacf..b12013bf0e5 100644 --- a/test/configCases/compiletime/exports-presence/warnings.js +++ b/test/configCases/compiletime/exports-presence/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { moduleName: /bbb/, diff --git a/test/configCases/compiletime/exports-presence/webpack.config.js b/test/configCases/compiletime/exports-presence/webpack.config.js index 7634dfd7a65..307b36be00b 100644 --- a/test/configCases/compiletime/exports-presence/webpack.config.js +++ b/test/configCases/compiletime/exports-presence/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/compiletime/warn-not-found/warnings.js b/test/configCases/compiletime/warn-not-found/warnings.js index 59aab9d5ba7..fbebeba18d8 100644 --- a/test/configCases/compiletime/warn-not-found/warnings.js +++ b/test/configCases/compiletime/warn-not-found/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [/not found/]; diff --git a/test/configCases/concatenate-modules/destructuring-assignment-with-default-value-and-variable-collision-nested/webpack.config.js b/test/configCases/concatenate-modules/destructuring-assignment-with-default-value-and-variable-collision-nested/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/configCases/concatenate-modules/destructuring-assignment-with-default-value-and-variable-collision-nested/webpack.config.js +++ b/test/configCases/concatenate-modules/destructuring-assignment-with-default-value-and-variable-collision-nested/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/concatenate-modules/destructuring-assignment-with-default-value-and-variable-collision-simple/webpack.config.js b/test/configCases/concatenate-modules/destructuring-assignment-with-default-value-and-variable-collision-simple/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/configCases/concatenate-modules/destructuring-assignment-with-default-value-and-variable-collision-simple/webpack.config.js +++ b/test/configCases/concatenate-modules/destructuring-assignment-with-default-value-and-variable-collision-simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/concatenate-modules/import-module/webpack.config.js b/test/configCases/concatenate-modules/import-module/webpack.config.js index 161c13c0dd5..1b88ae4d4a7 100644 --- a/test/configCases/concatenate-modules/import-module/webpack.config.js +++ b/test/configCases/concatenate-modules/import-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/concatenate-modules/issue-13022/webpack.config.js b/test/configCases/concatenate-modules/issue-13022/webpack.config.js index dbbdda7ead7..c0653e925f9 100644 --- a/test/configCases/concatenate-modules/issue-13022/webpack.config.js +++ b/test/configCases/concatenate-modules/issue-13022/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration[]} */ diff --git a/test/configCases/concatenate-modules/load-chunk-function/test.config.js b/test/configCases/concatenate-modules/load-chunk-function/test.config.js index e4c2d7d4b4a..c5234ed761a 100644 --- a/test/configCases/concatenate-modules/load-chunk-function/test.config.js +++ b/test/configCases/concatenate-modules/load-chunk-function/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["entry1.js", "entry2.js"]; diff --git a/test/configCases/concatenate-modules/load-chunk-function/webpack.config.js b/test/configCases/concatenate-modules/load-chunk-function/webpack.config.js index 1a64af2a394..f340b275eea 100644 --- a/test/configCases/concatenate-modules/load-chunk-function/webpack.config.js +++ b/test/configCases/concatenate-modules/load-chunk-function/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/concatenate-modules/rename-10168/webpack.config.js b/test/configCases/concatenate-modules/rename-10168/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/configCases/concatenate-modules/rename-10168/webpack.config.js +++ b/test/configCases/concatenate-modules/rename-10168/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/concatenate-modules/side-effects/webpack.config.js b/test/configCases/concatenate-modules/side-effects/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/configCases/concatenate-modules/side-effects/webpack.config.js +++ b/test/configCases/concatenate-modules/side-effects/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/concatenate-modules/split-chunk-entry-module/test.config.js b/test/configCases/concatenate-modules/split-chunk-entry-module/test.config.js index ed54956ea13..edc922cf4f9 100644 --- a/test/configCases/concatenate-modules/split-chunk-entry-module/test.config.js +++ b/test/configCases/concatenate-modules/split-chunk-entry-module/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["runtime.js", "common-index_js.js", "main.js"]; diff --git a/test/configCases/concatenate-modules/split-chunk-entry-module/webpack.config.js b/test/configCases/concatenate-modules/split-chunk-entry-module/webpack.config.js index 16ed8a8d82c..bae7ecf962d 100644 --- a/test/configCases/concatenate-modules/split-chunk-entry-module/webpack.config.js +++ b/test/configCases/concatenate-modules/split-chunk-entry-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/container/0-container-full/test.config.js b/test/configCases/container/0-container-full/test.config.js index acc7d2091c8..bd1daf1ba17 100644 --- a/test/configCases/container/0-container-full/test.config.js +++ b/test/configCases/container/0-container-full/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; diff --git a/test/configCases/container/0-container-full/webpack.config.js b/test/configCases/container/0-container-full/webpack.config.js index 3fe8d8bab2c..84a5013a15a 100644 --- a/test/configCases/container/0-container-full/webpack.config.js +++ b/test/configCases/container/0-container-full/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {ConstructorParameters[0]} */ diff --git a/test/configCases/container/0-eager-shared/webpack.config.js b/test/configCases/container/0-eager-shared/webpack.config.js index c01af235fd3..a6e9e60e32a 100644 --- a/test/configCases/container/0-eager-shared/webpack.config.js +++ b/test/configCases/container/0-eager-shared/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; const { dependencies } = require("./package.json"); diff --git a/test/configCases/container/0-transitive-overriding/webpack.config.js b/test/configCases/container/0-transitive-overriding/webpack.config.js index 82dd86951de..724076dd97d 100644 --- a/test/configCases/container/0-transitive-overriding/webpack.config.js +++ b/test/configCases/container/0-transitive-overriding/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/1-container-full/test.config.js b/test/configCases/container/1-container-full/test.config.js index acc7d2091c8..bd1daf1ba17 100644 --- a/test/configCases/container/1-container-full/test.config.js +++ b/test/configCases/container/1-container-full/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; diff --git a/test/configCases/container/1-container-full/webpack.config.js b/test/configCases/container/1-container-full/webpack.config.js index 0c9d66c16d2..130d25ac128 100644 --- a/test/configCases/container/1-container-full/webpack.config.js +++ b/test/configCases/container/1-container-full/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; const common = { diff --git a/test/configCases/container/1-transitive-overriding/webpack.config.js b/test/configCases/container/1-transitive-overriding/webpack.config.js index 71b4410b9c8..c4909db5bc2 100644 --- a/test/configCases/container/1-transitive-overriding/webpack.config.js +++ b/test/configCases/container/1-transitive-overriding/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/2-container-full/webpack.config.js b/test/configCases/container/2-container-full/webpack.config.js index 5f2872dc80e..bbe627a943c 100644 --- a/test/configCases/container/2-container-full/webpack.config.js +++ b/test/configCases/container/2-container-full/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/2-transitive-overriding/webpack.config.js b/test/configCases/container/2-transitive-overriding/webpack.config.js index 3d384985ccb..b0c9812e447 100644 --- a/test/configCases/container/2-transitive-overriding/webpack.config.js +++ b/test/configCases/container/2-transitive-overriding/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/3-container-full/warnings.js b/test/configCases/container/3-container-full/warnings.js index 55cee80a314..43d2a210b74 100644 --- a/test/configCases/container/3-container-full/warnings.js +++ b/test/configCases/container/3-container-full/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/No version specified and unable to automatically determine one/] ]; diff --git a/test/configCases/container/3-container-full/webpack.config.js b/test/configCases/container/3-container-full/webpack.config.js index 1d38b82ba2b..9c694a12d8e 100644 --- a/test/configCases/container/3-container-full/webpack.config.js +++ b/test/configCases/container/3-container-full/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/circular/test.config.js b/test/configCases/container/circular/test.config.js index c0ec1472777..d9a38d25b63 100644 --- a/test/configCases/container/circular/test.config.js +++ b/test/configCases/container/circular/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return "./main.js"; diff --git a/test/configCases/container/circular/webpack.config.js b/test/configCases/container/circular/webpack.config.js index efdae9fc5da..1e0e2528a58 100644 --- a/test/configCases/container/circular/webpack.config.js +++ b/test/configCases/container/circular/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** diff --git a/test/configCases/container/container-entry-overridables/webpack.config.js b/test/configCases/container/container-entry-overridables/webpack.config.js index 770f5f4deac..709ff85a227 100644 --- a/test/configCases/container/container-entry-overridables/webpack.config.js +++ b/test/configCases/container/container-entry-overridables/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ContainerPlugin } = require("../../../../").container; const { ConsumeSharedPlugin } = require("../../../../").sharing; diff --git a/test/configCases/container/container-entry/webpack.config.js b/test/configCases/container/container-entry/webpack.config.js index 414cb69b382..5ab7e37c838 100644 --- a/test/configCases/container/container-entry/webpack.config.js +++ b/test/configCases/container/container-entry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ContainerPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/container-reference-override/test.config.js b/test/configCases/container/container-reference-override/test.config.js index 28fa0bd58bd..5006ea774c0 100644 --- a/test/configCases/container/container-reference-override/test.config.js +++ b/test/configCases/container/container-reference-override/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { let ss; diff --git a/test/configCases/container/container-reference-override/webpack.config.js b/test/configCases/container/container-reference-override/webpack.config.js index 8f76ef90daa..2b9285e98d0 100644 --- a/test/configCases/container/container-reference-override/webpack.config.js +++ b/test/configCases/container/container-reference-override/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ContainerReferencePlugin } = require("../../../../").container; const { ProvideSharedPlugin } = require("../../../../").sharing; diff --git a/test/configCases/container/container-reference/test.config.js b/test/configCases/container/container-reference/test.config.js index 96099b8e50f..86191d988c8 100644 --- a/test/configCases/container/container-reference/test.config.js +++ b/test/configCases/container/container-reference/test.config.js @@ -1,8 +1,10 @@ +"use strict"; + module.exports = { moduleScope(scope) { scope.ABC = { get(module) { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => { resolve(() => `abc ${module}`); }, 100); @@ -11,7 +13,7 @@ module.exports = { }; scope.DEF = { get(module) { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => { resolve(() => ({ __esModule: true, diff --git a/test/configCases/container/container-reference/webpack.config.js b/test/configCases/container/container-reference/webpack.config.js index a73f9f65dfa..3aa1cad31e9 100644 --- a/test/configCases/container/container-reference/webpack.config.js +++ b/test/configCases/container/container-reference/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ContainerReferencePlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/eager-shared/webpack.config.js b/test/configCases/container/eager-shared/webpack.config.js index c73f3ade6b0..ba1b50fd3ec 100644 --- a/test/configCases/container/eager-shared/webpack.config.js +++ b/test/configCases/container/eager-shared/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; const { dependencies } = require("./package.json"); diff --git a/test/configCases/container/error-handling/webpack.config.js b/test/configCases/container/error-handling/webpack.config.js index 2e9ac09f1f8..203e3ab213c 100644 --- a/test/configCases/container/error-handling/webpack.config.js +++ b/test/configCases/container/error-handling/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/exposed-overridables/webpack.config.js b/test/configCases/container/exposed-overridables/webpack.config.js index 525c2710ba0..bfc87cb2ba6 100644 --- a/test/configCases/container/exposed-overridables/webpack.config.js +++ b/test/configCases/container/exposed-overridables/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/module-federation-with-shareScope/test.config.js b/test/configCases/container/module-federation-with-shareScope/test.config.js index acc7d2091c8..bd1daf1ba17 100644 --- a/test/configCases/container/module-federation-with-shareScope/test.config.js +++ b/test/configCases/container/module-federation-with-shareScope/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; diff --git a/test/configCases/container/module-federation-with-shareScope/webpack.config.js b/test/configCases/container/module-federation-with-shareScope/webpack.config.js index 218ebc25ddb..319f25f98f2 100644 --- a/test/configCases/container/module-federation-with-shareScope/webpack.config.js +++ b/test/configCases/container/module-federation-with-shareScope/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; const common = { diff --git a/test/configCases/container/module-federation/test.config.js b/test/configCases/container/module-federation/test.config.js index bd9d9060de0..0801dbda35d 100644 --- a/test/configCases/container/module-federation/test.config.js +++ b/test/configCases/container/module-federation/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const System = require("../../../helpers/fakeSystem"); module.exports = { @@ -9,7 +11,7 @@ module.exports = { scope.System = System; System.set("ABC", { get(module) { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => { resolve(() => `abc ${module}`); }, 100); @@ -18,7 +20,7 @@ module.exports = { }); System.set("DEF", { get(module) { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => { resolve(() => ({ __esModule: true, diff --git a/test/configCases/container/module-federation/webpack.config.js b/test/configCases/container/module-federation/webpack.config.js index 1b4c62d6f34..66abc2e02db 100644 --- a/test/configCases/container/module-federation/webpack.config.js +++ b/test/configCases/container/module-federation/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** diff --git a/test/configCases/container/no-shared/webpack.config.js b/test/configCases/container/no-shared/webpack.config.js index bce073f4eb2..176908407eb 100644 --- a/test/configCases/container/no-shared/webpack.config.js +++ b/test/configCases/container/no-shared/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/reference-hoisting/test.config.js b/test/configCases/container/reference-hoisting/test.config.js index acc7d2091c8..bd1daf1ba17 100644 --- a/test/configCases/container/reference-hoisting/test.config.js +++ b/test/configCases/container/reference-hoisting/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; diff --git a/test/configCases/container/reference-hoisting/webpack.config.js b/test/configCases/container/reference-hoisting/webpack.config.js index 98e4d1fbc76..85191bf44dd 100644 --- a/test/configCases/container/reference-hoisting/webpack.config.js +++ b/test/configCases/container/reference-hoisting/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {ConstructorParameters[0]} */ diff --git a/test/configCases/container/track-initial-chunks/test.config.js b/test/configCases/container/track-initial-chunks/test.config.js index acc7d2091c8..bd1daf1ba17 100644 --- a/test/configCases/container/track-initial-chunks/test.config.js +++ b/test/configCases/container/track-initial-chunks/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; diff --git a/test/configCases/container/track-initial-chunks/webpack.config.js b/test/configCases/container/track-initial-chunks/webpack.config.js index 9036608f1fd..6dcf61a53a3 100644 --- a/test/configCases/container/track-initial-chunks/webpack.config.js +++ b/test/configCases/container/track-initial-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../../").container; /** @type {ConstructorParameters[0]} */ diff --git a/test/configCases/contenthash/assets/test.config.js b/test/configCases/contenthash/assets/test.config.js index 7523cfa4617..890776fa8db 100644 --- a/test/configCases/contenthash/assets/test.config.js +++ b/test/configCases/contenthash/assets/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const findOutputFiles = require("../../../helpers/findOutputFiles"); const allAssets = new Set(); diff --git a/test/configCases/contenthash/assets/webpack.config.js b/test/configCases/contenthash/assets/webpack.config.js index 1d6fb419763..4bb1f731c24 100644 --- a/test/configCases/contenthash/assets/webpack.config.js +++ b/test/configCases/contenthash/assets/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/contenthash/css-generator-options/test.config.js b/test/configCases/contenthash/css-generator-options/test.config.js index 1002051a2b8..7f09af03c97 100644 --- a/test/configCases/contenthash/css-generator-options/test.config.js +++ b/test/configCases/contenthash/css-generator-options/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const findOutputFiles = require("../../../helpers/findOutputFiles"); const allCss = new Set(); diff --git a/test/configCases/contenthash/css-generator-options/webpack.config.js b/test/configCases/contenthash/css-generator-options/webpack.config.js index 84979d5e7a7..8b27cfb9631 100644 --- a/test/configCases/contenthash/css-generator-options/webpack.config.js +++ b/test/configCases/contenthash/css-generator-options/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ const common = { target: "web", @@ -81,7 +83,7 @@ module.exports = [ type: "css/module", /** @type {GeneratorOptionsByModuleTypeKnown["css/module"]} */ generator: { - exportsConvention: name => name.toUpperCase() + exportsConvention: (name) => name.toUpperCase() } } ] diff --git a/test/configCases/contenthash/include-chunk-id/test.config.js b/test/configCases/contenthash/include-chunk-id/test.config.js index cc45b50943a..e013cd48f4d 100644 --- a/test/configCases/contenthash/include-chunk-id/test.config.js +++ b/test/configCases/contenthash/include-chunk-id/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const findOutputFiles = require("../../../helpers/findOutputFiles"); const allFilenameHashes = new Set(); diff --git a/test/configCases/contenthash/include-chunk-id/webpack.config.js b/test/configCases/contenthash/include-chunk-id/webpack.config.js index 004bb036cb1..b280e8df5e9 100644 --- a/test/configCases/contenthash/include-chunk-id/webpack.config.js +++ b/test/configCases/contenthash/include-chunk-id/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/contenthash/module-ids-size/test.config.js b/test/configCases/contenthash/module-ids-size/test.config.js index 32bb896bf25..19bdf046f81 100644 --- a/test/configCases/contenthash/module-ids-size/test.config.js +++ b/test/configCases/contenthash/module-ids-size/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const findOutputFiles = require("../../../helpers/findOutputFiles"); const allAssets = new Set(); diff --git a/test/configCases/contenthash/module-ids-size/webpack.config.js b/test/configCases/contenthash/module-ids-size/webpack.config.js index 2b768573875..cc9e6a3edf3 100644 --- a/test/configCases/contenthash/module-ids-size/webpack.config.js +++ b/test/configCases/contenthash/module-ids-size/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = [ { diff --git a/test/configCases/contenthash/salt/test.config.js b/test/configCases/contenthash/salt/test.config.js index 9328ad9b72f..1095e974ac0 100644 --- a/test/configCases/contenthash/salt/test.config.js +++ b/test/configCases/contenthash/salt/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const findOutputFiles = require("../../../helpers/findOutputFiles"); const allAssets = new Set(); diff --git a/test/configCases/contenthash/salt/webpack.config.js b/test/configCases/contenthash/salt/webpack.config.js index 1ec1c83b9d9..8e09ee36d02 100644 --- a/test/configCases/contenthash/salt/webpack.config.js +++ b/test/configCases/contenthash/salt/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/context-modules/context-options/webpack.config.js b/test/configCases/context-modules/context-options/webpack.config.js index 3583b70a321..27313115dcd 100644 --- a/test/configCases/context-modules/context-options/webpack.config.js +++ b/test/configCases/context-modules/context-options/webpack.config.js @@ -1,2 +1,4 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = {}; diff --git a/test/configCases/context-modules/exclusion/webpack.config.js b/test/configCases/context-modules/exclusion/webpack.config.js index 80ca2b09305..f9198e5e8c3 100644 --- a/test/configCases/context-modules/exclusion/webpack.config.js +++ b/test/configCases/context-modules/exclusion/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/context-modules/replacement-System.import/webpack.config.js b/test/configCases/context-modules/replacement-System.import/webpack.config.js index 102b3879caa..6237be1a8ac 100644 --- a/test/configCases/context-modules/replacement-System.import/webpack.config.js +++ b/test/configCases/context-modules/replacement-System.import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + var path = require("path"); var webpack = require("../../../../"); diff --git a/test/configCases/context-modules/replacement-a/webpack.config.js b/test/configCases/context-modules/replacement-a/webpack.config.js index 8d86fa0a012..013250710e5 100644 --- a/test/configCases/context-modules/replacement-a/webpack.config.js +++ b/test/configCases/context-modules/replacement-a/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/context-modules/replacement-b/webpack.config.js b/test/configCases/context-modules/replacement-b/webpack.config.js index 9fa2c022ff1..3877a73ba13 100644 --- a/test/configCases/context-modules/replacement-b/webpack.config.js +++ b/test/configCases/context-modules/replacement-b/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/context-modules/replacement-c/webpack.config.js b/test/configCases/context-modules/replacement-c/webpack.config.js index 6c00f0d0b04..4a7c9fc4ee0 100644 --- a/test/configCases/context-modules/replacement-c/webpack.config.js +++ b/test/configCases/context-modules/replacement-c/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/context-modules/replacement-d/webpack.config.js b/test/configCases/context-modules/replacement-d/webpack.config.js index fdc797fc227..f4523d7ef82 100644 --- a/test/configCases/context-modules/replacement-d/webpack.config.js +++ b/test/configCases/context-modules/replacement-d/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/context-modules/replacement-e/webpack.config.js b/test/configCases/context-modules/replacement-e/webpack.config.js index 291621800d8..8e048e9b496 100644 --- a/test/configCases/context-modules/replacement-e/webpack.config.js +++ b/test/configCases/context-modules/replacement-e/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/context-modules/replacement-f/webpack.config.js b/test/configCases/context-modules/replacement-f/webpack.config.js index 84e11a8fd32..e1bf78c0829 100644 --- a/test/configCases/context-modules/replacement-f/webpack.config.js +++ b/test/configCases/context-modules/replacement-f/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/crossorigin/set-crossorigin/webpack.config.js b/test/configCases/crossorigin/set-crossorigin/webpack.config.js index 10096afbdf0..82db627da9b 100644 --- a/test/configCases/crossorigin/set-crossorigin/webpack.config.js +++ b/test/configCases/crossorigin/set-crossorigin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/async-chunk-node/webpack.config.js b/test/configCases/css/async-chunk-node/webpack.config.js index a91e72d278a..8cfa4eda679 100644 --- a/test/configCases/css/async-chunk-node/webpack.config.js +++ b/test/configCases/css/async-chunk-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", diff --git a/test/configCases/css/basic-dynamic-only/test.config.js b/test/configCases/css/basic-dynamic-only/test.config.js index 5e4602a59e2..df2ced03ebd 100644 --- a/test/configCases/css/basic-dynamic-only/test.config.js +++ b/test/configCases/css/basic-dynamic-only/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["style_css.bundle0.js", "bundle0.js"]; diff --git a/test/configCases/css/basic-dynamic-only/webpack.config.js b/test/configCases/css/basic-dynamic-only/webpack.config.js index eb8b0ebb1bd..0525a266f2b 100644 --- a/test/configCases/css/basic-dynamic-only/webpack.config.js +++ b/test/configCases/css/basic-dynamic-only/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/basic-esm-target-node/webpack.config.js b/test/configCases/css/basic-esm-target-node/webpack.config.js index 91b082607b5..e24569bec1f 100644 --- a/test/configCases/css/basic-esm-target-node/webpack.config.js +++ b/test/configCases/css/basic-esm-target-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", diff --git a/test/configCases/css/basic-esm-target-web/test.config.js b/test/configCases/css/basic-esm-target-web/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/basic-esm-target-web/test.config.js +++ b/test/configCases/css/basic-esm-target-web/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/basic-esm-target-web/webpack.config.js b/test/configCases/css/basic-esm-target-web/webpack.config.js index 673fa0ebded..44bb54f4999 100644 --- a/test/configCases/css/basic-esm-target-web/webpack.config.js +++ b/test/configCases/css/basic-esm-target-web/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/basic-initial-only/test.config.js b/test/configCases/css/basic-initial-only/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/basic-initial-only/test.config.js +++ b/test/configCases/css/basic-initial-only/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/basic-initial-only/webpack.config.js b/test/configCases/css/basic-initial-only/webpack.config.js index eb8b0ebb1bd..0525a266f2b 100644 --- a/test/configCases/css/basic-initial-only/webpack.config.js +++ b/test/configCases/css/basic-initial-only/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/basic-web-async/test.config.js b/test/configCases/css/basic-web-async/test.config.js index 41c0f0a0c7f..14346f87a41 100644 --- a/test/configCases/css/basic-web-async/test.config.js +++ b/test/configCases/css/basic-web-async/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["style2_css.bundle0.js", "bundle0.js"]; diff --git a/test/configCases/css/basic-web-async/webpack.config.js b/test/configCases/css/basic-web-async/webpack.config.js index eb8b0ebb1bd..0525a266f2b 100644 --- a/test/configCases/css/basic-web-async/webpack.config.js +++ b/test/configCases/css/basic-web-async/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/basic/test.config.js b/test/configCases/css/basic/test.config.js index 41c0f0a0c7f..14346f87a41 100644 --- a/test/configCases/css/basic/test.config.js +++ b/test/configCases/css/basic/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["style2_css.bundle0.js", "bundle0.js"]; diff --git a/test/configCases/css/basic/webpack.config.js b/test/configCases/css/basic/webpack.config.js index cfb8e5c0346..3cc31116df2 100644 --- a/test/configCases/css/basic/webpack.config.js +++ b/test/configCases/css/basic/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/build-http/test.config.js b/test/configCases/css/build-http/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/build-http/test.config.js +++ b/test/configCases/css/build-http/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/build-http/webpack.config.js b/test/configCases/css/build-http/webpack.config.js index b70654f3461..c10719bae0b 100644 --- a/test/configCases/css/build-http/webpack.config.js +++ b/test/configCases/css/build-http/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/css/cjs-module-syntax/test.config.js b/test/configCases/css/cjs-module-syntax/test.config.js index d8b1cd2e6ed..0ec2334b583 100644 --- a/test/configCases/css/cjs-module-syntax/test.config.js +++ b/test/configCases/css/cjs-module-syntax/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { if (scope.document) { diff --git a/test/configCases/css/cjs-module-syntax/webpack.config.js b/test/configCases/css/cjs-module-syntax/webpack.config.js index c99de4b1ee8..006060da2d1 100644 --- a/test/configCases/css/cjs-module-syntax/webpack.config.js +++ b/test/configCases/css/cjs-module-syntax/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = [ { diff --git a/test/configCases/css/conflicting-order/test.config.js b/test/configCases/css/conflicting-order/test.config.js index 457af618640..cddd59d788a 100644 --- a/test/configCases/css/conflicting-order/test.config.js +++ b/test/configCases/css/conflicting-order/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["css.bundle0.js", "lazy4_js.bundle0.js", "bundle0.js"]; diff --git a/test/configCases/css/conflicting-order/warnings.js b/test/configCases/css/conflicting-order/warnings.js index bf0f21a942d..1541f2c5f9a 100644 --- a/test/configCases/css/conflicting-order/warnings.js +++ b/test/configCases/css/conflicting-order/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Conflicting order between css \.\/b\.css and css \.\/c\.css/] ]; diff --git a/test/configCases/css/conflicting-order/webpack.config.js b/test/configCases/css/conflicting-order/webpack.config.js index a5f3136eaa4..d761c43534a 100644 --- a/test/configCases/css/conflicting-order/webpack.config.js +++ b/test/configCases/css/conflicting-order/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/contenthash/test.config.js b/test/configCases/css/contenthash/test.config.js index 6a9d21daf11..74d11b962a8 100644 --- a/test/configCases/css/contenthash/test.config.js +++ b/test/configCases/css/contenthash/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const findOutputFiles = require("../../../helpers/findOutputFiles"); module.exports = { diff --git a/test/configCases/css/contenthash/webpack.config.js b/test/configCases/css/contenthash/webpack.config.js index 2f799e18d58..faf9a298ba2 100644 --- a/test/configCases/css/contenthash/webpack.config.js +++ b/test/configCases/css/contenthash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/css-auto/test.config.js b/test/configCases/css/css-auto/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/css-auto/test.config.js +++ b/test/configCases/css/css-auto/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/css-auto/webpack.config.js b/test/configCases/css/css-auto/webpack.config.js index a9ddb2d852d..ffdefdb5702 100644 --- a/test/configCases/css/css-auto/webpack.config.js +++ b/test/configCases/css/css-auto/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/css-modules-broken-keyframes/webpack.config.js b/test/configCases/css/css-modules-broken-keyframes/webpack.config.js index 6bc17b0232d..7a17c20add7 100644 --- a/test/configCases/css/css-modules-broken-keyframes/webpack.config.js +++ b/test/configCases/css/css-modules-broken-keyframes/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); @@ -16,10 +18,10 @@ module.exports = (env, { testPath }) => ({ maxLength: 3, failOnConflict: true, fixedLength: true, - test: m => m.type.startsWith("css") + test: (m) => m.type.startsWith("css") }), new webpack.experiments.ids.SyncModuleIdsPlugin({ - test: m => m.type.startsWith("css"), + test: (m) => m.type.startsWith("css"), path: path.resolve(testPath, "module-ids.json"), mode: "create" }) diff --git a/test/configCases/css/css-modules-in-node/warnings.js b/test/configCases/css/css-modules-in-node/warnings.js index 0f96e43f9bf..5c044f7af52 100644 --- a/test/configCases/css/css-modules-in-node/warnings.js +++ b/test/configCases/css/css-modules-in-node/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = require("../css-modules/warnings"); for (const item of module.exports.slice(0, module.exports.length / 2)) { diff --git a/test/configCases/css/css-modules-in-node/webpack.config.js b/test/configCases/css/css-modules-in-node/webpack.config.js index 997e2ebb2b9..8490401ce9e 100644 --- a/test/configCases/css/css-modules-in-node/webpack.config.js +++ b/test/configCases/css/css-modules-in-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); @@ -40,7 +42,7 @@ module.exports = (env, { testPath }) => [ maxLength: 3, failOnConflict: true, fixedLength: true, - test: m => m.type.startsWith("css") + test: (m) => m.type.startsWith("css") }) ], module: { @@ -69,7 +71,7 @@ module.exports = (env, { testPath }) => [ }, plugins: [ new webpack.experiments.ids.SyncModuleIdsPlugin({ - test: m => m.type.startsWith("css"), + test: (m) => m.type.startsWith("css"), path: path.resolve(testPath, "../css-modules/module-ids.json"), mode: "read" }) diff --git a/test/configCases/css/css-modules-no-space/warnings.js b/test/configCases/css/css-modules-no-space/warnings.js index 32966cfb211..77b2d53afc9 100644 --- a/test/configCases/css/css-modules-no-space/warnings.js +++ b/test/configCases/css/css-modules-no-space/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/Missing whitespace after ':global' in ':global\.class \{/], [ diff --git a/test/configCases/css/css-modules-no-space/webpack.config.js b/test/configCases/css/css-modules-no-space/webpack.config.js index 31bf688dada..e4515a07c19 100644 --- a/test/configCases/css/css-modules-no-space/webpack.config.js +++ b/test/configCases/css/css-modules-no-space/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {() => import("../../../../").Configuration} */ module.exports = () => ({ target: "web", diff --git a/test/configCases/css/css-modules/test.config.js b/test/configCases/css/css-modules/test.config.js index 002bd6add7f..494e6787fca 100644 --- a/test/configCases/css/css-modules/test.config.js +++ b/test/configCases/css/css-modules/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return i === 0 diff --git a/test/configCases/css/css-modules/warnings.js b/test/configCases/css/css-modules/warnings.js index be7a71b2f00..987dcad0139 100644 --- a/test/configCases/css/css-modules/warnings.js +++ b/test/configCases/css/css-modules/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/export 'global' \(imported as 'style'\) was not found/], [/export 'nested2' \(imported as 'style'\) was not found/], diff --git a/test/configCases/css/css-modules/webpack.config.js b/test/configCases/css/css-modules/webpack.config.js index c9070ea0cd1..78c7a28643f 100644 --- a/test/configCases/css/css-modules/webpack.config.js +++ b/test/configCases/css/css-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); @@ -56,10 +58,10 @@ module.exports = (env, { testPath }) => [ maxLength: 3, failOnConflict: true, fixedLength: true, - test: m => m.type.startsWith("css") + test: (m) => m.type.startsWith("css") }), new webpack.experiments.ids.SyncModuleIdsPlugin({ - test: m => m.type.startsWith("css"), + test: (m) => m.type.startsWith("css"), path: path.resolve(testPath, "module-ids.json"), mode: "create" }) diff --git a/test/configCases/css/css-order-concatenate-modules/index.js b/test/configCases/css/css-order-concatenate-modules/index.js new file mode 100644 index 00000000000..faf7574346a --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/index.js @@ -0,0 +1,15 @@ +import { c, b, a } from "dep"; + +c() +b() +a() + +it("keep consistent css order", function() { + const fs = __non_webpack_require__("fs"); + let source = fs.readFileSync(__dirname + "/main.css", "utf-8"); + expect(removeComments(source)).toMatchSnapshot() +}); + +function removeComments(source) { + return source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, ""); +} diff --git a/test/configCases/css/css-order-concatenate-modules/node_modules/dep/a.css b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/a.css new file mode 100644 index 00000000000..04af14f0c01 --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/a.css @@ -0,0 +1,3 @@ +.a { + color: red; +} \ No newline at end of file diff --git a/test/configCases/css/css-order-concatenate-modules/node_modules/dep/a.js b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/a.js new file mode 100644 index 00000000000..de7acb49ee7 --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/a.js @@ -0,0 +1,2 @@ +import "./a.css" +export function a() {} \ No newline at end of file diff --git a/test/configCases/css/css-order-concatenate-modules/node_modules/dep/b.css b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/b.css new file mode 100644 index 00000000000..43c4cc6d378 --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/b.css @@ -0,0 +1,3 @@ +.b{ + color: green; +} \ No newline at end of file diff --git a/test/configCases/css/css-order-concatenate-modules/node_modules/dep/b.js b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/b.js new file mode 100644 index 00000000000..82aff859974 --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/b.js @@ -0,0 +1,2 @@ +import "./b.css" +export function b() {} \ No newline at end of file diff --git a/test/configCases/css/css-order-concatenate-modules/node_modules/dep/c.css b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/c.css new file mode 100644 index 00000000000..8c7886af387 --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/c.css @@ -0,0 +1,3 @@ +.c{ + color: black; +} \ No newline at end of file diff --git a/test/configCases/css/css-order-concatenate-modules/node_modules/dep/c.js b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/c.js new file mode 100644 index 00000000000..0813f955fdd --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/c.js @@ -0,0 +1,2 @@ +import "./c.css" +export function c() {} \ No newline at end of file diff --git a/test/configCases/css/css-order-concatenate-modules/node_modules/dep/index.js b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/index.js new file mode 100644 index 00000000000..6fc01ace2a8 --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/index.js @@ -0,0 +1,3 @@ +export * from "./a.js" +export * from "./b.js" +export * from "./c.js" diff --git a/test/configCases/css/css-order-concatenate-modules/node_modules/dep/package.json b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/package.json new file mode 100644 index 00000000000..644d902d8e0 --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/node_modules/dep/package.json @@ -0,0 +1,6 @@ +{ + "name": "dep", + "version": "1.0.0", + "type": "module", + "sideEffects": false +} diff --git a/test/configCases/css/css-order-concatenate-modules/package.json b/test/configCases/css/css-order-concatenate-modules/package.json new file mode 100644 index 00000000000..f9f7ed01bb1 --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/package.json @@ -0,0 +1,8 @@ +{ + "name": "css-order", + "version": "1.0.0", + "sideEffects": false, + "devDependencies": { + "mini-css-extract-plugin": "^2.9.0" + } +} diff --git a/test/configCases/css/css-order-concatenate-modules/webpack.config.js b/test/configCases/css/css-order-concatenate-modules/webpack.config.js new file mode 100644 index 00000000000..5decd0f98e5 --- /dev/null +++ b/test/configCases/css/css-order-concatenate-modules/webpack.config.js @@ -0,0 +1,46 @@ +"use strict"; + +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); + +/** @type {import("../../../../").Configuration} */ +module.exports = { + devtool: false, + target: "web", + entry: "./index.js", + mode: "development", + optimization: { + concatenateModules: true + }, + module: { + rules: [ + { + test: /\.css$/, + use: [ + { + loader: MiniCssExtractPlugin.loader + }, + { + loader: "css-loader", + options: { + esModule: true, + modules: { + namedExport: false, + localIdentName: "[name]" + } + } + } + ], + sideEffects: true + } + ] + }, + plugins: [ + new MiniCssExtractPlugin({ + filename: "[name].css" + }) + ], + node: { + __dirname: false, + __filename: false + } +}; diff --git a/test/configCases/css/css-order-reexport/webpack.config.js b/test/configCases/css/css-order-reexport/webpack.config.js index 4d2ad0fd32a..2d328bea81c 100644 --- a/test/configCases/css/css-order-reexport/webpack.config.js +++ b/test/configCases/css/css-order-reexport/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MiniCssExtractPlugin = require("mini-css-extract-plugin"); /** @type {import("../../../../types").Configuration} */ diff --git a/test/configCases/css/css-order/webpack.config.js b/test/configCases/css/css-order/webpack.config.js index d3ee73b99a4..396be2a51c5 100644 --- a/test/configCases/css/css-order/webpack.config.js +++ b/test/configCases/css/css-order/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MiniCssExtractPlugin = require("mini-css-extract-plugin"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/css/css-order2/webpack.config.js b/test/configCases/css/css-order2/webpack.config.js index 4231389feea..c128b4f57d2 100644 --- a/test/configCases/css/css-order2/webpack.config.js +++ b/test/configCases/css/css-order2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MiniCssExtractPlugin = require("mini-css-extract-plugin"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/css/css-order3/webpack.config.js b/test/configCases/css/css-order3/webpack.config.js index 4231389feea..c128b4f57d2 100644 --- a/test/configCases/css/css-order3/webpack.config.js +++ b/test/configCases/css/css-order3/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MiniCssExtractPlugin = require("mini-css-extract-plugin"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/css/css-types/test.config.js b/test/configCases/css/css-types/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/css-types/test.config.js +++ b/test/configCases/css/css-types/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/css-types/webpack.config.js b/test/configCases/css/css-types/webpack.config.js index 12ea75460e6..4157141bf55 100644 --- a/test/configCases/css/css-types/webpack.config.js +++ b/test/configCases/css/css-types/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/default-exports-parser-options/webpack.config.js b/test/configCases/css/default-exports-parser-options/webpack.config.js index b7d7852b059..8d39c5a9ff8 100644 --- a/test/configCases/css/default-exports-parser-options/webpack.config.js +++ b/test/configCases/css/default-exports-parser-options/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", diff --git a/test/configCases/css/escape-unescape/test.config.js b/test/configCases/css/escape-unescape/test.config.js index 937cd273f4b..b601ba4207a 100644 --- a/test/configCases/css/escape-unescape/test.config.js +++ b/test/configCases/css/escape-unescape/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["bundle0.js"]; diff --git a/test/configCases/css/escape-unescape/webpack.config.js b/test/configCases/css/escape-unescape/webpack.config.js index fb903c5cfa6..199853eba87 100644 --- a/test/configCases/css/escape-unescape/webpack.config.js +++ b/test/configCases/css/escape-unescape/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/css/exports-convention/test.config.js b/test/configCases/css/exports-convention/test.config.js index 05db19fcc48..a962de5ad78 100644 --- a/test/configCases/css/exports-convention/test.config.js +++ b/test/configCases/css/exports-convention/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return [ diff --git a/test/configCases/css/exports-convention/webpack.config.js b/test/configCases/css/exports-convention/webpack.config.js index b05d64aa4ea..a2f12652a6a 100644 --- a/test/configCases/css/exports-convention/webpack.config.js +++ b/test/configCases/css/exports-convention/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @typedef {import("../../../../").GeneratorOptionsByModuleTypeKnown} GeneratorOptionsByModuleTypeKnown */ @@ -46,7 +48,7 @@ const common = { resourceQuery: /\?upper$/, /** @type {GeneratorOptionsByModuleTypeKnown["css/module"]} */ generator: { - exportsConvention: name => name.toUpperCase() + exportsConvention: (name) => name.toUpperCase() } } ] diff --git a/test/configCases/css/exports-in-node/webpack.config.js b/test/configCases/css/exports-in-node/webpack.config.js index a91e72d278a..8cfa4eda679 100644 --- a/test/configCases/css/exports-in-node/webpack.config.js +++ b/test/configCases/css/exports-in-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", diff --git a/test/configCases/css/exports-only-generator-options/test.config.js b/test/configCases/css/exports-only-generator-options/test.config.js index ce962330ea5..cfe0f964059 100644 --- a/test/configCases/css/exports-only-generator-options/test.config.js +++ b/test/configCases/css/exports-only-generator-options/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/css/exports-only-generator-options/webpack.config.js b/test/configCases/css/exports-only-generator-options/webpack.config.js index c2f9beae76e..79d12a89389 100644 --- a/test/configCases/css/exports-only-generator-options/webpack.config.js +++ b/test/configCases/css/exports-only-generator-options/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = [ { diff --git a/test/configCases/css/external-in-node/webpack.config.js b/test/configCases/css/external-in-node/webpack.config.js index 87766dc8dae..86bafcea1e3 100644 --- a/test/configCases/css/external-in-node/webpack.config.js +++ b/test/configCases/css/external-in-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/css/external/test.config.js b/test/configCases/css/external/test.config.js index 35c79b0662e..12841901d7d 100644 --- a/test/configCases/css/external/test.config.js +++ b/test/configCases/css/external/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["125.bundle0.js", "bundle0.js"]; diff --git a/test/configCases/css/external/webpack.config.js b/test/configCases/css/external/webpack.config.js index 72bc3e86f47..1264c194215 100644 --- a/test/configCases/css/external/webpack.config.js +++ b/test/configCases/css/external/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/import-at-middle/test.config.js b/test/configCases/css/import-at-middle/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/import-at-middle/test.config.js +++ b/test/configCases/css/import-at-middle/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/import-at-middle/warnings.js b/test/configCases/css/import-at-middle/warnings.js index dff5dce2b35..2144a7273ff 100644 --- a/test/configCases/css/import-at-middle/warnings.js +++ b/test/configCases/css/import-at-middle/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /Any '@import' rules must precede all other rules/, /Any '@import' rules must precede all other rules/, diff --git a/test/configCases/css/import-at-middle/webpack.config.js b/test/configCases/css/import-at-middle/webpack.config.js index cfb8e5c0346..3cc31116df2 100644 --- a/test/configCases/css/import-at-middle/webpack.config.js +++ b/test/configCases/css/import-at-middle/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/import-different-case/test.config.js b/test/configCases/css/import-different-case/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/import-different-case/test.config.js +++ b/test/configCases/css/import-different-case/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/import-different-case/webpack.config.js b/test/configCases/css/import-different-case/webpack.config.js index cfb8e5c0346..3cc31116df2 100644 --- a/test/configCases/css/import-different-case/webpack.config.js +++ b/test/configCases/css/import-different-case/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/import-module/webpack.config.js b/test/configCases/css/import-module/webpack.config.js index bb3e4a8ef0e..fd7c39f6432 100644 --- a/test/configCases/css/import-module/webpack.config.js +++ b/test/configCases/css/import-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/css/import/errors.js b/test/configCases/css/import/errors.js index 290655b24f3..e75f4006776 100644 --- a/test/configCases/css/import/errors.js +++ b/test/configCases/css/import/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /Can't resolve 'non-exported-css'/, /Can't resolve '\.\/directory'/, diff --git a/test/configCases/css/import/test.config.js b/test/configCases/css/import/test.config.js index 5014f5795fe..dbfd4316888 100644 --- a/test/configCases/css/import/test.config.js +++ b/test/configCases/css/import/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/import/warnings.js b/test/configCases/css/import/warnings.js index b6cc2cf76c4..da91e8e8e03 100644 --- a/test/configCases/css/import/warnings.js +++ b/test/configCases/css/import/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /Expected URL in '@import nourl\(test\.css\);'/, /Expected URL in '@import ;'/, diff --git a/test/configCases/css/import/webpack.config.js b/test/configCases/css/import/webpack.config.js index 440985da639..cee6b515387 100644 --- a/test/configCases/css/import/webpack.config.js +++ b/test/configCases/css/import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/css/large/webpack.config.js b/test/configCases/css/large/webpack.config.js index c6289845d73..544806d3b1b 100644 --- a/test/configCases/css/large/webpack.config.js +++ b/test/configCases/css/large/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/css/local-ident-name/test.config.js b/test/configCases/css/local-ident-name/test.config.js index 207224f512d..cf60dd1af0b 100644 --- a/test/configCases/css/local-ident-name/test.config.js +++ b/test/configCases/css/local-ident-name/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return [ diff --git a/test/configCases/css/local-ident-name/webpack.config.js b/test/configCases/css/local-ident-name/webpack.config.js index 99d0a8346c2..33dff2c0dd3 100644 --- a/test/configCases/css/local-ident-name/webpack.config.js +++ b/test/configCases/css/local-ident-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const common = { mode: "development", module: { diff --git a/test/configCases/css/named-exports-parser-options/webpack.config.js b/test/configCases/css/named-exports-parser-options/webpack.config.js index 50b4c7745cf..9ab994f7fa8 100644 --- a/test/configCases/css/named-exports-parser-options/webpack.config.js +++ b/test/configCases/css/named-exports-parser-options/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", diff --git a/test/configCases/css/namespace/test.config.js b/test/configCases/css/namespace/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/namespace/test.config.js +++ b/test/configCases/css/namespace/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/namespace/warnings.js b/test/configCases/css/namespace/warnings.js index b10e066e2f7..1d2c445448e 100644 --- a/test/configCases/css/namespace/warnings.js +++ b/test/configCases/css/namespace/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [/'@namespace' is not supported in bundled CSS/]; diff --git a/test/configCases/css/namespace/webpack.config.js b/test/configCases/css/namespace/webpack.config.js index cfb8e5c0346..3cc31116df2 100644 --- a/test/configCases/css/namespace/webpack.config.js +++ b/test/configCases/css/namespace/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/no-extra-js-exports-output/test.config.js b/test/configCases/css/no-extra-js-exports-output/test.config.js index 92836b7847c..5eae4bcbacf 100644 --- a/test/configCases/css/no-extra-js-exports-output/test.config.js +++ b/test/configCases/css/no-extra-js-exports-output/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { switch (i) { diff --git a/test/configCases/css/no-extra-js-exports-output/webpack.config.js b/test/configCases/css/no-extra-js-exports-output/webpack.config.js index 4092e96c704..a8642569936 100644 --- a/test/configCases/css/no-extra-js-exports-output/webpack.config.js +++ b/test/configCases/css/no-extra-js-exports-output/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); @@ -6,7 +8,7 @@ const webpack = require("../../../../"); * @param {0 | 1 | 2} i index * @returns {{ main: string[] }} entry */ -const entry = i => { +const entry = (i) => { switch (i) { case 0: return { @@ -27,7 +29,7 @@ const entry = i => { * @param {0 | 1 | 2} i param * @returns {import("../../../../").Configuration} return */ -const common = i => ({ +const common = (i) => ({ entry: { ...entry(i) }, @@ -45,7 +47,7 @@ const common = i => ({ plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("Test", compilation => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-webpack-plugin", @@ -70,4 +72,4 @@ const common = i => ({ }); /** @type {import("../../../../").Configuration[]} */ -module.exports = /** @type {(0 | 1 | 2)[]} */ ([0, 1]).map(i => common(i)); +module.exports = /** @type {(0 | 1 | 2)[]} */ ([0, 1]).map((i) => common(i)); diff --git a/test/configCases/css/no-extra-runtime-in-js/test.config.js b/test/configCases/css/no-extra-runtime-in-js/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/no-extra-runtime-in-js/test.config.js +++ b/test/configCases/css/no-extra-runtime-in-js/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/no-extra-runtime-in-js/webpack.config.js b/test/configCases/css/no-extra-runtime-in-js/webpack.config.js index aa3c745380b..7aae301615e 100644 --- a/test/configCases/css/no-extra-runtime-in-js/webpack.config.js +++ b/test/configCases/css/no-extra-runtime-in-js/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/parsing/test.config.js b/test/configCases/css/parsing/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/parsing/test.config.js +++ b/test/configCases/css/parsing/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/parsing/webpack.config.js b/test/configCases/css/parsing/webpack.config.js index cfb8e5c0346..3cc31116df2 100644 --- a/test/configCases/css/parsing/webpack.config.js +++ b/test/configCases/css/parsing/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/pathinfo/test.config.js b/test/configCases/css/pathinfo/test.config.js index 3ec505d4261..5029f57ff58 100644 --- a/test/configCases/css/pathinfo/test.config.js +++ b/test/configCases/css/pathinfo/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/test/configCases/css/pathinfo/webpack.config.js b/test/configCases/css/pathinfo/webpack.config.js index e2848b6a973..e9040033e3f 100644 --- a/test/configCases/css/pathinfo/webpack.config.js +++ b/test/configCases/css/pathinfo/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/prefer-relative-css-import/test.config.js b/test/configCases/css/prefer-relative-css-import/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/prefer-relative-css-import/test.config.js +++ b/test/configCases/css/prefer-relative-css-import/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/prefer-relative-css-import/webpack.config.js b/test/configCases/css/prefer-relative-css-import/webpack.config.js index b4ebfb3d73f..63eb2a1656d 100644 --- a/test/configCases/css/prefer-relative-css-import/webpack.config.js +++ b/test/configCases/css/prefer-relative-css-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/prefer-relative/test.config.js b/test/configCases/css/prefer-relative/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/prefer-relative/test.config.js +++ b/test/configCases/css/prefer-relative/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/prefer-relative/webpack.config.js b/test/configCases/css/prefer-relative/webpack.config.js index cfb8e5c0346..3cc31116df2 100644 --- a/test/configCases/css/prefer-relative/webpack.config.js +++ b/test/configCases/css/prefer-relative/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/prefetch-preload-module-only-css/webpack.config.js b/test/configCases/css/prefetch-preload-module-only-css/webpack.config.js index 1d4d67a7068..3e545f2e498 100644 --- a/test/configCases/css/prefetch-preload-module-only-css/webpack.config.js +++ b/test/configCases/css/prefetch-preload-module-only-css/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./index.mjs", diff --git a/test/configCases/css/prefetch-preload-module/webpack.config.js b/test/configCases/css/prefetch-preload-module/webpack.config.js index 1d4d67a7068..3e545f2e498 100644 --- a/test/configCases/css/prefetch-preload-module/webpack.config.js +++ b/test/configCases/css/prefetch-preload-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./index.mjs", diff --git a/test/configCases/css/pseudo-export/webpack.config.js b/test/configCases/css/pseudo-export/webpack.config.js index cfb8e5c0346..3cc31116df2 100644 --- a/test/configCases/css/pseudo-export/webpack.config.js +++ b/test/configCases/css/pseudo-export/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/pseudo-import/test.config.js b/test/configCases/css/pseudo-import/test.config.js index 25a8b9f4dff..84026f61eb3 100644 --- a/test/configCases/css/pseudo-import/test.config.js +++ b/test/configCases/css/pseudo-import/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["reexport_modules_css.bundle0.js", "bundle0.js"]; diff --git a/test/configCases/css/pseudo-import/warnings.js b/test/configCases/css/pseudo-import/warnings.js index b9c29247d8c..d300b3f6b5b 100644 --- a/test/configCases/css/pseudo-import/warnings.js +++ b/test/configCases/css/pseudo-import/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ // /ICSS import "NONE_IMPORT" has no value./ ]; diff --git a/test/configCases/css/pseudo-import/webpack.config.js b/test/configCases/css/pseudo-import/webpack.config.js index cfb8e5c0346..3cc31116df2 100644 --- a/test/configCases/css/pseudo-import/webpack.config.js +++ b/test/configCases/css/pseudo-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/pure-css/test.config.js b/test/configCases/css/pure-css/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/pure-css/test.config.js +++ b/test/configCases/css/pure-css/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/pure-css/webpack.config.js b/test/configCases/css/pure-css/webpack.config.js index 53df0bf1ff2..1955d3808f9 100644 --- a/test/configCases/css/pure-css/webpack.config.js +++ b/test/configCases/css/pure-css/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/runtime-data-webpack/test.config.js b/test/configCases/css/runtime-data-webpack/test.config.js index a24512f1ae0..36c3327df6d 100644 --- a/test/configCases/css/runtime-data-webpack/test.config.js +++ b/test/configCases/css/runtime-data-webpack/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/runtime-data-webpack/webpack.config.js b/test/configCases/css/runtime-data-webpack/webpack.config.js index 336fd9f9fba..b32aedd1531 100644 --- a/test/configCases/css/runtime-data-webpack/webpack.config.js +++ b/test/configCases/css/runtime-data-webpack/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", @@ -8,14 +10,14 @@ module.exports = { plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("Test", compilation => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "Test", stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE }, - assets => { + (assets) => { const name = "bundle0.css"; const code = /** @type {string} */ (assets[name].source()); diff --git a/test/configCases/css/runtime-document-head-get-computed-style/test.config.js b/test/configCases/css/runtime-document-head-get-computed-style/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/runtime-document-head-get-computed-style/test.config.js +++ b/test/configCases/css/runtime-document-head-get-computed-style/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/runtime-document-head-get-computed-style/webpack.config.js b/test/configCases/css/runtime-document-head-get-computed-style/webpack.config.js index 7fb1039d0f9..35e121e56a5 100644 --- a/test/configCases/css/runtime-document-head-get-computed-style/webpack.config.js +++ b/test/configCases/css/runtime-document-head-get-computed-style/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", @@ -8,14 +10,14 @@ module.exports = { plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("Test", compilation => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "Test", stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE }, - assets => { + (assets) => { const name = "bundle0.css"; const code = assets[name].source(); diff --git a/test/configCases/css/runtime-issue/test.config.js b/test/configCases/css/runtime-issue/test.config.js index b4dce758416..839bb36ff17 100644 --- a/test/configCases/css/runtime-issue/test.config.js +++ b/test/configCases/css/runtime-issue/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link1 = scope.window.document.createElement("link"); diff --git a/test/configCases/css/runtime-issue/webpack.config.js b/test/configCases/css/runtime-issue/webpack.config.js index 8937b822ac1..ccd5e2dcca5 100644 --- a/test/configCases/css/runtime-issue/webpack.config.js +++ b/test/configCases/css/runtime-issue/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/css/universal/test.config.js b/test/configCases/css/universal/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/universal/test.config.js +++ b/test/configCases/css/universal/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/universal/test.filter.js b/test/configCases/css/universal/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/css/universal/test.filter.js +++ b/test/configCases/css/universal/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/css/universal/webpack.config.js b/test/configCases/css/universal/webpack.config.js index 18c6fd14735..71348e2f928 100644 --- a/test/configCases/css/universal/webpack.config.js +++ b/test/configCases/css/universal/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: ["web", "node"], diff --git a/test/configCases/css/url-and-asset-module-filename/test.config.js b/test/configCases/css/url-and-asset-module-filename/test.config.js index f3049c55ad1..d588de9f1e6 100644 --- a/test/configCases/css/url-and-asset-module-filename/test.config.js +++ b/test/configCases/css/url-and-asset-module-filename/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return [`index_css.bundle${i}.js`, `bundle${i}.js`]; diff --git a/test/configCases/css/url-and-asset-module-filename/webpack.config.js b/test/configCases/css/url-and-asset-module-filename/webpack.config.js index 3d6979860e5..a4ab9c1026f 100644 --- a/test/configCases/css/url-and-asset-module-filename/webpack.config.js +++ b/test/configCases/css/url-and-asset-module-filename/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ const common = { target: "web", diff --git a/test/configCases/css/url/errors.js b/test/configCases/css/url/errors.js index 0b3629f382e..29b195bd723 100644 --- a/test/configCases/css/url/errors.js +++ b/test/configCases/css/url/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [/Can't resolve 'unresolved.png'/]; diff --git a/test/configCases/css/url/test.config.js b/test/configCases/css/url/test.config.js index 5014f5795fe..dbfd4316888 100644 --- a/test/configCases/css/url/test.config.js +++ b/test/configCases/css/url/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/url/webpack.config.js b/test/configCases/css/url/webpack.config.js index 6f0cf2090e0..b74f5f43ec6 100644 --- a/test/configCases/css/url/webpack.config.js +++ b/test/configCases/css/url/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/css/webpack-ignore/test.config.js b/test/configCases/css/webpack-ignore/test.config.js index 0590757288f..eaabc0c0c55 100644 --- a/test/configCases/css/webpack-ignore/test.config.js +++ b/test/configCases/css/webpack-ignore/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/css/webpack-ignore/warnings.js b/test/configCases/css/webpack-ignore/warnings.js index 52aba8cc706..41d91ac4814 100644 --- a/test/configCases/css/webpack-ignore/warnings.js +++ b/test/configCases/css/webpack-ignore/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /Compilation error while processing magic comment\(-s\): \/\*\*\*\*webpackIgnore: false\*\*\*\//, /Compilation error while processing magic comment\(-s\): \/\* {3}\* {3}\* {3}\* {3}webpackIgnore: {3}false {3}\* {3}\* {3}\*\//, diff --git a/test/configCases/css/webpack-ignore/webpack.config.js b/test/configCases/css/webpack-ignore/webpack.config.js index cfb8e5c0346..3cc31116df2 100644 --- a/test/configCases/css/webpack-ignore/webpack.config.js +++ b/test/configCases/css/webpack-ignore/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/custom-hash-function/debug-hash/webpack.config.js b/test/configCases/custom-hash-function/debug-hash/webpack.config.js index ee9e650c781..b79e6c19a90 100644 --- a/test/configCases/custom-hash-function/debug-hash/webpack.config.js +++ b/test/configCases/custom-hash-function/debug-hash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/custom-hash-function/xxhash/webpack.config.js b/test/configCases/custom-hash-function/xxhash/webpack.config.js index 66e7927080a..4cbb3afda26 100644 --- a/test/configCases/custom-hash-function/xxhash/webpack.config.js +++ b/test/configCases/custom-hash-function/xxhash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/custom-modules/json-custom/webpack.config.js b/test/configCases/custom-modules/json-custom/webpack.config.js index 2825987f4dd..893ead92146 100644 --- a/test/configCases/custom-modules/json-custom/webpack.config.js +++ b/test/configCases/custom-modules/json-custom/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const toml = require("toml"); /** @typedef {import("../../../../").ParserOptionsByModuleTypeKnown} ParserOptionsByModuleTypeKnown */ diff --git a/test/configCases/custom-source-type/localization/deprecations.js b/test/configCases/custom-source-type/localization/deprecations.js index 44a05b2a72a..854cc588ed2 100644 --- a/test/configCases/custom-source-type/localization/deprecations.js +++ b/test/configCases/custom-source-type/localization/deprecations.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [{ code: /DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST/ }]; diff --git a/test/configCases/custom-source-type/localization/webpack.config.js b/test/configCases/custom-source-type/localization/webpack.config.js index 36ae26ec2d4..f5e1c48ee46 100644 --- a/test/configCases/custom-source-type/localization/webpack.config.js +++ b/test/configCases/custom-source-type/localization/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { RawSource } = require("webpack-sources"); const Generator = require("../../../../").Generator; const RuntimeModule = require("../../../../").RuntimeModule; @@ -133,7 +135,7 @@ module.exports = definitions.map((defs, i) => ({ /** * @param {Compiler} compiler the compiler */ - compiler => { + (compiler) => { compiler.hooks.thisCompilation.tap( "LocalizationPlugin", (compilation, { normalModuleFactory }) => { @@ -190,7 +192,7 @@ module.exports = definitions.map((defs, i) => ({ .tap("LocalizationPlugin", (chunk, set) => { const chunkGraph = compilation.chunkGraph; if ( - !chunkGraph.hasModuleInGraph(chunk, m => + !chunkGraph.hasModuleInGraph(chunk, (m) => m.type.startsWith("localization") ) ) { diff --git a/test/configCases/deep-scope-analysis/remove-export-scope-hoisting/webpack.config.js b/test/configCases/deep-scope-analysis/remove-export-scope-hoisting/webpack.config.js index 02610e9e203..9ff9ba31e3b 100644 --- a/test/configCases/deep-scope-analysis/remove-export-scope-hoisting/webpack.config.js +++ b/test/configCases/deep-scope-analysis/remove-export-scope-hoisting/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compilation} Compilation */ /** @typedef {import("../../../../").Module} Module */ @@ -16,7 +18,7 @@ module.exports = { * @param {Compilation} compilation the compilation * @returns {void} */ - compilation => { + (compilation) => { compilation.hooks.dependencyReferencedExports.tap( "Test", (referencedExports, dep) => { @@ -31,14 +33,14 @@ module.exports = { refModule && refModule.identifier().endsWith("reference.js") && referencedExports.some( - names => + (names) => Array.isArray(names) && names.length === 1 && names[0] === "unused" ) ) { return referencedExports.filter( - names => + (names) => (Array.isArray(names) && names.length !== 1) || /** @type {string[]} */ (names)[0] !== "unused" diff --git a/test/configCases/deep-scope-analysis/remove-export/webpack.config.js b/test/configCases/deep-scope-analysis/remove-export/webpack.config.js index 1981cb7a086..33ca6f79ad0 100644 --- a/test/configCases/deep-scope-analysis/remove-export/webpack.config.js +++ b/test/configCases/deep-scope-analysis/remove-export/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compilation} Compilation */ /** @typedef {import("../../../../").Module} Module */ @@ -10,7 +12,7 @@ module.exports = { }, plugins: [ function apply() { - this.hooks.compilation.tap("Test", compilation => { + this.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.dependencyReferencedExports.tap( "Test", (referencedExports, dep) => { @@ -25,14 +27,14 @@ module.exports = { refModule && refModule.identifier().endsWith("reference.js") && referencedExports.some( - names => + (names) => Array.isArray(names) && names.length === 1 && names[0] === "unused" ) ) { return referencedExports.filter( - names => + (names) => (Array.isArray(names) && names.length !== 1) || /** @type {string[]} */ (names)[0] !== "unused" diff --git a/test/configCases/defaulter/immutable-config/webpack.config.js b/test/configCases/defaulter/immutable-config/webpack.config.js index 6d30166043c..d9f963a8c35 100644 --- a/test/configCases/defaulter/immutable-config/webpack.config.js +++ b/test/configCases/defaulter/immutable-config/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { resolve: Object.freeze({}) diff --git a/test/configCases/defer-import/async-in-graph/webpack.config.js b/test/configCases/defer-import/async-in-graph/webpack.config.js index 64d7b07d3e8..7ffe9a13fe6 100644 --- a/test/configCases/defer-import/async-in-graph/webpack.config.js +++ b/test/configCases/defer-import/async-in-graph/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/comment-error/errors.js b/test/configCases/defer-import/comment-error/errors.js index 7daeddc2bbc..e8663e87c7a 100644 --- a/test/configCases/defer-import/comment-error/errors.js +++ b/test/configCases/defer-import/comment-error/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/used with `import \* as namespace from '...'`/], [/used with `import \* as namespace from '...'`/], diff --git a/test/configCases/defer-import/comment-error/webpack.config.js b/test/configCases/defer-import/comment-error/webpack.config.js index b1d898a6d0b..05e45ee810f 100644 --- a/test/configCases/defer-import/comment-error/webpack.config.js +++ b/test/configCases/defer-import/comment-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/defer-but-sync-order/webpack.config.js b/test/configCases/defer-import/defer-but-sync-order/webpack.config.js index e72757af771..c3897eb5054 100644 --- a/test/configCases/defer-import/defer-but-sync-order/webpack.config.js +++ b/test/configCases/defer-import/defer-but-sync-order/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/defer-runtime-concat-strict/webpack.config.js b/test/configCases/defer-import/defer-runtime-concat-strict/webpack.config.js index 4c47b61052b..434326f43ec 100644 --- a/test/configCases/defer-import/defer-runtime-concat-strict/webpack.config.js +++ b/test/configCases/defer-import/defer-runtime-concat-strict/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/defer-runtime-concat/webpack.config.js b/test/configCases/defer-import/defer-runtime-concat/webpack.config.js index 9bc9efa7e8c..bd136e3b40f 100644 --- a/test/configCases/defer-import/defer-runtime-concat/webpack.config.js +++ b/test/configCases/defer-import/defer-runtime-concat/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/defer-runtime-native-syntax/webpack.config.js b/test/configCases/defer-import/defer-runtime-native-syntax/webpack.config.js index 86a95ddad7b..6c58151518f 100644 --- a/test/configCases/defer-import/defer-runtime-native-syntax/webpack.config.js +++ b/test/configCases/defer-import/defer-runtime-native-syntax/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/defer-runtime-strict/webpack.config.js b/test/configCases/defer-import/defer-runtime-strict/webpack.config.js index cb106c8b37c..668d2a3f214 100644 --- a/test/configCases/defer-import/defer-runtime-strict/webpack.config.js +++ b/test/configCases/defer-import/defer-runtime-strict/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/defer-runtime/webpack.config.js b/test/configCases/defer-import/defer-runtime/webpack.config.js index 953151172ee..d7b3258a400 100644 --- a/test/configCases/defer-import/defer-runtime/webpack.config.js +++ b/test/configCases/defer-import/defer-runtime/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/defer-then-non-defer/webpack.config.js b/test/configCases/defer-import/defer-then-non-defer/webpack.config.js index 9915d3d5929..981c84a29c4 100644 --- a/test/configCases/defer-import/defer-then-non-defer/webpack.config.js +++ b/test/configCases/defer-import/defer-then-non-defer/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/defer-used-in-async/webpack.config.js b/test/configCases/defer-import/defer-used-in-async/webpack.config.js index b1d898a6d0b..05e45ee810f 100644 --- a/test/configCases/defer-import/defer-used-in-async/webpack.config.js +++ b/test/configCases/defer-import/defer-used-in-async/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/defer-import/harmony-import-mixed/webpack.config.js b/test/configCases/defer-import/harmony-import-mixed/webpack.config.js index b9ffe036a9b..5d29f61d419 100644 --- a/test/configCases/defer-import/harmony-import-mixed/webpack.config.js +++ b/test/configCases/defer-import/harmony-import-mixed/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], diff --git a/test/configCases/delegated-hash/simple/warnings.js b/test/configCases/delegated-hash/simple/warnings.js index 70fefa270fb..fdcecb3be97 100644 --- a/test/configCases/delegated-hash/simple/warnings.js +++ b/test/configCases/delegated-hash/simple/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/hashed/, /deprecated/]]; diff --git a/test/configCases/delegated-hash/simple/webpack.config.js b/test/configCases/delegated-hash/simple/webpack.config.js index d9e01efb3d3..8fa1ba8b3c7 100644 --- a/test/configCases/delegated-hash/simple/webpack.config.js +++ b/test/configCases/delegated-hash/simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const DelegatedPlugin = require("../../../../").DelegatedPlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/delegated/simple/webpack.config.js b/test/configCases/delegated/simple/webpack.config.js index 655614cc18a..ae47bc66b49 100644 --- a/test/configCases/delegated/simple/webpack.config.js +++ b/test/configCases/delegated/simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const DelegatedPlugin = require("../../../../").DelegatedPlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/deprecations/chunk-and-module/deprecations.js b/test/configCases/deprecations/chunk-and-module/deprecations.js index 6f776e23226..8dff62679f0 100644 --- a/test/configCases/deprecations/chunk-and-module/deprecations.js +++ b/test/configCases/deprecations/chunk-and-module/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_CHUNK_ADD_MODULE/ }, { code: /DEP_WEBPACK_CHUNK_CONTAINS_MODULE/ }, diff --git a/test/configCases/deprecations/chunk-and-module/webpack.config.js b/test/configCases/deprecations/chunk-and-module/webpack.config.js index f0519bd26a6..8b22b0b0809 100644 --- a/test/configCases/deprecations/chunk-and-module/webpack.config.js +++ b/test/configCases/deprecations/chunk-and-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ChunkGraph, ExternalModule } = require("../../../../"); /** @typedef {import("../../../../").Module} Module */ @@ -5,7 +7,7 @@ const { ChunkGraph, ExternalModule } = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { plugins: [ - compiler => { + (compiler) => { compiler.hooks.done.tap("Test", ({ compilation }) => { const { chunkGraph } = compilation; for (const chunk of compilation.chunks) { @@ -21,7 +23,7 @@ module.exports = { expect(chunk.getNumberOfModules()).toBe(4); expect(new Set(chunk.modulesIterable)).toContain(module); expect(new Set(chunk.getModules())).toContain(chunk.entryModule); - expect(chunk.hasModuleInGraph(m => m === module)).toBe(true); + expect(chunk.hasModuleInGraph((m) => m === module)).toBe(true); expect(chunk.containsModule(module)).toBe(true); chunk.removeModule(module); module.removeChunk(chunk); diff --git a/test/configCases/deprecations/chunk-files/deprecations.js b/test/configCases/deprecations/chunk-files/deprecations.js index 99016892f87..f3e917a89a5 100644 --- a/test/configCases/deprecations/chunk-files/deprecations.js +++ b/test/configCases/deprecations/chunk-files/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET/ }, { code: /DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET_INDEXER/ }, diff --git a/test/configCases/deprecations/chunk-files/webpack.config.js b/test/configCases/deprecations/chunk-files/webpack.config.js index 8d34f674457..23db54e0b16 100644 --- a/test/configCases/deprecations/chunk-files/webpack.config.js +++ b/test/configCases/deprecations/chunk-files/webpack.config.js @@ -1,7 +1,9 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { plugins: [ - compiler => { + (compiler) => { compiler.hooks.done.tap("Test", ({ compilation }) => { for (const c of compilation.chunks) { const chunk = diff --git a/test/configCases/deprecations/config/deprecations.js b/test/configCases/deprecations/config/deprecations.js index 51cb32875d7..fe3b56bfc3a 100644 --- a/test/configCases/deprecations/config/deprecations.js +++ b/test/configCases/deprecations/config/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS/ } ]; diff --git a/test/configCases/deprecations/config/webpack.config.js b/test/configCases/deprecations/config/webpack.config.js index 8542bc3b97f..493a1feda3e 100644 --- a/test/configCases/deprecations/config/webpack.config.js +++ b/test/configCases/deprecations/config/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/deprecations/invalid-dependencies/warnings.js b/test/configCases/deprecations/invalid-dependencies/warnings.js index 6debc775746..137b91c0d56 100644 --- a/test/configCases/deprecations/invalid-dependencies/warnings.js +++ b/test/configCases/deprecations/invalid-dependencies/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ { moduleName: /\.\/index\.js/ }, diff --git a/test/configCases/deprecations/invalid-dependencies/webpack.config.js b/test/configCases/deprecations/invalid-dependencies/webpack.config.js index 3722875d8ce..ad91963f42a 100644 --- a/test/configCases/deprecations/invalid-dependencies/webpack.config.js +++ b/test/configCases/deprecations/invalid-dependencies/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); @@ -12,9 +14,9 @@ module.exports = { ] }, plugins: [ - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { - compilation.hooks.succeedModule.tap("Test", module => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { + compilation.hooks.succeedModule.tap("Test", (module) => { const fileDeps = new webpack.util.LazySet(); const contextDeps = new webpack.util.LazySet(); const missingDeps = new webpack.util.LazySet(); diff --git a/test/configCases/deprecations/non-unique-hash/deprecations.js b/test/configCases/deprecations/non-unique-hash/deprecations.js index 8a3adf14664..7b23f649521 100644 --- a/test/configCases/deprecations/non-unique-hash/deprecations.js +++ b/test/configCases/deprecations/non-unique-hash/deprecations.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [{ code: /DEP_WEBPACK_MODULE_HASH/ }]; diff --git a/test/configCases/deprecations/non-unique-hash/webpack.config.js b/test/configCases/deprecations/non-unique-hash/webpack.config.js index d5db5c2229b..10d7d445c6b 100644 --- a/test/configCases/deprecations/non-unique-hash/webpack.config.js +++ b/test/configCases/deprecations/non-unique-hash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Chunk} Chunk */ /** @type {import("../../../../").Configuration} */ @@ -15,8 +17,8 @@ module.exports = { concatenateModules: false }, plugins: [ - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.afterModuleHash.tap("Test", () => { const hashes = []; expect(() => { diff --git a/test/configCases/dll-plugin-entry/0-create-dll/test.config.js b/test/configCases/dll-plugin-entry/0-create-dll/test.config.js index 04581a81040..67028ae7c8c 100644 --- a/test/configCases/dll-plugin-entry/0-create-dll/test.config.js +++ b/test/configCases/dll-plugin-entry/0-create-dll/test.config.js @@ -1 +1,3 @@ +"use strict"; + module.exports.noTests = true; diff --git a/test/configCases/dll-plugin-entry/0-create-dll/webpack.config.js b/test/configCases/dll-plugin-entry/0-create-dll/webpack.config.js index 6a358cd66a7..b9707095bfb 100644 --- a/test/configCases/dll-plugin-entry/0-create-dll/webpack.config.js +++ b/test/configCases/dll-plugin-entry/0-create-dll/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js b/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js index be916ac443e..fb1096191f6 100644 --- a/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js +++ b/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/dll-plugin-entry/2-error-non-entry/errors.js b/test/configCases/dll-plugin-entry/2-error-non-entry/errors.js index 857282ec937..595149cef77 100644 --- a/test/configCases/dll-plugin-entry/2-error-non-entry/errors.js +++ b/test/configCases/dll-plugin-entry/2-error-non-entry/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Can't resolve 'dll\/dep2'/]]; diff --git a/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js b/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js index be916ac443e..fb1096191f6 100644 --- a/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js +++ b/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/dll-plugin-format/0-create-dll/test.config.js b/test/configCases/dll-plugin-format/0-create-dll/test.config.js index 04581a81040..67028ae7c8c 100644 --- a/test/configCases/dll-plugin-format/0-create-dll/test.config.js +++ b/test/configCases/dll-plugin-format/0-create-dll/test.config.js @@ -1 +1,3 @@ +"use strict"; + module.exports.noTests = true; diff --git a/test/configCases/dll-plugin-format/0-create-dll/webpack.config.js b/test/configCases/dll-plugin-format/0-create-dll/webpack.config.js index eb75dc1c172..2bf320ed1be 100644 --- a/test/configCases/dll-plugin-format/0-create-dll/webpack.config.js +++ b/test/configCases/dll-plugin-format/0-create-dll/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/dll-plugin-side-effects/0-create-dll/test.config.js b/test/configCases/dll-plugin-side-effects/0-create-dll/test.config.js index 04581a81040..67028ae7c8c 100644 --- a/test/configCases/dll-plugin-side-effects/0-create-dll/test.config.js +++ b/test/configCases/dll-plugin-side-effects/0-create-dll/test.config.js @@ -1 +1,3 @@ +"use strict"; + module.exports.noTests = true; diff --git a/test/configCases/dll-plugin-side-effects/0-create-dll/webpack.config.js b/test/configCases/dll-plugin-side-effects/0-create-dll/webpack.config.js index 2fab4e47191..01edc8de510 100644 --- a/test/configCases/dll-plugin-side-effects/0-create-dll/webpack.config.js +++ b/test/configCases/dll-plugin-side-effects/0-create-dll/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js b/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js index e4efbfe5ff0..ecbc5423fa0 100644 --- a/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js +++ b/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/dll-plugin/0-create-dll-with-contenthash/test.config.js b/test/configCases/dll-plugin/0-create-dll-with-contenthash/test.config.js index 04581a81040..67028ae7c8c 100644 --- a/test/configCases/dll-plugin/0-create-dll-with-contenthash/test.config.js +++ b/test/configCases/dll-plugin/0-create-dll-with-contenthash/test.config.js @@ -1 +1,3 @@ +"use strict"; + module.exports.noTests = true; diff --git a/test/configCases/dll-plugin/0-create-dll-with-contenthash/webpack.config.js b/test/configCases/dll-plugin/0-create-dll-with-contenthash/webpack.config.js index 11e52fffca4..8e28f6d8c2a 100644 --- a/test/configCases/dll-plugin/0-create-dll-with-contenthash/webpack.config.js +++ b/test/configCases/dll-plugin/0-create-dll-with-contenthash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/dll-plugin/0-create-dll/test.config.js b/test/configCases/dll-plugin/0-create-dll/test.config.js index 04581a81040..67028ae7c8c 100644 --- a/test/configCases/dll-plugin/0-create-dll/test.config.js +++ b/test/configCases/dll-plugin/0-create-dll/test.config.js @@ -1 +1,3 @@ +"use strict"; + module.exports.noTests = true; 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 1983141cd1c..0f392cd35a0 100644 --- a/test/configCases/dll-plugin/0-create-dll/webpack.config.js +++ b/test/configCases/dll-plugin/0-create-dll/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/dll-plugin/0-issue-10475/test.config.js b/test/configCases/dll-plugin/0-issue-10475/test.config.js index 04581a81040..67028ae7c8c 100644 --- a/test/configCases/dll-plugin/0-issue-10475/test.config.js +++ b/test/configCases/dll-plugin/0-issue-10475/test.config.js @@ -1 +1,3 @@ +"use strict"; + module.exports.noTests = true; diff --git a/test/configCases/dll-plugin/0-issue-10475/webpack.config.js b/test/configCases/dll-plugin/0-issue-10475/webpack.config.js index 7ea13a7cef0..6f492c1ab7d 100644 --- a/test/configCases/dll-plugin/0-issue-10475/webpack.config.js +++ b/test/configCases/dll-plugin/0-issue-10475/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/dll-plugin/1-issue-10475/webpack.config.js b/test/configCases/dll-plugin/1-issue-10475/webpack.config.js index cd2640f87c3..184ecd19b90 100644 --- a/test/configCases/dll-plugin/1-issue-10475/webpack.config.js +++ b/test/configCases/dll-plugin/1-issue-10475/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/dll-plugin/1-use-dll/webpack.config.js b/test/configCases/dll-plugin/1-use-dll/webpack.config.js index 27906ea6f66..a73ae3c59bd 100644 --- a/test/configCases/dll-plugin/1-use-dll/webpack.config.js +++ b/test/configCases/dll-plugin/1-use-dll/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js b/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js index ce7262fa49a..def6b4af768 100644 --- a/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js +++ b/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/dll-plugin/3-use-dll-with-hashid/warnings.js b/test/configCases/dll-plugin/3-use-dll-with-hashid/warnings.js index 70fefa270fb..fdcecb3be97 100644 --- a/test/configCases/dll-plugin/3-use-dll-with-hashid/warnings.js +++ b/test/configCases/dll-plugin/3-use-dll-with-hashid/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/hashed/, /deprecated/]]; diff --git a/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js b/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js index 7039a3c5a61..8d0f2b8dab1 100644 --- a/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js +++ b/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js b/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js index 5b88d83b098..5aa52cf2572 100644 --- a/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js +++ b/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/dll-plugin/5-issue-18200/errors.js b/test/configCases/dll-plugin/5-issue-18200/errors.js index 48720d5cbae..69e6a6b0900 100644 --- a/test/configCases/dll-plugin/5-issue-18200/errors.js +++ b/test/configCases/dll-plugin/5-issue-18200/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/each chunk must have a unique path/]]; diff --git a/test/configCases/dll-plugin/5-issue-18200/webpack.config.js b/test/configCases/dll-plugin/5-issue-18200/webpack.config.js index a34ec169331..fc75e6d3b75 100644 --- a/test/configCases/dll-plugin/5-issue-18200/webpack.config.js +++ b/test/configCases/dll-plugin/5-issue-18200/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/ecmaVersion/2015/webpack.config.js b/test/configCases/ecmaVersion/2015/webpack.config.js index 989d5457ba3..5ca5c19de25 100644 --- a/test/configCases/ecmaVersion/2015/webpack.config.js +++ b/test/configCases/ecmaVersion/2015/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: ["node", "es2015"] diff --git a/test/configCases/ecmaVersion/2020/webpack.config.js b/test/configCases/ecmaVersion/2020/webpack.config.js index a4c801f0a7b..bbc84148425 100644 --- a/test/configCases/ecmaVersion/2020/webpack.config.js +++ b/test/configCases/ecmaVersion/2020/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: ["node", "es2020"] diff --git a/test/configCases/ecmaVersion/5/webpack.config.js b/test/configCases/ecmaVersion/5/webpack.config.js index 12f3d9f6535..11351a0baa8 100644 --- a/test/configCases/ecmaVersion/5/webpack.config.js +++ b/test/configCases/ecmaVersion/5/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: ["node", "es5"] diff --git a/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js b/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js index 47b717ab3c7..ae92dffb99b 100644 --- a/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js +++ b/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js @@ -1,11 +1,13 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ module.exports = { target: `browserslist:${path.join(__dirname, ".browserslistrc")}:modern`, plugins: [ - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { expect(compilation.outputOptions.environment).toMatchInlineSnapshot(` Object { "arrowFunction": false, diff --git a/test/configCases/ecmaVersion/browserslist-config/webpack.config.js b/test/configCases/ecmaVersion/browserslist-config/webpack.config.js index 6772fe11465..ab3cae79df4 100644 --- a/test/configCases/ecmaVersion/browserslist-config/webpack.config.js +++ b/test/configCases/ecmaVersion/browserslist-config/webpack.config.js @@ -1,11 +1,13 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ module.exports = { target: `browserslist:${path.join(__dirname, ".browserslistrc")}`, plugins: [ - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { expect(compilation.outputOptions.environment).toMatchInlineSnapshot(` Object { "arrowFunction": false, diff --git a/test/configCases/ecmaVersion/browserslist-missing/errors.js b/test/configCases/ecmaVersion/browserslist-missing/errors.js index a02f9820e5c..fab8478ddf3 100644 --- a/test/configCases/ecmaVersion/browserslist-missing/errors.js +++ b/test/configCases/ecmaVersion/browserslist-missing/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/No browserslist config found/]]; diff --git a/test/configCases/ecmaVersion/browserslist-missing/test.filter.js b/test/configCases/ecmaVersion/browserslist-missing/test.filter.js index d5852188b3e..96ddb2717f2 100644 --- a/test/configCases/ecmaVersion/browserslist-missing/test.filter.js +++ b/test/configCases/ecmaVersion/browserslist-missing/test.filter.js @@ -1 +1,3 @@ -module.exports = config => !config.cache; +"use strict"; + +module.exports = (config) => !config.cache; diff --git a/test/configCases/ecmaVersion/browserslist-missing/webpack.config.js b/test/configCases/ecmaVersion/browserslist-missing/webpack.config.js index 57dbb3363da..6ceb9d1a798 100644 --- a/test/configCases/ecmaVersion/browserslist-missing/webpack.config.js +++ b/test/configCases/ecmaVersion/browserslist-missing/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: ["browserslist"] diff --git a/test/configCases/ecmaVersion/browserslist-query/webpack.config.js b/test/configCases/ecmaVersion/browserslist-query/webpack.config.js index 5a2b52a97aa..f8a453518e8 100644 --- a/test/configCases/ecmaVersion/browserslist-query/webpack.config.js +++ b/test/configCases/ecmaVersion/browserslist-query/webpack.config.js @@ -1,9 +1,11 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "browserslist: ie 9", plugins: [ - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { expect(compilation.outputOptions.environment).toMatchInlineSnapshot(` Object { "arrowFunction": false, diff --git a/test/configCases/ecmaVersion/browserslist/webpack.config.js b/test/configCases/ecmaVersion/browserslist/webpack.config.js index cbaaab50eda..310967020d9 100644 --- a/test/configCases/ecmaVersion/browserslist/webpack.config.js +++ b/test/configCases/ecmaVersion/browserslist/webpack.config.js @@ -1,9 +1,11 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: ["browserslist"], plugins: [ - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { expect(compilation.outputOptions.environment).toMatchInlineSnapshot(` Object { "arrowFunction": true, diff --git a/test/configCases/ecmaVersion/custom/webpack.config.js b/test/configCases/ecmaVersion/custom/webpack.config.js index 53945cfba1e..4c66e4e396d 100644 --- a/test/configCases/ecmaVersion/custom/webpack.config.js +++ b/test/configCases/ecmaVersion/custom/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/ecmaVersion/loader-context/webpack.config.js b/test/configCases/ecmaVersion/loader-context/webpack.config.js index 72cbad754c1..0f3785aac63 100644 --- a/test/configCases/ecmaVersion/loader-context/webpack.config.js +++ b/test/configCases/ecmaVersion/loader-context/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: ["node", "es2020"], diff --git a/test/configCases/emit-asset/different-source/errors.js b/test/configCases/emit-asset/different-source/errors.js index 4ca3183d5ae..9f1227f09e3 100644 --- a/test/configCases/emit-asset/different-source/errors.js +++ b/test/configCases/emit-asset/different-source/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Conflict/, diff --git a/test/configCases/emit-asset/different-source/webpack.config.js b/test/configCases/emit-asset/different-source/webpack.config.js index c124af72167..641c6b8bf6e 100644 --- a/test/configCases/emit-asset/different-source/webpack.config.js +++ b/test/configCases/emit-asset/different-source/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/emit-asset/equal-source/webpack.config.js b/test/configCases/emit-asset/equal-source/webpack.config.js index c124af72167..641c6b8bf6e 100644 --- a/test/configCases/emit-asset/equal-source/webpack.config.js +++ b/test/configCases/emit-asset/equal-source/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/entry/adding-multiple-entry-points/test.config.js b/test/configCases/entry/adding-multiple-entry-points/test.config.js index 1a96fecb170..a4d8d86ae86 100644 --- a/test/configCases/entry/adding-multiple-entry-points/test.config.js +++ b/test/configCases/entry/adding-multiple-entry-points/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime~main.js", "./main.js"]; diff --git a/test/configCases/entry/adding-multiple-entry-points/webpack.config.js b/test/configCases/entry/adding-multiple-entry-points/webpack.config.js index 6c71cfb80c0..8184f4b1967 100644 --- a/test/configCases/entry/adding-multiple-entry-points/webpack.config.js +++ b/test/configCases/entry/adding-multiple-entry-points/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const EntryPlugin = require("../../../../").EntryPlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/entry/depend-on-advanced/test.config.js b/test/configCases/entry/depend-on-advanced/test.config.js index e4418ec8151..50a41ac8a57 100644 --- a/test/configCases/entry/depend-on-advanced/test.config.js +++ b/test/configCases/entry/depend-on-advanced/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/entry/depend-on-advanced/webpack.config.js b/test/configCases/entry/depend-on-advanced/webpack.config.js index f503e4e83f0..03d6b515e44 100644 --- a/test/configCases/entry/depend-on-advanced/webpack.config.js +++ b/test/configCases/entry/depend-on-advanced/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compiler} Compiler */ /** @typedef {import("../../../../").Compilation} Compilation */ /** @typedef {import("../../../../").Configuration} Configuration */ @@ -32,7 +34,7 @@ module.exports = { * @param {Compilation} compilation compilation * @returns {void} */ - const handler = compilation => { + const handler = (compilation) => { compilation.hooks.afterSeal.tap("testcase", () => { const { chunkGraph } = compilation; /** @type {Record>} */ diff --git a/test/configCases/entry/depend-on-bug/test.config.js b/test/configCases/entry/depend-on-bug/test.config.js index f0f5067ae54..49a5cbdac81 100644 --- a/test/configCases/entry/depend-on-bug/test.config.js +++ b/test/configCases/entry/depend-on-bug/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./other-vendors.js", "./page1.js", "./app.js"]; diff --git a/test/configCases/entry/depend-on-bug/webpack.config.js b/test/configCases/entry/depend-on-bug/webpack.config.js index e55145af4c7..ada19ab53cf 100644 --- a/test/configCases/entry/depend-on-bug/webpack.config.js +++ b/test/configCases/entry/depend-on-bug/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compiler} Compiler */ /** @typedef {import("../../../../").Compilation} Compilation */ /** @typedef {import("../../../../").Configuration} Configuration */ diff --git a/test/configCases/entry/depend-on-non-js/test.config.js b/test/configCases/entry/depend-on-non-js/test.config.js index bb4a0a53e21..fb58244b65b 100644 --- a/test/configCases/entry/depend-on-non-js/test.config.js +++ b/test/configCases/entry/depend-on-non-js/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime.js", "./a.js", "./b.js"]; diff --git a/test/configCases/entry/depend-on-non-js/webpack.config.js b/test/configCases/entry/depend-on-non-js/webpack.config.js index 1d85d3a86ad..07bc8a1e8f8 100644 --- a/test/configCases/entry/depend-on-non-js/webpack.config.js +++ b/test/configCases/entry/depend-on-non-js/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MiniCssPlugin = require("mini-css-extract-plugin"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/entry/depend-on-simple/test.config.js b/test/configCases/entry/depend-on-simple/test.config.js index 49dc848d75a..2288cff595f 100644 --- a/test/configCases/entry/depend-on-simple/test.config.js +++ b/test/configCases/entry/depend-on-simple/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./app.js", "./react-vendors.js"]; diff --git a/test/configCases/entry/depend-on-simple/webpack.config.js b/test/configCases/entry/depend-on-simple/webpack.config.js index d8f6017e1d8..4314a7d1d3a 100644 --- a/test/configCases/entry/depend-on-simple/webpack.config.js +++ b/test/configCases/entry/depend-on-simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compiler} Compiler */ /** @typedef {import("../../../../").Compilation} Compilation */ /** @typedef {import("../../../../").Chunk} Chunk */ @@ -22,7 +24,7 @@ module.exports = { * @param {Compilation} compilation compilation * @returns {void} */ - const handler = compilation => { + const handler = (compilation) => { compilation.hooks.afterSeal.tap("testcase", () => { const { chunkGraph } = compilation; /** @type {Record>} */ diff --git a/test/configCases/entry/descriptor/test.config.js b/test/configCases/entry/descriptor/test.config.js index 212b2e5fc13..af2075ac84f 100644 --- a/test/configCases/entry/descriptor/test.config.js +++ b/test/configCases/entry/descriptor/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./b.js"]; diff --git a/test/configCases/entry/descriptor/webpack.config.js b/test/configCases/entry/descriptor/webpack.config.js index d6e64eb6ec6..b9c6363e17f 100644 --- a/test/configCases/entry/descriptor/webpack.config.js +++ b/test/configCases/entry/descriptor/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry() { diff --git a/test/configCases/entry/entry-base-uri/webpack.config.js b/test/configCases/entry/entry-base-uri/webpack.config.js index 283ccf45eef..41979b90945 100644 --- a/test/configCases/entry/entry-base-uri/webpack.config.js +++ b/test/configCases/entry/entry-base-uri/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/entry/function-promise/test.config.js b/test/configCases/entry/function-promise/test.config.js index 212b2e5fc13..af2075ac84f 100644 --- a/test/configCases/entry/function-promise/test.config.js +++ b/test/configCases/entry/function-promise/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./b.js"]; diff --git a/test/configCases/entry/function-promise/webpack.config.js b/test/configCases/entry/function-promise/webpack.config.js index 50d4e430802..896edd15b81 100644 --- a/test/configCases/entry/function-promise/webpack.config.js +++ b/test/configCases/entry/function-promise/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry() { diff --git a/test/configCases/entry/function/test.config.js b/test/configCases/entry/function/test.config.js index 212b2e5fc13..af2075ac84f 100644 --- a/test/configCases/entry/function/test.config.js +++ b/test/configCases/entry/function/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./b.js"]; diff --git a/test/configCases/entry/function/webpack.config.js b/test/configCases/entry/function/webpack.config.js index b7bf7cdd8ec..a55d9325ff5 100644 --- a/test/configCases/entry/function/webpack.config.js +++ b/test/configCases/entry/function/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry() { diff --git a/test/configCases/entry/issue-1068/webpack.config.js b/test/configCases/entry/issue-1068/webpack.config.js index e1229c307c1..db676c98c94 100644 --- a/test/configCases/entry/issue-1068/webpack.config.js +++ b/test/configCases/entry/issue-1068/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: [ diff --git a/test/configCases/entry/issue-12562/test.config.js b/test/configCases/entry/issue-12562/test.config.js index b1fbb4ba6a7..3091b7d6f34 100644 --- a/test/configCases/entry/issue-12562/test.config.js +++ b/test/configCases/entry/issue-12562/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime.js", "./app.js", "./home.js"]; diff --git a/test/configCases/entry/issue-12562/webpack.config.js b/test/configCases/entry/issue-12562/webpack.config.js index 2e0423bbc89..e96ea195529 100644 --- a/test/configCases/entry/issue-12562/webpack.config.js +++ b/test/configCases/entry/issue-12562/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/entry/issue-13637/test.config.js b/test/configCases/entry/issue-13637/test.config.js index 89dad6d83d7..e9077fd3e6b 100644 --- a/test/configCases/entry/issue-13637/test.config.js +++ b/test/configCases/entry/issue-13637/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const System = require("../../../helpers/fakeSystem"); module.exports = { diff --git a/test/configCases/entry/issue-13637/webpack.config.js b/test/configCases/entry/issue-13637/webpack.config.js index ba3c6618ca1..74410018ebc 100644 --- a/test/configCases/entry/issue-13637/webpack.config.js +++ b/test/configCases/entry/issue-13637/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/entry/issue-8110/webpack.config.js b/test/configCases/entry/issue-8110/webpack.config.js index 1954865e205..c86e6227800 100644 --- a/test/configCases/entry/issue-8110/webpack.config.js +++ b/test/configCases/entry/issue-8110/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/entry/no-chunking/test.config.js b/test/configCases/entry/no-chunking/test.config.js index 81a03d4c348..cd9efc4d643 100644 --- a/test/configCases/entry/no-chunking/test.config.js +++ b/test/configCases/entry/no-chunking/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./b.js", "./c.js", "./runtime.js", "./d.js"]; diff --git a/test/configCases/entry/no-chunking/webpack.config.js b/test/configCases/entry/no-chunking/webpack.config.js index 3becbc09b6f..523f76de456 100644 --- a/test/configCases/entry/no-chunking/webpack.config.js +++ b/test/configCases/entry/no-chunking/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/entry/require-entry-point/webpack.config.js b/test/configCases/entry/require-entry-point/webpack.config.js index f8d4436d2a3..915e708d565 100644 --- a/test/configCases/entry/require-entry-point/webpack.config.js +++ b/test/configCases/entry/require-entry-point/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/entry/single-entry-point/webpack.config.js b/test/configCases/entry/single-entry-point/webpack.config.js index 777b9f6bd71..eb5e23c15a1 100644 --- a/test/configCases/entry/single-entry-point/webpack.config.js +++ b/test/configCases/entry/single-entry-point/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./single-entry-point" diff --git a/test/configCases/entry/usage-info-in-multiple-entry-points/webpack.config.js b/test/configCases/entry/usage-info-in-multiple-entry-points/webpack.config.js index 294adb67dd1..8dcbfa586b7 100644 --- a/test/configCases/entry/usage-info-in-multiple-entry-points/webpack.config.js +++ b/test/configCases/entry/usage-info-in-multiple-entry-points/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: ["./a", "./b"] diff --git a/test/configCases/entry/weird-names/test.config.js b/test/configCases/entry/weird-names/test.config.js index f6819f8a118..e4cf41ca7e8 100644 --- a/test/configCases/entry/weird-names/test.config.js +++ b/test/configCases/entry/weird-names/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i, options) { return [ diff --git a/test/configCases/entry/weird-names/webpack.config.js b/test/configCases/entry/weird-names/webpack.config.js index 6d3833d4946..82da45ccd3e 100644 --- a/test/configCases/entry/weird-names/webpack.config.js +++ b/test/configCases/entry/weird-names/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const entry = { "././../entry/point/./../": "./index.js", "/////": "./index.js", diff --git a/test/configCases/entry/weird-names2/test.config.js b/test/configCases/entry/weird-names2/test.config.js index d54f564d233..c5b6d32c1d1 100644 --- a/test/configCases/entry/weird-names2/test.config.js +++ b/test/configCases/entry/weird-names2/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i, options) { return [ diff --git a/test/configCases/entry/weird-names2/webpack.config.js b/test/configCases/entry/weird-names2/webpack.config.js index 831cc48f4d4..14afcd93b0d 100644 --- a/test/configCases/entry/weird-names2/webpack.config.js +++ b/test/configCases/entry/weird-names2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const entry = { "././../weird-names2-out/entry/point/./../entry": "./index.js", "..//weird-names2-out////entry": "./index.js" diff --git a/test/configCases/errors/asset-options-validation/errors.js b/test/configCases/errors/asset-options-validation/errors.js index cc7b138a373..974dd6069aa 100644 --- a/test/configCases/errors/asset-options-validation/errors.js +++ b/test/configCases/errors/asset-options-validation/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Invalid generator object\. Asset Modules Plugin has been initialized using a generator object that does not match the API schema/, diff --git a/test/configCases/errors/asset-options-validation/webpack.config.js b/test/configCases/errors/asset-options-validation/webpack.config.js index 6a2069d8c86..db05dda25a7 100644 --- a/test/configCases/errors/asset-options-validation/webpack.config.js +++ b/test/configCases/errors/asset-options-validation/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/errors/case-emit/errors.js b/test/configCases/errors/case-emit/errors.js index 0e4de24617e..05131a63eeb 100644 --- a/test/configCases/errors/case-emit/errors.js +++ b/test/configCases/errors/case-emit/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/only differs in casing/, /a\.js/, /A\.js/]]; diff --git a/test/configCases/errors/case-emit/webpack.config.js b/test/configCases/errors/case-emit/webpack.config.js index 9b771c2547c..811857876d7 100644 --- a/test/configCases/errors/case-emit/webpack.config.js +++ b/test/configCases/errors/case-emit/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/errors/depend-on-and-runtime/errors.js b/test/configCases/errors/depend-on-and-runtime/errors.js index 30fed466758..d7012cb9fcb 100644 --- a/test/configCases/errors/depend-on-and-runtime/errors.js +++ b/test/configCases/errors/depend-on-and-runtime/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Entrypoint 'b1' has a 'runtime' option which points to another entrypoint named 'a1'/ diff --git a/test/configCases/errors/depend-on-and-runtime/webpack.config.js b/test/configCases/errors/depend-on-and-runtime/webpack.config.js index 964c679dc0d..c4cdc14f457 100644 --- a/test/configCases/errors/depend-on-and-runtime/webpack.config.js +++ b/test/configCases/errors/depend-on-and-runtime/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/errors/depend-on-error/errors.js b/test/configCases/errors/depend-on-error/errors.js index 190bf41d53d..cc54ee51a0b 100644 --- a/test/configCases/errors/depend-on-error/errors.js +++ b/test/configCases/errors/depend-on-error/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Can't resolve '\.\/file-does-not-exist\.js'/]]; diff --git a/test/configCases/errors/depend-on-error/webpack.config.js b/test/configCases/errors/depend-on-error/webpack.config.js index 967e70817c4..b36e731c459 100644 --- a/test/configCases/errors/depend-on-error/webpack.config.js +++ b/test/configCases/errors/depend-on-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/errors/entry-not-found/errors.js b/test/configCases/errors/entry-not-found/errors.js index 648b41f3f03..fe6443acc8e 100644 --- a/test/configCases/errors/entry-not-found/errors.js +++ b/test/configCases/errors/entry-not-found/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/^Module not found/, /.\/index\.js/]]; diff --git a/test/configCases/errors/entry-not-found/webpack.config.js b/test/configCases/errors/entry-not-found/webpack.config.js index 3583b70a321..27313115dcd 100644 --- a/test/configCases/errors/entry-not-found/webpack.config.js +++ b/test/configCases/errors/entry-not-found/webpack.config.js @@ -1,2 +1,4 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = {}; diff --git a/test/configCases/errors/exception-in-chunk-renderer/errors.js b/test/configCases/errors/exception-in-chunk-renderer/errors.js index 69525586300..0bc6c5af382 100644 --- a/test/configCases/errors/exception-in-chunk-renderer/errors.js +++ b/test/configCases/errors/exception-in-chunk-renderer/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Test exception/]]; diff --git a/test/configCases/errors/exception-in-chunk-renderer/webpack.config.js b/test/configCases/errors/exception-in-chunk-renderer/webpack.config.js index d769e2c6e59..ad222c1514d 100644 --- a/test/configCases/errors/exception-in-chunk-renderer/webpack.config.js +++ b/test/configCases/errors/exception-in-chunk-renderer/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compiler} Compiler */ class ThrowsExceptionInRender { @@ -5,7 +7,7 @@ class ThrowsExceptionInRender { * @param {Compiler} compiler compiler */ apply(compiler) { - compiler.hooks.compilation.tap("ThrowsException", compilation => { + compiler.hooks.compilation.tap("ThrowsException", (compilation) => { compilation.mainTemplate.hooks.requireExtensions.tap( "ThrowsException", () => { diff --git a/test/configCases/errors/generator-generate-error/errors.js b/test/configCases/errors/generator-generate-error/errors.js index 5cc27fc1939..265073eab2b 100644 --- a/test/configCases/errors/generator-generate-error/errors.js +++ b/test/configCases/errors/generator-generate-error/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /javascript\/auto error message/, /asset\/inline error message/, diff --git a/test/configCases/errors/generator-generate-error/infrastructure-log.js b/test/configCases/errors/generator-generate-error/infrastructure-log.js index 10532afb6b2..951fafae256 100644 --- a/test/configCases/errors/generator-generate-error/infrastructure-log.js +++ b/test/configCases/errors/generator-generate-error/infrastructure-log.js @@ -1,4 +1,6 @@ -module.exports = options => { +"use strict"; + +module.exports = (options) => { if (options.cache && options.cache.type === "filesystem") { return [/Pack got invalid because of write to/]; } diff --git a/test/configCases/errors/generator-generate-error/test.config.js b/test/configCases/errors/generator-generate-error/test.config.js index ac2a9c3a4c3..28c3d22f55d 100644 --- a/test/configCases/errors/generator-generate-error/test.config.js +++ b/test/configCases/errors/generator-generate-error/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const findOutputFiles = require("../../../helpers/findOutputFiles"); module.exports = { diff --git a/test/configCases/errors/generator-generate-error/test.filter.js b/test/configCases/errors/generator-generate-error/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/configCases/errors/generator-generate-error/test.filter.js +++ b/test/configCases/errors/generator-generate-error/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/errors/generator-generate-error/webpack.config.js b/test/configCases/errors/generator-generate-error/webpack.config.js index ac63555dccb..85c772c3695 100644 --- a/test/configCases/errors/generator-generate-error/webpack.config.js +++ b/test/configCases/errors/generator-generate-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/errors/import-missing/errors.js b/test/configCases/errors/import-missing/errors.js index d85236a2c74..3c4e17e881e 100644 --- a/test/configCases/errors/import-missing/errors.js +++ b/test/configCases/errors/import-missing/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Module not found/]]; diff --git a/test/configCases/errors/import-missing/webpack.config.js b/test/configCases/errors/import-missing/webpack.config.js index 61694bc0914..ac887dc073d 100644 --- a/test/configCases/errors/import-missing/webpack.config.js +++ b/test/configCases/errors/import-missing/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { bail: true diff --git a/test/configCases/errors/multi-entry-missing-module/test.config.js b/test/configCases/errors/multi-entry-missing-module/test.config.js index 700b7acb674..212ce63ec51 100644 --- a/test/configCases/errors/multi-entry-missing-module/test.config.js +++ b/test/configCases/errors/multi-entry-missing-module/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./b.js", "./bundle0.js"]; diff --git a/test/configCases/errors/multi-entry-missing-module/webpack.config.js b/test/configCases/errors/multi-entry-missing-module/webpack.config.js index e832f4a8c16..91e207bd55e 100644 --- a/test/configCases/errors/multi-entry-missing-module/webpack.config.js +++ b/test/configCases/errors/multi-entry-missing-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const IgnorePlugin = require("../../../../").IgnorePlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/errors/self-reexport/webpack.config.js b/test/configCases/errors/self-reexport/webpack.config.js index dffc81bba10..7389b128cd5 100644 --- a/test/configCases/errors/self-reexport/webpack.config.js +++ b/test/configCases/errors/self-reexport/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production" diff --git a/test/configCases/externals/async-externals/webpack.config.js b/test/configCases/externals/async-externals/webpack.config.js index 68ccc42a6e2..03436263368 100644 --- a/test/configCases/externals/async-externals/webpack.config.js +++ b/test/configCases/externals/async-externals/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { target: ["web", "es2020"], output: { diff --git a/test/configCases/externals/concatenated-module/test.filter.js b/test/configCases/externals/concatenated-module/test.filter.js index 4afe691c9d7..831073aef62 100644 --- a/test/configCases/externals/concatenated-module/test.filter.js +++ b/test/configCases/externals/concatenated-module/test.filter.js @@ -1,2 +1,4 @@ +"use strict"; + module.exports = () => !process.version.startsWith("v10.") && !process.version.startsWith("v12."); diff --git a/test/configCases/externals/concatenated-module/webpack.config.js b/test/configCases/externals/concatenated-module/webpack.config.js index 302e048f3d9..9ddd5aed398 100644 --- a/test/configCases/externals/concatenated-module/webpack.config.js +++ b/test/configCases/externals/concatenated-module/webpack.config.js @@ -1,5 +1,7 @@ +"use strict"; + /** @type {(variant: boolean) => import("../../../../").Configuration} */ -const config = o => ({ +const config = (o) => ({ externals: { "module-fs": o ? "module fs" : "module fs/promises", fs: o ? "node-commonjs fs" : "node-commonjs fs/promises", diff --git a/test/configCases/externals/concatenated/webpack.config.js b/test/configCases/externals/concatenated/webpack.config.js index 281919c8caa..c247dd6a39b 100644 --- a/test/configCases/externals/concatenated/webpack.config.js +++ b/test/configCases/externals/concatenated/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { externals: { diff --git a/test/configCases/externals/devtool-eval-concatenate-modules/imported.js b/test/configCases/externals/devtool-eval-concatenate-modules/imported.js new file mode 100644 index 00000000000..aef22247d75 --- /dev/null +++ b/test/configCases/externals/devtool-eval-concatenate-modules/imported.js @@ -0,0 +1 @@ +export default 1; diff --git a/test/configCases/externals/devtool-eval-concatenate-modules/index.js b/test/configCases/externals/devtool-eval-concatenate-modules/index.js new file mode 100644 index 00000000000..69d26e2947c --- /dev/null +++ b/test/configCases/externals/devtool-eval-concatenate-modules/index.js @@ -0,0 +1,7 @@ +import imported from "./imported.mjs"; + +it("should allow to use externals in concatenated modules", () => { + expect(imported).toBe(1); +}); + +export { imported } \ No newline at end of file diff --git a/test/configCases/externals/devtool-eval-concatenate-modules/test.config.js b/test/configCases/externals/devtool-eval-concatenate-modules/test.config.js new file mode 100644 index 00000000000..04d5e6a4b35 --- /dev/null +++ b/test/configCases/externals/devtool-eval-concatenate-modules/test.config.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + findBundle() { + return "./main.mjs"; + } +}; diff --git a/test/configCases/externals/devtool-eval-concatenate-modules/webpack.config.js b/test/configCases/externals/devtool-eval-concatenate-modules/webpack.config.js new file mode 100644 index 00000000000..2b8f2064663 --- /dev/null +++ b/test/configCases/externals/devtool-eval-concatenate-modules/webpack.config.js @@ -0,0 +1,38 @@ +"use strict"; + +/** @type {import("../../../../types").Configuration} */ +module.exports = { + devtool: "eval", + module: { + parser: { + javascript: { + importMeta: false + } + } + }, + entry: { + main: "./index.js", + imported: { + import: "./imported.js", + library: { + type: "module" + } + } + }, + target: "node14", + output: { + filename: "[name].mjs", + module: true, + library: { + type: "module" + } + }, + externals: "./imported.mjs", + externalsType: "module", + experiments: { + outputModule: true + }, + optimization: { + concatenateModules: true + } +}; diff --git a/test/configCases/externals/export-fn-cjs/webpack.config.js b/test/configCases/externals/export-fn-cjs/webpack.config.js index 564d7c85986..4484e6fe390 100644 --- a/test/configCases/externals/export-fn-cjs/webpack.config.js +++ b/test/configCases/externals/export-fn-cjs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { externals: { diff --git a/test/configCases/externals/export-fn-esm/webpack.config.js b/test/configCases/externals/export-fn-esm/webpack.config.js index 564d7c85986..4484e6fe390 100644 --- a/test/configCases/externals/export-fn-esm/webpack.config.js +++ b/test/configCases/externals/export-fn-esm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { externals: { diff --git a/test/configCases/externals/externals-array/webpack.config.js b/test/configCases/externals/externals-array/webpack.config.js index 8d052033421..9d178995217 100644 --- a/test/configCases/externals/externals-array/webpack.config.js +++ b/test/configCases/externals/externals-array/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../types").Configuration[]} */ diff --git a/test/configCases/externals/externals-in-chunk/webpack.config.js b/test/configCases/externals/externals-in-chunk/webpack.config.js index f147c9f5b3a..85828e3132b 100644 --- a/test/configCases/externals/externals-in-chunk/webpack.config.js +++ b/test/configCases/externals/externals-in-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { externals: { diff --git a/test/configCases/externals/externals-in-commons-chunk/test.config.js b/test/configCases/externals/externals-in-commons-chunk/test.config.js index 33095374f40..10f6e39f723 100644 --- a/test/configCases/externals/externals-in-commons-chunk/test.config.js +++ b/test/configCases/externals/externals-in-commons-chunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./common.js", "./main.js"]; diff --git a/test/configCases/externals/externals-in-commons-chunk/webpack.config.js b/test/configCases/externals/externals-in-commons-chunk/webpack.config.js index 85305d390af..0690856e069 100644 --- a/test/configCases/externals/externals-in-commons-chunk/webpack.config.js +++ b/test/configCases/externals/externals-in-commons-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/externals/externals-system-custom/test.config.js b/test/configCases/externals/externals-system-custom/test.config.js index bbe84a3313d..e63e63adecf 100644 --- a/test/configCases/externals/externals-system-custom/test.config.js +++ b/test/configCases/externals/externals-system-custom/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const System = require("../../../helpers/fakeSystem"); module.exports = { diff --git a/test/configCases/externals/externals-system-custom/webpack.config.js b/test/configCases/externals/externals-system-custom/webpack.config.js index 16c4b3f9dad..c8a1aca055f 100644 --- a/test/configCases/externals/externals-system-custom/webpack.config.js +++ b/test/configCases/externals/externals-system-custom/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { output: { diff --git a/test/configCases/externals/externals-system/test.config.js b/test/configCases/externals/externals-system/test.config.js index 5520b1daefe..39826c30785 100644 --- a/test/configCases/externals/externals-system/test.config.js +++ b/test/configCases/externals/externals-system/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const System = require("../../../helpers/fakeSystem"); module.exports = { diff --git a/test/configCases/externals/externals-system/webpack.config.js b/test/configCases/externals/externals-system/webpack.config.js index 7d3ab88f06e..0744e8a80ce 100644 --- a/test/configCases/externals/externals-system/webpack.config.js +++ b/test/configCases/externals/externals-system/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/externals/global/webpack.config.js b/test/configCases/externals/global/webpack.config.js index 0396bdef95a..d44abc7189c 100644 --- a/test/configCases/externals/global/webpack.config.js +++ b/test/configCases/externals/global/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { externals: { diff --git a/test/configCases/externals/harmony/webpack.config.js b/test/configCases/externals/harmony/webpack.config.js index 471b2a5ce23..6333facfd65 100644 --- a/test/configCases/externals/harmony/webpack.config.js +++ b/test/configCases/externals/harmony/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { externals: { diff --git a/test/configCases/externals/import-assertion/test.filter.js b/test/configCases/externals/import-assertion/test.filter.js index 50efa4454ac..8b36f73c4bf 100644 --- a/test/configCases/externals/import-assertion/test.filter.js +++ b/test/configCases/externals/import-assertion/test.filter.js @@ -1 +1,3 @@ +"use strict"; + module.exports = () => /^v(1[6-9]|21)/.test(process.version); diff --git a/test/configCases/externals/import-assertion/webpack.config.js b/test/configCases/externals/import-assertion/webpack.config.js index b73df70a503..0da4f83595f 100644 --- a/test/configCases/externals/import-assertion/webpack.config.js +++ b/test/configCases/externals/import-assertion/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const { @@ -19,7 +21,7 @@ module.exports = { plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("html-plugin", compilation => { + compiler.hooks.compilation.tap("html-plugin", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-plugin", diff --git a/test/configCases/externals/import-attributes/test.filter.js b/test/configCases/externals/import-attributes/test.filter.js index 2ce4d1c330e..c2a0580e79c 100644 --- a/test/configCases/externals/import-attributes/test.filter.js +++ b/test/configCases/externals/import-attributes/test.filter.js @@ -1 +1,3 @@ +"use strict"; + module.exports = () => /^v(2[2-9])/.test(process.version); diff --git a/test/configCases/externals/import-attributes/webpack.config.js b/test/configCases/externals/import-attributes/webpack.config.js index b73df70a503..0da4f83595f 100644 --- a/test/configCases/externals/import-attributes/webpack.config.js +++ b/test/configCases/externals/import-attributes/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const { @@ -19,7 +21,7 @@ module.exports = { plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("html-plugin", compilation => { + compiler.hooks.compilation.tap("html-plugin", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-plugin", diff --git a/test/configCases/externals/module-import/a.js b/test/configCases/externals/module-import/a.js index d923fc87a03..1440a3c5c9b 100644 --- a/test/configCases/externals/module-import/a.js +++ b/test/configCases/externals/module-import/a.js @@ -4,4 +4,11 @@ const external2 = require("external2"); // node-commonjs import external3_1 from "external3"; // module const external3_2 = import("external3"); // import +// Trigger concatenation +import { internalHelper, internalConstant } from "./lib-to-concat"; + console.log(external0, external1, external3_1, external3_2); +console.log(internalHelper(), internalConstant); + +// ESM export ensures module concatenation +export { external0, internalHelper }; diff --git a/test/configCases/externals/module-import/index.js b/test/configCases/externals/module-import/index.js index af64c4613b0..90246878f29 100644 --- a/test/configCases/externals/module-import/index.js +++ b/test/configCases/externals/module-import/index.js @@ -3,7 +3,7 @@ const path = require("path"); it("module-import should correctly get fallback type", function() { const content = fs.readFileSync(path.resolve(__dirname, "a.js"), "utf-8"); - expect(content).toContain(`import * as __WEBPACK_EXTERNAL_MODULE_external0__ from "external0"`); // module + expect(content).toContain(`import { default as default_0 } from "external0"`); // module expect(content).toContain(`import * as __WEBPACK_EXTERNAL_MODULE_external1__ from "external1"`); // module expect(content).toContain(`module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("external2")`); // node-commonjs expect(content).toContain(`import * as __WEBPACK_EXTERNAL_MODULE_external3__ from "external3"`); // module diff --git a/test/configCases/externals/module-import/lib-to-concat.js b/test/configCases/externals/module-import/lib-to-concat.js new file mode 100644 index 00000000000..ab5a2e2fcdf --- /dev/null +++ b/test/configCases/externals/module-import/lib-to-concat.js @@ -0,0 +1,6 @@ +// Trigger concatenation with a.js +export function internalHelper() { + return "internal"; +} + +export const internalConstant = 100; \ No newline at end of file diff --git a/test/configCases/externals/module-import/test.config.js b/test/configCases/externals/module-import/test.config.js index 8280b4d308c..8fd6a346cd4 100644 --- a/test/configCases/externals/module-import/test.config.js +++ b/test/configCases/externals/module-import/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle: () => ["main.js"] }; diff --git a/test/configCases/externals/module-import/webpack.config.js b/test/configCases/externals/module-import/webpack.config.js index eee267f8904..941efedc194 100644 --- a/test/configCases/externals/module-import/webpack.config.js +++ b/test/configCases/externals/module-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { target: ["web", "es2020"], @@ -14,7 +16,8 @@ module.exports = { main: "./index" }, optimization: { - concatenateModules: true + concatenateModules: true, + usedExports: true }, experiments: { outputModule: true diff --git a/test/configCases/externals/node-require/webpack.config.js b/test/configCases/externals/node-require/webpack.config.js index 5d99e03170f..5559bacdcfd 100644 --- a/test/configCases/externals/node-require/webpack.config.js +++ b/test/configCases/externals/node-require/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../types").Configuration} */ diff --git a/test/configCases/externals/non-amd-externals-amd/test.config.js b/test/configCases/externals/non-amd-externals-amd/test.config.js index 680a119a5a8..25b040f0d9e 100644 --- a/test/configCases/externals/non-amd-externals-amd/test.config.js +++ b/test/configCases/externals/non-amd-externals-amd/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { modules: { external0: "module 0" diff --git a/test/configCases/externals/non-amd-externals-amd/webpack.config.js b/test/configCases/externals/non-amd-externals-amd/webpack.config.js index 6014360c8ad..ed60900c24b 100644 --- a/test/configCases/externals/non-amd-externals-amd/webpack.config.js +++ b/test/configCases/externals/non-amd-externals-amd/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/externals/non-umd-externals-umd/test.config.js b/test/configCases/externals/non-umd-externals-umd/test.config.js index 680a119a5a8..25b040f0d9e 100644 --- a/test/configCases/externals/non-umd-externals-umd/test.config.js +++ b/test/configCases/externals/non-umd-externals-umd/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { modules: { external0: "module 0" diff --git a/test/configCases/externals/non-umd-externals-umd/webpack.config.js b/test/configCases/externals/non-umd-externals-umd/webpack.config.js index bbb4c9b030e..8a6266b37f5 100644 --- a/test/configCases/externals/non-umd-externals-umd/webpack.config.js +++ b/test/configCases/externals/non-umd-externals-umd/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/externals/non-umd-externals-umd2/test.config.js b/test/configCases/externals/non-umd-externals-umd2/test.config.js index 680a119a5a8..25b040f0d9e 100644 --- a/test/configCases/externals/non-umd-externals-umd2/test.config.js +++ b/test/configCases/externals/non-umd-externals-umd2/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { modules: { external0: "module 0" diff --git a/test/configCases/externals/non-umd-externals-umd2/webpack.config.js b/test/configCases/externals/non-umd-externals-umd2/webpack.config.js index 423ba3992e4..736d61e6d63 100644 --- a/test/configCases/externals/non-umd-externals-umd2/webpack.config.js +++ b/test/configCases/externals/non-umd-externals-umd2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/externals/optional-externals-cjs/webpack.config.js b/test/configCases/externals/optional-externals-cjs/webpack.config.js index 59b592cacb9..a508493e9fb 100644 --- a/test/configCases/externals/optional-externals-cjs/webpack.config.js +++ b/test/configCases/externals/optional-externals-cjs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/externals/optional-externals-root/webpack.config.js b/test/configCases/externals/optional-externals-root/webpack.config.js index cb1a0c126d0..50962ea6d0d 100644 --- a/test/configCases/externals/optional-externals-root/webpack.config.js +++ b/test/configCases/externals/optional-externals-root/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { externalsType: "var", diff --git a/test/configCases/externals/optional-externals-umd/webpack.config.js b/test/configCases/externals/optional-externals-umd/webpack.config.js index ec8b3393897..f7debc17dbe 100644 --- a/test/configCases/externals/optional-externals-umd/webpack.config.js +++ b/test/configCases/externals/optional-externals-umd/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/externals/optional-externals-umd2-mixed/webpack.config.js b/test/configCases/externals/optional-externals-umd2-mixed/webpack.config.js index f27ef3ea2a3..6e640555b00 100644 --- a/test/configCases/externals/optional-externals-umd2-mixed/webpack.config.js +++ b/test/configCases/externals/optional-externals-umd2-mixed/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/externals/optional-externals-umd2/webpack.config.js b/test/configCases/externals/optional-externals-umd2/webpack.config.js index d8f15c43738..823a9992370 100644 --- a/test/configCases/externals/optional-externals-umd2/webpack.config.js +++ b/test/configCases/externals/optional-externals-umd2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/externals/prefer-provided-over-built-in/webpack.config.js b/test/configCases/externals/prefer-provided-over-built-in/webpack.config.js index 29caaf13836..40d38782c25 100644 --- a/test/configCases/externals/prefer-provided-over-built-in/webpack.config.js +++ b/test/configCases/externals/prefer-provided-over-built-in/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { target: "node", externals: { diff --git a/test/configCases/externals/resolve-callback/webpack.config.js b/test/configCases/externals/resolve-callback/webpack.config.js index 6590f004090..697ce23511f 100644 --- a/test/configCases/externals/resolve-callback/webpack.config.js +++ b/test/configCases/externals/resolve-callback/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("enhanced-resolve").ResolveRequest} ResolveRequest */ /** @typedef {import("../../../../").ExternalItemFunctionData} ExternalItemFunctionData */ diff --git a/test/configCases/externals/resolve/webpack.config.js b/test/configCases/externals/resolve/webpack.config.js index b712d132d91..d2d8497e836 100644 --- a/test/configCases/externals/resolve/webpack.config.js +++ b/test/configCases/externals/resolve/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").ExternalItemFunctionData} ExternalItemFunctionData */ /** @typedef {import("../../../../").ExternalItemFunctionPromise} ExternalItemFunctionPromise */ /** @typedef {import("../../../../").ExternalItemFunctionDataGetResolve} ExternalItemFunctionDataGetResolve */ diff --git a/test/configCases/externals/this/webpack.config.js b/test/configCases/externals/this/webpack.config.js index 3e9153e51eb..bbd810cdfc4 100644 --- a/test/configCases/externals/this/webpack.config.js +++ b/test/configCases/externals/this/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/filename-template/filename-function/test.config.js b/test/configCases/filename-template/filename-function/test.config.js index 57cc4f4b284..cdc829f688b 100644 --- a/test/configCases/filename-template/filename-function/test.config.js +++ b/test/configCases/filename-template/filename-function/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["11.js", "22.js", "aa.js", "bbb.js"]; diff --git a/test/configCases/filename-template/filename-function/webpack.config.js b/test/configCases/filename-template/filename-function/webpack.config.js index 9ce08f8c224..eac0922a86a 100644 --- a/test/configCases/filename-template/filename-function/webpack.config.js +++ b/test/configCases/filename-template/filename-function/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Chunk & { name: string }} Chunk */ /** @typedef {import("../../../../").PathData & { chunk: Chunk }} PathData */ @@ -12,7 +14,7 @@ module.exports = { * @param {PathData} data data * @returns {string} filename */ - filename: data => + filename: (data) => `${data.chunk.name + data.chunk.name + data.chunk.name}.js` } }, @@ -21,11 +23,11 @@ module.exports = { * @param {PathData} data data * @returns {string} filename */ - filename: data => `${data.chunk.name + data.chunk.name}.js`, + filename: (data) => `${data.chunk.name + data.chunk.name}.js`, /** * @param {PathData} data data * @returns {string} filename */ - chunkFilename: data => `${data.chunk.name + data.chunk.name}.js` + chunkFilename: (data) => `${data.chunk.name + data.chunk.name}.js` } }; diff --git a/test/configCases/filename-template/module-filename-template/webpack.config.js b/test/configCases/filename-template/module-filename-template/webpack.config.js index 80a78521c0b..0b12464218f 100644 --- a/test/configCases/filename-template/module-filename-template/webpack.config.js +++ b/test/configCases/filename-template/module-filename-template/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/filename-template/script-src-filename/webpack.config.js b/test/configCases/filename-template/script-src-filename/webpack.config.js index 8152f6c7681..c19d15e8f12 100644 --- a/test/configCases/filename-template/script-src-filename/webpack.config.js +++ b/test/configCases/filename-template/script-src-filename/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development" diff --git a/test/configCases/filename-template/split-chunks-filename/webpack.config.js b/test/configCases/filename-template/split-chunks-filename/webpack.config.js index b86d3f1b122..2558fd11f84 100644 --- a/test/configCases/filename-template/split-chunks-filename/webpack.config.js +++ b/test/configCases/filename-template/split-chunks-filename/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/finish-modules/simple/webpack.config.js b/test/configCases/finish-modules/simple/webpack.config.js index 0b14696c4c4..0b4b1decf6b 100644 --- a/test/configCases/finish-modules/simple/webpack.config.js +++ b/test/configCases/finish-modules/simple/webpack.config.js @@ -1,8 +1,10 @@ +"use strict"; + /** * @this {import("../../../../").Compiler} the compiler */ function testPlugin() { - this.hooks.compilation.tap("TestPlugin", compilation => { + this.hooks.compilation.tap("TestPlugin", (compilation) => { compilation.hooks.finishModules.tapAsync( "TestPlugin", (_modules, callback) => { diff --git a/test/configCases/graph/conditional-ensure/webpack.config.js b/test/configCases/graph/conditional-ensure/webpack.config.js index c4cca61071b..0ba7441fa46 100644 --- a/test/configCases/graph/conditional-ensure/webpack.config.js +++ b/test/configCases/graph/conditional-ensure/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/graph/conditional-reexport/test.config.js b/test/configCases/graph/conditional-reexport/test.config.js index a7d5e357230..bb94480055a 100644 --- a/test/configCases/graph/conditional-reexport/test.config.js +++ b/test/configCases/graph/conditional-reexport/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./lib.js", "./a.js", "./b.js"]; diff --git a/test/configCases/graph/conditional-reexport/webpack.config.js b/test/configCases/graph/conditional-reexport/webpack.config.js index b8cd3217e35..ab46ede46b3 100644 --- a/test/configCases/graph/conditional-reexport/webpack.config.js +++ b/test/configCases/graph/conditional-reexport/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("webpack").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/graph/issue-11770/test.config.js b/test/configCases/graph/issue-11770/test.config.js index ee8eace4eef..b23385953ef 100644 --- a/test/configCases/graph/issue-11770/test.config.js +++ b/test/configCases/graph/issue-11770/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/graph/issue-11770/webpack.config.js b/test/configCases/graph/issue-11770/webpack.config.js index 737dc91967d..723157811c9 100644 --- a/test/configCases/graph/issue-11770/webpack.config.js +++ b/test/configCases/graph/issue-11770/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/graph/issue-11856.2/test.config.js b/test/configCases/graph/issue-11856.2/test.config.js index 989a7739d98..f5d3f02d8f9 100644 --- a/test/configCases/graph/issue-11856.2/test.config.js +++ b/test/configCases/graph/issue-11856.2/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle: function (i, options) { return ["shared.js", "a.js", "b.js"]; diff --git a/test/configCases/graph/issue-11856.2/webpack.config.js b/test/configCases/graph/issue-11856.2/webpack.config.js index aa924728c07..059dc0d2d9b 100644 --- a/test/configCases/graph/issue-11856.2/webpack.config.js +++ b/test/configCases/graph/issue-11856.2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/graph/issue-11856/test.config.js b/test/configCases/graph/issue-11856/test.config.js index 5162706afa5..346f1fb1be7 100644 --- a/test/configCases/graph/issue-11856/test.config.js +++ b/test/configCases/graph/issue-11856/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["shared.js", "a.js", "b.js"]; diff --git a/test/configCases/graph/issue-11856/webpack.config.js b/test/configCases/graph/issue-11856/webpack.config.js index aa924728c07..059dc0d2d9b 100644 --- a/test/configCases/graph/issue-11856/webpack.config.js +++ b/test/configCases/graph/issue-11856/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/graph/issue-11863/test.config.js b/test/configCases/graph/issue-11863/test.config.js index 5f56a3e6c5e..fb30d2a64b6 100644 --- a/test/configCases/graph/issue-11863/test.config.js +++ b/test/configCases/graph/issue-11863/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/graph/issue-11863/webpack.config.js b/test/configCases/graph/issue-11863/webpack.config.js index e0616bcaaf7..8d5e7475a21 100644 --- a/test/configCases/graph/issue-11863/webpack.config.js +++ b/test/configCases/graph/issue-11863/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/hash-length/deterministic-module-ids/webpack.config.js b/test/configCases/hash-length/deterministic-module-ids/webpack.config.js index 089540e1b62..4ae15614625 100644 --- a/test/configCases/hash-length/deterministic-module-ids/webpack.config.js +++ b/test/configCases/hash-length/deterministic-module-ids/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration[]} */ diff --git a/test/configCases/hash-length/hashed-module-ids/webpack.config.js b/test/configCases/hash-length/hashed-module-ids/webpack.config.js index 7898abf3813..5f5eea96a32 100644 --- a/test/configCases/hash-length/hashed-module-ids/webpack.config.js +++ b/test/configCases/hash-length/hashed-module-ids/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration[]} */ diff --git a/test/configCases/hash-length/output-filename/test.config.js b/test/configCases/hash-length/output-filename/test.config.js index 63519c2815b..5b50bd0700a 100644 --- a/test/configCases/hash-length/output-filename/test.config.js +++ b/test/configCases/hash-length/output-filename/test.config.js @@ -1,7 +1,9 @@ +"use strict"; + const fs = require("fs"); const findFile = (files, regex) => - files.find(file => { + files.find((file) => { if (regex.test(file)) { return true; } diff --git a/test/configCases/hash-length/output-filename/webpack.config.js b/test/configCases/hash-length/output-filename/webpack.config.js index ae8679697bc..ecc76472ee1 100644 --- a/test/configCases/hash-length/output-filename/webpack.config.js +++ b/test/configCases/hash-length/output-filename/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration[]} */ diff --git a/test/configCases/inner-graph/_helpers/testModuleLoader.js b/test/configCases/inner-graph/_helpers/testModuleLoader.js index b6d54748dda..7f3a64f7ac6 100644 --- a/test/configCases/inner-graph/_helpers/testModuleLoader.js +++ b/test/configCases/inner-graph/_helpers/testModuleLoader.js @@ -3,8 +3,8 @@ module.exports = function () { const usedExports = JSON.parse(this.query.slice(1)); return [ `import { ${usedExports - .map(x => `${x} as export_${x}`) + .map((/** @type {string} */ x) => `${x} as export_${x}`) .join(", ")} } from "./module";`, - `export default [${usedExports.map(x => `export_${x}`).join(", ")}];` + `export default [${usedExports.map((/** @type {string} */ x) => `export_${x}`).join(", ")}];` ].join("\n"); }; diff --git a/test/configCases/inner-graph/altaskitButton/webpack.config.js b/test/configCases/inner-graph/altaskitButton/webpack.config.js index 0855084e75c..7d491ffc8b5 100644 --- a/test/configCases/inner-graph/altaskitButton/webpack.config.js +++ b/test/configCases/inner-graph/altaskitButton/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/basic/webpack.config.js b/test/configCases/inner-graph/basic/webpack.config.js index 5afb924300a..3246abfbd34 100644 --- a/test/configCases/inner-graph/basic/webpack.config.js +++ b/test/configCases/inner-graph/basic/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/blockScopes/webpack.config.js b/test/configCases/inner-graph/blockScopes/webpack.config.js index 192562029d4..8e5dc3f2a7e 100644 --- a/test/configCases/inner-graph/blockScopes/webpack.config.js +++ b/test/configCases/inner-graph/blockScopes/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/class/test.filter.js b/test/configCases/inner-graph/class/test.filter.js index 138d995647f..aa94ec7b474 100644 --- a/test/configCases/inner-graph/class/test.filter.js +++ b/test/configCases/inner-graph/class/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsClassFields = require("../../../helpers/supportsClassFields"); module.exports = () => supportsClassFields(); diff --git a/test/configCases/inner-graph/class/webpack.config.js b/test/configCases/inner-graph/class/webpack.config.js index 8b9ff9c9785..954d50511f8 100644 --- a/test/configCases/inner-graph/class/webpack.config.js +++ b/test/configCases/inner-graph/class/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); const base = ["getNameA", "getNameB"]; diff --git a/test/configCases/inner-graph/const/webpack.config.js b/test/configCases/inner-graph/const/webpack.config.js index 2500b9980fd..711ba875a08 100644 --- a/test/configCases/inner-graph/const/webpack.config.js +++ b/test/configCases/inner-graph/const/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/defaultArrow/webpack.config.js b/test/configCases/inner-graph/defaultArrow/webpack.config.js index 1f88aa09da1..8cf708c7bf7 100644 --- a/test/configCases/inner-graph/defaultArrow/webpack.config.js +++ b/test/configCases/inner-graph/defaultArrow/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/defaultClass/webpack.config.js b/test/configCases/inner-graph/defaultClass/webpack.config.js index 25bbfa8dc80..f7cc24d1422 100644 --- a/test/configCases/inner-graph/defaultClass/webpack.config.js +++ b/test/configCases/inner-graph/defaultClass/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/defaultExpression/webpack.config.js b/test/configCases/inner-graph/defaultExpression/webpack.config.js index a1310655931..670a8371590 100644 --- a/test/configCases/inner-graph/defaultExpression/webpack.config.js +++ b/test/configCases/inner-graph/defaultExpression/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/defaultFunction/webpack.config.js b/test/configCases/inner-graph/defaultFunction/webpack.config.js index 8fbe41b2fa8..52b9cdd8656 100644 --- a/test/configCases/inner-graph/defaultFunction/webpack.config.js +++ b/test/configCases/inner-graph/defaultFunction/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/defaultFunctionExpression/webpack.config.js b/test/configCases/inner-graph/defaultFunctionExpression/webpack.config.js index 8fbe41b2fa8..52b9cdd8656 100644 --- a/test/configCases/inner-graph/defaultFunctionExpression/webpack.config.js +++ b/test/configCases/inner-graph/defaultFunctionExpression/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/defaultId/webpack.config.js b/test/configCases/inner-graph/defaultId/webpack.config.js index 8fbe41b2fa8..52b9cdd8656 100644 --- a/test/configCases/inner-graph/defaultId/webpack.config.js +++ b/test/configCases/inner-graph/defaultId/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/defaultNamedFunction/webpack.config.js b/test/configCases/inner-graph/defaultNamedFunction/webpack.config.js index 8fbe41b2fa8..52b9cdd8656 100644 --- a/test/configCases/inner-graph/defaultNamedFunction/webpack.config.js +++ b/test/configCases/inner-graph/defaultNamedFunction/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/defaultNamedFunctionExpression/webpack.config.js b/test/configCases/inner-graph/defaultNamedFunctionExpression/webpack.config.js index 8fbe41b2fa8..52b9cdd8656 100644 --- a/test/configCases/inner-graph/defaultNamedFunctionExpression/webpack.config.js +++ b/test/configCases/inner-graph/defaultNamedFunctionExpression/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/eval-bailout/webpack.config.js b/test/configCases/inner-graph/eval-bailout/webpack.config.js index 92a87dd7d08..f140b4f06b0 100644 --- a/test/configCases/inner-graph/eval-bailout/webpack.config.js +++ b/test/configCases/inner-graph/eval-bailout/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/export/webpack.config.js b/test/configCases/inner-graph/export/webpack.config.js index 72e7846c297..9b3f370495a 100644 --- a/test/configCases/inner-graph/export/webpack.config.js +++ b/test/configCases/inner-graph/export/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/importAll/webpack.config.js b/test/configCases/inner-graph/importAll/webpack.config.js index 56826cc2b4b..b3275c0fe55 100644 --- a/test/configCases/inner-graph/importAll/webpack.config.js +++ b/test/configCases/inner-graph/importAll/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/issue-11678/webpack.config.js b/test/configCases/inner-graph/issue-11678/webpack.config.js index 400bb0b6812..1f6ca505c99 100644 --- a/test/configCases/inner-graph/issue-11678/webpack.config.js +++ b/test/configCases/inner-graph/issue-11678/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/issue-12669-mini/webpack.config.js b/test/configCases/inner-graph/issue-12669-mini/webpack.config.js index 879caaf7f9f..0760c5635a9 100644 --- a/test/configCases/inner-graph/issue-12669-mini/webpack.config.js +++ b/test/configCases/inner-graph/issue-12669-mini/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/issue-12669/webpack.config.js b/test/configCases/inner-graph/issue-12669/webpack.config.js index 735f61d3f64..d837bb975f1 100644 --- a/test/configCases/inner-graph/issue-12669/webpack.config.js +++ b/test/configCases/inner-graph/issue-12669/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/issue-17565/test.filter.js b/test/configCases/inner-graph/issue-17565/test.filter.js index 138d995647f..aa94ec7b474 100644 --- a/test/configCases/inner-graph/issue-17565/test.filter.js +++ b/test/configCases/inner-graph/issue-17565/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsClassFields = require("../../../helpers/supportsClassFields"); module.exports = () => supportsClassFields(); diff --git a/test/configCases/inner-graph/issue-17565/webpack.config.js b/test/configCases/inner-graph/issue-17565/webpack.config.js index 8f29d9f872a..3c8fed58bf2 100644 --- a/test/configCases/inner-graph/issue-17565/webpack.config.js +++ b/test/configCases/inner-graph/issue-17565/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/localReference/webpack.config.js b/test/configCases/inner-graph/localReference/webpack.config.js index 030ae45e0a1..a29fd1edf51 100644 --- a/test/configCases/inner-graph/localReference/webpack.config.js +++ b/test/configCases/inner-graph/localReference/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/nested/webpack.config.js b/test/configCases/inner-graph/nested/webpack.config.js index 86ac4f223a1..f7b22af99f0 100644 --- a/test/configCases/inner-graph/nested/webpack.config.js +++ b/test/configCases/inner-graph/nested/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/pr-18342/test.config.js b/test/configCases/inner-graph/pr-18342/test.config.js index ce98c463c7f..ffa7d375ed6 100644 --- a/test/configCases/inner-graph/pr-18342/test.config.js +++ b/test/configCases/inner-graph/pr-18342/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const findOutputFiles = require("../../../helpers/findOutputFiles"); module.exports = { diff --git a/test/configCases/inner-graph/pr-18342/webpack.config.js b/test/configCases/inner-graph/pr-18342/webpack.config.js index 2d487f51dc2..13e42680b35 100644 --- a/test/configCases/inner-graph/pr-18342/webpack.config.js +++ b/test/configCases/inner-graph/pr-18342/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { target: ["node"], entry: { diff --git a/test/configCases/inner-graph/pure/webpack.config.js b/test/configCases/inner-graph/pure/webpack.config.js index ee9fe7e3352..cde8d1c7938 100644 --- a/test/configCases/inner-graph/pure/webpack.config.js +++ b/test/configCases/inner-graph/pure/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/ramdaIdentical/webpack.config.js b/test/configCases/inner-graph/ramdaIdentical/webpack.config.js index 902433dda9d..19d73ddb16c 100644 --- a/test/configCases/inner-graph/ramdaIdentical/webpack.config.js +++ b/test/configCases/inner-graph/ramdaIdentical/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/specifier/webpack.config.js b/test/configCases/inner-graph/specifier/webpack.config.js index aab43f7f1be..1a1c78b404f 100644 --- a/test/configCases/inner-graph/specifier/webpack.config.js +++ b/test/configCases/inner-graph/specifier/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/varNotWritten/webpack.config.js b/test/configCases/inner-graph/varNotWritten/webpack.config.js index 38f2876301e..98947282627 100644 --- a/test/configCases/inner-graph/varNotWritten/webpack.config.js +++ b/test/configCases/inner-graph/varNotWritten/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/inner-graph/varWritten/webpack.config.js b/test/configCases/inner-graph/varWritten/webpack.config.js index 38f2876301e..98947282627 100644 --- a/test/configCases/inner-graph/varWritten/webpack.config.js +++ b/test/configCases/inner-graph/varWritten/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ diff --git a/test/configCases/issues/issue-12993/test.config.js b/test/configCases/issues/issue-12993/test.config.js index 7e3084c7bdf..41ca01361b2 100644 --- a/test/configCases/issues/issue-12993/test.config.js +++ b/test/configCases/issues/issue-12993/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { afterExecute() { delete global.lib; diff --git a/test/configCases/issues/issue-12993/webpack.config.js b/test/configCases/issues/issue-12993/webpack.config.js index f462f7e496f..8819fe80079 100644 --- a/test/configCases/issues/issue-12993/webpack.config.js +++ b/test/configCases/issues/issue-12993/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { mode: "development", diff --git a/test/configCases/issues/issue-14974/test.filter.js b/test/configCases/issues/issue-14974/test.filter.js index e4bb7db300b..b88fedb740b 100644 --- a/test/configCases/issues/issue-14974/test.filter.js +++ b/test/configCases/issues/issue-14974/test.filter.js @@ -1 +1,3 @@ +"use strict"; + module.exports = () => process.version.slice(0, 4) !== "v10."; diff --git a/test/configCases/issues/issue-14974/webpack.config.js b/test/configCases/issues/issue-14974/webpack.config.js index 24a11572636..06149563136 100644 --- a/test/configCases/issues/issue-14974/webpack.config.js +++ b/test/configCases/issues/issue-14974/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { HotModuleReplacementPlugin } = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/issues/issue-17459/webpack.config.js b/test/configCases/issues/issue-17459/webpack.config.js index dffc81bba10..7389b128cd5 100644 --- a/test/configCases/issues/issue-17459/webpack.config.js +++ b/test/configCases/issues/issue-17459/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production" diff --git a/test/configCases/issues/issue-3596/webpack.config.js b/test/configCases/issues/issue-3596/webpack.config.js index cd23171cf55..6f82711b34b 100644 --- a/test/configCases/issues/issue-3596/webpack.config.js +++ b/test/configCases/issues/issue-3596/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { @@ -9,7 +11,7 @@ module.exports = { }, plugins: [ function apply() { - this.hooks.compilation.tap("TestPlugin", compilation => { + this.hooks.compilation.tap("TestPlugin", (compilation) => { compilation.hooks.processAssets.tap("TestPlugin", () => { delete compilation.assets["b.js"]; }); diff --git a/test/configCases/issues/issue-7563/test.config.js b/test/configCases/issues/issue-7563/test.config.js index 8199264de73..b8044de7cd6 100644 --- a/test/configCases/issues/issue-7563/test.config.js +++ b/test/configCases/issues/issue-7563/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); module.exports = { @@ -5,7 +7,7 @@ module.exports = { findBundle(i, options) { const regex = new RegExp(`^bundle.${options.name}`, "i"); const files = fs.readdirSync(options.output.path); - const bundle = files.find(file => regex.test(file)); + const bundle = files.find((file) => regex.test(file)); if (!bundle) { throw new Error( diff --git a/test/configCases/json/bailout-flag-dep-export-perf/webpack.config.js b/test/configCases/json/bailout-flag-dep-export-perf/webpack.config.js index 22f491d9943..ea739dd445d 100644 --- a/test/configCases/json/bailout-flag-dep-export-perf/webpack.config.js +++ b/test/configCases/json/bailout-flag-dep-export-perf/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/json/flag-dep-export-perf/webpack.config.js b/test/configCases/json/flag-dep-export-perf/webpack.config.js index 8152f6c7681..c19d15e8f12 100644 --- a/test/configCases/json/flag-dep-export-perf/webpack.config.js +++ b/test/configCases/json/flag-dep-export-perf/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development" diff --git a/test/configCases/json/generator-json-parse-false/webpack.config.js b/test/configCases/json/generator-json-parse-false/webpack.config.js index f687f8406cb..67388be4319 100644 --- a/test/configCases/json/generator-json-parse-false/webpack.config.js +++ b/test/configCases/json/generator-json-parse-false/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: false, diff --git a/test/configCases/json/generator-json-parse-true/webpack.config.js b/test/configCases/json/generator-json-parse-true/webpack.config.js index 93230914b2f..20bea40d291 100644 --- a/test/configCases/json/generator-json-parse-true/webpack.config.js +++ b/test/configCases/json/generator-json-parse-true/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: false, diff --git a/test/configCases/json/only-null/webpack.config.js b/test/configCases/json/only-null/webpack.config.js index dffc81bba10..7389b128cd5 100644 --- a/test/configCases/json/only-null/webpack.config.js +++ b/test/configCases/json/only-null/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production" diff --git a/test/configCases/json/only-string/webpack.config.js b/test/configCases/json/only-string/webpack.config.js index dffc81bba10..7389b128cd5 100644 --- a/test/configCases/json/only-string/webpack.config.js +++ b/test/configCases/json/only-string/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production" diff --git a/test/configCases/json/proto/webpack.config.js b/test/configCases/json/proto/webpack.config.js index dd53b28785a..9b5e111fde7 100644 --- a/test/configCases/json/proto/webpack.config.js +++ b/test/configCases/json/proto/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: false, diff --git a/test/configCases/json/top-level-json-parser/webpack.config.js b/test/configCases/json/top-level-json-parser/webpack.config.js index 1b640981249..e550c66a2ad 100644 --- a/test/configCases/json/top-level-json-parser/webpack.config.js +++ b/test/configCases/json/top-level-json-parser/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const toml = require("toml"); /** @type {import("../../../../").Configuration[]} */ diff --git a/test/configCases/json/tree-shaking-default/warnings.js b/test/configCases/json/tree-shaking-default/warnings.js index 6857cae537e..7835012931b 100644 --- a/test/configCases/json/tree-shaking-default/warnings.js +++ b/test/configCases/json/tree-shaking-default/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Should not import the named export/]]; diff --git a/test/configCases/json/tree-shaking-default/webpack.config.js b/test/configCases/json/tree-shaking-default/webpack.config.js index 5e6a2dea4f0..6dd5d4e3eec 100644 --- a/test/configCases/json/tree-shaking-default/webpack.config.js +++ b/test/configCases/json/tree-shaking-default/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/layer/context-and-css/test.config.js b/test/configCases/layer/context-and-css/test.config.js index c4561c568b1..f9d83d5fd16 100644 --- a/test/configCases/layer/context-and-css/test.config.js +++ b/test/configCases/layer/context-and-css/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const light = scope.window.document.createElement("link"); diff --git a/test/configCases/layer/context-and-css/webpack.config.js b/test/configCases/layer/context-and-css/webpack.config.js index 838b847cc99..58565788398 100644 --- a/test/configCases/layer/context-and-css/webpack.config.js +++ b/test/configCases/layer/context-and-css/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/layer/context/test.config.js b/test/configCases/layer/context/test.config.js index c6cd71fd288..48a298849e1 100644 --- a/test/configCases/layer/context/test.config.js +++ b/test/configCases/layer/context/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./light.js", "./dark.js"]; diff --git a/test/configCases/layer/context/webpack.config.js b/test/configCases/layer/context/webpack.config.js index 41ed5eb13ee..ef301edd96d 100644 --- a/test/configCases/layer/context/webpack.config.js +++ b/test/configCases/layer/context/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MiniCssExtractPlugin = require("mini-css-extract-plugin"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/layer/define-multiple-entries/test.config.js b/test/configCases/layer/define-multiple-entries/test.config.js index fc2fea5bf92..36330ba44f5 100644 --- a/test/configCases/layer/define-multiple-entries/test.config.js +++ b/test/configCases/layer/define-multiple-entries/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./common.js", "./free.js", "./paid.js"]; diff --git a/test/configCases/layer/define-multiple-entries/webpack.config.js b/test/configCases/layer/define-multiple-entries/webpack.config.js index 6a95dd7de89..a609acadcd7 100644 --- a/test/configCases/layer/define-multiple-entries/webpack.config.js +++ b/test/configCases/layer/define-multiple-entries/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { DefinePlugin } = require("../../../../"); /** @type {import("../../../../").Configuration} */ @@ -30,7 +32,7 @@ module.exports = { plugins: [ new DefinePlugin({ FREE_VERSION: DefinePlugin.runtimeValue( - ctx => ctx.module.layer === "free" + (ctx) => ctx.module.layer === "free" ) }) ] diff --git a/test/configCases/layer/define-single-entry/test.config.js b/test/configCases/layer/define-single-entry/test.config.js index 458bcba5fc6..57eceaa943e 100644 --- a/test/configCases/layer/define-single-entry/test.config.js +++ b/test/configCases/layer/define-single-entry/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./free.js", "./paid.js"]; diff --git a/test/configCases/layer/define-single-entry/webpack.config.js b/test/configCases/layer/define-single-entry/webpack.config.js index cbeb7c22222..6d7f8802a53 100644 --- a/test/configCases/layer/define-single-entry/webpack.config.js +++ b/test/configCases/layer/define-single-entry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { DefinePlugin } = require("../../../../"); /** @type {import("../../../../").Configuration} */ @@ -28,7 +30,7 @@ module.exports = { plugins: [ new DefinePlugin({ FREE_VERSION: DefinePlugin.runtimeValue( - ctx => ctx.module.layer === "free" + (ctx) => ctx.module.layer === "free" ) }) ] diff --git a/test/configCases/layer/rules/webpack.config.js b/test/configCases/layer/rules/webpack.config.js index a1dc2986b58..46fd920a154 100644 --- a/test/configCases/layer/rules/webpack.config.js +++ b/test/configCases/layer/rules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { @@ -63,7 +65,7 @@ module.exports = { }, { external2: "var 42", - byLayer: layer => { + byLayer: (layer) => { if (layer === "layer") { return { external2: "var 43" diff --git a/test/configCases/library/0-create-library/test.config.js b/test/configCases/library/0-create-library/test.config.js index 04581a81040..67028ae7c8c 100644 --- a/test/configCases/library/0-create-library/test.config.js +++ b/test/configCases/library/0-create-library/test.config.js @@ -1 +1,3 @@ +"use strict"; + module.exports.noTests = true; diff --git a/test/configCases/library/0-create-library/webpack.config.js b/test/configCases/library/0-create-library/webpack.config.js index cef2e1a9389..e406cdc4117 100644 --- a/test/configCases/library/0-create-library/webpack.config.js +++ b/test/configCases/library/0-create-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); const supportsAsync = require("../../../helpers/supportsAsync"); @@ -427,7 +429,7 @@ module.exports = (env, { testPath }) => [ "external-named": "./non-external-named" } }, - ignoreWarnings: [error => error.name === "FalseIIFEUmdWarning"] + ignoreWarnings: [(error) => error.name === "FalseIIFEUmdWarning"] }, { output: { @@ -444,7 +446,7 @@ module.exports = (env, { testPath }) => [ "external-named": "./non-external-named" } }, - ignoreWarnings: [error => error.name === "FalseIIFEUmdWarning"] + ignoreWarnings: [(error) => error.name === "FalseIIFEUmdWarning"] }, { output: { diff --git a/test/configCases/library/1-use-library/test.config.js b/test/configCases/library/1-use-library/test.config.js index ac11abf4252..a24102c43a8 100644 --- a/test/configCases/library/1-use-library/test.config.js +++ b/test/configCases/library/1-use-library/test.config.js @@ -1,6 +1,8 @@ +"use strict"; + module.exports = { moduleScope(scope) { - scope.define = factory => { + scope.define = (factory) => { scope.module.exports = factory(); }; }, diff --git a/test/configCases/library/1-use-library/webpack.config.js b/test/configCases/library/1-use-library/webpack.config.js index 6e6b2665e83..a54358c147e 100644 --- a/test/configCases/library/1-use-library/webpack.config.js +++ b/test/configCases/library/1-use-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compiler} Compiler */ /** @typedef {import("../../../../").Compilation} Compilation */ @@ -29,8 +31,8 @@ module.exports = (env, { testPath }) => [ * @param {Compilation} compilation compilation * @returns {void} */ - const handler = compilation => { - compilation.hooks.afterProcessAssets.tap("testcase", assets => { + const handler = (compilation) => { + compilation.hooks.afterProcessAssets.tap("testcase", (assets) => { for (const asset of Object.keys(assets)) { const source = assets[asset].source(); expect(source).not.toContain('"a"'); diff --git a/test/configCases/library/a/webpack.config.js b/test/configCases/library/a/webpack.config.js index d6284c7acc7..0fd9032f997 100644 --- a/test/configCases/library/a/webpack.config.js +++ b/test/configCases/library/a/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/array-global/webpack.config.js b/test/configCases/library/array-global/webpack.config.js index 2e6d8a1e210..3f21390e81e 100644 --- a/test/configCases/library/array-global/webpack.config.js +++ b/test/configCases/library/array-global/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/array-window/webpack.config.js b/test/configCases/library/array-window/webpack.config.js index 0a58ae241bb..477deeeb3fe 100644 --- a/test/configCases/library/array-window/webpack.config.js +++ b/test/configCases/library/array-window/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/library/assign-properties/webpack.config.js b/test/configCases/library/assign-properties/webpack.config.js index 4e398b45410..ab95a11d282 100644 --- a/test/configCases/library/assign-properties/webpack.config.js +++ b/test/configCases/library/assign-properties/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/b/webpack.config.js b/test/configCases/library/b/webpack.config.js index e2f1eaa2db8..d48766fa5aa 100644 --- a/test/configCases/library/b/webpack.config.js +++ b/test/configCases/library/b/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/cjs-static/webpack.config.js b/test/configCases/library/cjs-static/webpack.config.js index 68425c7fa2d..4bcfff4a2dd 100644 --- a/test/configCases/library/cjs-static/webpack.config.js +++ b/test/configCases/library/cjs-static/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", diff --git a/test/configCases/library/concatenate-modules-named-import-externals/index.js b/test/configCases/library/concatenate-modules-named-import-externals/index.js new file mode 100644 index 00000000000..f6e48fad94d --- /dev/null +++ b/test/configCases/library/concatenate-modules-named-import-externals/index.js @@ -0,0 +1,7 @@ + +it('should compile', () => {}); + +it('should handle external modules with concatenation and caching', () => { + // This test ensures serialization works with caching enabled + expect(true).toBe(true); +}); diff --git a/test/configCases/library/concatenate-modules-named-import-externals/lib.js b/test/configCases/library/concatenate-modules-named-import-externals/lib.js new file mode 100644 index 00000000000..d484730bb89 --- /dev/null +++ b/test/configCases/library/concatenate-modules-named-import-externals/lib.js @@ -0,0 +1,21 @@ +import { HomeLayout as aaa } from 'externals0'; + +const { HomeLayout = 123 } = {}; +console.log({ HomeLayout }); +{ + const { HomeLayout = aaa } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = aaa } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = "111" } = {} + console.log({ external_externals3_namespaceObject }); +} + +export { HomeLayout } \ No newline at end of file diff --git a/test/configCases/library/concatenate-modules-named-import-externals/test.config.js b/test/configCases/library/concatenate-modules-named-import-externals/test.config.js new file mode 100644 index 00000000000..a8755bed92f --- /dev/null +++ b/test/configCases/library/concatenate-modules-named-import-externals/test.config.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + findBundle() { + return ["main.js"]; + } +}; diff --git a/test/configCases/library/concatenate-modules-named-import-externals/test.js b/test/configCases/library/concatenate-modules-named-import-externals/test.js new file mode 100644 index 00000000000..eddb63f953d --- /dev/null +++ b/test/configCases/library/concatenate-modules-named-import-externals/test.js @@ -0,0 +1,27 @@ +// re export +export { a } from 'externals0' + +// named import +import { a as a_2, HomeLayout as aaa } from 'externals1' +import { a as a_0 } from 'externals0' + +// default import +import defaultValue from 'externals2' + +// namespace import +import * as namespace from 'externals3' + +// side effect only import +import 'externals4' + +export { HomeLayout } from './lib' + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +aaa; +a_0; +a_2; +defaultValue; +namespace; \ No newline at end of file diff --git a/test/configCases/library/concatenate-modules-named-import-externals/webpack.config.js b/test/configCases/library/concatenate-modules-named-import-externals/webpack.config.js new file mode 100644 index 00000000000..af204eb0536 --- /dev/null +++ b/test/configCases/library/concatenate-modules-named-import-externals/webpack.config.js @@ -0,0 +1,56 @@ +"use strict"; + +/** @type {import("../../../../types").Configuration} */ +module.exports = { + cache: { + type: "memory" // Enable memory cache to test serialization + }, + mode: "none", + entry: { main: "./index.js", test: "./test.js" }, + output: { + module: true, + library: { + type: "modern-module" + }, + filename: "[name].js", + chunkFormat: "module" + }, + experiments: { + outputModule: true + }, + resolve: { + extensions: [".js"] + }, + externalsType: "module", + externals: [ + "externals0", + "externals1", + "externals2", + "externals3", + "externals4" + ], + optimization: { + concatenateModules: true, + usedExports: true + }, + plugins: [ + (compiler) => { + compiler.hooks.compilation.tap( + "testcase", + ( + /** @type {import("../../../../types").Compilation} */ compilation + ) => { + compilation.hooks.afterProcessAssets.tap( + "testcase", + ( + /** @type {Record} */ assets + ) => { + const source = assets["test.js"].source(); + expect(source).toMatchSnapshot(); + } + ); + } + ); + } + ] +}; diff --git a/test/configCases/library/disable-provided-export/test.filter.js b/test/configCases/library/disable-provided-export/test.filter.js index 0d61a0f0807..3185ff623c6 100644 --- a/test/configCases/library/disable-provided-export/test.filter.js +++ b/test/configCases/library/disable-provided-export/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsRequireInModule = require("../../../helpers/supportsRequireInModule"); module.exports = () => supportsRequireInModule(); diff --git a/test/configCases/library/disable-provided-export/webpack.config.js b/test/configCases/library/disable-provided-export/webpack.config.js index 235c0a2de0e..1575a333762 100644 --- a/test/configCases/library/disable-provided-export/webpack.config.js +++ b/test/configCases/library/disable-provided-export/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration[]} */ @@ -73,7 +75,7 @@ module.exports = [ () => { expect( compiler.hooks.compilation.taps.filter( - tap => tap.name === "FlagDependencyExportsPlugin" + (tap) => tap.name === "FlagDependencyExportsPlugin" ) ).toHaveLength(1); } diff --git a/test/configCases/library/invalid-name/errors.js b/test/configCases/library/invalid-name/errors.js index 465d98f6483..4251390f5a2 100644 --- a/test/configCases/library/invalid-name/errors.js +++ b/test/configCases/library/invalid-name/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Library name base \(123-hello world\) must be a valid identifier/, diff --git a/test/configCases/library/invalid-name/webpack.config.js b/test/configCases/library/invalid-name/webpack.config.js index 78ca5ab1c96..679c16f5629 100644 --- a/test/configCases/library/invalid-name/webpack.config.js +++ b/test/configCases/library/invalid-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/issue-18932/webpack.config.js b/test/configCases/library/issue-18932/webpack.config.js index 74ee1964621..ec48483499f 100644 --- a/test/configCases/library/issue-18932/webpack.config.js +++ b/test/configCases/library/issue-18932/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/library/issue-18951/test.config.js b/test/configCases/library/issue-18951/test.config.js index bc434b87b0c..9100dc59963 100644 --- a/test/configCases/library/issue-18951/test.config.js +++ b/test/configCases/library/issue-18951/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.mjs"]; diff --git a/test/configCases/library/issue-18951/webpack.config.js b/test/configCases/library/issue-18951/webpack.config.js index 1739a67b61a..de048029342 100644 --- a/test/configCases/library/issue-18951/webpack.config.js +++ b/test/configCases/library/issue-18951/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { experiments: { outputModule: true }, diff --git a/test/configCases/library/issue-19664/webpack.config.js b/test/configCases/library/issue-19664/webpack.config.js index 9150aa1751b..93c8cc12c7b 100644 --- a/test/configCases/library/issue-19664/webpack.config.js +++ b/test/configCases/library/issue-19664/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/modern-module-named-import-externals/index.js b/test/configCases/library/modern-module-named-import-externals/index.js new file mode 100644 index 00000000000..f6e48fad94d --- /dev/null +++ b/test/configCases/library/modern-module-named-import-externals/index.js @@ -0,0 +1,7 @@ + +it('should compile', () => {}); + +it('should handle external modules with concatenation and caching', () => { + // This test ensures serialization works with caching enabled + expect(true).toBe(true); +}); diff --git a/test/configCases/library/modern-module-named-import-externals/lib.js b/test/configCases/library/modern-module-named-import-externals/lib.js new file mode 100644 index 00000000000..650825e2bc7 --- /dev/null +++ b/test/configCases/library/modern-module-named-import-externals/lib.js @@ -0,0 +1,21 @@ +import { HomeLayout as aaa } from 'externals0'; + +const { HomeLayout = aaa } = {}; +console.log({ HomeLayout }); +{ + const { HomeLayout = aaa } = {}; + console.log({ HomeLayout }); +} +(() => { + { + const { HomeLayout = aaa } = {}; + console.log({ HomeLayout }); + } +})() + +{ + const { external_externals3_namespaceObject = "111" } = {} + console.log({ external_externals3_namespaceObject }); +} + +export { HomeLayout } \ No newline at end of file diff --git a/test/configCases/library/modern-module-named-import-externals/test.config.js b/test/configCases/library/modern-module-named-import-externals/test.config.js new file mode 100644 index 00000000000..a8755bed92f --- /dev/null +++ b/test/configCases/library/modern-module-named-import-externals/test.config.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + findBundle() { + return ["main.js"]; + } +}; diff --git a/test/configCases/library/modern-module-named-import-externals/test.js b/test/configCases/library/modern-module-named-import-externals/test.js new file mode 100644 index 00000000000..eddb63f953d --- /dev/null +++ b/test/configCases/library/modern-module-named-import-externals/test.js @@ -0,0 +1,27 @@ +// re export +export { a } from 'externals0' + +// named import +import { a as a_2, HomeLayout as aaa } from 'externals1' +import { a as a_0 } from 'externals0' + +// default import +import defaultValue from 'externals2' + +// namespace import +import * as namespace from 'externals3' + +// side effect only import +import 'externals4' + +export { HomeLayout } from './lib' + +{ + const HomeLayout_0 = 'HomeLayout_0'; + HomeLayout_0; +} +aaa; +a_0; +a_2; +defaultValue; +namespace; \ No newline at end of file diff --git a/test/configCases/library/modern-module-named-import-externals/webpack.config.js b/test/configCases/library/modern-module-named-import-externals/webpack.config.js new file mode 100644 index 00000000000..5b088d90a24 --- /dev/null +++ b/test/configCases/library/modern-module-named-import-externals/webpack.config.js @@ -0,0 +1,56 @@ +"use strict"; + +/** @type {import("../../../../types").Configuration} */ +module.exports = { + cache: { + type: "memory" // Enable memory cache to test serialization + }, + mode: "none", + entry: { main: "./index.js", test: "./test.js" }, + output: { + module: true, + library: { + type: "modern-module" + }, + filename: "[name].js", + chunkFormat: "module" + }, + experiments: { + outputModule: true + }, + resolve: { + extensions: [".js"] + }, + externalsType: "module", + externals: [ + "externals0", + "externals1", + "externals2", + "externals3", + "externals4" + ], + optimization: { + concatenateModules: false, + usedExports: true + }, + plugins: [ + (compiler) => { + compiler.hooks.compilation.tap( + "testcase", + ( + /** @type {import("../../../../types").Compilation} */ compilation + ) => { + compilation.hooks.afterProcessAssets.tap( + "testcase", + ( + /** @type {Record} */ assets + ) => { + const source = assets["test.js"].source(); + expect(source).toMatchSnapshot(); + } + ); + } + ); + } + ] +}; diff --git a/test/configCases/library/module-and-child-compilation/webpack.config.js b/test/configCases/library/module-and-child-compilation/webpack.config.js index 663dc2b706e..b431c353a22 100644 --- a/test/configCases/library/module-and-child-compilation/webpack.config.js +++ b/test/configCases/library/module-and-child-compilation/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/library/module-named-import-externals/index.js b/test/configCases/library/module-named-import-externals/index.js new file mode 100644 index 00000000000..15879c481b1 --- /dev/null +++ b/test/configCases/library/module-named-import-externals/index.js @@ -0,0 +1,21 @@ +import { readFileSync, writeFileSync as aaa } from 'fs' +import * as path from 'path' +import * as fs from 'fs' + +const { writeFileSync = aaa } = {} +console.log({ writeFileSync }); + + +{ + const { writeFileSync = aaa } = {} + console.log({ writeFileSync }); +} + +it('should handle external modules with concatenation and caching', () => { + expect(typeof readFileSync).toBe('function'); + const { writeFileSync = aaa } = {} + expect(typeof writeFileSync).toBe('function'); + expect(typeof path.join).toBe('function'); +}); + +export { readFileSync, writeFileSync, path, fs } \ No newline at end of file diff --git a/test/configCases/library/module-named-import-externals/test.config.js b/test/configCases/library/module-named-import-externals/test.config.js new file mode 100644 index 00000000000..9100dc59963 --- /dev/null +++ b/test/configCases/library/module-named-import-externals/test.config.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + findBundle() { + return ["main.mjs"]; + } +}; diff --git a/test/configCases/library/module-named-import-externals/webpack.config.js b/test/configCases/library/module-named-import-externals/webpack.config.js new file mode 100644 index 00000000000..78ca1e13e7a --- /dev/null +++ b/test/configCases/library/module-named-import-externals/webpack.config.js @@ -0,0 +1,26 @@ +"use strict"; + +/** @type {import("../../../../types").Configuration} */ +module.exports = { + entry: { main: "./index.js" }, + output: { + module: true, + library: { + type: "module" + }, + filename: "[name].mjs", + chunkFormat: "module" + }, + experiments: { + outputModule: true + }, + resolve: { + extensions: [".js"] + }, + externals: ["fs", "path"], + externalsType: "module", + optimization: { + concatenateModules: true, + usedExports: true + } +}; diff --git a/test/configCases/library/module-reexport-external/test.config.js b/test/configCases/library/module-reexport-external/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/library/module-reexport-external/test.config.js +++ b/test/configCases/library/module-reexport-external/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/library/module-reexport-external/webpack.config.js b/test/configCases/library/module-reexport-external/webpack.config.js index 53abd054ebb..80bef527495 100644 --- a/test/configCases/library/module-reexport-external/webpack.config.js +++ b/test/configCases/library/module-reexport-external/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compilation} Compilation */ /** @type {import("../../../../types").Configuration} */ @@ -28,8 +30,8 @@ module.exports = { /** * @param {Compilation} compilation compilation */ - const handler = compilation => { - compilation.hooks.afterProcessAssets.tap("testcase", assets => { + const handler = (compilation) => { + compilation.hooks.afterProcessAssets.tap("testcase", (assets) => { const source = assets["test.js"].source(); expect(source).toContain("export const value"); }); diff --git a/test/configCases/library/module-reexport-type/test.filter.js b/test/configCases/library/module-reexport-type/test.filter.js index 9486c09cf37..53cf6da0c34 100644 --- a/test/configCases/library/module-reexport-type/test.filter.js +++ b/test/configCases/library/module-reexport-type/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); module.exports = () => supportsOptionalChaining(); diff --git a/test/configCases/library/module-reexport-type/webpack.config.js b/test/configCases/library/module-reexport-type/webpack.config.js index ed134a4c227..3d1d555d30d 100644 --- a/test/configCases/library/module-reexport-type/webpack.config.js +++ b/test/configCases/library/module-reexport-type/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compilation} Compilation */ /** @type {import("../../../../").Configuration} */ @@ -5,7 +7,7 @@ module.exports = { mode: "none", entry: { main: "./index.ts" }, ignoreWarnings: [ - warning => { + (warning) => { // when using swc-loader or `transpileOnly: true` with ts-loader, the warning is expected expect(warning.message).toContain( "export 'T' (reexported as 'T') was not found in './re-export' (possible exports: value)" @@ -49,8 +51,8 @@ module.exports = { /** * @param {Compilation} compilation compilation */ - const handler = compilation => { - compilation.hooks.afterProcessAssets.tap("testcase", assets => { + const handler = (compilation) => { + compilation.hooks.afterProcessAssets.tap("testcase", (assets) => { const source = assets["bundle0.mjs"].source(); expect(source).toContain( "export { file_namespaceObject as logo, value };" diff --git a/test/configCases/library/module-terminal-binding/webpack.config.js b/test/configCases/library/module-terminal-binding/webpack.config.js index 68e94532f64..464be000415 100644 --- a/test/configCases/library/module-terminal-binding/webpack.config.js +++ b/test/configCases/library/module-terminal-binding/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { mode: "production", target: "web", diff --git a/test/configCases/library/type-assign-properties/test.config.js b/test/configCases/library/type-assign-properties/test.config.js index 0c592459f39..3e565191226 100644 --- a/test/configCases/library/type-assign-properties/test.config.js +++ b/test/configCases/library/type-assign-properties/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { afterExecute() { delete global.MyLibraryProperties; diff --git a/test/configCases/library/type-assign-properties/webpack.config.js b/test/configCases/library/type-assign-properties/webpack.config.js index efde945c998..70df544150a 100644 --- a/test/configCases/library/type-assign-properties/webpack.config.js +++ b/test/configCases/library/type-assign-properties/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/type-assign-runtime-chunk/test.config.js b/test/configCases/library/type-assign-runtime-chunk/test.config.js index 1a96fecb170..a4d8d86ae86 100644 --- a/test/configCases/library/type-assign-runtime-chunk/test.config.js +++ b/test/configCases/library/type-assign-runtime-chunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime~main.js", "./main.js"]; diff --git a/test/configCases/library/type-assign-runtime-chunk/webpack.config.js b/test/configCases/library/type-assign-runtime-chunk/webpack.config.js index 1dac2342460..96160a748b1 100644 --- a/test/configCases/library/type-assign-runtime-chunk/webpack.config.js +++ b/test/configCases/library/type-assign-runtime-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/type-assign/test.config.js b/test/configCases/library/type-assign/test.config.js index 79a079487a5..501be908dfe 100644 --- a/test/configCases/library/type-assign/test.config.js +++ b/test/configCases/library/type-assign/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { afterExecute() { delete global.MyLibrary; diff --git a/test/configCases/library/type-assign/webpack.config.js b/test/configCases/library/type-assign/webpack.config.js index 56889af0603..35dc0209d37 100644 --- a/test/configCases/library/type-assign/webpack.config.js +++ b/test/configCases/library/type-assign/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/umd-array/webpack.config.js b/test/configCases/library/umd-array/webpack.config.js index 73b14934a5d..0b7a695aba6 100644 --- a/test/configCases/library/umd-array/webpack.config.js +++ b/test/configCases/library/umd-array/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/library/umd/webpack.config.js b/test/configCases/library/umd/webpack.config.js index 815908500ca..e0c2d832da9 100644 --- a/test/configCases/library/umd/webpack.config.js +++ b/test/configCases/library/umd/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/loader-import-module/css/webpack.config.js b/test/configCases/loader-import-module/css/webpack.config.js index 3704a547e20..896a19a6f57 100644 --- a/test/configCases/loader-import-module/css/webpack.config.js +++ b/test/configCases/loader-import-module/css/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Chunk} Chunk */ /** @type {import("../../../../").Configuration} */ @@ -47,8 +49,8 @@ module.exports = { ] }, plugins: [ - compiler => - compiler.hooks.done.tap("test case", stats => { + (compiler) => + compiler.hooks.done.tap("test case", (stats) => { try { expect(stats.compilation.getAsset("assets/file.png")).toHaveProperty( "info", diff --git a/test/configCases/loaders-and-plugins-falsy/basic/webpack.config.js b/test/configCases/loaders-and-plugins-falsy/basic/webpack.config.js index 226726b9397..22efe7529ce 100644 --- a/test/configCases/loaders-and-plugins-falsy/basic/webpack.config.js +++ b/test/configCases/loaders-and-plugins-falsy/basic/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const DefinePlugin = require("../../../../").DefinePlugin; const nullValue = null; diff --git a/test/configCases/loaders/#-issue-14755-#/webpack.config.js b/test/configCases/loaders/#-issue-14755-#/webpack.config.js index a8828552624..64a40d1d92f 100644 --- a/test/configCases/loaders/#-issue-14755-#/webpack.config.js +++ b/test/configCases/loaders/#-issue-14755-#/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/loaders/async-loader/webpack.config.js b/test/configCases/loaders/async-loader/webpack.config.js index 9e819295974..1894d855199 100644 --- a/test/configCases/loaders/async-loader/webpack.config.js +++ b/test/configCases/loaders/async-loader/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/loaders/generate-ident/webpack.config.js b/test/configCases/loaders/generate-ident/webpack.config.js index fd5982717fb..56699c191cb 100644 --- a/test/configCases/loaders/generate-ident/webpack.config.js +++ b/test/configCases/loaders/generate-ident/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/loaders/hash-in-context/webpack.config.js b/test/configCases/loaders/hash-in-context/webpack.config.js index 140fdce3af9..afd84802e18 100644 --- a/test/configCases/loaders/hash-in-context/webpack.config.js +++ b/test/configCases/loaders/hash-in-context/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = { output: { diff --git a/test/configCases/loaders/hot-in-context/webpack.config.js b/test/configCases/loaders/hot-in-context/webpack.config.js index 322b76c0fbb..8cafeb0aa73 100644 --- a/test/configCases/loaders/hot-in-context/webpack.config.js +++ b/test/configCases/loaders/hot-in-context/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration[]} */ diff --git a/test/configCases/loaders/import-attributes-and-assertion/webpack.config.js b/test/configCases/loaders/import-attributes-and-assertion/webpack.config.js index 05fd19f2fc3..b13566831a6 100644 --- a/test/configCases/loaders/import-attributes-and-assertion/webpack.config.js +++ b/test/configCases/loaders/import-attributes-and-assertion/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/loaders/import-attributes-and-reexport/webpack.config.js b/test/configCases/loaders/import-attributes-and-reexport/webpack.config.js index c7e07d2b5ec..c35c4f48160 100644 --- a/test/configCases/loaders/import-attributes-and-reexport/webpack.config.js +++ b/test/configCases/loaders/import-attributes-and-reexport/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/loaders/issue-3320/deprecations.js b/test/configCases/loaders/issue-3320/deprecations.js index f05114b9382..417adc900d6 100644 --- a/test/configCases/loaders/issue-3320/deprecations.js +++ b/test/configCases/loaders/issue-3320/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/, diff --git a/test/configCases/loaders/issue-3320/webpack.config.js b/test/configCases/loaders/issue-3320/webpack.config.js index f943c051ed8..c6b2c88bf1d 100644 --- a/test/configCases/loaders/issue-3320/webpack.config.js +++ b/test/configCases/loaders/issue-3320/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { resolveLoader: { diff --git a/test/configCases/loaders/issue-9053/webpack.config.js b/test/configCases/loaders/issue-9053/webpack.config.js index fc77b7765ee..288f819bdc9 100644 --- a/test/configCases/loaders/issue-9053/webpack.config.js +++ b/test/configCases/loaders/issue-9053/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/loaders/mode-default/webpack.config.js b/test/configCases/loaders/mode-default/webpack.config.js index b991738c053..490c18b76df 100644 --- a/test/configCases/loaders/mode-default/webpack.config.js +++ b/test/configCases/loaders/mode-default/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/loaders/mode-development/webpack.config.js b/test/configCases/loaders/mode-development/webpack.config.js index 7184f5d44d9..190d66904bd 100644 --- a/test/configCases/loaders/mode-development/webpack.config.js +++ b/test/configCases/loaders/mode-development/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/loaders/mode-none/webpack.config.js b/test/configCases/loaders/mode-none/webpack.config.js index a0b076d51a2..09a281fe590 100644 --- a/test/configCases/loaders/mode-none/webpack.config.js +++ b/test/configCases/loaders/mode-none/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "none", diff --git a/test/configCases/loaders/mode-production/webpack.config.js b/test/configCases/loaders/mode-production/webpack.config.js index 09b14d843c2..4d7975ce1fd 100644 --- a/test/configCases/loaders/mode-production/webpack.config.js +++ b/test/configCases/loaders/mode-production/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/loaders/options/deprecations.js b/test/configCases/loaders/options/deprecations.js index 6c3c0c2f1b2..f7e3114b5ef 100644 --- a/test/configCases/loaders/options/deprecations.js +++ b/test/configCases/loaders/options/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, diff --git a/test/configCases/loaders/options/errors.js b/test/configCases/loaders/options/errors.js index 3ea73741041..a602f644c8c 100644 --- a/test/configCases/loaders/options/errors.js +++ b/test/configCases/loaders/options/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /\.\/loader-1\.js/, diff --git a/test/configCases/loaders/options/infrastructure-log.js b/test/configCases/loaders/options/infrastructure-log.js index 8ef4be52eb7..93b1b75dedb 100644 --- a/test/configCases/loaders/options/infrastructure-log.js +++ b/test/configCases/loaders/options/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ // We use (1|2), because both contain the problems, but due asynchronous nature the first module can be `error1` or `error2` /^Pack got invalid because of write to: Compilation\/modules.+loaders[/\\]options[/\\]error(1|2)\.js$/ diff --git a/test/configCases/loaders/options/webpack.config.js b/test/configCases/loaders/options/webpack.config.js index 6b5d5723311..f61b8961643 100644 --- a/test/configCases/loaders/options/webpack.config.js +++ b/test/configCases/loaders/options/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "none", diff --git a/test/configCases/loaders/pr-14384/webpack.config.js b/test/configCases/loaders/pr-14384/webpack.config.js index a8faf09f3ac..66130f9b7b7 100644 --- a/test/configCases/loaders/pr-14384/webpack.config.js +++ b/test/configCases/loaders/pr-14384/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const PluginWithLoader = require("./PluginWithLoader"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/loaders/pre-post-loader/webpack.config.js b/test/configCases/loaders/pre-post-loader/webpack.config.js index c460255cee6..2ad00d8a5e2 100644 --- a/test/configCases/loaders/pre-post-loader/webpack.config.js +++ b/test/configCases/loaders/pre-post-loader/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/loaders/remaining-request/webpack.config.js b/test/configCases/loaders/remaining-request/webpack.config.js index a4a7d3e84fc..65e416b36f2 100644 --- a/test/configCases/loaders/remaining-request/webpack.config.js +++ b/test/configCases/loaders/remaining-request/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/managedPaths/futureDefaults/webpack.config.js b/test/configCases/managedPaths/futureDefaults/webpack.config.js index bf94f1dd4e2..b37a749727c 100644 --- a/test/configCases/managedPaths/futureDefaults/webpack.config.js +++ b/test/configCases/managedPaths/futureDefaults/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { experiments: { diff --git a/test/configCases/mangle/exports-info-can-mangle/webpack.config.js b/test/configCases/mangle/exports-info-can-mangle/webpack.config.js index 3d405a2e2f2..a31a5193b3a 100644 --- a/test/configCases/mangle/exports-info-can-mangle/webpack.config.js +++ b/test/configCases/mangle/exports-info-can-mangle/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/mangle/mangle-with-destructuring-assignment/webpack.config.js b/test/configCases/mangle/mangle-with-destructuring-assignment/webpack.config.js index 67e35d061e0..251afe9f72a 100644 --- a/test/configCases/mangle/mangle-with-destructuring-assignment/webpack.config.js +++ b/test/configCases/mangle/mangle-with-destructuring-assignment/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("webpack-sources").Source} Source */ /** @type {import("../../../../").Configuration} */ @@ -20,7 +22,7 @@ module.exports = { function getJsonCodeGeneratedSource(compiler) { compiler.hooks.compilation.tap( getJsonCodeGeneratedSource.name, - compilation => { + (compilation) => { compilation.hooks.processAssets.tap( getJsonCodeGeneratedSource.name, () => { diff --git a/test/configCases/mangle/mangle-with-object-prop/test.config.js b/test/configCases/mangle/mangle-with-object-prop/test.config.js index e47827d568a..a8f47aaf1e3 100644 --- a/test/configCases/mangle/mangle-with-object-prop/test.config.js +++ b/test/configCases/mangle/mangle-with-object-prop/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./deterministic.js", "./size.js"]; diff --git a/test/configCases/mangle/mangle-with-object-prop/webpack.config.js b/test/configCases/mangle/mangle-with-object-prop/webpack.config.js index 80d543f7851..f74290543cf 100644 --- a/test/configCases/mangle/mangle-with-object-prop/webpack.config.js +++ b/test/configCases/mangle/mangle-with-object-prop/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { DefinePlugin } = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/mangle/mangle-with-re-export-as-default/webpack.config.js b/test/configCases/mangle/mangle-with-re-export-as-default/webpack.config.js index 1826c4c6589..8f8b84b5769 100644 --- a/test/configCases/mangle/mangle-with-re-export-as-default/webpack.config.js +++ b/test/configCases/mangle/mangle-with-re-export-as-default/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/module-name/different-issuers-for-same-module/webpack.config.js b/test/configCases/module-name/different-issuers-for-same-module/webpack.config.js index e86db6268f9..c3d1a4c12aa 100644 --- a/test/configCases/module-name/different-issuers-for-same-module/webpack.config.js +++ b/test/configCases/module-name/different-issuers-for-same-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/module/check-defaults/errors.js b/test/configCases/module/check-defaults/errors.js index 1d4e2ba0129..db651f87158 100644 --- a/test/configCases/module/check-defaults/errors.js +++ b/test/configCases/module/check-defaults/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/For the selected environment is no default ESM chunk format available/] ]; diff --git a/test/configCases/module/check-defaults/test.filter.js b/test/configCases/module/check-defaults/test.filter.js index d5852188b3e..96ddb2717f2 100644 --- a/test/configCases/module/check-defaults/test.filter.js +++ b/test/configCases/module/check-defaults/test.filter.js @@ -1 +1,3 @@ -module.exports = config => !config.cache; +"use strict"; + +module.exports = (config) => !config.cache; diff --git a/test/configCases/module/check-defaults/webpack.config.js b/test/configCases/module/check-defaults/webpack.config.js index d45f42ed855..b40afb54543 100644 --- a/test/configCases/module/check-defaults/webpack.config.js +++ b/test/configCases/module/check-defaults/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/module/chunk-format-fallback/test.config.js b/test/configCases/module/chunk-format-fallback/test.config.js index 051597fef8f..75989e21626 100644 --- a/test/configCases/module/chunk-format-fallback/test.config.js +++ b/test/configCases/module/chunk-format-fallback/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["runtime.mjs", "./main.mjs"]; diff --git a/test/configCases/module/chunk-format-fallback/webpack.config.js b/test/configCases/module/chunk-format-fallback/webpack.config.js index 5d5fc00fa01..fb84665e2ef 100644 --- a/test/configCases/module/chunk-format-fallback/webpack.config.js +++ b/test/configCases/module/chunk-format-fallback/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/module/circular-externals/test.config.js b/test/configCases/module/circular-externals/test.config.js index 1192a7afc60..04d5e6a4b35 100644 --- a/test/configCases/module/circular-externals/test.config.js +++ b/test/configCases/module/circular-externals/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return "./main.mjs"; diff --git a/test/configCases/module/circular-externals/webpack.config.js b/test/configCases/module/circular-externals/webpack.config.js index bbc92fd4361..beb34577a43 100644 --- a/test/configCases/module/circular-externals/webpack.config.js +++ b/test/configCases/module/circular-externals/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); @@ -28,7 +30,7 @@ module.exports = { apply(compiler) { compiler.hooks.thisCompilation.tap( "copy-external-files", - compilation => { + (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-external-files", diff --git a/test/configCases/module/duplicate-export/test.config.js b/test/configCases/module/duplicate-export/test.config.js index 9d2aabb1e9b..07b84041615 100644 --- a/test/configCases/module/duplicate-export/test.config.js +++ b/test/configCases/module/duplicate-export/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./main.mjs"]; diff --git a/test/configCases/module/duplicate-export/webpack.config.js b/test/configCases/module/duplicate-export/webpack.config.js index 576a99ee237..ab636c6d22f 100644 --- a/test/configCases/module/duplicate-export/webpack.config.js +++ b/test/configCases/module/duplicate-export/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/module/externals/test.config.js b/test/configCases/module/externals/test.config.js index 1192a7afc60..04d5e6a4b35 100644 --- a/test/configCases/module/externals/test.config.js +++ b/test/configCases/module/externals/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return "./main.mjs"; diff --git a/test/configCases/module/externals/webpack.config.js b/test/configCases/module/externals/webpack.config.js index 78ad7d63d86..3ae7981db23 100644 --- a/test/configCases/module/externals/webpack.config.js +++ b/test/configCases/module/externals/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/module/iife-entry-module-with-others/test.config.js b/test/configCases/module/iife-entry-module-with-others/test.config.js index 53042d86fab..07e6d9b8d11 100644 --- a/test/configCases/module/iife-entry-module-with-others/test.config.js +++ b/test/configCases/module/iife-entry-module-with-others/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/module/iife-entry-module-with-others/webpack.config.js b/test/configCases/module/iife-entry-module-with-others/webpack.config.js index 5d6eccc0d55..e0582f00f83 100644 --- a/test/configCases/module/iife-entry-module-with-others/webpack.config.js +++ b/test/configCases/module/iife-entry-module-with-others/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ const base = { output: { diff --git a/test/configCases/module/iife-innter-strict/test.config.js b/test/configCases/module/iife-innter-strict/test.config.js index f48f8b79def..6f661b3d1eb 100644 --- a/test/configCases/module/iife-innter-strict/test.config.js +++ b/test/configCases/module/iife-innter-strict/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["test.js"]; diff --git a/test/configCases/module/iife-innter-strict/webpack.config.js b/test/configCases/module/iife-innter-strict/webpack.config.js index a5d002ed82f..61255739b84 100644 --- a/test/configCases/module/iife-innter-strict/webpack.config.js +++ b/test/configCases/module/iife-innter-strict/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/module/iife-multiple-entry-modules/test.config.js b/test/configCases/module/iife-multiple-entry-modules/test.config.js index bb3de309b02..af8b742874c 100644 --- a/test/configCases/module/iife-multiple-entry-modules/test.config.js +++ b/test/configCases/module/iife-multiple-entry-modules/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["bundle0.mjs", "test.js"]; diff --git a/test/configCases/module/iife-multiple-entry-modules/webpack.config.js b/test/configCases/module/iife-multiple-entry-modules/webpack.config.js index ee452f23242..c469337b02a 100644 --- a/test/configCases/module/iife-multiple-entry-modules/webpack.config.js +++ b/test/configCases/module/iife-multiple-entry-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/module/issue-16040/test.config.js b/test/configCases/module/issue-16040/test.config.js index 194e0522015..120246cdaf8 100644 --- a/test/configCases/module/issue-16040/test.config.js +++ b/test/configCases/module/issue-16040/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.mjs", "vendor.mjs", "runtime.mjs"]; diff --git a/test/configCases/module/issue-16040/test.filter.js b/test/configCases/module/issue-16040/test.filter.js index 0d61a0f0807..3185ff623c6 100644 --- a/test/configCases/module/issue-16040/test.filter.js +++ b/test/configCases/module/issue-16040/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsRequireInModule = require("../../../helpers/supportsRequireInModule"); module.exports = () => supportsRequireInModule(); diff --git a/test/configCases/module/issue-16040/webpack.config.js b/test/configCases/module/issue-16040/webpack.config.js index 275e36a5232..08e20f5250e 100644 --- a/test/configCases/module/issue-16040/webpack.config.js +++ b/test/configCases/module/issue-16040/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { diff --git a/test/configCases/module/issue-17014-split-chunks/test.config.js b/test/configCases/module/issue-17014-split-chunks/test.config.js index 573e3dabc47..e9186c677ed 100644 --- a/test/configCases/module/issue-17014-split-chunks/test.config.js +++ b/test/configCases/module/issue-17014-split-chunks/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./common.mjs", "./bundle0.mjs"]; diff --git a/test/configCases/module/issue-17014-split-chunks/webpack.config.js b/test/configCases/module/issue-17014-split-chunks/webpack.config.js index 4a5d18e5483..49162fd3930 100644 --- a/test/configCases/module/issue-17014-split-chunks/webpack.config.js +++ b/test/configCases/module/issue-17014-split-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/module/issue-17014-webworker/test.config.js b/test/configCases/module/issue-17014-webworker/test.config.js index 7c59f2b5e80..9b6cacaa4d1 100644 --- a/test/configCases/module/issue-17014-webworker/test.config.js +++ b/test/configCases/module/issue-17014-webworker/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // findBundle() { // return ["./common.mjs", "./bundle0.mjs"]; diff --git a/test/configCases/module/issue-17014-webworker/test.filter.js b/test/configCases/module/issue-17014-webworker/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/module/issue-17014-webworker/test.filter.js +++ b/test/configCases/module/issue-17014-webworker/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/module/issue-17014-webworker/webpack.config.js b/test/configCases/module/issue-17014-webworker/webpack.config.js index b56e3a37c55..c277942a2c3 100644 --- a/test/configCases/module/issue-17014-webworker/webpack.config.js +++ b/test/configCases/module/issue-17014-webworker/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/module/node-globals/test.config.js b/test/configCases/module/node-globals/test.config.js index 1192a7afc60..04d5e6a4b35 100644 --- a/test/configCases/module/node-globals/test.config.js +++ b/test/configCases/module/node-globals/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return "./main.mjs"; diff --git a/test/configCases/module/node-globals/webpack.config.js b/test/configCases/module/node-globals/webpack.config.js index aac123421e6..69d1c13370d 100644 --- a/test/configCases/module/node-globals/webpack.config.js +++ b/test/configCases/module/node-globals/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/module/non-webpack-require/test.filter.js b/test/configCases/module/non-webpack-require/test.filter.js index 0d61a0f0807..3185ff623c6 100644 --- a/test/configCases/module/non-webpack-require/test.filter.js +++ b/test/configCases/module/non-webpack-require/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsRequireInModule = require("../../../helpers/supportsRequireInModule"); module.exports = () => supportsRequireInModule(); diff --git a/test/configCases/module/non-webpack-require/webpack.config.js b/test/configCases/module/non-webpack-require/webpack.config.js index 22f06b6ee95..715f62d9850 100644 --- a/test/configCases/module/non-webpack-require/webpack.config.js +++ b/test/configCases/module/non-webpack-require/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ @@ -20,7 +22,7 @@ module.exports = { plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("Test", compilation => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-webpack-plugin", diff --git a/test/configCases/module/public-path/test.config.js b/test/configCases/module/public-path/test.config.js index 83d80a64a1d..dca19db0eef 100644 --- a/test/configCases/module/public-path/test.config.js +++ b/test/configCases/module/public-path/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/test/configCases/module/public-path/webpack.config.js b/test/configCases/module/public-path/webpack.config.js index 92c2cfd0e96..42fb32384c8 100644 --- a/test/configCases/module/public-path/webpack.config.js +++ b/test/configCases/module/public-path/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration[]} */ diff --git a/test/configCases/module/reuse-webpack-esm-library/webpack.config.js b/test/configCases/module/reuse-webpack-esm-library/webpack.config.js index 714354b809d..6a81a7a2f93 100644 --- a/test/configCases/module/reuse-webpack-esm-library/webpack.config.js +++ b/test/configCases/module/reuse-webpack-esm-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/module/runtime-chunk/test.config.js b/test/configCases/module/runtime-chunk/test.config.js index cb1a8be8b4a..8437090156f 100644 --- a/test/configCases/module/runtime-chunk/test.config.js +++ b/test/configCases/module/runtime-chunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime.mjs", "./main.mjs"]; diff --git a/test/configCases/module/runtime-chunk/webpack.config.js b/test/configCases/module/runtime-chunk/webpack.config.js index b1bdf750f81..eacfbbc5fe4 100644 --- a/test/configCases/module/runtime-chunk/webpack.config.js +++ b/test/configCases/module/runtime-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/module/simple/webpack.config.js b/test/configCases/module/simple/webpack.config.js index b8e5da8c1f1..7c22e9021a1 100644 --- a/test/configCases/module/simple/webpack.config.js +++ b/test/configCases/module/simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { experiments: { diff --git a/test/configCases/module/split-chunks-issue-19657/test.config.js b/test/configCases/module/split-chunks-issue-19657/test.config.js index ab693054953..c49de5dd016 100644 --- a/test/configCases/module/split-chunks-issue-19657/test.config.js +++ b/test/configCases/module/split-chunks-issue-19657/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i, options) { return ["main.mjs"]; diff --git a/test/configCases/module/split-chunks-issue-19657/webpack.config.js b/test/configCases/module/split-chunks-issue-19657/webpack.config.js index 56d61cdf6c1..c51aad53688 100644 --- a/test/configCases/module/split-chunks-issue-19657/webpack.config.js +++ b/test/configCases/module/split-chunks-issue-19657/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/module/split-chunks-without-externals/test.config.js b/test/configCases/module/split-chunks-without-externals/test.config.js index 6dfa448614e..a9d0af8cdf5 100644 --- a/test/configCases/module/split-chunks-without-externals/test.config.js +++ b/test/configCases/module/split-chunks-without-externals/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.mjs", "testModule1.mjs", "testModule2.mjs"]; diff --git a/test/configCases/module/split-chunks-without-externals/webpack.config.js b/test/configCases/module/split-chunks-without-externals/webpack.config.js index 56d61cdf6c1..c51aad53688 100644 --- a/test/configCases/module/split-chunks-without-externals/webpack.config.js +++ b/test/configCases/module/split-chunks-without-externals/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/module/split-chunks/test.config.js b/test/configCases/module/split-chunks/test.config.js index e2664c9b261..ed5826c539f 100644 --- a/test/configCases/module/split-chunks/test.config.js +++ b/test/configCases/module/split-chunks/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime.mjs", "./separate.mjs", "./main.mjs"]; diff --git a/test/configCases/module/split-chunks/webpack.config.js b/test/configCases/module/split-chunks/webpack.config.js index e8a91725c45..458ab504618 100644 --- a/test/configCases/module/split-chunks/webpack.config.js +++ b/test/configCases/module/split-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/no-parse/module.exports/webpack.config.js b/test/configCases/no-parse/module.exports/webpack.config.js index b63c4511aa9..72d119f9362 100644 --- a/test/configCases/no-parse/module.exports/webpack.config.js +++ b/test/configCases/no-parse/module.exports/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/no-parse/no-parse-function/webpack.config.js b/test/configCases/no-parse/no-parse-function/webpack.config.js index c1e2ece23e0..07408be3ce4 100644 --- a/test/configCases/no-parse/no-parse-function/webpack.config.js +++ b/test/configCases/no-parse/no-parse-function/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/node/filename-and-dirname-eval-only/index.js b/test/configCases/node/filename-and-dirname-eval-only/index.js new file mode 100644 index 00000000000..9b7c32817d2 --- /dev/null +++ b/test/configCases/node/filename-and-dirname-eval-only/index.js @@ -0,0 +1,6 @@ +import path from "path"; + +it("should use custom name", () => { + expect(__dirname).toBe(__STATS__.outputPath); + expect(__filename).toBe(path.join(__STATS__.outputPath, "./bundle0.js")); +}); diff --git a/test/configCases/node/filename-and-dirname-eval-only/webpack.config.js b/test/configCases/node/filename-and-dirname-eval-only/webpack.config.js new file mode 100644 index 00000000000..cbda8c605d5 --- /dev/null +++ b/test/configCases/node/filename-and-dirname-eval-only/webpack.config.js @@ -0,0 +1,10 @@ +"use strict"; + +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "node", + node: { + __filename: "eval-only", + __dirname: "eval-only" + } +}; diff --git a/test/configCases/node/filename-and-dirname-node-module/index.js b/test/configCases/node/filename-and-dirname-node-module/index.js new file mode 100644 index 00000000000..00adc327ada --- /dev/null +++ b/test/configCases/node/filename-and-dirname-node-module/index.js @@ -0,0 +1,6 @@ +import path from "path"; + +it("should use custom name", () => { + expect(__dirname).toBe(__STATS__.outputPath); + expect(__filename).toBe(path.join(__STATS__.outputPath, "./bundle0.mjs")); +}); diff --git a/test/configCases/node/filename-and-dirname-node-module/test.config.js b/test/configCases/node/filename-and-dirname-node-module/test.config.js new file mode 100644 index 00000000000..f270e2a8535 --- /dev/null +++ b/test/configCases/node/filename-and-dirname-node-module/test.config.js @@ -0,0 +1,12 @@ +"use strict"; + +const path = require("path"); +const { pathToFileURL } = require("url"); + +module.exports = { + moduleScope(scope, options) { + scope.custom = { + url: pathToFileURL(path.join(options.output.path, "bundle0.mjs")) + }; + } +}; diff --git a/test/configCases/node/filename-and-dirname-node-module/test.filter.js b/test/configCases/node/filename-and-dirname-node-module/test.filter.js new file mode 100644 index 00000000000..03c7ecb753f --- /dev/null +++ b/test/configCases/node/filename-and-dirname-node-module/test.filter.js @@ -0,0 +1,5 @@ +"use strict"; + +const supportsNodePrefix = require("../../../helpers/supportsNodePrefix"); + +module.exports = () => supportsNodePrefix(); diff --git a/test/configCases/node/filename-and-dirname-node-module/webpack.config.js b/test/configCases/node/filename-and-dirname-node-module/webpack.config.js new file mode 100644 index 00000000000..aa469f23126 --- /dev/null +++ b/test/configCases/node/filename-and-dirname-node-module/webpack.config.js @@ -0,0 +1,17 @@ +"use strict"; + +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "node", + experiments: { + outputModule: true + }, + output: { + module: true, + importMetaName: "custom" + }, + node: { + __filename: "node-module", + __dirname: "node-module" + } +}; diff --git a/test/configCases/node/node-prefix/webpack.config.js b/test/configCases/node/node-prefix/webpack.config.js index 029181fbeba..b82488942a5 100644 --- a/test/configCases/node/node-prefix/webpack.config.js +++ b/test/configCases/node/node-prefix/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node" diff --git a/test/configCases/node/prefix-in-runtime/test.filter.js b/test/configCases/node/prefix-in-runtime/test.filter.js index 30573896be1..03c7ecb753f 100644 --- a/test/configCases/node/prefix-in-runtime/test.filter.js +++ b/test/configCases/node/prefix-in-runtime/test.filter.js @@ -1 +1,5 @@ -module.exports = () => !process.version.startsWith("v10."); +"use strict"; + +const supportsNodePrefix = require("../../../helpers/supportsNodePrefix"); + +module.exports = () => supportsNodePrefix(); diff --git a/test/configCases/node/prefix-in-runtime/webpack.config.js b/test/configCases/node/prefix-in-runtime/webpack.config.js index c7da21b83c8..c2725de2dea 100644 --- a/test/configCases/node/prefix-in-runtime/webpack.config.js +++ b/test/configCases/node/prefix-in-runtime/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = [ { diff --git a/test/configCases/optimization/chunk/webpack.config.js b/test/configCases/optimization/chunk/webpack.config.js index e47672c7448..544c81340d3 100644 --- a/test/configCases/optimization/chunk/webpack.config.js +++ b/test/configCases/optimization/chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/optimization/depend-on-runtimes/test.config.js b/test/configCases/optimization/depend-on-runtimes/test.config.js index 908653524a0..b4e7057cd03 100644 --- a/test/configCases/optimization/depend-on-runtimes/test.config.js +++ b/test/configCases/optimization/depend-on-runtimes/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./b.js", "./runtime-c.js", "./c.js"]; diff --git a/test/configCases/optimization/depend-on-runtimes/webpack.config.js b/test/configCases/optimization/depend-on-runtimes/webpack.config.js index 251e8fcccf9..7929fe6f3bd 100644 --- a/test/configCases/optimization/depend-on-runtimes/webpack.config.js +++ b/test/configCases/optimization/depend-on-runtimes/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/optimization/hashed-module-ids/warnings.js b/test/configCases/optimization/hashed-module-ids/warnings.js index 70fefa270fb..fdcecb3be97 100644 --- a/test/configCases/optimization/hashed-module-ids/warnings.js +++ b/test/configCases/optimization/hashed-module-ids/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/hashed/, /deprecated/]]; diff --git a/test/configCases/optimization/hashed-module-ids/webpack.config.js b/test/configCases/optimization/hashed-module-ids/webpack.config.js index e3f2e0b3bf3..ecd9cf88c1f 100644 --- a/test/configCases/optimization/hashed-module-ids/webpack.config.js +++ b/test/configCases/optimization/hashed-module-ids/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/optimization/issue-19184/warnings.js b/test/configCases/optimization/issue-19184/warnings.js index 70fefa270fb..fdcecb3be97 100644 --- a/test/configCases/optimization/issue-19184/warnings.js +++ b/test/configCases/optimization/issue-19184/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/hashed/, /deprecated/]]; diff --git a/test/configCases/optimization/issue-19184/webpack.config.js b/test/configCases/optimization/issue-19184/webpack.config.js index f77b0884f56..2b822a3d9c8 100644 --- a/test/configCases/optimization/issue-19184/webpack.config.js +++ b/test/configCases/optimization/issue-19184/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/optimization/minimizer/webpack.config.js b/test/configCases/optimization/minimizer/webpack.config.js index 554aca05538..ade134bdd3a 100644 --- a/test/configCases/optimization/minimizer/webpack.config.js +++ b/test/configCases/optimization/minimizer/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const Compiler = require("../../../../").Compiler; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/optimization/named-modules/webpack.config.js b/test/configCases/optimization/named-modules/webpack.config.js index 15fb81f1bc4..e14acb1a1ed 100644 --- a/test/configCases/optimization/named-modules/webpack.config.js +++ b/test/configCases/optimization/named-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/optimization/runtime-specific-used-exports/test.config.js b/test/configCases/optimization/runtime-specific-used-exports/test.config.js index 212b2e5fc13..af2075ac84f 100644 --- a/test/configCases/optimization/runtime-specific-used-exports/test.config.js +++ b/test/configCases/optimization/runtime-specific-used-exports/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./b.js"]; diff --git a/test/configCases/optimization/runtime-specific-used-exports/webpack.config.js b/test/configCases/optimization/runtime-specific-used-exports/webpack.config.js index 6cf012a34b1..11ec9666d90 100644 --- a/test/configCases/optimization/runtime-specific-used-exports/webpack.config.js +++ b/test/configCases/optimization/runtime-specific-used-exports/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/optimization/runtime-specific-used-exports2/test.config.js b/test/configCases/optimization/runtime-specific-used-exports2/test.config.js index 322f05c6b70..0b07c625c8d 100644 --- a/test/configCases/optimization/runtime-specific-used-exports2/test.config.js +++ b/test/configCases/optimization/runtime-specific-used-exports2/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./b.js", "./c.js"]; diff --git a/test/configCases/optimization/runtime-specific-used-exports2/webpack.config.js b/test/configCases/optimization/runtime-specific-used-exports2/webpack.config.js index c15fc77a848..166cf8c6b7e 100644 --- a/test/configCases/optimization/runtime-specific-used-exports2/webpack.config.js +++ b/test/configCases/optimization/runtime-specific-used-exports2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/output/charset/test.config.js b/test/configCases/output/charset/test.config.js index d338a4c0200..f17cba79fed 100644 --- a/test/configCases/output/charset/test.config.js +++ b/test/configCases/output/charset/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/configCases/output/charset/webpack.config.js b/test/configCases/output/charset/webpack.config.js index 15df7b6faf5..73a38a828ab 100644 --- a/test/configCases/output/charset/webpack.config.js +++ b/test/configCases/output/charset/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/output/chunk-format-with-runtimeChunk/test.config.js b/test/configCases/output/chunk-format-with-runtimeChunk/test.config.js index 8614239c759..2147b0a0b96 100644 --- a/test/configCases/output/chunk-format-with-runtimeChunk/test.config.js +++ b/test/configCases/output/chunk-format-with-runtimeChunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["runtime.mjs", "main.mjs"]; diff --git a/test/configCases/output/chunk-format-with-runtimeChunk/webpack.config.js b/test/configCases/output/chunk-format-with-runtimeChunk/webpack.config.js index 4779769a381..bfef95fa8ee 100644 --- a/test/configCases/output/chunk-format-with-runtimeChunk/webpack.config.js +++ b/test/configCases/output/chunk-format-with-runtimeChunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { mode: "production", entry: { diff --git a/test/configCases/output/function/test.config.js b/test/configCases/output/function/test.config.js index 212b2e5fc13..af2075ac84f 100644 --- a/test/configCases/output/function/test.config.js +++ b/test/configCases/output/function/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./b.js"]; diff --git a/test/configCases/output/function/webpack.config.js b/test/configCases/output/function/webpack.config.js index ca4e0c7aa73..c1b6ec86a5c 100644 --- a/test/configCases/output/function/webpack.config.js +++ b/test/configCases/output/function/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Chunk} Chunk */ /** @type {import("../../../../").Configuration} */ @@ -9,7 +11,7 @@ module.exports = { }; }, output: { - filename: data => + filename: (data) => /** @type {Chunk} */ (data.chunk).name === "a" ? `${/** @type {Chunk} */ (data.chunk).name}.js` diff --git a/test/configCases/output/import-meta-name/test.config.js b/test/configCases/output/import-meta-name/test.config.js index 3b7d7089653..68de5d74ac4 100644 --- a/test/configCases/output/import-meta-name/test.config.js +++ b/test/configCases/output/import-meta-name/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { scope.pseudoImport = { meta: { url: "http://test.co/path/index.js" } }; diff --git a/test/configCases/output/import-meta-name/webpack.config.js b/test/configCases/output/import-meta-name/webpack.config.js index 5d9667ad4f5..45061f52e9e 100644 --- a/test/configCases/output/import-meta-name/webpack.config.js +++ b/test/configCases/output/import-meta-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/output/inner-dirs-entries/test.config.js b/test/configCases/output/inner-dirs-entries/test.config.js index 18b3e20b6fd..7309eedcf7a 100644 --- a/test/configCases/output/inner-dirs-entries/test.config.js +++ b/test/configCases/output/inner-dirs-entries/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js", "./inner-dir/b.js", "./inner-dir/deep/deep/c.js"]; diff --git a/test/configCases/output/inner-dirs-entries/webpack.config.js b/test/configCases/output/inner-dirs-entries/webpack.config.js index 74d71fbfccc..c016f2ea778 100644 --- a/test/configCases/output/inner-dirs-entries/webpack.config.js +++ b/test/configCases/output/inner-dirs-entries/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "none", diff --git a/test/configCases/output/publicPath-node/webpack.config.js b/test/configCases/output/publicPath-node/webpack.config.js index 546fe977dbc..489e0036811 100644 --- a/test/configCases/output/publicPath-node/webpack.config.js +++ b/test/configCases/output/publicPath-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "none", diff --git a/test/configCases/output/publicPath-scriptType-module/test.config.js b/test/configCases/output/publicPath-scriptType-module/test.config.js index dd5df860f7e..46e07d929fd 100644 --- a/test/configCases/output/publicPath-scriptType-module/test.config.js +++ b/test/configCases/output/publicPath-scriptType-module/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./index.mjs"]; diff --git a/test/configCases/output/publicPath-scriptType-module/webpack.config.js b/test/configCases/output/publicPath-scriptType-module/webpack.config.js index e5a0a0a5780..0f6cc194844 100644 --- a/test/configCases/output/publicPath-scriptType-module/webpack.config.js +++ b/test/configCases/output/publicPath-scriptType-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "none", diff --git a/test/configCases/output/publicPath-web/test.config.js b/test/configCases/output/publicPath-web/test.config.js index b4e1084ee4d..7c4830cda12 100644 --- a/test/configCases/output/publicPath-web/test.config.js +++ b/test/configCases/output/publicPath-web/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./inner1/inner2/a.js", "./b.js"]; diff --git a/test/configCases/output/publicPath-web/webpack.config.js b/test/configCases/output/publicPath-web/webpack.config.js index c11ed1e2604..ef6e2ab0bff 100644 --- a/test/configCases/output/publicPath-web/webpack.config.js +++ b/test/configCases/output/publicPath-web/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Chunk} Chunk */ /** @type {import("../../../../").Configuration} */ @@ -19,7 +21,7 @@ module.exports = { }; }, output: { - filename: data => + filename: (data) => /^[ac]$/.test( /** @type {string} */ ( /** @type {Chunk} */ diff --git a/test/configCases/output/string/test.config.js b/test/configCases/output/string/test.config.js index a214e6a940f..32b91675978 100644 --- a/test/configCases/output/string/test.config.js +++ b/test/configCases/output/string/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./a.js"]; diff --git a/test/configCases/output/string/webpack.config.js b/test/configCases/output/string/webpack.config.js index d96ec181efb..c9461bd2326 100644 --- a/test/configCases/output/string/webpack.config.js +++ b/test/configCases/output/string/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry() { diff --git a/test/configCases/output/worker-public-path/test.config.js b/test/configCases/output/worker-public-path/test.config.js index 0e721ca1433..2059a3f8977 100644 --- a/test/configCases/output/worker-public-path/test.config.js +++ b/test/configCases/output/worker-public-path/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./main.js"]; diff --git a/test/configCases/output/worker-public-path/test.filter.js b/test/configCases/output/worker-public-path/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/output/worker-public-path/test.filter.js +++ b/test/configCases/output/worker-public-path/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/output/worker-public-path/webpack.config.js b/test/configCases/output/worker-public-path/webpack.config.js index a141441d354..7a31865c007 100644 --- a/test/configCases/output/worker-public-path/webpack.config.js +++ b/test/configCases/output/worker-public-path/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "none", diff --git a/test/configCases/parsing/bom/test.config.js b/test/configCases/parsing/bom/test.config.js index cceab964383..0421a90089b 100644 --- a/test/configCases/parsing/bom/test.config.js +++ b/test/configCases/parsing/bom/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/test/configCases/parsing/bom/webpack.config.js b/test/configCases/parsing/bom/webpack.config.js index cb633c0010e..d26e0145694 100644 --- a/test/configCases/parsing/bom/webpack.config.js +++ b/test/configCases/parsing/bom/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/parsing/context/errors.js b/test/configCases/parsing/context/errors.js index ab18d4d5490..779f16992ad 100644 --- a/test/configCases/parsing/context/errors.js +++ b/test/configCases/parsing/context/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Module parse failed/, diff --git a/test/configCases/parsing/context/infrastructure-log.js b/test/configCases/parsing/context/infrastructure-log.js index e458f85280b..fe6c3fa6e94 100644 --- a/test/configCases/parsing/context/infrastructure-log.js +++ b/test/configCases/parsing/context/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /^Pack got invalid because of write to: Compilation\/modules|.+dump-file\.txt/ ]; diff --git a/test/configCases/parsing/context/webpack.config.js b/test/configCases/parsing/context/webpack.config.js index 91e80ba3b53..497cd1228c0 100644 --- a/test/configCases/parsing/context/webpack.config.js +++ b/test/configCases/parsing/context/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/parsing/dead-code-elimination-require-ensure/webpack.config.js b/test/configCases/parsing/dead-code-elimination-require-ensure/webpack.config.js index e30e85e9364..504d6edc347 100644 --- a/test/configCases/parsing/dead-code-elimination-require-ensure/webpack.config.js +++ b/test/configCases/parsing/dead-code-elimination-require-ensure/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/parsing/dead-code-elimination/test.config.js b/test/configCases/parsing/dead-code-elimination/test.config.js index 69937cfcbe4..58a0ac314a1 100644 --- a/test/configCases/parsing/dead-code-elimination/test.config.js +++ b/test/configCases/parsing/dead-code-elimination/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["test.js", "bundle0.js"]; diff --git a/test/configCases/parsing/dead-code-elimination/webpack.config.js b/test/configCases/parsing/dead-code-elimination/webpack.config.js index e99e2537c8b..213510c47e0 100644 --- a/test/configCases/parsing/dead-code-elimination/webpack.config.js +++ b/test/configCases/parsing/dead-code-elimination/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); @@ -23,7 +25,7 @@ module.exports = [ plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("Test", compilation => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-webpack-plugin", diff --git a/test/configCases/parsing/destructuring-computed-property/webpack.config.js b/test/configCases/parsing/destructuring-computed-property/webpack.config.js index 2f7f833fa6e..ac8e5f982de 100644 --- a/test/configCases/parsing/destructuring-computed-property/webpack.config.js +++ b/test/configCases/parsing/destructuring-computed-property/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/parsing/destructuring-namespace-import/webpack.config.js b/test/configCases/parsing/destructuring-namespace-import/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/configCases/parsing/destructuring-namespace-import/webpack.config.js +++ b/test/configCases/parsing/destructuring-namespace-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/parsing/destructuring-rest/webpack.config.js b/test/configCases/parsing/destructuring-rest/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/configCases/parsing/destructuring-rest/webpack.config.js +++ b/test/configCases/parsing/destructuring-rest/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/parsing/harmony-global/webpack.config.js b/test/configCases/parsing/harmony-global/webpack.config.js index 7bb5f004c11..6718d29b4e7 100644 --- a/test/configCases/parsing/harmony-global/webpack.config.js +++ b/test/configCases/parsing/harmony-global/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/parsing/harmony-this-concat/webpack.config.js b/test/configCases/parsing/harmony-this-concat/webpack.config.js index 8c13599c69a..0310d544882 100644 --- a/test/configCases/parsing/harmony-this-concat/webpack.config.js +++ b/test/configCases/parsing/harmony-this-concat/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/parsing/harmony-this/webpack.config.js b/test/configCases/parsing/harmony-this/webpack.config.js index 2423e135e4e..4983396e4a3 100644 --- a/test/configCases/parsing/harmony-this/webpack.config.js +++ b/test/configCases/parsing/harmony-this/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/parsing/import-ignore/webpack.config.js b/test/configCases/parsing/import-ignore/webpack.config.js index a824d92018a..61f7c859bae 100644 --- a/test/configCases/parsing/import-ignore/webpack.config.js +++ b/test/configCases/parsing/import-ignore/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/parsing/issue-11619/webpack.config.js b/test/configCases/parsing/issue-11619/webpack.config.js index e7c39588cb5..5d05f5f38af 100644 --- a/test/configCases/parsing/issue-11619/webpack.config.js +++ b/test/configCases/parsing/issue-11619/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const ProvidePlugin = require("../../../../").ProvidePlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/parsing/issue-14545/webpack.config.js b/test/configCases/parsing/issue-14545/webpack.config.js index 91e80ba3b53..497cd1228c0 100644 --- a/test/configCases/parsing/issue-14545/webpack.config.js +++ b/test/configCases/parsing/issue-14545/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/parsing/issue-14720/webpack.config.js b/test/configCases/parsing/issue-14720/webpack.config.js index dffc81bba10..7389b128cd5 100644 --- a/test/configCases/parsing/issue-14720/webpack.config.js +++ b/test/configCases/parsing/issue-14720/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production" diff --git a/test/configCases/parsing/issue-19514/webpack.config.js b/test/configCases/parsing/issue-19514/webpack.config.js index f2b98bcca3f..ec51b60af3d 100644 --- a/test/configCases/parsing/issue-19514/webpack.config.js +++ b/test/configCases/parsing/issue-19514/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", diff --git a/test/configCases/parsing/issue-2942/warnings.js b/test/configCases/parsing/issue-2942/warnings.js index b9d04875279..f28c5900d66 100644 --- a/test/configCases/parsing/issue-2942/warnings.js +++ b/test/configCases/parsing/issue-2942/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/System.register is not supported by webpack/], [/System.get is not supported by webpack/], diff --git a/test/configCases/parsing/issue-2942/webpack.config.js b/test/configCases/parsing/issue-2942/webpack.config.js index cb87a26bb00..a0d3feb7ce7 100644 --- a/test/configCases/parsing/issue-2942/webpack.config.js +++ b/test/configCases/parsing/issue-2942/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/parsing/issue-336/webpack.config.js b/test/configCases/parsing/issue-336/webpack.config.js index ea4f97ab1c7..b29facb8459 100644 --- a/test/configCases/parsing/issue-336/webpack.config.js +++ b/test/configCases/parsing/issue-336/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const ProvidePlugin = require("../../../../").ProvidePlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/parsing/issue-4857/webpack.config.js b/test/configCases/parsing/issue-4857/webpack.config.js index e30e85e9364..504d6edc347 100644 --- a/test/configCases/parsing/issue-4857/webpack.config.js +++ b/test/configCases/parsing/issue-4857/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/parsing/issue-5624/webpack.config.js b/test/configCases/parsing/issue-5624/webpack.config.js index 8c13599c69a..0310d544882 100644 --- a/test/configCases/parsing/issue-5624/webpack.config.js +++ b/test/configCases/parsing/issue-5624/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/parsing/issue-8293/webpack.config.js b/test/configCases/parsing/issue-8293/webpack.config.js index 09541e8dc70..00e58d61b05 100644 --- a/test/configCases/parsing/issue-8293/webpack.config.js +++ b/test/configCases/parsing/issue-8293/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/parsing/issue-9042/test.config.js b/test/configCases/parsing/issue-9042/test.config.js index 997667fd529..c0a2708abdc 100644 --- a/test/configCases/parsing/issue-9042/test.config.js +++ b/test/configCases/parsing/issue-9042/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { delete scope.__dirname; diff --git a/test/configCases/parsing/issue-9042/webpack.config.js b/test/configCases/parsing/issue-9042/webpack.config.js index 0a96337dc09..0f4a52eef2e 100644 --- a/test/configCases/parsing/issue-9042/webpack.config.js +++ b/test/configCases/parsing/issue-9042/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/parsing/issue-9156/webpack.config.js b/test/configCases/parsing/issue-9156/webpack.config.js index 0c8b672e367..6b280875008 100644 --- a/test/configCases/parsing/issue-9156/webpack.config.js +++ b/test/configCases/parsing/issue-9156/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/parsing/node-source-plugin-off/webpack.config.js b/test/configCases/parsing/node-source-plugin-off/webpack.config.js index 0c8b672e367..6b280875008 100644 --- a/test/configCases/parsing/node-source-plugin-off/webpack.config.js +++ b/test/configCases/parsing/node-source-plugin-off/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/parsing/node-stuff-plugin-off/test.config.js b/test/configCases/parsing/node-stuff-plugin-off/test.config.js index 997667fd529..c0a2708abdc 100644 --- a/test/configCases/parsing/node-stuff-plugin-off/test.config.js +++ b/test/configCases/parsing/node-stuff-plugin-off/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { delete scope.__dirname; diff --git a/test/configCases/parsing/node-stuff-plugin-off/webpack.config.js b/test/configCases/parsing/node-stuff-plugin-off/webpack.config.js index 0c8b672e367..6b280875008 100644 --- a/test/configCases/parsing/node-stuff-plugin-off/webpack.config.js +++ b/test/configCases/parsing/node-stuff-plugin-off/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/parsing/optional-chaining/test.filter.js b/test/configCases/parsing/optional-chaining/test.filter.js index 9486c09cf37..53cf6da0c34 100644 --- a/test/configCases/parsing/optional-chaining/test.filter.js +++ b/test/configCases/parsing/optional-chaining/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); module.exports = () => supportsOptionalChaining(); diff --git a/test/configCases/parsing/optional-chaining/webpack.config.js b/test/configCases/parsing/optional-chaining/webpack.config.js index e805aa39e04..74f48566408 100644 --- a/test/configCases/parsing/optional-chaining/webpack.config.js +++ b/test/configCases/parsing/optional-chaining/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { DefinePlugin } = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/parsing/optional/warnings.js b/test/configCases/parsing/optional/warnings.js index e011edaca23..b7d814d8cff 100644 --- a/test/configCases/parsing/optional/warnings.js +++ b/test/configCases/parsing/optional/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /Module not found/, diff --git a/test/configCases/parsing/optional/webpack.config.js b/test/configCases/parsing/optional/webpack.config.js index 61694bc0914..ac887dc073d 100644 --- a/test/configCases/parsing/optional/webpack.config.js +++ b/test/configCases/parsing/optional/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { bail: true diff --git a/test/configCases/parsing/override-strict/webpack.config.js b/test/configCases/parsing/override-strict/webpack.config.js index d92a10890a5..246bef7b320 100644 --- a/test/configCases/parsing/override-strict/webpack.config.js +++ b/test/configCases/parsing/override-strict/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = [ { diff --git a/test/configCases/parsing/relative-filedirname/webpack.config.js b/test/configCases/parsing/relative-filedirname/webpack.config.js index 14316147f89..993501a19f3 100644 --- a/test/configCases/parsing/relative-filedirname/webpack.config.js +++ b/test/configCases/parsing/relative-filedirname/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { node: { diff --git a/test/configCases/parsing/require-ignore/webpack.config.js b/test/configCases/parsing/require-ignore/webpack.config.js index 4323daf6d9d..cfce94604ba 100644 --- a/test/configCases/parsing/require-ignore/webpack.config.js +++ b/test/configCases/parsing/require-ignore/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/parsing/require-resolve-ignore/webpack.config.js b/test/configCases/parsing/require-resolve-ignore/webpack.config.js index 4323daf6d9d..cfce94604ba 100644 --- a/test/configCases/parsing/require-resolve-ignore/webpack.config.js +++ b/test/configCases/parsing/require-resolve-ignore/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/parsing/require.main/webpack.config.js b/test/configCases/parsing/require.main/webpack.config.js index 3583b70a321..27313115dcd 100644 --- a/test/configCases/parsing/require.main/webpack.config.js +++ b/test/configCases/parsing/require.main/webpack.config.js @@ -1,2 +1,4 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = {}; diff --git a/test/configCases/parsing/requirejs/webpack.config.js b/test/configCases/parsing/requirejs/webpack.config.js index 8da4d0ff7c4..7edee3f73f3 100644 --- a/test/configCases/parsing/requirejs/webpack.config.js +++ b/test/configCases/parsing/requirejs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/parsing/system.import/warnings.js b/test/configCases/parsing/system.import/warnings.js index 87f7042472d..d27a39dc0d0 100644 --- a/test/configCases/parsing/system.import/warnings.js +++ b/test/configCases/parsing/system.import/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [{compilerPath: /system_true/}, /System\.import\(\) is deprecated/] ]; diff --git a/test/configCases/parsing/system.import/webpack.config.js b/test/configCases/parsing/system.import/webpack.config.js index ba03c038bdb..9bebce7addf 100644 --- a/test/configCases/parsing/system.import/webpack.config.js +++ b/test/configCases/parsing/system.import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** diff --git a/test/configCases/parsing/url-ignore/warnings.js b/test/configCases/parsing/url-ignore/warnings.js index 3e31c655be4..4730466a4b8 100644 --- a/test/configCases/parsing/url-ignore/warnings.js +++ b/test/configCases/parsing/url-ignore/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [/`webpackIgnore` expected a boolean, but received: test./]; diff --git a/test/configCases/parsing/url-ignore/webpack.config.js b/test/configCases/parsing/url-ignore/webpack.config.js index 9787b026dbc..a5b3cb94cdf 100644 --- a/test/configCases/parsing/url-ignore/webpack.config.js +++ b/test/configCases/parsing/url-ignore/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/performance/many-async-imports/test.config.js b/test/configCases/performance/many-async-imports/test.config.js index 3f84fd04e2f..cef84ace50f 100644 --- a/test/configCases/performance/many-async-imports/test.config.js +++ b/test/configCases/performance/many-async-imports/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { timeout: 10000 }; diff --git a/test/configCases/performance/many-async-imports/webpack.config.js b/test/configCases/performance/many-async-imports/webpack.config.js index e30e85e9364..504d6edc347 100644 --- a/test/configCases/performance/many-async-imports/webpack.config.js +++ b/test/configCases/performance/many-async-imports/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/performance/many-exports/test.config.js b/test/configCases/performance/many-exports/test.config.js index 3f84fd04e2f..cef84ace50f 100644 --- a/test/configCases/performance/many-exports/test.config.js +++ b/test/configCases/performance/many-exports/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { timeout: 10000 }; diff --git a/test/configCases/performance/many-exports/webpack.config.js b/test/configCases/performance/many-exports/webpack.config.js index e30e85e9364..504d6edc347 100644 --- a/test/configCases/performance/many-exports/webpack.config.js +++ b/test/configCases/performance/many-exports/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/plugins/banner-plugin-hashing/test.config.js b/test/configCases/plugins/banner-plugin-hashing/test.config.js index 72f2bf28c22..afa4e17c955 100644 --- a/test/configCases/plugins/banner-plugin-hashing/test.config.js +++ b/test/configCases/plugins/banner-plugin-hashing/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return "./dist/banner.js"; diff --git a/test/configCases/plugins/banner-plugin/webpack.config.js b/test/configCases/plugins/banner-plugin/webpack.config.js index 5591821323c..037636476bf 100644 --- a/test/configCases/plugins/banner-plugin/webpack.config.js +++ b/test/configCases/plugins/banner-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/plugins/define-plugin-bigint/webpack.config.js b/test/configCases/plugins/define-plugin-bigint/webpack.config.js index 47d5f73792e..b2593599aea 100644 --- a/test/configCases/plugins/define-plugin-bigint/webpack.config.js +++ b/test/configCases/plugins/define-plugin-bigint/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const DefinePlugin = require("../../../../").DefinePlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/plugins/define-plugin-process-env/webpack.config.js b/test/configCases/plugins/define-plugin-process-env/webpack.config.js index 9b5277c52f1..9e6995d132a 100644 --- a/test/configCases/plugins/define-plugin-process-env/webpack.config.js +++ b/test/configCases/plugins/define-plugin-process-env/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const DefinePlugin = require("../../../../").DefinePlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/plugins/define-plugin-sub-key/webpack.config.js b/test/configCases/plugins/define-plugin-sub-key/webpack.config.js index 8655194c02a..f2d5952d8b3 100644 --- a/test/configCases/plugins/define-plugin-sub-key/webpack.config.js +++ b/test/configCases/plugins/define-plugin-sub-key/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const DefinePlugin = require("../../../../").DefinePlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/plugins/define-plugin/webpack.config.js b/test/configCases/plugins/define-plugin/webpack.config.js index b73c8b9b110..0307a01e31a 100644 --- a/test/configCases/plugins/define-plugin/webpack.config.js +++ b/test/configCases/plugins/define-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const DefinePlugin = require("../../../../").DefinePlugin; const Module = require("../../../../").Module; diff --git a/test/configCases/plugins/environment-plugin/errors.js b/test/configCases/plugins/environment-plugin/errors.js index b393e2ba6ab..bd5671bdd78 100644 --- a/test/configCases/plugins/environment-plugin/errors.js +++ b/test/configCases/plugins/environment-plugin/errors.js @@ -1,3 +1,5 @@ +"use strict"; + const variables = [ "aaa", "bbb", diff --git a/test/configCases/plugins/lib-manifest-plugin/webpack.config.js b/test/configCases/plugins/lib-manifest-plugin/webpack.config.js index e409f28528b..5bcf77805bd 100644 --- a/test/configCases/plugins/lib-manifest-plugin/webpack.config.js +++ b/test/configCases/plugins/lib-manifest-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const LibManifestPlugin = require("../../../../").LibManifestPlugin; diff --git a/test/configCases/plugins/limit-chunk-count-plugin/test.config.js b/test/configCases/plugins/limit-chunk-count-plugin/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/plugins/limit-chunk-count-plugin/test.config.js +++ b/test/configCases/plugins/limit-chunk-count-plugin/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/plugins/limit-chunk-count-plugin/webpack.config.js b/test/configCases/plugins/limit-chunk-count-plugin/webpack.config.js index d4d76bcc2a3..b994327223e 100644 --- a/test/configCases/plugins/limit-chunk-count-plugin/webpack.config.js +++ b/test/configCases/plugins/limit-chunk-count-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/plugins/loader-options-plugin/webpack.config.js b/test/configCases/plugins/loader-options-plugin/webpack.config.js index be4a90d7fa7..d274e65fd02 100644 --- a/test/configCases/plugins/loader-options-plugin/webpack.config.js +++ b/test/configCases/plugins/loader-options-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/plugins/min-chunk-size/webpack.config.js b/test/configCases/plugins/min-chunk-size/webpack.config.js index f9dd2f4eda6..3c472ac98ac 100644 --- a/test/configCases/plugins/min-chunk-size/webpack.config.js +++ b/test/configCases/plugins/min-chunk-size/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/plugins/mini-css-extract-plugin/test.config.js b/test/configCases/plugins/mini-css-extract-plugin/test.config.js index 41eeb395b80..c0e2d2dc705 100644 --- a/test/configCases/plugins/mini-css-extract-plugin/test.config.js +++ b/test/configCases/plugins/mini-css-extract-plugin/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return [`${i}_a.js`, `${i}_b.js`, `${i}_c.js`]; diff --git a/test/configCases/plugins/mini-css-extract-plugin/webpack.config.js b/test/configCases/plugins/mini-css-extract-plugin/webpack.config.js index 4c30ac8871e..b4b704c222b 100644 --- a/test/configCases/plugins/mini-css-extract-plugin/webpack.config.js +++ b/test/configCases/plugins/mini-css-extract-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MCEP = require("mini-css-extract-plugin"); /** @typedef {import("../../../../").StatsCompilation} StatsCompilation */ @@ -37,12 +39,12 @@ const config = (i, options) => ({ }, plugins: [ new MCEP(options), - compiler => { - compiler.hooks.done.tap("Test", stats => { + (compiler) => { + compiler.hooks.done.tap("Test", (stats) => { const chunkIds = /** @type {NonNullable} */ (stats.toJson({ all: false, chunks: true, ids: true }).chunks) - .map(c => c.id) + .map((c) => c.id) .sort(); expect(chunkIds).toEqual([ "a", diff --git a/test/configCases/plugins/profiling-plugin/deprecations.js b/test/configCases/plugins/profiling-plugin/deprecations.js index dee16addc3f..368f9474dce 100644 --- a/test/configCases/plugins/profiling-plugin/deprecations.js +++ b/test/configCases/plugins/profiling-plugin/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK/ } ]; diff --git a/test/configCases/plugins/profiling-plugin/test.config.js b/test/configCases/plugins/profiling-plugin/test.config.js index 5ef314060c9..55bea19ac62 100644 --- a/test/configCases/plugins/profiling-plugin/test.config.js +++ b/test/configCases/plugins/profiling-plugin/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { timeout: 60000 }; diff --git a/test/configCases/plugins/profiling-plugin/test.filter.js b/test/configCases/plugins/profiling-plugin/test.filter.js index 1338bc1e7b5..f1925767d11 100644 --- a/test/configCases/plugins/profiling-plugin/test.filter.js +++ b/test/configCases/plugins/profiling-plugin/test.filter.js @@ -1 +1,3 @@ +"use strict"; + module.exports = () => !process.env.CI; diff --git a/test/configCases/plugins/profiling-plugin/webpack.config.js b/test/configCases/plugins/profiling-plugin/webpack.config.js index 07035fd7374..cf446e39d64 100644 --- a/test/configCases/plugins/profiling-plugin/webpack.config.js +++ b/test/configCases/plugins/profiling-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const rootPath = "../../../../"; const webpack = require(rootPath); diff --git a/test/configCases/plugins/progress-plugin/test.config.js b/test/configCases/plugins/progress-plugin/test.config.js index 57d3499a591..f6ef5272c58 100644 --- a/test/configCases/plugins/progress-plugin/test.config.js +++ b/test/configCases/plugins/progress-plugin/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/test/configCases/plugins/progress-plugin/webpack.config.js b/test/configCases/plugins/progress-plugin/webpack.config.js index a02a4fa2a3c..0f0633cf559 100644 --- a/test/configCases/plugins/progress-plugin/webpack.config.js +++ b/test/configCases/plugins/progress-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); const data = require("./data"); @@ -14,8 +16,8 @@ module.exports = { data.push(messages.join("|")); }), { - apply: compiler => { - compiler.hooks.compilation.tap("CustomPlugin", compilation => { + apply: (compiler) => { + compiler.hooks.compilation.tap("CustomPlugin", (compilation) => { compilation.hooks.optimize.tap("CustomPlugin", () => { const reportProgress = /** @type {NonNullable>} */ diff --git a/test/configCases/plugins/provide-plugin/webpack.config.js b/test/configCases/plugins/provide-plugin/webpack.config.js index 877c451c9bd..2b3e669e334 100644 --- a/test/configCases/plugins/provide-plugin/webpack.config.js +++ b/test/configCases/plugins/provide-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const ProvidePlugin = require("../../../../").ProvidePlugin; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/plugins/source-map-dev-tool-plugin-append-function/webpack.config.js b/test/configCases/plugins/source-map-dev-tool-plugin-append-function/webpack.config.js index 316da3e8874..2fc1f3a57f2 100644 --- a/test/configCases/plugins/source-map-dev-tool-plugin-append-function/webpack.config.js +++ b/test/configCases/plugins/source-map-dev-tool-plugin-append-function/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const TerserPlugin = require("terser-webpack-plugin"); const webpack = require("../../../../"); diff --git a/test/configCases/plugins/source-map-dev-tool-plugin/webpack.config.js b/test/configCases/plugins/source-map-dev-tool-plugin/webpack.config.js index 6ca950d3ffe..82961a1eac8 100644 --- a/test/configCases/plugins/source-map-dev-tool-plugin/webpack.config.js +++ b/test/configCases/plugins/source-map-dev-tool-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const TerserPlugin = require("terser-webpack-plugin"); const webpack = require("../../../../"); diff --git a/test/configCases/plugins/source-map-dev-tool-plugin~append/webpack.config.js b/test/configCases/plugins/source-map-dev-tool-plugin~append/webpack.config.js index b230e682bbb..d82b41fcb0b 100644 --- a/test/configCases/plugins/source-map-dev-tool-plugin~append/webpack.config.js +++ b/test/configCases/plugins/source-map-dev-tool-plugin~append/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const TerserPlugin = require("terser-webpack-plugin"); const webpack = require("../../../../"); diff --git a/test/configCases/plugins/terser-plugin/webpack.config.js b/test/configCases/plugins/terser-plugin/webpack.config.js index e7717a60588..89cf4ec7927 100644 --- a/test/configCases/plugins/terser-plugin/webpack.config.js +++ b/test/configCases/plugins/terser-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const TerserPlugin = require("terser-webpack-plugin"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/plugins/virtual-url-plugin/webpack.config.js b/test/configCases/plugins/virtual-url-plugin/webpack.config.js index a5081e27532..e5dd99bf20b 100644 --- a/test/configCases/plugins/virtual-url-plugin/webpack.config.js +++ b/test/configCases/plugins/virtual-url-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); @@ -14,7 +16,7 @@ const config = { const files = fs.readdirSync(watchDir); return ` export const routes = { - ${files.map(key => `${key.split(".")[0]}: () => import('./routes/${key}')`).join(",\n")} + ${files.map((key) => `${key.split(".")[0]}: () => import('./routes/${key}')`).join(",\n")} } `; }, diff --git a/test/configCases/process-assets/html-plugin/infrastructure-log.js b/test/configCases/process-assets/html-plugin/infrastructure-log.js index 0297c93d8a7..c519ba1a37d 100644 --- a/test/configCases/process-assets/html-plugin/infrastructure-log.js +++ b/test/configCases/process-assets/html-plugin/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ // each time returns different OriginalSource in webpack.config.js:78 // this prevents hit in inmemory cache diff --git a/test/configCases/process-assets/html-plugin/test.config.js b/test/configCases/process-assets/html-plugin/test.config.js index 63ffe2a56c9..494e0434cd4 100644 --- a/test/configCases/process-assets/html-plugin/test.config.js +++ b/test/configCases/process-assets/html-plugin/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return "./test.js"; diff --git a/test/configCases/process-assets/html-plugin/webpack.config.js b/test/configCases/process-assets/html-plugin/webpack.config.js index e7d0b991a17..b8cb54806f5 100644 --- a/test/configCases/process-assets/html-plugin/webpack.config.js +++ b/test/configCases/process-assets/html-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { sources: { RawSource, OriginalSource, ReplaceSource }, Compilation, @@ -24,7 +26,7 @@ class VerifyAdditionalAssetsPlugin { apply(compiler) { compiler.hooks.compilation.tap( "VerifyAdditionalAssetsPlugin", - compilation => { + (compilation) => { const alreadySeenAssets = new Set(); compilation.hooks.processAssets.tap( { @@ -32,7 +34,7 @@ class VerifyAdditionalAssetsPlugin { stage: this.stage, additionalAssets: true }, - assets => { + (assets) => { for (const asset of Object.keys(assets)) { expect(alreadySeenAssets).not.toContain(asset); alreadySeenAssets.add(asset); @@ -56,7 +58,7 @@ class HtmlPlugin { * @param {Compiler} compiler compiler */ apply(compiler) { - compiler.hooks.compilation.tap("html-plugin", compilation => { + compiler.hooks.compilation.tap("html-plugin", (compilation) => { compilation.hooks.processAssets.tap( { name: "html-plugin", @@ -76,19 +78,19 @@ class HtmlPlugin { * @param {string} file file * @returns {string} content of script tag */ - const toScriptTag = file => { + const toScriptTag = (file) => { const asset = /** @type {Asset} */ (compilation.getAsset(file)); const hash = createHash("sha512"); hash.update(asset.source.source()); const integrity = `sha512-${hash.digest("base64")}`; compilation.updateAsset( file, - x => x, + (x) => x, /** * @param {AssetInfo} assetInfo asset info * @returns {AssetInfo} new asset info */ - assetInfo => ({ + (assetInfo) => ({ ...assetInfo, contenthash: Array.isArray(assetInfo.contenthash) ? [...new Set([...assetInfo.contenthash, integrity])] @@ -106,7 +108,7 @@ class HtmlPlugin { new OriginalSource( ` -${files.map(file => ` ${toScriptTag(file)}`).join("\n")} +${files.map((file) => ` ${toScriptTag(file)}`).join("\n")} `, "index.html" @@ -130,14 +132,14 @@ class HtmlInlinePlugin { * @param {Compiler} compiler compiler */ apply(compiler) { - compiler.hooks.compilation.tap("html-inline-plugin", compilation => { + compiler.hooks.compilation.tap("html-inline-plugin", (compilation) => { compilation.hooks.processAssets.tap( { name: "html-inline-plugin", stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE, additionalAssets: true }, - assets => { + (assets) => { const publicPath = /** @type {string} */ (compilation.outputOptions.publicPath); @@ -191,7 +193,7 @@ class SriHashSupportPlugin { * @param {Compiler} compiler compiler */ apply(compiler) { - compiler.hooks.compilation.tap("sri-hash-support-plugin", compilation => { + compiler.hooks.compilation.tap("sri-hash-support-plugin", (compilation) => { RealContentHashPlugin.getCompilationHooks(compilation).updateHash.tap( "sri-hash-support-plugin", (input, oldHash) => { @@ -211,24 +213,24 @@ class HtmlMinimizePlugin { * @param {Compiler} compiler compiler */ apply(compiler) { - compiler.hooks.compilation.tap("html-minimize-plugin", compilation => { + compiler.hooks.compilation.tap("html-minimize-plugin", (compilation) => { compilation.hooks.processAssets.tap( { name: "html-minimize-plugin", stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE, additionalAssets: true }, - assets => { + (assets) => { for (const name of Object.keys(assets)) { if (/\.html$/.test(name)) { compilation.updateAsset( name, - source => + (source) => new RawSource( /** @type {string} */ (source.source()).replace(/\s+/g, " ") ), - assetInfo => ({ + (assetInfo) => ({ ...assetInfo, minimized: true }) diff --git a/test/configCases/process-assets/update-info/webpack.config.js b/test/configCases/process-assets/update-info/webpack.config.js index 4bb9868523c..8704cf67573 100644 --- a/test/configCases/process-assets/update-info/webpack.config.js +++ b/test/configCases/process-assets/update-info/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").AssetInfo} AssetInfo */ /** @type {import("../../../../").Configuration} */ @@ -7,14 +9,14 @@ module.exports = { }, plugins: [ { - apply: compiler => { - compiler.hooks.compilation.tap("TestPlugin", compilation => { + apply: (compiler) => { + compiler.hooks.compilation.tap("TestPlugin", (compilation) => { compilation.hooks.processAssets.tap( { name: "TestPlugin", additionalAssets: true }, - assets => { + (assets) => { for (const asset of Object.keys(assets)) { switch (asset) { case "images/file.svg": { @@ -22,7 +24,7 @@ module.exports = { custom: true, related: { first: ["first"] } }); - compilation.updateAsset(asset, assets[asset], info => ({ + compilation.updateAsset(asset, assets[asset], (info) => ({ ...info, related: { .../** @type {{ related: Record }} */ ( diff --git a/test/configCases/race-conditions/import-module/test.filter.js b/test/configCases/race-conditions/import-module/test.filter.js index daa2b101298..6c0c15c2e74 100644 --- a/test/configCases/race-conditions/import-module/test.filter.js +++ b/test/configCases/race-conditions/import-module/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = () => { const [major] = process.versions.node.split(".").map(Number); diff --git a/test/configCases/race-conditions/import-module/webpack.config.js b/test/configCases/race-conditions/import-module/webpack.config.js index 44c2cb40ef4..296579050cc 100644 --- a/test/configCases/race-conditions/import-module/webpack.config.js +++ b/test/configCases/race-conditions/import-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { parallelism: 1, diff --git a/test/configCases/race-conditions/load-module/webpack.config.js b/test/configCases/race-conditions/load-module/webpack.config.js index 40427f8605e..09f63feb12d 100644 --- a/test/configCases/race-conditions/load-module/webpack.config.js +++ b/test/configCases/race-conditions/load-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { parallelism: 1 diff --git a/test/configCases/rebuild/finishModules/webpack.config.js b/test/configCases/rebuild/finishModules/webpack.config.js index c97be5a3fc8..fd5c0834460 100644 --- a/test/configCases/rebuild/finishModules/webpack.config.js +++ b/test/configCases/rebuild/finishModules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { join, resolve } = require("path"); const { NormalModule } = require("../../../../"); @@ -8,12 +10,12 @@ const { NormalModule } = require("../../../../"); /** * @param {import("../../../../").Compiler} compiler the compiler */ -const testPlugin = compiler => { - compiler.hooks.compilation.tap("TestPlugin", compilation => { +const testPlugin = (compiler) => { + compiler.hooks.compilation.tap("TestPlugin", (compilation) => { let shouldReplace = false; NormalModule.getCompilationHooks(compilation).loader.tap( "TestPlugin", - loaderContext => { + (loaderContext) => { /** @type {EXPECTED_ANY} */ (loaderContext).shouldReplace = shouldReplace; } @@ -50,7 +52,7 @@ const testPlugin = compiler => { } shouldReplace = true; - compilation.rebuildModule(module, err => { + compilation.rebuildModule(module, (err) => { shouldReplace = false; callback(err); }); diff --git a/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js b/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js index 064fbf46c4a..bf634454391 100644 --- a/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js +++ b/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { join, resolve } = require("path"); const { NormalModule } = require("../../../../"); @@ -6,12 +8,12 @@ const { NormalModule } = require("../../../../"); /** * @param {import("../../../../").Compiler} compiler the compiler */ -const testPlugin = compiler => { - compiler.hooks.compilation.tap("TestPlugin", compilation => { +const testPlugin = (compiler) => { + compiler.hooks.compilation.tap("TestPlugin", (compilation) => { let shouldReplace = false; NormalModule.getCompilationHooks(compilation).loader.tap( "TestPlugin", - loaderContext => { + (loaderContext) => { /** @type {EXPECTED_ANY} */ (loaderContext).shouldReplace = shouldReplace; } @@ -48,7 +50,7 @@ const testPlugin = compiler => { } shouldReplace = true; - compilation.rebuildModule(module, err => { + compilation.rebuildModule(module, (err) => { shouldReplace = false; callback(err); }); diff --git a/test/configCases/records/issue-295/webpack.config.js b/test/configCases/records/issue-295/webpack.config.js index c7eedcfd8ed..f65ee6b2b7e 100644 --- a/test/configCases/records/issue-295/webpack.config.js +++ b/test/configCases/records/issue-295/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration} */ diff --git a/test/configCases/records/issue-2991/webpack.config.js b/test/configCases/records/issue-2991/webpack.config.js index 664fd120e95..a1179fc8a57 100644 --- a/test/configCases/records/issue-2991/webpack.config.js +++ b/test/configCases/records/issue-2991/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration} */ diff --git a/test/configCases/records/issue-7339/webpack.config.js b/test/configCases/records/issue-7339/webpack.config.js index 51047a992bb..255e8e121a8 100644 --- a/test/configCases/records/issue-7339/webpack.config.js +++ b/test/configCases/records/issue-7339/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration} */ diff --git a/test/configCases/records/issue-7492/webpack.config.js b/test/configCases/records/issue-7492/webpack.config.js index 14f0c37811b..66927c9b9ec 100644 --- a/test/configCases/records/issue-7492/webpack.config.js +++ b/test/configCases/records/issue-7492/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/records/stable-sort/webpack.config.js b/test/configCases/records/stable-sort/webpack.config.js index 132be139b0a..d5b47234bbc 100644 --- a/test/configCases/records/stable-sort/webpack.config.js +++ b/test/configCases/records/stable-sort/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration} */ diff --git a/test/configCases/records/with-readRecords-hook/webpack.config.js b/test/configCases/records/with-readRecords-hook/webpack.config.js index 503a8506c34..5f22cc0e5fa 100644 --- a/test/configCases/records/with-readRecords-hook/webpack.config.js +++ b/test/configCases/records/with-readRecords-hook/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const ReadRecordsPlugin = require("./ReadRecordsPlugin"); diff --git a/test/configCases/require/module-require/warnings.js b/test/configCases/require/module-require/warnings.js index c518f69bd24..7a68faffd4c 100644 --- a/test/configCases/require/module-require/warnings.js +++ b/test/configCases/require/module-require/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /require function is used in a way in which dependencies cannot be statically extracted/, /createRequire\(\)\.main is not supported by webpack/ diff --git a/test/configCases/require/module-require/webpack.config.js b/test/configCases/require/module-require/webpack.config.js index fe99e3d1745..b14c3325724 100644 --- a/test/configCases/require/module-require/webpack.config.js +++ b/test/configCases/require/module-require/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", diff --git a/test/configCases/resolve-merging/imports-fields/webpack.config.js b/test/configCases/resolve-merging/imports-fields/webpack.config.js index a1150b90eed..7332c1abd65 100644 --- a/test/configCases/resolve-merging/imports-fields/webpack.config.js +++ b/test/configCases/resolve-merging/imports-fields/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { entry: "./index.js", resolve: { diff --git a/test/configCases/resolve-merging/override/webpack.config.js b/test/configCases/resolve-merging/override/webpack.config.js index 4d790393546..029400f95b9 100644 --- a/test/configCases/resolve-merging/override/webpack.config.js +++ b/test/configCases/resolve-merging/override/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { resolve: { alias: { diff --git a/test/configCases/resolve/context-resolve-with-ignore/webpack.config.js b/test/configCases/resolve/context-resolve-with-ignore/webpack.config.js index 24884ab1c2e..69fde2acfe3 100644 --- a/test/configCases/resolve/context-resolve-with-ignore/webpack.config.js +++ b/test/configCases/resolve/context-resolve-with-ignore/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/resolve/empty-context-module/webpack.config.js b/test/configCases/resolve/empty-context-module/webpack.config.js index bfefc9c737a..abf9bf4e19a 100644 --- a/test/configCases/resolve/empty-context-module/webpack.config.js +++ b/test/configCases/resolve/empty-context-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/resolve/fallback/webpack.config.js b/test/configCases/resolve/fallback/webpack.config.js index 8c173e91a83..1bf74bd3276 100644 --- a/test/configCases/resolve/fallback/webpack.config.js +++ b/test/configCases/resolve/fallback/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/resolve/function-plugins/webpack.config.js b/test/configCases/resolve/function-plugins/webpack.config.js index 56c493fca27..0a1d74f5d90 100644 --- a/test/configCases/resolve/function-plugins/webpack.config.js +++ b/test/configCases/resolve/function-plugins/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + let pluginExecutionCounter = 0; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/resolve/issue-11335-context-module/webpack.config.js b/test/configCases/resolve/issue-11335-context-module/webpack.config.js index d1c50dcaac7..efa5b5a33a2 100644 --- a/test/configCases/resolve/issue-11335-context-module/webpack.config.js +++ b/test/configCases/resolve/issue-11335-context-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/resolve/issue-15580/webpack.config.js b/test/configCases/resolve/issue-15580/webpack.config.js index c39ef077cad..4879145be0d 100644 --- a/test/configCases/resolve/issue-15580/webpack.config.js +++ b/test/configCases/resolve/issue-15580/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/resolve/multi-alias/webpack.config.js b/test/configCases/resolve/multi-alias/webpack.config.js index 5ba1fdc2c47..9aafc4545fa 100644 --- a/test/configCases/resolve/multi-alias/webpack.config.js +++ b/test/configCases/resolve/multi-alias/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/resolve/only-module/webpack.config.js b/test/configCases/resolve/only-module/webpack.config.js index 2b59831e34e..adf3d1a7440 100644 --- a/test/configCases/resolve/only-module/webpack.config.js +++ b/test/configCases/resolve/only-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/resolve/unsafe-cache-proxy/webpack.config.js b/test/configCases/resolve/unsafe-cache-proxy/webpack.config.js index b701fc1a36c..75fedeb2ce9 100644 --- a/test/configCases/resolve/unsafe-cache-proxy/webpack.config.js +++ b/test/configCases/resolve/unsafe-cache-proxy/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); let getCounter = 0; diff --git a/test/configCases/resolving/extensions-order/webpack.config.js b/test/configCases/resolving/extensions-order/webpack.config.js index 6d1fa7e19f4..2facaa1b0a2 100644 --- a/test/configCases/resolving/extensions-order/webpack.config.js +++ b/test/configCases/resolving/extensions-order/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { resolve: { extensions: [".js", "", ".json"] diff --git a/test/configCases/resolving/prefer-absolute/webpack.config.js b/test/configCases/resolving/prefer-absolute/webpack.config.js index 21adc6f0fdc..53fd232349d 100644 --- a/test/configCases/resolving/prefer-absolute/webpack.config.js +++ b/test/configCases/resolving/prefer-absolute/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("enhanced-resolve").Resolver} Resolver */ /** @typedef {import("enhanced-resolve").ResolveRequest} ResolveRequest */ /** @typedef {import("enhanced-resolve").ResolveContext} ResolveContext */ @@ -18,7 +20,7 @@ module.exports = { * @param {Resolver & { hooks: { file: SyncBailHook<[ResolveRequest, ResolveContext], void> } }} resolver resolver */ apply(resolver) { - resolver.hooks.file.tap("Test", request => { + resolver.hooks.file.tap("Test", (request) => { if ( /test.configCases.*test.configCases/.test( /** @type {string} */ diff --git a/test/configCases/resolving/prefer-root/webpack.config.js b/test/configCases/resolving/prefer-root/webpack.config.js index 9aecc535c92..363f998c549 100644 --- a/test/configCases/resolving/prefer-root/webpack.config.js +++ b/test/configCases/resolving/prefer-root/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("enhanced-resolve").Resolver} Resolver */ /** @typedef {import("enhanced-resolve").ResolveRequest} ResolveRequest */ /** @typedef {import("enhanced-resolve").ResolveContext} ResolveContext */ @@ -16,7 +18,7 @@ module.exports = { * @param {Resolver & { hooks: { file: SyncBailHook<[ResolveRequest, ResolveContext], void> } }} resolver resolver */ apply(resolver) { - resolver.hooks.file.tap("Test", request => { + resolver.hooks.file.tap("Test", (request) => { if (request.path === "/index.js") { throw new Error("Trying to resolve as absolute path"); } diff --git a/test/configCases/rule-set/chaining/deprecations.js b/test/configCases/rule-set/chaining/deprecations.js index 6452ef04180..aaf2f310def 100644 --- a/test/configCases/rule-set/chaining/deprecations.js +++ b/test/configCases/rule-set/chaining/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/, diff --git a/test/configCases/rule-set/chaining/webpack.config.js b/test/configCases/rule-set/chaining/webpack.config.js index 88c052b57b6..db99c5717b6 100644 --- a/test/configCases/rule-set/chaining/webpack.config.js +++ b/test/configCases/rule-set/chaining/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/rule-set/compiler/webpack.config.js b/test/configCases/rule-set/compiler/webpack.config.js index 11c0be4e04e..0cb2f868ce2 100644 --- a/test/configCases/rule-set/compiler/webpack.config.js +++ b/test/configCases/rule-set/compiler/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { name: "compiler-name", diff --git a/test/configCases/rule-set/custom/webpack.config.js b/test/configCases/rule-set/custom/webpack.config.js index c1170eccbf4..c5e42835394 100644 --- a/test/configCases/rule-set/custom/webpack.config.js +++ b/test/configCases/rule-set/custom/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").RuleSetUseFunction} RuleSetUseFunction */ /** @typedef {import("../../../../").RuleSetUseItem} RuleSetUseItem */ diff --git a/test/configCases/rule-set/oneOf/webpack.config.js b/test/configCases/rule-set/oneOf/webpack.config.js index 1e19a358be6..745fe508b67 100644 --- a/test/configCases/rule-set/oneOf/webpack.config.js +++ b/test/configCases/rule-set/oneOf/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/rule-set/query/webpack.config.js b/test/configCases/rule-set/query/webpack.config.js index 589fd6fe6f8..09afe74be2e 100644 --- a/test/configCases/rule-set/query/webpack.config.js +++ b/test/configCases/rule-set/query/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/rule-set/resolve-options/webpack.config.js b/test/configCases/rule-set/resolve-options/webpack.config.js index cf15580f0e4..5a03332174f 100644 --- a/test/configCases/rule-set/resolve-options/webpack.config.js +++ b/test/configCases/rule-set/resolve-options/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { resolve: { diff --git a/test/configCases/rule-set/simple-use-array-fn/deprecations.js b/test/configCases/rule-set/simple-use-array-fn/deprecations.js index 509a3520bac..f2b357d311b 100644 --- a/test/configCases/rule-set/simple-use-array-fn/deprecations.js +++ b/test/configCases/rule-set/simple-use-array-fn/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/, message: /oneOf\[0\]/ }, { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/, message: /oneOf\[1\]/ }, diff --git a/test/configCases/rule-set/simple-use-array-fn/webpack.config.js b/test/configCases/rule-set/simple-use-array-fn/webpack.config.js index 2100be79f7d..0ac1aff5568 100644 --- a/test/configCases/rule-set/simple-use-array-fn/webpack.config.js +++ b/test/configCases/rule-set/simple-use-array-fn/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/rule-set/simple-use-fn-array/deprecations.js b/test/configCases/rule-set/simple-use-fn-array/deprecations.js index 509a3520bac..f2b357d311b 100644 --- a/test/configCases/rule-set/simple-use-fn-array/deprecations.js +++ b/test/configCases/rule-set/simple-use-fn-array/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/, message: /oneOf\[0\]/ }, { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/, message: /oneOf\[1\]/ }, diff --git a/test/configCases/rule-set/simple-use-fn-array/webpack.config.js b/test/configCases/rule-set/simple-use-fn-array/webpack.config.js index 8e3cee4afc3..6713b5dbe36 100644 --- a/test/configCases/rule-set/simple-use-fn-array/webpack.config.js +++ b/test/configCases/rule-set/simple-use-fn-array/webpack.config.js @@ -1,10 +1,12 @@ +"use strict"; + /** * @param {EXPECTED_ANY[]} useArray use array * @returns {EXPECTED_FUNCTION[]} functions */ function createFunctionArrayFromUseArray(useArray) { return useArray.map( - useItem => + (useItem) => function fn() { return useItem; } diff --git a/test/configCases/rule-set/simple/deprecations.js b/test/configCases/rule-set/simple/deprecations.js index 509a3520bac..f2b357d311b 100644 --- a/test/configCases/rule-set/simple/deprecations.js +++ b/test/configCases/rule-set/simple/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/, message: /oneOf\[0\]/ }, { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/, message: /oneOf\[1\]/ }, diff --git a/test/configCases/rule-set/simple/webpack.config.js b/test/configCases/rule-set/simple/webpack.config.js index 5515487f932..154e5325de2 100644 --- a/test/configCases/rule-set/simple/webpack.config.js +++ b/test/configCases/rule-set/simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/rule-set/undefined-values/webpack.config.js b/test/configCases/rule-set/undefined-values/webpack.config.js index 0b3933fba40..04c0e7854b1 100644 --- a/test/configCases/rule-set/undefined-values/webpack.config.js +++ b/test/configCases/rule-set/undefined-values/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/test.config.js b/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/test.config.js index 3f1ee62addd..99f8e1637f9 100644 --- a/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/test.config.js +++ b/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/webpack.config.js b/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/webpack.config.js index af731ef6aca..57e2eeb16f5 100644 --- a/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/webpack.config.js +++ b/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { @@ -14,7 +16,7 @@ module.exports = { }, optimization: { runtimeChunk: { - name: entrypoint => + name: (entrypoint) => `dir5/dir6/runtime~${entrypoint.name.split("/").pop()}` } } diff --git a/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/test.config.js b/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/test.config.js index 73daff2cf36..60f3ac7abbf 100644 --- a/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/test.config.js +++ b/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/webpack.config.js b/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/webpack.config.js index aef3552de43..95b14621d23 100644 --- a/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/webpack.config.js +++ b/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { @@ -15,7 +17,7 @@ module.exports = { }, optimization: { runtimeChunk: { - name: entrypoint => + name: (entrypoint) => `dir5/dir6/runtime~${entrypoint.name.split("/").pop()}` } }, diff --git a/test/configCases/runtime/dynamic-with-deep-entries-commonjs/test.config.js b/test/configCases/runtime/dynamic-with-deep-entries-commonjs/test.config.js index 41e056466f0..6a3519d439c 100644 --- a/test/configCases/runtime/dynamic-with-deep-entries-commonjs/test.config.js +++ b/test/configCases/runtime/dynamic-with-deep-entries-commonjs/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/runtime/dynamic-with-deep-entries-commonjs/webpack.config.js b/test/configCases/runtime/dynamic-with-deep-entries-commonjs/webpack.config.js index 4bdad1a91cd..415ab9ef70e 100644 --- a/test/configCases/runtime/dynamic-with-deep-entries-commonjs/webpack.config.js +++ b/test/configCases/runtime/dynamic-with-deep-entries-commonjs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { @@ -14,7 +16,7 @@ module.exports = { }, optimization: { runtimeChunk: { - name: entrypoint => `runtime/${entrypoint.name.replace(/^\/+/g, "")}` + name: (entrypoint) => `runtime/${entrypoint.name.replace(/^\/+/g, "")}` } } }; diff --git a/test/configCases/runtime/dynamic-with-deep-entries-esm/test.config.js b/test/configCases/runtime/dynamic-with-deep-entries-esm/test.config.js index 07fb94c9ba9..4e7d583c9cb 100644 --- a/test/configCases/runtime/dynamic-with-deep-entries-esm/test.config.js +++ b/test/configCases/runtime/dynamic-with-deep-entries-esm/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/runtime/dynamic-with-deep-entries-esm/webpack.config.js b/test/configCases/runtime/dynamic-with-deep-entries-esm/webpack.config.js index 2ffd63de8fc..4e6a39a8b41 100644 --- a/test/configCases/runtime/dynamic-with-deep-entries-esm/webpack.config.js +++ b/test/configCases/runtime/dynamic-with-deep-entries-esm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { @@ -15,7 +17,7 @@ module.exports = { }, optimization: { runtimeChunk: { - name: entrypoint => `runtime/${entrypoint.name.replace(/^\/+/g, "")}` + name: (entrypoint) => `runtime/${entrypoint.name.replace(/^\/+/g, "")}` } }, experiments: { diff --git a/test/configCases/runtime/entries-in-runtime/test.config.js b/test/configCases/runtime/entries-in-runtime/test.config.js index b63304387c7..b037c503597 100644 --- a/test/configCases/runtime/entries-in-runtime/test.config.js +++ b/test/configCases/runtime/entries-in-runtime/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime.js", "./main.js", "./first-entry.js"]; diff --git a/test/configCases/runtime/entries-in-runtime/webpack.config.js b/test/configCases/runtime/entries-in-runtime/webpack.config.js index a45319b6213..8e78c0e713e 100644 --- a/test/configCases/runtime/entries-in-runtime/webpack.config.js +++ b/test/configCases/runtime/entries-in-runtime/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/runtime/invalid-esm-export/webpack.config.js b/test/configCases/runtime/invalid-esm-export/webpack.config.js index 8152f6c7681..c19d15e8f12 100644 --- a/test/configCases/runtime/invalid-esm-export/webpack.config.js +++ b/test/configCases/runtime/invalid-esm-export/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development" diff --git a/test/configCases/runtime/no-runtime-per-entry/test.config.js b/test/configCases/runtime/no-runtime-per-entry/test.config.js index c0ec1472777..d9a38d25b63 100644 --- a/test/configCases/runtime/no-runtime-per-entry/test.config.js +++ b/test/configCases/runtime/no-runtime-per-entry/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return "./main.js"; diff --git a/test/configCases/runtime/no-runtime-per-entry/webpack.config.js b/test/configCases/runtime/no-runtime-per-entry/webpack.config.js index 1931aed0574..c0e60c4a397 100644 --- a/test/configCases/runtime/no-runtime-per-entry/webpack.config.js +++ b/test/configCases/runtime/no-runtime-per-entry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/runtime/opt-in-finally/webpack.config.js b/test/configCases/runtime/opt-in-finally/webpack.config.js index b98edea7fa5..ca77f588c2b 100644 --- a/test/configCases/runtime/opt-in-finally/webpack.config.js +++ b/test/configCases/runtime/opt-in-finally/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/runtime/opt-in-finally2/webpack.config.js b/test/configCases/runtime/opt-in-finally2/webpack.config.js index f8abbb88657..5a7310dea04 100644 --- a/test/configCases/runtime/opt-in-finally2/webpack.config.js +++ b/test/configCases/runtime/opt-in-finally2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/runtime/single-with-deep-entries-commonjs/test.config.js b/test/configCases/runtime/single-with-deep-entries-commonjs/test.config.js index eae17321170..e203772ca75 100644 --- a/test/configCases/runtime/single-with-deep-entries-commonjs/test.config.js +++ b/test/configCases/runtime/single-with-deep-entries-commonjs/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/runtime/single-with-deep-entries-commonjs/webpack.config.js b/test/configCases/runtime/single-with-deep-entries-commonjs/webpack.config.js index d2da242a9cd..200a0299e89 100644 --- a/test/configCases/runtime/single-with-deep-entries-commonjs/webpack.config.js +++ b/test/configCases/runtime/single-with-deep-entries-commonjs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/runtime/single-with-deep-entries-esm/test.config.js b/test/configCases/runtime/single-with-deep-entries-esm/test.config.js index ac00794d426..76b809e740d 100644 --- a/test/configCases/runtime/single-with-deep-entries-esm/test.config.js +++ b/test/configCases/runtime/single-with-deep-entries-esm/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/runtime/single-with-deep-entries-esm/webpack.config.js b/test/configCases/runtime/single-with-deep-entries-esm/webpack.config.js index acb96965dd2..e9b39ac50ca 100644 --- a/test/configCases/runtime/single-with-deep-entries-esm/webpack.config.js +++ b/test/configCases/runtime/single-with-deep-entries-esm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/runtime/target-webworker-with-dynamic/test.config.js b/test/configCases/runtime/target-webworker-with-dynamic/test.config.js index 8022cb75980..5760e2030f0 100644 --- a/test/configCases/runtime/target-webworker-with-dynamic/test.config.js +++ b/test/configCases/runtime/target-webworker-with-dynamic/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime.js", "./main.js"]; diff --git a/test/configCases/runtime/target-webworker-with-dynamic/webpack.config.js b/test/configCases/runtime/target-webworker-with-dynamic/webpack.config.js index 151c8bdb96d..0b3f260eae9 100644 --- a/test/configCases/runtime/target-webworker-with-dynamic/webpack.config.js +++ b/test/configCases/runtime/target-webworker-with-dynamic/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { target: "webworker", diff --git a/test/configCases/runtime/target-webworker/test.config.js b/test/configCases/runtime/target-webworker/test.config.js index 8022cb75980..5760e2030f0 100644 --- a/test/configCases/runtime/target-webworker/test.config.js +++ b/test/configCases/runtime/target-webworker/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime.js", "./main.js"]; diff --git a/test/configCases/runtime/target-webworker/webpack.config.js b/test/configCases/runtime/target-webworker/webpack.config.js index 151c8bdb96d..0b3f260eae9 100644 --- a/test/configCases/runtime/target-webworker/webpack.config.js +++ b/test/configCases/runtime/target-webworker/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { target: "webworker", diff --git a/test/configCases/scope-hoisting/class-naming/webpack.config.js b/test/configCases/scope-hoisting/class-naming/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/configCases/scope-hoisting/class-naming/webpack.config.js +++ b/test/configCases/scope-hoisting/class-naming/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/scope-hoisting/create-dll-plugin/test.config.js b/test/configCases/scope-hoisting/create-dll-plugin/test.config.js index 04581a81040..67028ae7c8c 100644 --- a/test/configCases/scope-hoisting/create-dll-plugin/test.config.js +++ b/test/configCases/scope-hoisting/create-dll-plugin/test.config.js @@ -1 +1,3 @@ +"use strict"; + module.exports.noTests = true; diff --git a/test/configCases/scope-hoisting/create-dll-plugin/webpack.config.js b/test/configCases/scope-hoisting/create-dll-plugin/webpack.config.js index bdff16d8622..6f9cdcfc0ab 100644 --- a/test/configCases/scope-hoisting/create-dll-plugin/webpack.config.js +++ b/test/configCases/scope-hoisting/create-dll-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/scope-hoisting/dll-plugin/webpack.config.js b/test/configCases/scope-hoisting/dll-plugin/webpack.config.js index 29af2f143b3..7a6adaad6f6 100644 --- a/test/configCases/scope-hoisting/dll-plugin/webpack.config.js +++ b/test/configCases/scope-hoisting/dll-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/scope-hoisting/esModule/webpack.config.js b/test/configCases/scope-hoisting/esModule/webpack.config.js index 363b516cae6..c7e33f096d8 100644 --- a/test/configCases/scope-hoisting/esModule/webpack.config.js +++ b/test/configCases/scope-hoisting/esModule/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/scope-hoisting/export-global/webpack.config.js b/test/configCases/scope-hoisting/export-global/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/configCases/scope-hoisting/export-global/webpack.config.js +++ b/test/configCases/scope-hoisting/export-global/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/scope-hoisting/harmony-pure-default/webpack.config.js b/test/configCases/scope-hoisting/harmony-pure-default/webpack.config.js index 7d36a68c1cd..5f8adbc6af9 100644 --- a/test/configCases/scope-hoisting/harmony-pure-default/webpack.config.js +++ b/test/configCases/scope-hoisting/harmony-pure-default/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/scope-hoisting/issue-11897/webpack.config.js b/test/configCases/scope-hoisting/issue-11897/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/configCases/scope-hoisting/issue-11897/webpack.config.js +++ b/test/configCases/scope-hoisting/issue-11897/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/scope-hoisting/named-modules/webpack.config.js b/test/configCases/scope-hoisting/named-modules/webpack.config.js index 4a7373bf986..0d76e646262 100644 --- a/test/configCases/scope-hoisting/named-modules/webpack.config.js +++ b/test/configCases/scope-hoisting/named-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/scope-hoisting/strictThisContextOnImports/webpack.config.js b/test/configCases/scope-hoisting/strictThisContextOnImports/webpack.config.js index 90dc09a7d31..7a3a1f8b0a2 100644 --- a/test/configCases/scope-hoisting/strictThisContextOnImports/webpack.config.js +++ b/test/configCases/scope-hoisting/strictThisContextOnImports/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/consume-module-ignore-warnings/errors.js b/test/configCases/sharing/consume-module-ignore-warnings/errors.js index 722d5d0a45f..cc8949a9c72 100644 --- a/test/configCases/sharing/consume-module-ignore-warnings/errors.js +++ b/test/configCases/sharing/consume-module-ignore-warnings/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/prefix\/deep\/c/]]; diff --git a/test/configCases/sharing/consume-module-ignore-warnings/webpack.config.js b/test/configCases/sharing/consume-module-ignore-warnings/webpack.config.js index d148e12b7ec..17d84ffa637 100644 --- a/test/configCases/sharing/consume-module-ignore-warnings/webpack.config.js +++ b/test/configCases/sharing/consume-module-ignore-warnings/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ConsumeSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/consume-module/errors.js b/test/configCases/sharing/consume-module/errors.js index 722d5d0a45f..cc8949a9c72 100644 --- a/test/configCases/sharing/consume-module/errors.js +++ b/test/configCases/sharing/consume-module/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/prefix\/deep\/c/]]; diff --git a/test/configCases/sharing/consume-module/webpack.config.js b/test/configCases/sharing/consume-module/webpack.config.js index 37a3c42901c..5d2a1a1822b 100644 --- a/test/configCases/sharing/consume-module/webpack.config.js +++ b/test/configCases/sharing/consume-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ConsumeSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/consume-multiple-versions-ignore-warnings/webpack.config.js b/test/configCases/sharing/consume-multiple-versions-ignore-warnings/webpack.config.js index 59376be223b..22b7a95ae58 100644 --- a/test/configCases/sharing/consume-multiple-versions-ignore-warnings/webpack.config.js +++ b/test/configCases/sharing/consume-multiple-versions-ignore-warnings/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ConsumeSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/consume-multiple-versions/webpack.config.js b/test/configCases/sharing/consume-multiple-versions/webpack.config.js index 2ca3aaa9d5e..350ef1bee5d 100644 --- a/test/configCases/sharing/consume-multiple-versions/webpack.config.js +++ b/test/configCases/sharing/consume-multiple-versions/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ConsumeSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/consume-self-reference/webpack.config.js b/test/configCases/sharing/consume-self-reference/webpack.config.js index a6ece7dd9fb..1cafc901d09 100644 --- a/test/configCases/sharing/consume-self-reference/webpack.config.js +++ b/test/configCases/sharing/consume-self-reference/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { SharePlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/no-override-loaded/webpack.config.js b/test/configCases/sharing/no-override-loaded/webpack.config.js index c626d7a5bec..5e079c2aa1d 100644 --- a/test/configCases/sharing/no-override-loaded/webpack.config.js +++ b/test/configCases/sharing/no-override-loaded/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { SharePlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/provide-eager-module/webpack.config.js b/test/configCases/sharing/provide-eager-module/webpack.config.js index e8e02441d98..ba90a4e0fce 100644 --- a/test/configCases/sharing/provide-eager-module/webpack.config.js +++ b/test/configCases/sharing/provide-eager-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ProvideSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../types").Configuration} */ diff --git a/test/configCases/sharing/provide-module/webpack.config.js b/test/configCases/sharing/provide-module/webpack.config.js index 14383b0b771..3e0e88cd1d7 100644 --- a/test/configCases/sharing/provide-module/webpack.config.js +++ b/test/configCases/sharing/provide-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ProvideSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/provide-multiple-versions/webpack.config.js b/test/configCases/sharing/provide-multiple-versions/webpack.config.js index 59fcca431d1..55b7c765bc4 100644 --- a/test/configCases/sharing/provide-multiple-versions/webpack.config.js +++ b/test/configCases/sharing/provide-multiple-versions/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ProvideSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/provide-shared-with-runtime-chunk/test.config.js b/test/configCases/sharing/provide-shared-with-runtime-chunk/test.config.js index 8022cb75980..5760e2030f0 100644 --- a/test/configCases/sharing/provide-shared-with-runtime-chunk/test.config.js +++ b/test/configCases/sharing/provide-shared-with-runtime-chunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime.js", "./main.js"]; diff --git a/test/configCases/sharing/provide-shared-with-runtime-chunk/webpack.config.js b/test/configCases/sharing/provide-shared-with-runtime-chunk/webpack.config.js index 3bd7b407fec..ef2803d9777 100644 --- a/test/configCases/sharing/provide-shared-with-runtime-chunk/webpack.config.js +++ b/test/configCases/sharing/provide-shared-with-runtime-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ProvideSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/share-multiple-versions/webpack.config.js b/test/configCases/sharing/share-multiple-versions/webpack.config.js index a138c884c31..268d3dc5dd8 100644 --- a/test/configCases/sharing/share-multiple-versions/webpack.config.js +++ b/test/configCases/sharing/share-multiple-versions/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { SharePlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/share-plugin-dual-mode/webpack.config.js b/test/configCases/sharing/share-plugin-dual-mode/webpack.config.js index 58de7a92b51..870c026fd05 100644 --- a/test/configCases/sharing/share-plugin-dual-mode/webpack.config.js +++ b/test/configCases/sharing/share-plugin-dual-mode/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const { SharePlugin } = require("../../../../").sharing; diff --git a/test/configCases/sharing/share-plugin-monorepo/webpack.config.js b/test/configCases/sharing/share-plugin-monorepo/webpack.config.js index 102015e980f..a1ba7c3f6bd 100644 --- a/test/configCases/sharing/share-plugin-monorepo/webpack.config.js +++ b/test/configCases/sharing/share-plugin-monorepo/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const { SharePlugin } = require("../../../../").sharing; diff --git a/test/configCases/sharing/share-plugin/webpack.config.js b/test/configCases/sharing/share-plugin/webpack.config.js index 89ca53ad7ab..6ce09bc2c9a 100644 --- a/test/configCases/sharing/share-plugin/webpack.config.js +++ b/test/configCases/sharing/share-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { SharePlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/side-effects/issue-13063/test.config.js b/test/configCases/side-effects/issue-13063/test.config.js index 6f97c7a60c3..53b31d9931e 100644 --- a/test/configCases/side-effects/issue-13063/test.config.js +++ b/test/configCases/side-effects/issue-13063/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./vendors.js", "./tst_examples_uiform.js"]; diff --git a/test/configCases/side-effects/issue-13063/webpack.config.js b/test/configCases/side-effects/issue-13063/webpack.config.js index e0ae0496602..ef172b3c116 100644 --- a/test/configCases/side-effects/issue-13063/webpack.config.js +++ b/test/configCases/side-effects/issue-13063/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { entry: { tst_examples_uiform: "./tst_examples_uiform", diff --git a/test/configCases/side-effects/side-effects-override/webpack.config.js b/test/configCases/side-effects/side-effects-override/webpack.config.js index 1f868402b50..0b6d4994f13 100644 --- a/test/configCases/side-effects/side-effects-override/webpack.config.js +++ b/test/configCases/side-effects/side-effects-override/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/side-effects/side-effects-unsorted-modules/webpack.config.js b/test/configCases/side-effects/side-effects-unsorted-modules/webpack.config.js index 00ea93201bb..776754b1490 100644 --- a/test/configCases/side-effects/side-effects-unsorted-modules/webpack.config.js +++ b/test/configCases/side-effects/side-effects-unsorted-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compiler} Compiler */ /** @typedef {import("../../../../").NormalModule} NormalModule */ @@ -6,7 +8,7 @@ class ReorderModulesPlugin { * @param {Compiler} compiler compiler */ apply(compiler) { - compiler.hooks.compilation.tap("ReorderModulesPlugin", compilation => { + compiler.hooks.compilation.tap("ReorderModulesPlugin", (compilation) => { compilation.hooks.seal.tap("ReorderModulesPlugin", () => { const sortedModules = [...compilation.modules].sort((a, _b) => /** @type {NormalModule} */ diff --git a/test/configCases/side-effects/side-effects-values/webpack.config.js b/test/configCases/side-effects/side-effects-values/webpack.config.js index 5e498c66907..5c6c362a57a 100644 --- a/test/configCases/side-effects/side-effects-values/webpack.config.js +++ b/test/configCases/side-effects/side-effects-values/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/side-effects/type-reexports/webpack.config.js b/test/configCases/side-effects/type-reexports/webpack.config.js index 8769da51a0d..cc7eb9d8225 100644 --- a/test/configCases/side-effects/type-reexports/webpack.config.js +++ b/test/configCases/side-effects/type-reexports/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { output: { diff --git a/test/configCases/side-effects/url/webpack.config.js b/test/configCases/side-effects/url/webpack.config.js index 492d1b5903c..db05329b698 100644 --- a/test/configCases/side-effects/url/webpack.config.js +++ b/test/configCases/side-effects/url/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/simple/empty-config/webpack.config.js b/test/configCases/simple/empty-config/webpack.config.js index 3583b70a321..27313115dcd 100644 --- a/test/configCases/simple/empty-config/webpack.config.js +++ b/test/configCases/simple/empty-config/webpack.config.js @@ -1,2 +1,4 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = {}; diff --git a/test/configCases/simple/multi-compiler-functions-export/webpack.config.js b/test/configCases/simple/multi-compiler-functions-export/webpack.config.js index 3c9411db856..f151215eacc 100644 --- a/test/configCases/simple/multi-compiler-functions-export/webpack.config.js +++ b/test/configCases/simple/multi-compiler-functions-export/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports.default = [ function empty() { return {}; diff --git a/test/configCases/simple/multi-compiler-functions/webpack.config.js b/test/configCases/simple/multi-compiler-functions/webpack.config.js index 4885a78df2c..d64d68acbf8 100644 --- a/test/configCases/simple/multi-compiler-functions/webpack.config.js +++ b/test/configCases/simple/multi-compiler-functions/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ function empty() { diff --git a/test/configCases/simple/multi-compiler/webpack.config.js b/test/configCases/simple/multi-compiler/webpack.config.js index a309ecd2e6e..26c4bc00336 100644 --- a/test/configCases/simple/multi-compiler/webpack.config.js +++ b/test/configCases/simple/multi-compiler/webpack.config.js @@ -1,2 +1,4 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [{}]; diff --git a/test/configCases/source-map/array-as-output-library-in-object-output/webpack.config.js b/test/configCases/source-map/array-as-output-library-in-object-output/webpack.config.js index 5adb84b3236..1b42b506857 100644 --- a/test/configCases/source-map/array-as-output-library-in-object-output/webpack.config.js +++ b/test/configCases/source-map/array-as-output-library-in-object-output/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: "source-map", diff --git a/test/configCases/source-map/array-as-output-library/webpack.config.js b/test/configCases/source-map/array-as-output-library/webpack.config.js index 81087b112d1..0833b4782c7 100644 --- a/test/configCases/source-map/array-as-output-library/webpack.config.js +++ b/test/configCases/source-map/array-as-output-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: "source-map", diff --git a/test/configCases/source-map/context-module-source-path/webpack.config.js b/test/configCases/source-map/context-module-source-path/webpack.config.js index 9f32ea2927b..0399c23c3c8 100644 --- a/test/configCases/source-map/context-module-source-path/webpack.config.js +++ b/test/configCases/source-map/context-module-source-path/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { node: { __dirname: false, diff --git a/test/configCases/source-map/default-filename-extensions-css/webpack.config.js b/test/configCases/source-map/default-filename-extensions-css/webpack.config.js index 29cefe96ef0..4aab368d6f0 100644 --- a/test/configCases/source-map/default-filename-extensions-css/webpack.config.js +++ b/test/configCases/source-map/default-filename-extensions-css/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MiniCssExtractPlugin = require("mini-css-extract-plugin"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/source-map/default-filename-extensions-js/webpack.config.js b/test/configCases/source-map/default-filename-extensions-js/webpack.config.js index 63d1ba55ad0..909f207d7c5 100644 --- a/test/configCases/source-map/default-filename-extensions-js/webpack.config.js +++ b/test/configCases/source-map/default-filename-extensions-js/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/source-map/default-filename-extensions-mjs/webpack.config.js b/test/configCases/source-map/default-filename-extensions-mjs/webpack.config.js index a4ea707130a..6a493687fda 100644 --- a/test/configCases/source-map/default-filename-extensions-mjs/webpack.config.js +++ b/test/configCases/source-map/default-filename-extensions-mjs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/source-map/devtool-namespace-with-eval-source-map/test.config.js b/test/configCases/source-map/devtool-namespace-with-eval-source-map/test.config.js index be2150cc603..b42f991e21a 100644 --- a/test/configCases/source-map/devtool-namespace-with-eval-source-map/test.config.js +++ b/test/configCases/source-map/devtool-namespace-with-eval-source-map/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["entry-a-bundle.js", "entry-b-bundle.js"]; diff --git a/test/configCases/source-map/devtool-namespace-with-eval-source-map/webpack.config.js b/test/configCases/source-map/devtool-namespace-with-eval-source-map/webpack.config.js index 0b114a6251f..ba9d693d8d9 100644 --- a/test/configCases/source-map/devtool-namespace-with-eval-source-map/webpack.config.js +++ b/test/configCases/source-map/devtool-namespace-with-eval-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/source-map/devtool-namespace-with-eval/test.config.js b/test/configCases/source-map/devtool-namespace-with-eval/test.config.js index be2150cc603..b42f991e21a 100644 --- a/test/configCases/source-map/devtool-namespace-with-eval/test.config.js +++ b/test/configCases/source-map/devtool-namespace-with-eval/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["entry-a-bundle.js", "entry-b-bundle.js"]; diff --git a/test/configCases/source-map/devtool-namespace-with-eval/webpack.config.js b/test/configCases/source-map/devtool-namespace-with-eval/webpack.config.js index 3f7c69737eb..8c7b8e2537d 100644 --- a/test/configCases/source-map/devtool-namespace-with-eval/webpack.config.js +++ b/test/configCases/source-map/devtool-namespace-with-eval/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/source-map/devtool-namespace-with-source-map/test.config.js b/test/configCases/source-map/devtool-namespace-with-source-map/test.config.js index be2150cc603..b42f991e21a 100644 --- a/test/configCases/source-map/devtool-namespace-with-source-map/test.config.js +++ b/test/configCases/source-map/devtool-namespace-with-source-map/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["entry-a-bundle.js", "entry-b-bundle.js"]; diff --git a/test/configCases/source-map/devtool-namespace-with-source-map/webpack.config.js b/test/configCases/source-map/devtool-namespace-with-source-map/webpack.config.js index c237cc22379..1502a4043b8 100644 --- a/test/configCases/source-map/devtool-namespace-with-source-map/webpack.config.js +++ b/test/configCases/source-map/devtool-namespace-with-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/source-map/eval-nosources-source-map/test.filter.js b/test/configCases/source-map/eval-nosources-source-map/test.filter.js index 9486c09cf37..53cf6da0c34 100644 --- a/test/configCases/source-map/eval-nosources-source-map/test.filter.js +++ b/test/configCases/source-map/eval-nosources-source-map/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); module.exports = () => supportsOptionalChaining(); diff --git a/test/configCases/source-map/eval-nosources-source-map/webpack.config.js b/test/configCases/source-map/eval-nosources-source-map/webpack.config.js index 3319debc4f8..c4e951f3538 100644 --- a/test/configCases/source-map/eval-nosources-source-map/webpack.config.js +++ b/test/configCases/source-map/eval-nosources-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const devtool = "eval-nosources-source-map"; /** @type {import("../../../../").Configuration[]} */ diff --git a/test/configCases/source-map/eval-source-map-debugids/webpack.config.js b/test/configCases/source-map/eval-source-map-debugids/webpack.config.js index 46e027864f2..5b1287d986b 100644 --- a/test/configCases/source-map/eval-source-map-debugids/webpack.config.js +++ b/test/configCases/source-map/eval-source-map-debugids/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: "eval-source-map-debugids" diff --git a/test/configCases/source-map/eval-source-map/test.filter.js b/test/configCases/source-map/eval-source-map/test.filter.js index 9486c09cf37..53cf6da0c34 100644 --- a/test/configCases/source-map/eval-source-map/test.filter.js +++ b/test/configCases/source-map/eval-source-map/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); module.exports = () => supportsOptionalChaining(); diff --git a/test/configCases/source-map/eval-source-map/webpack.config.js b/test/configCases/source-map/eval-source-map/webpack.config.js index 44225d67bb2..5264abd0b31 100644 --- a/test/configCases/source-map/eval-source-map/webpack.config.js +++ b/test/configCases/source-map/eval-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const devtool = "eval-source-map"; /** @type {import("../../../../").Configuration[]} */ diff --git a/test/configCases/source-map/exclude-chunks-source-map/webpack.config.js b/test/configCases/source-map/exclude-chunks-source-map/webpack.config.js index ac7fa12769c..e97e1eef438 100644 --- a/test/configCases/source-map/exclude-chunks-source-map/webpack.config.js +++ b/test/configCases/source-map/exclude-chunks-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/source-map/exclude-modules-source-map/webpack.config.js b/test/configCases/source-map/exclude-modules-source-map/webpack.config.js index 0dfd27f9f49..12336684f8b 100644 --- a/test/configCases/source-map/exclude-modules-source-map/webpack.config.js +++ b/test/configCases/source-map/exclude-modules-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/source-map/harmony-eval-source-map/webpack.config.js b/test/configCases/source-map/harmony-eval-source-map/webpack.config.js index 568d999d5b6..983a751baa3 100644 --- a/test/configCases/source-map/harmony-eval-source-map/webpack.config.js +++ b/test/configCases/source-map/harmony-eval-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: "eval-source-map" diff --git a/test/configCases/source-map/harmony-eval/webpack.config.js b/test/configCases/source-map/harmony-eval/webpack.config.js index 4b28913b108..e6f605078a8 100644 --- a/test/configCases/source-map/harmony-eval/webpack.config.js +++ b/test/configCases/source-map/harmony-eval/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: "eval" diff --git a/test/configCases/source-map/loader-source-map-string/webpack.config.js b/test/configCases/source-map/loader-source-map-string/webpack.config.js index 83788c09a14..442503a7bc7 100644 --- a/test/configCases/source-map/loader-source-map-string/webpack.config.js +++ b/test/configCases/source-map/loader-source-map-string/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import('webpack').Configuration} */ const config = { devtool: "source-map", diff --git a/test/configCases/source-map/loader-source-map/webpack.config.js b/test/configCases/source-map/loader-source-map/webpack.config.js index 83788c09a14..442503a7bc7 100644 --- a/test/configCases/source-map/loader-source-map/webpack.config.js +++ b/test/configCases/source-map/loader-source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import('webpack').Configuration} */ const config = { devtool: "source-map", diff --git a/test/configCases/source-map/module-names/webpack.config.js b/test/configCases/source-map/module-names/webpack.config.js index 249cf04c40a..d3036e685d5 100644 --- a/test/configCases/source-map/module-names/webpack.config.js +++ b/test/configCases/source-map/module-names/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/source-map/namespace-source-path-no-truncate/webpack.config.js b/test/configCases/source-map/namespace-source-path-no-truncate/webpack.config.js index e741f449ed6..a940ced3ce7 100644 --- a/test/configCases/source-map/namespace-source-path-no-truncate/webpack.config.js +++ b/test/configCases/source-map/namespace-source-path-no-truncate/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { node: { diff --git a/test/configCases/source-map/namespace-source-path.library/webpack.config.js b/test/configCases/source-map/namespace-source-path.library/webpack.config.js index 71e95006fc0..2527951c4f8 100644 --- a/test/configCases/source-map/namespace-source-path.library/webpack.config.js +++ b/test/configCases/source-map/namespace-source-path.library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/source-map/namespace-source-path/webpack.config.js b/test/configCases/source-map/namespace-source-path/webpack.config.js index 12407607a5f..6897cf63fbe 100644 --- a/test/configCases/source-map/namespace-source-path/webpack.config.js +++ b/test/configCases/source-map/namespace-source-path/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/source-map/no-source-map/webpack.config.js b/test/configCases/source-map/no-source-map/webpack.config.js index 92592515cff..67bfd694a2e 100644 --- a/test/configCases/source-map/no-source-map/webpack.config.js +++ b/test/configCases/source-map/no-source-map/webpack.config.js @@ -1,9 +1,11 @@ +"use strict"; + /** @typedef {import("../../../../").WebpackPluginFunction} WebpackPluginFunction */ /** @type {WebpackPluginFunction[]} */ const plugins = [ - compiler => { - compiler.hooks.emit.tap("Test", compilation => { + (compiler) => { + compiler.hooks.emit.tap("Test", (compilation) => { for (const asset of compilation.getAssets()) { const result = asset.source.sourceAndMap(); try { diff --git a/test/configCases/source-map/nosources/webpack.config.js b/test/configCases/source-map/nosources/webpack.config.js index 3cf6572108f..259d880c1c4 100644 --- a/test/configCases/source-map/nosources/webpack.config.js +++ b/test/configCases/source-map/nosources/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/source-map/object-as-output-library/webpack.config.js b/test/configCases/source-map/object-as-output-library/webpack.config.js index 5da44457e10..b9e4633e4ba 100644 --- a/test/configCases/source-map/object-as-output-library/webpack.config.js +++ b/test/configCases/source-map/object-as-output-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: "source-map", diff --git a/test/configCases/source-map/relative-source-map-path/webpack.config.js b/test/configCases/source-map/relative-source-map-path/webpack.config.js index ccfc9bff6f0..52788d981c0 100644 --- a/test/configCases/source-map/relative-source-map-path/webpack.config.js +++ b/test/configCases/source-map/relative-source-map-path/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/source-map/relative-source-maps-by-loader/webpack.config.js b/test/configCases/source-map/relative-source-maps-by-loader/webpack.config.js index c0a285cd11b..f85b8736b56 100644 --- a/test/configCases/source-map/relative-source-maps-by-loader/webpack.config.js +++ b/test/configCases/source-map/relative-source-maps-by-loader/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/source-map/resource-path/webpack.config.js b/test/configCases/source-map/resource-path/webpack.config.js index e68ec19f72e..b63a89569c5 100644 --- a/test/configCases/source-map/resource-path/webpack.config.js +++ b/test/configCases/source-map/resource-path/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { node: { diff --git a/test/configCases/source-map/source-map-debugids/webpack.config.js b/test/configCases/source-map/source-map-debugids/webpack.config.js index 467ccfd15ea..58c876953a8 100644 --- a/test/configCases/source-map/source-map-debugids/webpack.config.js +++ b/test/configCases/source-map/source-map-debugids/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { devtool: "source-map-debugids" diff --git a/test/configCases/source-map/source-map-filename-contenthash/webpack.config.js b/test/configCases/source-map/source-map-filename-contenthash/webpack.config.js index 09dd74b31a4..f5933fcd189 100644 --- a/test/configCases/source-map/source-map-filename-contenthash/webpack.config.js +++ b/test/configCases/source-map/source-map-filename-contenthash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/source-map/source-map-with-profiling-plugin/deprecations.js b/test/configCases/source-map/source-map-with-profiling-plugin/deprecations.js index dee16addc3f..368f9474dce 100644 --- a/test/configCases/source-map/source-map-with-profiling-plugin/deprecations.js +++ b/test/configCases/source-map/source-map-with-profiling-plugin/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK/ } ]; diff --git a/test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js b/test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js index 1338bc1e7b5..f1925767d11 100644 --- a/test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js +++ b/test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js @@ -1 +1,3 @@ +"use strict"; + module.exports = () => !process.env.CI; diff --git a/test/configCases/source-map/source-map-with-profiling-plugin/webpack.config.js b/test/configCases/source-map/source-map-with-profiling-plugin/webpack.config.js index 0f0696754d5..a822ffdc02d 100644 --- a/test/configCases/source-map/source-map-with-profiling-plugin/webpack.config.js +++ b/test/configCases/source-map/source-map-with-profiling-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const os = require("os"); const path = require("path"); const webpack = require("../../../../"); diff --git a/test/configCases/source-map/sources-array-production/webpack.config.js b/test/configCases/source-map/sources-array-production/webpack.config.js index e741f449ed6..a940ced3ce7 100644 --- a/test/configCases/source-map/sources-array-production/webpack.config.js +++ b/test/configCases/source-map/sources-array-production/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { node: { diff --git a/test/configCases/split-chunks-common/correct-order/test.config.js b/test/configCases/split-chunks-common/correct-order/test.config.js index ac3afebfca3..79b9186a336 100644 --- a/test/configCases/split-chunks-common/correct-order/test.config.js +++ b/test/configCases/split-chunks-common/correct-order/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./vendor.js", "./main.js"]; diff --git a/test/configCases/split-chunks-common/correct-order/webpack.config.js b/test/configCases/split-chunks-common/correct-order/webpack.config.js index 65bafc0f652..d9ad06ecc2b 100644 --- a/test/configCases/split-chunks-common/correct-order/webpack.config.js +++ b/test/configCases/split-chunks-common/correct-order/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks-common/extract-async-from-entry/test.config.js b/test/configCases/split-chunks-common/extract-async-from-entry/test.config.js index 0e721ca1433..2059a3f8977 100644 --- a/test/configCases/split-chunks-common/extract-async-from-entry/test.config.js +++ b/test/configCases/split-chunks-common/extract-async-from-entry/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./main.js"]; diff --git a/test/configCases/split-chunks-common/extract-async-from-entry/webpack.config.js b/test/configCases/split-chunks-common/extract-async-from-entry/webpack.config.js index 715e35bdb31..62ee5b143f8 100644 --- a/test/configCases/split-chunks-common/extract-async-from-entry/webpack.config.js +++ b/test/configCases/split-chunks-common/extract-async-from-entry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks-common/hot-multi/test.config.js b/test/configCases/split-chunks-common/hot-multi/test.config.js index 64952711508..ecc81364003 100644 --- a/test/configCases/split-chunks-common/hot-multi/test.config.js +++ b/test/configCases/split-chunks-common/hot-multi/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./vendor.js", "./first.js", "./second.js"]; diff --git a/test/configCases/split-chunks-common/hot-multi/webpack.config.js b/test/configCases/split-chunks-common/hot-multi/webpack.config.js index ac4cfdb6903..925e08b3991 100644 --- a/test/configCases/split-chunks-common/hot-multi/webpack.config.js +++ b/test/configCases/split-chunks-common/hot-multi/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const HotModuleReplacementPlugin = require("../../../../").HotModuleReplacementPlugin; diff --git a/test/configCases/split-chunks-common/hot/test.config.js b/test/configCases/split-chunks-common/hot/test.config.js index ac3afebfca3..79b9186a336 100644 --- a/test/configCases/split-chunks-common/hot/test.config.js +++ b/test/configCases/split-chunks-common/hot/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./vendor.js", "./main.js"]; diff --git a/test/configCases/split-chunks-common/hot/webpack.config.js b/test/configCases/split-chunks-common/hot/webpack.config.js index 6f9b5cc31c1..6b8b5e67f7a 100644 --- a/test/configCases/split-chunks-common/hot/webpack.config.js +++ b/test/configCases/split-chunks-common/hot/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const HotModuleReplacementPlugin = require("../../../../").HotModuleReplacementPlugin; diff --git a/test/configCases/split-chunks-common/inverted-order/test.config.js b/test/configCases/split-chunks-common/inverted-order/test.config.js index eed5873a9bf..5167300e802 100644 --- a/test/configCases/split-chunks-common/inverted-order/test.config.js +++ b/test/configCases/split-chunks-common/inverted-order/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./main.js", "./vendor.js"]; diff --git a/test/configCases/split-chunks-common/inverted-order/webpack.config.js b/test/configCases/split-chunks-common/inverted-order/webpack.config.js index 65bafc0f652..d9ad06ecc2b 100644 --- a/test/configCases/split-chunks-common/inverted-order/webpack.config.js +++ b/test/configCases/split-chunks-common/inverted-order/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks-common/issue-12128/test.config.js b/test/configCases/split-chunks-common/issue-12128/test.config.js index 69f19523ba2..21126d055c2 100644 --- a/test/configCases/split-chunks-common/issue-12128/test.config.js +++ b/test/configCases/split-chunks-common/issue-12128/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./common.js", "./main.js", "./main2.js"]; diff --git a/test/configCases/split-chunks-common/issue-12128/webpack.config.js b/test/configCases/split-chunks-common/issue-12128/webpack.config.js index ac66bb5a981..c9eacbef555 100644 --- a/test/configCases/split-chunks-common/issue-12128/webpack.config.js +++ b/test/configCases/split-chunks-common/issue-12128/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks-common/library/test.config.js b/test/configCases/split-chunks-common/library/test.config.js index 06e8b92c02a..f00b18bc3c2 100644 --- a/test/configCases/split-chunks-common/library/test.config.js +++ b/test/configCases/split-chunks-common/library/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./vendor.js", "./main.js"]; diff --git a/test/configCases/split-chunks-common/library/webpack.config.js b/test/configCases/split-chunks-common/library/webpack.config.js index 74eda62c39d..db296603ddc 100644 --- a/test/configCases/split-chunks-common/library/webpack.config.js +++ b/test/configCases/split-chunks-common/library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks-common/move-entry/test.config.js b/test/configCases/split-chunks-common/move-entry/test.config.js index 40bcfbb6380..7972f85ec67 100644 --- a/test/configCases/split-chunks-common/move-entry/test.config.js +++ b/test/configCases/split-chunks-common/move-entry/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./commons.js", "./main.js"]; diff --git a/test/configCases/split-chunks-common/move-entry/webpack.config.js b/test/configCases/split-chunks-common/move-entry/webpack.config.js index 36226f7227b..1d3b0ab9b64 100644 --- a/test/configCases/split-chunks-common/move-entry/webpack.config.js +++ b/test/configCases/split-chunks-common/move-entry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks-common/move-to-grandparent/test.config.js b/test/configCases/split-chunks-common/move-to-grandparent/test.config.js index 20f79312e29..5ebaeb7ab72 100644 --- a/test/configCases/split-chunks-common/move-to-grandparent/test.config.js +++ b/test/configCases/split-chunks-common/move-to-grandparent/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./main.js", "./misc.js"]; diff --git a/test/configCases/split-chunks-common/move-to-grandparent/webpack.config.js b/test/configCases/split-chunks-common/move-to-grandparent/webpack.config.js index 183a1227e42..43a28d161e5 100644 --- a/test/configCases/split-chunks-common/move-to-grandparent/webpack.config.js +++ b/test/configCases/split-chunks-common/move-to-grandparent/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks-common/simple/test.config.js b/test/configCases/split-chunks-common/simple/test.config.js index ac3afebfca3..79b9186a336 100644 --- a/test/configCases/split-chunks-common/simple/test.config.js +++ b/test/configCases/split-chunks-common/simple/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./vendor.js", "./main.js"]; diff --git a/test/configCases/split-chunks-common/simple/webpack.config.js b/test/configCases/split-chunks-common/simple/webpack.config.js index 65bafc0f652..d9ad06ecc2b 100644 --- a/test/configCases/split-chunks-common/simple/webpack.config.js +++ b/test/configCases/split-chunks-common/simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks-common/target-node/test.config.js b/test/configCases/split-chunks-common/target-node/test.config.js index 9b06a7f2cc0..ce202b2d4df 100644 --- a/test/configCases/split-chunks-common/target-node/test.config.js +++ b/test/configCases/split-chunks-common/target-node/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i, options) { return [`./${options.name}-main.js`]; diff --git a/test/configCases/split-chunks-common/target-node/webpack.config.js b/test/configCases/split-chunks-common/target-node/webpack.config.js index 33b27c09e06..eb0584ded2c 100644 --- a/test/configCases/split-chunks-common/target-node/webpack.config.js +++ b/test/configCases/split-chunks-common/target-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { @@ -33,7 +35,7 @@ module.exports = [ defaultVendors: false, vendors: { test: /node_modules/, - name: m => { + name: (m) => { const match = /** @type {string} */ (m.nameForCondition()).match(/([b-d]+)\.js$/); diff --git a/test/configCases/split-chunks/asnyc-entries/test.config.js b/test/configCases/split-chunks/asnyc-entries/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/split-chunks/asnyc-entries/test.config.js +++ b/test/configCases/split-chunks/asnyc-entries/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/split-chunks/asnyc-entries/test.filter.js b/test/configCases/split-chunks/asnyc-entries/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/split-chunks/asnyc-entries/test.filter.js +++ b/test/configCases/split-chunks/asnyc-entries/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/split-chunks/asnyc-entries/webpack.config.js b/test/configCases/split-chunks/asnyc-entries/webpack.config.js index aaf5279b801..d45fc7ec296 100644 --- a/test/configCases/split-chunks/asnyc-entries/webpack.config.js +++ b/test/configCases/split-chunks/asnyc-entries/webpack.config.js @@ -1,5 +1,10 @@ +"use strict"; + module.exports = { output: { - filename: "[name].js" + filename: "[name].js", + environment: { + nodePrefixForCoreModules: false + } } }; diff --git a/test/configCases/split-chunks/chunk-filename-delimiter-default/test.config.js b/test/configCases/split-chunks/chunk-filename-delimiter-default/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/split-chunks/chunk-filename-delimiter-default/test.config.js +++ b/test/configCases/split-chunks/chunk-filename-delimiter-default/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/split-chunks/chunk-filename-delimiter-default/webpack.config.js b/test/configCases/split-chunks/chunk-filename-delimiter-default/webpack.config.js index 5dbdb640985..356fd782f79 100644 --- a/test/configCases/split-chunks/chunk-filename-delimiter-default/webpack.config.js +++ b/test/configCases/split-chunks/chunk-filename-delimiter-default/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/split-chunks/chunk-filename-delimiter/test.config.js b/test/configCases/split-chunks/chunk-filename-delimiter/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/split-chunks/chunk-filename-delimiter/test.config.js +++ b/test/configCases/split-chunks/chunk-filename-delimiter/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/split-chunks/chunk-filename-delimiter/webpack.config.js b/test/configCases/split-chunks/chunk-filename-delimiter/webpack.config.js index e28f3cb635d..d346ec8035b 100644 --- a/test/configCases/split-chunks/chunk-filename-delimiter/webpack.config.js +++ b/test/configCases/split-chunks/chunk-filename-delimiter/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/split-chunks/custom-filename-function/test.config.js b/test/configCases/split-chunks/custom-filename-function/test.config.js index 4ca1669700f..7b6bf1749ea 100644 --- a/test/configCases/split-chunks/custom-filename-function/test.config.js +++ b/test/configCases/split-chunks/custom-filename-function/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["a.js"]; diff --git a/test/configCases/split-chunks/custom-filename-function/webpack.config.js b/test/configCases/split-chunks/custom-filename-function/webpack.config.js index e83ba6c8245..49010b32aa6 100644 --- a/test/configCases/split-chunks/custom-filename-function/webpack.config.js +++ b/test/configCases/split-chunks/custom-filename-function/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Chunk} Chunk */ /** @type {import("../../../../").Configuration} */ @@ -7,7 +9,7 @@ module.exports = { b: "./b" }, output: { - filename: data => + filename: (data) => `${/** @type {Chunk} */ (data.chunk).name || /** @type {Chunk} */ (data.chunk).id}.js`, libraryTarget: "commonjs2" }, @@ -18,7 +20,7 @@ module.exports = { shared: { chunks: "all", test: /shared/, - filename: data => + filename: (data) => `shared-${/** @type {Chunk} */ (data.chunk).name || /** @type {Chunk} */ (data.chunk).id}.js`, enforce: true }, diff --git a/test/configCases/split-chunks/custom-filename-many-custom/test.config.js b/test/configCases/split-chunks/custom-filename-many-custom/test.config.js index 4ca1669700f..7b6bf1749ea 100644 --- a/test/configCases/split-chunks/custom-filename-many-custom/test.config.js +++ b/test/configCases/split-chunks/custom-filename-many-custom/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["a.js"]; diff --git a/test/configCases/split-chunks/custom-filename-many-custom/webpack.config.js b/test/configCases/split-chunks/custom-filename-many-custom/webpack.config.js index 46accefd651..f6e6d981925 100644 --- a/test/configCases/split-chunks/custom-filename-many-custom/webpack.config.js +++ b/test/configCases/split-chunks/custom-filename-many-custom/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks/custom-filename/test.config.js b/test/configCases/split-chunks/custom-filename/test.config.js index 4ca1669700f..7b6bf1749ea 100644 --- a/test/configCases/split-chunks/custom-filename/test.config.js +++ b/test/configCases/split-chunks/custom-filename/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["a.js"]; diff --git a/test/configCases/split-chunks/custom-filename/webpack.config.js b/test/configCases/split-chunks/custom-filename/webpack.config.js index 46accefd651..f6e6d981925 100644 --- a/test/configCases/split-chunks/custom-filename/webpack.config.js +++ b/test/configCases/split-chunks/custom-filename/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks/entry-point-error/errors.js b/test/configCases/split-chunks/entry-point-error/errors.js index f8d7dc2e33b..05b662b40fb 100644 --- a/test/configCases/split-chunks/entry-point-error/errors.js +++ b/test/configCases/split-chunks/entry-point-error/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/SplitChunksPlugin/, /Both have the same name "vendors"/]]; diff --git a/test/configCases/split-chunks/entry-point-error/test.config.js b/test/configCases/split-chunks/entry-point-error/test.config.js index fa1cdb2fcb2..b1060682b62 100644 --- a/test/configCases/split-chunks/entry-point-error/test.config.js +++ b/test/configCases/split-chunks/entry-point-error/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["vendors.js", "main.js"]; diff --git a/test/configCases/split-chunks/entry-point-error/webpack.config.js b/test/configCases/split-chunks/entry-point-error/webpack.config.js index d7a3de190bd..50d91f65249 100644 --- a/test/configCases/split-chunks/entry-point-error/webpack.config.js +++ b/test/configCases/split-chunks/entry-point-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/webpack.config.js b/test/configCases/split-chunks/incorrect-chunk-reuse/webpack.config.js index 5704fc5c569..c6f577ffa0d 100644 --- a/test/configCases/split-chunks/incorrect-chunk-reuse/webpack.config.js +++ b/test/configCases/split-chunks/incorrect-chunk-reuse/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/split-chunks/issue-11337/webpack.config.js b/test/configCases/split-chunks/issue-11337/webpack.config.js index c892fa337dc..3f4592ee4b2 100644 --- a/test/configCases/split-chunks/issue-11337/webpack.config.js +++ b/test/configCases/split-chunks/issue-11337/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/split-chunks/issue-11513/test.config.js b/test/configCases/split-chunks/issue-11513/test.config.js index aab02d48ec4..82757a4ba97 100644 --- a/test/configCases/split-chunks/issue-11513/test.config.js +++ b/test/configCases/split-chunks/issue-11513/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["test.js", "main.js"]; diff --git a/test/configCases/split-chunks/issue-11513/webpack.config.js b/test/configCases/split-chunks/issue-11513/webpack.config.js index 3ed14c215ce..2c2766ad228 100644 --- a/test/configCases/split-chunks/issue-11513/webpack.config.js +++ b/test/configCases/split-chunks/issue-11513/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/configCases/split-chunks/issue-12307/webpack.config.js b/test/configCases/split-chunks/issue-12307/webpack.config.js index 9b3b9ad5d81..508b7db2afb 100644 --- a/test/configCases/split-chunks/issue-12307/webpack.config.js +++ b/test/configCases/split-chunks/issue-12307/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks/issue-17332/test.config.js b/test/configCases/split-chunks/issue-17332/test.config.js index 1a6234f5e0f..98b0b244463 100644 --- a/test/configCases/split-chunks/issue-17332/test.config.js +++ b/test/configCases/split-chunks/issue-17332/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["split-foo.js", "foo.js", "main.js"]; diff --git a/test/configCases/split-chunks/issue-17332/webpack.config.js b/test/configCases/split-chunks/issue-17332/webpack.config.js index 7039d77ada1..9b5dc16d32d 100644 --- a/test/configCases/split-chunks/issue-17332/webpack.config.js +++ b/test/configCases/split-chunks/issue-17332/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/split-chunks/issue-8908/test.config.js b/test/configCases/split-chunks/issue-8908/test.config.js index 7948c3fe722..287196fe52d 100644 --- a/test/configCases/split-chunks/issue-8908/test.config.js +++ b/test/configCases/split-chunks/issue-8908/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["runtime.js", "vendor-a.js", "a.js"]; diff --git a/test/configCases/split-chunks/issue-8908/webpack.config.js b/test/configCases/split-chunks/issue-8908/webpack.config.js index c7307692cbf..35860037437 100644 --- a/test/configCases/split-chunks/issue-8908/webpack.config.js +++ b/test/configCases/split-chunks/issue-8908/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks/issue-9491/test.config.js b/test/configCases/split-chunks/issue-9491/test.config.js index 823968a3f38..6a7fc8a6b8b 100644 --- a/test/configCases/split-chunks/issue-9491/test.config.js +++ b/test/configCases/split-chunks/issue-9491/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["runtime.js", "constructor.js"]; diff --git a/test/configCases/split-chunks/issue-9491/webpack.config.js b/test/configCases/split-chunks/issue-9491/webpack.config.js index bfced90ac73..5df22bbefab 100644 --- a/test/configCases/split-chunks/issue-9491/webpack.config.js +++ b/test/configCases/split-chunks/issue-9491/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks/max-size-casing/test.config.js b/test/configCases/split-chunks/max-size-casing/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/split-chunks/max-size-casing/test.config.js +++ b/test/configCases/split-chunks/max-size-casing/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/split-chunks/max-size-casing/webpack.config.js b/test/configCases/split-chunks/max-size-casing/webpack.config.js index beebf157473..edb6ccc2a4e 100644 --- a/test/configCases/split-chunks/max-size-casing/webpack.config.js +++ b/test/configCases/split-chunks/max-size-casing/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/split-chunks/module-type-filter/test.config.js b/test/configCases/split-chunks/module-type-filter/test.config.js index 5e6f0eb36c3..7c55f9f821c 100644 --- a/test/configCases/split-chunks/module-type-filter/test.config.js +++ b/test/configCases/split-chunks/module-type-filter/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["json.js", "main.js"]; diff --git a/test/configCases/split-chunks/module-type-filter/webpack.config.js b/test/configCases/split-chunks/module-type-filter/webpack.config.js index 3b2df399f7a..76c3a3df222 100644 --- a/test/configCases/split-chunks/module-type-filter/webpack.config.js +++ b/test/configCases/split-chunks/module-type-filter/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks/move-to-entrypoint/test.config.js b/test/configCases/split-chunks/move-to-entrypoint/test.config.js index 97e8d085f4d..45d8ad5686b 100644 --- a/test/configCases/split-chunks/move-to-entrypoint/test.config.js +++ b/test/configCases/split-chunks/move-to-entrypoint/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["runtime.js", "a.js", "b.js"]; diff --git a/test/configCases/split-chunks/move-to-entrypoint/webpack.config.js b/test/configCases/split-chunks/move-to-entrypoint/webpack.config.js index 01a9cfcd60c..7c83b7a806d 100644 --- a/test/configCases/split-chunks/move-to-entrypoint/webpack.config.js +++ b/test/configCases/split-chunks/move-to-entrypoint/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks/no-name/test.config.js b/test/configCases/split-chunks/no-name/test.config.js index 859a3d0a5fe..23c2b10beed 100644 --- a/test/configCases/split-chunks/no-name/test.config.js +++ b/test/configCases/split-chunks/no-name/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["common-a_js.js", "main.js"]; diff --git a/test/configCases/split-chunks/no-name/webpack.config.js b/test/configCases/split-chunks/no-name/webpack.config.js index 2318b4ee7df..fc2bb0b1d10 100644 --- a/test/configCases/split-chunks/no-name/webpack.config.js +++ b/test/configCases/split-chunks/no-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/split-chunks/no-options/test.config.js b/test/configCases/split-chunks/no-options/test.config.js index 5875983aa91..740103470a8 100644 --- a/test/configCases/split-chunks/no-options/test.config.js +++ b/test/configCases/split-chunks/no-options/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["vendor.js", "main.js"]; diff --git a/test/configCases/split-chunks/no-options/webpack.config.js b/test/configCases/split-chunks/no-options/webpack.config.js index 2fec23d7fed..3fa31b8124c 100644 --- a/test/configCases/split-chunks/no-options/webpack.config.js +++ b/test/configCases/split-chunks/no-options/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { SplitChunksPlugin } = require("../../../../").optimize; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/split-chunks/reuse-chunk-name/test.config.js b/test/configCases/split-chunks/reuse-chunk-name/test.config.js index dc9c0aae56c..80cfc5a7a2c 100644 --- a/test/configCases/split-chunks/reuse-chunk-name/test.config.js +++ b/test/configCases/split-chunks/reuse-chunk-name/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["common.js", "main.js"]; diff --git a/test/configCases/split-chunks/reuse-chunk-name/webpack.config.js b/test/configCases/split-chunks/reuse-chunk-name/webpack.config.js index a31736a3908..a2cd9284657 100644 --- a/test/configCases/split-chunks/reuse-chunk-name/webpack.config.js +++ b/test/configCases/split-chunks/reuse-chunk-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/split-chunks/runtime-chunk-async-node/test.config.js b/test/configCases/split-chunks/runtime-chunk-async-node/test.config.js index 1b0256ddd2a..c99b0ddac1d 100644 --- a/test/configCases/split-chunks/runtime-chunk-async-node/test.config.js +++ b/test/configCases/split-chunks/runtime-chunk-async-node/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["b.js", "deep/path/a.js", "somewhere/c.js"]; diff --git a/test/configCases/split-chunks/runtime-chunk-async-node/webpack.config.js b/test/configCases/split-chunks/runtime-chunk-async-node/webpack.config.js index a023f1b45f2..da937dcc69b 100644 --- a/test/configCases/split-chunks/runtime-chunk-async-node/webpack.config.js +++ b/test/configCases/split-chunks/runtime-chunk-async-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js b/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js index c19bed73651..7381dcffaa4 100644 --- a/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js +++ b/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js @@ -1,8 +1,10 @@ +"use strict"; + const fs = require("fs"); module.exports = { findBundle(i, options) { const files = fs.readdirSync(options.output.path); - return ["runtime.js", files.find(f => f.startsWith("main"))]; + return ["runtime.js", files.find((f) => f.startsWith("main"))]; } }; diff --git a/test/configCases/split-chunks/runtime-chunk-no-async/webpack.config.js b/test/configCases/split-chunks/runtime-chunk-no-async/webpack.config.js index b8fb043d721..fbcd11a3bc0 100644 --- a/test/configCases/split-chunks/runtime-chunk-no-async/webpack.config.js +++ b/test/configCases/split-chunks/runtime-chunk-no-async/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/split-chunks/runtime-chunk-node-13130/test.config.js b/test/configCases/split-chunks/runtime-chunk-node-13130/test.config.js index 1b0256ddd2a..c99b0ddac1d 100644 --- a/test/configCases/split-chunks/runtime-chunk-node-13130/test.config.js +++ b/test/configCases/split-chunks/runtime-chunk-node-13130/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["b.js", "deep/path/a.js", "somewhere/c.js"]; diff --git a/test/configCases/split-chunks/runtime-chunk-node-13130/webpack.config.js b/test/configCases/split-chunks/runtime-chunk-node-13130/webpack.config.js index d3650f3f156..2fa8e6107ab 100644 --- a/test/configCases/split-chunks/runtime-chunk-node-13130/webpack.config.js +++ b/test/configCases/split-chunks/runtime-chunk-node-13130/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/split-chunks/runtime-chunk-node/test.config.js b/test/configCases/split-chunks/runtime-chunk-node/test.config.js index 1b0256ddd2a..c99b0ddac1d 100644 --- a/test/configCases/split-chunks/runtime-chunk-node/test.config.js +++ b/test/configCases/split-chunks/runtime-chunk-node/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["b.js", "deep/path/a.js", "somewhere/c.js"]; diff --git a/test/configCases/split-chunks/runtime-chunk-node/webpack.config.js b/test/configCases/split-chunks/runtime-chunk-node/webpack.config.js index 93007b2e541..5f75bbac846 100644 --- a/test/configCases/split-chunks/runtime-chunk-node/webpack.config.js +++ b/test/configCases/split-chunks/runtime-chunk-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/split-chunks/runtime-chunk/test.config.js b/test/configCases/split-chunks/runtime-chunk/test.config.js index cdc9dd1d401..8304525e276 100644 --- a/test/configCases/split-chunks/runtime-chunk/test.config.js +++ b/test/configCases/split-chunks/runtime-chunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["runtime.js", "a.js"]; diff --git a/test/configCases/split-chunks/runtime-chunk/webpack.config.js b/test/configCases/split-chunks/runtime-chunk/webpack.config.js index 180a47ff5f1..48a4f907be2 100644 --- a/test/configCases/split-chunks/runtime-chunk/webpack.config.js +++ b/test/configCases/split-chunks/runtime-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/split-chunks/vendor-only-entrypoint/test.config.js b/test/configCases/split-chunks/vendor-only-entrypoint/test.config.js index f80a9c6f527..b29bc722da5 100644 --- a/test/configCases/split-chunks/vendor-only-entrypoint/test.config.js +++ b/test/configCases/split-chunks/vendor-only-entrypoint/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["runtime~vendor.js", "vendor.js"]; diff --git a/test/configCases/split-chunks/vendor-only-entrypoint/webpack.config.js b/test/configCases/split-chunks/vendor-only-entrypoint/webpack.config.js index 8a122bd6db7..6d569a00537 100644 --- a/test/configCases/split-chunks/vendor-only-entrypoint/webpack.config.js +++ b/test/configCases/split-chunks/vendor-only-entrypoint/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/target/amd-container-named/webpack.config.js b/test/configCases/target/amd-container-named/webpack.config.js index a77d26e8630..2df6e0e13e8 100644 --- a/test/configCases/target/amd-container-named/webpack.config.js +++ b/test/configCases/target/amd-container-named/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../types").Configuration} */ diff --git a/test/configCases/target/amd-container-require/webpack.config.js b/test/configCases/target/amd-container-require/webpack.config.js index 74ea04edd02..9856dc84f01 100644 --- a/test/configCases/target/amd-container-require/webpack.config.js +++ b/test/configCases/target/amd-container-require/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../types").Configuration} */ diff --git a/test/configCases/target/amd-container-unnamed/webpack.config.js b/test/configCases/target/amd-container-unnamed/webpack.config.js index 6a9b47fc534..fb2fad70d96 100644 --- a/test/configCases/target/amd-container-unnamed/webpack.config.js +++ b/test/configCases/target/amd-container-unnamed/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../types").Configuration} */ diff --git a/test/configCases/target/amd-named/webpack.config.js b/test/configCases/target/amd-named/webpack.config.js index 5f67e29272c..9d820b7ad5e 100644 --- a/test/configCases/target/amd-named/webpack.config.js +++ b/test/configCases/target/amd-named/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/target/amd-require/webpack.config.js b/test/configCases/target/amd-require/webpack.config.js index 968ab6b0bb3..6ccf82b81cc 100644 --- a/test/configCases/target/amd-require/webpack.config.js +++ b/test/configCases/target/amd-require/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/target/amd-unnamed/webpack.config.js b/test/configCases/target/amd-unnamed/webpack.config.js index 0569a4488f4..030b23e6b10 100644 --- a/test/configCases/target/amd-unnamed/webpack.config.js +++ b/test/configCases/target/amd-unnamed/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/target/chunk-loading-per-entry/test.config.js b/test/configCases/target/chunk-loading-per-entry/test.config.js index 643395505ab..03621266a7e 100644 --- a/test/configCases/target/chunk-loading-per-entry/test.config.js +++ b/test/configCases/target/chunk-loading-per-entry/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { return i === 0 ? "./web-0.js" : "./webworker-1.js"; diff --git a/test/configCases/target/chunk-loading-per-entry/webpack.config.js b/test/configCases/target/chunk-loading-per-entry/webpack.config.js index f60246ed5da..9335030d0b9 100644 --- a/test/configCases/target/chunk-loading-per-entry/webpack.config.js +++ b/test/configCases/target/chunk-loading-per-entry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ const base = { entry: { diff --git a/test/configCases/target/electron-renderer/webpack.config.js b/test/configCases/target/electron-renderer/webpack.config.js index e7d1ecf5c87..f07409cdb5d 100644 --- a/test/configCases/target/electron-renderer/webpack.config.js +++ b/test/configCases/target/electron-renderer/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "electron-renderer", diff --git a/test/configCases/target/node-dynamic-import/test.filter.js b/test/configCases/target/node-dynamic-import/test.filter.js index 356ad462e20..59f3f281b7c 100644 --- a/test/configCases/target/node-dynamic-import/test.filter.js +++ b/test/configCases/target/node-dynamic-import/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsArrowFn = require("../../../helpers/supportsArrowFunctionExpression"); module.exports = () => supportsArrowFn(); diff --git a/test/configCases/target/node-dynamic-import/webpack.config.js b/test/configCases/target/node-dynamic-import/webpack.config.js index 411eb1af1e7..bf47c842f7d 100644 --- a/test/configCases/target/node-dynamic-import/webpack.config.js +++ b/test/configCases/target/node-dynamic-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", diff --git a/test/configCases/target/strict-mode-global/webpack.config.js b/test/configCases/target/strict-mode-global/webpack.config.js index 03c779ee0af..5717dd93196 100644 --- a/test/configCases/target/strict-mode-global/webpack.config.js +++ b/test/configCases/target/strict-mode-global/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web" diff --git a/test/configCases/target/system-context/test.config.js b/test/configCases/target/system-context/test.config.js index 97ebf538dbe..781df45dd79 100644 --- a/test/configCases/target/system-context/test.config.js +++ b/test/configCases/target/system-context/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const System = require("../../../helpers/fakeSystem"); module.exports = { diff --git a/test/configCases/target/system-context/webpack.config.js b/test/configCases/target/system-context/webpack.config.js index 9c9c85fe0a3..61bcd04b0f2 100644 --- a/test/configCases/target/system-context/webpack.config.js +++ b/test/configCases/target/system-context/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/system-export/test.config.js b/test/configCases/target/system-export/test.config.js index 97ebf538dbe..781df45dd79 100644 --- a/test/configCases/target/system-export/test.config.js +++ b/test/configCases/target/system-export/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const System = require("../../../helpers/fakeSystem"); module.exports = { diff --git a/test/configCases/target/system-export/webpack.config.js b/test/configCases/target/system-export/webpack.config.js index 2d1a8001fb8..e4a456e8d4d 100644 --- a/test/configCases/target/system-export/webpack.config.js +++ b/test/configCases/target/system-export/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/system-named-assets-path/test.config.js b/test/configCases/target/system-named-assets-path/test.config.js index ad31a215df0..04cef0a8851 100644 --- a/test/configCases/target/system-named-assets-path/test.config.js +++ b/test/configCases/target/system-named-assets-path/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const System = require("../../../helpers/fakeSystem"); module.exports = { diff --git a/test/configCases/target/system-named-assets-path/webpack.config.js b/test/configCases/target/system-named-assets-path/webpack.config.js index 4dc791678d0..05a61a677a1 100644 --- a/test/configCases/target/system-named-assets-path/webpack.config.js +++ b/test/configCases/target/system-named-assets-path/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/system-named/test.config.js b/test/configCases/target/system-named/test.config.js index 8b3f83a51f9..da2dedea743 100644 --- a/test/configCases/target/system-named/test.config.js +++ b/test/configCases/target/system-named/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const System = require("../../../helpers/fakeSystem"); module.exports = { diff --git a/test/configCases/target/system-named/webpack.config.js b/test/configCases/target/system-named/webpack.config.js index fef28f250bc..7f84c7050ce 100644 --- a/test/configCases/target/system-named/webpack.config.js +++ b/test/configCases/target/system-named/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/system-unnamed/test.config.js b/test/configCases/target/system-unnamed/test.config.js index 97ebf538dbe..781df45dd79 100644 --- a/test/configCases/target/system-unnamed/test.config.js +++ b/test/configCases/target/system-unnamed/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const System = require("../../../helpers/fakeSystem"); module.exports = { diff --git a/test/configCases/target/system-unnamed/webpack.config.js b/test/configCases/target/system-unnamed/webpack.config.js index 2d1a8001fb8..e4a456e8d4d 100644 --- a/test/configCases/target/system-unnamed/webpack.config.js +++ b/test/configCases/target/system-unnamed/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/umd-auxiliary-comments-object/webpack.config.js b/test/configCases/target/umd-auxiliary-comments-object/webpack.config.js index 43147101b8b..00bbe8ba98e 100644 --- a/test/configCases/target/umd-auxiliary-comments-object/webpack.config.js +++ b/test/configCases/target/umd-auxiliary-comments-object/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/umd-auxiliary-comments-string/webpack.config.js b/test/configCases/target/umd-auxiliary-comments-string/webpack.config.js index 739c67f4f10..96619f0a8bb 100644 --- a/test/configCases/target/umd-auxiliary-comments-string/webpack.config.js +++ b/test/configCases/target/umd-auxiliary-comments-string/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/umd-named-define/webpack.config.js b/test/configCases/target/umd-named-define/webpack.config.js index bfe025995ba..aa4f0b8d761 100644 --- a/test/configCases/target/umd-named-define/webpack.config.js +++ b/test/configCases/target/umd-named-define/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/universal/test.config.js b/test/configCases/target/universal/test.config.js index e2664c9b261..ed5826c539f 100644 --- a/test/configCases/target/universal/test.config.js +++ b/test/configCases/target/universal/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["./runtime.mjs", "./separate.mjs", "./main.mjs"]; diff --git a/test/configCases/target/universal/webpack.config.js b/test/configCases/target/universal/webpack.config.js index 386112ee018..475abca5d6d 100644 --- a/test/configCases/target/universal/webpack.config.js +++ b/test/configCases/target/universal/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/trusted-types/continue-on-policy-creation-failure/webpack.config.js b/test/configCases/trusted-types/continue-on-policy-creation-failure/webpack.config.js index df698de6663..39302e8a5e9 100644 --- a/test/configCases/trusted-types/continue-on-policy-creation-failure/webpack.config.js +++ b/test/configCases/trusted-types/continue-on-policy-creation-failure/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { target: "web", output: { diff --git a/test/configCases/trusted-types/custom-policy-name/webpack.config.js b/test/configCases/trusted-types/custom-policy-name/webpack.config.js index bd52bcc388c..116a46e4eb3 100644 --- a/test/configCases/trusted-types/custom-policy-name/webpack.config.js +++ b/test/configCases/trusted-types/custom-policy-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { target: "web", output: { diff --git a/test/configCases/trusted-types/default-policy-name/webpack.config.js b/test/configCases/trusted-types/default-policy-name/webpack.config.js index 21395fcf3b4..be9c4677bd2 100644 --- a/test/configCases/trusted-types/default-policy-name/webpack.config.js +++ b/test/configCases/trusted-types/default-policy-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { target: "web", output: { diff --git a/test/configCases/trusted-types/devtool-eval/webpack.config.js b/test/configCases/trusted-types/devtool-eval/webpack.config.js index 1356571fd81..fe9b267827f 100644 --- a/test/configCases/trusted-types/devtool-eval/webpack.config.js +++ b/test/configCases/trusted-types/devtool-eval/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/trusted-types/no-policy-name/webpack.config.js b/test/configCases/trusted-types/no-policy-name/webpack.config.js index 68eeb96a523..52762a7eac6 100644 --- a/test/configCases/trusted-types/no-policy-name/webpack.config.js +++ b/test/configCases/trusted-types/no-policy-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { target: "web", output: { diff --git a/test/configCases/trusted-types/no-trusted-types/webpack.config.js b/test/configCases/trusted-types/no-trusted-types/webpack.config.js index 21395fcf3b4..be9c4677bd2 100644 --- a/test/configCases/trusted-types/no-trusted-types/webpack.config.js +++ b/test/configCases/trusted-types/no-trusted-types/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { target: "web", output: { diff --git a/test/configCases/trusted-types/stop-on-policy-creation-failure/webpack.config.js b/test/configCases/trusted-types/stop-on-policy-creation-failure/webpack.config.js index 21395fcf3b4..be9c4677bd2 100644 --- a/test/configCases/trusted-types/stop-on-policy-creation-failure/webpack.config.js +++ b/test/configCases/trusted-types/stop-on-policy-creation-failure/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { target: "web", output: { diff --git a/test/configCases/trusted-types/web-worker/test.config.js b/test/configCases/trusted-types/web-worker/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/trusted-types/web-worker/test.config.js +++ b/test/configCases/trusted-types/web-worker/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/trusted-types/web-worker/test.filter.js b/test/configCases/trusted-types/web-worker/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/trusted-types/web-worker/test.filter.js +++ b/test/configCases/trusted-types/web-worker/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/trusted-types/web-worker/webpack.config.js b/test/configCases/trusted-types/web-worker/webpack.config.js index 1b611149a76..7fff149a0a1 100644 --- a/test/configCases/trusted-types/web-worker/webpack.config.js +++ b/test/configCases/trusted-types/web-worker/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { filename: "[name].js", diff --git a/test/configCases/types/filesystems/test.filter.js b/test/configCases/types/filesystems/test.filter.js index 0ba64710234..549d112c2e3 100644 --- a/test/configCases/types/filesystems/test.filter.js +++ b/test/configCases/types/filesystems/test.filter.js @@ -1 +1,3 @@ +"use strict"; + module.exports = () => false; diff --git a/test/configCases/types/filesystems/webpack.config.js b/test/configCases/types/filesystems/webpack.config.js index db6a5706dcf..db6324733cc 100644 --- a/test/configCases/types/filesystems/webpack.config.js +++ b/test/configCases/types/filesystems/webpack.config.js @@ -1,10 +1,12 @@ +"use strict"; + const fs = require("fs"); const memfs = require("memfs"); /** @type {import("../../../../").Configuration} */ module.exports = { plugins: [ - compiler => { + (compiler) => { // eslint-disable-next-line no-warning-comments // @ts-ignore compiler.outputFileSystem = memfs.fs; diff --git a/test/configCases/umd/issue-15545/test.config.js b/test/configCases/umd/issue-15545/test.config.js index 67874807764..d408b899ed7 100644 --- a/test/configCases/umd/issue-15545/test.config.js +++ b/test/configCases/umd/issue-15545/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const CONTEXT = {}; module.exports = { diff --git a/test/configCases/umd/issue-15545/webpack.config.js b/test/configCases/umd/issue-15545/webpack.config.js index 73b1025f8b4..c06ebb726d2 100644 --- a/test/configCases/umd/issue-15545/webpack.config.js +++ b/test/configCases/umd/issue-15545/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/configCases/url/context-options/webpack.config.js b/test/configCases/url/context-options/webpack.config.js index 9546ca838cc..b5bb19a1400 100644 --- a/test/configCases/url/context-options/webpack.config.js +++ b/test/configCases/url/context-options/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/url/disable-dynamic-url/webpack.config.js b/test/configCases/url/disable-dynamic-url/webpack.config.js index 3a33d13ddc3..e0915b5cb84 100644 --- a/test/configCases/url/disable-dynamic-url/webpack.config.js +++ b/test/configCases/url/disable-dynamic-url/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/url/dynamic-template-literals-expr/webpack.config.js b/test/configCases/url/dynamic-template-literals-expr/webpack.config.js index 142bed85d16..401da64e36e 100644 --- a/test/configCases/url/dynamic-template-literals-expr/webpack.config.js +++ b/test/configCases/url/dynamic-template-literals-expr/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/url/pure-dep/webpack.config.js b/test/configCases/url/pure-dep/webpack.config.js index 3a5dfd52ba3..f30981f5406 100644 --- a/test/configCases/url/pure-dep/webpack.config.js +++ b/test/configCases/url/pure-dep/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/utils/lazy-set/webpack.config.js b/test/configCases/utils/lazy-set/webpack.config.js index e438873edc3..8f202cf8e09 100644 --- a/test/configCases/utils/lazy-set/webpack.config.js +++ b/test/configCases/utils/lazy-set/webpack.config.js @@ -1,7 +1,9 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { plugins: [ - compiler => { + (compiler) => { compiler.hooks.done.tap("Test", ({ compilation }) => { const items1 = [...compilation.fileDependencies]; const items2 = new Set(compilation.fileDependencies.keys()); @@ -17,7 +19,7 @@ module.exports = { const items1Set = new Set(items1); expect(items2).toEqual(items1Set); expect(items3).toEqual(items1Set); - expect(items4).toEqual(new Set(items1.map(x => [x, x]))); + expect(items4).toEqual(new Set(items1.map((x) => [x, x]))); }); } ] diff --git a/test/configCases/wasm/async-node/test.filter.js b/test/configCases/wasm/async-node/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/configCases/wasm/async-node/test.filter.js +++ b/test/configCases/wasm/async-node/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/wasm/async-node/webpack.config.js b/test/configCases/wasm/async-node/webpack.config.js index f90f325e1f4..3b08ee1e1eb 100644 --- a/test/configCases/wasm/async-node/webpack.config.js +++ b/test/configCases/wasm/async-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/wasm/bigints/test.filter.js b/test/configCases/wasm/bigints/test.filter.js index d8c4a29ca6b..59937a91d90 100644 --- a/test/configCases/wasm/bigints/test.filter.js +++ b/test/configCases/wasm/bigints/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supports = require("webassembly-feature"); module.exports = () => diff --git a/test/configCases/wasm/bigints/webpack.config.js b/test/configCases/wasm/bigints/webpack.config.js index 63567a47504..a578692c0b4 100644 --- a/test/configCases/wasm/bigints/webpack.config.js +++ b/test/configCases/wasm/bigints/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/configCases/wasm/export-imported-global/test.filter.js b/test/configCases/wasm/export-imported-global/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/configCases/wasm/export-imported-global/test.filter.js +++ b/test/configCases/wasm/export-imported-global/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/wasm/export-imported-global/webpack.config.js b/test/configCases/wasm/export-imported-global/webpack.config.js index 63567a47504..a578692c0b4 100644 --- a/test/configCases/wasm/export-imported-global/webpack.config.js +++ b/test/configCases/wasm/export-imported-global/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/configCases/wasm/externref/test.filter.js b/test/configCases/wasm/externref/test.filter.js index 7eef22e2153..0812b507e6b 100644 --- a/test/configCases/wasm/externref/test.filter.js +++ b/test/configCases/wasm/externref/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => { diff --git a/test/configCases/wasm/externref/webpack.config.js b/test/configCases/wasm/externref/webpack.config.js index 2a575598785..89408d0072c 100644 --- a/test/configCases/wasm/externref/webpack.config.js +++ b/test/configCases/wasm/externref/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compiler} Compiler */ /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/wasm/fetch/test.config.js b/test/configCases/wasm/fetch/test.config.js index 68d0c25fcf0..5d01d956984 100644 --- a/test/configCases/wasm/fetch/test.config.js +++ b/test/configCases/wasm/fetch/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const url = require("url"); @@ -16,7 +18,7 @@ module.exports = { } }, moduleScope(scope, options) { - scope.fetch = resource => + scope.fetch = (resource) => new Promise((resolve, reject) => { const file = /^file:/i.test(resource) ? url.fileURLToPath(resource) diff --git a/test/configCases/wasm/fetch/test.filter.js b/test/configCases/wasm/fetch/test.filter.js index 2c96b54d2ba..b8be1af9c74 100644 --- a/test/configCases/wasm/fetch/test.filter.js +++ b/test/configCases/wasm/fetch/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsResponse = require("../../../helpers/supportsResponse"); const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); diff --git a/test/configCases/wasm/fetch/webpack.config.js b/test/configCases/wasm/fetch/webpack.config.js index 43ae72b2a69..136ef9e10ec 100644 --- a/test/configCases/wasm/fetch/webpack.config.js +++ b/test/configCases/wasm/fetch/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/wasm/identical/test.filter.js b/test/configCases/wasm/identical/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/configCases/wasm/identical/test.filter.js +++ b/test/configCases/wasm/identical/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/wasm/identical/webpack.config.js b/test/configCases/wasm/identical/webpack.config.js index a897d4f823c..8c81af56f79 100644 --- a/test/configCases/wasm/identical/webpack.config.js +++ b/test/configCases/wasm/identical/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { CachedSource } = require("webpack-sources"); const { AsyncWebAssemblyModulesPlugin } = require("../../../../").wasm; @@ -25,12 +27,12 @@ module.exports = { * @this {Compiler} compiler */ function test() { - this.hooks.compilation.tap("Test", compilation => { + this.hooks.compilation.tap("Test", (compilation) => { AsyncWebAssemblyModulesPlugin.getCompilationHooks( compilation ).renderModuleContent.tap( "Test", - source => + (source) => // this is important to make each returned value a new instance new CachedSource(source) ); diff --git a/test/configCases/wasm/import-wasm-wasm/test.filter.js b/test/configCases/wasm/import-wasm-wasm/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/configCases/wasm/import-wasm-wasm/test.filter.js +++ b/test/configCases/wasm/import-wasm-wasm/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/wasm/import-wasm-wasm/webpack.config.js b/test/configCases/wasm/import-wasm-wasm/webpack.config.js index 63567a47504..a578692c0b4 100644 --- a/test/configCases/wasm/import-wasm-wasm/webpack.config.js +++ b/test/configCases/wasm/import-wasm-wasm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/configCases/wasm/missing-wasm-experiment/errors.js b/test/configCases/wasm/missing-wasm-experiment/errors.js index 42b03522a5b..88e0c9cd875 100644 --- a/test/configCases/wasm/missing-wasm-experiment/errors.js +++ b/test/configCases/wasm/missing-wasm-experiment/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/BREAKING CHANGE/, /experiments\.asyncWebAssembly/]]; diff --git a/test/configCases/wasm/missing-wasm-experiment/infrastructure-log.js b/test/configCases/wasm/missing-wasm-experiment/infrastructure-log.js index e729fa65151..e52440c5277 100644 --- a/test/configCases/wasm/missing-wasm-experiment/infrastructure-log.js +++ b/test/configCases/wasm/missing-wasm-experiment/infrastructure-log.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /^Pack got invalid because of write to: Compilation\/modules.+wasm.wasm$/ ]; diff --git a/test/configCases/wasm/missing-wasm-experiment/webpack.config.js b/test/configCases/wasm/missing-wasm-experiment/webpack.config.js index 3583b70a321..27313115dcd 100644 --- a/test/configCases/wasm/missing-wasm-experiment/webpack.config.js +++ b/test/configCases/wasm/missing-wasm-experiment/webpack.config.js @@ -1,2 +1,4 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = {}; diff --git a/test/configCases/wasm/reference-types/test.filter.js b/test/configCases/wasm/reference-types/test.filter.js index 7eef22e2153..0812b507e6b 100644 --- a/test/configCases/wasm/reference-types/test.filter.js +++ b/test/configCases/wasm/reference-types/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => { diff --git a/test/configCases/wasm/reference-types/webpack.config.js b/test/configCases/wasm/reference-types/webpack.config.js index 2a575598785..89408d0072c 100644 --- a/test/configCases/wasm/reference-types/webpack.config.js +++ b/test/configCases/wasm/reference-types/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").Compiler} Compiler */ /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/wasm/universal/test.config.js b/test/configCases/wasm/universal/test.config.js index c8746aca86d..09adae70313 100644 --- a/test/configCases/wasm/universal/test.config.js +++ b/test/configCases/wasm/universal/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const url = require("url"); @@ -8,7 +10,7 @@ module.exports = { delete scope.document; delete scope.self; } else { - scope.fetch = resource => + scope.fetch = (resource) => new Promise((resolve, reject) => { fs.readFile(url.fileURLToPath(resource), (err, data) => { if (err) { diff --git a/test/configCases/wasm/universal/test.filter.js b/test/configCases/wasm/universal/test.filter.js index 2c96b54d2ba..b8be1af9c74 100644 --- a/test/configCases/wasm/universal/test.filter.js +++ b/test/configCases/wasm/universal/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsResponse = require("../../../helpers/supportsResponse"); const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); diff --git a/test/configCases/wasm/universal/webpack.config.js b/test/configCases/wasm/universal/webpack.config.js index 5cea60cf511..fec0530fd8d 100644 --- a/test/configCases/wasm/universal/webpack.config.js +++ b/test/configCases/wasm/universal/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = [ { diff --git a/test/configCases/wasm/wasm-in-initial-chunk-error/errors.js b/test/configCases/wasm/wasm-in-initial-chunk-error/errors.js index 1a501f8505e..956d7e60c8e 100644 --- a/test/configCases/wasm/wasm-in-initial-chunk-error/errors.js +++ b/test/configCases/wasm/wasm-in-initial-chunk-error/errors.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [ /\.\/wasm.wat/, diff --git a/test/configCases/wasm/wasm-in-initial-chunk-error/test.filter.js b/test/configCases/wasm/wasm-in-initial-chunk-error/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/configCases/wasm/wasm-in-initial-chunk-error/test.filter.js +++ b/test/configCases/wasm/wasm-in-initial-chunk-error/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/wasm/wasm-in-initial-chunk-error/webpack.config.js b/test/configCases/wasm/wasm-in-initial-chunk-error/webpack.config.js index 47355aa66a7..9a207092f94 100644 --- a/test/configCases/wasm/wasm-in-initial-chunk-error/webpack.config.js +++ b/test/configCases/wasm/wasm-in-initial-chunk-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./index", diff --git a/test/configCases/web/attach-existing/webpack.config.js b/test/configCases/web/attach-existing/webpack.config.js index 102ef6e7f42..7ef0279ef59 100644 --- a/test/configCases/web/attach-existing/webpack.config.js +++ b/test/configCases/web/attach-existing/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/web/fetch-priority-2/webpack.config.js b/test/configCases/web/fetch-priority-2/webpack.config.js index df77841026e..5dead05bac8 100644 --- a/test/configCases/web/fetch-priority-2/webpack.config.js +++ b/test/configCases/web/fetch-priority-2/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/web/fetch-priority/warnings.js b/test/configCases/web/fetch-priority/warnings.js index 9a0ecd96954..353f95b8d1e 100644 --- a/test/configCases/web/fetch-priority/warnings.js +++ b/test/configCases/web/fetch-priority/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/`webpackFetchPriority` expected true or "low", "high" or "auto"/] ]; diff --git a/test/configCases/web/fetch-priority/webpack.config.js b/test/configCases/web/fetch-priority/webpack.config.js index c5f0efbe3cf..bca77e3a64d 100644 --- a/test/configCases/web/fetch-priority/webpack.config.js +++ b/test/configCases/web/fetch-priority/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/web/node-source-future-defaults/warnings.js b/test/configCases/web/node-source-future-defaults/warnings.js index 9c0b7c899f6..e457aaf14a7 100644 --- a/test/configCases/web/node-source-future-defaults/warnings.js +++ b/test/configCases/web/node-source-future-defaults/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ [/"global" has been used, it will be undefined in next major version/], [/"__filename" has been used, it will be undefined in next major version/], diff --git a/test/configCases/web/node-source-future-defaults/webpack.config.js b/test/configCases/web/node-source-future-defaults/webpack.config.js index f3f037144f2..b8fc2e22db5 100644 --- a/test/configCases/web/node-source-future-defaults/webpack.config.js +++ b/test/configCases/web/node-source-future-defaults/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/web/node-source-global/test.config.js b/test/configCases/web/node-source-global/test.config.js index b5337739a37..c3d5914efaa 100644 --- a/test/configCases/web/node-source-global/test.config.js +++ b/test/configCases/web/node-source-global/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { scope.global = scope.global || {}; diff --git a/test/configCases/web/node-source-global/webpack.config.js b/test/configCases/web/node-source-global/webpack.config.js index 4cae9c33bd4..0f2183bc75e 100644 --- a/test/configCases/web/node-source-global/webpack.config.js +++ b/test/configCases/web/node-source-global/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { DefinePlugin } = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/web/node-source/webpack.config.js b/test/configCases/web/node-source/webpack.config.js index 6524ff2c4f2..1d61ba91658 100644 --- a/test/configCases/web/node-source/webpack.config.js +++ b/test/configCases/web/node-source/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/web/non-js-chunks-entrypoint-runtime-chunk/test.config.js b/test/configCases/web/non-js-chunks-entrypoint-runtime-chunk/test.config.js index 09896fb508d..cc10ec4ef40 100644 --- a/test/configCases/web/non-js-chunks-entrypoint-runtime-chunk/test.config.js +++ b/test/configCases/web/non-js-chunks-entrypoint-runtime-chunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/web/non-js-chunks-entrypoint-runtime-chunk/webpack.config.js b/test/configCases/web/non-js-chunks-entrypoint-runtime-chunk/webpack.config.js index ab7c49b156f..80694f5f5ea 100644 --- a/test/configCases/web/non-js-chunks-entrypoint-runtime-chunk/webpack.config.js +++ b/test/configCases/web/non-js-chunks-entrypoint-runtime-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ProvideSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/web/non-js-chunks-entrypoint/test.config.js b/test/configCases/web/non-js-chunks-entrypoint/test.config.js index 229a4f1a0da..f344037df6c 100644 --- a/test/configCases/web/non-js-chunks-entrypoint/test.config.js +++ b/test/configCases/web/non-js-chunks-entrypoint/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return [ diff --git a/test/configCases/web/non-js-chunks-entrypoint/webpack.config.js b/test/configCases/web/non-js-chunks-entrypoint/webpack.config.js index 0f03aba307f..f9feab9e09c 100644 --- a/test/configCases/web/non-js-chunks-entrypoint/webpack.config.js +++ b/test/configCases/web/non-js-chunks-entrypoint/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ProvideSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/web/nonce/webpack.config.js b/test/configCases/web/nonce/webpack.config.js index b034ef3c8d2..e2faf77c221 100644 --- a/test/configCases/web/nonce/webpack.config.js +++ b/test/configCases/web/nonce/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/web/preexecuted-chunk/test.config.js b/test/configCases/web/preexecuted-chunk/test.config.js index 7aafb486102..49b8de3ee45 100644 --- a/test/configCases/web/preexecuted-chunk/test.config.js +++ b/test/configCases/web/preexecuted-chunk/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["the-chunk.js", "bundle0.js"]; diff --git a/test/configCases/web/preexecuted-chunk/webpack.config.js b/test/configCases/web/preexecuted-chunk/webpack.config.js index e41f49d5157..ec1a1407f0f 100644 --- a/test/configCases/web/preexecuted-chunk/webpack.config.js +++ b/test/configCases/web/preexecuted-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/web/prefetch-preload-module-jsonp/webpack.config.js b/test/configCases/web/prefetch-preload-module-jsonp/webpack.config.js index 9cd0da7b9ab..6a4b06d3866 100644 --- a/test/configCases/web/prefetch-preload-module-jsonp/webpack.config.js +++ b/test/configCases/web/prefetch-preload-module-jsonp/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./index.mjs", diff --git a/test/configCases/web/prefetch-preload-module-only-js/webpack.config.js b/test/configCases/web/prefetch-preload-module-only-js/webpack.config.js index 9b7f2978e2d..af281cf79e0 100644 --- a/test/configCases/web/prefetch-preload-module-only-js/webpack.config.js +++ b/test/configCases/web/prefetch-preload-module-only-js/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const RuntimeGlobals = require("../../../../lib/RuntimeGlobals"); /** @type {import("../../../../").Configuration} */ @@ -20,14 +22,14 @@ module.exports = { plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("Test", compilation => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "Test", stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE }, - assets => { + (assets) => { if ( assets["bundle0.mjs"] .source() diff --git a/test/configCases/web/prefetch-preload-module/webpack.config.js b/test/configCases/web/prefetch-preload-module/webpack.config.js index e99ad08edb5..958cf4f869d 100644 --- a/test/configCases/web/prefetch-preload-module/webpack.config.js +++ b/test/configCases/web/prefetch-preload-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./index.mjs", diff --git a/test/configCases/web/prefetch-preload/webpack.config.js b/test/configCases/web/prefetch-preload/webpack.config.js index 7271fe2ac59..90952d4cefa 100644 --- a/test/configCases/web/prefetch-preload/webpack.config.js +++ b/test/configCases/web/prefetch-preload/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/web/prefetch-split-chunks/test.config.js b/test/configCases/web/prefetch-split-chunks/test.config.js index 086baa60bb9..702f1082c76 100644 --- a/test/configCases/web/prefetch-split-chunks/test.config.js +++ b/test/configCases/web/prefetch-split-chunks/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js", "runtime~main.js", "separate-public-path_js.js"]; diff --git a/test/configCases/web/prefetch-split-chunks/webpack.config.js b/test/configCases/web/prefetch-split-chunks/webpack.config.js index 392e266446f..29896ca233b 100644 --- a/test/configCases/web/prefetch-split-chunks/webpack.config.js +++ b/test/configCases/web/prefetch-split-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/web/retry-failed-import/webpack.config.js b/test/configCases/web/retry-failed-import/webpack.config.js index f7950dc539a..3959a8b5eb5 100644 --- a/test/configCases/web/retry-failed-import/webpack.config.js +++ b/test/configCases/web/retry-failed-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/web/unique-jsonp/test.config.js b/test/configCases/web/unique-jsonp/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/web/unique-jsonp/test.config.js +++ b/test/configCases/web/unique-jsonp/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/web/unique-jsonp/webpack.config.js b/test/configCases/web/unique-jsonp/webpack.config.js index 681dcca656d..f438bab22c0 100644 --- a/test/configCases/web/unique-jsonp/webpack.config.js +++ b/test/configCases/web/unique-jsonp/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/configCases/worker/blob/test.filter.js b/test/configCases/worker/blob/test.filter.js index 0d78d1214d1..724a5ff9687 100644 --- a/test/configCases/worker/blob/test.filter.js +++ b/test/configCases/worker/blob/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsBlob = require("../../../helpers/supportsBlob"); const supportsWorker = require("../../../helpers/supportsWorker"); diff --git a/test/configCases/worker/blob/webpack.config.js b/test/configCases/worker/blob/webpack.config.js index 03c779ee0af..5717dd93196 100644 --- a/test/configCases/worker/blob/webpack.config.js +++ b/test/configCases/worker/blob/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web" diff --git a/test/configCases/worker/custom-worker/test.config.js b/test/configCases/worker/custom-worker/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/worker/custom-worker/test.config.js +++ b/test/configCases/worker/custom-worker/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/worker/custom-worker/test.filter.js b/test/configCases/worker/custom-worker/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/custom-worker/test.filter.js +++ b/test/configCases/worker/custom-worker/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/custom-worker/webpack.config.js b/test/configCases/worker/custom-worker/webpack.config.js index 339c124a88a..842eb9465dd 100644 --- a/test/configCases/worker/custom-worker/webpack.config.js +++ b/test/configCases/worker/custom-worker/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/worker/issue-17489/test.config.js b/test/configCases/worker/issue-17489/test.config.js index e5f36d141e8..43f179d66e6 100644 --- a/test/configCases/worker/issue-17489/test.config.js +++ b/test/configCases/worker/issue-17489/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + let outputDirectory; module.exports = { @@ -10,7 +12,7 @@ module.exports = { scope.AudioContext = class AudioContext { constructor() { this.audioWorklet = { - addModule: url => Promise.resolve(FakeWorker.bind(null, url)) + addModule: (url) => Promise.resolve(FakeWorker.bind(null, url)) }; } }; diff --git a/test/configCases/worker/issue-17489/test.filter.js b/test/configCases/worker/issue-17489/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/issue-17489/test.filter.js +++ b/test/configCases/worker/issue-17489/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/issue-17489/webpack.config.js b/test/configCases/worker/issue-17489/webpack.config.js index 8c1ae09ea78..46be9aee0b7 100644 --- a/test/configCases/worker/issue-17489/webpack.config.js +++ b/test/configCases/worker/issue-17489/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/worker/node-worker-async-node/test.config.js b/test/configCases/worker/node-worker-async-node/test.config.js index 9656284e0b7..08946de6f83 100644 --- a/test/configCases/worker/node-worker-async-node/test.config.js +++ b/test/configCases/worker/node-worker-async-node/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/test/configCases/worker/node-worker-async-node/test.filter.js b/test/configCases/worker/node-worker-async-node/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/node-worker-async-node/test.filter.js +++ b/test/configCases/worker/node-worker-async-node/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker-async-node/webpack.config.js b/test/configCases/worker/node-worker-async-node/webpack.config.js index e12e3859b22..addfe94c63a 100644 --- a/test/configCases/worker/node-worker-async-node/webpack.config.js +++ b/test/configCases/worker/node-worker-async-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "async-node14", diff --git a/test/configCases/worker/node-worker-esm-class-worker/chunk.js b/test/configCases/worker/node-worker-esm-class-worker/chunk.js new file mode 100644 index 00000000000..2c52aca6628 --- /dev/null +++ b/test/configCases/worker/node-worker-esm-class-worker/chunk.js @@ -0,0 +1,3 @@ +export function getMessage(msg) { + return msg + " from worker with ESM import"; +} diff --git a/test/configCases/worker/node-worker-esm-class-worker/index.js b/test/configCases/worker/node-worker-esm-class-worker/index.js new file mode 100644 index 00000000000..3e54ccf8c90 --- /dev/null +++ b/test/configCases/worker/node-worker-esm-class-worker/index.js @@ -0,0 +1,17 @@ +import { Worker } from "worker_threads"; + +it("should support class worker chunk in Node.js", async () => { + const worker = new Worker(new URL("./worker.js" + __resourceQuery, import.meta.url)); + + const promise = new Promise((resolve, reject) => { + worker.on("message", resolve); + worker.on("error", reject); + }); + + worker.postMessage("hello"); + + const result = await promise; + expect(result).toBe("hello from worker with ESM import"); + + await worker.terminate(); +}); diff --git a/test/configCases/worker/node-worker-esm-class-worker/test.config.js b/test/configCases/worker/node-worker-esm-class-worker/test.config.js new file mode 100644 index 00000000000..b850ec8e5ad --- /dev/null +++ b/test/configCases/worker/node-worker-esm-class-worker/test.config.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = { + findBundle() { + return "./bundle.mjs"; + }, + moduleScope(scope) { + scope.URL = URL; + } +}; diff --git a/test/configCases/worker/node-worker-esm-class-worker/test.filter.js b/test/configCases/worker/node-worker-esm-class-worker/test.filter.js new file mode 100644 index 00000000000..fc9b5e2ce0d --- /dev/null +++ b/test/configCases/worker/node-worker-esm-class-worker/test.filter.js @@ -0,0 +1,5 @@ +"use strict"; + +const supportsWorker = require("../../../helpers/supportsWorker"); + +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker-esm-class-worker/webpack.config.js b/test/configCases/worker/node-worker-esm-class-worker/webpack.config.js new file mode 100644 index 00000000000..b95db4679db --- /dev/null +++ b/test/configCases/worker/node-worker-esm-class-worker/webpack.config.js @@ -0,0 +1,17 @@ +"use strict"; + +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "node14", + entry: "./index.js", + optimization: { + chunkIds: "named" + }, + output: { + module: true, + filename: "bundle.mjs" + }, + experiments: { + outputModule: true + } +}; diff --git a/test/configCases/worker/node-worker-esm-class-worker/worker.js b/test/configCases/worker/node-worker-esm-class-worker/worker.js new file mode 100644 index 00000000000..839478a5e7f --- /dev/null +++ b/test/configCases/worker/node-worker-esm-class-worker/worker.js @@ -0,0 +1,8 @@ +const { parentPort } = require("worker_threads"); + +const { getMessage } = require("./chunk.js"); + +parentPort.on("message", (msg) => { + // Worker with ESM import + parentPort.postMessage(getMessage(msg)); +}); diff --git a/test/configCases/worker/node-worker-esm/test.config.js b/test/configCases/worker/node-worker-esm/test.config.js index b048fb04eba..e83f922621b 100644 --- a/test/configCases/worker/node-worker-esm/test.config.js +++ b/test/configCases/worker/node-worker-esm/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/test/configCases/worker/node-worker-esm/test.filter.js b/test/configCases/worker/node-worker-esm/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/node-worker-esm/test.filter.js +++ b/test/configCases/worker/node-worker-esm/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker-esm/webpack.config.js b/test/configCases/worker/node-worker-esm/webpack.config.js index 7186e0febf4..b95db4679db 100644 --- a/test/configCases/worker/node-worker-esm/webpack.config.js +++ b/test/configCases/worker/node-worker-esm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { target: "node14", diff --git a/test/configCases/worker/node-worker-hmr/test.config.js b/test/configCases/worker/node-worker-hmr/test.config.js index d0b177310f8..5daf817c156 100644 --- a/test/configCases/worker/node-worker-hmr/test.config.js +++ b/test/configCases/worker/node-worker-hmr/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["a.js", "b.js", "c.js", "d.js"]; diff --git a/test/configCases/worker/node-worker-hmr/test.filter.js b/test/configCases/worker/node-worker-hmr/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/node-worker-hmr/test.filter.js +++ b/test/configCases/worker/node-worker-hmr/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker-hmr/webpack.config.js b/test/configCases/worker/node-worker-hmr/webpack.config.js index 8ebca110d29..954614a3751 100644 --- a/test/configCases/worker/node-worker-hmr/webpack.config.js +++ b/test/configCases/worker/node-worker-hmr/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ @@ -9,7 +11,10 @@ module.exports = { d: { import: "./index.js?d", filename: "[name].js" } }, output: { - filename: "[name].[contenthash].js" + filename: "[name].[contenthash].js", + environment: { + nodePrefixForCoreModules: false + } }, plugins: [new webpack.HotModuleReplacementPlugin()] }; diff --git a/test/configCases/worker/node-worker-named/test.config.js b/test/configCases/worker/node-worker-named/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/worker/node-worker-named/test.config.js +++ b/test/configCases/worker/node-worker-named/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/worker/node-worker-named/test.filter.js b/test/configCases/worker/node-worker-named/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/node-worker-named/test.filter.js +++ b/test/configCases/worker/node-worker-named/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker-named/webpack.config.js b/test/configCases/worker/node-worker-named/webpack.config.js index 0c85320bdd3..9849d6a24b2 100644 --- a/test/configCases/worker/node-worker-named/webpack.config.js +++ b/test/configCases/worker/node-worker-named/webpack.config.js @@ -1,6 +1,11 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { - filename: "[name].js" + filename: "[name].js", + environment: { + nodePrefixForCoreModules: false + } } }; diff --git a/test/configCases/worker/node-worker-require/chunk.js b/test/configCases/worker/node-worker-require/chunk.js new file mode 100644 index 00000000000..2c52aca6628 --- /dev/null +++ b/test/configCases/worker/node-worker-require/chunk.js @@ -0,0 +1,3 @@ +export function getMessage(msg) { + return msg + " from worker with ESM import"; +} diff --git a/test/configCases/worker/node-worker-require/index.js b/test/configCases/worker/node-worker-require/index.js new file mode 100644 index 00000000000..55035f56b64 --- /dev/null +++ b/test/configCases/worker/node-worker-require/index.js @@ -0,0 +1,22 @@ +import { Worker } from "worker_threads"; + +it("should support ESM worker chunks in Node.js", async () => { + const worker = new Worker( + new URL("./worker.js" + __resourceQuery, import.meta.url), + { + type: "module" + } + ); + + const promise = new Promise((resolve, reject) => { + worker.on("message", resolve); + worker.on("error", reject); + }); + + worker.postMessage("hello"); + + const result = await promise; + expect(result).toBe("hello from worker with ESM import"); + + await worker.terminate(); +}); diff --git a/test/configCases/worker/node-worker-require/test.config.js b/test/configCases/worker/node-worker-require/test.config.js new file mode 100644 index 00000000000..0e90f9b43a6 --- /dev/null +++ b/test/configCases/worker/node-worker-require/test.config.js @@ -0,0 +1,22 @@ +"use strict"; + +const fs = require("fs"); +const path = require("path"); + +module.exports = { + findBundle() { + return "./bundle.js"; + }, + afterExecute(options) { + const workerCode = fs.readFileSync( + path.resolve(options.output.path, "./worker_js.bundle.js"), + "utf8" + ); + + if (!/require\(\) chunk loading for javascript/.test(workerCode)) { + throw new Error( + "require was not found in the worker code for loading async chunks" + ); + } + } +}; diff --git a/test/configCases/worker/node-worker-require/test.filter.js b/test/configCases/worker/node-worker-require/test.filter.js new file mode 100644 index 00000000000..fc9b5e2ce0d --- /dev/null +++ b/test/configCases/worker/node-worker-require/test.filter.js @@ -0,0 +1,5 @@ +"use strict"; + +const supportsWorker = require("../../../helpers/supportsWorker"); + +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker-require/webpack.config.js b/test/configCases/worker/node-worker-require/webpack.config.js new file mode 100644 index 00000000000..22d8316a035 --- /dev/null +++ b/test/configCases/worker/node-worker-require/webpack.config.js @@ -0,0 +1,14 @@ +"use strict"; + +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "async-node14", + entry: "./index.js", + optimization: { + chunkIds: "named" + }, + output: { + filename: "bundle.js", + workerChunkLoading: "require" + } +}; diff --git a/test/configCases/worker/node-worker-require/worker.js b/test/configCases/worker/node-worker-require/worker.js new file mode 100644 index 00000000000..7db06d04718 --- /dev/null +++ b/test/configCases/worker/node-worker-require/worker.js @@ -0,0 +1,8 @@ +import { parentPort } from "worker_threads"; + +const { getMessage } = await import("./chunk.js"); + +parentPort.on("message", (msg) => { + // Worker with ESM import + parentPort.postMessage(getMessage(msg)); +}); diff --git a/test/configCases/worker/node-worker/test.config.js b/test/configCases/worker/node-worker/test.config.js index d0b177310f8..5daf817c156 100644 --- a/test/configCases/worker/node-worker/test.config.js +++ b/test/configCases/worker/node-worker/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["a.js", "b.js", "c.js", "d.js"]; diff --git a/test/configCases/worker/node-worker/test.filter.js b/test/configCases/worker/node-worker/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/node-worker/test.filter.js +++ b/test/configCases/worker/node-worker/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker/webpack.config.js b/test/configCases/worker/node-worker/webpack.config.js index abfa199650d..fe9fca45005 100644 --- a/test/configCases/worker/node-worker/webpack.config.js +++ b/test/configCases/worker/node-worker/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { @@ -7,6 +9,9 @@ module.exports = { d: { import: "./index.js?d", filename: "[name].js" } }, output: { - filename: "[name].[contenthash].js" + filename: "[name].[contenthash].js", + environment: { + nodePrefixForCoreModules: false + } } }; diff --git a/test/configCases/worker/self-import/test.config.js b/test/configCases/worker/self-import/test.config.js index 792e0848ff5..55df512ffe8 100644 --- a/test/configCases/worker/self-import/test.config.js +++ b/test/configCases/worker/self-import/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle(i) { switch (i) { diff --git a/test/configCases/worker/self-import/test.filter.js b/test/configCases/worker/self-import/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/self-import/test.filter.js +++ b/test/configCases/worker/self-import/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/self-import/warnings.js b/test/configCases/worker/self-import/warnings.js index 67303cafa97..e77648b6927 100644 --- a/test/configCases/worker/self-import/warnings.js +++ b/test/configCases/worker/self-import/warnings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ /This prevents using hashes of each other and should be avoided/, /This prevents using hashes of each other and should be avoided/, diff --git a/test/configCases/worker/self-import/webpack.config.js b/test/configCases/worker/self-import/webpack.config.js index 5788102325a..22bcc176ccd 100644 --- a/test/configCases/worker/self-import/webpack.config.js +++ b/test/configCases/worker/self-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/worker/universal/test.config.js b/test/configCases/worker/universal/test.config.js index 61de36bb639..2f51b4690b5 100644 --- a/test/configCases/worker/universal/test.config.js +++ b/test/configCases/worker/universal/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope, options) { if (options.name.includes("node")) { diff --git a/test/configCases/worker/universal/test.filter.js b/test/configCases/worker/universal/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/universal/test.filter.js +++ b/test/configCases/worker/universal/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/universal/webpack.config.js b/test/configCases/worker/universal/webpack.config.js index 583e26debb0..5b5a24139fb 100644 --- a/test/configCases/worker/universal/webpack.config.js +++ b/test/configCases/worker/universal/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = [ { diff --git a/test/configCases/worker/web-worker/test.config.js b/test/configCases/worker/web-worker/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/worker/web-worker/test.config.js +++ b/test/configCases/worker/web-worker/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/worker/web-worker/test.filter.js b/test/configCases/worker/web-worker/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/web-worker/test.filter.js +++ b/test/configCases/worker/web-worker/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/web-worker/webpack.config.js b/test/configCases/worker/web-worker/webpack.config.js index 64e7c138734..46691b4f766 100644 --- a/test/configCases/worker/web-worker/webpack.config.js +++ b/test/configCases/worker/web-worker/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/worker/worker-contenthash/test.config.js b/test/configCases/worker/worker-contenthash/test.config.js index 78a59a58887..a8755bed92f 100644 --- a/test/configCases/worker/worker-contenthash/test.config.js +++ b/test/configCases/worker/worker-contenthash/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { findBundle() { return ["main.js"]; diff --git a/test/configCases/worker/worker-contenthash/test.filter.js b/test/configCases/worker/worker-contenthash/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/configCases/worker/worker-contenthash/test.filter.js +++ b/test/configCases/worker/worker-contenthash/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/worker-contenthash/webpack.config.js b/test/configCases/worker/worker-contenthash/webpack.config.js index 9b0fd61b3fd..16e562cd7a2 100644 --- a/test/configCases/worker/worker-contenthash/webpack.config.js +++ b/test/configCases/worker/worker-contenthash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { @@ -7,6 +9,9 @@ module.exports = { } }, output: { - filename: "[name]-[contenthash].js" + filename: "[name]-[contenthash].js", + environment: { + nodePrefixForCoreModules: false + } } }; diff --git a/test/configCases/worker/worklet/test.config.js b/test/configCases/worker/worklet/test.config.js index 081778fc932..23fbd56e879 100644 --- a/test/configCases/worker/worklet/test.config.js +++ b/test/configCases/worker/worklet/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + let outputDirectory; module.exports = { @@ -10,19 +12,19 @@ module.exports = { scope.AudioContext = class AudioContext { constructor() { this.audioWorklet = { - addModule: url => Promise.resolve(FakeWorker.bind(null, url)) + addModule: (url) => Promise.resolve(FakeWorker.bind(null, url)) }; } }; scope.CSS = { paintWorklet: { - addModule: url => Promise.resolve(FakeWorker.bind(null, url)) + addModule: (url) => Promise.resolve(FakeWorker.bind(null, url)) }, layoutWorklet: { - addModule: url => Promise.resolve(FakeWorker.bind(null, url)) + addModule: (url) => Promise.resolve(FakeWorker.bind(null, url)) }, animationWorklet: { - addModule: url => Promise.resolve(FakeWorker.bind(null, url)) + addModule: (url) => Promise.resolve(FakeWorker.bind(null, url)) } }; }, diff --git a/test/configCases/worker/worklet/test.filter.js b/test/configCases/worker/worklet/test.filter.js index 0d61f042810..c7acb2017ba 100644 --- a/test/configCases/worker/worklet/test.filter.js +++ b/test/configCases/worker/worklet/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); const supportsWorker = require("../../../helpers/supportsWorker"); diff --git a/test/configCases/worker/worklet/webpack.config.js b/test/configCases/worker/worklet/webpack.config.js index e0dc1ca5069..a20d911d8dc 100644 --- a/test/configCases/worker/worklet/webpack.config.js +++ b/test/configCases/worker/worklet/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/deterministicGrouping.unittest.js b/test/deterministicGrouping.unittest.js index 3f36da343f3..e91d65c48c3 100644 --- a/test/deterministicGrouping.unittest.js +++ b/test/deterministicGrouping.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const deterministicGrouping = require("../lib/util/deterministicGrouping"); describe("deterministicGrouping", () => { @@ -8,7 +10,10 @@ describe("deterministicGrouping", () => { maxSize, getKey: ([key]) => `${100000 + key}`, getSize: ([, size]) => size - }).map(group => ({ items: group.items.map(([i]) => i), size: group.size })); + }).map((group) => ({ + items: group.items.map(([i]) => i), + size: group.size + })); it("should split large chunks with different size types", () => { expect( diff --git a/test/helpers/CurrentScript.js b/test/helpers/CurrentScript.js index 8feb610b6bd..c902351a6d5 100644 --- a/test/helpers/CurrentScript.js +++ b/test/helpers/CurrentScript.js @@ -1,3 +1,5 @@ +"use strict"; + class CurrentScript { constructor(path = "", type = "text/javascript") { this.src = `https://test.cases/path/${path}index.js`; diff --git a/test/helpers/EventSourceForNode.js b/test/helpers/EventSourceForNode.js index c9e21fdeb8e..a05f1e55cb2 100644 --- a/test/helpers/EventSourceForNode.js +++ b/test/helpers/EventSourceForNode.js @@ -17,14 +17,14 @@ module.exports = class EventSource { rejectUnauthorized: false, headers: { accept: "text/event-stream" } }, - res => { + (res) => { this.response = res; - res.on("error", err => { + res.on("error", (err) => { if (this.onerror) this.onerror(err); }); } ); - request.on("error", err => { + request.on("error", (err) => { if (this.onerror) this.onerror({ message: err }); }); request.end(); diff --git a/test/helpers/FakeDocument.js b/test/helpers/FakeDocument.js index a50bd6187a4..bad1d4e8192 100644 --- a/test/helpers/FakeDocument.js +++ b/test/helpers/FakeDocument.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); @@ -212,7 +214,7 @@ class FakeSheet { let currentRule = { getPropertyValue }; let selector; let last = 0; - const processDeclaration = str => { + const processDeclaration = (str) => { const colon = str.indexOf(":"); if (colon > 0) { const property = str.slice(0, colon).trim(); diff --git a/test/helpers/LogTestPlugin.js b/test/helpers/LogTestPlugin.js index 1af54c1d6e3..18b80e102cf 100644 --- a/test/helpers/LogTestPlugin.js +++ b/test/helpers/LogTestPlugin.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../").Compiler} Compiler */ /** @typedef {import("../../").Compilation} Compilation */ @@ -16,7 +18,7 @@ module.exports = class LogTestPlugin { /** * @param {ReturnType} logger logger */ - const logSome = logger => { + const logSome = (logger) => { logger.group("Group"); if (!this.noTraced) { logger.error("Error"); @@ -36,7 +38,7 @@ module.exports = class LogTestPlugin { logger.log("End"); }; logSome(compiler.getInfrastructureLogger("LogTestPlugin")); - compiler.hooks.compilation.tap("LogTestPlugin", compilation => { + compiler.hooks.compilation.tap("LogTestPlugin", (compilation) => { const logger = compilation.getLogger("LogTestPlugin"); logSome(logger); diff --git a/test/helpers/PluginEnvironment.js b/test/helpers/PluginEnvironment.js index 15df146259d..2dbca35c93b 100644 --- a/test/helpers/PluginEnvironment.js +++ b/test/helpers/PluginEnvironment.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function PluginEnvironment() { /** * @type {{ name: string, handler: EXPECTED_FUNCTION }[]} @@ -22,7 +24,7 @@ module.exports = function PluginEnvironment() { function getEventName(hookName) { // Convert a hook name to an event name. // e.g. `buildModule` -> `build-module` - return hookName.replace(/[A-Z]/g, c => `-${c.toLowerCase()}`); + return hookName.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`); } this.getEnvironmentStub = function getEnvironmentStub() { diff --git a/test/helpers/applyPluginWithOptions.js b/test/helpers/applyPluginWithOptions.js index 423935afbc4..74c245f610c 100644 --- a/test/helpers/applyPluginWithOptions.js +++ b/test/helpers/applyPluginWithOptions.js @@ -1,3 +1,5 @@ +"use strict"; + const PluginEnvironment = require("./PluginEnvironment"); module.exports = function applyPluginWithOptions(Plugin) { diff --git a/test/helpers/asModule.js b/test/helpers/asModule.js index 1598ce06d13..bc974d781a6 100644 --- a/test/helpers/asModule.js +++ b/test/helpers/asModule.js @@ -1,3 +1,5 @@ +"use strict"; + const vm = require("vm"); const SYNTHETIC_MODULES_STORE = "__SYNTHETIC_MODULES_STORE"; @@ -13,7 +15,7 @@ module.exports = async (something, context, unlinked) => { context[SYNTHETIC_MODULES_STORE].push(something); const code = [...new Set(["default", ...Object.keys(something)])] .map( - name => + (name) => `const _${name} = ${SYNTHETIC_MODULES_STORE}[${i}]${ name === "default" ? "" : `[${JSON.stringify(name)}]` }; export { _${name} as ${name}};` diff --git a/test/helpers/captureStdio.js b/test/helpers/captureStdio.js index 3d616760a52..8082712fd21 100644 --- a/test/helpers/captureStdio.js +++ b/test/helpers/captureStdio.js @@ -1,3 +1,5 @@ +"use strict"; + const stripVTControlCharacters = require("strip-ansi"); module.exports = (stdio, tty) => { diff --git a/test/helpers/createFakeWorker.js b/test/helpers/createFakeWorker.js index d2fbadf6054..52b0ec613c7 100644 --- a/test/helpers/createFakeWorker.js +++ b/test/helpers/createFakeWorker.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = ({ outputDirectory }) => @@ -102,7 +104,7 @@ if (${options.type === "module"}) { if (this._onmessage) this.worker.off("message", this._onmessage); this.worker.on( "message", - (this._onmessage = data => { + (this._onmessage = (data) => { value({ data }); diff --git a/test/helpers/createLazyTestEnv.js b/test/helpers/createLazyTestEnv.js index afb9ed0a480..f538d852b39 100644 --- a/test/helpers/createLazyTestEnv.js +++ b/test/helpers/createLazyTestEnv.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = (globalTimeout = 2000, nameSuffix = "") => { const state = global.JEST_STATE_SYMBOL; let currentDescribeBlock; @@ -11,7 +13,7 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => { if (!fn) return null; const rfn = fn.length >= 1 - ? done => { + ? (done) => { fn((...args) => { if (isTest) runTests++; done(...args); @@ -35,7 +37,7 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => { it("should run the exported tests", () => { runTests++; }); - afterAll(done => { + afterAll((done) => { for (const dispose of disposables) { dispose(); } @@ -46,7 +48,7 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => { } ); let numberOfTests = 0; - const inSuite = fn => { + const inSuite = (fn) => { const { currentDescribeBlock: oldCurrentDescribeBlock, currentlyRunningTest: oldCurrentlyRunningTest, @@ -69,7 +71,7 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => { state.currentlyRunningTest = oldCurrentlyRunningTest; state.hasStarted = oldHasStarted; }; - const fixAsyncError = block => { + const fixAsyncError = (block) => { // By default jest leaks memory as it stores asyncError // for each "it" call to track the origin test suite // We want to evaluate this early here to avoid leaking memory diff --git a/test/helpers/currentWatchStep.js b/test/helpers/currentWatchStep.js index b3aa4dfc86b..6bdad38e577 100644 --- a/test/helpers/currentWatchStep.js +++ b/test/helpers/currentWatchStep.js @@ -1 +1,3 @@ +"use strict"; + module.exports.step = undefined; diff --git a/test/helpers/expectSource.js b/test/helpers/expectSource.js index 116216ca59c..92ed29a12ca 100644 --- a/test/helpers/expectSource.js +++ b/test/helpers/expectSource.js @@ -1,3 +1,5 @@ +"use strict"; + const regexEscape = require("./regexEscape"); // These expect* methods are necessary because 'source' contains the code for this test file, which will always contain the string diff --git a/test/helpers/expectWarningFactory.js b/test/helpers/expectWarningFactory.js index 7f0fda512f8..21522235f41 100644 --- a/test/helpers/expectWarningFactory.js +++ b/test/helpers/expectWarningFactory.js @@ -1,21 +1,23 @@ +"use strict"; + module.exports = () => { const warnings = []; let oldWarn; - beforeEach(done => { + beforeEach((done) => { oldWarn = console.warn; - console.warn = m => warnings.push(m); + console.warn = (m) => warnings.push(m); done(); }); - afterEach(done => { + afterEach((done) => { expectWarning(); console.warn = oldWarn; done(); }); const expectWarning = (...regexp) => { - expect(warnings).toEqual(regexp.map(r => expect.stringMatching(r))); + expect(warnings).toEqual(regexp.map((r) => expect.stringMatching(r))); warnings.length = 0; }; diff --git a/test/helpers/fakeSystem.js b/test/helpers/fakeSystem.js index cb0c2bafaa0..0964685c7e5 100644 --- a/test/helpers/fakeSystem.js +++ b/test/helpers/fakeSystem.js @@ -1,3 +1,5 @@ +"use strict"; + const System = { register: (name, deps, fn) => { if (!System.registry) { @@ -12,7 +14,7 @@ const System = { fn = deps; deps = []; } - const dynamicExport = result => { + const dynamicExport = (result) => { if (System.registry[name] !== entry) { throw new Error(`Module ${name} calls dynamicExport too late`); } @@ -72,10 +74,10 @@ const System = { registry: undefined, _require: undefined, _nextName: "(anonym)", - setRequire: req => { + setRequire: (req) => { System._require = req; }, - init: modules => { + init: (modules) => { System.registry = {}; if (modules) { for (const name of Object.keys(modules)) { @@ -86,13 +88,13 @@ const System = { } } }, - execute: name => { + execute: (name) => { const m = System.registry[name]; if (!m) throw new Error(`Module ${name} not registered`); if (m.executed) throw new Error(`Module ${name} was already executed`); return System.ensureExecuted(name); }, - ensureExecuted: name => { + ensureExecuted: (name) => { let m = System.registry[name]; if (!m && System._require) { const oldName = System._nextName; diff --git a/test/helpers/findOutputFiles.js b/test/helpers/findOutputFiles.js index 4bbe2b01bce..cae5037fc2f 100644 --- a/test/helpers/findOutputFiles.js +++ b/test/helpers/findOutputFiles.js @@ -14,5 +14,5 @@ module.exports = function findOutputFiles(options, regexp, subpath) { subpath ? path.join(options.output.path, subpath) : options.output.path ); - return files.filter(file => regexp.test(file)); + return files.filter((file) => regexp.test(file)); }; diff --git a/test/helpers/prepareOptions.js b/test/helpers/prepareOptions.js index 637f69d9c30..f25929effcb 100644 --- a/test/helpers/prepareOptions.js +++ b/test/helpers/prepareOptions.js @@ -1,6 +1,6 @@ "use strict"; -const handleExport = options => { +const handleExport = (options) => { const isES6DefaultExported = typeof options === "object" && options !== null && @@ -22,7 +22,7 @@ module.exports = (options, argv) => { options = handleExport(options); options = Array.isArray(options) - ? options.map(_options => handleFunction(_options, argv)) + ? options.map((_options) => handleFunction(_options, argv)) : handleFunction(options, argv); return options; }; diff --git a/test/helpers/regexEscape.js b/test/helpers/regexEscape.js index 11f4b6f003a..33b2ea7692f 100644 --- a/test/helpers/regexEscape.js +++ b/test/helpers/regexEscape.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function regexEscape(string) { return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string }; diff --git a/test/helpers/remove.js b/test/helpers/remove.js index 54825e28ec3..deb1733d35b 100644 --- a/test/helpers/remove.js +++ b/test/helpers/remove.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/test/helpers/supportDefaultAssignment.js b/test/helpers/supportDefaultAssignment.js index abfabbe1e9b..98ac25f4e0a 100644 --- a/test/helpers/supportDefaultAssignment.js +++ b/test/helpers/supportDefaultAssignment.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportDefaultAssignment() { try { // eslint-disable-next-line no-unused-vars diff --git a/test/helpers/supportsAggregateError.js b/test/helpers/supportsAggregateError.js index b1a1952ea5b..a5788ec9222 100644 --- a/test/helpers/supportsAggregateError.js +++ b/test/helpers/supportsAggregateError.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsAggregateError() { return typeof AggregateError !== "undefined"; }; diff --git a/test/helpers/supportsArrowFunctionExpression.js b/test/helpers/supportsArrowFunctionExpression.js index c60dc2ee95e..768a42319c3 100644 --- a/test/helpers/supportsArrowFunctionExpression.js +++ b/test/helpers/supportsArrowFunctionExpression.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportArrowFunctionExpression() { try { eval( diff --git a/test/helpers/supportsAsync.js b/test/helpers/supportsAsync.js index ea517ad37b9..1b6e2ae992a 100644 --- a/test/helpers/supportsAsync.js +++ b/test/helpers/supportsAsync.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsAsync() { // Node.js@10 has a bug with nested async/await if (process.version.startsWith("v10.")) { diff --git a/test/helpers/supportsBlob.js b/test/helpers/supportsBlob.js index 8f6c80fb0ff..a7793768aa0 100644 --- a/test/helpers/supportsBlob.js +++ b/test/helpers/supportsBlob.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsBlob() { try { return typeof Blob !== "undefined"; diff --git a/test/helpers/supportsBlockScoping.js b/test/helpers/supportsBlockScoping.js index 3e2b0d260c4..7d9e0023830 100644 --- a/test/helpers/supportsBlockScoping.js +++ b/test/helpers/supportsBlockScoping.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsBlockScoping() { try { const f = eval( diff --git a/test/helpers/supportsClassFields.js b/test/helpers/supportsClassFields.js index ebb848a4688..97cf0e36a9c 100644 --- a/test/helpers/supportsClassFields.js +++ b/test/helpers/supportsClassFields.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsES6() { try { eval("class A { #field = 1 }"); diff --git a/test/helpers/supportsClassStaticBlock.js b/test/helpers/supportsClassStaticBlock.js index 75c891caf33..5a572df7b3d 100644 --- a/test/helpers/supportsClassStaticBlock.js +++ b/test/helpers/supportsClassStaticBlock.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsClassStaticBLock() { try { eval("(function f({x, y}) { class Foo { static {} } })"); diff --git a/test/helpers/supportsDefaultArgs.js b/test/helpers/supportsDefaultArgs.js index d637725dc4f..dc1e9f8deda 100644 --- a/test/helpers/supportsDefaultArgs.js +++ b/test/helpers/supportsDefaultArgs.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsDefaultArgs() { try { const f = eval("(function f(a = 123) { return a; })"); diff --git a/test/helpers/supportsES6.js b/test/helpers/supportsES6.js index fc00740a40b..50ebfe0af7c 100644 --- a/test/helpers/supportsES6.js +++ b/test/helpers/supportsES6.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsES6() { try { eval("class A {}"); diff --git a/test/helpers/supportsErrorCause.js b/test/helpers/supportsErrorCause.js index 84384a28793..3a67afe4c59 100644 --- a/test/helpers/supportsErrorCause.js +++ b/test/helpers/supportsErrorCause.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsErrorCause() { return ( typeof new Error("test", { cause: new Error("cause") }).cause !== diff --git a/test/helpers/supportsForOf.js b/test/helpers/supportsForOf.js index 01d04046331..44abe3272d7 100644 --- a/test/helpers/supportsForOf.js +++ b/test/helpers/supportsForOf.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportDefaultAssignment() { try { const f = eval("(function f() { for(var x of ['ok', 'fail']) return x; })"); diff --git a/test/helpers/supportsIteratorDestructuring.js b/test/helpers/supportsIteratorDestructuring.js index 88b9985a6e8..e0417d43f98 100644 --- a/test/helpers/supportsIteratorDestructuring.js +++ b/test/helpers/supportsIteratorDestructuring.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsIteratorDestructuring() { try { const f = eval("(function f([, x, ...y]) { return x; })"); diff --git a/test/helpers/supportsLogicalAssignment.js b/test/helpers/supportsLogicalAssignment.js index 2b85e0d38cc..d3720c94110 100644 --- a/test/helpers/supportsLogicalAssignment.js +++ b/test/helpers/supportsLogicalAssignment.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsLogicalAssignment() { try { const f = eval( diff --git a/test/helpers/supportsNodePrefix.js b/test/helpers/supportsNodePrefix.js new file mode 100644 index 00000000000..5768b441d4d --- /dev/null +++ b/test/helpers/supportsNodePrefix.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = function supportsNodePrefix() { + try { + eval("require('node:path')"); + return true; + } catch (_err) { + // Ignore + } + + return false; +}; diff --git a/test/helpers/supportsNullishCoalescing.js b/test/helpers/supportsNullishCoalescing.js index 370414f14ad..a5fbebe5034 100644 --- a/test/helpers/supportsNullishCoalescing.js +++ b/test/helpers/supportsNullishCoalescing.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsNullishCoalescing() { try { const f = eval("(function f() { return null ?? true; })"); diff --git a/test/helpers/supportsObjectDestructuring.js b/test/helpers/supportsObjectDestructuring.js index 809f56edb29..edb51bb1ae4 100644 --- a/test/helpers/supportsObjectDestructuring.js +++ b/test/helpers/supportsObjectDestructuring.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsObjectDestructuring() { try { const f = eval("(function f({x, y}) { return x + y; })"); diff --git a/test/helpers/supportsOptionalCatchBinding.js b/test/helpers/supportsOptionalCatchBinding.js index 673ee569932..cb5bca9facd 100644 --- a/test/helpers/supportsOptionalCatchBinding.js +++ b/test/helpers/supportsOptionalCatchBinding.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsOptionalCatchBinding() { try { eval("try {} catch {}"); diff --git a/test/helpers/supportsOptionalChaining.js b/test/helpers/supportsOptionalChaining.js index f0531bca89d..199ee0d5a57 100644 --- a/test/helpers/supportsOptionalChaining.js +++ b/test/helpers/supportsOptionalChaining.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsOptionalChaining() { try { const f = eval("(function f() { return ({a: true}) ?.a })"); diff --git a/test/helpers/supportsRequireInModule.js b/test/helpers/supportsRequireInModule.js index 74fe986b21f..d37658c4494 100644 --- a/test/helpers/supportsRequireInModule.js +++ b/test/helpers/supportsRequireInModule.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsRequireInModule() { return Boolean(require("module").createRequire); }; diff --git a/test/helpers/supportsResponse.js b/test/helpers/supportsResponse.js index ddb479d7a56..57658d8a443 100644 --- a/test/helpers/supportsResponse.js +++ b/test/helpers/supportsResponse.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsResponse() { try { return typeof Response !== "undefined"; diff --git a/test/helpers/supportsSpread.js b/test/helpers/supportsSpread.js index 05ecd49306d..600850b7606 100644 --- a/test/helpers/supportsSpread.js +++ b/test/helpers/supportsSpread.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsSpread() { try { const x = { a: true }; diff --git a/test/helpers/supportsTemplateStrings.js b/test/helpers/supportsTemplateStrings.js index f5ab91b2c56..d7fae89466e 100644 --- a/test/helpers/supportsTemplateStrings.js +++ b/test/helpers/supportsTemplateStrings.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsTemplateStrings() { try { const f = eval("(function f() { return String.raw`a\\b`; })"); diff --git a/test/helpers/supportsUsing.js b/test/helpers/supportsUsing.js index b7dd79ebfd3..ceaf3194924 100644 --- a/test/helpers/supportsUsing.js +++ b/test/helpers/supportsUsing.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsUsing() { try { const f = eval(`(function f() { diff --git a/test/helpers/supportsWebAssembly.js b/test/helpers/supportsWebAssembly.js index 0cdc04da30e..c81ab9606aa 100644 --- a/test/helpers/supportsWebAssembly.js +++ b/test/helpers/supportsWebAssembly.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function supportsWebAssembly() { try { return typeof WebAssembly !== "undefined"; diff --git a/test/helpers/supportsWorker.js b/test/helpers/supportsWorker.js index 590dc1b7f7d..90b02455033 100644 --- a/test/helpers/supportsWorker.js +++ b/test/helpers/supportsWorker.js @@ -1,3 +1,5 @@ +"use strict"; + const nodeVersion = process.versions.node.split(".").map(Number); module.exports = function supportsWorker() { diff --git a/test/helpers/warmup-webpack.js b/test/helpers/warmup-webpack.js index 1d465d08dff..92942e72b2b 100644 --- a/test/helpers/warmup-webpack.js +++ b/test/helpers/warmup-webpack.js @@ -1,5 +1,7 @@ +"use strict"; + describe("warmup", () => { - it("should warmup webpack", done => { + it("should warmup webpack", (done) => { /** @type {typeof import("../../") | undefined} */ let webpack = require("../../"); @@ -8,13 +10,13 @@ describe("warmup", () => { { entry: "data:text/javascript,import 'data:text/javascript,'", plugins: [ - c => + (c) => c.hooks.emit.tap("Warmup", () => { throw END; }) ] }, - err => { + (err) => { webpack = undefined; try { expect(err).toBe(END); diff --git a/test/hotCases/asset-modules-source/lazy-compilation/webpack.config.js b/test/hotCases/asset-modules-source/lazy-compilation/webpack.config.js index 231f79a619f..56253efb4de 100644 --- a/test/hotCases/asset-modules-source/lazy-compilation/webpack.config.js +++ b/test/hotCases/asset-modules-source/lazy-compilation/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { experiments: { diff --git a/test/hotCases/asset-modules-source/source/webpack.config.js b/test/hotCases/asset-modules-source/source/webpack.config.js index 25951fef2c8..6093c44ed68 100644 --- a/test/hotCases/asset-modules-source/source/webpack.config.js +++ b/test/hotCases/asset-modules-source/source/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/async-module/async-accept/index.js b/test/hotCases/async-module/async-accept/index.js new file mode 100644 index 00000000000..8a604011016 --- /dev/null +++ b/test/hotCases/async-module/async-accept/index.js @@ -0,0 +1,28 @@ +import update from "../../update"; +import a from "./module-a"; + +it("should support async accept", (done) => { + let test = 0; + expect(a).toEqual(1); + + import.meta.webpackHot.accept(["./module-a"], () => { + debugger + return new Promise((resolve) => { + setTimeout(() => { + debugger + test = 1; + resolve(); + }, 3000); + }); + }); + + NEXT(update(done)); + + import.meta.webpackHot.addStatusHandler((status) => { + if (status === "idle") { + expect(test).toEqual(1); + expect(a).toEqual(2); + done(); + } + }); +}); \ No newline at end of file diff --git a/test/hotCases/async-module/async-accept/module-a.js b/test/hotCases/async-module/async-accept/module-a.js new file mode 100644 index 00000000000..9bb32214bea --- /dev/null +++ b/test/hotCases/async-module/async-accept/module-a.js @@ -0,0 +1,3 @@ +export default 1; +--- +export default 2; \ No newline at end of file diff --git a/test/hotCases/chunks/initial-chunks-hmr/webpack.config.js b/test/hotCases/chunks/initial-chunks-hmr/webpack.config.js index a9292dcc395..4c1827c5960 100644 --- a/test/hotCases/chunks/initial-chunks-hmr/webpack.config.js +++ b/test/hotCases/chunks/initial-chunks-hmr/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "named", diff --git a/test/hotCases/chunks/split-chunks-webpackhot/webpack.config.js b/test/hotCases/chunks/split-chunks-webpackhot/webpack.config.js index f6b8531395b..dc6a8d361ec 100644 --- a/test/hotCases/chunks/split-chunks-webpackhot/webpack.config.js +++ b/test/hotCases/chunks/split-chunks-webpackhot/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { filename: "[name].js" diff --git a/test/hotCases/chunks/split-chunks/webpack.config.js b/test/hotCases/chunks/split-chunks/webpack.config.js index f6b8531395b..dc6a8d361ec 100644 --- a/test/hotCases/chunks/split-chunks/webpack.config.js +++ b/test/hotCases/chunks/split-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { filename: "[name].js" diff --git a/test/hotCases/chunks/update-chunk-loading-runtime/webpack.config.js b/test/hotCases/chunks/update-chunk-loading-runtime/webpack.config.js index fd272520e15..3bbf0a3697a 100644 --- a/test/hotCases/chunks/update-chunk-loading-runtime/webpack.config.js +++ b/test/hotCases/chunks/update-chunk-loading-runtime/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** * @param {{ config: import("../../../../").Configuration }} config configuration * @returns {import("../../../../").Configuration} configuration diff --git a/test/hotCases/code-generation/async-dependency-callback/index.js b/test/hotCases/code-generation/async-dependency-callback/index.js new file mode 100644 index 00000000000..066df28cd2f --- /dev/null +++ b/test/hotCases/code-generation/async-dependency-callback/index.js @@ -0,0 +1,13 @@ +import update from "../../update"; +import a from "./module"; + +it("should await an async dependency when callback is provided", (done) => { + expect(a).toEqual("a 1"); + + import.meta.webpackHot.accept("./module", () => { + expect(a).toEqual("a 2"); + done(); + }); + + NEXT(update(done)); +}); diff --git a/test/hotCases/code-generation/async-dependency-callback/module.js b/test/hotCases/code-generation/async-dependency-callback/module.js new file mode 100644 index 00000000000..8982171fb0b --- /dev/null +++ b/test/hotCases/code-generation/async-dependency-callback/module.js @@ -0,0 +1,3 @@ +export default await Promise.resolve("a 1"); +--- +export default await Promise.resolve("a 2"); diff --git a/test/hotCases/code-generation/async-dependency-multi-callback/index.js b/test/hotCases/code-generation/async-dependency-multi-callback/index.js new file mode 100644 index 00000000000..f68af6183cc --- /dev/null +++ b/test/hotCases/code-generation/async-dependency-multi-callback/index.js @@ -0,0 +1,16 @@ +import update from "../../update"; +import a from "./module-a"; +import b from "./module-b"; + +it("should await multiple async dependencies when callback is provided", (done) => { + expect(a).toEqual("a 1"); + expect(b).toEqual("b 1"); + + import.meta.webpackHot.accept(["./module-a", "./module-b"], () => { + expect(a).toEqual("a 2"); + expect(b).toEqual("b 2"); + done(); + }); + + NEXT(update(done)); +}); diff --git a/test/hotCases/code-generation/async-dependency-multi-callback/module-a.js b/test/hotCases/code-generation/async-dependency-multi-callback/module-a.js new file mode 100644 index 00000000000..8982171fb0b --- /dev/null +++ b/test/hotCases/code-generation/async-dependency-multi-callback/module-a.js @@ -0,0 +1,3 @@ +export default await Promise.resolve("a 1"); +--- +export default await Promise.resolve("a 2"); diff --git a/test/hotCases/code-generation/async-dependency-multi-callback/module-b.js b/test/hotCases/code-generation/async-dependency-multi-callback/module-b.js new file mode 100644 index 00000000000..19eb6104003 --- /dev/null +++ b/test/hotCases/code-generation/async-dependency-multi-callback/module-b.js @@ -0,0 +1,3 @@ +export default await Promise.resolve("b 1"); +--- +export default await Promise.resolve("b 2"); diff --git a/test/hotCases/code-generation/async-dependency-multi/index.js b/test/hotCases/code-generation/async-dependency-multi/index.js new file mode 100644 index 00000000000..39d27e5cf93 --- /dev/null +++ b/test/hotCases/code-generation/async-dependency-multi/index.js @@ -0,0 +1,20 @@ +import update from "../../update"; +import a from "./module-a"; +import b from "./module-b"; + +it("should await multiple async dependencies", (done) => { + expect(a).toEqual("a 1"); + expect(b).toEqual("b 1"); + + import.meta.webpackHot.accept(["./module-a", "./module-b"]); + + NEXT(update(done)); + + import.meta.webpackHot.addStatusHandler((status) => { + if (status === "idle") { + expect(a).toEqual("a 2"); + expect(b).toEqual("b 2"); + done(); + } + }); +}); diff --git a/test/hotCases/code-generation/async-dependency-multi/module-a.js b/test/hotCases/code-generation/async-dependency-multi/module-a.js new file mode 100644 index 00000000000..8982171fb0b --- /dev/null +++ b/test/hotCases/code-generation/async-dependency-multi/module-a.js @@ -0,0 +1,3 @@ +export default await Promise.resolve("a 1"); +--- +export default await Promise.resolve("a 2"); diff --git a/test/hotCases/code-generation/async-dependency-multi/module-b.js b/test/hotCases/code-generation/async-dependency-multi/module-b.js new file mode 100644 index 00000000000..19eb6104003 --- /dev/null +++ b/test/hotCases/code-generation/async-dependency-multi/module-b.js @@ -0,0 +1,3 @@ +export default await Promise.resolve("b 1"); +--- +export default await Promise.resolve("b 2"); diff --git a/test/hotCases/code-generation/async-dependency/index.js b/test/hotCases/code-generation/async-dependency/index.js new file mode 100644 index 00000000000..3fef7ae6b6a --- /dev/null +++ b/test/hotCases/code-generation/async-dependency/index.js @@ -0,0 +1,17 @@ +import update from "../../update"; +import a from "./module"; + +it("should await an async dependency", (done) => { + expect(a).toEqual("a 1"); + + import.meta.webpackHot.accept("./module"); + + NEXT(update(done)); + + import.meta.webpackHot.addStatusHandler((status) => { + if (status === "idle") { + expect(a).toEqual("a 2"); + done(); + } + }); +}); diff --git a/test/hotCases/code-generation/async-dependency/module.js b/test/hotCases/code-generation/async-dependency/module.js new file mode 100644 index 00000000000..8982171fb0b --- /dev/null +++ b/test/hotCases/code-generation/async-dependency/module.js @@ -0,0 +1,3 @@ +export default await Promise.resolve("a 1"); +--- +export default await Promise.resolve("a 2"); diff --git a/test/hotCases/css/css-modules/test.config.js b/test/hotCases/css/css-modules/test.config.js index 734eb19e218..c94209e745b 100644 --- a/test/hotCases/css/css-modules/test.config.js +++ b/test/hotCases/css/css-modules/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/hotCases/css/css-modules/webpack.config.js b/test/hotCases/css/css-modules/webpack.config.js index 14df4b56566..8a366ccd152 100644 --- a/test/hotCases/css/css-modules/webpack.config.js +++ b/test/hotCases/css/css-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/css/fetch-priority/test.config.js b/test/hotCases/css/fetch-priority/test.config.js index ce23192133c..6e8d95c693e 100644 --- a/test/hotCases/css/fetch-priority/test.config.js +++ b/test/hotCases/css/fetch-priority/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { env: "jsdom" }; diff --git a/test/hotCases/css/fetch-priority/webpack.config.js b/test/hotCases/css/fetch-priority/webpack.config.js index 14df4b56566..8a366ccd152 100644 --- a/test/hotCases/css/fetch-priority/webpack.config.js +++ b/test/hotCases/css/fetch-priority/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/css/imported-css/test.config.js b/test/hotCases/css/imported-css/test.config.js index ce23192133c..6e8d95c693e 100644 --- a/test/hotCases/css/imported-css/test.config.js +++ b/test/hotCases/css/imported-css/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { env: "jsdom" }; diff --git a/test/hotCases/css/imported-css/test.filter.js b/test/hotCases/css/imported-css/test.filter.js index c2410949472..94e49e42d68 100644 --- a/test/hotCases/css/imported-css/test.filter.js +++ b/test/hotCases/css/imported-css/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.target === "web"; +"use strict"; + +module.exports = (config) => config.target === "web"; diff --git a/test/hotCases/css/imported-css/webpack.config.js b/test/hotCases/css/imported-css/webpack.config.js index 14df4b56566..8a366ccd152 100644 --- a/test/hotCases/css/imported-css/webpack.config.js +++ b/test/hotCases/css/imported-css/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/css/single-css-entry/test.config.js b/test/hotCases/css/single-css-entry/test.config.js index ce23192133c..6e8d95c693e 100644 --- a/test/hotCases/css/single-css-entry/test.config.js +++ b/test/hotCases/css/single-css-entry/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { env: "jsdom" }; diff --git a/test/hotCases/css/single-css-entry/test.filter.js b/test/hotCases/css/single-css-entry/test.filter.js index c2410949472..94e49e42d68 100644 --- a/test/hotCases/css/single-css-entry/test.filter.js +++ b/test/hotCases/css/single-css-entry/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.target === "web"; +"use strict"; + +module.exports = (config) => config.target === "web"; diff --git a/test/hotCases/css/single-css-entry/webpack.config.js b/test/hotCases/css/single-css-entry/webpack.config.js index 62cd01bf74c..37a9505b531 100644 --- a/test/hotCases/css/single-css-entry/webpack.config.js +++ b/test/hotCases/css/single-css-entry/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ @@ -11,7 +13,7 @@ module.exports = { plugins: [ { apply(compiler) { - compiler.hooks.compilation.tap("Test", compilation => { + compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.additionalTreeRuntimeRequirements.tap( "Test", (module, set, _context) => { diff --git a/test/hotCases/css/vanilla/test.config.js b/test/hotCases/css/vanilla/test.config.js index 734eb19e218..c94209e745b 100644 --- a/test/hotCases/css/vanilla/test.config.js +++ b/test/hotCases/css/vanilla/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/hotCases/css/vanilla/webpack.config.js b/test/hotCases/css/vanilla/webpack.config.js index 1629277c043..c2c01cc2dc5 100644 --- a/test/hotCases/css/vanilla/webpack.config.js +++ b/test/hotCases/css/vanilla/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/css/with-lazy-compilation/test.filter.js b/test/hotCases/css/with-lazy-compilation/test.filter.js index c2410949472..94e49e42d68 100644 --- a/test/hotCases/css/with-lazy-compilation/test.filter.js +++ b/test/hotCases/css/with-lazy-compilation/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.target === "web"; +"use strict"; + +module.exports = (config) => config.target === "web"; diff --git a/test/hotCases/css/with-lazy-compilation/webpack.config.js b/test/hotCases/css/with-lazy-compilation/webpack.config.js index 01b5b906611..0028456b129 100644 --- a/test/hotCases/css/with-lazy-compilation/webpack.config.js +++ b/test/hotCases/css/with-lazy-compilation/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/disposing/runtime-independent-filename/webpack.config.js b/test/hotCases/disposing/runtime-independent-filename/webpack.config.js index 270d65696c7..9548f91f138 100644 --- a/test/hotCases/disposing/runtime-independent-filename/webpack.config.js +++ b/test/hotCases/disposing/runtime-independent-filename/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/hotCases/esm-output/async-chunks/webpack.config.js b/test/hotCases/esm-output/async-chunks/webpack.config.js index d877ef17c85..b499f3fa10e 100644 --- a/test/hotCases/esm-output/async-chunks/webpack.config.js +++ b/test/hotCases/esm-output/async-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/esm-output/css-modules/test.config.js b/test/hotCases/esm-output/css-modules/test.config.js index 734eb19e218..c94209e745b 100644 --- a/test/hotCases/esm-output/css-modules/test.config.js +++ b/test/hotCases/esm-output/css-modules/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope) { const link = scope.window.document.createElement("link"); diff --git a/test/hotCases/esm-output/css-modules/webpack.config.js b/test/hotCases/esm-output/css-modules/webpack.config.js index ef5dc7bd319..d1e659cef89 100644 --- a/test/hotCases/esm-output/css-modules/webpack.config.js +++ b/test/hotCases/esm-output/css-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/esm-output/runtime-chunk/webpack.config.js b/test/hotCases/esm-output/runtime-chunk/webpack.config.js index 43cb0766070..0f8db78a255 100644 --- a/test/hotCases/esm-output/runtime-chunk/webpack.config.js +++ b/test/hotCases/esm-output/runtime-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/esm-output/simple/webpack.config.js b/test/hotCases/esm-output/simple/webpack.config.js index d877ef17c85..b499f3fa10e 100644 --- a/test/hotCases/esm-output/simple/webpack.config.js +++ b/test/hotCases/esm-output/simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/esm-output/split-chunks/webpack.config.js b/test/hotCases/esm-output/split-chunks/webpack.config.js index 8093beac2b6..30844fdb945 100644 --- a/test/hotCases/esm-output/split-chunks/webpack.config.js +++ b/test/hotCases/esm-output/split-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../types").Configuration} */ module.exports = { mode: "development", diff --git a/test/hotCases/hashing/exports-info-influence/webpack.config.js b/test/hotCases/hashing/exports-info-influence/webpack.config.js index 02eaae9dc55..16e3b098f0a 100644 --- a/test/hotCases/hashing/exports-info-influence/webpack.config.js +++ b/test/hotCases/hashing/exports-info-influence/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { externals: { external: "var 'external'" diff --git a/test/hotCases/hashing/full-hash-main/webpack.config.js b/test/hotCases/hashing/full-hash-main/webpack.config.js index 81b44793745..d2e9a3b7c0e 100644 --- a/test/hotCases/hashing/full-hash-main/webpack.config.js +++ b/test/hotCases/hashing/full-hash-main/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { node: { __dirname: false diff --git a/test/hotCases/hashing/full-hash-syntax-error/webpack.config.js b/test/hotCases/hashing/full-hash-syntax-error/webpack.config.js index 43a1a24fd92..2b166fe309e 100644 --- a/test/hotCases/hashing/full-hash-syntax-error/webpack.config.js +++ b/test/hotCases/hashing/full-hash-syntax-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { node: { __dirname: false diff --git a/test/hotCases/json/error-in-json/errors.js b/test/hotCases/json/error-in-json/errors.js index 534e9facc4c..7b246fd2cc3 100644 --- a/test/hotCases/json/error-in-json/errors.js +++ b/test/hotCases/json/error-in-json/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Module parse failed/]]; diff --git a/test/hotCases/lazy-compilation/https/test.config.js b/test/hotCases/lazy-compilation/https/test.config.js index afaea34172c..9448eebbacc 100644 --- a/test/hotCases/lazy-compilation/https/test.config.js +++ b/test/hotCases/lazy-compilation/https/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope, options) { if ( diff --git a/test/hotCases/lazy-compilation/module-test/webpack.config.js b/test/hotCases/lazy-compilation/module-test/webpack.config.js index cae5d069215..d39a24d201d 100644 --- a/test/hotCases/lazy-compilation/module-test/webpack.config.js +++ b/test/hotCases/lazy-compilation/module-test/webpack.config.js @@ -5,7 +5,7 @@ module.exports = { experiments: { lazyCompilation: { entries: false, - test: module => + test: (module) => !/moduleB/.test(/** @type {string} */ (module.nameForCondition())) } } diff --git a/test/hotCases/loader-import-module/css/webpack.config.js b/test/hotCases/loader-import-module/css/webpack.config.js index 61cc3d5069a..9faedce410f 100644 --- a/test/hotCases/loader-import-module/css/webpack.config.js +++ b/test/hotCases/loader-import-module/css/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { @@ -21,8 +23,8 @@ module.exports = { ] }, plugins: [ - compiler => - compiler.hooks.done.tap("test case", stats => { + (compiler) => + compiler.hooks.done.tap("test case", (stats) => { const png = stats.compilation.getAsset("assets/file.png"); const jpg = stats.compilation.getAsset("assets/file.jpg"); if (png) { diff --git a/test/hotCases/recover/recover-after-css-loader-error/test.filter.js b/test/hotCases/recover/recover-after-css-loader-error/test.filter.js index c2410949472..94e49e42d68 100644 --- a/test/hotCases/recover/recover-after-css-loader-error/test.filter.js +++ b/test/hotCases/recover/recover-after-css-loader-error/test.filter.js @@ -1 +1,3 @@ -module.exports = config => config.target === "web"; +"use strict"; + +module.exports = (config) => config.target === "web"; diff --git a/test/hotCases/recover/recover-after-css-loader-error/webpack.config.js b/test/hotCases/recover/recover-after-css-loader-error/webpack.config.js index 527c1c2c19d..23171fcc94b 100644 --- a/test/hotCases/recover/recover-after-css-loader-error/webpack.config.js +++ b/test/hotCases/recover/recover-after-css-loader-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { experiments: { diff --git a/test/hotCases/runtime/add-runtime/test.filter.js b/test/hotCases/runtime/add-runtime/test.filter.js index b4cd65c5a11..6cca85b2eff 100644 --- a/test/hotCases/runtime/add-runtime/test.filter.js +++ b/test/hotCases/runtime/add-runtime/test.filter.js @@ -1,6 +1,8 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = config => { +module.exports = (config) => { if (config.target !== "web") { return false; } diff --git a/test/hotCases/runtime/add-runtime/webpack.config.js b/test/hotCases/runtime/add-runtime/webpack.config.js index d0d0854b6da..1ad1d436542 100644 --- a/test/hotCases/runtime/add-runtime/webpack.config.js +++ b/test/hotCases/runtime/add-runtime/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { usedExports: true, diff --git a/test/hotCases/runtime/root-error/webpack.config.js b/test/hotCases/runtime/root-error/webpack.config.js index e9fe7588df6..ddc967bb279 100644 --- a/test/hotCases/runtime/root-error/webpack.config.js +++ b/test/hotCases/runtime/root-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { emitOnErrors: false diff --git a/test/hotCases/sharing/share-plugin/webpack.config.js b/test/hotCases/sharing/share-plugin/webpack.config.js index 7cd5ca03ad6..706184ddefb 100644 --- a/test/hotCases/sharing/share-plugin/webpack.config.js +++ b/test/hotCases/sharing/share-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { SharePlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/hotCases/worker/move-between-runtime/test.config.js b/test/hotCases/worker/move-between-runtime/test.config.js index 46da6fed452..8ca5fe752fe 100644 --- a/test/hotCases/worker/move-between-runtime/test.config.js +++ b/test/hotCases/worker/move-between-runtime/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope, options) { const FakeWorker = require("../../../helpers/createFakeWorker")({ diff --git a/test/hotCases/worker/move-between-runtime/test.filter.js b/test/hotCases/worker/move-between-runtime/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/hotCases/worker/move-between-runtime/test.filter.js +++ b/test/hotCases/worker/move-between-runtime/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/hotCases/worker/move-between-runtime/webpack.config.js b/test/hotCases/worker/move-between-runtime/webpack.config.js new file mode 100644 index 00000000000..5b89ed624a5 --- /dev/null +++ b/test/hotCases/worker/move-between-runtime/webpack.config.js @@ -0,0 +1,10 @@ +"use strict"; + +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + environment: { + nodePrefixForCoreModules: false + } + } +}; diff --git a/test/hotCases/worker/remove-add-worker/test.config.js b/test/hotCases/worker/remove-add-worker/test.config.js index 46da6fed452..8ca5fe752fe 100644 --- a/test/hotCases/worker/remove-add-worker/test.config.js +++ b/test/hotCases/worker/remove-add-worker/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope, options) { const FakeWorker = require("../../../helpers/createFakeWorker")({ diff --git a/test/hotCases/worker/remove-add-worker/test.filter.js b/test/hotCases/worker/remove-add-worker/test.filter.js index cac73d61621..b12cf7ef56c 100644 --- a/test/hotCases/worker/remove-add-worker/test.filter.js +++ b/test/hotCases/worker/remove-add-worker/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = config => supportsWorker() && config.target !== "async-node"; +module.exports = (config) => supportsWorker() && config.target !== "async-node"; diff --git a/test/hotCases/worker/remove-add-worker/webpack.config.js b/test/hotCases/worker/remove-add-worker/webpack.config.js new file mode 100644 index 00000000000..5b89ed624a5 --- /dev/null +++ b/test/hotCases/worker/remove-add-worker/webpack.config.js @@ -0,0 +1,10 @@ +"use strict"; + +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + environment: { + nodePrefixForCoreModules: false + } + } +}; diff --git a/test/hotCases/worker/update-in-worker/test.config.js b/test/hotCases/worker/update-in-worker/test.config.js index 46da6fed452..8ca5fe752fe 100644 --- a/test/hotCases/worker/update-in-worker/test.config.js +++ b/test/hotCases/worker/update-in-worker/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { moduleScope(scope, options) { const FakeWorker = require("../../../helpers/createFakeWorker")({ diff --git a/test/hotCases/worker/update-in-worker/test.filter.js b/test/hotCases/worker/update-in-worker/test.filter.js index d456e8870d2..fc9b5e2ce0d 100644 --- a/test/hotCases/worker/update-in-worker/test.filter.js +++ b/test/hotCases/worker/update-in-worker/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = () => supportsWorker(); diff --git a/test/hotCases/worker/update-in-worker/webpack.config.js b/test/hotCases/worker/update-in-worker/webpack.config.js new file mode 100644 index 00000000000..5b89ed624a5 --- /dev/null +++ b/test/hotCases/worker/update-in-worker/webpack.config.js @@ -0,0 +1,10 @@ +"use strict"; + +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + environment: { + nodePrefixForCoreModules: false + } + } +}; diff --git a/test/hotPlayground/webpack.config.js b/test/hotPlayground/webpack.config.js index 8890444988f..b89be3f6b13 100644 --- a/test/hotPlayground/webpack.config.js +++ b/test/hotPlayground/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/test/numberHash.unittest.js b/test/numberHash.unittest.js index 1378b272861..801975b34a3 100644 --- a/test/numberHash.unittest.js +++ b/test/numberHash.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const { numberToIdentifier } = require("../lib/Template"); const numberHash = require("../lib/util/numberHash"); diff --git a/test/patch-node-env.js b/test/patch-node-env.js index 36f335ab88c..eb172e70f16 100644 --- a/test/patch-node-env.js +++ b/test/patch-node-env.js @@ -1,3 +1,5 @@ +"use strict"; + const NodeEnvironment = // For jest@29 require("jest-environment-node").TestEnvironment || diff --git a/test/propertyAccess.unittest.js b/test/propertyAccess.unittest.js index 51f33979744..30475df4755 100644 --- a/test/propertyAccess.unittest.js +++ b/test/propertyAccess.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const propertyAccess = require("../lib/util/propertyAccess"); describe("propertyAccess", () => { diff --git a/test/propertyName.unittest.js b/test/propertyName.unittest.js index 72a1cff7a29..7a129fdd0d3 100644 --- a/test/propertyName.unittest.js +++ b/test/propertyName.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const { propertyName } = require("../lib/util/propertyName"); describe("propertyName", () => { diff --git a/test/runner/index.js b/test/runner/index.js index f1c545906ae..b9f4e3bc610 100644 --- a/test/runner/index.js +++ b/test/runner/index.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const { Module } = require("module"); const path = require("path"); @@ -8,7 +10,7 @@ const vm = require("vm"); * @param {string} path path * @returns {string} subPath */ -const getSubPath = path => { +const getSubPath = (path) => { let subPath = ""; const lastSlash = path.lastIndexOf("/"); let firstSlash = path.indexOf("/"); @@ -32,7 +34,7 @@ const getSubPath = path => { * @param {string} path path * @returns {boolean} whether path is a relative path */ -const isRelativePath = path => /^\.\.?\//.test(path); +const isRelativePath = (path) => /^\.\.?\//.test(path); /** * @param {string} url url @@ -49,7 +51,7 @@ const urlToPath = (url, outputDirectory) => { * @param {string} url url * @returns {string} relative path */ -const urlToRelativePath = url => { +const urlToRelativePath = (url) => { if (url.startsWith("https://test.cases/path/")) url = url.slice(24); else if (url.startsWith("https://test.cases/")) url = url.slice(19); return `./${url}`; @@ -189,7 +191,7 @@ class TestRunner { console, expect, jest, - nsObj: m => { + nsObj: (m) => { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); @@ -246,7 +248,7 @@ class TestRunner { subPath: "", modulePath: path.join(currentDirectory, ".array-require.js"), content: `module.exports = (${module - .map(arg => `require(${JSON.stringify(`./${arg}`)})`) + .map((arg) => `require(${JSON.stringify(`./${arg}`)})`) .join(", ")});` }; } @@ -338,7 +340,7 @@ class TestRunner { this.require.bind(this, path.dirname(modulePath)), this.require ), - importScripts: url => { + importScripts: (url) => { expect(url).toMatch(/^https:\/\/test\.cases\/path\//); this.require(this.outputDirectory, urlToRelativePath(url)); }, @@ -356,7 +358,7 @@ class TestRunner { _content = `Object.assign(global, _globalAssign); ${content}`; } const args = Object.keys(moduleScope); - const argValues = args.map(arg => moduleScope[arg]); + const argValues = args.map((arg) => moduleScope[arg]); const code = `(function(${args.join(", ")}) {${_content}\n})`; const document = this._moduleScope.document; const fn = this._runInNewContext @@ -482,14 +484,14 @@ class TestRunner { * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} json runner */ createJSONRunner() { - return moduleInfo => JSON.parse(moduleInfo.content); + return (moduleInfo) => JSON.parse(moduleInfo.content); } /** * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} raw runner */ createRawRunner() { - return moduleInfo => moduleInfo.content; + return (moduleInfo) => moduleInfo.content; } /** @@ -505,11 +507,11 @@ class TestRunner { const document = new FakeDocument(outputDirectory); if (this.testConfig.evaluateScriptOnAttached) { - document.onScript = src => { + document.onScript = (src) => { this.require(outputDirectory, urlToRelativePath(src)); }; } - const fetch = async url => { + const fetch = async (url) => { try { const buffer = await new Promise((resolve, reject) => { fs.readFile(urlToPath(url, this.outputDirectory), (err, b) => diff --git a/test/setupTestFramework.js b/test/setupTestFramework.js index 2be3218817f..df09512a757 100644 --- a/test/setupTestFramework.js +++ b/test/setupTestFramework.js @@ -1,3 +1,5 @@ +"use strict"; + expect.extend({ toBeTypeOf(received, expected) { const objType = typeof received; @@ -70,7 +72,7 @@ if (process.env.ALTERNATIVE_SORT) { // Setup debugging info for tests if (process.env.DEBUG_INFO) { - const addDebugInfo = it => (name, fn, timeout) => { + const addDebugInfo = (it) => (name, fn, timeout) => { if (fn.length === 0) { it( name, @@ -80,11 +82,11 @@ if (process.env.DEBUG_INFO) { const promise = fn(); if (promise && promise.then) { return promise.then( - r => { + (r) => { process.stdout.write(`DONE OK ${name}\n`); return r; }, - err => { + (err) => { process.stdout.write(`DONE FAIL ${name}\n`); throw err; } @@ -102,9 +104,9 @@ if (process.env.DEBUG_INFO) { } else { it( name, - done => { + (done) => { process.stdout.write(`START2 ${name}\n`); - return fn(err => { + return fn((err) => { if (err) { process.stdout.write(`DONE FAIL ${name}\n`); } else { diff --git a/test/statsCases/aggressive-splitting-entry/webpack.config.js b/test/statsCases/aggressive-splitting-entry/webpack.config.js index 7357bf4295f..3c8fdede5ca 100644 --- a/test/statsCases/aggressive-splitting-entry/webpack.config.js +++ b/test/statsCases/aggressive-splitting-entry/webpack.config.js @@ -1,8 +1,10 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../"); /** @type {import("../../../").Configuration[]} */ -module.exports = ["fitting", "content-change"].map(type => ({ +module.exports = ["fitting", "content-change"].map((type) => ({ name: type, mode: "production", cache: true, // AggressiveSplittingPlugin rebuilds multiple times, we need to cache the assets diff --git a/test/statsCases/aggressive-splitting-on-demand/webpack.config.js b/test/statsCases/aggressive-splitting-on-demand/webpack.config.js index 9fdb93e7412..1b2a23eb93e 100644 --- a/test/statsCases/aggressive-splitting-on-demand/webpack.config.js +++ b/test/statsCases/aggressive-splitting-on-demand/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../"); diff --git a/test/statsCases/all-stats/webpack.config.js b/test/statsCases/all-stats/webpack.config.js index bf88460981f..d12887418db 100644 --- a/test/statsCases/all-stats/webpack.config.js +++ b/test/statsCases/all-stats/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/statsCases/asset-concat/webpack.config.js b/test/statsCases/asset-concat/webpack.config.js index 67951bc27c2..c2af5df368d 100644 --- a/test/statsCases/asset-concat/webpack.config.js +++ b/test/statsCases/asset-concat/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/asset/webpack.config.js b/test/statsCases/asset/webpack.config.js index 6f5d1756efe..3380fecc1e7 100644 --- a/test/statsCases/asset/webpack.config.js +++ b/test/statsCases/asset/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/async-commons-chunk-auto/webpack.config.js b/test/statsCases/async-commons-chunk-auto/webpack.config.js index 68848614104..9e396791b70 100644 --- a/test/statsCases/async-commons-chunk-auto/webpack.config.js +++ b/test/statsCases/async-commons-chunk-auto/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const stats = { @@ -93,7 +95,7 @@ module.exports = [ minSize: 0, // enforce all chunks: "all", cacheGroups: { - libs: module => { + libs: (module) => { const name = module.nameForCondition(); if (!name) return; const match = /[\\/](xyz|x)\.js/.exec(name); diff --git a/test/statsCases/async-commons-chunk/webpack.config.js b/test/statsCases/async-commons-chunk/webpack.config.js index aee3af00445..e0819f75096 100644 --- a/test/statsCases/async-commons-chunk/webpack.config.js +++ b/test/statsCases/async-commons-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/cause-error/webpack.config.js b/test/statsCases/cause-error/webpack.config.js index 9eb4f495f0f..95b332988c5 100644 --- a/test/statsCases/cause-error/webpack.config.js +++ b/test/statsCases/cause-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const WebpackError = require("../../../lib/WebpackError"); /** @typedef {Error & { cause?: unknown }} ErrorWithCause */ @@ -71,8 +73,8 @@ module.exports = { mode: "development", entry: "./index.js", plugins: [ - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { const errCauseErr = createErrorWithCause("error with case", { cause: new Error("error case") }); diff --git a/test/statsCases/chunk-module-id-range/webpack.config.js b/test/statsCases/chunk-module-id-range/webpack.config.js index 535f66f9656..115638d587d 100644 --- a/test/statsCases/chunk-module-id-range/webpack.config.js +++ b/test/statsCases/chunk-module-id-range/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/chunks-development/webpack.config.js b/test/statsCases/chunks-development/webpack.config.js index 655e7e2fa67..d1411a1c81a 100644 --- a/test/statsCases/chunks-development/webpack.config.js +++ b/test/statsCases/chunks-development/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/statsCases/chunks/webpack.config.js b/test/statsCases/chunks/webpack.config.js index 7eb0b143658..f342867f852 100644 --- a/test/statsCases/chunks/webpack.config.js +++ b/test/statsCases/chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/circular-correctness/webpack.config.js b/test/statsCases/circular-correctness/webpack.config.js index 4322ee12726..399a523e5d7 100644 --- a/test/statsCases/circular-correctness/webpack.config.js +++ b/test/statsCases/circular-correctness/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/color-disabled/webpack.config.js b/test/statsCases/color-disabled/webpack.config.js index 5d137823375..0b9b9e2aa83 100644 --- a/test/statsCases/color-disabled/webpack.config.js +++ b/test/statsCases/color-disabled/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/color-enabled-custom/webpack.config.js b/test/statsCases/color-enabled-custom/webpack.config.js index 346b1c20df4..794d8bde5a0 100644 --- a/test/statsCases/color-enabled-custom/webpack.config.js +++ b/test/statsCases/color-enabled-custom/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/color-enabled/webpack.config.js b/test/statsCases/color-enabled/webpack.config.js index 8db94e7367b..e507cc549d8 100644 --- a/test/statsCases/color-enabled/webpack.config.js +++ b/test/statsCases/color-enabled/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/common-libs/webpack.config.js b/test/statsCases/common-libs/webpack.config.js index d5049a1bdde..e906c795300 100644 --- a/test/statsCases/common-libs/webpack.config.js +++ b/test/statsCases/common-libs/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/commons-chunk-min-size-0/webpack.config.js b/test/statsCases/commons-chunk-min-size-0/webpack.config.js index a68deca161b..ed04b917e88 100644 --- a/test/statsCases/commons-chunk-min-size-0/webpack.config.js +++ b/test/statsCases/commons-chunk-min-size-0/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/commons-chunk-min-size-Infinity/webpack.config.js b/test/statsCases/commons-chunk-min-size-Infinity/webpack.config.js index b4b0364a3af..059e410ebc6 100644 --- a/test/statsCases/commons-chunk-min-size-Infinity/webpack.config.js +++ b/test/statsCases/commons-chunk-min-size-Infinity/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/commons-plugin-issue-4980/webpack.config.js b/test/statsCases/commons-plugin-issue-4980/webpack.config.js index eac99f48beb..f3b76968d20 100644 --- a/test/statsCases/commons-plugin-issue-4980/webpack.config.js +++ b/test/statsCases/commons-plugin-issue-4980/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + // should generate vendor chunk with the same chunkhash for both entries /** @type {import("../../../").Configuration[]} */ module.exports = [ diff --git a/test/statsCases/concat-and-sideeffects/webpack.config.js b/test/statsCases/concat-and-sideeffects/webpack.config.js index 14ef0be999d..c7cbf5e520d 100644 --- a/test/statsCases/concat-and-sideeffects/webpack.config.js +++ b/test/statsCases/concat-and-sideeffects/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/context-independence/test.config.js b/test/statsCases/context-independence/test.config.js index 305c9bb3133..d48af7814d7 100644 --- a/test/statsCases/context-independence/test.config.js +++ b/test/statsCases/context-independence/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { validate(stats) { for (let i = 0; i < stats.stats.length; i += 2) { diff --git a/test/statsCases/context-independence/webpack.config.js b/test/statsCases/context-independence/webpack.config.js index 87a0ba0fe9f..19e0face3ae 100644 --- a/test/statsCases/context-independence/webpack.config.js +++ b/test/statsCases/context-independence/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** diff --git a/test/statsCases/custom-terser/webpack.config.js b/test/statsCases/custom-terser/webpack.config.js index 21e0cf7413b..4c0cd2188ca 100644 --- a/test/statsCases/custom-terser/webpack.config.js +++ b/test/statsCases/custom-terser/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const TerserPlugin = require("terser-webpack-plugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/define-plugin/webpack.config.js b/test/statsCases/define-plugin/webpack.config.js index 802b389c15a..90140fbc511 100644 --- a/test/statsCases/define-plugin/webpack.config.js +++ b/test/statsCases/define-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const join = require("path").join; const webpack = require("../../../"); diff --git a/test/statsCases/details-error/webpack.config.js b/test/statsCases/details-error/webpack.config.js index 5196ef59a00..5bdc9fa6306 100644 --- a/test/statsCases/details-error/webpack.config.js +++ b/test/statsCases/details-error/webpack.config.js @@ -1,7 +1,9 @@ +"use strict"; + const { WebpackError } = require("../../../"); /** @type {import("../../../").Configuration[]} */ -module.exports = [0, 1, 10, 2, 20, 11, 12, 13, 3, 30].map(n => ({ +module.exports = [0, 1, 10, 2, 20, 11, 12, 13, 3, 30].map((n) => ({ name: `${n % 10} errors ${(n / 10) | 0} warnings`, mode: "development", output: { @@ -9,8 +11,8 @@ module.exports = [0, 1, 10, 2, 20, 11, 12, 13, 3, 30].map(n => ({ }, entry: "./index.js", plugins: [ - compiler => { - compiler.hooks.compilation.tap("Test", compilation => { + (compiler) => { + compiler.hooks.compilation.tap("Test", (compilation) => { const err = new WebpackError("Test"); err.details = "Error details"; for (let i = n % 10; i > 0; i--) compilation.errors.push(err); diff --git a/test/statsCases/dll-reference-plugin-issue-7624-error/webpack.config.js b/test/statsCases/dll-reference-plugin-issue-7624-error/webpack.config.js index b3676547e7b..f1353be2c42 100644 --- a/test/statsCases/dll-reference-plugin-issue-7624-error/webpack.config.js +++ b/test/statsCases/dll-reference-plugin-issue-7624-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../"); diff --git a/test/statsCases/dll-reference-plugin-issue-7624/webpack.config.js b/test/statsCases/dll-reference-plugin-issue-7624/webpack.config.js index 746a27eb8e7..52eba1fe7e5 100644 --- a/test/statsCases/dll-reference-plugin-issue-7624/webpack.config.js +++ b/test/statsCases/dll-reference-plugin-issue-7624/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../"); diff --git a/test/statsCases/dynamic-chunk-name-error/webpack.config.js b/test/statsCases/dynamic-chunk-name-error/webpack.config.js index ac1c74fe1f0..657731ad869 100644 --- a/test/statsCases/dynamic-chunk-name-error/webpack.config.js +++ b/test/statsCases/dynamic-chunk-name-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/dynamic-import/webpack.config.js b/test/statsCases/dynamic-import/webpack.config.js index dccb55d1300..6cba3932ded 100644 --- a/test/statsCases/dynamic-import/webpack.config.js +++ b/test/statsCases/dynamic-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { devtool: false, diff --git a/test/statsCases/entry-filename/webpack.config.js b/test/statsCases/entry-filename/webpack.config.js index 5efaf0330d3..12bd9acf6f4 100644 --- a/test/statsCases/entry-filename/webpack.config.js +++ b/test/statsCases/entry-filename/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/errors-space-error/webpack.config.js b/test/statsCases/errors-space-error/webpack.config.js index 4ea95efae2e..dcc754514d4 100644 --- a/test/statsCases/errors-space-error/webpack.config.js +++ b/test/statsCases/errors-space-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration[]} */ module.exports = [ { diff --git a/test/statsCases/exclude-with-loader/webpack.config.js b/test/statsCases/exclude-with-loader/webpack.config.js index 725e0252c5c..39a0c58ca33 100644 --- a/test/statsCases/exclude-with-loader/webpack.config.js +++ b/test/statsCases/exclude-with-loader/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/external/webpack.config.js b/test/statsCases/external/webpack.config.js index 9dcff537b42..ccd928a4d0c 100644 --- a/test/statsCases/external/webpack.config.js +++ b/test/statsCases/external/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/graph-correctness-entries/webpack.config.js b/test/statsCases/graph-correctness-entries/webpack.config.js index b47eedfe1de..81e9a9dc084 100644 --- a/test/statsCases/graph-correctness-entries/webpack.config.js +++ b/test/statsCases/graph-correctness-entries/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/graph-correctness-modules/webpack.config.js b/test/statsCases/graph-correctness-modules/webpack.config.js index b47eedfe1de..81e9a9dc084 100644 --- a/test/statsCases/graph-correctness-modules/webpack.config.js +++ b/test/statsCases/graph-correctness-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/graph-roots/webpack.config.js b/test/statsCases/graph-roots/webpack.config.js index f6b9e638b1b..195cc04a9a6 100644 --- a/test/statsCases/graph-roots/webpack.config.js +++ b/test/statsCases/graph-roots/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/statsCases/ignore-warnings/webpack.config.js b/test/statsCases/ignore-warnings/webpack.config.js index 8d203f8ef9d..9324d4468c6 100644 --- a/test/statsCases/ignore-warnings/webpack.config.js +++ b/test/statsCases/ignore-warnings/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../").Module} Module */ /** @typedef {import("../../../").WebpackError} WebpackError */ @@ -13,7 +15,7 @@ module.exports = { message: /homepage/ }, /The 'mode' option has not been set/, - warning => + (warning) => /** @type {Module} */ (/** @type {WebpackError} */ (warning).module).identifier().endsWith("?2") ] diff --git a/test/statsCases/immutable/webpack.config.js b/test/statsCases/immutable/webpack.config.js index 2bbf3aa2caf..3e3a958c5f1 100644 --- a/test/statsCases/immutable/webpack.config.js +++ b/test/statsCases/immutable/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/statsCases/import-context-filter/webpack.config.js b/test/statsCases/import-context-filter/webpack.config.js index 250f8f5e63a..e11b1e43cd7 100644 --- a/test/statsCases/import-context-filter/webpack.config.js +++ b/test/statsCases/import-context-filter/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/import-weak-parser-option/webpack.config.js b/test/statsCases/import-weak-parser-option/webpack.config.js index dc55f04d88c..3bb70f70f23 100644 --- a/test/statsCases/import-weak-parser-option/webpack.config.js +++ b/test/statsCases/import-weak-parser-option/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/import-weak/webpack.config.js b/test/statsCases/import-weak/webpack.config.js index 250f8f5e63a..e11b1e43cd7 100644 --- a/test/statsCases/import-weak/webpack.config.js +++ b/test/statsCases/import-weak/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/import-with-invalid-options-comments/webpack.config.js b/test/statsCases/import-with-invalid-options-comments/webpack.config.js index 29bbb85511b..4f630e60fd0 100644 --- a/test/statsCases/import-with-invalid-options-comments/webpack.config.js +++ b/test/statsCases/import-with-invalid-options-comments/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/issue-7577/webpack.config.js b/test/statsCases/issue-7577/webpack.config.js index 8468e20b49c..202f90c8d2a 100644 --- a/test/statsCases/issue-7577/webpack.config.js +++ b/test/statsCases/issue-7577/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const base = { mode: "production", optimization: { diff --git a/test/statsCases/limit-chunk-count-plugin/webpack.config.js b/test/statsCases/limit-chunk-count-plugin/webpack.config.js index cefff804cbb..1cd9d5e6f07 100644 --- a/test/statsCases/limit-chunk-count-plugin/webpack.config.js +++ b/test/statsCases/limit-chunk-count-plugin/webpack.config.js @@ -1,7 +1,9 @@ +"use strict"; + const webpack = require("../../../"); /** @type {import("../../../").Configuration[]} */ -module.exports = [1, 2, 3, 4].map(n => ({ +module.exports = [1, 2, 3, 4].map((n) => ({ name: `${n} chunks`, mode: "production", entry: "./index", diff --git a/test/statsCases/logging-debug/webpack.config.js b/test/statsCases/logging-debug/webpack.config.js index 8faf807a2fc..32190db81ef 100644 --- a/test/statsCases/logging-debug/webpack.config.js +++ b/test/statsCases/logging-debug/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/logging/webpack.config.js b/test/statsCases/logging/webpack.config.js index e3e086af9f3..deda6c1354c 100644 --- a/test/statsCases/logging/webpack.config.js +++ b/test/statsCases/logging/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/max-external-module-readable-identifier/webpack.config.js b/test/statsCases/max-external-module-readable-identifier/webpack.config.js index 7f5712802a4..3254c2018dc 100644 --- a/test/statsCases/max-external-module-readable-identifier/webpack.config.js +++ b/test/statsCases/max-external-module-readable-identifier/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../types").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/max-modules-default/webpack.config.js b/test/statsCases/max-modules-default/webpack.config.js index 30e8de2c0f0..d1f52e29f95 100644 --- a/test/statsCases/max-modules-default/webpack.config.js +++ b/test/statsCases/max-modules-default/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/max-modules/webpack.config.js b/test/statsCases/max-modules/webpack.config.js index cb83e0b2382..ab12c6e29c2 100644 --- a/test/statsCases/max-modules/webpack.config.js +++ b/test/statsCases/max-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/module-assets/webpack.config.js b/test/statsCases/module-assets/webpack.config.js index 20922e8dbf1..1adf515255b 100644 --- a/test/statsCases/module-assets/webpack.config.js +++ b/test/statsCases/module-assets/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/module-deduplication-named/webpack.config.js b/test/statsCases/module-deduplication-named/webpack.config.js index 595b06dc2a1..a0810f0b64b 100644 --- a/test/statsCases/module-deduplication-named/webpack.config.js +++ b/test/statsCases/module-deduplication-named/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/module-deduplication/webpack.config.js b/test/statsCases/module-deduplication/webpack.config.js index 595b06dc2a1..a0810f0b64b 100644 --- a/test/statsCases/module-deduplication/webpack.config.js +++ b/test/statsCases/module-deduplication/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/module-federation-custom-exposed-module-name/webpack.config.js b/test/statsCases/module-federation-custom-exposed-module-name/webpack.config.js index ac57c47b9f1..8604bcefd78 100644 --- a/test/statsCases/module-federation-custom-exposed-module-name/webpack.config.js +++ b/test/statsCases/module-federation-custom-exposed-module-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ModuleFederationPlugin } = require("../../../").container; /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/module-not-found-error/webpack.config.js b/test/statsCases/module-not-found-error/webpack.config.js index 04f99c80907..62ad84facb2 100644 --- a/test/statsCases/module-not-found-error/webpack.config.js +++ b/test/statsCases/module-not-found-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/module-reasons/webpack.config.js b/test/statsCases/module-reasons/webpack.config.js index db7b8b1808e..b41e14b45a0 100644 --- a/test/statsCases/module-reasons/webpack.config.js +++ b/test/statsCases/module-reasons/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/module-trace-disabled-in-error/webpack.config.js b/test/statsCases/module-trace-disabled-in-error/webpack.config.js index a4ac64a08ef..a1fdcc3b631 100644 --- a/test/statsCases/module-trace-disabled-in-error/webpack.config.js +++ b/test/statsCases/module-trace-disabled-in-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/module-trace-enabled-in-error/webpack.config.js b/test/statsCases/module-trace-enabled-in-error/webpack.config.js index 58a72453689..8c01e2c2753 100644 --- a/test/statsCases/module-trace-enabled-in-error/webpack.config.js +++ b/test/statsCases/module-trace-enabled-in-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/name/webpack.config.js b/test/statsCases/name/webpack.config.js index 5072e80e8e9..604101f20f6 100644 --- a/test/statsCases/name/webpack.config.js +++ b/test/statsCases/name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration[]} */ module.exports = [ { diff --git a/test/statsCases/named-chunk-groups/webpack.config.js b/test/statsCases/named-chunk-groups/webpack.config.js index 5707a8b1e24..e59ed7dc88b 100644 --- a/test/statsCases/named-chunk-groups/webpack.config.js +++ b/test/statsCases/named-chunk-groups/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/named-chunks-plugin/webpack.config.js b/test/statsCases/named-chunks-plugin/webpack.config.js index b358371ed22..b3321bbb6fc 100644 --- a/test/statsCases/named-chunks-plugin/webpack.config.js +++ b/test/statsCases/named-chunks-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/optimize-chunks/webpack.config.js b/test/statsCases/optimize-chunks/webpack.config.js index efb9acd5dda..dc6d6efba28 100644 --- a/test/statsCases/optimize-chunks/webpack.config.js +++ b/test/statsCases/optimize-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/output-module/webpack.config.js b/test/statsCases/output-module/webpack.config.js index 164dbddbf6a..8b93daaff20 100644 --- a/test/statsCases/output-module/webpack.config.js +++ b/test/statsCases/output-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { mode: "production", entry: "./index", diff --git a/test/statsCases/performance-different-mode-and-target/webpack.config.js b/test/statsCases/performance-different-mode-and-target/webpack.config.js index 99f80423cc3..fd2a5451bcf 100644 --- a/test/statsCases/performance-different-mode-and-target/webpack.config.js +++ b/test/statsCases/performance-different-mode-and-target/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration[]} */ module.exports = [ { diff --git a/test/statsCases/performance-disabled/webpack.config.js b/test/statsCases/performance-disabled/webpack.config.js index 49d1699527f..0b78bcb03a9 100644 --- a/test/statsCases/performance-disabled/webpack.config.js +++ b/test/statsCases/performance-disabled/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/performance-error/webpack.config.js b/test/statsCases/performance-error/webpack.config.js index 2a53b983726..df5b4381e9c 100644 --- a/test/statsCases/performance-error/webpack.config.js +++ b/test/statsCases/performance-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/performance-no-async-chunks-shown/webpack.config.js b/test/statsCases/performance-no-async-chunks-shown/webpack.config.js index 1147c3f183f..e6f780f54f9 100644 --- a/test/statsCases/performance-no-async-chunks-shown/webpack.config.js +++ b/test/statsCases/performance-no-async-chunks-shown/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/performance-no-hints/webpack.config.js b/test/statsCases/performance-no-hints/webpack.config.js index 793fe03db68..0333cd4f070 100644 --- a/test/statsCases/performance-no-hints/webpack.config.js +++ b/test/statsCases/performance-no-hints/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/performance-oversize-limit-error/webpack.config.js b/test/statsCases/performance-oversize-limit-error/webpack.config.js index 79b0915ec4f..7612937b0d9 100644 --- a/test/statsCases/performance-oversize-limit-error/webpack.config.js +++ b/test/statsCases/performance-oversize-limit-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/prefetch-preload-mixed/webpack.config.js b/test/statsCases/prefetch-preload-mixed/webpack.config.js index d864bc6af94..3a03ccdcb4f 100644 --- a/test/statsCases/prefetch-preload-mixed/webpack.config.js +++ b/test/statsCases/prefetch-preload-mixed/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/prefetch/webpack.config.js b/test/statsCases/prefetch/webpack.config.js index b8a3ca5e08f..2d192a2d07b 100644 --- a/test/statsCases/prefetch/webpack.config.js +++ b/test/statsCases/prefetch/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/preload/webpack.config.js b/test/statsCases/preload/webpack.config.js index f84da434cfd..e2bab409cef 100644 --- a/test/statsCases/preload/webpack.config.js +++ b/test/statsCases/preload/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/preset-detailed/webpack.config.js b/test/statsCases/preset-detailed/webpack.config.js index b3f4ace1f5a..947895b8979 100644 --- a/test/statsCases/preset-detailed/webpack.config.js +++ b/test/statsCases/preset-detailed/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/preset-errors-only-error/webpack.config.js b/test/statsCases/preset-errors-only-error/webpack.config.js index a07357ddad8..44cdd6e27b7 100644 --- a/test/statsCases/preset-errors-only-error/webpack.config.js +++ b/test/statsCases/preset-errors-only-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/preset-errors-only/webpack.config.js b/test/statsCases/preset-errors-only/webpack.config.js index 04f99c80907..62ad84facb2 100644 --- a/test/statsCases/preset-errors-only/webpack.config.js +++ b/test/statsCases/preset-errors-only/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/preset-errors-warnings/webpack.config.js b/test/statsCases/preset-errors-warnings/webpack.config.js index 68ce0928c70..032da0fc8e9 100644 --- a/test/statsCases/preset-errors-warnings/webpack.config.js +++ b/test/statsCases/preset-errors-warnings/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/preset-minimal-simple/webpack.config.js b/test/statsCases/preset-minimal-simple/webpack.config.js index c4fb6fdc0ff..50833d4b597 100644 --- a/test/statsCases/preset-minimal-simple/webpack.config.js +++ b/test/statsCases/preset-minimal-simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/preset-minimal/webpack.config.js b/test/statsCases/preset-minimal/webpack.config.js index 7ba0caf0a1a..c76f0db0b01 100644 --- a/test/statsCases/preset-minimal/webpack.config.js +++ b/test/statsCases/preset-minimal/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/preset-mixed-array/webpack.config.js b/test/statsCases/preset-mixed-array/webpack.config.js index e4282dcf3f6..bd0613d21b1 100644 --- a/test/statsCases/preset-mixed-array/webpack.config.js +++ b/test/statsCases/preset-mixed-array/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration[]} */ module.exports = [ { diff --git a/test/statsCases/preset-none-array/webpack.config.js b/test/statsCases/preset-none-array/webpack.config.js index 8beaeabc609..1b33043cafa 100644 --- a/test/statsCases/preset-none-array/webpack.config.js +++ b/test/statsCases/preset-none-array/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration[]} */ module.exports = [ { diff --git a/test/statsCases/preset-none-error/webpack.config.js b/test/statsCases/preset-none-error/webpack.config.js index fc5edb6b418..6b9e1c904d0 100644 --- a/test/statsCases/preset-none-error/webpack.config.js +++ b/test/statsCases/preset-none-error/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/preset-none/webpack.config.js b/test/statsCases/preset-none/webpack.config.js index 54cc4b2d3e6..0573143e381 100644 --- a/test/statsCases/preset-none/webpack.config.js +++ b/test/statsCases/preset-none/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/webpack.config.js b/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/webpack.config.js index 919599037a0..067fb5a3592 100644 --- a/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/webpack.config.js +++ b/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/preset-normal-performance/webpack.config.js b/test/statsCases/preset-normal-performance/webpack.config.js index 1de6394e577..79c815a4cc0 100644 --- a/test/statsCases/preset-normal-performance/webpack.config.js +++ b/test/statsCases/preset-normal-performance/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/preset-normal/webpack.config.js b/test/statsCases/preset-normal/webpack.config.js index 6b76a5c3bb6..d0b4be0e522 100644 --- a/test/statsCases/preset-normal/webpack.config.js +++ b/test/statsCases/preset-normal/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/preset-summary/webpack.config.js b/test/statsCases/preset-summary/webpack.config.js index b3cc92ca604..450b908b3bc 100644 --- a/test/statsCases/preset-summary/webpack.config.js +++ b/test/statsCases/preset-summary/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/preset-verbose/webpack.config.js b/test/statsCases/preset-verbose/webpack.config.js index 912534b998c..f0e55cbce5f 100644 --- a/test/statsCases/preset-verbose/webpack.config.js +++ b/test/statsCases/preset-verbose/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/real-content-hash/test.config.js b/test/statsCases/real-content-hash/test.config.js index d9954ee4666..55cbd0f04c8 100644 --- a/test/statsCases/real-content-hash/test.config.js +++ b/test/statsCases/real-content-hash/test.config.js @@ -1,10 +1,12 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const createHash = require("../../../lib/util/createHash"); const hashedFiles = { - "file.jpg": a => a.name.endsWith(".jpg"), - "file.png": a => a.name.endsWith(".png") + "file.jpg": (a) => a.name.endsWith(".jpg"), + "file.png": (a) => a.name.endsWith(".png") }; module.exports = { diff --git a/test/statsCases/real-content-hash/webpack.config.js b/test/statsCases/real-content-hash/webpack.config.js index ff7970c9a6a..c5fa283450c 100644 --- a/test/statsCases/real-content-hash/webpack.config.js +++ b/test/statsCases/real-content-hash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/related-assets/test.config.js b/test/statsCases/related-assets/test.config.js index 965ad45e551..d4c1959482f 100644 --- a/test/statsCases/related-assets/test.config.js +++ b/test/statsCases/related-assets/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { validate(stats) { for (const item of stats.stats) { diff --git a/test/statsCases/related-assets/webpack.config.js b/test/statsCases/related-assets/webpack.config.js index 130cf25502c..a73dad288b1 100644 --- a/test/statsCases/related-assets/webpack.config.js +++ b/test/statsCases/related-assets/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../").Compiler} Compiler */ /** @typedef {import("../../../").Configuration} Configuration */ @@ -8,8 +10,8 @@ const { Compilation } = require("../../../"); * @param {string[]} exts extensions * @returns {(compiler: Compiler) => void} callback for comperssion */ -const compression = exts => compiler => { - compiler.hooks.thisCompilation.tap("Test", compilation => { +const compression = (exts) => (compiler) => { + compiler.hooks.thisCompilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "Test", @@ -39,7 +41,7 @@ const compression = exts => compiler => { * @param {string} name name * @returns {Configuration} configuration */ -const base = name => ({ +const base = (name) => ({ name, mode: "development", devtool: "source-map", diff --git a/test/statsCases/resolve-plugin-context/webpack.config.js b/test/statsCases/resolve-plugin-context/webpack.config.js index 7fb04fdaff8..e098b5dd8a6 100644 --- a/test/statsCases/resolve-plugin-context/webpack.config.js +++ b/test/statsCases/resolve-plugin-context/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const ResolvePackageFromRootPlugin = require("./ResolvePackageFromRootPlugin"); /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/reverse-sort-modules/webpack.config.js b/test/statsCases/reverse-sort-modules/webpack.config.js index 92793287950..82329344262 100644 --- a/test/statsCases/reverse-sort-modules/webpack.config.js +++ b/test/statsCases/reverse-sort-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/runtime-chunk-integration/webpack.config.js b/test/statsCases/runtime-chunk-integration/webpack.config.js index 773ef5e9724..378485be44b 100644 --- a/test/statsCases/runtime-chunk-integration/webpack.config.js +++ b/test/statsCases/runtime-chunk-integration/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { MinChunkSizePlugin } = require("../../../").optimize; /** @type {import("../../../").Configuration} */ diff --git a/test/statsCases/runtime-chunk-issue-7382/webpack.config.js b/test/statsCases/runtime-chunk-issue-7382/webpack.config.js index b44443f5016..9b185db2bd2 100644 --- a/test/statsCases/runtime-chunk-issue-7382/webpack.config.js +++ b/test/statsCases/runtime-chunk-issue-7382/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/statsCases/runtime-chunk-single/webpack.config.js b/test/statsCases/runtime-chunk-single/webpack.config.js index f5b3476f7ee..e77892c9d74 100644 --- a/test/statsCases/runtime-chunk-single/webpack.config.js +++ b/test/statsCases/runtime-chunk-single/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/statsCases/runtime-chunk/webpack.config.js b/test/statsCases/runtime-chunk/webpack.config.js index 8bbebaa7bcc..0f11c162979 100644 --- a/test/statsCases/runtime-chunk/webpack.config.js +++ b/test/statsCases/runtime-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/statsCases/runtime-specific-used-exports/webpack.config.js b/test/statsCases/runtime-specific-used-exports/webpack.config.js index 4f37ce2c369..3fbe5515223 100644 --- a/test/statsCases/runtime-specific-used-exports/webpack.config.js +++ b/test/statsCases/runtime-specific-used-exports/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const entry = { a: "./a", b: "./b", diff --git a/test/statsCases/scope-hoisting-bailouts/webpack.config.js b/test/statsCases/scope-hoisting-bailouts/webpack.config.js index 61a8acc6d76..fba1de25ac5 100644 --- a/test/statsCases/scope-hoisting-bailouts/webpack.config.js +++ b/test/statsCases/scope-hoisting-bailouts/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/scope-hoisting-multi/webpack.config.js b/test/statsCases/scope-hoisting-multi/webpack.config.js index 392007e703f..80e7b99a3b2 100644 --- a/test/statsCases/scope-hoisting-multi/webpack.config.js +++ b/test/statsCases/scope-hoisting-multi/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration[]} */ module.exports = [ { diff --git a/test/statsCases/side-effects-issue-7428/webpack.config.js b/test/statsCases/side-effects-issue-7428/webpack.config.js index 7d6f086d647..03d5ac620ff 100644 --- a/test/statsCases/side-effects-issue-7428/webpack.config.js +++ b/test/statsCases/side-effects-issue-7428/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "none", diff --git a/test/statsCases/side-effects-optimization/webpack.config.js b/test/statsCases/side-effects-optimization/webpack.config.js index a916b70c129..135afb13c9f 100644 --- a/test/statsCases/side-effects-optimization/webpack.config.js +++ b/test/statsCases/side-effects-optimization/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ const baseConfig = { mode: "production", diff --git a/test/statsCases/side-effects-simple-unused/webpack.config.js b/test/statsCases/side-effects-simple-unused/webpack.config.js index f41626e1061..acc2d44b1c9 100644 --- a/test/statsCases/side-effects-simple-unused/webpack.config.js +++ b/test/statsCases/side-effects-simple-unused/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/simple-more-info/webpack.config.js b/test/statsCases/simple-more-info/webpack.config.js index 0bf661294dc..2aebb5d10d9 100644 --- a/test/statsCases/simple-more-info/webpack.config.js +++ b/test/statsCases/simple-more-info/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/split-chunks-automatic-name/webpack.config.js b/test/statsCases/split-chunks-automatic-name/webpack.config.js index ff2bc55260d..1998f43d4ff 100644 --- a/test/statsCases/split-chunks-automatic-name/webpack.config.js +++ b/test/statsCases/split-chunks-automatic-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-cache-group-filename/webpack.config.js b/test/statsCases/split-chunks-cache-group-filename/webpack.config.js index af0e97aad8b..bfc42688391 100644 --- a/test/statsCases/split-chunks-cache-group-filename/webpack.config.js +++ b/test/statsCases/split-chunks-cache-group-filename/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../types").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/split-chunks-chunk-name/webpack.config.js b/test/statsCases/split-chunks-chunk-name/webpack.config.js index 8a55e57c88f..3a93a966101 100644 --- a/test/statsCases/split-chunks-chunk-name/webpack.config.js +++ b/test/statsCases/split-chunks-chunk-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-combinations/webpack.config.js b/test/statsCases/split-chunks-combinations/webpack.config.js index fb9892eb412..8a0bf4f47e9 100644 --- a/test/statsCases/split-chunks-combinations/webpack.config.js +++ b/test/statsCases/split-chunks-combinations/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-dedup/webpack.config.js b/test/statsCases/split-chunks-dedup/webpack.config.js index 2a47cdaff6d..3a2da5b6408 100644 --- a/test/statsCases/split-chunks-dedup/webpack.config.js +++ b/test/statsCases/split-chunks-dedup/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../").Module} Module */ const webpack = require("../../../"); diff --git a/test/statsCases/split-chunks-issue-6413/webpack.config.js b/test/statsCases/split-chunks-issue-6413/webpack.config.js index 2deec6baab4..fad3ca5dc34 100644 --- a/test/statsCases/split-chunks-issue-6413/webpack.config.js +++ b/test/statsCases/split-chunks-issue-6413/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-issue-6696/webpack.config.js b/test/statsCases/split-chunks-issue-6696/webpack.config.js index 2017aa984e6..f613f89397f 100644 --- a/test/statsCases/split-chunks-issue-6696/webpack.config.js +++ b/test/statsCases/split-chunks-issue-6696/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-issue-7401/webpack.config.js b/test/statsCases/split-chunks-issue-7401/webpack.config.js index 051fcf83d54..edd859378ce 100644 --- a/test/statsCases/split-chunks-issue-7401/webpack.config.js +++ b/test/statsCases/split-chunks-issue-7401/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-keep-remaining-size/webpack.config.js b/test/statsCases/split-chunks-keep-remaining-size/webpack.config.js index 3f230099452..f58db63492a 100644 --- a/test/statsCases/split-chunks-keep-remaining-size/webpack.config.js +++ b/test/statsCases/split-chunks-keep-remaining-size/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-max-size/webpack.config.js b/test/statsCases/split-chunks-max-size/webpack.config.js index 8bc668b115b..aa10397f870 100644 --- a/test/statsCases/split-chunks-max-size/webpack.config.js +++ b/test/statsCases/split-chunks-max-size/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-min-size-reduction/webpack.config.js b/test/statsCases/split-chunks-min-size-reduction/webpack.config.js index 0e65c02453c..9e31651349a 100644 --- a/test/statsCases/split-chunks-min-size-reduction/webpack.config.js +++ b/test/statsCases/split-chunks-min-size-reduction/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-prefer-bigger-splits/webpack.config.js b/test/statsCases/split-chunks-prefer-bigger-splits/webpack.config.js index 90fff485fa6..73cbff2f407 100644 --- a/test/statsCases/split-chunks-prefer-bigger-splits/webpack.config.js +++ b/test/statsCases/split-chunks-prefer-bigger-splits/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, diff --git a/test/statsCases/split-chunks-runtime-specific/webpack.config.js b/test/statsCases/split-chunks-runtime-specific/webpack.config.js index 008575c37f0..2b84626648b 100644 --- a/test/statsCases/split-chunks-runtime-specific/webpack.config.js +++ b/test/statsCases/split-chunks-runtime-specific/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const entry = { a: "./a", b: "./b", diff --git a/test/statsCases/split-chunks/webpack.config.js b/test/statsCases/split-chunks/webpack.config.js index 7ae86c74c67..0a9be3137e8 100644 --- a/test/statsCases/split-chunks/webpack.config.js +++ b/test/statsCases/split-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const stats = { hash: false, timings: false, @@ -118,7 +120,7 @@ module.exports = [ optimization: { splitChunks: { minSize: 0, - chunks: chunk => chunk.name !== "a" + chunks: (chunk) => chunk.name !== "a" } }, stats @@ -146,7 +148,7 @@ module.exports = [ test: /[\\/]node_modules[\\/]/, name: "vendors", enforce: true, - chunks: chunk => chunk.name !== "a" + chunks: (chunk) => chunk.name !== "a" } } } diff --git a/test/statsCases/track-returned/test.config.js b/test/statsCases/track-returned/test.config.js index 02f3effd85c..975bb8a8bff 100644 --- a/test/statsCases/track-returned/test.config.js +++ b/test/statsCases/track-returned/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { validate(stats) { expect(stats.compilation.modules.size).toBe(246); diff --git a/test/statsCases/tree-shaking/webpack.config.js b/test/statsCases/tree-shaking/webpack.config.js index 018c4209c9f..99db7c69fb7 100644 --- a/test/statsCases/tree-shaking/webpack.config.js +++ b/test/statsCases/tree-shaking/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/warnings-space-warning/webpack.config.js b/test/statsCases/warnings-space-warning/webpack.config.js index 2e516731d15..c7f326ebc7f 100644 --- a/test/statsCases/warnings-space-warning/webpack.config.js +++ b/test/statsCases/warnings-space-warning/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { entry: "./index.js", diff --git a/test/statsCases/wasm-explorer-examples-sync/test.filter.js b/test/statsCases/wasm-explorer-examples-sync/test.filter.js index e4ae2530c7a..30be02fa257 100644 --- a/test/statsCases/wasm-explorer-examples-sync/test.filter.js +++ b/test/statsCases/wasm-explorer-examples-sync/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/statsCases/wasm-explorer-examples-sync/webpack.config.js b/test/statsCases/wasm-explorer-examples-sync/webpack.config.js index 6e61793ab6e..25e12f4ba6b 100644 --- a/test/statsCases/wasm-explorer-examples-sync/webpack.config.js +++ b/test/statsCases/wasm-explorer-examples-sync/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/worker-public-path/webpack.config.js b/test/statsCases/worker-public-path/webpack.config.js index 8f1f15977e8..8cc06eb60db 100644 --- a/test/statsCases/worker-public-path/webpack.config.js +++ b/test/statsCases/worker-public-path/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../types").Configuration} */ module.exports = { mode: "production", diff --git a/test/target-browserslist.unittest.js b/test/target-browserslist.unittest.js index ef6104c9b80..50297bc0248 100644 --- a/test/target-browserslist.unittest.js +++ b/test/target-browserslist.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const { resolve } = require("../lib/config/browserslistTargetHandler"); describe("browserslist target", () => { diff --git a/test/walkCssTokens.unittest.js b/test/walkCssTokens.unittest.js index a179740b79d..6cd3450cb09 100644 --- a/test/walkCssTokens.unittest.js +++ b/test/walkCssTokens.unittest.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const walkCssTokens = require("../lib/css/walkCssTokens"); @@ -75,13 +77,13 @@ describe("walkCssTokens", () => { const casesPath = path.resolve(__dirname, "./configCases/css/parsing/cases"); const tests = fs .readdirSync(casesPath) - .filter(test => /\.css/.test(test)) - .map(item => [ + .filter((test) => /\.css/.test(test)) + .map((item) => [ item, fs.readFileSync(path.resolve(casesPath, item), "utf8") ]); for (const [name, code] of tests) { - test(name, code, e => e.toMatchSnapshot()); + test(name, code, (e) => e.toMatchSnapshot()); } }); diff --git a/test/watchCases/cache/add-defines/test.filter.js b/test/watchCases/cache/add-defines/test.filter.js index 10518911111..02701fcf4ea 100644 --- a/test/watchCases/cache/add-defines/test.filter.js +++ b/test/watchCases/cache/add-defines/test.filter.js @@ -1,2 +1,4 @@ -module.exports = config => +"use strict"; + +module.exports = (config) => !(config.experiments && config.experiments.cacheUnaffected); diff --git a/test/watchCases/cache/add-defines/webpack.config.js b/test/watchCases/cache/add-defines/webpack.config.js index 9f2333a888b..ea24eef6be7 100644 --- a/test/watchCases/cache/add-defines/webpack.config.js +++ b/test/watchCases/cache/add-defines/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @typedef {import("../../../../").WebpackPluginInstance} WebpackPluginInstance */ const { DefinePlugin } = require("../../../../"); @@ -10,7 +12,7 @@ module.exports = { cacheUnaffected: false }, plugins: [ - compiler => { + (compiler) => { const base = { DEFINE: "{}", RUN: DefinePlugin.runtimeValue( diff --git a/test/watchCases/cache/asset-concat/test.filter.js b/test/watchCases/cache/asset-concat/test.filter.js index 10518911111..02701fcf4ea 100644 --- a/test/watchCases/cache/asset-concat/test.filter.js +++ b/test/watchCases/cache/asset-concat/test.filter.js @@ -1,2 +1,4 @@ -module.exports = config => +"use strict"; + +module.exports = (config) => !(config.experiments && config.experiments.cacheUnaffected); diff --git a/test/watchCases/cache/asset-concat/webpack.config.js b/test/watchCases/cache/asset-concat/webpack.config.js index b2a5d4c00bc..5ba3eecf5c1 100644 --- a/test/watchCases/cache/asset-concat/webpack.config.js +++ b/test/watchCases/cache/asset-concat/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/watchCases/cache/change-dep-while-detatched/webpack.config.js b/test/watchCases/cache/change-dep-while-detatched/webpack.config.js index 009c97a1f16..b48e7233f98 100644 --- a/test/watchCases/cache/change-dep-while-detatched/webpack.config.js +++ b/test/watchCases/cache/change-dep-while-detatched/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/watchCases/cache/changing-module-id/webpack.config.js b/test/watchCases/cache/changing-module-id/webpack.config.js index 04720f340aa..8618f1bfa7a 100644 --- a/test/watchCases/cache/changing-module-id/webpack.config.js +++ b/test/watchCases/cache/changing-module-id/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/watchCases/cache/emit-when-clean/webpack.config.js b/test/watchCases/cache/emit-when-clean/webpack.config.js index 36b900e3e16..148e25ef579 100644 --- a/test/watchCases/cache/emit-when-clean/webpack.config.js +++ b/test/watchCases/cache/emit-when-clean/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { clean: true diff --git a/test/watchCases/cache/emit-without-clean/webpack.config.js b/test/watchCases/cache/emit-without-clean/webpack.config.js index e1eaf59239c..878e36cf396 100644 --- a/test/watchCases/cache/emit-without-clean/webpack.config.js +++ b/test/watchCases/cache/emit-without-clean/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { clean: false diff --git a/test/watchCases/cache/immutable/webpack.config.js b/test/watchCases/cache/immutable/webpack.config.js index 0925d384b06..cb9ec4abb35 100644 --- a/test/watchCases/cache/immutable/webpack.config.js +++ b/test/watchCases/cache/immutable/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/watchCases/cache/loader-import-module-progress/webpack.config.js b/test/watchCases/cache/loader-import-module-progress/webpack.config.js index 93b7fc7f8ae..cf4a7eb93eb 100644 --- a/test/watchCases/cache/loader-import-module-progress/webpack.config.js +++ b/test/watchCases/cache/loader-import-module-progress/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/watchCases/cache/loader-import-module/webpack.config.js b/test/watchCases/cache/loader-import-module/webpack.config.js index 2a0a5ded08d..b5369e35701 100644 --- a/test/watchCases/cache/loader-import-module/webpack.config.js +++ b/test/watchCases/cache/loader-import-module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { module: { diff --git a/test/watchCases/cache/loader-load-module-progress/webpack.config.js b/test/watchCases/cache/loader-load-module-progress/webpack.config.js index c853d37e2e0..323d24441a1 100644 --- a/test/watchCases/cache/loader-load-module-progress/webpack.config.js +++ b/test/watchCases/cache/loader-load-module-progress/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/watchCases/cache/managedPath/webpack.config.js b/test/watchCases/cache/managedPath/webpack.config.js index 7ef2fe927c0..c7e912cc432 100644 --- a/test/watchCases/cache/managedPath/webpack.config.js +++ b/test/watchCases/cache/managedPath/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration} */ diff --git a/test/watchCases/cache/max-generation/webpack.config.js b/test/watchCases/cache/max-generation/webpack.config.js index 6314aff8311..56bd72ce238 100644 --- a/test/watchCases/cache/max-generation/webpack.config.js +++ b/test/watchCases/cache/max-generation/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/watchCases/cache/new-split-chunk-entry-node/webpack.config.js b/test/watchCases/cache/new-split-chunk-entry-node/webpack.config.js index 704b991b52c..2876dcc3a16 100644 --- a/test/watchCases/cache/new-split-chunk-entry-node/webpack.config.js +++ b/test/watchCases/cache/new-split-chunk-entry-node/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/watchCases/cache/new-split-chunk-entry-web/webpack.config.js b/test/watchCases/cache/new-split-chunk-entry-web/webpack.config.js index 7b4cd8b6302..6c8857f1d10 100644 --- a/test/watchCases/cache/new-split-chunk-entry-web/webpack.config.js +++ b/test/watchCases/cache/new-split-chunk-entry-web/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/watchCases/cache/reexport-mangle/webpack.config.js b/test/watchCases/cache/reexport-mangle/webpack.config.js index 10396828746..ea1a749a6fb 100644 --- a/test/watchCases/cache/reexport-mangle/webpack.config.js +++ b/test/watchCases/cache/reexport-mangle/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js b/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js index a6974524b0b..a39dcc12a45 100644 --- a/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js +++ b/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @typedef {import("../../../../").NormalModule} NormalModule */ @@ -11,17 +13,17 @@ module.exports = (env, { srcPath }) => ({ idleTimeout: 1 }, module: { - unsafeCache: module => + unsafeCache: (module) => /module\.js/.test(/** @type {NormalModule} */ (module).resource) }, plugins: [ - compiler => { + (compiler) => { compiler.cache.hooks.get.tap( { name: "webpack.config.js", stage: -1000 }, - identifier => { + (identifier) => { if (identifier.includes(path.join(srcPath, "module.js"))) { return null; } diff --git a/test/watchCases/cache/unsafe-cache-managed-paths/webpack.config.js b/test/watchCases/cache/unsafe-cache-managed-paths/webpack.config.js index 231f2371a9b..142095c26bb 100644 --- a/test/watchCases/cache/unsafe-cache-managed-paths/webpack.config.js +++ b/test/watchCases/cache/unsafe-cache-managed-paths/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {() => import("../../../../").Configuration} */ module.exports = () => ({ mode: "development", diff --git a/test/watchCases/cache/unsafe-cache/webpack.config.js b/test/watchCases/cache/unsafe-cache/webpack.config.js index edbb2155bad..7f739928b73 100644 --- a/test/watchCases/cache/unsafe-cache/webpack.config.js +++ b/test/watchCases/cache/unsafe-cache/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/watchCases/chunks/esm-async-chunks-hmr/test.config.js b/test/watchCases/chunks/esm-async-chunks-hmr/test.config.js index 024d917ac37..ab9f34700f0 100644 --- a/test/watchCases/chunks/esm-async-chunks-hmr/test.config.js +++ b/test/watchCases/chunks/esm-async-chunks-hmr/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { bundlePath: /^main\./ }; diff --git a/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js b/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js index 7957917eca2..e6f9663d700 100644 --- a/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js +++ b/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { experiments: { @@ -21,7 +23,7 @@ module.exports = { * @param {import("../../../../").Entrypoint} entrypoint The entrypoint to generate runtime chunk name for * @returns {string} The generated runtime chunk name */ - name: entrypoint => `runtime-${entrypoint.name}` + name: (entrypoint) => `runtime-${entrypoint.name}` } }, output: { diff --git a/test/watchCases/long-term-caching/issue-8766-with-cache/webpack.config.js b/test/watchCases/long-term-caching/issue-8766-with-cache/webpack.config.js index 5438f5e84a5..de61ef61ee6 100644 --- a/test/watchCases/long-term-caching/issue-8766-with-cache/webpack.config.js +++ b/test/watchCases/long-term-caching/issue-8766-with-cache/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/watchCases/long-term-caching/issue-8766/webpack.config.js b/test/watchCases/long-term-caching/issue-8766/webpack.config.js index b3c40d3396b..7f2c6d1e800 100644 --- a/test/watchCases/long-term-caching/issue-8766/webpack.config.js +++ b/test/watchCases/long-term-caching/issue-8766/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/watchCases/plugins/automatic-prefetch-plugin-9485/webpack.config.js b/test/watchCases/plugins/automatic-prefetch-plugin-9485/webpack.config.js index cfc6b797db9..ddc4ffad23c 100644 --- a/test/watchCases/plugins/automatic-prefetch-plugin-9485/webpack.config.js +++ b/test/watchCases/plugins/automatic-prefetch-plugin-9485/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../../../"); diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/webpack.config.js b/test/watchCases/plugins/automatic-prefetch-plugin/webpack.config.js index 6b46d011d33..22091f5c87f 100644 --- a/test/watchCases/plugins/automatic-prefetch-plugin/webpack.config.js +++ b/test/watchCases/plugins/automatic-prefetch-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/watchCases/plugins/define-plugin/webpack.config.js b/test/watchCases/plugins/define-plugin/webpack.config.js index 48a78da5276..347482523de 100644 --- a/test/watchCases/plugins/define-plugin/webpack.config.js +++ b/test/watchCases/plugins/define-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); diff --git a/test/watchCases/plugins/dll-reference-plugin/webpack.config.js b/test/watchCases/plugins/dll-reference-plugin/webpack.config.js index 9f4b18a4b3d..67eac4484f8 100644 --- a/test/watchCases/plugins/dll-reference-plugin/webpack.config.js +++ b/test/watchCases/plugins/dll-reference-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/watchCases/plugins/mini-css-extract-plugin/webpack.config.js b/test/watchCases/plugins/mini-css-extract-plugin/webpack.config.js index bb8848ce287..5a0619d9282 100644 --- a/test/watchCases/plugins/mini-css-extract-plugin/webpack.config.js +++ b/test/watchCases/plugins/mini-css-extract-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const MCEP = require("mini-css-extract-plugin"); /** @type {import("../../../../").Configuration} */ diff --git a/test/watchCases/plugins/module-concatenation-plugin/webpack.config.js b/test/watchCases/plugins/module-concatenation-plugin/webpack.config.js index dffc81bba10..7389b128cd5 100644 --- a/test/watchCases/plugins/module-concatenation-plugin/webpack.config.js +++ b/test/watchCases/plugins/module-concatenation-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production" diff --git a/test/watchCases/plugins/profiling-plugin/deprecations.js b/test/watchCases/plugins/profiling-plugin/deprecations.js index dee16addc3f..368f9474dce 100644 --- a/test/watchCases/plugins/profiling-plugin/deprecations.js +++ b/test/watchCases/plugins/profiling-plugin/deprecations.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { code: /DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK/ } ]; diff --git a/test/watchCases/plugins/profiling-plugin/webpack.config.js b/test/watchCases/plugins/profiling-plugin/webpack.config.js index 0395d66871e..7678920da20 100644 --- a/test/watchCases/plugins/profiling-plugin/webpack.config.js +++ b/test/watchCases/plugins/profiling-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/watchCases/plugins/watch-ignore-plugin/webpack.config.js b/test/watchCases/plugins/watch-ignore-plugin/webpack.config.js index 076857a06a5..d7040c4264d 100644 --- a/test/watchCases/plugins/watch-ignore-plugin/webpack.config.js +++ b/test/watchCases/plugins/watch-ignore-plugin/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/watchCases/recover-from-error/missing-module/0/errors.js b/test/watchCases/recover-from-error/missing-module/0/errors.js index 8a65e54f089..d8543ba25ac 100644 --- a/test/watchCases/recover-from-error/missing-module/0/errors.js +++ b/test/watchCases/recover-from-error/missing-module/0/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Module not found/, /Can't resolve 'some-module' /]]; diff --git a/test/watchCases/recover-from-error/parse-failed-esm/0/errors.js b/test/watchCases/recover-from-error/parse-failed-esm/0/errors.js index 534e9facc4c..7b246fd2cc3 100644 --- a/test/watchCases/recover-from-error/parse-failed-esm/0/errors.js +++ b/test/watchCases/recover-from-error/parse-failed-esm/0/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Module parse failed/]]; diff --git a/test/watchCases/recover-from-error/parse-failed-esm/2/errors.js b/test/watchCases/recover-from-error/parse-failed-esm/2/errors.js index 534e9facc4c..7b246fd2cc3 100644 --- a/test/watchCases/recover-from-error/parse-failed-esm/2/errors.js +++ b/test/watchCases/recover-from-error/parse-failed-esm/2/errors.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Module parse failed/]]; diff --git a/test/watchCases/runtime/dynamic-import/webpack.config.js b/test/watchCases/runtime/dynamic-import/webpack.config.js index b536f6cfe5e..29c0e41be2b 100644 --- a/test/watchCases/runtime/dynamic-import/webpack.config.js +++ b/test/watchCases/runtime/dynamic-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/watchCases/runtime/static-import/test.config.js b/test/watchCases/runtime/static-import/test.config.js index 3080b9d1ebf..1c56555af6b 100644 --- a/test/watchCases/runtime/static-import/test.config.js +++ b/test/watchCases/runtime/static-import/test.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { bundlePath: ["./runtime~main.js", "./main.js"] }; diff --git a/test/watchCases/runtime/static-import/webpack.config.js b/test/watchCases/runtime/static-import/webpack.config.js index c95208c176b..f58bbe2c2cd 100644 --- a/test/watchCases/runtime/static-import/webpack.config.js +++ b/test/watchCases/runtime/static-import/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/watchCases/scope-hoisting/caching-inner-source/webpack.config.js b/test/watchCases/scope-hoisting/caching-inner-source/webpack.config.js index c939ba33f61..40cc8810a1e 100644 --- a/test/watchCases/scope-hoisting/caching-inner-source/webpack.config.js +++ b/test/watchCases/scope-hoisting/caching-inner-source/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/watchCases/sharing/provide-unsafe-cache/webpack.config.js b/test/watchCases/sharing/provide-unsafe-cache/webpack.config.js index efd2c99705b..0c909d86e8a 100644 --- a/test/watchCases/sharing/provide-unsafe-cache/webpack.config.js +++ b/test/watchCases/sharing/provide-unsafe-cache/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { ProvideSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/watchCases/side-effects/issue-7400/test.filter.js b/test/watchCases/side-effects/issue-7400/test.filter.js index 10518911111..02701fcf4ea 100644 --- a/test/watchCases/side-effects/issue-7400/test.filter.js +++ b/test/watchCases/side-effects/issue-7400/test.filter.js @@ -1,2 +1,4 @@ -module.exports = config => +"use strict"; + +module.exports = (config) => !(config.experiments && config.experiments.cacheUnaffected); diff --git a/test/watchCases/side-effects/issue-7400/webpack.config.js b/test/watchCases/side-effects/issue-7400/webpack.config.js index 58251b86aef..98df839f522 100644 --- a/test/watchCases/side-effects/issue-7400/webpack.config.js +++ b/test/watchCases/side-effects/issue-7400/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/watchCases/simple/multi-compiler/webpack.config.js b/test/watchCases/simple/multi-compiler/webpack.config.js index 1c53840c393..ff0a302d2fc 100644 --- a/test/watchCases/simple/multi-compiler/webpack.config.js +++ b/test/watchCases/simple/multi-compiler/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/watchCases/simple/production/webpack.config.js b/test/watchCases/simple/production/webpack.config.js index dffc81bba10..7389b128cd5 100644 --- a/test/watchCases/simple/production/webpack.config.js +++ b/test/watchCases/simple/production/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production" diff --git a/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js b/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js index 52c5156b7bf..36821b01047 100644 --- a/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js +++ b/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration} */ diff --git a/test/watchCases/warnings/warnings-contribute-to-hash/0/warnings.js b/test/watchCases/warnings/warnings-contribute-to-hash/0/warnings.js index 77561d2bebb..153b74a03f3 100644 --- a/test/watchCases/warnings/warnings-contribute-to-hash/0/warnings.js +++ b/test/watchCases/warnings/warnings-contribute-to-hash/0/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/Warning1/]]; diff --git a/test/watchCases/warnings/warnings-contribute-to-hash/1/warnings.js b/test/watchCases/warnings/warnings-contribute-to-hash/1/warnings.js index cf7a02b47ff..ff2d1ad202a 100644 --- a/test/watchCases/warnings/warnings-contribute-to-hash/1/warnings.js +++ b/test/watchCases/warnings/warnings-contribute-to-hash/1/warnings.js @@ -1 +1,3 @@ +"use strict"; + module.exports = [[/New Warning/]]; diff --git a/test/watchCases/wasm/caching/test.filter.js b/test/watchCases/wasm/caching/test.filter.js index 8f89b2fa4b7..331c7995f89 100644 --- a/test/watchCases/wasm/caching/test.filter.js +++ b/test/watchCases/wasm/caching/test.filter.js @@ -1,3 +1,5 @@ +"use strict"; + const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); module.exports = () => supportsWebAssembly(); diff --git a/test/watchCases/wasm/caching/webpack.config.js b/test/watchCases/wasm/caching/webpack.config.js index d2aff73f7bf..961b6df856e 100644 --- a/test/watchCases/wasm/caching/webpack.config.js +++ b/test/watchCases/wasm/caching/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import("../../../../").Configuration} */ module.exports = { experiments: { diff --git a/tooling/generate-runtime-code.js b/tooling/generate-runtime-code.js index 696e365369c..2804c7ce290 100644 --- a/tooling/generate-runtime-code.js +++ b/tooling/generate-runtime-code.js @@ -85,7 +85,7 @@ exports.${name}RuntimeCode = runtimeTemplate => \`var ${name} = \${runtimeTempla const prettierConfig = await prettier.resolveConfig(filePath); const newContent = await prettier.format( - content.replace(regexp, match => replaces.get(match)), + content.replace(regexp, (match) => replaces.get(match)), { filepath: filePath, ...prettierConfig } ); diff --git a/tooling/generate-wasm-code.js b/tooling/generate-wasm-code.js index 863f5789de3..3aa5c963964 100644 --- a/tooling/generate-wasm-code.js +++ b/tooling/generate-wasm-code.js @@ -77,7 +77,7 @@ const ${identifier} = new WebAssembly.Module( match = regexp.exec(content); } - const newContent = content.replace(regexp, match => replaces.get(match)); + const newContent = content.replace(regexp, (match) => replaces.get(match)); if (newContent !== content) { if (doWrite) { diff --git a/tooling/print-cache-file.js b/tooling/print-cache-file.js index e0c6bbd38ce..cd7389712f3 100644 --- a/tooling/print-cache-file.js +++ b/tooling/print-cache-file.js @@ -22,7 +22,7 @@ const lazySizes = []; * @param {(Buffer | (() => Promise))[]} data data * @returns {Promise} size info */ -const captureSize = async data => { +const captureSize = async (data) => { let size = 0; let lazySize = 0; for (const b of data) { @@ -78,7 +78,7 @@ const printData = async (data, indent) => { /** * @param {string} content content */ - const printLine = content => { + const printLine = (content) => { console.log(`${indent}${content}`); }; printLine(`Version: ${read()}`); diff --git a/types.d.ts b/types.d.ts index 885aca9fa47..8fa5306f239 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1180,6 +1180,7 @@ declare interface CallbackWebpack { (err: null | Error, stats?: T): void; } type Cell = undefined | T; +type ChildrenStatsOptions = undefined | string | boolean | StatsOptions; declare class Chunk { constructor(name?: null | string, backCompat?: boolean); id: null | string | number; @@ -1951,6 +1952,55 @@ type CodeValuePrimitive = | boolean | Function | RegExp; +declare interface Colors { + reset: (value?: any) => string; + bold: (value?: any) => string; + dim: (value?: any) => string; + italic: (value?: any) => string; + underline: (value?: any) => string; + inverse: (value?: any) => string; + hidden: (value?: any) => string; + strikethrough: (value?: any) => string; + black: (value?: any) => string; + red: (value?: any) => string; + green: (value?: any) => string; + yellow: (value?: any) => string; + blue: (value?: any) => string; + magenta: (value?: any) => string; + cyan: (value?: any) => string; + white: (value?: any) => string; + gray: (value?: any) => string; + bgBlack: (value?: any) => string; + bgRed: (value?: any) => string; + bgGreen: (value?: any) => string; + bgYellow: (value?: any) => string; + bgBlue: (value?: any) => string; + bgMagenta: (value?: any) => string; + bgCyan: (value?: any) => string; + bgWhite: (value?: any) => string; + blackBright: (value?: any) => string; + redBright: (value?: any) => string; + greenBright: (value?: any) => string; + yellowBright: (value?: any) => string; + blueBright: (value?: any) => string; + magentaBright: (value?: any) => string; + cyanBright: (value?: any) => string; + whiteBright: (value?: any) => string; + bgBlackBright: (value?: any) => string; + bgRedBright: (value?: any) => string; + bgGreenBright: (value?: any) => string; + bgYellowBright: (value?: any) => string; + bgBlueBright: (value?: any) => string; + bgMagentaBright: (value?: any) => string; + bgCyanBright: (value?: any) => string; + bgWhiteBright: (value?: any) => string; +} +declare interface ColorsOptions { + /** + * force use colors + */ + useColor?: boolean; +} declare interface Comparator { (a: T, b: T): 0 | 1 | -1; } @@ -2519,7 +2569,7 @@ declare interface CompilationHooksJavascriptModulesPlugin { renderStartup: SyncWaterfallHook<[Source, Module, StartupRenderContext]>; renderRequire: SyncWaterfallHook<[string, RenderBootstrapContext]>; inlineInRuntimeBailout: SyncBailHook< - [Module, RenderBootstrapContext], + [Module, Partial], string | void >; embedInRuntimeBailout: SyncBailHook< @@ -2701,6 +2751,7 @@ declare interface ConcatenatedModuleInfo { rawExportMap?: Map; namespaceExportSymbol?: string; namespaceObjectName?: string; + concatenationScope?: ConcatenationScope; /** * "default-with-named" namespace @@ -2746,12 +2797,17 @@ declare interface ConcatenationBailoutReasonContext { declare class ConcatenationScope { constructor( modulesMap: ModuleInfo[] | Map, - currentModule: ConcatenatedModuleInfo + currentModule: ConcatenatedModuleInfo, + usedNames: Set ); + usedNames: Set; isModuleInScope(module: Module): boolean; registerExport(exportName: string, symbol: string): void; registerRawExport(exportName: string, expression: string): void; + getRawExport(exportName: string): undefined | string; + setRawExportMap(exportName: string, expression: string): void; registerNamespaceExport(symbol: string): void; + registerUsedName(symbol: string): boolean; createModuleReference( module: Module, __1: Partial @@ -5180,6 +5236,7 @@ declare class ExternalModule extends Module { unsafeCacheData: UnsafeCacheData, normalModuleFactory: NormalModuleFactory ): void; + static ModuleExternalInitFragment: typeof ModuleExternalInitFragment; } declare interface ExternalModuleInfo { type: "external"; @@ -5606,9 +5663,9 @@ declare abstract class FileSystemInfo { ): void; createSnapshot( startTime: undefined | null | number, - files: null | Iterable, - directories: null | Iterable, - missing: null | Iterable, + files: undefined | null | Iterable, + directories: undefined | null | Iterable, + missing: undefined | null | Iterable, options: undefined | null | SnapshotOptionsFileSystemInfo, callback: (err: null | WebpackError, snapshot: null | Snapshot) => void ): void; @@ -5910,10 +5967,12 @@ declare class HarmonyImportDependency extends ModuleDependency { constructor( request: string, sourceOrder: number, - attributes?: ImportAttributes + attributes?: ImportAttributes, + defer?: boolean ); sourceOrder: number; getImportVar(moduleGraph: ModuleGraph): string; + getModuleExports(__0: DependencyTemplateContext): string; getImportStatement( update: boolean, __1: DependencyTemplateContext @@ -6226,6 +6285,7 @@ type ImportSource = | SimpleLiteral | RegExpLiteral | BigIntLiteral; +type Imported = true | [string, string][]; /** * Options for infrastructure level logging. @@ -6288,6 +6348,8 @@ declare class InitFragment { serialize(context: ObjectSerializerContext): void; deserialize(context: ObjectDeserializerContext): void; merge: any; + getImported: any; + setImported: any; static addToSource( source: Source, initFragments: InitFragment[], @@ -7818,6 +7880,11 @@ declare interface JavascriptParserOptions { */ createRequire?: string | boolean; + /** + * Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use. + */ + deferImport?: boolean; + /** * Specifies global fetchPriority for dynamic import. */ @@ -8445,7 +8512,7 @@ declare interface KnownStatsChunkOrigin { moduleId?: string | number; } declare interface KnownStatsCompilation { - env?: Record; + env?: any; name?: string; hash?: string; version?: string; @@ -9759,6 +9826,28 @@ declare class ModuleDependency extends Dependency { static EXPORTS_OBJECT_REFERENCED: string[][]; static TRANSITIVE: typeof TRANSITIVE; } +declare class ModuleExternalInitFragment extends InitFragment { + constructor( + request: string, + imported: Imported, + ident?: string, + dependencyMeta?: ImportDependencyMeta, + hashFunction?: string | typeof Hash + ); + getNamespaceIdentifier(): string; + static addToSource( + source: Source, + initFragments: InitFragment[], + context: Context + ): Source; + static STAGE_CONSTANTS: number; + static STAGE_ASYNC_BOUNDARY: number; + static STAGE_HARMONY_EXPORTS: number; + static STAGE_HARMONY_IMPORTS: number; + static STAGE_PROVIDES: number; + static STAGE_ASYNC_DEPENDENCIES: number; + static STAGE_ASYNC_HARMONY_IMPORTS: number; +} declare abstract class ModuleFactory { create( data: ModuleFactoryCreateData, @@ -10417,14 +10506,18 @@ declare interface MultiCompilerOptions { */ parallelism?: number; } +type MultiConfiguration = ReadonlyArray & MultiCompilerOptions; declare abstract class MultiStats { stats: Stats[]; get hash(): string; hasErrors(): boolean; hasWarnings(): boolean; - toJson(options?: string | boolean | StatsOptions): StatsCompilation; - toString(options?: string | boolean | StatsOptions): string; + toJson(options?: string | boolean | MultiStatsOptions): StatsCompilation; + toString(options?: string | boolean | MultiStatsOptions): string; } +type MultiStatsOptions = Omit & { + children?: string | boolean | StatsOptions | ChildrenStatsOptions[]; +}; declare abstract class MultiWatching { watchings: Watching[]; compiler: MultiCompiler; @@ -10877,43 +10970,43 @@ declare class NormalModuleReplacementPlugin { type NormalizedStatsOptions = KnownNormalizedStatsOptions & Omit< StatsOptions, - | "context" - | "chunkGroups" - | "requestShortener" - | "chunksSort" - | "modulesSort" - | "chunkModulesSort" - | "nestedModulesSort" | "assetsSort" - | "ids" - | "cachedAssets" - | "groupAssetsByEmitStatus" - | "groupAssetsByPath" - | "groupAssetsByExtension" | "assetsSpace" - | "excludeAssets" - | "excludeModules" - | "warningsFilter" + | "cachedAssets" | "cachedModules" - | "orphanModules" + | "chunkGroupAuxiliary" + | "chunkGroupChildren" + | "chunkGroupMaxAssets" + | "chunkGroups" + | "chunkModulesSpace" + | "chunksSort" + | "context" | "dependentModules" - | "runtimeModules" + | "entrypoints" + | "excludeAssets" + | "excludeModules" + | "groupAssetsByEmitStatus" + | "groupAssetsByExtension" + | "groupAssetsByPath" + | "groupModulesByAttributes" | "groupModulesByCacheStatus" + | "groupModulesByExtension" | "groupModulesByLayer" - | "groupModulesByAttributes" | "groupModulesByPath" - | "groupModulesByExtension" | "groupModulesByType" - | "entrypoints" - | "chunkGroupAuxiliary" - | "chunkGroupChildren" - | "chunkGroupMaxAssets" - | "modulesSpace" - | "chunkModulesSpace" - | "nestedModulesSpace" + | "ids" | "logging" | "loggingDebug" | "loggingTrace" + | "modulesSort" + | "modulesSpace" + | "nestedModulesSpace" + | "orphanModules" + | "runtimeModules" + | "warningsFilter" + | "requestShortener" + | "chunkModulesSort" + | "nestedModulesSort" | "_env" > & Record; @@ -12574,7 +12667,7 @@ declare class ProgressPlugin { showModules?: boolean; showDependencies?: boolean; showActiveModules?: boolean; - percentBy?: null | "entries" | "modules" | "dependencies"; + percentBy?: null | "modules" | "entries" | "dependencies"; apply(compiler: Compiler | MultiCompiler): void; static getReporter( compiler: Compiler @@ -12639,7 +12732,7 @@ declare interface ProgressPluginOptions { /** * Collect percent algorithm. By default it calculates by a median from modules, entries and dependencies percent. */ - percentBy?: null | "entries" | "modules" | "dependencies"; + percentBy?: null | "modules" | "entries" | "dependencies"; /** * Collect profile data for progress steps. Default: false. @@ -14912,6 +15005,7 @@ declare abstract class RuntimeTemplate { supportsEcmaScriptModuleSyntax(): undefined | boolean; supportTemplateLiteral(): undefined | boolean; supportNodePrefixForCoreModules(): undefined | boolean; + renderNodePrefixForCoreModule(mod: string): string; returningFunction(returnValue: string, args?: string): string; basicFunction(args: string, body: string | string[]): string; concatenation(...args: (string | { expr: string })[]): string; @@ -17389,21 +17483,24 @@ declare interface WriteStreamOptions { declare function exports( options: Configuration, callback?: CallbackWebpack -): Compiler; +): null | Compiler; declare function exports( - options: ReadonlyArray & MultiCompilerOptions, + options: MultiConfiguration, callback?: CallbackWebpack -): MultiCompiler; +): null | MultiCompiler; declare namespace exports { export const webpack: { - (options: Configuration, callback?: CallbackWebpack): Compiler; ( - options: ReadonlyArray & MultiCompilerOptions, + options: Configuration, + callback?: CallbackWebpack + ): null | Compiler; + ( + options: MultiConfiguration, callback?: CallbackWebpack - ): MultiCompiler; + ): null | MultiCompiler; }; export const validate: ( - configuration: Configuration | Configuration[] + configuration: Configuration | MultiConfiguration ) => void; export const validateSchema: ( schema: Parameters[0], @@ -17412,6 +17509,7 @@ declare namespace exports { ) => void; export const version: string; export namespace cli { + export let createColors: (__0?: ColorsOptions) => Colors; export let getArguments: ( schema?: | (JSONSchema4 & { @@ -17448,6 +17546,7 @@ declare namespace exports { }; }) ) => Flags; + export let isColorSupported: () => boolean; export let processArguments: ( args: Flags, config: ObjectConfiguration, @@ -17525,6 +17624,10 @@ declare namespace exports { export let ensureChunkHandlers: "__webpack_require__.f"; export let ensureChunkIncludeEntries: "__webpack_require__.f (include entries)"; export let entryModuleId: "__webpack_require__.s"; + export let esmId: "__webpack_esm_id__"; + export let esmIds: "__webpack_esm_ids__"; + export let esmModules: "__webpack_esm_modules__"; + export let esmRuntime: "__webpack_esm_runtime__"; export let exports: "__webpack_exports__"; export let externalInstallChunk: "__webpack_require__.C"; export let getChunkCssFilename: "__webpack_require__.k"; @@ -18100,7 +18203,9 @@ declare namespace exports { AssetEmittedInfo, Entrypoint, MultiCompilerOptions, + MultiConfiguration, MultiStats, + MultiStatsOptions, ResolveData, ParserState, ResolvePluginInstance, @@ -18108,6 +18213,8 @@ declare namespace exports { Watching, Argument, Problem, + Colors, + ColorsOptions, StatsAsset, StatsChunk, StatsChunkGroup, diff --git a/yarn.lock b/yarn.lock index e57c3c2e6ea..e682fd560a3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -116,7 +116,7 @@ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== -"@babel/helper-validator-identifier@^7.25.9", "@babel/helper-validator-identifier@^7.27.1": +"@babel/helper-validator-identifier@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== @@ -350,14 +350,6 @@ form-data "^4.0.0" node-gyp-build "^4.6.0" -"@codspeed/tinybench-plugin@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@codspeed/tinybench-plugin/-/tinybench-plugin-4.0.1.tgz#b0e27a963c03e6ca84c99685ee86abdbd3aa5c9f" - integrity sha512-hga1xif6XU8p/FZqTHzUrDPrBSLqxc3NuxMX8m4P8AIdhORsPrvgSNe09uVYlVOtD6jG7kPsmx5DZscez4wKrQ== - dependencies: - "@codspeed/core" "^4.0.1" - stack-trace "1.0.0-pre2" - "@cspell/cspell-bundled-dicts@9.1.3": version "9.1.3" resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-9.1.3.tgz#ad26ab92489fb5ac45e3a967ba2afd71560d8aab" @@ -806,7 +798,7 @@ esquery "^1.6.0" jsdoc-type-pratt-parser "~4.1.0" -"@eslint-community/eslint-utils@^4.1.2", "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.5.0", "@eslint-community/eslint-utils@^4.5.1", "@eslint-community/eslint-utils@^4.7.0": +"@eslint-community/eslint-utils@^4.1.2", "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.5.0", "@eslint-community/eslint-utils@^4.7.0": version "4.7.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz#607084630c6c033992a082de6e6fbc1a8b52175a" integrity sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw== @@ -832,20 +824,6 @@ resolved "https://registry.yarnpkg.com/@eslint/config-helpers/-/config-helpers-0.3.0.tgz#3e09a90dfb87e0005c7694791e58e97077271286" integrity sha512-ViuymvFmcJi04qdZeDc2whTHryouGcDlaxPqarTD0ZE10ISpxGUVZGZDx4w01upyIynL3iu6IXH2bS1NhclQMw== -"@eslint/core@^0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.13.0.tgz#bf02f209846d3bf996f9e8009db62df2739b458c" - integrity sha512-yfkgDw1KR66rkT5A8ci4irzDysN7FRpq3ttJolR88OqQikAWqwA8j5VZyas+vjyBNFIJ7MfybJ9plMILI2UrCw== - dependencies: - "@types/json-schema" "^7.0.15" - -"@eslint/core@^0.14.0": - version "0.14.0" - resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.14.0.tgz#326289380968eaf7e96f364e1e4cf8f3adf2d003" - integrity sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg== - dependencies: - "@types/json-schema" "^7.0.15" - "@eslint/core@^0.15.0", "@eslint/core@^0.15.1": version "0.15.1" resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.15.1.tgz#d530d44209cbfe2f82ef86d6ba08760196dd3b60" @@ -868,22 +846,22 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.31.0", "@eslint/js@^9.29.0": - version "9.31.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.31.0.tgz#adb1f39953d8c475c4384b67b67541b0d7206ed8" - integrity sha512-LOm5OVt7D4qiKCqoiPbA7LWmI+tbw1VbTUowBcUMgQSuM6poJufkFkYDcQpo5KfgD39TnNySV26QjOh7VFpSyw== +"@eslint/js@9.32.0", "@eslint/js@^9.29.0": + version "9.32.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.32.0.tgz#a02916f58bd587ea276876cb051b579a3d75d091" + integrity sha512-BBpRFZK3eX6uMLKz8WxFOBIFFcGFJ/g8XuwjTHCqHROSIsopI+ddn/d5Cfh36+7+e5edVS8dbSHnBNhrLEX0zg== -"@eslint/markdown@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@eslint/markdown/-/markdown-7.0.0.tgz#e5711a23fd69764a31f4abfd1612de05f14ac3c3" - integrity sha512-0WNH6pSFHNlWSlNaIFQP0sLHpMUJw1FaJtyqapvGqOt0ISRgTUkTLVT0hT/zekDA1QlP2TT8pwjPkqYTu2s8yg== +"@eslint/markdown@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@eslint/markdown/-/markdown-7.1.0.tgz#c35be3f16d9e74077ca238ceca184ded0bac74bc" + integrity sha512-Y+X1B1j+/zupKDVJfkKc8uYMjQkGzfnd8lt7vK3y8x9Br6H5dBuhAfFrQ6ff7HAMm/1BwgecyEiRFkYCWPRxmA== dependencies: - "@eslint/core" "^0.14.0" - "@eslint/plugin-kit" "^0.3.1" + "@eslint/core" "^0.15.1" + "@eslint/plugin-kit" "^0.3.4" github-slugger "^2.0.0" mdast-util-from-markdown "^2.0.2" mdast-util-frontmatter "^2.0.1" - mdast-util-gfm "^3.0.0" + mdast-util-gfm "^3.1.0" micromark-extension-frontmatter "^2.0.0" micromark-extension-gfm "^3.0.0" @@ -892,18 +870,10 @@ resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.6.tgz#58369ab5b5b3ca117880c0f6c0b0f32f6950f24f" integrity sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA== -"@eslint/plugin-kit@^0.2.7": - version "0.2.8" - resolved "https://registry.yarnpkg.com/@eslint/plugin-kit/-/plugin-kit-0.2.8.tgz#47488d8f8171b5d4613e833313f3ce708e3525f8" - integrity sha512-ZAoA40rNMPwSm+AeHpCq8STiNAwzWLJuP8Xv4CHIc9wv/PSuExjMrmjfYNj682vW0OOiZ1HKxzvjQr9XZIisQA== - dependencies: - "@eslint/core" "^0.13.0" - levn "^0.4.1" - -"@eslint/plugin-kit@^0.3.1": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@eslint/plugin-kit/-/plugin-kit-0.3.3.tgz#32926b59bd407d58d817941e48b2a7049359b1fd" - integrity sha512-1+WqvgNMhmlAambTvT3KPtCl/Ibr68VldY2XY40SL1CE0ZXiakFR/cbTspaF5HsnpDMvcYYoJHfl4980NBjGag== +"@eslint/plugin-kit@^0.3.3", "@eslint/plugin-kit@^0.3.4": + version "0.3.4" + resolved "https://registry.yarnpkg.com/@eslint/plugin-kit/-/plugin-kit-0.3.4.tgz#c6b9f165e94bf4d9fdd493f1c028a94aaf5fc1cc" + integrity sha512-Ul5l+lHEcw3L5+k8POx6r74mxEYKG5kOb6Xpy2gCRW6zweT6TEhAf8vhxGgjhqrd/VO/Dirhsb+1hNpD1ue9hw== dependencies: "@eslint/core" "^0.15.1" levn "^0.4.1" @@ -971,50 +941,50 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-30.0.4.tgz#943a62c3c8e3f495290f2e2c3749b7b4516c3e93" - integrity sha512-tMLCDvBJBwPqMm4OAiuKm2uF5y5Qe26KgcMn+nrDSWpEW+eeFmqA0iO4zJfL16GP7gE3bUUQ3hIuUJ22AqVRnw== +"@jest/console@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-30.0.5.tgz#d7d027c2db5c64c20a973b7f3e57b49956d6c335" + integrity sha512-xY6b0XiL0Nav3ReresUarwl2oIz1gTnxGbGpho9/rbUWsLH0f1OD/VT84xs8c7VmH7MChnLb0pag6PhZhAdDiA== dependencies: - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" "@types/node" "*" chalk "^4.1.2" - jest-message-util "30.0.2" - jest-util "30.0.2" + jest-message-util "30.0.5" + jest-util "30.0.5" slash "^3.0.0" -"@jest/core@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-30.0.4.tgz#a8fc7fcdc8a650f50f33dd585d774a1f683e9e59" - integrity sha512-MWScSO9GuU5/HoWjpXAOBs6F/iobvK1XlioelgOM9St7S0Z5WTI9kjCQLPeo4eQRRYusyLW25/J7J5lbFkrYXw== +"@jest/core@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-30.0.5.tgz#b5778922d2928f676636e3ec199829554e61e452" + integrity sha512-fKD0OulvRsXF1hmaFgHhVJzczWzA1RXMMo9LTPuFXo9q/alDbME3JIyWYqovWsUBWSoBcsHaGPSLF9rz4l9Qeg== dependencies: - "@jest/console" "30.0.4" + "@jest/console" "30.0.5" "@jest/pattern" "30.0.1" - "@jest/reporters" "30.0.4" - "@jest/test-result" "30.0.4" - "@jest/transform" "30.0.4" - "@jest/types" "30.0.1" + "@jest/reporters" "30.0.5" + "@jest/test-result" "30.0.5" + "@jest/transform" "30.0.5" + "@jest/types" "30.0.5" "@types/node" "*" ansi-escapes "^4.3.2" chalk "^4.1.2" ci-info "^4.2.0" exit-x "^0.2.2" graceful-fs "^4.2.11" - jest-changed-files "30.0.2" - jest-config "30.0.4" - jest-haste-map "30.0.2" - jest-message-util "30.0.2" + jest-changed-files "30.0.5" + jest-config "30.0.5" + jest-haste-map "30.0.5" + jest-message-util "30.0.5" jest-regex-util "30.0.1" - jest-resolve "30.0.2" - jest-resolve-dependencies "30.0.4" - jest-runner "30.0.4" - jest-runtime "30.0.4" - jest-snapshot "30.0.4" - jest-util "30.0.2" - jest-validate "30.0.2" - jest-watcher "30.0.4" + jest-resolve "30.0.5" + jest-resolve-dependencies "30.0.5" + jest-runner "30.0.5" + jest-runtime "30.0.5" + jest-snapshot "30.0.5" + jest-util "30.0.5" + jest-validate "30.0.5" + jest-watcher "30.0.5" micromatch "^4.0.8" - pretty-format "30.0.2" + pretty-format "30.0.5" slash "^3.0.0" "@jest/diff-sequences@30.0.1": @@ -1022,57 +992,57 @@ resolved "https://registry.yarnpkg.com/@jest/diff-sequences/-/diff-sequences-30.0.1.tgz#0ededeae4d071f5c8ffe3678d15f3a1be09156be" integrity sha512-n5H8QLDJ47QqbCNn5SuFjCRDrOLEZ0h8vAHCK5RL9Ls7Xa8AQLa/YxAc9UjFqoEDM48muwtBGjtMY5cr0PLDCw== -"@jest/environment@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-30.0.4.tgz#fb0deafd8a3cbb06cd9ce0b52c6bcaf342778428" - integrity sha512-5NT+sr7ZOb8wW7C4r7wOKnRQ8zmRWQT2gW4j73IXAKp5/PX1Z8MCStBLQDYfIG3n1Sw0NRfYGdp0iIPVooBAFQ== +"@jest/environment@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-30.0.5.tgz#eaaae0403c7d3f8414053c2224acc3011e1c3a1b" + integrity sha512-aRX7WoaWx1oaOkDQvCWImVQ8XNtdv5sEWgk4gxR6NXb7WBUnL5sRak4WRzIQRZ1VTWPvV4VI4mgGjNL9TeKMYA== dependencies: - "@jest/fake-timers" "30.0.4" - "@jest/types" "30.0.1" + "@jest/fake-timers" "30.0.5" + "@jest/types" "30.0.5" "@types/node" "*" - jest-mock "30.0.2" + jest-mock "30.0.5" -"@jest/expect-utils@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.0.4.tgz#0512fb2588c7fc463ce26fb38c0d47814266d965" - integrity sha512-EgXecHDNfANeqOkcak0DxsoVI4qkDUsR7n/Lr2vtmTBjwLPBnnPOF71S11Q8IObWzxm2QgQoY6f9hzrRD3gHRA== +"@jest/expect-utils@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.0.5.tgz#9d42e4b8bc80367db30abc6c42b2cb14073f66fc" + integrity sha512-F3lmTT7CXWYywoVUGTCmom0vXq3HTTkaZyTAzIy+bXSBizB7o5qzlC9VCtq0arOa8GqmNsbg/cE9C6HLn7Szew== dependencies: "@jest/get-type" "30.0.1" -"@jest/expect@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-30.0.4.tgz#de25549873ccc0302faeef96044acae464f50997" - integrity sha512-Z/DL7t67LBHSX4UzDyeYKqOxE/n7lbrrgEwWM3dGiH5Dgn35nk+YtgzKudmfIrBI8DRRrKYY5BCo3317HZV1Fw== +"@jest/expect@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-30.0.5.tgz#2bbd101df4869f5d171c3cfee881f810f1525005" + integrity sha512-6udac8KKrtTtC+AXZ2iUN/R7dp7Ydry+Fo6FPFnDG54wjVMnb6vW/XNlf7Xj8UDjAE3aAVAsR4KFyKk3TCXmTA== dependencies: - expect "30.0.4" - jest-snapshot "30.0.4" + expect "30.0.5" + jest-snapshot "30.0.5" -"@jest/fake-timers@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-30.0.4.tgz#fdd4552541a99826e488fc01afdb7626d6ad46cd" - integrity sha512-qZ7nxOcL5+gwBO6LErvwVy5k06VsX/deqo2XnVUSTV0TNC9lrg8FC3dARbi+5lmrr5VyX5drragK+xLcOjvjYw== +"@jest/fake-timers@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-30.0.5.tgz#c028a9465a44b7744cb2368196bed89ce13c7054" + integrity sha512-ZO5DHfNV+kgEAeP3gK3XlpJLL4U3Sz6ebl/n68Uwt64qFFs5bv4bfEEjyRGK5uM0C90ewooNgFuKMdkbEoMEXw== dependencies: - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" "@sinonjs/fake-timers" "^13.0.0" "@types/node" "*" - jest-message-util "30.0.2" - jest-mock "30.0.2" - jest-util "30.0.2" + jest-message-util "30.0.5" + jest-mock "30.0.5" + jest-util "30.0.5" "@jest/get-type@30.0.1": version "30.0.1" resolved "https://registry.yarnpkg.com/@jest/get-type/-/get-type-30.0.1.tgz#0d32f1bbfba511948ad247ab01b9007724fc9f52" integrity sha512-AyYdemXCptSRFirI5EPazNxyPwAL0jXt3zceFjaj8NFiKP9pOi0bfXonf6qkf82z2t3QWPeLCWWw4stPBzctLw== -"@jest/globals@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-30.0.4.tgz#8650aa24c587fae830915b5c3518e82bd2ac5e60" - integrity sha512-avyZuxEHF2EUhFF6NEWVdxkRRV6iXXcIES66DLhuLlU7lXhtFG/ySq/a8SRZmEJSsLkNAFX6z6mm8KWyXe9OEA== +"@jest/globals@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-30.0.5.tgz#ca70e0ac08ab40417cf8cd92bcb76116c2ccca63" + integrity sha512-7oEJT19WW4oe6HR7oLRvHxwlJk2gev0U9px3ufs8sX9PoD1Eza68KF0/tlN7X0dq/WVsBScXQGgCldA1V9Y/jA== dependencies: - "@jest/environment" "30.0.4" - "@jest/expect" "30.0.4" - "@jest/types" "30.0.1" - jest-mock "30.0.2" + "@jest/environment" "30.0.5" + "@jest/expect" "30.0.5" + "@jest/types" "30.0.5" + jest-mock "30.0.5" "@jest/pattern@30.0.1": version "30.0.1" @@ -1082,16 +1052,16 @@ "@types/node" "*" jest-regex-util "30.0.1" -"@jest/reporters@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-30.0.4.tgz#8ff5939713f643f788b48d3edcf15f2c06a00a63" - integrity sha512-6ycNmP0JSJEEys1FbIzHtjl9BP0tOZ/KN6iMeAKrdvGmUsa1qfRdlQRUDKJ4P84hJ3xHw1yTqJt4fvPNHhyE+g== +"@jest/reporters@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-30.0.5.tgz#b83585e6448d390a8d92a641c567f1655976d5c6" + integrity sha512-mafft7VBX4jzED1FwGC1o/9QUM2xebzavImZMeqnsklgcyxBto8mV4HzNSzUrryJ+8R9MFOM3HgYuDradWR+4g== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "30.0.4" - "@jest/test-result" "30.0.4" - "@jest/transform" "30.0.4" - "@jest/types" "30.0.1" + "@jest/console" "30.0.5" + "@jest/test-result" "30.0.5" + "@jest/transform" "30.0.5" + "@jest/types" "30.0.5" "@jridgewell/trace-mapping" "^0.3.25" "@types/node" "*" chalk "^4.1.2" @@ -1104,26 +1074,26 @@ istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^5.0.0" istanbul-reports "^3.1.3" - jest-message-util "30.0.2" - jest-util "30.0.2" - jest-worker "30.0.2" + jest-message-util "30.0.5" + jest-util "30.0.5" + jest-worker "30.0.5" slash "^3.0.0" string-length "^4.0.2" v8-to-istanbul "^9.0.1" -"@jest/schemas@30.0.1": - version "30.0.1" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-30.0.1.tgz#27c00d707d480ece0c19126af97081a1af3bc46e" - integrity sha512-+g/1TKjFuGrf1Hh0QPCv0gISwBxJ+MQSNXmG9zjHy7BmFhtoJ9fdNhWJp3qUKRi93AOZHXtdxZgJ1vAtz6z65w== +"@jest/schemas@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-30.0.5.tgz#7bdf69fc5a368a5abdb49fd91036c55225846473" + integrity sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA== dependencies: "@sinclair/typebox" "^0.34.0" -"@jest/snapshot-utils@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/snapshot-utils/-/snapshot-utils-30.0.4.tgz#cd5b3d21e19255106b12350d55c1b9bf613fbcfa" - integrity sha512-BEpX8M/Y5lG7MI3fmiO+xCnacOrVsnbqVrcDZIT8aSGkKV1w2WwvRQxSWw5SIS8ozg7+h8tSj5EO1Riqqxcdag== +"@jest/snapshot-utils@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/snapshot-utils/-/snapshot-utils-30.0.5.tgz#e23a0e786f174e8cff7f150c1cfbdc9cb7cc81a4" + integrity sha512-XcCQ5qWHLvi29UUrowgDFvV4t7ETxX91CbDczMnoqXPOIcZOxyNdSjm6kV5XMc8+HkxfRegU/MUmnTbJRzGrUQ== dependencies: - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" chalk "^4.1.2" graceful-fs "^4.2.11" natural-compare "^1.4.0" @@ -1137,54 +1107,54 @@ callsites "^3.1.0" graceful-fs "^4.2.11" -"@jest/test-result@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-30.0.4.tgz#0b1c4e8256e3f9ebb9452ede22d4b04b31ea54fe" - integrity sha512-Mfpv8kjyKTHqsuu9YugB6z1gcdB3TSSOaKlehtVaiNlClMkEHY+5ZqCY2CrEE3ntpBMlstX/ShDAf84HKWsyIw== +"@jest/test-result@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-30.0.5.tgz#064c5210c24d5ea192fb02ceddad3be1cfa557c8" + integrity sha512-wPyztnK0gbDMQAJZ43tdMro+qblDHH1Ru/ylzUo21TBKqt88ZqnKKK2m30LKmLLoKtR2lxdpCC/P3g1vfKcawQ== dependencies: - "@jest/console" "30.0.4" - "@jest/types" "30.0.1" + "@jest/console" "30.0.5" + "@jest/types" "30.0.5" "@types/istanbul-lib-coverage" "^2.0.6" collect-v8-coverage "^1.0.2" -"@jest/test-sequencer@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-30.0.4.tgz#4ef749c994beca340e274e67a4c90f0154482e5f" - integrity sha512-bj6ePmqi4uxAE8EHE0Slmk5uBYd9Vd/PcVt06CsBxzH4bbA8nGsI1YbXl/NH+eii4XRtyrRx+Cikub0x8H4vDg== +"@jest/test-sequencer@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-30.0.5.tgz#c6dba8fc3c386dd793c087626e8508ff1ead19f4" + integrity sha512-Aea/G1egWoIIozmDD7PBXUOxkekXl7ueGzrsGGi1SbeKgQqCYCIf+wfbflEbf2LiPxL8j2JZGLyrzZagjvW4YQ== dependencies: - "@jest/test-result" "30.0.4" + "@jest/test-result" "30.0.5" graceful-fs "^4.2.11" - jest-haste-map "30.0.2" + jest-haste-map "30.0.5" slash "^3.0.0" -"@jest/transform@30.0.4": - version "30.0.4" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-30.0.4.tgz#a06f8c6fc2a04985241b483096f821bafb99cc93" - integrity sha512-atvy4hRph/UxdCIBp+UB2jhEA/jJiUeGZ7QPgBi9jUUKNgi3WEoMXGNG7zbbELG2+88PMabUNCDchmqgJy3ELg== +"@jest/transform@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-30.0.5.tgz#f8ca2e9f7466b77b406807d3bef1f6790dd384e4" + integrity sha512-Vk8amLQCmuZyy6GbBht1Jfo9RSdBtg7Lks+B0PecnjI8J+PCLQPGh7uI8Q/2wwpW2gLdiAfiHNsmekKlywULqg== dependencies: "@babel/core" "^7.27.4" - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" "@jridgewell/trace-mapping" "^0.3.25" babel-plugin-istanbul "^7.0.0" chalk "^4.1.2" convert-source-map "^2.0.0" fast-json-stable-stringify "^2.1.0" graceful-fs "^4.2.11" - jest-haste-map "30.0.2" + jest-haste-map "30.0.5" jest-regex-util "30.0.1" - jest-util "30.0.2" + jest-util "30.0.5" micromatch "^4.0.8" pirates "^4.0.7" slash "^3.0.0" write-file-atomic "^5.0.1" -"@jest/types@30.0.1": - version "30.0.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-30.0.1.tgz#a46df6a99a416fa685740ac4264b9f9cd7da1598" - integrity sha512-HGwoYRVF0QSKJu1ZQX0o5ZrUrrhj0aOOFA8hXrumD7SIzjouevhawbTjmXdwOmURdGluU9DM/XvGm3NyFoiQjw== +"@jest/types@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-30.0.5.tgz#29a33a4c036e3904f1cfd94f6fe77f89d2e1cc05" + integrity sha512-aREYa3aku9SSnea4aX6bhKn4bgv3AXkgijoQgbYV3yvbiGt6z+MQ85+6mIhx9DsKW2BuB/cLR/A+tcMThx+KLQ== dependencies: "@jest/pattern" "30.0.1" - "@jest/schemas" "30.0.1" + "@jest/schemas" "30.0.5" "@types/istanbul-lib-coverage" "^2.0.6" "@types/istanbul-reports" "^3.0.4" "@types/node" "*" @@ -1344,17 +1314,17 @@ dependencies: "@sinonjs/commons" "^3.0.1" -"@stylistic/eslint-plugin@^5.0.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-5.1.0.tgz#98769a3e6fc68d92deba20538341b0ea7923b3ce" - integrity sha512-TJRJul4u/lmry5N/kyCU+7RWWOk0wyXN+BncRlDYBqpLFnzXkd7QGVfN7KewarFIXv0IX0jSF/Ksu7aHWEDeuw== +"@stylistic/eslint-plugin@^5.2.2": + version "5.2.2" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-5.2.2.tgz#a1cb24f17263e1dcb2d5c94069dc3ae7af1eb9ce" + integrity sha512-bE2DUjruqXlHYP3Q2Gpqiuj2bHq7/88FnuaS0FjeGGLCy+X6a07bGVuwtiOYnPSLHR6jmx5Bwdv+j7l8H+G97A== dependencies: "@eslint-community/eslint-utils" "^4.7.0" - "@typescript-eslint/types" "^8.34.1" + "@typescript-eslint/types" "^8.37.0" eslint-visitor-keys "^4.2.1" espree "^10.4.0" estraverse "^5.3.0" - picomatch "^4.0.2" + picomatch "^4.0.3" "@tokenizer/token@^0.3.0": version "0.3.0" @@ -1495,10 +1465,10 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-2.1.0.tgz#052aa67a48eccc4309d7f0191b7e41434b90bb78" integrity sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA== -"@types/node@*", "@types/node@^24.0.13": - version "24.0.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.13.tgz#93ed8c05c7b188a59760be0ce2ee3fa7ad0f83f6" - integrity sha512-Qm9OYVOFHFYg3wJoTSrz80hoec5Lia/dPp84do3X7dZvLikQvM1YpmvTBEdIr/e+U8HTkFjLHLnl78K/qjf+jQ== +"@types/node@*", "@types/node@^24.1.0": + version "24.1.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.1.0.tgz#0993f7dc31ab5cc402d112315b463e383d68a49c" + integrity sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w== dependencies: undici-types "~7.8.0" @@ -1553,11 +1523,16 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.36.0.tgz#63ef8a20ae9b5754c6ceacbe87b2fe1aab12ba13" integrity sha512-Nhh3TIEgN18mNbdXpd5Q8mSCBnrZQeY9V7Ca3dqYvNDStNIGRmJA6dmrIPMJ0kow3C7gcQbpsG2rPzy1Ks/AnA== -"@typescript-eslint/types@8.36.0", "@typescript-eslint/types@^8.34.1", "@typescript-eslint/types@^8.36.0": +"@typescript-eslint/types@8.36.0": version "8.36.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.36.0.tgz#d3d184adc2899e2912c13b17c1590486ef37c7ac" integrity sha512-xGms6l5cTJKQPZOKM75Dl9yBfNdGeLRsIyufewnxT4vZTrjC0ImQT4fj8QmtJK84F58uSh5HVBSANwcfiXxABQ== +"@typescript-eslint/types@^8.34.1", "@typescript-eslint/types@^8.36.0", "@typescript-eslint/types@^8.37.0": + version "8.37.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.37.0.tgz#09517aa9625eb3c68941dde3ac8835740587b6ff" + integrity sha512-ax0nv7PUF9NOVPs+lmQ7yIE7IQmAf8LGcXbMvHX5Gm+YJUYNAl340XkGnrimxZ0elXyoQJuN5sbg6C4evKA4SQ== + "@typescript-eslint/typescript-estree@8.36.0": version "8.36.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.36.0.tgz#344857fa79f71715369554a3cbb6b4ff8695a7bc" @@ -2141,20 +2116,20 @@ available-typed-arrays@^1.0.7: possible-typed-array-names "^1.0.0" axios@^1.4.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.10.0.tgz#af320aee8632eaf2a400b6a1979fa75856f38d54" - integrity sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw== + version "1.11.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.11.0.tgz#c2ec219e35e414c025b2095e8b8280278478fdb6" + integrity sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA== dependencies: follow-redirects "^1.15.6" - form-data "^4.0.0" + form-data "^4.0.4" proxy-from-env "^1.1.0" -babel-jest@30.0.4: - version "30.0.4" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-30.0.4.tgz#63945c1b27227312fc687689073124dba5b28282" - integrity sha512-UjG2j7sAOqsp2Xua1mS/e+ekddkSu3wpf4nZUSvXNHuVWdaOUXQ77+uyjJLDE9i0atm5x4kds8K9yb5lRsRtcA== +babel-jest@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-30.0.5.tgz#7cc7dd03d0d613125d458521f635b8c2361e89cc" + integrity sha512-mRijnKimhGDMsizTvBTWotwNpzrkHr+VvZUQBof2AufXKB8NXrL1W69TG20EvOz7aevx6FTJIaBuBkYxS8zolg== dependencies: - "@jest/transform" "30.0.4" + "@jest/transform" "30.0.5" "@types/babel__core" "^7.20.5" babel-plugin-istanbul "^7.0.0" babel-preset-jest "30.0.1" @@ -2420,6 +2395,11 @@ chalk@^5.2.0, chalk@^5.4.1: resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.4.1.tgz#1b48bf0963ec158dce2aacf69c093ae2dd2092d8" integrity sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w== +change-case@^5.4.4: + version "5.4.4" + resolved "https://registry.yarnpkg.com/change-case/-/change-case-5.4.4.tgz#0d52b507d8fb8f204343432381d1a6d7bff97a02" + integrity sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w== + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -2454,7 +2434,7 @@ chrome-trace-event@^1.0.2: resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b" integrity sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ== -ci-info@^4.2.0: +ci-info@^4.2.0, ci-info@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.3.0.tgz#c39b1013f8fdbd28cd78e62318357d02da160cd7" integrity sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ== @@ -2661,7 +2641,7 @@ copy-anything@^2.0.1: dependencies: is-what "^3.14.1" -core-js-compat@^3.41.0: +core-js-compat@^3.44.0: version "3.44.0" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.44.0.tgz#62b9165b97e4cbdb8bca16b14818e67428b4a0f8" integrity sha512-JepmAj2zfl6ogy34qfWtcE7nHKAJnKsQFRn++scjVS2bZFllwptzw61BZcZFYBPpUznLfAvh0LGhxKppk04ClA== @@ -3310,19 +3290,19 @@ eslint-compat-utils@^0.5.1: semver "^7.5.4" eslint-config-prettier@^10.1.1: - version "10.1.5" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-10.1.5.tgz#00c18d7225043b6fbce6a665697377998d453782" - integrity sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw== + version "10.1.8" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz#15734ce4af8c2778cc32f0b01b37b0b5cd1ecb97" + integrity sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w== -eslint-config-webpack@^4.3.0: - version "4.3.4" - resolved "https://registry.yarnpkg.com/eslint-config-webpack/-/eslint-config-webpack-4.3.4.tgz#995c7036898f015078b5d59716c4ec8fc8cfd0e6" - integrity sha512-u0wlSpmIaxEvPGzMi3hKtSxOmj933oMVM+pTabghQTrqLP27ZzYr1l/cs/WrnT2ZKP9VyccV16IVp9V2YZrh+w== +eslint-config-webpack@^4.5.1: + version "4.5.1" + resolved "https://registry.yarnpkg.com/eslint-config-webpack/-/eslint-config-webpack-4.5.1.tgz#553f591d027bb9a869059ed1d328b6cee104483a" + integrity sha512-Qiq0PSjx7P1ncI9PCTvfW8c76OqkXAFr91TQGa+u1FAMHXMur3in8hwL7fXYPi2oF8ytI1Zuoc2TmDzX0ZO4tA== dependencies: detect-indent "^7.0.1" jsonc-eslint-parser "^2.4.0" semver "^7.7.2" - sort-package-json "^3.3.1" + sort-package-json "^3.4.0" eslint-import-resolver-node@^0.3.9: version "0.3.9" @@ -3398,49 +3378,50 @@ eslint-plugin-jsdoc@^51.2.3: spdx-expression-parse "^4.0.0" eslint-plugin-n@^17.21.0: - version "17.21.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-17.21.0.tgz#6b1833e5e8fd07a69bbab2be429771ff2309db5e" - integrity sha512-1+iZ8We4ZlwVMtb/DcHG3y5/bZOdazIpa/4TySo22MLKdwrLcfrX0hbadnCvykSQCCmkAnWmIP8jZVb2AAq29A== + version "17.21.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-17.21.2.tgz#eba404bf818ea41ed2ebd12a75050a6f1a6137dc" + integrity sha512-s3ai4Msfk5mbSvOgCkYo6k5+zP3W/OK+AvLmMmx++Ki4a5CPO7luIDwOnjUZm/t+oZYP0YADTxe+u4JqnT8+Dg== dependencies: "@eslint-community/eslint-utils" "^4.5.0" enhanced-resolve "^5.17.1" eslint-plugin-es-x "^7.8.0" get-tsconfig "^4.8.1" globals "^15.11.0" + globrex "^0.1.2" ignore "^5.3.2" - minimatch "^9.0.5" semver "^7.6.3" ts-declaration-location "^1.0.6" eslint-plugin-prettier@^5.5.0: - version "5.5.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.1.tgz#470820964de9aedb37e9ce62c3266d2d26d08d15" - integrity sha512-dobTkHT6XaEVOo8IO90Q4DOSxnm3Y151QxPJlM/vKC0bVy+d6cVWQZLlFiuZPP0wS6vZwSKeJgKkcS+KfMBlRw== + version "5.5.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.3.tgz#1f88e9220a72ac8be171eec5f9d4e4d529b5f4a0" + integrity sha512-NAdMYww51ehKfDyDhv59/eIItUVzU0Io9H2E8nHNGKEeeqlnci+1gCvrHib6EmZdf6GxF+LCV5K7UC65Ezvw7w== dependencies: prettier-linter-helpers "^1.0.0" synckit "^0.11.7" -eslint-plugin-unicorn@^59.0.1: - version "59.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-59.0.1.tgz#e76ca18f6b92633440973e5442923a36544a1422" - integrity sha512-EtNXYuWPUmkgSU2E7Ttn57LbRREQesIP1BiLn7OZLKodopKfDXfBUkC/0j6mpw2JExwf43Uf3qLSvrSvppgy8Q== +eslint-plugin-unicorn@^60.0.0: + version "60.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-60.0.0.tgz#68f712bcb17e94bd176cce7312647ba1d1409c3c" + integrity sha512-QUzTefvP8stfSXsqKQ+vBQSEsXIlAiCduS/V1Em+FKgL9c21U/IIm20/e3MFy1jyCf14tHAhqC1sX8OTy6VUCg== dependencies: - "@babel/helper-validator-identifier" "^7.25.9" - "@eslint-community/eslint-utils" "^4.5.1" - "@eslint/plugin-kit" "^0.2.7" - ci-info "^4.2.0" + "@babel/helper-validator-identifier" "^7.27.1" + "@eslint-community/eslint-utils" "^4.7.0" + "@eslint/plugin-kit" "^0.3.3" + change-case "^5.4.4" + ci-info "^4.3.0" clean-regexp "^1.0.0" - core-js-compat "^3.41.0" + core-js-compat "^3.44.0" esquery "^1.6.0" find-up-simple "^1.0.1" - globals "^16.0.0" + globals "^16.3.0" indent-string "^5.0.0" is-builtin-module "^5.0.0" jsesc "^3.1.0" pluralize "^8.0.0" regexp-tree "^0.1.27" regjsparser "^0.12.0" - semver "^7.7.1" + semver "^7.7.2" strip-indent "^4.0.0" eslint-scope@5.1.1: @@ -3470,9 +3451,9 @@ eslint-visitor-keys@^4.2.1: integrity sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ== eslint@^9.29.0: - version "9.31.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.31.0.tgz#9a488e6da75bbe05785cd62e43c5ea99356d21ba" - integrity sha512-QldCVh/ztyKJJZLr4jXNUByx3gR+TDYZCRXEktiZoUR3PGy4qCmSbkxcIle8GEwGpb5JBZazlaJ/CxLidXdEbQ== + version "9.32.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.32.0.tgz#4ea28df4a8dbc454e1251e0f3aed4bcf4ce50a47" + integrity sha512-LSehfdpgMeWcTZkWZVIJl+tkZ2nuSkyyB9C27MZqFWXuph7DvaowgcTvKqxvpLW1JZIk8PN7hFY3Rj9LQ7m7lg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.12.1" @@ -3480,8 +3461,8 @@ eslint@^9.29.0: "@eslint/config-helpers" "^0.3.0" "@eslint/core" "^0.15.0" "@eslint/eslintrc" "^3.3.1" - "@eslint/js" "9.31.0" - "@eslint/plugin-kit" "^0.3.1" + "@eslint/js" "9.32.0" + "@eslint/plugin-kit" "^0.3.4" "@humanfs/node" "^0.16.6" "@humanwhocodes/module-importer" "^1.0.1" "@humanwhocodes/retry" "^0.4.2" @@ -3625,17 +3606,17 @@ exit-x@^0.2.2: resolved "https://registry.yarnpkg.com/exit-x/-/exit-x-0.2.2.tgz#1f9052de3b8d99a696b10dad5bced9bdd5c3aa64" integrity sha512-+I6B/IkJc1o/2tiURyz/ivu/O0nKNEArIUB5O7zBrlDVJr22SCLH3xTeEry428LvFhRzIA1g8izguxJ/gbNcVQ== -expect@30.0.4, expect@^30.0.0: - version "30.0.4" - resolved "https://registry.yarnpkg.com/expect/-/expect-30.0.4.tgz#23ce0eaa9a1dcd72fcb78a228b9babdbcf9ddeca" - integrity sha512-dDLGjnP2cKbEppxVICxI/Uf4YemmGMPNy0QytCbfafbpYk9AFQsxb8Uyrxii0RPK7FWgLGlSem+07WirwS3cFQ== +expect@30.0.5, expect@^30.0.0: + version "30.0.5" + resolved "https://registry.yarnpkg.com/expect/-/expect-30.0.5.tgz#c23bf193c5e422a742bfd2990ad990811de41a5a" + integrity sha512-P0te2pt+hHI5qLJkIR+iMvS+lYUZml8rKKsohVHAGY+uClp9XVbdyYNJOIjSRpHVp8s8YqxJCiHUkSYZGr8rtQ== dependencies: - "@jest/expect-utils" "30.0.4" + "@jest/expect-utils" "30.0.5" "@jest/get-type" "30.0.1" - jest-matcher-utils "30.0.4" - jest-message-util "30.0.2" - jest-mock "30.0.2" - jest-util "30.0.2" + jest-matcher-utils "30.0.5" + jest-message-util "30.0.5" + jest-mock "30.0.5" + jest-util "30.0.5" exponential-backoff@^3.1.1: version "3.1.2" @@ -3869,10 +3850,10 @@ fork-ts-checker-webpack-plugin@^9.0.2: semver "^7.3.5" tapable "^2.2.1" -form-data@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.3.tgz#608b1b3f3e28be0fccf5901fc85fb3641e5cf0ae" - integrity sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA== +form-data@^4.0.0, form-data@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.4.tgz#784cdcce0669a9d68e94d11ac4eea98088edd2c4" + integrity sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" @@ -4099,7 +4080,7 @@ globals@^15.11.0: resolved "https://registry.yarnpkg.com/globals/-/globals-15.15.0.tgz#7c4761299d41c32b075715a4ce1ede7897ff72a8" integrity sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg== -globals@^16.0.0: +globals@^16.0.0, globals@^16.3.0: version "16.3.0" resolved "https://registry.yarnpkg.com/globals/-/globals-16.3.0.tgz#66118e765ddaf9e2d880f7e17658543f93f1f667" integrity sha512-bqWEnJ1Nt3neqx2q5SFfGS8r/ahumIakg3HcwtNlrVlwXIeNumWn/c7Pn/wKzGhf6SaW6H6uWXLqC30STCMchQ== @@ -4112,6 +4093,11 @@ globalthis@^1.0.4: define-properties "^1.2.1" gopd "^1.0.1" +globrex@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" + integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== + gopd@^1.0.1, gopd@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" @@ -4748,96 +4734,96 @@ jackspeak@^3.1.2: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" -jest-changed-files@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-30.0.2.tgz#2c275263037f8f291b71cbb0a4f639c519ab7eb8" - integrity sha512-Ius/iRST9FKfJI+I+kpiDh8JuUlAISnRszF9ixZDIqJF17FckH5sOzKC8a0wd0+D+8em5ADRHA5V5MnfeDk2WA== +jest-changed-files@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-30.0.5.tgz#ec448f83bd9caa894dd7da8707f207c356a19924" + integrity sha512-bGl2Ntdx0eAwXuGpdLdVYVr5YQHnSZlQ0y9HVDu565lCUAe9sj6JOtBbMmBBikGIegne9piDDIOeiLVoqTkz4A== dependencies: execa "^5.1.1" - jest-util "30.0.2" + jest-util "30.0.5" p-limit "^3.1.0" -jest-circus@30.0.4, jest-circus@^30.0.3: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-30.0.4.tgz#7bdfc5951eb883283bf0336cc4d624222f09851e" - integrity sha512-o6UNVfbXbmzjYgmVPtSQrr5xFZCtkDZGdTlptYvGFSN80RuOOlTe73djvMrs+QAuSERZWcHBNIOMH+OEqvjWuw== +jest-circus@30.0.5, jest-circus@^30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-30.0.5.tgz#9b4d44feb56c7ffe14411ad7fc08af188c5d4da7" + integrity sha512-h/sjXEs4GS+NFFfqBDYT7y5Msfxh04EwWLhQi0F8kuWpe+J/7tICSlswU8qvBqumR3kFgHbfu7vU6qruWWBPug== dependencies: - "@jest/environment" "30.0.4" - "@jest/expect" "30.0.4" - "@jest/test-result" "30.0.4" - "@jest/types" "30.0.1" + "@jest/environment" "30.0.5" + "@jest/expect" "30.0.5" + "@jest/test-result" "30.0.5" + "@jest/types" "30.0.5" "@types/node" "*" chalk "^4.1.2" co "^4.6.0" dedent "^1.6.0" is-generator-fn "^2.1.0" - jest-each "30.0.2" - jest-matcher-utils "30.0.4" - jest-message-util "30.0.2" - jest-runtime "30.0.4" - jest-snapshot "30.0.4" - jest-util "30.0.2" + jest-each "30.0.5" + jest-matcher-utils "30.0.5" + jest-message-util "30.0.5" + jest-runtime "30.0.5" + jest-snapshot "30.0.5" + jest-util "30.0.5" p-limit "^3.1.0" - pretty-format "30.0.2" + pretty-format "30.0.5" pure-rand "^7.0.0" slash "^3.0.0" stack-utils "^2.0.6" -jest-cli@30.0.4, jest-cli@^30.0.3: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-30.0.4.tgz#85510c5ebffc4ed31b571b3e166bca3febe7ba4a" - integrity sha512-3dOrP3zqCWBkjoVG1zjYJpD9143N9GUCbwaF2pFF5brnIgRLHmKcCIw+83BvF1LxggfMWBA0gxkn6RuQVuRhIQ== +jest-cli@30.0.5, jest-cli@^30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-30.0.5.tgz#c3fbfdabd1a5c428429476f915a1ba6d0774cc50" + integrity sha512-Sa45PGMkBZzF94HMrlX4kUyPOwUpdZasaliKN3mifvDmkhLYqLLg8HQTzn6gq7vJGahFYMQjXgyJWfYImKZzOw== dependencies: - "@jest/core" "30.0.4" - "@jest/test-result" "30.0.4" - "@jest/types" "30.0.1" + "@jest/core" "30.0.5" + "@jest/test-result" "30.0.5" + "@jest/types" "30.0.5" chalk "^4.1.2" exit-x "^0.2.2" import-local "^3.2.0" - jest-config "30.0.4" - jest-util "30.0.2" - jest-validate "30.0.2" + jest-config "30.0.5" + jest-util "30.0.5" + jest-validate "30.0.5" yargs "^17.7.2" -jest-config@30.0.4: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-30.0.4.tgz#a710897373ae2b0ad8db027cb7a06e6d4a903c41" - integrity sha512-3dzbO6sh34thAGEjJIW0fgT0GA0EVlkski6ZzMcbW6dzhenylXAE/Mj2MI4HonroWbkKc6wU6bLVQ8dvBSZ9lA== +jest-config@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-30.0.5.tgz#567cf39b595229b786506a496c22e222d5e8d480" + integrity sha512-aIVh+JNOOpzUgzUnPn5FLtyVnqc3TQHVMupYtyeURSb//iLColiMIR8TxCIDKyx9ZgjKnXGucuW68hCxgbrwmA== dependencies: "@babel/core" "^7.27.4" "@jest/get-type" "30.0.1" "@jest/pattern" "30.0.1" - "@jest/test-sequencer" "30.0.4" - "@jest/types" "30.0.1" - babel-jest "30.0.4" + "@jest/test-sequencer" "30.0.5" + "@jest/types" "30.0.5" + babel-jest "30.0.5" chalk "^4.1.2" ci-info "^4.2.0" deepmerge "^4.3.1" glob "^10.3.10" graceful-fs "^4.2.11" - jest-circus "30.0.4" + jest-circus "30.0.5" jest-docblock "30.0.1" - jest-environment-node "30.0.4" + jest-environment-node "30.0.5" jest-regex-util "30.0.1" - jest-resolve "30.0.2" - jest-runner "30.0.4" - jest-util "30.0.2" - jest-validate "30.0.2" + jest-resolve "30.0.5" + jest-runner "30.0.5" + jest-util "30.0.5" + jest-validate "30.0.5" micromatch "^4.0.8" parse-json "^5.2.0" - pretty-format "30.0.2" + pretty-format "30.0.5" slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@30.0.4, jest-diff@^30.0.3: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.0.4.tgz#f6e71d19ed6e8f5c7f1bead9ac406c0dd6abce5a" - integrity sha512-TSjceIf6797jyd+R64NXqicttROD+Qf98fex7CowmlSn7f8+En0da1Dglwr1AXxDtVizoxXYZBlUQwNhoOXkNw== +jest-diff@30.0.5, jest-diff@^30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.0.5.tgz#b40f81e0c0d13e5b81c4d62b0d0dfa6a524ee0fd" + integrity sha512-1UIqE9PoEKaHcIKvq2vbibrCog4Y8G0zmOxgQUVEiTqwR5hJVMCoDsN1vFvI5JvwD37hjueZ1C4l2FyGnfpE0A== dependencies: "@jest/diff-sequences" "30.0.1" "@jest/get-type" "30.0.1" chalk "^4.1.2" - pretty-format "30.0.2" + pretty-format "30.0.5" jest-docblock@30.0.1: version "30.0.1" @@ -4846,43 +4832,43 @@ jest-docblock@30.0.1: dependencies: detect-newline "^3.1.0" -jest-each@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-30.0.2.tgz#402e189784715f5c76f1bb97c29842e79abe99a1" - integrity sha512-ZFRsTpe5FUWFQ9cWTMguCaiA6kkW5whccPy9JjD1ezxh+mJeqmz8naL8Fl/oSbNJv3rgB0x87WBIkA5CObIUZQ== +jest-each@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-30.0.5.tgz#5962264ff246cd757ba44db096c1bc5b4835173e" + integrity sha512-dKjRsx1uZ96TVyejD3/aAWcNKy6ajMaN531CwWIsrazIqIoXI9TnnpPlkrEYku/8rkS3dh2rbH+kMOyiEIv0xQ== dependencies: "@jest/get-type" "30.0.1" - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" chalk "^4.1.2" - jest-util "30.0.2" - pretty-format "30.0.2" + jest-util "30.0.5" + pretty-format "30.0.5" -jest-environment-node@30.0.4, jest-environment-node@^30.0.2: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-30.0.4.tgz#080f2d6e438ef35a4701a09207fd2cfa030cd4a3" - integrity sha512-p+rLEzC2eThXqiNh9GHHTC0OW5Ca4ZfcURp7scPjYBcmgpR9HG6750716GuUipYf2AcThU3k20B31USuiaaIEg== +jest-environment-node@30.0.5, jest-environment-node@^30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-30.0.5.tgz#6a98dd80e0384ead67ed05643381395f6cda93c9" + integrity sha512-ppYizXdLMSvciGsRsMEnv/5EFpvOdXBaXRBzFUDPWrsfmog4kYrOGWXarLllz6AXan6ZAA/kYokgDWuos1IKDA== dependencies: - "@jest/environment" "30.0.4" - "@jest/fake-timers" "30.0.4" - "@jest/types" "30.0.1" + "@jest/environment" "30.0.5" + "@jest/fake-timers" "30.0.5" + "@jest/types" "30.0.5" "@types/node" "*" - jest-mock "30.0.2" - jest-util "30.0.2" - jest-validate "30.0.2" + jest-mock "30.0.5" + jest-util "30.0.5" + jest-validate "30.0.5" -jest-haste-map@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-30.0.2.tgz#83826e7e352fa139dc95100337aff4de58c99453" - integrity sha512-telJBKpNLeCb4MaX+I5k496556Y2FiKR/QLZc0+MGBYl4k3OO0472drlV2LUe7c1Glng5HuAu+5GLYp//GpdOQ== +jest-haste-map@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-30.0.5.tgz#fdd0daa322b02eb34267854cff2859fae21e92a6" + integrity sha512-dkmlWNlsTSR0nH3nRfW5BKbqHefLZv0/6LCccG0xFCTWcJu8TuEwG+5Cm75iBfjVoockmO6J35o5gxtFSn5xeg== dependencies: - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" "@types/node" "*" anymatch "^3.1.3" fb-watchman "^2.0.2" graceful-fs "^4.2.11" jest-regex-util "30.0.1" - jest-util "30.0.2" - jest-worker "30.0.2" + jest-util "30.0.5" + jest-worker "30.0.5" micromatch "^4.0.8" walker "^1.0.8" optionalDependencies: @@ -4898,47 +4884,47 @@ jest-junit@^16.0.0: uuid "^8.3.2" xml "^1.0.1" -jest-leak-detector@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-30.0.2.tgz#da4df660615d170136d2b468af3bf1c9bff0137e" - integrity sha512-U66sRrAYdALq+2qtKffBLDWsQ/XoNNs2Lcr83sc9lvE/hEpNafJlq2lXCPUBMNqamMECNxSIekLfe69qg4KMIQ== +jest-leak-detector@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-30.0.5.tgz#00cfd2b323f48d8f4416b0a3e05fcf4c51f18864" + integrity sha512-3Uxr5uP8jmHMcsOtYMRB/zf1gXN3yUIc+iPorhNETG54gErFIiUhLvyY/OggYpSMOEYqsmRxmuU4ZOoX5jpRFg== dependencies: "@jest/get-type" "30.0.1" - pretty-format "30.0.2" + pretty-format "30.0.5" -jest-matcher-utils@30.0.4: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.0.4.tgz#1aab71eb7ba401f81d9ef7231feb88392e4a6e54" - integrity sha512-ubCewJ54YzeAZ2JeHHGVoU+eDIpQFsfPQs0xURPWoNiO42LGJ+QGgfSf+hFIRplkZDkhH5MOvuxHKXRTUU3dUQ== +jest-matcher-utils@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.0.5.tgz#dff3334be58faea4a5e1becc228656fbbfc2467d" + integrity sha512-uQgGWt7GOrRLP1P7IwNWwK1WAQbq+m//ZY0yXygyfWp0rJlksMSLQAA4wYQC3b6wl3zfnchyTx+k3HZ5aPtCbQ== dependencies: "@jest/get-type" "30.0.1" chalk "^4.1.2" - jest-diff "30.0.4" - pretty-format "30.0.2" + jest-diff "30.0.5" + pretty-format "30.0.5" -jest-message-util@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-30.0.2.tgz#9dfdc37570d172f0ffdc42a0318036ff4008837f" - integrity sha512-vXywcxmr0SsKXF/bAD7t7nMamRvPuJkras00gqYeB1V0WllxZrbZ0paRr3XqpFU2sYYjD0qAaG2fRyn/CGZ0aw== +jest-message-util@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-30.0.5.tgz#dd12ffec91dd3fa6a59cbd538a513d8e239e070c" + integrity sha512-NAiDOhsK3V7RU0Aa/HnrQo+E4JlbarbmI3q6Pi4KcxicdtjV82gcIUrejOtczChtVQR4kddu1E1EJlW6EN9IyA== dependencies: "@babel/code-frame" "^7.27.1" - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" "@types/stack-utils" "^2.0.3" chalk "^4.1.2" graceful-fs "^4.2.11" micromatch "^4.0.8" - pretty-format "30.0.2" + pretty-format "30.0.5" slash "^3.0.0" stack-utils "^2.0.6" -jest-mock@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-30.0.2.tgz#5e4245f25f6f9532714906cab10a2b9e39eb2183" - integrity sha512-PnZOHmqup/9cT/y+pXIVbbi8ID6U1XHRmbvR7MvUy4SLqhCbwpkmXhLbsWbGewHrV5x/1bF7YDjs+x24/QSvFA== +jest-mock@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-30.0.5.tgz#ef437e89212560dd395198115550085038570bdd" + integrity sha512-Od7TyasAAQX/6S+QCbN6vZoWOMwlTtzzGuxJku1GhGanAjz9y+QsQkpScDmETvdc9aSXyJ/Op4rhpMYBWW91wQ== dependencies: - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" "@types/node" "*" - jest-util "30.0.2" + jest-util "30.0.5" jest-pnp-resolver@^1.2.3: version "1.2.3" @@ -4950,157 +4936,157 @@ jest-regex-util@30.0.1: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-30.0.1.tgz#f17c1de3958b67dfe485354f5a10093298f2a49b" integrity sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA== -jest-resolve-dependencies@30.0.4: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-30.0.4.tgz#54decdedec040ec0b5b717af43a0b538d638d395" - integrity sha512-EQBYow19B/hKr4gUTn+l8Z+YLlP2X0IoPyp0UydOtrcPbIOYzJ8LKdFd+yrbwztPQvmlBFUwGPPEzHH1bAvFAw== +jest-resolve-dependencies@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-30.0.5.tgz#53be4c51d296c84a0e75608e7b77b6fe92dbac29" + integrity sha512-/xMvBR4MpwkrHW4ikZIWRttBBRZgWK4d6xt3xW1iRDSKt4tXzYkMkyPfBnSCgv96cpkrctfXs6gexeqMYqdEpw== dependencies: jest-regex-util "30.0.1" - jest-snapshot "30.0.4" + jest-snapshot "30.0.5" -jest-resolve@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-30.0.2.tgz#4b7c826a35e9657189568e4dafc0ba5f05868cf2" - integrity sha512-q/XT0XQvRemykZsvRopbG6FQUT6/ra+XV6rPijyjT6D0msOyCvR2A5PlWZLd+fH0U8XWKZfDiAgrUNDNX2BkCw== +jest-resolve@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-30.0.5.tgz#f52f91600070b7073db465dc553eee5471ea8e06" + integrity sha512-d+DjBQ1tIhdz91B79mywH5yYu76bZuE96sSbxj8MkjWVx5WNdt1deEFRONVL4UkKLSrAbMkdhb24XN691yDRHg== dependencies: chalk "^4.1.2" graceful-fs "^4.2.11" - jest-haste-map "30.0.2" + jest-haste-map "30.0.5" jest-pnp-resolver "^1.2.3" - jest-util "30.0.2" - jest-validate "30.0.2" + jest-util "30.0.5" + jest-validate "30.0.5" slash "^3.0.0" unrs-resolver "^1.7.11" -jest-runner@30.0.4: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-30.0.4.tgz#3647eeb04f2d0b2c0a5769dd73cd861ebc5853f4" - integrity sha512-mxY0vTAEsowJwvFJo5pVivbCpuu6dgdXRmt3v3MXjBxFly7/lTk3Td0PaMyGOeNQUFmSuGEsGYqhbn7PA9OekQ== +jest-runner@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-30.0.5.tgz#5cbaaf85964246da4f65d697f186846f23cd9b5a" + integrity sha512-JcCOucZmgp+YuGgLAXHNy7ualBx4wYSgJVWrYMRBnb79j9PD0Jxh0EHvR5Cx/r0Ce+ZBC4hCdz2AzFFLl9hCiw== dependencies: - "@jest/console" "30.0.4" - "@jest/environment" "30.0.4" - "@jest/test-result" "30.0.4" - "@jest/transform" "30.0.4" - "@jest/types" "30.0.1" + "@jest/console" "30.0.5" + "@jest/environment" "30.0.5" + "@jest/test-result" "30.0.5" + "@jest/transform" "30.0.5" + "@jest/types" "30.0.5" "@types/node" "*" chalk "^4.1.2" emittery "^0.13.1" exit-x "^0.2.2" graceful-fs "^4.2.11" jest-docblock "30.0.1" - jest-environment-node "30.0.4" - jest-haste-map "30.0.2" - jest-leak-detector "30.0.2" - jest-message-util "30.0.2" - jest-resolve "30.0.2" - jest-runtime "30.0.4" - jest-util "30.0.2" - jest-watcher "30.0.4" - jest-worker "30.0.2" + jest-environment-node "30.0.5" + jest-haste-map "30.0.5" + jest-leak-detector "30.0.5" + jest-message-util "30.0.5" + jest-resolve "30.0.5" + jest-runtime "30.0.5" + jest-util "30.0.5" + jest-watcher "30.0.5" + jest-worker "30.0.5" p-limit "^3.1.0" source-map-support "0.5.13" -jest-runtime@30.0.4: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-30.0.4.tgz#100f31a5f6c4a6586c2ce91a936a10f1aca64749" - integrity sha512-tUQrZ8+IzoZYIHoPDQEB4jZoPyzBjLjq7sk0KVyd5UPRjRDOsN7o6UlvaGF8ddpGsjznl9PW+KRgWqCNO+Hn7w== +jest-runtime@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-30.0.5.tgz#d6a7e22687264240d1786d6f7682ac6a2872e552" + integrity sha512-7oySNDkqpe4xpX5PPiJTe5vEa+Ak/NnNz2bGYZrA1ftG3RL3EFlHaUkA1Cjx+R8IhK0Vg43RML5mJedGTPNz3A== dependencies: - "@jest/environment" "30.0.4" - "@jest/fake-timers" "30.0.4" - "@jest/globals" "30.0.4" + "@jest/environment" "30.0.5" + "@jest/fake-timers" "30.0.5" + "@jest/globals" "30.0.5" "@jest/source-map" "30.0.1" - "@jest/test-result" "30.0.4" - "@jest/transform" "30.0.4" - "@jest/types" "30.0.1" + "@jest/test-result" "30.0.5" + "@jest/transform" "30.0.5" + "@jest/types" "30.0.5" "@types/node" "*" chalk "^4.1.2" cjs-module-lexer "^2.1.0" collect-v8-coverage "^1.0.2" glob "^10.3.10" graceful-fs "^4.2.11" - jest-haste-map "30.0.2" - jest-message-util "30.0.2" - jest-mock "30.0.2" + jest-haste-map "30.0.5" + jest-message-util "30.0.5" + jest-mock "30.0.5" jest-regex-util "30.0.1" - jest-resolve "30.0.2" - jest-snapshot "30.0.4" - jest-util "30.0.2" + jest-resolve "30.0.5" + jest-snapshot "30.0.5" + jest-util "30.0.5" slash "^3.0.0" strip-bom "^4.0.0" -jest-snapshot@30.0.4: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-30.0.4.tgz#21fdc1d944bc077a58f5eda88ef77a26dee4c3ee" - integrity sha512-S/8hmSkeUib8WRUq9pWEb5zMfsOjiYWDWzFzKnjX7eDyKKgimsu9hcmsUEg8a7dPAw8s/FacxsXquq71pDgPjQ== +jest-snapshot@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-30.0.5.tgz#6600716eef2e6d8ea1dd788ae4385f3a2791b11f" + integrity sha512-T00dWU/Ek3LqTp4+DcW6PraVxjk28WY5Ua/s+3zUKSERZSNyxTqhDXCWKG5p2HAJ+crVQ3WJ2P9YVHpj1tkW+g== dependencies: "@babel/core" "^7.27.4" "@babel/generator" "^7.27.5" "@babel/plugin-syntax-jsx" "^7.27.1" "@babel/plugin-syntax-typescript" "^7.27.1" "@babel/types" "^7.27.3" - "@jest/expect-utils" "30.0.4" + "@jest/expect-utils" "30.0.5" "@jest/get-type" "30.0.1" - "@jest/snapshot-utils" "30.0.4" - "@jest/transform" "30.0.4" - "@jest/types" "30.0.1" + "@jest/snapshot-utils" "30.0.5" + "@jest/transform" "30.0.5" + "@jest/types" "30.0.5" babel-preset-current-node-syntax "^1.1.0" chalk "^4.1.2" - expect "30.0.4" + expect "30.0.5" graceful-fs "^4.2.11" - jest-diff "30.0.4" - jest-matcher-utils "30.0.4" - jest-message-util "30.0.2" - jest-util "30.0.2" - pretty-format "30.0.2" + jest-diff "30.0.5" + jest-matcher-utils "30.0.5" + jest-message-util "30.0.5" + jest-util "30.0.5" + pretty-format "30.0.5" semver "^7.7.2" synckit "^0.11.8" -jest-util@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-30.0.2.tgz#1bd8411f81e6f5e2ca8b31bb2534ebcd7cbac065" - integrity sha512-8IyqfKS4MqprBuUpZNlFB5l+WFehc8bfCe1HSZFHzft2mOuND8Cvi9r1musli+u6F3TqanCZ/Ik4H4pXUolZIg== +jest-util@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-30.0.5.tgz#035d380c660ad5f1748dff71c4105338e05f8669" + integrity sha512-pvyPWssDZR0FlfMxCBoc0tvM8iUEskaRFALUtGQYzVEAqisAztmy+R8LnU14KT4XA0H/a5HMVTXat1jLne010g== dependencies: - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" "@types/node" "*" chalk "^4.1.2" ci-info "^4.2.0" graceful-fs "^4.2.11" picomatch "^4.0.2" -jest-validate@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-30.0.2.tgz#f62a2f0e014dac94747509ba8c2bcd5d48215b7f" - integrity sha512-noOvul+SFER4RIvNAwGn6nmV2fXqBq67j+hKGHKGFCmK4ks/Iy1FSrqQNBLGKlu4ZZIRL6Kg1U72N1nxuRCrGQ== +jest-validate@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-30.0.5.tgz#d26fd218b8d566bff48fd98880b8ea94fd0d8456" + integrity sha512-ouTm6VFHaS2boyl+k4u+Qip4TSH7Uld5tyD8psQ8abGgt2uYYB8VwVfAHWHjHc0NWmGGbwO5h0sCPOGHHevefw== dependencies: "@jest/get-type" "30.0.1" - "@jest/types" "30.0.1" + "@jest/types" "30.0.5" camelcase "^6.3.0" chalk "^4.1.2" leven "^3.1.0" - pretty-format "30.0.2" + pretty-format "30.0.5" -jest-watcher@30.0.4: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-30.0.4.tgz#f51b9870760d917851bb5b871e95b3c5f021cb86" - integrity sha512-YESbdHDs7aQOCSSKffG8jXqOKFqw4q4YqR+wHYpR5GWEQioGvL0BfbcjvKIvPEM0XGfsfJrka7jJz3Cc3gI4VQ== +jest-watcher@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-30.0.5.tgz#90db6e3f582b88085bde58f7555cbdd3a1beb10d" + integrity sha512-z9slj/0vOwBDBjN3L4z4ZYaA+pG56d6p3kTUhFRYGvXbXMWhXmb/FIxREZCD06DYUwDKKnj2T80+Pb71CQ0KEg== dependencies: - "@jest/test-result" "30.0.4" - "@jest/types" "30.0.1" + "@jest/test-result" "30.0.5" + "@jest/types" "30.0.5" "@types/node" "*" ansi-escapes "^4.3.2" chalk "^4.1.2" emittery "^0.13.1" - jest-util "30.0.2" + jest-util "30.0.5" string-length "^4.0.2" -jest-worker@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-30.0.2.tgz#e67bd7debbc9d8445907a17067a89359acedc8c5" - integrity sha512-RN1eQmx7qSLFA+o9pfJKlqViwL5wt+OL3Vff/A+/cPsmuw7NPwfgl33AP+/agRmHzPOFgXviRycR9kYwlcRQXg== +jest-worker@30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-30.0.5.tgz#0b85cbab10610303e8d84e214f94d8f052c3cd04" + integrity sha512-ojRXsWzEP16NdUuBw/4H/zkZdHOa7MMYCk4E430l+8fELeLg/mqmMlRhjL7UNZvQrDmnovWZV4DxX03fZF48fQ== dependencies: "@types/node" "*" "@ungap/structured-clone" "^1.3.0" - jest-util "30.0.2" + jest-util "30.0.5" merge-stream "^2.0.0" supports-color "^8.1.1" @@ -5113,15 +5099,15 @@ jest-worker@^27.4.5: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^30.0.3: - version "30.0.4" - resolved "https://registry.yarnpkg.com/jest/-/jest-30.0.4.tgz#4596879f2af0560d9b1e588b252531cf10148947" - integrity sha512-9QE0RS4WwTj/TtTC4h/eFVmFAhGNVerSB9XpJh8sqaXlP73ILcPcZ7JWjjEtJJe2m8QyBLKKfPQuK+3F+Xij/g== +jest@^30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/jest/-/jest-30.0.5.tgz#ee62729fb77829790d67c660d852350fbde315ce" + integrity sha512-y2mfcJywuTUkvLm2Lp1/pFX8kTgMO5yyQGq/Sk/n2mN7XWYp4JsCZ/QXW34M8YScgk8bPZlREH04f6blPnoHnQ== dependencies: - "@jest/core" "30.0.4" - "@jest/types" "30.0.1" + "@jest/core" "30.0.5" + "@jest/types" "30.0.5" import-local "^3.2.0" - jest-cli "30.0.4" + jest-cli "30.0.5" js-stringify@^1.0.2: version "1.0.2" @@ -5285,9 +5271,9 @@ less-loader@^12.2.0: integrity sha512-0M6+uYulvYIWs52y0LqN4+QM9TqWAohYSNTo4htE8Z7Cn3G/qQMEmktfHmyJT23k+20kU9zHH2wrfFXkxNLtVw== less@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/less/-/less-4.3.0.tgz#ef0cfc260a9ca8079ed8d0e3512bda8a12c82f2a" - integrity sha512-X9RyH9fvemArzfdP8Pi3irr7lor2Ok4rOttDXBhlwDg+wKQsXOXgHWduAJE1EsF7JJx0w0bcO6BC6tCKKYnXKA== + version "4.4.0" + resolved "https://registry.yarnpkg.com/less/-/less-4.4.0.tgz#deaf881f4880ee80691beae925b8fac699d3a76d" + integrity sha512-kdTwsyRuncDfjEs0DlRILWNvxhDG/Zij4YLO4TMJgDLW+8OzpfkdPnRgrsRuY1o+oaxJGWsps5f/RVBgGmmN0w== dependencies: copy-anything "^2.0.1" parse-node-version "^1.0.1" @@ -5612,7 +5598,7 @@ mdast-util-gfm-task-list-item@^2.0.0: mdast-util-from-markdown "^2.0.0" mdast-util-to-markdown "^2.0.0" -mdast-util-gfm@^3.0.0: +mdast-util-gfm@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz#2cdf63b92c2a331406b0fb0db4c077c1b0331751" integrity sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ== @@ -5663,9 +5649,9 @@ memfs@^3.4.1: fs-monkey "^1.0.4" memfs@^4.14.0: - version "4.17.2" - resolved "https://registry.yarnpkg.com/memfs/-/memfs-4.17.2.tgz#1f71a6d85c8c53b4f1b388234ed981a690c7e227" - integrity sha512-NgYhCOWgovOXSzvYgUW0LQ7Qy72rWQMGGFJDoWg4G30RHd3z77VbYdtJ4fembJXBy8pMIUA31XNAupobOQlwdg== + version "4.23.0" + resolved "https://registry.yarnpkg.com/memfs/-/memfs-4.23.0.tgz#1a80f324a8e499825e147b0b382371cf257ed06e" + integrity sha512-SucHN2lcWf0jrnw+jP6FoVW6l/zGJiXfNMdApZzG0x/0mAIMdwAeR5mjfsCH5U3BoqpUEtqzz+dSQSO0H/eqxg== dependencies: "@jsonjoy.com/json-pack" "^1.0.3" "@jsonjoy.com/util" "^1.3.0" @@ -6044,7 +6030,7 @@ mini-svg-data-uri@^1.2.3: dependencies: brace-expansion "^1.1.7" -minimatch@^9.0.4, minimatch@^9.0.5: +minimatch@^9.0.4: version "9.0.5" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== @@ -6589,10 +6575,10 @@ picomatch@^2.0.4, picomatch@^2.3.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -picomatch@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" - integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== +picomatch@^4.0.2, picomatch@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.3.tgz#796c76136d1eead715db1e7bad785dedd695a042" + integrity sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q== pidtree@^0.6.0: version "0.6.0" @@ -6708,12 +6694,12 @@ prettier@^3.6.0: resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.2.tgz#ccda02a1003ebbb2bfda6f83a074978f608b9393" integrity sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ== -pretty-format@30.0.2, pretty-format@^30.0.0, pretty-format@^30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.0.2.tgz#54717b6aa2b4357a2e6d83868e10a2ea8dd647c7" - integrity sha512-yC5/EBSOrTtqhCKfLHqoUIAXVRZnukHPwWBJWR7h84Q3Be1DRQZLncwcfLoPA5RPQ65qfiCMqgYwdUuQ//eVpg== +pretty-format@30.0.5, pretty-format@^30.0.0, pretty-format@^30.0.5: + version "30.0.5" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.0.5.tgz#e001649d472800396c1209684483e18a4d250360" + integrity sha512-D1tKtYvByrBkFLe2wHJl2bwMJIiT8rW+XA+TiataH79/FszLQMrpGEvzUVkzPau7OCO0Qnrhpe87PqtOAIB8Yw== dependencies: - "@jest/schemas" "30.0.1" + "@jest/schemas" "30.0.5" ansi-styles "^5.2.0" react-is "^18.3.1" @@ -7364,7 +7350,7 @@ sort-object-keys@^1.1.3: resolved "https://registry.yarnpkg.com/sort-object-keys/-/sort-object-keys-1.1.3.tgz#bff833fe85cab147b34742e45863453c1e190b45" integrity sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg== -sort-package-json@^3.3.1: +sort-package-json@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/sort-package-json/-/sort-package-json-3.4.0.tgz#98e42b78848c517736b069f8aa4fa322fae56677" integrity sha512-97oFRRMM2/Js4oEA9LJhjyMlde+2ewpZQf53pgue27UkbEXfHJnDzHlUxQ/DWUkzqmp7DFwJp8D+wi/TYeQhpA== @@ -7462,11 +7448,6 @@ ssri@^12.0.0: dependencies: minipass "^7.0.3" -stack-trace@1.0.0-pre2: - version "1.0.0-pre2" - resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-1.0.0-pre2.tgz#46a83a79f1b287807e9aaafc6a5dd8bcde626f9c" - integrity sha512-2ztBJRek8IVofG9DBJqdy2N5kulaacX30Nz7xmkYF6ale9WBVmIy6mFBchvGX7Vx/MyjBhx+Rcxqrj+dbOnQ6A== - stack-utils@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f"