From 4b309eda4e7930dbb6b503ccc8659abbda6df881 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 14:02:56 +0300 Subject: [PATCH 01/56] chore(deps-dev): bump @types/node in the dependencies group (#19553) Bumps the dependencies group with 1 update: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node). Updates `@types/node` from 22.15.19 to 22.15.21 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 22.15.21 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a411c2b48ae..1bcd0f7848a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1383,9 +1383,9 @@ integrity sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w== "@types/node@*", "@types/node@^22.15.11": - version "22.15.19" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.19.tgz#ba9f321675243af0456d607fa82a4865931e0cef" - integrity sha512-3vMNr4TzNQyjHcRZadojpRaD9Ofr6LsonZAoQ+HMUa/9ORTPoxVIw0e0mpqWpdjj8xybyCM+oKOUH2vwFu/oEw== + version "22.15.21" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.21.tgz#196ef14fe20d87f7caf1e7b39832767f9a995b77" + integrity sha512-EV/37Td6c+MgKAbkcLG6vqZ2zEYHD7bvSrzqqs2RIhbA6w3x+Dqz8MZM3sP6kGTeLrdoOgKZe+Xja7tUB2DNkQ== dependencies: undici-types "~6.21.0" From eff3e26b119ede399f06046ea5c1769b2f415d43 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 17:36:46 +0300 Subject: [PATCH 02/56] chore(deps): bump watchpack in the dependencies group (#19555) Bumps the dependencies group with 1 update: [watchpack](https://github.com/webpack/watchpack). Updates `watchpack` from 2.4.3 to 2.4.4 - [Release notes](https://github.com/webpack/watchpack/releases) - [Commits](https://github.com/webpack/watchpack/compare/v2.4.3...v2.4.4) --- updated-dependencies: - dependency-name: watchpack dependency-version: 2.4.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 1bcd0f7848a..d59a1113c0f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6556,9 +6556,9 @@ wast-loader@^1.12.1: wabt "1.0.0-nightly.20180421" watchpack@^2.4.1: - version "2.4.3" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.3.tgz#110b3a600c525f6a39ab66cf354cf08b205c29dc" - integrity sha512-adBYQLivcg1jbdKEJeqScJJFvgm4qY9+3tXw+jdG6lkVeqRJEtiQmSWjmth8GKmDZuX7sYM4YFxQsf0AzMfGGw== + version "2.4.4" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.4.tgz#473bda72f0850453da6425081ea46fc0d7602947" + integrity sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA== dependencies: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" From e4c21e2766b5c3f2ecc89ad6cbee972153dcfb74 Mon Sep 17 00:00:00 2001 From: Xiao <784487301@qq.com> Date: Thu, 22 May 2025 22:41:15 +0800 Subject: [PATCH 03/56] feat: add VirtualUrlPlugin --- .../plugins/schemes/VirtualUrlPlugin.d.ts | 51 ++++ lib/index.js | 3 + lib/schemes/VirtualUrlPlugin.js | 222 ++++++++++++++++++ .../schemes/VirtualUrlPlugin.check.d.ts | 7 + .../plugins/schemes/VirtualUrlPlugin.check.js | 6 + schemas/plugins/schemes/VirtualUrlPlugin.json | 77 ++++++ .../virtual-url-plugin/babel-loader.js | 19 ++ .../plugins/virtual-url-plugin/index.js | 38 +++ .../plugins/virtual-url-plugin/routes/bar.js | 1 + .../plugins/virtual-url-plugin/routes/foo.js | 1 + .../plugins/virtual-url-plugin/ts-loader.js | 8 + .../virtual-url-plugin/webpack.config.js | 74 ++++++ .../virtual-url-plugin-version/0/index.js | 15 ++ .../plugins/virtual-url-plugin-version/0/v.js | 1 + .../virtual-url-plugin-version/1/index.js | 15 ++ .../plugins/virtual-url-plugin-version/1/v.js | 1 + .../webpack.config.js | 29 +++ types.d.ts | 57 ++++- yarn.lock | 6 +- 19 files changed, 618 insertions(+), 13 deletions(-) create mode 100644 declarations/plugins/schemes/VirtualUrlPlugin.d.ts create mode 100644 lib/schemes/VirtualUrlPlugin.js create mode 100644 schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts create mode 100644 schemas/plugins/schemes/VirtualUrlPlugin.check.js create mode 100644 schemas/plugins/schemes/VirtualUrlPlugin.json create mode 100644 test/configCases/plugins/virtual-url-plugin/babel-loader.js create mode 100644 test/configCases/plugins/virtual-url-plugin/index.js create mode 100644 test/configCases/plugins/virtual-url-plugin/routes/bar.js create mode 100644 test/configCases/plugins/virtual-url-plugin/routes/foo.js create mode 100644 test/configCases/plugins/virtual-url-plugin/ts-loader.js create mode 100644 test/configCases/plugins/virtual-url-plugin/webpack.config.js create mode 100644 test/watchCases/plugins/virtual-url-plugin-version/0/index.js create mode 100644 test/watchCases/plugins/virtual-url-plugin-version/0/v.js create mode 100644 test/watchCases/plugins/virtual-url-plugin-version/1/index.js create mode 100644 test/watchCases/plugins/virtual-url-plugin-version/1/v.js create mode 100644 test/watchCases/plugins/virtual-url-plugin-version/webpack.config.js diff --git a/declarations/plugins/schemes/VirtualUrlPlugin.d.ts b/declarations/plugins/schemes/VirtualUrlPlugin.d.ts new file mode 100644 index 00000000000..f2c92d30416 --- /dev/null +++ b/declarations/plugins/schemes/VirtualUrlPlugin.d.ts @@ -0,0 +1,51 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn fix:special` to update + */ + +export type VirtualUrlPluginOptions = VirtualUrlOptions; +/** + * A virtual module can be a string, a function, or a VirtualModule object. + */ +export type VirtualModuleContent = + | string + | (( + loaderContext: import("webpack").LoaderContext + ) => Promise | string) + | VirtualModule; + +/** + * Options for building virtual resources. + */ +export interface VirtualUrlOptions { + /** + * The virtual modules configuration. + */ + modules: { + [k: string]: VirtualModuleContent; + }; + /** + * The URL scheme to use for virtual resources. + */ + scheme?: string; +} +/** + * A virtual module definition. + */ +export interface VirtualModule { + /** + * The source function that provides the virtual content. + */ + source: ( + loaderContext: import("webpack").LoaderContext + ) => Promise | string; + /** + * The module type. + */ + type?: string; + /** + * Optional version function or value for cache invalidation. + */ + version?: true | string | (() => string | undefined); +} diff --git a/lib/index.js b/lib/index.js index ed0c34149e2..e3ca2ce9da3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -641,6 +641,9 @@ module.exports = mergeExports(fn, { schemes: { get HttpUriPlugin() { return require("./schemes/HttpUriPlugin"); + }, + get VirtualUrlPlugin() { + return require("./schemes/VirtualUrlPlugin"); } }, ids: { diff --git a/lib/schemes/VirtualUrlPlugin.js b/lib/schemes/VirtualUrlPlugin.js new file mode 100644 index 00000000000..49895bb6e71 --- /dev/null +++ b/lib/schemes/VirtualUrlPlugin.js @@ -0,0 +1,222 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Natsu @xiaoxiaojx +*/ + +"use strict"; + +const { NormalModule } = require(".."); +const ModuleNotFoundError = require("../ModuleNotFoundError"); +const { parseResourceWithoutFragment } = require("../util/identifier"); + +/** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../Module").BuildInfo} BuildInfo */ +/** @typedef {import("../Module").ValueCacheVersions} ValueCacheVersions */ +/** @typedef {string | Set} ValueCacheVersion */ + +/** + * @template T + * @typedef {import("../../declarations/LoaderContext").LoaderContext} LoaderContext + */ + +const PLUGIN_NAME = "VirtualUrlPlugin"; +const DEFAULT_SCHEME = "virtual"; + +/** + * @typedef {object} VirtualModuleConfig + * @property {string=} type - The module type + * @property {(loaderContext: LoaderContext) => Promise | string} source - The source function + * @property {(() => string) | true | string=} version - Optional version function or value + */ + +/** + * @typedef {string | ((loaderContext: LoaderContext) => Promise | string) | VirtualModuleConfig} VirtualModuleInput + */ + +/** @typedef {{[key: string]: VirtualModuleInput}} VirtualModules */ + +/** + * Normalizes a virtual module definition into a standard format + * @param {VirtualModuleInput} virtualConfig The virtual module to normalize + * @returns {VirtualModuleConfig} The normalized virtual module + */ +function normalizeModule(virtualConfig) { + if (typeof virtualConfig === "string") { + return { + type: "", + source() { + return virtualConfig; + } + }; + } else if (typeof virtualConfig === "function") { + return { + type: "", + source: virtualConfig + }; + } + return virtualConfig; +} + +/** + * Normalizes all virtual modules with the given scheme + * @param {VirtualModules} virtualConfigs The virtual modules to normalize + * @param {string} scheme The URL scheme to use + * @returns {{[key: string]: VirtualModuleConfig}} The normalized virtual modules + */ +function normalizeModules(virtualConfigs, scheme) { + return Object.keys(virtualConfigs).reduce((pre, id) => { + pre[toVid(id, scheme)] = normalizeModule(virtualConfigs[id]); + return pre; + }, /** @type {{[key: string]: VirtualModuleConfig}} */ ({})); +} + +/** + * Converts a module id and scheme to a virtual module id + * @param {string} id The module id + * @param {string} scheme The URL scheme + * @returns {string} The virtual module id + */ +function toVid(id, scheme) { + return `${scheme}:${id}`; +} + +const VALUE_DEP_VERSION = `webpack/${PLUGIN_NAME}/version`; + +/** + * Converts a module id and scheme to a cache key + * @param {string} id The module id + * @param {string} scheme The URL scheme + * @returns {string} The cache key + */ +function toCacheKey(id, scheme) { + return `${VALUE_DEP_VERSION}/${toVid(id, scheme)}`; +} + +/** + * @typedef {object} VirtualUrlPluginOptions + * @property {VirtualModules} modules - The virtual modules + * @property {string=} scheme - The URL scheme to use + */ + +class VirtualUrlPlugin { + /** + * @param {VirtualModules} modules The virtual modules + * @param {string=} scheme The URL scheme to use + */ + constructor(modules, scheme) { + this.scheme = scheme || DEFAULT_SCHEME; + this.modules = normalizeModules(modules, this.scheme); + } + + /** + * Apply the plugin + * @param {Compiler} compiler the compiler instance + * @returns {void} + */ + apply(compiler) { + const scheme = this.scheme; + const cachedParseResourceWithoutFragment = + parseResourceWithoutFragment.bindCache(compiler.root); + + compiler.hooks.compilation.tap( + PLUGIN_NAME, + (compilation, { normalModuleFactory }) => { + normalModuleFactory.hooks.resolveForScheme + .for(scheme) + .tap(PLUGIN_NAME, resourceData => { + const virtualConfig = this.findVirtualModuleConfigById( + resourceData.resource + ); + const url = cachedParseResourceWithoutFragment( + resourceData.resource + ); + const path = url.path; + const type = virtualConfig.type; + resourceData.path = path + type; + resourceData.resource = path; + + if (virtualConfig.version) { + const cacheKey = toCacheKey(resourceData.resource, scheme); + const cacheVersion = this.getCacheVersion(virtualConfig.version); + compilation.valueCacheVersions.set( + cacheKey, + /** @type {string} */ (cacheVersion) + ); + } + + return true; + }); + + const hooks = NormalModule.getCompilationHooks(compilation); + hooks.readResource + .for(scheme) + .tapAsync(PLUGIN_NAME, async (loaderContext, callback) => { + const { resourcePath } = loaderContext; + const module = /** @type {NormalModule} */ (loaderContext._module); + const cacheKey = toCacheKey(resourcePath, scheme); + + const addVersionValueDependency = () => { + if (!module || !module.buildInfo) return; + + const buildInfo = module.buildInfo; + if (!buildInfo.valueDependencies) { + buildInfo.valueDependencies = new Map(); + } + + const cacheVersion = compilation.valueCacheVersions.get(cacheKey); + if (compilation.valueCacheVersions.has(cacheKey)) { + buildInfo.valueDependencies.set( + cacheKey, + /** @type {string} */ (cacheVersion) + ); + } + }; + + try { + const virtualConfig = + this.findVirtualModuleConfigById(resourcePath); + const content = await virtualConfig.source(loaderContext); + addVersionValueDependency(); + callback(null, content); + } catch (err) { + callback(/** @type {Error} */ (err)); + } + }); + } + ); + } + + /** + * @param {string} id The module id + * @returns {VirtualModuleConfig} The virtual module config + */ + findVirtualModuleConfigById(id) { + const config = this.modules[id]; + if (!config) { + throw new ModuleNotFoundError( + null, + new Error(`Can't resolve virtual module ${id}`), + { + name: `virtual module ${id}` + } + ); + } + return config; + } + + /** + * Get the cache version for a given version value + * @param {(() => string) | true | string} version The version value or function + * @returns {string | undefined} The cache version + */ + getCacheVersion(version) { + return version === true + ? undefined + : (typeof version === "function" ? version() : version) || "unset"; + } +} + +VirtualUrlPlugin.DEFAULT_SCHEME = DEFAULT_SCHEME; + +module.exports = VirtualUrlPlugin; diff --git a/schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts b/schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts new file mode 100644 index 00000000000..e07bbe26d54 --- /dev/null +++ b/schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts @@ -0,0 +1,7 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn fix:special` to update + */ +declare const check: (options: import("../../../declarations/plugins/schemes/VirtualUrlPlugin").VirtualUrlPluginOptions) => boolean; +export = check; diff --git a/schemas/plugins/schemes/VirtualUrlPlugin.check.js b/schemas/plugins/schemes/VirtualUrlPlugin.check.js new file mode 100644 index 00000000000..ed6aae62fd1 --- /dev/null +++ b/schemas/plugins/schemes/VirtualUrlPlugin.check.js @@ -0,0 +1,6 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn fix:special` to update + */ +"use strict";function t(r,{instancePath:e="",parentData:n,parentDataProperty:s,rootData:o=r}={}){let a=null,l=0;const i=l;let p=!1;const u=l;if("string"!=typeof r){const t={params:{type:"string"}};null===a?a=[t]:a.push(t),l++}var c=u===l;if(p=p||c,!p){const t=l;if(!(r instanceof Function)){const t={params:{}};null===a?a=[t]:a.push(t),l++}if(c=t===l,p=p||c,!p){const t=l;if(l==l)if(r&&"object"==typeof r&&!Array.isArray(r)){let t;if(void 0===r.source&&(t="source")){const r={params:{missingProperty:t}};null===a?a=[r]:a.push(r),l++}else{const t=l;for(const t in r)if("source"!==t&&"type"!==t&&"version"!==t){const r={params:{additionalProperty:t}};null===a?a=[r]:a.push(r),l++;break}if(t===l){if(void 0!==r.source){const t=l;if(!(r.source instanceof Function)){const t={params:{}};null===a?a=[t]:a.push(t),l++}var f=t===l}else f=!0;if(f){if(void 0!==r.type){const t=l;if("string"!=typeof r.type){const t={params:{type:"string"}};null===a?a=[t]:a.push(t),l++}f=t===l}else f=!0;if(f)if(void 0!==r.version){let t=r.version;const e=l,n=l;let s=!1;const o=l;if("boolean"!=typeof t){const t={params:{type:"boolean"}};null===a?a=[t]:a.push(t),l++}if(!0!==t){const t={params:{}};null===a?a=[t]:a.push(t),l++}var y=o===l;if(s=s||y,!s){const r=l;if("string"!=typeof t){const t={params:{type:"string"}};null===a?a=[t]:a.push(t),l++}if(y=r===l,s=s||y,!s){const r=l;if(!(t instanceof Function)){const t={params:{}};null===a?a=[t]:a.push(t),l++}y=r===l,s=s||y}}if(s)l=n,null!==a&&(n?a.length=n:a=null);else{const t={params:{}};null===a?a=[t]:a.push(t),l++}f=e===l}else f=!0}}}}else{const t={params:{type:"object"}};null===a?a=[t]:a.push(t),l++}c=t===l,p=p||c}}if(!p){const r={params:{}};return null===a?a=[r]:a.push(r),l++,t.errors=a,!1}return l=i,null!==a&&(i?a.length=i:a=null),t.errors=a,0===l}function r(e,{instancePath:n="",parentData:s,parentDataProperty:o,rootData:a=e}={}){let l=null,i=0;if(0===i){if(!e||"object"!=typeof e||Array.isArray(e))return r.errors=[{params:{type:"object"}}],!1;{let s;if(void 0===e.modules&&(s="modules"))return r.errors=[{params:{missingProperty:s}}],!1;{const s=i;for(const t in e)if("modules"!==t&&"scheme"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(s===i){if(void 0!==e.modules){let s=e.modules;const o=i;if(i===o){if(!s||"object"!=typeof s||Array.isArray(s))return r.errors=[{params:{type:"object"}}],!1;for(const r in s){const e=i;if(t(s[r],{instancePath:n+"/modules/"+r.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:s,parentDataProperty:r,rootData:a})||(l=null===l?t.errors:l.concat(t.errors),i=l.length),e!==i)break}}var p=o===i}else p=!0;if(p)if(void 0!==e.scheme){const t=i;if("string"!=typeof e.scheme)return r.errors=[{params:{type:"string"}}],!1;p=t===i}else p=!0}}}}return r.errors=l,0===i}function e(t,{instancePath:n="",parentData:s,parentDataProperty:o,rootData:a=t}={}){let l=null,i=0;const p=i;let u=!1,c=null;const f=i;if(r(t,{instancePath:n,parentData:s,parentDataProperty:o,rootData:a})||(l=null===l?r.errors:l.concat(r.errors),i=l.length),f===i&&(u=!0,c=0),!u){const t={params:{passingSchemas:c}};return null===l?l=[t]:l.push(t),i++,e.errors=l,!1}return i=p,null!==l&&(p?l.length=p:l=null),e.errors=l,0===i}module.exports=e,module.exports.default=e; \ No newline at end of file diff --git a/schemas/plugins/schemes/VirtualUrlPlugin.json b/schemas/plugins/schemes/VirtualUrlPlugin.json new file mode 100644 index 00000000000..704135a9714 --- /dev/null +++ b/schemas/plugins/schemes/VirtualUrlPlugin.json @@ -0,0 +1,77 @@ +{ + "definitions": { + "VirtualModule": { + "description": "A virtual module definition.", + "type": "object", + "additionalProperties": false, + "properties": { + "source": { + "description": "The source function that provides the virtual content.", + "instanceof": "Function", + "tsType": "((loaderContext: import('webpack').LoaderContext) => Promise | string)" + }, + "type": { + "description": "The module type.", + "type": "string" + }, + "version": { + "description": "Optional version function or value for cache invalidation.", + "anyOf": [ + { + "type": "boolean", + "enum": [true] + }, + { + "type": "string" + }, + { + "instanceof": "Function", + "tsType": "(() => string | undefined)" + } + ] + } + }, + "required": ["source"] + }, + "VirtualModuleContent": { + "description": "A virtual module can be a string, a function, or a VirtualModule object.", + "anyOf": [ + { + "type": "string" + }, + { + "instanceof": "Function", + "tsType": "((loaderContext: import('webpack').LoaderContext) => Promise | string)" + }, + { + "$ref": "#/definitions/VirtualModule" + } + ] + }, + "VirtualUrlOptions": { + "description": "Options for building virtual resources.", + "type": "object", + "additionalProperties": false, + "properties": { + "modules": { + "description": "The virtual modules configuration.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/VirtualModuleContent" + } + }, + "scheme": { + "description": "The URL scheme to use for virtual resources.", + "type": "string" + } + }, + "required": ["modules"] + } + }, + "title": "VirtualUrlPluginOptions", + "oneOf": [ + { + "$ref": "#/definitions/VirtualUrlOptions" + } + ] +} diff --git a/test/configCases/plugins/virtual-url-plugin/babel-loader.js b/test/configCases/plugins/virtual-url-plugin/babel-loader.js new file mode 100644 index 00000000000..c1b53a7013c --- /dev/null +++ b/test/configCases/plugins/virtual-url-plugin/babel-loader.js @@ -0,0 +1,19 @@ +/** @typedef {import("webpack").LoaderContext} LoaderContext */ + +/** + * @this {LoaderContext} + * @param {string} source The source code to process + * @returns {void} + */ +module.exports = function(source) { + const callback = this.async(); + + try { + const withoutConst = source.replace(/const/g, "var"); + + callback(null, withoutConst); + } catch (err) { + callback(/** @type {Error} */ (err)); + } +}; + \ No newline at end of file diff --git a/test/configCases/plugins/virtual-url-plugin/index.js b/test/configCases/plugins/virtual-url-plugin/index.js new file mode 100644 index 00000000000..68406efde75 --- /dev/null +++ b/test/configCases/plugins/virtual-url-plugin/index.js @@ -0,0 +1,38 @@ +import { routes } from "virtual:routes" +import { app } from "virtual:app" +import json from "virtual:config" +import { ts } from "virtual:ts" +import txt from "virtual:txt" + +it("should correctly load virtual modules with the js type.", (done) => { + expect(typeof routes.bar).toBe("function"); + expect(typeof routes.foo).toBe("function"); + expect(app).toBe("app"); + Promise.all([ + routes.bar(), + routes.foo() + ]).then(([{bar}, {foo}]) => { + expect(bar).toBe("bar"); + expect(foo).toBe("foo"); + done(); + }).catch(done); +}); + +it("should correctly load virtual modules with the json type.", (done) => { + expect(json.name).toBe("virtual-url-plugin"); + done() +}); + +it("should correctly load virtual modules with the css type.", (done) => { + import("virtual:style").then(() => done()).catch(done) +}); + +it("should correctly load virtual modules with the asset/source type.", (done) => { + expect(txt).toBe("Hello world"); + done(); +}); + +it("should correctly load virtual modules with custom loader.", (done) => { + expect(ts).toBe("var"); + done() +}); \ No newline at end of file diff --git a/test/configCases/plugins/virtual-url-plugin/routes/bar.js b/test/configCases/plugins/virtual-url-plugin/routes/bar.js new file mode 100644 index 00000000000..20d220b9e76 --- /dev/null +++ b/test/configCases/plugins/virtual-url-plugin/routes/bar.js @@ -0,0 +1 @@ +export const bar = "bar"; \ No newline at end of file diff --git a/test/configCases/plugins/virtual-url-plugin/routes/foo.js b/test/configCases/plugins/virtual-url-plugin/routes/foo.js new file mode 100644 index 00000000000..ca6bb3bd505 --- /dev/null +++ b/test/configCases/plugins/virtual-url-plugin/routes/foo.js @@ -0,0 +1 @@ +export const foo = "foo"; \ No newline at end of file diff --git a/test/configCases/plugins/virtual-url-plugin/ts-loader.js b/test/configCases/plugins/virtual-url-plugin/ts-loader.js new file mode 100644 index 00000000000..4aa65190847 --- /dev/null +++ b/test/configCases/plugins/virtual-url-plugin/ts-loader.js @@ -0,0 +1,8 @@ +/** @type {import("../../../../").LoaderDefinition} */ +module.exports = function(source) { + const callback = this.async(); + + const withoutInterfaces = source.replace(/interface\s+\w+(\s*extends\s+\w+)?\s*\{[^}]*\}/g, ''); + + callback(null, withoutInterfaces); +}; diff --git a/test/configCases/plugins/virtual-url-plugin/webpack.config.js b/test/configCases/plugins/virtual-url-plugin/webpack.config.js new file mode 100644 index 00000000000..9adad4bb103 --- /dev/null +++ b/test/configCases/plugins/virtual-url-plugin/webpack.config.js @@ -0,0 +1,74 @@ +const fs = require("fs"); +const path = require("path"); +const webpack = require("../../../../"); +const { VirtualUrlPlugin } = webpack.experiments.schemes; + +const watchDir = path.join(__dirname, "./routes"); + +/** @type {import('webpack').Configuration} */ +const config = { + plugins: [ + new VirtualUrlPlugin({ + routes(loaderContext) { + const files = fs.readdirSync(watchDir); + return ` + export const routes = { + ${files.map(key => `${key.split(".")[0]}: () => import('./routes/${key}')`).join(",\n")} + } + `; + }, + app: "export const app = 'app'", + config: { + type: ".json", + source() { + return `{"name": "virtual-url-plugin"}`; + } + }, + ts: { + type: ".ts", + source() { + return `interface Info { + name: string; + } + export const ts = 'const';`; + } + }, + style: { + type: ".css", + source() { + return `body{background-color: powderblue;}`; + } + }, + txt: { + type: ".txt", + source() { + return `Hello world`; + } + } + }) + ], + experiments: { + css: true + }, + module: { + rules: [ + { + test: /\.ts/, + use: [ + { + loader: require.resolve("./ts-loader.js") + }, + { + loader: require.resolve("./babel-loader.js") + } + ] + }, + { + test: /\.txt/, + type: "asset/source" + } + ] + } +}; + +module.exports = config; diff --git a/test/watchCases/plugins/virtual-url-plugin-version/0/index.js b/test/watchCases/plugins/virtual-url-plugin-version/0/index.js new file mode 100644 index 00000000000..9b5a19c81a5 --- /dev/null +++ b/test/watchCases/plugins/virtual-url-plugin-version/0/index.js @@ -0,0 +1,15 @@ +import { routes } from "virtual:routes"; +import { watchStep } from "virtual:watchStep"; +import { constStep } from "virtual:constStep"; + +it("should have correct exports when read from an external file", function() { + expect(routes).toBe("v0"); +}); + +it("should always rebuild when version set to true", function() { + expect(watchStep).toBe(0); +}); + +it("should not rebuild when version not set", function() { + expect(constStep).toBe(0); +}); diff --git a/test/watchCases/plugins/virtual-url-plugin-version/0/v.js b/test/watchCases/plugins/virtual-url-plugin-version/0/v.js new file mode 100644 index 00000000000..ed8fe80bddc --- /dev/null +++ b/test/watchCases/plugins/virtual-url-plugin-version/0/v.js @@ -0,0 +1 @@ +export const routes = 'v0' \ No newline at end of file diff --git a/test/watchCases/plugins/virtual-url-plugin-version/1/index.js b/test/watchCases/plugins/virtual-url-plugin-version/1/index.js new file mode 100644 index 00000000000..16a7f6ed5a7 --- /dev/null +++ b/test/watchCases/plugins/virtual-url-plugin-version/1/index.js @@ -0,0 +1,15 @@ +import { routes } from "virtual:routes"; +import { watchStep } from "virtual:watchStep"; +import { constStep } from "virtual:constStep"; + +it("should have correct read from an external file", function() { + expect(routes).toBe("v1"); +}); + +it("should always rebuild when version set to true", function() { + expect(watchStep).toBe(1); +}); + +it("should not rebuild when version not set", function() { + expect(constStep).toBe(0); +}); diff --git a/test/watchCases/plugins/virtual-url-plugin-version/1/v.js b/test/watchCases/plugins/virtual-url-plugin-version/1/v.js new file mode 100644 index 00000000000..90ee6a5b7db --- /dev/null +++ b/test/watchCases/plugins/virtual-url-plugin-version/1/v.js @@ -0,0 +1 @@ +export const routes = 'v1' \ No newline at end of file diff --git a/test/watchCases/plugins/virtual-url-plugin-version/webpack.config.js b/test/watchCases/plugins/virtual-url-plugin-version/webpack.config.js new file mode 100644 index 00000000000..eb71873bed1 --- /dev/null +++ b/test/watchCases/plugins/virtual-url-plugin-version/webpack.config.js @@ -0,0 +1,29 @@ +const fs = require("fs"); +const path = require("path"); +const webpack = require("../../../../"); +const { VirtualUrlPlugin } = webpack.experiments.schemes; + +let watchStep = -1; + +/** @type {import("../../../../types").Configuration} */ +module.exports = { + plugins: [ + new VirtualUrlPlugin({ + routes: { + source: () => + fs.readFileSync(path.join(__dirname, `./${watchStep}/v.js`), "utf8"), + version: () => { + watchStep = watchStep + 1; + return `v${watchStep}`; + } + }, + watchStep: { + source: () => `export const watchStep = ${watchStep}`, + version: true + }, + constStep: { + source: () => `export const constStep = ${watchStep}` + } + }) + ] +}; diff --git a/types.d.ts b/types.d.ts index 1d6f52bdbe9..2ccfde9200f 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1973,7 +1973,7 @@ declare class Compilation { statsFactory: SyncHook<[StatsFactory, NormalizedStatsOptions]>; statsPrinter: SyncHook<[StatsPrinter, NormalizedStatsOptions]>; get normalModuleLoader(): SyncHook< - [LoaderContextNormalModule, NormalModule] + [LoaderContextObject, NormalModule] >; }>; name?: string; @@ -8584,7 +8584,7 @@ type LoaderContextDeclarationsIndex = LoaderRunnerLoaderContext & LoaderPluginLoaderContext & HotModuleReplacementPluginLoaderContext; -type LoaderContextNormalModule = NormalModuleLoaderContext & +type LoaderContextObject = NormalModuleLoaderContext & LoaderRunnerLoaderContext & LoaderPluginLoaderContext & HotModuleReplacementPluginLoaderContext; @@ -10131,7 +10131,7 @@ declare class NormalModule extends Module { associatedObjectForCache?: object ): Source; getCurrentLoader( - loaderContext: LoaderContextNormalModule, + loaderContext: LoaderContextObject, index?: number ): null | LoaderItem; createSource( @@ -10157,9 +10157,9 @@ declare class NormalModule extends Module { static deserialize(context: ObjectDeserializerContext): NormalModule; } declare interface NormalModuleCompilationHooks { - loader: SyncHook<[LoaderContextNormalModule, NormalModule]>; + loader: SyncHook<[LoaderContextObject, NormalModule]>; beforeLoaders: SyncHook< - [LoaderItem[], NormalModule, LoaderContextNormalModule] + [LoaderItem[], NormalModule, LoaderContextObject] >; beforeParse: SyncHook<[NormalModule]>; beforeSnapshot: SyncHook<[NormalModule]>; @@ -10169,10 +10169,7 @@ declare interface NormalModuleCompilationHooks { > >; readResource: HookMap< - AsyncSeriesBailHook< - [LoaderContextNormalModule], - null | string | Buffer - > + AsyncSeriesBailHook<[LoaderContextObject], null | string | Buffer> >; processResult: SyncWaterfallHook< [[string | Buffer, string | SourceMapSource, PreparsedAst], NormalModule] @@ -15927,6 +15924,46 @@ declare class VariableInfo { freeName?: string | true; tagInfo?: TagInfo; } +declare interface VirtualModuleConfig { + /** + * - The module type + */ + type?: string; + + /** + * - The source function + */ + source: (loaderContext: LoaderContextObject) => string | Promise; + + /** + * - Optional version function or value + */ + version?: string | true | (() => string); +} +type VirtualModuleInput = + | string + | ((loaderContext: LoaderContextObject) => string | Promise) + | VirtualModuleConfig; +declare interface VirtualModules { + [index: string]: VirtualModuleInput; +} +declare class VirtualUrlPlugin { + constructor(modules: VirtualModules, scheme?: string); + scheme: string; + modules: { [index: string]: VirtualModuleConfig }; + + /** + * Apply the plugin + */ + apply(compiler: Compiler): void; + findVirtualModuleConfigById(id: string): VirtualModuleConfig; + + /** + * Get the cache version for a given version value + */ + getCacheVersion(version: string | true | (() => string)): undefined | string; + static DEFAULT_SCHEME: string; +} type WarningFilterItemTypes = | string | RegExp @@ -17063,7 +17100,7 @@ declare namespace exports { } export namespace experiments { export namespace schemes { - export { HttpUriPlugin }; + export { HttpUriPlugin, VirtualUrlPlugin }; } export namespace ids { export { SyncModuleIdsPlugin }; diff --git a/yarn.lock b/yarn.lock index d59a1113c0f..327588f06d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -706,9 +706,9 @@ integrity sha512-D/xHXX7T37BJxNRf5JJHsvziFDvh23IF/KvkZXNSh8VqcRdod3BAz9VGHZf6VDqcZXr1VRqIYR3mQ8DSvs3AVQ== "@cspell/dict-software-terms@^5.0.8": - version "5.0.8" - resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-5.0.8.tgz#baa277fabfc70f3d8453830e26628ee6df53fad9" - integrity sha512-VsJesitvaHZpMgNwHHms3yDsZz7LNToC2HuSAnyt1znn37ribiJF1ty0jWhVQO6fv7K4PM1KsKTJIwqBwc446g== + version "5.0.9" + resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-5.0.9.tgz#009dcd916191f1915776a5cedb39fd2d34b0b5ff" + integrity sha512-Zcm7PMxLSmgJNeICsj1jfhOIS8sOFGgmV1EsTo+EALXWU5pcD6u/P+B9sY0f/9M8V82VaYmTeNVwSlZNh5h94w== "@cspell/dict-sql@^2.2.0": version "2.2.0" From 9bc07c6c19d0373eabfdf079660e60fa3ad96118 Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Thu, 22 May 2025 22:54:59 +0800 Subject: [PATCH 04/56] feat: support dynamic template literals expressions for new URL() (#19046) --- declarations/WebpackOptions.d.ts | 4 + lib/config/defaults.js | 1 + lib/dependencies/ImportParserPlugin.js | 4 +- lib/dependencies/URLContextDependency.js | 65 ++++++ lib/dependencies/URLPlugin.js | 174 ++------------- lib/url/URLExpressionParserPlugin.js | 204 ++++++++++++++++++ lib/util/internalSerializables.js | 2 + schemas/WebpackOptions.check.js | 2 +- schemas/WebpackOptions.json | 4 + test/Defaults.unittest.js | 1 + test/__snapshots__/Cli.basictest.js.snap | 47 +++- .../url/disable-dynamic-url/index.js | 10 + .../url/disable-dynamic-url/webpack.config.js | 11 + .../dynamic-template-literals-expr/index.js | 23 ++ .../dynamic-template-literals-expr/js/a.js | 1 + .../dynamic-template-literals-expr/js/b.js | 1 + .../dynamic-template-literals-expr/js/c.js | 1 + .../json/a.json | 3 + .../json/b.json | 3 + .../json/c.json | 3 + .../webpack.config.js | 7 + types.d.ts | 5 + 22 files changed, 416 insertions(+), 160 deletions(-) create mode 100644 lib/dependencies/URLContextDependency.js create mode 100644 lib/url/URLExpressionParserPlugin.js create mode 100644 test/configCases/url/disable-dynamic-url/index.js create mode 100644 test/configCases/url/disable-dynamic-url/webpack.config.js create mode 100644 test/configCases/url/dynamic-template-literals-expr/index.js create mode 100644 test/configCases/url/dynamic-template-literals-expr/js/a.js create mode 100644 test/configCases/url/dynamic-template-literals-expr/js/b.js create mode 100644 test/configCases/url/dynamic-template-literals-expr/js/c.js create mode 100644 test/configCases/url/dynamic-template-literals-expr/json/a.json create mode 100644 test/configCases/url/dynamic-template-literals-expr/json/b.json create mode 100644 test/configCases/url/dynamic-template-literals-expr/json/c.json create mode 100644 test/configCases/url/dynamic-template-literals-expr/webpack.config.js diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index ec1e380ecd1..0182b6b31f2 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -3299,6 +3299,10 @@ export interface JavascriptParserOptions { * Specifies global preload for dynamic import. */ dynamicImportPreload?: number | boolean; + /** + * Enable/disable parsing of dynamic URL. + */ + dynamicUrl?: boolean; /** * Specifies the behavior of invalid export names in "import ... from ..." and "export ... from ...". */ diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 40ef46ebd94..27fc64b64e0 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -585,6 +585,7 @@ const applyJavascriptParserOptionsDefaults = ( D(parserOptions, "dynamicImportPreload", false); D(parserOptions, "dynamicImportFetchPriority", false); D(parserOptions, "createRequire", isNode); + D(parserOptions, "dynamicUrl", true); if (futureDefaults) D(parserOptions, "exportsPresence", "error"); }; diff --git a/lib/dependencies/ImportParserPlugin.js b/lib/dependencies/ImportParserPlugin.js index 52fdb9317ca..25d8ccd1a0b 100644 --- a/lib/dependencies/ImportParserPlugin.js +++ b/lib/dependencies/ImportParserPlugin.js @@ -24,6 +24,8 @@ const ImportWeakDependency = require("./ImportWeakDependency"); /** @typedef {import("../javascript/JavascriptParser").ImportExpression} ImportExpression */ /** @typedef {import("../javascript/JavascriptParser").Range} Range */ +const PLUGIN_NAME = "ImportParserPlugin"; + class ImportParserPlugin { /** * @param {JavascriptParserOptions} options options @@ -44,7 +46,7 @@ class ImportParserPlugin { */ const exportsFromEnumerable = enumerable => Array.from(enumerable, e => [e]); - parser.hooks.importCall.tap("ImportParserPlugin", expr => { + parser.hooks.importCall.tap(PLUGIN_NAME, expr => { const param = parser.evaluateExpression(expr.source); let chunkName = null; diff --git a/lib/dependencies/URLContextDependency.js b/lib/dependencies/URLContextDependency.js new file mode 100644 index 00000000000..cdf10312cb4 --- /dev/null +++ b/lib/dependencies/URLContextDependency.js @@ -0,0 +1,65 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Haijie Xie @hai-x +*/ + +"use strict"; + +const makeSerializable = require("../util/makeSerializable"); +const ContextDependency = require("./ContextDependency"); +const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall"); + +/** @typedef {import("../ContextModule").ContextOptions} ContextOptions */ +/** @typedef {import("../javascript/JavascriptParser").Range} Range */ +/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ +/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ + +/** @typedef {ContextOptions & { request: string }} ContextDependencyOptions */ + +class URLContextDependency extends ContextDependency { + /** + * @param {ContextDependencyOptions} options options + * @param {Range} range range + * @param {Range} valueRange value range + */ + constructor(options, range, valueRange) { + super(options); + this.range = range; + this.valueRange = valueRange; + } + + get type() { + return "new URL() context"; + } + + get category() { + return "url"; + } + + /** + * @param {ObjectSerializerContext} context context + */ + serialize(context) { + const { write } = context; + write(this.valueRange); + super.serialize(context); + } + + /** + * @param {ObjectDeserializerContext} context context + */ + deserialize(context) { + const { read } = context; + this.valueRange = read(); + super.deserialize(context); + } +} + +makeSerializable( + URLContextDependency, + "webpack/lib/dependencies/URLContextDependency" +); + +URLContextDependency.Template = ContextDependencyTemplateAsRequireCall; + +module.exports = URLContextDependency; diff --git a/lib/dependencies/URLPlugin.js b/lib/dependencies/URLPlugin.js index 0409f0689b6..a692c401925 100644 --- a/lib/dependencies/URLPlugin.js +++ b/lib/dependencies/URLPlugin.js @@ -5,29 +5,19 @@ "use strict"; -const { pathToFileURL } = require("url"); -const CommentCompilationWarning = require("../CommentCompilationWarning"); const { JAVASCRIPT_MODULE_TYPE_AUTO, JAVASCRIPT_MODULE_TYPE_ESM } = require("../ModuleTypeConstants"); -const RuntimeGlobals = require("../RuntimeGlobals"); -const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning"); -const BasicEvaluatedExpression = require("../javascript/BasicEvaluatedExpression"); -const { approve } = require("../javascript/JavascriptParserHelpers"); -const InnerGraph = require("../optimize/InnerGraph"); -const ConstDependency = require("./ConstDependency"); -const URLDependency = require("./URLDependency"); -/** @typedef {import("estree").MemberExpression} MemberExpression */ -/** @typedef {import("estree").NewExpression} NewExpressionNode */ +const URLContextDependency = require("../dependencies/URLContextDependency"); +const URLDependency = require("../dependencies/URLDependency"); +const URLExpressionParserPlugin = require("../url/URLExpressionParserPlugin"); + /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ /** @typedef {import("../Compiler")} Compiler */ -/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ -/** @typedef {import("../NormalModule")} NormalModule */ /** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ /** @typedef {import("../javascript/JavascriptParser")} Parser */ -/** @typedef {import("../javascript/JavascriptParser").Range} Range */ const PLUGIN_NAME = "URLPlugin"; @@ -38,168 +28,38 @@ class URLPlugin { apply(compiler) { compiler.hooks.compilation.tap( PLUGIN_NAME, - (compilation, { normalModuleFactory }) => { + (compilation, { normalModuleFactory, contextModuleFactory }) => { compilation.dependencyFactories.set(URLDependency, normalModuleFactory); compilation.dependencyTemplates.set( URLDependency, new URLDependency.Template() ); - - /** - * @param {NormalModule} module module - * @returns {URL} file url - */ - const getUrl = module => pathToFileURL(module.resource); - - /** - * @param {Parser} parser parser parser - * @param {MemberExpression} arg arg - * @returns {boolean} true when it is `meta.url`, otherwise false - */ - const isMetaUrl = (parser, arg) => { - const chain = parser.extractMemberExpressionChain(arg); - - if ( - chain.members.length !== 1 || - chain.object.type !== "MetaProperty" || - chain.object.meta.name !== "import" || - chain.object.property.name !== "meta" || - chain.members[0] !== "url" - ) - return false; - - return true; - }; + compilation.dependencyFactories.set( + URLContextDependency, + contextModuleFactory + ); + compilation.dependencyTemplates.set( + URLContextDependency, + new URLContextDependency.Template() + ); /** * @param {Parser} parser parser parser * @param {JavascriptParserOptions} parserOptions parserOptions * @returns {void} */ - const parserCallback = (parser, parserOptions) => { + const handler = (parser, parserOptions) => { if (parserOptions.url === false) return; - const relative = parserOptions.url === "relative"; - - /** - * @param {NewExpressionNode} expr expression - * @returns {undefined | string} request - */ - const getUrlRequest = expr => { - if (expr.arguments.length !== 2) return; - - const [arg1, arg2] = expr.arguments; - - if ( - arg2.type !== "MemberExpression" || - arg1.type === "SpreadElement" - ) - return; - - if (!isMetaUrl(parser, arg2)) return; - - return parser.evaluateExpression(arg1).asString(); - }; - - parser.hooks.canRename.for("URL").tap(PLUGIN_NAME, approve); - parser.hooks.evaluateNewExpression - .for("URL") - .tap(PLUGIN_NAME, expr => { - const request = getUrlRequest(expr); - if (!request) return; - const url = new URL(request, getUrl(parser.state.module)); - - return new BasicEvaluatedExpression() - .setString(url.toString()) - .setRange(/** @type {Range} */ (expr.range)); - }); - 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)); - - if (commentErrors) { - for (const e of commentErrors) { - const { comment } = e; - parser.state.module.addWarning( - new CommentCompilationWarning( - `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, - /** @type {DependencyLocation} */ (comment.loc) - ) - ); - } - } - - if (importOptions && importOptions.webpackIgnore !== undefined) { - if (typeof importOptions.webpackIgnore !== "boolean") { - parser.state.module.addWarning( - new UnsupportedFeatureWarning( - `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, - /** @type {DependencyLocation} */ (expr.loc) - ) - ); - return; - } else if (importOptions.webpackIgnore) { - if (expr.arguments.length !== 2) return; - - const [, arg2] = expr.arguments; - - if ( - arg2.type !== "MemberExpression" || - !isMetaUrl(parser, arg2) - ) - return; - - const dep = new ConstDependency( - RuntimeGlobals.baseURI, - /** @type {Range} */ (arg2.range), - [RuntimeGlobals.baseURI] - ); - dep.loc = /** @type {DependencyLocation} */ (expr.loc); - parser.state.module.addPresentationalDependency(dep); - - return true; - } - } - - const request = getUrlRequest(expr); - - if (!request) return; - - const [arg1, arg2] = expr.arguments; - const dep = new URLDependency( - request, - [ - /** @type {Range} */ (arg1.range)[0], - /** @type {Range} */ (arg2.range)[1] - ], - /** @type {Range} */ (expr.range), - relative - ); - dep.loc = /** @type {DependencyLocation} */ (expr.loc); - parser.state.current.addDependency(dep); - InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); - return true; - }); - parser.hooks.isPure.for("NewExpression").tap(PLUGIN_NAME, _expr => { - const expr = /** @type {NewExpressionNode} */ (_expr); - const { callee } = expr; - if (callee.type !== "Identifier") return; - const calleeInfo = parser.getFreeInfoFromVariable(callee.name); - if (!calleeInfo || calleeInfo.name !== "URL") return; - - const request = getUrlRequest(expr); - - if (request) return true; - }); + new URLExpressionParserPlugin(parserOptions).apply(parser); }; normalModuleFactory.hooks.parser .for(JAVASCRIPT_MODULE_TYPE_AUTO) - .tap(PLUGIN_NAME, parserCallback); + .tap(PLUGIN_NAME, handler); normalModuleFactory.hooks.parser .for(JAVASCRIPT_MODULE_TYPE_ESM) - .tap(PLUGIN_NAME, parserCallback); + .tap(PLUGIN_NAME, handler); } ); } diff --git a/lib/url/URLExpressionParserPlugin.js b/lib/url/URLExpressionParserPlugin.js new file mode 100644 index 00000000000..3728edecee2 --- /dev/null +++ b/lib/url/URLExpressionParserPlugin.js @@ -0,0 +1,204 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Haijie Xie @hai-x +*/ + +"use strict"; + +const { pathToFileURL } = require("url"); +const CommentCompilationWarning = require("../CommentCompilationWarning"); +const RuntimeGlobals = require("../RuntimeGlobals"); +const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning"); +const ConstDependency = require("../dependencies/ConstDependency"); +const ContextDependencyHelpers = require("../dependencies/ContextDependencyHelpers"); +const URLContextDependency = require("../dependencies/URLContextDependency"); +const URLDependency = require("../dependencies/URLDependency"); +const BasicEvaluatedExpression = require("../javascript/BasicEvaluatedExpression"); +const { approve } = require("../javascript/JavascriptParserHelpers"); +const InnerGraph = require("../optimize/InnerGraph"); + +/** @typedef {import("estree").MemberExpression} MemberExpression */ +/** @typedef {import("estree").NewExpression} NewExpressionNode */ + +/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ +/** @typedef {import("../NormalModule")} NormalModule */ +/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ +/** @typedef {import("../javascript/JavascriptParser")} Parser */ +/** @typedef {import("../javascript/JavascriptParser").Range} Range */ + +const PLUGIN_NAME = "URLParserPlugin"; + +/** + * @param {NormalModule} module module + * @returns {URL} file url + */ +const getUrl = module => pathToFileURL(module.resource); + +/** + * @param {Parser} parser parser parser + * @param {MemberExpression} arg arg + * @returns {boolean} true when it is `meta.url`, otherwise false + */ +const isMetaUrl = (parser, arg) => { + const chain = parser.extractMemberExpressionChain(arg); + + if ( + chain.members.length !== 1 || + chain.object.type !== "MetaProperty" || + chain.object.meta.name !== "import" || + chain.object.property.name !== "meta" || + chain.members[0] !== "url" + ) + return false; + + return true; +}; + +/** + * @param {NewExpressionNode} expr expression + * @param {Parser} parser parser parser + * @returns {BasicEvaluatedExpression | undefined} basicEvaluatedExpression + */ +const getEvaluatedExpr = (expr, parser) => { + if (expr.arguments.length !== 2) return; + + const [arg1, arg2] = expr.arguments; + + if (arg2.type !== "MemberExpression" || arg1.type === "SpreadElement") return; + + if (!isMetaUrl(parser, arg2)) return; + + return parser.evaluateExpression(arg1); +}; + +class URLParserPlugin { + /** + * @param {JavascriptParserOptions} options options + */ + constructor(options) { + this.options = options; + } + + /** + * @param {JavascriptParser} parser the parser + * @returns {void} + */ + apply(parser) { + const relative = this.options.url === "relative"; + + parser.hooks.canRename.for("URL").tap(PLUGIN_NAME, approve); + parser.hooks.evaluateNewExpression.for("URL").tap(PLUGIN_NAME, expr => { + const evaluatedExpr = getEvaluatedExpr(expr, parser); + const request = evaluatedExpr && evaluatedExpr.asString(); + + if (!request) return; + const url = new URL(request, getUrl(parser.state.module)); + + return new BasicEvaluatedExpression() + .setString(url.toString()) + .setRange(/** @type {Range} */ (expr.range)); + }); + 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)); + + if (commentErrors) { + for (const e of commentErrors) { + const { comment } = e; + parser.state.module.addWarning( + new CommentCompilationWarning( + `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, + /** @type {DependencyLocation} */ (comment.loc) + ) + ); + } + } + + if (importOptions && importOptions.webpackIgnore !== undefined) { + if (typeof importOptions.webpackIgnore !== "boolean") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`, + /** @type {DependencyLocation} */ (expr.loc) + ) + ); + return; + } else if (importOptions.webpackIgnore) { + if (expr.arguments.length !== 2) return; + + const [, arg2] = expr.arguments; + + if (arg2.type !== "MemberExpression" || !isMetaUrl(parser, arg2)) + return; + + const dep = new ConstDependency( + RuntimeGlobals.baseURI, + /** @type {Range} */ (arg2.range), + [RuntimeGlobals.baseURI] + ); + dep.loc = /** @type {DependencyLocation} */ (expr.loc); + parser.state.module.addPresentationalDependency(dep); + + return true; + } + } + + const evaluatedExpr = getEvaluatedExpr(expr, parser); + if (!evaluatedExpr) return; + + let request; + if ((request = evaluatedExpr.asString())) { + const [arg1, arg2] = expr.arguments; + const dep = new URLDependency( + request, + [ + /** @type {Range} */ (arg1.range)[0], + /** @type {Range} */ (arg2.range)[1] + ], + /** @type {Range} */ (expr.range), + relative + ); + dep.loc = /** @type {DependencyLocation} */ (expr.loc); + parser.state.current.addDependency(dep); + InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); + return true; + } + + if (this.options.dynamicUrl === false) return; + + // handle dynamic url + const dep = ContextDependencyHelpers.create( + URLContextDependency, + /** @type {Range} */ (expr.range), + evaluatedExpr, + expr, + this.options, + { + category: "url" + }, + parser + ); + if (!dep) return; + dep.loc = /** @type {DependencyLocation} */ (expr.loc); + dep.optional = Boolean(parser.scope.inTry); + parser.state.current.addDependency(dep); + return true; + }); + parser.hooks.isPure.for("NewExpression").tap(PLUGIN_NAME, _expr => { + const expr = /** @type {NewExpressionNode} */ (_expr); + const { callee } = expr; + if (callee.type !== "Identifier") return; + const calleeInfo = parser.getFreeInfoFromVariable(callee.name); + if (!calleeInfo || calleeInfo.name !== "URL") return; + + const evaluatedExpr = getEvaluatedExpr(expr, parser); + const request = evaluatedExpr && evaluatedExpr.asString(); + + if (request) return true; + }); + } +} + +module.exports = URLParserPlugin; diff --git a/lib/util/internalSerializables.js b/lib/util/internalSerializables.js index 3ca8f2b9178..964a5c26570 100644 --- a/lib/util/internalSerializables.js +++ b/lib/util/internalSerializables.js @@ -170,6 +170,8 @@ module.exports = { "dependencies/UnsupportedDependency": () => require("../dependencies/UnsupportedDependency"), "dependencies/URLDependency": () => require("../dependencies/URLDependency"), + "dependencies/URLContextDependency": () => + require("../dependencies/URLContextDependency"), "dependencies/WebAssemblyExportImportedDependency": () => require("../dependencies/WebAssemblyExportImportedDependency"), "dependencies/WebAssemblyImportDependency": () => diff --git a/schemas/WebpackOptions.check.js b/schemas/WebpackOptions.check.js index e41dc00c8e7..90d0358e9f6 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"},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"},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"},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"}]},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"},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;Te(r.plugins,{instancePath:o+"/plugins",parentData:r,parentDataProperty:"plugins",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.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;Ie(r.resolve,{instancePath:o+"/resolve",parentData:r,parentDataProperty:"resolve",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.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"},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;Te(r.plugins,{instancePath:o+"/plugins",parentData:r,parentDataProperty:"plugins",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.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;Ie(r.resolve,{instancePath:o+"/resolve",parentData:r,parentDataProperty:"resolve",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.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 { "dynamicImportMode": "lazy", "dynamicImportPrefetch": false, "dynamicImportPreload": false, + "dynamicUrl": true, "exprContextCritical": true, "exprContextRecursive": true, "exprContextRegExp": false, diff --git a/test/__snapshots__/Cli.basictest.js.snap b/test/__snapshots__/Cli.basictest.js.snap index 007fcded9ce..18c8e05c3e7 100644 --- a/test/__snapshots__/Cli.basictest.js.snap +++ b/test/__snapshots__/Cli.basictest.js.snap @@ -2052,6 +2052,19 @@ Object { "multiple": false, "simpleType": "string", }, + "module-parser-javascript-auto-dynamic-url": Object { + "configs": Array [ + Object { + "description": "Enable/disable parsing of dynamic URL.", + "multiple": false, + "path": "module.parser.javascript/auto.dynamicUrl", + "type": "boolean", + }, + ], + "description": "Enable/disable parsing of dynamic URL.", + "multiple": false, + "simpleType": "boolean", + }, "module-parser-javascript-auto-exports-presence": Object { "configs": Array [ Object { @@ -2762,6 +2775,19 @@ Object { "multiple": false, "simpleType": "string", }, + "module-parser-javascript-dynamic-dynamic-url": Object { + "configs": Array [ + Object { + "description": "Enable/disable parsing of dynamic URL.", + "multiple": false, + "path": "module.parser.javascript/dynamic.dynamicUrl", + "type": "boolean", + }, + ], + "description": "Enable/disable parsing of dynamic URL.", + "multiple": false, + "simpleType": "boolean", + }, "module-parser-javascript-dynamic-exports-presence": Object { "configs": Array [ Object { @@ -3249,6 +3275,12 @@ Object { }, "module-parser-javascript-dynamic-url": Object { "configs": Array [ + Object { + "description": "Enable/disable parsing of dynamic URL.", + "multiple": false, + "path": "module.parser.javascript.dynamicUrl", + "type": "boolean", + }, Object { "description": "Enable/disable parsing of new URL() syntax.", "multiple": false, @@ -3265,7 +3297,7 @@ Object { "type": "boolean", }, ], - "description": "Enable/disable parsing of new URL() syntax.", + "description": "Enable/disable parsing of dynamic URL. Enable/disable parsing of new URL() syntax.", "multiple": false, "simpleType": "string", }, @@ -3490,6 +3522,19 @@ Object { "multiple": false, "simpleType": "string", }, + "module-parser-javascript-esm-dynamic-url": Object { + "configs": Array [ + Object { + "description": "Enable/disable parsing of dynamic URL.", + "multiple": false, + "path": "module.parser.javascript/esm.dynamicUrl", + "type": "boolean", + }, + ], + "description": "Enable/disable parsing of dynamic URL.", + "multiple": false, + "simpleType": "boolean", + }, "module-parser-javascript-esm-exports-presence": Object { "configs": Array [ Object { diff --git a/test/configCases/url/disable-dynamic-url/index.js b/test/configCases/url/disable-dynamic-url/index.js new file mode 100644 index 00000000000..cff02cdfa89 --- /dev/null +++ b/test/configCases/url/disable-dynamic-url/index.js @@ -0,0 +1,10 @@ +it("should compile fine", () => { + let dyn1 = "dynamic" + let url1 = new URL(`./${dyn1}?foo=bar`, import.meta.url) + expect(url1.search).toBe("?foo=bar") + expect(url1.pathname).toMatch("url/disable-dynamic-url/dynamic") + + let dyn2 = "./dynamic" + let url2 = new URL(dyn2, import.meta.url) + expect(url2 instanceof URL).toBe(true) +}); diff --git a/test/configCases/url/disable-dynamic-url/webpack.config.js b/test/configCases/url/disable-dynamic-url/webpack.config.js new file mode 100644 index 00000000000..3a33d13ddc3 --- /dev/null +++ b/test/configCases/url/disable-dynamic-url/webpack.config.js @@ -0,0 +1,11 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "web", + module: { + parser: { + javascript: { + dynamicUrl: false + } + } + } +}; diff --git a/test/configCases/url/dynamic-template-literals-expr/index.js b/test/configCases/url/dynamic-template-literals-expr/index.js new file mode 100644 index 00000000000..e0b4d6b16b4 --- /dev/null +++ b/test/configCases/url/dynamic-template-literals-expr/index.js @@ -0,0 +1,23 @@ +it("should compile fine", () => { + let dyn = "a" + let test + test = new URL(`./json/${dyn}.json`, import.meta.url) + expect(test).toMatch("json/a.json") + dyn = "b" + test = new URL(`./json/${dyn}.json`, import.meta.url) + expect(test).toMatch("json/b.json") + dyn = "c" + test = new URL(`./json/${dyn}.json`, import.meta.url) + expect(test).toMatch("json/c.json") + dyn = "c" + test = new URL(`./js/${dyn}.js`, import.meta.url) + expect(test).toMatch("js/c.js") + dyn = "b" + test = new URL(`./js/${dyn}.js`, import.meta.url) + expect(test).toMatch("js/b.js") + dyn = "a" + test = new URL(`./js/${dyn}.js?foo=bar`, import.meta.url) + expect(test).toMatch("js/a.js") + test = new URL('./js/' + dyn + ".js?foo=bar", import.meta.url) + expect(test).toMatch("js/a.js") +}); diff --git a/test/configCases/url/dynamic-template-literals-expr/js/a.js b/test/configCases/url/dynamic-template-literals-expr/js/a.js new file mode 100644 index 00000000000..b0d35f3a137 --- /dev/null +++ b/test/configCases/url/dynamic-template-literals-expr/js/a.js @@ -0,0 +1 @@ +export default 1 diff --git a/test/configCases/url/dynamic-template-literals-expr/js/b.js b/test/configCases/url/dynamic-template-literals-expr/js/b.js new file mode 100644 index 00000000000..1a1389afa46 --- /dev/null +++ b/test/configCases/url/dynamic-template-literals-expr/js/b.js @@ -0,0 +1 @@ +export default 2 diff --git a/test/configCases/url/dynamic-template-literals-expr/js/c.js b/test/configCases/url/dynamic-template-literals-expr/js/c.js new file mode 100644 index 00000000000..b5ea2ec2bd3 --- /dev/null +++ b/test/configCases/url/dynamic-template-literals-expr/js/c.js @@ -0,0 +1 @@ +export default 3 diff --git a/test/configCases/url/dynamic-template-literals-expr/json/a.json b/test/configCases/url/dynamic-template-literals-expr/json/a.json new file mode 100644 index 00000000000..44d21f1fa79 --- /dev/null +++ b/test/configCases/url/dynamic-template-literals-expr/json/a.json @@ -0,0 +1,3 @@ +{ + "name": "a" +} diff --git a/test/configCases/url/dynamic-template-literals-expr/json/b.json b/test/configCases/url/dynamic-template-literals-expr/json/b.json new file mode 100644 index 00000000000..bbe7ab805ef --- /dev/null +++ b/test/configCases/url/dynamic-template-literals-expr/json/b.json @@ -0,0 +1,3 @@ +{ + "name": "b" +} diff --git a/test/configCases/url/dynamic-template-literals-expr/json/c.json b/test/configCases/url/dynamic-template-literals-expr/json/c.json new file mode 100644 index 00000000000..6cd5677e763 --- /dev/null +++ b/test/configCases/url/dynamic-template-literals-expr/json/c.json @@ -0,0 +1,3 @@ +{ + "name": "c" +} diff --git a/test/configCases/url/dynamic-template-literals-expr/webpack.config.js b/test/configCases/url/dynamic-template-literals-expr/webpack.config.js new file mode 100644 index 00000000000..142bed85d16 --- /dev/null +++ b/test/configCases/url/dynamic-template-literals-expr/webpack.config.js @@ -0,0 +1,7 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "web", + output: { + assetModuleFilename: "[path][name][ext]" + } +}; diff --git a/types.d.ts b/types.d.ts index 2ccfde9200f..47265a9e4dd 100644 --- a/types.d.ts +++ b/types.d.ts @@ -7459,6 +7459,11 @@ declare interface JavascriptParserOptions { */ dynamicImportPreload?: number | boolean; + /** + * Enable/disable parsing of dynamic URL. + */ + dynamicUrl?: boolean; + /** * Specifies the behavior of invalid export names in "import ... from ..." and "export ... from ...". */ From d681b877478d02fcad2126ef30fa49d815858a4d Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 22 May 2025 19:45:06 +0300 Subject: [PATCH 05/56] ci: avoid lint on basic test (#19556) --- package.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 73569443e66..a59551fcb12 100644 --- a/package.json +++ b/package.json @@ -168,11 +168,12 @@ "build:examples": "cd examples && node buildAll.js", "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation --hash-seed=1 --random-seed=1 --no-opt --predictable --predictable-gc-schedule --interpreted-frames-native-stack --allow-natives-syntax --expose-gc --no-concurrent-sweeping ./test/BenchmarkTestCases.benchmark.mjs", "pretest": "yarn lint", - "test": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage", - "test:update-snapshots": "yarn test -u", - "test:basic": "yarn test --testMatch \"/test/*.basictest.js\"", - "test:unit": "yarn test --testMatch \"/test/*.unittest.js\"", - "test:integration": "yarn test --testMatch \"/test/*.{basictest,longtest,test}.js\"", + "test": "yarn test:base", + "test:update-snapshots": "yarn test:base -u", + "test:basic": "yarn test:base --testMatch \"/test/*.basictest.js\"", + "test:unit": "yarn test:base --testMatch \"/test/*.unittest.js\"", + "test:integration": "yarn test:base --testMatch \"/test/*.{basictest,longtest,test}.js\"", + "test:base": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage", "cover": "yarn cover:all && yarn cover:report", "cover:clean": "rimraf .nyc_output coverage", "cover:all": "yarn cover:base --coverage", From c9e25e5d063a2cc1167358d57e66e9b22ee79854 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 22 May 2025 20:43:50 +0300 Subject: [PATCH 06/56] perf: cache new URL evaluate expression (#19557) --- lib/url/URLExpressionParserPlugin.js | 30 ++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/url/URLExpressionParserPlugin.js b/lib/url/URLExpressionParserPlugin.js index 3728edecee2..8e25a3e3e2f 100644 --- a/lib/url/URLExpressionParserPlugin.js +++ b/lib/url/URLExpressionParserPlugin.js @@ -55,21 +55,39 @@ const isMetaUrl = (parser, arg) => { return true; }; +/** + * @type {WeakMap} + */ +const getEvaluatedExprCache = new WeakMap(); + /** * @param {NewExpressionNode} expr expression * @param {Parser} parser parser parser - * @returns {BasicEvaluatedExpression | undefined} basicEvaluatedExpression + * @returns {BasicEvaluatedExpression | undefined} basic evaluated expression */ const getEvaluatedExpr = (expr, parser) => { - if (expr.arguments.length !== 2) return; + let result = getEvaluatedExprCache.get(expr); + if (result !== undefined) return result; + + /** + * @returns {BasicEvaluatedExpression | undefined} basic evaluated expression + */ + const evaluate = () => { + if (expr.arguments.length !== 2) return; + + const [arg1, arg2] = expr.arguments; - const [arg1, arg2] = expr.arguments; + if (arg2.type !== "MemberExpression" || arg1.type === "SpreadElement") + return; + if (!isMetaUrl(parser, arg2)) return; - if (arg2.type !== "MemberExpression" || arg1.type === "SpreadElement") return; + return parser.evaluateExpression(arg1); + }; - if (!isMetaUrl(parser, arg2)) return; + result = evaluate(); + getEvaluatedExprCache.set(expr, result); - return parser.evaluateExpression(arg1); + return result; }; class URLParserPlugin { From af1c86da6f53642f02605d2a8e0e53f5961bcbfa Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Fri, 23 May 2025 16:39:55 +0300 Subject: [PATCH 07/56] fix: types and test (#19558) --- declarations.d.ts | 26 ---- lib/Compilation.js | 5 +- lib/Compiler.js | 41 ++++++- lib/ContextReplacementPlugin.js | 6 +- lib/CssModule.js | 4 +- lib/HotModuleReplacementPlugin.js | 57 ++++++--- lib/NormalModuleFactory.js | 6 +- lib/RecordIdsPlugin.js | 1 - lib/dependencies/AMDPlugin.js | 18 +-- ...AMDRequireDependenciesBlockParserPlugin.js | 46 +++---- ...armonyExportImportedSpecifierDependency.js | 12 +- .../HarmonyImportDependencyParserPlugin.js | 7 +- lib/javascript/JavascriptParser.js | 74 +++++++----- lib/optimize/AggressiveSplittingPlugin.js | 3 +- test/JavascriptParser.unittest.js | 112 +++++++++++++++++- test/cases/amd/define-amd/index.js | 13 ++ .../amd/require-module-keywords/index.js | 10 ++ .../amd/require-module-keywords/module.js | 3 + types.d.ts | 80 ++++++++++--- 19 files changed, 369 insertions(+), 155 deletions(-) create mode 100644 test/cases/amd/define-amd/index.js create mode 100644 test/cases/amd/require-module-keywords/index.js create mode 100644 test/cases/amd/require-module-keywords/module.js diff --git a/declarations.d.ts b/declarations.d.ts index 025ebc7b34f..d261284c4df 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -408,25 +408,6 @@ declare module "webpack-sources" { } } -declare module "browserslist" { - function browserslist(query: string): string[] | undefined; - namespace browserslist { - export function loadConfig( - options: - | { - config: string; - env?: string; - } - | { - path: string; - env?: string; - } - ): string | undefined; - export function findConfig(path: string): Record; - } - export = browserslist; -} - declare module "json-parse-even-better-errors" { function parseJson( text: string, @@ -436,13 +417,6 @@ declare module "json-parse-even-better-errors" { export = parseJson; } -// TODO remove that when @types/estree is updated -interface ImportAttributeNode { - type: "ImportAttribute"; - key: import("estree").Identifier | import("estree").Literal; - value: import("estree").Literal; -} - type RecursiveArrayOrRecord = | { [index: string]: RecursiveArrayOrRecord } | Array> diff --git a/lib/Compilation.js b/lib/Compilation.js index dfc3c71c972..05f56d59e12 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -102,6 +102,7 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {import("./Compiler").MemCache} MemCache */ /** @typedef {import("./Compiler").WeakReferences} WeakReferences */ /** @typedef {import("./Compiler").ModuleMemCachesItem} ModuleMemCachesItem */ +/** @typedef {import("./Compiler").Records} Records */ /** @typedef {import("./DependenciesBlock")} DependenciesBlock */ /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ /** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ @@ -391,8 +392,6 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {Set} NotCodeGeneratedModules */ -/** @typedef {Record} Records */ - /** @type {AssetInfo} */ const EMPTY_ASSET_INFO = Object.freeze({}); @@ -4089,7 +4088,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o /** * @param {Module} module module relationship for removal - * @param {DependenciesBlockLike} block //TODO: good description + * @param {DependenciesBlockLike} block dependencies block * @returns {void} */ removeReasonsOfDependencyBlock(module, block) { diff --git a/lib/Compiler.js b/lib/Compiler.js index b09e240d687..8211a867bae 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -42,10 +42,19 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {import("./Chunk")} Chunk */ /** @typedef {import("./ChunkGraph").ModuleId} ModuleId */ /** @typedef {import("./Dependency")} Dependency */ +/** @typedef {import("./HotModuleReplacementPlugin").ChunkHashes} ChunkHashes */ +/** @typedef {import("./HotModuleReplacementPlugin").ChunkModuleHashes} ChunkModuleHashes */ +/** @typedef {import("./HotModuleReplacementPlugin").ChunkModuleIds} ChunkModuleIds */ +/** @typedef {import("./HotModuleReplacementPlugin").ChunkRuntime} ChunkRuntime */ +/** @typedef {import("./HotModuleReplacementPlugin").FullHashChunkModuleHashes} FullHashChunkModuleHashes */ +/** @typedef {import("./HotModuleReplacementPlugin").HotIndex} HotIndex */ /** @typedef {import("./Module")} Module */ /** @typedef {import("./Module").BuildInfo} BuildInfo */ +/** @typedef {import("./RecordIdsPlugin").RecordsChunks} RecordsChunks */ +/** @typedef {import("./RecordIdsPlugin").RecordsModules} RecordsModules */ /** @typedef {import("./config/target").PlatformTargetProperties} PlatformTargetProperties */ /** @typedef {import("./logging/createConsoleLogger").LoggingFunction} LoggingFunction */ +/** @typedef {import("./optimize/AggressiveSplittingPlugin").SplitData} SplitData */ /** @typedef {import("./util/fs").IStats} IStats */ /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ /** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ @@ -80,6 +89,22 @@ const { isSourceEqual } = require("./util/source"); * @param {Compilation=} compilation */ +/** + * @typedef {object} KnownRecords + * @property {SplitData[]=} aggressiveSplits + * @property {RecordsChunks=} chunks + * @property {RecordsModules=} modules + * @property {string=} hash + * @property {HotIndex=} hotIndex + * @property {FullHashChunkModuleHashes=} fullHashChunkModuleHashes + * @property {ChunkModuleHashes=} chunkModuleHashes + * @property {ChunkHashes=} chunkHashes + * @property {ChunkRuntime=} chunkRuntime + * @property {ChunkModuleIds=} chunkModuleIds + */ + +/** @typedef {KnownRecords & Record & Record} Records */ + /** * @typedef {object} AssetEmittedInfo * @property {Buffer} content @@ -238,11 +263,11 @@ class Compiler { /** @type {WatchFileSystem | null} */ this.watchFileSystem = null; - /** @type {string|null} */ + /** @type {string | null} */ this.recordsInputPath = null; - /** @type {string|null} */ + /** @type {string | null} */ this.recordsOutputPath = null; - /** @type {Record} */ + /** @type {Records} */ this.records = {}; /** @type {Set} */ this.managedPaths = new Set(); @@ -1075,8 +1100,10 @@ ${other}`); }; const recordsOutputPathDirectory = dirname( - /** @type {OutputFileSystem} */ (this.outputFileSystem), - /** @type {string} */ (this.recordsOutputPath) + /** @type {OutputFileSystem} */ + (this.outputFileSystem), + /** @type {string} */ + (this.recordsOutputPath) ); if (!recordsOutputPathDirectory) { return writeFile(); @@ -1201,7 +1228,9 @@ ${other}`); this.records[relativeCompilerName] = []; } if (this.records[relativeCompilerName][compilerIndex]) { - childCompiler.records = this.records[relativeCompilerName][compilerIndex]; + childCompiler.records = + /** @type {Records} */ + (this.records[relativeCompilerName][compilerIndex]); } else { this.records[relativeCompilerName].push((childCompiler.records = {})); } diff --git a/lib/ContextReplacementPlugin.js b/lib/ContextReplacementPlugin.js index eda49603362..828b8192ed8 100644 --- a/lib/ContextReplacementPlugin.js +++ b/lib/ContextReplacementPlugin.js @@ -131,7 +131,8 @@ class ContextReplacementPlugin { result.resource = newContentResource; } else { result.resource = join( - /** @type {InputFileSystem} */ (compiler.inputFileSystem), + /** @type {InputFileSystem} */ + (compiler.inputFileSystem), result.resource, newContentResource ); @@ -159,7 +160,8 @@ class ContextReplacementPlugin { ) { // When the function changed it to an relative path result.resource = join( - /** @type {InputFileSystem} */ (compiler.inputFileSystem), + /** @type {InputFileSystem} */ + (compiler.inputFileSystem), origResource, result.resource ); diff --git a/lib/CssModule.js b/lib/CssModule.js index 1112cea9ec1..90095c505a1 100644 --- a/lib/CssModule.js +++ b/lib/CssModule.js @@ -18,9 +18,9 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {string | undefined} Supports */ /** @typedef {string | undefined} Media */ /** @typedef {[CssLayer, Supports, Media]} InheritanceItem */ -/** @typedef {Array} Inheritance */ +/** @typedef {InheritanceItem[]} Inheritance */ -/** @typedef {NormalModuleCreateData & { cssLayer: CssLayer, supports: Supports, media: Media, inheritance: Inheritance }} CSSModuleCreateData */ +/** @typedef {NormalModuleCreateData & { cssLayer: CssLayer, supports: Supports, media: Media, inheritance?: Inheritance }} CSSModuleCreateData */ class CssModule extends NormalModule { /** diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 4672e2fc9fd..8c84f3a1a3c 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -66,6 +66,13 @@ const { * @property {SyncBailHook<[CallExpression, string[]], void>} hotAcceptWithoutCallback */ +/** @typedef {number} HotIndex */ +/** @typedef {Record} FullHashChunkModuleHashes */ +/** @typedef {Record} ChunkModuleHashes */ +/** @typedef {Record} ChunkHashes */ +/** @typedef {Record} ChunkRuntime */ +/** @typedef {Record} ChunkModuleIds */ + /** @typedef {{ updatedChunkIds: Set, removedChunkIds: Set, removedModules: Set, filename: string, assetInfo: AssetInfo }} HotUpdateMainContentByRuntimeItem */ /** @typedef {Map} HotUpdateMainContentByRuntime */ @@ -344,10 +351,11 @@ class HotModuleReplacementPlugin { ); // #endregion + /** @type {HotIndex} */ let hotIndex = 0; - /** @type {Record} */ + /** @type {FullHashChunkModuleHashes} */ const fullHashChunkModuleHashes = {}; - /** @type {Record} */ + /** @type {ChunkModuleHashes} */ const chunkModuleHashes = {}; compilation.hooks.record.tap(PLUGIN_NAME, (compilation, records) => { @@ -361,19 +369,20 @@ class HotModuleReplacementPlugin { records.chunkRuntime = {}; for (const chunk of compilation.chunks) { const chunkId = /** @type {ChunkId} */ (chunk.id); - records.chunkHashes[chunkId] = chunk.hash; + records.chunkHashes[chunkId] = /** @type {string} */ (chunk.hash); records.chunkRuntime[chunkId] = getRuntimeKey(chunk.runtime); } records.chunkModuleIds = {}; for (const chunk of compilation.chunks) { - records.chunkModuleIds[/** @type {ChunkId} */ (chunk.id)] = - Array.from( - chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesById(chunkGraph) - ), - m => chunkGraph.getModuleId(m) - ); + const chunkId = /** @type {ChunkId} */ (chunk.id); + + records.chunkModuleIds[chunkId] = Array.from( + chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesById(chunkGraph) + ), + m => /** @type {ModuleId} */ (chunkGraph.getModuleId(m)) + ); } }); /** @type {TupleSet} */ @@ -418,10 +427,14 @@ class HotModuleReplacementPlugin { const hash = getModuleHash(module); if ( fullHashModulesInThisChunk.has( - /** @type {RuntimeModule} */ (module) + /** @type {RuntimeModule} */ + (module) ) ) { - if (records.fullHashChunkModuleHashes[key] !== hash) { + if ( + /** @type {FullHashChunkModuleHashes} */ + (records.fullHashChunkModuleHashes)[key] !== hash + ) { updatedModules.add(module, chunk); } fullHashChunkModuleHashes[key] = hash; @@ -504,8 +517,11 @@ class HotModuleReplacementPlugin { /** @type {HotUpdateMainContentByRuntime} */ const hotUpdateMainContentByRuntime = new Map(); let allOldRuntime; - for (const key of Object.keys(records.chunkRuntime)) { - const runtime = keyToRuntime(records.chunkRuntime[key]); + const chunkRuntime = + /** @type {ChunkRuntime} */ + (records.chunkRuntime); + for (const key of Object.keys(chunkRuntime)) { + const runtime = keyToRuntime(chunkRuntime[key]); allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime); } forEachRuntime(allOldRuntime, runtime => { @@ -532,7 +548,7 @@ class HotModuleReplacementPlugin { if (hotUpdateMainContentByRuntime.size === 0) return; // Create a list of all active modules to verify which modules are removed completely - /** @type {Map} */ + /** @type {Map} */ const allModules = new Map(); for (const module of compilation.modules) { const id = @@ -546,7 +562,10 @@ class HotModuleReplacementPlugin { const completelyRemovedModules = new Set(); for (const key of Object.keys(records.chunkHashes)) { - const oldRuntime = keyToRuntime(records.chunkRuntime[key]); + const oldRuntime = keyToRuntime( + /** @type {ChunkRuntime} */ + (records.chunkRuntime)[key] + ); /** @type {Module[]} */ const remainingModules = []; // Check which modules are removed @@ -706,8 +725,8 @@ class HotModuleReplacementPlugin { } const renderManifest = compilation.getRenderManifest({ chunk: hotUpdateChunk, - hash: records.hash, - fullHash: records.hash, + hash: /** @type {string} */ (records.hash), + fullHash: /** @type {string} */ (records.hash), outputOptions: compilation.outputOptions, moduleTemplates: compilation.moduleTemplates, dependencyTemplates: compilation.dependencyTemplates, diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js index 47bedac3172..004d4630b69 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -635,12 +635,10 @@ class NormalModuleFactory extends ModuleFactory { settings[/** @type {keyof ModuleSettings} */ (r.type)] !== null ) { const type = /** @type {keyof ModuleSettings} */ (r.type); - /** @type {TODO} */ - (settings)[type] = cachedCleverMerge(settings[type], r.value); + settings[type] = cachedCleverMerge(settings[type], r.value); } else { const type = /** @type {keyof ModuleSettings} */ (r.type); - /** @type {TODO} */ - (settings)[type] = r.value; + settings[type] = r.value; } } } diff --git a/lib/RecordIdsPlugin.js b/lib/RecordIdsPlugin.js index d76f1c42882..de52ea04a8c 100644 --- a/lib/RecordIdsPlugin.js +++ b/lib/RecordIdsPlugin.js @@ -22,7 +22,6 @@ const identifierUtils = require("./util/identifier"); /** * @typedef {object} RecordsModules * @property {Record=} byIdentifier - * @property {Record=} bySource * @property {number[]=} usedIds */ diff --git a/lib/dependencies/AMDPlugin.js b/lib/dependencies/AMDPlugin.js index 03137d843a5..be8ab4ee641 100644 --- a/lib/dependencies/AMDPlugin.js +++ b/lib/dependencies/AMDPlugin.js @@ -42,7 +42,7 @@ const UnsupportedDependency = require("./UnsupportedDependency"); const PLUGIN_NAME = "AMDPlugin"; -/** @typedef {Record} AmdOptions */ +/** @typedef {Exclude} AmdOptions */ class AMDPlugin { /** @@ -143,7 +143,7 @@ class AMDPlugin { /** * @param {string} optionExpr option expression * @param {string} rootName root name - * @param {() => TODO} getMembers callback + * @param {() => string[]} getMembers callback */ const tapOptionsHooks = (optionExpr, rootName, getMembers) => { parser.hooks.expression @@ -156,10 +156,14 @@ class AMDPlugin { ); parser.hooks.evaluateIdentifier .for(optionExpr) - .tap( - PLUGIN_NAME, - evaluateToIdentifier(optionExpr, rootName, getMembers, true) - ); + .tap(PLUGIN_NAME, function (expr) { + return evaluateToIdentifier( + optionExpr, + rootName, + getMembers, + true + )(expr); + }); parser.hooks.evaluateTypeof .for(optionExpr) .tap(PLUGIN_NAME, evaluateToString("object")); @@ -176,7 +180,7 @@ class AMDPlugin { ); new AMDDefineDependencyParserPlugin(parserOptions).apply(parser); - tapOptionsHooks("define.amd", "define", () => "amd"); + tapOptionsHooks("define.amd", "define", () => ["amd"]); tapOptionsHooks("require.amd", "require", () => ["amd"]); tapOptionsHooks( "__webpack_amd_options__", diff --git a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js index b65b4e7bc71..1ee651cd8c3 100644 --- a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +++ b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js @@ -126,7 +126,8 @@ class AMDRequireDependenciesBlockParserPlugin { } const dep = this.newRequireArrayDependency( deps, - /** @type {Range} */ (param.range) + /** @type {Range} */ + (param.range) ); dep.loc = /** @type {DependencyLocation} */ (expr.loc); dep.optional = Boolean(parser.scope.inTry); @@ -158,41 +159,37 @@ class AMDRequireDependenciesBlockParserPlugin { if (param.string === "require") { dep = new ConstDependency( RuntimeGlobals.require, - /** @type {TODO} */ - (param.string), + /** @type {Range} */ + (param.range), [RuntimeGlobals.require] ); } else if (param.string === "module") { dep = new ConstDependency( - /** @type {string} */ - ( - /** @type {BuildInfo} */ - (parser.state.module.buildInfo).moduleArgument - ), - /** @type {Range} */ (param.range), + parser.state.module.moduleArgument, + /** @type {Range} */ + (param.range), [RuntimeGlobals.module] ); } else if (param.string === "exports") { dep = new ConstDependency( - /** @type {string} */ - ( - /** @type {BuildInfo} */ - (parser.state.module.buildInfo).exportsArgument - ), - /** @type {Range} */ (param.range), + parser.state.module.exportsArgument, + /** @type {Range} */ + (param.range), [RuntimeGlobals.exports] ); } else if ( (localModule = getLocalModule( parser.state, - /** @type {string} */ (param.string) + /** @type {string} */ + (param.string) )) ) { localModule.flagUsed(); dep = new LocalModuleDependency(localModule, param.range, false); } else { dep = this.newRequireItemDependency( - /** @type {string} */ (param.string), + /** @type {string} */ + (param.string), param.range ); dep.loc = /** @type {DependencyLocation} */ (expr.loc); @@ -308,13 +305,15 @@ class AMDRequireDependenciesBlockParserPlugin { result = this.processArray( parser, expr, - /** @type {BasicEvaluatedExpression} */ (param) + /** @type {BasicEvaluatedExpression} */ + (param) ); }); parser.state.current = old; if (!result) return; parser.state.current.addBlock( - /** @type {AMDRequireDependenciesBlock} */ (depBlock) + /** @type {AMDRequireDependenciesBlock} */ + (depBlock) ); return true; } @@ -325,13 +324,15 @@ class AMDRequireDependenciesBlockParserPlugin { result = this.processArray( parser, expr, - /** @type {BasicEvaluatedExpression} */ (param) + /** @type {BasicEvaluatedExpression} */ + (param) ); }); if (!result) { const dep = new UnsupportedDependency( "unsupported", - /** @type {Range} */ (expr.range) + /** @type {Range} */ + (expr.range) ); old.addPresentationalDependency(dep); if (parser.state.module) { @@ -340,7 +341,8 @@ class AMDRequireDependenciesBlockParserPlugin { `Cannot statically analyse 'require(…, …)' in line ${ /** @type {SourceLocation} */ (expr.loc).start.line }`, - /** @type {DependencyLocation} */ (expr.loc) + /** @type {DependencyLocation} */ + (expr.loc) ) ); } diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index aca20541628..c76c4509d41 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -121,7 +121,7 @@ class ExportMode { /** * @param {ModuleGraph} moduleGraph module graph - * @param {HarmonyExportImportedSpecifierDependency[]} dependencies dependencies + * @param {ReadonlyArray} dependencies dependencies * @param {TODO=} additionalDependency additional dependency * @returns {{ names: Names, dependencyIndices: DependencyIndices }} result */ @@ -166,7 +166,7 @@ const determineExportAssignments = ( * @param {Names} options.names names * @param {DependencyIndices} options.dependencyIndices dependency indices * @param {string} name name - * @param {Iterable} dependencies dependencies + * @param {ReadonlyArray} dependencies dependencies * @returns {HarmonyExportImportedSpecifierDependency | undefined} found dependency or nothing */ const findDependencyForName = ( @@ -302,7 +302,6 @@ const getMode = (moduleGraph, dep, runtimeKey) => { } // Star reexporting - const { ignoredExports, exports, checked, hidden } = dep.getStarReexports( moduleGraph, runtime, @@ -371,7 +370,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { * @param {Ids} ids the requested export name of the imported module * @param {string | null} name the export name of for this module * @param {Set} activeExports other named exports in the module - * @param {ReadonlyArray | Iterable | null} otherStarExports other star exports in the module before this import + * @param {ReadonlyArray | null} otherStarExports other star exports in the module before this import * @param {ExportPresenceMode} exportPresenceMode mode of checking export names * @param {HarmonyStarExportsList | null} allStarExports all star exports in the module * @param {ImportAttributes=} attributes import attributes @@ -658,7 +657,8 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { const { names, dependencyIndices } = moduleGraph.cached( determineExportAssignments, - this.otherStarExports, + /** @type {HarmonyExportImportedSpecifierDependency[]} */ + (this.otherStarExports), this ); @@ -884,7 +884,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { this.allStarExports ? this.allStarExports.dependencies : [ - .../** @type {Iterable} */ + .../** @type {ReadonlyArray} */ (this.otherStarExports), this ] diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index 7fc43c6b228..48df8dafe3e 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -86,12 +86,12 @@ module.exports = class HarmonyImportDependencyParserPlugin { } /** - * @param {TODO} node member expression + * @param {MemberExpression} node member expression * @param {number} count count * @returns {Expression} member expression */ function getNonOptionalMemberChain(node, count) { - while (count--) node = node.object; + while (count--) node = /** @type {MemberExpression} */ (node.object); return node; } @@ -270,7 +270,8 @@ module.exports = class HarmonyImportDependencyParserPlugin { .tap( "HarmonyImportDependencyParserPlugin", (expression, members, membersOptionals, memberRanges) => { - const { arguments: args, callee } = expression; + const { arguments: args } = expression; + const callee = /** @type {MemberExpression} */ (expression.callee); const settings = /** @type {HarmonySettings} */ ( parser.currentTagData ); diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index 48272aad6dd..c6d6816ced8 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -120,7 +120,7 @@ const LEGACY_ASSERT_ATTRIBUTES = Symbol("assert"); const importAssertions = Parser => class extends Parser { /** - * @this {TODO} + * @this {InstanceType} * @returns {ImportAttribute[]} import attributes */ parseWithClause() { @@ -484,13 +484,13 @@ class JavascriptParser extends Parser { preDeclarator: new SyncBailHook(["declarator", "statement"]), /** @type {SyncBailHook<[VariableDeclarator, Statement], boolean | void>} */ declarator: new SyncBailHook(["declarator", "statement"]), - /** @type {HookMap>} */ + /** @type {HookMap>} */ varDeclaration: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ + /** @type {HookMap>} */ varDeclarationLet: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ + /** @type {HookMap>} */ varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])), - /** @type {HookMap>} */ + /** @type {HookMap>} */ varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])), /** @type {HookMap>} */ pattern: new HookMap(() => new SyncBailHook(["pattern"])), @@ -1373,6 +1373,7 @@ class JavascriptParser extends Parser { name => { cachedExpression = expression; cachedInfo = info; + return undefined; }, name => { const hook = this.hooks.evaluateDefinedIdentifier.get(name); @@ -1879,13 +1880,20 @@ class JavascriptParser extends Parser { scopeParams.push(classy.id); } this.inClassScope(true, scopeParams, () => { - for (const classElement of /** @type {TODO} */ (classy.body.body)) { + for (const classElement of classy.body.body) { if (!this.hooks.classBodyElement.call(classElement, classy)) { - if (classElement.computed && classElement.key) { - this.walkExpression(classElement.key); - } - if (classElement.value) { + if (classElement.type === "StaticBlock") { + const wasTopLevel = this.scope.topLevelScope; + this.scope.topLevelScope = false; + this.walkBlockStatement(classElement); + this.scope.topLevelScope = wasTopLevel; + } else { + if (classElement.computed && classElement.key) { + this.walkExpression(classElement.key); + } + if ( + classElement.value && !this.hooks.classBodyValue.call( classElement.value, classElement, @@ -1897,11 +1905,6 @@ class JavascriptParser extends Parser { this.walkExpression(classElement.value); this.scope.topLevelScope = wasTopLevel; } - } else if (classElement.type === "StaticBlock") { - const wasTopLevel = this.scope.topLevelScope; - this.scope.topLevelScope = false; - this.walkBlockStatement(classElement); - this.scope.topLevelScope = wasTopLevel; } } } @@ -2151,7 +2154,7 @@ class JavascriptParser extends Parser { } /** - * @param {BlockStatement} statement block statement + * @param {BlockStatement | StaticBlock} statement block statement */ walkBlockStatement(statement) { this.inBlockScope(() => { @@ -2824,7 +2827,7 @@ class JavascriptParser extends Parser { /** * @param {VariableDeclaration} statement variable declaration - * @param {TODO} hookMap map of hooks + * @param {HookMap>} hookMap map of hooks */ _preWalkVariableDeclaration(statement, hookMap) { for (const declarator of statement.declarations) { @@ -2832,11 +2835,11 @@ class JavascriptParser extends Parser { case "VariableDeclarator": { this.preWalkVariableDeclarator(declarator); if (!this.hooks.preDeclarator.call(declarator, statement)) { - this.enterPattern(declarator.id, (name, decl) => { + this.enterPattern(declarator.id, (name, ident) => { let hook = hookMap.get(name); - if (hook === undefined || !hook.call(decl)) { + if (hook === undefined || !hook.call(ident)) { hook = this.hooks.varDeclaration.get(name); - if (hook === undefined || !hook.call(decl)) { + if (hook === undefined || !hook.call(ident)) { this.defineVariable(name); } } @@ -3928,7 +3931,7 @@ class JavascriptParser extends Parser { * @template R * @param {HookMap>} hookMap hooks the should be called * @param {Expression | Super} expr expression info - * @param {((name: string, rootInfo: string | ScopeInfo | VariableInfo, getMembers: () => string[]) => TODO) | undefined} fallback callback when variable in not handled by hooks + * @param {((name: string, rootInfo: string | ScopeInfo | VariableInfo, getMembers: () => string[]) => R) | undefined} fallback callback when variable in not handled by hooks * @param {((result?: string) => R | undefined) | undefined} defined callback when variable is defined * @param {AsArray} args args for the hook * @returns {R | undefined} result of hook @@ -3998,7 +4001,7 @@ class JavascriptParser extends Parser { * @template R * @param {HookMap>} hookMap hooks the should be called * @param {ExportedVariableInfo} info variable info - * @param {((name: string) => TODO) | undefined} fallback callback when variable in not handled by hooks + * @param {((name: string) => R | undefined) | undefined} fallback callback when variable in not handled by hooks * @param {((result?: string) => TODO) | undefined} defined callback when variable is defined * @param {AsArray} args args for the hook * @returns {R | undefined} result of hook @@ -4365,9 +4368,11 @@ class JavascriptParser extends Parser { ); } + /** @typedef {{ range?: Range, value: string, code: boolean, conditional: false | CalculatedStringResult[] }} CalculatedStringResult */ + /** * @param {Expression} expression expression - * @returns {{ range?: Range, value: string, code: boolean, conditional: boolean | TODO }} result + * @returns {CalculatedStringResult} result */ parseCalculatedString(expression) { switch (expression.type) { @@ -4415,6 +4420,7 @@ class JavascriptParser extends Parser { case "ConditionalExpression": { const consequent = this.parseCalculatedString(expression.consequent); const alternate = this.parseCalculatedString(expression.alternate); + /** @type {CalculatedStringResult[]} */ const items = []; if (consequent.conditional) { items.push(...consequent.conditional); @@ -4566,14 +4572,20 @@ class JavascriptParser extends Parser { ) { return false; } - const items = - /** @type {TODO[]} */ - (expr.body.body); + const items = expr.body.body; return items.every(item => { + if (item.type === "StaticBlock") { + return false; + } + if ( item.computed && item.key && - !this.isPure(item.key, item.range[0]) + !this.isPure( + item.key, + /** @type {Range} */ + (item.range)[0] + ) ) { return false; } @@ -4583,16 +4595,14 @@ class JavascriptParser extends Parser { item.value && !this.isPure( item.value, - item.key ? item.key.range[1] : item.range[0] + item.key + ? /** @type {Range} */ (item.key.range)[1] + : /** @type {Range} */ (item.range)[0] ) ) { return false; } - if (item.type === "StaticBlock") { - return false; - } - if ( expr.superClass && item.type === "MethodDefinition" && diff --git a/lib/optimize/AggressiveSplittingPlugin.js b/lib/optimize/AggressiveSplittingPlugin.js index e2a85c7e7ad..0b29c1365c8 100644 --- a/lib/optimize/AggressiveSplittingPlugin.js +++ b/lib/optimize/AggressiveSplittingPlugin.js @@ -49,6 +49,8 @@ const moveModuleBetween = (chunkGraph, oldChunk, newChunk) => module => { const isNotAEntryModule = (chunkGraph, chunk) => module => !chunkGraph.isEntryModuleInChunk(module, chunk); +/** @typedef {{ id?: NonNullable, hash?: NonNullable, modules: Module[], size: number }} SplitData */ + /** @type {WeakSet} */ const recordedChunks = new WeakSet(); @@ -92,7 +94,6 @@ class AggressiveSplittingPlugin { apply(compiler) { compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { let needAdditionalSeal = false; - /** @typedef {{ id?: NonNullable, hash?: NonNullable, modules: Module[], size: number }} SplitData */ /** @type {SplitData[]} */ let newSplits; /** @type {Set} */ diff --git a/test/JavascriptParser.unittest.js b/test/JavascriptParser.unittest.js index 9cf8e5d3a14..21982807af7 100644 --- a/test/JavascriptParser.unittest.js +++ b/test/JavascriptParser.unittest.js @@ -711,16 +711,120 @@ describe("JavascriptParser", () => { }); }); - describe("optional catch binding support", () => { - describe("should accept", () => { + describe("parse calculated string", () => { + describe("should work", () => { const cases = { - "optional binding": "try {} catch {}" + 123: { + code: "123", + result: { + code: false, + conditional: false, + range: [0, 3], + value: "123" + } + }, + "'test'": { + code: "'test'", + result: { + code: false, + conditional: false, + range: [0, 6], + value: "test" + } + }, + "'test' + 'test'": { + code: "'test' + 'test'", + result: { + code: false, + conditional: false, + range: [0, 15], + value: "testtest" + } + }, + "myVar + 'test'": { + code: "myVar + 'test'", + result: { + code: true, + conditional: false, + range: undefined, + value: "" + } + }, + "'test' + myVar": { + code: "'test' + myVar", + result: { + code: true, + conditional: false, + range: [0, 6], + value: "test" + } + }, + "true ? 'one' : 'two'": { + code: "true ? 'one' : 'two'", + result: { + code: true, + conditional: [ + { + code: false, + conditional: false, + range: [7, 12], + value: "one" + }, + { + code: false, + conditional: false, + range: [15, 20], + value: "two" + } + ], + range: undefined, + value: "" + } + }, + "true ? true ? 'one' : 'two' : true ? 'three': 'four'": { + code: "true ? true ? 'one' : 'two' : true ? 'three': 'four'", + result: { + code: true, + conditional: [ + { + code: false, + conditional: false, + range: [14, 19], + value: "one" + }, + { + code: false, + conditional: false, + range: [22, 27], + value: "two" + }, + { + code: false, + conditional: false, + range: [37, 44], + value: "three" + }, + { + code: false, + conditional: false, + range: [46, 52], + value: "four" + } + ], + range: undefined, + value: "" + } + } }; for (const name of Object.keys(cases)) { const expr = cases[name]; it(name, () => { - const actual = JavascriptParser._parse(expr); + const parser = new JavascriptParser(); + const actual = JavascriptParser._parse(expr.code); expect(typeof actual).toBe("object"); + expect( + parser.parseCalculatedString(actual.body[0].expression) + ).toEqual(expr.result); }); } }); diff --git a/test/cases/amd/define-amd/index.js b/test/cases/amd/define-amd/index.js new file mode 100644 index 00000000000..13eac3d953b --- /dev/null +++ b/test/cases/amd/define-amd/index.js @@ -0,0 +1,13 @@ +if (typeof define === "function" && define.amd && require.amd) { + define("my-module", [], function () { + return 'my-module'; + }); +} + + +it("should work with `define.amd`", function(done) { + require(["my-module"], function (myModule) { + expect(myModule).toBe("my-module"); + done(); + }); +}); diff --git a/test/cases/amd/require-module-keywords/index.js b/test/cases/amd/require-module-keywords/index.js new file mode 100644 index 00000000000..8552820d742 --- /dev/null +++ b/test/cases/amd/require-module-keywords/index.js @@ -0,0 +1,10 @@ +it("should work when require module keywords", (done) => { + require(['require', 'module', 'exports'], function (webpackRequire, webpackModule, webpackExports) { + expect(require("./module")).toBe(42); + expect(webpackRequire).toBeDefined(); + expect(webpackModule).toBeDefined(); + expect(webpackExports).toBeDefined(); + + done(); + }); +}); diff --git a/test/cases/amd/require-module-keywords/module.js b/test/cases/amd/require-module-keywords/module.js new file mode 100644 index 00000000000..d83845079f6 --- /dev/null +++ b/test/cases/amd/require-module-keywords/module.js @@ -0,0 +1,3 @@ +define([], function () { + return 42; +}); diff --git a/types.d.ts b/types.d.ts index 47265a9e4dd..3188bdfe1c3 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1021,6 +1021,12 @@ declare class CachedSource extends Source { originalLazy(): Source | (() => Source); getCachedData(): any; } +declare interface CalculatedStringResult { + range?: [number, number]; + value: string; + code: boolean; + conditional: false | CalculatedStringResult[]; +} type CallExpression = SimpleCallExpression | NewExpression; declare interface CallExpressionInfo { type: "call"; @@ -1444,12 +1450,19 @@ declare interface ChunkHashContext { */ chunkGraph: ChunkGraph; } +declare interface ChunkHashes { + [index: number]: string; + [index: string]: string; +} type ChunkId = string | number; declare interface ChunkMaps { hash: Record; contentHash: Record>; name: Record; } +declare interface ChunkModuleHashes { + [index: string]: string; +} declare class ChunkModuleIdRangePlugin { constructor(options: ChunkModuleIdRangePluginOptions); options: ChunkModuleIdRangePluginOptions; @@ -1480,6 +1493,10 @@ declare interface ChunkModuleIdRangePluginOptions { */ end?: number; } +declare interface ChunkModuleIds { + [index: number]: ModuleId[]; + [index: string]: ModuleId[]; +} declare interface ChunkModuleMaps { id: Record; hash: Record; @@ -1564,6 +1581,10 @@ declare interface ChunkRenderContextJavascriptModulesPlugin { */ strictMode?: boolean; } +declare interface ChunkRuntime { + [index: number]: string; + [index: string]: string; +} declare interface ChunkSizeOptions { /** * constant overhead for a chunk @@ -2461,7 +2482,7 @@ declare class Compiler { watchFileSystem: null | WatchFileSystem; recordsInputPath: null | string; recordsOutputPath: null | string; - records: Record; + records: Records; managedPaths: Set; unmanagedPaths: Set; immutablePaths: Set; @@ -3293,7 +3314,7 @@ declare abstract class CssModule extends NormalModule { cssLayer: CssLayer; supports: Supports; media: Media; - inheritance: [CssLayer, Supports, Media][]; + inheritance?: [CssLayer, Supports, Media][]; } /** @@ -5294,6 +5315,9 @@ type FilterItemTypes = string | RegExp | ((value: string) => boolean); declare interface Flags { [index: string]: Argument; } +declare interface FullHashChunkModuleHashes { + [index: string]: string; +} declare interface GenerateContext { /** * mapping from dependencies to templates @@ -6403,10 +6427,10 @@ declare class JavascriptParser extends Parser { boolean | void >; declarator: SyncBailHook<[VariableDeclarator, Statement], boolean | void>; - varDeclaration: HookMap>; - varDeclarationLet: HookMap>; - varDeclarationConst: HookMap>; - varDeclarationVar: HookMap>; + varDeclaration: HookMap>; + varDeclarationLet: HookMap>; + varDeclarationConst: HookMap>; + varDeclarationVar: HookMap>; pattern: HookMap>; canRename: HookMap>; rename: HookMap>; @@ -6815,7 +6839,7 @@ declare class JavascriptParser extends Parser { */ walkNestedStatement(statement: Statement): void; preWalkBlockStatement(statement: BlockStatement): void; - walkBlockStatement(statement: BlockStatement): void; + walkBlockStatement(statement: BlockStatement | StaticBlock): void; walkExpressionStatement(statement: ExpressionStatement): void; preWalkIfStatement(statement: IfStatement): void; walkIfStatement(statement: IfStatement): void; @@ -7059,7 +7083,7 @@ declare class JavascriptParser extends Parser { name: string, rootInfo: string | VariableInfo | ScopeInfo, getMembers: () => string[] - ) => any), + ) => R), defined: undefined | ((result?: string) => undefined | R), ...args: AsArray ): undefined | R; @@ -7076,7 +7100,7 @@ declare class JavascriptParser extends Parser { callHooksForInfoWithFallback( hookMap: HookMap>, info: ExportedVariableInfo, - fallback: undefined | ((name: string) => any), + fallback: undefined | ((name: string) => undefined | R), defined: undefined | ((result?: string) => any), ...args: AsArray ): undefined | R; @@ -7224,12 +7248,7 @@ declare class JavascriptParser extends Parser { | Super ): BasicEvaluatedExpression; parseString(expression: Expression): string; - parseCalculatedString(expression: Expression): { - range?: [number, number]; - value: string; - code: boolean; - conditional: any; - }; + parseCalculatedString(expression: Expression): CalculatedStringResult; evaluate(source: string): BasicEvaluatedExpression; isPure( expr: @@ -7939,6 +7958,18 @@ declare interface KnownNormalizedStatsOptions { loggingDebug: ((value: string) => boolean)[]; loggingTrace: boolean; } +declare interface KnownRecords { + aggressiveSplits?: SplitData[]; + chunks?: RecordsChunks; + modules?: RecordsModules; + hash?: string; + hotIndex?: number; + fullHashChunkModuleHashes?: FullHashChunkModuleHashes; + chunkModuleHashes?: ChunkModuleHashes; + chunkHashes?: ChunkHashes; + chunkRuntime?: ChunkRuntime; + chunkModuleIds?: ChunkModuleIds; +} declare interface KnownStatsAsset { type: string; name: string; @@ -12800,8 +12831,17 @@ declare interface RealPathTypes { callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void ): void; } -declare interface Records { - [index: string]: any; +type Records = KnownRecords & + Record & + Record; +declare interface RecordsChunks { + byName?: Record; + bySource?: Record; + usedIds?: number[]; +} +declare interface RecordsModules { + byIdentifier?: Record; + usedIds?: number[]; } type RecursiveArrayOrRecord = | { [index: string]: RecursiveArrayOrRecord } @@ -15037,6 +15077,12 @@ declare class SplitChunksPlugin { declare interface SplitChunksSizes { [index: string]: number; } +declare interface SplitData { + id?: string | number; + hash?: string; + modules: Module[]; + size: number; +} declare abstract class StackedMap { map: Map>; stack: Map>[]; From 4be8fcc3dd2fdd30da413988fabf33e2d3ef7c39 Mon Sep 17 00:00:00 2001 From: Noritaka Kobayashi Date: Wed, 28 May 2025 23:40:54 +0900 Subject: [PATCH 08/56] test: refactor test code (#19564) --- test/BenchmarkTestCases.benchmark.mjs | 3 +-- test/ProgressPlugin.test.js | 2 +- test/checkArrayExpectation.js | 6 +++--- .../output-module/iife-multiple-entry-modules/test.js | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/test/BenchmarkTestCases.benchmark.mjs b/test/BenchmarkTestCases.benchmark.mjs index 10cd1313172..a64a67cc799 100644 --- a/test/BenchmarkTestCases.benchmark.mjs +++ b/test/BenchmarkTestCases.benchmark.mjs @@ -2,12 +2,11 @@ import path from "path"; import fs from "fs/promises"; import { constants, writeFile } from "fs"; import { Bench, hrtimeNow } from "tinybench"; -import { dirname } from "path"; import { fileURLToPath, pathToFileURL } from "url"; import simpleGit from "simple-git"; import { withCodSpeed } from "@codspeed/tinybench-plugin"; -const __dirname = dirname(fileURLToPath(import.meta.url)); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const rootPath = path.join(__dirname, ".."); const git = simpleGit(rootPath); diff --git a/test/ProgressPlugin.test.js b/test/ProgressPlugin.test.js index a620c9f7b06..8e9676cd12f 100644 --- a/test/ProgressPlugin.test.js +++ b/test/ProgressPlugin.test.js @@ -68,7 +68,7 @@ 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 => new Promise((resolve, reject) => { diff --git a/test/checkArrayExpectation.js b/test/checkArrayExpectation.js index 3cd3d3392f3..9148b753fda 100644 --- a/test/checkArrayExpectation.js +++ b/test/checkArrayExpectation.js @@ -109,14 +109,14 @@ module.exports = function checkArrayExpectation( } for (let i = 0; i < array.length; i++) { if (Array.isArray(expected[i])) { - for (let j = 0; j < expected[i].length; j++) { - if (!check(expected[i][j], array[i])) { + for (const expectedItem of expected[i]) { + if (!check(expectedItem, array[i])) { return ( done( new Error( `${upperCaseKind} ${i}: ${explain( array[i] - )} doesn't match ${explain(expected[i][j])}` + )} doesn't match ${explain(expectedItem)}` ) ), true diff --git a/test/configCases/output-module/iife-multiple-entry-modules/test.js b/test/configCases/output-module/iife-multiple-entry-modules/test.js index 3e8c37be198..0ad5d2d5de0 100644 --- a/test/configCases/output-module/iife-multiple-entry-modules/test.js +++ b/test/configCases/output-module/iife-multiple-entry-modules/test.js @@ -1,7 +1,7 @@ const fs = require("fs"); const path = require("path"); -it("IIFE should present for multiple entires", () => { +it("IIFE should present for multiple entries", () => { const source = fs.readFileSync(path.join(__dirname, "bundle0.mjs"), "utf-8"); expect(source).toContain(`This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules.`); }); From 1b34181550a25d1e107a78b1e518654e35dcdd58 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Wed, 28 May 2025 17:41:15 +0300 Subject: [PATCH 09/56] docs: update examples (#19560) --- examples/explicit-vendor-chunk/README.md | 2 +- examples/http2-aggressive-splitting/README.md | 16 ++++++------ examples/module-code-splitting/README.md | 14 +++++----- examples/module-federation/README.md | 2 +- examples/module-worker/README.md | 26 +++++++++---------- examples/multi-compiler/README.md | 5 ++-- examples/stats-detailed/README.md | 2 +- 7 files changed, 34 insertions(+), 33 deletions(-) diff --git a/examples/explicit-vendor-chunk/README.md b/examples/explicit-vendor-chunk/README.md index 03c8fa9fc68..5ba7605d23f 100644 --- a/examples/explicit-vendor-chunk/README.md +++ b/examples/explicit-vendor-chunk/README.md @@ -280,7 +280,7 @@ vendor: app: asset pageB.js 297 bytes [emitted] [minimized] (name: pageB) - asset pageA.js 295 bytes [emitted] [minimized] (name: pageA) + asset pageA.js 293 bytes [emitted] [minimized] (name: pageA) asset pageC.js 174 bytes [emitted] [minimized] (name: pageC) chunk (runtime: pageB) pageB.js (pageB) 144 bytes [entry] [rendered] > ./pageB pageB diff --git a/examples/http2-aggressive-splitting/README.md b/examples/http2-aggressive-splitting/README.md index 51d9899b171..ff0ee91e510 100644 --- a/examples/http2-aggressive-splitting/README.md +++ b/examples/http2-aggressive-splitting/README.md @@ -47,14 +47,14 @@ module.exports = { ## Unoptimized ``` -asset 3010f5aee596f6f09529.js 36.3 KiB [emitted] [immutable] (name: main) -asset adcc62444431e4f1597f.js 11.9 KiB [emitted] [immutable] -chunk (runtime: main) 3010f5aee596f6f09529.js (main) 16.9 KiB (javascript) 4.94 KiB (runtime) [entry] [rendered] +asset 20d7a312b158a10e97d4.js 36.3 KiB [emitted] [immutable] (name: main) +asset 1bacc8037d20ba374848.js 12 KiB [emitted] [immutable] +chunk (runtime: main) 20d7a312b158a10e97d4.js (main) 16.9 KiB (javascript) 4.94 KiB (runtime) [entry] [rendered] > ./example main runtime modules 4.94 KiB 6 modules dependent modules 16.9 KiB [dependent] 2 modules ./example.js 42 bytes [built] [code generated] -chunk (runtime: main) adcc62444431e4f1597f.js 7.83 KiB [rendered] +chunk (runtime: main) 1bacc8037d20ba374848.js 7.83 KiB [rendered] > react-dom ./example.js 2:0-22 dependent modules 6.5 KiB [dependent] 1 module ../../node_modules/react-dom/index.js 1.33 KiB [built] [code generated] @@ -64,13 +64,13 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset 954fd9a9a767ef883087.js 9.04 KiB [emitted] [immutable] [minimized] (name: main) 1 related asset -asset 52e3fb6cd8bed8b461cf.js 3.55 KiB [emitted] [immutable] [minimized] 1 related asset -chunk (runtime: main) 52e3fb6cd8bed8b461cf.js 7.83 KiB [rendered] +asset 4e9b80a6c242d1cbf940.js 9.04 KiB [emitted] [immutable] [minimized] (name: main) 1 related asset +asset 9679c25c4fa710024c2a.js 3.55 KiB [emitted] [immutable] [minimized] 1 related asset +chunk (runtime: main) 9679c25c4fa710024c2a.js 7.83 KiB [rendered] > react-dom ./example.js 2:0-22 dependent modules 6.5 KiB [dependent] 1 module ../../node_modules/react-dom/index.js 1.33 KiB [built] [code generated] -chunk (runtime: main) 954fd9a9a767ef883087.js (main) 16.9 KiB (javascript) 4.94 KiB (runtime) [entry] [rendered] +chunk (runtime: main) 4e9b80a6c242d1cbf940.js (main) 16.9 KiB (javascript) 4.94 KiB (runtime) [entry] [rendered] > ./example main runtime modules 4.94 KiB 6 modules dependent modules 16.9 KiB [dependent] 2 modules diff --git a/examples/module-code-splitting/README.md b/examples/module-code-splitting/README.md index f7db47eb065..c4f6a287300 100644 --- a/examples/module-code-splitting/README.md +++ b/examples/module-code-splitting/README.md @@ -176,7 +176,7 @@ export function reset() { /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = import(__webpack_require__.p + "./" + __webpack_require__.u(chunkId)).then(installChunk, (e) => { +/******/ var promise = import(__webpack_require__.p + __webpack_require__.u(chunkId)).then(installChunk, (e) => { /******/ if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined; /******/ throw e; /******/ }); @@ -234,7 +234,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_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); ``` # Info @@ -242,11 +242,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.61 KiB [emitted] [javascript module] (name: main) +asset output.js 6.6 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.05 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 420 bytes (javascript) 3.04 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.05 KiB 7 modules + runtime modules 3.04 KiB 7 modules ./example.js + 1 modules 420 bytes [built] [code generated] [no exports] [no exports used] @@ -274,9 +274,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.05 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 420 bytes (javascript) 3.04 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.05 KiB 7 modules + runtime modules 3.04 KiB 7 modules ./example.js + 1 modules 420 bytes [built] [code generated] [no exports] [no exports used] diff --git a/examples/module-federation/README.md b/examples/module-federation/README.md index e16e477cf9f..b7644ca86f1 100644 --- a/examples/module-federation/README.md +++ b/examples/module-federation/README.md @@ -2076,7 +2076,7 @@ __webpack_require__.d(exports, { ``` app: - asset src_bootstrap_js.js 43.7 KiB [emitted] + asset src_bootstrap_js.js 43.8 KiB [emitted] asset app.js 30.1 KiB [emitted] (name: app) asset vendors-node_modules_react_index_js.js 27.5 KiB [emitted] (id hint: vendors) chunk (runtime: app) app.js (app) 672 bytes (javascript) 42 bytes (share-init) 19 KiB (runtime) [entry] [rendered] diff --git a/examples/module-worker/README.md b/examples/module-worker/README.md index faad2abc327..8293e19d7f8 100644 --- a/examples/module-worker/README.md +++ b/examples/module-worker/README.md @@ -292,7 +292,7 @@ export const add = (content, from) => { /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = import(__webpack_require__.p + "./" + __webpack_require__.u(chunkId)).then(installChunk, (e) => { +/******/ var promise = import(__webpack_require__.p + __webpack_require__.u(chunkId)).then(installChunk, (e) => { /******/ if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined; /******/ throw e; /******/ }); @@ -559,7 +559,7 @@ fibWorker.onmessage = event => { /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = import(__webpack_require__.p + "./" + __webpack_require__.u(chunkId)).then(installChunk, (e) => { +/******/ var promise = import(__webpack_require__.p + __webpack_require__.u(chunkId)).then(installChunk, (e) => { /******/ if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined; /******/ throw e; /******/ }); @@ -614,7 +614,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_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})}}}; ``` # dist/workers/fibonacci.js @@ -753,7 +753,7 @@ var e,o,t={},r={};function s(e){var o=r[e];if(void 0!==o)return o.exports;var n= /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = import(__webpack_require__.p + "../" + __webpack_require__.u(chunkId)).then(installChunk, (e) => { +/******/ var promise = import(__webpack_require__.p + __webpack_require__.u(chunkId)).then(installChunk, (e) => { /******/ if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined; /******/ throw e; /******/ }); @@ -793,7 +793,7 @@ 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={},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)}`)}; ``` # dist/129.js @@ -832,9 +832,9 @@ function fibonacci(n) { ## Unoptimized ``` -asset main.js 8.74 KiB [emitted] [javascript module] (name: main) -asset chat.js 6.65 KiB [emitted] [javascript module] (name: chat) -asset workers/fibonacci.js 6.3 KiB [emitted] [javascript module] (name: fibonacci) +asset main.js 8.73 KiB [emitted] [javascript module] (name: main) +asset chat.js 6.64 KiB [emitted] [javascript module] (name: chat) +asset workers/fibonacci.js 6.29 KiB [emitted] [javascript module] (name: fibonacci) asset 936.js 1.04 KiB [emitted] [javascript module] asset 129.js 881 bytes [emitted] [javascript module] chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered] @@ -879,7 +879,7 @@ webpack X.X.X compiled successfully ``` asset main.js 2.37 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 workers/fibonacci.js 945 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] chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered] @@ -896,15 +896,15 @@ chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 442 bytes (javascript) 2.77 ./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.78 KiB (runtime) [entry] [rendered] +chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.77 KiB (runtime) [entry] [rendered] > ./example.js 80:18-84:2 - runtime modules 2.78 KiB 6 modules + runtime modules 2.77 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.95 KiB (runtime) [entry] [rendered] +chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 2.94 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 2.95 KiB 6 modules + runtime modules 2.94 KiB 6 modules ./example.js 2.25 KiB [built] [code generated] [no exports used] entry ./example.js main diff --git a/examples/multi-compiler/README.md b/examples/multi-compiler/README.md index efb228b05aa..d6a27c8d571 100644 --- a/examples/multi-compiler/README.md +++ b/examples/multi-compiler/README.md @@ -55,7 +55,8 @@ module.exports = [ \********************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: */ -if(false) {} +if(false) // removed by dead control flow +{} console.log("Running " + "desktop" + " build"); /******/ })() ; @@ -148,7 +149,7 @@ mobile: mobile (webpack X.X.X) compiled successfully desktop: - asset desktop.js 262 bytes [emitted] (name: main) + asset desktop.js 294 bytes [emitted] (name: main) chunk (runtime: main) desktop.js (main) 94 bytes [entry] [rendered] > ./example main ./example.js 94 bytes [built] [code generated] diff --git a/examples/stats-detailed/README.md b/examples/stats-detailed/README.md index 82a773155f5..98da256db1d 100644 --- a/examples/stats-detailed/README.md +++ b/examples/stats-detailed/README.md @@ -78,5 +78,5 @@ LOG from webpack.FileSystemInfo Directory info in cache: 0 timestamps 0 hashes 0 timestamp hash combinations Managed items info in cache: 0 items -XXXX-XX-XX XXXX:XX:XX: webpack X.X.X compiled successfully (922245dc37adc36977b5) +XXXX-XX-XX XXXX:XX:XX: webpack X.X.X compiled successfully (37904780141efdcbf726) ``` From e805dc1b099a6ec09a7858478945a206234bef47 Mon Sep 17 00:00:00 2001 From: Xiao <784487301@qq.com> Date: Fri, 30 May 2025 20:30:09 +0800 Subject: [PATCH 10/56] fix: fix the case where an ESM entryChunk depends on the runtimeChunk hash (#19570) --- lib/Compilation.js | 14 +- lib/esm/ModuleChunkFormatPlugin.js | 44 +++-- test/WatchTestCases.template.js | 164 +++++++++++++++--- .../esm-async-chunks-hmr/0/dynamic-1.js | 1 + .../esm-async-chunks-hmr/0/dynamic-2.js | 2 + .../chunks/esm-async-chunks-hmr/0/index.js | 36 ++++ .../chunks/esm-async-chunks-hmr/0/react.js | 1 + .../esm-async-chunks-hmr/1/dynamic-1.js | 3 + .../esm-async-chunks-hmr/test.config.js | 3 + .../esm-async-chunks-hmr/webpack.config.js | 31 ++++ 10 files changed, 265 insertions(+), 34 deletions(-) create mode 100644 test/watchCases/chunks/esm-async-chunks-hmr/0/dynamic-1.js create mode 100644 test/watchCases/chunks/esm-async-chunks-hmr/0/dynamic-2.js create mode 100644 test/watchCases/chunks/esm-async-chunks-hmr/0/index.js create mode 100644 test/watchCases/chunks/esm-async-chunks-hmr/0/react.js create mode 100644 test/watchCases/chunks/esm-async-chunks-hmr/1/dynamic-1.js create mode 100644 test/watchCases/chunks/esm-async-chunks-hmr/test.config.js create mode 100644 test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js diff --git a/lib/Compilation.js b/lib/Compilation.js index 05f56d59e12..02309fdb597 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -4366,16 +4366,21 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o /** @type {Chunk[]} */ const unorderedRuntimeChunks = []; /** @type {Chunk[]} */ - const otherChunks = []; + const initialChunks = []; + /** @type {Chunk[]} */ + const asyncChunks = []; for (const c of this.chunks) { if (c.hasRuntime()) { unorderedRuntimeChunks.push(c); + } else if (c.canBeInitial()) { + initialChunks.push(c); } else { - otherChunks.push(c); + asyncChunks.push(c); } } unorderedRuntimeChunks.sort(byId); - otherChunks.sort(byId); + initialChunks.sort(byId); + asyncChunks.sort(byId); /** @typedef {{ chunk: Chunk, referencedBy: RuntimeChunkInfo[], remaining: number }} RuntimeChunkInfo */ /** @type {Map} */ @@ -4541,8 +4546,9 @@ This prevents using hashes of each other and should be avoided.`); } this.logger.timeAggregate("hashing: hash chunks"); }; - for (const chunk of otherChunks) processChunk(chunk); + for (const chunk of asyncChunks) processChunk(chunk); 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)); for (const error of errors) { diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index b7aa73bdbab..ba95c578fab 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -19,8 +19,33 @@ const { updateHashForEntryStartup } = require("../javascript/StartupHelpers"); const { getUndoPath } = require("../util/identifier"); /** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../ChunkGraph")} ChunkGraph */ +/** @typedef {import("../ChunkGroup")} ChunkGroup */ /** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Entrypoint")} Entrypoint */ +/** @typedef {import("../Module")} Module */ + +/** + * Gets information about a chunk including its entries and runtime chunk + * @param {Chunk} chunk The chunk to get information for + * @param {ChunkGraph} chunkGraph The chunk graph containing the chunk + * @returns {{entries: Array<[Module, Entrypoint | undefined]>, runtimeChunk: Chunk|null}} Object containing chunk entries and runtime chunk + */ +function getChunkInfo(chunk, chunkGraph) { + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + const runtimeChunk = + entries.length > 0 + ? /** @type {Entrypoint[][]} */ + (entries)[0][1].getRuntimeChunk() + : null; + + return { + entries, + runtimeChunk + }; +} class ModuleChunkFormatPlugin { /** @@ -76,13 +101,8 @@ class ModuleChunkFormatPlugin { ) ); } - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - if (entries.length > 0) { - const runtimeChunk = - /** @type {Entrypoint[][]} */ - (entries)[0][1].getRuntimeChunk(); + const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); + if (runtimeChunk) { const currentOutputName = compilation .getPath( getChunkFilenameTemplate(chunk, compilation.outputOptions), @@ -207,11 +227,15 @@ class ModuleChunkFormatPlugin { "ModuleChunkFormatPlugin", (chunk, hash, { chunkGraph, runtimeTemplate }) => { if (chunk.hasRuntime()) return; + const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); hash.update("ModuleChunkFormatPlugin"); hash.update("1"); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); + if (runtimeChunk && runtimeChunk.hash) { + // Any change to runtimeChunk should trigger a hash update, + // we shouldn't depend on or inspect its internal implementation. + // import __webpack_require__ from "./runtime-main.e9400aee33633a3973bd.js"; + hash.update(runtimeChunk.hash); + } updateHashForEntryStartup(hash, chunkGraph, entries, chunk); } ); diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js index ea45702698d..e718207def4 100644 --- a/test/WatchTestCases.template.js +++ b/test/WatchTestCases.template.js @@ -9,12 +9,14 @@ const path = require("path"); const fs = require("graceful-fs"); const vm = require("vm"); const rimraf = require("rimraf"); +const { pathToFileURL, fileURLToPath } = require("url"); const checkArrayExpectation = require("./checkArrayExpectation"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const { remove } = require("./helpers/remove"); const prepareOptions = require("./helpers/prepareOptions"); const deprecationTracking = require("./helpers/deprecationTracking"); const FakeDocument = require("./helpers/FakeDocument"); +const asModule = require("./helpers/asModule"); /** * @param {string} src src @@ -200,7 +202,7 @@ const describeCases = config => { { aggregateTimeout: 1000 }, - (err, stats) => { + async (err, stats) => { if (err) return compilationFinished(err); if (!stats) { return compilationFinished( @@ -273,29 +275,122 @@ const describeCases = config => { document: new FakeDocument() }; + const baseModuleScope = { + console, + it: run.it, + beforeEach: _beforeEach, + afterEach: _afterEach, + expect, + jest, + STATS_JSON: jsonStats, + nsObj: m => { + Object.defineProperty(m, Symbol.toStringTag, { + value: "Module" + }); + return m; + }, + window: globalContext, + self: globalContext, + WATCH_STEP: run.name, + STATE: state + }; + + const esmCache = new Map(); + const esmIdentifier = `${category.name}-${testName}`; + const esmContext = vm.createContext(baseModuleScope, { + name: "context for esm" + }); + // ESM + const isModule = + options.experiments && options.experiments.outputModule; + /** - * @param {string} currentDirectory the current directory - * @param {TODO} module a module + * @param {string} currentDirectory The directory to resolve relative paths from + * @param {string} module The module to require + * @param {("unlinked"|"evaluated")} esmMode The mode for ESM module handling * @returns {EXPECTED_ANY} required module * @private */ - function _require(currentDirectory, module) { - if (Array.isArray(module) || /^\.\.?\//.test(module)) { + function _require(currentDirectory, module, esmMode) { + if (/^\.\.?\//.test(module) || path.isAbsolute(module)) { let fn; - let content; - let p; - if (Array.isArray(module)) { - p = path.join(currentDirectory, module[0]); - content = module - .map(arg => { - p = path.join(currentDirectory, arg); - return fs.readFileSync(p, "utf-8"); - }) - .join("\n"); - } else { - p = path.join(currentDirectory, module); - content = fs.readFileSync(p, "utf-8"); + const p = path.isAbsolute(module) + ? module + : path.join(currentDirectory, module); + const content = fs.readFileSync(p, "utf-8"); + + if (isModule) { + if (!vm.SourceTextModule) + throw new Error( + "Running this test requires '--experimental-vm-modules'.\nRun with 'node --experimental-vm-modules node_modules/jest-cli/bin/jest'." + ); + let esm = esmCache.get(p); + if (!esm) { + esm = new vm.SourceTextModule(content, { + identifier: `${esmIdentifier}-${p}`, + url: `${pathToFileURL(p).href}?${esmIdentifier}`, + context: esmContext, + initializeImportMeta: (meta, module) => { + meta.url = pathToFileURL(p).href; + }, + importModuleDynamically: async ( + specifier, + module + ) => { + const normalizedSpecifier = + specifier.startsWith("file:") + ? `./${path.relative( + path.dirname(p), + fileURLToPath(specifier) + )}` + : specifier.replace( + /https:\/\/test.cases\/path\//, + "./" + ); + const result = await _require( + currentDirectory, + normalizedSpecifier, + "evaluated" + ); + return await asModule(result, module.context); + } + }); + esmCache.set(p, esm); + } + if (esmMode === "unlinked") return esm; + return (async () => { + if (esmMode === "unlinked") return esm; + if (esm.status !== "evaluated") { + await esm.link( + async (specifier, referencingModule) => + await asModule( + await _require( + path.dirname( + referencingModule.identifier + ? referencingModule.identifier.slice( + esmIdentifier.length + 1 + ) + : fileURLToPath(referencingModule.url) + ), + specifier, + "unlinked" + ), + referencingModule.context, + true + ) + ); + // node.js 10 needs instantiate + if (esm.instantiate) esm.instantiate(); + await esm.evaluate(); + } + if (esmMode === "evaluated") return esm; + const ns = esm.namespace; + return ns.default && ns.default instanceof Promise + ? ns.default + : ns; + })(); } + if ( options.target === "web" || options.target === "webworker" @@ -358,10 +453,33 @@ const describeCases = config => { if (testConfig.noTests) return process.nextTick(compilationFinished); - _require( + + const getBundle = (outputDirectory, module) => { + if (Array.isArray(module)) { + 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)); + } + return [path.join(outputDirectory, module)]; + }; + + const promises = []; + for (const p of getBundle( outputDirectory, testConfig.bundlePath || "./bundle.js" - ); + )) { + promises.push( + Promise.resolve().then(() => + _require(outputDirectory, p) + ) + ); + } + await Promise.all(promises); if (run.getNumberOfTests() < 1) return compilationFinished( @@ -431,6 +549,12 @@ const describeCases = config => { afterAll(() => { remove(tempDirectory); }); + + const { + it: _it, + beforeEach: _beforeEach, + afterEach: _afterEach + } = createLazyTestEnv(10000); }); } }); diff --git a/test/watchCases/chunks/esm-async-chunks-hmr/0/dynamic-1.js b/test/watchCases/chunks/esm-async-chunks-hmr/0/dynamic-1.js new file mode 100644 index 00000000000..92f3c109ad4 --- /dev/null +++ b/test/watchCases/chunks/esm-async-chunks-hmr/0/dynamic-1.js @@ -0,0 +1 @@ +export var value = "0"; \ No newline at end of file diff --git a/test/watchCases/chunks/esm-async-chunks-hmr/0/dynamic-2.js b/test/watchCases/chunks/esm-async-chunks-hmr/0/dynamic-2.js new file mode 100644 index 00000000000..034acec950d --- /dev/null +++ b/test/watchCases/chunks/esm-async-chunks-hmr/0/dynamic-2.js @@ -0,0 +1,2 @@ +export var value = "0"; + diff --git a/test/watchCases/chunks/esm-async-chunks-hmr/0/index.js b/test/watchCases/chunks/esm-async-chunks-hmr/0/index.js new file mode 100644 index 00000000000..4ff87308c6a --- /dev/null +++ b/test/watchCases/chunks/esm-async-chunks-hmr/0/index.js @@ -0,0 +1,36 @@ +import { react } from "./react"; + +it("should work where an ESM entryChunk depends on the runtimeChunk", async function (done) { + const mainChunk = STATS_JSON.chunks.find((chunk) => chunk.id === "main"); + const runtimeChunk = STATS_JSON.chunks.find((chunk) => chunk.id === "runtime-main"); + const dynamic1Chunk = STATS_JSON.chunks.find((chunk) => chunk.id === "dynamic-1_js"); + const dynamic2Chunk = STATS_JSON.chunks.find((chunk) => chunk.id === "dynamic-2_js"); + const reactChunk = STATS_JSON.chunks.find((chunk) => chunk.id === "react"); + expect(mainChunk).toBeDefined(); + expect(react).toBe("react"); + + await import('./dynamic-1').then(console.log) + await import('./dynamic-2').then(console.log) + + if (WATCH_STEP === "0") { + STATE.mainChunkHash = mainChunk.hash; + STATE.dynamic1ChunkHash = dynamic1Chunk.hash; + STATE.dynamic2ChunkHash = dynamic2Chunk.hash; + STATE.runtimeChunkHash = runtimeChunk.hash; + STATE.reactChunkHash = reactChunk.hash; + } else { + // async dynamic2Chunk needn't be updated + expect(dynamic2Chunk.hash).toBe(STATE.dynamic2ChunkHash); + // initial reactChunk is needn't be updated + expect(reactChunk.hash).toBe(STATE.reactChunkHash); + + + // initial mainChunk need to be updated + expect(mainChunk.hash).not.toBe(STATE.mainChunkHash); + // async dynamic1Chunk need to be updated + expect(dynamic1Chunk.hash).not.toBe(STATE.dynamic1ChunkHash); + // runtime runtimeChunk need to be updated + expect(runtimeChunk.hash).not.toBe(STATE.runtimeChunkHash); + } + done() +}); diff --git a/test/watchCases/chunks/esm-async-chunks-hmr/0/react.js b/test/watchCases/chunks/esm-async-chunks-hmr/0/react.js new file mode 100644 index 00000000000..59fb4cdbd3b --- /dev/null +++ b/test/watchCases/chunks/esm-async-chunks-hmr/0/react.js @@ -0,0 +1 @@ +export const react = "react"; \ No newline at end of file diff --git a/test/watchCases/chunks/esm-async-chunks-hmr/1/dynamic-1.js b/test/watchCases/chunks/esm-async-chunks-hmr/1/dynamic-1.js new file mode 100644 index 00000000000..d0565da5879 --- /dev/null +++ b/test/watchCases/chunks/esm-async-chunks-hmr/1/dynamic-1.js @@ -0,0 +1,3 @@ +export var value = "1"; + +import("./dynamic-2").then(console.log) \ No newline at end of file diff --git a/test/watchCases/chunks/esm-async-chunks-hmr/test.config.js b/test/watchCases/chunks/esm-async-chunks-hmr/test.config.js new file mode 100644 index 00000000000..024d917ac37 --- /dev/null +++ b/test/watchCases/chunks/esm-async-chunks-hmr/test.config.js @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000000..eb48318285e --- /dev/null +++ b/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js @@ -0,0 +1,31 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + experiments: { + outputModule: true + }, + optimization: { + splitChunks: { + chunks: "all", + minSize: 1, + cacheGroups: { + react: { + test: /react/, + name: "react", + chunks: "all", + priority: 100 + } + } + }, + runtimeChunk: { + /** + * @param {import("../../../../").Entrypoint} entrypoint The entrypoint to generate runtime chunk name for + * @returns {string} The generated runtime chunk name + */ + name: entrypoint => `runtime-${entrypoint.name}` + } + }, + output: { + filename: "[name].[contenthash].js", + chunkFilename: "[name].[contenthash].js" + } +}; From fc969037cadfd15c09f413aea90a9c07fb7b5ca5 Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Sun, 1 Jun 2025 22:55:34 +0800 Subject: [PATCH 11/56] test: pure dep for URL expression (#19572) --- test/configCases/url/pure-dep/foo.js | 14 +++++++++++ test/configCases/url/pure-dep/index.js | 24 +++++++++++++++++++ test/configCases/url/pure-dep/lang/foo.json | 1 + .../url/pure-dep/webpack.config.js | 17 +++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 test/configCases/url/pure-dep/foo.js create mode 100644 test/configCases/url/pure-dep/index.js create mode 100644 test/configCases/url/pure-dep/lang/foo.json create mode 100644 test/configCases/url/pure-dep/webpack.config.js diff --git a/test/configCases/url/pure-dep/foo.js b/test/configCases/url/pure-dep/foo.js new file mode 100644 index 00000000000..587f63a81e5 --- /dev/null +++ b/test/configCases/url/pure-dep/foo.js @@ -0,0 +1,14 @@ +const pureUrl1 = new URL("./lang/foo.json", import.meta.url); + +export const foo = "foo"; + +export const pureUrl2 = new URL("./lang/" + "foo" + ".json", import.meta.url); + +export const pureUrl3 = new URL(`./lang/${"foo"}.json`, import.meta.url); + +export const impureUrl1 = new URL( + "./lang/" + (global.foo = "foo") + ".json", + import.meta.url +); + +export const impureUrl2 = new URL("https://test.cases/lang/foo.json"); diff --git a/test/configCases/url/pure-dep/index.js b/test/configCases/url/pure-dep/index.js new file mode 100644 index 00000000000..0bf468a17a5 --- /dev/null +++ b/test/configCases/url/pure-dep/index.js @@ -0,0 +1,24 @@ +import { foo } from "./foo.js"; + +let generated = /** @type {string} */ ( + __non_webpack_require__("fs").readFileSync(__filename, "utf-8") +); + +it("should work", () => { + let idx = 0; + let count = 0; + while (idx < generated.length) { + let found = generated.indexOf("/* unused pure expression or super */", idx); + if ( + found !== -1 && + // Skip the indexOf call on line 11 + generated[found - 1] === "(" + ) { + count++; + idx = found + 37; + } else break; + } + expect(count).toBe(3); + expect(foo).toBe("foo"); + expect(global.foo).toBe("foo"); +}); diff --git a/test/configCases/url/pure-dep/lang/foo.json b/test/configCases/url/pure-dep/lang/foo.json new file mode 100644 index 00000000000..d97196bc01b --- /dev/null +++ b/test/configCases/url/pure-dep/lang/foo.json @@ -0,0 +1 @@ +{ "name": "foo" } diff --git a/test/configCases/url/pure-dep/webpack.config.js b/test/configCases/url/pure-dep/webpack.config.js new file mode 100644 index 00000000000..3a5dfd52ba3 --- /dev/null +++ b/test/configCases/url/pure-dep/webpack.config.js @@ -0,0 +1,17 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + assetModuleFilename: "[path][name][ext]" + }, + optimization: { + minimize: false, + innerGraph: true + }, + module: { + parser: { + javascript: { + dynamicUrl: true + } + } + } +}; From 79b3000fda4ec4a808e60d569ebba31eebbac68b Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Sun, 1 Jun 2025 22:56:20 +0800 Subject: [PATCH 12/56] test: refactor watchTestCase when ESM (#19571) --- test/WatchTestCases.template.js | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js index e718207def4..194b8b03e6e 100644 --- a/test/WatchTestCases.template.js +++ b/test/WatchTestCases.template.js @@ -144,6 +144,8 @@ const describeCases = config => { if (!options.entry) options.entry = "./index.js"; if (!options.target) options.target = "async-node"; if (!options.output) options.output = {}; + if (options.output.clean === undefined) + options.output.clean = true; if (!options.output.path) options.output.path = outputDirectory; if (typeof options.output.pathinfo === "undefined") options.output.pathinfo = true; @@ -360,29 +362,27 @@ const describeCases = config => { if (esmMode === "unlinked") return esm; return (async () => { if (esmMode === "unlinked") return esm; - if (esm.status !== "evaluated") { - await esm.link( - async (specifier, referencingModule) => - await asModule( - await _require( - path.dirname( - referencingModule.identifier - ? referencingModule.identifier.slice( - esmIdentifier.length + 1 - ) - : fileURLToPath(referencingModule.url) - ), - specifier, - "unlinked" + await esm.link( + async (specifier, referencingModule) => + await asModule( + await _require( + path.dirname( + referencingModule.identifier + ? referencingModule.identifier.slice( + esmIdentifier.length + 1 + ) + : fileURLToPath(referencingModule.url) ), - referencingModule.context, - true - ) - ); - // node.js 10 needs instantiate - if (esm.instantiate) esm.instantiate(); - await esm.evaluate(); - } + specifier, + "unlinked" + ), + referencingModule.context, + true + ) + ); + // node.js 10 needs instantiate + if (esm.instantiate) esm.instantiate(); + await esm.evaluate(); if (esmMode === "evaluated") return esm; const ns = esm.namespace; return ns.default && ns.default instanceof Promise From 47866c450d5373c835f72987872237669239bcdb Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:18:59 +0300 Subject: [PATCH 13/56] chore(deps): update webpack-sources (#19559) --- declarations.d.ts | 131 ++-------------- declarations/LoaderContext.d.ts | 8 +- lib/EvalSourceMapDevToolPlugin.js | 8 +- lib/NormalModule.js | 22 +-- lib/SourceMapDevToolPlugin.js | 10 +- package.json | 2 +- types.d.ts | 253 ++++++++++++++++++++++++------ yarn.lock | 8 +- 8 files changed, 248 insertions(+), 194 deletions(-) diff --git a/declarations.d.ts b/declarations.d.ts index d261284c4df..b3b245dd6fa 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -290,122 +290,21 @@ declare module "@webassemblyjs/wasm-edit" { } declare module "webpack-sources" { - export type MapOptions = { columns?: boolean; module?: boolean }; - - export type RawSourceMap = { - version: number; - sources: string[]; - names: string[]; - sourceRoot?: string; - sourcesContent?: string[]; - mappings: string; - file: string; - }; - - export abstract class Source { - size(): number; - - map(options?: MapOptions): RawSourceMap | null; - - sourceAndMap(options?: MapOptions): { - source: string | Buffer; - map: Object; - }; - - updateHash(hash: import("./lib/util/Hash")): void; - - source(): string | Buffer; - - buffer(): Buffer; - } - - export class RawSource extends Source { - constructor(source: string | Buffer, convertToString?: boolean); - - isBuffer(): boolean; - } - - export class OriginalSource extends Source { - constructor(source: string | Buffer, name: string); - - getName(): string; - } - - export class ReplaceSource extends Source { - constructor(source: Source, name?: string); - - replace(start: number, end: number, newValue: string, name?: string): void; - insert(pos: number, newValue: string, name?: string): void; - - getName(): string; - original(): string; - getReplacements(): { - start: number; - end: number; - content: string; - insertIndex: number; - name: string; - }[]; - } - - export class SourceMapSource extends Source { - constructor( - source: string | Buffer, - name: string, - sourceMap: Object | string | Buffer, - originalSource?: string | Buffer, - innerSourceMap?: Object | string | Buffer, - removeOriginalSource?: boolean - ); - - getArgsAsBuffers(): [ - Buffer, - string, - Buffer, - Buffer | undefined, - Buffer | undefined, - boolean - ]; - } - - export class ConcatSource extends Source { - constructor(...args: (string | Source)[]); - - getChildren(): Source[]; - - add(item: string | Source): void; - addAllSkipOptimizing(items: Source[]): void; - } - - export class PrefixSource extends Source { - constructor(prefix: string, source: string | Source); - - original(): Source; - getPrefix(): string; - } - - export class CachedSource extends Source { - constructor(source: Source); - constructor(source: Source | (() => Source), cachedData?: any); - - original(): Source; - originalLazy(): Source | (() => Source); - getCachedData(): any; - } - - export class SizeOnlySource extends Source { - constructor(size: number); - } - - interface SourceLike { - source(): string | Buffer; - } - - export class CompatSource extends Source { - constructor(sourceLike: SourceLike); - - static from(sourceLike: SourceLike): Source; - } + export { + SourceLike, + RawSourceMap, + MapOptions, + Source, + RawSource, + OriginalSource, + ReplaceSource, + SourceMapSource, + ConcatSource, + PrefixSource, + CachedSource, + SizeOnlySource, + CompatSource + } from "webpack-sources/types"; } declare module "json-parse-even-better-errors" { diff --git a/declarations/LoaderContext.d.ts b/declarations/LoaderContext.d.ts index 2de0a3fae66..d83edb5cecb 100644 --- a/declarations/LoaderContext.d.ts +++ b/declarations/LoaderContext.d.ts @@ -1,4 +1,4 @@ -import type { SourceMap } from "../lib/NormalModule"; +import type { RawSourceMap } from "../lib/NormalModule"; import type Module from "../lib/Module"; import type { validate } from "schema-utils"; import type { AssetInfo } from "../lib/Compilation"; @@ -247,7 +247,7 @@ type AdditionalData = { type WebpackLoaderContextCallback = ( err: undefined | null | Error, content?: string | Buffer, - sourceMap?: null | string | SourceMap, + sourceMap?: null | string | RawSourceMap, additionalData?: AdditionalData ) => void; @@ -266,14 +266,14 @@ type PitchLoaderDefinitionFunction = ( type LoaderDefinitionFunction = ( this: LoaderContext & ContextAdditions, content: string, - sourceMap?: string | SourceMap, + sourceMap?: string | RawSourceMap, additionalData?: AdditionalData ) => string | Buffer | Promise | void; type RawLoaderDefinitionFunction = ( this: LoaderContext & ContextAdditions, content: Buffer, - sourceMap?: string | SourceMap, + sourceMap?: string | RawSourceMap, additionalData?: AdditionalData ) => string | Buffer | Promise | void; diff --git a/lib/EvalSourceMapDevToolPlugin.js b/lib/EvalSourceMapDevToolPlugin.js index 29dcc55c52a..e43f0fdec0d 100644 --- a/lib/EvalSourceMapDevToolPlugin.js +++ b/lib/EvalSourceMapDevToolPlugin.js @@ -15,12 +15,12 @@ const ConcatenatedModule = require("./optimize/ConcatenatedModule"); const generateDebugId = require("./util/generateDebugId"); const { makePathsAbsolute } = require("./util/identifier"); +/** @typedef {import("webpack-sources").RawSourceMap} RawSourceMap */ /** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("../declarations/WebpackOptions").DevTool} DevToolOptions */ /** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ /** @typedef {import("./ChunkGraph").ModuleId} ModuleId */ /** @typedef {import("./Compiler")} Compiler */ -/** @typedef {import("./NormalModule").SourceMap} SourceMap */ /** @type {WeakMap} */ const cache = new WeakMap(); @@ -117,15 +117,15 @@ class EvalSourceMapDevToolPlugin { const namespace = compilation.getPath(this.namespace, { chunk }); - /** @type {SourceMap} */ + /** @type {RawSourceMap} */ let sourceMap; let content; if (source.sourceAndMap) { const sourceAndMap = source.sourceAndMap(options); - sourceMap = /** @type {SourceMap} */ (sourceAndMap.map); + sourceMap = /** @type {RawSourceMap} */ (sourceAndMap.map); content = sourceAndMap.source; } else { - sourceMap = /** @type {SourceMap} */ (source.map(options)); + sourceMap = /** @type {RawSourceMap} */ (source.map(options)); content = source.source(); } if (!sourceMap) { diff --git a/lib/NormalModule.js b/lib/NormalModule.js index b07d4253798..fc12bd04b1f 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -54,6 +54,7 @@ const makeSerializable = require("./util/makeSerializable"); const memoize = require("./util/memoize"); /** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("webpack-sources").RawSourceMap} RawSourceMap */ /** @typedef {import("../declarations/WebpackOptions").Mode} Mode */ /** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */ /** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ @@ -115,18 +116,6 @@ const memoize = require("./util/memoize"); * @typedef {import("../declarations/LoaderContext").NormalModuleLoaderContext} NormalModuleLoaderContext */ -/** - * @typedef {object} SourceMap - * @property {number} version - * @property {string[]} sources - * @property {string} mappings - * @property {string=} file - * @property {string=} sourceRoot - * @property {string[]=} sourcesContent - * @property {string[]=} names - * @property {string=} debugId - */ - const getInvalidDependenciesModuleWarning = memoize(() => require("./InvalidDependenciesModuleWarning") ); @@ -159,9 +148,9 @@ const contextifySourceUrl = (context, source, associatedObjectForCache) => { /** * @param {string} context absolute context path - * @param {SourceMap} sourceMap a source map + * @param {RawSourceMap} sourceMap a source map * @param {AssociatedObjectForCache=} associatedObjectForCache an object to which the cache will be attached - * @returns {SourceMap} new source map + * @returns {RawSourceMap} new source map */ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { if (!Array.isArray(sourceMap.sources)) return sourceMap; @@ -543,7 +532,7 @@ class NormalModule extends Module { * @param {string} context the compilation context * @param {string} name the asset name * @param {string | Buffer} content the content - * @param {(string | SourceMap)=} sourceMap an optional source map + * @param {(string | RawSourceMap)=} sourceMap an optional source map * @param {AssociatedObjectForCache=} associatedObjectForCache object for caching * @returns {Source} the created source */ @@ -571,7 +560,8 @@ class NormalModule extends Module { name, contextifySourceMap( context, - /** @type {SourceMap} */ (sourceMap), + /** @type {RawSourceMap} */ + (sourceMap), associatedObjectForCache ) ); diff --git a/lib/SourceMapDevToolPlugin.js b/lib/SourceMapDevToolPlugin.js index 7cbba17992f..356493361ba 100644 --- a/lib/SourceMapDevToolPlugin.js +++ b/lib/SourceMapDevToolPlugin.js @@ -28,7 +28,7 @@ const { makePathsAbsolute } = require("./util/identifier"); /** @typedef {import("./Compilation").AssetInfo} AssetInfo */ /** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./Module")} Module */ -/** @typedef {import("./NormalModule").SourceMap} SourceMap */ +/** @typedef {import("./NormalModule").RawSourceMap} RawSourceMap */ /** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */ /** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ @@ -47,7 +47,7 @@ const validate = createSchemaValidation( * @property {(string | Module)[]} modules * @property {string} source * @property {string} file - * @property {SourceMap} sourceMap + * @property {RawSourceMap} sourceMap * @property {ItemCacheFacade} cacheItem cache item */ @@ -95,17 +95,17 @@ const getTaskForFile = ( cacheItem ) => { let source; - /** @type {SourceMap} */ + /** @type {RawSourceMap} */ let sourceMap; /** * Check if asset can build source map */ if (asset.sourceAndMap) { const sourceAndMap = asset.sourceAndMap(options); - sourceMap = /** @type {SourceMap} */ (sourceAndMap.map); + sourceMap = /** @type {RawSourceMap} */ (sourceAndMap.map); source = sourceAndMap.source; } else { - sourceMap = /** @type {SourceMap} */ (asset.map(options)); + sourceMap = /** @type {RawSourceMap} */ (asset.map(options)); source = asset.source(); } if (!sourceMap || typeof source !== "string") return; diff --git a/package.json b/package.json index a59551fcb12..f80781a5ff9 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "tapable": "^2.1.1", "terser-webpack-plugin": "^5.3.11", "watchpack": "^2.4.1", - "webpack-sources": "^3.2.3" + "webpack-sources": "^3.3.2" }, "peerDependenciesMeta": { "webpack-cli": { diff --git a/types.d.ts b/types.d.ts index 3188bdfe1c3..7c97dc95fbf 100644 --- a/types.d.ts +++ b/types.d.ts @@ -895,6 +895,19 @@ type BufferEncoding = | "binary" | "hex"; type BufferEncodingOption = "buffer" | { encoding: "buffer" }; +declare interface BufferEntry { + map?: null | RawSourceMap; + bufferedMap?: null | BufferedMap; +} +declare interface BufferedMap { + version: number; + sources: string[]; + names: string[]; + sourceRoot?: string; + sourcesContent?: ("" | Buffer)[]; + mappings?: Buffer; + file: string; +} type BuildInfo = KnownBuildInfo & Record; type BuildMeta = KnownBuildMeta & Record; declare abstract class ByTypeGenerator extends Generator { @@ -1014,12 +1027,36 @@ declare interface CacheGroupsContext { chunkGraph: ChunkGraph; } type CacheOptionsNormalized = false | FileCacheOptions | MemoryCacheOptions; +declare interface CachedData { + source?: boolean; + buffer: Buffer; + size?: number; + maps: Map; + hash?: (string | Buffer)[]; +} declare class CachedSource extends Source { - constructor(source: Source); - constructor(source: Source | (() => Source), cachedData?: any); - original(): Source; + constructor(source: Source | (() => Source), cachedData?: CachedData); + getCachedData(): CachedData; originalLazy(): Source | (() => Source); - getCachedData(): any; + original(): Source; + streamChunks( + options: StreamChunksOptions, + onChunk: ( + chunk: undefined | string, + generatedLine: number, + generatedColumn: number, + sourceIndex: number, + originalLine: number, + originalColumn: number, + nameIndex: number + ) => void, + onSource: ( + sourceIndex: number, + source: null | string, + sourceContent?: string + ) => void, + onName: (nameIndex: number, name: string) => void + ): GeneratedSourceInfo; } declare interface CalculatedStringResult { range?: [number, number]; @@ -2545,11 +2582,30 @@ declare class Compiler { close(callback: RunCallback): void; } declare class ConcatSource extends Source { - constructor(...args: (string | Source)[]); + constructor(...args: ConcatSourceChild[]); getChildren(): Source[]; - add(item: string | Source): void; - addAllSkipOptimizing(items: Source[]): void; + add(item: ConcatSourceChild): void; + addAllSkipOptimizing(items: ConcatSourceChild[]): void; + streamChunks( + options: StreamChunksOptions, + onChunk: ( + chunk: undefined | string, + generatedLine: number, + generatedColumn: number, + sourceIndex: number, + originalLine: number, + originalColumn: number, + nameIndex: number + ) => void, + onSource: ( + sourceIndex: number, + source: null | string, + sourceContent?: string + ) => void, + onName: (nameIndex: number, name: string) => void + ): GeneratedSourceInfo; } +type ConcatSourceChild = string | Source | SourceLike; declare interface ConcatenatedModuleInfo { type: "concatenated"; module: Module; @@ -5369,6 +5425,11 @@ declare interface GenerateContext { */ getData?: () => Map; } +declare interface GeneratedSourceInfo { + generatedLine?: number; + generatedColumn?: number; + source?: string; +} declare class Generator { constructor(); getTypes(module: NormalModule): ReadonlySet; @@ -5619,6 +5680,10 @@ declare class Hash { digest(encoding?: string): string | Buffer; } type HashFunction = string | typeof Hash; +declare interface HashLike { + update: (data: string | Buffer, inputEncoding?: string) => HashLike; + digest: (encoding?: string) => string | Buffer; +} declare interface HashableObject { updateHash: (hash: Hash) => void; } @@ -8642,7 +8707,7 @@ declare interface LoaderDefinitionFunction< HotModuleReplacementPluginLoaderContext & ContextAdditions, content: string, - sourceMap?: string | SourceMap, + sourceMap?: string | RawSourceMap, additionalData?: AdditionalData ): string | void | Buffer | Promise; } @@ -8743,7 +8808,7 @@ declare interface LoaderRunnerLoaderContext { async(): ( err?: null | Error, content?: string | Buffer, - sourceMap?: null | string | SourceMap, + sourceMap?: null | string | RawSourceMap, additionalData?: AdditionalData ) => void; @@ -8757,7 +8822,7 @@ declare interface LoaderRunnerLoaderContext { callback: ( err?: null | Error, content?: string | Buffer, - sourceMap?: null | string | SourceMap, + sourceMap?: null | string | RawSourceMap, additionalData?: AdditionalData ) => void; @@ -10163,7 +10228,7 @@ declare class NormalModule extends Module { context: string, name: string, content: string | Buffer, - sourceMap?: string | SourceMap, + sourceMap?: string | RawSourceMap, associatedObjectForCache?: object ): Source; getCurrentLoader( @@ -11186,8 +11251,26 @@ declare interface OriginRecord { request: string; } declare class OriginalSource extends Source { - constructor(source: string | Buffer, name: string); + constructor(value: string | Buffer, name: string); getName(): string; + streamChunks( + options: StreamChunksOptions, + onChunk: ( + chunk: undefined | string, + generatedLine: number, + generatedColumn: number, + sourceIndex: number, + originalLine: number, + originalColumn: number, + nameIndex: number + ) => void, + onSource: ( + sourceIndex: number, + source: null | string, + sourceContent?: string + ) => void, + onName: (nameIndex: number, name: string) => void + ): GeneratedSourceInfo; } /** @@ -11998,9 +12081,27 @@ declare class PrefetchPlugin { apply(compiler: Compiler): void; } declare class PrefixSource extends Source { - constructor(prefix: string, source: string | Source); - original(): Source; + constructor(prefix: string, source: string | Source | Buffer); getPrefix(): string; + original(): Source; + streamChunks( + options: StreamChunksOptions, + onChunk: ( + chunk: undefined | string, + generatedLine: number, + generatedColumn: number, + sourceIndex: number, + originalLine: number, + originalColumn: number, + nameIndex: number + ) => void, + onSource: ( + sourceIndex: number, + source: null | string, + sourceContent?: string + ) => void, + onName: (nameIndex: number, name: string) => void + ): GeneratedSourceInfo; } declare interface PreparsedAst { [index: string]: any; @@ -12218,13 +12319,31 @@ declare interface RawLoaderDefinitionFunction< HotModuleReplacementPluginLoaderContext & ContextAdditions, content: Buffer, - sourceMap?: string | SourceMap, + sourceMap?: string | RawSourceMap, additionalData?: AdditionalData ): string | void | Buffer | Promise; } declare class RawSource extends Source { - constructor(source: string | Buffer, convertToString?: boolean); + constructor(value: string | Buffer, convertToString?: boolean); isBuffer(): boolean; + streamChunks( + options: StreamChunksOptions, + onChunk: ( + chunk: undefined | string, + generatedLine: number, + generatedColumn: number, + sourceIndex: number, + originalLine: number, + originalColumn: number, + nameIndex: number + ) => void, + onSource: ( + sourceIndex: number, + source: null | string, + sourceContent?: string + ) => void, + onName: (nameIndex: number, name: string) => void + ): GeneratedSourceInfo; } declare interface RawSourceMap { version: number; @@ -12234,6 +12353,8 @@ declare interface RawSourceMap { sourcesContent?: string[]; mappings: string; file: string; + debugId?: string; + ignoreList?: number[]; } declare interface Read< TBuffer extends @@ -13022,17 +13143,38 @@ declare interface RenderManifestOptions { } declare class ReplaceSource extends Source { constructor(source: Source, name?: string); + getName(): undefined | string; + getReplacements(): Replacement[]; replace(start: number, end: number, newValue: string, name?: string): void; insert(pos: number, newValue: string, name?: string): void; - getName(): string; - original(): string; - getReplacements(): { - start: number; - end: number; - content: string; - insertIndex: number; - name: string; - }[]; + original(): Source; + streamChunks( + options: StreamChunksOptions, + onChunk: ( + chunk: undefined | string, + generatedLine: number, + generatedColumn: number, + sourceIndex: number, + originalLine: number, + originalColumn: number, + nameIndex: number + ) => void, + onSource: ( + sourceIndex: number, + source: null | string, + sourceContent?: string + ) => void, + onName: (nameIndex: number, name: string) => void + ): GeneratedSourceInfo; + static Replacement: typeof Replacement; +} +declare class Replacement { + constructor(start: number, end: number, content: string, name?: string); + start: number; + end: number; + content: string; + name?: string; + index?: number; } declare interface RequestRecord { [index: string]: string | string[]; @@ -14903,25 +15045,24 @@ declare abstract class SortableSet extends Set { } declare class Source { constructor(); + source(): SourceValue; + buffer(): Buffer; size(): number; map(options?: MapOptions): null | RawSourceMap; - sourceAndMap(options?: MapOptions): { source: string | Buffer; map: Object }; - updateHash(hash: Hash): void; - source(): string | Buffer; - buffer(): Buffer; + sourceAndMap(options?: MapOptions): SourceAndMap; + updateHash(hash: HashLike): void; } -declare interface SourceLike { - source(): string | Buffer; +declare interface SourceAndMap { + source: SourceValue; + map: null | RawSourceMap; } -declare interface SourceMap { - version: number; - sources: string[]; - mappings: string; - file?: string; - sourceRoot?: string; - sourcesContent?: string[]; - names?: string[]; - debugId?: string; +declare interface SourceLike { + source: () => SourceValue; + buffer?: () => Buffer; + size?: () => number; + map?: (options?: MapOptions) => null | RawSourceMap; + sourceAndMap?: (options?: MapOptions) => SourceAndMap; + updateHash?: (hash: HashLike) => void; } declare class SourceMapDevToolPlugin { constructor(options?: SourceMapDevToolPluginOptions); @@ -15022,11 +15163,11 @@ declare interface SourceMapDevToolPluginOptions { } declare class SourceMapSource extends Source { constructor( - source: string | Buffer, + value: string | Buffer, name: string, - sourceMap: string | Object | Buffer, + sourceMap?: string | Buffer | RawSourceMap, originalSource?: string | Buffer, - innerSourceMap?: string | Object | Buffer, + innerSourceMap?: string | Buffer | RawSourceMap, removeOriginalSource?: boolean ); getArgsAsBuffers(): [ @@ -15035,13 +15176,32 @@ declare class SourceMapSource extends Source { Buffer, undefined | Buffer, undefined | Buffer, - boolean + undefined | boolean ]; + streamChunks( + options: StreamChunksOptions, + onChunk: ( + chunk: undefined | string, + generatedLine: number, + generatedColumn: number, + sourceIndex: number, + originalLine: number, + originalColumn: number, + nameIndex: number + ) => void, + onSource: ( + sourceIndex: number, + source: null | string, + sourceContent?: string + ) => void, + onName: (nameIndex: number, name: string) => void + ): GeneratedSourceInfo; } declare interface SourcePosition { line: number; column?: number; } +type SourceValue = string | Buffer; declare interface SplitChunksOptions { chunksFilter: (chunk: Chunk) => undefined | boolean; defaultSizeTypes: string[]; @@ -15826,6 +15986,11 @@ type StatsValue = | "minimal" | "normal" | "detailed"; +declare interface StreamChunksOptions { + source?: boolean; + finalSource?: boolean; + columns?: boolean; +} type Supports = undefined | string; declare class SyncModuleIdsPlugin { constructor(__0: SyncModuleIdsPluginOptions); diff --git a/yarn.lock b/yarn.lock index 327588f06d2..31c989b7b36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6596,10 +6596,10 @@ webpack-merge@^6.0.1: flat "^5.0.2" wildcard "^2.0.1" -webpack-sources@^3.2.3: - version "3.2.3" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" - integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== +webpack-sources@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.2.tgz#0ab55ab0b380ce53c45ca40cb7b33bab3149ea85" + integrity sha512-ykKKus8lqlgXX/1WjudpIEjqsafjOTcOJqxnAbMLAu/KCsDCJ6GBtvscewvTkrn24HsnvFwrSCbenFrhtcCsAA== which-module@^2.0.0: version "2.0.1" From a4bd378b746f2384a220aefda7a4b70a47c31f3b Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Tue, 3 Jun 2025 01:56:51 +0800 Subject: [PATCH 14/56] feat: support more context options for URL --- lib/dependencies/URLPlugin.js | 4 +- ...sionParserPlugin.js => URLParserPlugin.js} | 45 ++++++++++++++++++- .../url/context-options/folder1/a.json | 3 ++ .../url/context-options/folder1/b.js | 1 + .../url/context-options/folder1/c.js | 1 + .../url/context-options/folder2/a.json | 3 ++ test/configCases/url/context-options/index.js | 42 +++++++++++++++++ .../url/context-options/webpack.config.js | 13 ++++++ 8 files changed, 108 insertions(+), 4 deletions(-) rename lib/url/{URLExpressionParserPlugin.js => URLParserPlugin.js} (84%) create mode 100644 test/configCases/url/context-options/folder1/a.json create mode 100644 test/configCases/url/context-options/folder1/b.js create mode 100644 test/configCases/url/context-options/folder1/c.js create mode 100644 test/configCases/url/context-options/folder2/a.json create mode 100644 test/configCases/url/context-options/index.js create mode 100644 test/configCases/url/context-options/webpack.config.js diff --git a/lib/dependencies/URLPlugin.js b/lib/dependencies/URLPlugin.js index a692c401925..70946588765 100644 --- a/lib/dependencies/URLPlugin.js +++ b/lib/dependencies/URLPlugin.js @@ -12,7 +12,7 @@ const { const URLContextDependency = require("../dependencies/URLContextDependency"); const URLDependency = require("../dependencies/URLDependency"); -const URLExpressionParserPlugin = require("../url/URLExpressionParserPlugin"); +const URLParserPlugin = require("../url/URLParserPlugin"); /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ /** @typedef {import("../Compiler")} Compiler */ @@ -50,7 +50,7 @@ class URLPlugin { */ const handler = (parser, parserOptions) => { if (parserOptions.url === false) return; - new URLExpressionParserPlugin(parserOptions).apply(parser); + new URLParserPlugin(parserOptions).apply(parser); }; normalModuleFactory.hooks.parser diff --git a/lib/url/URLExpressionParserPlugin.js b/lib/url/URLParserPlugin.js similarity index 84% rename from lib/url/URLExpressionParserPlugin.js rename to lib/url/URLParserPlugin.js index 8e25a3e3e2f..3fc13c1778d 100644 --- a/lib/url/URLExpressionParserPlugin.js +++ b/lib/url/URLParserPlugin.js @@ -19,8 +19,8 @@ const InnerGraph = require("../optimize/InnerGraph"); /** @typedef {import("estree").MemberExpression} MemberExpression */ /** @typedef {import("estree").NewExpression} NewExpressionNode */ - /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ +/** @typedef {import("../ContextModule").ContextMode} ContextMode */ /** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */ /** @typedef {import("../NormalModule")} NormalModule */ /** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ @@ -167,6 +167,8 @@ class URLParserPlugin { if (!evaluatedExpr) return; let request; + + // static URL if ((request = evaluatedExpr.asString())) { const [arg1, arg2] = expr.arguments; const dep = new URLDependency( @@ -186,7 +188,42 @@ class URLParserPlugin { if (this.options.dynamicUrl === false) return; - // handle dynamic url + // context URL + let include; + let exclude; + + if (importOptions) { + if (importOptions.webpackInclude !== undefined) { + if ( + !importOptions.webpackInclude || + !(importOptions.webpackInclude instanceof RegExp) + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackInclude\` expected a regular expression, but received: ${importOptions.webpackInclude}.`, + /** @type {DependencyLocation} */ (expr.loc) + ) + ); + } else { + include = importOptions.webpackInclude; + } + } + if (importOptions.webpackExclude !== undefined) { + if ( + !importOptions.webpackExclude || + !(importOptions.webpackExclude instanceof RegExp) + ) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackExclude\` expected a regular expression, but received: ${importOptions.webpackExclude}.`, + /** @type {DependencyLocation} */ (expr.loc) + ) + ); + } else { + exclude = importOptions.webpackExclude; + } + } + } const dep = ContextDependencyHelpers.create( URLContextDependency, /** @type {Range} */ (expr.range), @@ -194,6 +231,10 @@ class URLParserPlugin { expr, this.options, { + include, + exclude, + mode: "sync", + typePrefix: "new URL with import.meta.url", category: "url" }, parser diff --git a/test/configCases/url/context-options/folder1/a.json b/test/configCases/url/context-options/folder1/a.json new file mode 100644 index 00000000000..44d21f1fa79 --- /dev/null +++ b/test/configCases/url/context-options/folder1/a.json @@ -0,0 +1,3 @@ +{ + "name": "a" +} diff --git a/test/configCases/url/context-options/folder1/b.js b/test/configCases/url/context-options/folder1/b.js new file mode 100644 index 00000000000..eff703ff465 --- /dev/null +++ b/test/configCases/url/context-options/folder1/b.js @@ -0,0 +1 @@ +export default "b"; diff --git a/test/configCases/url/context-options/folder1/c.js b/test/configCases/url/context-options/folder1/c.js new file mode 100644 index 00000000000..5d50db5bc15 --- /dev/null +++ b/test/configCases/url/context-options/folder1/c.js @@ -0,0 +1 @@ +export default "c"; diff --git a/test/configCases/url/context-options/folder2/a.json b/test/configCases/url/context-options/folder2/a.json new file mode 100644 index 00000000000..44d21f1fa79 --- /dev/null +++ b/test/configCases/url/context-options/folder2/a.json @@ -0,0 +1,3 @@ +{ + "name": "a" +} diff --git a/test/configCases/url/context-options/index.js b/test/configCases/url/context-options/index.js new file mode 100644 index 00000000000..9f3ba6e0cff --- /dev/null +++ b/test/configCases/url/context-options/index.js @@ -0,0 +1,42 @@ +const throwModuleNotFound = fn => expect(fn).toThrow(/Cannot find module/); + +it("should work with context options", () => { + // webpackInclude + let dyn = "/a.json"; + let url = new URL( + /* webpackInclude: /.json$/ */ "./folder1" + dyn, + import.meta.url + ); + expect(url).toMatch("folder1/a.json"); + + // webpackExclude + dyn = "/b.js"; + throwModuleNotFound(() => { + url = new URL( + /* webpackInclude: /.json$/ */ "./folder1" + dyn, + import.meta.url + ); + }); + + dyn = "/c.js"; + throwModuleNotFound(() => { + url = new URL( + /* webpackExclude: /.js$/ */ "./folder1" + dyn, + import.meta.url + ); + }); + + // webpackExclude interfere the context prefix + throwModuleNotFound(() => { + dyn = "/a.json"; + url = new URL( + /* webpackExclude: /[\\/]folder2[\\/]/ */ "./folder2" + dyn, + import.meta.url + ); + }); + + // webpackIgnore + dyn = "bundle0.js"; + url = new URL(/* webpackIgnore: true */ "./" + dyn, import.meta.url); + expect(url.href).toMatch(__webpack_base_uri__.href); +}); diff --git a/test/configCases/url/context-options/webpack.config.js b/test/configCases/url/context-options/webpack.config.js new file mode 100644 index 00000000000..9546ca838cc --- /dev/null +++ b/test/configCases/url/context-options/webpack.config.js @@ -0,0 +1,13 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + assetModuleFilename: "[path][name][ext]" + }, + module: { + parser: { + javascript: { + dynamicUrl: true + } + } + } +}; From f3001e0ce840c93976e2e4768855234e01fad814 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 21:34:39 +0300 Subject: [PATCH 15/56] chore(deps): bump the dependencies group across 1 directory with 14 updates (#19576) Bumps the dependencies group with 14 updates in the / directory: | Package | From | To | | --- | --- | --- | | [browserslist](https://github.com/browserslist/browserslist) | `4.24.5` | `4.25.0` | | [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) | `7.27.1` | `7.27.4` | | [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) | `9.27.0` | `9.28.0` | | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) | `4.2.0` | `4.4.0` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `22.15.21` | `22.15.29` | | [assemblyscript](https://github.com/AssemblyScript/assemblyscript) | `0.27.36` | `0.28.1` | | [eslint](https://github.com/eslint/eslint) | `9.27.0` | `9.28.0` | | [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) | `28.11.0` | `28.12.0` | | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) | `17.18.0` | `17.19.0` | | [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) | `5.4.0` | `5.4.1` | | [globals](https://github.com/sindresorhus/globals) | `16.1.0` | `16.2.0` | | [lint-staged](https://github.com/lint-staged/lint-staged) | `16.0.0` | `16.1.0` | | [terser](https://github.com/terser/terser) | `5.39.2` | `5.40.0` | | [three](https://github.com/mrdoob/three.js) | `0.176.0` | `0.177.0` | Updates `browserslist` from 4.24.5 to 4.25.0 - [Release notes](https://github.com/browserslist/browserslist/releases) - [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md) - [Commits](https://github.com/browserslist/browserslist/compare/4.24.5...4.25.0) Updates `@babel/core` from 7.27.1 to 7.27.4 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.4/packages/babel-core) Updates `@eslint/js` from 9.27.0 to 9.28.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/commits/v9.28.0/packages/js) Updates `@stylistic/eslint-plugin` from 4.2.0 to 4.4.0 - [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases) - [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v4.4.0/packages/eslint-plugin) Updates `@types/node` from 22.15.21 to 22.15.29 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `assemblyscript` from 0.27.36 to 0.28.1 - [Release notes](https://github.com/AssemblyScript/assemblyscript/releases) - [Commits](https://github.com/AssemblyScript/assemblyscript/compare/v0.27.36...v0.28.1) Updates `eslint` from 9.27.0 to 9.28.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v9.27.0...v9.28.0) Updates `eslint-plugin-jest` from 28.11.0 to 28.12.0 - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v28.11.0...v28.12.0) Updates `eslint-plugin-n` from 17.18.0 to 17.19.0 - [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases) - [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.18.0...v17.19.0) Updates `eslint-plugin-prettier` from 5.4.0 to 5.4.1 - [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases) - [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v5.4.0...v5.4.1) Updates `globals` from 16.1.0 to 16.2.0 - [Release notes](https://github.com/sindresorhus/globals/releases) - [Commits](https://github.com/sindresorhus/globals/compare/v16.1.0...v16.2.0) Updates `lint-staged` from 16.0.0 to 16.1.0 - [Release notes](https://github.com/lint-staged/lint-staged/releases) - [Changelog](https://github.com/lint-staged/lint-staged/blob/main/CHANGELOG.md) - [Commits](https://github.com/lint-staged/lint-staged/compare/v16.0.0...v16.1.0) Updates `terser` from 5.39.2 to 5.40.0 - [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md) - [Commits](https://github.com/terser/terser/compare/v5.39.2...v5.40.0) Updates `three` from 0.176.0 to 0.177.0 - [Release notes](https://github.com/mrdoob/three.js/releases) - [Commits](https://github.com/mrdoob/three.js/commits) --- updated-dependencies: - dependency-name: browserslist dependency-version: 4.25.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: "@babel/core" dependency-version: 7.27.4 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: "@eslint/js" dependency-version: 9.28.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: "@stylistic/eslint-plugin" dependency-version: 4.4.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: "@types/node" dependency-version: 22.15.29 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: assemblyscript dependency-version: 0.28.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: eslint dependency-version: 9.28.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: eslint-plugin-jest dependency-version: 28.12.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: eslint-plugin-n dependency-version: 17.19.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: eslint-plugin-prettier dependency-version: 5.4.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: globals dependency-version: 16.2.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: lint-staged dependency-version: 16.1.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: terser dependency-version: 5.40.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: three dependency-version: 0.177.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 4 +- yarn.lock | 379 +++++++++++++++++++++++++++------------------------ 2 files changed, 206 insertions(+), 177 deletions(-) diff --git a/package.json b/package.json index f80781a5ff9..f88ee2c21b7 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@types/mime-types": "^2.1.4", "@types/node": "^22.15.11", "@types/xxhashjs": "^0.2.4", - "assemblyscript": "^0.27.34", + "assemblyscript": "^0.28.1", "babel-loader": "^10.0.0", "bundle-loader": "^0.5.6", "coffee-loader": "^5.0.0", @@ -103,7 +103,7 @@ "strip-ansi": "^6.0.0", "style-loader": "^4.0.0", "terser": "^5.38.1", - "three": "^0.176.0", + "three": "^0.177.0", "tinybench": "^4.0.1", "toml": "^3.0.0", "tooling": "webpack/tooling#v1.23.9", diff --git a/yarn.lock b/yarn.lock index 31c989b7b36..4e22e2f1755 100644 --- a/yarn.lock +++ b/yarn.lock @@ -29,39 +29,39 @@ js-tokens "^4.0.0" picocolors "^1.1.1" -"@babel/compat-data@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.27.1.tgz#db7cf122745e0a332c44e847ddc4f5e5221a43f6" - integrity sha512-Q+E+rd/yBzNQhXkG+zQnF58e4zoZfBedaxwzPmicKsiK3nt8iJYrSrDbjwFFDGC4f+rPafqRaPH6TsDoSvMf7A== +"@babel/compat-data@^7.27.2": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.27.3.tgz#cc49c2ac222d69b889bf34c795f537c0c6311111" + integrity sha512-V42wFfx1ymFte+ecf6iXghnnP8kWTO+ZLXIyZq+1LAXHHvTZdVxicn4yiVYdYMGaCO3tmqub11AorKkv+iodqw== "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9", "@babel/core@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.27.1.tgz#89de51e86bd12246003e3524704c49541b16c3e6" - integrity sha512-IaaGWsQqfsQWVLqMn9OB92MNN7zukfVA4s7KKAI0KfrrDsZ0yhi5uV4baBuLuN7n3vsZpwP8asPPcVwApxvjBQ== + version "7.27.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.27.4.tgz#cc1fc55d0ce140a1828d1dd2a2eba285adbfb3ce" + integrity sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g== dependencies: "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.27.1" - "@babel/helper-compilation-targets" "^7.27.1" - "@babel/helper-module-transforms" "^7.27.1" - "@babel/helpers" "^7.27.1" - "@babel/parser" "^7.27.1" - "@babel/template" "^7.27.1" - "@babel/traverse" "^7.27.1" - "@babel/types" "^7.27.1" + "@babel/generator" "^7.27.3" + "@babel/helper-compilation-targets" "^7.27.2" + "@babel/helper-module-transforms" "^7.27.3" + "@babel/helpers" "^7.27.4" + "@babel/parser" "^7.27.4" + "@babel/template" "^7.27.2" + "@babel/traverse" "^7.27.4" + "@babel/types" "^7.27.3" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.27.1", "@babel/generator@^7.7.2": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.1.tgz#862d4fad858f7208edd487c28b58144036b76230" - integrity sha512-UnJfnIpc/+JO0/+KRVQNGU+y5taA5vCbwN8+azkX6beii/ZF+enZJSOKo11ZSzGJjlNfJHfQtmQT8H+9TXPG2w== +"@babel/generator@^7.27.3", "@babel/generator@^7.7.2": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.3.tgz#ef1c0f7cfe3b5fc8cbb9f6cc69f93441a68edefc" + integrity sha512-xnlJYj5zepml8NXtjkG0WquFUv8RskFqyFcVgTBp5k+NaA/8uw/K+OSVf8AMGw5e9HKP2ETd5xpK5MLZQD6b4Q== dependencies: - "@babel/parser" "^7.27.1" - "@babel/types" "^7.27.1" + "@babel/parser" "^7.27.3" + "@babel/types" "^7.27.3" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^3.0.2" @@ -73,12 +73,12 @@ dependencies: "@babel/types" "^7.27.1" -"@babel/helper-compilation-targets@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.1.tgz#eac1096c7374f161e4f33fc8ae38f4ddf122087a" - integrity sha512-2YaDd/Rd9E598B5+WIc8wJPmWETiiJXFYVE60oX8FDohv7rAUU3CQj+A1MgeEmcsk2+dQuEjIe/GDvig0SqL4g== +"@babel/helper-compilation-targets@^7.27.2": + version "7.27.2" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz#46a0f6efab808d51d29ce96858dd10ce8732733d" + integrity sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ== dependencies: - "@babel/compat-data" "^7.27.1" + "@babel/compat-data" "^7.27.2" "@babel/helper-validator-option" "^7.27.1" browserslist "^4.24.0" lru-cache "^5.1.1" @@ -92,14 +92,14 @@ "@babel/traverse" "^7.27.1" "@babel/types" "^7.27.1" -"@babel/helper-module-transforms@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.27.1.tgz#e1663b8b71d2de948da5c4fb2a20ca4f3ec27a6f" - integrity sha512-9yHn519/8KvTU5BjTVEEeIM3w9/2yXNKoD82JifINImhpKkARMJKPP59kLo+BafpdN5zgNeIcS4jsGDmd3l58g== +"@babel/helper-module-transforms@^7.27.3": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz#db0bbcfba5802f9ef7870705a7ef8788508ede02" + integrity sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg== dependencies: "@babel/helper-module-imports" "^7.27.1" "@babel/helper-validator-identifier" "^7.27.1" - "@babel/traverse" "^7.27.1" + "@babel/traverse" "^7.27.3" "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.25.9", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": version "7.27.1" @@ -121,20 +121,20 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== -"@babel/helpers@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.27.1.tgz#ffc27013038607cdba3288e692c3611c06a18aa4" - integrity sha512-FCvFTm0sWV8Fxhpp2McP5/W53GPllQ9QeQ7SiqGWjMf/LVG07lFa5+pgK05IRhVwtvafT22KF+ZSnM9I545CvQ== +"@babel/helpers@^7.27.4": + version "7.27.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.27.4.tgz#c79050c6a0e41e095bfc96d469c85431e9ed7fe7" + integrity sha512-Y+bO6U+I7ZKaM5G5rDUZiYfUvQPUibYmAFe7EnKdnKBbVXDZxvp+MWOH5gYciY0EPk4EScsuFMQBbEfpdRKSCQ== dependencies: - "@babel/template" "^7.27.1" - "@babel/types" "^7.27.1" + "@babel/template" "^7.27.2" + "@babel/types" "^7.27.3" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.1", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.1.tgz#c55d5bed74449d1223701f1869b9ee345cc94cc9" - integrity sha512-I0dZ3ZpCrJ1c04OqlNsQcKiZlsrXf/kkE4FXzID9rIOYICsAbA8mMDzhW/luRNAHdCNt7os/u8wenklZDlUVUQ== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.27.3", "@babel/parser@^7.27.4", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": + version "7.27.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.4.tgz#f92e89e4f51847be05427285836fc88341c956df" + integrity sha512-BRmLHGwpUqLFR2jzx9orBuX/ABDkj2jLKOXrHDTN2aOKL+jFDDKaRNo9nyYsIl9h/UE/7lMKdDjKQQyxKKDZ7g== dependencies: - "@babel/types" "^7.27.1" + "@babel/types" "^7.27.3" "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -300,32 +300,32 @@ "@babel/plugin-transform-react-jsx-development" "^7.27.1" "@babel/plugin-transform-react-pure-annotations" "^7.27.1" -"@babel/template@^7.27.1", "@babel/template@^7.3.3": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.1.tgz#b9e4f55c17a92312774dfbdde1b3c01c547bbae2" - integrity sha512-Fyo3ghWMqkHHpHQCoBs2VnYjR4iWFFjguTDEqA5WgZDOrFesVjMhMM2FSqTKSoUSDO1VQtavj8NFpdRBEvJTtg== +"@babel/template@^7.27.2", "@babel/template@^7.3.3": + version "7.27.2" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d" + integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw== dependencies: "@babel/code-frame" "^7.27.1" - "@babel/parser" "^7.27.1" + "@babel/parser" "^7.27.2" "@babel/types" "^7.27.1" -"@babel/traverse@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.1.tgz#4db772902b133bbddd1c4f7a7ee47761c1b9f291" - integrity sha512-ZCYtZciz1IWJB4U61UPu4KEaqyfj+r5T1Q5mqPo+IBpcG9kHv30Z0aD8LXPgC1trYa6rK0orRyAhqUgk4MjmEg== +"@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.27.4": + version "7.27.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.4.tgz#b0045ac7023c8472c3d35effd7cc9ebd638da6ea" + integrity sha512-oNcu2QbHqts9BtOWJosOVJapWjBDSxGCpFvikNR5TGDYDQf3JwpIoMzIKrvfoti93cLfPJEG4tH9SPVeyCGgdA== dependencies: "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.27.1" - "@babel/parser" "^7.27.1" - "@babel/template" "^7.27.1" - "@babel/types" "^7.27.1" + "@babel/generator" "^7.27.3" + "@babel/parser" "^7.27.4" + "@babel/template" "^7.27.2" + "@babel/types" "^7.27.3" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.3.3", "@babel/types@^7.6.1", "@babel/types@^7.9.6": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.1.tgz#9defc53c16fc899e46941fc6901a9eea1c9d8560" - integrity sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.3.3", "@babel/types@^7.6.1", "@babel/types@^7.9.6": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.3.tgz#c0257bedf33aad6aad1f406d35c44758321eb3ec" + integrity sha512-Y1GkI4ktrtvmawoSq+4FCVHNryea6uR+qUQy0AGxLSsjCX0nVmkYQMBLHDkXZuo5hGx7eYdnIaslsdBFm7zbUw== dependencies: "@babel/helper-string-parser" "^7.27.1" "@babel/helper-validator-identifier" "^7.27.1" @@ -777,10 +777,10 @@ 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.4.0", "@eslint-community/eslint-utils@^4.5.0", "@eslint-community/eslint-utils@^4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.5.1.tgz#b0fc7e06d0c94f801537fd4237edc2706d3b8e4c" - integrity sha512-soEIOALTfTK6EjmKMMoLugwaP0rzkad90iIWd1hMO9ARkSAyjfMfkRRhLvD5qH7vvM0Cg72pieUfR6yh6XxC4w== +"@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": + 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== dependencies: eslint-visitor-keys "^3.4.3" @@ -832,10 +832,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.27.0", "@eslint/js@^9.21.0": - version "9.27.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.27.0.tgz#181a23460877c484f6dd03890f4e3fa2fdeb8ff0" - integrity sha512-G5JD9Tu5HJEu4z2Uo4aHY2sLV64B7CDMXxFzqzjl3NKd6RVzSXNoE80jk7Y0lJkTTkjiIhBAqmlYwjuBY3tvpA== +"@eslint/js@9.28.0", "@eslint/js@^9.21.0": + version "9.28.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.28.0.tgz#7822ccc2f8cae7c3cd4f902377d520e9ae03f844" + integrity sha512-fnqSjGWd/CoIp4EXIxWVK/sHA6DOHN4+8Ix2cX5ycOY7LG0UY8nHCU5pIp2eaE1Mc7Qd8kHspYNzYXT2ojPLzg== "@eslint/object-schema@^2.1.6": version "2.1.6" @@ -1239,10 +1239,10 @@ resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.2.tgz#1cf95080bb7072fafaa3cb13b442fab4695c3893" integrity sha512-fdDH1LSGfZdTH2sxdpVMw31BanV28K/Gry0cVFxaNP77neJSkd82mM8ErPNYs9e+0O7SdHBLTDzDgwUuy18RnQ== -"@pkgr/core@^0.2.0": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.1.tgz#6d083acfddae21fb329c8df8c94bf895ce7d0c15" - integrity sha512-VzgHzGblFmUeBmmrk55zPyrQIArQN4vujc9shWytaPdB3P7qhi0cpaiKIr7tlCmFv2lYUwnLospIqjL9ZSAhhg== +"@pkgr/core@^0.2.4": + version "0.2.7" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.7.tgz#eb5014dfd0b03e7f3ba2eeeff506eed89b028058" + integrity sha512-YLT9Zo3oNPJoBjBc4q8G2mjU4tqIbf5CEOORbUUr48dCD9q3umJ3IPlVqOqDakPfd2HuwccBaqlGhN4Gmr5OWg== "@sinclair/typebox@^0.27.8": version "0.27.8" @@ -1264,11 +1264,11 @@ "@sinonjs/commons" "^3.0.0" "@stylistic/eslint-plugin@^4.2.0": - version "4.2.0" - resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-4.2.0.tgz#7860ea84aa7ee3b21757907b863eb62f4f8b0455" - integrity sha512-8hXezgz7jexGHdo5WN6JBEIPHCSFyyU4vgbxevu4YLVS5vl+sxqAAGyXSzfNDyR6xMNSH5H1x67nsXcYMOHtZA== + version "4.4.0" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-4.4.0.tgz#e1a3c9fd7109411d32dc0bcb575d2b4066fbbc63" + integrity sha512-bIh/d9X+OQLCAMdhHtps+frvyjvAM4B1YlSJzcEEhl7wXLIqPar3ngn9DrHhkBOrTA/z9J0bUMtctAspe0dxdQ== dependencies: - "@typescript-eslint/utils" "^8.23.0" + "@typescript-eslint/utils" "^8.32.1" eslint-visitor-keys "^4.2.0" espree "^10.3.0" estraverse "^5.3.0" @@ -1383,9 +1383,9 @@ integrity sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w== "@types/node@*", "@types/node@^22.15.11": - version "22.15.21" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.21.tgz#196ef14fe20d87f7caf1e7b39832767f9a995b77" - integrity sha512-EV/37Td6c+MgKAbkcLG6vqZ2zEYHD7bvSrzqqs2RIhbA6w3x+Dqz8MZM3sP6kGTeLrdoOgKZe+Xja7tUB2DNkQ== + version "22.15.29" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.29.tgz#c75999124a8224a3f79dd8b6ccfb37d74098f678" + integrity sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ== dependencies: undici-types "~6.21.0" @@ -1413,49 +1413,65 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/scope-manager@8.29.0": - version "8.29.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.29.0.tgz#8fd9872823aef65ff71d3f6d1ec9316ace0b6bf3" - integrity sha512-aO1PVsq7Gm+tcghabUpzEnVSFMCU4/nYIgC2GOatJcllvWfnhrgW0ZEbnTxm36QsikmCN1K/6ZgM7fok2I7xNw== +"@typescript-eslint/project-service@8.33.1": + version "8.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/project-service/-/project-service-8.33.1.tgz#c85e7d9a44d6a11fe64e73ac1ed47de55dc2bf9f" + integrity sha512-DZR0efeNklDIHHGRpMpR5gJITQpu6tLr9lDJnKdONTC7vvzOlLAG/wcfxcdxEWrbiZApcoBCzXqU/Z458Za5Iw== dependencies: - "@typescript-eslint/types" "8.29.0" - "@typescript-eslint/visitor-keys" "8.29.0" - -"@typescript-eslint/types@8.29.0": - version "8.29.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.29.0.tgz#65add70ab4ef66beaa42a5addf87dab2b05b1f33" - integrity sha512-wcJL/+cOXV+RE3gjCyl/V2G877+2faqvlgtso/ZRbTCnZazh0gXhe+7gbAnfubzN2bNsBtZjDvlh7ero8uIbzg== + "@typescript-eslint/tsconfig-utils" "^8.33.1" + "@typescript-eslint/types" "^8.33.1" + debug "^4.3.4" -"@typescript-eslint/typescript-estree@8.29.0": - version "8.29.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.29.0.tgz#d201a4f115327ec90496307c9958262285065b00" - integrity sha512-yOfen3jE9ISZR/hHpU/bmNvTtBW1NjRbkSFdZOksL1N+ybPEE7UVGMwqvS6CP022Rp00Sb0tdiIkhSCe6NI8ow== - dependencies: - "@typescript-eslint/types" "8.29.0" - "@typescript-eslint/visitor-keys" "8.29.0" +"@typescript-eslint/scope-manager@8.33.1": + version "8.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.33.1.tgz#d1e0efb296da5097d054bc9972e69878a2afea73" + integrity sha512-dM4UBtgmzHR9bS0Rv09JST0RcHYearoEoo3pG5B6GoTR9XcyeqX87FEhPo+5kTvVfKCvfHaHrcgeJQc6mrDKrA== + dependencies: + "@typescript-eslint/types" "8.33.1" + "@typescript-eslint/visitor-keys" "8.33.1" + +"@typescript-eslint/tsconfig-utils@8.33.1", "@typescript-eslint/tsconfig-utils@^8.33.1": + version "8.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.33.1.tgz#7836afcc097a4657a5ed56670851a450d8b70ab8" + integrity sha512-STAQsGYbHCF0/e+ShUQ4EatXQ7ceh3fBCXkNU7/MZVKulrlq1usH7t2FhxvCpuCi5O5oi1vmVaAjrGeL71OK1g== + +"@typescript-eslint/types@8.33.1", "@typescript-eslint/types@^8.33.1": + version "8.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.33.1.tgz#b693111bc2180f8098b68e9958cf63761657a55f" + integrity sha512-xid1WfizGhy/TKMTwhtVOgalHwPtV8T32MS9MaH50Cwvz6x6YqRIPdD2WvW0XaqOzTV9p5xdLY0h/ZusU5Lokg== + +"@typescript-eslint/typescript-estree@8.33.1": + version "8.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.33.1.tgz#d271beed470bc915b8764e22365d4925c2ea265d" + integrity sha512-+s9LYcT8LWjdYWu7IWs7FvUxpQ/DGkdjZeE/GGulHvv8rvYwQvVaUZ6DE+j5x/prADUgSbbCWZ2nPI3usuVeOA== + dependencies: + "@typescript-eslint/project-service" "8.33.1" + "@typescript-eslint/tsconfig-utils" "8.33.1" + "@typescript-eslint/types" "8.33.1" + "@typescript-eslint/visitor-keys" "8.33.1" debug "^4.3.4" fast-glob "^3.3.2" is-glob "^4.0.3" minimatch "^9.0.4" semver "^7.6.0" - ts-api-utils "^2.0.1" + ts-api-utils "^2.1.0" -"@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/utils@^8.23.0": - version "8.29.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.29.0.tgz#d6d22b19c8c4812a874f00341f686b45b9fe895f" - integrity sha512-gX/A0Mz9Bskm8avSWFcK0gP7cZpbY4AIo6B0hWYFCaIsz750oaiWR4Jr2CI+PQhfW1CpcQr9OlfPS+kMFegjXA== +"@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/utils@^8.26.1", "@typescript-eslint/utils@^8.32.1": + version "8.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.33.1.tgz#ea22f40d3553da090f928cf17907e963643d4b96" + integrity sha512-52HaBiEQUaRYqAXpfzWSR2U3gxk92Kw006+xZpElaPMg3C4PgM+A5LqwoQI1f9E5aZ/qlxAZxzm42WX+vn92SQ== dependencies: - "@eslint-community/eslint-utils" "^4.4.0" - "@typescript-eslint/scope-manager" "8.29.0" - "@typescript-eslint/types" "8.29.0" - "@typescript-eslint/typescript-estree" "8.29.0" + "@eslint-community/eslint-utils" "^4.7.0" + "@typescript-eslint/scope-manager" "8.33.1" + "@typescript-eslint/types" "8.33.1" + "@typescript-eslint/typescript-estree" "8.33.1" -"@typescript-eslint/visitor-keys@8.29.0": - version "8.29.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.29.0.tgz#2356336c9efdc3597ffcd2aa1ce95432852b743d" - integrity sha512-Sne/pVz8ryR03NFK21VpN88dZ2FdQXOlq3VIklbrTYEt8yXtRFr9tvUhqvCeKjqYk5FSim37sHbooT6vzBTZcg== +"@typescript-eslint/visitor-keys@8.33.1": + version "8.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.33.1.tgz#6c6e002c24d13211df3df851767f24dfdb4f42bc" + integrity sha512-3i8NrFcZeeDHJ+7ZUuDkGT+UHq+XoFGsymNK2jZCOHcfEzRQ0BdpRtdpSx/Iyf3MHLWIcLS0COuOPibKQboIiQ== dependencies: - "@typescript-eslint/types" "8.29.0" + "@typescript-eslint/types" "8.33.1" eslint-visitor-keys "^4.2.0" "@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1": @@ -1796,10 +1812,10 @@ asap@~2.0.3: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== -assemblyscript@^0.27.34: - version "0.27.36" - resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.27.36.tgz#5ff7ae6c3047e96b13de32d4dc741f256d33943f" - integrity sha512-1qX2zf6p7l/mNYv8r21jC/Yft7kX7XKR3xUHw41zvV4xad5lyC8w7jZiwZBGoy64VKZLc+bTDJDWi8Kb70YrHA== +assemblyscript@^0.28.1: + version "0.28.1" + resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.28.1.tgz#e459d9d2b29b0b4a1a90ebd59ebddcce01dcedc3" + integrity sha512-CcoEh+cdNaFY9n2hIoM2989H5BqRprS/1xFNXrXRZyfbUD9i/5IkAiL3EKaN2hORfsIilRTtKGx6ghHaiVpPSQ== dependencies: binaryen "116.0.0-nightly.20240114" long "^5.2.4" @@ -1948,12 +1964,12 @@ braces@^3.0.3: fill-range "^7.1.1" browserslist@^4.24.0, browserslist@^4.24.4: - version "4.24.5" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.5.tgz#aa0f5b8560fe81fde84c6dcb38f759bafba0e11b" - integrity sha512-FDToo4Wo82hIdgc1CQ+NQD0hEhmpPjrZ3hiUgwgOG6IuTdlpr8jdjyG24P6cNP1yJpTLzS5OcGgSw0xmDU1/Tw== + version "4.25.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.0.tgz#986aa9c6d87916885da2b50d8eb577ac8d133b2c" + integrity sha512-PJ8gYKeS5e/whHBh8xrwYK+dAvEj7JXtz6uTucnMRB8OiGTsKccFekoRrjajPBHV8oOY+2tI4uxeceSimKwMFA== dependencies: - caniuse-lite "^1.0.30001716" - electron-to-chromium "^1.5.149" + caniuse-lite "^1.0.30001718" + electron-to-chromium "^1.5.160" node-releases "^2.0.19" update-browserslist-db "^1.1.3" @@ -2060,10 +2076,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001716: - version "1.0.30001718" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001718.tgz#dae13a9c80d517c30c6197515a96131c194d8f82" - integrity sha512-AflseV1ahcSunK53NfEs9gFWgOEmzr0f+kaMFA4xiLZlr9Hzt7HxcSpIFcnNCUkz6R6dWKa54rUz3HUmI3nVcw== +caniuse-lite@^1.0.30001718: + version "1.0.30001720" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001720.tgz#c138cb6026d362be9d8d7b0e4bcd0183a850edfd" + integrity sha512-Ec/2yV2nNPwb4DnTANEV99ZWwm3ZWfdlfkQbWSDDt+PsXEVYwlhPH8tdMaPunYTKKmz7AnHi2oNEi1GcmKCD8g== chalk-template@^1.1.0: version "1.1.0" @@ -2270,6 +2286,11 @@ commander@^13.1.0: resolved "https://registry.yarnpkg.com/commander/-/commander-13.1.0.tgz#776167db68c78f38dcce1f9b8d7b8b9a488abf46" integrity sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw== +commander@^14.0.0: + version "14.0.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.0.tgz#f244fc74a92343514e56229f16ef5c5e22ced5e9" + integrity sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA== + commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -2533,10 +2554,10 @@ date-fns@^4.0.0: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-4.1.0.tgz#64b3d83fff5aa80438f5b1a633c2e83b8a1c2d14" integrity sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg== -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5, debug@^4.3.6, debug@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" - integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5, debug@^4.3.6, debug@^4.4.1: + version "4.4.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" + integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== dependencies: ms "^2.1.3" @@ -2619,10 +2640,10 @@ eastasianwidth@^0.2.0: resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -electron-to-chromium@^1.5.149: - version "1.5.155" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.155.tgz#809dd0ae9ae1db87c358e0c0c17c09a2ffc432d1" - integrity sha512-ps5KcGGmwL8VaeJlvlDlu4fORQpv3+GIcF5I3f9tUKUlJ/wsysh6HU8P5L1XWRYeXfA0oJd4PyM8ds8zTFf6Ng== +electron-to-chromium@^1.5.160: + version "1.5.161" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.161.tgz#650376bd3be7ff8e581031409fc2d4f150620b12" + integrity sha512-hwtetwfKNZo/UlwHIVBlKZVdy7o8bIZxxKs0Mv/ROPiQQQmDgdm5a+KvKtBsxM8ZjFzTaCeLoodZ8jiBE3o9rA== emittery@^0.13.1: version "0.13.1" @@ -2836,9 +2857,9 @@ eslint-plugin-es-x@^7.8.0: eslint-compat-utils "^0.5.1" eslint-plugin-jest@^28.6.0: - version "28.11.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-28.11.0.tgz#2641ecb4411941bbddb3d7cf8a8ff1163fbb510e" - integrity sha512-QAfipLcNCWLVocVbZW8GimKn5p5iiMcgGbRzz8z/P5q7xw+cNEpYqyzFMtIF/ZgF2HLOyy+dYBut+DoYolvqig== + version "28.12.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-28.12.0.tgz#cf0200ae1421acffe7f263d1eaf65912eb9addd9" + integrity sha512-J6zmDp8WiQ9tyvYXE+3RFy7/+l4hraWLzmsabYXyehkmmDd36qV4VQFc7XzcsD8C1PTNt646MSx25bO1mdd9Yw== dependencies: "@typescript-eslint/utils" "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -2860,11 +2881,12 @@ eslint-plugin-jsdoc@^50.6.3: synckit "^0.9.1" eslint-plugin-n@^17.16.2: - version "17.18.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-17.18.0.tgz#8515979b49ef8db7bb16e457b8ed22cc695d2a84" - integrity sha512-hvZ/HusueqTJ7VDLoCpjN0hx4N4+jHIWTXD4TMLHy9F23XkDagR9v+xQWRWR57yY55GPF8NnD4ox9iGTxirY8A== + version "17.19.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-17.19.0.tgz#3c198306c2eb9ea950c7458cff9c9a6426d02c58" + integrity sha512-qxn1NaDHtizbhVAPpbMT8wWFaLtPnwhfN/e+chdu2i6Vgzmo/tGM62tcJ1Hf7J5Ie4dhse3DOPMmDxduzfifzw== dependencies: "@eslint-community/eslint-utils" "^4.5.0" + "@typescript-eslint/utils" "^8.26.1" enhanced-resolve "^5.17.1" eslint-plugin-es-x "^7.8.0" get-tsconfig "^4.8.1" @@ -2872,14 +2894,15 @@ eslint-plugin-n@^17.16.2: ignore "^5.3.2" minimatch "^9.0.5" semver "^7.6.3" + ts-declaration-location "^1.0.6" eslint-plugin-prettier@^5.1.3: - version "5.4.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.4.0.tgz#54d4748904e58eaf1ffe26c4bffa4986ca7f952b" - integrity sha512-BvQOvUhkVQM1i63iMETK9Hjud9QhqBnbtT1Zc642p9ynzBuCe5pybkOnvqZIBypXmMlsGcnU4HZ8sCTPfpAexA== + version "5.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.4.1.tgz#99b55d7dd70047886b2222fdd853665f180b36af" + integrity sha512-9dF+KuU/Ilkq27A8idRP7N2DH8iUR6qXcjF3FR2wETY21PZdBrIjwCau8oboyGj9b7etWmTGEeM8e7oOed6ZWg== dependencies: prettier-linter-helpers "^1.0.0" - synckit "^0.11.0" + synckit "^0.11.7" eslint-plugin-unicorn@^59.0.0: version "59.0.1" @@ -2931,9 +2954,9 @@ eslint-visitor-keys@^4.2.0: integrity sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw== eslint@^9.21.0: - version "9.27.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.27.0.tgz#a587d3cd5b844b68df7898944323a702afe38979" - integrity sha512-ixRawFQuMB9DZ7fjU3iGGganFDp3+45bPOdaRurcFHSXO1e/sYwUX/FtQZpLZJR6SjMoJH8hR2pPEAfDyCoU2Q== + version "9.28.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.28.0.tgz#b0bcbe82a16945a40906924bea75e8b4980ced7d" + integrity sha512-ocgh41VhRlf9+fVpe7QKzwLj9c92fDiqOj8Y3Sd4/ZmVA4Btx4PlUYPq4pp9JDyupkf1upbEXecxL2mwNV7jPQ== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.12.1" @@ -2941,7 +2964,7 @@ eslint@^9.21.0: "@eslint/config-helpers" "^0.2.1" "@eslint/core" "^0.14.0" "@eslint/eslintrc" "^3.3.1" - "@eslint/js" "9.27.0" + "@eslint/js" "9.28.0" "@eslint/plugin-kit" "^0.3.1" "@humanfs/node" "^0.16.6" "@humanwhocodes/module-importer" "^1.0.1" @@ -3500,9 +3523,9 @@ globals@^15.11.0: integrity sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg== globals@^16.0.0: - version "16.1.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-16.1.0.tgz#ee6ab147d41c64e9f2beaaaf66572d18df8e1e60" - integrity sha512-aibexHNbb/jiUSObBgpHLj+sIuUmJnYcgXBlrfsiDZ9rt4aF2TFRbyLgZ2iFQuVZ1K5Mx3FVkbKRSgKrbK3K2g== + version "16.2.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-16.2.0.tgz#19efcd1ddde2bd5efce128e5c2e441df1abc6f7c" + integrity sha512-O+7l9tPdHCU320IigZZPj5zmRCFG9xHmx9cU8FqU2Rp+JN714seHV+2S9+JslCpY4gJwU2vOGox0wzgae/MCEg== gopd@^1.2.0: version "1.2.0" @@ -4538,20 +4561,20 @@ lines-and-columns@^1.1.6: integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== lint-staged@^16.0.0: - version "16.0.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-16.0.0.tgz#31826709bde6a62542431da3055f038e386a20db" - integrity sha512-sUCprePs6/rbx4vKC60Hez6X10HPkpDJaGcy3D1NdwR7g1RcNkWL8q9mJMreOqmHBTs+1sNFp+wOiX9fr+hoOQ== + version "16.1.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-16.1.0.tgz#06807ef3dbbade9e4e3416897aac0ac5b99a2377" + integrity sha512-HkpQh69XHxgCjObjejBT3s2ILwNjFx8M3nw+tJ/ssBauDlIpkx2RpqWSi1fBgkXLSSXnbR3iEq1NkVtpvV+FLQ== dependencies: chalk "^5.4.1" - commander "^13.1.0" - debug "^4.4.0" + commander "^14.0.0" + debug "^4.4.1" lilconfig "^3.1.3" listr2 "^8.3.3" micromatch "^4.0.8" - nano-spawn "^1.0.0" + nano-spawn "^1.0.2" pidtree "^0.6.0" string-argv "^0.3.2" - yaml "^2.7.1" + yaml "^2.8.0" listr2@^8.3.3: version "8.3.3" @@ -4922,10 +4945,10 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nano-spawn@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/nano-spawn/-/nano-spawn-1.0.1.tgz#c8e4c1e133e567e3efba44041dcfb12113d861b6" - integrity sha512-BfcvzBlUTxSDWfT+oH7vd6CbUV+rThLLHCIym/QO6GGLBsyVXleZs00fto2i2jzC/wPiBYk5jyOmpXWg4YopiA== +nano-spawn@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/nano-spawn/-/nano-spawn-1.0.2.tgz#9853795681f0e96ef6f39104c2e4347b6ba79bf6" + integrity sha512-21t+ozMQDAL/UGgQVBbZ/xXvNO10++ZPuTmKRO8k9V3AClVRht49ahtDjfY8l1q6nSHOrE5ASfthzH3ol6R/hg== nanoid@^3.3.8: version "3.3.11" @@ -6195,13 +6218,12 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -synckit@^0.11.0: - version "0.11.2" - resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.2.tgz#2a8015ce5df8d5eb0cc47ee55924ad8f8756c24b" - integrity sha512-1IUffI8zZ8qUMB3NUJIjk0RpLroG/8NkQDAWH1NbB2iJ0/5pn3M8rxfNzMz4GH9OnYaGYn31LEDSXJp/qIlxgA== +synckit@^0.11.7: + version "0.11.8" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.8.tgz#b2aaae998a4ef47ded60773ad06e7cb821f55457" + integrity sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A== dependencies: - "@pkgr/core" "^0.2.0" - tslib "^2.8.1" + "@pkgr/core" "^0.2.4" synckit@^0.9.1: version "0.9.2" @@ -6255,9 +6277,9 @@ terser-webpack-plugin@^5.3.11: terser "^5.31.1" terser@^5.31.1, terser@^5.32.0, terser@^5.38.1: - version "5.39.2" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.39.2.tgz#5a1626030724a672e2e5b5c9cd9070308c20e8f9" - integrity sha512-yEPUmWve+VA78bI71BW70Dh0TuV4HHd+I5SHOAfS1+QBOmvmCiiffgjR8ryyEd3KIfvPGFqoADt8LdQ6XpXIvg== + version "5.40.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.40.0.tgz#839a80db42bfee8340085f44ea99b5cba36c55c8" + integrity sha512-cfeKl/jjwSR5ar7d0FGmave9hFGJT8obyo0z+CrQOylLDbk7X81nPU6vq9VORa5jU30SkDnT2FXjLbR8HLP+xA== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.14.0" @@ -6292,10 +6314,10 @@ thingies@^1.20.0: resolved "https://registry.yarnpkg.com/thingies/-/thingies-1.21.0.tgz#e80fbe58fd6fdaaab8fad9b67bd0a5c943c445c1" integrity sha512-hsqsJsFMsV+aD4s3CWKk85ep/3I9XzYV/IXaSouJMYIoDlgyi11cBhsqYe9/geRfB0YIikBQg6raRaM+nIMP9g== -three@^0.176.0: - version "0.176.0" - resolved "https://registry.yarnpkg.com/three/-/three-0.176.0.tgz#a30c1974e46db5745e4f96dd9ee2028d71e16ecf" - integrity sha512-PWRKYWQo23ojf9oZSlRGH8K09q7nRSWx6LY/HF/UUrMdYgN9i1e2OwJYHoQjwc6HF/4lvvYLC5YC1X8UJL2ZpA== +three@^0.177.0: + version "0.177.0" + resolved "https://registry.yarnpkg.com/three/-/three-0.177.0.tgz#e51f2eb2b921fbab535bdfa81c403f9993b9dd83" + integrity sha512-EiXv5/qWAaGI+Vz2A+JfavwYCMdGjxVsrn3oBwllUoqYeaBO75J63ZfyaQKoiLrqNHoTlUc6PFgMXnS0kI45zg== timers-ext@^0.1.7: version "0.1.8" @@ -6365,11 +6387,18 @@ tree-dump@^1.0.1: resolved "https://registry.yarnpkg.com/tree-dump/-/tree-dump-1.0.2.tgz#c460d5921caeb197bde71d0e9a7b479848c5b8ac" integrity sha512-dpev9ABuLWdEubk+cIaI9cHwRNNDjkBBLXTwI4UCUFdQ5xXKqNXoK4FEciw/vxf+NQ7Cb7sGUyeUtORvHIdRXQ== -ts-api-utils@^2.0.1: +ts-api-utils@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-2.1.0.tgz#595f7094e46eed364c13fd23e75f9513d29baf91" integrity sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ== +ts-declaration-location@^1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/ts-declaration-location/-/ts-declaration-location-1.0.7.tgz#d4068fe9975828b3b453b3ab112b4711d8267688" + integrity sha512-EDyGAwH1gO0Ausm9gV6T2nUvBgXT5kGoCMJPllOaooZ+4VvJiKBdZE7wK18N1deEowhcUptS+5GXZK8U/fvpwA== + dependencies: + picomatch "^4.0.2" + ts-loader@^9.5.1: version "9.5.2" resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.2.tgz#1f3d7f4bb709b487aaa260e8f19b301635d08020" @@ -6381,7 +6410,7 @@ ts-loader@^9.5.1: semver "^7.3.4" source-map "^0.7.4" -tslib@^2.0.0, tslib@^2.3.0, tslib@^2.5.0, tslib@^2.6.2, tslib@^2.8.1: +tslib@^2.0.0, tslib@^2.3.0, tslib@^2.5.0, tslib@^2.6.2: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== @@ -6762,7 +6791,7 @@ yallist@^5.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-5.0.0.tgz#00e2de443639ed0d78fd87de0d27469fbcffb533" integrity sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw== -yaml@^2.7.1: +yaml@^2.7.1, yaml@^2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.8.0.tgz#15f8c9866211bdc2d3781a0890e44d4fa1a5fff6" integrity sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ== From 19ca74127f7668aaf60d59f4af8fcaee7924541a Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Tue, 3 Jun 2025 21:20:37 +0300 Subject: [PATCH 16/56] refactor: plugin name (#19580) --- lib/DelegatedModuleFactoryPlugin.js | 35 +- lib/EvalSourceMapDevToolPlugin.js | 2 +- lib/ExternalModuleFactoryPlugin.js | 4 +- lib/SourceMapDevToolModuleOptionsPlugin.js | 40 +-- lib/WarnDeprecatedOptionPlugin.js | 15 +- lib/asset/AssetModulesPlugin.js | 20 +- lib/cache/AddBuildDependenciesPlugin.js | 11 +- .../AMDDefineDependencyParserPlugin.js | 7 +- ...AMDRequireDependenciesBlockParserPlugin.js | 7 +- .../CommonJsExportsParserPlugin.js | 46 ++- .../CommonJsImportsParserPlugin.js | 211 +++++------ .../HarmonyExportDependencyParserPlugin.js | 190 +++++----- .../HarmonyImportDependencyParserPlugin.js | 292 ++++++++-------- .../RequireIncludeDependencyParserPlugin.js | 67 ++-- lib/esm/ModuleChunkFormatPlugin.js | 328 ++++++++---------- lib/ids/DeterministicChunkIdsPlugin.js | 61 ++-- .../ArrayPushCallbackChunkFormatPlugin.js | 229 ++++++------ lib/javascript/CommonJsChunkFormatPlugin.js | 253 +++++++------- lib/optimize/AggressiveMergingPlugin.js | 91 +++-- lib/optimize/EnsureChunkConditionsPlugin.js | 115 +++--- lib/optimize/MergeDuplicateChunksPlugin.js | 157 ++++----- lib/rules/BasicEffectRulePlugin.js | 4 +- lib/rules/BasicMatcherRulePlugin.js | 4 +- lib/rules/ObjectMatcherRulePlugin.js | 4 +- lib/rules/UseEffectRulePlugin.js | 4 +- .../AsyncWebAssemblyModulesPlugin.js | 95 +++-- 26 files changed, 1091 insertions(+), 1201 deletions(-) diff --git a/lib/DelegatedModuleFactoryPlugin.js b/lib/DelegatedModuleFactoryPlugin.js index 3e9df64415a..ea9ae3ac0fc 100644 --- a/lib/DelegatedModuleFactoryPlugin.js +++ b/lib/DelegatedModuleFactoryPlugin.js @@ -25,6 +25,8 @@ const DelegatedModule = require("./DelegatedModule"); * @property {AssociatedObjectForCache=} associatedObjectForCache object for caching */ +const PLUGIN_NAME = "DelegatedModuleFactoryPlugin"; + class DelegatedModuleFactoryPlugin { /** * @param {Options} options options @@ -43,7 +45,7 @@ class DelegatedModuleFactoryPlugin { const scope = this.options.scope; if (scope) { normalModuleFactory.hooks.factorize.tapAsync( - "DelegatedModuleFactoryPlugin", + PLUGIN_NAME, (data, callback) => { const [dependency] = data.dependencies; const { request } = dependency; @@ -90,24 +92,21 @@ class DelegatedModuleFactoryPlugin { } ); } else { - normalModuleFactory.hooks.module.tap( - "DelegatedModuleFactoryPlugin", - module => { - const request = module.libIdent(this.options); - if (request && request in this.options.content) { - const resolved = this.options.content[request]; - return new DelegatedModule( - this.options.source, - resolved, - /** @type {DelegatedModuleType} */ - (this.options.type), - request, - module - ); - } - return 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]; + return new DelegatedModule( + this.options.source, + resolved, + /** @type {DelegatedModuleType} */ + (this.options.type), + request, + module + ); } - ); + return module; + }); } } } diff --git a/lib/EvalSourceMapDevToolPlugin.js b/lib/EvalSourceMapDevToolPlugin.js index e43f0fdec0d..3f2a71bd681 100644 --- a/lib/EvalSourceMapDevToolPlugin.js +++ b/lib/EvalSourceMapDevToolPlugin.js @@ -200,7 +200,7 @@ class EvalSourceMapDevToolPlugin { } ); hooks.inlineInRuntimeBailout.tap( - "EvalDevToolModulePlugin", + PLUGIN_NAME, () => "the eval-source-map devtool is used." ); hooks.render.tap( diff --git a/lib/ExternalModuleFactoryPlugin.js b/lib/ExternalModuleFactoryPlugin.js index c5c4f3fb2d5..5fbf114ddde 100644 --- a/lib/ExternalModuleFactoryPlugin.js +++ b/lib/ExternalModuleFactoryPlugin.js @@ -75,6 +75,8 @@ const resolveLayer = (obj, layer) => { /** @typedef {string | string[] | boolean | Record} ExternalValue */ /** @typedef {string | undefined} ExternalType */ +const PLUGIN_NAME = "ExternalModuleFactoryPlugin"; + class ExternalModuleFactoryPlugin { /** * @param {string | undefined} type default external type @@ -92,7 +94,7 @@ class ExternalModuleFactoryPlugin { apply(normalModuleFactory) { const globalType = this.type; normalModuleFactory.hooks.factorize.tapAsync( - "ExternalModuleFactoryPlugin", + PLUGIN_NAME, (data, callback) => { const context = data.context; const contextInfo = data.contextInfo; diff --git a/lib/SourceMapDevToolModuleOptionsPlugin.js b/lib/SourceMapDevToolModuleOptionsPlugin.js index e7d722e12a8..ae62b0379aa 100644 --- a/lib/SourceMapDevToolModuleOptionsPlugin.js +++ b/lib/SourceMapDevToolModuleOptionsPlugin.js @@ -10,6 +10,8 @@ const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin"); /** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ /** @typedef {import("./Compilation")} Compilation */ +const PLUGIN_NAME = "SourceMapDevToolModuleOptionsPlugin"; + class SourceMapDevToolModuleOptionsPlugin { /** * @param {SourceMapDevToolPluginOptions} options options @@ -25,34 +27,22 @@ class SourceMapDevToolModuleOptionsPlugin { apply(compilation) { const options = this.options; if (options.module !== false) { - compilation.hooks.buildModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSourceMap = true; - } - ); - compilation.hooks.runtimeModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSourceMap = true; - } - ); + compilation.hooks.buildModule.tap(PLUGIN_NAME, module => { + module.useSourceMap = true; + }); + compilation.hooks.runtimeModule.tap(PLUGIN_NAME, module => { + module.useSourceMap = true; + }); } else { - compilation.hooks.buildModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSimpleSourceMap = true; - } - ); - compilation.hooks.runtimeModule.tap( - "SourceMapDevToolModuleOptionsPlugin", - module => { - module.useSimpleSourceMap = true; - } - ); + compilation.hooks.buildModule.tap(PLUGIN_NAME, module => { + module.useSimpleSourceMap = true; + }); + compilation.hooks.runtimeModule.tap(PLUGIN_NAME, module => { + module.useSimpleSourceMap = true; + }); } JavascriptModulesPlugin.getCompilationHooks(compilation).useSourceMap.tap( - "SourceMapDevToolModuleOptionsPlugin", + PLUGIN_NAME, () => true ); } diff --git a/lib/WarnDeprecatedOptionPlugin.js b/lib/WarnDeprecatedOptionPlugin.js index 8cad0869908..96183768788 100644 --- a/lib/WarnDeprecatedOptionPlugin.js +++ b/lib/WarnDeprecatedOptionPlugin.js @@ -9,6 +9,8 @@ const WebpackError = require("./WebpackError"); /** @typedef {import("./Compiler")} Compiler */ +const PLUGIN_NAME = "WarnDeprecatedOptionPlugin"; + class WarnDeprecatedOptionPlugin { /** * Create an instance of the plugin @@ -28,14 +30,11 @@ class WarnDeprecatedOptionPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "WarnDeprecatedOptionPlugin", - compilation => { - compilation.warnings.push( - new DeprecatedOptionWarning(this.option, this.value, this.suggestion) - ); - } - ); + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compilation.warnings.push( + new DeprecatedOptionWarning(this.option, this.value, this.suggestion) + ); + }); } } diff --git a/lib/asset/AssetModulesPlugin.js b/lib/asset/AssetModulesPlugin.js index 42c0e236155..4cb5948e6d8 100644 --- a/lib/asset/AssetModulesPlugin.js +++ b/lib/asset/AssetModulesPlugin.js @@ -77,7 +77,7 @@ const getAssetSourceGenerator = memoize(() => ); const type = ASSET_MODULE_TYPE; -const plugin = "AssetModulesPlugin"; +const PLUGIN_NAME = "AssetModulesPlugin"; class AssetModulesPlugin { /** @@ -87,11 +87,11 @@ class AssetModulesPlugin { */ apply(compiler) { compiler.hooks.compilation.tap( - plugin, + PLUGIN_NAME, (compilation, { normalModuleFactory }) => { normalModuleFactory.hooks.createParser .for(ASSET_MODULE_TYPE) - .tap(plugin, parserOptions => { + .tap(PLUGIN_NAME, parserOptions => { validateParserOptions(parserOptions); parserOptions = cleverMerge( /** @type {AssetParserOptions} */ @@ -113,21 +113,21 @@ class AssetModulesPlugin { }); normalModuleFactory.hooks.createParser .for(ASSET_MODULE_TYPE_INLINE) - .tap(plugin, _parserOptions => { + .tap(PLUGIN_NAME, _parserOptions => { const AssetParser = getAssetParser(); return new AssetParser(true); }); normalModuleFactory.hooks.createParser .for(ASSET_MODULE_TYPE_RESOURCE) - .tap(plugin, _parserOptions => { + .tap(PLUGIN_NAME, _parserOptions => { const AssetParser = getAssetParser(); return new AssetParser(false); }); normalModuleFactory.hooks.createParser .for(ASSET_MODULE_TYPE_SOURCE) - .tap(plugin, _parserOptions => { + .tap(PLUGIN_NAME, _parserOptions => { const AssetSourceParser = getAssetSourceParser(); return new AssetSourceParser(); @@ -140,7 +140,7 @@ class AssetModulesPlugin { ]) { normalModuleFactory.hooks.createGenerator .for(type) - .tap(plugin, generatorOptions => { + .tap(PLUGIN_NAME, generatorOptions => { validateGeneratorOptions[type](generatorOptions); let dataUrl; @@ -178,13 +178,13 @@ class AssetModulesPlugin { } normalModuleFactory.hooks.createGenerator .for(ASSET_MODULE_TYPE_SOURCE) - .tap(plugin, () => { + .tap(PLUGIN_NAME, () => { const AssetSourceGenerator = getAssetSourceGenerator(); return new AssetSourceGenerator(compilation.moduleGraph); }); - compilation.hooks.renderManifest.tap(plugin, (result, options) => { + compilation.hooks.renderManifest.tap(PLUGIN_NAME, (result, options) => { const { chunkGraph } = compilation; const { chunk, codeGenerationResults, runtimeTemplate } = options; @@ -270,7 +270,7 @@ class AssetModulesPlugin { }); compilation.hooks.prepareModuleExecution.tap( - "AssetModulesPlugin", + PLUGIN_NAME, (options, context) => { const { codeGenerationResult } = options; const source = codeGenerationResult.sources.get(ASSET_MODULE_TYPE); diff --git a/lib/cache/AddBuildDependenciesPlugin.js b/lib/cache/AddBuildDependenciesPlugin.js index f2283ffcc0d..7d8b1d0775b 100644 --- a/lib/cache/AddBuildDependenciesPlugin.js +++ b/lib/cache/AddBuildDependenciesPlugin.js @@ -7,6 +7,8 @@ /** @typedef {import("../Compiler")} Compiler */ +const PLUGIN_NAME = "AddBuildDependenciesPlugin"; + class AddBuildDependenciesPlugin { /** * @param {Iterable} buildDependencies list of build dependencies @@ -21,12 +23,9 @@ class AddBuildDependenciesPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap( - "AddBuildDependenciesPlugin", - compilation => { - compilation.buildDependencies.addAll(this.buildDependencies); - } - ); + compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compilation.buildDependencies.addAll(this.buildDependencies); + }); } } diff --git a/lib/dependencies/AMDDefineDependencyParserPlugin.js b/lib/dependencies/AMDDefineDependencyParserPlugin.js index f509d05c7c0..964c9b7e795 100644 --- a/lib/dependencies/AMDDefineDependencyParserPlugin.js +++ b/lib/dependencies/AMDDefineDependencyParserPlugin.js @@ -68,6 +68,8 @@ const isCallable = expr => { return false; }; +const PLUGIN_NAME = "AMDDefineDependencyParserPlugin"; + class AMDDefineDependencyParserPlugin { /** * @param {JavascriptParserOptions} options parserOptions @@ -83,10 +85,7 @@ class AMDDefineDependencyParserPlugin { apply(parser) { parser.hooks.call .for("define") - .tap( - "AMDDefineDependencyParserPlugin", - this.processCallDefine.bind(this, parser) - ); + .tap(PLUGIN_NAME, this.processCallDefine.bind(this, parser)); } /** diff --git a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js index 1ee651cd8c3..9ef26dfaa80 100644 --- a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +++ b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js @@ -31,6 +31,8 @@ const getFunctionExpression = require("./getFunctionExpression"); /** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ /** @typedef {import("../javascript/JavascriptParser").Range} Range */ +const PLUGIN_NAME = "AMDRequireDependenciesBlockParserPlugin"; + class AMDRequireDependenciesBlockParserPlugin { /** * @param {JavascriptParserOptions} options parserOptions @@ -80,10 +82,7 @@ class AMDRequireDependenciesBlockParserPlugin { apply(parser) { parser.hooks.call .for("require") - .tap( - "AMDRequireDependenciesBlockParserPlugin", - this.processCallRequire.bind(this, parser) - ); + .tap(PLUGIN_NAME, this.processCallRequire.bind(this, parser)); } /** diff --git a/lib/dependencies/CommonJsExportsParserPlugin.js b/lib/dependencies/CommonJsExportsParserPlugin.js index 60f506edea7..e65b66595f4 100644 --- a/lib/dependencies/CommonJsExportsParserPlugin.js +++ b/lib/dependencies/CommonJsExportsParserPlugin.js @@ -125,6 +125,8 @@ const parseRequireCall = (parser, expr) => { return { argument: argValue, ids: ids.reverse() }; }; +const PLUGIN_NAME = "CommonJsExportsParserPlugin"; + class CommonJsExportsParserPlugin { /** * @param {ModuleGraph} moduleGraph module graph @@ -177,10 +179,10 @@ class CommonJsExportsParserPlugin { // metadata // parser.hooks.evaluateTypeof .for("module") - .tap("CommonJsExportsParserPlugin", evaluateToString("object")); + .tap(PLUGIN_NAME, evaluateToString("object")); parser.hooks.evaluateTypeof .for("exports") - .tap("CommonJsPlugin", evaluateToString("object")); + .tap(PLUGIN_NAME, evaluateToString("object")); // exporting // @@ -239,24 +241,24 @@ class CommonJsExportsParserPlugin { }; parser.hooks.assignMemberChain .for("exports") - .tap("CommonJsExportsParserPlugin", (expr, members) => + .tap(PLUGIN_NAME, (expr, members) => handleAssignExport(expr, "exports", members) ); parser.hooks.assignMemberChain .for("this") - .tap("CommonJsExportsParserPlugin", (expr, members) => { + .tap(PLUGIN_NAME, (expr, members) => { if (!parser.scope.topLevelScope) return; return handleAssignExport(expr, "this", members); }); parser.hooks.assignMemberChain .for("module") - .tap("CommonJsExportsParserPlugin", (expr, members) => { + .tap(PLUGIN_NAME, (expr, members) => { if (members[0] !== "exports") return; return handleAssignExport(expr, "module.exports", members.slice(1)); }); parser.hooks.call .for("Object.defineProperty") - .tap("CommonJsExportsParserPlugin", expression => { + .tap(PLUGIN_NAME, expression => { const expr = /** @type {CallExpression} */ (expression); if (!parser.isStatementLevelExpression(expr)) return; if (expr.arguments.length !== 3) return; @@ -338,22 +340,20 @@ class CommonJsExportsParserPlugin { }; parser.hooks.callMemberChain .for("exports") - .tap("CommonJsExportsParserPlugin", (expr, members) => + .tap(PLUGIN_NAME, (expr, members) => handleAccessExport(expr.callee, "exports", members, expr) ); parser.hooks.expressionMemberChain .for("exports") - .tap("CommonJsExportsParserPlugin", (expr, members) => + .tap(PLUGIN_NAME, (expr, members) => handleAccessExport(expr, "exports", members) ); parser.hooks.expression .for("exports") - .tap("CommonJsExportsParserPlugin", expr => - handleAccessExport(expr, "exports", []) - ); + .tap(PLUGIN_NAME, expr => handleAccessExport(expr, "exports", [])); parser.hooks.callMemberChain .for("module") - .tap("CommonJsExportsParserPlugin", (expr, members) => { + .tap(PLUGIN_NAME, (expr, members) => { if (members[0] !== "exports") return; return handleAccessExport( expr.callee, @@ -364,36 +364,32 @@ class CommonJsExportsParserPlugin { }); parser.hooks.expressionMemberChain .for("module") - .tap("CommonJsExportsParserPlugin", (expr, members) => { + .tap(PLUGIN_NAME, (expr, members) => { if (members[0] !== "exports") return; return handleAccessExport(expr, "module.exports", members.slice(1)); }); parser.hooks.expression .for("module.exports") - .tap("CommonJsExportsParserPlugin", expr => - handleAccessExport(expr, "module.exports", []) - ); + .tap(PLUGIN_NAME, expr => handleAccessExport(expr, "module.exports", [])); parser.hooks.callMemberChain .for("this") - .tap("CommonJsExportsParserPlugin", (expr, members) => { + .tap(PLUGIN_NAME, (expr, members) => { if (!parser.scope.topLevelScope) return; return handleAccessExport(expr.callee, "this", members, expr); }); parser.hooks.expressionMemberChain .for("this") - .tap("CommonJsExportsParserPlugin", (expr, members) => { + .tap(PLUGIN_NAME, (expr, members) => { if (!parser.scope.topLevelScope) return; return handleAccessExport(expr, "this", members); }); - parser.hooks.expression - .for("this") - .tap("CommonJsExportsParserPlugin", expr => { - if (!parser.scope.topLevelScope) return; - return handleAccessExport(expr, "this", []); - }); + 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("CommonJsPlugin", 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 f5ff981e7a6..23705746716 100644 --- a/lib/dependencies/CommonJsImportsParserPlugin.js +++ b/lib/dependencies/CommonJsImportsParserPlugin.js @@ -42,6 +42,8 @@ const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency const createRequireSpecifierTag = Symbol("createRequire"); const createdRequireIdentifierTag = Symbol("createRequire()"); +const PLUGIN_NAME = "CommonJsImportsParserPlugin"; + class CommonJsImportsParserPlugin { /** * @param {JavascriptParserOptions} options parser options @@ -73,16 +75,16 @@ class CommonJsImportsParserPlugin { parser.hooks.typeof .for(expression) .tap( - "CommonJsImportsParserPlugin", + PLUGIN_NAME, toConstantDependency(parser, JSON.stringify("function")) ); parser.hooks.evaluateTypeof .for(expression) - .tap("CommonJsImportsParserPlugin", evaluateToString("function")); + .tap(PLUGIN_NAME, evaluateToString("function")); parser.hooks.evaluateIdentifier .for(expression) .tap( - "CommonJsImportsParserPlugin", + PLUGIN_NAME, evaluateToIdentifier(expression, "require", getMembers, true) ); }; @@ -93,12 +95,12 @@ class CommonJsImportsParserPlugin { parser.hooks.typeof .for(tag) .tap( - "CommonJsImportsParserPlugin", + PLUGIN_NAME, toConstantDependency(parser, JSON.stringify("function")) ); parser.hooks.evaluateTypeof .for(tag) - .tap("CommonJsImportsParserPlugin", evaluateToString("function")); + .tap(PLUGIN_NAME, evaluateToString("function")); }; tapRequireExpression("require", () => []); tapRequireExpression("require.resolve", () => ["resolve"]); @@ -106,21 +108,19 @@ class CommonJsImportsParserPlugin { // #endregion // Weird stuff // - parser.hooks.assign - .for("require") - .tap("CommonJsImportsParserPlugin", 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); - parser.state.module.addPresentationalDependency(dep); - return true; - }); + 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); + parser.state.module.addPresentationalDependency(dep); + return true; + }); // #region Unsupported parser.hooks.expression .for("require.main") .tap( - "CommonJsImportsParserPlugin", + PLUGIN_NAME, expressionIsUnsupported( parser, "require.main is not supported by webpack." @@ -129,7 +129,7 @@ class CommonJsImportsParserPlugin { parser.hooks.call .for("require.main.require") .tap( - "CommonJsImportsParserPlugin", + PLUGIN_NAME, expressionIsUnsupported( parser, "require.main.require is not supported by webpack." @@ -138,7 +138,7 @@ class CommonJsImportsParserPlugin { parser.hooks.expression .for("module.parent.require") .tap( - "CommonJsImportsParserPlugin", + PLUGIN_NAME, expressionIsUnsupported( parser, "module.parent.require is not supported by webpack." @@ -147,7 +147,7 @@ class CommonJsImportsParserPlugin { parser.hooks.call .for("module.parent.require") .tap( - "CommonJsImportsParserPlugin", + PLUGIN_NAME, expressionIsUnsupported( parser, "module.parent.require is not supported by webpack." @@ -170,12 +170,8 @@ class CommonJsImportsParserPlugin { parser.state.module.addPresentationalDependency(dep); return false; }; - parser.hooks.canRename - .for("require") - .tap("CommonJsImportsParserPlugin", () => true); - parser.hooks.rename - .for("require") - .tap("CommonJsImportsParserPlugin", defineUndefined); + parser.hooks.canRename.for("require").tap(PLUGIN_NAME, () => true); + parser.hooks.rename.for("require").tap(PLUGIN_NAME, defineUndefined); // #endregion // #region Inspection @@ -189,9 +185,7 @@ class CommonJsImportsParserPlugin { ] ); - parser.hooks.expression - .for("require.cache") - .tap("CommonJsImportsParserPlugin", requireCache); + parser.hooks.expression.for("require.cache").tap(PLUGIN_NAME, requireCache); // #endregion // #region Require as expression @@ -222,7 +216,7 @@ class CommonJsImportsParserPlugin { }; parser.hooks.expression .for("require") - .tap("CommonJsImportsParserPlugin", requireAsExpressionHandler); + .tap(PLUGIN_NAME, requireAsExpressionHandler); // #endregion // #region Require @@ -357,16 +351,16 @@ class CommonJsImportsParserPlugin { }; parser.hooks.call .for("require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); + .tap(PLUGIN_NAME, createRequireHandler(false)); parser.hooks.new .for("require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); + .tap(PLUGIN_NAME, createRequireHandler(true)); parser.hooks.call .for("module.require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); + .tap(PLUGIN_NAME, createRequireHandler(false)); parser.hooks.new .for("module.require") - .tap("CommonJsImportsParserPlugin", createRequireHandler(true)); + .tap(PLUGIN_NAME, createRequireHandler(true)); // #endregion // #region Require with property access @@ -446,16 +440,16 @@ class CommonJsImportsParserPlugin { }; parser.hooks.memberChainOfCallMemberChain .for("require") - .tap("CommonJsImportsParserPlugin", chainHandler); + .tap(PLUGIN_NAME, chainHandler); parser.hooks.memberChainOfCallMemberChain .for("module.require") - .tap("CommonJsImportsParserPlugin", chainHandler); + .tap(PLUGIN_NAME, chainHandler); parser.hooks.callMemberChainOfCallMemberChain .for("require") - .tap("CommonJsImportsParserPlugin", callChainHandler); + .tap(PLUGIN_NAME, callChainHandler); parser.hooks.callMemberChainOfCallMemberChain .for("module.require") - .tap("CommonJsImportsParserPlugin", callChainHandler); + .tap(PLUGIN_NAME, callChainHandler); // #endregion // #region Require.resolve @@ -573,10 +567,10 @@ class CommonJsImportsParserPlugin { parser.hooks.call .for("require.resolve") - .tap("CommonJsImportsParserPlugin", expr => processResolve(expr, false)); + .tap(PLUGIN_NAME, expr => processResolve(expr, false)); parser.hooks.call .for("require.resolveWeak") - .tap("CommonJsImportsParserPlugin", expr => processResolve(expr, true)); + .tap(PLUGIN_NAME, expr => processResolve(expr, true)); // #endregion // #region Create require @@ -613,7 +607,7 @@ class CommonJsImportsParserPlugin { tapRequireExpressionTag(createRequireSpecifierTag); parser.hooks.evaluateCallExpression .for(createRequireSpecifierTag) - .tap("CommonJsImportsParserPlugin", expr => { + .tap(PLUGIN_NAME, expr => { const context = parseCreateRequireArguments(expr); if (context === undefined) return; const ident = parser.evaluatedVariable({ @@ -629,7 +623,7 @@ class CommonJsImportsParserPlugin { }); parser.hooks.unhandledExpressionMemberChain .for(createdRequireIdentifierTag) - .tap("CommonJsImportsParserPlugin", (expr, members) => + .tap(PLUGIN_NAME, (expr, members) => expressionIsUnsupported( parser, `createRequire().${members.join(".")} is not supported by webpack.` @@ -637,19 +631,19 @@ class CommonJsImportsParserPlugin { ); parser.hooks.canRename .for(createdRequireIdentifierTag) - .tap("CommonJsImportsParserPlugin", () => true); + .tap(PLUGIN_NAME, () => true); parser.hooks.canRename .for(createRequireSpecifierTag) - .tap("CommonJsImportsParserPlugin", () => true); + .tap(PLUGIN_NAME, () => true); parser.hooks.rename .for(createRequireSpecifierTag) - .tap("CommonJsImportsParserPlugin", defineUndefined); + .tap(PLUGIN_NAME, defineUndefined); parser.hooks.expression .for(createdRequireIdentifierTag) - .tap("CommonJsImportsParserPlugin", requireAsExpressionHandler); + .tap(PLUGIN_NAME, requireAsExpressionHandler); parser.hooks.call .for(createdRequireIdentifierTag) - .tap("CommonJsImportsParserPlugin", createRequireHandler(false)); + .tap(PLUGIN_NAME, createRequireHandler(false)); /** * @param {CallExpression} expr call expression * @returns {string | void} context @@ -683,7 +677,7 @@ class CommonJsImportsParserPlugin { parser.hooks.import.tap( { - name: "CommonJsImportsParserPlugin", + name: PLUGIN_NAME, stage: -10 }, (statement, source) => { @@ -711,7 +705,7 @@ class CommonJsImportsParserPlugin { ); parser.hooks.importSpecifier.tap( { - name: "CommonJsImportsParserPlugin", + name: PLUGIN_NAME, stage: -10 }, (statement, source, id, name) => { @@ -720,70 +714,59 @@ class CommonJsImportsParserPlugin { return true; } ); - parser.hooks.preDeclarator.tap( - "CommonJsImportsParserPlugin", - declarator => { - if ( - declarator.id.type !== "Identifier" || - !declarator.init || - declarator.init.type !== "CallExpression" || - declarator.init.callee.type !== "Identifier" - ) - return; - const variableInfo = parser.getVariableInfo( - declarator.init.callee.name - ); - if ( - variableInfo instanceof VariableInfo && - variableInfo.tagInfo && - variableInfo.tagInfo.tag === createRequireSpecifierTag - ) { - const context = parseCreateRequireArguments(declarator.init); - if (context === undefined) return; - parser.tagVariable(declarator.id.name, createdRequireIdentifierTag, { - name: declarator.id.name, - context - }); - return true; - } + parser.hooks.preDeclarator.tap(PLUGIN_NAME, declarator => { + if ( + declarator.id.type !== "Identifier" || + !declarator.init || + declarator.init.type !== "CallExpression" || + declarator.init.callee.type !== "Identifier" + ) + return; + const variableInfo = parser.getVariableInfo(declarator.init.callee.name); + if ( + variableInfo instanceof VariableInfo && + variableInfo.tagInfo && + variableInfo.tagInfo.tag === createRequireSpecifierTag + ) { + const context = parseCreateRequireArguments(declarator.init); + if (context === undefined) return; + parser.tagVariable(declarator.id.name, createdRequireIdentifierTag, { + name: declarator.id.name, + context + }); + return true; } - ); + }); parser.hooks.memberChainOfCallMemberChain .for(createRequireSpecifierTag) - .tap( - "CommonJsImportsParserPlugin", - (expr, calleeMembers, callExpr, members) => { - if ( - calleeMembers.length !== 0 || - members.length !== 1 || - members[0] !== "cache" - ) - return; - // createRequire().cache - const context = parseCreateRequireArguments(callExpr); - if (context === undefined) return; - return requireCache(expr); - } - ); + .tap(PLUGIN_NAME, (expr, calleeMembers, callExpr, members) => { + if ( + calleeMembers.length !== 0 || + members.length !== 1 || + members[0] !== "cache" + ) + return; + // createRequire().cache + const context = parseCreateRequireArguments(callExpr); + if (context === undefined) return; + return requireCache(expr); + }); parser.hooks.callMemberChainOfCallMemberChain .for(createRequireSpecifierTag) - .tap( - "CommonJsImportsParserPlugin", - (expr, calleeMembers, innerCallExpression, members) => { - if ( - calleeMembers.length !== 0 || - members.length !== 1 || - members[0] !== "resolve" - ) - return; - // createRequire().resolve() - return processResolve(expr, false); - } - ); + .tap(PLUGIN_NAME, (expr, calleeMembers, innerCallExpression, members) => { + if ( + calleeMembers.length !== 0 || + members.length !== 1 || + members[0] !== "resolve" + ) + return; + // createRequire().resolve() + return processResolve(expr, false); + }); parser.hooks.expressionMemberChain .for(createdRequireIdentifierTag) - .tap("CommonJsImportsParserPlugin", (expr, members) => { + .tap(PLUGIN_NAME, (expr, members) => { // require.cache if (members.length === 1 && members[0] === "cache") { return requireCache(expr); @@ -791,23 +774,21 @@ class CommonJsImportsParserPlugin { }); parser.hooks.callMemberChain .for(createdRequireIdentifierTag) - .tap("CommonJsImportsParserPlugin", (expr, members) => { + .tap(PLUGIN_NAME, (expr, members) => { // require.resolve() if (members.length === 1 && members[0] === "resolve") { return processResolve(expr, false); } }); - parser.hooks.call - .for(createRequireSpecifierTag) - .tap("CommonJsImportsParserPlugin", 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/HarmonyExportDependencyParserPlugin.js b/lib/dependencies/HarmonyExportDependencyParserPlugin.js index 65b4ec26b9c..37d62d1c428 100644 --- a/lib/dependencies/HarmonyExportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyExportDependencyParserPlugin.js @@ -26,6 +26,8 @@ const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDepe const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency; +const PLUGIN_NAME = "HarmonyExportDependencyParserPlugin"; + module.exports = class HarmonyExportDependencyParserPlugin { /** * @param {import("../../declarations/WebpackOptions").JavascriptParserOptions} options options @@ -47,107 +49,97 @@ module.exports = class HarmonyExportDependencyParserPlugin { */ apply(parser) { const { exportPresenceMode } = this; - parser.hooks.export.tap( - "HarmonyExportDependencyParserPlugin", - statement => { - const dep = new HarmonyExportHeaderDependency( - /** @type {Range | false} */ ( - statement.declaration && statement.declaration.range - ), - /** @type {Range} */ (statement.range) - ); - dep.loc = Object.create( - /** @type {DependencyLocation} */ (statement.loc) - ); - dep.loc.index = -1; - parser.state.module.addPresentationalDependency(dep); - return true; - } - ); - parser.hooks.exportImport.tap( - "HarmonyExportDependencyParserPlugin", - (statement, source) => { - parser.state.lastHarmonyImportOrder = - (parser.state.lastHarmonyImportOrder || 0) + 1; - const clearDep = new ConstDependency( - "", - /** @type {Range} */ (statement.range) - ); - clearDep.loc = /** @type {DependencyLocation} */ (statement.loc); - clearDep.loc.index = -1; - parser.state.module.addPresentationalDependency(clearDep); - const sideEffectDep = new HarmonyImportSideEffectDependency( - /** @type {string} */ (source), - parser.state.lastHarmonyImportOrder, - getImportAttributes(statement) - ); - sideEffectDep.loc = Object.create( - /** @type {DependencyLocation} */ (statement.loc) - ); - sideEffectDep.loc.index = -1; - parser.state.current.addDependency(sideEffectDep); - return true; - } - ); - parser.hooks.exportExpression.tap( - "HarmonyExportDependencyParserPlugin", - (statement, node) => { - const isFunctionDeclaration = node.type === "FunctionDeclaration"; - const exprRange = /** @type {Range} */ (node.range); - const statementRange = /** @type {Range} */ (statement.range); - const comments = parser.getComments([statementRange[0], exprRange[0]]); - const dep = new HarmonyExportExpressionDependency( - exprRange, - statementRange, - comments - .map(c => { - switch (c.type) { - case "Block": - return `/*${c.value}*/`; - case "Line": - return `//${c.value}\n`; + parser.hooks.export.tap(PLUGIN_NAME, statement => { + const dep = new HarmonyExportHeaderDependency( + /** @type {Range | false} */ ( + statement.declaration && statement.declaration.range + ), + /** @type {Range} */ (statement.range) + ); + dep.loc = Object.create( + /** @type {DependencyLocation} */ (statement.loc) + ); + dep.loc.index = -1; + parser.state.module.addPresentationalDependency(dep); + return true; + }); + parser.hooks.exportImport.tap(PLUGIN_NAME, (statement, source) => { + parser.state.lastHarmonyImportOrder = + (parser.state.lastHarmonyImportOrder || 0) + 1; + const clearDep = new ConstDependency( + "", + /** @type {Range} */ (statement.range) + ); + clearDep.loc = /** @type {DependencyLocation} */ (statement.loc); + clearDep.loc.index = -1; + parser.state.module.addPresentationalDependency(clearDep); + const sideEffectDep = new HarmonyImportSideEffectDependency( + /** @type {string} */ (source), + parser.state.lastHarmonyImportOrder, + getImportAttributes(statement) + ); + sideEffectDep.loc = Object.create( + /** @type {DependencyLocation} */ (statement.loc) + ); + sideEffectDep.loc.index = -1; + parser.state.current.addDependency(sideEffectDep); + return true; + }); + parser.hooks.exportExpression.tap(PLUGIN_NAME, (statement, node) => { + const isFunctionDeclaration = node.type === "FunctionDeclaration"; + const exprRange = /** @type {Range} */ (node.range); + const statementRange = /** @type {Range} */ (statement.range); + const comments = parser.getComments([statementRange[0], exprRange[0]]); + const dep = new HarmonyExportExpressionDependency( + exprRange, + statementRange, + comments + .map(c => { + switch (c.type) { + case "Block": + return `/*${c.value}*/`; + case "Line": + return `//${c.value}\n`; + } + return ""; + }) + .join(""), + node.type.endsWith("Declaration") && + /** @type {FunctionDeclaration | ClassDeclaration} */ (node).id + ? /** @type {FunctionDeclaration | ClassDeclaration} */ + (node).id.name + : isFunctionDeclaration + ? { + range: [ + exprRange[0], + node.params.length > 0 + ? /** @type {Range} */ (node.params[0].range)[0] + : /** @type {Range} */ (node.body.range)[0] + ], + prefix: `${node.async ? "async " : ""}function${ + node.generator ? "*" : "" + } `, + suffix: `(${node.params.length > 0 ? "" : ") "}` } - return ""; - }) - .join(""), - node.type.endsWith("Declaration") && + : undefined + ); + dep.loc = Object.create( + /** @type {DependencyLocation} */ (statement.loc) + ); + dep.loc.index = -1; + parser.state.current.addDependency(dep); + InnerGraph.addVariableUsage( + parser, + node.type.endsWith("Declaration") && /** @type {FunctionDeclaration | ClassDeclaration} */ (node).id - ? /** @type {FunctionDeclaration | ClassDeclaration} */ - (node).id.name - : isFunctionDeclaration - ? { - range: [ - exprRange[0], - node.params.length > 0 - ? /** @type {Range} */ (node.params[0].range)[0] - : /** @type {Range} */ (node.body.range)[0] - ], - prefix: `${node.async ? "async " : ""}function${ - node.generator ? "*" : "" - } `, - suffix: `(${node.params.length > 0 ? "" : ") "}` - } - : undefined - ); - dep.loc = Object.create( - /** @type {DependencyLocation} */ (statement.loc) - ); - dep.loc.index = -1; - parser.state.current.addDependency(dep); - InnerGraph.addVariableUsage( - parser, - node.type.endsWith("Declaration") && - /** @type {FunctionDeclaration | ClassDeclaration} */ (node).id - ? /** @type {FunctionDeclaration | ClassDeclaration} */ (node).id - .name - : "*default*", - "default" - ); - return true; - } - ); + ? /** @type {FunctionDeclaration | ClassDeclaration} */ (node).id.name + : "*default*", + "default" + ); + return true; + }); parser.hooks.exportSpecifier.tap( - "HarmonyExportDependencyParserPlugin", + PLUGIN_NAME, (statement, id, name, idx) => { const settings = parser.getTagData(id, harmonySpecifierTag); const harmonyNamedExports = (parser.state.harmonyNamedExports = @@ -183,7 +175,7 @@ module.exports = class HarmonyExportDependencyParserPlugin { } ); parser.hooks.exportImportSpecifier.tap( - "HarmonyExportDependencyParserPlugin", + PLUGIN_NAME, (statement, source, id, name, idx) => { const harmonyNamedExports = (parser.state.harmonyNamedExports = parser.state.harmonyNamedExports || new Set()); diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index 48df8dafe3e..c0b6f29335e 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -51,6 +51,8 @@ const harmonySpecifierTag = Symbol("harmony import"); * @property {ImportAttributes=} attributes */ +const PLUGIN_NAME = "HarmonyImportDependencyParserPlugin"; + module.exports = class HarmonyImportDependencyParserPlugin { /** * @param {JavascriptParserOptions} options options @@ -95,44 +97,39 @@ module.exports = class HarmonyImportDependencyParserPlugin { return node; } - parser.hooks.isPure - .for("Identifier") - .tap("HarmonyImportDependencyParserPlugin", expression => { - const expr = /** @type {Identifier} */ (expression); - if ( - parser.isVariableDefined(expr.name) || - parser.getTagData(expr.name, harmonySpecifierTag) - ) { - return true; - } - }); - parser.hooks.import.tap( - "HarmonyImportDependencyParserPlugin", - (statement, source) => { - parser.state.lastHarmonyImportOrder = - (parser.state.lastHarmonyImportOrder || 0) + 1; - const clearDep = new ConstDependency( - parser.isAsiPosition(/** @type {Range} */ (statement.range)[0]) - ? ";" - : "", - /** @type {Range} */ (statement.range) - ); - clearDep.loc = /** @type {DependencyLocation} */ (statement.loc); - parser.state.module.addPresentationalDependency(clearDep); - parser.unsetAsiPosition(/** @type {Range} */ (statement.range)[1]); - const attributes = getImportAttributes(statement); - const sideEffectDep = new HarmonyImportSideEffectDependency( - /** @type {string} */ (source), - parser.state.lastHarmonyImportOrder, - attributes - ); - sideEffectDep.loc = /** @type {DependencyLocation} */ (statement.loc); - parser.state.module.addDependency(sideEffectDep); + parser.hooks.isPure.for("Identifier").tap(PLUGIN_NAME, expression => { + const expr = /** @type {Identifier} */ (expression); + if ( + parser.isVariableDefined(expr.name) || + parser.getTagData(expr.name, harmonySpecifierTag) + ) { return true; } - ); + }); + parser.hooks.import.tap(PLUGIN_NAME, (statement, source) => { + parser.state.lastHarmonyImportOrder = + (parser.state.lastHarmonyImportOrder || 0) + 1; + const clearDep = new ConstDependency( + parser.isAsiPosition(/** @type {Range} */ (statement.range)[0]) + ? ";" + : "", + /** @type {Range} */ (statement.range) + ); + clearDep.loc = /** @type {DependencyLocation} */ (statement.loc); + parser.state.module.addPresentationalDependency(clearDep); + parser.unsetAsiPosition(/** @type {Range} */ (statement.range)[1]); + const attributes = getImportAttributes(statement); + const sideEffectDep = new HarmonyImportSideEffectDependency( + /** @type {string} */ (source), + parser.state.lastHarmonyImportOrder, + attributes + ); + sideEffectDep.loc = /** @type {DependencyLocation} */ (statement.loc); + parser.state.module.addDependency(sideEffectDep); + return true; + }); parser.hooks.importSpecifier.tap( - "HarmonyImportDependencyParserPlugin", + PLUGIN_NAME, (statement, source, id, name) => { const ids = id === null ? [] : [id]; parser.tagVariable(name, harmonySpecifierTag, { @@ -145,82 +142,75 @@ module.exports = class HarmonyImportDependencyParserPlugin { return true; } ); - parser.hooks.binaryExpression.tap( - "HarmonyImportDependencyParserPlugin", - expression => { - if (expression.operator !== "in") return; + parser.hooks.binaryExpression.tap(PLUGIN_NAME, expression => { + if (expression.operator !== "in") return; - const leftPartEvaluated = parser.evaluateExpression(expression.left); - if (leftPartEvaluated.couldHaveSideEffects()) return; - const leftPart = leftPartEvaluated.asString(); - if (!leftPart) return; + const leftPartEvaluated = parser.evaluateExpression(expression.left); + if (leftPartEvaluated.couldHaveSideEffects()) return; + const leftPart = leftPartEvaluated.asString(); + if (!leftPart) return; - const rightPart = parser.evaluateExpression(expression.right); - if (!rightPart.isIdentifier()) return; + const rightPart = parser.evaluateExpression(expression.right); + if (!rightPart.isIdentifier()) return; - const rootInfo = rightPart.rootInfo; - if ( - typeof rootInfo === "string" || - !rootInfo || - !rootInfo.tagInfo || - rootInfo.tagInfo.tag !== harmonySpecifierTag - ) - return; - const settings = /** @type {TagData} */ (rootInfo.tagInfo.data); - const members = - /** @type {(() => string[])} */ - (rightPart.getMembers)(); - const dep = new HarmonyEvaluatedImportSpecifierDependency( - settings.source, - settings.sourceOrder, - settings.ids.concat(members).concat([leftPart]), - settings.name, - /** @type {Range} */ (expression.range), - settings.attributes, - "in" - ); - dep.directImport = members.length === 0; - dep.asiSafe = !parser.isAsiPosition( - /** @type {Range} */ (expression.range)[0] - ); - 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("HarmonyImportDependencyParserPlugin", 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, - [] - ); - 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; - }); + const rootInfo = rightPart.rootInfo; + if ( + typeof rootInfo === "string" || + !rootInfo || + !rootInfo.tagInfo || + rootInfo.tagInfo.tag !== harmonySpecifierTag + ) + return; + const settings = /** @type {TagData} */ (rootInfo.tagInfo.data); + const members = + /** @type {(() => string[])} */ + (rightPart.getMembers)(); + const dep = new HarmonyEvaluatedImportSpecifierDependency( + settings.source, + settings.sourceOrder, + settings.ids.concat(members).concat([leftPart]), + settings.name, + /** @type {Range} */ (expression.range), + settings.attributes, + "in" + ); + dep.directImport = members.length === 0; + dep.asiSafe = !parser.isAsiPosition( + /** @type {Range} */ (expression.range)[0] + ); + 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, + [] + ); + 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( - "HarmonyImportDependencyParserPlugin", + PLUGIN_NAME, (expression, members, membersOptionals, memberRanges) => { const settings = /** @type {HarmonySettings} */ @@ -268,7 +258,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { parser.hooks.callMemberChain .for(harmonySpecifierTag) .tap( - "HarmonyImportDependencyParserPlugin", + PLUGIN_NAME, (expression, members, membersOptionals, memberRanges) => { const { arguments: args } = expression; const callee = /** @type {MemberExpression} */ (expression.callee); @@ -320,56 +310,50 @@ module.exports = class HarmonyImportDependencyParserPlugin { ); const { hotAcceptCallback, hotAcceptWithoutCallback } = HotModuleReplacementPlugin.getParserHooks(parser); - hotAcceptCallback.tap( - "HarmonyImportDependencyParserPlugin", - (expr, requests) => { - if (!HarmonyExports.isEnabled(parser.state)) { - // This is not a harmony module, skip it - return; - } - const dependencies = requests.map(request => { - const dep = new HarmonyAcceptImportDependency(request); - dep.loc = /** @type {DependencyLocation} */ (expr.loc); - parser.state.module.addDependency(dep); - return dep; - }); - if (dependencies.length > 0) { - const dep = new HarmonyAcceptDependency( - /** @type {Range} */ - (expr.range), - dependencies, - true - ); - dep.loc = /** @type {DependencyLocation} */ (expr.loc); - parser.state.module.addDependency(dep); - } + hotAcceptCallback.tap(PLUGIN_NAME, (expr, requests) => { + if (!HarmonyExports.isEnabled(parser.state)) { + // This is not a harmony module, skip it + return; } - ); - hotAcceptWithoutCallback.tap( - "HarmonyImportDependencyParserPlugin", - (expr, requests) => { - if (!HarmonyExports.isEnabled(parser.state)) { - // This is not a harmony module, skip it - return; - } - const dependencies = requests.map(request => { - const dep = new HarmonyAcceptImportDependency(request); - dep.loc = /** @type {DependencyLocation} */ (expr.loc); - parser.state.module.addDependency(dep); - return dep; - }); - if (dependencies.length > 0) { - const dep = new HarmonyAcceptDependency( - /** @type {Range} */ - (expr.range), - dependencies, - false - ); - dep.loc = /** @type {DependencyLocation} */ (expr.loc); - parser.state.module.addDependency(dep); - } + const dependencies = requests.map(request => { + const dep = new HarmonyAcceptImportDependency(request); + dep.loc = /** @type {DependencyLocation} */ (expr.loc); + parser.state.module.addDependency(dep); + return dep; + }); + if (dependencies.length > 0) { + const dep = new HarmonyAcceptDependency( + /** @type {Range} */ + (expr.range), + dependencies, + true + ); + dep.loc = /** @type {DependencyLocation} */ (expr.loc); + parser.state.module.addDependency(dep); } - ); + }); + hotAcceptWithoutCallback.tap(PLUGIN_NAME, (expr, requests) => { + if (!HarmonyExports.isEnabled(parser.state)) { + // This is not a harmony module, skip it + return; + } + const dependencies = requests.map(request => { + const dep = new HarmonyAcceptImportDependency(request); + dep.loc = /** @type {DependencyLocation} */ (expr.loc); + parser.state.module.addDependency(dep); + return dep; + }); + if (dependencies.length > 0) { + const dep = new HarmonyAcceptDependency( + /** @type {Range} */ + (expr.range), + dependencies, + false + ); + dep.loc = /** @type {DependencyLocation} */ (expr.loc); + parser.state.module.addDependency(dep); + } + }); } }; diff --git a/lib/dependencies/RequireIncludeDependencyParserPlugin.js b/lib/dependencies/RequireIncludeDependencyParserPlugin.js index 7b9de2c9324..ede50250dff 100644 --- a/lib/dependencies/RequireIncludeDependencyParserPlugin.js +++ b/lib/dependencies/RequireIncludeDependencyParserPlugin.js @@ -17,6 +17,8 @@ const RequireIncludeDependency = require("./RequireIncludeDependency"); /** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ /** @typedef {import("../javascript/JavascriptParser").Range} Range */ +const PLUGIN_NAME = "RequireIncludeDependencyParserPlugin"; + module.exports = class RequireIncludeDependencyParserPlugin { /** * @param {boolean} warn true: warn about deprecation, false: don't warn @@ -31,32 +33,31 @@ module.exports = class RequireIncludeDependencyParserPlugin { */ apply(parser) { const { warn } = this; - parser.hooks.call - .for("require.include") - .tap("RequireIncludeDependencyParserPlugin", expr => { - if (expr.arguments.length !== 1) return; - const param = parser.evaluateExpression(expr.arguments[0]); - if (!param.isString()) return; + 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; - if (warn) { - parser.state.module.addWarning( - new RequireIncludeDeprecationWarning( - /** @type {DependencyLocation} */ (expr.loc) - ) - ); - } - - const dep = new RequireIncludeDependency( - /** @type {string} */ (param.string), - /** @type {Range} */ (expr.range) + if (warn) { + parser.state.module.addWarning( + new RequireIncludeDeprecationWarning( + /** @type {DependencyLocation} */ + (expr.loc) + ) ); - dep.loc = /** @type {DependencyLocation} */ (expr.loc); - parser.state.current.addDependency(dep); - return true; - }); + } + + const dep = new RequireIncludeDependency( + /** @type {string} */ (param.string), + /** @type {Range} */ (expr.range) + ); + dep.loc = /** @type {DependencyLocation} */ (expr.loc); + parser.state.current.addDependency(dep); + return true; + }); parser.hooks.evaluateTypeof .for("require.include") - .tap("RequireIncludePlugin", expr => { + .tap(PLUGIN_NAME, expr => { if (warn) { parser.state.module.addWarning( new RequireIncludeDeprecationWarning( @@ -66,18 +67,16 @@ module.exports = class RequireIncludeDependencyParserPlugin { } return evaluateToString("function")(expr); }); - parser.hooks.typeof - .for("require.include") - .tap("RequireIncludePlugin", expr => { - if (warn) { - parser.state.module.addWarning( - new RequireIncludeDeprecationWarning( - /** @type {DependencyLocation} */ (expr.loc) - ) - ); - } - return toConstantDependency(parser, JSON.stringify("function"))(expr); - }); + parser.hooks.typeof.for("require.include").tap(PLUGIN_NAME, expr => { + if (warn) { + parser.state.module.addWarning( + new RequireIncludeDeprecationWarning( + /** @type {DependencyLocation} */ (expr.loc) + ) + ); + } + return toConstantDependency(parser, JSON.stringify("function"))(expr); + }); } }; diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index ba95c578fab..af49333d578 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -47,6 +47,8 @@ function getChunkInfo(chunk, chunkGraph) { }; } +const PLUGIN_NAME = "ModuleChunkFormatPlugin"; + class ModuleChunkFormatPlugin { /** * Apply the plugin @@ -54,193 +56,171 @@ class ModuleChunkFormatPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ModuleChunkFormatPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "ModuleChunkFormatPlugin", - (chunk, set) => { - if (chunk.hasRuntime()) return; - if (compilation.chunkGraph.getNumberOfEntryModules(chunk) > 0) { - set.add(RuntimeGlobals.require); - set.add(RuntimeGlobals.startupEntrypoint); - set.add(RuntimeGlobals.externalInstallChunk); - } + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + PLUGIN_NAME, + (chunk, set) => { + if (chunk.hasRuntime()) return; + if (compilation.chunkGraph.getNumberOfEntryModules(chunk) > 0) { + set.add(RuntimeGlobals.require); + set.add(RuntimeGlobals.startupEntrypoint); + set.add(RuntimeGlobals.externalInstallChunk); } - ); - const hooks = getCompilationHooks(compilation); - hooks.renderChunk.tap( - "ModuleChunkFormatPlugin", - (modules, renderContext) => { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; - const hotUpdateChunk = - chunk instanceof HotUpdateChunk ? chunk : null; - const source = new ConcatSource(); - if (hotUpdateChunk) { - throw new Error( - "HMR is not implemented for module chunk format yet" - ); - } else { - source.add( - `export const __webpack_id__ = ${JSON.stringify(chunk.id)};\n` - ); - source.add( - `export const __webpack_ids__ = ${JSON.stringify(chunk.ids)};\n` - ); - source.add("export const __webpack_modules__ = "); - source.add(modules); - source.add(";\n"); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (runtimeModules.length > 0) { - source.add("export const __webpack_runtime__ =\n"); - source.add( - Template.renderChunkRuntimeModules( - runtimeModules, - renderContext - ) - ); + } + ); + const hooks = getCompilationHooks(compilation); + hooks.renderChunk.tap(PLUGIN_NAME, (modules, renderContext) => { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + const hotUpdateChunk = chunk instanceof HotUpdateChunk ? chunk : null; + const source = new ConcatSource(); + if (hotUpdateChunk) { + throw new Error("HMR is not implemented for module chunk format yet"); + } else { + source.add( + `export const __webpack_id__ = ${JSON.stringify(chunk.id)};\n` + ); + source.add( + `export const __webpack_ids__ = ${JSON.stringify(chunk.ids)};\n` + ); + source.add("export const __webpack_modules__ = "); + source.add(modules); + source.add(";\n"); + const runtimeModules = + chunkGraph.getChunkRuntimeModulesInOrder(chunk); + if (runtimeModules.length > 0) { + source.add("export const __webpack_runtime__ =\n"); + source.add( + Template.renderChunkRuntimeModules(runtimeModules, renderContext) + ); + } + const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); + if (runtimeChunk) { + const currentOutputName = compilation + .getPath( + getChunkFilenameTemplate(chunk, compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ) + .replace(/^\/+/g, "") + .split("/"); + + /** + * @param {Chunk} chunk the chunk + * @returns {string} the relative path + */ + const getRelativePath = chunk => { + const baseOutputName = currentOutputName.slice(); + const chunkOutputName = compilation + .getPath( + getChunkFilenameTemplate(chunk, compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ) + .replace(/^\/+/g, "") + .split("/"); + + // remove common parts except filename + while ( + baseOutputName.length > 1 && + chunkOutputName.length > 1 && + baseOutputName[0] === chunkOutputName[0] + ) { + baseOutputName.shift(); + chunkOutputName.shift(); } - const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); - if (runtimeChunk) { - const currentOutputName = compilation - .getPath( - getChunkFilenameTemplate(chunk, compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ) - .replace(/^\/+/g, "") - .split("/"); + const last = chunkOutputName.join("/"); + // create final path + return getUndoPath(baseOutputName.join("/"), last, true) + last; + }; - /** - * @param {Chunk} chunk the chunk - * @returns {string} the relative path - */ - const getRelativePath = chunk => { - const baseOutputName = currentOutputName.slice(); - const chunkOutputName = compilation - .getPath( - getChunkFilenameTemplate( - chunk, - compilation.outputOptions - ), - { - chunk, - contentHashType: "javascript" - } - ) - .replace(/^\/+/g, "") - .split("/"); + const entrySource = new ConcatSource(); + entrySource.add(source); + entrySource.add(";\n\n// load runtime\n"); + entrySource.add( + `import ${RuntimeGlobals.require} from ${JSON.stringify( + getRelativePath(/** @type {Chunk} */ (runtimeChunk)) + )};\n` + ); - // remove common parts except filename - while ( - baseOutputName.length > 1 && - chunkOutputName.length > 1 && - baseOutputName[0] === chunkOutputName[0] - ) { - baseOutputName.shift(); - chunkOutputName.shift(); - } - const last = chunkOutputName.join("/"); - // create final path - return ( - getUndoPath(baseOutputName.join("/"), last, true) + last - ); - }; + const startupSource = new ConcatSource(); + startupSource.add( + `var __webpack_exec__ = ${runtimeTemplate.returningFunction( + `${RuntimeGlobals.require}(${RuntimeGlobals.entryModuleId} = moduleId)`, + "moduleId" + )}\n` + ); - const entrySource = new ConcatSource(); - entrySource.add(source); - entrySource.add(";\n\n// load runtime\n"); - entrySource.add( - `import ${RuntimeGlobals.require} from ${JSON.stringify( - getRelativePath(/** @type {Chunk} */ (runtimeChunk)) + const loadedChunks = new Set(); + let index = 0; + for (let i = 0; i < entries.length; i++) { + const [module, entrypoint] = entries[i]; + if (!chunkGraph.getModuleSourceTypes(module).has("javascript")) { + continue; + } + const final = i + 1 === entries.length; + const moduleId = chunkGraph.getModuleId(module); + const chunks = getAllChunks( + /** @type {Entrypoint} */ (entrypoint), + /** @type {Chunk} */ (runtimeChunk), + undefined + ); + for (const chunk of chunks) { + if (loadedChunks.has(chunk) || !chunkHasJs(chunk, chunkGraph)) + continue; + loadedChunks.add(chunk); + startupSource.add( + `import * as __webpack_chunk_${index}__ from ${JSON.stringify( + getRelativePath(chunk) )};\n` ); - - const startupSource = new ConcatSource(); startupSource.add( - `var __webpack_exec__ = ${runtimeTemplate.returningFunction( - `${RuntimeGlobals.require}(${RuntimeGlobals.entryModuleId} = moduleId)`, - "moduleId" - )}\n` + `${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n` ); - - const loadedChunks = new Set(); - let index = 0; - for (let i = 0; i < entries.length; i++) { - const [module, entrypoint] = entries[i]; - if ( - !chunkGraph.getModuleSourceTypes(module).has("javascript") - ) { - continue; - } - const final = i + 1 === entries.length; - const moduleId = chunkGraph.getModuleId(module); - const chunks = getAllChunks( - /** @type {Entrypoint} */ (entrypoint), - /** @type {Chunk} */ (runtimeChunk), - undefined - ); - for (const chunk of chunks) { - if ( - loadedChunks.has(chunk) || - !chunkHasJs(chunk, chunkGraph) - ) - continue; - loadedChunks.add(chunk); - startupSource.add( - `import * as __webpack_chunk_${index}__ from ${JSON.stringify( - getRelativePath(chunk) - )};\n` - ); - startupSource.add( - `${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n` - ); - index++; - } - startupSource.add( - `${ - final ? `var ${RuntimeGlobals.exports} = ` : "" - }__webpack_exec__(${JSON.stringify(moduleId)});\n` - ); - } - - entrySource.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) - ); - return entrySource; + index++; } + startupSource.add( + `${ + final ? `var ${RuntimeGlobals.exports} = ` : "" + }__webpack_exec__(${JSON.stringify(moduleId)});\n` + ); } - return source; + + entrySource.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false + } + ) + ); + return entrySource; } - ); - hooks.chunkHash.tap( - "ModuleChunkFormatPlugin", - (chunk, hash, { chunkGraph, runtimeTemplate }) => { - if (chunk.hasRuntime()) return; - const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); - hash.update("ModuleChunkFormatPlugin"); - hash.update("1"); - if (runtimeChunk && runtimeChunk.hash) { - // Any change to runtimeChunk should trigger a hash update, - // we shouldn't depend on or inspect its internal implementation. - // import __webpack_require__ from "./runtime-main.e9400aee33633a3973bd.js"; - hash.update(runtimeChunk.hash); - } - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + } + return source; + }); + hooks.chunkHash.tap( + PLUGIN_NAME, + (chunk, hash, { chunkGraph, runtimeTemplate }) => { + if (chunk.hasRuntime()) return; + const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); + hash.update(PLUGIN_NAME); + hash.update("1"); + if (runtimeChunk && runtimeChunk.hash) { + // Any change to runtimeChunk should trigger a hash update, + // we shouldn't depend on or inspect its internal implementation. + // import __webpack_require__ from "./runtime-main.e9400aee33633a3973bd.js"; + hash.update(runtimeChunk.hash); } - ); - } - ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + } + ); + }); } } diff --git a/lib/ids/DeterministicChunkIdsPlugin.js b/lib/ids/DeterministicChunkIdsPlugin.js index ab3f821cd1f..2bfdbab76f5 100644 --- a/lib/ids/DeterministicChunkIdsPlugin.js +++ b/lib/ids/DeterministicChunkIdsPlugin.js @@ -21,6 +21,8 @@ const { * @property {number=} maxLength maximum length of ids */ +const PLUGIN_NAME = "DeterministicChunkIdsPlugin"; + class DeterministicChunkIdsPlugin { /** * @param {DeterministicChunkIdsPluginOptions=} options options @@ -35,42 +37,35 @@ class DeterministicChunkIdsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap( - "DeterministicChunkIdsPlugin", - compilation => { - compilation.hooks.chunkIds.tap( - "DeterministicChunkIdsPlugin", - chunks => { - const chunkGraph = compilation.chunkGraph; - const context = this.options.context - ? this.options.context - : compiler.context; - const maxLength = this.options.maxLength || 3; + 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 + : compiler.context; + const maxLength = this.options.maxLength || 3; - const compareNatural = compareChunksNatural(chunkGraph); + const compareNatural = compareChunksNatural(chunkGraph); - const usedIds = getUsedChunkIds(compilation); - assignDeterministicIds( - Array.from(chunks).filter(chunk => chunk.id === null), - chunk => - getFullChunkName(chunk, chunkGraph, context, compiler.root), - compareNatural, - (chunk, id) => { - const size = usedIds.size; - usedIds.add(`${id}`); - if (size === usedIds.size) return false; - chunk.id = id; - chunk.ids = [id]; - return true; - }, - [10 ** maxLength], - 10, - usedIds.size - ); - } + const usedIds = getUsedChunkIds(compilation); + assignDeterministicIds( + Array.from(chunks).filter(chunk => chunk.id === null), + chunk => getFullChunkName(chunk, chunkGraph, context, compiler.root), + compareNatural, + (chunk, id) => { + const size = usedIds.size; + usedIds.add(`${id}`); + if (size === usedIds.size) return false; + chunk.id = id; + chunk.ids = [id]; + return true; + }, + [10 ** maxLength], + 10, + usedIds.size ); - } - ); + }); + }); } } diff --git a/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js b/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js index 1bb04abaffb..53fe9e6f049 100644 --- a/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +++ b/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js @@ -17,6 +17,8 @@ const { /** @typedef {import("../Compiler")} Compiler */ +const PLUGIN_NAME = "ArrayPushCallbackChunkFormatPlugin"; + class ArrayPushCallbackChunkFormatPlugin { /** * Apply the plugin @@ -24,132 +26,121 @@ class ArrayPushCallbackChunkFormatPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "ArrayPushCallbackChunkFormatPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "ArrayPushCallbackChunkFormatPlugin", - (chunk, set, { chunkGraph }) => { - if (chunk.hasRuntime()) return; - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { - set.add(RuntimeGlobals.onChunksLoaded); - set.add(RuntimeGlobals.exports); - set.add(RuntimeGlobals.require); - } - set.add(RuntimeGlobals.chunkCallback); + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + PLUGIN_NAME, + (chunk, set, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { + set.add(RuntimeGlobals.onChunksLoaded); + set.add(RuntimeGlobals.exports); + set.add(RuntimeGlobals.require); } - ); - const hooks = getCompilationHooks(compilation); - hooks.renderChunk.tap( - "ArrayPushCallbackChunkFormatPlugin", - (modules, renderContext) => { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; - const hotUpdateChunk = - chunk instanceof HotUpdateChunk ? chunk : null; - const globalObject = runtimeTemplate.globalObject; - const source = new ConcatSource(); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (hotUpdateChunk) { - const hotUpdateGlobal = - runtimeTemplate.outputOptions.hotUpdateGlobal; - source.add( - `${globalObject}[${JSON.stringify(hotUpdateGlobal)}](` - ); - source.add(`${JSON.stringify(chunk.id)},`); - source.add(modules); - if (runtimeModules.length > 0) { - source.add(",\n"); - const runtimePart = Template.renderChunkRuntimeModules( - runtimeModules, - renderContext - ); - source.add(runtimePart); - } - source.add(")"); - } else { - const chunkLoadingGlobal = - runtimeTemplate.outputOptions.chunkLoadingGlobal; - source.add( - `(${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}] = ${globalObject}[${JSON.stringify( - chunkLoadingGlobal - )}] || []).push([` + set.add(RuntimeGlobals.chunkCallback); + } + ); + const hooks = getCompilationHooks(compilation); + hooks.renderChunk.tap(PLUGIN_NAME, (modules, renderContext) => { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + const hotUpdateChunk = chunk instanceof HotUpdateChunk ? chunk : null; + const globalObject = runtimeTemplate.globalObject; + const source = new ConcatSource(); + const runtimeModules = chunkGraph.getChunkRuntimeModulesInOrder(chunk); + if (hotUpdateChunk) { + const hotUpdateGlobal = runtimeTemplate.outputOptions.hotUpdateGlobal; + source.add(`${globalObject}[${JSON.stringify(hotUpdateGlobal)}](`); + source.add(`${JSON.stringify(chunk.id)},`); + source.add(modules); + if (runtimeModules.length > 0) { + source.add(",\n"); + const runtimePart = Template.renderChunkRuntimeModules( + runtimeModules, + renderContext + ); + source.add(runtimePart); + } + source.add(")"); + } else { + const chunkLoadingGlobal = + runtimeTemplate.outputOptions.chunkLoadingGlobal; + source.add( + `(${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}] = ${globalObject}[${JSON.stringify( + chunkLoadingGlobal + )}] || []).push([` + ); + source.add(`${JSON.stringify(chunk.ids)},`); + source.add(modules); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + if (runtimeModules.length > 0 || entries.length > 0) { + const runtime = new ConcatSource( + `${ + runtimeTemplate.supportsArrowFunction() + ? `${RuntimeGlobals.require} =>` + : `function(${RuntimeGlobals.require})` + } { // webpackRuntimeModules\n` + ); + if (runtimeModules.length > 0) { + runtime.add( + Template.renderRuntimeModules(runtimeModules, { + ...renderContext, + codeGenerationResults: compilation.codeGenerationResults + }) ); - source.add(`${JSON.stringify(chunk.ids)},`); - source.add(modules); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + } + if (entries.length > 0) { + const startupSource = new RawSource( + generateEntryStartup( + chunkGraph, + runtimeTemplate, + entries, + chunk, + true + ) ); - if (runtimeModules.length > 0 || entries.length > 0) { - const runtime = new ConcatSource( - `${ - runtimeTemplate.supportsArrowFunction() - ? `${RuntimeGlobals.require} =>` - : `function(${RuntimeGlobals.require})` - } { // webpackRuntimeModules\n` - ); - if (runtimeModules.length > 0) { - runtime.add( - Template.renderRuntimeModules(runtimeModules, { - ...renderContext, - codeGenerationResults: compilation.codeGenerationResults - }) - ); - } - if (entries.length > 0) { - const startupSource = new RawSource( - generateEntryStartup( - chunkGraph, - runtimeTemplate, - entries, - chunk, - true - ) - ); - runtime.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) - ); - if ( - chunkGraph - .getChunkRuntimeRequirements(chunk) - .has(RuntimeGlobals.returnExportsFromRuntime) - ) { - runtime.add(`return ${RuntimeGlobals.exports};\n`); + runtime.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false } - } - runtime.add("}\n"); - source.add(",\n"); - source.add(new PrefixSource("/******/ ", runtime)); + ) + ); + if ( + chunkGraph + .getChunkRuntimeRequirements(chunk) + .has(RuntimeGlobals.returnExportsFromRuntime) + ) { + runtime.add(`return ${RuntimeGlobals.exports};\n`); } - source.add("])"); } - return source; - } - ); - hooks.chunkHash.tap( - "ArrayPushCallbackChunkFormatPlugin", - (chunk, hash, { chunkGraph, runtimeTemplate }) => { - if (chunk.hasRuntime()) return; - hash.update( - `ArrayPushCallbackChunkFormatPlugin1${runtimeTemplate.outputOptions.chunkLoadingGlobal}${runtimeTemplate.outputOptions.hotUpdateGlobal}${runtimeTemplate.globalObject}` - ); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + runtime.add("}\n"); + source.add(",\n"); + source.add(new PrefixSource("/******/ ", runtime)); } - ); - } - ); + source.add("])"); + } + return source; + }); + hooks.chunkHash.tap( + PLUGIN_NAME, + (chunk, hash, { chunkGraph, runtimeTemplate }) => { + if (chunk.hasRuntime()) return; + hash.update( + `${PLUGIN_NAME}1${runtimeTemplate.outputOptions.chunkLoadingGlobal}${runtimeTemplate.outputOptions.hotUpdateGlobal}${runtimeTemplate.globalObject}` + ); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + } + ); + }); } } diff --git a/lib/javascript/CommonJsChunkFormatPlugin.js b/lib/javascript/CommonJsChunkFormatPlugin.js index 75384ab9a50..59d4a6be88c 100644 --- a/lib/javascript/CommonJsChunkFormatPlugin.js +++ b/lib/javascript/CommonJsChunkFormatPlugin.js @@ -22,6 +22,8 @@ const { /** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Entrypoint")} Entrypoint */ +const PLUGIN_NAME = "CommonJsChunkFormatPlugin"; + class CommonJsChunkFormatPlugin { /** * Apply the plugin @@ -29,146 +31,129 @@ class CommonJsChunkFormatPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.thisCompilation.tap( - "CommonJsChunkFormatPlugin", - compilation => { - compilation.hooks.additionalChunkRuntimeRequirements.tap( - "CommonJsChunkFormatPlugin", - (chunk, set, { chunkGraph }) => { - if (chunk.hasRuntime()) return; - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { - set.add(RuntimeGlobals.require); - set.add(RuntimeGlobals.startupEntrypoint); - set.add(RuntimeGlobals.externalInstallChunk); - } + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compilation.hooks.additionalChunkRuntimeRequirements.tap( + PLUGIN_NAME, + (chunk, set, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { + set.add(RuntimeGlobals.require); + set.add(RuntimeGlobals.startupEntrypoint); + set.add(RuntimeGlobals.externalInstallChunk); } + } + ); + const hooks = getCompilationHooks(compilation); + hooks.renderChunk.tap(PLUGIN_NAME, (modules, renderContext) => { + const { chunk, chunkGraph, runtimeTemplate } = renderContext; + const source = new ConcatSource(); + source.add(`exports.id = ${JSON.stringify(chunk.id)};\n`); + source.add(`exports.ids = ${JSON.stringify(chunk.ids)};\n`); + source.add("exports.modules = "); + source.add(modules); + source.add(";\n"); + const runtimeModules = chunkGraph.getChunkRuntimeModulesInOrder(chunk); + if (runtimeModules.length > 0) { + source.add("exports.runtime =\n"); + source.add( + Template.renderChunkRuntimeModules(runtimeModules, renderContext) + ); + } + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) ); - const hooks = getCompilationHooks(compilation); - hooks.renderChunk.tap( - "CommonJsChunkFormatPlugin", - (modules, renderContext) => { - const { chunk, chunkGraph, runtimeTemplate } = renderContext; - const source = new ConcatSource(); - source.add(`exports.id = ${JSON.stringify(chunk.id)};\n`); - source.add(`exports.ids = ${JSON.stringify(chunk.ids)};\n`); - source.add("exports.modules = "); - source.add(modules); - source.add(";\n"); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (runtimeModules.length > 0) { - source.add("exports.runtime =\n"); - source.add( - Template.renderChunkRuntimeModules( - runtimeModules, - renderContext - ) - ); - } - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - if (entries.length > 0) { - const runtimeChunk = - /** @type {Entrypoint} */ - (entries[0][1]).getRuntimeChunk(); - const currentOutputName = compilation - .getPath( - getChunkFilenameTemplate(chunk, compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ) - .replace(/^\/+/g, "") - .split("/"); - const runtimeOutputName = compilation - .getPath( - getChunkFilenameTemplate( - /** @type {Chunk} */ - (runtimeChunk), - compilation.outputOptions - ), - { - chunk: /** @type {Chunk} */ (runtimeChunk), - contentHashType: "javascript" - } - ) - .replace(/^\/+/g, "") - .split("/"); - - // remove common parts - while ( - currentOutputName.length > 1 && - runtimeOutputName.length > 1 && - currentOutputName[0] === runtimeOutputName[0] - ) { - currentOutputName.shift(); - runtimeOutputName.shift(); + if (entries.length > 0) { + const runtimeChunk = + /** @type {Entrypoint} */ + (entries[0][1]).getRuntimeChunk(); + const currentOutputName = compilation + .getPath( + getChunkFilenameTemplate(chunk, compilation.outputOptions), + { + chunk, + contentHashType: "javascript" } - const last = runtimeOutputName.join("/"); - // create final path - const runtimePath = - getUndoPath(currentOutputName.join("/"), last, true) + last; + ) + .replace(/^\/+/g, "") + .split("/"); + const runtimeOutputName = compilation + .getPath( + getChunkFilenameTemplate( + /** @type {Chunk} */ + (runtimeChunk), + compilation.outputOptions + ), + { + chunk: /** @type {Chunk} */ (runtimeChunk), + contentHashType: "javascript" + } + ) + .replace(/^\/+/g, "") + .split("/"); - const entrySource = new ConcatSource(); - entrySource.add( - `(${ - runtimeTemplate.supportsArrowFunction() - ? "() => " - : "function() " - }{\n` - ); - entrySource.add("var exports = {};\n"); - entrySource.add(source); - entrySource.add(";\n\n// load runtime\n"); - entrySource.add( - `var ${RuntimeGlobals.require} = require(${JSON.stringify( - runtimePath - )});\n` - ); - entrySource.add( - `${RuntimeGlobals.externalInstallChunk}(exports);\n` - ); - const startupSource = new RawSource( - generateEntryStartup( - chunkGraph, - runtimeTemplate, - entries, - chunk, - false - ) - ); - entrySource.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) - ); - entrySource.add("\n})()"); - return entrySource; - } - return source; - } - ); - hooks.chunkHash.tap( - "CommonJsChunkFormatPlugin", - (chunk, hash, { chunkGraph }) => { - if (chunk.hasRuntime()) return; - hash.update("CommonJsChunkFormatPlugin"); - hash.update("1"); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + // remove common parts + while ( + currentOutputName.length > 1 && + runtimeOutputName.length > 1 && + currentOutputName[0] === runtimeOutputName[0] + ) { + currentOutputName.shift(); + runtimeOutputName.shift(); } + const last = runtimeOutputName.join("/"); + // create final path + const runtimePath = + getUndoPath(currentOutputName.join("/"), last, true) + last; + + const entrySource = new ConcatSource(); + entrySource.add( + `(${ + runtimeTemplate.supportsArrowFunction() ? "() => " : "function() " + }{\n` + ); + entrySource.add("var exports = {};\n"); + entrySource.add(source); + entrySource.add(";\n\n// load runtime\n"); + entrySource.add( + `var ${RuntimeGlobals.require} = require(${JSON.stringify( + runtimePath + )});\n` + ); + entrySource.add(`${RuntimeGlobals.externalInstallChunk}(exports);\n`); + const startupSource = new RawSource( + generateEntryStartup( + chunkGraph, + runtimeTemplate, + entries, + chunk, + false + ) + ); + entrySource.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false + } + ) + ); + entrySource.add("\n})()"); + return entrySource; + } + return source; + }); + hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + hash.update(PLUGIN_NAME); + hash.update("1"); + const entries = Array.from( + chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) ); - } - ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + }); + }); } } diff --git a/lib/optimize/AggressiveMergingPlugin.js b/lib/optimize/AggressiveMergingPlugin.js index 9c5147cf384..a759a03e8bd 100644 --- a/lib/optimize/AggressiveMergingPlugin.js +++ b/lib/optimize/AggressiveMergingPlugin.js @@ -15,6 +15,8 @@ const { STAGE_ADVANCED } = require("../OptimizationStages"); * @property {number=} minSizeReduce minimal size reduction to trigger merging */ +const PLUGIN_NAME = "AggressiveMergingPlugin"; + class AggressiveMergingPlugin { /** * @param {AggressiveMergingPluginOptions=} options options object @@ -40,58 +42,55 @@ class AggressiveMergingPlugin { const options = this.options; const minSizeReduce = options.minSizeReduce || 1.5; - compiler.hooks.thisCompilation.tap( - "AggressiveMergingPlugin", - compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "AggressiveMergingPlugin", - stage: STAGE_ADVANCED - }, - chunks => { - const chunkGraph = compilation.chunkGraph; - /** @type {{a: Chunk, b: Chunk, improvement: number}[]} */ - const combinations = []; - for (const a of chunks) { - if (a.canBeInitial()) continue; - for (const b of chunks) { - if (b.canBeInitial()) continue; - if (b === a) break; - if (!chunkGraph.canChunksBeIntegrated(a, b)) { - continue; - } - const aSize = chunkGraph.getChunkSize(b, { - chunkOverhead: 0 - }); - const bSize = chunkGraph.getChunkSize(a, { - chunkOverhead: 0 - }); - const abSize = chunkGraph.getIntegratedChunksSize(b, a, { - chunkOverhead: 0 - }); - const improvement = (aSize + bSize) / abSize; - combinations.push({ - a, - b, - improvement - }); + compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: PLUGIN_NAME, + stage: STAGE_ADVANCED + }, + chunks => { + const chunkGraph = compilation.chunkGraph; + /** @type {{a: Chunk, b: Chunk, improvement: number}[]} */ + const combinations = []; + for (const a of chunks) { + if (a.canBeInitial()) continue; + for (const b of chunks) { + if (b.canBeInitial()) continue; + if (b === a) break; + if (!chunkGraph.canChunksBeIntegrated(a, b)) { + continue; } + const aSize = chunkGraph.getChunkSize(b, { + chunkOverhead: 0 + }); + const bSize = chunkGraph.getChunkSize(a, { + chunkOverhead: 0 + }); + const abSize = chunkGraph.getIntegratedChunksSize(b, a, { + chunkOverhead: 0 + }); + const improvement = (aSize + bSize) / abSize; + combinations.push({ + a, + b, + improvement + }); } + } - combinations.sort((a, b) => b.improvement - a.improvement); + combinations.sort((a, b) => b.improvement - a.improvement); - const pair = combinations[0]; + const pair = combinations[0]; - if (!pair) return; - if (pair.improvement < minSizeReduce) return; + if (!pair) return; + if (pair.improvement < minSizeReduce) return; - chunkGraph.integrateChunks(pair.b, pair.a); - compilation.chunks.delete(pair.a); - return true; - } - ); - } - ); + chunkGraph.integrateChunks(pair.b, pair.a); + compilation.chunks.delete(pair.a); + return true; + } + ); + }); } } diff --git a/lib/optimize/EnsureChunkConditionsPlugin.js b/lib/optimize/EnsureChunkConditionsPlugin.js index 0bc8a384bb6..2def4c2350f 100644 --- a/lib/optimize/EnsureChunkConditionsPlugin.js +++ b/lib/optimize/EnsureChunkConditionsPlugin.js @@ -11,6 +11,8 @@ const { STAGE_BASIC } = require("../OptimizationStages"); /** @typedef {import("../ChunkGroup")} ChunkGroup */ /** @typedef {import("../Compiler")} Compiler */ +const PLUGIN_NAME = "EnsureChunkConditionsPlugin"; + class EnsureChunkConditionsPlugin { /** * Apply the plugin @@ -18,71 +20,68 @@ class EnsureChunkConditionsPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap( - "EnsureChunkConditionsPlugin", - compilation => { - /** - * @param {Iterable} chunks the 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 - /** @type {Set} */ - const sourceChunks = new Set(); - /** @type {Set} */ - const chunkGroups = new Set(); - for (const module of compilation.modules) { - if (!module.hasChunkCondition()) continue; - for (const chunk of chunkGraph.getModuleChunksIterable(module)) { - if (!module.chunkCondition(chunk, compilation)) { - sourceChunks.add(chunk); - for (const group of chunk.groupsIterable) { - chunkGroups.add(group); - } + compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + /** + * @param {Iterable} chunks the 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 + /** @type {Set} */ + const sourceChunks = new Set(); + /** @type {Set} */ + const chunkGroups = new Set(); + for (const module of compilation.modules) { + if (!module.hasChunkCondition()) continue; + for (const chunk of chunkGraph.getModuleChunksIterable(module)) { + if (!module.chunkCondition(chunk, compilation)) { + sourceChunks.add(chunk); + for (const group of chunk.groupsIterable) { + chunkGroups.add(group); } } - if (sourceChunks.size === 0) continue; - /** @type {Set} */ - const targetChunks = new Set(); - chunkGroupLoop: for (const chunkGroup of chunkGroups) { - // Can module be placed in a chunk of this group? - for (const chunk of chunkGroup.chunks) { - if (module.chunkCondition(chunk, compilation)) { - targetChunks.add(chunk); - continue chunkGroupLoop; - } - } - // We reached the entrypoint: fail - if (chunkGroup.isInitial()) { - throw new Error( - `Cannot fulfil chunk condition of ${module.identifier()}` - ); - } - // Try placing in all parents - for (const group of chunkGroup.parentsIterable) { - chunkGroups.add(group); + } + if (sourceChunks.size === 0) continue; + /** @type {Set} */ + const targetChunks = new Set(); + chunkGroupLoop: for (const chunkGroup of chunkGroups) { + // Can module be placed in a chunk of this group? + for (const chunk of chunkGroup.chunks) { + if (module.chunkCondition(chunk, compilation)) { + targetChunks.add(chunk); + continue chunkGroupLoop; } } - for (const sourceChunk of sourceChunks) { - chunkGraph.disconnectChunkAndModule(sourceChunk, module); + // We reached the entrypoint: fail + if (chunkGroup.isInitial()) { + throw new Error( + `Cannot fulfil chunk condition of ${module.identifier()}` + ); } - for (const targetChunk of targetChunks) { - chunkGraph.connectChunkAndModule(targetChunk, module); + // Try placing in all parents + for (const group of chunkGroup.parentsIterable) { + chunkGroups.add(group); } - sourceChunks.clear(); - chunkGroups.clear(); } - }; - compilation.hooks.optimizeChunks.tap( - { - name: "EnsureChunkConditionsPlugin", - stage: STAGE_BASIC - }, - handler - ); - } - ); + for (const sourceChunk of sourceChunks) { + chunkGraph.disconnectChunkAndModule(sourceChunk, module); + } + for (const targetChunk of targetChunks) { + chunkGraph.connectChunkAndModule(targetChunk, module); + } + sourceChunks.clear(); + chunkGroups.clear(); + } + }; + compilation.hooks.optimizeChunks.tap( + { + name: PLUGIN_NAME, + stage: STAGE_BASIC + }, + handler + ); + }); } } module.exports = EnsureChunkConditionsPlugin; diff --git a/lib/optimize/MergeDuplicateChunksPlugin.js b/lib/optimize/MergeDuplicateChunksPlugin.js index 08db56823a2..6e4c3c95424 100644 --- a/lib/optimize/MergeDuplicateChunksPlugin.js +++ b/lib/optimize/MergeDuplicateChunksPlugin.js @@ -22,6 +22,8 @@ const validate = createSchemaValidation( } ); +const PLUGIN_NAME = "MergeDuplicateChunksPlugin"; + class MergeDuplicateChunksPlugin { /** * @param {MergeDuplicateChunksPluginOptions} options options object @@ -36,100 +38,95 @@ class MergeDuplicateChunksPlugin { * @returns {void} */ apply(compiler) { - compiler.hooks.compilation.tap( - "MergeDuplicateChunksPlugin", - compilation => { - compilation.hooks.optimizeChunks.tap( - { - name: "MergeDuplicateChunksPlugin", - stage: this.options.stage - }, - chunks => { - const { chunkGraph, moduleGraph } = compilation; + compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { + compilation.hooks.optimizeChunks.tap( + { + name: PLUGIN_NAME, + stage: this.options.stage + }, + chunks => { + const { chunkGraph, moduleGraph } = compilation; - // remember already tested chunks for performance - const notDuplicates = new Set(); + // remember already tested chunks for performance + const notDuplicates = new Set(); - // for each chunk - for (const chunk of chunks) { - // track a Set of all chunk that could be duplicates - let possibleDuplicates; - for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (possibleDuplicates === undefined) { - // when possibleDuplicates is not yet set, - // create a new Set from chunks of the current module - // including only chunks with the same number of modules - for (const dup of chunkGraph.getModuleChunksIterable( - module - )) { - if ( - dup !== chunk && - chunkGraph.getNumberOfChunkModules(chunk) === - chunkGraph.getNumberOfChunkModules(dup) && - !notDuplicates.has(dup) - ) { - // delay allocating the new Set until here, reduce memory pressure - if (possibleDuplicates === undefined) { - possibleDuplicates = new Set(); - } - possibleDuplicates.add(dup); + // for each chunk + for (const chunk of chunks) { + // track a Set of all chunk that could be duplicates + let possibleDuplicates; + for (const module of chunkGraph.getChunkModulesIterable(chunk)) { + if (possibleDuplicates === undefined) { + // when possibleDuplicates is not yet set, + // create a new Set from chunks of the current module + // including only chunks with the same number of modules + for (const dup of chunkGraph.getModuleChunksIterable(module)) { + if ( + dup !== chunk && + chunkGraph.getNumberOfChunkModules(chunk) === + chunkGraph.getNumberOfChunkModules(dup) && + !notDuplicates.has(dup) + ) { + // delay allocating the new Set until here, reduce memory pressure + if (possibleDuplicates === undefined) { + possibleDuplicates = new Set(); } + possibleDuplicates.add(dup); } - // when no chunk is possible we can break here - if (possibleDuplicates === undefined) break; - } else { - // validate existing possible duplicates - for (const dup of possibleDuplicates) { - // remove possible duplicate when module is not contained - if (!chunkGraph.isModuleInChunk(module, dup)) { - possibleDuplicates.delete(dup); - } + } + // when no chunk is possible we can break here + if (possibleDuplicates === undefined) break; + } else { + // validate existing possible duplicates + for (const dup of possibleDuplicates) { + // remove possible duplicate when module is not contained + if (!chunkGraph.isModuleInChunk(module, dup)) { + possibleDuplicates.delete(dup); } - // when all chunks has been removed we can break here - if (possibleDuplicates.size === 0) break; } + // when all chunks has been removed we can break here + if (possibleDuplicates.size === 0) break; } + } - // when we found duplicates - if ( - possibleDuplicates !== undefined && - possibleDuplicates.size > 0 - ) { - outer: for (const otherChunk of possibleDuplicates) { - if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue; - if (chunkGraph.getNumberOfEntryModules(chunk) > 0) continue; - if (chunkGraph.getNumberOfEntryModules(otherChunk) > 0) - continue; - if (!runtimeEqual(chunk.runtime, otherChunk.runtime)) { - for (const module of chunkGraph.getChunkModulesIterable( - chunk - )) { - const exportsInfo = moduleGraph.getExportsInfo(module); - if ( - !exportsInfo.isEquallyUsed( - chunk.runtime, - otherChunk.runtime - ) - ) { - continue outer; - } + // when we found duplicates + if ( + possibleDuplicates !== undefined && + possibleDuplicates.size > 0 + ) { + outer: for (const otherChunk of possibleDuplicates) { + if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue; + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) continue; + if (chunkGraph.getNumberOfEntryModules(otherChunk) > 0) + continue; + if (!runtimeEqual(chunk.runtime, otherChunk.runtime)) { + for (const module of chunkGraph.getChunkModulesIterable( + chunk + )) { + const exportsInfo = moduleGraph.getExportsInfo(module); + if ( + !exportsInfo.isEquallyUsed( + chunk.runtime, + otherChunk.runtime + ) + ) { + continue outer; } } - // merge them - if (chunkGraph.canChunksBeIntegrated(chunk, otherChunk)) { - chunkGraph.integrateChunks(chunk, otherChunk); - compilation.chunks.delete(otherChunk); - } + } + // merge them + if (chunkGraph.canChunksBeIntegrated(chunk, otherChunk)) { + chunkGraph.integrateChunks(chunk, otherChunk); + compilation.chunks.delete(otherChunk); } } - - // don't check already processed chunks twice - notDuplicates.add(chunk); } + + // don't check already processed chunks twice + notDuplicates.add(chunk); } - ); - } - ); + } + ); + }); } } module.exports = MergeDuplicateChunksPlugin; diff --git a/lib/rules/BasicEffectRulePlugin.js b/lib/rules/BasicEffectRulePlugin.js index 5d24bac5d12..3e7ca5f87b2 100644 --- a/lib/rules/BasicEffectRulePlugin.js +++ b/lib/rules/BasicEffectRulePlugin.js @@ -16,6 +16,8 @@ /** @typedef {KeysOfTypes} BasicEffectRuleKeys */ +const PLUGIN_NAME = "BasicEffectRulePlugin"; + class BasicEffectRulePlugin { /** * @param {BasicEffectRuleKeys} ruleProperty the rule property @@ -32,7 +34,7 @@ class BasicEffectRulePlugin { */ apply(ruleSetCompiler) { ruleSetCompiler.hooks.rule.tap( - "BasicEffectRulePlugin", + PLUGIN_NAME, (path, rule, unhandledProperties, result, references) => { if (unhandledProperties.has(this.ruleProperty)) { unhandledProperties.delete(this.ruleProperty); diff --git a/lib/rules/BasicMatcherRulePlugin.js b/lib/rules/BasicMatcherRulePlugin.js index 4193ecfcb1d..b2cbfb7ea92 100644 --- a/lib/rules/BasicMatcherRulePlugin.js +++ b/lib/rules/BasicMatcherRulePlugin.js @@ -20,6 +20,8 @@ /** @typedef {KeysOfTypes} BasicMatcherRuleKeys */ +const PLUGIN_NAME = "BasicMatcherRulePlugin"; + class BasicMatcherRulePlugin { /** * @param {BasicMatcherRuleKeys} ruleProperty the rule property @@ -38,7 +40,7 @@ class BasicMatcherRulePlugin { */ apply(ruleSetCompiler) { ruleSetCompiler.hooks.rule.tap( - "BasicMatcherRulePlugin", + PLUGIN_NAME, (path, rule, unhandledProperties, result) => { if (unhandledProperties.has(this.ruleProperty)) { unhandledProperties.delete(this.ruleProperty); diff --git a/lib/rules/ObjectMatcherRulePlugin.js b/lib/rules/ObjectMatcherRulePlugin.js index 9b56c0bf99b..5ec7f8e523d 100644 --- a/lib/rules/ObjectMatcherRulePlugin.js +++ b/lib/rules/ObjectMatcherRulePlugin.js @@ -20,6 +20,8 @@ /** @typedef {KeysOfTypes} ObjectMatcherRuleKeys */ +const PLUGIN_NAME = "ObjectMatcherRulePlugin"; + class ObjectMatcherRulePlugin { /** * @param {ObjectMatcherRuleKeys} ruleProperty the rule property @@ -39,7 +41,7 @@ class ObjectMatcherRulePlugin { apply(ruleSetCompiler) { const { ruleProperty, dataProperty } = this; ruleSetCompiler.hooks.rule.tap( - "ObjectMatcherRulePlugin", + PLUGIN_NAME, (path, rule, unhandledProperties, result) => { if (unhandledProperties.has(ruleProperty)) { unhandledProperties.delete(ruleProperty); diff --git a/lib/rules/UseEffectRulePlugin.js b/lib/rules/UseEffectRulePlugin.js index 60840a366e3..3b2f8077143 100644 --- a/lib/rules/UseEffectRulePlugin.js +++ b/lib/rules/UseEffectRulePlugin.js @@ -17,6 +17,8 @@ const util = require("util"); /** @typedef {import("./RuleSetCompiler").Effect} Effect */ /** @typedef {import("./RuleSetCompiler").EffectData} EffectData */ +const PLUGIN_NAME = "UseEffectRulePlugin"; + class UseEffectRulePlugin { /** * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler @@ -24,7 +26,7 @@ class UseEffectRulePlugin { */ apply(ruleSetCompiler) { ruleSetCompiler.hooks.rule.tap( - "UseEffectRulePlugin", + PLUGIN_NAME, (path, rule, unhandledProperties, result, references) => { /** * @param {keyof RuleSetRule} property property diff --git a/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js b/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js index 621457821de..77925068a10 100644 --- a/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +++ b/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js @@ -133,58 +133,55 @@ class AsyncWebAssemblyModulesPlugin { }); }); - compilation.hooks.renderManifest.tap( - "WebAssemblyModulesPlugin", - (result, options) => { - const { moduleGraph, chunkGraph, runtimeTemplate } = compilation; - const { - chunk, - outputOptions, - dependencyTemplates, - codeGenerationResults - } = options; - - for (const module of chunkGraph.getOrderedChunkModulesIterable( - chunk, - compareModulesByIdOrIdentifier(chunkGraph) - )) { - if (module.type === WEBASSEMBLY_MODULE_TYPE_ASYNC) { - const filenameTemplate = - /** @type {NonNullable} */ - (outputOptions.webassemblyModuleFilename); - - result.push({ - render: () => - this.renderModule( - module, - { - chunk, - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - codeGenerationResults - }, - hooks - ), - filenameTemplate, - pathOptions: { + compilation.hooks.renderManifest.tap(PLUGIN_NAME, (result, options) => { + const { moduleGraph, chunkGraph, runtimeTemplate } = compilation; + const { + chunk, + outputOptions, + dependencyTemplates, + codeGenerationResults + } = options; + + for (const module of chunkGraph.getOrderedChunkModulesIterable( + chunk, + compareModulesByIdOrIdentifier(chunkGraph) + )) { + if (module.type === WEBASSEMBLY_MODULE_TYPE_ASYNC) { + const filenameTemplate = + /** @type {NonNullable} */ + (outputOptions.webassemblyModuleFilename); + + result.push({ + render: () => + this.renderModule( module, - runtime: chunk.runtime, - chunkGraph - }, - auxiliary: true, - identifier: `webassemblyAsyncModule${chunkGraph.getModuleId( - module - )}`, - hash: chunkGraph.getModuleHash(module, chunk.runtime) - }); - } + { + chunk, + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + codeGenerationResults + }, + hooks + ), + filenameTemplate, + pathOptions: { + module, + runtime: chunk.runtime, + chunkGraph + }, + auxiliary: true, + identifier: `webassemblyAsyncModule${chunkGraph.getModuleId( + module + )}`, + hash: chunkGraph.getModuleHash(module, chunk.runtime) + }); } - - return result; } - ); + + return result; + }); } ); } From d7987b9904bb61f91f6f0f8325c5ec8de93db80c Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:41:41 +0300 Subject: [PATCH 17/56] docs: update examples (#19594) --- examples/explicit-vendor-chunk/README.md | 2 +- examples/http2-aggressive-splitting/README.md | 8 ++++---- examples/stats-detailed/README.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/explicit-vendor-chunk/README.md b/examples/explicit-vendor-chunk/README.md index 5ba7605d23f..03c8fa9fc68 100644 --- a/examples/explicit-vendor-chunk/README.md +++ b/examples/explicit-vendor-chunk/README.md @@ -280,7 +280,7 @@ vendor: app: asset pageB.js 297 bytes [emitted] [minimized] (name: pageB) - asset pageA.js 293 bytes [emitted] [minimized] (name: pageA) + asset pageA.js 295 bytes [emitted] [minimized] (name: pageA) asset pageC.js 174 bytes [emitted] [minimized] (name: pageC) chunk (runtime: pageB) pageB.js (pageB) 144 bytes [entry] [rendered] > ./pageB pageB diff --git a/examples/http2-aggressive-splitting/README.md b/examples/http2-aggressive-splitting/README.md index ff0ee91e510..4583698d0e0 100644 --- a/examples/http2-aggressive-splitting/README.md +++ b/examples/http2-aggressive-splitting/README.md @@ -64,13 +64,13 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset 4e9b80a6c242d1cbf940.js 9.04 KiB [emitted] [immutable] [minimized] (name: main) 1 related asset -asset 9679c25c4fa710024c2a.js 3.55 KiB [emitted] [immutable] [minimized] 1 related asset -chunk (runtime: main) 9679c25c4fa710024c2a.js 7.83 KiB [rendered] +asset 68dab3066399275cfe8c.js 9.04 KiB [emitted] [immutable] [minimized] (name: main) 1 related asset +asset 9ae91119845b89b379f6.js 3.55 KiB [emitted] [immutable] [minimized] 1 related asset +chunk (runtime: main) 9ae91119845b89b379f6.js 7.83 KiB [rendered] > react-dom ./example.js 2:0-22 dependent modules 6.5 KiB [dependent] 1 module ../../node_modules/react-dom/index.js 1.33 KiB [built] [code generated] -chunk (runtime: main) 4e9b80a6c242d1cbf940.js (main) 16.9 KiB (javascript) 4.94 KiB (runtime) [entry] [rendered] +chunk (runtime: main) 68dab3066399275cfe8c.js (main) 16.9 KiB (javascript) 4.94 KiB (runtime) [entry] [rendered] > ./example main runtime modules 4.94 KiB 6 modules dependent modules 16.9 KiB [dependent] 2 modules diff --git a/examples/stats-detailed/README.md b/examples/stats-detailed/README.md index 98da256db1d..8bfddaea2d9 100644 --- a/examples/stats-detailed/README.md +++ b/examples/stats-detailed/README.md @@ -78,5 +78,5 @@ LOG from webpack.FileSystemInfo Directory info in cache: 0 timestamps 0 hashes 0 timestamp hash combinations Managed items info in cache: 0 items -XXXX-XX-XX XXXX:XX:XX: webpack X.X.X compiled successfully (37904780141efdcbf726) +XXXX-XX-XX XXXX:XX:XX: webpack X.X.X compiled successfully (17b2b008cbfb55e631ef) ``` From 4df83e7c54c831f3a8ec5ade3a56734cb6fa3b20 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Tue, 10 Jun 2025 15:45:16 +0300 Subject: [PATCH 18/56] chore: update assemblyscript (#19601) --- lib/util/hash/md4.js | 4 ++-- package.json | 2 +- yarn.lock | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/util/hash/md4.js b/lib/util/hash/md4.js index 425edc3b9ba..eb15298d3e3 100644 --- a/lib/util/hash/md4.js +++ b/lib/util/hash/md4.js @@ -10,8 +10,8 @@ const create = require("./wasm-hash"); // #region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1 const md4 = new WebAssembly.Module( Buffer.from( - // 2154 bytes - "AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqJEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvQCgEZfyMBIQUjAiECIwMhAyMEIQQDQCAAIAFLBEAgASgCBCIOIAQgAyABKAIAIg8gBSAEIAIgAyAEc3FzampBA3ciCCACIANzcXNqakEHdyEJIAEoAgwiBiACIAggASgCCCIQIAMgAiAJIAIgCHNxc2pqQQt3IgogCCAJc3FzampBE3chCyABKAIUIgcgCSAKIAEoAhAiESAIIAkgCyAJIApzcXNqakEDdyIMIAogC3Nxc2pqQQd3IQ0gASgCHCIJIAsgDCABKAIYIgggCiALIA0gCyAMc3FzampBC3ciEiAMIA1zcXNqakETdyETIAEoAiQiFCANIBIgASgCICIVIAwgDSATIA0gEnNxc2pqQQN3IgwgEiATc3FzampBB3chDSABKAIsIgsgEyAMIAEoAigiCiASIBMgDSAMIBNzcXNqakELdyISIAwgDXNxc2pqQRN3IRMgASgCNCIWIA0gEiABKAIwIhcgDCANIBMgDSASc3FzampBA3ciGCASIBNzcXNqakEHdyEZIBggASgCPCINIBMgGCABKAI4IgwgEiATIBkgEyAYc3FzampBC3ciEiAYIBlzcXNqakETdyITIBIgGXJxIBIgGXFyaiAPakGZ84nUBWpBA3ciGCATIBIgGSAYIBIgE3JxIBIgE3FyaiARakGZ84nUBWpBBXciEiATIBhycSATIBhxcmogFWpBmfOJ1AVqQQl3IhMgEiAYcnEgEiAYcXJqIBdqQZnzidQFakENdyIYIBIgE3JxIBIgE3FyaiAOakGZ84nUBWpBA3ciGSAYIBMgEiAZIBMgGHJxIBMgGHFyaiAHakGZ84nUBWpBBXciEiAYIBlycSAYIBlxcmogFGpBmfOJ1AVqQQl3IhMgEiAZcnEgEiAZcXJqIBZqQZnzidQFakENdyIYIBIgE3JxIBIgE3FyaiAQakGZ84nUBWpBA3ciGSAYIBMgEiAZIBMgGHJxIBMgGHFyaiAIakGZ84nUBWpBBXciEiAYIBlycSAYIBlxcmogCmpBmfOJ1AVqQQl3IhMgEiAZcnEgEiAZcXJqIAxqQZnzidQFakENdyIYIBIgE3JxIBIgE3FyaiAGakGZ84nUBWpBA3ciGSAYIBMgEiAZIBMgGHJxIBMgGHFyaiAJakGZ84nUBWpBBXciEiAYIBlycSAYIBlxcmogC2pBmfOJ1AVqQQl3IhMgEiAZcnEgEiAZcXJqIA1qQZnzidQFakENdyIYIBNzIBJzaiAPakGh1+f2BmpBA3ciDyAYIBMgEiAPIBhzIBNzaiAVakGh1+f2BmpBCXciEiAPcyAYc2ogEWpBodfn9gZqQQt3IhEgEnMgD3NqIBdqQaHX5/YGakEPdyIPIBFzIBJzaiAQakGh1+f2BmpBA3ciECAPIBEgEiAPIBBzIBFzaiAKakGh1+f2BmpBCXciCiAQcyAPc2ogCGpBodfn9gZqQQt3IgggCnMgEHNqIAxqQaHX5/YGakEPdyIMIAhzIApzaiAOakGh1+f2BmpBA3ciDiAMIAggCiAMIA5zIAhzaiAUakGh1+f2BmpBCXciCCAOcyAMc2ogB2pBodfn9gZqQQt3IgcgCHMgDnNqIBZqQaHX5/YGakEPdyIKIAdzIAhzaiAGakGh1+f2BmpBA3ciBiAFaiEFIAIgCiAHIAggBiAKcyAHc2ogC2pBodfn9gZqQQl3IgcgBnMgCnNqIAlqQaHX5/YGakELdyIIIAdzIAZzaiANakGh1+f2BmpBD3dqIQIgAyAIaiEDIAQgB2ohBCABQUBrIQEMAQsLIAUkASACJAIgAyQDIAQkBAsNACAAEAEjACAAaiQAC/8EAgN/AX4jACAAaq1CA4YhBCAAQcgAakFAcSICQQhrIQMgACIBQQFqIQAgAUGAAToAAANAIAAgAklBACAAQQdxGwRAIABBADoAACAAQQFqIQAMAQsLA0AgACACSQRAIABCADcDACAAQQhqIQAMAQsLIAMgBDcDACACEAFBACMBrSIEQv//A4MgBEKAgPz/D4NCEIaEIgRC/4GAgPAfgyAEQoD+g4CA4D+DQgiGhCIEQo+AvIDwgcAHg0IIhiAEQvCBwIeAnoD4AINCBIiEIgRChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IARCsODAgYOGjJgwhHw3AwBBCCMCrSIEQv//A4MgBEKAgPz/D4NCEIaEIgRC/4GAgPAfgyAEQoD+g4CA4D+DQgiGhCIEQo+AvIDwgcAHg0IIhiAEQvCBwIeAnoD4AINCBIiEIgRChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IARCsODAgYOGjJgwhHw3AwBBECMDrSIEQv//A4MgBEKAgPz/D4NCEIaEIgRC/4GAgPAfgyAEQoD+g4CA4D+DQgiGhCIEQo+AvIDwgcAHg0IIhiAEQvCBwIeAnoD4AINCBIiEIgRChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IARCsODAgYOGjJgwhHw3AwBBGCMErSIEQv//A4MgBEKAgPz/D4NCEIaEIgRC/4GAgPAfgyAEQoD+g4CA4D+DQgiGhCIEQo+AvIDwgcAHg0IIhiAEQvCBwIeAnoD4AINCBIiEIgRChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IARCsODAgYOGjJgwhHw3AwAL", + // 2150 bytes + "AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqFEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvQCgEZfyMBIQUjAiECIwMhAyMEIQQDQCAAIAFLBEAgASgCBCIOIAQgAyABKAIAIg8gBSAEIAIgAyAEc3FzampBA3ciCCACIANzcXNqakEHdyEJIAEoAgwiBiACIAggASgCCCIQIAMgAiAJIAIgCHNxc2pqQQt3IgogCCAJc3FzampBE3chCyABKAIUIgcgCSAKIAEoAhAiESAIIAkgCyAJIApzcXNqakEDdyIMIAogC3Nxc2pqQQd3IQ0gASgCHCIJIAsgDCABKAIYIgggCiALIA0gCyAMc3FzampBC3ciEiAMIA1zcXNqakETdyETIAEoAiQiFCANIBIgASgCICIVIAwgDSATIA0gEnNxc2pqQQN3IgwgEiATc3FzampBB3chDSABKAIsIgsgEyAMIAEoAigiCiASIBMgDSAMIBNzcXNqakELdyISIAwgDXNxc2pqQRN3IRMgASgCNCIWIA0gEiABKAIwIhcgDCANIBMgDSASc3FzampBA3ciGCASIBNzcXNqakEHdyEZIBggASgCPCINIBMgGCABKAI4IgwgEiATIBkgEyAYc3FzampBC3ciEiAYIBlzcXNqakETdyITIBIgGXJxIBIgGXFyaiAPakGZ84nUBWpBA3ciGCATIBIgGSAYIBIgE3JxIBIgE3FyaiARakGZ84nUBWpBBXciEiATIBhycSATIBhxcmogFWpBmfOJ1AVqQQl3IhMgEiAYcnEgEiAYcXJqIBdqQZnzidQFakENdyIYIBIgE3JxIBIgE3FyaiAOakGZ84nUBWpBA3ciGSAYIBMgEiAZIBMgGHJxIBMgGHFyaiAHakGZ84nUBWpBBXciEiAYIBlycSAYIBlxcmogFGpBmfOJ1AVqQQl3IhMgEiAZcnEgEiAZcXJqIBZqQZnzidQFakENdyIYIBIgE3JxIBIgE3FyaiAQakGZ84nUBWpBA3ciGSAYIBMgEiAZIBMgGHJxIBMgGHFyaiAIakGZ84nUBWpBBXciEiAYIBlycSAYIBlxcmogCmpBmfOJ1AVqQQl3IhMgEiAZcnEgEiAZcXJqIAxqQZnzidQFakENdyIYIBIgE3JxIBIgE3FyaiAGakGZ84nUBWpBA3ciGSAYIBMgEiAZIBMgGHJxIBMgGHFyaiAJakGZ84nUBWpBBXciEiAYIBlycSAYIBlxcmogC2pBmfOJ1AVqQQl3IhMgEiAZcnEgEiAZcXJqIA1qQZnzidQFakENdyIYIBNzIBJzaiAPakGh1+f2BmpBA3ciDyAYIBMgEiAPIBhzIBNzaiAVakGh1+f2BmpBCXciEiAPcyAYc2ogEWpBodfn9gZqQQt3IhEgEnMgD3NqIBdqQaHX5/YGakEPdyIPIBFzIBJzaiAQakGh1+f2BmpBA3ciECAPIBEgEiAPIBBzIBFzaiAKakGh1+f2BmpBCXciCiAQcyAPc2ogCGpBodfn9gZqQQt3IgggCnMgEHNqIAxqQaHX5/YGakEPdyIMIAhzIApzaiAOakGh1+f2BmpBA3ciDiAMIAggCiAMIA5zIAhzaiAUakGh1+f2BmpBCXciCCAOcyAMc2ogB2pBodfn9gZqQQt3IgcgCHMgDnNqIBZqQaHX5/YGakEPdyIKIAdzIAhzaiAGakGh1+f2BmpBA3ciBiAFaiEFIAIgCiAHIAggBiAKcyAHc2ogC2pBodfn9gZqQQl3IgcgBnMgCnNqIAlqQaHX5/YGakELdyIIIAdzIAZzaiANakGh1+f2BmpBD3dqIQIgAyAIaiEDIAQgB2ohBCABQUBrIQEMAQsLIAUkASACJAIgAyQDIAQkBAsNACAAEAEjACAAaiQAC/sEAgN/AX4jACAAaq1CA4YhBCAAQcgAakFAcSICQQhrIAAiAUEBaiEAIAFBgAE6AAADQCAAIAJJQQAgAEEHcRsEQCAAQQA6AAAgAEEBaiEADAELCwNAIAAgAkkEQCAAQgA3AwAgAEEIaiEADAELCyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=", "base64" ) ); diff --git a/package.json b/package.json index f88ee2c21b7..ff3da3f6cbf 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@types/mime-types": "^2.1.4", "@types/node": "^22.15.11", "@types/xxhashjs": "^0.2.4", - "assemblyscript": "^0.28.1", + "assemblyscript": "^0.28.2", "babel-loader": "^10.0.0", "bundle-loader": "^0.5.6", "coffee-loader": "^5.0.0", diff --git a/yarn.lock b/yarn.lock index 4e22e2f1755..df0f30c8596 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1812,12 +1812,12 @@ asap@~2.0.3: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== -assemblyscript@^0.28.1: - version "0.28.1" - resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.28.1.tgz#e459d9d2b29b0b4a1a90ebd59ebddcce01dcedc3" - integrity sha512-CcoEh+cdNaFY9n2hIoM2989H5BqRprS/1xFNXrXRZyfbUD9i/5IkAiL3EKaN2hORfsIilRTtKGx6ghHaiVpPSQ== +assemblyscript@^0.28.2: + version "0.28.2" + resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.28.2.tgz#0789280a1bda52834dc550e03d4b38e42d84b71b" + integrity sha512-0j6kQdfKqRgmkY9zIzpFVcsLW8lMZ61pIZmmXJNiJeN2rvaHCCBSzHOoFNBh2jlvQNijY2/uxuufnSQma8HmFQ== dependencies: - binaryen "116.0.0-nightly.20240114" + binaryen "123.0.0-nightly.20250530" long "^5.2.4" assert-never@^1.2.1: @@ -1936,10 +1936,10 @@ big.js@^5.2.2: resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== -binaryen@116.0.0-nightly.20240114: - version "116.0.0-nightly.20240114" - resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-116.0.0-nightly.20240114.tgz#ad8bfbde77d4cb4715b93997114eefc30f45155b" - integrity sha512-0GZrojJnuhoe+hiwji7QFaL3tBlJoA+KFUN7ouYSDGZLSo9CKM8swQX8n/UcbR0d1VuZKU+nhogNzv423JEu5A== +binaryen@123.0.0-nightly.20250530: + version "123.0.0-nightly.20250530" + resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-123.0.0-nightly.20250530.tgz#f78aceafedb01df779a42a0ea7fa04043d45c19d" + integrity sha512-d1zPHBN5YlOd3Ff+OUxvVExuFeh8heSnqe+X3bjItFxGLvn4VGBKmrvv7pgy/cRhrIUGuPW138iaWfDhwjyDqg== brace-expansion@^1.1.7: version "1.1.11" From 93eb096c8424b69089607a8dc0b893e2823a7b14 Mon Sep 17 00:00:00 2001 From: Xiao <784487301@qq.com> Date: Tue, 10 Jun 2025 22:18:43 +0800 Subject: [PATCH 19/56] fix: CleanPlugin unlink same file twice (#19595) --- lib/CleanPlugin.js | 75 ++++++++++++++++++++++++++----- test/CleanPlugin.unittest.js | 87 ++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+), 10 deletions(-) create mode 100644 test/CleanPlugin.unittest.js diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js index 7bd5ac904b9..77a85147e19 100644 --- a/lib/CleanPlugin.js +++ b/lib/CleanPlugin.js @@ -6,6 +6,7 @@ "use strict"; const asyncLib = require("neo-async"); +const path = require("path"); const { SyncBailHook } = require("tapable"); const Compilation = require("./Compilation"); const createSchemaValidation = require("./util/create-schema-validation"); @@ -61,6 +62,62 @@ const mergeAssets = (as1, as2) => { } }; +/** + * @param {Map} assets current assets + * @returns {Set} Set of directory paths + */ +function getDirectories(assets) { + const directories = new Set(); + /** + * @param {string} filename asset filename + */ + const addDirectory = filename => { + directories.add(path.dirname(filename)); + }; + + // get directories of assets + for (const [asset] of assets) { + addDirectory(asset); + } + // and all parent directories + for (const directory of directories) { + addDirectory(directory); + } + 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 */ /** @@ -71,15 +128,7 @@ const mergeAssets = (as1, as2) => { * @returns {void} */ const getDiffToFs = (fs, outputPath, currentAssets, callback) => { - const directories = new Set(); - // get directories of assets - for (const [asset] of currentAssets) { - directories.add(asset.replace(/(^|\/)[^/]*$/, "")); - } - // and all parent directories - for (const directory of directories) { - directories.add(directory.replace(/(^|\/)[^/]*$/, "")); - } + const directories = getDirectories(currentAssets); const diff = new Set(); asyncLib.forEachLimit( directories, @@ -98,7 +147,10 @@ const getDiffToFs = (fs, outputPath, currentAssets, callback) => { for (const entry of /** @type {string[]} */ (entries)) { const file = entry; const filename = directory ? `${directory}/${file}` : file; - if (!directories.has(filename) && !currentAssets.has(filename)) { + if ( + !hasFile(directories, filename) && + !hasFile(currentAssets, filename) + ) { diff.add(filename); } } @@ -443,3 +495,6 @@ class CleanPlugin { } module.exports = CleanPlugin; +module.exports._getDirectories = getDirectories; +module.exports._hasFile = hasFile; +module.exports._isEqualPath = isEqualPath; diff --git a/test/CleanPlugin.unittest.js b/test/CleanPlugin.unittest.js new file mode 100644 index 00000000000..627601723d2 --- /dev/null +++ b/test/CleanPlugin.unittest.js @@ -0,0 +1,87 @@ +"use strict"; + +const { + _getDirectories, + _hasFile, + _isEqualPath +} = require("../lib/CleanPlugin"); + +describe("CleanPlugin", () => { + describe("_getDirectories", () => { + it("should return empty set when assets map is empty", () => { + const assets = new Map(); + const result = _getDirectories(assets); + expect(result).toBeInstanceOf(Set); + expect(result.size).toBe(0); + }); + + it("should extract root directory from single file path", () => { + const assets = new Map([["./static.js", 0]]); + const result = _getDirectories(assets); + expect(Array.from(result)).toEqual(["."]); + }); + + it("should extract all parent directories from deep nested path", () => { + const assets = new Map([["this/dir/should/not/be/removed/file.ext", 0]]); + const result = _getDirectories(assets); + expect(Array.from(result)).toEqual([ + "this/dir/should/not/be/removed", + "this/dir/should/not/be", + "this/dir/should/not", + "this/dir/should", + "this/dir", + "this", + "." + ]); + }); + + it("should extract root and first level directories", () => { + const assets = new Map([ + ["./main.js", 0], + ["./js/main.js", 0] + ]); + const result = _getDirectories(assets); + expect(Array.from(result)).toEqual([".", "./js"]); + }); + + it("should extract all nested directory levels", () => { + const assets = new Map([ + ["./main.js", 0], + ["./js/main.js", 0], + ["./static/js/main.js", 0] + ]); + const result = _getDirectories(assets); + expect(Array.from(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); + }); + }); +}); From 574a88736d3374af40591eeb6b61e424a5af1ee6 Mon Sep 17 00:00:00 2001 From: Ryuya Date: Thu, 12 Jun 2025 05:17:12 -0700 Subject: [PATCH 20/56] chore: update Jest to `v30` (#19604) --- .github/workflows/test.yml | 2 +- package.json | 11 +- test/StatsTestCases.basictest.js | 6 +- .../StatsTestCases.basictest.js.snap | 8 +- test/cases/chunks/context-weak/index.js | 4 +- test/cases/compile/error-hide-stack/index.js | 2 +- .../context/ignore-hidden-files/index.js | 2 +- .../import-meta-webpack-context/index.js | 2 +- test/cases/context/issue-524/index.js | 4 +- .../errors/harmony-import-missing/index.js | 2 +- .../errors/harmony-import-missing2/index.js | 4 +- test/cases/errors/load-module-error/index.js | 2 +- test/cases/esm/import-meta/index.js | 2 +- .../json/import-assertions-type-json/index.js | 2 +- .../cases/json/import-with-type-json/index.js | 2 +- test/cases/loaders/no-string/index.js | 4 +- test/cases/parsing/context/index.js | 6 +- .../parsing/harmony-commonjs-mix/module1.js | 4 +- test/cases/parsing/issue-627/dir/test.js | 2 +- test/cases/parsing/unsupported-amd/index.js | 4 +- .../asset-modules/http-url/index.errors.js | 12 +- .../container/2-container-full/index.js | 8 +- .../container/error-handling/index.js | 8 +- .../context-exclusion/simple/index.js | 6 +- .../context-replacement/c/index.js | 2 +- .../multi-entry-missing-module/index.js | 2 +- test/configCases/ignore/checkContext/test.js | 6 +- .../ignore/checkResource-one-argument/test.js | 4 +- .../checkResource-two-arguments/test.js | 6 +- .../ignore/multiple-with-externals/test.js | 6 +- .../ignore/only-resource-context/test.js | 4 +- test/configCases/ignore/only-resource/test.js | 4 +- .../test.js | 8 +- .../ignore/resource-and-context/test.js | 6 +- .../parsing/harmony-this-concat/index.js | 6 +- .../configCases/parsing/harmony-this/index.js | 6 +- test/configCases/parsing/optional/index.js | 2 +- .../parsing/system.import/index.js | 2 +- .../plugins/define-plugin/index.js | 4 +- .../runtime/invalid-esm-export/index.js | 2 +- .../runtime/opt-in-finally/index.js | 4 +- .../runtime/opt-in-finally2/index.js | 4 +- .../consume-module-ignore-warnings/index.js | 8 +- .../sharing/consume-module/index.js | 8 +- .../index.js | 2 +- .../consume-multiple-versions/index.js | 2 +- .../trusted-types/devtool-eval/index.js | 4 +- test/configCases/worker/issue-17489/index.js | 2 +- test/configCases/worker/worklet/index.js | 16 +- test/hotCases/json/error-in-json/index.js | 2 +- yarn.lock | 1325 ++++++++++------- 51 files changed, 898 insertions(+), 658 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f3ca0ed4754..a2780bac9e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -182,7 +182,7 @@ jobs: yarn --frozen-lockfile --ignore-engines if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' - run: | - yarn upgrade husky@^8.0.3 lint-staged@^13.2.1 nyc@^15.1.0 coffee-loader@1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 --ignore-engines + yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 nyc@^15.1.0 coffee-loader@1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 --ignore-engines yarn --frozen-lockfile if: matrix.node-version == '16.x' - run: | diff --git a/package.json b/package.json index ff3da3f6cbf..e39f3cf1d89 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@eslint/js": "^9.21.0", "@stylistic/eslint-plugin": "^4.2.0", "@types/glob-to-regexp": "^0.4.4", + "@types/graceful-fs": "^4.1.9", "@types/jest": "^29.5.11", "@types/mime-types": "^2.1.4", "@types/node": "^22.15.11", @@ -70,11 +71,11 @@ "hash-wasm": "^4.9.0", "husky": "^9.0.11", "istanbul": "^0.4.5", - "jest": "^29.7.0", - "jest-circus": "^29.7.0", - "jest-cli": "^29.7.0", - "jest-diff": "^29.7.0", - "jest-environment-node": "^29.7.0", + "jest": "^30.0.0", + "jest-circus": "^30.0.0", + "jest-cli": "^30.0.0", + "jest-diff": "^30.0.0", + "jest-environment-node": "^30.0.0", "jest-junit": "^16.0.0", "json-loader": "^0.5.7", "json5": "^2.1.3", diff --git a/test/StatsTestCases.basictest.js b/test/StatsTestCases.basictest.js index 534178493e1..7c3f44db8d3 100644 --- a/test/StatsTestCases.basictest.js +++ b/test/StatsTestCases.basictest.js @@ -210,7 +210,11 @@ describe("StatsTestCases", () => { .replace( /ms\s\([0-9a-f]{6,32}\)|(?![0-9]+-)[0-9a-f-]{6,32}\./g, match => `${match.replace(/[0-9a-f]/g, "X")}` - ); + ) + // Normalize stack traces between Jest v27 and v30 + // Jest v27: at Object..module.exports + // Jest v30: at Object.module.exports + .replace(/Object\.\./g, "Object."); expect(actual).toMatchSnapshot(); if (testConfig.validate) { diff --git a/test/__snapshots__/StatsTestCases.basictest.js.snap b/test/__snapshots__/StatsTestCases.basictest.js.snap index e039eb10c21..02f53d1be60 100644 --- a/test/__snapshots__/StatsTestCases.basictest.js.snap +++ b/test/__snapshots__/StatsTestCases.basictest.js.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`StatsTestCases should print correct stats for aggressive-splitting-entry 1`] = ` "fitting: @@ -1558,9 +1558,9 @@ asset main.js X bytes [emitted] (name: mai DEBUG LOG from ./node_modules/custom-loader/index.js ./node_modules/custom-loader/index.js!./index.js An error -| at Object..module.exports (Xdir/logging/node_modules/custom-loader/index.js:5:9) +| at Object.module.exports (Xdir/logging/node_modules/custom-loader/index.js:5:9) A warning -| at Object..module.exports (Xdir/logging/node_modules/custom-loader/index.js:6:9) +| at Object.module.exports (Xdir/logging/node_modules/custom-loader/index.js:6:9) <-> Unimportant Info message Just log @@ -1569,7 +1569,7 @@ asset main.js X bytes [emitted] (name: mai <-> Nested Log inside collapsed group Trace - | at Object..module.exports (Xdir/logging/node_modules/custom-loader/index.js:15:9) + | at Object.module.exports (Xdir/logging/node_modules/custom-loader/index.js:15:9) Measure: X ms ------- After clear diff --git a/test/cases/chunks/context-weak/index.js b/test/cases/chunks/context-weak/index.js index e4f711141f5..c3d6538122f 100644 --- a/test/cases/chunks/context-weak/index.js +++ b/test/cases/chunks/context-weak/index.js @@ -2,7 +2,7 @@ it("should not bundle context requires with asyncMode === 'weak'", function() { var contextRequire = require.context(".", false, /two/, "weak"); expect(function() { contextRequire("./two") - }).toThrowError(/not available/); + }).toThrow(/not available/); }); it("should not bundle context requires with asyncMode === 'weak' using import.meta.webpackContext", function() { @@ -13,7 +13,7 @@ it("should not bundle context requires with asyncMode === 'weak' using import.me }); expect(function() { contextRequire("./two") - }).toThrowError(/not available/); + }).toThrow(/not available/); }); it("should find module with asyncMode === 'weak' when required elsewhere", function() { diff --git a/test/cases/compile/error-hide-stack/index.js b/test/cases/compile/error-hide-stack/index.js index e73a65df4ee..85c538ed0e6 100644 --- a/test/cases/compile/error-hide-stack/index.js +++ b/test/cases/compile/error-hide-stack/index.js @@ -1,5 +1,5 @@ it("should hide stack in details", function() { expect(function f() { require("./loader!"); - }).toThrowError(); + }).toThrow(); }); diff --git a/test/cases/context/ignore-hidden-files/index.js b/test/cases/context/ignore-hidden-files/index.js index 83313cd16e2..df90fc86515 100644 --- a/test/cases/context/ignore-hidden-files/index.js +++ b/test/cases/context/ignore-hidden-files/index.js @@ -2,5 +2,5 @@ it("should ignore hidden files", function() { expect(function() { var name = "./file.js"; require("./folder/" + name); - }).toThrowError(); + }).toThrow(); }); \ No newline at end of file diff --git a/test/cases/context/import-meta-webpack-context/index.js b/test/cases/context/import-meta-webpack-context/index.js index 9ad5d42ee59..2c60e21152e 100644 --- a/test/cases/context/import-meta-webpack-context/index.js +++ b/test/cases/context/import-meta-webpack-context/index.js @@ -15,7 +15,7 @@ it("should allow include/exclude", function() { }); expect(function() { contextRequire("./two-three") - }).toThrowError(/Cannot find module/); + }).toThrow(/Cannot find module/); }); it("should allow chunkName", function() { diff --git a/test/cases/context/issue-524/index.js b/test/cases/context/issue-524/index.js index 4c0c7721c43..0c86b25d4f6 100644 --- a/test/cases/context/issue-524/index.js +++ b/test/cases/context/issue-524/index.js @@ -3,9 +3,9 @@ it("should support an empty context", function() { expect(typeof c.id === "number" || typeof c.id === "string").toBeTruthy(); expect(function() { c.resolve(""); - }).toThrowError(); + }).toThrow(); expect(function() { c(""); - }).toThrowError(); + }).toThrow(); expect(c.keys()).toEqual([]); }); diff --git a/test/cases/errors/harmony-import-missing/index.js b/test/cases/errors/harmony-import-missing/index.js index 14db1676922..278c5637578 100644 --- a/test/cases/errors/harmony-import-missing/index.js +++ b/test/cases/errors/harmony-import-missing/index.js @@ -1,5 +1,5 @@ it("should not crash on importing missing modules", function() { expect(function() { require("./module"); - }).toThrowError(); + }).toThrow(); }); diff --git a/test/cases/errors/harmony-import-missing2/index.js b/test/cases/errors/harmony-import-missing2/index.js index 77cb8d2ed72..8f416c73d92 100644 --- a/test/cases/errors/harmony-import-missing2/index.js +++ b/test/cases/errors/harmony-import-missing2/index.js @@ -1,11 +1,11 @@ it("should not crash on importing missing modules", function() { expect(function() { require("./module1"); - }).toThrowError(); + }).toThrow(); }); it("should not crash on importing missing modules", function() { expect(function() { require("./module2"); - }).toThrowError(); + }).toThrow(); }); diff --git a/test/cases/errors/load-module-error/index.js b/test/cases/errors/load-module-error/index.js index e724ffff78f..29da61868cc 100644 --- a/test/cases/errors/load-module-error/index.js +++ b/test/cases/errors/load-module-error/index.js @@ -1,5 +1,5 @@ it("should error loadModule when the referenced module contains errors", () => { expect(function() { require("./loader!./a") - }).toThrowError(); + }).toThrow(); }); diff --git a/test/cases/esm/import-meta/index.js b/test/cases/esm/import-meta/index.js index 8f57a9a700f..97fea14af75 100644 --- a/test/cases/esm/import-meta/index.js +++ b/test/cases/esm/import-meta/index.js @@ -41,7 +41,7 @@ it("should return correct import.meta.webpack", () => { it("should return undefined for unknown property", () => { expect(import.meta.other).toBe(undefined); if (typeof import.meta.other !== "undefined") require("fail"); - expect(() => import.meta.other.other.other).toThrowError(); + expect(() => import.meta.other.other.other).toThrow(); }); it("should add warning on direct import.meta usage", () => { diff --git a/test/cases/json/import-assertions-type-json/index.js b/test/cases/json/import-assertions-type-json/index.js index d757fbaf4aa..48af30a044f 100644 --- a/test/cases/json/import-assertions-type-json/index.js +++ b/test/cases/json/import-assertions-type-json/index.js @@ -17,5 +17,5 @@ it("should be possible to import js without extension without import assertion i it("should not be possible to import js with import assertion", function () { expect(() => { require("./import-poison.js"); - }).toThrowError(); + }).toThrow(); }); diff --git a/test/cases/json/import-with-type-json/index.js b/test/cases/json/import-with-type-json/index.js index 95e23f74729..3ecb2e20d85 100644 --- a/test/cases/json/import-with-type-json/index.js +++ b/test/cases/json/import-with-type-json/index.js @@ -17,5 +17,5 @@ it("should be possible to import js without extension without import assertion i it("should not be possible to import js with import assertion", function () { expect(() => { require("./import-poison.js"); - }).toThrowError(); + }).toThrow(); }); diff --git a/test/cases/loaders/no-string/index.js b/test/cases/loaders/no-string/index.js index a7205631c24..68f841bfb1f 100644 --- a/test/cases/loaders/no-string/index.js +++ b/test/cases/loaders/no-string/index.js @@ -1,8 +1,8 @@ it("should emit the correct error for loaders not returning buffer or string", function() { - expect(() => require("./loader.js!./file.js")).toThrowError( + expect(() => require("./loader.js!./file.js")).toThrow( /Module build failed/ ); - expect(() => require("./loader.js!./pitch-loader.js!./file.js")).toThrowError( + expect(() => require("./loader.js!./pitch-loader.js!./file.js")).toThrow( /Module build failed/ ); }); diff --git a/test/cases/parsing/context/index.js b/test/cases/parsing/context/index.js index c2bbbc43eef..2f37e347cb8 100644 --- a/test/cases/parsing/context/index.js +++ b/test/cases/parsing/context/index.js @@ -37,15 +37,15 @@ it("should compile an empty context", function() { var x = "xxx"; expect(function() { require("./templates/notExisting" + x); - }).toThrowError(/xxx/); + }).toThrow(/xxx/); }); it("should execute an empty context", function() { var context; expect(function() { context = require.context("./templates/", true, /^\.\/notExisting/); - }).not.toThrowError(); + }).not.toThrow(); expect(function() { context(""); - }).toThrowError(); + }).toThrow(); }); diff --git a/test/cases/parsing/harmony-commonjs-mix/module1.js b/test/cases/parsing/harmony-commonjs-mix/module1.js index 45bb8d02e35..28c4b2a59e0 100644 --- a/test/cases/parsing/harmony-commonjs-mix/module1.js +++ b/test/cases/parsing/harmony-commonjs-mix/module1.js @@ -2,14 +2,14 @@ import "./module"; expect(function() { module.exports = 1; -}).toThrowError(); +}).toThrow(); expect((typeof module.exports)).toBe("undefined"); expect((typeof define)).toBe("undefined"); expect(function() { define(function() {}) -}).toThrowError(/define is not defined/); +}).toThrow(/define is not defined/); export default 1234; diff --git a/test/cases/parsing/issue-627/dir/test.js b/test/cases/parsing/issue-627/dir/test.js index 71bf065207c..7a56e2548cd 100644 --- a/test/cases/parsing/issue-627/dir/test.js +++ b/test/cases/parsing/issue-627/dir/test.js @@ -1,4 +1,4 @@ expect(function() { var expr1 = "a", expr2 = "b"; require(Math.random() < 0.5 ? expr1 : expr2); -}).toThrowError(); +}).toThrow(); diff --git a/test/cases/parsing/unsupported-amd/index.js b/test/cases/parsing/unsupported-amd/index.js index db59455784f..3e016f87b67 100644 --- a/test/cases/parsing/unsupported-amd/index.js +++ b/test/cases/parsing/unsupported-amd/index.js @@ -2,7 +2,7 @@ it("should fail on unsupported use of AMD require 1", function() { expect(function() { var abc = ["./a", "./b"]; require(abc, function(a, b) {}); - }).toThrowError(); + }).toThrow(); }); it("should fail on unsupported use of AMD require 2", function() { @@ -10,5 +10,5 @@ it("should fail on unsupported use of AMD require 2", function() { var abc = ["./a", "./b"]; function f(a, b) {} require(abc, f); - }).toThrowError(); + }).toThrow(); }); diff --git a/test/configCases/asset-modules/http-url/index.errors.js b/test/configCases/asset-modules/http-url/index.errors.js index ee4a379b4e2..47b442f7f18 100644 --- a/test/configCases/asset-modules/http-url/index.errors.js +++ b/test/configCases/asset-modules/http-url/index.errors.js @@ -1,22 +1,22 @@ it("error when lockfile is outdated/invalid", () => { expect(() => { require("http://localhost:9990/index.css?cache"); - }).toThrowError(); + }).toThrow(); expect(() => { require("http://localhost:9990/index.css?no-cache"); - }).toThrowError(); + }).toThrow(); expect(() => { require("http://localhost:9990/index.css"); - }).toThrowError(); + }).toThrow(); expect(() => { require("http://localhost:9990/resolve.js"); - }).toThrowError(); + }).toThrow(); expect(() => { require("http://localhost:9990/fallback.js"); - }).toThrowError(); + }).toThrow(); expect(() => { require("http://localhost:9990/redirect"); - }).toThrowError(); + }).toThrow(); }); import text from "http://localhost:9990/asset.txt?ignore"; diff --git a/test/configCases/container/2-container-full/index.js b/test/configCases/container/2-container-full/index.js index 4dcf93a5a1e..a07bb250faa 100644 --- a/test/configCases/container/2-container-full/index.js +++ b/test/configCases/container/2-container-full/index.js @@ -17,12 +17,8 @@ const expectWarning = regexp => { if (!regexp) { expect(warnings).toEqual([]); } else { - expect(warnings).toEqual( - expect.objectContaining({ - 0: expect.stringMatching(regexp), - length: 1 - }) - ); + expect(warnings).toHaveLength(1); + expect(warnings[0]).toMatch(regexp); } warnings.length = 0; }; diff --git a/test/configCases/container/error-handling/index.js b/test/configCases/container/error-handling/index.js index a3a080b43cc..f5c7a1a4620 100644 --- a/test/configCases/container/error-handling/index.js +++ b/test/configCases/container/error-handling/index.js @@ -19,12 +19,8 @@ const expectWarning = regexp => { if (!regexp) { expect(warnings).toEqual([]); } else { - expect(warnings).toEqual( - expect.objectContaining({ - 0: expect.stringMatching(regexp), - length: 1 - }) - ); + expect(warnings).toHaveLength(1); + expect(warnings[0]).toMatch(regexp); } warnings.length = 0; }; diff --git a/test/configCases/context-exclusion/simple/index.js b/test/configCases/context-exclusion/simple/index.js index 47eb9afe063..d94fe895a60 100644 --- a/test/configCases/context-exclusion/simple/index.js +++ b/test/configCases/context-exclusion/simple/index.js @@ -9,9 +9,9 @@ it("should not exclude paths not matching the exclusion pattern", function() { }); it("should exclude paths/files matching the exclusion pattern", function() { - expect(() => requireInContext("dont")).toThrowError(/Cannot find module '.\/dont'/); + expect(() => requireInContext("dont")).toThrow(/Cannot find module '.\/dont'/); - expect(() => requireInContext("dont-check-here/file")).toThrowError(/Cannot find module '.\/dont-check-here\/file'/); + expect(() => requireInContext("dont-check-here/file")).toThrow(/Cannot find module '.\/dont-check-here\/file'/); - expect(() => requireInContext("check-here/dont-check-here/file")).toThrowError(/Cannot find module '.\/check-here\/dont-check-here\/file'/); + expect(() => requireInContext("check-here/dont-check-here/file")).toThrow(/Cannot find module '.\/check-here\/dont-check-here\/file'/); }); diff --git a/test/configCases/context-replacement/c/index.js b/test/configCases/context-replacement/c/index.js index 5ee5fb8bb91..0fec479f2b8 100644 --- a/test/configCases/context-replacement/c/index.js +++ b/test/configCases/context-replacement/c/index.js @@ -9,5 +9,5 @@ it("should replace a context with a manual map", function() { expect(rqInContext("./d")).toBe("d"); (expect(function() { rqInContext("module-b") - }).toThrowError()); + }).toThrow()); }); diff --git a/test/configCases/errors/multi-entry-missing-module/index.js b/test/configCases/errors/multi-entry-missing-module/index.js index b7603e051c5..ac6a05d6c5c 100644 --- a/test/configCases/errors/multi-entry-missing-module/index.js +++ b/test/configCases/errors/multi-entry-missing-module/index.js @@ -5,5 +5,5 @@ it("should ignore missing modules as entries", function() { it("should use WebpackMissingModule when evaluating missing modules", function() { expect(function() { require("./intentionally-missing-module"); - }).toThrowError("Cannot find module './intentionally-missing-module'"); + }).toThrow("Cannot find module './intentionally-missing-module'"); }); diff --git a/test/configCases/ignore/checkContext/test.js b/test/configCases/ignore/checkContext/test.js index ae4f1ae2c67..14e1c3be363 100644 --- a/test/configCases/ignore/checkContext/test.js +++ b/test/configCases/ignore/checkContext/test.js @@ -4,17 +4,17 @@ it("should ignore resources that match resource regex and context", function() { expect(function() { require("./folder-b/normal-module"); - }).toThrowError(); + }).toThrow(); }); it("should not ignore resources that match resource but not context", function() { expect(function() { require("./folder-a/normal-module"); - }).not.toThrowError(); + }).not.toThrow(); }); it("should not ignore resources that do not match resource but do match context", function() { expect(function() { require("./folder-b/only-context-match"); - }).not.toThrowError(); + }).not.toThrow(); }); diff --git a/test/configCases/ignore/checkResource-one-argument/test.js b/test/configCases/ignore/checkResource-one-argument/test.js index 93ce8146bd8..e08631dfa2e 100644 --- a/test/configCases/ignore/checkResource-one-argument/test.js +++ b/test/configCases/ignore/checkResource-one-argument/test.js @@ -4,10 +4,10 @@ it("should ignore ignored resources", function() { expect(function() { require("./ignored-module"); - }).toThrowError(); + }).toThrow(); }); it("should not ignore resources that do not match", function() { expect(function() { require("./normal-module"); - }).not.toThrowError(); + }).not.toThrow(); }); diff --git a/test/configCases/ignore/checkResource-two-arguments/test.js b/test/configCases/ignore/checkResource-two-arguments/test.js index ae4f1ae2c67..14e1c3be363 100644 --- a/test/configCases/ignore/checkResource-two-arguments/test.js +++ b/test/configCases/ignore/checkResource-two-arguments/test.js @@ -4,17 +4,17 @@ it("should ignore resources that match resource regex and context", function() { expect(function() { require("./folder-b/normal-module"); - }).toThrowError(); + }).toThrow(); }); it("should not ignore resources that match resource but not context", function() { expect(function() { require("./folder-a/normal-module"); - }).not.toThrowError(); + }).not.toThrow(); }); it("should not ignore resources that do not match resource but do match context", function() { expect(function() { require("./folder-b/only-context-match"); - }).not.toThrowError(); + }).not.toThrow(); }); diff --git a/test/configCases/ignore/multiple-with-externals/test.js b/test/configCases/ignore/multiple-with-externals/test.js index caa14b2abb1..05abfecc6d2 100644 --- a/test/configCases/ignore/multiple-with-externals/test.js +++ b/test/configCases/ignore/multiple-with-externals/test.js @@ -4,15 +4,15 @@ it("should ignore ignored resources 1", function() { expect(function() { require("./ignored-module1"); - }).toThrowError(); + }).toThrow(); }); it("should ignore ignored resources 2", function() { expect(function() { require("./ignored-module2"); - }).toThrowError(); + }).toThrow(); }); it("should not ignore resources that do not match", function() { expect(function() { require("./normal-module"); - }).not.toThrowError(); + }).not.toThrow(); }); diff --git a/test/configCases/ignore/only-resource-context/test.js b/test/configCases/ignore/only-resource-context/test.js index 9fd0c934b91..075ec107f32 100644 --- a/test/configCases/ignore/only-resource-context/test.js +++ b/test/configCases/ignore/only-resource-context/test.js @@ -8,7 +8,7 @@ it("should ignore ignored resources", function() { expect(function() { folderBContext("ignored-module"); - }).toThrowError(); + }).toThrow(); }); it("should not ignore resources that do not match", function() { const folderBContext = function(mod) { @@ -17,5 +17,5 @@ it("should not ignore resources that do not match", function() { expect(function() { folderBContext("normal-module"); - }).not.toThrowError(); + }).not.toThrow(); }); diff --git a/test/configCases/ignore/only-resource/test.js b/test/configCases/ignore/only-resource/test.js index 93ce8146bd8..e08631dfa2e 100644 --- a/test/configCases/ignore/only-resource/test.js +++ b/test/configCases/ignore/only-resource/test.js @@ -4,10 +4,10 @@ it("should ignore ignored resources", function() { expect(function() { require("./ignored-module"); - }).toThrowError(); + }).toThrow(); }); it("should not ignore resources that do not match", function() { expect(function() { require("./normal-module"); - }).not.toThrowError(); + }).not.toThrow(); }); diff --git a/test/configCases/ignore/resource-and-context-contextmodule/test.js b/test/configCases/ignore/resource-and-context-contextmodule/test.js index 61d1a30584a..7b6c5c55109 100644 --- a/test/configCases/ignore/resource-and-context-contextmodule/test.js +++ b/test/configCases/ignore/resource-and-context-contextmodule/test.js @@ -8,7 +8,7 @@ it("should ignore context modules that match resource regex and context", functi expect(function() { folderBContext("normal-module"); - }).toThrowError(); + }).toThrow(); }); it("should not ignore context modules that do not match the resource", function() { @@ -18,7 +18,7 @@ it("should not ignore context modules that do not match the resource", function( expect(function() { folderBContext("only-context-match"); - }).not.toThrowError(); + }).not.toThrow(); }); it("should not ignore context modules that do not match the context", function() { @@ -28,8 +28,8 @@ it("should not ignore context modules that do not match the context", function() expect(function() { folderBContext("normal-module"); - }).not.toThrowError(); + }).not.toThrow(); expect(function() { folderBContext("ignored-module"); - }).not.toThrowError(); + }).not.toThrow(); }); diff --git a/test/configCases/ignore/resource-and-context/test.js b/test/configCases/ignore/resource-and-context/test.js index ae4f1ae2c67..14e1c3be363 100644 --- a/test/configCases/ignore/resource-and-context/test.js +++ b/test/configCases/ignore/resource-and-context/test.js @@ -4,17 +4,17 @@ it("should ignore resources that match resource regex and context", function() { expect(function() { require("./folder-b/normal-module"); - }).toThrowError(); + }).toThrow(); }); it("should not ignore resources that match resource but not context", function() { expect(function() { require("./folder-a/normal-module"); - }).not.toThrowError(); + }).not.toThrow(); }); it("should not ignore resources that do not match resource but do match context", function() { expect(function() { require("./folder-b/only-context-match"); - }).not.toThrowError(); + }).not.toThrow(); }); diff --git a/test/configCases/parsing/harmony-this-concat/index.js b/test/configCases/parsing/harmony-this-concat/index.js index e4ecf860e0a..cf3acc6af9a 100644 --- a/test/configCases/parsing/harmony-this-concat/index.js +++ b/test/configCases/parsing/harmony-this-concat/index.js @@ -13,13 +13,13 @@ it("should have this = undefined on harmony modules", () => { expect((typeof abc.returnThisArrow())).toBe("undefined"); expect(function() { returnThisMember(); - }).toThrowError(); + }).toThrow(); expect(function() { abc.returnThisMember(); - }).toThrowError(); + }).toThrow(); expect(function() { extendThisClass(); - }).toThrowError(); + }).toThrow(); }); it("should not break classes and functions", () => { diff --git a/test/configCases/parsing/harmony-this/index.js b/test/configCases/parsing/harmony-this/index.js index 531f7a7bef5..605d21c00de 100644 --- a/test/configCases/parsing/harmony-this/index.js +++ b/test/configCases/parsing/harmony-this/index.js @@ -13,13 +13,13 @@ it("should have this = undefined on harmony modules", () => { expect((typeof abc.returnThisArrow())).toBe("undefined"); expect(function() { returnThisMember(); - }).toThrowError(); + }).toThrow(); expect(function() { abc.returnThisMember(); - }).toThrowError(); + }).toThrow(); expect(function() { extendThisClass(); - }).toThrowError(); + }).toThrow(); }); it("should not break classes and functions", () => { diff --git a/test/configCases/parsing/optional/index.js b/test/configCases/parsing/optional/index.js index cca013cc054..aac2a938aa2 100644 --- a/test/configCases/parsing/optional/index.js +++ b/test/configCases/parsing/optional/index.js @@ -7,5 +7,5 @@ it("should not fail for optional modules with bail", () => { } expect(() => { throw error; - }).toThrowError(); + }).toThrow(); }); diff --git a/test/configCases/parsing/system.import/index.js b/test/configCases/parsing/system.import/index.js index 52b10dd9e4c..d906997798b 100644 --- a/test/configCases/parsing/system.import/index.js +++ b/test/configCases/parsing/system.import/index.js @@ -12,7 +12,7 @@ it("should answer typeof System.import correctly", () => { } else { expect(() => { typeof System.import; - }).toThrowError(); + }).toThrow(); } }); diff --git a/test/configCases/plugins/define-plugin/index.js b/test/configCases/plugins/define-plugin/index.js index 33282fba0f8..8c6d684a743 100644 --- a/test/configCases/plugins/define-plugin/index.js +++ b/test/configCases/plugins/define-plugin/index.js @@ -212,7 +212,7 @@ it("should not explode on recursive typeof calls", function() { it("should not explode on recursive statements", function() { expect(function() { wurst; // <- is recursively defined in config - }).toThrowError("suppe is not defined"); + }).toThrow("suppe is not defined"); }); it("should evaluate composed expressions (issue 5100)", function() { @@ -293,5 +293,5 @@ it('should allow shorthand property (issue #16764)', () => { }) it("fails for unknown property", () => { - expect(() => ({ UNKNOWN })).toThrowError("UNKNOWN is not defined") + expect(() => ({ UNKNOWN })).toThrow("UNKNOWN is not defined") }) \ No newline at end of file diff --git a/test/configCases/runtime/invalid-esm-export/index.js b/test/configCases/runtime/invalid-esm-export/index.js index a25f46d5973..3f4958b21c6 100644 --- a/test/configCases/runtime/invalid-esm-export/index.js +++ b/test/configCases/runtime/invalid-esm-export/index.js @@ -1,7 +1,7 @@ it("should throw exception when module.exports is assigned in es module", function() { expect(function() { require("./esm-import-cjs-export"); - }).toThrowError( + }).toThrow( 'ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ./esm-import-cjs-export.js' ); }); diff --git a/test/configCases/runtime/opt-in-finally/index.js b/test/configCases/runtime/opt-in-finally/index.js index 5d0bac929f9..576d2e21499 100644 --- a/test/configCases/runtime/opt-in-finally/index.js +++ b/test/configCases/runtime/opt-in-finally/index.js @@ -1,8 +1,8 @@ it("should throw exception on every try to load a module", function() { expect(function() { require("./exception"); - }).toThrowError(); + }).toThrow(); expect(function() { require("./exception"); - }).toThrowError(); + }).toThrow(); }); diff --git a/test/configCases/runtime/opt-in-finally2/index.js b/test/configCases/runtime/opt-in-finally2/index.js index 5d0bac929f9..576d2e21499 100644 --- a/test/configCases/runtime/opt-in-finally2/index.js +++ b/test/configCases/runtime/opt-in-finally2/index.js @@ -1,8 +1,8 @@ it("should throw exception on every try to load a module", function() { expect(function() { require("./exception"); - }).toThrowError(); + }).toThrow(); expect(function() { require("./exception"); - }).toThrowError(); + }).toThrow(); }); diff --git a/test/configCases/sharing/consume-module-ignore-warnings/index.js b/test/configCases/sharing/consume-module-ignore-warnings/index.js index 43a7d1832d1..8a299ca5d8c 100644 --- a/test/configCases/sharing/consume-module-ignore-warnings/index.js +++ b/test/configCases/sharing/consume-module-ignore-warnings/index.js @@ -17,12 +17,8 @@ const expectWarning = regexp => { if (!regexp) { expect(warnings).toEqual([]); } else { - expect(warnings).toEqual( - expect.objectContaining({ - 0: expect.stringMatching(regexp), - length: 1 - }) - ); + expect(warnings).toHaveLength(1); + expect(warnings[0]).toMatch(regexp); } warnings.length = 0; }; diff --git a/test/configCases/sharing/consume-module/index.js b/test/configCases/sharing/consume-module/index.js index 442fdecde73..6761fe7c9d5 100644 --- a/test/configCases/sharing/consume-module/index.js +++ b/test/configCases/sharing/consume-module/index.js @@ -17,12 +17,8 @@ const expectWarning = regexp => { if (!regexp) { expect(warnings).toEqual([]); } else { - expect(warnings).toEqual( - expect.objectContaining({ - 0: expect.stringMatching(regexp), - length: 1 - }) - ); + expect(warnings).toHaveLength(1); + expect(warnings[0]).toMatch(regexp); } warnings.length = 0; }; diff --git a/test/configCases/sharing/consume-multiple-versions-ignore-warnings/index.js b/test/configCases/sharing/consume-multiple-versions-ignore-warnings/index.js index da18374d39d..3e28b4cf90e 100644 --- a/test/configCases/sharing/consume-multiple-versions-ignore-warnings/index.js +++ b/test/configCases/sharing/consume-multiple-versions-ignore-warnings/index.js @@ -38,7 +38,7 @@ it("should be able to consume different shared module version depending on conte expect(require("shared")).toBe("shared@1.9.9"); expect(require("my-module")).toBe("shared@2.9.9"); expect(require("my-module2")).toBe("shared@2.3.9"); - expect(() => require("my-module3")).toThrowError( + expect(() => require("my-module3")).toThrow( "No satisfying version (^3.4.5) of shared module shared found in shared scope default.\n" + "Available versions: 9.9.9 from undefined, 1.9.9 from undefined, 1.2.9 from undefined, 1.2.3 from mfe1, 2.9.9 from undefined, 2.3.9 from undefined, 2.3.4 from undefined, 3.0.0 from undefined" ); diff --git a/test/configCases/sharing/consume-multiple-versions/index.js b/test/configCases/sharing/consume-multiple-versions/index.js index 2375def871d..1d57db57e06 100644 --- a/test/configCases/sharing/consume-multiple-versions/index.js +++ b/test/configCases/sharing/consume-multiple-versions/index.js @@ -161,7 +161,7 @@ it("should be able to consume different shared module version depending on conte expect(require("shared")).toBe("shared@1.9.9"); expect(require("my-module")).toBe("shared@2.9.9"); expect(require("my-module2")).toBe("shared@2.3.9"); - expect(() => require("my-module3")).toThrowError( + expect(() => require("my-module3")).toThrow( "No satisfying version (^3.4.5) of shared module shared found in shared scope default.\n" + "Available versions: 9.9.9 from undefined, 1.9.9 from undefined, 1.2.9 from undefined, 1.2.3 from mfe1, 2.9.9 from undefined, 2.3.9 from undefined, 2.3.4 from undefined, 3.0.0 from undefined" ); diff --git a/test/configCases/trusted-types/devtool-eval/index.js b/test/configCases/trusted-types/devtool-eval/index.js index 5499320847f..1ff2afb55f9 100644 --- a/test/configCases/trusted-types/devtool-eval/index.js +++ b/test/configCases/trusted-types/devtool-eval/index.js @@ -11,10 +11,10 @@ it("should pass TrustedScript to eval", function () { const testPattern = "var test = {\\s*foo: 'bar'\\s*};\\s*module.exports = test;"; - expect(policy.createScript).toBeCalledWith( + expect(policy.createScript).toHaveBeenCalledWith( expect.stringMatching(testPattern) ); - expect(window.eval).toBeCalledWith( + expect(window.eval).toHaveBeenCalledWith( expect.objectContaining({ _script: expect.stringMatching(testPattern) }) diff --git a/test/configCases/worker/issue-17489/index.js b/test/configCases/worker/issue-17489/index.js index 46c056f4148..a9a22ddb245 100644 --- a/test/configCases/worker/issue-17489/index.js +++ b/test/configCases/worker/issue-17489/index.js @@ -9,7 +9,7 @@ it("should allow to create a paintWorklet worklet", async () => { pseudoWorklet = new pseudoWorklet(); - expect(pseudoWorklet.url).not.toContain("asset-"); + expect(pseudoWorklet.url.toString()).not.toMatch(/asset-/); pseudoWorklet.postMessage("ok"); diff --git a/test/configCases/worker/worklet/index.js b/test/configCases/worker/worklet/index.js index 629fdff08e7..f64da832cb7 100644 --- a/test/configCases/worker/worklet/index.js +++ b/test/configCases/worker/worklet/index.js @@ -6,7 +6,7 @@ it("should allow to create a paintWorklet worklet", async () => { pseudoWorklet = new pseudoWorklet(); - expect(pseudoWorklet.url).not.toContain("asset-"); + expect(pseudoWorklet.url.toString()).not.toMatch(/asset-/); pseudoWorklet.postMessage("ok"); @@ -25,7 +25,7 @@ it("should allow to create a layoutWorklet worklet", async () => { pseudoWorklet = new pseudoWorklet(); - expect(pseudoWorklet.url).not.toContain("asset-"); + expect(pseudoWorklet.url.toString()).not.toMatch(/asset-/); pseudoWorklet.postMessage("ok"); @@ -44,7 +44,7 @@ it("should allow to create a animationWorklet worklet", async () => { pseudoWorklet = new pseudoWorklet(); - expect(pseudoWorklet.url).not.toContain("asset-"); + expect(pseudoWorklet.url.toString()).not.toMatch(/asset-/); pseudoWorklet.postMessage("ok"); @@ -64,7 +64,7 @@ it("should allow to create a audioWorklet worklet", async () => { pseudoWorklet = new pseudoWorklet(); - expect(pseudoWorklet.url).not.toContain("asset-"); + expect(pseudoWorklet.url.toString()).not.toMatch(/asset-/); pseudoWorklet.postMessage("ok"); @@ -83,7 +83,7 @@ it("should allow to create a paintWorklet worklet using '?.'", async () => { pseudoWorklet = new pseudoWorklet(); - expect(pseudoWorklet.url).not.toContain("asset-"); + expect(pseudoWorklet.url.toString()).not.toMatch(/asset-/); pseudoWorklet.postMessage("ok"); @@ -103,7 +103,7 @@ it("should allow to create a audioWorklet worklet #2", async () => { pseudoWorklet = new pseudoWorklet(); - expect(pseudoWorklet.url).not.toContain("asset-"); + expect(pseudoWorklet.url.toString()).not.toMatch(/asset-/); pseudoWorklet.postMessage("ok"); @@ -127,7 +127,7 @@ it("should allow to create a audioWorklet worklet #3", async () => { pseudoWorklet = new pseudoWorklet(); - expect(pseudoWorklet.url).not.toContain("asset-"); + expect(pseudoWorklet.url.toString()).not.toMatch(/asset-/); pseudoWorklet.postMessage("ok"); @@ -147,7 +147,7 @@ it("should allow to create a audioWorklet worklet using '?.'", async () => { pseudoWorklet = new pseudoWorklet(); - expect(pseudoWorklet.url).not.toContain("asset-"); + expect(pseudoWorklet.url.toString()).not.toMatch(/asset-/); pseudoWorklet.postMessage("ok"); diff --git a/test/hotCases/json/error-in-json/index.js b/test/hotCases/json/error-in-json/index.js index 5b6a25ab2be..e5da5d0e873 100644 --- a/test/hotCases/json/error-in-json/index.js +++ b/test/hotCases/json/error-in-json/index.js @@ -1,5 +1,5 @@ it("should be able to recover from json error", function(done) { - expect(() => require("./data.json")).toThrowError(); + expect(() => require("./data.json")).toThrow(); module.hot.accept("./data.json", function() { expect(require("./data.json")).toBe(42); done(); diff --git a/yarn.lock b/yarn.lock index df0f30c8596..9003a9dd445 100644 --- a/yarn.lock +++ b/yarn.lock @@ -34,7 +34,7 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.27.3.tgz#cc49c2ac222d69b889bf34c795f537c0c6311111" integrity sha512-V42wFfx1ymFte+ecf6iXghnnP8kWTO+ZLXIyZq+1LAXHHvTZdVxicn4yiVYdYMGaCO3tmqub11AorKkv+iodqw== -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9", "@babel/core@^7.27.1": +"@babel/core@^7.23.9", "@babel/core@^7.27.1", "@babel/core@^7.27.4": version "7.27.4" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.27.4.tgz#cc1fc55d0ce140a1828d1dd2a2eba285adbfb3ce" integrity sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g== @@ -55,12 +55,12 @@ json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.27.3", "@babel/generator@^7.7.2": - version "7.27.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.3.tgz#ef1c0f7cfe3b5fc8cbb9f6cc69f93441a68edefc" - integrity sha512-xnlJYj5zepml8NXtjkG0WquFUv8RskFqyFcVgTBp5k+NaA/8uw/K+OSVf8AMGw5e9HKP2ETd5xpK5MLZQD6b4Q== +"@babel/generator@^7.27.3", "@babel/generator@^7.27.5": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.5.tgz#3eb01866b345ba261b04911020cbe22dd4be8c8c" + integrity sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw== dependencies: - "@babel/parser" "^7.27.3" + "@babel/parser" "^7.27.5" "@babel/types" "^7.27.3" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" @@ -129,10 +129,10 @@ "@babel/template" "^7.27.2" "@babel/types" "^7.27.3" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.27.3", "@babel/parser@^7.27.4", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": - version "7.27.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.4.tgz#f92e89e4f51847be05427285836fc88341c956df" - integrity sha512-BRmLHGwpUqLFR2jzx9orBuX/ABDkj2jLKOXrHDTN2aOKL+jFDDKaRNo9nyYsIl9h/UE/7lMKdDjKQQyxKKDZ7g== +"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.27.3", "@babel/parser@^7.27.4", "@babel/parser@^7.27.5", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.5.tgz#ed22f871f110aa285a6fd934a0efed621d118826" + integrity sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg== dependencies: "@babel/types" "^7.27.3" @@ -185,7 +185,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.27.1", "@babel/plugin-syntax-jsx@^7.7.2": +"@babel/plugin-syntax-jsx@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.27.1.tgz#2f9beb5eff30fa507c5532d107daac7b888fa34c" integrity sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w== @@ -248,12 +248,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-typescript@^7.7.2": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz#67dda2b74da43727cf21d46cf9afef23f4365399" - integrity sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ== +"@babel/plugin-syntax-typescript@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" + integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-transform-react-display-name@^7.27.1": version "7.27.1" @@ -300,7 +300,7 @@ "@babel/plugin-transform-react-jsx-development" "^7.27.1" "@babel/plugin-transform-react-pure-annotations" "^7.27.1" -"@babel/template@^7.27.2", "@babel/template@^7.3.3": +"@babel/template@^7.27.2": version "7.27.2" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d" integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw== @@ -322,7 +322,7 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.3.3", "@babel/types@^7.6.1", "@babel/types@^7.9.6": +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.6.1", "@babel/types@^7.9.6": version "7.27.3" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.3.tgz#c0257bedf33aad6aad1f406d35c44758321eb3ec" integrity sha512-Y1GkI4ktrtvmawoSq+4FCVHNryea6uR+qUQy0AGxLSsjCX0nVmkYQMBLHDkXZuo5hGx7eYdnIaslsdBFm7zbUw== @@ -768,6 +768,28 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.6.3.tgz#f13c7c205915eb91ae54c557f5e92bddd8be0e83" integrity sha512-4B4OijXeVNOPZlYA2oEwWOTkzyltLao+xbotHQeqN++Rv27Y6s818+n2Qkp8q+Fxhn0t/5lA5X1Mxktud8eayQ== +"@emnapi/core@^1.4.3": + version "1.4.3" + resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.4.3.tgz#9ac52d2d5aea958f67e52c40a065f51de59b77d6" + integrity sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g== + dependencies: + "@emnapi/wasi-threads" "1.0.2" + tslib "^2.4.0" + +"@emnapi/runtime@^1.4.3": + version "1.4.3" + resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.4.3.tgz#c0564665c80dc81c448adac23f9dfbed6c838f7d" + integrity sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ== + dependencies: + tslib "^2.4.0" + +"@emnapi/wasi-threads@1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.0.2.tgz#977f44f844eac7d6c138a415a123818c655f874c" + integrity sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA== + dependencies: + tslib "^2.4.0" + "@es-joy/jsdoccomment@~0.49.0": version "0.49.0" resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.49.0.tgz#e5ec1eda837c802eca67d3b29e577197f14ba1db" @@ -921,61 +943,73 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" - integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== +"@jest/console@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-30.0.0.tgz#7f8f66adc20ea795cc74afb74280e08947e55c13" + integrity sha512-vfpJap6JZQ3I8sUN8dsFqNAKJYO4KIGxkcB+3Fw7Q/BJiWY5HwtMMiuT1oP0avsiDhjE/TCLaDgbGfHwDdBVeg== dependencies: - "@jest/types" "^29.6.3" + "@jest/types" "30.0.0" "@types/node" "*" - chalk "^4.0.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" + chalk "^4.1.2" + jest-message-util "30.0.0" + jest-util "30.0.0" slash "^3.0.0" -"@jest/core@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" - integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== - dependencies: - "@jest/console" "^29.7.0" - "@jest/reporters" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" +"@jest/core@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-30.0.0.tgz#2ea3e63dd193af0b986f70b01c2597efd0e10b27" + integrity sha512-1zU39zFtWSl5ZuDK3Rd6P8S28MmS4F11x6Z4CURrgJ99iaAJg68hmdJ2SAHEEO6ociaNk43UhUYtHxWKEWoNYw== + dependencies: + "@jest/console" "30.0.0" + "@jest/pattern" "30.0.0" + "@jest/reporters" "30.0.0" + "@jest/test-result" "30.0.0" + "@jest/transform" "30.0.0" + "@jest/types" "30.0.0" "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - ci-info "^3.2.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-changed-files "^29.7.0" - jest-config "^29.7.0" - jest-haste-map "^29.7.0" - jest-message-util "^29.7.0" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-resolve-dependencies "^29.7.0" - jest-runner "^29.7.0" - jest-runtime "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - jest-watcher "^29.7.0" - micromatch "^4.0.4" - pretty-format "^29.7.0" + 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.0" + jest-config "30.0.0" + jest-haste-map "30.0.0" + jest-message-util "30.0.0" + jest-regex-util "30.0.0" + jest-resolve "30.0.0" + jest-resolve-dependencies "30.0.0" + jest-runner "30.0.0" + jest-runtime "30.0.0" + jest-snapshot "30.0.0" + jest-util "30.0.0" + jest-validate "30.0.0" + jest-watcher "30.0.0" + micromatch "^4.0.8" + pretty-format "30.0.0" slash "^3.0.0" - strip-ansi "^6.0.0" -"@jest/environment@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" - integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== +"@jest/diff-sequences@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/diff-sequences/-/diff-sequences-30.0.0.tgz#402d27d14e9d5161dedfca98bf181018a8931eb1" + integrity sha512-xMbtoCeKJDto86GW6AiwVv7M4QAuI56R7dVBr1RNGYbOT44M2TIzOiske2RxopBqkumDY+A1H55pGvuribRY9A== + +"@jest/environment@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-30.0.0.tgz#d66484e35d6ee9a551d2ef3adb9e18728f0e4736" + integrity sha512-09sFbMMgS5JxYnvgmmtwIHhvoyzvR5fUPrVl8nOCrC5KdzmmErTcAxfWyAhJ2bv3rvHNQaKiS+COSG+O7oNbXw== dependencies: - "@jest/fake-timers" "^29.7.0" - "@jest/types" "^29.6.3" + "@jest/fake-timers" "30.0.0" + "@jest/types" "30.0.0" "@types/node" "*" - jest-mock "^29.7.0" + jest-mock "30.0.0" + +"@jest/expect-utils@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.0.0.tgz#118d41d9df420db61d307308848a9e12f0fc1fad" + integrity sha512-UiWfsqNi/+d7xepfOv8KDcbbzcYtkWBe3a3kVDtg6M1kuN6CJ7b4HzIp5e1YHrSaQaVS8sdCoyCMCZClTLNKFQ== + dependencies: + "@jest/get-type" "30.0.0" "@jest/expect-utils@^29.7.0": version "29.7.0" @@ -984,66 +1018,85 @@ dependencies: jest-get-type "^29.6.3" -"@jest/expect@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" - integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== +"@jest/expect@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-30.0.0.tgz#3f6c17a333444aa6d93b507871815c24c6681f21" + integrity sha512-XZ3j6syhMeKiBknmmc8V3mNIb44kxLTbOQtaXA4IFdHy+vEN0cnXRzbRjdGBtrp4k1PWyMWNU3Fjz3iejrhpQg== dependencies: - expect "^29.7.0" - jest-snapshot "^29.7.0" + expect "30.0.0" + jest-snapshot "30.0.0" -"@jest/fake-timers@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" - integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== +"@jest/fake-timers@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-30.0.0.tgz#4d4ae90695609c1b27795ad1210203d73f30dcfd" + integrity sha512-yzBmJcrMHAMcAEbV2w1kbxmx8WFpEz8Cth3wjLMSkq+LO8VeGKRhpr5+BUp7PPK+x4njq/b6mVnDR8e/tPL5ng== dependencies: - "@jest/types" "^29.6.3" - "@sinonjs/fake-timers" "^10.0.2" + "@jest/types" "30.0.0" + "@sinonjs/fake-timers" "^13.0.0" "@types/node" "*" - jest-message-util "^29.7.0" - jest-mock "^29.7.0" - jest-util "^29.7.0" - -"@jest/globals@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" - integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== + jest-message-util "30.0.0" + jest-mock "30.0.0" + jest-util "30.0.0" + +"@jest/get-type@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/get-type/-/get-type-30.0.0.tgz#59dcb5a9cbd9eb0004d3a2ed2fa9c9c3abfbf005" + integrity sha512-VZWMjrBzqfDKngQ7sUctKeLxanAbsBFoZnPxNIG6CmxK7Gv6K44yqd0nzveNIBfuhGZMmk1n5PGbvdSTOu0yTg== + +"@jest/globals@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-30.0.0.tgz#b80a488ec3fc99637455def038e53cfcd562a18f" + integrity sha512-OEzYes5A1xwBJVMPqFRa8NCao8Vr42nsUZuf/SpaJWoLE+4kyl6nCQZ1zqfipmCrIXQVALC5qJwKy/7NQQLPhw== + dependencies: + "@jest/environment" "30.0.0" + "@jest/expect" "30.0.0" + "@jest/types" "30.0.0" + jest-mock "30.0.0" + +"@jest/pattern@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/pattern/-/pattern-30.0.0.tgz#2d1f04c8b64b31f1bfa71ccb60593a4415d0d452" + integrity sha512-k+TpEThzLVXMkbdxf8KHjZ83Wl+G54ytVJoDIGWwS96Ql4xyASRjc6SU1hs5jHVql+hpyK9G8N7WuFhLpGHRpQ== dependencies: - "@jest/environment" "^29.7.0" - "@jest/expect" "^29.7.0" - "@jest/types" "^29.6.3" - jest-mock "^29.7.0" + "@types/node" "*" + jest-regex-util "30.0.0" -"@jest/reporters@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" - integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== +"@jest/reporters@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-30.0.0.tgz#a384cc5692e3288617f6993c3267314f8f865781" + integrity sha512-5WHNlLO0Ok+/o6ML5IzgVm1qyERtLHBNhwn67PAq92H4hZ+n5uW/BYj1VVwmTdxIcNrZLxdV9qtpdZkXf16HxA== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@jridgewell/trace-mapping" "^0.3.18" + "@jest/console" "30.0.0" + "@jest/test-result" "30.0.0" + "@jest/transform" "30.0.0" + "@jest/types" "30.0.0" + "@jridgewell/trace-mapping" "^0.3.25" "@types/node" "*" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.2.9" + chalk "^4.1.2" + collect-v8-coverage "^1.0.2" + exit-x "^0.2.2" + glob "^10.3.10" + graceful-fs "^4.2.11" istanbul-lib-coverage "^3.0.0" istanbul-lib-instrument "^6.0.0" istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" + istanbul-lib-source-maps "^5.0.0" istanbul-reports "^3.1.3" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - jest-worker "^29.7.0" + jest-message-util "30.0.0" + jest-util "30.0.0" + jest-worker "30.0.0" slash "^3.0.0" - string-length "^4.0.1" - strip-ansi "^6.0.0" + string-length "^4.0.2" v8-to-istanbul "^9.0.1" +"@jest/schemas@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-30.0.0.tgz#427b862696c65ea6f6a138a9221326519877555f" + integrity sha512-NID2VRyaEkevCRz6badhfqYwri/RvMbiHY81rk3AkK/LaiB0LSxi1RdVZ7MpZdTjNugtZeGfpL0mLs9Kp3MrQw== + dependencies: + "@sinclair/typebox" "^0.34.0" + "@jest/schemas@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" @@ -1051,55 +1104,78 @@ dependencies: "@sinclair/typebox" "^0.27.8" -"@jest/source-map@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" - integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== - dependencies: - "@jridgewell/trace-mapping" "^0.3.18" - callsites "^3.0.0" - graceful-fs "^4.2.9" - -"@jest/test-result@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" - integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== +"@jest/snapshot-utils@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/snapshot-utils/-/snapshot-utils-30.0.0.tgz#95c34aa1e59840c53b91695132022bfeeeee650e" + integrity sha512-C/QSFUmvZEYptg2Vin84FggAphwHvj6la39vkw1CNOZQORWZ7O/H0BXmdeeeGnvlXDYY8TlFM5jgFnxLAxpFjA== dependencies: - "@jest/console" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" + "@jest/types" "30.0.0" + chalk "^4.1.2" + graceful-fs "^4.2.11" + natural-compare "^1.4.0" -"@jest/test-sequencer@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" - integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== +"@jest/source-map@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-30.0.0.tgz#f1318656f6ca2cab188c5860d8d7ccb2f9a0396c" + integrity sha512-oYBJ4d/NF4ZY3/7iq1VaeoERHRvlwKtrGClgescaXMIa1mmb+vfJd0xMgbW9yrI80IUA7qGbxpBWxlITrHkWoA== dependencies: - "@jest/test-result" "^29.7.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" + "@jridgewell/trace-mapping" "^0.3.25" + callsites "^3.1.0" + graceful-fs "^4.2.11" + +"@jest/test-result@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-30.0.0.tgz#9a06e3b0f2024ace56a2989075c2c8938aae5297" + integrity sha512-685zco9HdgBaaWiB9T4xjLtBuN0Q795wgaQPpmuAeZPHwHZSoKFAUnozUtU+ongfi4l5VCz8AclOE5LAQdyjxQ== + dependencies: + "@jest/console" "30.0.0" + "@jest/types" "30.0.0" + "@types/istanbul-lib-coverage" "^2.0.6" + collect-v8-coverage "^1.0.2" + +"@jest/test-sequencer@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-30.0.0.tgz#7052c0c6d56580f9096b6c3d02834220df676340" + integrity sha512-Hmvv5Yg6UmghXIcVZIydkT0nAK7M/hlXx9WMHR5cLVwdmc14/qUQt3mC72T6GN0olPC6DhmKE6Cd/pHsgDbuqQ== + dependencies: + "@jest/test-result" "30.0.0" + graceful-fs "^4.2.11" + jest-haste-map "30.0.0" slash "^3.0.0" -"@jest/transform@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" - integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== +"@jest/transform@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-30.0.0.tgz#62702f0d0030c361255b6d84c16fed9b91a1c331" + integrity sha512-8xhpsCGYJsUjqpJOgLyMkeOSSlhqggFZEWAnZquBsvATtueoEs7CkMRxOUmJliF3E5x+mXmZ7gEEsHank029Og== dependencies: - "@babel/core" "^7.11.6" - "@jest/types" "^29.6.3" - "@jridgewell/trace-mapping" "^0.3.18" - babel-plugin-istanbul "^6.1.1" - chalk "^4.0.0" + "@babel/core" "^7.27.4" + "@jest/types" "30.0.0" + "@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.9" - jest-haste-map "^29.7.0" - jest-regex-util "^29.6.3" - jest-util "^29.7.0" - micromatch "^4.0.4" - pirates "^4.0.4" + graceful-fs "^4.2.11" + jest-haste-map "30.0.0" + jest-regex-util "30.0.0" + jest-util "30.0.0" + micromatch "^4.0.8" + pirates "^4.0.7" slash "^3.0.0" - write-file-atomic "^4.0.2" + write-file-atomic "^5.0.1" + +"@jest/types@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-30.0.0.tgz#7afb1d34937f722f667b621eb9c653f0f8fda07e" + integrity sha512-1Nox8mAL52PKPfEnUQWBvKU/bp8FTT6AiDu76bFDEJj/qsRFSAVSldfCH3XYMqialti2zHXKvD5gN0AaHc0yKA== + dependencies: + "@jest/pattern" "30.0.0" + "@jest/schemas" "30.0.0" + "@types/istanbul-lib-coverage" "^2.0.6" + "@types/istanbul-reports" "^3.0.4" + "@types/node" "*" + "@types/yargs" "^17.0.33" + chalk "^4.1.2" "@jest/types@^29.6.3": version "29.6.3" @@ -1145,7 +1221,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.23", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== @@ -1190,6 +1266,15 @@ resolved "https://registry.yarnpkg.com/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz#8ace5259254426ccef57f3175bc64ed7095ed919" integrity sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw== +"@napi-rs/wasm-runtime@^0.2.11": + version "0.2.11" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.11.tgz#192c1610e1625048089ab4e35bc0649ce478500e" + integrity sha512-9DPkXtvHydrcOsopiYpUgPHpmj0HWZKMUnL2dZqpvC42lsratuBG06V5ipyno0fUek5VlFsNQ+AcFATSrJXgMA== + dependencies: + "@emnapi/core" "^1.4.3" + "@emnapi/runtime" "^1.4.3" + "@tybys/wasm-util" "^0.9.0" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1249,19 +1334,24 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== -"@sinonjs/commons@^3.0.0": +"@sinclair/typebox@^0.34.0": + version "0.34.33" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.34.33.tgz#10ab3f1261ed9e754660250fad3e69cca1fa44b2" + integrity sha512-5HAV9exOMcXRUxo+9iYB5n09XxzCXnfy4VTNW4xnDv+FgjzAGY989C28BIdljKqmF+ZltUwujE3aossvcVtq6g== + +"@sinonjs/commons@^3.0.1": version "3.0.1" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== dependencies: type-detect "4.0.8" -"@sinonjs/fake-timers@^10.0.2": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" - integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== +"@sinonjs/fake-timers@^13.0.0": + version "13.0.5" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz#36b9dbc21ad5546486ea9173d6bea063eb1717d5" + integrity sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw== dependencies: - "@sinonjs/commons" "^3.0.0" + "@sinonjs/commons" "^3.0.1" "@stylistic/eslint-plugin@^4.2.0": version "4.4.0" @@ -1279,7 +1369,14 @@ resolved "https://registry.yarnpkg.com/@tokenizer/token/-/token-0.3.0.tgz#fe98a93fe789247e998c75e74e9c7c63217aa276" integrity sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A== -"@types/babel__core@^7.1.14": +"@tybys/wasm-util@^0.9.0": + version "0.9.0" + resolved "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.9.0.tgz#3e75eb00604c8d6db470bf18c37b7d984a0e3355" + integrity sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw== + dependencies: + tslib "^2.4.0" + +"@types/babel__core@^7.20.5": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== @@ -1305,7 +1402,7 @@ "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": +"@types/babel__traverse@*": version "7.20.7" resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.7.tgz#968cdc2366ec3da159f61166428ee40f370e56c2" integrity sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng== @@ -1338,14 +1435,14 @@ resolved "https://registry.yarnpkg.com/@types/glob-to-regexp/-/glob-to-regexp-0.4.4.tgz#409e71290253203185b1ea8a3d6ea406a4bdc902" integrity sha512-nDKoaKJYbnn1MZxUY0cA1bPmmgZbg0cTq7Rh13d0KWYNOiKbqoR+2d89SnRPszGh7ROzSwZ/GOjZ4jPbmmZ6Eg== -"@types/graceful-fs@^4.1.3": +"@types/graceful-fs@^4.1.9": version "4.1.9" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== dependencies: "@types/node" "*" -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1", "@types/istanbul-lib-coverage@^2.0.6": version "2.0.6" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== @@ -1357,7 +1454,7 @@ dependencies: "@types/istanbul-lib-coverage" "*" -"@types/istanbul-reports@^3.0.0": +"@types/istanbul-reports@^3.0.0", "@types/istanbul-reports@^3.0.4": version "3.0.4" resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== @@ -1389,7 +1486,7 @@ dependencies: undici-types "~6.21.0" -"@types/stack-utils@^2.0.0": +"@types/stack-utils@^2.0.0", "@types/stack-utils@^2.0.3": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== @@ -1406,7 +1503,7 @@ resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== -"@types/yargs@^17.0.8": +"@types/yargs@^17.0.33", "@types/yargs@^17.0.8": version "17.0.33" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== @@ -1474,6 +1571,98 @@ "@typescript-eslint/types" "8.33.1" eslint-visitor-keys "^4.2.0" +"@ungap/structured-clone@^1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.0.tgz#d06bbb384ebcf6c505fde1c3d0ed4ddffe0aaff8" + integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g== + +"@unrs/resolver-binding-darwin-arm64@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.8.1.tgz#4ebdbe47a4d8e45690f03482d7463b282683ded8" + integrity sha512-OKuBTQdOb4Kjbe+y4KgbRhn+nu47hNyNU2K3qjD+SA/bnQouvZnRzEiR85xZAIyZ6z1C+O1Zg1dK4hGH1RPdYA== + +"@unrs/resolver-binding-darwin-x64@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.8.1.tgz#2d36bee16e8dc8594a7ddbd04cc1e6c572bb1b68" + integrity sha512-inaphBsOqqzauNvx6kSHrgqDLShicPg3+fInBcEdD7Ut8sUUbm2z19LL+S9ccGpHnYoNiJ+Qrf7/B8hRsCUvBw== + +"@unrs/resolver-binding-freebsd-x64@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.8.1.tgz#cc546963b5eabd059587498f81cf69a6f75e89ec" + integrity sha512-LkGw7jDoLKEZO6yYwTKUlrboD6Qmy9Jkq7ZDPlJReq/FnCnNh0k1Z1hjtevpqPCMLz9hGW0ITMb04jdDZ796Cg== + +"@unrs/resolver-binding-linux-arm-gnueabihf@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.8.1.tgz#7135d3df1faa37b33923c8ee20314b6cef267e7f" + integrity sha512-6vhu22scv64dynXTVmeClenn3OPI8cwdhtydLFDkoW4UJzNwcgJ5mVtzbtikDGM9PmIQa+ekpH6tdvKt0ToK3A== + +"@unrs/resolver-binding-linux-arm-musleabihf@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.8.1.tgz#0ae5128e38d8df8ad685867b4de4d8df9a4fbf35" + integrity sha512-SrQ286JVFWlnZSm1/TJwulTgJVOdb1x8BWW2ecOK0Sx+acdRpoMf4WSxH+/+R4LyE/YYyekcEtUrPhSEgJ748g== + +"@unrs/resolver-binding-linux-arm64-gnu@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.8.1.tgz#139d34a03f4232836e761f2aa28751fd8f86fa0e" + integrity sha512-I2s4L27V+2kAee43x/qAkFjTZJgmDvSd9vtnyINOdBEdz5+QqiG6ccd5pgOw06MsUwygkrhB4jOe4ZN4SA6IwA== + +"@unrs/resolver-binding-linux-arm64-musl@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.8.1.tgz#b095fcb567f00c6df88ff334e0c1cba3ea12ec44" + integrity sha512-Drq80e/EQbdSVyJpheF65qVmfYy8OaDdQqoWV+09tZHz/P1SdSulvVtgtYrk216D++9hbx3c1bwVXwR5PZ2TzA== + +"@unrs/resolver-binding-linux-ppc64-gnu@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.8.1.tgz#3fde0589f276be5e21d7b90fe264448839afa2b8" + integrity sha512-EninHQHw8Zkq8K5qB6KWNDqjCtUzTDsCRQ6LzAtQWIxic/VQxR5Kl36V/GCXNvQaR7W0AB5gvJLyQtJwkf+AJA== + +"@unrs/resolver-binding-linux-riscv64-gnu@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.8.1.tgz#ad21df9d44960e751cadf10a915eb190044be433" + integrity sha512-s7Xu5PS4vWhsb5ZFAi+UBguTn0g8qDhN+BbB1t9APX23AdAI7TS4DRrJV5dBVdQ6a8MiergGr1Cjb0Q1V/sW8w== + +"@unrs/resolver-binding-linux-riscv64-musl@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.8.1.tgz#b38d5c9fad291b542e45baccd9d43849f4dc0733" + integrity sha512-Ca+bVzOJtgQ3OrMkRSeDLYWJIjRmEylDHSZuSKqqPmZI2vgX6yZgzrKY28I6hjjG9idlW4DcJzLv/TjFXev+4Q== + +"@unrs/resolver-binding-linux-s390x-gnu@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.8.1.tgz#b77d80b7dea1e34d833b21d9579fd4956061d5c5" + integrity sha512-ut1vBBFs6AC5EcerH8HorcmS/9wAy6iI1tfpzT7jy+SKnMgmPth/psc3W5V04njble7cyLPjFHwYJTlxmozQ/g== + +"@unrs/resolver-binding-linux-x64-gnu@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.8.1.tgz#a2371b20d7ae7f482d247f2f45699ea314a4ceeb" + integrity sha512-w5agLxesvrYKrCOlAsUkwRDogjnyRBi4/vEaujZRkXbeRCupJ9dFD0qUhLXZyIed+GSzJJIsJocUZIVzcTHYXQ== + +"@unrs/resolver-binding-linux-x64-musl@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.8.1.tgz#45f2f58ad4fc103f7feea0899e638021d5bf2c57" + integrity sha512-vk5htmWYCLRpfjn2wmCUne6pLvlcYUFDAAut4g02/2iWeGeZO/3GmSLmiZ9fcn9oH0FUzgetg0/zSo8oZ7liIg== + +"@unrs/resolver-binding-wasm32-wasi@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.8.1.tgz#d57ea7275464328403fc103347db1fa4900f220e" + integrity sha512-RcsLTcrqDT5XW/TnhhIeM7lVLgUv/gvPEC4WaH+OhkLCkRfH6EEuhprwrcp1WhdlrtL/U5FkHh4NtFLnMXoeXA== + dependencies: + "@napi-rs/wasm-runtime" "^0.2.11" + +"@unrs/resolver-binding-win32-arm64-msvc@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.8.1.tgz#41eeb4731c22e74d87be0628df1eb79298ed663b" + integrity sha512-XbSRLZY/gEi5weYv/aCkiUiSWvrNKkvec3m6/bDypDI+ZACwMllPH7smeOW/fdnIGhf9YtPATNliJHAS2GyMUA== + +"@unrs/resolver-binding-win32-ia32-msvc@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.8.1.tgz#399763affd06fb409f6d22f1e4d26e9cb3ac8982" + integrity sha512-SbCJMKOmqOsIBCklT5c+t0DjVbOkseE7ZN0OtMxRnraLKdj1AAv7d3cjJMYkPd9ZGKosHoMXo66gBs02YM8KeA== + +"@unrs/resolver-binding-win32-x64-msvc@1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.8.1.tgz#91e3322e735382cbe5611d1467fd95411cb58141" + integrity sha512-DdHqo7XbeUa/ZOcxq+q5iuO4sSxhwX9HR1JPL0JMOKEzgkIO4OKF2TPjqmo6UCCGZUXIMwrAycFXj/40sICagw== + "@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1": version "1.14.1" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.14.1.tgz#a9f6a07f2b03c95c8d38c4536a1fdfb521ff55b6" @@ -1719,7 +1908,7 @@ amdefine@>=0.0.4: resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" integrity sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg== -ansi-escapes@^4.2.1: +ansi-escapes@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== @@ -1750,7 +1939,7 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" -ansi-styles@^5.0.0: +ansi-styles@^5.0.0, ansi-styles@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== @@ -1765,7 +1954,7 @@ any-promise@^1.0.0: resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== -anymatch@^3.0.3: +anymatch@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== @@ -1844,17 +2033,17 @@ axios@^1.4.0: form-data "^4.0.0" proxy-from-env "^1.1.0" -babel-jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" - integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== +babel-jest@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-30.0.0.tgz#485050f0a0dcfc8859ef3ab5092a8c0bcbd6f33f" + integrity sha512-JQ0DhdFjODbSawDf0026uZuwaqfKkQzk+9mwWkq2XkKFIaMhFVOxlVmbFCOnnC76jATdxrff3IiUAvOAJec6tw== dependencies: - "@jest/transform" "^29.7.0" - "@types/babel__core" "^7.1.14" - babel-plugin-istanbul "^6.1.1" - babel-preset-jest "^29.6.3" - chalk "^4.0.0" - graceful-fs "^4.2.9" + "@jest/transform" "30.0.0" + "@types/babel__core" "^7.20.5" + babel-plugin-istanbul "^7.0.0" + babel-preset-jest "30.0.0" + chalk "^4.1.2" + graceful-fs "^4.2.11" slash "^3.0.0" babel-loader@^10.0.0: @@ -1864,28 +2053,27 @@ babel-loader@^10.0.0: dependencies: find-up "^5.0.0" -babel-plugin-istanbul@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" - integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== +babel-plugin-istanbul@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-7.0.0.tgz#629a178f63b83dc9ecee46fd20266283b1f11280" + integrity sha512-C5OzENSx/A+gt7t4VH1I2XsflxyPUmXRFPKBxt33xncdOmq7oROVM3bZv9Ysjjkv8OJYDMa+tKuKMvqU/H3xdw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-instrument "^5.0.4" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-instrument "^6.0.2" test-exclude "^6.0.0" -babel-plugin-jest-hoist@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" - integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== +babel-plugin-jest-hoist@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-30.0.0.tgz#76c9bf58316ebb7026d671d71d26138ae415326b" + integrity sha512-DSRm+US/FCB4xPDD6Rnslb6PAF9Bej1DZ+1u4aTiqJnk7ZX12eHsnDiIOqjGvITCq+u6wLqUhgS+faCNbVY8+g== dependencies: - "@babel/template" "^7.3.3" - "@babel/types" "^7.3.3" - "@types/babel__core" "^7.1.14" - "@types/babel__traverse" "^7.0.6" + "@babel/template" "^7.27.2" + "@babel/types" "^7.27.3" + "@types/babel__core" "^7.20.5" -babel-preset-current-node-syntax@^1.0.0: +babel-preset-current-node-syntax@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw== @@ -1906,13 +2094,13 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-private-property-in-object" "^7.14.5" "@babel/plugin-syntax-top-level-await" "^7.14.5" -babel-preset-jest@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" - integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== +babel-preset-jest@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-30.0.0.tgz#54b16c96c1b687b9c72baa37a00b01fe9be4c4f3" + integrity sha512-hgEuu/W7gk8QOWUA9+m3Zk+WpGvKc1Egp6rFQEfYxEoM9Fk/q8nuTXNL65OkhwGrTApauEGgakOoWVXj+UfhKw== dependencies: - babel-plugin-jest-hoist "^29.6.3" - babel-preset-current-node-syntax "^1.0.0" + babel-plugin-jest-hoist "30.0.0" + babel-preset-current-node-syntax "^1.1.0" babel-walk@3.0.0-canary-5: version "3.0.0-canary-5" @@ -2071,7 +2259,7 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.2.0: +camelcase@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -2140,10 +2328,10 @@ ci-info@^4.2.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.2.0.tgz#cbd21386152ebfe1d56f280a3b5feccbd96764c7" integrity sha512-cYY9mypksY8NRqgDB1XD1RiJL338v/551niynFTGkZOO2LHuB2OmOYxDIe/ttN9AHwrqdum1360G3ald0W9kCg== -cjs-module-lexer@^1.0.0: - version "1.4.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz#0f79731eb8cfe1ec72acd4066efac9d61991b00d" - integrity sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q== +cjs-module-lexer@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-2.1.0.tgz#586e87d4341cb2661850ece5190232ccdebcff8b" + integrity sha512-UX0OwmYRYQQetfrLEZeewIFFI+wSTofC+pMBLNuH3RUuu/xzG1oz84UCEDOSoQlN3fZ4+AzmV50ZYvGqkMh9yA== clean-regexp@^1.0.0: version "1.0.0" @@ -2242,7 +2430,7 @@ coffeescript@^2.5.1: resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-2.7.0.tgz#a43ec03be6885d6d1454850ea70b9409c391279c" integrity sha512-hzWp6TUE2d/jCcN67LrW1eh5b/rSDKQK6oD6VMLlggYVUUFexgTH9z3dNYihzX4RMhze5FTUsUmOXViJKFQR/A== -collect-v8-coverage@^1.0.0: +collect-v8-coverage@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" integrity sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== @@ -2374,19 +2562,6 @@ cosmiconfig@^8.2.0: parse-json "^5.2.0" path-type "^4.0.0" -create-jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" - integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== - dependencies: - "@jest/types" "^29.6.3" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-config "^29.7.0" - jest-util "^29.7.0" - prompts "^2.0.1" - cross-spawn@^7.0.0, cross-spawn@^7.0.3, cross-spawn@^7.0.6: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" @@ -2566,17 +2741,17 @@ decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== -dedent@^1.0.0: - version "1.5.3" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" - integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== +dedent@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.6.0.tgz#79d52d6389b1ffa67d2bcef59ba51847a9d503b2" + integrity sha512-F1Z+5UCFpmQUzJa11agbyPVMbpgT/qA3/SKyJ1jyBgm7dUcUEa8v9JwDkerSQXfakBwFljIxhOJqGkjUwZ9FSA== deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -deepmerge@^4.2.2: +deepmerge@^4.2.2, deepmerge@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== @@ -2611,7 +2786,7 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -detect-newline@^3.0.0: +detect-newline@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== @@ -3080,7 +3255,7 @@ events@^3.2.0, events@^3.3.0: resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== -execa@^5.0.0: +execa@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== @@ -3095,12 +3270,24 @@ execa@^5.0.0: signal-exit "^3.0.3" strip-final-newline "^2.0.0" -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== - -expect@^29.0.0, expect@^29.7.0: +exit-x@^0.2.2: + version "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.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-30.0.0.tgz#460dfda282e0a8de8302aabee951dba7e79a5a53" + integrity sha512-xCdPp6gwiR9q9lsPCHANarIkFTN/IMZso6Kkq03sOm9IIGtzK/UJqml0dkhHibGh8HKOj8BIDIpZ0BZuU7QK6w== + dependencies: + "@jest/expect-utils" "30.0.0" + "@jest/get-type" "30.0.0" + jest-matcher-utils "30.0.0" + jest-message-util "30.0.0" + jest-mock "30.0.0" + jest-util "30.0.0" + +expect@^29.0.0: version "29.7.0" resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== @@ -3176,7 +3363,7 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" -fb-watchman@^2.0.0: +fb-watchman@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== @@ -3370,7 +3557,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2: +fsevents@^2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -3465,7 +3652,7 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@^10.2.2: +glob@^10.2.2, glob@^10.3.10: version "10.4.5" resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== @@ -3672,7 +3859,7 @@ import-fresh@^3.2.1, import-fresh@^3.3.0, import-fresh@^3.3.1: parent-module "^1.0.0" resolve-from "^4.0.0" -import-local@^3.0.2: +import-local@^3.0.2, import-local@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== @@ -3785,7 +3972,7 @@ is-fullwidth-code-point@^5.0.0: dependencies: get-east-asian-width "^1.0.0" -is-generator-fn@^2.0.0: +is-generator-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== @@ -3890,17 +4077,6 @@ istanbul-lib-hook@^3.0.0: dependencies: append-transform "^2.0.0" -istanbul-lib-instrument@^5.0.4: - version "5.2.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" - integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== - dependencies: - "@babel/core" "^7.12.3" - "@babel/parser" "^7.14.7" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.2.0" - semver "^6.3.0" - istanbul-lib-instrument@^6.0.0, istanbul-lib-instrument@^6.0.2: version "6.0.3" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" @@ -3942,6 +4118,15 @@ istanbul-lib-source-maps@^4.0.0: istanbul-lib-coverage "^3.0.0" source-map "^0.6.1" +istanbul-lib-source-maps@^5.0.0: + version "5.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz#acaef948df7747c8eb5fbf1265cb980f6353a441" + integrity sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A== + dependencies: + "@jridgewell/trace-mapping" "^0.3.23" + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + istanbul-reports@^3.0.2, istanbul-reports@^3.1.3: version "3.1.7" resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" @@ -3979,86 +4164,97 @@ jackspeak@^3.1.2: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" -jest-changed-files@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" - integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== +jest-changed-files@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-30.0.0.tgz#2993fc97acdf701b286310bf672a88a797b57e64" + integrity sha512-rzGpvCdPdEV1Ma83c1GbZif0L2KAm3vXSXGRlpx7yCt0vhruwCNouKNRh3SiVcISHP1mb3iJzjb7tAEnNu1laQ== dependencies: - execa "^5.0.0" - jest-util "^29.7.0" + execa "^5.1.1" + jest-util "30.0.0" p-limit "^3.1.0" -jest-circus@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" - integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== +jest-circus@30.0.0, jest-circus@^30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-30.0.0.tgz#f5d32ef11dcef9beba7ee78f32dd2c82b5f51097" + integrity sha512-nTwah78qcKVyndBS650hAkaEmwWGaVsMMoWdJwMnH77XArRJow2Ir7hc+8p/mATtxVZuM9OTkA/3hQocRIK5Dw== dependencies: - "@jest/environment" "^29.7.0" - "@jest/expect" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" + "@jest/environment" "30.0.0" + "@jest/expect" "30.0.0" + "@jest/test-result" "30.0.0" + "@jest/types" "30.0.0" "@types/node" "*" - chalk "^4.0.0" + chalk "^4.1.2" co "^4.6.0" - dedent "^1.0.0" - is-generator-fn "^2.0.0" - jest-each "^29.7.0" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-runtime "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" + dedent "^1.6.0" + is-generator-fn "^2.1.0" + jest-each "30.0.0" + jest-matcher-utils "30.0.0" + jest-message-util "30.0.0" + jest-runtime "30.0.0" + jest-snapshot "30.0.0" + jest-util "30.0.0" p-limit "^3.1.0" - pretty-format "^29.7.0" - pure-rand "^6.0.0" + pretty-format "30.0.0" + pure-rand "^7.0.0" slash "^3.0.0" - stack-utils "^2.0.3" + stack-utils "^2.0.6" -jest-cli@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" - integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== +jest-cli@30.0.0, jest-cli@^30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-30.0.0.tgz#d689f093e6019bd86e76407b431fae2f8beb85fe" + integrity sha512-fWKAgrhlwVVCfeizsmIrPRTBYTzO82WSba3gJniZNR3PKXADgdC0mmCSK+M+t7N8RCXOVfY6kvCkvjUNtzmHYQ== dependencies: - "@jest/core" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - chalk "^4.0.0" - create-jest "^29.7.0" - exit "^0.1.2" - import-local "^3.0.2" - jest-config "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - yargs "^17.3.1" - -jest-config@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" - integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== - dependencies: - "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^29.7.0" - "@jest/types" "^29.6.3" - babel-jest "^29.7.0" - chalk "^4.0.0" - ci-info "^3.2.0" - deepmerge "^4.2.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-circus "^29.7.0" - jest-environment-node "^29.7.0" - jest-get-type "^29.6.3" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-runner "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - micromatch "^4.0.4" + "@jest/core" "30.0.0" + "@jest/test-result" "30.0.0" + "@jest/types" "30.0.0" + chalk "^4.1.2" + exit-x "^0.2.2" + import-local "^3.2.0" + jest-config "30.0.0" + jest-util "30.0.0" + jest-validate "30.0.0" + yargs "^17.7.2" + +jest-config@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-30.0.0.tgz#77387de024f5a1b456be844f80a1390e8ef19699" + integrity sha512-p13a/zun+sbOMrBnTEUdq/5N7bZMOGd1yMfqtAJniPNuzURMay4I+vxZLK1XSDbjvIhmeVdG8h8RznqYyjctyg== + dependencies: + "@babel/core" "^7.27.4" + "@jest/get-type" "30.0.0" + "@jest/pattern" "30.0.0" + "@jest/test-sequencer" "30.0.0" + "@jest/types" "30.0.0" + babel-jest "30.0.0" + 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.0" + jest-docblock "30.0.0" + jest-environment-node "30.0.0" + jest-regex-util "30.0.0" + jest-resolve "30.0.0" + jest-runner "30.0.0" + jest-util "30.0.0" + jest-validate "30.0.0" + micromatch "^4.0.8" parse-json "^5.2.0" - pretty-format "^29.7.0" + pretty-format "30.0.0" slash "^3.0.0" strip-json-comments "^3.1.1" +jest-diff@30.0.0, jest-diff@^30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.0.0.tgz#d3d4f75e257e3c2cb8729438fe9cec66098f6176" + integrity sha512-TgT1+KipV8JTLXXeFX0qSvIJR/UXiNNojjxb/awh3vYlBZyChU/NEmyKmq+wijKjWEztyrGJFL790nqMqNjTHA== + dependencies: + "@jest/diff-sequences" "30.0.0" + "@jest/get-type" "30.0.0" + chalk "^4.1.2" + pretty-format "30.0.0" + jest-diff@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" @@ -4069,59 +4265,59 @@ jest-diff@^29.7.0: jest-get-type "^29.6.3" pretty-format "^29.7.0" -jest-docblock@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" - integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== +jest-docblock@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-30.0.0.tgz#1650e0ded4fa92ff1adeda2050641705b6b300db" + integrity sha512-By/iQ0nvTzghEecGzUMCp1axLtBh+8wB4Hpoi5o+x1stycjEmPcH1mHugL4D9Q+YKV++vKeX/3ZTW90QC8ICPg== dependencies: - detect-newline "^3.0.0" + detect-newline "^3.1.0" -jest-each@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" - integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== +jest-each@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-30.0.0.tgz#f3760fba22074c4e82b440f4a0557467f464f718" + integrity sha512-qkFEW3cfytEjG2KtrhwtldZfXYnWSanO8xUMXLe4A6yaiHMHJUalk0Yyv4MQH6aeaxgi4sGVrukvF0lPMM7U1w== dependencies: - "@jest/types" "^29.6.3" - chalk "^4.0.0" - jest-get-type "^29.6.3" - jest-util "^29.7.0" - pretty-format "^29.7.0" + "@jest/get-type" "30.0.0" + "@jest/types" "30.0.0" + chalk "^4.1.2" + jest-util "30.0.0" + pretty-format "30.0.0" -jest-environment-node@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" - integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== +jest-environment-node@30.0.0, jest-environment-node@^30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-30.0.0.tgz#0d16b29f5720c796d8eadd9c22ada1c1c43d3ba2" + integrity sha512-sF6lxyA25dIURyDk4voYmGU9Uwz2rQKMfjxKnDd19yk+qxKGrimFqS5YsPHWTlAVBo+YhWzXsqZoaMzrTFvqfg== dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/types" "^29.6.3" + "@jest/environment" "30.0.0" + "@jest/fake-timers" "30.0.0" + "@jest/types" "30.0.0" "@types/node" "*" - jest-mock "^29.7.0" - jest-util "^29.7.0" + jest-mock "30.0.0" + jest-util "30.0.0" + jest-validate "30.0.0" jest-get-type@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== -jest-haste-map@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" - integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== +jest-haste-map@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-30.0.0.tgz#7e8597a8931eef090aa011bedba7a1173775acb8" + integrity sha512-p4bXAhXTawTsADgQgTpbymdLaTyPW1xWNu1oIGG7/N3LIAbZVkH2JMJqS8/IUcnGR8Kc7WFE+vWbJvsqGCWZXw== dependencies: - "@jest/types" "^29.6.3" - "@types/graceful-fs" "^4.1.3" + "@jest/types" "30.0.0" "@types/node" "*" - anymatch "^3.0.3" - fb-watchman "^2.0.0" - graceful-fs "^4.2.9" - jest-regex-util "^29.6.3" - jest-util "^29.7.0" - jest-worker "^29.7.0" - micromatch "^4.0.4" + anymatch "^3.1.3" + fb-watchman "^2.0.2" + graceful-fs "^4.2.11" + jest-regex-util "30.0.0" + jest-util "30.0.0" + jest-worker "30.0.0" + micromatch "^4.0.8" walker "^1.0.8" optionalDependencies: - fsevents "^2.3.2" + fsevents "^2.3.3" jest-junit@^16.0.0: version "16.0.0" @@ -4133,13 +4329,23 @@ jest-junit@^16.0.0: uuid "^8.3.2" xml "^1.0.1" -jest-leak-detector@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" - integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== +jest-leak-detector@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-30.0.0.tgz#056d168e6f308262b40ad05843723a52cdb58b91" + integrity sha512-E/ly1azdVVbZrS0T6FIpyYHvsdek4FNaThJTtggjV/8IpKxh3p9NLndeUZy2+sjAI3ncS+aM0uLLon/dBg8htA== dependencies: - jest-get-type "^29.6.3" - pretty-format "^29.7.0" + "@jest/get-type" "30.0.0" + pretty-format "30.0.0" + +jest-matcher-utils@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.0.0.tgz#f72a65e248c0462795f7e14386682bfee6ad4386" + integrity sha512-m5mrunqopkrqwG1mMdJxe1J4uGmS9AHHKYUmoxeQOxBcLjEvirIrIDwuKmUYrecPHVB/PUBpXs2gPoeA2FSSLQ== + dependencies: + "@jest/get-type" "30.0.0" + chalk "^4.1.2" + jest-diff "30.0.0" + pretty-format "30.0.0" jest-matcher-utils@^29.7.0: version "29.7.0" @@ -4151,6 +4357,21 @@ jest-matcher-utils@^29.7.0: jest-get-type "^29.6.3" pretty-format "^29.7.0" +jest-message-util@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-30.0.0.tgz#b115d408cd877a6e3e711485a3bd240c7a27503c" + integrity sha512-pV3qcrb4utEsa/U7UI2VayNzSDQcmCllBZLSoIucrESRu0geKThFZOjjh0kACDJFJRAQwsK7GVsmS6SpEceD8w== + dependencies: + "@babel/code-frame" "^7.27.1" + "@jest/types" "30.0.0" + "@types/stack-utils" "^2.0.3" + chalk "^4.1.2" + graceful-fs "^4.2.11" + micromatch "^4.0.8" + pretty-format "30.0.0" + slash "^3.0.0" + stack-utils "^2.0.6" + jest-message-util@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" @@ -4166,128 +4387,141 @@ jest-message-util@^29.7.0: slash "^3.0.0" stack-utils "^2.0.3" -jest-mock@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" - integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== +jest-mock@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-30.0.0.tgz#f3b3115cd80c3eec7df93809430ab1feaeeb7229" + integrity sha512-W2sRA4ALXILrEetEOh2ooZG6fZ01iwVs0OWMKSSWRcUlaLr4ESHuiKXDNTg+ZVgOq8Ei5445i/Yxrv59VT+XkA== dependencies: - "@jest/types" "^29.6.3" + "@jest/types" "30.0.0" "@types/node" "*" - jest-util "^29.7.0" + jest-util "30.0.0" -jest-pnp-resolver@^1.2.2: +jest-pnp-resolver@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== -jest-regex-util@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" - integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== +jest-regex-util@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-30.0.0.tgz#031f385ebb947e770e409ede703d200b3405413e" + integrity sha512-rT84010qRu/5OOU7a9TeidC2Tp3Qgt9Sty4pOZ/VSDuEmRupIjKZAb53gU3jr4ooMlhwScrgC9UixJxWzVu9oQ== -jest-resolve-dependencies@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" - integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== +jest-resolve-dependencies@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-30.0.0.tgz#caf6829daa9ad6579a6da7c2723346761102ef83" + integrity sha512-Yhh7odCAUNXhluK1bCpwIlHrN1wycYaTlZwq1GdfNBEESNNI/z1j1a7dUEWHbmB9LGgv0sanxw3JPmWU8NeebQ== dependencies: - jest-regex-util "^29.6.3" - jest-snapshot "^29.7.0" + jest-regex-util "30.0.0" + jest-snapshot "30.0.0" -jest-resolve@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" - integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== +jest-resolve@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-30.0.0.tgz#8aaf8f85c8a14579fa34e651af406e57d2675092" + integrity sha512-zwWl1P15CcAfuQCEuxszjiKdsValhnWcj/aXg/R3aMHs8HVoCWHC4B/+5+1BirMoOud8NnN85GSP2LEZCbj3OA== dependencies: - chalk "^4.0.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-pnp-resolver "^1.2.2" - jest-util "^29.7.0" - jest-validate "^29.7.0" - resolve "^1.20.0" - resolve.exports "^2.0.0" + chalk "^4.1.2" + graceful-fs "^4.2.11" + jest-haste-map "30.0.0" + jest-pnp-resolver "^1.2.3" + jest-util "30.0.0" + jest-validate "30.0.0" slash "^3.0.0" - -jest-runner@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" - integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== - dependencies: - "@jest/console" "^29.7.0" - "@jest/environment" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" + unrs-resolver "^1.7.11" + +jest-runner@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-30.0.0.tgz#d4667945181e3aecb025802a3f81ff30a523f877" + integrity sha512-xbhmvWIc8X1IQ8G7xTv0AQJXKjBVyxoVJEJgy7A4RXsSaO+k/1ZSBbHwjnUhvYqMvwQPomWssDkUx6EoidEhlw== + dependencies: + "@jest/console" "30.0.0" + "@jest/environment" "30.0.0" + "@jest/test-result" "30.0.0" + "@jest/transform" "30.0.0" + "@jest/types" "30.0.0" "@types/node" "*" - chalk "^4.0.0" + chalk "^4.1.2" emittery "^0.13.1" - graceful-fs "^4.2.9" - jest-docblock "^29.7.0" - jest-environment-node "^29.7.0" - jest-haste-map "^29.7.0" - jest-leak-detector "^29.7.0" - jest-message-util "^29.7.0" - jest-resolve "^29.7.0" - jest-runtime "^29.7.0" - jest-util "^29.7.0" - jest-watcher "^29.7.0" - jest-worker "^29.7.0" + exit-x "^0.2.2" + graceful-fs "^4.2.11" + jest-docblock "30.0.0" + jest-environment-node "30.0.0" + jest-haste-map "30.0.0" + jest-leak-detector "30.0.0" + jest-message-util "30.0.0" + jest-resolve "30.0.0" + jest-runtime "30.0.0" + jest-util "30.0.0" + jest-watcher "30.0.0" + jest-worker "30.0.0" p-limit "^3.1.0" source-map-support "0.5.13" -jest-runtime@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" - integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/globals" "^29.7.0" - "@jest/source-map" "^29.6.3" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" +jest-runtime@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-30.0.0.tgz#7aad9359da4054d4ae1ec8d94f83d3c07d6ce1c7" + integrity sha512-/O07qVgFrFAOGKGigojmdR3jUGz/y3+a/v9S/Yi2MHxsD+v6WcPppglZJw0gNJkRBArRDK8CFAwpM/VuEiiRjA== + dependencies: + "@jest/environment" "30.0.0" + "@jest/fake-timers" "30.0.0" + "@jest/globals" "30.0.0" + "@jest/source-map" "30.0.0" + "@jest/test-result" "30.0.0" + "@jest/transform" "30.0.0" + "@jest/types" "30.0.0" "@types/node" "*" - chalk "^4.0.0" - cjs-module-lexer "^1.0.0" - collect-v8-coverage "^1.0.0" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-message-util "^29.7.0" - jest-mock "^29.7.0" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" + 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.0" + jest-message-util "30.0.0" + jest-mock "30.0.0" + jest-regex-util "30.0.0" + jest-resolve "30.0.0" + jest-snapshot "30.0.0" + jest-util "30.0.0" slash "^3.0.0" strip-bom "^4.0.0" -jest-snapshot@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" - integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== - dependencies: - "@babel/core" "^7.11.6" - "@babel/generator" "^7.7.2" - "@babel/plugin-syntax-jsx" "^7.7.2" - "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/types" "^7.3.3" - "@jest/expect-utils" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - babel-preset-current-node-syntax "^1.0.0" - chalk "^4.0.0" - expect "^29.7.0" - graceful-fs "^4.2.9" - jest-diff "^29.7.0" - jest-get-type "^29.6.3" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - natural-compare "^1.4.0" - pretty-format "^29.7.0" - semver "^7.5.3" +jest-snapshot@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-30.0.0.tgz#44217201c3f935e7cc5b413c8dda05341c80b0d7" + integrity sha512-6oCnzjpvfj/UIOMTqKZ6gedWAUgaycMdV8Y8h2dRJPvc2wSjckN03pzeoonw8y33uVngfx7WMo1ygdRGEKOT7w== + 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.0" + "@jest/get-type" "30.0.0" + "@jest/snapshot-utils" "30.0.0" + "@jest/transform" "30.0.0" + "@jest/types" "30.0.0" + babel-preset-current-node-syntax "^1.1.0" + chalk "^4.1.2" + expect "30.0.0" + graceful-fs "^4.2.11" + jest-diff "30.0.0" + jest-matcher-utils "30.0.0" + jest-message-util "30.0.0" + jest-util "30.0.0" + pretty-format "30.0.0" + semver "^7.7.2" + synckit "^0.11.8" + +jest-util@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-30.0.0.tgz#d4f20f59e1fd72c7143143f4aa961bb71aeddad0" + integrity sha512-fhNBBM9uSUbd4Lzsf8l/kcAdaHD/4SgoI48en3HXcBEMwKwoleKFMZ6cYEYs21SB779PRuRCyNLmymApAm8tZw== + dependencies: + "@jest/types" "30.0.0" + "@types/node" "*" + chalk "^4.1.2" + ci-info "^4.2.0" + graceful-fs "^4.2.11" + picomatch "^4.0.2" jest-util@^29.7.0: version "29.7.0" @@ -4301,60 +4535,61 @@ jest-util@^29.7.0: graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-validate@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" - integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== +jest-validate@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-30.0.0.tgz#0e961bcf6ec9922edb10860039529797f02eb821" + integrity sha512-d6OkzsdlWItHAikUDs1hlLmpOIRhsZoXTCliV2XXalVQ3ZOeb9dy0CQ6AKulJu/XOZqpOEr/FiMH+FeOBVV+nw== dependencies: - "@jest/types" "^29.6.3" - camelcase "^6.2.0" - chalk "^4.0.0" - jest-get-type "^29.6.3" + "@jest/get-type" "30.0.0" + "@jest/types" "30.0.0" + camelcase "^6.3.0" + chalk "^4.1.2" leven "^3.1.0" - pretty-format "^29.7.0" + pretty-format "30.0.0" -jest-watcher@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" - integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== +jest-watcher@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-30.0.0.tgz#d444ad4950e20e1cca60e470c448cc15f3f858ce" + integrity sha512-fbAkojcyS53bOL/B7XYhahORq9cIaPwOgd/p9qW/hybbC8l6CzxfWJJxjlPBAIVN8dRipLR0zdhpGQdam+YBtw== dependencies: - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" + "@jest/test-result" "30.0.0" + "@jest/types" "30.0.0" "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" + ansi-escapes "^4.3.2" + chalk "^4.1.2" emittery "^0.13.1" - jest-util "^29.7.0" - string-length "^4.0.1" + jest-util "30.0.0" + string-length "^4.0.2" -jest-worker@^27.4.5: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" - integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== +jest-worker@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-30.0.0.tgz#63f15145e2b2b36db0be2d2d4413d197d0460912" + integrity sha512-VZvxfWIybIvwK8N/Bsfe43LfQgd/rD0c4h5nLUx78CAqPxIQcW2qDjsVAC53iUR8yxzFIeCFFvWOh8en8hGzdg== dependencies: "@types/node" "*" + "@ungap/structured-clone" "^1.3.0" + jest-util "30.0.0" merge-stream "^2.0.0" - supports-color "^8.0.0" + supports-color "^8.1.1" -jest-worker@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" - integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== +jest-worker@^27.4.5: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" + integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== dependencies: "@types/node" "*" - jest-util "^29.7.0" merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" - integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== +jest@^30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-30.0.0.tgz#d1d69adb09045053762a40217238c76b19d1db6d" + integrity sha512-/3G2iFwsUY95vkflmlDn/IdLyLWqpQXcftptooaPH4qkyU52V7qVYf1BjmdSPlp1+0fs6BmNtrGaSFwOfV07ew== dependencies: - "@jest/core" "^29.7.0" - "@jest/types" "^29.6.3" - import-local "^3.0.2" - jest-cli "^29.7.0" + "@jest/core" "30.0.0" + "@jest/types" "30.0.0" + import-local "^3.2.0" + jest-cli "30.0.0" js-stringify@^1.0.2: version "1.0.2" @@ -4502,11 +4737,6 @@ kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== -kleur@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" - integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== - less-loader@^12.2.0: version "12.3.0" resolved "https://registry.yarnpkg.com/less-loader/-/less-loader-12.3.0.tgz#d4a00361568be86a97da3df4f16954b0d4c15340" @@ -4955,6 +5185,11 @@ nanoid@^3.3.8: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.11.tgz#4f4f112cefbe303202f2199838128936266d185b" integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w== +napi-postinstall@^0.2.2: + version "0.2.4" + resolved "https://registry.yarnpkg.com/napi-postinstall/-/napi-postinstall-0.2.4.tgz#419697d0288cb524623e422f919624f22a5e4028" + integrity sha512-ZEzHJwBhZ8qQSbknHqYcdtQVr8zUgGyM/q6h6qAyhtyVMNrSgDhrC4disf03dYW0e+czXyLnZINnCTEkWy0eJg== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -5335,7 +5570,7 @@ pify@^4.0.1: resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== -pirates@^4.0.4: +pirates@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== @@ -5434,6 +5669,15 @@ prettier@^3.5.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.3.tgz#4fc2ce0d657e7a02e602549f053b239cb7dfe1b5" integrity sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw== +pretty-format@30.0.0: + version "30.0.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.0.0.tgz#a3137bed442af87eadea2c427a1b201189e590a4" + integrity sha512-18NAOUr4ZOQiIR+BgI5NhQE7uREdx4ZyV0dyay5izh4yfQ+1T7BSvggxvRGoXocrRyevqW5OhScUjbi9GB8R8Q== + dependencies: + "@jest/schemas" "30.0.0" + ansi-styles "^5.2.0" + react-is "^18.3.1" + pretty-format@^29.0.0, pretty-format@^29.5.0, pretty-format@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" @@ -5475,14 +5719,6 @@ promise@^7.0.1: dependencies: asap "~2.0.3" -prompts@^2.0.1: - version "2.4.2" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" - integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== - dependencies: - kleur "^3.0.3" - sisteransi "^1.0.5" - proxy-from-env@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" @@ -5615,10 +5851,10 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== -pure-rand@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" - integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== +pure-rand@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-7.0.1.tgz#6f53a5a9e3e4a47445822af96821ca509ed37566" + integrity sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ== queue-microtask@^1.2.2: version "1.2.3" @@ -5652,7 +5888,7 @@ react-dom@^19.0.0: dependencies: scheduler "^0.26.0" -react-is@^18.0.0: +react-is@^18.0.0, react-is@^18.3.1: version "18.3.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== @@ -5753,11 +5989,6 @@ resolve-pkg-maps@^1.0.0: resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f" integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw== -resolve.exports@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.3.tgz#41955e6f1b4013b7586f873749a635dea07ebe3f" - integrity sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A== - resolve@1.1.x: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" @@ -5865,15 +6096,15 @@ semver@^5.6.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== -semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: +semver@^6.0.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.4, semver@^7.3.5, semver@^7.5.0, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3, semver@^7.7.1: - version "7.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.1.tgz#abd5098d82b18c6c81f6074ff2647fd3e7220c9f" - integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== +semver@^7.3.4, semver@^7.3.5, semver@^7.5.0, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3, semver@^7.7.1, semver@^7.7.2: + version "7.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" + integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== serialize-javascript@^6.0.2: version "6.0.2" @@ -5906,7 +6137,7 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: +signal-exit@^3.0.2, signal-exit@^3.0.3: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== @@ -5925,11 +6156,6 @@ simple-git@^3.27.0: "@kwsites/promise-deferred" "^1.1.1" debug "^4.3.5" -sisteransi@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" - integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== - slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -6068,7 +6294,7 @@ stack-trace@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.3: +stack-utils@^2.0.3, stack-utils@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== @@ -6085,7 +6311,7 @@ string-argv@^0.3.2: resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== -string-length@^4.0.1: +string-length@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== @@ -6206,7 +6432,7 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -supports-color@^8.0.0: +supports-color@^8.0.0, supports-color@^8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== @@ -6218,7 +6444,7 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -synckit@^0.11.7: +synckit@^0.11.7, synckit@^0.11.8: version "0.11.8" resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.8.tgz#b2aaae998a4ef47ded60773ad06e7cb821f55457" integrity sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A== @@ -6410,7 +6636,7 @@ ts-loader@^9.5.1: semver "^7.3.4" source-map "^0.7.4" -tslib@^2.0.0, tslib@^2.3.0, tslib@^2.5.0, tslib@^2.6.2: +tslib@^2.0.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.5.0, tslib@^2.6.2: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== @@ -6507,6 +6733,31 @@ universalify@^2.0.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== +unrs-resolver@^1.7.11: + version "1.8.1" + resolved "https://registry.yarnpkg.com/unrs-resolver/-/unrs-resolver-1.8.1.tgz#f84ce4aee9ffc2d6eaad497178e0a996bc18433c" + integrity sha512-M5++xH5Tu/m3NNAc0+dBHidXfF6bTC08mfhQ3AB5UTonEzQSH9ASC/a7EbZN3WU5m0OWMTvf12GHVJZ3uUmPtA== + dependencies: + napi-postinstall "^0.2.2" + optionalDependencies: + "@unrs/resolver-binding-darwin-arm64" "1.8.1" + "@unrs/resolver-binding-darwin-x64" "1.8.1" + "@unrs/resolver-binding-freebsd-x64" "1.8.1" + "@unrs/resolver-binding-linux-arm-gnueabihf" "1.8.1" + "@unrs/resolver-binding-linux-arm-musleabihf" "1.8.1" + "@unrs/resolver-binding-linux-arm64-gnu" "1.8.1" + "@unrs/resolver-binding-linux-arm64-musl" "1.8.1" + "@unrs/resolver-binding-linux-ppc64-gnu" "1.8.1" + "@unrs/resolver-binding-linux-riscv64-gnu" "1.8.1" + "@unrs/resolver-binding-linux-riscv64-musl" "1.8.1" + "@unrs/resolver-binding-linux-s390x-gnu" "1.8.1" + "@unrs/resolver-binding-linux-x64-gnu" "1.8.1" + "@unrs/resolver-binding-linux-x64-musl" "1.8.1" + "@unrs/resolver-binding-wasm32-wasi" "1.8.1" + "@unrs/resolver-binding-win32-arm64-msvc" "1.8.1" + "@unrs/resolver-binding-win32-ia32-msvc" "1.8.1" + "@unrs/resolver-binding-win32-x64-msvc" "1.8.1" + update-browserslist-db@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz#348377dd245216f9e7060ff50b15a1b740b75420" @@ -6741,13 +6992,13 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" -write-file-atomic@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" - integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== +write-file-atomic@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-5.0.1.tgz#68df4717c55c6fa4281a7860b4c2ba0a6d2b11e7" + integrity sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw== dependencies: imurmurhash "^0.1.4" - signal-exit "^3.0.7" + signal-exit "^4.0.1" xdg-basedir@^5.1.0: version "5.1.0" @@ -6852,7 +7103,7 @@ yargs@^16.1.1: y18n "^5.0.5" yargs-parser "^20.2.2" -yargs@^17.3.1: +yargs@^17.7.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== From 0af28df145c9c39f30cfd1b5eadd8d39d9b19b37 Mon Sep 17 00:00:00 2001 From: Xiao <784487301@qq.com> Date: Fri, 20 Jun 2025 21:40:01 +0800 Subject: [PATCH 21/56] fix: handle function exports in webpack module wrapper (#19609) --- .../CreateFakeNamespaceObjectRuntimeModule.js | 2 +- test/Stats.test.js | 8 ++++---- .../externals/export-fn-cjs/index.js | 13 +++++++++++++ .../externals/export-fn-cjs/webpack.config.js | 7 +++++++ .../configCases/externals/export-fn-esm/foo.mjs | 1 + .../externals/export-fn-esm/index.js | 17 +++++++++++++++++ .../externals/export-fn-esm/webpack.config.js | 7 +++++++ 7 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 test/configCases/externals/export-fn-cjs/index.js create mode 100644 test/configCases/externals/export-fn-cjs/webpack.config.js create mode 100644 test/configCases/externals/export-fn-esm/foo.mjs create mode 100644 test/configCases/externals/export-fn-esm/index.js create mode 100644 test/configCases/externals/export-fn-esm/webpack.config.js diff --git a/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js b/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js index 05b811b19b0..b5f09df7952 100644 --- a/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +++ b/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js @@ -49,7 +49,7 @@ class CreateFakeNamespaceObjectRuntimeModule extends HelperRuntimeModule { `${RuntimeGlobals.makeNamespaceObject}(ns);`, "var def = {};", "leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];", - "for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {", + "for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {", Template.indent([ `Object.getOwnPropertyNames(current).forEach(${runtimeTemplate.expressionFunction( `def[key] = ${runtimeTemplate.returningFunction("value[key]", "")}`, diff --git a/test/Stats.test.js b/test/Stats.test.js index 7ae75f303bb..8ad680f94e8 100644 --- a/test/Stats.test.js +++ b/test/Stats.test.js @@ -190,10 +190,10 @@ describe("Stats", () => { "assets": Array [ Object { "name": "entryB.js", - "size": 3081, + "size": 3105, }, ], - "assetsSize": 3081, + "assetsSize": 3105, "auxiliaryAssets": undefined, "auxiliaryAssetsSize": 0, "childAssets": undefined, @@ -238,10 +238,10 @@ describe("Stats", () => { "info": Object { "javascriptModule": false, "minimized": true, - "size": 3081, + "size": 3105, }, "name": "entryB.js", - "size": 3081, + "size": 3105, "type": "asset", }, Object { diff --git a/test/configCases/externals/export-fn-cjs/index.js b/test/configCases/externals/export-fn-cjs/index.js new file mode 100644 index 00000000000..c1726d62dd0 --- /dev/null +++ b/test/configCases/externals/export-fn-cjs/index.js @@ -0,0 +1,13 @@ +it("Should work with export a function", function(done) { + const myModule = require("module"); + expect(typeof myModule).toBe("function"); + expect(myModule.builtinModules).toBeDefined(); + done() +}); + +it("should work with export a object", function(done) { + const myFs = require("fs"); + expect(typeof myFs).toBe("object"); + expect(myFs.readFileSync).toBeDefined(); + done() +}); \ No newline at end of file diff --git a/test/configCases/externals/export-fn-cjs/webpack.config.js b/test/configCases/externals/export-fn-cjs/webpack.config.js new file mode 100644 index 00000000000..564d7c85986 --- /dev/null +++ b/test/configCases/externals/export-fn-cjs/webpack.config.js @@ -0,0 +1,7 @@ +/** @type {import("../../../../types").Configuration} */ +module.exports = { + externals: { + module: "commonjs module", + fs: "commonjs fs" + } +}; diff --git a/test/configCases/externals/export-fn-esm/foo.mjs b/test/configCases/externals/export-fn-esm/foo.mjs new file mode 100644 index 00000000000..ff499a60ea7 --- /dev/null +++ b/test/configCases/externals/export-fn-esm/foo.mjs @@ -0,0 +1 @@ +export const foo = 'foo' \ No newline at end of file diff --git a/test/configCases/externals/export-fn-esm/index.js b/test/configCases/externals/export-fn-esm/index.js new file mode 100644 index 00000000000..7633ab781ee --- /dev/null +++ b/test/configCases/externals/export-fn-esm/index.js @@ -0,0 +1,17 @@ +import { foo } from "./foo.mjs" + +it("Should work with export a function when using CreateFakeNamespaceObjectRuntimeModule", async function(done) { + expect(foo).toBe("foo") + const myModule = await import("module"); + // namespace object + expect(typeof myModule).toBe("object"); + expect(myModule.builtinModules).toBeDefined(); + done() +}); + +it("Should work with export a object when using CreateFakeNamespaceObjectRuntimeModule", async function(done) { + const myFs = await import("fs"); + expect(typeof myFs).toBe("object"); + expect(myFs.readFileSync).toBeDefined(); + done() +}); \ No newline at end of file diff --git a/test/configCases/externals/export-fn-esm/webpack.config.js b/test/configCases/externals/export-fn-esm/webpack.config.js new file mode 100644 index 00000000000..564d7c85986 --- /dev/null +++ b/test/configCases/externals/export-fn-esm/webpack.config.js @@ -0,0 +1,7 @@ +/** @type {import("../../../../types").Configuration} */ +module.exports = { + externals: { + module: "commonjs module", + fs: "commonjs fs" + } +}; From a55ac0ed6d23ea9e47da55137083f0213a1fc59c Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Fri, 20 Jun 2025 22:08:04 +0800 Subject: [PATCH 22/56] chore: refactor test (#19608) --- .prettierignore | 1 + package.json | 2 +- test/ConfigTestCases.template.js | 297 +---------- test/HotTestCases.template.js | 222 ++------ test/WatchTestCases.template.js | 208 ++------ .../ConfigTestCases.basictest.js.snap | 2 +- .../plugins/progress-plugin/test.config.js | 8 + .../default-filename-extensions-css/index.js | 15 +- .../default-filename-extensions-css/style.css | 3 + .../default-filename-extensions-css/test.js | 3 - .../webpack.config.js | 28 +- test/helpers/EventSourceForNode.js | 1 + test/helpers/FakeDocument.js | 19 +- .../lazy-compilation/https/test.config.js | 10 + test/hotCases/status/accept/index.js | 2 +- test/runner/index.js | 484 ++++++++++++++++++ .../esm-async-chunks-hmr/webpack.config.js | 4 +- yarn.lock | 2 +- 18 files changed, 648 insertions(+), 663 deletions(-) create mode 100644 test/configCases/plugins/progress-plugin/test.config.js create mode 100644 test/configCases/source-map/default-filename-extensions-css/style.css delete mode 100644 test/configCases/source-map/default-filename-extensions-css/test.js create mode 100644 test/hotCases/lazy-compilation/https/test.config.js create mode 100644 test/runner/index.js diff --git a/.prettierignore b/.prettierignore index ebf1141fc83..0d57d80513e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -16,6 +16,7 @@ test/**/*.* !test/**/infrastructure-log.js !test/*.md !test/helpers/*.* +!test/runner/**/*.* !test/benchmarkCases/**/*.mjs test/js/**/*.* diff --git a/package.json b/package.json index e39f3cf1d89..d1689b0b690 100644 --- a/package.json +++ b/package.json @@ -162,7 +162,7 @@ "fmt": "yarn fmt:base --log-level warn --write", "fmt:check": "yarn fmt:base --check", "fmt:base": "node node_modules/prettier/bin/prettier.cjs --cache --ignore-unknown .", - "fix": "yarn fix:code && fix:yarn && fix:special && yarn fmt", + "fix": "yarn fix:code && yarn fix:yarn && yarn fix:special && yarn fmt", "fix:code": "yarn lint:code --fix", "fix:yarn": "yarn-deduplicate -s highest yarn.lock", "fix:special": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write", diff --git a/test/ConfigTestCases.template.js b/test/ConfigTestCases.template.js index b9193d7e803..0517ef716e8 100644 --- a/test/ConfigTestCases.template.js +++ b/test/ConfigTestCases.template.js @@ -7,21 +7,15 @@ require("./helpers/warmup-webpack"); const path = require("path"); const fs = require("graceful-fs"); -const vm = require("vm"); -const url = require("url"); -const { URL, pathToFileURL, fileURLToPath } = require("url"); const rimraf = require("rimraf"); const checkArrayExpectation = require("./checkArrayExpectation"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const deprecationTracking = require("./helpers/deprecationTracking"); -const FakeDocument = require("./helpers/FakeDocument"); -const CurrentScript = require("./helpers/CurrentScript"); - const prepareOptions = require("./helpers/prepareOptions"); const { parseResource } = require("../lib/util/identifier"); const captureStdio = require("./helpers/captureStdio"); -const asModule = require("./helpers/asModule"); const filterInfraStructureErrors = require("./helpers/infrastructureLogErrors"); +const { TestRunner } = require("./runner"); const casesPath = path.join(__dirname, "configCases"); const categories = fs.readdirSync(casesPath).map(cat => ({ @@ -420,290 +414,35 @@ const describeCases = config => { const bundlePath = testConfig.findBundle(i, optionsArr[i]); if (bundlePath) { filesCount++; - const document = new FakeDocument(outputDirectory); - const globalContext = { - console, - expect, - setTimeout, - clearTimeout, - document, - getComputedStyle: - document.getComputedStyle.bind(document), - location: { - href: "https://test.cases/path/index.html", - origin: "https://test.cases", - toString() { - return "https://test.cases/path/index.html"; - } - } - }; - - const requireCache = Object.create(null); - const esmCache = new Map(); - const esmIdentifier = `${category.name}-${testName}-${i}`; - const baseModuleScope = { - console, + const runner = new TestRunner({ + target: options.target, + outputDirectory, + testMeta: { + category: category.name, + name: testName, + round: i + }, + testConfig, + webpackOptions: options + }); + runner.mergeModuleScope({ it: _it, beforeEach: _beforeEach, afterEach: _afterEach, - expect, - jest, __STATS__: jsonStats, - __STATS_I__: i, - nsObj: m => { - Object.defineProperty(m, Symbol.toStringTag, { - value: "Module" - }); - return m; - } - }; - - let runInNewContext = false; - if ( - options.target === "web" || - options.target === "webworker" || - (Array.isArray(options.target) && - (options.target.includes("web") || - options.target.includes("webworker"))) - ) { - baseModuleScope.window = globalContext; - baseModuleScope.self = globalContext; - baseModuleScope.document = globalContext.document; - baseModuleScope.setTimeout = globalContext.setTimeout; - baseModuleScope.clearTimeout = globalContext.clearTimeout; - baseModuleScope.getComputedStyle = - globalContext.getComputedStyle; - baseModuleScope.URL = URL; - if (typeof Blob !== "undefined") { - baseModuleScope.Blob = Blob; - } - baseModuleScope.Worker = - require("./helpers/createFakeWorker")({ - outputDirectory - }); - runInNewContext = true; - } + __STATS_I__: i + }); if (testConfig.moduleScope) { - testConfig.moduleScope(baseModuleScope, options); + testConfig.moduleScope(runner._moduleScope, options); } - const esmContext = vm.createContext(baseModuleScope, { - name: "context for esm" - }); - - // eslint-disable-next-line no-loop-func - const _require = ( - currentDirectory, - options, - module, - esmMode, - parentModule - ) => { - if (testConfig.resolveModule) { - module = testConfig.resolveModule(module, i, options); - } - if (testConfig === undefined) { - throw new Error( - `_require(${module}) called after all tests from ${category.name} ${testName} have completed` - ); - } - - if (Array.isArray(module) || /^\.\.?\//.test(module)) { - let content; - let p; - let subPath = ""; - if (Array.isArray(module)) { - p = path.join(currentDirectory, ".array-require.js"); - content = `module.exports = (${module - .map( - arg => `require(${JSON.stringify(`./${arg}`)})` - ) - .join(", ")});`; - } else { - p = path.join(currentDirectory, module); - content = fs.readFileSync(p, "utf-8"); - const lastSlash = module.lastIndexOf("/"); - let firstSlash = module.indexOf("/"); - - if (lastSlash !== -1 && firstSlash !== lastSlash) { - if (firstSlash !== -1) { - let next = module.indexOf("/", firstSlash + 1); - let dir = module.slice(firstSlash + 1, next); - - while (dir === ".") { - firstSlash = next; - next = module.indexOf("/", firstSlash + 1); - dir = module.slice(firstSlash + 1, next); - } - } - - subPath = module.slice( - firstSlash + 1, - lastSlash + 1 - ); - } - } - const isModule = - p.endsWith(".mjs") && - options.experiments && - options.experiments.outputModule; - - if (isModule) { - if (!vm.SourceTextModule) - throw new Error( - "Running this test requires '--experimental-vm-modules'.\nRun with 'node --experimental-vm-modules node_modules/jest-cli/bin/jest'." - ); - let esm = esmCache.get(p); - if (!esm) { - esm = new vm.SourceTextModule(content, { - identifier: `${esmIdentifier}-${p}`, - url: `${pathToFileURL(p).href}?${esmIdentifier}`, - context: esmContext, - initializeImportMeta: (meta, module) => { - meta.url = pathToFileURL(p).href; - }, - importModuleDynamically: async ( - specifier, - module - ) => { - const normalizedSpecifier = - specifier.startsWith("file:") - ? `./${path.relative( - path.dirname(p), - url.fileURLToPath(specifier) - )}` - : specifier.replace( - /https:\/\/example.com\/public\/path\//, - "./" - ); - const result = await _require( - path.dirname(p), - options, - normalizedSpecifier, - "evaluated", - module - ); - return await asModule(result, module.context); - } - }); - esmCache.set(p, esm); - } - if (esmMode === "unlinked") return esm; - return (async () => { - if (esmMode === "unlinked") return esm; - await esm.link( - async (specifier, referencingModule) => - await asModule( - await _require( - path.dirname( - referencingModule.identifier - ? referencingModule.identifier.slice( - esmIdentifier.length + 1 - ) - : fileURLToPath(referencingModule.url) - ), - options, - specifier, - "unlinked", - referencingModule - ), - referencingModule.context, - true - ) - ); - // node.js 10 needs instantiate - if (esm.instantiate) esm.instantiate(); - await esm.evaluate(); - if (esmMode === "evaluated") return esm; - const ns = esm.namespace; - return ns.default && ns.default instanceof Promise - ? ns.default - : ns; - })(); - } - const isJSON = p.endsWith(".json"); - if (isJSON) { - return JSON.parse(content); - } - - if (p in requireCache) { - return requireCache[p].exports; - } - const m = { - exports: {} - }; - requireCache[p] = m; - - const moduleScope = { - ...baseModuleScope, - require: _require.bind( - null, - path.dirname(p), - options - ), - importScripts: url => { - expect(url).toMatch( - /^https:\/\/test\.cases\/path\// - ); - _require( - outputDirectory, - options, - `.${url.slice("https://test.cases/path".length)}` - ); - }, - module: m, - exports: m.exports, - __dirname: path.dirname(p), - __filename: p, - _globalAssign: { expect } - }; - if (testConfig.moduleScope) { - testConfig.moduleScope(moduleScope, options); - } - if (!runInNewContext) - content = `Object.assign(global, _globalAssign); ${content}`; - const args = Object.keys(moduleScope); - const argValues = args.map(arg => moduleScope[arg]); - const code = `(function(${args.join( - ", " - )}) {${content}\n})`; - - const oldCurrentScript = document.currentScript; - document.currentScript = new CurrentScript(subPath); - const fn = runInNewContext - ? vm.runInNewContext(code, globalContext, p) - : vm.runInThisContext(code, p); - fn.call( - testConfig.nonEsmThis - ? testConfig.nonEsmThis(module) - : m.exports, - ...argValues - ); - document.currentScript = oldCurrentScript; - return m.exports; - } else if ( - testConfig.modules && - module in testConfig.modules - ) { - return testConfig.modules[module]; - } - return require( - module.startsWith("node:") ? module.slice(5) : module - ); - }; if (Array.isArray(bundlePath)) { for (const bundlePathItem of bundlePath) { results.push( - _require( - outputDirectory, - options, - `./${bundlePathItem}` - ) + runner.require(outputDirectory, `./${bundlePathItem}`) ); } } else { - results.push( - _require(outputDirectory, options, bundlePath) - ); + results.push(runner.require(outputDirectory, bundlePath)); } } } diff --git a/test/HotTestCases.template.js b/test/HotTestCases.template.js index d0e14a17fe4..7b0d31653f7 100644 --- a/test/HotTestCases.template.js +++ b/test/HotTestCases.template.js @@ -4,11 +4,10 @@ require("./helpers/warmup-webpack"); const path = require("path"); const fs = require("graceful-fs"); -const vm = require("vm"); const rimraf = require("rimraf"); const checkArrayExpectation = require("./checkArrayExpectation"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); -const FakeDocument = require("./helpers/FakeDocument"); +const { TestRunner } = require("./runner"); const casesPath = path.join(__dirname, "hotCases"); let categories = fs @@ -69,7 +68,11 @@ const describeCases = config => { if (!options.output) options.output = {}; if (!options.output.path) options.output.path = outputDirectory; if (!options.output.filename) - options.output.filename = "bundle.js"; + options.output.filename = `bundle${ + options.experiments && options.experiments.outputModule + ? ".mjs" + : ".js" + }`; if (!options.output.chunkFilename) options.output.chunkFilename = "[name].chunk.[fullhash].js"; if (options.output.pathinfo === undefined) @@ -139,136 +142,20 @@ const describeCases = config => { return; } - const urlToPath = url => { - if (url.startsWith("https://test.cases/path/")) - url = url.slice(24); - return path.resolve(outputDirectory, `./${url}`); - }; - const urlToRelativePath = url => { - if (url.startsWith("https://test.cases/path/")) - url = url.slice(24); - return `./${url}`; - }; - const window = { - _elements: [], - fetch: async url => { - try { - const buffer = await new Promise((resolve, reject) => { - fs.readFile(urlToPath(url), (err, b) => - err ? reject(err) : resolve(b) - ); - }); - return { - status: 200, - ok: true, - json: async () => JSON.parse(buffer.toString("utf-8")) - }; - } catch (err) { - if (err.code === "ENOENT") { - return { - status: 404, - ok: false - }; - } - throw err; - } + const runner = new TestRunner({ + target: options.target, + outputDirectory, + testMeta: { + category: category.name, + name: testName, + env: "jsdom" }, - importScripts: url => { - expect(url).toMatch(/^https:\/\/test\.cases\/path\//); - _require(urlToRelativePath(url)); + testConfig: { + ...testConfig, + evaluateScriptOnAttached: true }, - document: { - createElement(type) { - const ele = { - _type: type, - getAttribute(name) { - return this[name]; - }, - setAttribute(name, value) { - this[name] = value; - }, - removeAttribute(name) { - delete this[name]; - }, - parentNode: { - removeChild(node) { - window._elements = window._elements.filter( - item => item !== node - ); - } - } - }; - ele.sheet = - type === "link" - ? new FakeDocument.FakeSheet(ele, outputDirectory) - : {}; - return ele; - }, - head: { - appendChild(element) { - window._elements.push(element); - - if (element._type === "script") { - // run it - Promise.resolve().then(() => { - _require(urlToRelativePath(element.src)); - }); - } else if (element._type === "link") { - Promise.resolve().then(() => { - if (element.onload) { - // run it - element.onload({ type: "load" }); - } - }); - } - }, - insertBefore(element, before) { - window._elements.push(element); - - if (element._type === "script") { - // run it - Promise.resolve().then(() => { - _require(urlToRelativePath(element.src)); - }); - } else if (element._type === "link") { - // run it - Promise.resolve().then(() => { - element.onload({ type: "load" }); - }); - } - } - }, - getElementsByTagName(name) { - if (name === "head") return [this.head]; - if (name === "script" || name === "link") { - return window._elements.filter( - item => item._type === name - ); - } - - throw new Error("Not supported"); - } - }, - Worker: require("./helpers/createFakeWorker")({ - outputDirectory - }), - EventSource: require("./helpers/EventSourceForNode"), - location: { - href: "https://test.cases/path/index.html", - origin: "https://test.cases", - toString() { - return "https://test.cases/path/index.html"; - } - } - }; - - const moduleScope = { - window - }; - - if (testConfig.moduleScope) { - testConfig.moduleScope(moduleScope, options); - } + webpackOptions: options + }); function _next(callback) { fakeUpdateLoaderOptions.updateIndex++; @@ -307,74 +194,31 @@ const describeCases = config => { }); } - /** - * @private - * @param {string} module module - * @returns {EXPECTED_ANY} required module - */ - function _require(module) { - if (module.startsWith("./")) { - const p = path.join(outputDirectory, module); - if (module.endsWith(".css")) { - return fs.readFileSync(p, "utf-8"); - } - if (module.endsWith(".json")) { - return JSON.parse(fs.readFileSync(p, "utf-8")); - } - const fn = vm.runInThisContext( - "(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest, self, window, fetch, document, importScripts, Worker, EventSource, NEXT, STATS) {" + - "global.expect = expect;" + - "global.it = it;" + - `function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }${fs.readFileSync( - p, - "utf-8" - )}\n})`, - p - ); - const m = { - exports: {} - }; - fn.call( - m.exports, - _require, - m, - m.exports, - outputDirectory, - p, - _it, - _beforeEach, - _afterEach, - expect, - jest, - window, - window, - window.fetch, - window.document, - window.importScripts, - window.Worker, - window.EventSource, - _next, - jsonStats - ); - return m.exports; - } - return require(module); - } + runner.mergeModuleScope({ + it: _it, + beforeEach: _beforeEach, + afterEach: _afterEach, + STATE: jsonStats, + NEXT: _next + }); + let promise = Promise.resolve(); const info = stats.toJson({ all: false, entrypoints: true }); if (config.target === "web") { for (const file of info.entrypoints.main.assets) { if (file.name.endsWith(".css")) { - const link = window.document.createElement("link"); - link.href = path.join(outputDirectory, file.name); - window.document.head.appendChild(link); + const link = + runner._moduleScope.document.createElement("link"); + link.href = file.name; + runner._moduleScope.document.head.appendChild(link); } else { - _require(`./${file.name}`); + runner.require(outputDirectory, `./${file.name}`); } } } else { const assets = info.entrypoints.main.assets; - const result = _require( + const result = runner.require( + outputDirectory, `./${assets[assets.length - 1].name}` ); if (typeof result === "object" && "then" in result) diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js index 194b8b03e6e..6b0b9a1609d 100644 --- a/test/WatchTestCases.template.js +++ b/test/WatchTestCases.template.js @@ -7,16 +7,13 @@ require("./helpers/warmup-webpack"); const path = require("path"); const fs = require("graceful-fs"); -const vm = require("vm"); const rimraf = require("rimraf"); -const { pathToFileURL, fileURLToPath } = require("url"); const checkArrayExpectation = require("./checkArrayExpectation"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const { remove } = require("./helpers/remove"); const prepareOptions = require("./helpers/prepareOptions"); const deprecationTracking = require("./helpers/deprecationTracking"); -const FakeDocument = require("./helpers/FakeDocument"); -const asModule = require("./helpers/asModule"); +const { TestRunner } = require("./runner"); /** * @param {string} src src @@ -150,7 +147,11 @@ const describeCases = config => { if (typeof options.output.pathinfo === "undefined") options.output.pathinfo = true; if (!options.output.filename) - options.output.filename = "bundle.js"; + options.output.filename = `bundle${ + options.experiments && options.experiments.outputModule + ? ".mjs" + : ".js" + }`; if (options.cache && options.cache.type === "filesystem") { const cacheDirectory = path.join(tempDirectory, ".cache"); options.cache.cacheDirectory = cacheDirectory; @@ -269,178 +270,6 @@ const describeCases = config => { ) return; - const globalContext = { - console, - expect, - setTimeout, - clearTimeout, - document: new FakeDocument() - }; - - const baseModuleScope = { - console, - it: run.it, - beforeEach: _beforeEach, - afterEach: _afterEach, - expect, - jest, - STATS_JSON: jsonStats, - nsObj: m => { - Object.defineProperty(m, Symbol.toStringTag, { - value: "Module" - }); - return m; - }, - window: globalContext, - self: globalContext, - WATCH_STEP: run.name, - STATE: state - }; - - const esmCache = new Map(); - const esmIdentifier = `${category.name}-${testName}`; - const esmContext = vm.createContext(baseModuleScope, { - name: "context for esm" - }); - // ESM - const isModule = - options.experiments && options.experiments.outputModule; - - /** - * @param {string} currentDirectory The directory to resolve relative paths from - * @param {string} module The module to require - * @param {("unlinked"|"evaluated")} esmMode The mode for ESM module handling - * @returns {EXPECTED_ANY} required module - * @private - */ - function _require(currentDirectory, module, esmMode) { - if (/^\.\.?\//.test(module) || path.isAbsolute(module)) { - let fn; - const p = path.isAbsolute(module) - ? module - : path.join(currentDirectory, module); - const content = fs.readFileSync(p, "utf-8"); - - if (isModule) { - if (!vm.SourceTextModule) - throw new Error( - "Running this test requires '--experimental-vm-modules'.\nRun with 'node --experimental-vm-modules node_modules/jest-cli/bin/jest'." - ); - let esm = esmCache.get(p); - if (!esm) { - esm = new vm.SourceTextModule(content, { - identifier: `${esmIdentifier}-${p}`, - url: `${pathToFileURL(p).href}?${esmIdentifier}`, - context: esmContext, - initializeImportMeta: (meta, module) => { - meta.url = pathToFileURL(p).href; - }, - importModuleDynamically: async ( - specifier, - module - ) => { - const normalizedSpecifier = - specifier.startsWith("file:") - ? `./${path.relative( - path.dirname(p), - fileURLToPath(specifier) - )}` - : specifier.replace( - /https:\/\/test.cases\/path\//, - "./" - ); - const result = await _require( - currentDirectory, - normalizedSpecifier, - "evaluated" - ); - return await asModule(result, module.context); - } - }); - esmCache.set(p, esm); - } - if (esmMode === "unlinked") return esm; - return (async () => { - if (esmMode === "unlinked") return esm; - await esm.link( - async (specifier, referencingModule) => - await asModule( - await _require( - path.dirname( - referencingModule.identifier - ? referencingModule.identifier.slice( - esmIdentifier.length + 1 - ) - : fileURLToPath(referencingModule.url) - ), - specifier, - "unlinked" - ), - referencingModule.context, - true - ) - ); - // node.js 10 needs instantiate - if (esm.instantiate) esm.instantiate(); - await esm.evaluate(); - if (esmMode === "evaluated") return esm; - const ns = esm.namespace; - return ns.default && ns.default instanceof Promise - ? ns.default - : ns; - })(); - } - - if ( - options.target === "web" || - options.target === "webworker" - ) { - fn = vm.runInNewContext( - "(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE, expect, window, self) {" + - `function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }${ - content - }\n})`, - globalContext, - p - ); - } else { - fn = vm.runInThisContext( - "(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE, expect) {" + - "global.expect = expect;" + - `function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }${ - content - }\n})`, - p - ); - } - const m = { - exports: {} - }; - fn.call( - m.exports, - _require.bind(null, path.dirname(p)), - m, - m.exports, - path.dirname(p), - p, - run.it, - run.name, - jsonStats, - state, - expect, - globalContext, - globalContext - ); - return module.exports; - } else if ( - testConfig.modules && - module in testConfig.modules - ) { - return testConfig.modules[module]; - } - return jest.requireActual(module); - } - let testConfig = {}; try { // try to load a test file @@ -453,7 +282,28 @@ const describeCases = config => { if (testConfig.noTests) return process.nextTick(compilationFinished); - + const runner = new TestRunner({ + target: options.target, + outputDirectory, + testMeta: { + category: category.name, + name: testName, + env: "jsdom" + }, + testConfig: { + ...testConfig, + evaluateScriptOnAttached: true + }, + webpackOptions: options + }); + runner.mergeModuleScope({ + it: run.it, + beforeEach: _beforeEach, + afterEach: _afterEach, + STATS_JSON: jsonStats, + STATE: state, + WATCH_STEP: run.name + }); const getBundle = (outputDirectory, module) => { if (Array.isArray(module)) { return module.map(arg => @@ -475,7 +325,7 @@ const describeCases = config => { )) { promises.push( Promise.resolve().then(() => - _require(outputDirectory, p) + runner.require(outputDirectory, p) ) ); } diff --git a/test/__snapshots__/ConfigTestCases.basictest.js.snap b/test/__snapshots__/ConfigTestCases.basictest.js.snap index 23153134e9f..ee01f31ffaa 100644 --- a/test/__snapshots__/ConfigTestCases.basictest.js.snap +++ b/test/__snapshots__/ConfigTestCases.basictest.js.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`ConfigTestCases css build-http exported tests should work with URLs in CSS 1`] = ` Array [ diff --git a/test/configCases/plugins/progress-plugin/test.config.js b/test/configCases/plugins/progress-plugin/test.config.js new file mode 100644 index 00000000000..67135d9ebe1 --- /dev/null +++ b/test/configCases/plugins/progress-plugin/test.config.js @@ -0,0 +1,8 @@ +const path = require("path"); + +module.exports = { + // sharing global require cache between webpack.config.js and testing file + modules: { + [path.resolve(__dirname, "data.js")]: require("./data.js") + } +}; diff --git a/test/configCases/source-map/default-filename-extensions-css/index.js b/test/configCases/source-map/default-filename-extensions-css/index.js index 55d51278fd2..12cac76ec29 100644 --- a/test/configCases/source-map/default-filename-extensions-css/index.js +++ b/test/configCases/source-map/default-filename-extensions-css/index.js @@ -1,6 +1,13 @@ +import "./style.css"; +import fs from "fs"; +import path from "path"; + it("creates source maps for .css output files by default", function() { - var fs = require("fs"); - var source = fs.readFileSync(__filename, "utf-8"); - var match = /sourceMappingURL\s*=\s*(.*)\*\//.exec(source); - expect(match[1]).toBe("bundle0.css.map"); + const css = fs.readFileSync(path.resolve(__dirname, "style.css"), "utf-8"); + const map = JSON.parse(fs.readFileSync(path.resolve(__dirname, "style.css.map"), "utf-8")); + + var match = /sourceMappingURL\s*=\s*(.*)\*\//.exec(css); + expect(match[1]).toBe("style.css.map"); + expect(map).toHaveProperty("version", 3); + expect(map).toHaveProperty("file", "style.css"); }); \ No newline at end of file diff --git a/test/configCases/source-map/default-filename-extensions-css/style.css b/test/configCases/source-map/default-filename-extensions-css/style.css new file mode 100644 index 00000000000..40363d3c146 --- /dev/null +++ b/test/configCases/source-map/default-filename-extensions-css/style.css @@ -0,0 +1,3 @@ +body { + background-color: red; +} \ No newline at end of file diff --git a/test/configCases/source-map/default-filename-extensions-css/test.js b/test/configCases/source-map/default-filename-extensions-css/test.js deleted file mode 100644 index d336df4c821..00000000000 --- a/test/configCases/source-map/default-filename-extensions-css/test.js +++ /dev/null @@ -1,3 +0,0 @@ -var foo = {}; - -module.exports = foo; \ No newline at end of file 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 ae476c291fa..29cefe96ef0 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,12 +1,36 @@ +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { - filename: "bundle0.css" + filename: "bundle0.js" }, node: { __dirname: false, __filename: false }, - devtool: "source-map" + devtool: "source-map", + module: { + rules: [ + { + test: /\.css$/i, + use: [ + MiniCssExtractPlugin.loader, + { + loader: "css-loader", + options: { + sourceMap: true + } + } + ] + } + ] + }, + plugins: [ + new MiniCssExtractPlugin({ + filename: "style.css", + chunkFilename: "[id].css" + }) + ] }; diff --git a/test/helpers/EventSourceForNode.js b/test/helpers/EventSourceForNode.js index ae9437871f6..17f30aad6c8 100644 --- a/test/helpers/EventSourceForNode.js +++ b/test/helpers/EventSourceForNode.js @@ -14,6 +14,7 @@ module.exports = class EventSource { url, { agent: false, + rejectUnauthorized: false, headers: { accept: "text/event-stream" } }, res => { diff --git a/test/helpers/FakeDocument.js b/test/helpers/FakeDocument.js index 700be0d13b5..fe02264c09a 100644 --- a/test/helpers/FakeDocument.js +++ b/test/helpers/FakeDocument.js @@ -73,17 +73,34 @@ class FakeElement { this.sheet = type === "link" ? new FakeSheet(this, basePath) : undefined; } - appendChild(node) { + _attach(node) { this._document._onElementAttached(node); this._children.push(node); node.parentNode = this; + } + + _load(node) { if (node._type === "link") { setTimeout(() => { if (node.onload) node.onload({ type: "load", target: node }); }, 100); + } else if (node._type === "script" && this._document.onScript) { + Promise.resolve().then(() => { + this._document.onScript(node.src); + }); } } + insertBefore(node, before) { + this._attach(node); + this._load(node); + } + + appendChild(node) { + this._attach(node); + this._load(node); + } + removeChild(node) { const idx = this._children.indexOf(node); if (idx >= 0) { diff --git a/test/hotCases/lazy-compilation/https/test.config.js b/test/hotCases/lazy-compilation/https/test.config.js new file mode 100644 index 00000000000..afaea34172c --- /dev/null +++ b/test/hotCases/lazy-compilation/https/test.config.js @@ -0,0 +1,10 @@ +module.exports = { + moduleScope(scope, options) { + if ( + (options.target === "web" || options.target === "webworker") && + !scope.process + ) { + scope.process = process; + } + } +}; diff --git a/test/hotCases/status/accept/index.js b/test/hotCases/status/accept/index.js index 597a2bd0ec3..95c4c66166f 100644 --- a/test/hotCases/status/accept/index.js +++ b/test/hotCases/status/accept/index.js @@ -16,7 +16,7 @@ it("should wait until promises returned by status handlers are fulfilled", (done value = require("./file"); }); NEXT(require("../../update")(done, undefined, () => { - expect(handler.mock.calls).toStrictEqual([['check'], ['prepare'], ['dispose'], ['apply'], ['idle']]); + expect(handler.mock.calls).toEqual([['check'], ['prepare'], ['dispose'], ['apply'], ['idle']]); for (let result of handler.mock.results) expect(result.value.test).toHaveBeenCalledTimes(1); diff --git a/test/runner/index.js b/test/runner/index.js new file mode 100644 index 00000000000..35cc0d8b216 --- /dev/null +++ b/test/runner/index.js @@ -0,0 +1,484 @@ +const fs = require("fs"); +const path = require("path"); +const vm = require("vm"); +const { pathToFileURL, fileURLToPath } = require("url"); + +/** + * @param {string} path + * @returns {string} + */ +const getSubPath = path => { + let subPath = ""; + const lastSlash = path.lastIndexOf("/"); + let firstSlash = path.indexOf("/"); + if (lastSlash !== -1 && firstSlash !== lastSlash) { + if (firstSlash !== -1) { + let next = path.indexOf("/", firstSlash + 1); + let dir = path.slice(firstSlash + 1, next); + + while (dir === ".") { + firstSlash = next; + next = path.indexOf("/", firstSlash + 1); + dir = path.slice(firstSlash + 1, next); + } + } + subPath = path.slice(firstSlash + 1, lastSlash + 1); + } + return subPath; +}; + +/** + * @param {string} path + * @returns {boolean} + */ +const isRelativePath = path => /^\.\.?\//.test(path); + +/** + * @param {string} url + * @param {string} outputDirectory + * @returns {string} + */ +const urlToPath = (url, outputDirectory) => { + if (url.startsWith("https://test.cases/path/")) url = url.slice(24); + else if (url.startsWith("https://test.cases/")) url = url.slice(19); + return path.resolve(outputDirectory, `./${url}`); +}; + +/** + * @param {string} url + * @returns {string} + */ +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}`; +}; + +/** + * @typedef {Object} TestMeta + * @property {string} category + * @property {string} name + * @property {"jsdom"} [env] + * @property {number} [round] + */ + +/** + * @typedef {Object} TestConfig + * @property {Function} [resolveModule] + * @property {Function} [moduleScope] + * @property {Function} [nonEsmThis] + * @property {boolean} [evaluateScriptOnAttached] + */ + +/** + * @typedef {Object} TestRunnerOptions + * @property {string|string[]} target + * @property {string} outputDirectory + * @property {TestMeta} testMeta + * @property {TestConfig} testConfig + * @property {EXPECTED_ANY} webpackOptions + */ + +/** + * @typedef {Object} ModuleInfo + * @property {string} subPath + * @property {string} modulePath + * @property {string} content + */ + +/** + * @typedef {Object} RequireContext + * @property {"unlinked"|"evaluated"} esmMode + */ + +/** + * @typedef {Object} ModuleRunner + * @property {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} cjs + * @property {(moduleInfo: ModuleInfo, context: RequireContext) => Promise} esm + * @property {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} json + * @property {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} raw + */ + +class TestRunner { + /** + * @param {TestRunnerOptions} options + */ + constructor({ + target, + outputDirectory, + testMeta, + testConfig, + webpackOptions + }) { + this.target = target; + this.outputDirectory = outputDirectory; + this.testConfig = testConfig || {}; + this.testMeta = testMeta || {}; + this.webpackOptions = webpackOptions || {}; + this._runInNewContext = this.isTargetWeb(); + this._globalContext = this.createBaseGlobalContext(); + this._moduleScope = this.createBaseModuleScope(); + this._moduleRunners = this.createModuleRunners(); + } + + /** + * @returns {ModuleRunner} + */ + createModuleRunners() { + return { + cjs: this.createCjsRunner(), + esm: this.createEsmRunner(), + json: this.createJSONRunner(), + raw: this.createRawRunner() + }; + } + /** + * @returns {EXPECTED_ANY} globalContext + */ + createBaseGlobalContext() { + let base = { console, expect, setTimeout, clearTimeout }; + Object.assign(base, this.setupEnv()); + return base; + } + /** + * @returns {boolean} + */ + isTargetWeb() { + return ( + this.target === "web" || + this.target === "webworker" || + (Array.isArray(this.target) && + (this.target.includes("web") || this.target.includes("webworker"))) + ); + } + /** + * @returns {boolean} + */ + jsDom() { + return this.testMeta.env === "jsdom" || this.isTargetWeb(); + } + /** + * @returns {EXPECTED_ANY} moduleScope + */ + createBaseModuleScope() { + let base = { + console, + expect, + jest, + nsObj: m => { + Object.defineProperty(m, Symbol.toStringTag, { + value: "Module" + }); + return m; + } + }; + if (this.jsDom()) { + Object.assign(base, this._globalContext); + base.window = this._globalContext; + base.self = this._globalContext; + } + return base; + } + /** + * @param {EXPECTED_ANY} globalContext + * @returns {EXPECTED_ANY} + */ + mergeGlobalContext(globalContext) { + return Object.assign(this._globalContext, globalContext); + } + /** + * @param {EXPECTED_ANY} moduleScope + * @returns {EXPECTED_ANY} + */ + mergeModuleScope(moduleScope) { + return Object.assign(this._moduleScope, moduleScope); + } + /** + * @param {string} currentDirectory + * @param {string|string[]} module + * @returns {ModuleInfo} + */ + _resolveModule(currentDirectory, module) { + if (Array.isArray(module)) { + return { + subPath: "", + modulePath: path.join(currentDirectory, ".array-require.js"), + content: `module.exports = (${module + .map(arg => `require(${JSON.stringify(`./${arg}`)})`) + .join(", ")});` + }; + } + if (isRelativePath(module)) { + return { + subPath: getSubPath(module), + modulePath: path.join(currentDirectory, module), + content: fs.readFileSync(path.join(currentDirectory, module), "utf-8") + }; + } + if (path.isAbsolute(module)) { + return { + subPath: "", + modulePath: module, + content: fs.readFileSync(module, "utf-8") + }; + } + } + + /** + * @param {string} currentDirectory + * @param {string|string[]} module + * @param {RequireContext} [context={}] + * @returns {EXPECTED_ANY} + */ + require(currentDirectory, module, context = {}) { + if (this.testConfig.modules && module in this.testConfig.modules) { + return this.testConfig.modules[module]; + } + if (this.testConfig.resolveModule) { + module = this.testConfig.resolveModule( + module, + this.testMeta.round || 0, + this.webpackOptions + ); + } + let moduleInfo = this._resolveModule(currentDirectory, module); + if (!moduleInfo) { + return require(module.startsWith("node:") ? module.slice(5) : module); + } + const { modulePath } = moduleInfo; + if ( + modulePath.endsWith(".mjs") && + this.webpackOptions.experiments && + this.webpackOptions.experiments.outputModule + ) { + return this._moduleRunners.esm(moduleInfo, context); + } + if (modulePath.endsWith(".json")) { + return this._moduleRunners.json(moduleInfo, context); + } + if (["css"].includes(modulePath.split(".").pop())) { + return this._moduleRunners.raw(moduleInfo, context); + } + return this._moduleRunners.cjs(moduleInfo, context); + } + /** + * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} + */ + createCjsRunner() { + const requireCache = Object.create(null); + return (moduleInfo, context) => { + const { modulePath, subPath, content } = moduleInfo; + let _content = content; + if (modulePath in requireCache) { + return requireCache[modulePath].exports; + } + const mod = { + exports: {} + }; + requireCache[modulePath] = mod; + const moduleScope = { + ...this._moduleScope, + require: this.require.bind(this, path.dirname(modulePath)), + importScripts: url => { + expect(url).toMatch(/^https:\/\/test\.cases\/path\//); + this.require(this.outputDirectory, urlToRelativePath(url)); + }, + module: mod, + exports: mod.exports, + __dirname: path.dirname(modulePath), + __filename: modulePath, + _globalAssign: { expect, it: this._moduleScope.it } + }; + // Call again because some tests rely on `scope.module` + if (this.testConfig.moduleScope) { + this.testConfig.moduleScope(moduleScope, this.webpackOptions); + } + if (!this._runInNewContext) + _content = `Object.assign(global, _globalAssign); ${content}`; + const args = Object.keys(moduleScope); + const argValues = args.map(arg => moduleScope[arg]); + const code = `(function(${args.join(", ")}) {${_content}\n})`; + const document = this._moduleScope.document; + const fn = this._runInNewContext + ? vm.runInNewContext(code, this._globalContext, modulePath) + : vm.runInThisContext(code, modulePath); + const call = () => { + fn.call( + this.testConfig.nonEsmThis + ? this.testConfig.nonEsmThis(module) + : mod.exports, + ...argValues + ); + }; + if (document) { + const CurrentScript = require("../helpers/CurrentScript"); + const oldCurrentScript = document.currentScript; + document.currentScript = new CurrentScript(subPath); + try { + call(); + } finally { + document.currentScript = oldCurrentScript; + } + } else { + call(); + } + return mod.exports; + }; + } + /** + * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => Promise} + */ + createEsmRunner() { + const esmCache = new Map(); + const { category, name, round } = this.testMeta; + const esmIdentifier = `${category.name}-${name}-${round || 0}`; + let esmContext = null; + return (moduleInfo, context) => { + const asModule = require("../helpers/asModule"); + // lazy bind esm context + if (!esmContext) { + esmContext = vm.createContext(this._moduleScope, { + name: "context for esm" + }); + } + const { modulePath, subPath, content } = moduleInfo; + const { esmMode } = context; + if (!vm.SourceTextModule) + throw new Error( + "Running this test requires '--experimental-vm-modules'.\nRun with 'node --experimental-vm-modules node_modules/jest-cli/bin/jest'." + ); + let esm = esmCache.get(modulePath); + if (!esm) { + esm = new vm.SourceTextModule(content, { + identifier: `${esmIdentifier}-${modulePath}`, + url: `${pathToFileURL(modulePath).href}?${esmIdentifier}`, + context: esmContext, + initializeImportMeta: (meta, module) => { + meta.url = pathToFileURL(modulePath).href; + }, + importModuleDynamically: async (specifier, module) => { + const normalizedSpecifier = specifier.startsWith("file:") + ? `./${path.relative( + path.dirname(modulePath), + fileURLToPath(specifier) + )}` + : specifier.replace( + /https:\/\/example.com\/public\/path\//, + "./" + ); + const result = await this.require( + path.dirname(modulePath), + normalizedSpecifier, + { + esmMode: "evaluated" + } + ); + return await asModule(result, module.context); + } + }); + esmCache.set(modulePath, esm); + } + if (esmMode === "unlinked") return esm; + return (async () => { + if (esmMode === "unlinked") return esm; + await esm.link( + async (specifier, referencingModule) => + await asModule( + await this.require( + path.dirname( + referencingModule.identifier + ? referencingModule.identifier.slice( + esmIdentifier.length + 1 + ) + : fileURLToPath(referencingModule.url) + ), + specifier, + { esmMode: "unlinked" } + ), + referencingModule.context, + true + ) + ); + // node.js 10 needs instantiate + if (esm.instantiate) esm.instantiate(); + await esm.evaluate(); + if (esmMode === "evaluated") return esm; + const ns = esm.namespace; + return ns.default && ns.default instanceof Promise ? ns.default : ns; + })(); + }; + } + createJSONRunner() { + return moduleInfo => { + return JSON.parse(moduleInfo.content); + }; + } + createRawRunner() { + return moduleInfo => { + return moduleInfo.content; + }; + } + setupEnv() { + if (this.jsDom()) { + const outputDirectory = this.outputDirectory; + const FakeDocument = require("../helpers/FakeDocument"); + const createFakeWorker = require("../helpers/createFakeWorker"); + const EventSource = require("../helpers/EventSourceForNode"); + const document = new FakeDocument(outputDirectory); + if (this.testConfig.evaluateScriptOnAttached) { + document.onScript = src => { + this.require(outputDirectory, urlToRelativePath(src)); + }; + } + const fetch = async url => { + try { + const buffer = await new Promise((resolve, reject) => { + fs.readFile(urlToPath(url, this.outputDirectory), (err, b) => + err ? reject(err) : resolve(b) + ); + }); + return { + status: 200, + ok: true, + json: async () => JSON.parse(buffer.toString("utf-8")) + }; + } catch (err) { + if (err.code === "ENOENT") { + return { + status: 404, + ok: false + }; + } + throw err; + } + }; + let env = { + setTimeout, + document, + location: { + href: "https://test.cases/path/index.html", + origin: "https://test.cases", + toString() { + return "https://test.cases/path/index.html"; + } + }, + getComputedStyle: document.getComputedStyle.bind(document), + Worker: createFakeWorker({ + outputDirectory + }), + URL, + EventSource, + clearTimeout, + fetch + }; + if (typeof Blob !== "undefined") { + // node.js >= 18 + env.Blob = Blob; + } + return env; + } + return {}; + } +} + +module.exports.TestRunner = TestRunner; 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 eb48318285e..7957917eca2 100644 --- a/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js +++ b/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js @@ -25,7 +25,7 @@ module.exports = { } }, output: { - filename: "[name].[contenthash].js", - chunkFilename: "[name].[contenthash].js" + filename: "[name].[contenthash].mjs", + chunkFilename: "[name].[contenthash].mjs" } }; diff --git a/yarn.lock b/yarn.lock index 9003a9dd445..ab72adca471 100644 --- a/yarn.lock +++ b/yarn.lock @@ -129,7 +129,7 @@ "@babel/template" "^7.27.2" "@babel/types" "^7.27.3" -"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.27.3", "@babel/parser@^7.27.4", "@babel/parser@^7.27.5", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": +"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.27.4", "@babel/parser@^7.27.5", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": version "7.27.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.5.tgz#ed22f871f110aa285a6fd934a0efed621d118826" integrity sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg== From 605897418a4d96bf421a06846f4baa818898e129 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Mon, 23 Jun 2025 15:20:10 +0300 Subject: [PATCH 23/56] docs: update examples (#19618) --- examples/chunkhash/README.md | 18 +++++++-------- examples/code-splitting-harmony/README.md | 12 +++++----- examples/hybrid-routing/README.md | 28 +++++++++++------------ examples/module-federation/README.md | 8 +++---- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/examples/chunkhash/README.md b/examples/chunkhash/README.md index ebfab5df2d3..bba30fd6d60 100644 --- a/examples/chunkhash/README.md +++ b/examples/chunkhash/README.md @@ -44,7 +44,7 @@ module.exports = { @@ -145,7 +145,7 @@ module.exports = { /******/ __webpack_require__.r(ns); /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; -/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { +/******/ for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) { /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } /******/ def['default'] = () => (value); @@ -392,15 +392,15 @@ asset runtime~main.[chunkhash].js 12.2 KiB [emitted] (name: runtime~main) asset main.[chunkhash].js 873 bytes [emitted] (name: main) asset 2.[chunkhash].js 285 bytes [emitted] asset 3.[chunkhash].js 279 bytes [emitted] -Entrypoint main 13 KiB = runtime~main.[chunkhash].js 12.2 KiB main.[chunkhash].js 873 bytes +Entrypoint main 13.1 KiB = runtime~main.[chunkhash].js 12.2 KiB main.[chunkhash].js 873 bytes chunk (runtime: runtime~main) main.[chunkhash].js (main) 55 bytes [initial] [rendered] > ./example main ./example.js 55 bytes [built] [code generated] [used exports unknown] entry ./example main -chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.59 KiB [entry] [rendered] +chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.63 KiB [entry] [rendered] > ./example main - runtime modules 7.59 KiB 10 modules + runtime modules 7.63 KiB 10 modules chunk (runtime: runtime~main) 2.[chunkhash].js 28 bytes [rendered] > ./async1 ./example.js 2:0-18 ./async1.js 28 bytes [built] [code generated] @@ -417,19 +417,19 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset runtime~main.[chunkhash].js 2.73 KiB [emitted] [minimized] (name: runtime~main) +asset runtime~main.[chunkhash].js 2.75 KiB [emitted] [minimized] (name: runtime~main) asset main.[chunkhash].js 155 bytes [emitted] [minimized] (name: main) asset 471.[chunkhash].js 69 bytes [emitted] [minimized] asset 18.[chunkhash].js 67 bytes [emitted] [minimized] -Entrypoint main 2.88 KiB = runtime~main.[chunkhash].js 2.73 KiB main.[chunkhash].js 155 bytes +Entrypoint main 2.91 KiB = runtime~main.[chunkhash].js 2.75 KiB main.[chunkhash].js 155 bytes chunk (runtime: runtime~main) 18.[chunkhash].js 28 bytes [rendered] > ./async1 ./example.js 2:0-18 ./async1.js 28 bytes [built] [code generated] [used exports unknown] import() ./async1 ./example.js 2:0-18 -chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.6 KiB [entry] [rendered] +chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.63 KiB [entry] [rendered] > ./example main - runtime modules 7.6 KiB 10 modules + runtime modules 7.63 KiB 10 modules chunk (runtime: runtime~main) 471.[chunkhash].js 28 bytes [rendered] > ./async2 ./example.js 3:0-18 ./async2.js 28 bytes [built] [code generated] diff --git a/examples/code-splitting-harmony/README.md b/examples/code-splitting-harmony/README.md index 064b72870b4..dbb4a4cd9af 100644 --- a/examples/code-splitting-harmony/README.md +++ b/examples/code-splitting-harmony/README.md @@ -155,7 +155,7 @@ module.exports = webpackAsyncContext; /******/ __webpack_require__.r(ns); /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; -/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { +/******/ for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) { /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } /******/ def['default'] = () => (value); @@ -422,9 +422,9 @@ chunk (runtime: main) 414.output.js 11 bytes [rendered] ./node_modules/b.js 11 bytes [built] [code generated] [used exports unknown] import() b ./example.js 3:0-11 -chunk (runtime: main) output.js (main) 414 bytes (javascript) 6.88 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 414 bytes (javascript) 6.91 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 6.88 KiB 10 modules + runtime modules 6.91 KiB 10 modules dependent modules 171 bytes [dependent] 2 modules ./example.js 243 bytes [built] [code generated] [no exports] @@ -436,7 +436,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.89 KiB [emitted] [minimized] (name: main) +asset output.js 2.91 KiB [emitted] [minimized] (name: main) asset 140.output.js 69 bytes [emitted] [minimized] asset 197.output.js 69 bytes [emitted] [minimized] asset 414.output.js 69 bytes [emitted] [minimized] @@ -459,9 +459,9 @@ chunk (runtime: main) 414.output.js 11 bytes [rendered] ./node_modules/b.js 11 bytes [built] [code generated] [used exports unknown] import() b ./example.js 3:0-11 -chunk (runtime: main) output.js (main) 403 bytes (javascript) 6.62 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 403 bytes (javascript) 6.65 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 6.62 KiB 9 modules + runtime modules 6.65 KiB 9 modules dependent modules 160 bytes [dependent] 1 module ./example.js 243 bytes [built] [code generated] [no exports] diff --git a/examples/hybrid-routing/README.md b/examples/hybrid-routing/README.md index 4b6e6678a6e..10fac2bd061 100644 --- a/examples/hybrid-routing/README.md +++ b/examples/hybrid-routing/README.md @@ -281,7 +281,7 @@ render(__webpack_require__(/*! ./aPage */ 2)); /******/ __webpack_require__.r(ns); /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; -/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { +/******/ for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) { /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } /******/ def['default'] = () => (value); @@ -533,7 +533,7 @@ asset router_js.bundle.js 2.45 KiB [emitted] asset aPage.bundle.js 392 bytes [emitted] (name: aPage) asset bPage.bundle.js 392 bytes [emitted] (name: bPage) Entrypoint pageA 15.8 KiB = router_js.bundle.js 2.45 KiB aPage.bundle.js 392 bytes pageA.bundle.js 13 KiB -Entrypoint pageB 15.8 KiB = router_js.bundle.js 2.45 KiB bPage.bundle.js 392 bytes pageB.bundle.js 13 KiB +Entrypoint pageB 15.9 KiB = router_js.bundle.js 2.45 KiB bPage.bundle.js 392 bytes pageB.bundle.js 13 KiB chunk (runtime: pageA, pageB) aPage.bundle.js (aPage) 59 bytes [initial] [rendered] reused as split chunk (cache group: default) > ./aPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./aPage > ./aEntry pageA @@ -552,17 +552,17 @@ chunk (runtime: pageA, pageB) bPage.bundle.js (bPage) 59 bytes [initial] [render cjs require ./bPage ./bEntry.js 3:7-25 cjs self exports reference ./bPage.js 1:0-14 import() context element ./bPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./bPage -chunk (runtime: pageA) pageA.bundle.js (pageA) 87 bytes (javascript) 7.57 KiB (runtime) [entry] [rendered] +chunk (runtime: pageA) pageA.bundle.js (pageA) 87 bytes (javascript) 7.61 KiB (runtime) [entry] [rendered] > ./aEntry pageA > ./router pageA - runtime modules 7.57 KiB 10 modules + runtime modules 7.61 KiB 10 modules ./aEntry.js 87 bytes [built] [code generated] [used exports unknown] entry ./aEntry pageA -chunk (runtime: pageB) pageB.bundle.js (pageB) 87 bytes (javascript) 7.57 KiB (runtime) [entry] [rendered] +chunk (runtime: pageB) pageB.bundle.js (pageB) 87 bytes (javascript) 7.61 KiB (runtime) [entry] [rendered] > ./bEntry pageB > ./router pageB - runtime modules 7.57 KiB 10 modules + runtime modules 7.61 KiB 10 modules ./bEntry.js 87 bytes [built] [code generated] [used exports unknown] entry ./bEntry pageB @@ -582,13 +582,13 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset pageA.bundle.js 2.83 KiB [emitted] [minimized] (name: pageA) -asset pageB.bundle.js 2.83 KiB [emitted] [minimized] (name: pageB) +asset pageA.bundle.js 2.85 KiB [emitted] [minimized] (name: pageA) +asset pageB.bundle.js 2.85 KiB [emitted] [minimized] (name: pageB) asset router_js.bundle.js 544 bytes [emitted] [minimized] asset aPage.bundle.js 117 bytes [emitted] [minimized] (name: aPage) asset bPage.bundle.js 117 bytes [emitted] [minimized] (name: bPage) -Entrypoint pageA 3.48 KiB = router_js.bundle.js 544 bytes aPage.bundle.js 117 bytes pageA.bundle.js 2.83 KiB -Entrypoint pageB 3.48 KiB = router_js.bundle.js 544 bytes bPage.bundle.js 117 bytes pageB.bundle.js 2.83 KiB +Entrypoint pageA 3.5 KiB = router_js.bundle.js 544 bytes aPage.bundle.js 117 bytes pageA.bundle.js 2.85 KiB +Entrypoint pageB 3.5 KiB = router_js.bundle.js 544 bytes bPage.bundle.js 117 bytes pageB.bundle.js 2.85 KiB chunk (runtime: pageA, pageB) aPage.bundle.js (aPage) 59 bytes [initial] [rendered] reused as split chunk (cache group: default) > ./aPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./aPage > ./aEntry pageA @@ -607,17 +607,17 @@ chunk (runtime: pageA, pageB) bPage.bundle.js (bPage) 59 bytes [initial] [render cjs require ./bPage ./bEntry.js 3:7-25 cjs self exports reference ./bPage.js 1:0-14 import() context element ./bPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./bPage -chunk (runtime: pageA) pageA.bundle.js (pageA) 87 bytes (javascript) 7.57 KiB (runtime) [entry] [rendered] +chunk (runtime: pageA) pageA.bundle.js (pageA) 87 bytes (javascript) 7.61 KiB (runtime) [entry] [rendered] > ./aEntry pageA > ./router pageA - runtime modules 7.57 KiB 10 modules + runtime modules 7.61 KiB 10 modules ./aEntry.js 87 bytes [built] [code generated] [no exports used] entry ./aEntry pageA -chunk (runtime: pageB) pageB.bundle.js (pageB) 87 bytes (javascript) 7.57 KiB (runtime) [entry] [rendered] +chunk (runtime: pageB) pageB.bundle.js (pageB) 87 bytes (javascript) 7.61 KiB (runtime) [entry] [rendered] > ./bEntry pageB > ./router pageB - runtime modules 7.57 KiB 10 modules + runtime modules 7.61 KiB 10 modules ./bEntry.js 87 bytes [built] [code generated] [no exports used] entry ./bEntry pageB diff --git a/examples/module-federation/README.md b/examples/module-federation/README.md index b7644ca86f1..b3540b8b557 100644 --- a/examples/module-federation/README.md +++ b/examples/module-federation/README.md @@ -484,7 +484,7 @@ module.exports = new Promise((resolve, reject) => { /******/ __webpack_require__.r(ns); /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; -/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { +/******/ for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) { /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } /******/ def['default'] = () => (value); @@ -2175,11 +2175,11 @@ mfe-c: ``` app: asset src_bootstrap_js.js 12.5 KiB [emitted] [minimized] 1 related asset - asset app.js 7.66 KiB [emitted] [minimized] (name: app) + asset app.js 7.69 KiB [emitted] [minimized] (name: app) asset node_modules_react_index_js.js 7.46 KiB [emitted] [minimized] 1 related asset - chunk (runtime: app) app.js (app) 672 bytes (javascript) 42 bytes (share-init) 18.9 KiB (runtime) [entry] [rendered] + chunk (runtime: app) app.js (app) 672 bytes (javascript) 42 bytes (share-init) 19 KiB (runtime) [entry] [rendered] > ./src/index.js app - runtime modules 18.9 KiB 13 modules + runtime modules 19 KiB 13 modules built modules 672 bytes (javascript) 42 bytes (share-init) [built] ./src/index.js 588 bytes [built] [code generated] external "mfeBBB@/dist/bbb/mfeBBB.js" 42 bytes [built] [code generated] From 09fda8730d384b6c58cc83ed8b8b2ce14ce46f1d Mon Sep 17 00:00:00 2001 From: Natsu Xiao <784487301@qq.com> Date: Mon, 23 Jun 2025 20:22:23 +0800 Subject: [PATCH 24/56] feat: HMR support for ESM --- lib/esm/ModuleChunkFormatPlugin.js | 212 +++++++++--------- lib/esm/ModuleChunkLoadingPlugin.js | 26 +++ lib/esm/ModuleChunkLoadingRuntimeModule.js | 90 +++++++- test/HotTestCases.template.js | 7 +- .../esm-output/async-chunks/async-module.js | 3 + .../hotCases/esm-output/async-chunks/index.js | 34 +++ .../esm-output/async-chunks/lazy-module.js | 9 + .../esm-output/async-chunks/webpack.config.js | 17 ++ test/hotCases/esm-output/css-modules/index.js | 29 +++ .../esm-output/css-modules/style.module.css | 7 + .../esm-output/css-modules/style2.module.css | 7 + .../esm-output/css-modules/test.config.js | 8 + .../esm-output/css-modules/webpack.config.js | 18 ++ .../esm-output/runtime-chunk/async-shared.js | 4 + .../esm-output/runtime-chunk/index.js | 23 ++ .../esm-output/runtime-chunk/shared.js | 9 + .../runtime-chunk/webpack.config.js | 18 ++ test/hotCases/esm-output/simple/index.js | 22 ++ test/hotCases/esm-output/simple/module.js | 3 + .../esm-output/simple/webpack.config.js | 17 ++ .../esm-output/split-chunks/common/shared.js | 16 ++ .../hotCases/esm-output/split-chunks/index.js | 25 +++ .../split-chunks/node_modules/vendor-lib.js | 17 ++ .../esm-output/split-chunks/webpack.config.js | 34 +++ test/hotCases/update.esm.js | 16 ++ test/runner/index.js | 8 + 26 files changed, 570 insertions(+), 109 deletions(-) create mode 100644 test/hotCases/esm-output/async-chunks/async-module.js create mode 100644 test/hotCases/esm-output/async-chunks/index.js create mode 100644 test/hotCases/esm-output/async-chunks/lazy-module.js create mode 100644 test/hotCases/esm-output/async-chunks/webpack.config.js create mode 100644 test/hotCases/esm-output/css-modules/index.js create mode 100644 test/hotCases/esm-output/css-modules/style.module.css create mode 100644 test/hotCases/esm-output/css-modules/style2.module.css create mode 100644 test/hotCases/esm-output/css-modules/test.config.js create mode 100644 test/hotCases/esm-output/css-modules/webpack.config.js create mode 100644 test/hotCases/esm-output/runtime-chunk/async-shared.js create mode 100644 test/hotCases/esm-output/runtime-chunk/index.js create mode 100644 test/hotCases/esm-output/runtime-chunk/shared.js create mode 100644 test/hotCases/esm-output/runtime-chunk/webpack.config.js create mode 100644 test/hotCases/esm-output/simple/index.js create mode 100644 test/hotCases/esm-output/simple/module.js create mode 100644 test/hotCases/esm-output/simple/webpack.config.js create mode 100644 test/hotCases/esm-output/split-chunks/common/shared.js create mode 100644 test/hotCases/esm-output/split-chunks/index.js create mode 100644 test/hotCases/esm-output/split-chunks/node_modules/vendor-lib.js create mode 100644 test/hotCases/esm-output/split-chunks/webpack.config.js create mode 100644 test/hotCases/update.esm.js diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index af49333d578..224b0c95868 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -6,8 +6,7 @@ "use strict"; const { ConcatSource } = require("webpack-sources"); -const { RuntimeGlobals } = require(".."); -const HotUpdateChunk = require("../HotUpdateChunk"); +const { RuntimeGlobals, HotUpdateChunk } = require(".."); const Template = require("../Template"); const { getAllChunks } = require("../javascript/ChunkHelpers"); const { @@ -72,30 +71,47 @@ class ModuleChunkFormatPlugin { hooks.renderChunk.tap(PLUGIN_NAME, (modules, renderContext) => { const { chunk, chunkGraph, runtimeTemplate } = renderContext; const hotUpdateChunk = chunk instanceof HotUpdateChunk ? chunk : null; + const source = new ConcatSource(); - if (hotUpdateChunk) { - throw new Error("HMR is not implemented for module chunk format yet"); - } else { - source.add( - `export const __webpack_id__ = ${JSON.stringify(chunk.id)};\n` - ); + source.add( + `export const __webpack_id__ = ${JSON.stringify(chunk.id)};\n` + ); + source.add( + `export const __webpack_ids__ = ${JSON.stringify(chunk.ids)};\n` + ); + source.add("export const __webpack_modules__ = "); + 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 __webpack_ids__ = ${JSON.stringify(chunk.ids)};\n` + Template.renderChunkRuntimeModules(runtimeModules, renderContext) ); - source.add("export const __webpack_modules__ = "); - source.add(modules); - source.add(";\n"); - const runtimeModules = - chunkGraph.getChunkRuntimeModulesInOrder(chunk); - if (runtimeModules.length > 0) { - source.add("export const __webpack_runtime__ =\n"); - source.add( - Template.renderChunkRuntimeModules(runtimeModules, renderContext) - ); - } - const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); - if (runtimeChunk) { - const currentOutputName = compilation + } + if (hotUpdateChunk) { + return source; + } + const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); + if (runtimeChunk) { + const currentOutputName = compilation + .getPath( + getChunkFilenameTemplate(chunk, compilation.outputOptions), + { + chunk, + contentHashType: "javascript" + } + ) + .replace(/^\/+/g, "") + .split("/"); + + /** + * @param {Chunk} chunk the chunk + * @returns {string} the relative path + */ + const getRelativePath = chunk => { + const baseOutputName = currentOutputName.slice(); + const chunkOutputName = compilation .getPath( getChunkFilenameTemplate(chunk, compilation.outputOptions), { @@ -106,101 +122,83 @@ class ModuleChunkFormatPlugin { .replace(/^\/+/g, "") .split("/"); - /** - * @param {Chunk} chunk the chunk - * @returns {string} the relative path - */ - const getRelativePath = chunk => { - const baseOutputName = currentOutputName.slice(); - const chunkOutputName = compilation - .getPath( - getChunkFilenameTemplate(chunk, compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ) - .replace(/^\/+/g, "") - .split("/"); + // remove common parts except filename + while ( + baseOutputName.length > 1 && + chunkOutputName.length > 1 && + baseOutputName[0] === chunkOutputName[0] + ) { + baseOutputName.shift(); + chunkOutputName.shift(); + } + const last = chunkOutputName.join("/"); + // create final path + return getUndoPath(baseOutputName.join("/"), last, true) + last; + }; - // remove common parts except filename - while ( - baseOutputName.length > 1 && - chunkOutputName.length > 1 && - baseOutputName[0] === chunkOutputName[0] - ) { - baseOutputName.shift(); - chunkOutputName.shift(); - } - const last = chunkOutputName.join("/"); - // create final path - return getUndoPath(baseOutputName.join("/"), last, true) + last; - }; + const entrySource = new ConcatSource(); + entrySource.add(source); + entrySource.add(";\n\n// load runtime\n"); + entrySource.add( + `import ${RuntimeGlobals.require} from ${JSON.stringify( + getRelativePath(/** @type {Chunk} */ (runtimeChunk)) + )};\n` + ); - const entrySource = new ConcatSource(); - entrySource.add(source); - entrySource.add(";\n\n// load runtime\n"); - entrySource.add( - `import ${RuntimeGlobals.require} from ${JSON.stringify( - getRelativePath(/** @type {Chunk} */ (runtimeChunk)) - )};\n` - ); + const startupSource = new ConcatSource(); + startupSource.add( + `var __webpack_exec__ = ${runtimeTemplate.returningFunction( + `${RuntimeGlobals.require}(${RuntimeGlobals.entryModuleId} = moduleId)`, + "moduleId" + )}\n` + ); - const startupSource = new ConcatSource(); - startupSource.add( - `var __webpack_exec__ = ${runtimeTemplate.returningFunction( - `${RuntimeGlobals.require}(${RuntimeGlobals.entryModuleId} = moduleId)`, - "moduleId" - )}\n` + const loadedChunks = new Set(); + let index = 0; + for (let i = 0; i < entries.length; i++) { + const [module, entrypoint] = entries[i]; + if (!chunkGraph.getModuleSourceTypes(module).has("javascript")) { + continue; + } + const final = i + 1 === entries.length; + const moduleId = chunkGraph.getModuleId(module); + const chunks = getAllChunks( + /** @type {Entrypoint} */ (entrypoint), + /** @type {Chunk} */ (runtimeChunk), + undefined ); - - const loadedChunks = new Set(); - let index = 0; - for (let i = 0; i < entries.length; i++) { - const [module, entrypoint] = entries[i]; - if (!chunkGraph.getModuleSourceTypes(module).has("javascript")) { + for (const chunk of chunks) { + if (loadedChunks.has(chunk) || !chunkHasJs(chunk, chunkGraph)) continue; - } - const final = i + 1 === entries.length; - const moduleId = chunkGraph.getModuleId(module); - const chunks = getAllChunks( - /** @type {Entrypoint} */ (entrypoint), - /** @type {Chunk} */ (runtimeChunk), - undefined + loadedChunks.add(chunk); + startupSource.add( + `import * as __webpack_chunk_${index}__ from ${JSON.stringify( + getRelativePath(chunk) + )};\n` ); - for (const chunk of chunks) { - if (loadedChunks.has(chunk) || !chunkHasJs(chunk, chunkGraph)) - continue; - loadedChunks.add(chunk); - startupSource.add( - `import * as __webpack_chunk_${index}__ from ${JSON.stringify( - getRelativePath(chunk) - )};\n` - ); - startupSource.add( - `${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n` - ); - index++; - } startupSource.add( - `${ - final ? `var ${RuntimeGlobals.exports} = ` : "" - }__webpack_exec__(${JSON.stringify(moduleId)});\n` + `${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n` ); + index++; } - - entrySource.add( - hooks.renderStartup.call( - startupSource, - entries[entries.length - 1][0], - { - ...renderContext, - inlined: false - } - ) + startupSource.add( + `${ + final ? `var ${RuntimeGlobals.exports} = ` : "" + }__webpack_exec__(${JSON.stringify(moduleId)});\n` ); - return entrySource; } + + entrySource.add( + hooks.renderStartup.call( + startupSource, + entries[entries.length - 1][0], + { + ...renderContext, + inlined: false + } + ) + ); + return entrySource; } return source; }); diff --git a/lib/esm/ModuleChunkLoadingPlugin.js b/lib/esm/ModuleChunkLoadingPlugin.js index 79df4ce5cc5..c92e69888fe 100644 --- a/lib/esm/ModuleChunkLoadingPlugin.js +++ b/lib/esm/ModuleChunkLoadingPlugin.js @@ -63,6 +63,12 @@ class ModuleChunkLoadingPlugin { compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.onChunksLoaded) .tap(PLUGIN_NAME, handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap(PLUGIN_NAME, handler); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap(PLUGIN_NAME, handler); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.externalInstallChunk) .tap(PLUGIN_NAME, (chunk, set) => { @@ -99,6 +105,26 @@ class ModuleChunkLoadingPlugin { set.add(RuntimeGlobals.getChunkScriptFilename); }); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadUpdateHandlers) + .tap(PLUGIN_NAME, (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.loadScript); + set.add(RuntimeGlobals.getChunkUpdateScriptFilename); + set.add(RuntimeGlobals.moduleCache); + set.add(RuntimeGlobals.hmrModuleData); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); + }); + + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.hmrDownloadManifest) + .tap(PLUGIN_NAME, (chunk, set) => { + if (!isEnabledForChunk(chunk)) return; + set.add(RuntimeGlobals.publicPath); + set.add(RuntimeGlobals.getUpdateManifestFilename); + }); }); } } diff --git a/lib/esm/ModuleChunkLoadingRuntimeModule.js b/lib/esm/ModuleChunkLoadingRuntimeModule.js index 727c918fa97..ed850b0fd66 100644 --- a/lib/esm/ModuleChunkLoadingRuntimeModule.js +++ b/lib/esm/ModuleChunkLoadingRuntimeModule.js @@ -109,6 +109,9 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { const withHmr = this._runtimeRequirements.has( RuntimeGlobals.hmrDownloadUpdateHandlers ); + const withHmrManifest = this._runtimeRequirements.has( + RuntimeGlobals.hmrDownloadManifest + ); const { linkPreload, linkPrefetch } = ModuleChunkLoadingRuntimeModule.getCompilationHooks(compilation); const isNeutralPlatform = runtimeTemplate.isNeutralPlatform(); @@ -346,7 +349,92 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { "installedChunks[chunkId] === 0", "chunkId" )};` - : "// no on chunks loaded" + : "// no on chunks loaded", + withHmr + ? Template.asString([ + Template.getFunctionContent( + require("../hmr/JavascriptHotModuleReplacement.runtime.js") + ) + .replace(/\$key\$/g, "jsonp") + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace( + /\$ensureChunkHandlers\$/g, + RuntimeGlobals.ensureChunkHandlers + ) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ), + "", + "function loadUpdateChunk(chunkId, updatedModulesList) {", + Template.indent([ + `return new Promise(${runtimeTemplate.basicFunction( + "resolve, reject", + [ + "// 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__;", + "if(updatedRuntime) currentUpdateRuntime.push(updatedRuntime);", + "for(var moduleId in updatedModules) {", + Template.indent([ + `if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`, + Template.indent([ + "currentUpdate[moduleId] = updatedModules[moduleId];", + "if(updatedModulesList) updatedModulesList.push(moduleId);" + ]), + "}" + ]), + "}", + "resolve(obj);" + ])};`, + `var onReject = ${runtimeTemplate.basicFunction("error", [ + "var errorMsg = error.message || 'unknown reason';", + "error.message = 'Loading hot update chunk ' + chunkId + ' failed.\\n(' + errorMsg + ')';", + "error.name = 'ChunkLoadError';", + "reject(error);" + ])}`, + `var loadScript = ${runtimeTemplate.basicFunction( + "url, onResolve, onReject", + [ + `return ${importFunctionName}(/* webpackIgnore: true */ url).then(onResolve).catch(onReject)` + ] + )} + loadScript(url, onResolve, onReject);` + ] + )});` + ]), + "}", + "" + ]) + : "// no HMR", + "", + withHmrManifest + ? Template.asString([ + `${ + RuntimeGlobals.hmrDownloadManifest + } = ${runtimeTemplate.basicFunction("", [ + 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', + `return fetch(${RuntimeGlobals.publicPath} + ${ + RuntimeGlobals.getUpdateManifestFilename + }()).then(${runtimeTemplate.basicFunction("response", [ + "if(response.status === 404) return; // no update available", + 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', + "return response.json();" + ])});` + ])};` + ]) + : "// no HMR manifest" ]); } } diff --git a/test/HotTestCases.template.js b/test/HotTestCases.template.js index 7b0d31653f7..b376c77e408 100644 --- a/test/HotTestCases.template.js +++ b/test/HotTestCases.template.js @@ -212,7 +212,12 @@ const describeCases = config => { link.href = file.name; runner._moduleScope.document.head.appendChild(link); } else { - runner.require(outputDirectory, `./${file.name}`); + const result = runner.require( + outputDirectory, + `./${file.name}` + ); + if (typeof result === "object" && "then" in result) + promise = promise.then(() => result); } } } else { diff --git a/test/hotCases/esm-output/async-chunks/async-module.js b/test/hotCases/esm-output/async-chunks/async-module.js new file mode 100644 index 00000000000..f93cad69c30 --- /dev/null +++ b/test/hotCases/esm-output/async-chunks/async-module.js @@ -0,0 +1,3 @@ +export const message = "Hello from async module!"; +--- +export const message = "Updated async module!"; \ No newline at end of file diff --git a/test/hotCases/esm-output/async-chunks/index.js b/test/hotCases/esm-output/async-chunks/index.js new file mode 100644 index 00000000000..99fa7481c1d --- /dev/null +++ b/test/hotCases/esm-output/async-chunks/index.js @@ -0,0 +1,34 @@ +import update from "../../update.esm"; +import.meta.webpackHot.accept(["./async-module", "./lazy-module"]); + +it("should handle HMR with async chunks in ESM format", (done) => { + // Initial load of async chunks + Promise.all([ + import("./async-module"), + import("./lazy-module") + ]).then(([asyncModule, lazyModule]) => { + expect(asyncModule.message).toBe("Hello from async module!"); + expect(lazyModule.data.value).toBe(42); + + NEXT(update(done, true, () => { + // Re-import after HMR update + Promise.all([ + import("./async-module"), + import("./lazy-module") + ]).then(([updatedAsyncModule, updatedLazyModule]) => { + expect(updatedAsyncModule.message).toBe("Updated async module!"); + expect(updatedLazyModule.data.value).toBe(100); + done(); + }).catch(done); + })); + }).catch(done); +}); + +it("should support dynamic imports with proper ESM chunk loading", (done) => { + // Test that dynamic imports work correctly with ESM chunk format + import("./async-module").then((module) => { + expect(module.message).toBeDefined(); + expect(typeof module.message).toBe("string"); + done(); + }).catch(done); +}); diff --git a/test/hotCases/esm-output/async-chunks/lazy-module.js b/test/hotCases/esm-output/async-chunks/lazy-module.js new file mode 100644 index 00000000000..c3bddf0cba9 --- /dev/null +++ b/test/hotCases/esm-output/async-chunks/lazy-module.js @@ -0,0 +1,9 @@ +export const data = { + type: "lazy", + value: 42 +}; +--- +export const data = { + type: "lazy", + value: 100 +}; diff --git a/test/hotCases/esm-output/async-chunks/webpack.config.js b/test/hotCases/esm-output/async-chunks/webpack.config.js new file mode 100644 index 00000000000..d877ef17c85 --- /dev/null +++ b/test/hotCases/esm-output/async-chunks/webpack.config.js @@ -0,0 +1,17 @@ +/** @type {import("../../../../types").Configuration} */ +module.exports = { + mode: "development", + experiments: { + outputModule: true + }, + output: { + module: true, + chunkFormat: "module", + filename: "[name].mjs", + chunkFilename: "[name].chunk.mjs", + enabledLibraryTypes: ["module"] + }, + optimization: { + minimize: false + } +}; diff --git a/test/hotCases/esm-output/css-modules/index.js b/test/hotCases/esm-output/css-modules/index.js new file mode 100644 index 00000000000..e4511d95ad5 --- /dev/null +++ b/test/hotCases/esm-output/css-modules/index.js @@ -0,0 +1,29 @@ +import * as styles from "./style.module.css"; +import update from "../../update.esm"; + +it("should work", async function (done) { + expect(styles).toMatchObject({ class: "_style_module_css-class" }); + + const styles2 = await import("./style2.module.css"); + + expect(styles2).toMatchObject({ + foo: "_style2_module_css-foo" + }); + + import.meta.webpackHot.accept(["./style.module.css", "./style2.module.css"], () => { + expect(styles).toMatchObject({ + "class-other": "_style_module_css-class-other" + }); + import("./style2.module.css").then(styles2 => { + expect(styles2).toMatchObject({ + "bar": "_style2_module_css-bar" + }); + + done(); + }); + }); + + NEXT(update(done)); +}); + +module.hot.accept(); diff --git a/test/hotCases/esm-output/css-modules/style.module.css b/test/hotCases/esm-output/css-modules/style.module.css new file mode 100644 index 00000000000..98c6b2bb5d0 --- /dev/null +++ b/test/hotCases/esm-output/css-modules/style.module.css @@ -0,0 +1,7 @@ +.class { + color: red; +} +--- +.class-other { + color: blue; +} diff --git a/test/hotCases/esm-output/css-modules/style2.module.css b/test/hotCases/esm-output/css-modules/style2.module.css new file mode 100644 index 00000000000..681b83a2612 --- /dev/null +++ b/test/hotCases/esm-output/css-modules/style2.module.css @@ -0,0 +1,7 @@ +.foo { + color: red; +} +--- +.bar { + color: blue; +} diff --git a/test/hotCases/esm-output/css-modules/test.config.js b/test/hotCases/esm-output/css-modules/test.config.js new file mode 100644 index 00000000000..429d7576747 --- /dev/null +++ b/test/hotCases/esm-output/css-modules/test.config.js @@ -0,0 +1,8 @@ +module.exports = { + moduleScope(scope) { + const link = scope.window.document.createElement("link"); + link.rel = "stylesheet"; + link.href = "https://test.cases/path/bundle.css"; + scope.window.document.head.appendChild(link); + } +}; diff --git a/test/hotCases/esm-output/css-modules/webpack.config.js b/test/hotCases/esm-output/css-modules/webpack.config.js new file mode 100644 index 00000000000..ef5dc7bd319 --- /dev/null +++ b/test/hotCases/esm-output/css-modules/webpack.config.js @@ -0,0 +1,18 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + mode: "development", + experiments: { + outputModule: true, + css: true + }, + output: { + module: true, + chunkFormat: "module", + filename: "[name].mjs", + chunkFilename: "[name].chunk.mjs", + enabledLibraryTypes: ["module"] + }, + optimization: { + minimize: false + } +}; diff --git a/test/hotCases/esm-output/runtime-chunk/async-shared.js b/test/hotCases/esm-output/runtime-chunk/async-shared.js new file mode 100644 index 00000000000..b2dfdeba8eb --- /dev/null +++ b/test/hotCases/esm-output/runtime-chunk/async-shared.js @@ -0,0 +1,4 @@ +export const asyncData = { + loaded: true, + content: "Async shared content" +}; diff --git a/test/hotCases/esm-output/runtime-chunk/index.js b/test/hotCases/esm-output/runtime-chunk/index.js new file mode 100644 index 00000000000..9f974779884 --- /dev/null +++ b/test/hotCases/esm-output/runtime-chunk/index.js @@ -0,0 +1,23 @@ +import { sharedData } from "./shared"; +import update from "../../update.esm"; + +it("should handle HMR with runtime chunk in ESM format", (done) => { + expect(sharedData.version).toBe("1.0.0"); + + import.meta.webpackHot.accept(["./shared"]); + + NEXT(update(done, true, () => { + import("./shared").then(updatedModule => { + expect(updatedModule.sharedData.version).toBe("2.0.0"); + done(); + }).catch(done); + })); +}); + +it("should load async shared module with runtime chunk", (done) => { + import("./async-shared").then(module => { + expect(module.asyncData.loaded).toBe(true); + expect(module.asyncData.content).toBe("Async shared content"); + done(); + }).catch(done); +}); diff --git a/test/hotCases/esm-output/runtime-chunk/shared.js b/test/hotCases/esm-output/runtime-chunk/shared.js new file mode 100644 index 00000000000..92df22ed1ad --- /dev/null +++ b/test/hotCases/esm-output/runtime-chunk/shared.js @@ -0,0 +1,9 @@ +export const sharedData = { + version: "1.0.0", + timestamp: Date.now() +}; +--- +export const sharedData = { + version: "2.0.0", + timestamp: Date.now() +}; diff --git a/test/hotCases/esm-output/runtime-chunk/webpack.config.js b/test/hotCases/esm-output/runtime-chunk/webpack.config.js new file mode 100644 index 00000000000..43cb0766070 --- /dev/null +++ b/test/hotCases/esm-output/runtime-chunk/webpack.config.js @@ -0,0 +1,18 @@ +/** @type {import("../../../../types").Configuration} */ +module.exports = { + mode: "development", + experiments: { + outputModule: true + }, + output: { + module: true, + chunkFormat: "module", + filename: "[name].mjs", + chunkFilename: "[name].chunk.mjs", + enabledLibraryTypes: ["module"] + }, + optimization: { + minimize: false, + runtimeChunk: "single" + } +}; diff --git a/test/hotCases/esm-output/simple/index.js b/test/hotCases/esm-output/simple/index.js new file mode 100644 index 00000000000..02815b36509 --- /dev/null +++ b/test/hotCases/esm-output/simple/index.js @@ -0,0 +1,22 @@ +import { greeting } from "./module.js"; +import update from "../../update.esm.js"; + +import.meta.webpackHot.accept(["./module.js"]); + +it("should update a simple ES module with HMR", (done) => { + expect(greeting).toBe("Hello World!"); + + NEXT(update(done, true, () => { + // After HMR update, we need to re-import the module in ESM + import("./module.js").then(updatedModule => { + expect(updatedModule.greeting).toBe("Hello HMR!"); + done(); + }).catch(done); + })); +}); + +it("should have HMR runtime available in ESM output", () => { + expect(typeof import.meta.webpackHot.accept).toBe("function"); + expect(typeof import.meta.webpackHot.decline).toBe("function"); + expect(typeof import.meta.webpackHot.dispose).toBe("function"); +}); diff --git a/test/hotCases/esm-output/simple/module.js b/test/hotCases/esm-output/simple/module.js new file mode 100644 index 00000000000..9ce42fc23bb --- /dev/null +++ b/test/hotCases/esm-output/simple/module.js @@ -0,0 +1,3 @@ +export const greeting = "Hello World!"; +--- +export const greeting = "Hello HMR!"; diff --git a/test/hotCases/esm-output/simple/webpack.config.js b/test/hotCases/esm-output/simple/webpack.config.js new file mode 100644 index 00000000000..d877ef17c85 --- /dev/null +++ b/test/hotCases/esm-output/simple/webpack.config.js @@ -0,0 +1,17 @@ +/** @type {import("../../../../types").Configuration} */ +module.exports = { + mode: "development", + experiments: { + outputModule: true + }, + output: { + module: true, + chunkFormat: "module", + filename: "[name].mjs", + chunkFilename: "[name].chunk.mjs", + enabledLibraryTypes: ["module"] + }, + optimization: { + minimize: false + } +}; diff --git a/test/hotCases/esm-output/split-chunks/common/shared.js b/test/hotCases/esm-output/split-chunks/common/shared.js new file mode 100644 index 00000000000..b97c6b020a8 --- /dev/null +++ b/test/hotCases/esm-output/split-chunks/common/shared.js @@ -0,0 +1,16 @@ +export function commonFunction(input) { + return `Common function processed: ${input}`; +} + +export const commonData = { + shared: true +}; +--- +export function commonFunction(input) { + return `Updated common function: ${input}`; +} + +export const commonData = { + shared: true, + updated: true +}; diff --git a/test/hotCases/esm-output/split-chunks/index.js b/test/hotCases/esm-output/split-chunks/index.js new file mode 100644 index 00000000000..706146c997e --- /dev/null +++ b/test/hotCases/esm-output/split-chunks/index.js @@ -0,0 +1,25 @@ +import update from "../../update.esm"; +import.meta.webpackHot.accept(["./common/shared", "vendor-lib"]); + +it("should handle HMR with split chunks in ESM format", (done) => { + Promise.all([ + import("./common/shared"), + import("vendor-lib") + ]).then(([commonModule, vendorModule]) => { + expect(commonModule.commonFunction("test")).toBe("Common function processed: test"); + expect(vendorModule.default.version).toBe("1.0.0"); + done(); + }).catch(done); + + NEXT(update(done, true, () => { + // Re-import after HMR update + Promise.all([ + import("./common/shared"), + import("vendor-lib") + ]).then(([commonModule, vendorModule]) => { + expect(commonModule.commonFunction("test")).toBe("Updated common function: test"); + expect(vendorModule.default.version).toBe("2.0.0"); + done(); + }).catch(done); + })); +}); diff --git a/test/hotCases/esm-output/split-chunks/node_modules/vendor-lib.js b/test/hotCases/esm-output/split-chunks/node_modules/vendor-lib.js new file mode 100644 index 00000000000..b686ed55cbd --- /dev/null +++ b/test/hotCases/esm-output/split-chunks/node_modules/vendor-lib.js @@ -0,0 +1,17 @@ +const vendorLib = { + version: "1.0.0", + init: function() { + console.log("Vendor lib initialized"); + } +}; + +export default vendorLib; +--- +const vendorLib = { + version: "2.0.0", + init: function() { + console.log("Vendor lib initialized v2"); + } +}; + +export default vendorLib; diff --git a/test/hotCases/esm-output/split-chunks/webpack.config.js b/test/hotCases/esm-output/split-chunks/webpack.config.js new file mode 100644 index 00000000000..8093beac2b6 --- /dev/null +++ b/test/hotCases/esm-output/split-chunks/webpack.config.js @@ -0,0 +1,34 @@ +/** @type {import("../../../../types").Configuration} */ +module.exports = { + mode: "development", + experiments: { + outputModule: true + }, + output: { + module: true, + chunkFormat: "module", + filename: "[name].mjs", + chunkFilename: "[name].chunk.mjs", + enabledLibraryTypes: ["module"] + }, + optimization: { + minimize: false, + splitChunks: { + chunks: "all", + minSize: 0, + cacheGroups: { + common: { + test: /common/, + name: "common", + priority: 10, + enforce: true + }, + vendor: { + test: /node_modules/, + name: "vendor", + priority: 20 + } + } + } + } +}; diff --git a/test/hotCases/update.esm.js b/test/hotCases/update.esm.js new file mode 100644 index 00000000000..6cfa77afcbb --- /dev/null +++ b/test/hotCases/update.esm.js @@ -0,0 +1,16 @@ +export default function update(done, options, callback) { + return function (err, stats) { + if (err) return done(err); + import.meta.webpackHot + .check(options || true) + .then(updatedModules => { + if (!updatedModules) { + return done(new Error("No update available")); + } + if (callback) callback(stats); + }) + .catch(err => { + done(err); + }); + }; +}; diff --git a/test/runner/index.js b/test/runner/index.js index 35cc0d8b216..e6bc9f73973 100644 --- a/test/runner/index.js +++ b/test/runner/index.js @@ -222,6 +222,14 @@ class TestRunner { content: fs.readFileSync(module, "utf-8") }; } + if (module.startsWith("https://test.")) { + const realPath = urlToPath(module, currentDirectory); + return { + subPath: "", + modulePath: realPath, + content: fs.readFileSync(realPath, "utf-8") + }; + } } /** From c109f97b1bf5eceb2e0e498d399f46321f40b07f Mon Sep 17 00:00:00 2001 From: Natsu Xiao <784487301@qq.com> Date: Tue, 24 Jun 2025 02:21:57 +0800 Subject: [PATCH 25/56] feat: ESM output mode to support splitChunks when externals and runtimeChunk are not set --- lib/esm/ModuleChunkFormatPlugin.js | 193 ++++++++++++------ lib/esm/ModuleChunkLoadingPlugin.js | 9 + .../split-chunks-without-externals/index.js | 8 + .../test.config.js | 5 + .../testModule1.js | 1 + .../testModule2.js | 1 + .../webpack.config.js | 34 +++ 7 files changed, 191 insertions(+), 60 deletions(-) create mode 100644 test/configCases/module/split-chunks-without-externals/index.js create mode 100644 test/configCases/module/split-chunks-without-externals/test.config.js create mode 100644 test/configCases/module/split-chunks-without-externals/testModule1.js create mode 100644 test/configCases/module/split-chunks-without-externals/testModule2.js create mode 100644 test/configCases/module/split-chunks-without-externals/webpack.config.js diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index 224b0c95868..3ef656f86ea 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -17,12 +17,15 @@ const { const { updateHashForEntryStartup } = require("../javascript/StartupHelpers"); const { getUndoPath } = require("../util/identifier"); +/** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../ChunkGroup")} ChunkGroup */ +/** @typedef {import("../Compilation")} Compilation */ /** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Entrypoint")} Entrypoint */ /** @typedef {import("../Module")} Module */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ /** * Gets information about a chunk including its entries and runtime chunk @@ -46,6 +49,67 @@ function getChunkInfo(chunk, chunkGraph) { }; } +/** + * @param {Compilation} compilation the compilation instance + * @param {Chunk} chunk the chunk + * @param {Chunk} runtimeChunk the runtime chunk + * @returns {string} the relative path + */ +const getRelativePath = (compilation, chunk, runtimeChunk) => { + const currentOutputName = compilation + .getPath( + getChunkFilenameTemplate(runtimeChunk, compilation.outputOptions), + { + chunk: runtimeChunk, + contentHashType: "javascript" + } + ) + .replace(/^\/+/g, "") + .split("/"); + const baseOutputName = currentOutputName.slice(); + const chunkOutputName = compilation + .getPath(getChunkFilenameTemplate(chunk, compilation.outputOptions), { + chunk, + contentHashType: "javascript" + }) + .replace(/^\/+/g, "") + .split("/"); + + // remove common parts except filename + while ( + baseOutputName.length > 1 && + chunkOutputName.length > 1 && + baseOutputName[0] === chunkOutputName[0] + ) { + baseOutputName.shift(); + chunkOutputName.shift(); + } + const last = chunkOutputName.join("/"); + // create final path + return getUndoPath(baseOutputName.join("/"), last, true) + last; +}; + +/** + * @param {Compilation} compilation the compilation instance + * @param {Chunk} chunk the chunk to render the import for + * @param {string=} namedImport the named import to use for the import + * @param {Chunk=} runtimeChunk the runtime chunk + * @returns {string} the import source + */ +function renderChunkImport(compilation, chunk, namedImport, runtimeChunk) { + return `import ${namedImport ? `* as ${namedImport}` : RuntimeGlobals.require} from ${JSON.stringify( + getRelativePath(compilation, chunk, runtimeChunk || chunk) + )};\n`; +} + +/** + * @param {number} index the index of the chunk + * @returns {string} the named import to use for the import + */ +function getChunkNamedImport(index) { + return `__webpack_chunk_${index}__`; +} + const PLUGIN_NAME = "ModuleChunkFormatPlugin"; class ModuleChunkFormatPlugin { @@ -68,10 +132,60 @@ class ModuleChunkFormatPlugin { } ); const hooks = getCompilationHooks(compilation); + /** + * @param {Set} chunks the chunks to render + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {Chunk=} runtimeChunk the runtime chunk + * @returns {Source|undefined} the source + */ + const withDependentChunks = (chunks, chunkGraph, runtimeChunk) => { + if (/** @type {Set} */ (chunks).size > 0) { + const source = new ConcatSource(); + let index = 0; + + for (const chunk of chunks) { + index++; + + if (!chunkHasJs(chunk, chunkGraph)) { + continue; + } + const namedImport = getChunkNamedImport(index); + source.add( + renderChunkImport( + compilation, + chunk, + namedImport, + runtimeChunk || chunk + ) + ); + source.add( + `${RuntimeGlobals.externalInstallChunk}(${namedImport});\n` + ); + } + return source; + } + }; + hooks.renderMain.tap(PLUGIN_NAME, (modules, renderContext) => { + const { chunk, chunkGraph } = renderContext; + const entryDependentChunks = + chunkGraph.getChunkEntryDependentChunksIterable(chunk); + const sourceWithDependentChunks = withDependentChunks( + /** @type {Set} */ (entryDependentChunks), + chunkGraph, + chunk + ); + if (!sourceWithDependentChunks) { + return modules; + } + const source = new ConcatSource(); + source.add(modules); + source.add("\n"); + source.add(sourceWithDependentChunks); + return source; + }); hooks.renderChunk.tap(PLUGIN_NAME, (modules, renderContext) => { const { chunk, chunkGraph, runtimeTemplate } = renderContext; const hotUpdateChunk = chunk instanceof HotUpdateChunk ? chunk : null; - const source = new ConcatSource(); source.add( `export const __webpack_id__ = ${JSON.stringify(chunk.id)};\n` @@ -94,57 +208,12 @@ class ModuleChunkFormatPlugin { } const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); if (runtimeChunk) { - const currentOutputName = compilation - .getPath( - getChunkFilenameTemplate(chunk, compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ) - .replace(/^\/+/g, "") - .split("/"); - - /** - * @param {Chunk} chunk the chunk - * @returns {string} the relative path - */ - const getRelativePath = chunk => { - const baseOutputName = currentOutputName.slice(); - const chunkOutputName = compilation - .getPath( - getChunkFilenameTemplate(chunk, compilation.outputOptions), - { - chunk, - contentHashType: "javascript" - } - ) - .replace(/^\/+/g, "") - .split("/"); - - // remove common parts except filename - while ( - baseOutputName.length > 1 && - chunkOutputName.length > 1 && - baseOutputName[0] === chunkOutputName[0] - ) { - baseOutputName.shift(); - chunkOutputName.shift(); - } - const last = chunkOutputName.join("/"); - // create final path - return getUndoPath(baseOutputName.join("/"), last, true) + last; - }; - const entrySource = new ConcatSource(); entrySource.add(source); entrySource.add(";\n\n// load runtime\n"); entrySource.add( - `import ${RuntimeGlobals.require} from ${JSON.stringify( - getRelativePath(/** @type {Chunk} */ (runtimeChunk)) - )};\n` + renderChunkImport(compilation, runtimeChunk, "", chunk) ); - const startupSource = new ConcatSource(); startupSource.add( `var __webpack_exec__ = ${runtimeTemplate.returningFunction( @@ -154,7 +223,6 @@ class ModuleChunkFormatPlugin { ); const loadedChunks = new Set(); - let index = 0; for (let i = 0; i < entries.length; i++) { const [module, entrypoint] = entries[i]; if (!chunkGraph.getModuleSourceTypes(module).has("javascript")) { @@ -162,24 +230,29 @@ class ModuleChunkFormatPlugin { } const final = i + 1 === entries.length; const moduleId = chunkGraph.getModuleId(module); + const entryDependentChunks = /** @type {Set} */ ( + chunkGraph.getChunkEntryDependentChunksIterable(chunk) + ); const chunks = getAllChunks( /** @type {Entrypoint} */ (entrypoint), /** @type {Chunk} */ (runtimeChunk), undefined ); - for (const chunk of chunks) { - if (loadedChunks.has(chunk) || !chunkHasJs(chunk, chunkGraph)) + const processChunks = new Set(); + for (const _chunk of chunks) { + if (loadedChunks.has(_chunk) || entryDependentChunks.has(_chunk)) continue; - loadedChunks.add(chunk); - startupSource.add( - `import * as __webpack_chunk_${index}__ from ${JSON.stringify( - getRelativePath(chunk) - )};\n` - ); - startupSource.add( - `${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n` - ); - index++; + loadedChunks.add(_chunk); + processChunks.add(_chunk); + } + const sourceWithDependentChunks = withDependentChunks( + processChunks, + chunkGraph, + chunk + ); + if (sourceWithDependentChunks) { + startupSource.add("\n"); + startupSource.add(sourceWithDependentChunks); } startupSource.add( `${ diff --git a/lib/esm/ModuleChunkLoadingPlugin.js b/lib/esm/ModuleChunkLoadingPlugin.js index c92e69888fe..3f86bc221cb 100644 --- a/lib/esm/ModuleChunkLoadingPlugin.js +++ b/lib/esm/ModuleChunkLoadingPlugin.js @@ -125,6 +125,15 @@ class ModuleChunkLoadingPlugin { set.add(RuntimeGlobals.publicPath); set.add(RuntimeGlobals.getUpdateManifestFilename); }); + + compilation.hooks.additionalTreeRuntimeRequirements.tap( + PLUGIN_NAME, + (chunk, set, { chunkGraph }) => { + if (chunkGraph.hasChunkEntryDependentChunks(chunk)) { + set.add(RuntimeGlobals.externalInstallChunk); + } + } + ); }); } } diff --git a/test/configCases/module/split-chunks-without-externals/index.js b/test/configCases/module/split-chunks-without-externals/index.js new file mode 100644 index 00000000000..5faf1b78927 --- /dev/null +++ b/test/configCases/module/split-chunks-without-externals/index.js @@ -0,0 +1,8 @@ +import { m1 } from "./testModule1.js" +import { m2 } from "./testModule2.js" + +it("should compile and evaluate fine", (done) => { + expect(m1).toBeDefined(); + expect(m2).toBeDefined(); + done() +}); diff --git a/test/configCases/module/split-chunks-without-externals/test.config.js b/test/configCases/module/split-chunks-without-externals/test.config.js new file mode 100644 index 00000000000..1dd2dfc6303 --- /dev/null +++ b/test/configCases/module/split-chunks-without-externals/test.config.js @@ -0,0 +1,5 @@ +module.exports = { + findBundle(i, options) { + return ["main.mjs", "testModule1.mjs", "testModule2.mjs"]; + } +}; diff --git a/test/configCases/module/split-chunks-without-externals/testModule1.js b/test/configCases/module/split-chunks-without-externals/testModule1.js new file mode 100644 index 00000000000..78fbf447153 --- /dev/null +++ b/test/configCases/module/split-chunks-without-externals/testModule1.js @@ -0,0 +1 @@ +export const m1 = "m11111111"; diff --git a/test/configCases/module/split-chunks-without-externals/testModule2.js b/test/configCases/module/split-chunks-without-externals/testModule2.js new file mode 100644 index 00000000000..1c580944c31 --- /dev/null +++ b/test/configCases/module/split-chunks-without-externals/testModule2.js @@ -0,0 +1 @@ +export const m2 = "m2222222"; diff --git a/test/configCases/module/split-chunks-without-externals/webpack.config.js b/test/configCases/module/split-chunks-without-externals/webpack.config.js new file mode 100644 index 00000000000..56d61cdf6c1 --- /dev/null +++ b/test/configCases/module/split-chunks-without-externals/webpack.config.js @@ -0,0 +1,34 @@ +/** @type {import("../../../../types").Configuration} */ +module.exports = { + mode: "development", + experiments: { + outputModule: true + }, + output: { + module: true, + chunkFormat: "module", + filename: "[name].mjs", + chunkFilename: "[name].chunk.mjs" + }, + devtool: false, + optimization: { + minimize: false, + splitChunks: { + chunks: "all", + minSize: 0, + cacheGroups: { + testModule1: { + test: /testModule1/, + name: "testModule1", + priority: 10, + enforce: true + }, + testModule2: { + test: /testModule2/, + name: "testModule2", + priority: 20 + } + } + } + } +}; From 24c0ededd2fbd5fddfb3c6da104d415532fa4119 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Tue, 24 Jun 2025 17:43:58 +0300 Subject: [PATCH 26/56] fix: types --- declarations.d.ts | 18 + lib/Module.js | 1 + lib/optimize/ConcatenatedModule.js | 37 +- lib/util/LazySet.js | 13 +- lib/util/StackedCacheMap.js | 4 +- lib/util/fs.js | 39 +- lib/util/semver.js | 2 +- package.json | 50 +- test/Stats.test.js | 8 +- types.d.ts | 590 ++++++++-- yarn.lock | 1629 +++++++++++++--------------- 11 files changed, 1373 insertions(+), 1018 deletions(-) diff --git a/declarations.d.ts b/declarations.d.ts index b3b245dd6fa..f184b2a56b2 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -15,6 +15,24 @@ declare namespace NodeJS { } } +declare module "typescript-iterable" { + // New iterator interfaces from `lib.es2015.iterable.d.ts` for compatibility with old typescript versions and `dispose` + interface Disposable { + [Symbol.dispose](): void; + } + + export interface IteratorObject + extends Iterator, + Disposable { + [Symbol.iterator](): IteratorObject; + } + + export interface SetIterator + extends IteratorObject { + [Symbol.iterator](): SetIterator; + } +} + declare module "neo-async" { interface QueueObject { push(item: T): void; diff --git a/lib/Module.js b/lib/Module.js index c654d1633ac..036e1679b88 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -140,6 +140,7 @@ const makeSerializable = require("./util/makeSerializable"); * @property {Map=} assetsInfo for assets modules * @property {boolean=} dataUrl for assets modules * @property {CssData=} cssData for css modules + * @property {Set=} topLevelDeclarations top level declaration names */ /** @typedef {Map>} ValueCacheVersions */ diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index 22d0e653ef5..9bd59543e90 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -762,9 +762,13 @@ class ConcatenatedModule extends Module { cacheable: true, moduleArgument, exportsArgument, + /** @type {LazySet} */ fileDependencies: new LazySet(), + /** @type {LazySet} */ contextDependencies: new LazySet(), + /** @type {LazySet} */ missingDependencies: new LazySet(), + /** @type {Set} */ topLevelDeclarations: new Set(), assets: undefined }; @@ -775,7 +779,8 @@ class ConcatenatedModule extends Module { for (const m of this._modules) { // populate cacheable if (!(/** @type {BuildInfo} */ (m.buildInfo).cacheable)) { - this.buildInfo.cacheable = false; + /** @type {BuildInfo} */ + (this.buildInfo).cacheable = false; } // populate dependencies @@ -783,7 +788,8 @@ class ConcatenatedModule extends Module { dep => !(dep instanceof HarmonyImportDependency) || !this._modules.has( - /** @type {Module} */ (compilation.moduleGraph.getModule(dep)) + /** @type {Module} */ + (compilation.moduleGraph.getModule(dep)) ) )) { this.dependencies.push(d); @@ -812,38 +818,37 @@ class ConcatenatedModule extends Module { const { assets, assetsInfo, topLevelDeclarations } = /** @type {BuildInfo} */ (m.buildInfo); + const buildInfo = /** @type {BuildInfo} */ (this.buildInfo); + // populate topLevelDeclarations if (topLevelDeclarations) { - const topLevelDeclarations = this.buildInfo.topLevelDeclarations; + const topLevelDeclarations = buildInfo.topLevelDeclarations; if (topLevelDeclarations !== undefined) { for (const decl of topLevelDeclarations) { topLevelDeclarations.add(decl); } } } else { - this.buildInfo.topLevelDeclarations = undefined; + buildInfo.topLevelDeclarations = undefined; } // populate assets if (assets) { - if (this.buildInfo.assets === undefined) { - this.buildInfo.assets = Object.create(null); + if (buildInfo.assets === undefined) { + buildInfo.assets = Object.create(null); } Object.assign( /** @type {NonNullable} */ - ( - /** @type {BuildInfo} */ - (this.buildInfo).assets - ), + (buildInfo.assets), assets ); } if (assetsInfo) { - if (this.buildInfo.assetsInfo === undefined) { - this.buildInfo.assetsInfo = new Map(); + if (buildInfo.assetsInfo === undefined) { + buildInfo.assetsInfo = new Map(); } for (const [key, value] of assetsInfo) { - this.buildInfo.assetsInfo.set(key, value); + buildInfo.assetsInfo.set(key, value); } } } @@ -1136,6 +1141,7 @@ class ConcatenatedModule extends Module { // 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(); // List of additional names in scope for module references @@ -1326,7 +1332,10 @@ class ConcatenatedModule extends Module { info.namespaceObjectName = /** @type {string} */ (namespaceObjectName); - topLevelDeclarations.add(namespaceObjectName); + topLevelDeclarations.add( + /** @type {string} */ + (namespaceObjectName) + ); break; } case "external": { diff --git a/lib/util/LazySet.js b/lib/util/LazySet.js index 1ab56167eef..5d4fcb7059c 100644 --- a/lib/util/LazySet.js +++ b/lib/util/LazySet.js @@ -39,6 +39,11 @@ const flatten = (targetSet, toDeepMerge) => { } }; +/** + * @template T + * @typedef {import("typescript-iterable").SetIterator} SetIterator + */ + /** * Like Set but with an addAll method to eventually add items from another iterable. * Access methods make sure that all delayed operations are executed. @@ -139,7 +144,7 @@ class LazySet { } /** - * @returns {IterableIterator<[T, T]>} entries + * @returns {SetIterator<[T, T]>} entries */ entries() { this._deopt = true; @@ -170,7 +175,7 @@ class LazySet { } /** - * @returns {IterableIterator} keys + * @returns {SetIterator} keys */ keys() { this._deopt = true; @@ -179,7 +184,7 @@ class LazySet { } /** - * @returns {IterableIterator} values + * @returns {SetIterator} values */ values() { this._deopt = true; @@ -188,7 +193,7 @@ class LazySet { } /** - * @returns {IterableIterator} iterable iterator + * @returns {SetIterator} iterable iterator */ [Symbol.iterator]() { this._deopt = true; diff --git a/lib/util/StackedCacheMap.js b/lib/util/StackedCacheMap.js index 820f0d1b3d8..735573610a0 100644 --- a/lib/util/StackedCacheMap.js +++ b/lib/util/StackedCacheMap.js @@ -5,6 +5,8 @@ "use strict"; +new Map().entries(); + /** * The StackedCacheMap is a data structure designed as an alternative to a Map * in situations where you need to handle multiple item additions and @@ -128,7 +130,7 @@ class StackedCacheMap { next() { let result = current.next(); while (result.done && iterators.length > 0) { - current = /** @type {IterableIterator<[K, V]>} */ (iterators.pop()); + current = /** @type {MapIterator<[K, V]>} */ (iterators.pop()); result = current.next(); } return result; diff --git a/lib/util/fs.js b/lib/util/fs.js index 7cf4a4abf85..d38331827c9 100644 --- a/lib/util/fs.js +++ b/lib/util/fs.js @@ -48,18 +48,22 @@ const path = require("path"); * @typedef {IStatsBase & { atimeNs: bigint, mtimeNs: bigint, ctimeNs: bigint, birthtimeNs: bigint }} IBigIntStats */ +/* eslint-disable jsdoc/require-template */ /** + * @template {string | Buffer} [T=string] * @typedef {object} Dirent - * @property {() => boolean} isFile - * @property {() => boolean} isDirectory - * @property {() => boolean} isBlockDevice - * @property {() => boolean} isCharacterDevice - * @property {() => boolean} isSymbolicLink - * @property {() => boolean} isFIFO - * @property {() => boolean} isSocket - * @property {string} name - * @property {string} path - */ + * @property {() => boolean} isFile true when is file, otherwise false + * @property {() => boolean} isDirectory true when is directory, otherwise false + * @property {() => boolean} isBlockDevice true when is block device, otherwise false + * @property {() => boolean} isCharacterDevice true when is character device, otherwise false + * @property {() => boolean} isSymbolicLink true when is symbolic link, otherwise false + * @property {() => boolean} isFIFO true when is FIFO, otherwise false + * @property {() => boolean} isSocket true when is socket, otherwise false + * @property {T} name name + * @property {string} parentPath path + * @property {string=} path path + */ +/* eslint-enable jsdoc/require-template */ /** @typedef {string | number | boolean | null} JsonPrimitive */ /** @typedef {JsonValue[]} JsonArray */ @@ -74,6 +78,7 @@ const path = require("path"); /** @typedef {(err: NodeJS.ErrnoException | null, result?: Buffer[]) => void} ReaddirBufferCallback */ /** @typedef {(err: NodeJS.ErrnoException | null, result?: string[] | Buffer[]) => void} ReaddirStringOrBufferCallback */ /** @typedef {(err: NodeJS.ErrnoException | null, result?: Dirent[]) => void} ReaddirDirentCallback */ +/** @typedef {(err: NodeJS.ErrnoException | null, result?: Dirent[]) => void} ReaddirDirentBufferCallback */ /** @typedef {(err: NodeJS.ErrnoException | null, result?: IStats) => void} StatsCallback */ /** @typedef {(err: NodeJS.ErrnoException | null, result?: IBigIntStats) => void} BigIntStatsCallback */ /** @typedef {(err: NodeJS.ErrnoException | null, result?: IStats | IBigIntStats) => void} StatsOrBigIntStatsCallback */ @@ -187,20 +192,22 @@ const path = require("path"); /** * @typedef {{ - * (path: PathLike, options: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null, callback: ReaddirStringCallback): void; - * (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer', callback: ReaddirBufferCallback): void; - * (path: PathLike, callback: ReaddirStringCallback): void; - * (path: PathLike, options: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | undefined | null, callback: ReaddirStringOrBufferCallback): void; - * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }, callback: ReaddirDirentCallback): void; + * (path: PathLike, options: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void; + * (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer', callback: (err: NodeJS.ErrnoException | null, files?: Buffer[]) => void): void; + * (path: PathLike, options: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[] | Buffer[]) => void): void; + * (path: PathLike, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void; + * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files?: Dirent[]) => void): void; + * (path: PathLike, options: { encoding: 'buffer', withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void; * }} Readdir */ /** * @typedef {{ - * (path: PathLike, options?: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | null): string[]; + * (path: PathLike, options?: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined; } | BufferEncoding | null): string[]; * (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer'): Buffer[]; * (path: PathLike, options?: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | null): string[] | Buffer[]; * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }): Dirent[]; + * (path: PathLike, options: { encoding: "buffer", withFileTypes: true, recursive?: boolean | undefined }): Dirent[]; * }} ReaddirSync */ diff --git a/lib/util/semver.js b/lib/util/semver.js index 86628eadd40..d52fe5ce776 100644 --- a/lib/util/semver.js +++ b/lib/util/semver.js @@ -561,7 +561,7 @@ module.exports.stringifyHoley = json => { 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;` + `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;` ])}`; //#endregion diff --git a/package.json b/package.json index d1689b0b690..db7655c6f88 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "license": "MIT", "dependencies": { "@types/eslint-scope": "^3.7.7", - "@types/estree": "^1.0.6", + "@types/estree": "^1.0.8", "@types/json-schema": "^7.0.15", "@webassemblyjs/ast": "^1.14.1", "@webassemblyjs/wasm-edit": "^1.14.1", @@ -14,7 +14,7 @@ "acorn": "^8.14.0", "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.1", + "enhanced-resolve": "^5.17.2", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", @@ -28,7 +28,7 @@ "tapable": "^2.1.1", "terser-webpack-plugin": "^5.3.11", "watchpack": "^2.4.1", - "webpack-sources": "^3.3.2" + "webpack-sources": "^3.3.3" }, "peerDependenciesMeta": { "webpack-cli": { @@ -39,31 +39,31 @@ "@babel/core": "^7.27.1", "@babel/preset-react": "^7.27.1", "@codspeed/tinybench-plugin": "^4.0.1", - "@eslint/js": "^9.21.0", - "@stylistic/eslint-plugin": "^4.2.0", + "@eslint/js": "^9.29.0", + "@stylistic/eslint-plugin": "^5.0.0", "@types/glob-to-regexp": "^0.4.4", "@types/graceful-fs": "^4.1.9", - "@types/jest": "^29.5.11", + "@types/jest": "^30.0.0", "@types/mime-types": "^2.1.4", - "@types/node": "^22.15.11", + "@types/node": "^24.0.3", "@types/xxhashjs": "^0.2.4", "assemblyscript": "^0.28.2", "babel-loader": "^10.0.0", "bundle-loader": "^0.5.6", "coffee-loader": "^5.0.0", "coffeescript": "^2.5.1", - "core-js": "^3.6.5", - "cspell": "^9.0.1", + "core-js": "^3.43.0", + "cspell": "^9.1.1", "css-loader": "^7.1.2", "date-fns": "^4.0.0", "es5-ext": "^0.10.53", "es6-promise-polyfill": "^1.2.0", - "eslint": "^9.21.0", + "eslint": "^9.29.0", "eslint-config-prettier": "^10.1.1", - "eslint-plugin-jest": "^28.6.0", - "eslint-plugin-jsdoc": "^50.6.3", - "eslint-plugin-n": "^17.16.2", - "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-jest": "^29.0.1", + "eslint-plugin-jsdoc": "^51.2.2", + "eslint-plugin-n": "^17.20.0", + "eslint-plugin-prettier": "^5.5.0", "eslint-plugin-unicorn": "^59.0.0", "file-loader": "^6.0.0", "fork-ts-checker-webpack-plugin": "^9.0.2", @@ -71,17 +71,17 @@ "hash-wasm": "^4.9.0", "husky": "^9.0.11", "istanbul": "^0.4.5", - "jest": "^30.0.0", - "jest-circus": "^30.0.0", - "jest-cli": "^30.0.0", - "jest-diff": "^30.0.0", - "jest-environment-node": "^30.0.0", + "jest": "^30.0.2", + "jest-circus": "^30.0.2", + "jest-cli": "^30.0.2", + "jest-diff": "^30.0.2", + "jest-environment-node": "^30.0.2", "jest-junit": "^16.0.0", "json-loader": "^0.5.7", "json5": "^2.1.3", "less": "^4.0.0", "less-loader": "^12.2.0", - "lint-staged": "^16.0.0", + "lint-staged": "^16.1.2", "lodash": "^4.17.19", "lodash-es": "^4.17.15", "memfs": "^4.14.0", @@ -90,9 +90,9 @@ "node-gyp": "^11.2.0", "nyc": "^17.1.0", "open-cli": "^8.0.0", - "prettier": "^3.5.1", + "prettier": "^3.6.0", "prettier-2": "npm:prettier@^2", - "pretty-format": "^29.5.0", + "pretty-format": "^30.0.2", "pug": "^3.0.3", "pug-loader": "^2.4.0", "raw-loader": "^4.0.1", @@ -100,14 +100,14 @@ "react-dom": "^19.0.0", "rimraf": "^3.0.2", "script-loader": "^0.7.2", - "simple-git": "^3.27.0", + "simple-git": "^3.28.0", "strip-ansi": "^6.0.0", "style-loader": "^4.0.0", - "terser": "^5.38.1", + "terser": "^5.43.1", "three": "^0.177.0", "tinybench": "^4.0.1", "toml": "^3.0.0", - "tooling": "webpack/tooling#v1.23.9", + "tooling": "webpack/tooling#v1.24.0", "ts-loader": "^9.5.1", "typescript": "^5.8.2", "url-loader": "^4.1.0", diff --git a/test/Stats.test.js b/test/Stats.test.js index 8ad680f94e8..704a3494fe9 100644 --- a/test/Stats.test.js +++ b/test/Stats.test.js @@ -190,10 +190,10 @@ describe("Stats", () => { "assets": Array [ Object { "name": "entryB.js", - "size": 3105, + "size": 3093, }, ], - "assetsSize": 3105, + "assetsSize": 3093, "auxiliaryAssets": undefined, "auxiliaryAssetsSize": 0, "childAssets": undefined, @@ -238,10 +238,10 @@ describe("Stats", () => { "info": Object { "javascriptModule": false, "minimized": true, - "size": 3105, + "size": 3093, }, "name": "entryB.js", - "size": 3105, + "size": 3093, "type": "asset", }, Object { diff --git a/types.d.ts b/types.d.ts index 7c97dc95fbf..6c4ad3aa2b9 100644 --- a/types.d.ts +++ b/types.d.ts @@ -263,6 +263,7 @@ type ArrayBufferView = | Int32Array | BigUint64Array | BigInt64Array + | Float16Array | Float32Array | Float64Array | DataView; @@ -529,16 +530,59 @@ declare interface BannerPluginOptions { test?: string | RegExp | Rule[]; } declare interface BaseResolveRequest { + /** + * path + */ path: string | false; + + /** + * content + */ context?: object; + + /** + * description file path + */ descriptionFilePath?: string; + + /** + * description file root + */ descriptionFileRoot?: string; + + /** + * description file data + */ descriptionFileData?: JsonObjectTypes; + + /** + * relative path + */ relativePath?: string; + + /** + * true when need to ignore symlinks, otherwise false + */ ignoreSymlinks?: boolean; + + /** + * true when full specified, otherwise false + */ fullySpecified?: boolean; + + /** + * inner request for internal usage + */ __innerRequest?: string; + + /** + * inner request for internal usage + */ __innerRequest_request?: string; + + /** + * inner relative path for internal usage + */ __innerRequest_relativePath?: string; } declare abstract class BasicEvaluatedExpression { @@ -900,12 +944,39 @@ declare interface BufferEntry { bufferedMap?: null | BufferedMap; } declare interface BufferedMap { + /** + * version + */ version: number; + + /** + * sources + */ sources: string[]; + + /** + * name + */ names: string[]; + + /** + * source root + */ sourceRoot?: string; + + /** + * sources content + */ sourcesContent?: ("" | Buffer)[]; + + /** + * mappings + */ mappings?: Buffer; + + /** + * file + */ file: string; } type BuildInfo = KnownBuildInfo & Record; @@ -919,7 +990,7 @@ declare abstract class ByTypeGenerator extends Generator { ) => null | Source; } declare const CIRCULAR_CONNECTION: unique symbol; -declare class Cache { +declare class CacheClass { constructor(); hooks: { get: AsyncSeriesBailHook< @@ -1027,11 +1098,33 @@ declare interface CacheGroupsContext { chunkGraph: ChunkGraph; } type CacheOptionsNormalized = false | FileCacheOptions | MemoryCacheOptions; +declare interface CacheTypes { + [index: string]: undefined | ResolveRequest | ResolveRequest[]; +} declare interface CachedData { + /** + * source + */ source?: boolean; + + /** + * buffer + */ buffer: Buffer; + + /** + * size + */ size?: number; + + /** + * maps + */ maps: Map; + + /** + * hash + */ hash?: (string | Buffer)[]; } declare class CachedSource extends Source { @@ -2538,7 +2631,7 @@ declare class Compiler { options: WebpackOptionsNormalized; context: string; requestShortener: RequestShortener; - cache: Cache; + cache: CacheClass; moduleMemCaches?: Map; compilerPath: string; running: boolean; @@ -3762,16 +3855,59 @@ declare interface DeterministicModuleIdsPluginOptions { failOnConflict?: boolean; } type DevtoolModuleFilenameTemplate = string | ((context?: any) => string); -declare interface Dirent { +declare interface Dirent { + /** + * true when is file, otherwise false + */ isFile: () => boolean; + + /** + * true when is directory, otherwise false + */ isDirectory: () => boolean; + + /** + * true when is block device, otherwise false + */ isBlockDevice: () => boolean; + + /** + * true when is character device, otherwise false + */ isCharacterDevice: () => boolean; + + /** + * true when is symbolic link, otherwise false + */ isSymbolicLink: () => boolean; + + /** + * true when is FIFO, otherwise false + */ isFIFO: () => boolean; + + /** + * true when is socket, otherwise false + */ isSocket: () => boolean; - name: string; - path: string; + + /** + * name + */ + name: T; + + /** + * path + */ + parentPath: string; + + /** + * path + */ + path?: string; +} +declare interface Disposable { + [Symbol.dispose](): void; } declare class DllPlugin { constructor(options: DllPluginOptions); @@ -5260,18 +5396,45 @@ declare interface FileCacheOptions { version?: string; } declare interface FileSystem { + /** + * read file method + */ readFile: ReadFileTypes; + + /** + * readdir method + */ readdir: ReaddirTypes; + + /** + * read json method + */ readJson?: ( - arg0: PathOrFileDescriptorTypes, - arg1: ( - arg0: null | Error | NodeJS.ErrnoException, - arg1?: JsonObjectTypes + pathOrFileDescription: PathOrFileDescriptorTypes, + callback: ( + err: null | Error | NodeJS.ErrnoException, + result?: JsonObjectTypes ) => void ) => void; + + /** + * read link method + */ readlink: ReadlinkTypes; + + /** + * lstat method + */ lstat?: LStatTypes; + + /** + * stat method + */ stat: StatTypes; + + /** + * realpath method + */ realpath?: RealPathTypes; } declare abstract class FileSystemInfo { @@ -5426,8 +5589,19 @@ declare interface GenerateContext { getData?: () => Map; } declare interface GeneratedSourceInfo { + /** + * generated line + */ generatedLine?: number; + + /** + * generated column + */ generatedColumn?: number; + + /** + * source + */ source?: string; } declare class Generator { @@ -5681,7 +5855,14 @@ declare class Hash { } type HashFunction = string | typeof Hash; declare interface HashLike { + /** + * make hash update + */ update: (data: string | Buffer, inputEncoding?: string) => HashLike; + + /** + * get hash digest + */ digest: (encoding?: string) => string | Buffer; } declare interface HashableObject { @@ -6098,6 +6279,12 @@ declare abstract class ItemCacheFacade { ): void; providePromise(computer: () => T | Promise): Promise; } +declare interface IteratorObject + extends Iterator, + Disposable { + [Symbol.iterator](): IteratorObject; + [Symbol.dispose](): void; +} declare class JavascriptModulesPlugin { constructor(options?: object); options: object; @@ -7950,6 +8137,11 @@ declare interface KnownBuildInfo { * for css modules */ cssData?: CssData; + + /** + * top level declaration names + */ + topLevelDeclarations?: Set; } declare interface KnownBuildMeta { exportsType?: "namespace" | "dynamic" | "default" | "flagged"; @@ -7964,6 +8156,9 @@ declare interface KnownCreateStatsOptionsContext { forToString?: boolean; } declare interface KnownHooks { + /** + * resolve step hook + */ resolveStep: SyncHook< [ AsyncSeriesBailHook< @@ -7973,11 +8168,23 @@ declare interface KnownHooks { ResolveRequest ] >; + + /** + * no resolve hook + */ noResolve: SyncHook<[ResolveRequest, Error]>; + + /** + * resolve hook + */ resolve: AsyncSeriesBailHook< [ResolveRequest, ResolveContext], null | ResolveRequest >; + + /** + * result hook + */ result: AsyncSeriesHook<[ResolveRequest, ResolveContext]>; } declare interface KnownNormalizedStatsOptions { @@ -8350,24 +8557,24 @@ declare interface LStatSync { declare interface LStatTypes { ( path: PathLikeTypes, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void + callback: (err: null | NodeJS.ErrnoException, result?: IStats) => void ): void; ( path: PathLikeTypes, options: undefined | (StatOptions & { bigint?: false }), - callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void + callback: (err: null | NodeJS.ErrnoException, result?: IStats) => void ): void; ( path: PathLikeTypes, options: StatOptions & { bigint: true }, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: IBigIntStats) => void + callback: (err: null | NodeJS.ErrnoException, result?: IBigIntStats) => void ): void; ( path: PathLikeTypes, options: undefined | StatOptions, callback: ( - arg0: null | NodeJS.ErrnoException, - arg1?: IStats | IBigIntStats + err: null | NodeJS.ErrnoException, + result?: IStats | IBigIntStats ) => void ): void; } @@ -8451,16 +8658,16 @@ declare class LazySet { addAll(iterable: LazySet | Iterable): LazySet; clear(): void; delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; + entries(): SetIterator<[T, T]>; forEach( callbackFn: (value: T, value2: T, set: Set) => void, thisArg: K ): void; has(item: T): boolean; - keys(): IterableIterator; - values(): IterableIterator; + keys(): SetIterator; + values(): SetIterator; serialize(__0: ObjectSerializerContext): void; - [Symbol.iterator](): IterableIterator; + [Symbol.iterator](): SetIterator; static deserialize(__0: ObjectDeserializerContext): LazySet; } declare interface LibIdentOptions { @@ -9106,7 +9313,14 @@ declare interface MakeDirectoryOptions { mode?: string | number; } declare interface MapOptions { + /** + * need columns? + */ columns?: boolean; + + /** + * is module + */ module?: boolean; } declare interface MatchObject { @@ -11269,7 +11483,7 @@ declare class OriginalSource extends Source { source: null | string, sourceContent?: string ) => void, - onName: (nameIndex: number, name: string) => void + _onName: (nameIndex: number, name: string) => void ): GeneratedSourceInfo; } @@ -11843,12 +12057,39 @@ declare interface ParameterizedComparator { (tArg: TArg): Comparator; } declare interface ParsedIdentifier { + /** + * request + */ request: string; + + /** + * query + */ query: string; + + /** + * fragment + */ fragment: string; + + /** + * is directory + */ directory: boolean; + + /** + * is module + */ module: boolean; + + /** + * is file + */ file: boolean; + + /** + * is internal + */ internal: boolean; } declare class Parser { @@ -12061,13 +12302,16 @@ type Plugin = | false | "" | 0 - | { apply: (arg0: Resolver) => void } - | ((this: Resolver, arg1: Resolver) => void); + | { apply: (this: Resolver, resolver: Resolver) => void } + | ((this: Resolver, resolver: Resolver) => void); declare interface PnpApi { + /** + * resolve to unqualified + */ resolveToUnqualified: ( - arg0: string, - arg1: string, - arg2: object + packageName: string, + issuer: string, + options: { considerBuiltins: boolean } ) => null | string; } declare class PrefetchPlugin { @@ -12346,14 +12590,49 @@ declare class RawSource extends Source { ): GeneratedSourceInfo; } declare interface RawSourceMap { + /** + * version + */ version: number; + + /** + * sources + */ sources: string[]; + + /** + * names + */ names: string[]; + + /** + * source root + */ sourceRoot?: string; + + /** + * sources content + */ sourcesContent?: string[]; + + /** + * mappings + */ mappings: string; + + /** + * file + */ file: string; + + /** + * debug id + */ debugId?: string; + + /** + * ignore list + */ ignoreList?: number[]; } declare interface Read< @@ -12535,7 +12814,7 @@ declare interface ReadFileTypes { | undefined | null | ({ encoding?: null; flag?: string } & Abortable), - callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void + callback: (err: null | NodeJS.ErrnoException, result?: Buffer) => void ): void; ( path: PathOrFileDescriptorTypes, @@ -12553,7 +12832,7 @@ declare interface ReadFileTypes { | "binary" | "hex" | ({ encoding: BufferEncoding; flag?: string } & Abortable), - callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void + callback: (err: null | NodeJS.ErrnoException, result?: string) => void ): void; ( path: PathOrFileDescriptorTypes, @@ -12574,13 +12853,13 @@ declare interface ReadFileTypes { | "hex" | (ObjectEncodingOptions & { flag?: string } & Abortable), callback: ( - arg0: null | NodeJS.ErrnoException, - arg1?: string | Buffer + err: null | NodeJS.ErrnoException, + result?: string | Buffer ) => void ): void; ( path: PathOrFileDescriptorTypes, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void + callback: (err: null | NodeJS.ErrnoException, result?: Buffer) => void ): void; } declare interface ReaddirFs { @@ -12619,18 +12898,14 @@ declare interface ReaddirFs { withFileTypes?: false; recursive?: boolean; }, - callback: (err: null | NodeJS.ErrnoException, result?: string[]) => void + callback: (err: null | NodeJS.ErrnoException, files?: string[]) => void ): void; ( path: PathLikeFs, options: | "buffer" | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean }, - callback: (err: null | NodeJS.ErrnoException, result?: Buffer[]) => void - ): void; - ( - path: PathLikeFs, - callback: (err: null | NodeJS.ErrnoException, result?: string[]) => void + callback: (err: null | NodeJS.ErrnoException, files?: Buffer[]) => void ): void; ( path: PathLikeFs, @@ -12655,16 +12930,31 @@ declare interface ReaddirFs { }), callback: ( err: null | NodeJS.ErrnoException, - result?: string[] | Buffer[] + files?: string[] | Buffer[] ) => void ): void; + ( + path: PathLikeFs, + callback: (err: null | NodeJS.ErrnoException, files?: string[]) => void + ): void; ( path: PathLikeFs, options: ObjectEncodingOptions & { withFileTypes: true; recursive?: boolean; }, - callback: (err: null | NodeJS.ErrnoException, result?: Dirent[]) => void + callback: ( + err: null | NodeJS.ErrnoException, + files?: Dirent[] + ) => void + ): void; + ( + path: PathLikeFs, + options: { encoding: "buffer"; withFileTypes: true; recursive?: boolean }, + callback: ( + err: null | NodeJS.ErrnoException, + files: Dirent[] + ) => void ): void; } declare interface ReaddirSync { @@ -12733,7 +13023,11 @@ declare interface ReaddirSync { withFileTypes: true; recursive?: boolean; } - ): Dirent[]; + ): Dirent[]; + ( + path: PathLikeFs, + options: { encoding: "buffer"; withFileTypes: true; recursive?: boolean } + ): Dirent[]; } declare interface ReaddirTypes { ( @@ -12771,18 +13065,14 @@ declare interface ReaddirTypes { withFileTypes?: false; recursive?: boolean; }, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: string[]) => void + callback: (err: null | NodeJS.ErrnoException, files?: string[]) => void ): void; ( path: PathLikeTypes, options: | "buffer" | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean }, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer[]) => void - ): void; - ( - path: PathLikeTypes, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: string[]) => void + callback: (err: null | NodeJS.ErrnoException, files?: Buffer[]) => void ): void; ( path: PathLikeTypes, @@ -12806,17 +13096,32 @@ declare interface ReaddirTypes { recursive?: boolean; }), callback: ( - arg0: null | NodeJS.ErrnoException, - arg1?: string[] | Buffer[] + err: null | NodeJS.ErrnoException, + files?: string[] | Buffer[] ) => void ): void; + ( + path: PathLikeTypes, + callback: (err: null | NodeJS.ErrnoException, files?: string[]) => void + ): void; ( path: PathLikeTypes, options: ObjectEncodingOptions & { withFileTypes: true; recursive?: boolean; }, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: Dirent[]) => void + callback: ( + err: null | NodeJS.ErrnoException, + files?: Dirent[] + ) => void + ): void; + ( + path: PathLikeTypes, + options: { encoding: "buffer"; withFileTypes: true; recursive?: boolean }, + callback: ( + err: null | NodeJS.ErrnoException, + files: Dirent[] + ) => void ): void; } declare interface ReadlinkFs { @@ -12852,24 +13157,24 @@ declare interface ReadlinkTypes { ( path: PathLikeTypes, options: EncodingOption, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void + callback: (err: null | NodeJS.ErrnoException, result?: string) => void ): void; ( path: PathLikeTypes, options: BufferEncodingOption, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void + callback: (err: null | NodeJS.ErrnoException, result?: Buffer) => void ): void; ( path: PathLikeTypes, options: EncodingOption, callback: ( - arg0: null | NodeJS.ErrnoException, - arg1?: string | Buffer + err: null | NodeJS.ErrnoException, + result?: string | Buffer ) => void ): void; ( path: PathLikeTypes, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void + callback: (err: null | NodeJS.ErrnoException, result?: string) => void ): void; } declare class RealContentHashPlugin { @@ -12932,24 +13237,24 @@ declare interface RealPathTypes { ( path: PathLikeTypes, options: EncodingOption, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void + callback: (err: null | NodeJS.ErrnoException, result?: string) => void ): void; ( path: PathLikeTypes, options: BufferEncodingOption, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void + callback: (err: null | NodeJS.ErrnoException, result?: Buffer) => void ): void; ( path: PathLikeTypes, options: EncodingOption, callback: ( - arg0: null | NodeJS.ErrnoException, - arg1?: string | Buffer + err: null | NodeJS.ErrnoException, + result?: string | Buffer ) => void ): void; ( path: PathLikeTypes, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void + callback: (err: null | NodeJS.ErrnoException, result?: string) => void ): void; } type Records = KnownRecords & @@ -13210,6 +13515,9 @@ declare interface ResolveBuildDependenciesResult { resolveDependencies: ResolveDependencies; } declare interface ResolveContext { + /** + * directories that was found on file system + */ contextDependencies?: WriteOnlySet; /** @@ -13230,12 +13538,12 @@ declare interface ResolveContext { /** * log function */ - log?: (arg0: string) => void; + log?: (str: string) => void; /** * yield result, if provided plugins can return several results */ - yield?: (arg0: ResolveRequest) => void; + yield?: (request: ResolveRequest) => void; } declare interface ResolveData { contextInfo: ModuleFactoryCreateDataContextInfo; @@ -13463,36 +13771,139 @@ declare interface ResolveOptions { useSyncFileSystemCalls?: boolean; } declare interface ResolveOptionsResolverFactoryObject1 { + /** + * alias + */ alias: AliasOption[]; + + /** + * fallback + */ fallback: AliasOption[]; + + /** + * alias fields + */ aliasFields: Set; + + /** + * extension alias + */ extensionAlias: ExtensionAliasOption[]; - cachePredicate: (arg0: ResolveRequest) => boolean; + + /** + * cache predicate + */ + cachePredicate: (predicate: ResolveRequest) => boolean; + + /** + * cache with context + */ cacheWithContext: boolean; /** * A list of exports field condition names. */ conditionNames: Set; + + /** + * description files + */ descriptionFiles: string[]; + + /** + * enforce extension + */ enforceExtension: boolean; + + /** + * exports fields + */ exportsFields: Set; + + /** + * imports fields + */ importsFields: Set; + + /** + * extensions + */ extensions: Set; + + /** + * fileSystem + */ fileSystem: FileSystem; - unsafeCache: false | object; + + /** + * unsafe cache + */ + unsafeCache: false | CacheTypes; + + /** + * symlinks + */ symlinks: boolean; + + /** + * resolver + */ resolver?: Resolver; + + /** + * modules + */ modules: (string | string[])[]; + + /** + * main fields + */ mainFields: { name: string[]; forceRelative: boolean }[]; + + /** + * main files + */ mainFiles: Set; + + /** + * plugins + */ plugins: Plugin[]; + + /** + * pnp API + */ pnpApi: null | PnpApi; + + /** + * roots + */ roots: Set; + + /** + * fully specified + */ fullySpecified: boolean; + + /** + * resolve to context + */ resolveToContext: boolean; + + /** + * restrictions + */ restrictions: Set; + + /** + * prefer relative + */ preferRelative: boolean; + + /** + * prefer absolute + */ preferAbsolute: boolean; } declare interface ResolveOptionsResolverFactoryObject2 { @@ -13519,7 +13930,7 @@ declare interface ResolveOptionsResolverFactoryObject2 { /** * A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties. */ - cachePredicate?: (arg0: ResolveRequest) => boolean; + cachePredicate?: (predicate: ResolveRequest) => boolean; /** * Whether or not the unsafeCache should include request context as part of the cache key. @@ -13564,7 +13975,7 @@ declare interface ResolveOptionsResolverFactoryObject2 { /** * Use this cache object to unsafely cache the successful requests */ - unsafeCache?: boolean | object; + unsafeCache?: boolean | CacheTypes; /** * Resolve symlinks to their symlinked location @@ -14785,6 +15196,10 @@ declare abstract class SerializerMiddleware< context: Context ): DeserializedType | Promise; } +declare interface SetIterator extends IteratorObject { + [Symbol.iterator](): SetIterator; + [Symbol.dispose](): void; +} declare class SharePlugin { constructor(options: SharePluginOptions); @@ -15053,15 +15468,45 @@ declare class Source { updateHash(hash: HashLike): void; } declare interface SourceAndMap { + /** + * source + */ source: SourceValue; + + /** + * map + */ map: null | RawSourceMap; } declare interface SourceLike { + /** + * source + */ source: () => SourceValue; + + /** + * buffer + */ buffer?: () => Buffer; + + /** + * size + */ size?: () => number; + + /** + * map + */ map?: (options?: MapOptions) => null | RawSourceMap; + + /** + * source and map + */ sourceAndMap?: (options?: MapOptions) => SourceAndMap; + + /** + * hash updater + */ updateHash?: (hash: HashLike) => void; } declare class SourceMapDevToolPlugin { @@ -15315,24 +15760,24 @@ declare interface StatSyncOptions { declare interface StatTypes { ( path: PathLikeTypes, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void + callback: (err: null | NodeJS.ErrnoException, result?: IStats) => void ): void; ( path: PathLikeTypes, options: undefined | (StatOptions & { bigint?: false }), - callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void + callback: (err: null | NodeJS.ErrnoException, result?: IStats) => void ): void; ( path: PathLikeTypes, options: StatOptions & { bigint: true }, - callback: (arg0: null | NodeJS.ErrnoException, arg1?: IBigIntStats) => void + callback: (err: null | NodeJS.ErrnoException, result?: IBigIntStats) => void ): void; ( path: PathLikeTypes, options: undefined | StatOptions, callback: ( - arg0: null | NodeJS.ErrnoException, - arg1?: IStats | IBigIntStats + err: null | NodeJS.ErrnoException, + result?: IStats | IBigIntStats ) => void ): void; } @@ -16105,11 +16550,6 @@ declare interface TrustedTypes { policyName?: string; } declare const UNDEFINED_MARKER: unique symbol; - -/** - * `URL` class is a global reference for `require('url').URL` - * https://nodejs.org/api/url.html#the-whatwg-url-api - */ declare interface URL_url extends URL {} type UnsafeCacheData = KnownUnsafeCacheData & Record; declare interface UpdateHashContextDependency { @@ -16720,6 +17160,7 @@ declare interface WriteFile { | Int32Array | BigUint64Array | BigInt64Array + | Float16Array | Float32Array | Float64Array | DataView, @@ -16739,6 +17180,7 @@ declare interface WriteFile { | Int32Array | BigUint64Array | BigInt64Array + | Float16Array | Float32Array | Float64Array | DataView, @@ -17405,7 +17847,7 @@ declare namespace exports { AutomaticPrefetchPlugin, AsyncDependenciesBlock, BannerPlugin, - Cache, + CacheClass as Cache, Chunk, ChunkGraph, CleanPlugin, diff --git a/yarn.lock b/yarn.lock index ab72adca471..bc99358eb36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20,7 +20,7 @@ call-me-maybe "^1.0.1" js-yaml "^4.1.0" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.27.1": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== @@ -353,10 +353,10 @@ "@codspeed/core" "^4.0.1" stack-trace "1.0.0-pre2" -"@cspell/cspell-bundled-dicts@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-9.0.1.tgz#a61b34317f5cbe3fda56af9a399af6fe7041fc82" - integrity sha512-h7gTqg0VF4N8VhOPk66XewuSsT56OP2ujgxtAyYQ4H+NuYd3HMfS0h/I3/y9uBhllwOEamaeAzYhc5JF/qIrsQ== +"@cspell/cspell-bundled-dicts@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-9.1.1.tgz#5873a02490dbab030dda80385041ce98c0a075c1" + integrity sha512-AbaIez18Puo9SbnhYsZnzG90ohelWWFQVbEIdtwMmRRItoIevF8wcNkQrFeFCXINs+FZH+aDGkt7oA1dwKgJFA== dependencies: "@cspell/dict-ada" "^4.1.0" "@cspell/dict-al" "^1.1.0" @@ -373,33 +373,33 @@ "@cspell/dict-docker" "^1.1.14" "@cspell/dict-dotnet" "^5.0.9" "@cspell/dict-elixir" "^4.0.7" - "@cspell/dict-en-common-misspellings" "^2.0.11" - "@cspell/dict-en-gb-mit" "^3.0.6" - "@cspell/dict-en_us" "^4.4.8" + "@cspell/dict-en-common-misspellings" "^2.1.1" + "@cspell/dict-en-gb-mit" "^3.1.1" + "@cspell/dict-en_us" "^4.4.11" "@cspell/dict-filetypes" "^3.0.12" "@cspell/dict-flutter" "^1.1.0" "@cspell/dict-fonts" "^4.0.4" "@cspell/dict-fsharp" "^1.1.0" "@cspell/dict-fullstack" "^3.2.6" "@cspell/dict-gaming-terms" "^1.1.1" - "@cspell/dict-git" "^3.0.4" - "@cspell/dict-golang" "^6.0.21" + "@cspell/dict-git" "^3.0.6" + "@cspell/dict-golang" "^6.0.22" "@cspell/dict-google" "^1.0.8" "@cspell/dict-haskell" "^4.0.5" "@cspell/dict-html" "^4.0.11" "@cspell/dict-html-symbol-entities" "^4.0.3" "@cspell/dict-java" "^5.0.11" "@cspell/dict-julia" "^1.1.0" - "@cspell/dict-k8s" "^1.0.10" + "@cspell/dict-k8s" "^1.0.11" "@cspell/dict-kotlin" "^1.1.0" "@cspell/dict-latex" "^4.0.3" "@cspell/dict-lorem-ipsum" "^4.0.4" "@cspell/dict-lua" "^4.0.7" "@cspell/dict-makefile" "^1.0.4" - "@cspell/dict-markdown" "^2.0.10" + "@cspell/dict-markdown" "^2.0.11" "@cspell/dict-monkeyc" "^1.0.10" "@cspell/dict-node" "^5.0.7" - "@cspell/dict-npm" "^5.2.3" + "@cspell/dict-npm" "^5.2.6" "@cspell/dict-php" "^4.0.14" "@cspell/dict-powershell" "^5.0.14" "@cspell/dict-public-licenses" "^2.0.13" @@ -409,42 +409,42 @@ "@cspell/dict-rust" "^4.0.11" "@cspell/dict-scala" "^5.0.7" "@cspell/dict-shell" "^1.1.0" - "@cspell/dict-software-terms" "^5.0.8" + "@cspell/dict-software-terms" "^5.1.0" "@cspell/dict-sql" "^2.2.0" "@cspell/dict-svelte" "^1.0.6" "@cspell/dict-swift" "^2.0.5" "@cspell/dict-terraform" "^1.1.1" - "@cspell/dict-typescript" "^3.2.1" + "@cspell/dict-typescript" "^3.2.2" "@cspell/dict-vue" "^3.0.4" -"@cspell/cspell-json-reporter@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/cspell-json-reporter/-/cspell-json-reporter-9.0.1.tgz#c21c750fdd006a5dec308efec01063e80cd32d49" - integrity sha512-Rpn7Tuq9t8bZpXZFV43NkhCl0LaPDJZSON4/JFxGbOcH16ryXfrx7oObUTIIyxSxO3fGkzaJZHIwGibRJSsbNQ== +"@cspell/cspell-json-reporter@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-json-reporter/-/cspell-json-reporter-9.1.1.tgz#fa093ce29ef880c87d9c29301789ea7f8ab82d47" + integrity sha512-bvbBXr77yz0xu/6GckWMWoUyjSL5MqF86y7g0DkGnNpB5Bu5fCNAltR5yNo1xlBCtbUwB0zrlPENSSxRmNpPCA== dependencies: - "@cspell/cspell-types" "9.0.1" + "@cspell/cspell-types" "9.1.1" -"@cspell/cspell-pipe@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/cspell-pipe/-/cspell-pipe-9.0.1.tgz#34e2b167dae4bda4c9e03639efdc8efabdbd7b7d" - integrity sha512-bhFcvF2a8KYKVh/OebCfJ8LFw5GYHyUsUjAbxnznTBrYOFSIclDjwUwT29yVDXwnQkJkB6Px5Y9e2VvtFizVFg== +"@cspell/cspell-pipe@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-pipe/-/cspell-pipe-9.1.1.tgz#ac7fd0c2e2a68b7e19e1a1de690a0f0db96515b6" + integrity sha512-WFh6+Fig//8Ev8mxBHjKiKhYfJHez5JyI2ioWBgh16EL08k5kfqIsANX8/ij+k0QvfObA4J4LRJ6RUoExvD+4g== -"@cspell/cspell-resolver@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/cspell-resolver/-/cspell-resolver-9.0.1.tgz#8cb2a3d21cb9bd4f7dbba69e496a0fc9155afd5b" - integrity sha512-AhIXAhX1qt7Y3EyiP/5rAk7Ow7DJpAyB44wPbfdF9p1vhnk6oQ7RslnD3G6S9o/vNxZ0DWFPREMWx19J/3c+hw== +"@cspell/cspell-resolver@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-resolver/-/cspell-resolver-9.1.1.tgz#cae9f70a3619c5ef3e9d022fac85a33d167c7706" + integrity sha512-nnHE6ZA4tGA0jU1Yco6OuXUwPvFqHrWqMwvbmOHRLPZRLrtbqKUQGxUuSHlM3aGLHBfaPZSZqBl5rvGyj2EX1Q== dependencies: global-directory "^4.0.1" -"@cspell/cspell-service-bus@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/cspell-service-bus/-/cspell-service-bus-9.0.1.tgz#c151e5a3b48306b48b36a043fa282f254691f5e9" - integrity sha512-DoW6hLkFIO3BXePtUYQEax3FTH9fkwCUbf6qphAEXnr4PjoyPZsgBhR6iCrZd4DyhuFiRvK3Cgpq2o3O0NdODQ== +"@cspell/cspell-service-bus@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-service-bus/-/cspell-service-bus-9.1.1.tgz#514ae6c7ae1ff0f990ff392f37884c0a1a520aa8" + integrity sha512-0eFZe4dsEaETsNsqcFilWwfi2VRHRxldSkNZFGXf/QbamSK89VNf0X/q9CtAU90PVgJAzYevV2r6uyWX2poZpQ== -"@cspell/cspell-types@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/cspell-types/-/cspell-types-9.0.1.tgz#6143b68e1c5c9115ec397fba9615c90e4b37fa52" - integrity sha512-8FRmvyV1AYEepJB3J7jji1ZYG9yOK0eYr4WuUVPfUJa6N3HyeZjWKhxbVvqedmEI74f5Ls3cQKHY1T2Yvqk/ag== +"@cspell/cspell-types@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-types/-/cspell-types-9.1.1.tgz#33be34edd222308f01d07b3056b4fbc5a5cdd396" + integrity sha512-xouQmxgAuEz+jnmyzQV6LoAKzwTt/wF1xjRgVW1ssMFDlRGPtvEOmfk3yk79Ror0AnHmA5O1xXpFQ/VgFU56MQ== "@cspell/dict-ada@^4.1.0": version "4.1.0" @@ -523,20 +523,20 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-elixir/-/dict-elixir-4.0.7.tgz#fd6136db9acb7912e495e02777e2141ef16822f4" integrity sha512-MAUqlMw73mgtSdxvbAvyRlvc3bYnrDqXQrx5K9SwW8F7fRYf9V4vWYFULh+UWwwkqkhX9w03ZqFYRTdkFku6uA== -"@cspell/dict-en-common-misspellings@^2.0.11": - version "2.0.11" - resolved "https://registry.yarnpkg.com/@cspell/dict-en-common-misspellings/-/dict-en-common-misspellings-2.0.11.tgz#5ba78c86c1d638d6c1acd4c6409d756266860822" - integrity sha512-xFQjeg0wFHh9sFhshpJ+5BzWR1m9Vu8pD0CGPkwZLK9oii8AD8RXNchabLKy/O5VTLwyqPOi9qpyp1cxm3US4Q== +"@cspell/dict-en-common-misspellings@^2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@cspell/dict-en-common-misspellings/-/dict-en-common-misspellings-2.1.1.tgz#0dbac3cb2a5965d3a1dacdf1e680c4719c3bec66" + integrity sha512-6m2EEm4WUgsNzFzz/2boeOVrZenYQRaDXFtDNcaQK5Ly4A37HTRPm8uVvE8cAlACVk+HBHhH/4e7ebxdXwId9w== -"@cspell/dict-en-gb-mit@^3.0.6": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@cspell/dict-en-gb-mit/-/dict-en-gb-mit-3.0.6.tgz#23af2677bc32deaca829efdfc45bd0efd1779af6" - integrity sha512-QYDwuXi9Yh+AvU1omhz8sWX+A1SxWI3zeK1HdGfTrICZavhp8xxcQGTa5zxTTFRCcQc483YzUH2Dl+6Zd50tJg== +"@cspell/dict-en-gb-mit@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@cspell/dict-en-gb-mit/-/dict-en-gb-mit-3.1.1.tgz#31d9bc225a7bf4fcaf548df8a614d7307b450688" + integrity sha512-sZbuOPlAGDwudoquXjaSA+TbJEzfG0MkUeF4Iz3tdL9xOYDb6lgueNVnDJfBrw6jrKKDdOI68MJqiLjW4uth8A== -"@cspell/dict-en_us@^4.4.8": - version "4.4.8" - resolved "https://registry.yarnpkg.com/@cspell/dict-en_us/-/dict-en_us-4.4.8.tgz#36513b6b578d8d90ec8b68a7e780fde42ae08033" - integrity sha512-OkNUVuU9Q+Sf827/61YPkk6ya6dSsllzeYniBFqNW9TkoqQXT3vggkgmtCE1aEhSvVctMwxpPYoC8pZgn1TeSA== +"@cspell/dict-en_us@^4.4.11": + version "4.4.11" + resolved "https://registry.yarnpkg.com/@cspell/dict-en_us/-/dict-en_us-4.4.11.tgz#2c97176611dddf259b3bd956d1c05a903e7b886a" + integrity sha512-ls3ASwIL0uuAEXsxB7NsIe6GRBQ+NZfqI5k1qtNgOZ1eh1MFYjCiF+YcqArH5SFHNzOwCHRKzlLeX0ZFIok7GQ== "@cspell/dict-filetypes@^3.0.12": version "3.0.12" @@ -568,15 +568,15 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-gaming-terms/-/dict-gaming-terms-1.1.1.tgz#755d96864650f679ed5d0381e867380bf8efcf9a" integrity sha512-tb8GFxjTLDQstkJcJ90lDqF4rKKlMUKs5/ewePN9P+PYRSehqDpLI5S5meOfPit8LGszeOrjUdBQ4zXo7NpMyQ== -"@cspell/dict-git@^3.0.4": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@cspell/dict-git/-/dict-git-3.0.4.tgz#3753f17a2a122f4dc734a51820fac7b6ffc594f1" - integrity sha512-C44M+m56rYn6QCsLbiKiedyPTMZxlDdEYAsPwwlL5bhMDDzXZ3Ic8OCQIhMbiunhCOJJT+er4URmOmM+sllnjg== +"@cspell/dict-git@^3.0.6": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@cspell/dict-git/-/dict-git-3.0.6.tgz#2ae75d856293fb618ff0bd5a38575fb093222bfb" + integrity sha512-nazfOqyxlBOQGgcur9ssEOEQCEZkH8vXfQe8SDEx8sCN/g0SFm8ktabgLVmBOXjy3RzjVNLlM2nBfRQ7e6+5hQ== -"@cspell/dict-golang@^6.0.21": - version "6.0.21" - resolved "https://registry.yarnpkg.com/@cspell/dict-golang/-/dict-golang-6.0.21.tgz#dc6fb7177cd99faa8bdebaecb22ec13570154424" - integrity sha512-D3wG1MWhFx54ySFJ00CS1MVjR4UiBVsOWGIjJ5Av+HamnguqEshxbF9mvy+BX0KqzdLVzwFkoLBs8QeOID56HA== +"@cspell/dict-golang@^6.0.22": + version "6.0.22" + resolved "https://registry.yarnpkg.com/@cspell/dict-golang/-/dict-golang-6.0.22.tgz#d648ea7421db33cf1ecf97e6a6d3770fb9084102" + integrity sha512-FvV0m3Y0nUFxw36uDCD8UtfOPv4wsZnnlabNwB3xNZ2IBn0gBURuMUZywScb9sd2wXM8VFBRoU//tc6NQsOVOg== "@cspell/dict-google@^1.0.8": version "1.0.8" @@ -608,10 +608,10 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-julia/-/dict-julia-1.1.0.tgz#06302765dbdb13023be506c27c26b2f3e475d1cc" integrity sha512-CPUiesiXwy3HRoBR3joUseTZ9giFPCydSKu2rkh6I2nVjXnl5vFHzOMLXpbF4HQ1tH2CNfnDbUndxD+I+7eL9w== -"@cspell/dict-k8s@^1.0.10": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@cspell/dict-k8s/-/dict-k8s-1.0.10.tgz#3f4f77a47d6062d66e85651a05482ad62dd65180" - integrity sha512-313haTrX9prep1yWO7N6Xw4D6tvUJ0Xsx+YhCP+5YrrcIKoEw5Rtlg8R4PPzLqe6zibw6aJ+Eqq+y76Vx5BZkw== +"@cspell/dict-k8s@^1.0.11": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@cspell/dict-k8s/-/dict-k8s-1.0.11.tgz#8712403bdeb1165466e785edeb2d1f98125521f3" + integrity sha512-8ojNwB5j4PfZ1Gq9n5c/HKJCtZD3h6+wFy+zpALpDWFFQ2qT22Be30+3PVd+G5gng8or0LeK8VgKKd0l1uKPTA== "@cspell/dict-kotlin@^1.1.0": version "1.1.0" @@ -638,10 +638,10 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-makefile/-/dict-makefile-1.0.4.tgz#52ea60fbf30a9814229c222788813bf93cbf1f3e" integrity sha512-E4hG/c0ekPqUBvlkrVvzSoAA+SsDA9bLi4xSV3AXHTVru7Y2bVVGMPtpfF+fI3zTkww/jwinprcU1LSohI3ylw== -"@cspell/dict-markdown@^2.0.10": - version "2.0.10" - resolved "https://registry.yarnpkg.com/@cspell/dict-markdown/-/dict-markdown-2.0.10.tgz#7e00957036aa3da2ea133135ae53a9108fb6b223" - integrity sha512-vtVa6L/84F9sTjclTYDkWJF/Vx2c5xzxBKkQp+CEFlxOF2SYgm+RSoEvAvg5vj4N5kuqR4350ZlY3zl2eA3MXw== +"@cspell/dict-markdown@^2.0.11": + version "2.0.11" + resolved "https://registry.yarnpkg.com/@cspell/dict-markdown/-/dict-markdown-2.0.11.tgz#209fada54a200f0b5fa2dd4c3fcbc70acedc395e" + integrity sha512-stZieFKJyMQbzKTVoalSx2QqCpB0j8nPJF/5x+sBnDIWgMC65jp8Wil+jccWh9/vnUVukP3Ejewven5NC7SWuQ== "@cspell/dict-monkeyc@^1.0.10": version "1.0.10" @@ -653,10 +653,10 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-node/-/dict-node-5.0.7.tgz#d26e558b2b157c254c6d5e5bf9b63cf35654c5ea" integrity sha512-ZaPpBsHGQCqUyFPKLyCNUH2qzolDRm1/901IO8e7btk7bEDF56DN82VD43gPvD4HWz3yLs/WkcLa01KYAJpnOw== -"@cspell/dict-npm@^5.2.3": - version "5.2.3" - resolved "https://registry.yarnpkg.com/@cspell/dict-npm/-/dict-npm-5.2.3.tgz#f33d259245ea15796627661ae91e6e25b039b3ae" - integrity sha512-EdGkCpAq66Mhi9Qldgsr+NvPVL4TdtmdlqDe4VBp0P3n6J0B7b0jT1MlVDIiLR+F1eqBfL0qjfHf0ey1CafeNw== +"@cspell/dict-npm@^5.2.6": + version "5.2.6" + resolved "https://registry.yarnpkg.com/@cspell/dict-npm/-/dict-npm-5.2.6.tgz#ac3c43fe322f6e89281004a71ca43262516f5628" + integrity sha512-VGEY1ZjE8c8JCA+dic1IdYmVTNfVtWAw7V2n4TXO1+mKfRL+BsPsqEoH8iR0OMutC9QXjVNh32rzMh4D3E+Lxw== "@cspell/dict-php@^4.0.14": version "4.0.14" @@ -705,10 +705,10 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-shell/-/dict-shell-1.1.0.tgz#3110d5c81cb5bd7f6c0cc88e6e8ac7ccf6fa65b5" integrity sha512-D/xHXX7T37BJxNRf5JJHsvziFDvh23IF/KvkZXNSh8VqcRdod3BAz9VGHZf6VDqcZXr1VRqIYR3mQ8DSvs3AVQ== -"@cspell/dict-software-terms@^5.0.8": - version "5.0.9" - resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-5.0.9.tgz#009dcd916191f1915776a5cedb39fd2d34b0b5ff" - integrity sha512-Zcm7PMxLSmgJNeICsj1jfhOIS8sOFGgmV1EsTo+EALXWU5pcD6u/P+B9sY0f/9M8V82VaYmTeNVwSlZNh5h94w== +"@cspell/dict-software-terms@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-5.1.0.tgz#41f94027da0224c899957d4ea53541285589d41a" + integrity sha512-8zsOVzcHpb4PAaKtOWAIJRbpaNINaUZRsHzqFb3K9hQIC6hxmet/avLlCeKdnmBVZkn3TmRN5caxTJamJvbXww== "@cspell/dict-sql@^2.2.0": version "2.2.0" @@ -730,38 +730,38 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-terraform/-/dict-terraform-1.1.1.tgz#23a25f64eb7495642ab17b8fbeda46ac10cd6f43" integrity sha512-07KFDwCU7EnKl4hOZLsLKlj6Zceq/IsQ3LRWUyIjvGFfZHdoGtFdCp3ZPVgnFaAcd/DKv+WVkrOzUBSYqHopQQ== -"@cspell/dict-typescript@^3.2.1": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@cspell/dict-typescript/-/dict-typescript-3.2.1.tgz#638b5d48b97d00b3db15746dd5cdf5535147fb55" - integrity sha512-jdnKg4rBl75GUBTsUD6nTJl7FGvaIt5wWcWP7TZSC3rV1LfkwvbUiY3PiGpfJlAIdnLYSeFWIpYU9gyVgz206w== +"@cspell/dict-typescript@^3.2.2": + version "3.2.2" + resolved "https://registry.yarnpkg.com/@cspell/dict-typescript/-/dict-typescript-3.2.2.tgz#c236e3e752658b68f0e128163f5a7ba3538ceed5" + integrity sha512-H9Y+uUHsTIDFO/jdfUAcqmcd5osT+2DB5b0aRCHfLWN/twUbGn/1qq3b7YwEvttxKlYzWHU3uNFf+KfA93VY7w== "@cspell/dict-vue@^3.0.4": version "3.0.4" resolved "https://registry.yarnpkg.com/@cspell/dict-vue/-/dict-vue-3.0.4.tgz#0f1cb65e2f640925de72acbc1cae9e87f7727c05" integrity sha512-0dPtI0lwHcAgSiQFx8CzvqjdoXROcH+1LyqgROCpBgppommWpVhbQ0eubnKotFEXgpUCONVkeZJ6Ql8NbTEu+w== -"@cspell/dynamic-import@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/dynamic-import/-/dynamic-import-9.0.1.tgz#e71d33bd13ffd2ab86227d955a3d4c62791a3b6b" - integrity sha512-BoWzHwkufo90ubMZUN8Jy4HQYYWFW7psVCdG/4RUgfvVnazkPfLxWBbsPQsLrlIP0utaqei7D9FU0K7r7mpl4A== +"@cspell/dynamic-import@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/dynamic-import/-/dynamic-import-9.1.1.tgz#1f8431d1cab13d85838c99a27095b4db86e84ada" + integrity sha512-jcg5Wti4kcPh4Deds009MEZvuN3tViUft079MTsdSpNPNhRf/gKwSIQnkda9g4ppsVPh5mxkE0nUZLxfZRZYMg== dependencies: - "@cspell/url" "9.0.1" + "@cspell/url" "9.1.1" import-meta-resolve "^4.1.0" -"@cspell/filetypes@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/filetypes/-/filetypes-9.0.1.tgz#349f5e6e28ff741720df8f6e44a8e6d42ea37e6e" - integrity sha512-swZu3ra2AueyjEz/bPsvwFuHGYhjWZBx1K9FSvZA/yDIX5RVr6orQSuf9zvXNFui6Nyk0tudLnn3y9jT0LHk8A== +"@cspell/filetypes@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/filetypes/-/filetypes-9.1.1.tgz#6b87f56a7eff157d0ba7dd5ae71a52dde395b2ce" + integrity sha512-kQ1mD+hPxh8KRbDtPvCb6nuODwJV26W43sC77I5Vpk+IDXZqxEhkTCXB6OefnfplOl6+wU0e/EAw+7XYtlKjfg== -"@cspell/strong-weak-map@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/strong-weak-map/-/strong-weak-map-9.0.1.tgz#509819ab5503ffb21794fbba5d19650fdf05985b" - integrity sha512-u87PWr1xACqs/F3HibZ4Eb0Za/ghWIa6WLvEKV9OaiLfEUQuczbrXPVgHmGr83H0XXWUKy8FvVbWGFmXwiw+gQ== +"@cspell/strong-weak-map@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/strong-weak-map/-/strong-weak-map-9.1.1.tgz#634d1b8bfe5a94997a619a5e16fd94306a0ad3f5" + integrity sha512-D9dDws2MmE24zxkT9TcxYzOAiZncllgcfAGVswklM+dpQeHyZgRDPpdjVhz+nrYrwVwTbdWlRNJ9RiwzRN+jpA== -"@cspell/url@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@cspell/url/-/url-9.0.1.tgz#bffe68a51b98e4c1a7dfbd2d42994451510a02f9" - integrity sha512-8xaLrsQ742dmwXwS6tjreps3NpSQe6WEZFPQQT2DprVJXGZnfQR8ob0c+kPhD0hu9A6PwShJsRsfh3DQGKCqAw== +"@cspell/url@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@cspell/url/-/url-9.1.1.tgz#eb0850cddcec97b6586959526bca0ef75988549e" + integrity sha512-/RL/QTcaFBr0UGl6uLc9d2kPCEpqWHmBs8uFRnBottJ3I5tMOiaVtkEKFTx5FIxrlWTjZwW3rWaIUspNX5ejUw== "@discoveryjs/json-ext@^0.6.1": version "0.6.3" @@ -790,11 +790,13 @@ dependencies: tslib "^2.4.0" -"@es-joy/jsdoccomment@~0.49.0": - version "0.49.0" - resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.49.0.tgz#e5ec1eda837c802eca67d3b29e577197f14ba1db" - integrity sha512-xjZTSFgECpb9Ohuk5yMX5RhUEbfeQcuOp8IF60e+wyzWEF0M5xeSgqsfLtvPEX8BIyOX9saZqzuGPmZ8oWc+5Q== +"@es-joy/jsdoccomment@~0.52.0": + version "0.52.0" + resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.52.0.tgz#106945b6d1abed89597aa104b80ff8f9fb7038a6" + integrity sha512-BXuN7BII+8AyNtn57euU2Yxo9yA/KUDNzrpXyi3pfqKmBhhysR6ZWOebFh3vyPoqA3/j1SOvGgucElMGwlXing== dependencies: + "@types/estree" "^1.0.8" + "@typescript-eslint/types" "^8.34.1" comment-parser "1.4.1" esquery "^1.6.0" jsdoc-type-pratt-parser "~4.1.0" @@ -811,10 +813,10 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0" integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ== -"@eslint/config-array@^0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.20.0.tgz#7a1232e82376712d3340012a2f561a2764d1988f" - integrity sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ== +"@eslint/config-array@^0.20.1": + version "0.20.1" + resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.20.1.tgz#454f89be82b0e5b1ae872c154c7e2f3dd42c3979" + integrity sha512-OL0RJzC/CBzli0DrrR31qzj6d6i6Mm3HByuhflhl4LOBiWxN+3i6/t/ZQQNii4tjksXi8r2CRW1wMpWA2ULUEw== dependencies: "@eslint/object-schema" "^2.1.6" debug "^4.3.1" @@ -854,10 +856,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.28.0", "@eslint/js@^9.21.0": - version "9.28.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.28.0.tgz#7822ccc2f8cae7c3cd4f902377d520e9ae03f844" - integrity sha512-fnqSjGWd/CoIp4EXIxWVK/sHA6DOHN4+8Ix2cX5ycOY7LG0UY8nHCU5pIp2eaE1Mc7Qd8kHspYNzYXT2ojPLzg== +"@eslint/js@9.29.0", "@eslint/js@^9.29.0": + version "9.29.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.29.0.tgz#dc6fd117c19825f8430867a662531da36320fe56" + integrity sha512-3PIF4cBw/y+1u2EazflInpV+lYsSG0aByVIQzAgb1m1MhHFSbqTyNqtBKHgWf/9Ykud+DhILS9EGkmekVhbKoQ== "@eslint/object-schema@^2.1.6": version "2.1.6" @@ -943,134 +945,127 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-30.0.0.tgz#7f8f66adc20ea795cc74afb74280e08947e55c13" - integrity sha512-vfpJap6JZQ3I8sUN8dsFqNAKJYO4KIGxkcB+3Fw7Q/BJiWY5HwtMMiuT1oP0avsiDhjE/TCLaDgbGfHwDdBVeg== +"@jest/console@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-30.0.2.tgz#e2bf6c7703d45f9824d77c7332388c3e1685afd7" + integrity sha512-krGElPU0FipAqpVZ/BRZOy0MZh/ARdJ0Nj+PiH1ykFY1+VpBlYNLjdjVA5CFKxnKR6PFqFutO4Z7cdK9BlGiDA== dependencies: - "@jest/types" "30.0.0" + "@jest/types" "30.0.1" "@types/node" "*" chalk "^4.1.2" - jest-message-util "30.0.0" - jest-util "30.0.0" + jest-message-util "30.0.2" + jest-util "30.0.2" slash "^3.0.0" -"@jest/core@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-30.0.0.tgz#2ea3e63dd193af0b986f70b01c2597efd0e10b27" - integrity sha512-1zU39zFtWSl5ZuDK3Rd6P8S28MmS4F11x6Z4CURrgJ99iaAJg68hmdJ2SAHEEO6ociaNk43UhUYtHxWKEWoNYw== - dependencies: - "@jest/console" "30.0.0" - "@jest/pattern" "30.0.0" - "@jest/reporters" "30.0.0" - "@jest/test-result" "30.0.0" - "@jest/transform" "30.0.0" - "@jest/types" "30.0.0" +"@jest/core@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-30.0.2.tgz#c84c85baac55e6fa85b491edc4280425631951c7" + integrity sha512-mUMFdDtYWu7la63NxlyNIhgnzynszxunXWrtryR7bV24jV9hmi7XCZTzZHaLJjcBU66MeUAPZ81HjwASVpYhYQ== + dependencies: + "@jest/console" "30.0.2" + "@jest/pattern" "30.0.1" + "@jest/reporters" "30.0.2" + "@jest/test-result" "30.0.2" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" "@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.0" - jest-config "30.0.0" - jest-haste-map "30.0.0" - jest-message-util "30.0.0" - jest-regex-util "30.0.0" - jest-resolve "30.0.0" - jest-resolve-dependencies "30.0.0" - jest-runner "30.0.0" - jest-runtime "30.0.0" - jest-snapshot "30.0.0" - jest-util "30.0.0" - jest-validate "30.0.0" - jest-watcher "30.0.0" + jest-changed-files "30.0.2" + jest-config "30.0.2" + jest-haste-map "30.0.2" + jest-message-util "30.0.2" + jest-regex-util "30.0.1" + jest-resolve "30.0.2" + jest-resolve-dependencies "30.0.2" + jest-runner "30.0.2" + jest-runtime "30.0.2" + jest-snapshot "30.0.2" + jest-util "30.0.2" + jest-validate "30.0.2" + jest-watcher "30.0.2" micromatch "^4.0.8" - pretty-format "30.0.0" + pretty-format "30.0.2" slash "^3.0.0" -"@jest/diff-sequences@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/diff-sequences/-/diff-sequences-30.0.0.tgz#402d27d14e9d5161dedfca98bf181018a8931eb1" - integrity sha512-xMbtoCeKJDto86GW6AiwVv7M4QAuI56R7dVBr1RNGYbOT44M2TIzOiske2RxopBqkumDY+A1H55pGvuribRY9A== +"@jest/diff-sequences@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/diff-sequences/-/diff-sequences-30.0.1.tgz#0ededeae4d071f5c8ffe3678d15f3a1be09156be" + integrity sha512-n5H8QLDJ47QqbCNn5SuFjCRDrOLEZ0h8vAHCK5RL9Ls7Xa8AQLa/YxAc9UjFqoEDM48muwtBGjtMY5cr0PLDCw== -"@jest/environment@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-30.0.0.tgz#d66484e35d6ee9a551d2ef3adb9e18728f0e4736" - integrity sha512-09sFbMMgS5JxYnvgmmtwIHhvoyzvR5fUPrVl8nOCrC5KdzmmErTcAxfWyAhJ2bv3rvHNQaKiS+COSG+O7oNbXw== +"@jest/environment@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-30.0.2.tgz#1b0d055070e97f697e9edb25059e9435221cbe65" + integrity sha512-hRLhZRJNxBiOhxIKSq2UkrlhMt3/zVFQOAi5lvS8T9I03+kxsbflwHJEF+eXEYXCrRGRhHwECT7CDk6DyngsRA== dependencies: - "@jest/fake-timers" "30.0.0" - "@jest/types" "30.0.0" + "@jest/fake-timers" "30.0.2" + "@jest/types" "30.0.1" "@types/node" "*" - jest-mock "30.0.0" - -"@jest/expect-utils@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.0.0.tgz#118d41d9df420db61d307308848a9e12f0fc1fad" - integrity sha512-UiWfsqNi/+d7xepfOv8KDcbbzcYtkWBe3a3kVDtg6M1kuN6CJ7b4HzIp5e1YHrSaQaVS8sdCoyCMCZClTLNKFQ== - dependencies: - "@jest/get-type" "30.0.0" + jest-mock "30.0.2" -"@jest/expect-utils@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" - integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== +"@jest/expect-utils@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.0.2.tgz#d065f68c128cec526540193d88f2fc64c3d4f971" + integrity sha512-FHF2YdtFBUQOo0/qdgt+6UdBFcNPF/TkVzcc+4vvf8uaBzUlONytGBeeudufIHHW1khRfM1sBbRT1VCK7n/0dQ== dependencies: - jest-get-type "^29.6.3" + "@jest/get-type" "30.0.1" -"@jest/expect@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-30.0.0.tgz#3f6c17a333444aa6d93b507871815c24c6681f21" - integrity sha512-XZ3j6syhMeKiBknmmc8V3mNIb44kxLTbOQtaXA4IFdHy+vEN0cnXRzbRjdGBtrp4k1PWyMWNU3Fjz3iejrhpQg== +"@jest/expect@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-30.0.2.tgz#b3d5adec28f3884d6fd0746c4b5d0d2473e9e212" + integrity sha512-blWRFPjv2cVfh42nLG6L3xIEbw+bnuiZYZDl/BZlsNG/i3wKV6FpPZ2EPHguk7t5QpLaouIu+7JmYO4uBR6AOg== dependencies: - expect "30.0.0" - jest-snapshot "30.0.0" + expect "30.0.2" + jest-snapshot "30.0.2" -"@jest/fake-timers@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-30.0.0.tgz#4d4ae90695609c1b27795ad1210203d73f30dcfd" - integrity sha512-yzBmJcrMHAMcAEbV2w1kbxmx8WFpEz8Cth3wjLMSkq+LO8VeGKRhpr5+BUp7PPK+x4njq/b6mVnDR8e/tPL5ng== +"@jest/fake-timers@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-30.0.2.tgz#ec758b28ae6f63a49eda9e8d6af274d152d37c09" + integrity sha512-jfx0Xg7l0gmphTY9UKm5RtH12BlLYj/2Plj6wXjVW5Era4FZKfXeIvwC67WX+4q8UCFxYS20IgnMcFBcEU0DtA== dependencies: - "@jest/types" "30.0.0" + "@jest/types" "30.0.1" "@sinonjs/fake-timers" "^13.0.0" "@types/node" "*" - jest-message-util "30.0.0" - jest-mock "30.0.0" - jest-util "30.0.0" - -"@jest/get-type@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/get-type/-/get-type-30.0.0.tgz#59dcb5a9cbd9eb0004d3a2ed2fa9c9c3abfbf005" - integrity sha512-VZWMjrBzqfDKngQ7sUctKeLxanAbsBFoZnPxNIG6CmxK7Gv6K44yqd0nzveNIBfuhGZMmk1n5PGbvdSTOu0yTg== - -"@jest/globals@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-30.0.0.tgz#b80a488ec3fc99637455def038e53cfcd562a18f" - integrity sha512-OEzYes5A1xwBJVMPqFRa8NCao8Vr42nsUZuf/SpaJWoLE+4kyl6nCQZ1zqfipmCrIXQVALC5qJwKy/7NQQLPhw== - dependencies: - "@jest/environment" "30.0.0" - "@jest/expect" "30.0.0" - "@jest/types" "30.0.0" - jest-mock "30.0.0" - -"@jest/pattern@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/pattern/-/pattern-30.0.0.tgz#2d1f04c8b64b31f1bfa71ccb60593a4415d0d452" - integrity sha512-k+TpEThzLVXMkbdxf8KHjZ83Wl+G54ytVJoDIGWwS96Ql4xyASRjc6SU1hs5jHVql+hpyK9G8N7WuFhLpGHRpQ== + jest-message-util "30.0.2" + jest-mock "30.0.2" + jest-util "30.0.2" + +"@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.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-30.0.2.tgz#3b401bb7cb8cc0a00476630298747a38e40a6fc1" + integrity sha512-DwTtus9jjbG7b6jUdkcVdptf0wtD1v153A+PVwWB/zFwXhqu6hhtSd+uq88jofMhmYPtkmPmVGUBRNCZEKXn+w== + dependencies: + "@jest/environment" "30.0.2" + "@jest/expect" "30.0.2" + "@jest/types" "30.0.1" + jest-mock "30.0.2" + +"@jest/pattern@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/pattern/-/pattern-30.0.1.tgz#d5304147f49a052900b4b853dedb111d080e199f" + integrity sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA== dependencies: "@types/node" "*" - jest-regex-util "30.0.0" + jest-regex-util "30.0.1" -"@jest/reporters@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-30.0.0.tgz#a384cc5692e3288617f6993c3267314f8f865781" - integrity sha512-5WHNlLO0Ok+/o6ML5IzgVm1qyERtLHBNhwn67PAq92H4hZ+n5uW/BYj1VVwmTdxIcNrZLxdV9qtpdZkXf16HxA== +"@jest/reporters@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-30.0.2.tgz#e804435ab77cd05b7e8732b91006cd00bd822399" + integrity sha512-l4QzS/oKf57F8WtPZK+vvF4Io6ukplc6XgNFu4Hd/QxaLEO9f+8dSFzUua62Oe0HKlCUjKHpltKErAgDiMJKsA== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "30.0.0" - "@jest/test-result" "30.0.0" - "@jest/transform" "30.0.0" - "@jest/types" "30.0.0" + "@jest/console" "30.0.2" + "@jest/test-result" "30.0.2" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" "@jridgewell/trace-mapping" "^0.3.25" "@types/node" "*" chalk "^4.1.2" @@ -1083,112 +1078,93 @@ istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^5.0.0" istanbul-reports "^3.1.3" - jest-message-util "30.0.0" - jest-util "30.0.0" - jest-worker "30.0.0" + jest-message-util "30.0.2" + jest-util "30.0.2" + jest-worker "30.0.2" slash "^3.0.0" string-length "^4.0.2" v8-to-istanbul "^9.0.1" -"@jest/schemas@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-30.0.0.tgz#427b862696c65ea6f6a138a9221326519877555f" - integrity sha512-NID2VRyaEkevCRz6badhfqYwri/RvMbiHY81rk3AkK/LaiB0LSxi1RdVZ7MpZdTjNugtZeGfpL0mLs9Kp3MrQw== +"@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== dependencies: "@sinclair/typebox" "^0.34.0" -"@jest/schemas@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" - integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== - dependencies: - "@sinclair/typebox" "^0.27.8" - -"@jest/snapshot-utils@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/snapshot-utils/-/snapshot-utils-30.0.0.tgz#95c34aa1e59840c53b91695132022bfeeeee650e" - integrity sha512-C/QSFUmvZEYptg2Vin84FggAphwHvj6la39vkw1CNOZQORWZ7O/H0BXmdeeeGnvlXDYY8TlFM5jgFnxLAxpFjA== +"@jest/snapshot-utils@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/snapshot-utils/-/snapshot-utils-30.0.1.tgz#536108aa6b74858d758ae3b5229518c3d818bd68" + integrity sha512-6Dpv7vdtoRiISEFwYF8/c7LIvqXD7xDXtLPNzC2xqAfBznKip0MQM+rkseKwUPUpv2PJ7KW/YsnwWXrIL2xF+A== dependencies: - "@jest/types" "30.0.0" + "@jest/types" "30.0.1" chalk "^4.1.2" graceful-fs "^4.2.11" natural-compare "^1.4.0" -"@jest/source-map@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-30.0.0.tgz#f1318656f6ca2cab188c5860d8d7ccb2f9a0396c" - integrity sha512-oYBJ4d/NF4ZY3/7iq1VaeoERHRvlwKtrGClgescaXMIa1mmb+vfJd0xMgbW9yrI80IUA7qGbxpBWxlITrHkWoA== +"@jest/source-map@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-30.0.1.tgz#305ebec50468f13e658b3d5c26f85107a5620aaa" + integrity sha512-MIRWMUUR3sdbP36oyNyhbThLHyJ2eEDClPCiHVbrYAe5g3CHRArIVpBw7cdSB5fr+ofSfIb2Tnsw8iEHL0PYQg== dependencies: "@jridgewell/trace-mapping" "^0.3.25" callsites "^3.1.0" graceful-fs "^4.2.11" -"@jest/test-result@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-30.0.0.tgz#9a06e3b0f2024ace56a2989075c2c8938aae5297" - integrity sha512-685zco9HdgBaaWiB9T4xjLtBuN0Q795wgaQPpmuAeZPHwHZSoKFAUnozUtU+ongfi4l5VCz8AclOE5LAQdyjxQ== +"@jest/test-result@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-30.0.2.tgz#786849e33da6060381c508986fa7309ff855a367" + integrity sha512-KKMuBKkkZYP/GfHMhI+cH2/P3+taMZS3qnqqiPC1UXZTJskkCS+YU/ILCtw5anw1+YsTulDHFpDo70mmCedW8w== dependencies: - "@jest/console" "30.0.0" - "@jest/types" "30.0.0" + "@jest/console" "30.0.2" + "@jest/types" "30.0.1" "@types/istanbul-lib-coverage" "^2.0.6" collect-v8-coverage "^1.0.2" -"@jest/test-sequencer@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-30.0.0.tgz#7052c0c6d56580f9096b6c3d02834220df676340" - integrity sha512-Hmvv5Yg6UmghXIcVZIydkT0nAK7M/hlXx9WMHR5cLVwdmc14/qUQt3mC72T6GN0olPC6DhmKE6Cd/pHsgDbuqQ== +"@jest/test-sequencer@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-30.0.2.tgz#2693692d285b1c929ed353f7f0b7cbea51c57515" + integrity sha512-fbyU5HPka0rkalZ3MXVvq0hwZY8dx3Y6SCqR64zRmh+xXlDeFl0IdL4l9e7vp4gxEXTYHbwLFA1D+WW5CucaSw== dependencies: - "@jest/test-result" "30.0.0" + "@jest/test-result" "30.0.2" graceful-fs "^4.2.11" - jest-haste-map "30.0.0" + jest-haste-map "30.0.2" slash "^3.0.0" -"@jest/transform@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-30.0.0.tgz#62702f0d0030c361255b6d84c16fed9b91a1c331" - integrity sha512-8xhpsCGYJsUjqpJOgLyMkeOSSlhqggFZEWAnZquBsvATtueoEs7CkMRxOUmJliF3E5x+mXmZ7gEEsHank029Og== +"@jest/transform@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-30.0.2.tgz#62ba84fcc2389ab751e7ec923958c9b1163d90c3" + integrity sha512-kJIuhLMTxRF7sc0gPzPtCDib/V9KwW3I2U25b+lYCYMVqHHSrcZopS8J8H+znx9yixuFv+Iozl8raLt/4MoxrA== dependencies: "@babel/core" "^7.27.4" - "@jest/types" "30.0.0" + "@jest/types" "30.0.1" "@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.0" - jest-regex-util "30.0.0" - jest-util "30.0.0" + jest-haste-map "30.0.2" + jest-regex-util "30.0.1" + jest-util "30.0.2" micromatch "^4.0.8" pirates "^4.0.7" slash "^3.0.0" write-file-atomic "^5.0.1" -"@jest/types@30.0.0": - version "30.0.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-30.0.0.tgz#7afb1d34937f722f667b621eb9c653f0f8fda07e" - integrity sha512-1Nox8mAL52PKPfEnUQWBvKU/bp8FTT6AiDu76bFDEJj/qsRFSAVSldfCH3XYMqialti2zHXKvD5gN0AaHc0yKA== +"@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== dependencies: - "@jest/pattern" "30.0.0" - "@jest/schemas" "30.0.0" + "@jest/pattern" "30.0.1" + "@jest/schemas" "30.0.1" "@types/istanbul-lib-coverage" "^2.0.6" "@types/istanbul-reports" "^3.0.4" "@types/node" "*" "@types/yargs" "^17.0.33" chalk "^4.1.2" -"@jest/types@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" - integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== - dependencies: - "@jest/schemas" "^29.6.3" - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^17.0.8" - chalk "^4.0.0" - "@jridgewell/gen-mapping@^0.3.5": version "0.3.8" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz#4f0e06362e01362f823d348f1872b08f666d8142" @@ -1319,21 +1295,11 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@pkgr/core@^0.1.0": - version "0.1.2" - resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.2.tgz#1cf95080bb7072fafaa3cb13b442fab4695c3893" - integrity sha512-fdDH1LSGfZdTH2sxdpVMw31BanV28K/Gry0cVFxaNP77neJSkd82mM8ErPNYs9e+0O7SdHBLTDzDgwUuy18RnQ== - "@pkgr/core@^0.2.4": version "0.2.7" resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.7.tgz#eb5014dfd0b03e7f3ba2eeeff506eed89b028058" integrity sha512-YLT9Zo3oNPJoBjBc4q8G2mjU4tqIbf5CEOORbUUr48dCD9q3umJ3IPlVqOqDakPfd2HuwccBaqlGhN4Gmr5OWg== -"@sinclair/typebox@^0.27.8": - version "0.27.8" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" - integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== - "@sinclair/typebox@^0.34.0": version "0.34.33" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.34.33.tgz#10ab3f1261ed9e754660250fad3e69cca1fa44b2" @@ -1353,14 +1319,15 @@ dependencies: "@sinonjs/commons" "^3.0.1" -"@stylistic/eslint-plugin@^4.2.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-4.4.0.tgz#e1a3c9fd7109411d32dc0bcb575d2b4066fbbc63" - integrity sha512-bIh/d9X+OQLCAMdhHtps+frvyjvAM4B1YlSJzcEEhl7wXLIqPar3ngn9DrHhkBOrTA/z9J0bUMtctAspe0dxdQ== +"@stylistic/eslint-plugin@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-5.0.0.tgz#587a2d0ca80e3395ad16d8044a62d40119e1b4a7" + integrity sha512-nVV2FSzeTJ3oFKw+3t9gQYQcrgbopgCASSY27QOtkhEGgSfdQQjDmzZd41NeT1myQ8Wc6l+pZllST9qIu4NKzg== dependencies: - "@typescript-eslint/utils" "^8.32.1" - eslint-visitor-keys "^4.2.0" - espree "^10.3.0" + "@eslint-community/eslint-utils" "^4.7.0" + "@typescript-eslint/types" "^8.34.1" + eslint-visitor-keys "^4.2.1" + espree "^10.4.0" estraverse "^5.3.0" picomatch "^4.0.2" @@ -1425,10 +1392,10 @@ "@types/estree" "*" "@types/json-schema" "*" -"@types/estree@*", "@types/estree@^1.0.6": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.7.tgz#4158d3105276773d5b7695cd4834b1722e4f37a8" - integrity sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ== +"@types/estree@*", "@types/estree@^1.0.6", "@types/estree@^1.0.8": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" + integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== "@types/glob-to-regexp@^0.4.4": version "0.4.4" @@ -1442,7 +1409,7 @@ dependencies: "@types/node" "*" -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1", "@types/istanbul-lib-coverage@^2.0.6": +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.1", "@types/istanbul-lib-coverage@^2.0.6": version "2.0.6" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== @@ -1454,20 +1421,20 @@ dependencies: "@types/istanbul-lib-coverage" "*" -"@types/istanbul-reports@^3.0.0", "@types/istanbul-reports@^3.0.4": +"@types/istanbul-reports@^3.0.4": version "3.0.4" resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@^29.5.11": - version "29.5.14" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" - integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== +"@types/jest@^30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-30.0.0.tgz#5e85ae568006712e4ad66f25433e9bdac8801f1d" + integrity sha512-XTYugzhuwqWjws0CVz8QpM36+T+Dz5mTEBKhNs/esGLnCIlGdRy+Dq78NRjd7ls7r8BC8ZRMOrKlkO1hU0JOwA== dependencies: - expect "^29.0.0" - pretty-format "^29.0.0" + expect "^30.0.0" + pretty-format "^30.0.0" "@types/json-schema@*", "@types/json-schema@^7.0.15", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" @@ -1479,14 +1446,14 @@ resolved "https://registry.yarnpkg.com/@types/mime-types/-/mime-types-2.1.4.tgz#93a1933e24fed4fb9e4adc5963a63efcbb3317a2" integrity sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w== -"@types/node@*", "@types/node@^22.15.11": - version "22.15.29" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.29.tgz#c75999124a8224a3f79dd8b6ccfb37d74098f678" - integrity sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ== +"@types/node@*", "@types/node@^24.0.3": + version "24.0.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.3.tgz#f935910f3eece3a3a2f8be86b96ba833dc286cab" + integrity sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg== dependencies: - undici-types "~6.21.0" + undici-types "~7.8.0" -"@types/stack-utils@^2.0.0", "@types/stack-utils@^2.0.3": +"@types/stack-utils@^2.0.3": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== @@ -1503,49 +1470,49 @@ resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== -"@types/yargs@^17.0.33", "@types/yargs@^17.0.8": +"@types/yargs@^17.0.33": version "17.0.33" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/project-service@8.33.1": - version "8.33.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/project-service/-/project-service-8.33.1.tgz#c85e7d9a44d6a11fe64e73ac1ed47de55dc2bf9f" - integrity sha512-DZR0efeNklDIHHGRpMpR5gJITQpu6tLr9lDJnKdONTC7vvzOlLAG/wcfxcdxEWrbiZApcoBCzXqU/Z458Za5Iw== +"@typescript-eslint/project-service@8.34.1": + version "8.34.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/project-service/-/project-service-8.34.1.tgz#20501f8b87202c45f5e70a5b24dcdcb8fe12d460" + integrity sha512-nuHlOmFZfuRwLJKDGQOVc0xnQrAmuq1Mj/ISou5044y1ajGNp2BNliIqp7F2LPQ5sForz8lempMFCovfeS1XoA== dependencies: - "@typescript-eslint/tsconfig-utils" "^8.33.1" - "@typescript-eslint/types" "^8.33.1" + "@typescript-eslint/tsconfig-utils" "^8.34.1" + "@typescript-eslint/types" "^8.34.1" debug "^4.3.4" -"@typescript-eslint/scope-manager@8.33.1": - version "8.33.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.33.1.tgz#d1e0efb296da5097d054bc9972e69878a2afea73" - integrity sha512-dM4UBtgmzHR9bS0Rv09JST0RcHYearoEoo3pG5B6GoTR9XcyeqX87FEhPo+5kTvVfKCvfHaHrcgeJQc6mrDKrA== - dependencies: - "@typescript-eslint/types" "8.33.1" - "@typescript-eslint/visitor-keys" "8.33.1" - -"@typescript-eslint/tsconfig-utils@8.33.1", "@typescript-eslint/tsconfig-utils@^8.33.1": - version "8.33.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.33.1.tgz#7836afcc097a4657a5ed56670851a450d8b70ab8" - integrity sha512-STAQsGYbHCF0/e+ShUQ4EatXQ7ceh3fBCXkNU7/MZVKulrlq1usH7t2FhxvCpuCi5O5oi1vmVaAjrGeL71OK1g== - -"@typescript-eslint/types@8.33.1", "@typescript-eslint/types@^8.33.1": - version "8.33.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.33.1.tgz#b693111bc2180f8098b68e9958cf63761657a55f" - integrity sha512-xid1WfizGhy/TKMTwhtVOgalHwPtV8T32MS9MaH50Cwvz6x6YqRIPdD2WvW0XaqOzTV9p5xdLY0h/ZusU5Lokg== - -"@typescript-eslint/typescript-estree@8.33.1": - version "8.33.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.33.1.tgz#d271beed470bc915b8764e22365d4925c2ea265d" - integrity sha512-+s9LYcT8LWjdYWu7IWs7FvUxpQ/DGkdjZeE/GGulHvv8rvYwQvVaUZ6DE+j5x/prADUgSbbCWZ2nPI3usuVeOA== - dependencies: - "@typescript-eslint/project-service" "8.33.1" - "@typescript-eslint/tsconfig-utils" "8.33.1" - "@typescript-eslint/types" "8.33.1" - "@typescript-eslint/visitor-keys" "8.33.1" +"@typescript-eslint/scope-manager@8.34.1": + version "8.34.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.34.1.tgz#727ea43441f4d23d5c73d34195427d85042e5117" + integrity sha512-beu6o6QY4hJAgL1E8RaXNC071G4Kso2MGmJskCFQhRhg8VOH/FDbC8soP8NHN7e/Hdphwp8G8cE6OBzC8o41ZA== + dependencies: + "@typescript-eslint/types" "8.34.1" + "@typescript-eslint/visitor-keys" "8.34.1" + +"@typescript-eslint/tsconfig-utils@8.34.1", "@typescript-eslint/tsconfig-utils@^8.34.1": + version "8.34.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.34.1.tgz#d6abb1b1e9f1f1c83ac92051c8fbf2dbc4dc9f5e" + integrity sha512-K4Sjdo4/xF9NEeA2khOb7Y5nY6NSXBnod87uniVYW9kHP+hNlDV8trUSFeynA2uxWam4gIWgWoygPrv9VMWrYg== + +"@typescript-eslint/types@8.34.1", "@typescript-eslint/types@^8.34.1": + version "8.34.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.34.1.tgz#565a46a251580dae674dac5aafa8eb14b8322a35" + integrity sha512-rjLVbmE7HR18kDsjNIZQHxmv9RZwlgzavryL5Lnj2ujIRTeXlKtILHgRNmQ3j4daw7zd+mQgy+uyt6Zo6I0IGA== + +"@typescript-eslint/typescript-estree@8.34.1": + version "8.34.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.34.1.tgz#befdb042a6bc44fdad27429b2d3b679c80daad71" + integrity sha512-rjCNqqYPuMUF5ODD+hWBNmOitjBWghkGKJg6hiCHzUvXRy6rK22Jd3rwbP2Xi+R7oYVvIKhokHVhH41BxPV5mA== + dependencies: + "@typescript-eslint/project-service" "8.34.1" + "@typescript-eslint/tsconfig-utils" "8.34.1" + "@typescript-eslint/types" "8.34.1" + "@typescript-eslint/visitor-keys" "8.34.1" debug "^4.3.4" fast-glob "^3.3.2" is-glob "^4.0.3" @@ -1553,23 +1520,23 @@ semver "^7.6.0" ts-api-utils "^2.1.0" -"@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/utils@^8.26.1", "@typescript-eslint/utils@^8.32.1": - version "8.33.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.33.1.tgz#ea22f40d3553da090f928cf17907e963643d4b96" - integrity sha512-52HaBiEQUaRYqAXpfzWSR2U3gxk92Kw006+xZpElaPMg3C4PgM+A5LqwoQI1f9E5aZ/qlxAZxzm42WX+vn92SQ== +"@typescript-eslint/utils@^8.0.0", "@typescript-eslint/utils@^8.26.1": + version "8.34.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.34.1.tgz#f98c9b0c5cae407e34f5131cac0f3a74347a398e" + integrity sha512-mqOwUdZ3KjtGk7xJJnLbHxTuWVn3GO2WZZuM+Slhkun4+qthLdXx32C8xIXbO1kfCECb3jIs3eoxK3eryk7aoQ== dependencies: "@eslint-community/eslint-utils" "^4.7.0" - "@typescript-eslint/scope-manager" "8.33.1" - "@typescript-eslint/types" "8.33.1" - "@typescript-eslint/typescript-estree" "8.33.1" + "@typescript-eslint/scope-manager" "8.34.1" + "@typescript-eslint/types" "8.34.1" + "@typescript-eslint/typescript-estree" "8.34.1" -"@typescript-eslint/visitor-keys@8.33.1": - version "8.33.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.33.1.tgz#6c6e002c24d13211df3df851767f24dfdb4f42bc" - integrity sha512-3i8NrFcZeeDHJ+7ZUuDkGT+UHq+XoFGsymNK2jZCOHcfEzRQ0BdpRtdpSx/Iyf3MHLWIcLS0COuOPibKQboIiQ== +"@typescript-eslint/visitor-keys@8.34.1": + version "8.34.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.34.1.tgz#28a1987ea3542ccafb92aa792726a304b39531cf" + integrity sha512-xoh5rJ+tgsRKoXnkBPFRLZ7rjKM0AfVbC68UZ/ECXoDbfggb9RbEySN359acY1vS3qZ0jVTVWzbtfapwm5ztxw== dependencies: - "@typescript-eslint/types" "8.33.1" - eslint-visitor-keys "^4.2.0" + "@typescript-eslint/types" "8.34.1" + eslint-visitor-keys "^4.2.1" "@ungap/structured-clone@^1.3.0": version "1.3.0" @@ -1846,10 +1813,10 @@ acorn@^7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.14.0: - version "8.14.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.1.tgz#721d5dc10f7d5b5609a891773d47731796935dfb" - integrity sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg== +acorn@^8.14.0, acorn@^8.15.0: + version "8.15.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" + integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== agent-base@^7.1.0, agent-base@^7.1.2: version "7.1.3" @@ -1939,7 +1906,7 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" -ansi-styles@^5.0.0, ansi-styles@^5.2.0: +ansi-styles@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== @@ -2033,15 +2000,15 @@ axios@^1.4.0: form-data "^4.0.0" proxy-from-env "^1.1.0" -babel-jest@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-30.0.0.tgz#485050f0a0dcfc8859ef3ab5092a8c0bcbd6f33f" - integrity sha512-JQ0DhdFjODbSawDf0026uZuwaqfKkQzk+9mwWkq2XkKFIaMhFVOxlVmbFCOnnC76jATdxrff3IiUAvOAJec6tw== +babel-jest@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-30.0.2.tgz#f627dc5afc3bd5795fc84735b4f1d74f9d4b8e91" + integrity sha512-A5kqR1/EUTidM2YC2YMEUDP2+19ppgOwK0IAd9Swc3q2KqFb5f9PtRUXVeZcngu0z5mDMyZ9zH2huJZSOMLiTQ== dependencies: - "@jest/transform" "30.0.0" + "@jest/transform" "30.0.2" "@types/babel__core" "^7.20.5" babel-plugin-istanbul "^7.0.0" - babel-preset-jest "30.0.0" + babel-preset-jest "30.0.1" chalk "^4.1.2" graceful-fs "^4.2.11" slash "^3.0.0" @@ -2064,10 +2031,10 @@ babel-plugin-istanbul@^7.0.0: istanbul-lib-instrument "^6.0.2" test-exclude "^6.0.0" -babel-plugin-jest-hoist@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-30.0.0.tgz#76c9bf58316ebb7026d671d71d26138ae415326b" - integrity sha512-DSRm+US/FCB4xPDD6Rnslb6PAF9Bej1DZ+1u4aTiqJnk7ZX12eHsnDiIOqjGvITCq+u6wLqUhgS+faCNbVY8+g== +babel-plugin-jest-hoist@30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-30.0.1.tgz#f271b2066d2c1fb26a863adb8e13f85b06247125" + integrity sha512-zTPME3pI50NsFW8ZBaVIOeAxzEY7XHlmWeXXu9srI+9kNfzCUTy8MFan46xOGZY8NZThMqq+e3qZUKsvXbasnQ== dependencies: "@babel/template" "^7.27.2" "@babel/types" "^7.27.3" @@ -2094,12 +2061,12 @@ babel-preset-current-node-syntax@^1.1.0: "@babel/plugin-syntax-private-property-in-object" "^7.14.5" "@babel/plugin-syntax-top-level-await" "^7.14.5" -babel-preset-jest@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-30.0.0.tgz#54b16c96c1b687b9c72baa37a00b01fe9be4c4f3" - integrity sha512-hgEuu/W7gk8QOWUA9+m3Zk+WpGvKc1Egp6rFQEfYxEoM9Fk/q8nuTXNL65OkhwGrTApauEGgakOoWVXj+UfhKw== +babel-preset-jest@30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-30.0.1.tgz#7d28db9531bce264e846c8483d54236244b8ae88" + integrity sha512-+YHejD5iTWI46cZmcc/YtX4gaKBtdqCHCVfuVinizVpbmyjO3zYmeuyFdfA8duRqQZfgCAMlsfmkVbJ+e2MAJw== dependencies: - babel-plugin-jest-hoist "30.0.0" + babel-plugin-jest-hoist "30.0.1" babel-preset-current-node-syntax "^1.1.0" babel-walk@3.0.0-canary-5: @@ -2318,11 +2285,6 @@ 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@^3.2.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" - integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== - ci-info@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.2.0.tgz#cbd21386152ebfe1d56f280a3b5feccbd96764c7" @@ -2469,11 +2431,6 @@ commander@^12.1.0: resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== -commander@^13.1.0: - version "13.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-13.1.0.tgz#776167db68c78f38dcce1f9b8d7b8b9a488abf46" - integrity sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw== - commander@^14.0.0: version "14.0.0" resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.0.tgz#f244fc74a92343514e56229f16ef5c5e22ced5e9" @@ -2542,10 +2499,10 @@ core-js-compat@^3.41.0: dependencies: browserslist "^4.24.4" -core-js@^3.6.5: - version "3.42.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.42.0.tgz#edbe91f78ac8cfb6df8d997e74d368a68082fe37" - integrity sha512-Sz4PP4ZA+Rq4II21qkNqOEDTDrCvcANId3xpIgB34NDkWc3UduWj2dqEtN9yZIq8Dk3HyPI33x9sqqU5C8sr0g== +core-js@^3.43.0: + version "3.43.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.43.0.tgz#f7258b156523208167df35dea0cfd6b6ecd4ee88" + integrity sha512-N6wEbTTZSYOY2rYAn85CuvWWkCK6QweMn7/4Nr3w+gDBeBhk/x4EJeY6FPo4QzDoJZxVTv8U7CMvgWk6pOHHqA== core-util-is@^1.0.3: version "1.0.3" @@ -2578,79 +2535,79 @@ crypto-random-string@^4.0.0: dependencies: type-fest "^1.0.1" -cspell-config-lib@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/cspell-config-lib/-/cspell-config-lib-9.0.1.tgz#ec00b2bf75d88507cc3e9b6e26d6a6ed0f6194f5" - integrity sha512-hbeyU6cY4NPKh69L4QpBZgGz00f7rLk10xPlCo6MxEmCqSOTuXXvDEUR51d2ED69G+GyFAeZi5VU9IdJ4jhvzQ== +cspell-config-lib@9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/cspell-config-lib/-/cspell-config-lib-9.1.1.tgz#158cfe73f027af261d75ff4b2dec08176e945b93" + integrity sha512-fi/ohH5mIeba416Jl0DREm+A4QssC3OCY8wjze7hAZ9lOzFuuBmyjoo5OD/J48stkCt1pf2TIAAU3up5o/oaBw== dependencies: - "@cspell/cspell-types" "9.0.1" + "@cspell/cspell-types" "9.1.1" comment-json "^4.2.5" - yaml "^2.7.1" + yaml "^2.8.0" -cspell-dictionary@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/cspell-dictionary/-/cspell-dictionary-9.0.1.tgz#de6c70c509a863f667cb21bb75f6f41332fe1e81" - integrity sha512-I9gjRpfV4djxN0i2p9OzWIrkjtUaGUyVE9atvRbkHUMeqDUhC2Qt0Mb9tnF8I7qnHeZt+U44vUa9Dg7yrJ+k4Q== +cspell-dictionary@9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/cspell-dictionary/-/cspell-dictionary-9.1.1.tgz#c66b85f310a07ce8acb1db9d9b0e6a992a2379c8" + integrity sha512-VobPhTE/+hMsI5qppKsuljdDkG23av16bNRBR0hA0O/pG07SXZ6nzwWIwdPoKSjiWSGTmmCGXv45W0sn20ahbA== dependencies: - "@cspell/cspell-pipe" "9.0.1" - "@cspell/cspell-types" "9.0.1" - cspell-trie-lib "9.0.1" + "@cspell/cspell-pipe" "9.1.1" + "@cspell/cspell-types" "9.1.1" + cspell-trie-lib "9.1.1" fast-equals "^5.2.2" -cspell-gitignore@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/cspell-gitignore/-/cspell-gitignore-9.0.1.tgz#ae7f74a876d621542fcca6a2216bd74cb1738c40" - integrity sha512-xjgOmeGbHEaeF0erRQ2QXwqxWqGDiI4mu+NjCL7ZHPoAM5y8PEO6IbxVNabIB1xC4QAborbtEQ/8ydDWLJcPoQ== +cspell-gitignore@9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/cspell-gitignore/-/cspell-gitignore-9.1.1.tgz#06897f573b147473604e26babb965bb4c5556a1c" + integrity sha512-8gx61lyxdAMLulL7Mtb10jOBzL/e3rU34YW0kaTT3LkHBb/LGapmOFKRiJyt2bA/UA6kJkR/wPLmsjUfRJwOmA== dependencies: - "@cspell/url" "9.0.1" - cspell-glob "9.0.1" - cspell-io "9.0.1" + "@cspell/url" "9.1.1" + cspell-glob "9.1.1" + cspell-io "9.1.1" -cspell-glob@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/cspell-glob/-/cspell-glob-9.0.1.tgz#0249ba4a0a41cac8454678df84300e36a28cc5b1" - integrity sha512-dQU/ln6J9Qe31zk1cLJnq/WNAjRrTUig1GG8WA2oK1jHZKY9VbyJLb5DUFnDUx35cI0jdOEnGSCWi8qNjHSc1Q== +cspell-glob@9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/cspell-glob/-/cspell-glob-9.1.1.tgz#405f2ac101e8804911de6cddb0bb73ddee2b70b7" + integrity sha512-f274mlln/QG/wj12xF/SnvfdUAx0pGjIxnNOYGwRXS1MbaH0B4F9pkhkMqY0GwqAsvPxT6NzJybAoivS4Icvzg== dependencies: - "@cspell/url" "9.0.1" + "@cspell/url" "9.1.1" picomatch "^4.0.2" -cspell-grammar@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/cspell-grammar/-/cspell-grammar-9.0.1.tgz#84509e77210106f6fa025691dd2e2a6a38791760" - integrity sha512-FZ1z1p3pslfotZT/W/VRZjB4S+z0ETrTbNmQ5pGmhdY0nm7Slmg+8nIJluLEjBneBGTJIOcLjYykwS2vI6jzxw== - dependencies: - "@cspell/cspell-pipe" "9.0.1" - "@cspell/cspell-types" "9.0.1" - -cspell-io@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/cspell-io/-/cspell-io-9.0.1.tgz#1c4a6071f734df070039c0d057a75cd8333886a3" - integrity sha512-L5fZY0glVeQb6nmt1WL1wKzZzoHJUkBQ9BGCrwqSXIrjZrYmBNSKixCjo6o9n2keRUwpNjsvZj1TQDKDV+FsXA== - dependencies: - "@cspell/cspell-service-bus" "9.0.1" - "@cspell/url" "9.0.1" - -cspell-lib@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-9.0.1.tgz#1cc10f485cfe976c5091999278c4c37f548b67e9" - integrity sha512-F4vJG6GmAGVAuhgcepO12UtG7yev7Rcfa31MLIyYNTrd5NeORzM+GTHnL970FlEflwYPYjcSTGwkyowQ+ZbmDg== - dependencies: - "@cspell/cspell-bundled-dicts" "9.0.1" - "@cspell/cspell-pipe" "9.0.1" - "@cspell/cspell-resolver" "9.0.1" - "@cspell/cspell-types" "9.0.1" - "@cspell/dynamic-import" "9.0.1" - "@cspell/filetypes" "9.0.1" - "@cspell/strong-weak-map" "9.0.1" - "@cspell/url" "9.0.1" +cspell-grammar@9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/cspell-grammar/-/cspell-grammar-9.1.1.tgz#1cd68a6fe67c518f0cb2fa736db6aead4626278d" + integrity sha512-IBOOzmj1z4IWHSis6iGZNbE0syEiT0Rz4NbbHwscCMc30jgbotupscn6T8PhqmDwmlXCW81C4vGSMzqQh0UaLQ== + dependencies: + "@cspell/cspell-pipe" "9.1.1" + "@cspell/cspell-types" "9.1.1" + +cspell-io@9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/cspell-io/-/cspell-io-9.1.1.tgz#90ca484f2a870fa60ca98a359e33e75dba94f72c" + integrity sha512-LMzoBvbWqVokrkrnLrdnCzX8Sf77Q42nvj7Q36G4sqZaB3Lr/ih+iZ4t5l90Wlsnst5flrQmIy0YNtndAWzp2A== + dependencies: + "@cspell/cspell-service-bus" "9.1.1" + "@cspell/url" "9.1.1" + +cspell-lib@9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-9.1.1.tgz#37ff80af031c4550aa4951a3b079a2367a8e3a0e" + integrity sha512-On2m0/UFtsKenEHTfvNA5EoKI5YcnOzgGQF3yX4CllvtGQXCewB5U1TBCqTR/0wckw5q94iqZJDF2oY3GBGBAg== + dependencies: + "@cspell/cspell-bundled-dicts" "9.1.1" + "@cspell/cspell-pipe" "9.1.1" + "@cspell/cspell-resolver" "9.1.1" + "@cspell/cspell-types" "9.1.1" + "@cspell/dynamic-import" "9.1.1" + "@cspell/filetypes" "9.1.1" + "@cspell/strong-weak-map" "9.1.1" + "@cspell/url" "9.1.1" clear-module "^4.1.2" comment-json "^4.2.5" - cspell-config-lib "9.0.1" - cspell-dictionary "9.0.1" - cspell-glob "9.0.1" - cspell-grammar "9.0.1" - cspell-io "9.0.1" - cspell-trie-lib "9.0.1" + cspell-config-lib "9.1.1" + cspell-dictionary "9.1.1" + cspell-glob "9.1.1" + cspell-grammar "9.1.1" + cspell-io "9.1.1" + cspell-trie-lib "9.1.1" env-paths "^3.0.0" fast-equals "^5.2.2" gensequence "^7.0.0" @@ -2660,37 +2617,38 @@ cspell-lib@9.0.1: vscode-uri "^3.1.0" xdg-basedir "^5.1.0" -cspell-trie-lib@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-9.0.1.tgz#219acb8e6d249504a1fd4026df9c50871cad05a7" - integrity sha512-gIupiHwLdsQun79biJgiqmXffKUGzFjGLFEeVptI2Zy5Oa3XhRJsHap4PyeleErONkpzxMG1tgpOWzhOqwl65Q== +cspell-trie-lib@9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-9.1.1.tgz#da3ffd2574afdcb1643a28994bfe9370d6815496" + integrity sha512-eULMGTTbvmuOWpAM34wodpbAM3dXscLL26WOn9/9uyQJ36dZ0u8B+ctrYf17Ij/wcpGzLqwTNspJN2fkbiXkBQ== dependencies: - "@cspell/cspell-pipe" "9.0.1" - "@cspell/cspell-types" "9.0.1" + "@cspell/cspell-pipe" "9.1.1" + "@cspell/cspell-types" "9.1.1" gensequence "^7.0.0" -cspell@^9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/cspell/-/cspell-9.0.1.tgz#f279181887fb79961f588eab93af69be703f1918" - integrity sha512-AJqsX+3eSTz9GmIuyEZUzCCTbvCPw6+Nv7UYa4PCn7vNV3XEb5LHTp5i9y2i65fNaeNEcQXLrLYoY/JcBFmUSQ== - dependencies: - "@cspell/cspell-json-reporter" "9.0.1" - "@cspell/cspell-pipe" "9.0.1" - "@cspell/cspell-types" "9.0.1" - "@cspell/dynamic-import" "9.0.1" - "@cspell/url" "9.0.1" +cspell@^9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/cspell/-/cspell-9.1.1.tgz#11feb3cc26f7f5fcfefd374a824018b0e6a295af" + integrity sha512-srPIS39EzbgRLncBIbsJy3GzYWxrSm0mbXj24XLxZgVBjMps+/uxpVo0aXEFy4JClUSNBoYxhCb+vSHZUoqu3w== + dependencies: + "@cspell/cspell-json-reporter" "9.1.1" + "@cspell/cspell-pipe" "9.1.1" + "@cspell/cspell-types" "9.1.1" + "@cspell/dynamic-import" "9.1.1" + "@cspell/url" "9.1.1" chalk "^5.4.1" chalk-template "^1.1.0" - commander "^13.1.0" - cspell-dictionary "9.0.1" - cspell-gitignore "9.0.1" - cspell-glob "9.0.1" - cspell-io "9.0.1" - cspell-lib "9.0.1" + commander "^14.0.0" + cspell-config-lib "9.1.1" + cspell-dictionary "9.1.1" + cspell-gitignore "9.1.1" + cspell-glob "9.1.1" + cspell-io "9.1.1" + cspell-lib "9.1.1" fast-json-stable-stringify "^2.1.0" file-entry-cache "^9.1.0" - semver "^7.7.1" - tinyglobby "^0.2.13" + semver "^7.7.2" + tinyglobby "^0.2.14" css-loader@^7.1.2: version "7.1.2" @@ -2729,7 +2687,7 @@ date-fns@^4.0.0: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-4.1.0.tgz#64b3d83fff5aa80438f5b1a633c2e83b8a1c2d14" integrity sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg== -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5, debug@^4.3.6, debug@^4.4.1: +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.4.0, debug@^4.4.1: version "4.4.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== @@ -2791,11 +2749,6 @@ detect-newline@^3.1.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -diff-sequences@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" - integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== - doctypes@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/doctypes/-/doctypes-1.1.0.tgz#ea80b106a87538774e8a3a4a5afe293de489e0a9" @@ -2852,10 +2805,10 @@ encoding@^0.1.13: dependencies: iconv-lite "^0.6.2" -enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.1: - version "5.18.1" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.18.1.tgz#728ab082f8b7b6836de51f1637aab5d3b9568faf" - integrity sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg== +enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.1, enhanced-resolve@^5.17.2: + version "5.18.2" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.18.2.tgz#7903c5b32ffd4b2143eeb4b92472bd68effd5464" + integrity sha512-6Jw4sE1maoRJo3q8MsSIn2onJFbLTOjY9hlx4DZXmOKvLRd1Ok2kXmAGXaafL2+ijsJZ1ClYbl/pmqr9+k4iUQ== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -2909,7 +2862,7 @@ es-errors@^1.3.0: resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== -es-module-lexer@^1.2.1, es-module-lexer@^1.5.3: +es-module-lexer@^1.2.1: version "1.7.0" resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.7.0.tgz#9159601561880a85f2734560a9099b2c31e5372a" integrity sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA== @@ -3031,34 +2984,33 @@ eslint-plugin-es-x@^7.8.0: "@eslint-community/regexpp" "^4.11.0" eslint-compat-utils "^0.5.1" -eslint-plugin-jest@^28.6.0: - version "28.12.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-28.12.0.tgz#cf0200ae1421acffe7f263d1eaf65912eb9addd9" - integrity sha512-J6zmDp8WiQ9tyvYXE+3RFy7/+l4hraWLzmsabYXyehkmmDd36qV4VQFc7XzcsD8C1PTNt646MSx25bO1mdd9Yw== +eslint-plugin-jest@^29.0.1: + version "29.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-29.0.1.tgz#0f72a81349409d20742208260c9a6cb9efed4df5" + integrity sha512-EE44T0OSMCeXhDrrdsbKAhprobKkPtJTbQz5yEktysNpHeDZTAL1SfDTNKmcFfJkY6yrQLtTKZALrD3j/Gpmiw== dependencies: - "@typescript-eslint/utils" "^6.0.0 || ^7.0.0 || ^8.0.0" + "@typescript-eslint/utils" "^8.0.0" -eslint-plugin-jsdoc@^50.6.3: - version "50.6.9" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.6.9.tgz#b4afc06110958b9c525456b6c4348bf14e21c298" - integrity sha512-7/nHu3FWD4QRG8tCVqcv+BfFtctUtEDWc29oeDXB4bwmDM2/r1ndl14AG/2DUntdqH7qmpvdemJKwb3R97/QEw== +eslint-plugin-jsdoc@^51.2.2: + version "51.2.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-51.2.2.tgz#bbae4e07c218ec6e7b36b6385a2c86a8a05ad0f8" + integrity sha512-5e3VGUk3rvZ6ZuxJr5fCTVMj7TrMC80F1GbymjyUkplCbj6dXW41qX3ZzF8YULXM74cBfjnWy/nSp/I0eLl3vg== dependencies: - "@es-joy/jsdoccomment" "~0.49.0" + "@es-joy/jsdoccomment" "~0.52.0" are-docs-informative "^0.0.2" comment-parser "1.4.1" - debug "^4.3.6" + debug "^4.4.1" escape-string-regexp "^4.0.0" - espree "^10.1.0" + espree "^10.4.0" esquery "^1.6.0" - parse-imports "^2.1.1" - semver "^7.6.3" + parse-imports-exports "^0.2.4" + semver "^7.7.2" spdx-expression-parse "^4.0.0" - synckit "^0.9.1" -eslint-plugin-n@^17.16.2: - version "17.19.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-17.19.0.tgz#3c198306c2eb9ea950c7458cff9c9a6426d02c58" - integrity sha512-qxn1NaDHtizbhVAPpbMT8wWFaLtPnwhfN/e+chdu2i6Vgzmo/tGM62tcJ1Hf7J5Ie4dhse3DOPMmDxduzfifzw== +eslint-plugin-n@^17.20.0: + version "17.20.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-17.20.0.tgz#000a7a39675d737824d704ae77b626c257b318ef" + integrity sha512-IRSoatgB/NQJZG5EeTbv/iAx1byOGdbbyhQrNvWdCfTnmPxUT0ao9/eGOeG7ljD8wJBsxwE8f6tES5Db0FRKEw== dependencies: "@eslint-community/eslint-utils" "^4.5.0" "@typescript-eslint/utils" "^8.26.1" @@ -3071,10 +3023,10 @@ eslint-plugin-n@^17.16.2: semver "^7.6.3" ts-declaration-location "^1.0.6" -eslint-plugin-prettier@^5.1.3: - version "5.4.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.4.1.tgz#99b55d7dd70047886b2222fdd853665f180b36af" - integrity sha512-9dF+KuU/Ilkq27A8idRP7N2DH8iUR6qXcjF3FR2wETY21PZdBrIjwCau8oboyGj9b7etWmTGEeM8e7oOed6ZWg== +eslint-plugin-prettier@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.0.tgz#cf763962f90bad035db03ca008ffb0c9b359fb16" + integrity sha512-8qsOYwkkGrahrgoUv76NZi23koqXOGiiEzXMrT8Q7VcYaUISR+5MorIUxfWqYXN0fN/31WbSrxCxFkVQ43wwrA== dependencies: prettier-linter-helpers "^1.0.0" synckit "^0.11.7" @@ -3110,10 +3062,10 @@ eslint-scope@5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^8.3.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.3.0.tgz#10cd3a918ffdd722f5f3f7b5b83db9b23c87340d" - integrity sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ== +eslint-scope@^8.4.0: + version "8.4.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.4.0.tgz#88e646a207fad61436ffa39eb505147200655c82" + integrity sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -3123,23 +3075,23 @@ eslint-visitor-keys@^3.4.3: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint-visitor-keys@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz#687bacb2af884fcdda8a6e7d65c606f46a14cd45" - integrity sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw== +eslint-visitor-keys@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz#4cfea60fe7dd0ad8e816e1ed026c1d5251b512c1" + integrity sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ== -eslint@^9.21.0: - version "9.28.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.28.0.tgz#b0bcbe82a16945a40906924bea75e8b4980ced7d" - integrity sha512-ocgh41VhRlf9+fVpe7QKzwLj9c92fDiqOj8Y3Sd4/ZmVA4Btx4PlUYPq4pp9JDyupkf1upbEXecxL2mwNV7jPQ== +eslint@^9.29.0: + version "9.29.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.29.0.tgz#65e3db3b7e5a5b04a8af541741a0f3648d0a81a6" + integrity sha512-GsGizj2Y1rCWDu6XoEekL3RLilp0voSePurjZIkxL3wlm5o5EC9VpgaP7lrCvjnkuLvzFBQWB3vWB3K5KQTveQ== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.12.1" - "@eslint/config-array" "^0.20.0" + "@eslint/config-array" "^0.20.1" "@eslint/config-helpers" "^0.2.1" "@eslint/core" "^0.14.0" "@eslint/eslintrc" "^3.3.1" - "@eslint/js" "9.28.0" + "@eslint/js" "9.29.0" "@eslint/plugin-kit" "^0.3.1" "@humanfs/node" "^0.16.6" "@humanwhocodes/module-importer" "^1.0.1" @@ -3151,9 +3103,9 @@ eslint@^9.21.0: cross-spawn "^7.0.6" debug "^4.3.2" escape-string-regexp "^4.0.0" - eslint-scope "^8.3.0" - eslint-visitor-keys "^4.2.0" - espree "^10.3.0" + eslint-scope "^8.4.0" + eslint-visitor-keys "^4.2.1" + espree "^10.4.0" esquery "^1.5.0" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -3179,14 +3131,14 @@ esniff@^2.0.1: event-emitter "^0.3.5" type "^2.7.2" -espree@^10.0.1, espree@^10.1.0, espree@^10.3.0: - version "10.3.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-10.3.0.tgz#29267cf5b0cb98735b65e64ba07e0ed49d1eed8a" - integrity sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg== +espree@^10.0.1, espree@^10.4.0: + version "10.4.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-10.4.0.tgz#d54f4949d4629005a1fa168d937c3ff1f7e2a837" + integrity sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ== dependencies: - acorn "^8.14.0" + acorn "^8.15.0" acorn-jsx "^5.3.2" - eslint-visitor-keys "^4.2.0" + eslint-visitor-keys "^4.2.1" esprima@2.7.x, esprima@^2.7.1: version "2.7.3" @@ -3275,28 +3227,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.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-30.0.0.tgz#460dfda282e0a8de8302aabee951dba7e79a5a53" - integrity sha512-xCdPp6gwiR9q9lsPCHANarIkFTN/IMZso6Kkq03sOm9IIGtzK/UJqml0dkhHibGh8HKOj8BIDIpZ0BZuU7QK6w== - dependencies: - "@jest/expect-utils" "30.0.0" - "@jest/get-type" "30.0.0" - jest-matcher-utils "30.0.0" - jest-message-util "30.0.0" - jest-mock "30.0.0" - jest-util "30.0.0" - -expect@^29.0.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" - integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== - dependencies: - "@jest/expect-utils" "^29.7.0" - jest-get-type "^29.6.3" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" +expect@30.0.2, expect@^30.0.0: + version "30.0.2" + resolved "https://registry.yarnpkg.com/expect/-/expect-30.0.2.tgz#d073942c19d54cb7bc42c9b2a434d850433a7def" + integrity sha512-YN9Mgv2mtTWXVmifQq3QT+ixCL/uLuLJw+fdp8MOjKqu8K3XQh3o5aulMM1tn+O2DdrWNxLZTeJsCY/VofUA0A== + dependencies: + "@jest/expect-utils" "30.0.2" + "@jest/get-type" "30.0.1" + jest-matcher-utils "30.0.2" + jest-message-util "30.0.2" + jest-mock "30.0.2" + jest-util "30.0.2" exponential-backoff@^3.1.1: version "3.1.2" @@ -3719,7 +3660,7 @@ gopd@^1.2.0: resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== -graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: +graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -4164,156 +4105,141 @@ jackspeak@^3.1.2: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" -jest-changed-files@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-30.0.0.tgz#2993fc97acdf701b286310bf672a88a797b57e64" - integrity sha512-rzGpvCdPdEV1Ma83c1GbZif0L2KAm3vXSXGRlpx7yCt0vhruwCNouKNRh3SiVcISHP1mb3iJzjb7tAEnNu1laQ== +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== dependencies: execa "^5.1.1" - jest-util "30.0.0" + jest-util "30.0.2" p-limit "^3.1.0" -jest-circus@30.0.0, jest-circus@^30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-30.0.0.tgz#f5d32ef11dcef9beba7ee78f32dd2c82b5f51097" - integrity sha512-nTwah78qcKVyndBS650hAkaEmwWGaVsMMoWdJwMnH77XArRJow2Ir7hc+8p/mATtxVZuM9OTkA/3hQocRIK5Dw== +jest-circus@30.0.2, jest-circus@^30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-30.0.2.tgz#a00a408d5d32d2b547f20f9e84a487d236ed8ee1" + integrity sha512-NRozwx4DaFHcCUtwdEd/0jBLL1imyMrCbla3vF//wdsB2g6jIicMbjx9VhqE/BYU4dwsOQld+06ODX0oZ9xOLg== dependencies: - "@jest/environment" "30.0.0" - "@jest/expect" "30.0.0" - "@jest/test-result" "30.0.0" - "@jest/types" "30.0.0" + "@jest/environment" "30.0.2" + "@jest/expect" "30.0.2" + "@jest/test-result" "30.0.2" + "@jest/types" "30.0.1" "@types/node" "*" chalk "^4.1.2" co "^4.6.0" dedent "^1.6.0" is-generator-fn "^2.1.0" - jest-each "30.0.0" - jest-matcher-utils "30.0.0" - jest-message-util "30.0.0" - jest-runtime "30.0.0" - jest-snapshot "30.0.0" - jest-util "30.0.0" + jest-each "30.0.2" + jest-matcher-utils "30.0.2" + jest-message-util "30.0.2" + jest-runtime "30.0.2" + jest-snapshot "30.0.2" + jest-util "30.0.2" p-limit "^3.1.0" - pretty-format "30.0.0" + pretty-format "30.0.2" pure-rand "^7.0.0" slash "^3.0.0" stack-utils "^2.0.6" -jest-cli@30.0.0, jest-cli@^30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-30.0.0.tgz#d689f093e6019bd86e76407b431fae2f8beb85fe" - integrity sha512-fWKAgrhlwVVCfeizsmIrPRTBYTzO82WSba3gJniZNR3PKXADgdC0mmCSK+M+t7N8RCXOVfY6kvCkvjUNtzmHYQ== +jest-cli@30.0.2, jest-cli@^30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-30.0.2.tgz#cf8ad8a1157721c3a1dc3a371565f6b7f5e6b549" + integrity sha512-yQ6Qz747oUbMYLNAqOlEby+hwXx7WEJtCl0iolBRpJhr2uvkBgiVMrvuKirBc8utwQBnkETFlDUkYifbRpmBrQ== dependencies: - "@jest/core" "30.0.0" - "@jest/test-result" "30.0.0" - "@jest/types" "30.0.0" + "@jest/core" "30.0.2" + "@jest/test-result" "30.0.2" + "@jest/types" "30.0.1" chalk "^4.1.2" exit-x "^0.2.2" import-local "^3.2.0" - jest-config "30.0.0" - jest-util "30.0.0" - jest-validate "30.0.0" + jest-config "30.0.2" + jest-util "30.0.2" + jest-validate "30.0.2" yargs "^17.7.2" -jest-config@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-30.0.0.tgz#77387de024f5a1b456be844f80a1390e8ef19699" - integrity sha512-p13a/zun+sbOMrBnTEUdq/5N7bZMOGd1yMfqtAJniPNuzURMay4I+vxZLK1XSDbjvIhmeVdG8h8RznqYyjctyg== +jest-config@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-30.0.2.tgz#a4884ba3b4d31fb0599b0b78e7a0204efb126f9d" + integrity sha512-vo0fVq+uzDcXETFVnCUyr5HaUCM8ES6DEuS9AFpma34BVXMRRNlsqDyiW5RDHaEFoeFlJHoI4Xjh/WSYIAL58g== dependencies: "@babel/core" "^7.27.4" - "@jest/get-type" "30.0.0" - "@jest/pattern" "30.0.0" - "@jest/test-sequencer" "30.0.0" - "@jest/types" "30.0.0" - babel-jest "30.0.0" + "@jest/get-type" "30.0.1" + "@jest/pattern" "30.0.1" + "@jest/test-sequencer" "30.0.2" + "@jest/types" "30.0.1" + babel-jest "30.0.2" 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.0" - jest-docblock "30.0.0" - jest-environment-node "30.0.0" - jest-regex-util "30.0.0" - jest-resolve "30.0.0" - jest-runner "30.0.0" - jest-util "30.0.0" - jest-validate "30.0.0" + jest-circus "30.0.2" + jest-docblock "30.0.1" + jest-environment-node "30.0.2" + jest-regex-util "30.0.1" + jest-resolve "30.0.2" + jest-runner "30.0.2" + jest-util "30.0.2" + jest-validate "30.0.2" micromatch "^4.0.8" parse-json "^5.2.0" - pretty-format "30.0.0" + pretty-format "30.0.2" slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@30.0.0, jest-diff@^30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.0.0.tgz#d3d4f75e257e3c2cb8729438fe9cec66098f6176" - integrity sha512-TgT1+KipV8JTLXXeFX0qSvIJR/UXiNNojjxb/awh3vYlBZyChU/NEmyKmq+wijKjWEztyrGJFL790nqMqNjTHA== +jest-diff@30.0.2, jest-diff@^30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.0.2.tgz#db77e7ca48a964337c0a4259d5e389c0bb124d7e" + integrity sha512-2UjrNvDJDn/oHFpPrUTVmvYYDNeNtw2DlY3er8bI6vJJb9Fb35ycp/jFLd5RdV59tJ8ekVXX3o/nwPcscgXZJQ== dependencies: - "@jest/diff-sequences" "30.0.0" - "@jest/get-type" "30.0.0" + "@jest/diff-sequences" "30.0.1" + "@jest/get-type" "30.0.1" chalk "^4.1.2" - pretty-format "30.0.0" + pretty-format "30.0.2" -jest-diff@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" - integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== - dependencies: - chalk "^4.0.0" - diff-sequences "^29.6.3" - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-docblock@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-30.0.0.tgz#1650e0ded4fa92ff1adeda2050641705b6b300db" - integrity sha512-By/iQ0nvTzghEecGzUMCp1axLtBh+8wB4Hpoi5o+x1stycjEmPcH1mHugL4D9Q+YKV++vKeX/3ZTW90QC8ICPg== +jest-docblock@30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-30.0.1.tgz#545ff59f2fa88996bd470dba7d3798a8421180b1" + integrity sha512-/vF78qn3DYphAaIc3jy4gA7XSAz167n9Bm/wn/1XhTLW7tTBIzXtCJpb/vcmc73NIIeeohCbdL94JasyXUZsGA== dependencies: detect-newline "^3.1.0" -jest-each@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-30.0.0.tgz#f3760fba22074c4e82b440f4a0557467f464f718" - integrity sha512-qkFEW3cfytEjG2KtrhwtldZfXYnWSanO8xUMXLe4A6yaiHMHJUalk0Yyv4MQH6aeaxgi4sGVrukvF0lPMM7U1w== +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== dependencies: - "@jest/get-type" "30.0.0" - "@jest/types" "30.0.0" + "@jest/get-type" "30.0.1" + "@jest/types" "30.0.1" chalk "^4.1.2" - jest-util "30.0.0" - pretty-format "30.0.0" + jest-util "30.0.2" + pretty-format "30.0.2" -jest-environment-node@30.0.0, jest-environment-node@^30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-30.0.0.tgz#0d16b29f5720c796d8eadd9c22ada1c1c43d3ba2" - integrity sha512-sF6lxyA25dIURyDk4voYmGU9Uwz2rQKMfjxKnDd19yk+qxKGrimFqS5YsPHWTlAVBo+YhWzXsqZoaMzrTFvqfg== +jest-environment-node@30.0.2, jest-environment-node@^30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-30.0.2.tgz#3c24d6becb505f344f52cddb15ea506cf3288543" + integrity sha512-XsGtZ0H+a70RsxAQkKuIh0D3ZlASXdZdhpOSBq9WRPq6lhe0IoQHGW0w9ZUaPiZQ/CpkIdprvlfV1QcXcvIQLQ== dependencies: - "@jest/environment" "30.0.0" - "@jest/fake-timers" "30.0.0" - "@jest/types" "30.0.0" + "@jest/environment" "30.0.2" + "@jest/fake-timers" "30.0.2" + "@jest/types" "30.0.1" "@types/node" "*" - jest-mock "30.0.0" - jest-util "30.0.0" - jest-validate "30.0.0" - -jest-get-type@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" - integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== + jest-mock "30.0.2" + jest-util "30.0.2" + jest-validate "30.0.2" -jest-haste-map@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-30.0.0.tgz#7e8597a8931eef090aa011bedba7a1173775acb8" - integrity sha512-p4bXAhXTawTsADgQgTpbymdLaTyPW1xWNu1oIGG7/N3LIAbZVkH2JMJqS8/IUcnGR8Kc7WFE+vWbJvsqGCWZXw== +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== dependencies: - "@jest/types" "30.0.0" + "@jest/types" "30.0.1" "@types/node" "*" anymatch "^3.1.3" fb-watchman "^2.0.2" graceful-fs "^4.2.11" - jest-regex-util "30.0.0" - jest-util "30.0.0" - jest-worker "30.0.0" + jest-regex-util "30.0.1" + jest-util "30.0.2" + jest-worker "30.0.2" micromatch "^4.0.8" walker "^1.0.8" optionalDependencies: @@ -4329,246 +4255,209 @@ jest-junit@^16.0.0: uuid "^8.3.2" xml "^1.0.1" -jest-leak-detector@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-30.0.0.tgz#056d168e6f308262b40ad05843723a52cdb58b91" - integrity sha512-E/ly1azdVVbZrS0T6FIpyYHvsdek4FNaThJTtggjV/8IpKxh3p9NLndeUZy2+sjAI3ncS+aM0uLLon/dBg8htA== +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== dependencies: - "@jest/get-type" "30.0.0" - pretty-format "30.0.0" + "@jest/get-type" "30.0.1" + pretty-format "30.0.2" -jest-matcher-utils@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.0.0.tgz#f72a65e248c0462795f7e14386682bfee6ad4386" - integrity sha512-m5mrunqopkrqwG1mMdJxe1J4uGmS9AHHKYUmoxeQOxBcLjEvirIrIDwuKmUYrecPHVB/PUBpXs2gPoeA2FSSLQ== +jest-matcher-utils@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.0.2.tgz#2dbb5f9aacfdd9c013fa72ed6132ca4e1b41f8db" + integrity sha512-1FKwgJYECR8IT93KMKmjKHSLyru0DqguThov/aWpFccC0wbiXGOxYEu7SScderBD7ruDOpl7lc5NG6w3oxKfaA== dependencies: - "@jest/get-type" "30.0.0" + "@jest/get-type" "30.0.1" chalk "^4.1.2" - jest-diff "30.0.0" - pretty-format "30.0.0" + jest-diff "30.0.2" + pretty-format "30.0.2" -jest-matcher-utils@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" - integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== - dependencies: - chalk "^4.0.0" - jest-diff "^29.7.0" - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-message-util@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-30.0.0.tgz#b115d408cd877a6e3e711485a3bd240c7a27503c" - integrity sha512-pV3qcrb4utEsa/U7UI2VayNzSDQcmCllBZLSoIucrESRu0geKThFZOjjh0kACDJFJRAQwsK7GVsmS6SpEceD8w== +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== dependencies: "@babel/code-frame" "^7.27.1" - "@jest/types" "30.0.0" + "@jest/types" "30.0.1" "@types/stack-utils" "^2.0.3" chalk "^4.1.2" graceful-fs "^4.2.11" micromatch "^4.0.8" - pretty-format "30.0.0" + pretty-format "30.0.2" slash "^3.0.0" stack-utils "^2.0.6" -jest-message-util@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" - integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== +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== dependencies: - "@babel/code-frame" "^7.12.13" - "@jest/types" "^29.6.3" - "@types/stack-utils" "^2.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.9" - micromatch "^4.0.4" - pretty-format "^29.7.0" - slash "^3.0.0" - stack-utils "^2.0.3" - -jest-mock@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-30.0.0.tgz#f3b3115cd80c3eec7df93809430ab1feaeeb7229" - integrity sha512-W2sRA4ALXILrEetEOh2ooZG6fZ01iwVs0OWMKSSWRcUlaLr4ESHuiKXDNTg+ZVgOq8Ei5445i/Yxrv59VT+XkA== - dependencies: - "@jest/types" "30.0.0" + "@jest/types" "30.0.1" "@types/node" "*" - jest-util "30.0.0" + jest-util "30.0.2" jest-pnp-resolver@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== -jest-regex-util@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-30.0.0.tgz#031f385ebb947e770e409ede703d200b3405413e" - integrity sha512-rT84010qRu/5OOU7a9TeidC2Tp3Qgt9Sty4pOZ/VSDuEmRupIjKZAb53gU3jr4ooMlhwScrgC9UixJxWzVu9oQ== +jest-regex-util@30.0.1: + version "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.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-30.0.0.tgz#caf6829daa9ad6579a6da7c2723346761102ef83" - integrity sha512-Yhh7odCAUNXhluK1bCpwIlHrN1wycYaTlZwq1GdfNBEESNNI/z1j1a7dUEWHbmB9LGgv0sanxw3JPmWU8NeebQ== +jest-resolve-dependencies@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-30.0.2.tgz#0c5da8dc5f791f3de10c1d5df294503cd612e5a6" + integrity sha512-Lp1iIXpsF5fGM4vyP8xHiIy2H5L5yO67/nXoYJzH4kz+fQmO+ZMKxzYLyWxYy4EeCLeNQ6a9OozL+uHZV2iuEA== dependencies: - jest-regex-util "30.0.0" - jest-snapshot "30.0.0" + jest-regex-util "30.0.1" + jest-snapshot "30.0.2" -jest-resolve@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-30.0.0.tgz#8aaf8f85c8a14579fa34e651af406e57d2675092" - integrity sha512-zwWl1P15CcAfuQCEuxszjiKdsValhnWcj/aXg/R3aMHs8HVoCWHC4B/+5+1BirMoOud8NnN85GSP2LEZCbj3OA== +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== dependencies: chalk "^4.1.2" graceful-fs "^4.2.11" - jest-haste-map "30.0.0" + jest-haste-map "30.0.2" jest-pnp-resolver "^1.2.3" - jest-util "30.0.0" - jest-validate "30.0.0" + jest-util "30.0.2" + jest-validate "30.0.2" slash "^3.0.0" unrs-resolver "^1.7.11" -jest-runner@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-30.0.0.tgz#d4667945181e3aecb025802a3f81ff30a523f877" - integrity sha512-xbhmvWIc8X1IQ8G7xTv0AQJXKjBVyxoVJEJgy7A4RXsSaO+k/1ZSBbHwjnUhvYqMvwQPomWssDkUx6EoidEhlw== - dependencies: - "@jest/console" "30.0.0" - "@jest/environment" "30.0.0" - "@jest/test-result" "30.0.0" - "@jest/transform" "30.0.0" - "@jest/types" "30.0.0" +jest-runner@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-30.0.2.tgz#28022ea290e2759864ae97cb5307bcae98e68f2d" + integrity sha512-6H+CIFiDLVt1Ix6jLzASXz3IoIiDukpEIxL9FHtDQ2BD/k5eFtDF5e5N9uItzRE3V1kp7VoSRyrGBytXKra4xA== + dependencies: + "@jest/console" "30.0.2" + "@jest/environment" "30.0.2" + "@jest/test-result" "30.0.2" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" "@types/node" "*" chalk "^4.1.2" emittery "^0.13.1" exit-x "^0.2.2" graceful-fs "^4.2.11" - jest-docblock "30.0.0" - jest-environment-node "30.0.0" - jest-haste-map "30.0.0" - jest-leak-detector "30.0.0" - jest-message-util "30.0.0" - jest-resolve "30.0.0" - jest-runtime "30.0.0" - jest-util "30.0.0" - jest-watcher "30.0.0" - jest-worker "30.0.0" + jest-docblock "30.0.1" + jest-environment-node "30.0.2" + 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.2" + jest-util "30.0.2" + jest-watcher "30.0.2" + jest-worker "30.0.2" p-limit "^3.1.0" source-map-support "0.5.13" -jest-runtime@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-30.0.0.tgz#7aad9359da4054d4ae1ec8d94f83d3c07d6ce1c7" - integrity sha512-/O07qVgFrFAOGKGigojmdR3jUGz/y3+a/v9S/Yi2MHxsD+v6WcPppglZJw0gNJkRBArRDK8CFAwpM/VuEiiRjA== - dependencies: - "@jest/environment" "30.0.0" - "@jest/fake-timers" "30.0.0" - "@jest/globals" "30.0.0" - "@jest/source-map" "30.0.0" - "@jest/test-result" "30.0.0" - "@jest/transform" "30.0.0" - "@jest/types" "30.0.0" +jest-runtime@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-30.0.2.tgz#db5b4723ebdb8c2158779c055976cb6cc22ce1df" + integrity sha512-H1a51/soNOeAjoggu6PZKTH7DFt8JEGN4mesTSwyqD2jU9PXD04Bp6DKbt2YVtQvh2JcvH2vjbkEerCZ3lRn7A== + dependencies: + "@jest/environment" "30.0.2" + "@jest/fake-timers" "30.0.2" + "@jest/globals" "30.0.2" + "@jest/source-map" "30.0.1" + "@jest/test-result" "30.0.2" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" "@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.0" - jest-message-util "30.0.0" - jest-mock "30.0.0" - jest-regex-util "30.0.0" - jest-resolve "30.0.0" - jest-snapshot "30.0.0" - jest-util "30.0.0" + jest-haste-map "30.0.2" + jest-message-util "30.0.2" + jest-mock "30.0.2" + jest-regex-util "30.0.1" + jest-resolve "30.0.2" + jest-snapshot "30.0.2" + jest-util "30.0.2" slash "^3.0.0" strip-bom "^4.0.0" -jest-snapshot@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-30.0.0.tgz#44217201c3f935e7cc5b413c8dda05341c80b0d7" - integrity sha512-6oCnzjpvfj/UIOMTqKZ6gedWAUgaycMdV8Y8h2dRJPvc2wSjckN03pzeoonw8y33uVngfx7WMo1ygdRGEKOT7w== +jest-snapshot@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-30.0.2.tgz#0f9f2c59c2070874a2db96d30c8543dfef657701" + integrity sha512-KeoHikoKGln3OlN7NS7raJ244nIVr2K46fBTNdfuxqYv2/g4TVyWDSO4fmk08YBJQMjs3HNfG1rlLfL/KA+nUw== 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.0" - "@jest/get-type" "30.0.0" - "@jest/snapshot-utils" "30.0.0" - "@jest/transform" "30.0.0" - "@jest/types" "30.0.0" + "@jest/expect-utils" "30.0.2" + "@jest/get-type" "30.0.1" + "@jest/snapshot-utils" "30.0.1" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" babel-preset-current-node-syntax "^1.1.0" chalk "^4.1.2" - expect "30.0.0" + expect "30.0.2" graceful-fs "^4.2.11" - jest-diff "30.0.0" - jest-matcher-utils "30.0.0" - jest-message-util "30.0.0" - jest-util "30.0.0" - pretty-format "30.0.0" + jest-diff "30.0.2" + jest-matcher-utils "30.0.2" + jest-message-util "30.0.2" + jest-util "30.0.2" + pretty-format "30.0.2" semver "^7.7.2" synckit "^0.11.8" -jest-util@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-30.0.0.tgz#d4f20f59e1fd72c7143143f4aa961bb71aeddad0" - integrity sha512-fhNBBM9uSUbd4Lzsf8l/kcAdaHD/4SgoI48en3HXcBEMwKwoleKFMZ6cYEYs21SB779PRuRCyNLmymApAm8tZw== +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== dependencies: - "@jest/types" "30.0.0" + "@jest/types" "30.0.1" "@types/node" "*" chalk "^4.1.2" ci-info "^4.2.0" graceful-fs "^4.2.11" picomatch "^4.0.2" -jest-util@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" - integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== - dependencies: - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.9" - picomatch "^2.2.3" - -jest-validate@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-30.0.0.tgz#0e961bcf6ec9922edb10860039529797f02eb821" - integrity sha512-d6OkzsdlWItHAikUDs1hlLmpOIRhsZoXTCliV2XXalVQ3ZOeb9dy0CQ6AKulJu/XOZqpOEr/FiMH+FeOBVV+nw== +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== dependencies: - "@jest/get-type" "30.0.0" - "@jest/types" "30.0.0" + "@jest/get-type" "30.0.1" + "@jest/types" "30.0.1" camelcase "^6.3.0" chalk "^4.1.2" leven "^3.1.0" - pretty-format "30.0.0" + pretty-format "30.0.2" -jest-watcher@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-30.0.0.tgz#d444ad4950e20e1cca60e470c448cc15f3f858ce" - integrity sha512-fbAkojcyS53bOL/B7XYhahORq9cIaPwOgd/p9qW/hybbC8l6CzxfWJJxjlPBAIVN8dRipLR0zdhpGQdam+YBtw== +jest-watcher@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-30.0.2.tgz#ec93ed25183679f549a47f6197267d50ec83ea51" + integrity sha512-vYO5+E7jJuF+XmONr6CrbXdlYrgvZqtkn6pdkgjt/dU64UAdc0v1cAVaAeWtAfUUMScxNmnUjKPUMdCpNVASwg== dependencies: - "@jest/test-result" "30.0.0" - "@jest/types" "30.0.0" + "@jest/test-result" "30.0.2" + "@jest/types" "30.0.1" "@types/node" "*" ansi-escapes "^4.3.2" chalk "^4.1.2" emittery "^0.13.1" - jest-util "30.0.0" + jest-util "30.0.2" string-length "^4.0.2" -jest-worker@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-30.0.0.tgz#63f15145e2b2b36db0be2d2d4413d197d0460912" - integrity sha512-VZvxfWIybIvwK8N/Bsfe43LfQgd/rD0c4h5nLUx78CAqPxIQcW2qDjsVAC53iUR8yxzFIeCFFvWOh8en8hGzdg== +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== dependencies: "@types/node" "*" "@ungap/structured-clone" "^1.3.0" - jest-util "30.0.0" + jest-util "30.0.2" merge-stream "^2.0.0" supports-color "^8.1.1" @@ -4581,15 +4470,15 @@ jest-worker@^27.4.5: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-30.0.0.tgz#d1d69adb09045053762a40217238c76b19d1db6d" - integrity sha512-/3G2iFwsUY95vkflmlDn/IdLyLWqpQXcftptooaPH4qkyU52V7qVYf1BjmdSPlp1+0fs6BmNtrGaSFwOfV07ew== +jest@^30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest/-/jest-30.0.2.tgz#0b3af654548d706bdde6f1bba93099ec343b8772" + integrity sha512-HlSEiHRcmTuGwNyeawLTEzpQUMFn+f741FfoNg7RXG2h0WLJKozVCpcQLT0GW17H6kNCqRwGf+Ii/I1YVNvEGQ== dependencies: - "@jest/core" "30.0.0" - "@jest/types" "30.0.0" + "@jest/core" "30.0.2" + "@jest/types" "30.0.1" import-local "^3.2.0" - jest-cli "30.0.0" + jest-cli "30.0.2" js-stringify@^1.0.2: version "1.0.2" @@ -4790,10 +4679,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -lint-staged@^16.0.0: - version "16.1.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-16.1.0.tgz#06807ef3dbbade9e4e3416897aac0ac5b99a2377" - integrity sha512-HkpQh69XHxgCjObjejBT3s2ILwNjFx8M3nw+tJ/ssBauDlIpkx2RpqWSi1fBgkXLSSXnbR3iEq1NkVtpvV+FLQ== +lint-staged@^16.1.2: + version "16.1.2" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-16.1.2.tgz#8cb84daa844f39c7a9790dd2c0caa327125ef059" + integrity sha512-sQKw2Si2g9KUZNY3XNvRuDq4UJqpHwF0/FQzZR2M7I5MvtpWvibikCjUVJzZdGE0ByurEl3KQNvsGetd1ty1/Q== dependencies: chalk "^5.4.1" commander "^14.0.0" @@ -5014,7 +4903,7 @@ merge2@^1.3.0: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -micromatch@^4.0.0, micromatch@^4.0.4, micromatch@^4.0.8: +micromatch@^4.0.0, micromatch@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== @@ -5479,13 +5368,12 @@ parent-module@^2.0.0: dependencies: callsites "^3.1.0" -parse-imports@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/parse-imports/-/parse-imports-2.2.1.tgz#0a6e8b5316beb5c9905f50eb2bbb8c64a4805642" - integrity sha512-OL/zLggRp8mFhKL0rNORUTR4yBYujK/uU+xZL+/0Rgm2QE4nLO9v8PzEweSJEbMGKmDRjJE4R3IMJlL2di4JeQ== +parse-imports-exports@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/parse-imports-exports/-/parse-imports-exports-0.2.4.tgz#e3fb3b5e264cfb55c25b5dfcbe7f410f8dc4e7af" + integrity sha512-4s6vd6dx1AotCx/RCI2m7t7GCh5bDRUtGNvRfHSP2wbBQdMi67pPe7mtzmgwcaQ8VKK/6IB7Glfyu3qdZJPybQ== dependencies: - es-module-lexer "^1.5.3" - slashes "^3.0.12" + parse-statements "1.0.11" parse-json@^5.2.0: version "5.2.0" @@ -5502,6 +5390,11 @@ parse-node-version@^1.0.1: resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b" integrity sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA== +parse-statements@1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/parse-statements/-/parse-statements-1.0.11.tgz#8787c5d383ae5746568571614be72b0689584344" + integrity sha512-HlsyYdMBnbPQ9Jr/VgJ1YF4scnldvJpJxCVx6KgqPL4dxppsWrJHCIIxQXMJrqGnsRkNPATbeMJ8Yxu7JMsYcA== + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -5550,7 +5443,7 @@ picocolors@^1.1.1: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: +picomatch@^2.0.4, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -5664,29 +5557,20 @@ prettier@^2.0.5: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== -prettier@^3.5.1: - version "3.5.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.3.tgz#4fc2ce0d657e7a02e602549f053b239cb7dfe1b5" - integrity sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw== +prettier@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.0.tgz#18ec98d62cb0757a5d4eab40253ff3e6d0fc8dea" + integrity sha512-ujSB9uXHJKzM/2GBuE0hBOUgC77CN3Bnpqa+g80bkv3T3A93wL/xlzDATHhnhkzifz/UE2SNOvmbTz5hSkDlHw== -pretty-format@30.0.0: - version "30.0.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.0.0.tgz#a3137bed442af87eadea2c427a1b201189e590a4" - integrity sha512-18NAOUr4ZOQiIR+BgI5NhQE7uREdx4ZyV0dyay5izh4yfQ+1T7BSvggxvRGoXocrRyevqW5OhScUjbi9GB8R8Q== +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== dependencies: - "@jest/schemas" "30.0.0" + "@jest/schemas" "30.0.1" ansi-styles "^5.2.0" react-is "^18.3.1" -pretty-format@^29.0.0, pretty-format@^29.5.0, pretty-format@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" - integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== - dependencies: - "@jest/schemas" "^29.6.3" - ansi-styles "^5.0.0" - react-is "^18.0.0" - proc-log@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-5.0.0.tgz#e6c93cf37aef33f835c53485f314f50ea906a9d8" @@ -5888,7 +5772,7 @@ react-dom@^19.0.0: dependencies: scheduler "^0.26.0" -react-is@^18.0.0, react-is@^18.3.1: +react-is@^18.3.1: version "18.3.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== @@ -6147,25 +6031,20 @@ signal-exit@^4.0.1, signal-exit@^4.1.0: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== -simple-git@^3.27.0: - version "3.27.0" - resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-3.27.0.tgz#f4b09e807bda56a4a3968f635c0e4888d3decbd5" - integrity sha512-ivHoFS9Yi9GY49ogc6/YAi3Fl9ROnF4VyubNylgCkA+RVqLaKWnDSzXOVzya8csELIaWaYNutsEuAhZrtOjozA== +simple-git@^3.28.0: + version "3.28.0" + resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-3.28.0.tgz#c6345b2e387880f8450788a1e388573366ae48ac" + integrity sha512-Rs/vQRwsn1ILH1oBUy8NucJlXmnnLeLCfcvbSehkPzbv3wwoFWIdtfd6Ndo6ZPhlPsCZ60CPI4rxurnwAa+a2w== dependencies: "@kwsites/file-exists" "^1.1.1" "@kwsites/promise-deferred" "^1.1.1" - debug "^4.3.5" + debug "^4.4.0" slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -slashes@^3.0.12: - version "3.0.12" - resolved "https://registry.yarnpkg.com/slashes/-/slashes-3.0.12.tgz#3d664c877ad542dc1509eaf2c50f38d483a6435a" - integrity sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA== - slice-ansi@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-5.0.0.tgz#b73063c57aa96f9cd881654b15294d95d285c42a" @@ -6294,7 +6173,7 @@ stack-trace@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.3, stack-utils@^2.0.6: +stack-utils@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== @@ -6451,14 +6330,6 @@ synckit@^0.11.7, synckit@^0.11.8: dependencies: "@pkgr/core" "^0.2.4" -synckit@^0.9.1: - version "0.9.2" - resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.2.tgz#a3a935eca7922d48b9e7d6c61822ee6c3ae4ec62" - integrity sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw== - dependencies: - "@pkgr/core" "^0.1.0" - tslib "^2.6.2" - tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.2.tgz#ab4984340d30cb9989a490032f086dbb8b56d872" @@ -6502,10 +6373,10 @@ terser-webpack-plugin@^5.3.11: serialize-javascript "^6.0.2" terser "^5.31.1" -terser@^5.31.1, terser@^5.32.0, terser@^5.38.1: - version "5.40.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.40.0.tgz#839a80db42bfee8340085f44ea99b5cba36c55c8" - integrity sha512-cfeKl/jjwSR5ar7d0FGmave9hFGJT8obyo0z+CrQOylLDbk7X81nPU6vq9VORa5jU30SkDnT2FXjLbR8HLP+xA== +terser@^5.31.1, terser@^5.32.0, terser@^5.43.1: + version "5.43.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.43.1.tgz#88387f4f9794ff1a29e7ad61fb2932e25b4fdb6d" + integrity sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.14.0" @@ -6558,10 +6429,10 @@ tinybench@^4.0.1: resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-4.0.1.tgz#ff5940b4e4a63892ef0cad3daf148d5fd8a3725b" integrity sha512-Nb1srn7dvzkVx0J5h1vq8f48e3TIcbrS7e/UfAI/cDSef/n8yLh4zsAEsFkfpw6auTY+ZaspEvam/xs8nMnotQ== -tinyglobby@^0.2.12, tinyglobby@^0.2.13: - version "0.2.13" - resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.13.tgz#a0e46515ce6cbcd65331537e57484af5a7b2ff7e" - integrity sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw== +tinyglobby@^0.2.12, tinyglobby@^0.2.14: + version "0.2.14" + resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.14.tgz#5280b0cf3f972b050e74ae88406c0a6a58f4079d" + integrity sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ== dependencies: fdir "^6.4.4" picomatch "^4.0.2" @@ -6596,9 +6467,9 @@ toml@^3.0.0: resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee" integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== -tooling@webpack/tooling#v1.23.9: - version "1.23.9" - resolved "https://codeload.github.com/webpack/tooling/tar.gz/877a9a9f5ab0bac3d60f595dd0ffc92234356a49" +tooling@webpack/tooling#v1.24.0: + version "1.24.0" + resolved "https://codeload.github.com/webpack/tooling/tar.gz/0dc77b33f91c7310d4421fc80279aef1be04b20b" dependencies: "@yarnpkg/lockfile" "^1.1.0" ajv "^8.1.0" @@ -6636,7 +6507,7 @@ ts-loader@^9.5.1: semver "^7.3.4" source-map "^0.7.4" -tslib@^2.0.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.5.0, tslib@^2.6.2: +tslib@^2.0.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.5.0: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== @@ -6702,10 +6573,10 @@ uglify-js@^3.1.4: resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== -undici-types@~6.21.0: - version "6.21.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" - integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== +undici-types@~7.8.0: + version "7.8.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" + integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== unique-filename@^4.0.0: version "4.0.0" @@ -6876,10 +6747,10 @@ webpack-merge@^6.0.1: flat "^5.0.2" wildcard "^2.0.1" -webpack-sources@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.2.tgz#0ab55ab0b380ce53c45ca40cb7b33bab3149ea85" - integrity sha512-ykKKus8lqlgXX/1WjudpIEjqsafjOTcOJqxnAbMLAu/KCsDCJ6GBtvscewvTkrn24HsnvFwrSCbenFrhtcCsAA== +webpack-sources@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.3.tgz#d4bf7f9909675d7a070ff14d0ef2a4f3c982c723" + integrity sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg== which-module@^2.0.0: version "2.0.1" @@ -7042,7 +6913,7 @@ yallist@^5.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-5.0.0.tgz#00e2de443639ed0d78fd87de0d27469fbcffb533" integrity sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw== -yaml@^2.7.1, yaml@^2.8.0: +yaml@^2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.8.0.tgz#15f8c9866211bdc2d3781a0890e44d4fa1a5fff6" integrity sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ== From 21b28a82f7a6ec677752e1c8fb722a830a2adf69 Mon Sep 17 00:00:00 2001 From: Natsu Xiao <784487301@qq.com> Date: Tue, 24 Jun 2025 22:44:54 +0800 Subject: [PATCH 27/56] test: update tests for ESM HMR --- test/hotCases/esm-output/css-modules/index.js | 25 ++++++++++--------- .../hotCases/esm-output/split-chunks/index.js | 1 - 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/hotCases/esm-output/css-modules/index.js b/test/hotCases/esm-output/css-modules/index.js index e4511d95ad5..83344fef4ef 100644 --- a/test/hotCases/esm-output/css-modules/index.js +++ b/test/hotCases/esm-output/css-modules/index.js @@ -1,29 +1,30 @@ import * as styles from "./style.module.css"; import update from "../../update.esm"; +import.meta.webpackHot.accept(["./style.module.css", "./style2.module.css"]) + it("should work", async function (done) { expect(styles).toMatchObject({ class: "_style_module_css-class" }); - const styles2 = await import("./style2.module.css"); expect(styles2).toMatchObject({ foo: "_style2_module_css-foo" }); - import.meta.webpackHot.accept(["./style.module.css", "./style2.module.css"], () => { - expect(styles).toMatchObject({ + NEXT(update(done, true, () => { + Promise.all([ + import("./style.module.css"), + import("./style2.module.css") + ]) + .then(([styles, styles2]) => { + expect(styles).toMatchObject({ "class-other": "_style_module_css-class-other" - }); - import("./style2.module.css").then(styles2 => { + }); expect(styles2).toMatchObject({ "bar": "_style2_module_css-bar" }); done(); - }); - }); - - NEXT(update(done)); -}); - -module.hot.accept(); + }).catch(done); + })); +}); \ No newline at end of file diff --git a/test/hotCases/esm-output/split-chunks/index.js b/test/hotCases/esm-output/split-chunks/index.js index 706146c997e..dcdbf928c75 100644 --- a/test/hotCases/esm-output/split-chunks/index.js +++ b/test/hotCases/esm-output/split-chunks/index.js @@ -8,7 +8,6 @@ it("should handle HMR with split chunks in ESM format", (done) => { ]).then(([commonModule, vendorModule]) => { expect(commonModule.commonFunction("test")).toBe("Common function processed: test"); expect(vendorModule.default.version).toBe("1.0.0"); - done(); }).catch(done); NEXT(update(done, true, () => { From 10fb5566e71d24e268678cd8dd2376cafcdcb5dc Mon Sep 17 00:00:00 2001 From: Ryuya Date: Wed, 25 Jun 2025 03:21:53 -0700 Subject: [PATCH 28/56] test: add test case for circular dependency with externals (#19623) --- .../module/circular-externals/external-a.mjs | 10 +++ .../module/circular-externals/external-b.mjs | 10 +++ .../module/circular-externals/index.js | 51 +++++++++++++++ .../module/circular-externals/module-a.js | 12 ++++ .../module/circular-externals/module-b.js | 12 ++++ .../module/circular-externals/test.config.js | 5 ++ .../circular-externals/webpack.config.js | 65 +++++++++++++++++++ 7 files changed, 165 insertions(+) create mode 100644 test/configCases/module/circular-externals/external-a.mjs create mode 100644 test/configCases/module/circular-externals/external-b.mjs create mode 100644 test/configCases/module/circular-externals/index.js create mode 100644 test/configCases/module/circular-externals/module-a.js create mode 100644 test/configCases/module/circular-externals/module-b.js create mode 100644 test/configCases/module/circular-externals/test.config.js create mode 100644 test/configCases/module/circular-externals/webpack.config.js diff --git a/test/configCases/module/circular-externals/external-a.mjs b/test/configCases/module/circular-externals/external-a.mjs new file mode 100644 index 00000000000..2785f5f3eed --- /dev/null +++ b/test/configCases/module/circular-externals/external-a.mjs @@ -0,0 +1,10 @@ +import { externalValue as valueB, getOtherExternal as getB } from "./external-b.mjs"; + +export const externalValue = "external-A"; + +export function getOtherExternal() { + return valueB; +} + +// Re-export to test circular re-exports +export { getB as getOtherValue }; diff --git a/test/configCases/module/circular-externals/external-b.mjs b/test/configCases/module/circular-externals/external-b.mjs new file mode 100644 index 00000000000..06ad1a9c103 --- /dev/null +++ b/test/configCases/module/circular-externals/external-b.mjs @@ -0,0 +1,10 @@ +import { externalValue as valueA, getOtherExternal as getA } from "./external-a.mjs"; + +export const externalValue = "external-B"; + +export function getOtherExternal() { + return valueA; +} + +// Re-export to test circular re-exports +export { getA as getOtherValue }; diff --git a/test/configCases/module/circular-externals/index.js b/test/configCases/module/circular-externals/index.js new file mode 100644 index 00000000000..cf77fd392c0 --- /dev/null +++ b/test/configCases/module/circular-externals/index.js @@ -0,0 +1,51 @@ +import { valueA, getFromExternalA, callB } from "./module-a.js"; +import { valueB, getFromExternalB, callA } from "./module-b.js"; +import { externalValue as directExternalA } from "external-module-a"; +import { externalValue as directExternalB } from "external-module-b"; + +it("should handle circular dependencies between internal modules", () => { + expect(valueA).toBe("module-A"); + expect(valueB).toBe("module-B"); + expect(callB()).toBe("module-B"); + expect(callA()).toBe("module-A"); +}); + +it("should handle imports from external modules", () => { + expect(getFromExternalA()).toBe("external-A"); + expect(getFromExternalB()).toBe("external-B"); +}); + +it("should handle direct imports from external modules", () => { + expect(directExternalA).toBe("external-A"); + expect(directExternalB).toBe("external-B"); +}); + +// ESM external modules with circular dependencies +it("should maintain live bindings for ESM external modules", async () => { + // Import external modules that have circular dependencies + const moduleA = await import("external-module-a"); + const moduleB = await import("external-module-b"); + + // Verify that circular dependencies are resolved correctly + expect(moduleA.externalValue).toBe("external-A"); + expect(moduleB.externalValue).toBe("external-B"); + + // Verify that re-exports work correctly in circular scenarios + expect(moduleA.getOtherValue).toBeDefined(); + expect(moduleB.getOtherValue).toBeDefined(); + + // Test that the modules maintain their identity (live bindings) + expect(await import("external-module-a")).toBe(moduleA); + expect(await import("external-module-b")).toBe(moduleB); +}); + +// Edge case: Multiple imports of the same external module +it("should handle multiple imports of circular external modules", () => { + // This tests that the runtime module correctly caches external modules + const firstImportA = directExternalA; + const secondImportA = getFromExternalA(); + + // Both should reference the same value + expect(firstImportA).toBe(secondImportA); + expect(firstImportA).toBe("external-A"); +}); diff --git a/test/configCases/module/circular-externals/module-a.js b/test/configCases/module/circular-externals/module-a.js new file mode 100644 index 00000000000..3d62411234e --- /dev/null +++ b/test/configCases/module/circular-externals/module-a.js @@ -0,0 +1,12 @@ +import { valueB } from "./module-b.js"; +import { externalValue } from "external-module-a"; + +export const valueA = "module-A"; + +export function getFromExternalA() { + return externalValue; +} + +export function callB() { + return valueB; +} diff --git a/test/configCases/module/circular-externals/module-b.js b/test/configCases/module/circular-externals/module-b.js new file mode 100644 index 00000000000..8e68f59655a --- /dev/null +++ b/test/configCases/module/circular-externals/module-b.js @@ -0,0 +1,12 @@ +import { valueA } from "./module-a.js"; +import { externalValue } from "external-module-b"; + +export const valueB = "module-B"; + +export function getFromExternalB() { + return externalValue; +} + +export function callA() { + return valueA; +} diff --git a/test/configCases/module/circular-externals/test.config.js b/test/configCases/module/circular-externals/test.config.js new file mode 100644 index 00000000000..1192a7afc60 --- /dev/null +++ b/test/configCases/module/circular-externals/test.config.js @@ -0,0 +1,5 @@ +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 new file mode 100644 index 00000000000..4d111f5883b --- /dev/null +++ b/test/configCases/module/circular-externals/webpack.config.js @@ -0,0 +1,65 @@ +const fs = require("fs"); +const path = require("path"); + +/** @type {import("../../../../types").Configuration} */ +module.exports = { + entry: "./index.js", + experiments: { + outputModule: true + }, + output: { + module: true, + library: { + type: "module" + }, + filename: "[name].mjs", + chunkFormat: "module" + }, + externals: { + "external-module-a": "module ./external-a.mjs", + "external-module-b": "module ./external-b.mjs" + }, + externalsType: "module", + optimization: { + concatenateModules: false + }, + plugins: [ + { + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "copy-external-files", + compilation => { + compilation.hooks.processAssets.tap( + { + name: "copy-external-files", + stage: + compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL + }, + () => { + // Read the external module files + const externalA = fs.readFileSync( + path.join(__dirname, "external-a.mjs"), + "utf-8" + ); + const externalB = fs.readFileSync( + path.join(__dirname, "external-b.mjs"), + "utf-8" + ); + + // Emit them as assets + compilation.emitAsset( + "external-a.mjs", + new compiler.webpack.sources.RawSource(externalA) + ); + compilation.emitAsset( + "external-b.mjs", + new compiler.webpack.sources.RawSource(externalB) + ); + } + ); + } + ); + } + } + ] +}; From fab6c686fa3e61fa549bfab4265b171059224ee6 Mon Sep 17 00:00:00 2001 From: Natsu Xiao <784487301@qq.com> Date: Fri, 27 Jun 2025 01:10:23 +0800 Subject: [PATCH 29/56] perf: remove useless startupEntrypoint for ESM --- lib/esm/ModuleChunkFormatPlugin.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index 3ef656f86ea..f3136eac893 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -126,7 +126,6 @@ class ModuleChunkFormatPlugin { if (chunk.hasRuntime()) return; if (compilation.chunkGraph.getNumberOfEntryModules(chunk) > 0) { set.add(RuntimeGlobals.require); - set.add(RuntimeGlobals.startupEntrypoint); set.add(RuntimeGlobals.externalInstallChunk); } } From 43b0aafc91cad0878576f2f6059b54d496b80e8f Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 26 Jun 2025 20:10:49 +0300 Subject: [PATCH 30/56] feat: support `using` keyword --- lib/EvalDevToolModulePlugin.js | 4 +- lib/EvalSourceMapDevToolPlugin.js | 4 +- lib/javascript/JavascriptParser.js | 7 +- package.json | 10 +- test/cases/parsing/using/index.js | 55 ++++++ test/cases/parsing/using/module.js | 9 + test/cases/parsing/using/test.filter.js | 10 + .../exclude-modules-source-map/index.js | 4 +- test/helpers/supportsUsing.js | 23 +++ types.d.ts | 1 + yarn.lock | 178 +++++++++--------- 11 files changed, 204 insertions(+), 101 deletions(-) create mode 100644 test/cases/parsing/using/index.js create mode 100644 test/cases/parsing/using/module.js create mode 100644 test/cases/parsing/using/test.filter.js create mode 100644 test/helpers/supportsUsing.js diff --git a/lib/EvalDevToolModulePlugin.js b/lib/EvalDevToolModulePlugin.js index 956dd6a14a4..b9b402a1f6f 100644 --- a/lib/EvalDevToolModulePlugin.js +++ b/lib/EvalDevToolModulePlugin.js @@ -95,9 +95,9 @@ class EvalDevToolModulePlugin { `eval(${ compilation.outputOptions.trustedTypes ? `${RuntimeGlobals.createScript}(${JSON.stringify( - content + footer + `{${content + footer}\n}` )})` - : JSON.stringify(content + footer) + : JSON.stringify(`{${content + footer}\n}`) });` ); cache.set(source, result); diff --git a/lib/EvalSourceMapDevToolPlugin.js b/lib/EvalSourceMapDevToolPlugin.js index 3f2a71bd681..386f8ae4f80 100644 --- a/lib/EvalSourceMapDevToolPlugin.js +++ b/lib/EvalSourceMapDevToolPlugin.js @@ -191,9 +191,9 @@ class EvalSourceMapDevToolPlugin { `eval(${ compilation.outputOptions.trustedTypes ? `${RuntimeGlobals.createScript}(${JSON.stringify( - content + footer + `{${content + footer}\n}` )})` - : JSON.stringify(content + footer) + : JSON.stringify(`{${content + footer}\n}`) });` ) ); diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index c6d6816ced8..32f6cb70060 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -491,6 +491,8 @@ class JavascriptParser extends Parser { /** @type {HookMap>} */ varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])), /** @type {HookMap>} */ + varDeclarationUsing: new HookMap(() => new SyncBailHook(["declaration"])), + /** @type {HookMap>} */ varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])), /** @type {HookMap>} */ pattern: new HookMap(() => new SyncBailHook(["pattern"])), @@ -2818,10 +2820,13 @@ class JavascriptParser extends Parser { */ blockPreWalkVariableDeclaration(statement) { if (statement.kind === "var") return; + const hookMap = statement.kind === "const" ? this.hooks.varDeclarationConst - : this.hooks.varDeclarationLet; + : statement.kind === "using" || statement.kind === "await using" + ? this.hooks.varDeclarationUsing + : this.hooks.varDeclarationLet; this._preWalkVariableDeclaration(statement, hookMap); } diff --git a/package.json b/package.json index db7655c6f88..7f692c53e09 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "@webassemblyjs/ast": "^1.14.1", "@webassemblyjs/wasm-edit": "^1.14.1", "@webassemblyjs/wasm-parser": "^1.14.1", - "acorn": "^8.14.0", + "acorn": "^8.15.0", "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.17.2", @@ -71,10 +71,10 @@ "hash-wasm": "^4.9.0", "husky": "^9.0.11", "istanbul": "^0.4.5", - "jest": "^30.0.2", - "jest-circus": "^30.0.2", - "jest-cli": "^30.0.2", - "jest-diff": "^30.0.2", + "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-junit": "^16.0.0", "json-loader": "^0.5.7", diff --git a/test/cases/parsing/using/index.js b/test/cases/parsing/using/index.js new file mode 100644 index 00000000000..25b5c725098 --- /dev/null +++ b/test/cases/parsing/using/index.js @@ -0,0 +1,55 @@ +import { resource, disposed } from "./module.js"; + +let disposeCounter = 0; + +const getResource = () => { + return { + test() { + // Nothing + }, + [Symbol.dispose]: () => { + disposeCounter++; + } + } +} + + +it("should using", async () => { + { + using foo = getResource(); + + foo.test(); + } + + expect(disposeCounter).toBe(1); + + { + await using bar = getResource(); + + bar.test(); + } + + expect(disposeCounter).toBe(2); + + for (await using x of [getResource()]) { + x.test(); + } + + expect(disposeCounter).toBe(3); + + for await (await using x of [getResource()]) { + x.test(); + } + + expect(disposeCounter).toBe(4); + + { + using resource = await getResource(); + } + + expect(disposeCounter).toBe(5); + + // TODO uncomment when will re resolved on V8 side - https://github.com/tc39/proposal-explicit-resource-management/issues/262 + // resource[Symbol.dispose](); + // expect(disposed).toBe(true); +}); diff --git a/test/cases/parsing/using/module.js b/test/cases/parsing/using/module.js new file mode 100644 index 00000000000..0732aca7f40 --- /dev/null +++ b/test/cases/parsing/using/module.js @@ -0,0 +1,9 @@ +let disposed = false; + +using resource = { + [Symbol.dispose]: () => { + disposed = true; + } +}; + +export { resource, disposed }; diff --git a/test/cases/parsing/using/test.filter.js b/test/cases/parsing/using/test.filter.js new file mode 100644 index 00000000000..62f7583d1ab --- /dev/null +++ b/test/cases/parsing/using/test.filter.js @@ -0,0 +1,10 @@ +const supportsUsing = require("../../../helpers/supportsUsing"); + +module.exports = function (config) { + // TODO https://github.com/terser/terser/issues/1625 + if (config.minimize) { + return false; + } + + return supportsUsing(); +}; diff --git a/test/configCases/source-map/exclude-modules-source-map/index.js b/test/configCases/source-map/exclude-modules-source-map/index.js index bb54f271649..568a5ee144b 100644 --- a/test/configCases/source-map/exclude-modules-source-map/index.js +++ b/test/configCases/source-map/exclude-modules-source-map/index.js @@ -2,7 +2,7 @@ it("bundle1 should include eval sourcemapped test1.js and test2.js as is", funct var fs = require("fs"); var path = require("path"); var bundle1 = fs.readFileSync(path.join(__dirname, "bundle1.js"), "utf-8"); - expect(bundle1).toMatch("eval(\"var test1marker"); + expect(bundle1).toMatch("eval(\"{var test1marker"); expect(bundle1).toMatch("var test2marker"); - expect(bundle1).not.toMatch("eval(\"var test2marker"); + expect(bundle1).not.toMatch("eval(\"{var test2marker"); }); diff --git a/test/helpers/supportsUsing.js b/test/helpers/supportsUsing.js new file mode 100644 index 00000000000..b7dd79ebfd3 --- /dev/null +++ b/test/helpers/supportsUsing.js @@ -0,0 +1,23 @@ +module.exports = function supportsUsing() { + try { + const f = eval(`(function f() { + let disposed = false; + + { + const getResource = () => { + return { + [Symbol.dispose]: () => { + disposed = true; + } + } + } + using resource = getResource(); + } + + return disposed; + })`); + return f() === true; + } catch (_err) { + return false; + } +}; diff --git a/types.d.ts b/types.d.ts index 6c4ad3aa2b9..cd257d5b941 100644 --- a/types.d.ts +++ b/types.d.ts @@ -6682,6 +6682,7 @@ declare class JavascriptParser extends Parser { varDeclaration: HookMap>; varDeclarationLet: HookMap>; varDeclarationConst: HookMap>; + varDeclarationUsing: HookMap>; varDeclarationVar: HookMap>; pattern: HookMap>; canRename: HookMap>; diff --git a/yarn.lock b/yarn.lock index bc99358eb36..40630669278 100644 --- a/yarn.lock +++ b/yarn.lock @@ -957,10 +957,10 @@ jest-util "30.0.2" slash "^3.0.0" -"@jest/core@30.0.2": - version "30.0.2" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-30.0.2.tgz#c84c85baac55e6fa85b491edc4280425631951c7" - integrity sha512-mUMFdDtYWu7la63NxlyNIhgnzynszxunXWrtryR7bV24jV9hmi7XCZTzZHaLJjcBU66MeUAPZ81HjwASVpYhYQ== +"@jest/core@30.0.3": + version "30.0.3" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-30.0.3.tgz#87967dd3ea6bd6bc98e99aa4b47bfbb0b7f2a77e" + integrity sha512-Mgs1N+NSHD3Fusl7bOq1jyxv1JDAUwjy+0DhVR93Q6xcBP9/bAQ+oZhXb5TTnP5sQzAHgb7ROCKQ2SnovtxYtg== dependencies: "@jest/console" "30.0.2" "@jest/pattern" "30.0.1" @@ -975,15 +975,15 @@ exit-x "^0.2.2" graceful-fs "^4.2.11" jest-changed-files "30.0.2" - jest-config "30.0.2" + jest-config "30.0.3" jest-haste-map "30.0.2" jest-message-util "30.0.2" jest-regex-util "30.0.1" jest-resolve "30.0.2" - jest-resolve-dependencies "30.0.2" - jest-runner "30.0.2" - jest-runtime "30.0.2" - jest-snapshot "30.0.2" + jest-resolve-dependencies "30.0.3" + jest-runner "30.0.3" + jest-runtime "30.0.3" + jest-snapshot "30.0.3" jest-util "30.0.2" jest-validate "30.0.2" jest-watcher "30.0.2" @@ -1006,20 +1006,20 @@ "@types/node" "*" jest-mock "30.0.2" -"@jest/expect-utils@30.0.2": - version "30.0.2" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.0.2.tgz#d065f68c128cec526540193d88f2fc64c3d4f971" - integrity sha512-FHF2YdtFBUQOo0/qdgt+6UdBFcNPF/TkVzcc+4vvf8uaBzUlONytGBeeudufIHHW1khRfM1sBbRT1VCK7n/0dQ== +"@jest/expect-utils@30.0.3": + version "30.0.3" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.0.3.tgz#2a9fb40110c8a13ae464da41f877df90d2e6bc3b" + integrity sha512-SMtBvf2sfX2agcT0dA9pXwcUrKvOSDqBY4e4iRfT+Hya33XzV35YVg+98YQFErVGA/VR1Gto5Y2+A6G9LSQ3Yg== dependencies: "@jest/get-type" "30.0.1" -"@jest/expect@30.0.2": - version "30.0.2" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-30.0.2.tgz#b3d5adec28f3884d6fd0746c4b5d0d2473e9e212" - integrity sha512-blWRFPjv2cVfh42nLG6L3xIEbw+bnuiZYZDl/BZlsNG/i3wKV6FpPZ2EPHguk7t5QpLaouIu+7JmYO4uBR6AOg== +"@jest/expect@30.0.3": + version "30.0.3" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-30.0.3.tgz#9653e868ca27dd2194f6c20c81b8a690f9669465" + integrity sha512-73BVLqfCeWjYWPEQoYjiRZ4xuQRhQZU0WdgvbyXGRHItKQqg5e6mt2y1kVhzLSuZpmUnccZHbGynoaL7IcLU3A== dependencies: - expect "30.0.2" - jest-snapshot "30.0.2" + expect "30.0.3" + jest-snapshot "30.0.3" "@jest/fake-timers@30.0.2": version "30.0.2" @@ -1038,13 +1038,13 @@ resolved "https://registry.yarnpkg.com/@jest/get-type/-/get-type-30.0.1.tgz#0d32f1bbfba511948ad247ab01b9007724fc9f52" integrity sha512-AyYdemXCptSRFirI5EPazNxyPwAL0jXt3zceFjaj8NFiKP9pOi0bfXonf6qkf82z2t3QWPeLCWWw4stPBzctLw== -"@jest/globals@30.0.2": - version "30.0.2" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-30.0.2.tgz#3b401bb7cb8cc0a00476630298747a38e40a6fc1" - integrity sha512-DwTtus9jjbG7b6jUdkcVdptf0wtD1v153A+PVwWB/zFwXhqu6hhtSd+uq88jofMhmYPtkmPmVGUBRNCZEKXn+w== +"@jest/globals@30.0.3": + version "30.0.3" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-30.0.3.tgz#9c9ef55e6f5e6b7e946244bdbf2af85044b7bb04" + integrity sha512-fIduqNyYpMeeSr5iEAiMn15KxCzvrmxl7X7VwLDRGj7t5CoHtbF+7K3EvKk32mOUIJ4kIvFRlaixClMH2h/Vaw== dependencies: "@jest/environment" "30.0.2" - "@jest/expect" "30.0.2" + "@jest/expect" "30.0.3" "@jest/types" "30.0.1" jest-mock "30.0.2" @@ -3227,14 +3227,14 @@ 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.2, expect@^30.0.0: - version "30.0.2" - resolved "https://registry.yarnpkg.com/expect/-/expect-30.0.2.tgz#d073942c19d54cb7bc42c9b2a434d850433a7def" - integrity sha512-YN9Mgv2mtTWXVmifQq3QT+ixCL/uLuLJw+fdp8MOjKqu8K3XQh3o5aulMM1tn+O2DdrWNxLZTeJsCY/VofUA0A== +expect@30.0.3, expect@^30.0.0: + version "30.0.3" + resolved "https://registry.yarnpkg.com/expect/-/expect-30.0.3.tgz#8bf31a67514f78c5e4ac8d67774192ab95d5ec25" + integrity sha512-HXg6NvK35/cSYZCUKAtmlgCFyqKM4frEPbzrav5hRqb0GMz0E0lS5hfzYjSaiaE5ysnp/qI2aeZkeyeIAOeXzQ== dependencies: - "@jest/expect-utils" "30.0.2" + "@jest/expect-utils" "30.0.3" "@jest/get-type" "30.0.1" - jest-matcher-utils "30.0.2" + jest-matcher-utils "30.0.3" jest-message-util "30.0.2" jest-mock "30.0.2" jest-util "30.0.2" @@ -4114,13 +4114,13 @@ jest-changed-files@30.0.2: jest-util "30.0.2" p-limit "^3.1.0" -jest-circus@30.0.2, jest-circus@^30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-30.0.2.tgz#a00a408d5d32d2b547f20f9e84a487d236ed8ee1" - integrity sha512-NRozwx4DaFHcCUtwdEd/0jBLL1imyMrCbla3vF//wdsB2g6jIicMbjx9VhqE/BYU4dwsOQld+06ODX0oZ9xOLg== +jest-circus@30.0.3, jest-circus@^30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-30.0.3.tgz#d2de4adb92cfdbce18668e27176c1b9f79afdf5a" + integrity sha512-rD9qq2V28OASJHJWDRVdhoBdRs6k3u3EmBzDYcyuMby8XCO3Ll1uq9kyqM41ZcC4fMiPulMVh3qMw0cBvDbnyg== dependencies: "@jest/environment" "30.0.2" - "@jest/expect" "30.0.2" + "@jest/expect" "30.0.3" "@jest/test-result" "30.0.2" "@jest/types" "30.0.1" "@types/node" "*" @@ -4129,10 +4129,10 @@ jest-circus@30.0.2, jest-circus@^30.0.2: dedent "^1.6.0" is-generator-fn "^2.1.0" jest-each "30.0.2" - jest-matcher-utils "30.0.2" + jest-matcher-utils "30.0.3" jest-message-util "30.0.2" - jest-runtime "30.0.2" - jest-snapshot "30.0.2" + jest-runtime "30.0.3" + jest-snapshot "30.0.3" jest-util "30.0.2" p-limit "^3.1.0" pretty-format "30.0.2" @@ -4140,26 +4140,26 @@ jest-circus@30.0.2, jest-circus@^30.0.2: slash "^3.0.0" stack-utils "^2.0.6" -jest-cli@30.0.2, jest-cli@^30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-30.0.2.tgz#cf8ad8a1157721c3a1dc3a371565f6b7f5e6b549" - integrity sha512-yQ6Qz747oUbMYLNAqOlEby+hwXx7WEJtCl0iolBRpJhr2uvkBgiVMrvuKirBc8utwQBnkETFlDUkYifbRpmBrQ== +jest-cli@30.0.3, jest-cli@^30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-30.0.3.tgz#2340b69c580c471fd9f4a197f969025a545608dd" + integrity sha512-UWDSj0ayhumEAxpYRlqQLrssEi29kdQ+kddP94AuHhZknrE+mT0cR0J+zMHKFe9XPfX3dKQOc2TfWki3WhFTsA== dependencies: - "@jest/core" "30.0.2" + "@jest/core" "30.0.3" "@jest/test-result" "30.0.2" "@jest/types" "30.0.1" chalk "^4.1.2" exit-x "^0.2.2" import-local "^3.2.0" - jest-config "30.0.2" + jest-config "30.0.3" jest-util "30.0.2" jest-validate "30.0.2" yargs "^17.7.2" -jest-config@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-30.0.2.tgz#a4884ba3b4d31fb0599b0b78e7a0204efb126f9d" - integrity sha512-vo0fVq+uzDcXETFVnCUyr5HaUCM8ES6DEuS9AFpma34BVXMRRNlsqDyiW5RDHaEFoeFlJHoI4Xjh/WSYIAL58g== +jest-config@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-30.0.3.tgz#978853722b9b0f2d0596025ea423cc6c7b603c07" + integrity sha512-j0L4oRCtJwNyZktXIqwzEiDVQXBbQ4dqXuLD/TZdn++hXIcIfZmjHgrViEy5s/+j4HvITmAXbexVZpQ/jnr0bg== dependencies: "@babel/core" "^7.27.4" "@jest/get-type" "30.0.1" @@ -4172,12 +4172,12 @@ jest-config@30.0.2: deepmerge "^4.3.1" glob "^10.3.10" graceful-fs "^4.2.11" - jest-circus "30.0.2" + jest-circus "30.0.3" jest-docblock "30.0.1" jest-environment-node "30.0.2" jest-regex-util "30.0.1" jest-resolve "30.0.2" - jest-runner "30.0.2" + jest-runner "30.0.3" jest-util "30.0.2" jest-validate "30.0.2" micromatch "^4.0.8" @@ -4186,10 +4186,10 @@ jest-config@30.0.2: slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@30.0.2, jest-diff@^30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.0.2.tgz#db77e7ca48a964337c0a4259d5e389c0bb124d7e" - integrity sha512-2UjrNvDJDn/oHFpPrUTVmvYYDNeNtw2DlY3er8bI6vJJb9Fb35ycp/jFLd5RdV59tJ8ekVXX3o/nwPcscgXZJQ== +jest-diff@30.0.3, jest-diff@^30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.0.3.tgz#50ac056b90fe9151d6266b18a27adeb064c30235" + integrity sha512-Q1TAV0cUcBTic57SVnk/mug0/ASyAqtSIOkr7RAlxx97llRYsM74+E8N5WdGJUlwCKwgxPAkVjKh653h1+HA9A== dependencies: "@jest/diff-sequences" "30.0.1" "@jest/get-type" "30.0.1" @@ -4263,14 +4263,14 @@ jest-leak-detector@30.0.2: "@jest/get-type" "30.0.1" pretty-format "30.0.2" -jest-matcher-utils@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.0.2.tgz#2dbb5f9aacfdd9c013fa72ed6132ca4e1b41f8db" - integrity sha512-1FKwgJYECR8IT93KMKmjKHSLyru0DqguThov/aWpFccC0wbiXGOxYEu7SScderBD7ruDOpl7lc5NG6w3oxKfaA== +jest-matcher-utils@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.0.3.tgz#e07e4776bade71a3a7948a9bf8aeede311c5013a" + integrity sha512-hMpVFGFOhYmIIRGJ0HgM9htC5qUiJ00famcc9sRFchJJiLZbbVKrAztcgE6VnXLRxA3XZ0bvNA7hQWh3oHXo/A== dependencies: "@jest/get-type" "30.0.1" chalk "^4.1.2" - jest-diff "30.0.2" + jest-diff "30.0.3" pretty-format "30.0.2" jest-message-util@30.0.2: @@ -4307,13 +4307,13 @@ 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.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-30.0.2.tgz#0c5da8dc5f791f3de10c1d5df294503cd612e5a6" - integrity sha512-Lp1iIXpsF5fGM4vyP8xHiIy2H5L5yO67/nXoYJzH4kz+fQmO+ZMKxzYLyWxYy4EeCLeNQ6a9OozL+uHZV2iuEA== +jest-resolve-dependencies@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-30.0.3.tgz#8278f54a84009028b823f5c1f7033fb968405b2f" + integrity sha512-FlL6u7LiHbF0Oe27k7DHYMq2T2aNpPhxnNo75F7lEtu4A6sSw+TKkNNUGNcVckdFoL0RCWREJsC1HsKDwKRZzQ== dependencies: jest-regex-util "30.0.1" - jest-snapshot "30.0.2" + jest-snapshot "30.0.3" jest-resolve@30.0.2: version "30.0.2" @@ -4329,10 +4329,10 @@ jest-resolve@30.0.2: slash "^3.0.0" unrs-resolver "^1.7.11" -jest-runner@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-30.0.2.tgz#28022ea290e2759864ae97cb5307bcae98e68f2d" - integrity sha512-6H+CIFiDLVt1Ix6jLzASXz3IoIiDukpEIxL9FHtDQ2BD/k5eFtDF5e5N9uItzRE3V1kp7VoSRyrGBytXKra4xA== +jest-runner@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-30.0.3.tgz#baa1d5e77655c70cea9aa4138cfb437f6bada607" + integrity sha512-CxYBzu9WStOBBXAKkLXGoUtNOWsiS1RRmUQb6SsdUdTcqVncOau7m8AJ4cW3Mz+YL1O9pOGPSYLyvl8HBdFmkQ== dependencies: "@jest/console" "30.0.2" "@jest/environment" "30.0.2" @@ -4350,21 +4350,21 @@ jest-runner@30.0.2: jest-leak-detector "30.0.2" jest-message-util "30.0.2" jest-resolve "30.0.2" - jest-runtime "30.0.2" + jest-runtime "30.0.3" jest-util "30.0.2" jest-watcher "30.0.2" jest-worker "30.0.2" p-limit "^3.1.0" source-map-support "0.5.13" -jest-runtime@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-30.0.2.tgz#db5b4723ebdb8c2158779c055976cb6cc22ce1df" - integrity sha512-H1a51/soNOeAjoggu6PZKTH7DFt8JEGN4mesTSwyqD2jU9PXD04Bp6DKbt2YVtQvh2JcvH2vjbkEerCZ3lRn7A== +jest-runtime@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-30.0.3.tgz#1eb112924426e8b90c37f0ea7da1b51966e252bf" + integrity sha512-Xjosq0C48G9XEQOtmgrjXJwPaUPaq3sPJwHDRaiC+5wi4ZWxO6Lx6jNkizK/0JmTulVNuxP8iYwt77LGnfg3/w== dependencies: "@jest/environment" "30.0.2" "@jest/fake-timers" "30.0.2" - "@jest/globals" "30.0.2" + "@jest/globals" "30.0.3" "@jest/source-map" "30.0.1" "@jest/test-result" "30.0.2" "@jest/transform" "30.0.2" @@ -4380,32 +4380,32 @@ jest-runtime@30.0.2: jest-mock "30.0.2" jest-regex-util "30.0.1" jest-resolve "30.0.2" - jest-snapshot "30.0.2" + jest-snapshot "30.0.3" jest-util "30.0.2" slash "^3.0.0" strip-bom "^4.0.0" -jest-snapshot@30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-30.0.2.tgz#0f9f2c59c2070874a2db96d30c8543dfef657701" - integrity sha512-KeoHikoKGln3OlN7NS7raJ244nIVr2K46fBTNdfuxqYv2/g4TVyWDSO4fmk08YBJQMjs3HNfG1rlLfL/KA+nUw== +jest-snapshot@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-30.0.3.tgz#f605254223eee0946d205c6e7ede7238e87be920" + integrity sha512-F05JCohd3OA1N9+5aEPXA6I0qOfZDGIx0zTq5Z4yMBg2i1p5ELfBusjYAWwTkC12c7dHcbyth4QAfQbS7cRjow== 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.2" + "@jest/expect-utils" "30.0.3" "@jest/get-type" "30.0.1" "@jest/snapshot-utils" "30.0.1" "@jest/transform" "30.0.2" "@jest/types" "30.0.1" babel-preset-current-node-syntax "^1.1.0" chalk "^4.1.2" - expect "30.0.2" + expect "30.0.3" graceful-fs "^4.2.11" - jest-diff "30.0.2" - jest-matcher-utils "30.0.2" + jest-diff "30.0.3" + jest-matcher-utils "30.0.3" jest-message-util "30.0.2" jest-util "30.0.2" pretty-format "30.0.2" @@ -4470,15 +4470,15 @@ jest-worker@^27.4.5: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^30.0.2: - version "30.0.2" - resolved "https://registry.yarnpkg.com/jest/-/jest-30.0.2.tgz#0b3af654548d706bdde6f1bba93099ec343b8772" - integrity sha512-HlSEiHRcmTuGwNyeawLTEzpQUMFn+f741FfoNg7RXG2h0WLJKozVCpcQLT0GW17H6kNCqRwGf+Ii/I1YVNvEGQ== +jest@^30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest/-/jest-30.0.3.tgz#fc3b6b370e2820d718ea299d159a7ba4637dbd35" + integrity sha512-Uy8xfeE/WpT2ZLGDXQmaYNzw2v8NUKuYeKGtkS6sDxwsdQihdgYCXaKIYnph1h95DN5H35ubFDm0dfmsQnjn4Q== dependencies: - "@jest/core" "30.0.2" + "@jest/core" "30.0.3" "@jest/types" "30.0.1" import-local "^3.2.0" - jest-cli "30.0.2" + jest-cli "30.0.3" js-stringify@^1.0.2: version "1.0.2" From 22c0d02e6672663563874ad406117394160b14c1 Mon Sep 17 00:00:00 2001 From: Natsu Xiao <784487301@qq.com> Date: Fri, 27 Jun 2025 01:13:31 +0800 Subject: [PATCH 31/56] fix: unexpected error codes from fs.unlink on Windows --- lib/CleanPlugin.js | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js index 77a85147e19..9e610d6b30e 100644 --- a/lib/CleanPlugin.js +++ b/lib/CleanPlugin.js @@ -229,22 +229,43 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => { jobs, 10, ({ type, filename, parent }, push, callback) => { + const path = join(fs, outputPath, filename); /** * @param {Error & { code?: string }} err error * @returns {void} */ const handleError = err => { - if (err.code === "ENOENT") { - log(`${filename} was removed during cleaning by something else`); - handleParent(); - return callback(); - } - return callback(err); + const isAlreadyRemoved = () => + 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 => { + if (err) { + resolve(err.code === "ENOENT"); + } else { + resolve(false); + } + }); + } else { + resolve(false); + } + }); + + isAlreadyRemoved().then(isRemoved => { + if (isRemoved) { + log(`${filename} was removed during cleaning by something else`); + handleParent(); + return callback(); + } + return callback(err); + }); }; const handleParent = () => { if (parent && --parent.remaining === 0) push(parent.job); }; - const path = join(fs, outputPath, filename); switch (type) { case "check": if (isKept(filename)) { From 0e4a7ce73fcad531cdbb0b17b3cb576e7d3fc383 Mon Sep 17 00:00:00 2001 From: Natsu Xiao <784487301@qq.com> Date: Fri, 27 Jun 2025 02:11:41 +0800 Subject: [PATCH 32/56] refactor: reimplement hmrDownloadManifest in ESM to support more platforms --- lib/HotModuleReplacementPlugin.js | 5 ++++- lib/config/defaults.js | 6 +++++- lib/esm/ModuleChunkLoadingRuntimeModule.js | 9 +++------ test/Defaults.unittest.js | 3 +++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 8c84f3a1a3c..824cb433e48 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -830,7 +830,10 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename ) }; - const source = new RawSource(JSON.stringify(hotUpdateMainJson)); + const source = new RawSource( + (filename.endsWith(".json") ? "" : "export default ") + + JSON.stringify(hotUpdateMainJson) + ); compilation.emitAsset(filename, source, { hotModuleReplacement: true, ...assetInfo diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 27fc64b64e0..09759c5fd34 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -1276,7 +1276,11 @@ const applyOutputDefaults = ( "hotUpdateChunkFilename", `[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}` ); - D(output, "hotUpdateMainFilename", "[runtime].[fullhash].hot-update.json"); + D( + output, + "hotUpdateMainFilename", + `[runtime].[fullhash].hot-update.${output.module ? "json.mjs" : "json"}` + ); D(output, "crossOriginLoading", false); F(output, "scriptType", () => (output.module ? "module" : false)); D( diff --git a/lib/esm/ModuleChunkLoadingRuntimeModule.js b/lib/esm/ModuleChunkLoadingRuntimeModule.js index ed850b0fd66..a2aa3f9f651 100644 --- a/lib/esm/ModuleChunkLoadingRuntimeModule.js +++ b/lib/esm/ModuleChunkLoadingRuntimeModule.js @@ -424,13 +424,10 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { `${ RuntimeGlobals.hmrDownloadManifest } = ${runtimeTemplate.basicFunction("", [ - 'if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");', - `return fetch(${RuntimeGlobals.publicPath} + ${ + `return ${importFunctionName}(/* webpackIgnore: true */ ${RuntimeGlobals.publicPath} + ${ RuntimeGlobals.getUpdateManifestFilename - }()).then(${runtimeTemplate.basicFunction("response", [ - "if(response.status === 404) return; // no update available", - 'if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);', - "return response.json();" + }()).then(${runtimeTemplate.basicFunction("obj", [ + "return obj.default;" ])});` ])};` ]) diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js index f71e94d99e9..26bcef42680 100644 --- a/test/Defaults.unittest.js +++ b/test/Defaults.unittest.js @@ -968,6 +968,9 @@ describe("snapshots", () => { - "hotUpdateChunkFilename": "[id].[fullhash].hot-update.js", + "hotUpdateChunkFilename": "[id].[fullhash].hot-update.mjs", @@ ... @@ + - "hotUpdateMainFilename": "[runtime].[fullhash].hot-update.json", + + "hotUpdateMainFilename": "[runtime].[fullhash].hot-update.json.mjs", + @@ ... @@ - "iife": true, + "iife": false, @@ ... @@ From 2ee507894158b61bfdda2c5013cb696f6c7da937 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 18:09:30 +0300 Subject: [PATCH 33/56] chore(deps): bump the dependencies group across 1 directory with 5 updates (#19634) Bumps the dependencies group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [browserslist](https://github.com/browserslist/browserslist) | `4.25.0` | `4.25.1` | | [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) | `7.27.4` | `7.27.7` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `24.0.3` | `24.0.4` | | [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) | `5.5.0` | `5.5.1` | | [prettier](https://github.com/prettier/prettier) | `3.6.0` | `3.6.1` | Updates `browserslist` from 4.25.0 to 4.25.1 - [Release notes](https://github.com/browserslist/browserslist/releases) - [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md) - [Commits](https://github.com/browserslist/browserslist/compare/4.25.0...4.25.1) Updates `@babel/core` from 7.27.4 to 7.27.7 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.7/packages/babel-core) Updates `@types/node` from 24.0.3 to 24.0.4 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `eslint-plugin-prettier` from 5.5.0 to 5.5.1 - [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases) - [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v5.5.0...v5.5.1) Updates `prettier` from 3.6.0 to 3.6.1 - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.6.0...3.6.1) --- updated-dependencies: - dependency-name: browserslist dependency-version: 4.25.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: "@babel/core" dependency-version: 7.27.7 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: "@types/node" dependency-version: 24.0.4 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: eslint-plugin-prettier dependency-version: 5.5.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: prettier dependency-version: 3.6.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 104 +++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/yarn.lock b/yarn.lock index 40630669278..28934c63769 100644 --- a/yarn.lock +++ b/yarn.lock @@ -35,27 +35,27 @@ integrity sha512-V42wFfx1ymFte+ecf6iXghnnP8kWTO+ZLXIyZq+1LAXHHvTZdVxicn4yiVYdYMGaCO3tmqub11AorKkv+iodqw== "@babel/core@^7.23.9", "@babel/core@^7.27.1", "@babel/core@^7.27.4": - version "7.27.4" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.27.4.tgz#cc1fc55d0ce140a1828d1dd2a2eba285adbfb3ce" - integrity sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g== + version "7.27.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.27.7.tgz#0ddeab1e7b17317dad8c3c3a887716f66b5c4428" + integrity sha512-BU2f9tlKQ5CAthiMIgpzAh4eDTLWo1mqi9jqE2OxMG0E/OM199VJt2q8BztTxpnSW0i1ymdwLXRJnYzvDM5r2w== dependencies: "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.27.3" + "@babel/generator" "^7.27.5" "@babel/helper-compilation-targets" "^7.27.2" "@babel/helper-module-transforms" "^7.27.3" - "@babel/helpers" "^7.27.4" - "@babel/parser" "^7.27.4" + "@babel/helpers" "^7.27.6" + "@babel/parser" "^7.27.7" "@babel/template" "^7.27.2" - "@babel/traverse" "^7.27.4" - "@babel/types" "^7.27.3" + "@babel/traverse" "^7.27.7" + "@babel/types" "^7.27.7" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.27.3", "@babel/generator@^7.27.5": +"@babel/generator@^7.27.5": version "7.27.5" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.5.tgz#3eb01866b345ba261b04911020cbe22dd4be8c8c" integrity sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw== @@ -121,20 +121,20 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== -"@babel/helpers@^7.27.4": - version "7.27.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.27.4.tgz#c79050c6a0e41e095bfc96d469c85431e9ed7fe7" - integrity sha512-Y+bO6U+I7ZKaM5G5rDUZiYfUvQPUibYmAFe7EnKdnKBbVXDZxvp+MWOH5gYciY0EPk4EScsuFMQBbEfpdRKSCQ== +"@babel/helpers@^7.27.6": + version "7.27.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.27.6.tgz#6456fed15b2cb669d2d1fabe84b66b34991d812c" + integrity sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug== dependencies: "@babel/template" "^7.27.2" - "@babel/types" "^7.27.3" + "@babel/types" "^7.27.6" -"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.27.4", "@babel/parser@^7.27.5", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": - version "7.27.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.5.tgz#ed22f871f110aa285a6fd934a0efed621d118826" - integrity sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg== +"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.27.5", "@babel/parser@^7.27.7", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": + version "7.27.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.7.tgz#1687f5294b45039c159730e3b9c1f1b242e425e9" + integrity sha512-qnzXzDXdr/po3bOTbTIQZ7+TxNKxpkN5IifVLXS+r7qwynkZfPyjZfE7hCXbo7IoO9TNcSyibgONsf2HauUd3Q== dependencies: - "@babel/types" "^7.27.3" + "@babel/types" "^7.27.7" "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -309,23 +309,23 @@ "@babel/parser" "^7.27.2" "@babel/types" "^7.27.1" -"@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.27.4": - version "7.27.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.4.tgz#b0045ac7023c8472c3d35effd7cc9ebd638da6ea" - integrity sha512-oNcu2QbHqts9BtOWJosOVJapWjBDSxGCpFvikNR5TGDYDQf3JwpIoMzIKrvfoti93cLfPJEG4tH9SPVeyCGgdA== +"@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.27.7": + version "7.27.7" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.7.tgz#8355c39be6818362eace058cf7f3e25ac2ec3b55" + integrity sha512-X6ZlfR/O/s5EQ/SnUSLzr+6kGnkg8HXGMzpgsMsrJVcfDtH1vIp6ctCN4eZ1LS5c0+te5Cb6Y514fASjMRJ1nw== dependencies: "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.27.3" - "@babel/parser" "^7.27.4" + "@babel/generator" "^7.27.5" + "@babel/parser" "^7.27.7" "@babel/template" "^7.27.2" - "@babel/types" "^7.27.3" + "@babel/types" "^7.27.7" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.6.1", "@babel/types@^7.9.6": - version "7.27.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.3.tgz#c0257bedf33aad6aad1f406d35c44758321eb3ec" - integrity sha512-Y1GkI4ktrtvmawoSq+4FCVHNryea6uR+qUQy0AGxLSsjCX0nVmkYQMBLHDkXZuo5hGx7eYdnIaslsdBFm7zbUw== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.27.6", "@babel/types@^7.27.7", "@babel/types@^7.6.1", "@babel/types@^7.9.6": + version "7.27.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.7.tgz#40eabd562049b2ee1a205fa589e629f945dce20f" + integrity sha512-8OLQgDScAOHXnAz2cV+RfzzNMipuLVBz2biuAJFMV9bfkNf393je3VM8CLkjQodW5+iWsSJdSgSWT6rsZoXHPw== dependencies: "@babel/helper-string-parser" "^7.27.1" "@babel/helper-validator-identifier" "^7.27.1" @@ -1447,9 +1447,9 @@ integrity sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w== "@types/node@*", "@types/node@^24.0.3": - version "24.0.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.3.tgz#f935910f3eece3a3a2f8be86b96ba833dc286cab" - integrity sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg== + version "24.0.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.4.tgz#dbae889912bda33a7f57669fb8587c1a56bc0c1f" + integrity sha512-ulyqAkrhnuNq9pB76DRBTkcS6YsmDALy6Ua63V8OhrOBgbcYt6IOdzpw5P1+dyRIyMerzLkeYWBeOXPpA9GMAA== dependencies: undici-types "~7.8.0" @@ -2119,12 +2119,12 @@ braces@^3.0.3: fill-range "^7.1.1" browserslist@^4.24.0, browserslist@^4.24.4: - version "4.25.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.0.tgz#986aa9c6d87916885da2b50d8eb577ac8d133b2c" - integrity sha512-PJ8gYKeS5e/whHBh8xrwYK+dAvEj7JXtz6uTucnMRB8OiGTsKccFekoRrjajPBHV8oOY+2tI4uxeceSimKwMFA== + version "4.25.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.1.tgz#ba9e8e6f298a1d86f829c9b975e07948967bb111" + integrity sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw== dependencies: - caniuse-lite "^1.0.30001718" - electron-to-chromium "^1.5.160" + caniuse-lite "^1.0.30001726" + electron-to-chromium "^1.5.173" node-releases "^2.0.19" update-browserslist-db "^1.1.3" @@ -2231,10 +2231,10 @@ camelcase@^6.3.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001718: - version "1.0.30001720" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001720.tgz#c138cb6026d362be9d8d7b0e4bcd0183a850edfd" - integrity sha512-Ec/2yV2nNPwb4DnTANEV99ZWwm3ZWfdlfkQbWSDDt+PsXEVYwlhPH8tdMaPunYTKKmz7AnHi2oNEi1GcmKCD8g== +caniuse-lite@^1.0.30001726: + version "1.0.30001726" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001726.tgz#a15bd87d5a4bf01f6b6f70ae7c97fdfd28b5ae47" + integrity sha512-VQAUIUzBiZ/UnlM28fSp2CRF3ivUn1BWEvxMcVTNwpw91Py1pGbPIyIKtd+tzct9C3ouceCVdGAXxZOpZAsgdw== chalk-template@^1.1.0: version "1.1.0" @@ -2768,10 +2768,10 @@ eastasianwidth@^0.2.0: resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -electron-to-chromium@^1.5.160: - version "1.5.161" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.161.tgz#650376bd3be7ff8e581031409fc2d4f150620b12" - integrity sha512-hwtetwfKNZo/UlwHIVBlKZVdy7o8bIZxxKs0Mv/ROPiQQQmDgdm5a+KvKtBsxM8ZjFzTaCeLoodZ8jiBE3o9rA== +electron-to-chromium@^1.5.173: + version "1.5.176" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.176.tgz#f4bbbd2c0a9a6a2a527c884eacc18244fa79dd88" + integrity sha512-2nDK9orkm7M9ZZkjO3PjbEd3VUulQLyg5T9O3enJdFvUg46Hzd4DUvTvAuEgbdHYXyFsiG4A5sO9IzToMH1cDg== emittery@^0.13.1: version "0.13.1" @@ -3024,9 +3024,9 @@ eslint-plugin-n@^17.20.0: ts-declaration-location "^1.0.6" eslint-plugin-prettier@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.0.tgz#cf763962f90bad035db03ca008ffb0c9b359fb16" - integrity sha512-8qsOYwkkGrahrgoUv76NZi23koqXOGiiEzXMrT8Q7VcYaUISR+5MorIUxfWqYXN0fN/31WbSrxCxFkVQ43wwrA== + 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== dependencies: prettier-linter-helpers "^1.0.0" synckit "^0.11.7" @@ -5558,9 +5558,9 @@ prettier@^2.0.5: integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== prettier@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.0.tgz#18ec98d62cb0757a5d4eab40253ff3e6d0fc8dea" - integrity sha512-ujSB9uXHJKzM/2GBuE0hBOUgC77CN3Bnpqa+g80bkv3T3A93wL/xlzDATHhnhkzifz/UE2SNOvmbTz5hSkDlHw== + version "3.6.2" + 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" From 5bcd259a09a47624bf7df8735cc9278be5e61323 Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Fri, 27 Jun 2025 23:44:59 +0800 Subject: [PATCH 34/56] refactor: consolidate HMR code and refine ESM HMR (#19629) --- lib/esm/ModuleChunkLoadingRuntimeModule.js | 26 ++----------- .../JavascriptHotModuleReplacementHelper.js | 37 +++++++++++++++++++ lib/node/ReadFileChunkLoadingRuntimeModule.js | 26 ++----------- lib/node/RequireChunkLoadingRuntimeModule.js | 26 ++----------- lib/web/JsonpChunkLoadingRuntimeModule.js | 26 ++----------- .../ImportScriptsChunkLoadingRuntimeModule.js | 26 ++----------- 6 files changed, 57 insertions(+), 110 deletions(-) create mode 100644 lib/hmr/JavascriptHotModuleReplacementHelper.js diff --git a/lib/esm/ModuleChunkLoadingRuntimeModule.js b/lib/esm/ModuleChunkLoadingRuntimeModule.js index a2aa3f9f651..3a3b5c5e803 100644 --- a/lib/esm/ModuleChunkLoadingRuntimeModule.js +++ b/lib/esm/ModuleChunkLoadingRuntimeModule.js @@ -9,6 +9,9 @@ const Compilation = require("../Compilation"); const RuntimeGlobals = require("../RuntimeGlobals"); const RuntimeModule = require("../RuntimeModule"); const Template = require("../Template"); +const { + generateJavascriptHMR +} = require("../hmr/JavascriptHotModuleReplacementHelper"); const { getChunkFilenameTemplate, chunkHasJs @@ -352,28 +355,7 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { : "// no on chunks loaded", withHmr ? Template.asString([ - Template.getFunctionContent( - require("../hmr/JavascriptHotModuleReplacement.runtime.js") - ) - .replace(/\$key\$/g, "jsonp") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ), + generateJavascriptHMR("module"), "", "function loadUpdateChunk(chunkId, updatedModulesList) {", Template.indent([ diff --git a/lib/hmr/JavascriptHotModuleReplacementHelper.js b/lib/hmr/JavascriptHotModuleReplacementHelper.js new file mode 100644 index 00000000000..3e786d80106 --- /dev/null +++ b/lib/hmr/JavascriptHotModuleReplacementHelper.js @@ -0,0 +1,37 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Haijie Xie @hai-x +*/ + +"use strict"; + +const RuntimeGlobals = require("../RuntimeGlobals"); + +const Template = require("../Template"); + +/** + * @param {string} type unique identifier used for HMR runtime properties + * @returns {string} HMR runtime code + */ +const generateJavascriptHMR = type => + Template.getFunctionContent( + require("../hmr/JavascriptHotModuleReplacement.runtime.js") + ) + .replace(/\$key\$/g, type) + .replace(/\$installedChunks\$/g, "installedChunks") + .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") + .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) + .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) + .replace(/\$ensureChunkHandlers\$/g, RuntimeGlobals.ensureChunkHandlers) + .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) + .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) + .replace( + /\$hmrDownloadUpdateHandlers\$/g, + RuntimeGlobals.hmrDownloadUpdateHandlers + ) + .replace( + /\$hmrInvalidateModuleHandlers\$/g, + RuntimeGlobals.hmrInvalidateModuleHandlers + ); + +module.exports.generateJavascriptHMR = generateJavascriptHMR; diff --git a/lib/node/ReadFileChunkLoadingRuntimeModule.js b/lib/node/ReadFileChunkLoadingRuntimeModule.js index fd138b2e899..632c5eaa487 100644 --- a/lib/node/ReadFileChunkLoadingRuntimeModule.js +++ b/lib/node/ReadFileChunkLoadingRuntimeModule.js @@ -7,6 +7,9 @@ const RuntimeGlobals = require("../RuntimeGlobals"); const RuntimeModule = require("../RuntimeModule"); const Template = require("../Template"); +const { + generateJavascriptHMR +} = require("../hmr/JavascriptHotModuleReplacementHelper"); const { chunkHasJs, getChunkFilenameTemplate @@ -242,28 +245,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { ]), "}", "", - Template.getFunctionContent( - require("../hmr/JavascriptHotModuleReplacement.runtime.js") - ) - .replace(/\$key\$/g, "readFileVm") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) + generateJavascriptHMR("readFileVm") ]) : "// no HMR", "", diff --git a/lib/node/RequireChunkLoadingRuntimeModule.js b/lib/node/RequireChunkLoadingRuntimeModule.js index 1d4959459d5..c54cbac6268 100644 --- a/lib/node/RequireChunkLoadingRuntimeModule.js +++ b/lib/node/RequireChunkLoadingRuntimeModule.js @@ -7,6 +7,9 @@ const RuntimeGlobals = require("../RuntimeGlobals"); const RuntimeModule = require("../RuntimeModule"); const Template = require("../Template"); +const { + generateJavascriptHMR +} = require("../hmr/JavascriptHotModuleReplacementHelper"); const { chunkHasJs, getChunkFilenameTemplate @@ -199,28 +202,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule { ]), "}", "", - Template.getFunctionContent( - require("../hmr/JavascriptHotModuleReplacement.runtime.js") - ) - .replace(/\$key\$/g, "require") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) + generateJavascriptHMR("require") ]) : "// no HMR", "", diff --git a/lib/web/JsonpChunkLoadingRuntimeModule.js b/lib/web/JsonpChunkLoadingRuntimeModule.js index 0b9cebd8407..b4fc76d4ac2 100644 --- a/lib/web/JsonpChunkLoadingRuntimeModule.js +++ b/lib/web/JsonpChunkLoadingRuntimeModule.js @@ -9,6 +9,9 @@ const Compilation = require("../Compilation"); const RuntimeGlobals = require("../RuntimeGlobals"); const RuntimeModule = require("../RuntimeModule"); const Template = require("../Template"); +const { + generateJavascriptHMR +} = require("../hmr/JavascriptHotModuleReplacementHelper"); const chunkHasJs = require("../javascript/JavascriptModulesPlugin").chunkHasJs; const { getInitialChunkIds } = require("../javascript/StartupHelpers"); const compileBooleanMatcher = require("../util/compileBooleanMatcher"); @@ -363,28 +366,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { ] )};`, "", - Template.getFunctionContent( - require("../hmr/JavascriptHotModuleReplacement.runtime.js") - ) - .replace(/\$key\$/g, "jsonp") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) + generateJavascriptHMR("jsonp") ]) : "// no HMR", "", diff --git a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js index 06e1815cb78..6b2cf24c163 100644 --- a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +++ b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js @@ -7,6 +7,9 @@ const RuntimeGlobals = require("../RuntimeGlobals"); const RuntimeModule = require("../RuntimeModule"); const Template = require("../Template"); +const { + generateJavascriptHMR +} = require("../hmr/JavascriptHotModuleReplacementHelper"); const { getChunkFilenameTemplate, chunkHasJs @@ -199,28 +202,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { ]), "}", "", - Template.getFunctionContent( - require("../hmr/JavascriptHotModuleReplacement.runtime.js") - ) - .replace(/\$key\$/g, "importScripts") - .replace(/\$installedChunks\$/g, "installedChunks") - .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") - .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) - .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories) - .replace( - /\$ensureChunkHandlers\$/g, - RuntimeGlobals.ensureChunkHandlers - ) - .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty) - .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData) - .replace( - /\$hmrDownloadUpdateHandlers\$/g, - RuntimeGlobals.hmrDownloadUpdateHandlers - ) - .replace( - /\$hmrInvalidateModuleHandlers\$/g, - RuntimeGlobals.hmrInvalidateModuleHandlers - ) + generateJavascriptHMR("importScripts") ]) : "// no HMR", "", From 4d844bea903b5f1e4a13162d32b59e348418384a Mon Sep 17 00:00:00 2001 From: Natsu Xiao <784487301@qq.com> Date: Tue, 1 Jul 2025 18:11:46 +0800 Subject: [PATCH 35/56] refactor: replace the implementation of magic_number (#19636) --- lib/javascript/JavascriptGenerator.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/javascript/JavascriptGenerator.js b/lib/javascript/JavascriptGenerator.js index 56dcdd46fa3..3f50e39ae88 100644 --- a/lib/javascript/JavascriptGenerator.js +++ b/lib/javascript/JavascriptGenerator.js @@ -25,6 +25,18 @@ const HarmonyCompatibilityDependency = require("../dependencies/HarmonyCompatibi /** @typedef {import("../NormalModule")} NormalModule */ /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ +const DEFAULT_SOURCE = { + source() { + return new RawSource("throw new Error('No source available');"); + }, + /** + * @returns {number} size of the DEFAULT_SOURCE.source() + */ + size() { + return 39; + } +}; + // TODO: clean up this file // replace with newer constructs @@ -59,7 +71,7 @@ class JavascriptGenerator extends Generator { getSize(module, type) { const originalSource = module.originalSource(); if (!originalSource) { - return 39; + return DEFAULT_SOURCE.size(); } return originalSource.size(); } @@ -98,7 +110,7 @@ class JavascriptGenerator extends Generator { generate(module, generateContext) { const originalSource = module.originalSource(); if (!originalSource) { - return new RawSource("throw new Error('No source available');"); + return DEFAULT_SOURCE.source(); } const source = new ReplaceSource(originalSource); From d4f275dcc262b0f3ef98e1ed48e41ceff83318ff Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Tue, 1 Jul 2025 13:16:11 +0300 Subject: [PATCH 36/56] docs: update examples (#19639) --- examples/aggressive-merging/README.md | 6 +-- examples/chunkhash/README.md | 6 +-- .../README.md | 2 +- .../code-splitted-require.context/README.md | 2 +- .../code-splitting-bundle-loader/README.md | 2 +- .../README.md | 14 +++--- examples/code-splitting-harmony/README.md | 2 +- .../README.md | 2 +- .../README.md | 2 +- .../README.md | 2 +- examples/code-splitting/README.md | 2 +- .../common-chunk-and-vendor-chunk/README.md | 8 +-- examples/common-chunk-grandchildren/README.md | 2 +- examples/css/README.md | 6 +-- examples/externals/README.md | 2 +- examples/extra-async-chunk-advanced/README.md | 2 +- examples/extra-async-chunk/README.md | 2 +- examples/harmony-library/README.md | 2 +- examples/harmony/README.md | 2 +- examples/http2-aggressive-splitting/README.md | 8 +-- examples/hybrid-routing/README.md | 10 ++-- examples/many-pages/README.md | 12 ++--- examples/mixed/README.md | 2 +- examples/module-code-splitting/README.md | 17 ++++--- examples/module-federation/README.md | 16 +++--- examples/module-worker/README.md | 49 +++++++++++-------- examples/multi-part-library/README.md | 4 +- examples/multiple-entry-points/README.md | 8 +-- examples/named-chunks/README.md | 2 +- examples/persistent-caching/README.md | 16 +++--- examples/reexport-components/README.md | 2 +- examples/scope-hoisting/README.md | 2 +- examples/source-map/README.md | 26 +++++----- examples/stats-detailed/README.md | 2 +- examples/top-level-await/README.md | 6 +-- examples/wasm-bindgen-esm/README.md | 2 +- examples/wasm-complex/README.md | 2 +- examples/wasm-simple/README.md | 2 +- examples/worker/README.md | 6 +-- 39 files changed, 137 insertions(+), 125 deletions(-) diff --git a/examples/aggressive-merging/README.md b/examples/aggressive-merging/README.md index ffbd49eb43a..c0bc4af2f51 100644 --- a/examples/aggressive-merging/README.md +++ b/examples/aggressive-merging/README.md @@ -119,9 +119,9 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset pageC.bundle.js 1.74 KiB [emitted] [minimized] (name: pageC) -asset pageA.bundle.js 1.73 KiB [emitted] [minimized] (name: pageA) -asset pageB.bundle.js 1.73 KiB [emitted] [minimized] (name: pageB) +asset pageC.bundle.js 1.73 KiB [emitted] [minimized] (name: pageC) +asset pageA.bundle.js 1.71 KiB [emitted] [minimized] (name: pageA) +asset pageB.bundle.js 1.71 KiB [emitted] [minimized] (name: pageB) asset 531.chunk.js 154 bytes [emitted] [minimized] asset 78.chunk.js 103 bytes [emitted] [minimized] chunk (runtime: pageC) 78.chunk.js 42 bytes [rendered] diff --git a/examples/chunkhash/README.md b/examples/chunkhash/README.md index bba30fd6d60..e4ac3316ec8 100644 --- a/examples/chunkhash/README.md +++ b/examples/chunkhash/README.md @@ -44,7 +44,7 @@ module.exports = { @@ -417,11 +417,11 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset runtime~main.[chunkhash].js 2.75 KiB [emitted] [minimized] (name: runtime~main) +asset runtime~main.[chunkhash].js 2.74 KiB [emitted] [minimized] (name: runtime~main) asset main.[chunkhash].js 155 bytes [emitted] [minimized] (name: main) asset 471.[chunkhash].js 69 bytes [emitted] [minimized] asset 18.[chunkhash].js 67 bytes [emitted] [minimized] -Entrypoint main 2.91 KiB = runtime~main.[chunkhash].js 2.75 KiB main.[chunkhash].js 155 bytes +Entrypoint main 2.89 KiB = runtime~main.[chunkhash].js 2.74 KiB main.[chunkhash].js 155 bytes chunk (runtime: runtime~main) 18.[chunkhash].js 28 bytes [rendered] > ./async1 ./example.js 2:0-18 ./async1.js 28 bytes [built] [code generated] diff --git a/examples/code-splitted-require.context-amd/README.md b/examples/code-splitted-require.context-amd/README.md index 83b62e961b6..fd13bc7b83d 100644 --- a/examples/code-splitted-require.context-amd/README.md +++ b/examples/code-splitted-require.context-amd/README.md @@ -362,7 +362,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 1.86 KiB [emitted] [minimized] (name: main) +asset output.js 1.84 KiB [emitted] [minimized] (name: main) asset require_context_templates_sync_recursive_.output.js 652 bytes [emitted] [minimized] chunk (runtime: main) output.js (main) 251 bytes (javascript) 4.94 KiB (runtime) [entry] [rendered] > ./example.js main diff --git a/examples/code-splitted-require.context/README.md b/examples/code-splitted-require.context/README.md index 498d9433731..138530740d9 100644 --- a/examples/code-splitted-require.context/README.md +++ b/examples/code-splitted-require.context/README.md @@ -362,7 +362,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 1.83 KiB [emitted] [minimized] (name: main) +asset output.js 1.82 KiB [emitted] [minimized] (name: main) asset require_context_templates_sync_recursive_.output.js 652 bytes [emitted] [minimized] chunk (runtime: main) output.js (main) 266 bytes (javascript) 4.94 KiB (runtime) [entry] [rendered] > ./example.js main diff --git a/examples/code-splitting-bundle-loader/README.md b/examples/code-splitting-bundle-loader/README.md index b3a6f47d95a..c9727d67db0 100644 --- a/examples/code-splitting-bundle-loader/README.md +++ b/examples/code-splitting-bundle-loader/README.md @@ -320,7 +320,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 1.86 KiB [emitted] [minimized] (name: main) +asset output.js 1.84 KiB [emitted] [minimized] (name: main) asset file_js.output.js 94 bytes [emitted] [minimized] chunk (runtime: main) file_js.output.js 28 bytes [rendered] > ../../node_modules/bundle-loader/index.js!./file.js 7:0-14:2 diff --git a/examples/code-splitting-depend-on-advanced/README.md b/examples/code-splitting-depend-on-advanced/README.md index 3b062638f63..02b267a07fe 100644 --- a/examples/code-splitting-depend-on-advanced/README.md +++ b/examples/code-splitting-depend-on-advanced/README.md @@ -619,16 +619,16 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset runtime.js 2.37 KiB [emitted] [minimized] (name: runtime) -asset page1.js 283 bytes [emitted] [minimized] (name: page1) +asset runtime.js 2.36 KiB [emitted] [minimized] (name: runtime) +asset page1.js 281 bytes [emitted] [minimized] (name: page1) asset other-vendors.js 241 bytes [emitted] [minimized] (name: other-vendors) asset react-vendors.js 204 bytes [emitted] [minimized] (name: react-vendors) -asset app.js 202 bytes [emitted] [minimized] (name: app) +asset app.js 200 bytes [emitted] [minimized] (name: app) asset lazy_js.js 160 bytes [emitted] [minimized] -Entrypoint app 202 bytes = app.js -Entrypoint page1 283 bytes = page1.js -Entrypoint react-vendors 2.57 KiB = runtime.js 2.37 KiB react-vendors.js 204 bytes -Entrypoint other-vendors 2.6 KiB = runtime.js 2.37 KiB other-vendors.js 241 bytes +Entrypoint app 200 bytes = app.js +Entrypoint page1 281 bytes = page1.js +Entrypoint react-vendors 2.55 KiB = runtime.js 2.36 KiB react-vendors.js 204 bytes +Entrypoint other-vendors 2.59 KiB = runtime.js 2.36 KiB other-vendors.js 241 bytes chunk (runtime: runtime) app.js (app) 116 bytes <{other-vendors}> <{runtime}> >{page1}< [initial] [rendered] > ./app.js app ./app.js 116 bytes [built] [code generated] diff --git a/examples/code-splitting-harmony/README.md b/examples/code-splitting-harmony/README.md index dbb4a4cd9af..aea1268f8a7 100644 --- a/examples/code-splitting-harmony/README.md +++ b/examples/code-splitting-harmony/README.md @@ -436,7 +436,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.91 KiB [emitted] [minimized] (name: main) +asset output.js 2.89 KiB [emitted] [minimized] (name: main) asset 140.output.js 69 bytes [emitted] [minimized] asset 197.output.js 69 bytes [emitted] [minimized] asset 414.output.js 69 bytes [emitted] [minimized] diff --git a/examples/code-splitting-native-import-context-filter/README.md b/examples/code-splitting-native-import-context-filter/README.md index e5f1c32cb49..3671a90d47e 100644 --- a/examples/code-splitting-native-import-context-filter/README.md +++ b/examples/code-splitting-native-import-context-filter/README.md @@ -413,7 +413,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.46 KiB [emitted] [minimized] (name: main) +asset output.js 2.44 KiB [emitted] [minimized] (name: main) asset 717.output.js 130 bytes [emitted] [minimized] asset 776.output.js 130 bytes [emitted] [minimized] asset 0.output.js 124 bytes [emitted] [minimized] diff --git a/examples/code-splitting-native-import-context/README.md b/examples/code-splitting-native-import-context/README.md index aef36ecfff5..b4a2a1e71c3 100644 --- a/examples/code-splitting-native-import-context/README.md +++ b/examples/code-splitting-native-import-context/README.md @@ -400,7 +400,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.42 KiB [emitted] [minimized] (name: main) +asset output.js 2.4 KiB [emitted] [minimized] (name: main) asset 717.output.js 130 bytes [emitted] [minimized] asset 776.output.js 130 bytes [emitted] [minimized] asset 0.output.js 124 bytes [emitted] [minimized] diff --git a/examples/code-splitting-specify-chunk-name/README.md b/examples/code-splitting-specify-chunk-name/README.md index 1d474ea2ef9..75d09485126 100644 --- a/examples/code-splitting-specify-chunk-name/README.md +++ b/examples/code-splitting-specify-chunk-name/README.md @@ -392,7 +392,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.44 KiB [emitted] [minimized] (name: main) +asset output.js 2.42 KiB [emitted] [minimized] (name: main) asset 994.output.js 130 bytes [emitted] [minimized] (name: chunk-bar-baz0) asset 45.output.js 129 bytes [emitted] [minimized] (name: chunk-foo) asset 792.output.js 126 bytes [emitted] [minimized] (name: chunk-bar-baz2) diff --git a/examples/code-splitting/README.md b/examples/code-splitting/README.md index 7b3606f0da5..590c91e9879 100644 --- a/examples/code-splitting/README.md +++ b/examples/code-splitting/README.md @@ -356,7 +356,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 1.77 KiB [emitted] [minimized] (name: main) +asset output.js 1.76 KiB [emitted] [minimized] (name: main) asset node_modules_c_js-node_modules_d_js.output.js 114 bytes [emitted] [minimized] chunk (runtime: main) output.js (main) 161 bytes (javascript) 4.94 KiB (runtime) [entry] [rendered] > ./example.js main diff --git a/examples/common-chunk-and-vendor-chunk/README.md b/examples/common-chunk-and-vendor-chunk/README.md index c662abce680..546405907d3 100644 --- a/examples/common-chunk-and-vendor-chunk/README.md +++ b/examples/common-chunk-and-vendor-chunk/README.md @@ -728,13 +728,13 @@ webpack X.X.X compiled successfully assets by chunk 212 bytes (id hint: commons) asset commons-utility2_js.js 106 bytes [emitted] [minimized] (id hint: commons) asset commons-utility3_js.js 106 bytes [emitted] [minimized] (id hint: commons) -asset pageA.js 1 KiB [emitted] [minimized] (name: pageA) +asset pageA.js 1020 bytes [emitted] [minimized] (name: pageA) asset pageB.js 1020 bytes [emitted] [minimized] (name: pageB) -asset pageC.js 1010 bytes [emitted] [minimized] (name: pageC) +asset pageC.js 999 bytes [emitted] [minimized] (name: pageC) asset vendor.js 121 bytes [emitted] [minimized] (name: vendor) (id hint: vendor) -Entrypoint pageA 1.22 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes pageA.js 1 KiB +Entrypoint pageA 1.22 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes pageA.js 1020 bytes Entrypoint pageB 1.32 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageB.js 1020 bytes -Entrypoint pageC 1.19 KiB = commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageC.js 1010 bytes +Entrypoint pageC 1.18 KiB = commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageC.js 999 bytes chunk (runtime: pageA, pageB, pageC) commons-utility2_js.js (id hint: commons) 28 bytes [initial] [rendered] split chunk (cache group: commons) > ./pageA pageA > ./pageB pageB diff --git a/examples/common-chunk-grandchildren/README.md b/examples/common-chunk-grandchildren/README.md index 0942b2db45b..4e26fc1d676 100644 --- a/examples/common-chunk-grandchildren/README.md +++ b/examples/common-chunk-grandchildren/README.md @@ -492,7 +492,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 1.83 KiB [emitted] [minimized] (name: main) +asset output.js 1.82 KiB [emitted] [minimized] (name: main) asset pageB_js.output.js 231 bytes [emitted] [minimized] asset reusableComponent_js.output.js 142 bytes [emitted] [minimized] asset pageC_js.output.js 141 bytes [emitted] [minimized] diff --git a/examples/css/README.md b/examples/css/README.md index a78da27d1e6..f1f96f8be0a 100644 --- a/examples/css/README.md +++ b/examples/css/README.md @@ -573,14 +573,14 @@ webpack X.X.X compiled successfully ## Production mode ``` -assets by path *.js 3.44 KiB - asset output.js 3.35 KiB [emitted] [minimized] (name: main) +assets by path *.js 3.42 KiB + asset output.js 3.34 KiB [emitted] [minimized] (name: main) asset 822.output.js 87 bytes [emitted] [minimized] assets by path *.css 490 bytes asset output.css 466 bytes [emitted] (name: main) asset 822.output.css 24 bytes [emitted] asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: images/file.png] (auxiliary name: main) -Entrypoint main 3.81 KiB (14.6 KiB) = output.js 3.35 KiB output.css 466 bytes 1 auxiliary asset +Entrypoint main 3.79 KiB (14.6 KiB) = output.js 3.34 KiB output.css 466 bytes 1 auxiliary asset chunk (runtime: main) output.js, output.css (main) 299 bytes (javascript) 454 bytes (css) 14.6 KiB (asset) 42 bytes (css-url) 42 bytes (css-import) 8.82 KiB (runtime) [entry] [rendered] > ./example.js main runtime modules 8.82 KiB 9 modules diff --git a/examples/externals/README.md b/examples/externals/README.md index 3b900acb11f..569df4f238c 100644 --- a/examples/externals/README.md +++ b/examples/externals/README.md @@ -168,7 +168,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 665 bytes [emitted] [minimized] (name: main) +asset output.js 663 bytes [emitted] [minimized] (name: main) chunk (runtime: main) output.js (main) 194 bytes [entry] [rendered] > ./example.js main dependent modules 84 bytes [dependent] 2 modules diff --git a/examples/extra-async-chunk-advanced/README.md b/examples/extra-async-chunk-advanced/README.md index f833ea5fa83..ee9287596af 100644 --- a/examples/extra-async-chunk-advanced/README.md +++ b/examples/extra-async-chunk-advanced/README.md @@ -350,7 +350,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.11 KiB [emitted] [minimized] (name: main) +asset output.js 2.1 KiB [emitted] [minimized] (name: main) asset 210.output.js 81 bytes [emitted] [minimized] asset 425.output.js 81 bytes [emitted] [minimized] asset 670.output.js 81 bytes [emitted] [minimized] diff --git a/examples/extra-async-chunk/README.md b/examples/extra-async-chunk/README.md index 3ec85fa04ad..9943e2ded30 100644 --- a/examples/extra-async-chunk/README.md +++ b/examples/extra-async-chunk/README.md @@ -395,7 +395,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 1.83 KiB [emitted] [minimized] (name: main) +asset output.js 1.82 KiB [emitted] [minimized] (name: main) asset a_js-b_js.output.js 112 bytes [emitted] [minimized] asset c_js.output.js 84 bytes [emitted] [minimized] asset d_js.output.js 84 bytes [emitted] [minimized] diff --git a/examples/harmony-library/README.md b/examples/harmony-library/README.md index 58086067e0f..a41425e863d 100644 --- a/examples/harmony-library/README.md +++ b/examples/harmony-library/README.md @@ -121,7 +121,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset MyLibrary.umd.js 674 bytes [emitted] [minimized] (name: main) +asset MyLibrary.umd.js 672 bytes [emitted] [minimized] (name: main) chunk (runtime: main) MyLibrary.umd.js (main) 92 bytes (javascript) 670 bytes (runtime) [entry] [rendered] > ./example main runtime modules 670 bytes 3 modules diff --git a/examples/harmony/README.md b/examples/harmony/README.md index 72979074b28..c2c487f53e5 100644 --- a/examples/harmony/README.md +++ b/examples/harmony/README.md @@ -358,7 +358,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.04 KiB [emitted] [minimized] (name: main) +asset output.js 2.02 KiB [emitted] [minimized] (name: main) asset 655.output.js 124 bytes [emitted] [minimized] chunk (runtime: main) 655.output.js 24 bytes [rendered] > ./async-loaded ./example.js 6:0-24 diff --git a/examples/http2-aggressive-splitting/README.md b/examples/http2-aggressive-splitting/README.md index 4583698d0e0..6fed1ed226b 100644 --- a/examples/http2-aggressive-splitting/README.md +++ b/examples/http2-aggressive-splitting/README.md @@ -64,13 +64,13 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset 68dab3066399275cfe8c.js 9.04 KiB [emitted] [immutable] [minimized] (name: main) 1 related asset -asset 9ae91119845b89b379f6.js 3.55 KiB [emitted] [immutable] [minimized] 1 related asset -chunk (runtime: main) 9ae91119845b89b379f6.js 7.83 KiB [rendered] +asset 8f8c433db3f22b7d7f5a.js 9.01 KiB [emitted] [immutable] [minimized] (name: main) 1 related asset +asset ca29c65736cc562c09a7.js 3.55 KiB [emitted] [immutable] [minimized] 1 related asset +chunk (runtime: main) ca29c65736cc562c09a7.js 7.83 KiB [rendered] > react-dom ./example.js 2:0-22 dependent modules 6.5 KiB [dependent] 1 module ../../node_modules/react-dom/index.js 1.33 KiB [built] [code generated] -chunk (runtime: main) 68dab3066399275cfe8c.js (main) 16.9 KiB (javascript) 4.94 KiB (runtime) [entry] [rendered] +chunk (runtime: main) 8f8c433db3f22b7d7f5a.js (main) 16.9 KiB (javascript) 4.94 KiB (runtime) [entry] [rendered] > ./example main runtime modules 4.94 KiB 6 modules dependent modules 16.9 KiB [dependent] 2 modules diff --git a/examples/hybrid-routing/README.md b/examples/hybrid-routing/README.md index 10fac2bd061..03716192585 100644 --- a/examples/hybrid-routing/README.md +++ b/examples/hybrid-routing/README.md @@ -582,13 +582,13 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset pageA.bundle.js 2.85 KiB [emitted] [minimized] (name: pageA) -asset pageB.bundle.js 2.85 KiB [emitted] [minimized] (name: pageB) -asset router_js.bundle.js 544 bytes [emitted] [minimized] +asset pageA.bundle.js 2.84 KiB [emitted] [minimized] (name: pageA) +asset pageB.bundle.js 2.84 KiB [emitted] [minimized] (name: pageB) +asset router_js.bundle.js 538 bytes [emitted] [minimized] asset aPage.bundle.js 117 bytes [emitted] [minimized] (name: aPage) asset bPage.bundle.js 117 bytes [emitted] [minimized] (name: bPage) -Entrypoint pageA 3.5 KiB = router_js.bundle.js 544 bytes aPage.bundle.js 117 bytes pageA.bundle.js 2.85 KiB -Entrypoint pageB 3.5 KiB = router_js.bundle.js 544 bytes bPage.bundle.js 117 bytes pageB.bundle.js 2.85 KiB +Entrypoint pageA 3.48 KiB = router_js.bundle.js 538 bytes aPage.bundle.js 117 bytes pageA.bundle.js 2.84 KiB +Entrypoint pageB 3.48 KiB = router_js.bundle.js 538 bytes bPage.bundle.js 117 bytes pageB.bundle.js 2.84 KiB chunk (runtime: pageA, pageB) aPage.bundle.js (aPage) 59 bytes [initial] [rendered] reused as split chunk (cache group: default) > ./aPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./aPage > ./aEntry pageA diff --git a/examples/many-pages/README.md b/examples/many-pages/README.md index 05eda8532b9..13bc49b5a33 100644 --- a/examples/many-pages/README.md +++ b/examples/many-pages/README.md @@ -58,13 +58,13 @@ assets by chunk 772 bytes (id hint: vendors) asset 301.js 111 bytes [emitted] [minimized] (id hint: vendors) asset 811.js 111 bytes [emitted] [minimized] (id hint: vendors) asset 876.js 111 bytes [emitted] [minimized] (id hint: vendors) -asset pageB.js 1.26 KiB [emitted] [minimized] (name: pageB) -asset pageC.js 1.26 KiB [emitted] [minimized] (name: pageC) -asset pageA.js 1.18 KiB [emitted] [minimized] (name: pageA) -asset pageD.js 1.18 KiB [emitted] [minimized] (name: pageD) -asset pageF.js 1.18 KiB [emitted] [minimized] (name: pageF) +asset pageB.js 1.25 KiB [emitted] [minimized] (name: pageB) +asset pageC.js 1.25 KiB [emitted] [minimized] (name: pageC) +asset pageA.js 1.17 KiB [emitted] [minimized] (name: pageA) +asset pageD.js 1.17 KiB [emitted] [minimized] (name: pageD) +asset pageF.js 1.17 KiB [emitted] [minimized] (name: pageF) asset pageE.js 1.16 KiB [emitted] [minimized] (name: pageE) -asset pageG.js 1.15 KiB [emitted] [minimized] (name: pageG) +asset pageG.js 1.14 KiB [emitted] [minimized] (name: pageG) asset 554.js 139 bytes [emitted] [minimized] chunk (runtime: pageA) 122.js (id hint: vendors) 43 bytes [initial] [rendered] split chunk (cache group: defaultVendors) > ./pages/a pageA diff --git a/examples/mixed/README.md b/examples/mixed/README.md index 04065ebb377..8a72d08be88 100644 --- a/examples/mixed/README.md +++ b/examples/mixed/README.md @@ -512,7 +512,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.53 KiB [emitted] [minimized] (name: main) +asset output.js 2.51 KiB [emitted] [minimized] (name: main) asset require_context_templates_sync_recursive_js_.output.js 625 bytes [emitted] [minimized] chunk (runtime: main) output.js (main) 1010 bytes (javascript) 5.77 KiB (runtime) [entry] [rendered] > ./example.js main diff --git a/examples/module-code-splitting/README.md b/examples/module-code-splitting/README.md index c4f6a287300..36ad2da8154 100644 --- a/examples/module-code-splitting/README.md +++ b/examples/module-code-splitting/README.md @@ -194,6 +194,9 @@ export function reset() { /******/ // no external install chunk /******/ /******/ // no on chunks loaded +/******/ // no HMR +/******/ +/******/ // no HMR manifest /******/ })(); /******/ /************************************************************************/ @@ -234,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_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); ``` # Info @@ -242,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.6 KiB [emitted] [javascript module] (name: main) +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.04 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 420 bytes (javascript) 3.07 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.04 KiB 7 modules + runtime modules 3.07 KiB 7 modules ./example.js + 1 modules 420 bytes [built] [code generated] [no exports] [no exports used] @@ -265,7 +268,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 1.2 KiB [emitted] [javascript module] [minimized] (name: main) +asset output.js 1.19 KiB [emitted] [javascript module] [minimized] (name: main) asset 481.output.js 249 bytes [emitted] [javascript module] [minimized] chunk (runtime: main) 481.output.js 146 bytes [rendered] > ./counter ./methods.js 2:8-27 @@ -274,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.04 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 420 bytes (javascript) 3.07 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.04 KiB 7 modules + runtime modules 3.07 KiB 7 modules ./example.js + 1 modules 420 bytes [built] [code generated] [no exports] [no exports used] diff --git a/examples/module-federation/README.md b/examples/module-federation/README.md index b3540b8b557..2226be34e5a 100644 --- a/examples/module-federation/README.md +++ b/examples/module-federation/README.md @@ -723,7 +723,7 @@ module.exports = new Promise((resolve, reject) => { /******/ (() => { /******/ var parseVersion = (str) => { /******/ // see webpack/lib/util/semver.js for original code -/******/ var p=p=>{return p.split(".").map((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; +/******/ var p=p=>{return p.split(".").map(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; /******/ } /******/ var versionLt = (a, b) => { /******/ // see webpack/lib/util/semver.js for original code @@ -1250,7 +1250,7 @@ __webpack_require__.d(exports, { /******/ (() => { /******/ var parseVersion = (str) => { /******/ // see webpack/lib/util/semver.js for original code -/******/ var p=p=>{return p.split(".").map((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; +/******/ var p=p=>{return p.split(".").map(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; /******/ } /******/ var versionLt = (a, b) => { /******/ // see webpack/lib/util/semver.js for original code @@ -1793,7 +1793,7 @@ __webpack_require__.d(exports, { /******/ (() => { /******/ var parseVersion = (str) => { /******/ // see webpack/lib/util/semver.js for original code -/******/ var p=p=>{return p.split(".").map((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; +/******/ var p=p=>{return p.split(".").map(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; /******/ } /******/ var versionLt = (a, b) => { /******/ // see webpack/lib/util/semver.js for original code @@ -2175,8 +2175,8 @@ mfe-c: ``` app: asset src_bootstrap_js.js 12.5 KiB [emitted] [minimized] 1 related asset - asset app.js 7.69 KiB [emitted] [minimized] (name: app) - asset node_modules_react_index_js.js 7.46 KiB [emitted] [minimized] 1 related asset + asset app.js 7.64 KiB [emitted] [minimized] (name: app) + asset node_modules_react_index_js.js 7.44 KiB [emitted] [minimized] 1 related asset chunk (runtime: app) app.js (app) 672 bytes (javascript) 42 bytes (share-init) 19 KiB (runtime) [entry] [rendered] > ./src/index.js app runtime modules 19 KiB 13 modules @@ -2202,8 +2202,8 @@ app: mfe-b: asset vendors-node_modules_date-fns_index_js.js 70.4 KiB [emitted] [minimized] (id hint: vendors) - asset node_modules_react_index_js.js 7.46 KiB [emitted] [minimized] 1 related asset - asset mfeBBB.js 6.36 KiB [emitted] [minimized] (name: mfeBBB) + asset node_modules_react_index_js.js 7.44 KiB [emitted] [minimized] 1 related asset + asset mfeBBB.js 6.31 KiB [emitted] [minimized] (name: mfeBBB) asset src-b_Component_js.js 489 bytes [emitted] [minimized] chunk (runtime: mfeBBB) mfeBBB.js (mfeBBB) 42 bytes (javascript) 84 bytes (share-init) 16.1 KiB (runtime) [entry] [rendered] > mfeBBB @@ -2229,7 +2229,7 @@ mfe-b: mfe-c: asset vendors-node_modules_date-fns_index_js.js 70.4 KiB [emitted] [minimized] (id hint: vendors) - asset mfeCCC.js 6.9 KiB [emitted] [minimized] (name: mfeCCC) + asset mfeCCC.js 6.85 KiB [emitted] [minimized] (name: mfeCCC) asset node_modules_lodash_random_js.js 3.13 KiB [emitted] [minimized] asset src-c_LazyComponent_js.js 533 bytes [emitted] [minimized] asset src-c_Component_js.js 488 bytes [emitted] [minimized] diff --git a/examples/module-worker/README.md b/examples/module-worker/README.md index 8293e19d7f8..032e02deda8 100644 --- a/examples/module-worker/README.md +++ b/examples/module-worker/README.md @@ -310,6 +310,9 @@ export const add = (content, from) => { /******/ // no external install chunk /******/ /******/ // no on chunks loaded +/******/ // no HMR +/******/ +/******/ // no HMR manifest /******/ })(); /******/ /************************************************************************/ @@ -577,6 +580,9 @@ fibWorker.onmessage = event => { /******/ // no external install chunk /******/ /******/ // no on chunks loaded +/******/ // no HMR +/******/ +/******/ // no HMR manifest /******/ })(); /******/ /************************************************************************/ @@ -614,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_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})}}}; ``` # dist/workers/fibonacci.js @@ -771,6 +777,9 @@ var e,o,t={},r={};function s(e){var o=r[e];if(void 0!==o)return o.exports;var n= /******/ // no external install chunk /******/ /******/ // no on chunks loaded +/******/ // no HMR +/******/ +/******/ // no HMR manifest /******/ })(); /******/ /************************************************************************/ @@ -793,7 +802,7 @@ 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={},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)}`)}; ``` # dist/129.js @@ -832,9 +841,9 @@ function fibonacci(n) { ## Unoptimized ``` -asset main.js 8.73 KiB [emitted] [javascript module] (name: main) -asset chat.js 6.64 KiB [emitted] [javascript module] (name: chat) -asset workers/fibonacci.js 6.29 KiB [emitted] [javascript module] (name: fibonacci) +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] chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered] @@ -845,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.04 KiB (runtime) [entry] [rendered] +chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 442 bytes (javascript) 3.06 KiB (runtime) [entry] [rendered] > ./example.js 25:19-31:1 - runtime modules 3.04 KiB 7 modules + runtime modules 3.06 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.04 KiB (runtime) [entry] [rendered] +chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 3.06 KiB (runtime) [entry] [rendered] > ./example.js 80:18-84:2 - runtime modules 3.04 KiB 7 modules + runtime modules 3.06 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.21 KiB (runtime) [entry] [rendered] +chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 3.24 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.21 KiB 7 modules + runtime modules 3.24 KiB 7 modules ./example.js 2.25 KiB [built] [code generated] [used exports unknown] entry ./example.js main @@ -877,9 +886,9 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset main.js 2.37 KiB [emitted] [javascript module] [minimized] (name: main) -asset chat.js 1.08 KiB [emitted] [javascript module] [minimized] (name: chat) -asset workers/fibonacci.js 945 bytes [emitted] [javascript module] [minimized] (name: fibonacci) +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] chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered] @@ -890,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.77 KiB (runtime) [entry] [rendered] +chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 442 bytes (javascript) 2.8 KiB (runtime) [entry] [rendered] > ./example.js 25:19-31:1 - runtime modules 2.77 KiB 6 modules + runtime modules 2.8 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.77 KiB (runtime) [entry] [rendered] +chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.8 KiB (runtime) [entry] [rendered] > ./example.js 80:18-84:2 - runtime modules 2.77 KiB 6 modules + runtime modules 2.8 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.94 KiB (runtime) [entry] [rendered] +chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 2.97 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 2.94 KiB 6 modules + runtime modules 2.97 KiB 6 modules ./example.js 2.25 KiB [built] [code generated] [no exports used] entry ./example.js main diff --git a/examples/multi-part-library/README.md b/examples/multi-part-library/README.md index 3294303a686..465c6bf5bb9 100644 --- a/examples/multi-part-library/README.md +++ b/examples/multi-part-library/README.md @@ -212,8 +212,8 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset MyLibrary.alpha.js 423 bytes [emitted] [minimized] (name: alpha) -asset MyLibrary.beta.js 421 bytes [emitted] [minimized] (name: beta) +asset MyLibrary.alpha.js 421 bytes [emitted] [minimized] (name: alpha) +asset MyLibrary.beta.js 419 bytes [emitted] [minimized] (name: beta) chunk (runtime: beta) MyLibrary.beta.js (beta) 24 bytes [entry] [rendered] > ./beta beta ./beta.js 24 bytes [built] [code generated] diff --git a/examples/multiple-entry-points/README.md b/examples/multiple-entry-points/README.md index 813bd22745d..33bba7c01b8 100644 --- a/examples/multiple-entry-points/README.md +++ b/examples/multiple-entry-points/README.md @@ -721,12 +721,12 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset pageA.js 2.17 KiB [emitted] [minimized] (name: pageA) -asset pageB.js 2.15 KiB [emitted] [minimized] (name: pageB) +asset pageA.js 2.16 KiB [emitted] [minimized] (name: pageA) +asset pageB.js 2.13 KiB [emitted] [minimized] (name: pageB) asset shared_js.js 125 bytes [emitted] [minimized] asset commons.js 92 bytes [emitted] [minimized] (name: commons) (id hint: commons) -Entrypoint pageA 2.26 KiB = commons.js 92 bytes pageA.js 2.17 KiB -Entrypoint pageB 2.24 KiB = commons.js 92 bytes pageB.js 2.15 KiB +Entrypoint pageA 2.25 KiB = commons.js 92 bytes pageA.js 2.16 KiB +Entrypoint pageB 2.22 KiB = commons.js 92 bytes pageB.js 2.13 KiB chunk (runtime: pageA, pageB) commons.js (commons) (id hint: commons) 26 bytes [initial] [rendered] split chunk (cache group: commons) (name: commons) > ./pageA pageA > ./pageB pageB diff --git a/examples/named-chunks/README.md b/examples/named-chunks/README.md index 2cd9610e936..a53e2c69662 100644 --- a/examples/named-chunks/README.md +++ b/examples/named-chunks/README.md @@ -405,7 +405,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 1.95 KiB [emitted] [minimized] (name: main) +asset output.js 1.94 KiB [emitted] [minimized] (name: main) asset my own chunk.output.js 140 bytes [emitted] [minimized] (name: my own chunk) asset node_modules_b_js-node_modules_d_js.output.js 114 bytes [emitted] [minimized] chunk (runtime: main) output.js (main) 432 bytes (javascript) 4.94 KiB (runtime) [entry] [rendered] diff --git a/examples/persistent-caching/README.md b/examples/persistent-caching/README.md index c53e28b71df..84ef2840489 100644 --- a/examples/persistent-caching/README.md +++ b/examples/persistent-caching/README.md @@ -55,29 +55,29 @@ module.exports = (env = "development") => ({ ## Unoptimized ``` -asset output.js 3.57 MiB [emitted] (name: main) -chunk (runtime: main) output.js (main) 2.22 MiB (javascript) 1.29 KiB (runtime) [entry] +asset output.js 3.6 MiB [emitted] (name: main) +chunk (runtime: main) output.js (main) 2.24 MiB (javascript) 1.29 KiB (runtime) [entry] > ./example.js main - cached modules 2.22 MiB (javascript) 1.29 KiB (runtime) [cached] 1492 modules + cached modules 2.24 MiB (javascript) 1.29 KiB (runtime) [cached] 1514 modules webpack X.X.X compiled successfully ``` ## Production mode ``` -asset output.js 541 KiB [emitted] [minimized] [big] (name: main) 1 related asset -chunk (runtime: main) output.js (main) 2.16 MiB (javascript) 1.29 KiB (runtime) [entry] +asset output.js 548 KiB [emitted] [minimized] [big] (name: main) 1 related asset +chunk (runtime: main) output.js (main) 2.18 MiB (javascript) 1.29 KiB (runtime) [entry] > ./example.js main - cached modules 2.16 MiB (javascript) 1.29 KiB (runtime) [cached] 869 modules + cached modules 2.18 MiB (javascript) 1.29 KiB (runtime) [cached] 891 modules WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). This can impact web performance. Assets: - output.js (541 KiB) + output.js (548 KiB) WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. Entrypoints: - main (541 KiB) + main (548 KiB) output.js WARNING in webpack performance recommendations: diff --git a/examples/reexport-components/README.md b/examples/reexport-components/README.md index 8518c00b370..6b37d0f7935 100644 --- a/examples/reexport-components/README.md +++ b/examples/reexport-components/README.md @@ -233,7 +233,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.49 KiB [emitted] [minimized] (name: main) +asset output.js 2.47 KiB [emitted] [minimized] (name: main) asset pages_Dashboard_js.output.js 450 bytes [emitted] [minimized] asset pages_Login_js.output.js 444 bytes [emitted] [minimized] chunk (runtime: main) output.js (main) 208 bytes (javascript) 5.51 KiB (runtime) [entry] [rendered] diff --git a/examples/scope-hoisting/README.md b/examples/scope-hoisting/README.md index 6bf715a461d..9f111ad36ae 100644 --- a/examples/scope-hoisting/README.md +++ b/examples/scope-hoisting/README.md @@ -529,7 +529,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.11 KiB [emitted] [minimized] (name: main) +asset output.js 2.1 KiB [emitted] [minimized] (name: main) asset lazy_js.output.js 278 bytes [emitted] [minimized] chunk (runtime: main) lazy_js.output.js 263 bytes [rendered] > ./lazy ./example.js 4:0-16 diff --git a/examples/source-map/README.md b/examples/source-map/README.md index d49beb73d69..db4b008e8c4 100644 --- a/examples/source-map/README.md +++ b/examples/source-map/README.md @@ -208,7 +208,7 @@ race = function(winner, ...runners) { /*! runtime requirements: */ /***/ (() => { -eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vZXhhbXBsZS5jb2ZmZWU/MjQxNiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFVTs7O0FBQUEsSUFBQSxJQUFBLEVBQUE7O0FBQ1YsSUFBQSxHQUNFO0VBQUEsSUFBQSxFQUFRLElBQUksQ0FBQyxJQUFiO0VBQ0EsTUFBQSxFQUFRLE1BRFI7RUFFQSxJQUFBLEVBQVEsUUFBQSxDQUFDLENBQUQsQ0FBQTtXQUFPLENBQUEsR0FBSSxNQUFBLENBQU8sQ0FBUDtFQUFYO0FBRlIsRUFGUTs7O0FBT1YsSUFBQSxHQUFPLFFBQUEsQ0FBQyxNQUFELEVBQUEsR0FBUyxPQUFULENBQUE7U0FDTCxLQUFBLENBQU0sTUFBTixFQUFjLE9BQWQ7QUFESyIsInNvdXJjZXNDb250ZW50IjpbIiMgVGFrZW4gZnJvbSBodHRwOi8vY29mZmVlc2NyaXB0Lm9yZy9cblxuIyBPYmplY3RzOlxubWF0aCA9XG4gIHJvb3Q6ICAgTWF0aC5zcXJ0XG4gIHNxdWFyZTogc3F1YXJlXG4gIGN1YmU6ICAgKHgpIC0+IHggKiBzcXVhcmUgeFxuXG4jIFNwbGF0czpcbnJhY2UgPSAod2lubmVyLCBydW5uZXJzLi4uKSAtPlxuICBwcmludCB3aW5uZXIsIHJ1bm5lcnNcbiJdLCJmaWxlIjoiMC5qcyJ9\n//# sourceURL=webpack-internal:///0\n"); +eval("{// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vZXhhbXBsZS5jb2ZmZWU/MjQxNiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFVTs7O0FBQUEsSUFBQSxJQUFBLEVBQUE7O0FBQ1YsSUFBQSxHQUNFO0VBQUEsSUFBQSxFQUFRLElBQUksQ0FBQyxJQUFiO0VBQ0EsTUFBQSxFQUFRLE1BRFI7RUFFQSxJQUFBLEVBQVEsUUFBQSxDQUFDLENBQUQsQ0FBQTtXQUFPLENBQUEsR0FBSSxNQUFBLENBQU8sQ0FBUDtFQUFYO0FBRlIsRUFGUTs7O0FBT1YsSUFBQSxHQUFPLFFBQUEsQ0FBQyxNQUFELEVBQUEsR0FBUyxPQUFULENBQUE7U0FDTCxLQUFBLENBQU0sTUFBTixFQUFjLE9BQWQ7QUFESyIsInNvdXJjZXNDb250ZW50IjpbIiMgVGFrZW4gZnJvbSBodHRwOi8vY29mZmVlc2NyaXB0Lm9yZy9cblxuIyBPYmplY3RzOlxubWF0aCA9XG4gIHJvb3Q6ICAgTWF0aC5zcXJ0XG4gIHNxdWFyZTogc3F1YXJlXG4gIGN1YmU6ICAgKHgpIC0+IHggKiBzcXVhcmUgeFxuXG4jIFNwbGF0czpcbnJhY2UgPSAod2lubmVyLCBydW5uZXJzLi4uKSAtPlxuICBwcmludCB3aW5uZXIsIHJ1bm5lcnNcbiJdLCJmaWxlIjoiMC5qcyJ9\n//# sourceURL=webpack-internal:///0\n\n}"); /***/ }) ], @@ -239,7 +239,7 @@ eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\n /*! runtime requirements: */ /***/ (() => { -eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n\n\n//# sourceURL=webpack:///./example.coffee?../../node_modules/coffee-loader/dist/cjs.js"); +eval("{// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n\n\n//# sourceURL=webpack:///./example.coffee?../../node_modules/coffee-loader/dist/cjs.js\n}"); /***/ }) ], @@ -270,7 +270,7 @@ eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\n /*! runtime requirements: */ /***/ (() => { -eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vZXhhbXBsZS5jb2ZmZWU/ZWU1OCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBUYWtlbiBmcm9tIGh0dHA6Ly9jb2ZmZWVzY3JpcHQub3JnL1xuXG4vLyBPYmplY3RzOlxudmFyIG1hdGgsIHJhY2U7XG5cbm1hdGggPSB7XG4gIHJvb3Q6IE1hdGguc3FydCxcbiAgc3F1YXJlOiBzcXVhcmUsXG4gIGN1YmU6IGZ1bmN0aW9uKHgpIHtcbiAgICByZXR1cm4geCAqIHNxdWFyZSh4KTtcbiAgfVxufTtcblxuLy8gU3BsYXRzOlxucmFjZSA9IGZ1bmN0aW9uKHdpbm5lciwgLi4ucnVubmVycykge1xuICByZXR1cm4gcHJpbnQod2lubmVyLCBydW5uZXJzKTtcbn07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///0\n"); +eval("{// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vZXhhbXBsZS5jb2ZmZWU/ZWU1OCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBUYWtlbiBmcm9tIGh0dHA6Ly9jb2ZmZWVzY3JpcHQub3JnL1xuXG4vLyBPYmplY3RzOlxudmFyIG1hdGgsIHJhY2U7XG5cbm1hdGggPSB7XG4gIHJvb3Q6IE1hdGguc3FydCxcbiAgc3F1YXJlOiBzcXVhcmUsXG4gIGN1YmU6IGZ1bmN0aW9uKHgpIHtcbiAgICByZXR1cm4geCAqIHNxdWFyZSh4KTtcbiAgfVxufTtcblxuLy8gU3BsYXRzOlxucmFjZSA9IGZ1bmN0aW9uKHdpbm5lciwgLi4ucnVubmVycykge1xuICByZXR1cm4gcHJpbnQod2lubmVyLCBydW5uZXJzKTtcbn07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///0\n\n}"); /***/ }) ], @@ -301,7 +301,7 @@ eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\n /*! runtime requirements: */ /***/ (() => { -eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vZXhhbXBsZS5jb2ZmZWU/MjQxNiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFVTs7O0FBQUEsSUFBQSxJQUFBLEVBQUE7O0FBQ1YsSUFBQSxHQUNFO0VBQUEsSUFBQSxFQUFRLElBQUksQ0FBQyxJQUFiO0VBQ0EsTUFBQSxFQUFRLE1BRFI7RUFFQSxJQUFBLEVBQVEsUUFBQSxDQUFDLENBQUQsQ0FBQTtXQUFPLENBQUEsR0FBSSxNQUFBLENBQU8sQ0FBUDtFQUFYO0FBRlIsRUFGUTs7O0FBT1YsSUFBQSxHQUFPLFFBQUEsQ0FBQyxNQUFELEVBQUEsR0FBUyxPQUFULENBQUE7U0FDTCxLQUFBLENBQU0sTUFBTixFQUFjLE9BQWQ7QUFESyIsInNvdXJjZXNDb250ZW50IjpbIiMgVGFrZW4gZnJvbSBodHRwOi8vY29mZmVlc2NyaXB0Lm9yZy9cblxuIyBPYmplY3RzOlxubWF0aCA9XG4gIHJvb3Q6ICAgTWF0aC5zcXJ0XG4gIHNxdWFyZTogc3F1YXJlXG4gIGN1YmU6ICAgKHgpIC0+IHggKiBzcXVhcmUgeFxuXG4jIFNwbGF0czpcbnJhY2UgPSAod2lubmVyLCBydW5uZXJzLi4uKSAtPlxuICBwcmludCB3aW5uZXIsIHJ1bm5lcnNcbiJdLCJmaWxlIjoiMC5qcyJ9\n//# sourceURL=webpack-internal:///0\n"); +eval("{// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vZXhhbXBsZS5jb2ZmZWU/MjQxNiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFVTs7O0FBQUEsSUFBQSxJQUFBLEVBQUE7O0FBQ1YsSUFBQSxHQUNFO0VBQUEsSUFBQSxFQUFRLElBQUksQ0FBQyxJQUFiO0VBQ0EsTUFBQSxFQUFRLE1BRFI7RUFFQSxJQUFBLEVBQVEsUUFBQSxDQUFDLENBQUQsQ0FBQTtXQUFPLENBQUEsR0FBSSxNQUFBLENBQU8sQ0FBUDtFQUFYO0FBRlIsRUFGUTs7O0FBT1YsSUFBQSxHQUFPLFFBQUEsQ0FBQyxNQUFELEVBQUEsR0FBUyxPQUFULENBQUE7U0FDTCxLQUFBLENBQU0sTUFBTixFQUFjLE9BQWQ7QUFESyIsInNvdXJjZXNDb250ZW50IjpbIiMgVGFrZW4gZnJvbSBodHRwOi8vY29mZmVlc2NyaXB0Lm9yZy9cblxuIyBPYmplY3RzOlxubWF0aCA9XG4gIHJvb3Q6ICAgTWF0aC5zcXJ0XG4gIHNxdWFyZTogc3F1YXJlXG4gIGN1YmU6ICAgKHgpIC0+IHggKiBzcXVhcmUgeFxuXG4jIFNwbGF0czpcbnJhY2UgPSAod2lubmVyLCBydW5uZXJzLi4uKSAtPlxuICBwcmludCB3aW5uZXIsIHJ1bm5lcnNcbiJdLCJmaWxlIjoiMC5qcyJ9\n//# sourceURL=webpack-internal:///0\n\n}"); /***/ }) ], @@ -341,8 +341,8 @@ chunk (runtime: runtime~bundle) ./runtime~bundle-eval.js (runtime~bundle) 2.45 K webpack X.X.X compiled successfully asset ./runtime~bundle-eval-cheap-source-map.js 5.45 KiB [emitted] (name: runtime~bundle) -asset ./bundle-eval-cheap-source-map.js 2.2 KiB [emitted] (name: bundle) -Entrypoint bundle 7.65 KiB = ./runtime~bundle-eval-cheap-source-map.js 5.45 KiB ./bundle-eval-cheap-source-map.js 2.2 KiB +asset ./bundle-eval-cheap-source-map.js 2.21 KiB [emitted] (name: bundle) +Entrypoint bundle 7.66 KiB = ./runtime~bundle-eval-cheap-source-map.js 5.45 KiB ./bundle-eval-cheap-source-map.js 2.21 KiB chunk (runtime: runtime~bundle) ./bundle-eval-cheap-source-map.js (bundle) 256 bytes [initial] [rendered] > coffee-loader!./example.coffee bundle ../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated] @@ -354,8 +354,8 @@ chunk (runtime: runtime~bundle) ./runtime~bundle-eval-cheap-source-map.js (runti webpack X.X.X compiled successfully asset ./runtime~bundle-eval-cheap-module-source-map.js 5.45 KiB [emitted] (name: runtime~bundle) -asset ./bundle-eval-cheap-module-source-map.js 2.33 KiB [emitted] (name: bundle) -Entrypoint bundle 7.79 KiB = ./runtime~bundle-eval-cheap-module-source-map.js 5.45 KiB ./bundle-eval-cheap-module-source-map.js 2.33 KiB +asset ./bundle-eval-cheap-module-source-map.js 2.34 KiB [emitted] (name: bundle) +Entrypoint bundle 7.79 KiB = ./runtime~bundle-eval-cheap-module-source-map.js 5.45 KiB ./bundle-eval-cheap-module-source-map.js 2.34 KiB chunk (runtime: runtime~bundle) ./bundle-eval-cheap-module-source-map.js (bundle) 256 bytes [initial] [rendered] > coffee-loader!./example.coffee bundle ../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated] @@ -367,8 +367,8 @@ chunk (runtime: runtime~bundle) ./runtime~bundle-eval-cheap-module-source-map.js webpack X.X.X compiled successfully asset ./runtime~bundle-eval-source-map.js 5.45 KiB [emitted] (name: runtime~bundle) -asset ./bundle-eval-source-map.js 2.33 KiB [emitted] (name: bundle) -Entrypoint bundle 7.79 KiB = ./runtime~bundle-eval-source-map.js 5.45 KiB ./bundle-eval-source-map.js 2.33 KiB +asset ./bundle-eval-source-map.js 2.34 KiB [emitted] (name: bundle) +Entrypoint bundle 7.79 KiB = ./runtime~bundle-eval-source-map.js 5.45 KiB ./bundle-eval-source-map.js 2.34 KiB chunk (runtime: runtime~bundle) ./bundle-eval-source-map.js (bundle) 256 bytes [initial] [rendered] > coffee-loader!./example.coffee bundle ../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated] @@ -433,7 +433,7 @@ webpack X.X.X compiled successfully asset ./runtime~bundle-source-map.js 4.96 KiB [emitted] (name: runtime~bundle) 1 related asset asset ./bundle-source-map.js 932 bytes [emitted] (name: bundle) 1 related asset -Entrypoint bundle 5.87 KiB (4.85 KiB) = ./runtime~bundle-source-map.js 4.96 KiB ./bundle-source-map.js 932 bytes 2 auxiliary assets +Entrypoint bundle 5.87 KiB (4.86 KiB) = ./runtime~bundle-source-map.js 4.96 KiB ./bundle-source-map.js 932 bytes 2 auxiliary assets chunk (runtime: runtime~bundle) ./bundle-source-map.js (bundle) 256 bytes [initial] [rendered] > coffee-loader!./example.coffee bundle ../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated] @@ -444,9 +444,9 @@ chunk (runtime: runtime~bundle) ./runtime~bundle-source-map.js (runtime~bundle) runtime modules 2.45 KiB 3 modules webpack X.X.X compiled successfully -asset ./runtime~bundle-inline-source-map.js 10.7 KiB [emitted] (name: runtime~bundle) +asset ./runtime~bundle-inline-source-map.js 10.8 KiB [emitted] (name: runtime~bundle) asset ./bundle-inline-source-map.js 1.64 KiB [emitted] (name: bundle) -Entrypoint bundle 12.4 KiB = ./runtime~bundle-inline-source-map.js 10.7 KiB ./bundle-inline-source-map.js 1.64 KiB +Entrypoint bundle 12.4 KiB = ./runtime~bundle-inline-source-map.js 10.8 KiB ./bundle-inline-source-map.js 1.64 KiB chunk (runtime: runtime~bundle) ./bundle-inline-source-map.js (bundle) 256 bytes [initial] [rendered] > coffee-loader!./example.coffee bundle ../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated] diff --git a/examples/stats-detailed/README.md b/examples/stats-detailed/README.md index 8bfddaea2d9..042e47d7a59 100644 --- a/examples/stats-detailed/README.md +++ b/examples/stats-detailed/README.md @@ -78,5 +78,5 @@ LOG from webpack.FileSystemInfo Directory info in cache: 0 timestamps 0 hashes 0 timestamp hash combinations Managed items info in cache: 0 items -XXXX-XX-XX XXXX:XX:XX: webpack X.X.X compiled successfully (17b2b008cbfb55e631ef) +XXXX-XX-XX XXXX:XX:XX: webpack X.X.X compiled successfully (68b217a88f3561807beb) ``` diff --git a/examples/top-level-await/README.md b/examples/top-level-await/README.md index 42da97fc352..f74492e242a 100644 --- a/examples/top-level-await/README.md +++ b/examples/top-level-await/README.md @@ -571,7 +571,7 @@ __webpack_async_result__(); ## in production mode: ```javascript -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["UserApi_js"],{312:(a,e,s)=>{s.a(a,(async(a,t)=>{try{s.d(e,{D:()=>c});const a=async a=>{await new Promise((a=>setTimeout(a,1e3)))};await a("my-sql://example.com");const c=async a=>(await new Promise((a=>setTimeout(a,100))),"fake data");t()}catch(a){t(a)}}),1)},560:(a,e,s)=>{s.a(a,(async(a,t)=>{try{s.r(e),s.d(e,{createUser:()=>m});var c=s(312),n=a([c]);c=(n.then?(await n)():n)[0];const m=async a=>{command=`CREATE USER ${a}`,await(0,c.D)({command})};t()}catch(a){t(a)}}))}}]); +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["UserApi_js"],{312:(a,e,s)=>{s.a(a,async(a,t)=>{try{s.d(e,{D:()=>c});const a=async a=>{await new Promise(a=>setTimeout(a,1e3))};await a("my-sql://example.com");const c=async a=>(await new Promise(a=>setTimeout(a,100)),"fake data");t()}catch(a){t(a)}},1)},560:(a,e,s)=>{s.a(a,async(a,t)=>{try{s.r(e),s.d(e,{createUser:()=>m});var c=s(312),n=a([c]);c=(n.then?(await n)():n)[0];const m=async a=>{command=`CREATE USER ${a}`,await(0,c.D)({command})};t()}catch(a){t(a)}})}}]); ``` # Info @@ -604,8 +604,8 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.96 KiB [emitted] [minimized] (name: main) -asset UserApi_js.output.js 540 bytes [emitted] [minimized] +asset output.js 2.93 KiB [emitted] [minimized] (name: main) +asset UserApi_js.output.js 532 bytes [emitted] [minimized] chunk (runtime: main) UserApi_js.output.js 617 bytes [rendered] > ./UserApi.js ./Actions.js 22:30-52 > ./UserApi.js ./Actions.js 2:16-38 diff --git a/examples/wasm-bindgen-esm/README.md b/examples/wasm-bindgen-esm/README.md index 59a3e770c20..1852cab0ca9 100644 --- a/examples/wasm-bindgen-esm/README.md +++ b/examples/wasm-bindgen-esm/README.md @@ -385,7 +385,7 @@ webpack X.X.X compiled successfully ``` asset 78eeb14b9b5e2c77fb0a.wasm 14.8 KiB [emitted] [immutable] (auxiliary name: main) -asset output.js 3.41 KiB [emitted] [minimized] (name: main) +asset output.js 3.37 KiB [emitted] [minimized] (name: main) chunk (runtime: main) output.js (main) 3.03 KiB (javascript) 14.8 KiB (webassembly) 3.42 KiB (runtime) [entry] [rendered] > ./example.js main runtime modules 3.42 KiB 5 modules diff --git a/examples/wasm-complex/README.md b/examples/wasm-complex/README.md index e0f2db1b52c..b358aeb18c0 100644 --- a/examples/wasm-complex/README.md +++ b/examples/wasm-complex/README.md @@ -428,7 +428,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.81 KiB [emitted] [minimized] (name: main) +asset output.js 2.76 KiB [emitted] [minimized] (name: main) asset 03b5e050bc920dbbb73e.module.wasm 139 bytes [emitted] [immutable] (auxiliary name: main) chunk (runtime: main) output.js (main) 696 bytes (javascript) 139 bytes (webassembly) 3.42 KiB (runtime) [entry] [rendered] > ./example.js main diff --git a/examples/wasm-simple/README.md b/examples/wasm-simple/README.md index e1f4f4f3162..fbbe3813d21 100644 --- a/examples/wasm-simple/README.md +++ b/examples/wasm-simple/README.md @@ -393,7 +393,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.89 KiB [emitted] [minimized] (name: main) +asset output.js 2.85 KiB [emitted] [minimized] (name: main) asset 93de874acf2fa7def7d9.wasm 67 bytes [emitted] [immutable] (auxiliary name: main) asset 5055869d769f484de216.wasm 62 bytes [emitted] [immutable] (auxiliary name: main) asset db91ebd6538fd6985888.wasm 41 bytes [emitted] [immutable] (auxiliary name: main) diff --git a/examples/worker/README.md b/examples/worker/README.md index dd1a4837d6c..698fff59bd5 100644 --- a/examples/worker/README.md +++ b/examples/worker/README.md @@ -687,7 +687,7 @@ onmessage = async event => { ``` ```javascript -(()=>{var e={},r={};function o(t){var a=r[t];if(void 0!==a)return a.exports;var s=r[t]={exports:{}};return e[t](s,s.exports,o),s.exports}o.m=e,o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((r,t)=>(o.f[t](e,r),r)),[])),o.u=e=>e+".js",o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.p="/dist/",(()=>{var e={721:1};o.f.i=(r,t)=>{e[r]||importScripts(o.p+o.u(r))};var r=self.webpackChunk=self.webpackChunk||[],t=r.push.bind(r);r.push=r=>{var[a,s,p]=r;for(var n in s)o.o(s,n)&&(o.m[n]=s[n]);for(p&&p(o);a.length;)e[a.pop()]=1;t(r)}})(),onmessage=async e=>{const{fibonacci:r}=await o.e(129).then(o.bind(o,129)),t=JSON.parse(e.data);postMessage(`fib(${t}) = ${r(t)}`)}})(); +(()=>{var e={},r={};function o(t){var a=r[t];if(void 0!==a)return a.exports;var s=r[t]={exports:{}};return e[t](s,s.exports,o),s.exports}o.m=e,o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((r,t)=>(o.f[t](e,r),r),[])),o.u=e=>e+".js",o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.p="/dist/",(()=>{var e={721:1};o.f.i=(r,t)=>{e[r]||importScripts(o.p+o.u(r))};var r=self.webpackChunk=self.webpackChunk||[],t=r.push.bind(r);r.push=r=>{var[a,s,p]=r;for(var n in s)o.o(s,n)&&(o.m[n]=s[n]);for(p&&p(o);a.length;)e[a.pop()]=1;t(r)}})(),onmessage=async e=>{const{fibonacci:r}=await o.e(129).then(o.bind(o,129)),t=JSON.parse(e.data);postMessage(`fib(${t}) = ${r(t)}`)}})(); ``` # dist/129.js @@ -759,8 +759,8 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset main.js 3.29 KiB [emitted] [minimized] (name: main) -asset workers/fibonacci.js 778 bytes [emitted] [minimized] (name: fibonacci) +asset main.js 3.27 KiB [emitted] [minimized] (name: main) +asset workers/fibonacci.js 776 bytes [emitted] [minimized] (name: fibonacci) asset chat.js 270 bytes [emitted] [minimized] (name: chat) asset 129.js 159 bytes [emitted] [minimized] chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered] From cf1dc2f1313d2067d63aff7592e2bbdf63306ab1 Mon Sep 17 00:00:00 2001 From: Jack Works <5390719+Jack-Works@users.noreply.github.com> Date: Wed, 2 Jul 2025 20:02:03 +0800 Subject: [PATCH 37/56] feat: implement tc39 Defer Module Evaluation (experiment) * feat: implement tc39 defer import proposal Co-authored-by: Nicolo Ribaudo * fix: keys of DeferredNamespaceObject * refactor: MakeDeferredNamespaceObjectRuntimeModule --------- Co-authored-by: Nicolo Ribaudo Co-authored-by: Hai --- declarations/WebpackOptions.d.ts | 12 + lib/ConcatenationScope.js | 17 +- lib/Dependency.js | 7 +- lib/ExportsInfo.js | 10 +- lib/Module.js | 3 +- lib/ModuleGraph.js | 19 ++ lib/RuntimeGlobals.js | 20 ++ lib/RuntimePlugin.js | 28 ++- lib/RuntimeTemplate.js | 108 ++++++++- lib/WebpackOptionsApply.js | 3 +- .../HarmonyExportDependencyParserPlugin.js | 36 ++- .../HarmonyExportExpressionDependency.js | 2 +- ...armonyExportImportedSpecifierDependency.js | 74 +++++- lib/dependencies/HarmonyImportDependency.js | 4 +- .../HarmonyImportDependencyParserPlugin.js | 99 +++++++- .../HarmonyImportSideEffectDependency.js | 5 +- .../HarmonyImportSpecifierDependency.js | 18 +- lib/dependencies/HarmonyModulesPlugin.js | 17 +- lib/dependencies/ImportParserPlugin.js | 22 ++ lib/javascript/JavascriptModulesPlugin.js | 42 +++- lib/javascript/JavascriptParser.js | 146 +++++++++++- lib/optimize/ConcatenatedModule.js | 208 ++++++++++++++--- lib/optimize/ModuleConcatenationPlugin.js | 5 + lib/runtime/AsyncModuleRuntimeModule.js | 73 +++++- .../MakeDeferredNamespaceObjectRuntime.js | 214 ++++++++++++++++++ .../AsyncWebAssemblyJavascriptGenerator.js | 2 + .../WebAssemblyJavascriptGenerator.js | 3 + schemas/WebpackOptions.check.js | 2 +- schemas/WebpackOptions.json | 13 ++ test/__snapshots__/Cli.basictest.js.snap | 13 ++ .../async-in-graph/async-mod-dep.js | 4 + .../defer-import/async-in-graph/async-mod.js | 8 + .../async-in-graph/deep-async-dep.js | 5 + .../defer-import/async-in-graph/deep-async.js | 7 + .../defer-import/async-in-graph/entry.js | 9 + .../async-in-graph/full-sync-dep.js | 4 + .../defer-import/async-in-graph/full-sync.js | 7 + .../defer-import/async-in-graph/index.js | 46 ++++ .../async-in-graph/webpack.config.js | 14 ++ .../defer-import/comment-error/errors.js | 7 + .../defer-import/comment-error/index.js | 11 + .../defer-import/comment-error/mod.js | 2 + .../comment-error/webpack.config.js | 13 ++ .../defer-import/defer-but-sync-order/0.js | 5 + .../defer-import/defer-but-sync-order/1.js | 3 + .../defer-but-sync-order/deferred.js | 5 + .../defer-but-sync-order/entry.js | 6 + .../defer-but-sync-order/index.js | 3 + .../side-effect-counter.js | 4 + .../defer-but-sync-order/webpack.config.js | 13 ++ .../webpack.config.js | 22 ++ .../defer-runtime-concat/webpack.config.js | 14 ++ .../webpack.config.js | 16 ++ .../defer-runtime-strict/webpack.config.js | 24 ++ .../defer-runtime/all-native-syntax.js | 207 +++++++++++++++++ .../defer-import/defer-runtime/all.js | 214 ++++++++++++++++++ .../defer-runtime/commonjs/dynamic-both.cjs | 13 ++ .../commonjs/dynamic_both_ns.cjs | 13 ++ .../commonjs/dynamic_default.cjs | 7 + .../commonjs/dynamic_default_ns.cjs | 7 + .../defer-runtime/commonjs/dynamic_named.cjs | 12 + .../commonjs/dynamic_named_ns.cjs | 12 + .../defer-runtime/commonjs/flagged_both.js | 16 ++ .../defer-runtime/commonjs/flagged_both_ns.js | 16 ++ .../defer-runtime/commonjs/flagged_default.js | 10 + .../commonjs/flagged_default_ns.js | 10 + .../defer-runtime/commonjs/flagged_named.js | 15 ++ .../commonjs/flagged_named_ns.js | 15 ++ .../defer-runtime/esm/esm_both.mjs | 12 + .../defer-runtime/esm/esm_both_ns.mjs | 12 + .../defer-runtime/esm/esm_default.mjs | 6 + .../defer-runtime/esm/esm_default_ns.mjs | 6 + .../defer-runtime/esm/esm_named.mjs | 12 + .../defer-runtime/esm/esm_named_ns.mjs | 13 ++ .../defer-import/defer-runtime/esm/never.mjs | 1 + .../defer-runtime/esm/reexport-deep.cjs | 13 ++ .../defer-runtime/esm/reexport-deep.mjs | 13 ++ .../defer-runtime/esm/reexport.mjs | 4 + .../defer-runtime/side-effect-counter.js | 14 ++ .../defer-runtime/webpack.config.js | 16 ++ .../defer-import/defer-then-non-defer/0.js | 3 + .../defer-import/defer-then-non-defer/1.js | 3 + .../defer-import/defer-then-non-defer/a.js | 12 + .../defer-import/defer-then-non-defer/b.js | 9 + .../defer-then-non-defer/deferred.1.js | 4 + .../defer-then-non-defer/deferred.js | 3 + .../defer-then-non-defer/entry.js | 15 ++ .../defer-then-non-defer/index.js | 3 + .../defer-then-non-defer/order.js | 1 + .../defer-then-non-defer/webpack.config.js | 15 ++ .../defer-used-in-async/deferred.js | 6 + .../defer-import/defer-used-in-async/entry.js | 11 + .../defer-import/defer-used-in-async/index.js | 3 + .../side-effect-counter.js | 4 + .../defer-used-in-async/sync-access.js | 6 + .../defer-used-in-async/webpack.config.js | 14 ++ .../errors.js | 1 + .../index.js | 2 + .../mod.js | 2 + .../webpack.config.js | 9 + types.d.ts | 124 +++++++++- 101 files changed, 2327 insertions(+), 89 deletions(-) create mode 100644 lib/runtime/MakeDeferredNamespaceObjectRuntime.js create mode 100644 test/configCases/defer-import/async-in-graph/async-mod-dep.js create mode 100644 test/configCases/defer-import/async-in-graph/async-mod.js create mode 100644 test/configCases/defer-import/async-in-graph/deep-async-dep.js create mode 100644 test/configCases/defer-import/async-in-graph/deep-async.js create mode 100644 test/configCases/defer-import/async-in-graph/entry.js create mode 100644 test/configCases/defer-import/async-in-graph/full-sync-dep.js create mode 100644 test/configCases/defer-import/async-in-graph/full-sync.js create mode 100644 test/configCases/defer-import/async-in-graph/index.js create mode 100644 test/configCases/defer-import/async-in-graph/webpack.config.js create mode 100644 test/configCases/defer-import/comment-error/errors.js create mode 100644 test/configCases/defer-import/comment-error/index.js create mode 100644 test/configCases/defer-import/comment-error/mod.js create mode 100644 test/configCases/defer-import/comment-error/webpack.config.js create mode 100644 test/configCases/defer-import/defer-but-sync-order/0.js create mode 100644 test/configCases/defer-import/defer-but-sync-order/1.js create mode 100644 test/configCases/defer-import/defer-but-sync-order/deferred.js create mode 100644 test/configCases/defer-import/defer-but-sync-order/entry.js create mode 100644 test/configCases/defer-import/defer-but-sync-order/index.js create mode 100644 test/configCases/defer-import/defer-but-sync-order/side-effect-counter.js create mode 100644 test/configCases/defer-import/defer-but-sync-order/webpack.config.js create mode 100644 test/configCases/defer-import/defer-runtime-concat-strict/webpack.config.js create mode 100644 test/configCases/defer-import/defer-runtime-concat/webpack.config.js create mode 100644 test/configCases/defer-import/defer-runtime-native-syntax/webpack.config.js create mode 100644 test/configCases/defer-import/defer-runtime-strict/webpack.config.js create mode 100644 test/configCases/defer-import/defer-runtime/all-native-syntax.js create mode 100644 test/configCases/defer-import/defer-runtime/all.js create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/dynamic-both.cjs create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/dynamic_both_ns.cjs create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/dynamic_default.cjs create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/dynamic_default_ns.cjs create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/dynamic_named.cjs create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/dynamic_named_ns.cjs create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/flagged_both.js create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/flagged_both_ns.js create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/flagged_default.js create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/flagged_default_ns.js create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/flagged_named.js create mode 100644 test/configCases/defer-import/defer-runtime/commonjs/flagged_named_ns.js create mode 100644 test/configCases/defer-import/defer-runtime/esm/esm_both.mjs create mode 100644 test/configCases/defer-import/defer-runtime/esm/esm_both_ns.mjs create mode 100644 test/configCases/defer-import/defer-runtime/esm/esm_default.mjs create mode 100644 test/configCases/defer-import/defer-runtime/esm/esm_default_ns.mjs create mode 100644 test/configCases/defer-import/defer-runtime/esm/esm_named.mjs create mode 100644 test/configCases/defer-import/defer-runtime/esm/esm_named_ns.mjs create mode 100644 test/configCases/defer-import/defer-runtime/esm/never.mjs create mode 100644 test/configCases/defer-import/defer-runtime/esm/reexport-deep.cjs create mode 100644 test/configCases/defer-import/defer-runtime/esm/reexport-deep.mjs create mode 100644 test/configCases/defer-import/defer-runtime/esm/reexport.mjs create mode 100644 test/configCases/defer-import/defer-runtime/side-effect-counter.js create mode 100644 test/configCases/defer-import/defer-runtime/webpack.config.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/0.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/1.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/a.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/b.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/deferred.1.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/deferred.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/entry.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/index.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/order.js create mode 100644 test/configCases/defer-import/defer-then-non-defer/webpack.config.js create mode 100644 test/configCases/defer-import/defer-used-in-async/deferred.js create mode 100644 test/configCases/defer-import/defer-used-in-async/entry.js create mode 100644 test/configCases/defer-import/defer-used-in-async/index.js create mode 100644 test/configCases/defer-import/defer-used-in-async/side-effect-counter.js create mode 100644 test/configCases/defer-import/defer-used-in-async/sync-access.js create mode 100644 test/configCases/defer-import/defer-used-in-async/webpack.config.js create mode 100644 test/configCases/defer-import/syntax-error-if-experiment-not-enabled/errors.js create mode 100644 test/configCases/defer-import/syntax-error-if-experiment-not-enabled/index.js create mode 100644 test/configCases/defer-import/syntax-error-if-experiment-not-enabled/mod.js create mode 100644 test/configCases/defer-import/syntax-error-if-experiment-not-enabled/webpack.config.js diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index 0182b6b31f2..e2ba028309a 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -805,6 +805,10 @@ export type CssParserNamedExports = boolean; * Enable/disable `url()`/`image-set()`/`src()`/`image()` functions handling. */ export type CssParserUrl = boolean; +/** + * Options for defer import. + */ +export type DeferImportExperimentOptions = boolean; /** * A Function returning a Promise resolving to a normalized entry. */ @@ -4002,6 +4006,10 @@ export interface ExperimentsExtra { * Enable css support. */ css?: 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; /** * Compile entrypoints and import()s only when they are accessed. */ @@ -4019,6 +4027,10 @@ export interface ExperimentsNormalizedExtra { * Enable css support. */ css?: 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; /** * Compile entrypoints and import()s only when they are accessed. */ diff --git a/lib/ConcatenationScope.js b/lib/ConcatenationScope.js index 5c7bb6fd0dc..51f1e510ecb 100644 --- a/lib/ConcatenationScope.js +++ b/lib/ConcatenationScope.js @@ -15,13 +15,14 @@ const { /** @typedef {import("./optimize/ConcatenatedModule").ModuleInfo} ModuleInfo */ const MODULE_REFERENCE_REGEXP = - /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/; + /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(_deferredImport)?(?:_asiSafe(\d))?__$/; /** * @typedef {object} ModuleReferenceOptions * @property {string[]} ids the properties/exports of the module * @property {boolean} call true, when this referenced export is called * @property {boolean} directImport true, when this referenced export is directly imported (not via property access) + * @property {boolean} deferredImport true, when this referenced export is deferred * @property {boolean | undefined} asiSafe if the position is ASI safe or unknown */ @@ -90,11 +91,18 @@ class ConcatenationScope { */ createModuleReference( module, - { ids = undefined, call = false, directImport = false, asiSafe = false } + { + ids = undefined, + call = false, + directImport = false, + deferredImport = false, + asiSafe = false + } ) { const info = /** @type {ModuleInfo} */ (this._modulesMap.get(module)); const callFlag = call ? "_call" : ""; const directImportFlag = directImport ? "_directImport" : ""; + const deferredImportFlag = deferredImport ? "_deferredImport" : ""; const asiSafeFlag = asiSafe ? "_asiSafe1" : asiSafe === false @@ -104,7 +112,7 @@ class ConcatenationScope { ? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex") : "ns"; // a "._" is appended to allow "delete ...", which would cause a SyntaxError in strict mode - return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${asiSafeFlag}__._`; + return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${deferredImportFlag}${asiSafeFlag}__._`; } /** @@ -123,7 +131,7 @@ class ConcatenationScope { const match = MODULE_REFERENCE_REGEXP.exec(name); if (!match) return null; const index = Number(match[1]); - const asiSafe = match[5]; + const asiSafe = match[6]; return { index, ids: @@ -132,6 +140,7 @@ class ConcatenationScope { : JSON.parse(Buffer.from(match[2], "hex").toString("utf-8")), call: Boolean(match[3]), directImport: Boolean(match[4]), + deferredImport: Boolean(match[5]), asiSafe: asiSafe ? asiSafe === "1" : undefined }; } diff --git a/lib/Dependency.js b/lib/Dependency.js index 7447c36487f..1b2eb272d8b 100644 --- a/lib/Dependency.js +++ b/lib/Dependency.js @@ -101,7 +101,10 @@ class Dependency { /** @type {boolean} */ this.weak = false; // TODO check if this can be moved into ModuleDependency - /** @type {boolean} */ + /** @type {boolean | undefined} */ + this.defer = false; + // TODO check if this can be moved into ModuleDependency + /** @type {boolean | undefined} */ this.optional = false; this._locSL = 0; this._locSC = 0; @@ -309,6 +312,7 @@ class Dependency { write(this._locEC); write(this._locI); write(this._locN); + write(this.defer); } /** @@ -323,6 +327,7 @@ class Dependency { this._locEC = read(); this._locI = read(); this._locN = read(); + this.defer = read(); } } diff --git a/lib/ExportsInfo.js b/lib/ExportsInfo.js index 7234957339c..4289983be2f 100644 --- a/lib/ExportsInfo.js +++ b/lib/ExportsInfo.js @@ -832,7 +832,7 @@ class ExportsInfo { /** @typedef {Map} UsedInRuntime */ -/** @typedef {{ module: Module, export: string[] }} TargetItemWithoutConnection */ +/** @typedef {{ module: Module, export: string[], deferred: boolean }} TargetItemWithoutConnection */ /** @typedef {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }} TargetItemWithConnection */ @@ -1341,7 +1341,10 @@ class ExportInfo { /** @type {TargetItemWithoutConnection} */ let target = { module: rawTarget.connection.module, - export: rawTarget.export + export: rawTarget.export, + deferred: Boolean( + rawTarget.connection.dependency && rawTarget.connection.dependency.defer + ) }; for (;;) { if (validTargetModuleFilter(target.module)) return target; @@ -1361,7 +1364,8 @@ class ExportInfo { module: newTarget.module, export: newTarget.export ? newTarget.export.concat(target.export.slice(1)) - : target.export.slice(1) + : target.export.slice(1), + deferred: newTarget.deferred }; } } diff --git a/lib/Module.js b/lib/Module.js index 036e1679b88..195ed19360d 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -46,6 +46,7 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ /** @typedef {import("./util/identifier").AssociatedObjectForCache} AssociatedObjectForCache */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +/** @typedef {"namespace" | "default-only" | "default-with-named" | "dynamic"} ExportsType */ /** * @template T @@ -527,7 +528,7 @@ class Module extends DependenciesBlock { /** * @param {ModuleGraph} moduleGraph the module graph * @param {boolean | undefined} strict the importing module is strict - * @returns {"namespace" | "default-only" | "default-with-named" | "dynamic"} export type + * @returns {ExportsType} export type * "namespace": Exports is already a namespace object. namespace = exports. * "dynamic": Check at runtime if __esModule is set. When set: namespace = { ...exports, default: exports }. When not set: namespace = { default: exports }. * "default-only": Provide a namespace object with only default export. namespace = { default: exports } diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js index 40fc0392d94..5fa38ea6838 100644 --- a/lib/ModuleGraph.js +++ b/lib/ModuleGraph.js @@ -752,6 +752,25 @@ class ModuleGraph { return mgm.async; } + /** + * @param {Module} module the module + * @returns {boolean} true, if the module is used as a deferred module at least once + */ + isDeferred(module) { + if (this.isAsync(module)) return false; + const connections = this.getIncomingConnections(module); + for (const connection of connections) { + if ( + !connection.dependency || + connection.dependency instanceof + require("./dependencies/CommonJsSelfReferenceDependency") + ) + continue; + if (connection.dependency.defer) return true; + } + return false; + } + /** * @param {Module} module the module * @returns {void} diff --git a/lib/RuntimeGlobals.js b/lib/RuntimeGlobals.js index 7d201f6267a..84a69fbb62a 100644 --- a/lib/RuntimeGlobals.js +++ b/lib/RuntimeGlobals.js @@ -116,6 +116,16 @@ module.exports.definePropertyGetters = "__webpack_require__.d"; */ module.exports.makeNamespaceObject = "__webpack_require__.r"; +/** + * make a deferred namespace object + */ +module.exports.makeDeferredNamespaceObject = "__webpack_require__.z"; + +/** + * the internal symbol that makeDeferredNamespaceObject is using. + */ +module.exports.makeDeferredNamespaceObjectSymbol = "__webpack_require__.zS"; + /** * create a fake namespace object */ @@ -385,3 +395,13 @@ module.exports.relativeUrl = "__webpack_require__.U"; * ) => void */ module.exports.asyncModule = "__webpack_require__.a"; + +/** + * The internal symbol that asyncModule is using. + */ +module.exports.asyncModuleExportSymbol = "__webpack_require__.aE"; + +/** + * The internal symbol that asyncModule is using. + */ +module.exports.asyncModuleDoneSymbol = "__webpack_require__.aD"; diff --git a/lib/RuntimePlugin.js b/lib/RuntimePlugin.js index 1de5e592f4d..5d4d94d4763 100644 --- a/lib/RuntimePlugin.js +++ b/lib/RuntimePlugin.js @@ -25,6 +25,7 @@ const GetTrustedTypesPolicyRuntimeModule = require("./runtime/GetTrustedTypesPol const GlobalRuntimeModule = require("./runtime/GlobalRuntimeModule"); const HasOwnPropertyRuntimeModule = require("./runtime/HasOwnPropertyRuntimeModule"); const LoadScriptRuntimeModule = require("./runtime/LoadScriptRuntimeModule"); +const MakeDeferredNamespaceObjectRuntime = require("./runtime/MakeDeferredNamespaceObjectRuntime"); const MakeNamespaceObjectRuntimeModule = require("./runtime/MakeNamespaceObjectRuntimeModule"); const NonceRuntimeModule = require("./runtime/NonceRuntimeModule"); const OnChunksLoadedRuntimeModule = require("./runtime/OnChunksLoadedRuntimeModule"); @@ -79,7 +80,8 @@ const GLOBALS_ON_REQUIRE = [ RuntimeGlobals.initializeSharing, RuntimeGlobals.loadScript, RuntimeGlobals.systemContext, - RuntimeGlobals.onChunksLoaded + RuntimeGlobals.onChunksLoaded, + RuntimeGlobals.makeDeferredNamespaceObject ]; const MODULE_DEPENDENCIES = { @@ -97,6 +99,13 @@ const TREE_DEPENDENCIES = { RuntimeGlobals.makeNamespaceObject, RuntimeGlobals.require ], + [RuntimeGlobals.makeDeferredNamespaceObject]: [ + RuntimeGlobals.definePropertyGetters, + RuntimeGlobals.makeNamespaceObject, + RuntimeGlobals.createFakeNamespaceObject, + RuntimeGlobals.hasOwnProperty, + RuntimeGlobals.require + ], [RuntimeGlobals.initializeSharing]: [RuntimeGlobals.shareScopeMap], [RuntimeGlobals.shareScopeMap]: [RuntimeGlobals.hasOwnProperty] }; @@ -184,6 +193,17 @@ class RuntimePlugin { ); return true; }); + compilation.hooks.runtimeRequirementInTree + .for(RuntimeGlobals.makeDeferredNamespaceObject) + .tap("RuntimePlugin", (chunk, runtimeRequirement) => { + compilation.addRuntimeModule( + chunk, + new MakeDeferredNamespaceObjectRuntime( + runtimeRequirement.has(RuntimeGlobals.asyncModule) + ) + ); + return true; + }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.hasOwnProperty) .tap(PLUGIN_NAME, chunk => { @@ -246,7 +266,11 @@ class RuntimePlugin { compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.asyncModule) .tap(PLUGIN_NAME, chunk => { - compilation.addRuntimeModule(chunk, new AsyncModuleRuntimeModule()); + const experiments = compilation.options.experiments; + compilation.addRuntimeModule( + chunk, + new AsyncModuleRuntimeModule(experiments.deferImport) + ); return true; }); compilation.hooks.runtimeRequirementInTree diff --git a/lib/RuntimeTemplate.js b/lib/RuntimeTemplate.js index 536d0b5eb1d..48d8934a5a7 100644 --- a/lib/RuntimeTemplate.js +++ b/lib/RuntimeTemplate.js @@ -8,6 +8,10 @@ const InitFragment = require("./InitFragment"); const RuntimeGlobals = require("./RuntimeGlobals"); const Template = require("./Template"); +const { + getMakeDeferredNamespaceModeFromExportsType, + getOptimizedDeferredModule +} = require("./runtime/MakeDeferredNamespaceObjectRuntime"); const { equals } = require("./util/ArrayHelpers"); const compileBooleanMatcher = require("./util/compileBooleanMatcher"); const propertyAccess = require("./util/propertyAccess"); @@ -779,22 +783,26 @@ class RuntimeTemplate { * @param {object} options options object * @param {boolean=} options.update whether a new variable should be created or the existing one updated * @param {Module} options.module the module + * @param {ModuleGraph} options.moduleGraph the module graph * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {string} options.request the request that should be printed as comment * @param {string} options.importVar name of the import variable * @param {Module} options.originModule module in which the statement is emitted * @param {boolean=} options.weak true, if this is a weak dependency * @param {RuntimeRequirements} options.runtimeRequirements if set, will be filled with runtime requirements + * @param {boolean=} options.defer if set, the module will be deferred * @returns {[string, string]} the import statement and the compat statement */ importStatement({ update, module, + moduleGraph, chunkGraph, request, importVar, originModule, weak, + defer, runtimeRequirements }) { if (!module) { @@ -805,6 +813,29 @@ class RuntimeTemplate { "" ]; } + + /** @type {Set} */ + const innerAsyncDependencies = new Set(); + defer = defer && (module.buildMeta ? !module.buildMeta.async : true); + + if (this.compilation.options.experiments.deferImport && defer) { + const seen = new Set(); + (function gatherInnerAsyncDependencies(mod) { + if (!moduleGraph.isAsync(mod) || seen.has(mod)) return; + seen.add(mod); + if (mod.buildMeta && mod.buildMeta.async) { + innerAsyncDependencies.add(mod); + } else { + for (const dep of mod.dependencies) { + const module = moduleGraph.getModule(dep); + if (module) { + gatherInnerAsyncDependencies(module); + } + } + } + })(module); + } + if (chunkGraph.getModuleId(module) === null) { if (weak) { // only weak referenced modules don't get an id @@ -840,9 +871,19 @@ class RuntimeTemplate { (originModule.buildMeta).strictHarmonyModule ); runtimeRequirements.add(RuntimeGlobals.require); - const importContent = `/* harmony import */ ${optDeclaration}${importVar} = ${RuntimeGlobals.require}(${moduleId});\n`; + let importContent; + if (defer) { + importContent = `/* deferred harmony import */ ${optDeclaration}${importVar} = ${getOptimizedDeferredModule( + this, + exportsType, + moduleId, + Array.from(innerAsyncDependencies, mod => chunkGraph.getModuleId(mod)) + )};\n`; + } else { + importContent = `/* harmony import */ ${optDeclaration}${importVar} = ${RuntimeGlobals.require}(${moduleId});\n`; + } - if (exportsType === "dynamic") { + if (exportsType === "dynamic" && !defer) { runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); return [ importContent, @@ -856,6 +897,7 @@ class RuntimeTemplate { * @template GenerateContext * @param {object} options options * @param {ModuleGraph} options.moduleGraph the module graph + * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {Module} options.module the module * @param {string} options.request the request * @param {string | string[]} options.exportName the export name @@ -868,10 +910,12 @@ class RuntimeTemplate { * @param {InitFragment[]} options.initFragments init fragments will be added here * @param {RuntimeSpec} options.runtime runtime for which this code will be generated * @param {RuntimeRequirements} options.runtimeRequirements if set, will be filled with runtime requirements + * @param {boolean=} options.defer if true, the module will be deferred. * @returns {string} expression */ exportFromImport({ moduleGraph, + chunkGraph, module, request, exportName, @@ -883,13 +927,16 @@ class RuntimeTemplate { importVar, initFragments, runtime, - runtimeRequirements + runtimeRequirements, + defer }) { if (!module) { return this.missingModule({ request }); } + + defer = defer && (module.buildMeta ? !module.buildMeta.async : true); if (!Array.isArray(exportName)) { exportName = exportName ? [exportName] : []; } @@ -900,7 +947,21 @@ class RuntimeTemplate { ); 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") { + const access = `${importVar}.a${propertyAccess(exportName, 1)}`; + if (isCall || asiSafe === undefined) { + return access; + } + return asiSafe ? `(${access})` : `;(${access})`; + } + // accessing the .default property is same thing as `require()` the module. + + // For example: + // import mod from "cjs"; mod.default.x; + // is translated to + // var mod = require("cjs"); mod.x; switch (exportsType) { case "dynamic": if (isCall) { @@ -918,7 +979,11 @@ class RuntimeTemplate { break; } } else if (exportName.length > 0) { + // the property used is not .default. + // For example: + // import * as ns from "cjs"; cjs.prop; if (exportsType === "default-only") { + // in the strictest case, it is a runtime error (e.g. NodeJS behavior of CJS-ESM interop). return `/* non-default import from non-esm module */undefined${propertyAccess( exportName, 1 @@ -929,10 +994,17 @@ class RuntimeTemplate { ) { return "/* __esModule */true"; } + } else if (defer) { + // now exportName.length is 0 + // fall through to the end of this function, create the namespace there. } else if ( exportsType === "default-only" || exportsType === "default-with-named" ) { + // now exportName.length is 0, which means the namespace object is used in an unknown way + // for example: + // import * as ns from "cjs"; console.log(ns); + // we will need to createFakeNamespaceObject that simulates ES Module namespace object runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); initFragments.push( new InitFragment( @@ -952,6 +1024,8 @@ class RuntimeTemplate { if (exportName.length > 0) { const exportsInfo = moduleGraph.getExportsInfo(module); + // in some case the exported item is renamed (get this by getUsedName). for example, + // x.default might be emitted as x.Z (default is renamed to Z) const used = exportsInfo.getUsedName(exportName, runtime); if (!used) { const comment = Template.toNormalComment( @@ -962,7 +1036,9 @@ class RuntimeTemplate { const comment = equals(used, exportName) ? "" : `${Template.toNormalComment(propertyAccess(exportName))} `; - const access = `${importVar}${comment}${propertyAccess(used)}`; + const access = `${importVar}${ + defer ? ".a" : "" + }${comment}${propertyAccess(used)}`; if (isCall && callContext === false) { return asiSafe ? `(0,${access})` @@ -972,6 +1048,30 @@ class RuntimeTemplate { } return access; } + if (defer) { + initFragments.push( + new InitFragment( + `var ${importVar}_deferred_namespace_cache;\n`, + InitFragment.STAGE_CONSTANTS, + -1, + `${importVar}_deferred_namespace_cache` + ) + ); + + runtimeRequirements.add(RuntimeGlobals.makeDeferredNamespaceObject); + const id = chunkGraph.getModuleId(module); + const type = getMakeDeferredNamespaceModeFromExportsType(exportsType); + const init = `${ + RuntimeGlobals.makeDeferredNamespaceObject + }(${JSON.stringify(id)}, ${type})`; + + return `/*#__PURE__*/ ${ + asiSafe ? "" : asiSafe === false ? ";" : "Object" + }(${importVar}_deferred_namespace_cache || (${importVar}_deferred_namespace_cache = ${init}))`; + } + // if we hit here, the importVar is either + // - already a ES module namespace object + // - or imported by a way that does not need interop. return importVar; } diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index 02f5126aceb..00dddb42366 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -404,7 +404,8 @@ class WebpackOptionsApply extends OptionsApply { new CompatibilityPlugin().apply(compiler); new HarmonyModulesPlugin({ - topLevelAwait: options.experiments.topLevelAwait + topLevelAwait: options.experiments.topLevelAwait, + deferImport: options.experiments.deferImport }).apply(compiler); if (options.amd !== false) { const AMDPlugin = require("./dependencies/AMDPlugin"); diff --git a/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/lib/dependencies/HarmonyExportDependencyParserPlugin.js index 37d62d1c428..a80766b80b0 100644 --- a/lib/dependencies/HarmonyExportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyExportDependencyParserPlugin.js @@ -5,6 +5,7 @@ "use strict"; +const WebpackError = require("../WebpackError"); const { getImportAttributes } = require("../javascript/JavascriptParser"); const InnerGraph = require("../optimize/InnerGraph"); const ConstDependency = require("./ConstDependency"); @@ -14,7 +15,8 @@ const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImporte const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency"); const { ExportPresenceModes } = require("./HarmonyImportDependency"); const { - harmonySpecifierTag + harmonySpecifierTag, + getImportMode } = require("./HarmonyImportDependencyParserPlugin"); const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency"); @@ -31,8 +33,9 @@ const PLUGIN_NAME = "HarmonyExportDependencyParserPlugin"; module.exports = class HarmonyExportDependencyParserPlugin { /** * @param {import("../../declarations/WebpackOptions").JavascriptParserOptions} options options + * @param {boolean=} deferImport defer import enabled */ - constructor(options) { + constructor(options, deferImport) { this.exportPresenceMode = options.reexportExportsPresence !== undefined ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence) @@ -41,6 +44,7 @@ module.exports = class HarmonyExportDependencyParserPlugin { : options.strictExportPresence ? ExportPresenceModes.ERROR : ExportPresenceModes.AUTO; + this.deferImport = deferImport; } /** @@ -73,10 +77,24 @@ module.exports = class HarmonyExportDependencyParserPlugin { clearDep.loc = /** @type {DependencyLocation} */ (statement.loc); clearDep.loc.index = -1; parser.state.module.addPresentationalDependency(clearDep); + const { defer } = getImportMode( + parser, + statement, + this.deferImport, + true + ); + 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), parser.state.lastHarmonyImportOrder, - getImportAttributes(statement) + getImportAttributes(statement), + defer ); sideEffectDep.loc = Object.create( /** @type {DependencyLocation} */ (statement.loc) @@ -156,7 +174,8 @@ module.exports = class HarmonyExportDependencyParserPlugin { null, exportPresenceMode, null, - settings.attributes + settings.attributes, + settings.defer ) : new HarmonyExportSpecifierDependency(id, name); dep.loc = Object.create( @@ -187,6 +206,12 @@ module.exports = class HarmonyExportDependencyParserPlugin { parser.state.harmonyStarExports || new HarmonyStarExportsList(); } const attributes = getImportAttributes(statement); + const { defer } = getImportMode( + parser, + statement, + this.deferImport, + false + ); const dep = new HarmonyExportImportedSpecifierDependency( /** @type {string} */ (source), parser.state.lastHarmonyImportOrder, @@ -196,7 +221,8 @@ module.exports = class HarmonyExportDependencyParserPlugin { harmonyStarExports && harmonyStarExports.slice(), exportPresenceMode, harmonyStarExports, - attributes + attributes, + defer ); if (harmonyStarExports) { harmonyStarExports.push(dep); diff --git a/lib/dependencies/HarmonyExportExpressionDependency.js b/lib/dependencies/HarmonyExportExpressionDependency.js index 5de97a18a44..531b139126f 100644 --- a/lib/dependencies/HarmonyExportExpressionDependency.js +++ b/lib/dependencies/HarmonyExportExpressionDependency.js @@ -27,7 +27,7 @@ class HarmonyExportExpressionDependency extends NullDependency { * @param {Range} range range * @param {Range} rangeStatement range statement * @param {string} prefix prefix - * @param {string | { range: Range, prefix: string, suffix: string }=} declarationId declaration id + * @param {string | { id?: string | undefined, range: Range, prefix: string, suffix: string }=} declarationId declaration id */ constructor(range, rangeStatement, prefix, declarationId) { super(); diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index c76c4509d41..cd95213ee26 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -12,6 +12,9 @@ const HarmonyLinkingError = require("../HarmonyLinkingError"); const InitFragment = require("../InitFragment"); const RuntimeGlobals = require("../RuntimeGlobals"); const Template = require("../Template"); +const { + getMakeDeferredNamespaceModeFromExportsType +} = require("../runtime/MakeDeferredNamespaceObjectRuntime"); const { countIterable } = require("../util/IterableHelpers"); const { first, combine } = require("../util/SetHelpers"); const makeSerializable = require("../util/makeSerializable"); @@ -374,6 +377,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 */ constructor( request, @@ -384,7 +388,8 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { otherStarExports, exportPresenceMode, allStarExports, - attributes + attributes, + deferEvaluation ) { super(request, sourceOrder, attributes); @@ -394,6 +399,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { this.otherStarExports = otherStarExports; this.exportPresenceMode = exportPresenceMode; this.allStarExports = allStarExports; + this.defer = deferEvaluation; } /** @@ -1011,6 +1017,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS mode, templateContext.module, moduleGraph, + templateContext.chunkGraph, runtime, templateContext.runtimeTemplate, templateContext.runtimeRequirements @@ -1024,6 +1031,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS * @param {ExportMode} mode the export mode * @param {Module} module the current module * @param {ModuleGraph} moduleGraph the module graph + * @param {ChunkGraph} chunkGraph the chunk graph * @param {RuntimeSpec} runtime the runtime * @param {RuntimeTemplate} runtimeTemplate the runtime template * @param {RuntimeRequirements} runtimeRequirements runtime requirements @@ -1035,6 +1043,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS mode, module, moduleGraph, + chunkGraph, runtime, runtimeTemplate, runtimeRequirements @@ -1042,6 +1051,29 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS const importedModule = /** @type {Module} */ (moduleGraph.getModule(dep)); const importVar = dep.getImportVar(moduleGraph); + if ( + (mode.type === "reexport-namespace-object" || + mode.type === "reexport-fake-namespace-object") && + dep.defer && + !moduleGraph.isAsync(importedModule) + ) { + initFragments.push( + ...this.getReexportDeferredNamespaceObjectFragments( + importedModule, + chunkGraph, + moduleGraph + .getExportsInfo(module) + .getUsedName(mode.name ? mode.name : [], runtime), + importVar, + importedModule.getExportsType( + moduleGraph, + module.buildMeta && module.buildMeta.strictHarmonyModule + ), + runtimeRequirements + ) + ); + return; + } switch (mode.type) { case "missing": case "empty-star": @@ -1311,6 +1343,46 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS ]; } + /** + * @param {Module} module module + * @param {ChunkGraph} chunkGraph chunkGraph + * @param {string | false | string[]} key key + * @param {string} name name + * @param {import("../Module").ExportsType} exportsType exportsType + * @param {Set} runtimeRequirements runtimeRequirements + * @returns {InitFragment[]} fragments + */ + getReexportDeferredNamespaceObjectFragments( + module, + chunkGraph, + key, + name, + exportsType, + runtimeRequirements + ) { + runtimeRequirements.add(RuntimeGlobals.exports); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + runtimeRequirements.add(RuntimeGlobals.makeDeferredNamespaceObject); + + const map = new Map(); + const moduleId = JSON.stringify(chunkGraph.getModuleId(module)); + const mode = getMakeDeferredNamespaceModeFromExportsType(exportsType); + map.set( + key, + `/* reexport deferred namespace object */ ${name}_deferred_namespace_cache || (${name}_deferred_namespace_cache = ${RuntimeGlobals.makeDeferredNamespaceObject}(${moduleId}, ${mode}))` + ); + + return [ + new InitFragment( + `var ${name}_deferred_namespace_cache;\n`, + InitFragment.STAGE_CONSTANTS, + -1, + `${name}_deferred_namespace_cache` + ), + new HarmonyExportInitFragment(module.exportsArgument, map) + ]; + } + /** * @param {Module} module module * @param {string} key key diff --git a/lib/dependencies/HarmonyImportDependency.js b/lib/dependencies/HarmonyImportDependency.js index fab851ee831..170a2be42d3 100644 --- a/lib/dependencies/HarmonyImportDependency.js +++ b/lib/dependencies/HarmonyImportDependency.js @@ -120,11 +120,13 @@ class HarmonyImportDependency extends ModuleDependency { return runtimeTemplate.importStatement({ update, module: /** @type {Module} */ (moduleGraph.getModule(this)), + moduleGraph, chunkGraph, importVar: this.getImportVar(moduleGraph), request: this.request, originModule: module, - runtimeRequirements + runtimeRequirements, + defer: this.defer }); } diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index c0b6f29335e..65a722814dc 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -5,7 +5,10 @@ "use strict"; +const CommentCompilationWarning = require("../CommentCompilationWarning"); const HotModuleReplacementPlugin = require("../HotModuleReplacementPlugin"); +const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning"); +const WebpackError = require("../WebpackError"); const { getImportAttributes } = require("../javascript/JavascriptParser"); const InnerGraph = require("../optimize/InnerGraph"); const ConstDependency = require("./ConstDependency"); @@ -49,6 +52,7 @@ const harmonySpecifierTag = Symbol("harmony import"); * @property {string} name * @property {boolean} await * @property {ImportAttributes=} attributes + * @property {boolean | undefined} defer */ const PLUGIN_NAME = "HarmonyImportDependencyParserPlugin"; @@ -56,8 +60,9 @@ const PLUGIN_NAME = "HarmonyImportDependencyParserPlugin"; module.exports = class HarmonyImportDependencyParserPlugin { /** * @param {JavascriptParserOptions} options options + * @param {boolean | undefined} deferImport defer import enabled */ - constructor(options) { + constructor(options, deferImport) { this.exportPresenceMode = options.importExportsPresence !== undefined ? ExportPresenceModes.fromUserOption(options.importExportsPresence) @@ -67,6 +72,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { ? ExportPresenceModes.ERROR : ExportPresenceModes.AUTO; this.strictThisContextOnImports = options.strictThisContextOnImports; + this.deferImport = deferImport; } /** @@ -119,10 +125,28 @@ 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, + this.deferImport, + true + ); + 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), parser.state.lastHarmonyImportOrder, - attributes + attributes, + defer ); sideEffectDep.loc = /** @type {DependencyLocation} */ (statement.loc); parser.state.module.addDependency(sideEffectDep); @@ -132,12 +156,19 @@ module.exports = class HarmonyImportDependencyParserPlugin { PLUGIN_NAME, (statement, source, id, name) => { const ids = id === null ? [] : [id]; + const { defer } = getImportMode( + parser, + statement, + this.deferImport, + false + ); parser.tagVariable(name, harmonySpecifierTag, { name, source, ids, sourceOrder: parser.state.lastHarmonyImportOrder, - attributes: getImportAttributes(statement) + attributes: getImportAttributes(statement), + defer }); return true; } @@ -194,7 +225,8 @@ module.exports = class HarmonyImportDependencyParserPlugin { (expr.range), exportPresenceMode, settings.attributes, - [] + [], + settings.defer ); dep.referencedPropertiesInDestructuring = parser.destructuringAssignmentPropertiesFor(expr); @@ -241,7 +273,8 @@ module.exports = class HarmonyImportDependencyParserPlugin { (expr.range), exportPresenceMode, settings.attributes, - ranges + ranges, + settings.defer ); dep.referencedPropertiesInDestructuring = parser.destructuringAssignmentPropertiesFor(expr); @@ -290,7 +323,8 @@ module.exports = class HarmonyImportDependencyParserPlugin { /** @type {Range} */ (expr.range), exportPresenceMode, settings.attributes, - ranges + ranges, + settings.defer ); dep.directImport = members.length === 0; dep.call = true; @@ -357,4 +391,57 @@ module.exports = class HarmonyImportDependencyParserPlugin { } }; +/** + * @param {JavascriptParser} parser parser + * @param {ExportNamedDeclaration | ExportAllDeclaration | ImportDeclaration} node node + * @param {boolean | undefined} deferImportEnabled defer import enabled + * @param {boolean} reportSyntaxError report syntax error + * @returns {{defer: boolean}} import attributes + */ +function getImportMode(parser, node, deferImportEnabled, reportSyntaxError) { + const result = { defer: false }; + if ("phase" in node && node.phase === "defer") { + if (deferImportEnabled) { + result.defer = true; + } else if (reportSyntaxError) { + const error = new WebpackError( + "Deferred import syntax (`import defer * as namespace from '...'`) cannot be used unless experimental.deferImport is true." + ); + error.loc = node.loc || undefined; + parser.state.current.addError(error); + } + } + if (!node.range) { + return result; + } + const { options, errors } = parser.parseCommentOptions(node.range); + if (errors) { + for (const e of errors) { + const { comment } = e; + if (!comment.loc) continue; + parser.state.module.addWarning( + new CommentCompilationWarning( + `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`, + comment.loc + ) + ); + } + } + if (!options) return result; + if (options.webpackDefer) { + if (typeof options.webpackDefer === "boolean") { + result.defer = options.webpackDefer; + } else if (node.loc) { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + "webpackDefer magic comment expected a boolean value.", + node.loc + ) + ); + } + } + return result; +} + module.exports.harmonySpecifierTag = harmonySpecifierTag; +module.exports.getImportMode = getImportMode; diff --git a/lib/dependencies/HarmonyImportSideEffectDependency.js b/lib/dependencies/HarmonyImportSideEffectDependency.js index bf691745ed3..5911c5b3386 100644 --- a/lib/dependencies/HarmonyImportSideEffectDependency.js +++ b/lib/dependencies/HarmonyImportSideEffectDependency.js @@ -16,6 +16,7 @@ const HarmonyImportDependency = require("./HarmonyImportDependency"); /** @typedef {import("../ModuleGraph")} ModuleGraph */ /** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ /** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ +/** @typedef {import("../WebpackError")} WebpackError */ /** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */ /** @typedef {import("../util/Hash")} Hash */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ @@ -25,9 +26,11 @@ class HarmonyImportSideEffectDependency extends HarmonyImportDependency { * @param {string} request the request string * @param {number} sourceOrder source order * @param {ImportAttributes=} attributes import attributes + * @param {boolean=} deferred deferred */ - constructor(request, sourceOrder, attributes) { + constructor(request, sourceOrder, attributes, deferred) { super(request, sourceOrder, attributes); + this.defer = deferred; } get type() { diff --git a/lib/dependencies/HarmonyImportSpecifierDependency.js b/lib/dependencies/HarmonyImportSpecifierDependency.js index cef28d8e5d4..8b30d7947ca 100644 --- a/lib/dependencies/HarmonyImportSpecifierDependency.js +++ b/lib/dependencies/HarmonyImportSpecifierDependency.js @@ -51,6 +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 */ constructor( request, @@ -60,7 +61,8 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { range, exportPresenceMode, attributes, - idRanges // TODO webpack 6 make this non-optional. It must always be set to properly trim ids. + idRanges, // TODO webpack 6 make this non-optional. It must always be set to properly trim ids. + deferred ) { super(request, sourceOrder, attributes); this.ids = ids; @@ -77,6 +79,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { this.usedByExports = undefined; /** @type {Set | undefined} */ this.referencedPropertiesInDestructuring = undefined; + this.defer = deferred; } // TODO webpack 6 remove @@ -420,13 +423,15 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen exportExpr = concatenationScope.createModuleReference( connection.module, { - asiSafe: dep.asiSafe + asiSafe: dep.asiSafe, + deferredImport: dep.defer } ); } else if (dep.namespaceObjectAsContext && ids.length === 1) { exportExpr = concatenationScope.createModuleReference(connection.module, { - asiSafe: dep.asiSafe + asiSafe: dep.asiSafe, + deferredImport: dep.defer }) + propertyAccess(ids); } else { exportExpr = concatenationScope.createModuleReference( @@ -435,7 +440,8 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen ids, call: dep.call, directImport: dep.directImport, - asiSafe: dep.asiSafe + asiSafe: dep.asiSafe, + deferredImport: dep.defer } ); } @@ -448,6 +454,7 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen exportExpr = runtimeTemplate.exportFromImport({ moduleGraph, module: /** @type {Module} */ (moduleGraph.getModule(dep)), + chunkGraph: templateContext.chunkGraph, request: dep.request, exportName: ids, originModule: module, @@ -458,7 +465,8 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen importVar: dep.getImportVar(moduleGraph), initFragments, runtime, - runtimeRequirements + runtimeRequirements, + defer: dep.defer }); } return exportExpr; diff --git a/lib/dependencies/HarmonyModulesPlugin.js b/lib/dependencies/HarmonyModulesPlugin.js index a3bbd98de82..5665a21edfd 100644 --- a/lib/dependencies/HarmonyModulesPlugin.js +++ b/lib/dependencies/HarmonyModulesPlugin.js @@ -28,11 +28,14 @@ const HarmonyTopLevelThisParserPlugin = require("./HarmonyTopLevelThisParserPlug /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ /** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../javascript/JavascriptParser")} Parser */ +/** + * @typedef HarmonyModulesPluginOptions + * @property {boolean=} topLevelAwait + * @property {boolean=} deferImport + */ const PLUGIN_NAME = "HarmonyModulesPlugin"; -/** @typedef {{ topLevelAwait?: boolean }} HarmonyModulesPluginOptions */ - class HarmonyModulesPlugin { /** * @param {HarmonyModulesPluginOptions} options options @@ -131,8 +134,14 @@ class HarmonyModulesPlugin { return; new HarmonyDetectionParserPlugin(this.options).apply(parser); - new HarmonyImportDependencyParserPlugin(parserOptions).apply(parser); - new HarmonyExportDependencyParserPlugin(parserOptions).apply(parser); + new HarmonyImportDependencyParserPlugin( + parserOptions, + this.options.deferImport + ).apply(parser); + new HarmonyExportDependencyParserPlugin( + parserOptions, + this.options.deferImport + ).apply(parser); new HarmonyTopLevelThisParserPlugin().apply(parser); }; diff --git a/lib/dependencies/ImportParserPlugin.js b/lib/dependencies/ImportParserPlugin.js index 25d8ccd1a0b..e32b7469129 100644 --- a/lib/dependencies/ImportParserPlugin.js +++ b/lib/dependencies/ImportParserPlugin.js @@ -93,6 +93,28 @@ class ImportParserPlugin { } } + let phase = expr.phase; + if (!phase && importOptions && importOptions.webpackDefer !== undefined) { + if (typeof importOptions.webpackDefer !== "boolean") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + `\`webpackDefer\` expected a boolean, but received: ${importOptions.webpackDefer}.`, + /** @type {DependencyLocation} */ (expr.loc) + ) + ); + } else if (importOptions.webpackDefer) { + phase = "defer"; + } + } + if (phase === "defer") { + parser.state.module.addWarning( + new UnsupportedFeatureWarning( + "import.defer() is not implemented yet.", + /** @type {DependencyLocation} */ (expr.loc) + ) + ); + } + if (importOptions) { if (importOptions.webpackIgnore !== undefined) { if (typeof importOptions.webpackIgnore !== "boolean") { diff --git a/lib/javascript/JavascriptModulesPlugin.js b/lib/javascript/JavascriptModulesPlugin.js index 909968b2a8a..2db36cb58cc 100644 --- a/lib/javascript/JavascriptModulesPlugin.js +++ b/lib/javascript/JavascriptModulesPlugin.js @@ -1162,6 +1162,16 @@ class JavascriptModulesPlugin { buf.push(""); } + if (runtimeRequirements.has(RuntimeGlobals.makeDeferredNamespaceObject)) { + // in order to optimize of DeferredNamespaceObject, we remove all proxy handlers after the module initialize + // (see MakeDeferredNamespaceObjectRuntimeModule) + // This requires all deferred imports to a module can get the module export object before the module + // is evaluated. + buf.push("// The deferred module cache"); + buf.push("var __webpack_module_deferred_exports__ = {};"); + buf.push(""); + } + if (useRequire) { buf.push("// The require function"); buf.push(`function ${RuntimeGlobals.require}(moduleId) {`); @@ -1431,6 +1441,9 @@ class JavascriptModulesPlugin { const needModuleLoaded = runtimeRequirements.has( RuntimeGlobals.moduleLoaded ); + const needModuleDefer = runtimeRequirements.has( + RuntimeGlobals.makeDeferredNamespaceObject + ); const content = Template.asString([ "// Check if module is in cache", "var cachedModule = __webpack_module_cache__[moduleId];", @@ -1447,7 +1460,9 @@ class JavascriptModulesPlugin { Template.indent([ needModuleId ? "id: moduleId," : "// no module.id needed", needModuleLoaded ? "loaded: false," : "// no module.loaded needed", - "exports: {}" + needModuleDefer + ? "exports: __webpack_module_deferred_exports__[moduleId] || {}" + : "exports: {}" ]), "};", "", @@ -1456,7 +1471,13 @@ class JavascriptModulesPlugin { "// Execute the module function", "var threw = true;", "try {", - Template.indent([moduleExecution, "threw = false;"]), + Template.indent([ + moduleExecution, + "threw = false;", + ...(needModuleDefer + ? ["delete __webpack_module_deferred_exports__[moduleId];"] + : []) + ]), "} finally {", Template.indent([ "if(threw) delete __webpack_module_cache__[moduleId];" @@ -1467,14 +1488,27 @@ class JavascriptModulesPlugin { ? Template.asString([ "// Execute the module function", "try {", - Template.indent(moduleExecution), + Template.indent( + needModuleDefer + ? [ + moduleExecution, + "delete __webpack_module_deferred_exports__[moduleId];" + ] + : moduleExecution + ), "} catch(e) {", Template.indent(["module.error = e;", "throw e;"]), "}" ]) : Template.asString([ "// Execute the module function", - moduleExecution + moduleExecution, + ...(needModuleDefer + ? [ + "// delete __webpack_module_deferred_exports__[module];", + "// skipped because strictModuleErrorHandling is not enabled." + ] + : []) ]), needModuleLoaded ? Template.asString([ diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index 32f6cb70060..eed51824c83 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -83,6 +83,7 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); /** @typedef {import("estree").Statement} Statement */ /** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclaration */ /** @typedef {import("estree").Super} Super */ +/** @typedef {import("estree").ImportSpecifier} ImportSpecifier */ /** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpression */ /** @typedef {import("estree").TemplateLiteral} TemplateLiteral */ /** @typedef {import("estree").AssignmentProperty} AssignmentProperty */ @@ -102,10 +103,10 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); // TODO remove cast when @types/estree has been updated to import assertions /** @typedef {import("estree").BaseNode & { type: "ImportAttribute", key: Identifier | Literal, value: Literal }} ImportAttribute */ -/** @typedef {import("estree").ImportDeclaration & { attributes?: Array }} ImportDeclaration */ +/** @typedef {import("estree").ImportDeclaration & { attributes?: Array, phase?: "defer" }} ImportDeclaration */ /** @typedef {import("estree").ExportNamedDeclaration & { attributes?: Array }} ExportNamedDeclaration */ /** @typedef {import("estree").ExportAllDeclaration & { attributes?: Array }} ExportAllDeclaration */ -/** @typedef {import("estree").ImportExpression & { options?: Expression | null }} ImportExpression */ +/** @typedef {import("estree").ImportExpression & { options?: Expression | null, phase?: "defer" }} ImportExpression */ /** @typedef {ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration} ModuleDeclaration */ /** @type {string[]} */ @@ -179,8 +180,147 @@ const importAssertions = Parser => } }; +// follow https://www.npmjs.com/acorn-import-defer if possible +/** @type {(BaseParser: typeof AcornParser) => typeof AcornParser} */ +const importDefer = Parser => + class extends Parser { + /** + * @this {InstanceType} + * @param {ImportDeclaration} node import declaration + * @returns {ImportDeclaration} import declaration + */ + parseImport(node) { + this._defer = false; + // eslint-disable-next-line no-warning-comments + // @ts-ignore + const result = super.parseImport(node); + if (this._defer) { + node.phase = "defer"; + } + return result; + } + + /** + * @this {InstanceType} + * @returns {ImportSpecifier[]} import specifiers + */ + parseImportSpecifiers() { + // eslint-disable-next-line no-warning-comments + // @ts-ignore + if (!this.isContextual("defer")) return super.parseImportSpecifiers(); + + const deferId = this.parseIdent(); + if (this.isContextual("from") || this.type === tokTypes.comma) { + const defaultSpecifier = this.startNodeAt( + deferId.start, + deferId.loc.start + ); + defaultSpecifier.local = deferId; + this.checkLValSimple(deferId, /* BIND_LEXICAL */ 2); + + const nodes = [ + this.finishNode(defaultSpecifier, "ImportDefaultSpecifier") + ]; + if (this.eat(tokTypes.comma)) { + if (this.type !== tokTypes.star && this.type !== tokTypes.braceL) { + this.unexpected(); + } + // eslint-disable-next-line no-warning-comments + // @ts-ignore + nodes.push(...super.parseImportSpecifiers()); + } + return nodes; + } + + this._defer = true; + + if (this.type !== tokTypes.star) { + this.raiseRecoverable( + deferId.start, + "'import defer' can only be used with namespace imports." + ); + } + + // eslint-disable-next-line no-warning-comments + // @ts-ignore + return super.parseImportSpecifiers(); + } + + /** + * @this {InstanceType} + * @param {boolean} forNew forNew + * @returns {ImportExpression} import expression + */ + parseExprImport(forNew) { + // eslint-disable-next-line no-warning-comments + // @ts-ignore + const node = super.parseExprImport(forNew); + + if (node.type === "MetaProperty" && node.property.name === "defer") { + if (this.type === tokTypes.parenL) { + const dynImport = this.parseDynamicImport( + this.startNodeAt(node.start, node.loc.start) + ); + dynImport.phase = "defer"; + return dynImport; + } + this.raiseRecoverable( + node.start, + "'import.defer' can only be used in a dynamic import." + ); + } + + return node; + } + + /** + * @this {InstanceType} + * @param {MetaProperty} node node + * @returns {MetaProperty} import.meta + */ + parseImportMeta(node) { + this.next(); + + const containsEsc = this.containsEsc; + node.property = this.parseIdent(true); + + const { name } = node.property; + + if (name !== "meta" && name !== "defer") { + this.raiseRecoverable( + // eslint-disable-next-line no-warning-comments + // @ts-ignore + node.property.start, + "The only valid meta property for import is 'import.meta'" + ); + } + if (containsEsc) { + this.raiseRecoverable( + // eslint-disable-next-line no-warning-comments + // @ts-ignore + node.start, + `'import.${name}' must not contain escaped characters` + ); + } + if ( + name === "meta" && + this.options.sourceType !== "module" && + !this.options.allowImportExportEverywhere + ) { + this.raiseRecoverable( + // eslint-disable-next-line no-warning-comments + // @ts-ignore + node.start, + "Cannot use 'import.meta' outside a module" + ); + } + + return this.finishNode(node, "MetaProperty"); + } + }; + // Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API -const parser = AcornParser.extend(importAssertions); +const parser = AcornParser.extend(importAssertions, importDefer); /** @typedef {Record & { _isLegacyAssert?: boolean }} ImportAttributes */ diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index 9bd59543e90..4b237929ff5 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -22,7 +22,12 @@ const RuntimeGlobals = require("../RuntimeGlobals"); const Template = require("../Template"); const { DEFAULTS } = require("../config/defaults"); const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency"); +const HarmonyImportSideEffectDependency = require("../dependencies/HarmonyImportSideEffectDependency"); const JavascriptParser = require("../javascript/JavascriptParser"); +const { + getMakeDeferredNamespaceModeFromExportsType, + getOptimizedDeferredModule +} = require("../runtime/MakeDeferredNamespaceObjectRuntime"); const { equals } = require("../util/ArrayHelpers"); const LazySet = require("../util/LazySet"); const { concatComparators } = require("../util/comparators"); @@ -154,12 +159,12 @@ if (!ReferencerClass.prototype.PropertyDefinition) { * @property {Map | undefined} rawExportMap * @property {string=} namespaceExportSymbol * @property {string | undefined} namespaceObjectName - * @property {boolean} interopNamespaceObjectUsed - * @property {string | undefined} interopNamespaceObjectName - * @property {boolean} interopNamespaceObject2Used - * @property {string | undefined} interopNamespaceObject2Name - * @property {boolean} interopDefaultAccessUsed - * @property {string | undefined} interopDefaultAccessName + * @property {boolean} interopNamespaceObjectUsed "default-with-named" namespace + * @property {string | undefined} interopNamespaceObjectName "default-with-named" namespace + * @property {boolean} interopNamespaceObject2Used "default-only" namespace + * @property {string | undefined} interopNamespaceObject2Name "default-only" namespace + * @property {boolean} interopDefaultAccessUsed runtime namespace object that detects "__esModule" + * @property {string | undefined} interopDefaultAccessName runtime namespace object that detects "__esModule" */ /** @@ -168,13 +173,17 @@ if (!ReferencerClass.prototype.PropertyDefinition) { * @property {Module} module * @property {RuntimeSpec | boolean} runtimeCondition * @property {number} index - * @property {string | undefined} name - * @property {boolean} interopNamespaceObjectUsed - * @property {string | undefined} interopNamespaceObjectName - * @property {boolean} interopNamespaceObject2Used - * @property {string | undefined} interopNamespaceObject2Name - * @property {boolean} interopDefaultAccessUsed - * @property {string | undefined} interopDefaultAccessName + * @property {string | undefined} name module.exports / harmony namespace object + * @property {string | undefined} deferredName deferred module.exports / harmony namespace object + * @property {boolean} deferred the module is deferred at least once + * @property {boolean} deferredNamespaceObjectUsed deferred namespace object that being used in a not-analyzable way so it must be materialized + * @property {string | undefined} deferredNamespaceObjectName deferred namespace object that being used in a not-analyzable way so it must be materialized + * @property {boolean} interopNamespaceObjectUsed "default-with-named" namespace + * @property {string | undefined} interopNamespaceObjectName "default-with-named" namespace + * @property {boolean} interopNamespaceObject2Used "default-only" namespace + * @property {string | undefined} interopNamespaceObject2Name "default-only" namespace + * @property {boolean} interopDefaultAccessUsed runtime namespace object that detects "__esModule" + * @property {string | undefined} interopDefaultAccessName runtime namespace object that detects "__esModule" */ /** @@ -219,6 +228,14 @@ const compareNumbers = (a, b) => { }; const bySourceOrder = createComparator("sourceOrder", compareNumbers); const byRangeStart = createComparator("rangeStart", compareNumbers); +const moveDeferToLast = ( + /** @type {{ defer?: boolean }} */ a, + /** @type {{ defer?: boolean }} */ b +) => { + if (a.defer === b.defer) return 0; + if (a.defer) return 1; + return -1; +}; /** * @param {Iterable} iterable iterable object @@ -257,6 +274,7 @@ const joinIterableWithComma = iterable => { * @param {RuntimeTemplate} runtimeTemplate the runtime template * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated * @param {boolean} asCall asCall + * @param {boolean} depDeferred the dependency is deferred * @param {boolean | undefined} strictHarmonyModule strictHarmonyModule * @param {boolean | undefined} asiSafe asiSafe * @param {Set} alreadyVisited alreadyVisited @@ -272,6 +290,7 @@ const getFinalBinding = ( runtimeTemplate, neededNamespaceObjects, asCall, + depDeferred, strictHarmonyModule, asiSafe, alreadyVisited = new Set() @@ -280,21 +299,36 @@ const getFinalBinding = ( moduleGraph, strictHarmonyModule ); + const deferred = + depDeferred && + info.type === "external" && + info.deferred && + !moduleGraph.isAsync(info.module); if (exportName.length === 0) { switch (exportsType) { case "default-only": - info.interopNamespaceObject2Used = true; + if (deferred) info.deferredNamespaceObjectUsed = true; + else info.interopNamespaceObject2Used = true; return { info, - rawName: /** @type {string} */ (info.interopNamespaceObject2Name), + rawName: /** @type {string} */ ( + deferred + ? info.deferredNamespaceObjectName + : info.interopNamespaceObject2Name + ), ids: exportName, exportName }; case "default-with-named": - info.interopNamespaceObjectUsed = true; + if (deferred) info.deferredNamespaceObjectUsed = true; + else info.interopNamespaceObjectUsed = true; return { info, - rawName: /** @type {string} */ (info.interopNamespaceObjectName), + rawName: /** @type {string} */ ( + deferred + ? info.deferredNamespaceObjectName + : info.interopNamespaceObjectName + ), ids: exportName, exportName }; @@ -348,6 +382,14 @@ const getFinalBinding = ( switch (exportName[0]) { case "default": { exportName = exportName.slice(1); + if (deferred) { + return { + info, + rawName: `${info.deferredName}.a`, + ids: exportName, + exportName + }; + } info.interopDefaultAccessUsed = true; const defaultExport = asCall ? `${info.interopDefaultAccessName}()` @@ -389,6 +431,15 @@ const getFinalBinding = ( exportName }; case "external": + if (deferred) { + info.deferredNamespaceObjectUsed = true; + return { + info, + rawName: /** @type {string} */ (info.deferredNamespaceObjectName), + ids: exportName, + exportName + }; + } return { info, rawName: @@ -480,6 +531,7 @@ const getFinalBinding = ( runtimeTemplate, neededNamespaceObjects, asCall, + reexport.deferred, /** @type {BuildMeta} */ (info.module.buildMeta).strictHarmonyModule, asiSafe, @@ -519,7 +571,15 @@ const getFinalBinding = ( const comment = equals(used, exportName) ? "" : Template.toNormalComment(`${exportName.join(".")}`); - return { info, rawName: info.name + comment, ids: used, exportName }; + return { + info, + rawName: + (deferred ? info.deferredName : info.name) + + (deferred ? ".a" : "") + + comment, + ids: used, + exportName + }; } } }; @@ -534,6 +594,7 @@ const getFinalBinding = ( * @param {RuntimeTemplate} runtimeTemplate the runtime template * @param {Set} neededNamespaceObjects modules for which a namespace object should be generated * @param {boolean} asCall asCall + * @param {boolean} depDeferred the dependency is deferred * @param {boolean | undefined} callContext callContext * @param {boolean | undefined} strictHarmonyModule strictHarmonyModule * @param {boolean | undefined} asiSafe asiSafe @@ -549,6 +610,7 @@ const getFinalName = ( runtimeTemplate, neededNamespaceObjects, asCall, + depDeferred, callContext, strictHarmonyModule, asiSafe @@ -563,6 +625,7 @@ const getFinalName = ( runtimeTemplate, neededNamespaceObjects, asCall, + depDeferred, strictHarmonyModule, asiSafe ); @@ -881,6 +944,8 @@ class ConcatenatedModule extends Module { const list = []; /** @type {Map} */ const existingEntries = new Map(); + const deferEnabled = + this.compilation && this.compilation.options.experiments.deferImport; /** * @param {Module} module a module @@ -895,7 +960,7 @@ class ConcatenatedModule extends Module { connections.push(c); } /** - * @type {Array<{ connection: ModuleGraphConnection, sourceOrder: number, rangeStart: number }>} + * @type {Array<{ connection: ModuleGraphConnection, sourceOrder: number, rangeStart: number, defer?: boolean }>} */ const references = connections .filter(connection => { @@ -915,7 +980,8 @@ class ConcatenatedModule extends Module { return { connection, sourceOrder: dep.sourceOrder, - rangeStart: dep.range && dep.range[0] + rangeStart: dep.range && dep.range[0], + defer: dep.defer }; }); /** @@ -930,11 +996,16 @@ class ConcatenatedModule extends Module { * a.a(); // first range * b.b(); // second range * + * If the import is deferred, we always move it to the last. * If there is no reexport, we have the same source. * If there is reexport, but module has side effects, this will lead to reexport module only. * If there is side-effects-free reexport, we can get simple deterministic result with range start comparison. */ references.sort(concatComparators(bySourceOrder, byRangeStart)); + if (deferEnabled) { + // do not combine those two sorts. defer is not the same as source or range which has a comparable number, defer is only moving them. + references.sort(moveDeferToLast); + } /** @type {Map} */ const referencesMap = new Map(); for (const { connection } of references) { @@ -1209,6 +1280,7 @@ class ConcatenatedModule extends Module { runtimeTemplate, neededNamespaceObjects, false, + match.deferredImport, /** @type {BuildMeta} */ (info.module.buildMeta).strictHarmonyModule, true @@ -1348,6 +1420,28 @@ class ConcatenatedModule extends Module { allUsedNames.add(externalName); info.name = externalName; topLevelDeclarations.add(externalName); + + if (info.deferred) { + const externalName = findNewName( + "deferred", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalName); + info.deferredName = externalName; + topLevelDeclarations.add(externalName); + + const externalNameInterop = findNewName( + "deferredNamespaceObject", + allUsedNames, + namespaceObjectUsedNames, + info.module.readableIdentifier(requestShortener) + ); + allUsedNames.add(externalNameInterop); + info.deferredNamespaceObjectName = externalNameInterop; + topLevelDeclarations.add(externalNameInterop); + } break; } } @@ -1365,7 +1459,8 @@ class ConcatenatedModule extends Module { } if ( buildMeta.exportsType === "default" && - buildMeta.defaultObject !== "redirect" + buildMeta.defaultObject !== "redirect" && + info.interopNamespaceObject2Used ) { const externalNameInterop = findNewName( "namespaceObject2", @@ -1411,6 +1506,7 @@ class ConcatenatedModule extends Module { runtimeTemplate, neededNamespaceObjects, match.call, + match.deferredImport, !match.directImport, /** @type {BuildMeta} */ (info.module.buildMeta).strictHarmonyModule, @@ -1463,6 +1559,7 @@ class ConcatenatedModule extends Module { neededNamespaceObjects, false, false, + false, strictHarmonyModule, true ); @@ -1564,6 +1661,7 @@ class ConcatenatedModule extends Module { runtimeTemplate, neededNamespaceObjects, false, + false, undefined, /** @type {BuildMeta} */ (info.module.buildMeta).strictHarmonyModule, @@ -1605,7 +1703,10 @@ ${defineGetters}` } } + /** @type {InitFragment[]} */ const chunkInitFragments = []; + const deferEnabled = + this.compilation && this.compilation.options.experiments.deferImport; // evaluate modules in order for (const rawInfo of modulesWithInfo) { @@ -1617,6 +1718,31 @@ ${defineGetters}` result.add( `\n;// ${info.module.readableIdentifier(requestShortener)}\n` ); + // If a module is deferred in other places, but used as non-deferred here, + // the module itself will be emitted as mod_deferred (in the case "external"), + // we need to emit an extra import declaration to evaluate it in order. + if (deferEnabled) { + for (const dep of info.module.dependencies) { + if ( + !dep.defer && + dep instanceof HarmonyImportSideEffectDependency + ) { + const referredModule = moduleGraph.getModule(dep); + if (!referredModule) continue; + if (moduleGraph.isDeferred(referredModule)) { + const deferredModuleInfo = /** @type {ExternalModuleInfo} */ ( + modulesWithInfo.find( + i => i.type === "external" && i.module === referredModule + ) + ); + if (!deferredModuleInfo) continue; + result.add( + `\n// non-deferred import to a deferred module (${referredModule.readableIdentifier(requestShortener)})\nvar ${deferredModuleInfo.name} = ${deferredModuleInfo.deferredName}.a;` + ); + } + } + } + } result.add(/** @type {ReplaceSource} */ (info.source)); if (info.chunkInitFragments) { for (const f of info.chunkInitFragments) chunkInitFragments.push(f); @@ -1649,11 +1775,23 @@ ${defineGetters}` isConditional = true; result.add(`if (${condition}) {\n`); } - result.add( - `var ${info.name} = ${RuntimeGlobals.require}(${JSON.stringify( - chunkGraph.getModuleId(info.module) - )});` - ); + const moduleId = JSON.stringify(chunkGraph.getModuleId(info.module)); + if (info.deferred) { + const loader = getOptimizedDeferredModule( + runtimeTemplate, + info.module.getExportsType( + moduleGraph, + this.rootModule.buildMeta && + this.rootModule.buildMeta.strictHarmonyModule + ), + moduleId, + // an async module will opt-out of the concat module optimization. + [] + ); + result.add(`var ${info.deferredName} = ${loader};`); + } else { + result.add(`var ${info.name} = __webpack_require__(${moduleId});`); + } name = info.name; break; } @@ -1661,6 +1799,18 @@ ${defineGetters}` // @ts-expect-error never is expected here throw new Error(`Unsupported concatenation entry type ${info.type}`); } + if (info.type === "external" && info.deferredNamespaceObjectUsed) { + runtimeRequirements.add(RuntimeGlobals.makeDeferredNamespaceObject); + result.add( + `\nvar ${info.deferredNamespaceObjectName} = /*#__PURE__*/${ + RuntimeGlobals.makeDeferredNamespaceObject + }(${JSON.stringify( + chunkGraph.getModuleId(info.module) + )}, ${getMakeDeferredNamespaceModeFromExportsType( + info.module.getExportsType(moduleGraph, strictHarmonyModule) + )});` + ); + } if (info.interopNamespaceObjectUsed) { runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); result.add( @@ -1841,12 +1991,16 @@ ${defineGetters}` runtimeCondition: info.runtimeCondition, index, name: undefined, + deferredName: undefined, interopNamespaceObjectUsed: false, interopNamespaceObjectName: undefined, interopNamespaceObject2Used: false, interopNamespaceObject2Name: undefined, interopDefaultAccessUsed: false, - interopDefaultAccessName: undefined + interopDefaultAccessName: undefined, + deferred: moduleGraph.isDeferred(info.module), + deferredNamespaceObjectName: undefined, + deferredNamespaceObjectUsed: false }; break; default: diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index 93dc1795927..b54c85cf43d 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -223,6 +223,11 @@ class ModuleConcatenationPlugin { canBeInner = false; } + if (moduleGraph.isDeferred(module)) { + setInnerBailoutReason(module, `Module is deferred`); + canBeInner = false; + } + if (canBeRoot) relevantModules.push(module); if (canBeInner) possibleInners.add(module); } diff --git a/lib/runtime/AsyncModuleRuntimeModule.js b/lib/runtime/AsyncModuleRuntimeModule.js index 79141c76f2e..441480ba088 100644 --- a/lib/runtime/AsyncModuleRuntimeModule.js +++ b/lib/runtime/AsyncModuleRuntimeModule.js @@ -11,8 +11,12 @@ const HelperRuntimeModule = require("./HelperRuntimeModule"); /** @typedef {import("../Compilation")} Compilation */ class AsyncModuleRuntimeModule extends HelperRuntimeModule { - constructor() { + /** + * @param {boolean=} deferInterop if defer import is used. + */ + constructor(deferInterop = false) { super("async module"); + this._deferInterop = deferInterop; } /** @@ -22,10 +26,20 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule { const compilation = /** @type {Compilation} */ (this.compilation); const { runtimeTemplate } = compilation; const fn = RuntimeGlobals.asyncModule; + const defer = this._deferInterop; return Template.asString([ - 'var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__";', - `var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "${RuntimeGlobals.exports}";`, - 'var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";', + 'var hasSymbol = typeof Symbol === "function";', + 'var webpackQueues = hasSymbol ? Symbol("webpack queues") : "__webpack_queues__";', + `var webpackExports = ${ + defer ? `${RuntimeGlobals.asyncModuleExportSymbol}= ` : "" + }hasSymbol ? Symbol("webpack exports") : "${RuntimeGlobals.exports}";`, + 'var webpackError = hasSymbol ? Symbol("webpack error") : "__webpack_error__";', + defer + ? `var webpackDone = ${RuntimeGlobals.asyncModuleDoneSymbol} = hasSymbol ? Symbol("webpack done") : "__webpack_done__";` + : "", + defer + ? `var webpackDefer = ${RuntimeGlobals.makeDeferredNamespaceObjectSymbol} = hasSymbol ? Symbol("webpack defer") : "__webpack_defer__";` + : "", `var resolveQueue = ${runtimeTemplate.basicFunction("queue", [ "if(queue && queue.d < 1) {", Template.indent([ @@ -45,6 +59,39 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule { `deps.map(${runtimeTemplate.basicFunction("dep", [ 'if(dep !== null && typeof dep === "object") {', Template.indent([ + defer + ? Template.asString([ + "if(!dep[webpackQueues] && dep[webpackDefer]) {", + Template.indent([ + "var asyncDeps = dep[webpackDefer];", + `var hasUnresolvedAsyncSubgraph = asyncDeps.some(${runtimeTemplate.basicFunction( + "id", + [ + "var cache = __webpack_module_cache__[id];", + "return !cache || cache[webpackDone] === false;" + ] + )});`, + "if (hasUnresolvedAsyncSubgraph) {", + Template.indent([ + "var d = dep;", + "dep = {", + Template.indent([ + "then(callback) {", + Template.indent([ + "Promise.all(asyncDeps.map(__webpack_require__))", + `.then(${runtimeTemplate.returningFunction( + "callback(d)" + )});` + ]), + "}" + ]), + "};" + ]), + "} else return dep;" + ]), + "}" + ]) + : "", "if(dep[webpackQueues]) return dep;", "if(dep.then) {", Template.indent([ @@ -58,6 +105,7 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule { "resolveQueue(queue);" ])});`, "var obj = {};", + defer ? "obj[webpackDefer] = false;" : "", `obj[webpackQueues] = ${runtimeTemplate.expressionFunction( "fn(queue)", "fn" @@ -92,11 +140,12 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule { "fn" )};`, "module.exports = promise;", - `body(${runtimeTemplate.basicFunction("deps", [ + `var handle = ${runtimeTemplate.basicFunction("deps", [ "currentDeps = wrapDeps(deps);", "var fn;", `var getResult = ${runtimeTemplate.returningFunction( `currentDeps.map(${runtimeTemplate.basicFunction("d", [ + defer ? "if(d[webpackDefer]) return d;" : "", "if(d[webpackError]) throw d[webpackError];", "return d[webpackExports];" ])})` @@ -114,16 +163,22 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule { "q" )};`, `currentDeps.map(${runtimeTemplate.expressionFunction( - "dep[webpackQueues](fnQueue)", + `${ + defer ? "dep[webpackDefer]||" : "" + }dep[webpackQueues](fnQueue)`, "dep" )});` ] )});`, "return fn.r ? promise : getResult();" - ])}, ${runtimeTemplate.expressionFunction( - "(err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)", + ])}`, + `var done = ${runtimeTemplate.expressionFunction( + `(err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)${ + defer ? ", promise[webpackDone] = true" : "" + }`, "err" - )});`, + )}`, + "body(handle, done);", "queue && queue.d < 0 && (queue.d = 0);" ])};` ]); diff --git a/lib/runtime/MakeDeferredNamespaceObjectRuntime.js b/lib/runtime/MakeDeferredNamespaceObjectRuntime.js new file mode 100644 index 00000000000..7e2e3046dc3 --- /dev/null +++ b/lib/runtime/MakeDeferredNamespaceObjectRuntime.js @@ -0,0 +1,214 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ + +"use strict"; + +const RuntimeGlobals = require("../RuntimeGlobals"); +const Template = require("../Template"); +const HelperRuntimeModule = require("./HelperRuntimeModule"); + +/** + * @param {import("../Module").ExportsType} exportsType exports type + * @returns {string} mode + */ +function getMakeDeferredNamespaceModeFromExportsType(exportsType) { + if (exportsType === "namespace") return `/* ${exportsType} */ 0`; + if (exportsType === "default-only") return `/* ${exportsType} */ 1`; + if (exportsType === "default-with-named") return `/* ${exportsType} */ 2`; + if (exportsType === "dynamic") return `/* ${exportsType} */ 3`; + return ""; +} +/** + * @param {import("../ModuleTemplate").RuntimeTemplate} _runtimeTemplate runtimeTemplate + * @param {import("../Module").ExportsType} exportsType exportsType + * @param {string} moduleId moduleId + * @param {(import("../ChunkGraph").ModuleId | null)[]} asyncDepsIds asyncDepsIds + * @returns {string} function + */ +function getOptimizedDeferredModule( + _runtimeTemplate, + exportsType, + moduleId, + asyncDepsIds +) { + const isAsync = asyncDepsIds && asyncDepsIds.length; + const init = `${RuntimeGlobals.require}(${moduleId})${ + isAsync ? `[${RuntimeGlobals.asyncModuleExportSymbol}]` : "" + }`; + const props = [ + `/* ${exportsType} */ get a() {`, + // if exportsType is "namespace" we can generate the most optimized code, + // on the second access, we can avoid trigger the getter. + // we can also do this if exportsType is "dynamic" and there is a "__esModule" property on it. + exportsType === "namespace" || exportsType === "dynamic" + ? Template.indent([ + `var exports = ${init};`, + `${ + exportsType === "dynamic" ? "if (exports.__esModule) " : "" + }Object.defineProperty(this, "a", { value: exports });`, + "return exports;" + ]) + : Template.indent([`return ${init};`]), + isAsync ? "}," : "}", + isAsync + ? `[${ + RuntimeGlobals.makeDeferredNamespaceObjectSymbol + }]: ${JSON.stringify(asyncDepsIds.filter(x => x !== null))}` + : "" + ]; + return Template.asString(["{", Template.indent(props), "}"]); +} + +const strictModuleCache = [ + "if (cachedModule && cachedModule.error === undefined) {", + Template.indent([ + "var exports = cachedModule.exports;", + "if (mode == 0) return exports;", + `if (mode == 1) return ${RuntimeGlobals.createFakeNamespaceObject}(exports);`, + `if (mode == 2) return ${RuntimeGlobals.createFakeNamespaceObject}(exports, 2);`, + `if (mode == 3) return ${RuntimeGlobals.createFakeNamespaceObject}(exports, 6);` // 2 | 4 + ]), + "}" +]; +const nonStrictModuleCache = [ + "// optimization not applied when output.strictModuleErrorHandling is off" +]; + +class MakeDeferredNamespaceObjectRuntimeModule extends HelperRuntimeModule { + /** + * @param {boolean} hasAsyncRuntime if async module is used. + */ + constructor(hasAsyncRuntime) { + super("make deferred namespace object"); + this.hasAsyncRuntime = hasAsyncRuntime; + } + + /** + * @returns {string | null} runtime code + */ + generate() { + if (!this.compilation) return null; + const { runtimeTemplate } = this.compilation; + const fn = RuntimeGlobals.makeDeferredNamespaceObject; + const hasAsync = this.hasAsyncRuntime; + const strictError = + this.compilation.options.output.strictModuleErrorHandling; + const init = runtimeTemplate.supportsOptionalChaining() + ? "init?.();" + : "if (init) init();"; + return `${fn} = ${runtimeTemplate.basicFunction("moduleId, mode", [ + "// mode: 0 => namespace (esm)", + "// mode: 1 => default-only (esm strict cjs)", + "// mode: 2 => default-with-named (esm-cjs compat)", + "// mode: 3 => dynamic (if exports has __esModule, then esm, otherwise default-with-named)", + "", + "var cachedModule = __webpack_module_cache__[moduleId];", + ...(strictError ? strictModuleCache : nonStrictModuleCache), + "", + `var init = ${runtimeTemplate.basicFunction("", [ + `ns = ${RuntimeGlobals.require}(moduleId);`, + hasAsync + ? `if (${RuntimeGlobals.asyncModuleExportSymbol} in ns) ns = ns[${RuntimeGlobals.asyncModuleExportSymbol}];` + : "", + "init = null;", + "if (mode == 0 || mode == 3 && ns.__esModule && typeof ns === 'object') {", + Template.indent([ + "delete handler.defineProperty;", + "delete handler.deleteProperty;", + "delete handler.set;", + "delete handler.get;", + "delete handler.has;", + "delete handler.ownKeys;", + "delete handler.getOwnPropertyDescriptor;" + ]), + "} else if (mode == 1) {", + Template.indent([ + `ns = ${RuntimeGlobals.createFakeNamespaceObject}(ns);` + ]), + "} else if (mode == 2) {", + Template.indent([ + `ns = ${RuntimeGlobals.createFakeNamespaceObject}(ns, 2);` + ]), + "} else if (mode == 3) {", + Template.indent([ + `ns = ${RuntimeGlobals.createFakeNamespaceObject}(ns, 6);` + ]), + "}" + ])};`, + "", + `var ns = ${ + strictError ? "" : "cachedModule && cachedModule.exports || " + }__webpack_module_deferred_exports__[moduleId] || (__webpack_module_deferred_exports__[moduleId] = { __proto__: null });`, + "var handler = {", + Template.indent([ + "__proto__: null,", + `get: ${runtimeTemplate.basicFunction("_, name", [ + "switch (name) {", + Template.indent([ + 'case "__esModule": return true;', + 'case Symbol.toStringTag: return "Deferred Module";', + 'case "then": return undefined;' + ]), + "}", + init, + `return ns[name];` + ])},`, + `has: ${runtimeTemplate.basicFunction("_, name", [ + "switch (name) {", + Template.indent( + [ + 'case "__esModule":', + "case Symbol.toStringTag:", + hasAsync + ? `case ${RuntimeGlobals.makeDeferredNamespaceObjectSymbol}:` + : "", + Template.indent("return true;"), + 'case "then":', + Template.indent("return false;") + ].filter(Boolean) + ), + "}", + init, + `return name in ns;` + ])},`, + `ownKeys: ${runtimeTemplate.basicFunction("", [ + init, + `var keys = Reflect.ownKeys(ns).filter(${runtimeTemplate.expressionFunction('x !== "then"', "x")}).concat([Symbol.toStringTag]);`, + "return keys;" + ])},`, + `getOwnPropertyDescriptor: ${runtimeTemplate.basicFunction("_, name", [ + "switch (name) {", + Template.indent([ + 'case "__esModule": return { value: true, configurable: !!mode };', + 'case Symbol.toStringTag: return { value: "Deferred Module", configurable: !!mode };', + 'case "then": return undefined;' + ]), + "}", + init, + "var desc = Reflect.getOwnPropertyDescriptor(ns, name);", + `if (mode == 2 && name == "default" && !desc) {`, + Template.indent("desc = { value: ns, configurable: true };"), + "}", + "return desc;" + ])},`, + `defineProperty: ${runtimeTemplate.basicFunction("_, name", [ + init, + // Note: This behavior does not match the spec one, but since webpack does not do it either + // for a normal Module Namespace object (in MakeNamespaceObjectRuntimeModule), let's keep it simple. + "return false;" + ])},`, + `deleteProperty: ${runtimeTemplate.returningFunction("false")},`, + `set: ${runtimeTemplate.returningFunction("false")},` + ]), + "}", + // we don't fully emulate ES Module semantics in this Proxy to align with normal webpack esm namespace object. + "return new Proxy(ns, handler);" + ])};`; + } +} + +module.exports = MakeDeferredNamespaceObjectRuntimeModule; +module.exports.getMakeDeferredNamespaceModeFromExportsType = + getMakeDeferredNamespaceModeFromExportsType; +module.exports.getOptimizedDeferredModule = getOptimizedDeferredModule; diff --git a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js index b4b3297299e..90020b3d5de 100644 --- a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +++ b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js @@ -105,6 +105,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator { return runtimeTemplate.importStatement({ update: false, module: importedModule, + moduleGraph, chunkGraph, request, originModule: module, @@ -131,6 +132,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator { )}: ${runtimeTemplate.exportFromImport({ moduleGraph, module: importedModule, + chunkGraph, request, exportName: dep.name, originModule: module, diff --git a/lib/wasm-sync/WebAssemblyJavascriptGenerator.js b/lib/wasm-sync/WebAssemblyJavascriptGenerator.js index eddef16eb5d..5bd81a705c6 100644 --- a/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +++ b/lib/wasm-sync/WebAssemblyJavascriptGenerator.js @@ -97,6 +97,7 @@ class WebAssemblyJavascriptGenerator extends Generator { initParams.push( runtimeTemplate.exportFromImport({ moduleGraph, + chunkGraph, module: importedModule, request: dep.request, importVar: importData.importVar, @@ -129,6 +130,7 @@ class WebAssemblyJavascriptGenerator extends Generator { `${exportProp} = ${runtimeTemplate.exportFromImport({ moduleGraph, module: /** @type {Module} */ (moduleGraph.getModule(dep)), + chunkGraph, request: dep.request, importVar: importData.importVar, originModule: module, @@ -158,6 +160,7 @@ class WebAssemblyJavascriptGenerator extends Generator { ([module, { importVar, request, reexports }]) => { const importStatement = runtimeTemplate.importStatement({ module, + moduleGraph, chunkGraph, request, importVar, diff --git a/schemas/WebpackOptions.check.js b/schemas/WebpackOptions.check.js index 90d0358e9f6..25c08ef4cc1 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"},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"},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"},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"},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;Te(r.plugins,{instancePath:o+"/plugins",parentData:r,parentDataProperty:"plugins",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.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;Ie(r.resolve,{instancePath:o+"/resolve",parentData:r,parentDataProperty:"resolve",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.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 { + const logs = global.__configCases__deferImport__proposal = []; + + // change to other way if webpack in the future rejects require a TLA esm. + let mod = require("./entry.js"); + expect(mod).toBeInstanceOf(Promise); + + expect(logs).toEqual([ + "START async-mod-dep.js", + "END async-mod-dep.js", + "START async-mod.js", + "START deep-async-dep.js" + ]); + logs.length = 0; + + let { default: namespaces } = await mod; + + expect(logs).toEqual([ + "END async-mod.js", + "END deep-async-dep.js", + "START entry.js", + "END entry.js" + ]); + logs.length = 0; + + let fullSyncX = namespaces.fullSync.x; + expect(fullSyncX).toBe(1); + expect(logs).toEqual([ + "START full-sync-dep.js", + "END full-sync-dep.js", + "START full-sync.js", + "END full-sync.js" + ]); + logs.length = 0; + + let asyncModX = namespaces.asyncMod.x; + expect(asyncModX).toBe(2); + expect(logs).toEqual([]); + + let deepAsyncX = namespaces.deepAsync.x; + expect(deepAsyncX).toBe(3); + expect(logs).toEqual([ + "START deep-async.js", + "END deep-async.js" + ]); +}); diff --git a/test/configCases/defer-import/async-in-graph/webpack.config.js b/test/configCases/defer-import/async-in-graph/webpack.config.js new file mode 100644 index 00000000000..3b7367c05b1 --- /dev/null +++ b/test/configCases/defer-import/async-in-graph/webpack.config.js @@ -0,0 +1,14 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + mode: "none", + experiments: { + topLevelAwait: true, + deferImport: true + } +}; diff --git a/test/configCases/defer-import/comment-error/errors.js b/test/configCases/defer-import/comment-error/errors.js new file mode 100644 index 00000000000..7daeddc2bbc --- /dev/null +++ b/test/configCases/defer-import/comment-error/errors.js @@ -0,0 +1,7 @@ +module.exports = [ + [/used with `import \* as namespace from '...'`/], + [/used with `import \* as namespace from '...'`/], + [/used with `import \* as namespace from '...'`/], + [/is not a part of the Import Defer proposal/], + [/is not a part of the Import Defer proposal/] +]; diff --git a/test/configCases/defer-import/comment-error/index.js b/test/configCases/defer-import/comment-error/index.js new file mode 100644 index 00000000000..416cb1233b0 --- /dev/null +++ b/test/configCases/defer-import/comment-error/index.js @@ -0,0 +1,11 @@ +import { f } from /* webpackDefer: true */ "./mod.js"; // error +import f2 from /* webpackDefer: true */ "./mod.js"; // error +import * as f3 from /* webpackDefer: true */ "./mod.js"; +import f4, { f as f5 } from /* webpackDefer: true */ "./mod.js"; // error + +export * as f4 from /* webpackDefer: true */ "./mod.js"; // error +export { f as f5 } from /* webpackDefer: true */ "./mod.js"; // error + +export default [f, f2, f3, f4, f5]; + +export { f3 } diff --git a/test/configCases/defer-import/comment-error/mod.js b/test/configCases/defer-import/comment-error/mod.js new file mode 100644 index 00000000000..1b1caff7ada --- /dev/null +++ b/test/configCases/defer-import/comment-error/mod.js @@ -0,0 +1,2 @@ +export function f() {} +export default function f2() {} diff --git a/test/configCases/defer-import/comment-error/webpack.config.js b/test/configCases/defer-import/comment-error/webpack.config.js new file mode 100644 index 00000000000..8911b899153 --- /dev/null +++ b/test/configCases/defer-import/comment-error/webpack.config.js @@ -0,0 +1,13 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + experiments: { + topLevelAwait: true, + deferImport: true + } +}; diff --git a/test/configCases/defer-import/defer-but-sync-order/0.js b/test/configCases/defer-import/defer-but-sync-order/0.js new file mode 100644 index 00000000000..7a2cf8c8bfa --- /dev/null +++ b/test/configCases/defer-import/defer-but-sync-order/0.js @@ -0,0 +1,5 @@ +import { data, setData } from "./side-effect-counter"; + +if (data !== undefined) + throw new Error("No module should be executed before this one."); +setData("0.js"); diff --git a/test/configCases/defer-import/defer-but-sync-order/1.js b/test/configCases/defer-import/defer-but-sync-order/1.js new file mode 100644 index 00000000000..6ed763cfb79 --- /dev/null +++ b/test/configCases/defer-import/defer-but-sync-order/1.js @@ -0,0 +1,3 @@ +import "./0.js"; +import * as ns from "./deferred.js"; +export const x = ns; diff --git a/test/configCases/defer-import/defer-but-sync-order/deferred.js b/test/configCases/defer-import/defer-but-sync-order/deferred.js new file mode 100644 index 00000000000..7c39025a60d --- /dev/null +++ b/test/configCases/defer-import/defer-but-sync-order/deferred.js @@ -0,0 +1,5 @@ +import { data, setData } from "./side-effect-counter"; + +if (data !== "0.js") throw new Error("Expected 0.js to be executed first."); +setData("deferred"); +export {}; diff --git a/test/configCases/defer-import/defer-but-sync-order/entry.js b/test/configCases/defer-import/defer-but-sync-order/entry.js new file mode 100644 index 00000000000..514367aa9da --- /dev/null +++ b/test/configCases/defer-import/defer-but-sync-order/entry.js @@ -0,0 +1,6 @@ +import * as ns from /* webpackDefer: true */ "./deferred.js"; +import "./1.js"; + +if (Math.random() > 1) { + console.log(ns); +} diff --git a/test/configCases/defer-import/defer-but-sync-order/index.js b/test/configCases/defer-import/defer-but-sync-order/index.js new file mode 100644 index 00000000000..ac5d9f147fa --- /dev/null +++ b/test/configCases/defer-import/defer-but-sync-order/index.js @@ -0,0 +1,3 @@ +it("execution order should be correct.", () => { + return import("./entry.js"); +}); diff --git a/test/configCases/defer-import/defer-but-sync-order/side-effect-counter.js b/test/configCases/defer-import/defer-but-sync-order/side-effect-counter.js new file mode 100644 index 00000000000..4824c2574f8 --- /dev/null +++ b/test/configCases/defer-import/defer-but-sync-order/side-effect-counter.js @@ -0,0 +1,4 @@ +export let data; +export function setData(d) { + data = d; +} 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 new file mode 100644 index 00000000000..bbfa4a8289d --- /dev/null +++ b/test/configCases/defer-import/defer-but-sync-order/webpack.config.js @@ -0,0 +1,13 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + optimization: {}, + experiments: { + deferImport: true + } +}; 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 new file mode 100644 index 00000000000..2ca916d1c8c --- /dev/null +++ b/test/configCases/defer-import/defer-runtime-concat-strict/webpack.config.js @@ -0,0 +1,22 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + entry: ["../defer-runtime/all.js"], + optimization: {}, + module: { + rules: [ + { + test: /index\.js/, + type: "javascript/esm" + } + ] + }, + experiments: { + deferImport: true + } +}; diff --git a/test/configCases/defer-import/defer-runtime-concat/webpack.config.js b/test/configCases/defer-import/defer-runtime-concat/webpack.config.js new file mode 100644 index 00000000000..ecb8db57d72 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime-concat/webpack.config.js @@ -0,0 +1,14 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + entry: ["../defer-runtime/all.js"], + optimization: {}, + experiments: { + deferImport: true + } +}; 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 new file mode 100644 index 00000000000..eae014e6d0f --- /dev/null +++ b/test/configCases/defer-import/defer-runtime-native-syntax/webpack.config.js @@ -0,0 +1,16 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + entry: ["../defer-runtime/all-native-syntax.js"], + optimization: { + concatenateModules: false + }, + experiments: { + deferImport: true + } +}; diff --git a/test/configCases/defer-import/defer-runtime-strict/webpack.config.js b/test/configCases/defer-import/defer-runtime-strict/webpack.config.js new file mode 100644 index 00000000000..8dd1133d3e4 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime-strict/webpack.config.js @@ -0,0 +1,24 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + entry: ["../defer-runtime/all.js"], + optimization: { + concatenateModules: false + }, + module: { + rules: [ + { + test: /index\.js/, + type: "javascript/esm" + } + ] + }, + experiments: { + deferImport: true + } +}; diff --git a/test/configCases/defer-import/defer-runtime/all-native-syntax.js b/test/configCases/defer-import/defer-runtime/all-native-syntax.js new file mode 100644 index 00000000000..5c64bb46932 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/all-native-syntax.js @@ -0,0 +1,207 @@ +import defer * as dynamic_default from "./commonjs/dynamic_default.cjs"; +import defer * as dynamic_default_ns from "./commonjs/dynamic_default_ns.cjs"; +import defer * as dynamic_named from "./commonjs/dynamic_named.cjs"; +import defer * as dynamic_named_ns from "./commonjs/dynamic_named_ns.cjs"; +import defer * as dynamic_both from "./commonjs/dynamic-both.cjs"; +import defer * as dynamic_both_ns from "./commonjs/dynamic_both_ns.cjs"; + +import defer * as flagged_default from "./commonjs/flagged_default.js"; +import defer * as flagged_default_ns from "./commonjs/flagged_default_ns.js"; +import defer * as flagged_named from "./commonjs/flagged_named.js"; +import defer * as flagged_named_ns from "./commonjs/flagged_named_ns.js"; +import defer * as flagged_both from "./commonjs/flagged_both.js"; +import defer * as flagged_both_ns from "./commonjs/flagged_both_ns.js"; + +import defer * as esm_default from "./esm/esm_default.mjs"; +import defer * as esm_default_ns from "./esm/esm_default_ns.mjs"; +import defer * as esm_named from "./esm/esm_named.mjs"; +import defer * as esm_named_ns from "./esm/esm_named_ns.mjs"; +import defer * as esm_both from "./esm/esm_both.mjs"; +import defer * as esm_both_ns from "./esm/esm_both_ns.mjs"; + +import { reexport_ns, reexport_cjs_ns } from "./esm/reexport.mjs"; +import { + assertTouched as a, + assertUntouched as b, + reset as c +} from "./side-effect-counter.js"; +const [assertTouched, assertUntouched, reset] = [a, b, c]; + +it("should defer the module until first use", () => { + reset(); + dynamic_default.default; + assertTouched(); + expect(dynamic_default.default()).toBe("func"); + assertTouched(); + + reset(); + dynamic_named.f; + assertTouched(); + expect(dynamic_named.f()).toBe("func"); + expect(new dynamic_named.T().x).toBe(1); + assertTouched(); + + reset(); + dynamic_both.default; + assertTouched(); + expect(dynamic_both.default()).toBe("func"); + expect(dynamic_both.default.x).toBe(1); + expect(new dynamic_both.default.T().x).toBe(1); + assertTouched(); + + // then flagged, without namespace + reset(); + flagged_default.default; + assertTouched(); + expect(flagged_default.default()).toBe("func"); + assertTouched(); + + reset(); + flagged_named.f; + assertTouched(); + expect(flagged_named.f()).toBe("func"); + expect(new flagged_named.T().x).toBe(1); + assertTouched(); + + reset(); + flagged_both.default; + assertTouched(); + expect(flagged_both.default()).toBe("func"); + expect(flagged_both.x).toBe(1); + expect(new flagged_both.T().x).toBe(1); + assertTouched(); + + // then esm, without namespace + reset(); + esm_default.default; + assertTouched(); + expect(esm_default.default()).toBe("func"); + assertTouched(); + + reset(); + esm_named.f; + assertTouched(); + expect(esm_named.f()).toBe("func"); + expect(new esm_named.T().x).toBe(1); + assertTouched(); + + reset(); + esm_both.default; + assertTouched(); + expect(esm_both.default()).toBe("func"); + expect(esm_both.x).toBe(1); + expect(new esm_both.T().x).toBe(1); + assertTouched(); + + // then dynamic with namespace + reset(); + assertIsNamespaceObject(dynamic_default_ns); + assertUntouched(); + Reflect.get(dynamic_default_ns, "default"); + assertTouched(); + expect(Reflect.get(dynamic_default_ns, "default")()).toBe("func"); + assertTouched(); + + reset(); + assertIsNamespaceObject(dynamic_named_ns); + assertUntouched(); + Reflect.get(dynamic_named_ns, "f"); + assertTouched(); + expect(Reflect.get(dynamic_named_ns, "f")()).toBe("func"); + expect(new dynamic_named_ns.T().x).toBe(1); + assertTouched(); + + reset(); + assertIsNamespaceObject(dynamic_both_ns); + assertUntouched(); + Reflect.get(dynamic_both_ns, "default"); + assertTouched(); + expect(Reflect.get(dynamic_both_ns, "default")()).toBe("func"); + expect(Reflect.get(dynamic_both_ns, "x")).toBe(1); + expect(new dynamic_both_ns.T().x).toBe(1); + assertTouched(); + + // then flagged with namespace + reset(); + assertIsNamespaceObject(flagged_default_ns); + assertUntouched(); + Reflect.get(flagged_default_ns, "default"); + assertTouched(); + expect(Reflect.get(flagged_default_ns, "default")()).toBe("func"); + assertTouched(); + + reset(); + assertIsNamespaceObject(flagged_named_ns); + assertUntouched(); + Reflect.get(flagged_named_ns, "f"); + assertTouched(); + expect(Reflect.get(flagged_named_ns, "f")()).toBe("func"); + expect(new flagged_named_ns.T().x).toBe(1); + assertTouched(); + + reset(); + assertIsNamespaceObject(flagged_both_ns); + assertUntouched(); + Reflect.get(flagged_both_ns, "default"); + assertTouched(); + expect(Reflect.get(flagged_both_ns, "default")()).toBe("func"); + expect(Reflect.get(flagged_both_ns, "x")).toBe(1); + expect(new flagged_both_ns.T().x).toBe(1); + assertTouched(); + + // then esm with namespace + reset(); + assertIsNamespaceObject(esm_default_ns); + assertUntouched(); + Reflect.get(esm_default_ns, "default"); + assertTouched(); + expect(Reflect.get(esm_default_ns, "default")()).toBe("func"); + assertTouched(); + + reset(); + assertIsNamespaceObject(esm_named_ns); + assertUntouched(); + Reflect.get(esm_named_ns, "f"); + assertTouched(); + expect(Reflect.get(esm_named_ns, "f")()).toBe("func"); + expect(new esm_named_ns.T().x).toBe(1); + assertTouched(); + + reset(); + assertIsNamespaceObject(esm_both_ns); + assertUntouched(); + Reflect.get(esm_both_ns, "default"); + assertTouched(); + expect(Reflect.get(esm_both_ns, "default")()).toBe("func"); + expect(Reflect.get(esm_both_ns, "x")).toBe(1); + expect(new esm_both_ns.T().x).toBe(1); + assertTouched(); + + // then reexported with namespace + reset(); + assertIsNamespaceObject(reexport_ns); + assertUntouched(); + Reflect.get(reexport_ns, "f"); + assertTouched(); + expect(Reflect.get(reexport_ns, "f")()).toBe("func"); + expect(new reexport_ns.T().x).toBe(1); + assertTouched(); + + reset(); + assertIsNamespaceObject(reexport_cjs_ns); + assertUntouched(); + Reflect.get(reexport_cjs_ns, "default"); + Reflect.get(reexport_cjs_ns, "default").f; + assertTouched(); + expect(Reflect.get(reexport_cjs_ns, "default").f()).toBe("func"); + expect(new reexport_cjs_ns.T().x).toBe(1); + assertTouched(); +}); +function assertIsNamespaceObject(ns) { + if (typeof ns !== "object" || !ns) + throw new TypeError("namespace is not an object."); + if (!ns[Symbol.toStringTag]) + throw new Error( + "namespace object does not have a Symbol.toStringTag property." + ); +} diff --git a/test/configCases/defer-import/defer-runtime/all.js b/test/configCases/defer-import/defer-runtime/all.js new file mode 100644 index 00000000000..0868f723775 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/all.js @@ -0,0 +1,214 @@ +import * as dynamic_default from /* webpackDefer: true */ "./commonjs/dynamic_default.cjs"; +import * as dynamic_default_ns from /* webpackDefer: true */ "./commonjs/dynamic_default_ns.cjs"; +import * as dynamic_named from /* webpackDefer: true */ "./commonjs/dynamic_named.cjs"; +import * as dynamic_named_ns from /* webpackDefer: true */ "./commonjs/dynamic_named_ns.cjs"; +import * as dynamic_both from /* webpackDefer: true */ "./commonjs/dynamic-both.cjs"; +import * as dynamic_both_ns from /* webpackDefer: true */ "./commonjs/dynamic_both_ns.cjs"; + +import * as flagged_default from /* webpackDefer: true */ "./commonjs/flagged_default.js"; +import * as flagged_default_ns from /* webpackDefer: true */ "./commonjs/flagged_default_ns.js"; +import * as flagged_named from /* webpackDefer: true */ "./commonjs/flagged_named.js"; +import * as flagged_named_ns from /* webpackDefer: true */ "./commonjs/flagged_named_ns.js"; +import * as flagged_both from /* webpackDefer: true */ "./commonjs/flagged_both.js"; +import * as flagged_both_ns from /* webpackDefer: true */ "./commonjs/flagged_both_ns.js"; + +import * as esm_default from /* webpackDefer: true */ "./esm/esm_default.mjs"; +import * as esm_default_ns from /* webpackDefer: true */ "./esm/esm_default_ns.mjs"; +import * as esm_named from /* webpackDefer: true */ "./esm/esm_named.mjs"; +import * as esm_named_ns from /* webpackDefer: true */ "./esm/esm_named_ns.mjs"; +import * as esm_both from /* webpackDefer: true */ "./esm/esm_both.mjs"; +import * as esm_both_ns from /* webpackDefer: true */ "./esm/esm_both_ns.mjs"; + +import * as never from /* webpackDefer: true */ "./esm/esm_both_ns.mjs"; + +import { reexport_ns, reexport_cjs_ns } from "./esm/reexport.mjs"; +import { + assertTouched as a, + assertUntouched as b, + reset as c +} from "./side-effect-counter.js"; +const [assertTouched, assertUntouched, reset] = [a, b, c]; + +it("should defer the module until first use", () => { + assertUntouched(); + + dynamic_default.default; + assertTouched(); + expect(dynamic_default.default()).toBe("func"); + assertTouched(); + + reset(); + dynamic_named.f; + assertTouched(); + expect(dynamic_named.f()).toBe("func"); + expect(new dynamic_named.T().x).toBe(1); + assertTouched(); + + reset(); + dynamic_both.default; + assertTouched(); + expect(dynamic_both.default()).toBe("func"); + expect(dynamic_both.default.x).toBe(1); + expect(new dynamic_both.default.T().x).toBe(1); + assertTouched(); + + // then flagged, without namespace + reset(); + flagged_default.default; + assertTouched(); + expect(flagged_default.default()).toBe("func"); + assertTouched(); + + reset(); + flagged_named.f; + assertTouched(); + expect(flagged_named.f()).toBe("func"); + expect(new flagged_named.T().x).toBe(1); + assertTouched(); + + reset(); + flagged_both.default; + assertTouched(); + expect(flagged_both.default()).toBe("func"); + expect(flagged_both.x).toBe(1); + expect(new flagged_both.T().x).toBe(1); + assertTouched(); + + // then esm, without namespace + reset(); + esm_default.default; + assertTouched(); + expect(esm_default.default()).toBe("func"); + assertTouched(); + + reset(); + esm_named.f; + assertTouched(); + expect(esm_named.f()).toBe("func"); + expect(new esm_named.T().x).toBe(1); + assertTouched(); + + reset(); + esm_both.default; + assertTouched(); + expect(esm_both.default()).toBe("func"); + expect(esm_both.x).toBe(1); + expect(new esm_both.T().x).toBe(1); + assertTouched(); + + // then dynamic with namespace + reset(); + assertIsNamespaceObject(dynamic_default_ns); + assertUntouched(); + Reflect.get(dynamic_default_ns, "default"); + assertTouched(); + expect(Reflect.get(dynamic_default_ns, "default")()).toBe("func"); + assertTouched(); + + reset(); + assertIsNamespaceObject(dynamic_named_ns); + assertUntouched(); + Reflect.get(dynamic_named_ns, "f"); + assertTouched(); + expect(Reflect.get(dynamic_named_ns, "f")()).toBe("func"); + expect(new dynamic_named_ns.T().x).toBe(1); + assertTouched(); + + reset(); + assertIsNamespaceObject(dynamic_both_ns); + assertUntouched(); + Reflect.get(dynamic_both_ns, "default"); + assertTouched(); + expect(Reflect.get(dynamic_both_ns, "default")()).toBe("func"); + expect(Reflect.get(dynamic_both_ns, "x")).toBe(1); + expect(new dynamic_both_ns.T().x).toBe(1); + assertTouched(); + + // then flagged with namespace + reset(); + assertIsNamespaceObject(flagged_default_ns); + assertUntouched(); + Reflect.get(flagged_default_ns, "default"); + assertTouched(); + expect(Reflect.get(flagged_default_ns, "default")()).toBe("func"); + assertTouched(); + + reset(); + assertIsNamespaceObject(flagged_named_ns); + assertUntouched(); + Reflect.get(flagged_named_ns, "f"); + assertTouched(); + expect(Reflect.get(flagged_named_ns, "f")()).toBe("func"); + expect(new flagged_named_ns.T().x).toBe(1); + assertTouched(); + + reset(); + assertIsNamespaceObject(flagged_both_ns); + assertUntouched(); + Reflect.get(flagged_both_ns, "default"); + assertTouched(); + expect(Reflect.get(flagged_both_ns, "default")()).toBe("func"); + expect(Reflect.get(flagged_both_ns, "x")).toBe(1); + expect(new flagged_both_ns.T().x).toBe(1); + assertTouched(); + + // then esm with namespace + reset(); + assertIsNamespaceObject(esm_default_ns); + assertUntouched(); + Reflect.get(esm_default_ns, "default"); + assertTouched(); + expect(Reflect.get(esm_default_ns, "default")()).toBe("func"); + assertTouched(); + + reset(); + assertIsNamespaceObject(esm_named_ns); + assertUntouched(); + Reflect.get(esm_named_ns, "f"); + assertTouched(); + expect(Reflect.get(esm_named_ns, "f")()).toBe("func"); + expect(new esm_named_ns.T().x).toBe(1); + assertTouched(); + + reset(); + assertIsNamespaceObject(esm_both_ns); + assertUntouched(); + Reflect.get(esm_both_ns, "default"); + assertTouched(); + expect(Reflect.get(esm_both_ns, "default")()).toBe("func"); + expect(Reflect.get(esm_both_ns, "x")).toBe(1); + expect(new esm_both_ns.T().x).toBe(1); + assertTouched(); + + // then reexported with namespace + reset(); + assertIsNamespaceObject(reexport_ns); + assertUntouched(); + Reflect.get(reexport_ns, "f"); + assertTouched(); + expect(Reflect.get(reexport_ns, "f")()).toBe("func"); + expect(new reexport_ns.T().x).toBe(1); + assertTouched(); + + reset(); + assertIsNamespaceObject(reexport_cjs_ns); + assertUntouched(); + Reflect.get(reexport_cjs_ns, "default"); + Reflect.get(reexport_cjs_ns, "default").f; + assertTouched(); + expect(Reflect.get(reexport_cjs_ns, "default").f()).toBe("func"); + expect(new reexport_cjs_ns.T().x).toBe(1); + assertTouched(); + + reset(); + assertIsNamespaceObject(never); + expect((mod => mod.then)(never)).toBeUndefined(); +}); +function assertIsNamespaceObject(ns) { + if (typeof ns !== "object" || !ns) + throw new TypeError("namespace is not an object."); + if (!ns[Symbol.toStringTag]) + throw new Error( + "namespace object does not have a Symbol.toStringTag property." + ); +} diff --git a/test/configCases/defer-import/defer-runtime/commonjs/dynamic-both.cjs b/test/configCases/defer-import/defer-runtime/commonjs/dynamic-both.cjs new file mode 100644 index 00000000000..1012ee3d307 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/dynamic-both.cjs @@ -0,0 +1,13 @@ +const { touch } = require("../side-effect-counter"); + +touch(); + +module.exports = function () { + return "func"; +}; +module.exports.x = 1; +module.exports.T = class T { + constructor() { + this.x = 1; + } +} diff --git a/test/configCases/defer-import/defer-runtime/commonjs/dynamic_both_ns.cjs b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_both_ns.cjs new file mode 100644 index 00000000000..1012ee3d307 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_both_ns.cjs @@ -0,0 +1,13 @@ +const { touch } = require("../side-effect-counter"); + +touch(); + +module.exports = function () { + return "func"; +}; +module.exports.x = 1; +module.exports.T = class T { + constructor() { + this.x = 1; + } +} diff --git a/test/configCases/defer-import/defer-runtime/commonjs/dynamic_default.cjs b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_default.cjs new file mode 100644 index 00000000000..e6c04da7c1b --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_default.cjs @@ -0,0 +1,7 @@ +const { touch } = require("../side-effect-counter"); + +touch(); + +module.exports = function () { + return "func"; +}; diff --git a/test/configCases/defer-import/defer-runtime/commonjs/dynamic_default_ns.cjs b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_default_ns.cjs new file mode 100644 index 00000000000..e6c04da7c1b --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_default_ns.cjs @@ -0,0 +1,7 @@ +const { touch } = require("../side-effect-counter"); + +touch(); + +module.exports = function () { + return "func"; +}; diff --git a/test/configCases/defer-import/defer-runtime/commonjs/dynamic_named.cjs b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_named.cjs new file mode 100644 index 00000000000..591c3c09335 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_named.cjs @@ -0,0 +1,12 @@ +const { touch } = require("../side-effect-counter"); + +touch(); + +module.exports.f = function () { + return "func"; +}; +module.exports.T = class T { + constructor() { + this.x = 1; + } +} diff --git a/test/configCases/defer-import/defer-runtime/commonjs/dynamic_named_ns.cjs b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_named_ns.cjs new file mode 100644 index 00000000000..a8e16a9a5b2 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/dynamic_named_ns.cjs @@ -0,0 +1,12 @@ +const { touch } = require("../side-effect-counter"); + +touch(); + +module.exports.f = function () { + return "func"; +}; +module.exports.T = class { + constructor() { + this.x = 1; + } +} diff --git a/test/configCases/defer-import/defer-runtime/commonjs/flagged_both.js b/test/configCases/defer-import/defer-runtime/commonjs/flagged_both.js new file mode 100644 index 00000000000..4d6144e51ec --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/flagged_both.js @@ -0,0 +1,16 @@ +const { touch } = require("../side-effect-counter"); + +module.exports.__esModule = true; +module.exports.default = f; +module.exports.x = 1; +module.exports.T = class T { + constructor() { + this.x = 1; + } +} + +function f() { + return "func"; +} + +touch(); diff --git a/test/configCases/defer-import/defer-runtime/commonjs/flagged_both_ns.js b/test/configCases/defer-import/defer-runtime/commonjs/flagged_both_ns.js new file mode 100644 index 00000000000..4d6144e51ec --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/flagged_both_ns.js @@ -0,0 +1,16 @@ +const { touch } = require("../side-effect-counter"); + +module.exports.__esModule = true; +module.exports.default = f; +module.exports.x = 1; +module.exports.T = class T { + constructor() { + this.x = 1; + } +} + +function f() { + return "func"; +} + +touch(); diff --git a/test/configCases/defer-import/defer-runtime/commonjs/flagged_default.js b/test/configCases/defer-import/defer-runtime/commonjs/flagged_default.js new file mode 100644 index 00000000000..2eb7971a8f4 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/flagged_default.js @@ -0,0 +1,10 @@ +const { touch } = require("../side-effect-counter"); + +module.exports.__esModule = true; +module.exports.default = f; + +function f() { + return "func"; +} + +touch(); diff --git a/test/configCases/defer-import/defer-runtime/commonjs/flagged_default_ns.js b/test/configCases/defer-import/defer-runtime/commonjs/flagged_default_ns.js new file mode 100644 index 00000000000..2eb7971a8f4 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/flagged_default_ns.js @@ -0,0 +1,10 @@ +const { touch } = require("../side-effect-counter"); + +module.exports.__esModule = true; +module.exports.default = f; + +function f() { + return "func"; +} + +touch(); diff --git a/test/configCases/defer-import/defer-runtime/commonjs/flagged_named.js b/test/configCases/defer-import/defer-runtime/commonjs/flagged_named.js new file mode 100644 index 00000000000..c17f3c08f46 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/flagged_named.js @@ -0,0 +1,15 @@ +const { touch } = require("../side-effect-counter"); + +module.exports.__esModule = true; +module.exports.f = f; +module.exports.T = class T { + constructor() { + this.x = 1; + } +} + +function f() { + return "func"; +} + +touch(); diff --git a/test/configCases/defer-import/defer-runtime/commonjs/flagged_named_ns.js b/test/configCases/defer-import/defer-runtime/commonjs/flagged_named_ns.js new file mode 100644 index 00000000000..c17f3c08f46 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/commonjs/flagged_named_ns.js @@ -0,0 +1,15 @@ +const { touch } = require("../side-effect-counter"); + +module.exports.__esModule = true; +module.exports.f = f; +module.exports.T = class T { + constructor() { + this.x = 1; + } +} + +function f() { + return "func"; +} + +touch(); diff --git a/test/configCases/defer-import/defer-runtime/esm/esm_both.mjs b/test/configCases/defer-import/defer-runtime/esm/esm_both.mjs new file mode 100644 index 00000000000..6ad87ec445f --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/esm_both.mjs @@ -0,0 +1,12 @@ +import { touch } from "../side-effect-counter.js"; + +touch(); +export default function () { + return "func"; +} +export const x = 1; +export class T { + constructor() { + this.x = 1; + } +} diff --git a/test/configCases/defer-import/defer-runtime/esm/esm_both_ns.mjs b/test/configCases/defer-import/defer-runtime/esm/esm_both_ns.mjs new file mode 100644 index 00000000000..6ad87ec445f --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/esm_both_ns.mjs @@ -0,0 +1,12 @@ +import { touch } from "../side-effect-counter.js"; + +touch(); +export default function () { + return "func"; +} +export const x = 1; +export class T { + constructor() { + this.x = 1; + } +} diff --git a/test/configCases/defer-import/defer-runtime/esm/esm_default.mjs b/test/configCases/defer-import/defer-runtime/esm/esm_default.mjs new file mode 100644 index 00000000000..5070649e96c --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/esm_default.mjs @@ -0,0 +1,6 @@ +import { touch } from "../side-effect-counter.js"; + +touch(); +export default function () { + return "func"; +} diff --git a/test/configCases/defer-import/defer-runtime/esm/esm_default_ns.mjs b/test/configCases/defer-import/defer-runtime/esm/esm_default_ns.mjs new file mode 100644 index 00000000000..5070649e96c --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/esm_default_ns.mjs @@ -0,0 +1,6 @@ +import { touch } from "../side-effect-counter.js"; + +touch(); +export default function () { + return "func"; +} diff --git a/test/configCases/defer-import/defer-runtime/esm/esm_named.mjs b/test/configCases/defer-import/defer-runtime/esm/esm_named.mjs new file mode 100644 index 00000000000..c8b695967db --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/esm_named.mjs @@ -0,0 +1,12 @@ +import { touch } from "../side-effect-counter.js"; + +export function f() { + return "func"; +} +export class T { + constructor() { + this.x = 1; + } +} + +touch(); diff --git a/test/configCases/defer-import/defer-runtime/esm/esm_named_ns.mjs b/test/configCases/defer-import/defer-runtime/esm/esm_named_ns.mjs new file mode 100644 index 00000000000..7a6caa73dd9 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/esm_named_ns.mjs @@ -0,0 +1,13 @@ +import { touch } from "../side-effect-counter.js"; + +export function f() { + return "func"; +} +export class T { + constructor() { + this.x = 1; + } +} + + +touch(); diff --git a/test/configCases/defer-import/defer-runtime/esm/never.mjs b/test/configCases/defer-import/defer-runtime/esm/never.mjs new file mode 100644 index 00000000000..e5301505656 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/never.mjs @@ -0,0 +1 @@ +throw new Error('this file should never be evaluated.') diff --git a/test/configCases/defer-import/defer-runtime/esm/reexport-deep.cjs b/test/configCases/defer-import/defer-runtime/esm/reexport-deep.cjs new file mode 100644 index 00000000000..16eacfee82c --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/reexport-deep.cjs @@ -0,0 +1,13 @@ +const { touch } = require("../side-effect-counter"); + +function f() { + return "func"; +} + +touch(); +module.exports.f = f; +module.exports.T = class T { + constructor() { + this.x = 1; + } +} diff --git a/test/configCases/defer-import/defer-runtime/esm/reexport-deep.mjs b/test/configCases/defer-import/defer-runtime/esm/reexport-deep.mjs new file mode 100644 index 00000000000..631352c0490 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/reexport-deep.mjs @@ -0,0 +1,13 @@ +import { touch } from "../side-effect-counter.js"; + +export function f() { + return "func"; +} + +export class T { + constructor() { + this.x = 1; + } +} + +touch(); diff --git a/test/configCases/defer-import/defer-runtime/esm/reexport.mjs b/test/configCases/defer-import/defer-runtime/esm/reexport.mjs new file mode 100644 index 00000000000..8737a77896e --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/esm/reexport.mjs @@ -0,0 +1,4 @@ +import * as reexport_ns from /* webpackDefer: true */ "./reexport-deep.mjs"; +import * as reexport_cjs_ns from /* webpackDefer: true */ "./reexport-deep.cjs"; + +export { reexport_ns, reexport_cjs_ns }; diff --git a/test/configCases/defer-import/defer-runtime/side-effect-counter.js b/test/configCases/defer-import/defer-runtime/side-effect-counter.js new file mode 100644 index 00000000000..45a6f1cc7b6 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/side-effect-counter.js @@ -0,0 +1,14 @@ +let count = 0; +export function touch() { + count++; +} +export function reset() { + count = 0; +} +export function assertTouched() { + if (count === 0) throw new Error("Side effect not triggered."); + if (count > 1) throw new Error("Side effect triggered more than expected."); +} +export function assertUntouched() { + if (count !== 0) throw new Error("Side effect triggered."); +} diff --git a/test/configCases/defer-import/defer-runtime/webpack.config.js b/test/configCases/defer-import/defer-runtime/webpack.config.js new file mode 100644 index 00000000000..0c4162c9870 --- /dev/null +++ b/test/configCases/defer-import/defer-runtime/webpack.config.js @@ -0,0 +1,16 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + entry: ["./all.js"], + optimization: { + concatenateModules: false + }, + experiments: { + deferImport: true + } +}; diff --git a/test/configCases/defer-import/defer-then-non-defer/0.js b/test/configCases/defer-import/defer-then-non-defer/0.js new file mode 100644 index 00000000000..658b4a1fc17 --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/0.js @@ -0,0 +1,3 @@ +import * as deferred from /* webpackDefer: true */ './deferred.js'; +import { order } from './order.js'; +order.push([0, deferred][0]); diff --git a/test/configCases/defer-import/defer-then-non-defer/1.js b/test/configCases/defer-import/defer-then-non-defer/1.js new file mode 100644 index 00000000000..8e27eb19f91 --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/1.js @@ -0,0 +1,3 @@ +import './deferred.js'; +import { order } from './order.js'; +order.push(1); diff --git a/test/configCases/defer-import/defer-then-non-defer/a.js b/test/configCases/defer-import/defer-then-non-defer/a.js new file mode 100644 index 00000000000..79b2a68c787 --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/a.js @@ -0,0 +1,12 @@ +import * as deferred from /* webpackDefer: true */ './deferred.1.js'; +import { order } from './order.js'; +order.push(['a', deferred][0]); + +export function next() { + if (typeof avoidAnalyze(deferred).then !== 'undefined') { + throw new Error('deferred should be a deferred namespace object.'); + } +} +function avoidAnalyze(params) { + return params; +} diff --git a/test/configCases/defer-import/defer-then-non-defer/b.js b/test/configCases/defer-import/defer-then-non-defer/b.js new file mode 100644 index 00000000000..5f9c1e32d3e --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/b.js @@ -0,0 +1,9 @@ +import * as ns from './deferred.1.js'; +import { order } from './order.js'; +order.push(['b', ns][0]); +if (typeof avoidAnalyze(ns).then === 'undefined') { + throw new Error('ns should not be a deferred namespace object.'); +} +function avoidAnalyze(params) { + return params; +} diff --git a/test/configCases/defer-import/defer-then-non-defer/deferred.1.js b/test/configCases/defer-import/defer-then-non-defer/deferred.1.js new file mode 100644 index 00000000000..8a7cc6ffe45 --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/deferred.1.js @@ -0,0 +1,4 @@ +import { order } from "./order"; + +order.push("deferred.1"); +export function then() {} diff --git a/test/configCases/defer-import/defer-then-non-defer/deferred.js b/test/configCases/defer-import/defer-then-non-defer/deferred.js new file mode 100644 index 00000000000..ee896090310 --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/deferred.js @@ -0,0 +1,3 @@ +import { order } from "./order"; + +order.push("deferred"); diff --git a/test/configCases/defer-import/defer-then-non-defer/entry.js b/test/configCases/defer-import/defer-then-non-defer/entry.js new file mode 100644 index 00000000000..e886f7d4788 --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/entry.js @@ -0,0 +1,15 @@ +import { order } from "./order"; +import './0.js'; +import './1.js'; +import './a.js'; +import './b.js'; +import { next } from "./a.js"; + +const expected = "0 deferred 1 a deferred.1 b"; +if (order.join(' ') !== expected) { + throw new Error( + `Expected order to be "${expected}", but got "${order.join(' ')}"` + ); +} + +next(); diff --git a/test/configCases/defer-import/defer-then-non-defer/index.js b/test/configCases/defer-import/defer-then-non-defer/index.js new file mode 100644 index 00000000000..ac5d9f147fa --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/index.js @@ -0,0 +1,3 @@ +it("execution order should be correct.", () => { + return import("./entry.js"); +}); diff --git a/test/configCases/defer-import/defer-then-non-defer/order.js b/test/configCases/defer-import/defer-then-non-defer/order.js new file mode 100644 index 00000000000..5bb36829626 --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/order.js @@ -0,0 +1 @@ +export const order = []; 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 new file mode 100644 index 00000000000..c0ef1403bc9 --- /dev/null +++ b/test/configCases/defer-import/defer-then-non-defer/webpack.config.js @@ -0,0 +1,15 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + optimization: { + concatenateModules: true + }, + experiments: { + deferImport: true + } +}; diff --git a/test/configCases/defer-import/defer-used-in-async/deferred.js b/test/configCases/defer-import/defer-used-in-async/deferred.js new file mode 100644 index 00000000000..0b05a700193 --- /dev/null +++ b/test/configCases/defer-import/defer-used-in-async/deferred.js @@ -0,0 +1,6 @@ +import { data, setData } from "./side-effect-counter"; + +if (data !== "entry") + throw new Error("Expected entry.js to be executed first."); +setData("deferred"); +export {}; diff --git a/test/configCases/defer-import/defer-used-in-async/entry.js b/test/configCases/defer-import/defer-used-in-async/entry.js new file mode 100644 index 00000000000..6b4e680ce08 --- /dev/null +++ b/test/configCases/defer-import/defer-used-in-async/entry.js @@ -0,0 +1,11 @@ +import * as ns from /* webpackDefer: true */ "./deferred.js"; +import { data, setData } from "./side-effect-counter.js"; + +if (data !== undefined) + throw new Error("No side effect should be trigger before this."); +setData("entry"); +await import("./sync-access.js"); + +if (Math.random() > 1) { + console.log(ns); +} diff --git a/test/configCases/defer-import/defer-used-in-async/index.js b/test/configCases/defer-import/defer-used-in-async/index.js new file mode 100644 index 00000000000..ac5d9f147fa --- /dev/null +++ b/test/configCases/defer-import/defer-used-in-async/index.js @@ -0,0 +1,3 @@ +it("execution order should be correct.", () => { + return import("./entry.js"); +}); diff --git a/test/configCases/defer-import/defer-used-in-async/side-effect-counter.js b/test/configCases/defer-import/defer-used-in-async/side-effect-counter.js new file mode 100644 index 00000000000..4824c2574f8 --- /dev/null +++ b/test/configCases/defer-import/defer-used-in-async/side-effect-counter.js @@ -0,0 +1,4 @@ +export let data; +export function setData(d) { + data = d; +} diff --git a/test/configCases/defer-import/defer-used-in-async/sync-access.js b/test/configCases/defer-import/defer-used-in-async/sync-access.js new file mode 100644 index 00000000000..774ff9c4b35 --- /dev/null +++ b/test/configCases/defer-import/defer-used-in-async/sync-access.js @@ -0,0 +1,6 @@ +import * as ns from "./deferred.js"; +import { data } from "./side-effect-counter.js"; + +if (data !== "deferred") + throw new Error("Expected deferred.js to be executed first."); +Object.entries(ns); 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 new file mode 100644 index 00000000000..2d32cf8ca25 --- /dev/null +++ b/test/configCases/defer-import/defer-used-in-async/webpack.config.js @@ -0,0 +1,14 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + }, + optimization: {}, + experiments: { + topLevelAwait: true, + deferImport: true + } +}; diff --git a/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/errors.js b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/errors.js new file mode 100644 index 00000000000..ebc0cf1d625 --- /dev/null +++ b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/errors.js @@ -0,0 +1 @@ +module.exports = [[/cannot be used unless experimental\.deferImport is true/]]; diff --git a/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/index.js b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/index.js new file mode 100644 index 00000000000..ee766626e07 --- /dev/null +++ b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/index.js @@ -0,0 +1,2 @@ +import defer * as f3 from "./mod.js"; +export default f3.default; diff --git a/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/mod.js b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/mod.js new file mode 100644 index 00000000000..1b1caff7ada --- /dev/null +++ b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/mod.js @@ -0,0 +1,2 @@ +export function f() {} +export default function f2() {} diff --git a/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/webpack.config.js b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/webpack.config.js new file mode 100644 index 00000000000..5f126afb2ef --- /dev/null +++ b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/webpack.config.js @@ -0,0 +1,9 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test + environment: { + optionalChaining: false + } + } +}; diff --git a/types.d.ts b/types.d.ts index cd257d5b941..f5c9618934c 100644 --- a/types.d.ts +++ b/types.d.ts @@ -2715,11 +2715,35 @@ declare interface ConcatenatedModuleInfo { rawExportMap?: Map; namespaceExportSymbol?: string; namespaceObjectName?: string; + + /** + * "default-with-named" namespace + */ interopNamespaceObjectUsed: boolean; + + /** + * "default-with-named" namespace + */ interopNamespaceObjectName?: string; + + /** + * "default-only" namespace + */ interopNamespaceObject2Used: boolean; + + /** + * "default-only" namespace + */ interopNamespaceObject2Name?: string; + + /** + * runtime namespace object that detects "__esModule" + */ interopDefaultAccessUsed: boolean; + + /** + * runtime namespace object that detects "__esModule" + */ interopDefaultAccessName?: string; } declare interface ConcatenationBailoutReasonContext { @@ -3633,7 +3657,8 @@ declare interface DependenciesBlockLike { declare class Dependency { constructor(); weak: boolean; - optional: boolean; + defer?: boolean; + optional?: boolean; get type(): string; get category(): string; loc: DependencyLocation; @@ -4705,6 +4730,11 @@ declare interface ExperimentsExtra { */ css?: 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; + /** * Compile entrypoints and import()s only when they are accessed. */ @@ -4726,6 +4756,11 @@ declare interface ExperimentsNormalizedExtra { */ css?: 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; + /** * Compile entrypoints and import()s only when they are accessed. */ @@ -4959,6 +4994,11 @@ declare interface ExportsSpec { */ dependencies?: Module[]; } +type ExportsType = + | "namespace" + | "default-only" + | "default-with-named" + | "dynamic"; type Exposes = (string | ExposesObject)[] | ExposesObject; /** @@ -5139,12 +5179,60 @@ declare interface ExternalModuleInfo { module: Module; runtimeCondition?: string | boolean | SortableSet; index: number; + + /** + * module.exports / harmony namespace object + */ name?: string; + + /** + * deferred module.exports / harmony namespace object + */ + deferredName?: string; + + /** + * the module is deferred at least once + */ + deferred: boolean; + + /** + * deferred namespace object that being used in a not-analyzable way so it must be materialized + */ + deferredNamespaceObjectUsed: boolean; + + /** + * deferred namespace object that being used in a not-analyzable way so it must be materialized + */ + deferredNamespaceObjectName?: string; + + /** + * "default-with-named" namespace + */ interopNamespaceObjectUsed: boolean; + + /** + * "default-with-named" namespace + */ interopNamespaceObjectName?: string; + + /** + * "default-only" namespace + */ interopNamespaceObject2Used: boolean; + + /** + * "default-only" namespace + */ interopNamespaceObject2Name?: string; + + /** + * runtime namespace object that detects "__esModule" + */ interopDefaultAccessUsed: boolean; + + /** + * runtime namespace object that detects "__esModule" + */ interopDefaultAccessName?: string; } type Externals = @@ -6063,6 +6151,7 @@ type ImportAttribute = BaseNode & { type ImportAttributes = Record & {}; type ImportDeclarationJavascriptParser = ImportDeclarationImport & { attributes?: ImportAttribute[]; + phase?: "defer"; }; declare interface ImportDependencyMeta { attributes?: ImportAttributes; @@ -6098,6 +6187,7 @@ type ImportExpressionJavascriptParser = ImportExpressionImport & { | ThisExpression | UpdateExpression | YieldExpression; + phase?: "defer"; }; declare interface ImportModuleOptions { /** @@ -9479,10 +9569,7 @@ declare class Module extends DependenciesBlock { isProvided(exportName: string): null | boolean; get exportsArgument(): string; get moduleArgument(): string; - getExportsType( - moduleGraph: ModuleGraph, - strict?: boolean - ): "namespace" | "default-only" | "default-with-named" | "dynamic"; + getExportsType(moduleGraph: ModuleGraph, strict?: boolean): ExportsType; addPresentationalDependency(presentationalDependency: Dependency): void; addCodeGenerationDependency(codeGenerationDependency: Dependency): void; addWarning(warning: WebpackError): void; @@ -9821,6 +9908,7 @@ declare class ModuleGraph { setDepth(module: Module, depth: number): void; setDepthIfLower(module: Module, depth: number): boolean; isAsync(module: Module): boolean; + isDeferred(module: Module): boolean; setAsync(module: Module): void; getMeta(thing: object): any; getMetaIfExisting(thing: object): any; @@ -10113,6 +10201,11 @@ declare interface ModuleReferenceOptions { */ directImport: boolean; + /** + * true, when this referenced export is deferred + */ + deferredImport: boolean; + /** * if the position is ASI safe or unknown */ @@ -14985,6 +15078,10 @@ declare abstract class RuntimeTemplate { * the module */ module: Module; + /** + * the module graph + */ + moduleGraph: ModuleGraph; /** * the chunk graph */ @@ -15009,12 +15106,20 @@ declare abstract class RuntimeTemplate { * if set, will be filled with runtime requirements */ runtimeRequirements: Set; + /** + * if set, the module will be deferred + */ + defer?: boolean; }): [string, string]; exportFromImport(__0: { /** * the module graph */ moduleGraph: ModuleGraph; + /** + * the chunk graph + */ + chunkGraph: ChunkGraph; /** * the module */ @@ -15063,6 +15168,10 @@ declare abstract class RuntimeTemplate { * if set, will be filled with runtime requirements */ runtimeRequirements: Set; + /** + * if true, the module will be deferred. + */ + defer?: boolean; }): string; blockPromise(__0: { /** @@ -16490,6 +16599,7 @@ declare interface TargetItemWithConnection { declare interface TargetItemWithoutConnection { module: Module; export: string[]; + deferred: boolean; } declare class Template { constructor(); @@ -17374,6 +17484,8 @@ declare namespace exports { export let preloadChunkHandlers: "__webpack_require__.H"; export let definePropertyGetters: "__webpack_require__.d"; export let makeNamespaceObject: "__webpack_require__.r"; + export let makeDeferredNamespaceObject: "__webpack_require__.z"; + export let makeDeferredNamespaceObjectSymbol: "__webpack_require__.zS"; export let createFakeNamespaceObject: "__webpack_require__.t"; export let compatGetDefaultExport: "__webpack_require__.n"; export let harmonyModuleDecorator: "__webpack_require__.hmd"; @@ -17422,6 +17534,8 @@ declare namespace exports { export let baseURI: "__webpack_require__.b"; export let relativeUrl: "__webpack_require__.U"; export let asyncModule: "__webpack_require__.a"; + export let asyncModuleExportSymbol: "__webpack_require__.aE"; + export let asyncModuleDoneSymbol: "__webpack_require__.aD"; } export const UsageState: Readonly<{ Unused: 0; From 02a1d22db873d24a32d06ac836c1a3124e5bedb0 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Wed, 2 Jul 2025 15:10:54 +0300 Subject: [PATCH 38/56] refactor: use `eslint-config-webpack` (#19645) --- .prettierrc.js | 2 + bin/webpack.js | 5 + eslint.config.mjs | 518 ++---- examples/aggressive-merging/webpack.config.js | 2 + examples/asset-advanced/webpack.config.js | 2 + examples/asset-simple/webpack.config.js | 2 + examples/build-http/webpack.config.js | 2 + examples/chunkhash/webpack.config.js | 2 + examples/cjs-tree-shaking/webpack.config.js | 2 + .../webpack.config.js | 2 + .../webpack.config.js | 2 + .../webpack.config.js | 2 + .../webpack.config.js | 2 + .../webpack.config.js | 2 + .../code-splitting-harmony/webpack.config.js | 2 + .../webpack.config.js | 2 + .../webpack.config.js | 2 + .../webpack.config.js | 2 + examples/code-splitting/webpack.config.js | 2 + examples/coffee-script/webpack.config.js | 2 + .../webpack.config.js | 2 + .../webpack.config.js | 1 + examples/css/webpack.config.js | 2 + .../custom-json-modules/webpack.config.js | 2 + examples/dll-entry-only/webpack.config.js | 2 + examples/dll-user/webpack.config.js | 2 + examples/dll/c.jsx | 2 +- examples/dll/webpack.config.js | 2 + .../explicit-vendor-chunk/webpack.config.js | 2 + examples/externals/webpack.config.js | 2 + .../webpack.config.js | 2 + examples/extra-async-chunk/webpack.config.js | 2 + examples/harmony-library/webpack.config.js | 2 + examples/harmony-unused/webpack.config.js | 2 + examples/harmony/webpack.config.js | 2 + .../webpack.config.js | 2 + examples/hybrid-routing/webpack.config.js | 2 + examples/lazy-compilation/webpack.config.js | 2 + examples/loader/webpack.config.js | 2 + examples/many-pages/webpack.config.js | 2 + examples/mixed/webpack.config.js | 2 + .../module-code-splitting/webpack.config.js | 2 + examples/module-federation/webpack.config.js | 4 + examples/module-library/webpack.config.js | 2 + examples/module-worker/webpack.config.js | 2 + examples/module/webpack.config.js | 2 + examples/multi-compiler/webpack.config.js | 2 + examples/multi-part-library/webpack.config.js | 2 + .../multiple-entry-points/webpack.config.js | 2 + examples/named-chunks/webpack.config.js | 2 + examples/nodejs-addons/webpack.config.js | 2 + examples/persistent-caching/webpack.config.js | 3 + .../reexport-components/webpack.config.js | 2 + examples/scope-hoisting/webpack.config.js | 2 + examples/side-effects/webpack.config.js | 2 + examples/source-map/webpack.config.js | 2 + examples/stats-detailed/webpack.config.js | 2 + examples/stats-minimal/webpack.config.js | 2 + examples/stats-none/webpack.config.js | 2 + examples/stats-normal/webpack.config.js | 2 + examples/stats-summary/webpack.config.js | 2 + examples/top-level-await/webpack.config.js | 2 + .../webpack.config.js | 2 + examples/typescript/webpack.config.js | 2 + examples/wasm-bindgen-esm/pkg/package.json | 10 +- examples/wasm-bindgen-esm/webpack.config.js | 2 + examples/wasm-complex/webpack.config.js | 2 + examples/wasm-simple/webpack.config.js | 2 + examples/worker/webpack.config.js | 2 + generate-types-config.js | 2 + hot/log.js | 30 +- hot/poll.js | 1 + jest.config.js | 2 + lib/AbstractMethodError.js | 1 + lib/AutomaticPrefetchPlugin.js | 1 + lib/BannerPlugin.js | 2 +- lib/ChunkGraph.js | 37 +- lib/CleanPlugin.js | 1 + lib/CompatibilityPlugin.js | 7 +- lib/Compilation.js | 47 +- lib/Compiler.js | 2 +- lib/ConcatenationScope.js | 4 +- lib/ConstPlugin.js | 3 +- lib/ContextModule.js | 9 +- lib/ContextModuleFactory.js | 3 +- lib/DefinePlugin.js | 4 +- lib/DelegatedModuleFactoryPlugin.js | 1 + lib/DependencyTemplate.js | 1 + lib/DllPlugin.js | 2 +- lib/DllReferencePlugin.js | 4 +- lib/EntryOptionPlugin.js | 5 + lib/ExportsInfo.js | 24 +- lib/ExternalModule.js | 12 +- lib/ExternalModuleFactoryPlugin.js | 1 + lib/FileSystemInfo.js | 69 +- lib/FlagDependencyExportsPlugin.js | 21 +- lib/Generator.js | 3 + lib/HookWebpackError.js | 1 + lib/HotModuleReplacementPlugin.js | 21 +- lib/IgnorePlugin.js | 2 +- lib/LibManifestPlugin.js | 1 + lib/LoaderOptionsPlugin.js | 2 +- lib/Module.js | 11 +- lib/ModuleFactory.js | 1 + lib/ModuleGraph.js | 6 +- lib/ModuleInfoHeaderPlugin.js | 1 + lib/ModuleParseError.js | 1 + lib/NormalModule.js | 10 +- lib/NormalModuleFactory.js | 32 +- lib/NullFactory.js | 1 + lib/Parser.js | 1 + lib/ProgressPlugin.js | 8 +- lib/RecordIdsPlugin.js | 1 + lib/RuntimeModule.js | 1 + lib/RuntimePlugin.js | 4 +- lib/RuntimeTemplate.js | 6 +- lib/SourceMapDevToolPlugin.js | 10 +- lib/WatchIgnorePlugin.js | 2 +- lib/WebpackIsIncludedPlugin.js | 3 +- lib/WebpackOptionsApply.js | 90 +- lib/asset/AssetGenerator.js | 2 +- lib/asset/AssetModulesPlugin.js | 9 +- lib/asset/AssetSourceGenerator.js | 4 +- lib/asset/RawDataUrlModule.js | 6 +- lib/buildChunkGraph.js | 9 +- lib/cache/MemoryCachePlugin.js | 1 + lib/cache/MemoryWithGcCachePlugin.js | 1 + lib/cache/PackFileCacheStrategy.js | 34 +- lib/cache/ResolverCachePlugin.js | 24 +- lib/cli.js | 6 +- lib/config/defaults.js | 7 +- lib/config/normalization.js | 3 +- lib/config/target.js | 5 +- lib/container/ContainerPlugin.js | 2 +- lib/container/ContainerReferencePlugin.js | 2 +- lib/container/FallbackModule.js | 3 +- lib/container/ModuleFederationPlugin.js | 4 +- lib/css/CssGenerator.js | 5 +- lib/css/CssModulesPlugin.js | 25 +- lib/css/CssParser.js | 6 +- lib/css/walkCssTokens.js | 2 +- lib/debug/ProfilingPlugin.js | 2 +- .../AMDDefineDependencyParserPlugin.js | 9 +- lib/dependencies/AMDPlugin.js | 8 +- ...AMDRequireDependenciesBlockParserPlugin.js | 1 + .../CommonJsExportRequireDependency.js | 6 +- .../CommonJsExportsParserPlugin.js | 1 + .../CommonJsImportsParserPlugin.js | 13 +- lib/dependencies/CommonJsPlugin.js | 3 +- lib/dependencies/ContextDependencyHelpers.js | 3 +- .../ContextDependencyTemplateAsId.js | 1 + .../ContextDependencyTemplateAsRequireCall.js | 1 + .../CssSelfLocalIdentifierDependency.js | 3 +- ...armonyExportImportedSpecifierDependency.js | 9 +- .../HarmonyImportDependencyParserPlugin.js | 3 +- .../HarmonyImportSpecifierDependency.js | 6 +- lib/dependencies/HarmonyModulesPlugin.js | 4 +- ...ImportMetaContextDependencyParserPlugin.js | 1 + lib/dependencies/ImportMetaContextPlugin.js | 3 +- lib/dependencies/ImportParserPlugin.js | 13 +- lib/dependencies/ImportPlugin.js | 4 +- lib/dependencies/LoaderPlugin.js | 1 + .../ModuleDependencyTemplateAsRequireId.js | 1 + lib/dependencies/RequireContextPlugin.js | 4 +- lib/dependencies/RequireEnsurePlugin.js | 4 +- lib/dependencies/RequireIncludePlugin.js | 1 + lib/dependencies/WorkerPlugin.js | 17 +- lib/dependencies/processExportInfo.js | 1 + lib/esm/ModuleChunkFormatPlugin.js | 6 +- lib/hmr/HotModuleReplacement.runtime.js | 1 - lib/hmr/HotModuleReplacementRuntimeModule.js | 2 +- .../JavascriptHotModuleReplacementHelper.js | 2 +- lib/hmr/LazyCompilationPlugin.js | 6 +- lib/hmr/lazyCompilationBackend.js | 6 +- lib/ids/ChunkModuleIdRangePlugin.js | 1 + lib/ids/DeterministicModuleIdsPlugin.js | 3 +- lib/ids/HashedModuleIdsPlugin.js | 5 +- lib/ids/IdHelpers.js | 16 +- lib/ids/OccurrenceChunkIdsPlugin.js | 2 +- lib/ids/OccurrenceModuleIdsPlugin.js | 2 +- lib/index.js | 11 +- lib/javascript/BasicEvaluatedExpression.js | 3 +- lib/javascript/ChunkHelpers.js | 1 + lib/javascript/EnableChunkLoadingPlugin.js | 5 + lib/javascript/JavascriptModulesPlugin.js | 17 +- lib/javascript/JavascriptParser.js | 42 +- lib/json/JsonGenerator.js | 6 +- lib/json/JsonModulesPlugin.js | 4 +- lib/json/JsonParser.js | 2 +- lib/library/AbstractLibraryPlugin.js | 8 +- lib/library/AssignLibraryPlugin.js | 11 +- lib/library/EnableLibraryPlugin.js | 22 + lib/library/UmdLibraryPlugin.js | 9 +- lib/node/nodeConsole.js | 6 +- lib/optimize/AggressiveSplittingPlugin.js | 3 +- lib/optimize/ConcatenatedModule.js | 24 +- lib/optimize/EnsureChunkConditionsPlugin.js | 1 + lib/optimize/FlagIncludedChunksPlugin.js | 4 +- lib/optimize/InnerGraph.js | 6 +- lib/optimize/LimitChunkCountPlugin.js | 3 +- lib/optimize/MangleExportsPlugin.js | 3 +- lib/optimize/MergeDuplicateChunksPlugin.js | 6 +- lib/optimize/MinChunkSizePlugin.js | 9 +- lib/optimize/ModuleConcatenationPlugin.js | 6 +- lib/optimize/RealContentHashPlugin.js | 3 +- lib/optimize/RemoveEmptyChunksPlugin.js | 1 + lib/optimize/RemoveParentModulesPlugin.js | 1 + lib/optimize/SideEffectsFlagPlugin.js | 1 + lib/optimize/SplitChunksPlugin.js | 13 +- lib/rules/RuleSetCompiler.js | 6 +- lib/runtime/RuntimeIdRuntimeModule.js | 3 +- lib/schemes/HttpUriPlugin.js | 35 +- lib/serialization/AggregateErrorSerializer.js | 2 +- lib/serialization/BinaryMiddleware.js | 7 +- lib/serialization/FileMiddleware.js | 5 +- lib/serialization/ObjectMiddleware.js | 18 +- lib/serialization/Serializer.js | 4 +- lib/serialization/SerializerMiddleware.js | 2 + lib/sharing/ConsumeSharedPlugin.js | 2 +- lib/sharing/ProvideSharedPlugin.js | 5 +- lib/sharing/SharePlugin.js | 3 +- lib/sharing/utils.js | 2 + lib/stats/DefaultStatsFactoryPlugin.js | 23 +- lib/stats/DefaultStatsPresetPlugin.js | 4 +- lib/stats/DefaultStatsPrinterPlugin.js | 14 +- lib/stats/StatsFactory.js | 4 +- lib/stats/StatsPrinter.js | 1 + lib/url/URLParserPlugin.js | 9 +- lib/util/Hash.js | 2 + lib/util/LazyBucketSortedSet.js | 3 +- lib/util/LazySet.js | 4 +- lib/util/StringXor.js | 1 + lib/util/cleverMerge.js | 12 +- lib/util/comparators.js | 51 +- lib/util/compileBooleanMatcher.js | 7 +- lib/util/concatenate.js | 3 +- lib/util/createHash.js | 14 +- lib/util/deprecation.js | 1 + lib/util/deterministicGrouping.js | 6 +- lib/util/extractUrlAndGlobal.js | 2 +- lib/util/fs.js | 14 +- lib/util/hash/wasm-hash.js | 6 +- lib/util/identifier.js | 7 +- lib/util/removeBOM.js | 2 +- lib/util/runtime.js | 11 +- lib/util/serialization.js | 3 + lib/util/source.js | 5 +- lib/validateSchema.js | 1 + .../AsyncWebAssemblyJavascriptGenerator.js | 3 +- .../WebAssemblyInInitialChunkError.js | 3 +- lib/wasm/EnableWasmLoadingPlugin.js | 5 + lib/webpack.js | 2 +- .../ImportScriptsChunkLoadingPlugin.js | 1 + lib/webworker/WebWorkerTemplatePlugin.js | 1 + package.json | 175 +- setup/setup.js | 14 +- test/AbstractMethodError.unittest.js | 2 +- test/ArrayHelpers.unittest.js | 1 + test/BannerPlugin.test.js | 194 +-- test/BenchmarkTestCases.benchmark.mjs | 11 +- test/BinaryMiddleware.unittest.js | 4 +- test/BuildDependencies.longtest.js | 21 +- test/ChangesAndRemovals.test.js | 23 +- test/Compiler-caching.test.js | 6 +- test/Compiler-filesystem-caching.test.js | 30 +- test/Compiler.test.js | 92 +- test/ConfigTestCases.template.js | 40 +- test/ContextModule.unittest.js | 2 + test/ContextModuleFactory.unittest.js | 9 +- test/Defaults.unittest.js | 59 +- test/Errors.test.js | 152 +- test/Examples.test.js | 12 +- test/FileSystemInfo.unittest.js | 4 +- test/HotModuleReplacementPlugin.test.js | 25 +- test/HotTestCases.template.js | 31 +- test/JavascriptParser.unittest.js | 24 +- test/LocalModulesHelpers.unittest.js | 4 +- test/MemoryLimitTestCases.test.js | 14 +- test/MultiCompiler.test.js | 17 +- test/MultiItemCache.unittest.js | 12 +- test/MultiStats.test.js | 1 + test/MultiWatching.unittest.js | 18 +- test/NodeTemplatePlugin.test.js | 7 + test/NormalModule.unittest.js | 58 +- test/PersistentCaching.test.js | 8 +- test/ProfilingPlugin.test.js | 8 +- test/ProgressPlugin.test.js | 9 +- test/Queue.unittest.js | 6 +- test/RequestShortener.unittest.js | 6 +- test/SemVer.unittest.js | 4 +- test/SortableSet.unittest.js | 6 +- test/Stats.test.js | 6 + test/StatsTestCases.basictest.js | 21 +- test/Template.unittest.js | 2 + test/TestCases.template.js | 34 +- test/TestCasesAllCombined.longtest.js | 1 + test/Validation.test.js | 1 + test/WasmHashes.unittest.js | 10 +- test/Watch.test.js | 4 +- test/WatchClose.test.js | 1 + test/WatchDetection.test.js | 25 +- test/WatchSuspend.test.js | 34 +- test/WatchTestCases.template.js | 57 +- test/WatcherEvents.test.js | 1 + test/WebpackError.unittest.js | 2 +- test/checkArrayExpectation.js | 6 +- test/cleverMerge.unittest.js | 1 + test/compareLocations.unittest.js | 1 + test/compareStringsNumeric.unittest.js | 3 +- test/compileBooleanMatcher.unittest.js | 1 + .../additional-pass/simple/webpack.config.js | 2 +- .../asset-modules/errored/webpack.config.js | 2 +- .../asset-modules/file-url/webpack.config.js | 1 + .../assets/delete-asset/webpack.config.js | 34 +- .../order-multiple-entries/webpack.config.js | 4 +- .../2-container-full/webpack.config.js | 1 - .../3-container-full/webpack.config.js | 1 - .../exposed-overridables/webpack.config.js | 1 - .../css/css-modules-in-node/warnings.js | 4 +- .../css/import-module/webpack.config.js | 1 + .../no-extra-js-exports-output/test.config.js | 4 +- .../webpack.config.js | 2 +- test/configCases/css/pathinfo/test.config.js | 2 +- .../json-custom/webpack.config.js | 3 +- .../localization/webpack.config.js | 3 +- .../webpack.config.js | 3 +- .../remove-export/webpack.config.js | 3 +- .../chunk-and-module/webpack.config.js | 4 +- .../chunk-files/webpack.config.js | 10 +- .../webpack.config.js | 1 + .../webpack.config.js | 1 + .../externals-array/webpack.config.js | 1 + .../non-amd-externals-amd/webpack.config.js | 1 + .../resolve-callback/webpack.config.js | 11 +- .../finish-modules/simple/webpack.config.js | 2 +- .../output-filename/test.config.js | 2 +- .../altaskitButton/webpack.config.js | 1 + .../inner-graph/basic/webpack.config.js | 1 + .../inner-graph/blockScopes/webpack.config.js | 1 + .../inner-graph/class/webpack.config.js | 3 +- .../inner-graph/const/webpack.config.js | 1 + .../defaultArrow/webpack.config.js | 1 + .../defaultClass/webpack.config.js | 1 + .../defaultExpression/webpack.config.js | 1 + .../defaultFunction/webpack.config.js | 1 + .../webpack.config.js | 1 + .../inner-graph/defaultId/webpack.config.js | 1 + .../defaultNamedFunction/webpack.config.js | 1 + .../webpack.config.js | 1 + .../eval-bailout/webpack.config.js | 1 + .../inner-graph/export/webpack.config.js | 1 + .../inner-graph/importAll/webpack.config.js | 1 + .../inner-graph/issue-11678/webpack.config.js | 1 + .../issue-12669-mini/webpack.config.js | 1 + .../inner-graph/issue-12669/webpack.config.js | 1 + .../localReference/webpack.config.js | 1 + .../inner-graph/nested/webpack.config.js | 1 + .../inner-graph/pure/webpack.config.js | 1 + .../ramdaIdentical/webpack.config.js | 1 + .../inner-graph/specifier/webpack.config.js | 1 + .../inner-graph/varWritten/webpack.config.js | 1 + .../issues/issue-3596/webpack.config.js | 4 +- .../issues/issue-7563/test.config.js | 4 +- .../top-level-json-parser/webpack.config.js | 3 +- .../disable-provided-export/webpack.config.js | 4 +- .../basic/webpack.config.js | 2 - .../loaders/hot-in-context/webpack.config.js | 1 + .../loaders/pr-14384/webpack.config.js | 2 +- .../mangle-with-object-prop/webpack.config.js | 1 + .../circular-externals/webpack.config.js | 4 +- .../optimization/chunk/webpack.config.js | 1 + .../webpack.config.js | 1 + test/configCases/parsing/bom/test.config.js | 2 +- .../dead-code-elimination/test.config.js | 2 +- .../plugins/define-plugin/webpack.config.js | 4 +- .../profiling-plugin/webpack.config.js | 1 + .../plugins/progress-plugin/test.config.js | 2 +- .../plugins/provide-plugin/webpack.config.js | 4 - .../plugins/terser-plugin/webpack.config.js | 1 + .../virtual-url-plugin/webpack.config.js | 9 +- .../html-plugin/webpack.config.js | 6 +- .../rebuild/finishModules/webpack.config.js | 5 +- .../webpack.config.js | 5 +- .../resolve/fallback/webpack.config.js | 1 + .../resolve/multi-alias/webpack.config.js | 1 + .../resolve/only-module/webpack.config.js | 1 + .../prefer-absolute/webpack.config.js | 3 +- .../resolving/prefer-root/webpack.config.js | 3 +- .../simple-use-fn-array/webpack.config.js | 11 +- .../webpack.config.js | 1 - .../sharing/consume-module/webpack.config.js | 1 - .../webpack.config.js | 1 - .../webpack.config.js | 1 - .../consume-self-reference/webpack.config.js | 1 - .../no-override-loaded/webpack.config.js | 1 - .../provide-eager-module/webpack.config.js | 1 - .../sharing/provide-module/webpack.config.js | 1 - .../webpack.config.js | 1 - .../webpack.config.js | 1 + .../share-multiple-versions/webpack.config.js | 1 - .../share-plugin-dual-mode/webpack.config.js | 5 +- .../share-plugin-monorepo/webpack.config.js | 4 +- .../sharing/share-plugin/webpack.config.js | 1 - .../issue-13063/webpack.config.js | 2 - .../side-effects-override/webpack.config.js | 1 + .../webpack.config.js | 2 - .../no-source-map/webpack.config.js | 2 +- .../split-chunks/asnyc-entries/test.filter.js | 1 - .../amd-container-named/webpack.config.js | 1 + .../amd-container-require/webpack.config.js | 1 + .../amd-container-unnamed/webpack.config.js | 1 + .../target/amd-named/webpack.config.js | 1 + .../target/amd-require/webpack.config.js | 1 + .../target/amd-unnamed/webpack.config.js | 1 + .../system-named-assets-path/test.config.js | 1 + .../umd/issue-15545/test.config.js | 1 + test/configCases/web/nonce/webpack.config.js | 1 + test/deterministicGrouping.unittest.js | 4 + test/extractUrlAndGlobal.unittest.js | 14 +- test/helpers/EventSourceForNode.js | 2 + test/helpers/FakeDocument.js | 9 +- test/helpers/createFakeWorker.js | 1 + test/helpers/createLazyTestEnv.js | 10 +- test/helpers/expectSource.js | 2 +- test/helpers/fakeSystem.js | 1 + test/helpers/supportsSpread.js | 1 + test/helpers/warmup-webpack.js | 1 + .../css/webpack.config.js | 2 +- test/hotPlayground/webpack.config.js | 3 +- test/nonNumericOnlyHash.unittest.js | 54 +- test/setupTestFramework.js | 2 + .../webpack.config.js | 3 +- .../webpack.config.js | 3 +- .../webpack.config.js | 4 +- test/statsCases/cause-error/webpack.config.js | 2 +- .../custom-terser/webpack.config.js | 1 + .../webpack.config.js | 3 +- .../webpack.config.js | 3 +- test/statsCases/issue-7577/webpack.config.js | 1 + .../real-content-hash/test.config.js | 4 +- .../webpack.config.js | 1 + .../split-chunks-chunk-name/webpack.config.js | 1 + .../webpack.config.js | 1 + .../split-chunks-dedup/webpack.config.js | 3 +- .../split-chunks-issue-6413/webpack.config.js | 1 + .../split-chunks-issue-6696/webpack.config.js | 1 + .../split-chunks-issue-7401/webpack.config.js | 1 + .../webpack.config.js | 1 + .../split-chunks-max-size/webpack.config.js | 1 + .../webpack.config.js | 1 + .../webpack.config.js | 1 + .../statsCases/split-chunks/webpack.config.js | 1 + test/walkCssTokens.unittest.js | 2 +- .../plugins/define-plugin/webpack.config.js | 10 +- .../webpack.config.js | 5 +- tooling/decode-debug-hash.js | 6 +- tooling/generate-runtime-code.js | 9 +- tooling/generate-wasm-code.js | 8 +- tooling/print-cache-file.js | 2 + yarn.lock | 1511 ++++++++++++++++- 460 files changed, 3843 insertions(+), 1498 deletions(-) diff --git a/.prettierrc.js b/.prettierrc.js index 52e3a560973..b8110f9cd35 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { printWidth: 80, useTabs: true, diff --git a/bin/webpack.js b/bin/webpack.js index cbb748f7e6d..a87c340fe44 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +"use strict"; + /** * @param {string} command process to run * @param {string[]} args command line arguments @@ -7,6 +9,7 @@ */ const runCommand = (command, args) => { const cp = require("child_process"); + return new Promise((resolve, reject) => { const executedCommand = cp.spawn(command, args, { stdio: "inherit", @@ -75,7 +78,9 @@ const isInstalled = packageName => { */ const runCli = cli => { const path = require("path"); + const pkgPath = require.resolve(`${cli.package}/package.json`); + const pkg = require(pkgPath); if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) { diff --git a/eslint.config.mjs b/eslint.config.mjs index 749672b5214..50c722508cf 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,15 +1,7 @@ import { defineConfig, globalIgnores } from "eslint/config"; -import js from "@eslint/js"; -import prettier from "eslint-plugin-prettier"; -import nodePlugin from "eslint-plugin-n"; -import jest from "eslint-plugin-jest"; -import jsdoc from "eslint-plugin-jsdoc"; -import prettierConfig from "eslint-config-prettier"; +import config from "eslint-config-webpack"; +import configs from "eslint-config-webpack/configs.js"; import globals from "globals"; -import stylistic from "@stylistic/eslint-plugin"; -import unicorn from "eslint-plugin-unicorn"; - -const jsdocConfig = jsdoc.configs["flat/recommended-typescript-flavor-error"]; export default defineConfig([ globalIgnores([ @@ -31,6 +23,10 @@ export default defineConfig([ "!test/_helpers/**/*.mjs", "test/js/**/*.*", + // TODO fix me + // This is not exactly typescript + "assembly/**/*.ts", + // Ignore some folders "benchmark", "coverage", @@ -48,64 +44,35 @@ export default defineConfig([ "lib/util/semver.js", // Ignore some examples files - "examples/**/*.js", - "examples/**/*.mjs", + "examples/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,md}", "!examples/*/webpack.config.js" ]), { - files: ["**/*.mjs"], - languageOptions: { - sourceType: "module" - } - }, - { - files: ["**/*.{js,cjs}"], - languageOptions: { - ecmaVersion: 2018, - sourceType: "commonjs", - globals: { - ...globals.node, - ...globals.es2018, - WebAssembly: true - } - } - }, - ...nodePlugin.configs["flat/mixed-esm-and-cjs"], - { - plugins: { - n: nodePlugin - }, + ignores: ["lib/**/*.runtime.js", "hot/*.js"], + extends: [config], rules: { - "n/no-missing-require": ["error", { allowModules: ["webpack"] }], - "n/no-unsupported-features/node-builtins": [ + // Revisit it in future + "id-length": "off", + // Revisit it in future + "no-use-before-define": "off", + // We have helpers for the default configuration + "new-cap": [ "error", { - ignores: [ - "zlib.createBrotliCompress", - "zlib.createBrotliDecompress", - "EventSource" - ] + newIsCapExceptions: [], + capIsNewExceptions: ["A", "F", "D", "MODULES_GROUPERS"] } ], - "n/exports-style": "error" - } - }, - { - ...js.configs.recommended, - linterOptions: { - reportUnusedDisableDirectives: true - }, - rules: { - ...js.configs.recommended.rules, - "no-template-curly-in-string": "error", - "no-caller": "error", - "no-control-regex": "off", - yoda: "error", - eqeqeq: "error", - "eol-last": "error", - "no-extra-bind": "warn", - "no-process-exit": "warn", - "no-use-before-define": "off", + + // TODO enable me in future + "prefer-destructuring": "off", + // TODO enable me in future, we need to ignore Object.define + "func-names": "off", + // TODO enable me in future + "unicorn/prefer-spread": "off", + // TODO need patch in tooling, now we are doing weird order for destructuring in cjs import + "import/order": "off", + // TODO We need allow to have `_arg` in tooling and use `after-used` value for `args` "no-unused-vars": [ "error", { @@ -115,403 +82,150 @@ export default defineConfig([ argsIgnorePattern: "^_", caughtErrors: "all", caughtErrorsIgnorePattern: "^_", - ignoreRestSiblings: true - } - ], - "no-inner-declarations": "error", - "prefer-const": [ - "error", - { - destructuring: "all", - ignoreReadBeforeAssign: true - } - ], - "object-shorthand": "error", - "no-else-return": "error", - "no-lonely-if": "error", - "no-undef-init": "error", - // Disallow ts-ignore directive. Use ts-expect-error instead - "no-warning-comments": ["error", { terms: ["@ts-ignore"] }], - "no-constructor-return": "error", - "symbol-description": "error", - "array-callback-return": [ - "error", - { - allowImplicit: true - } - ], - "no-promise-executor-return": "error", - "no-undef": "error", - "guard-for-in": "error", - "no-constant-condition": "error", - camelcase: [ - "error", - { - allow: [ - "__webpack_require__", - "__webpack_public_path__", - "__webpack_base_uri__", - "__webpack_modules__", - "__webpack_chunk_load__", - "__non_webpack_require__", - "__webpack_nonce__", - "__webpack_hash__", - "__webpack_chunkname__", - "__webpack_get_script_filename__", - "__webpack_runtime_id__", - "__system_context__", - "__webpack_share_scopes__", - "__webpack_init_sharing__", - "__webpack_require_module__", - "_stream_duplex", - "_stream_passthrough", - "_stream_readable", - "_stream_transform", - "_stream_writable", - "string_decoder" - ] - } - ], - "prefer-exponentiation-operator": "error", - "no-useless-return": "error", - "no-return-assign": "error", - "default-case-last": "error", - "default-param-last": "error", - "dot-notation": "error", - "grouped-accessor-pairs": "error", - "id-match": [ - "error", - "^[$a-zA-Z_][$a-zA-Z0-9_]*$", - { - properties: true - } - ], - "no-console": "error", - "no-extra-label": "error", - "no-label-var": "error", - "no-lone-blocks": "error", - "no-multi-str": "error", - "no-new-func": "error", - "no-unneeded-ternary": ["error", { defaultAssignment: false }], - "no-useless-call": "error", - "no-useless-concat": "error", - "prefer-object-spread": "error", - "prefer-regex-literals": "error", - "prefer-rest-params": "error", - "no-var": "error", - "one-var": ["error", "never"], - "prefer-template": "error", - "no-implicit-coercion": [ - "error", - { - boolean: true, - number: true, - string: true - } - ], - "arrow-body-style": ["error", "as-needed"], - "new-cap": [ - "error", - { - newIsCapExceptions: [], - capIsNewExceptions: ["A", "F", "D", "MODULES_GROUPERS"] - } - ], - "func-style": [ - "error", - "declaration", - { - allowArrowFunctions: true + destructuredArrayIgnorePattern: "^_", + ignoreRestSiblings: true, + ignoreClassWithStaticInitBlock: false, + reportUsedIgnorePattern: false } ], - "no-loop-func": "error", - "no-unreachable-loop": "error", - "no-unmodified-loop-condition": "error", - "prefer-spread": "error", - "no-sequences": "error", - // TODO Enable - "id-length": "off", - "prefer-destructuring": "off" + + // Too noise + "jsdoc/require-property-description": "off", + + // TODO enable me in future + "unicorn/prefer-regexp-test": "off", + "unicorn/prefer-string-slice": "off", + + // TODO false positive, need to fix in upstream + "n/prefer-node-protocol": "off", + "n/prefer-global/url": "off" } }, { - plugins: { - unicorn - }, - rules: { - "unicorn/catch-error-name": [ - "error", - { name: "err", ignore: [/(^_|[0-9]+$)/i] } - ], - "unicorn/prefer-includes": "error", - "unicorn/no-zero-fractions": "error", - "unicorn/prefer-string-starts-ends-with": "error", - "unicorn/prefer-default-parameters": "error", - "unicorn/prefer-negative-index": "error", - "unicorn/prefer-ternary": ["error", "only-single-line"], - "unicorn/prefer-array-find": "error", - "unicorn/no-lonely-if": "error", - "unicorn/no-hex-escape": "error", - "unicorn/escape-case": "error", - "unicorn/no-array-for-each": "error", - "unicorn/prefer-number-properties": "error", - "unicorn/prefer-native-coercion-functions": "error", - // TODO Enable - "unicorn/prefer-spread": "off" - } + files: ["lib/**/*.js"], + extends: [configs["webpack/special"]] }, { - plugins: { - "@stylistic": stylistic + files: ["bin/**/*.js"], + // Allow to use `dynamic` import + languageOptions: { + ecmaVersion: 2020 }, rules: { - "@stylistic/lines-between-class-members": "error", - "@stylistic/quotes": [ - "error", - "double", - { avoidEscape: true, allowTemplateLiterals: false } - ], - "@stylistic/spaced-comment": [ + "no-console": "off", + + // Allow to use `dynamic` import and hashbang + "n/no-unsupported-features/es-syntax": [ "error", - "always", { - line: { - markers: ["=", "!"], // Space here to support sprockets directives - exceptions: ["-", "+"] - }, - block: { - markers: ["=", "!"], // Space here to support sprockets directives - exceptions: ["-", "+"], - balanced: true - } + ignores: ["hashbang", "dynamic-import"] } ] } }, { - ...jsdocConfig, - settings: { - jsdoc: { - mode: "typescript", - // supported tags https://github.com/microsoft/TypeScript-wiki/blob/master/JSDoc-support-in-JavaScript.md - tagNamePreference: { - ...["memberof", "yields", "member"].reduce((acc, tag) => { - acc[tag] = { - message: `@${tag} currently not supported in TypeScript` - }; - return acc; - }, {}), - extends: "extends", - return: "returns", - constructor: "constructor", - prop: "property", - arg: "param", - augments: "extends", - description: false, - desc: false, - inheritdoc: false, - class: "constructor" - }, - overrideReplacesDocs: false + files: ["lib/**/*.runtime.js", "hot/*.js"], + extends: [configs["javascript/es5"]], + languageOptions: { + sourceType: "commonjs", + globals: { + ...globals.browser, + ...globals.es5, + Promise: false, + Map: false, + Set: false, + process: false } }, rules: { - ...jsdocConfig.rules, - // Override recommended - // - // Doesn't support function overloading/tuples/`readonly`/module keyword/etc - // Also `typescript` reports this itself - "jsdoc/valid-types": "off", - // A lot of false positive with loops/`switch`/`if`/etc - "jsdoc/require-returns-check": "off", - // TODO fix and enable in future - "jsdoc/require-property-description": "off", + strict: "off", - // More rules - "jsdoc/check-indentation": "error", - "jsdoc/check-line-alignment": ["error", "never"], - "jsdoc/require-asterisk-prefix": "error", - "jsdoc/require-hyphen-before-param-description": ["error", "never"], - "jsdoc/require-template": "error", - "jsdoc/no-bad-blocks": "error", - "jsdoc/no-blank-block-descriptions": "error", - "jsdoc/no-blank-blocks": "error", - "jsdoc/no-restricted-syntax": [ - "error", - { - contexts: [ - // Prefer TypeScript syntax for functions - { - comment: "JsdocBlock:has(JsdocTypeFunction[arrow=false])", - message: - "Please use TypeScript syntax - `(a: string, b: boolean) => number`" - }, - // Prefer `{string=}` over `{string} [arg]` - { - comment: - "JsdocBlock:has(JsdocTag[tag=/^(property|param)$/][name=/[\\[\\]]/])", - message: - "Please use `@property {string=} property`/`@param {string=} arg` instead `[arg]` for optional properties and parameters" - }, - // No `*` type - { - comment: "JsdocBlock:has(JsdocTypeAny)", - message: "Please use `any` or `EXPECTED_ANY` type." - }, - // No `?` type - { - comment: "JsdocBlock:has(JsdocTypeUnknown)", - message: "Please use `unknown` or `any` (or `EXPECTED_ANY`) type" - }, - // No `any` type - { - comment: "JsdocBlock:has(JsdocTypeName[value=/^any$/])", - message: "Please use provide types instead `any`" - }, - // No `Function` type - { - comment: - "JsdocBlock:has(JsdocTypeName[value=/^(function|Function)$/])", - message: - "Please use provide types for function - `(a: number, b: number) -> number` instead `Function`/`function` or use `EXPECTED_FUNCTION` type" - }, - // No `Object` - { - comment: - "JsdocBlock:has(JsdocTag[tag!=/^(typedef|template|param)$/]:has(JsdocTypeName[value=/^(Object|object)$/]))", - message: - "Please use provide types for object - `{ property: number:, result: () => number}` instead `Object`/`object` or use `EXPECTED_OBJECT` type" - }, - { - comment: - "JsdocBlock:has(JsdocTag[tag=typedef][parsedType.type!=JsdocTypeName]:has(JsdocTypeName[value=/^(Object|object)$/]))", - message: - "Please use provide types for object - `{ property: number:, result: () => number}` instead `Object`/`object` or use `EXPECTED_OBJECT` type" - } - ] - } - ] + "block-scoped-var": "off", + + // Allow logging + "no-console": "off", + + // We replace `$VAR$` on real code + "no-unused-vars": "off", + "no-undef-init": "off", + + "id-length": "off", + + "unicorn/no-array-for-each": "off", + "unicorn/prefer-includes": "off", + + "jsdoc/require-jsdoc": "off", + + // Revisit it in future + "no-use-before-define": "off", + "func-names": "off", + "func-style": "off" } }, { - ...jest.configs["flat/recommended"], - files: ["test/**/*.{js,cjs,mjs}"], - languageOptions: { - ecmaVersion: "latest", - globals: { - ...globals.jest, - nsObj: false - } - }, + files: ["test/**/*.js"], rules: { - ...jest.configs["flat/recommended"].rules, + // TODO enable me + strict: "off", + + // No need here, we have custom test logic, so except can be placed in different places "jest/no-standalone-expect": "off", - "jest/valid-title": [ - "error", - { - ignoreTypeOfDescribeName: true, - ignoreTypeOfTestName: true - } - ], - "jest/no-done-callback": "off", + + // We have a lot of custom tests "jest/expect-expect": "off", - "jest/no-conditional-expect": "off", - "no-console": "off", - "jsdoc/require-jsdoc": "off", - "n/no-unsupported-features/es-syntax": [ - "error", - { - version: ">=22", - ignores: [] - } - ], - "n/no-unsupported-features/es-builtins": [ - "error", - { - version: ">=22", - ignores: [] - } - ], - "n/no-unsupported-features/node-builtins": [ - "error", - { - allowExperimental: true, - version: ">=22", - ignores: [] - } - ] + + // We have a lot of custom tests + "jest/no-confusing-set-timeout": "off" } }, { - files: ["lib/**/*.runtime.js", "hot/*.js"], + files: ["test/helpers/**/*.{js,cjs,mjs}"], languageOptions: { - ecmaVersion: 5, globals: { - ...globals.browser, - ...globals.es5 + ...globals.jest } }, rules: { - "prefer-const": "off", - "object-shorthand": "off", - "no-undef-init": "off", - "no-var": "off", - "n/exports-style": "off", - "prefer-template": "off", - "no-implicit-coercion": "off", + "no-eval": "off", "no-console": "off", - "func-style": "off", - "unicorn/prefer-includes": "off", - "unicorn/no-useless-undefined": "off", - "unicorn/no-array-for-each": "off", - "jsdoc/require-jsdoc": "off" + + // Allow to use any builtins, syntax and node API in tests + "n/no-unsupported-features/es-builtins": "off", + "n/no-unsupported-features/es-syntax": "off", + "n/no-unsupported-features/node-builtins": "off" } }, { - files: ["bin/**/*.js"], - // Allow to use `dynamic` import + files: ["test/**/*.mjs"], languageOptions: { - ecmaVersion: 2020 - }, - rules: { - "no-console": "off", - "n/no-unsupported-features/es-syntax": [ - "error", - { - ignores: ["hashbang", "dynamic-import"] - } - ] + ecmaVersion: 2022 } }, { files: ["setup/**/*.js", "tooling/**/*.js"], - // Allow to use `dynamic` import languageOptions: { - ecmaVersion: 2020 + ecmaVersion: 2022 }, rules: { "no-console": "off" } }, + { + files: ["test/Compiler-filesystem-caching.test.js"], + languageOptions: { + ecmaVersion: 2022 + } + }, { files: [ "test/configCases/{dll-plugin-entry,dll-plugin-side-effects,dll-plugin}/**/webpack.config.js", "examples/**/*.js", - "test/NodeTemplatePlugin.test.js" + "test/NodeTemplatePlugin.test.js", + "test/PersistentCaching.test.js" ], rules: { - "n/no-missing-require": "off" - } - }, - { - ...prettierConfig, - plugins: { - ...prettierConfig.plugins, - prettier - }, - rules: { - ...prettierConfig.rules, - "prettier/prettier": "error" + "import/extensions": "off", + "import/no-unresolved": "off" } } ]); diff --git a/examples/aggressive-merging/webpack.config.js b/examples/aggressive-merging/webpack.config.js index b4b6e38eec1..02fd32d0e26 100644 --- a/examples/aggressive-merging/webpack.config.js +++ b/examples/aggressive-merging/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const { AggressiveMergingPlugin } = require("../..").optimize; diff --git a/examples/asset-advanced/webpack.config.js b/examples/asset-advanced/webpack.config.js index a607befdd0d..965c349f4a4 100644 --- a/examples/asset-advanced/webpack.config.js +++ b/examples/asset-advanced/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const svgToMiniDataURI = require("mini-svg-data-uri"); module.exports = { diff --git a/examples/asset-simple/webpack.config.js b/examples/asset-simple/webpack.config.js index 8b935943f63..3cb7cda8454 100644 --- a/examples/asset-simple/webpack.config.js +++ b/examples/asset-simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { assetModuleFilename: "images/[hash][ext]" diff --git a/examples/build-http/webpack.config.js b/examples/build-http/webpack.config.js index ca271913b30..6a550d07d67 100644 --- a/examples/build-http/webpack.config.js +++ b/examples/build-http/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // enable debug logging to see network requests! // stats: { diff --git a/examples/chunkhash/webpack.config.js b/examples/chunkhash/webpack.config.js index 727e187cf1b..999acac3a01 100644 --- a/examples/chunkhash/webpack.config.js +++ b/examples/chunkhash/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/cjs-tree-shaking/webpack.config.js b/examples/cjs-tree-shaking/webpack.config.js index b40c7be44d9..ded2aade239 100644 --- a/examples/cjs-tree-shaking/webpack.config.js +++ b/examples/cjs-tree-shaking/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = [ { entry: "./example.js", diff --git a/examples/code-splitted-require.context-amd/webpack.config.js b/examples/code-splitted-require.context-amd/webpack.config.js index 115df174878..dc38ee12eaf 100644 --- a/examples/code-splitted-require.context-amd/webpack.config.js +++ b/examples/code-splitted-require.context-amd/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "named" // To keep filename consistent between different modes (for example building only) diff --git a/examples/code-splitted-require.context/webpack.config.js b/examples/code-splitted-require.context/webpack.config.js index 115df174878..dc38ee12eaf 100644 --- a/examples/code-splitted-require.context/webpack.config.js +++ b/examples/code-splitted-require.context/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "named" // To keep filename consistent between different modes (for example building only) diff --git a/examples/code-splitting-bundle-loader/webpack.config.js b/examples/code-splitting-bundle-loader/webpack.config.js index 115df174878..dc38ee12eaf 100644 --- a/examples/code-splitting-bundle-loader/webpack.config.js +++ b/examples/code-splitting-bundle-loader/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "named" // To keep filename consistent between different modes (for example building only) diff --git a/examples/code-splitting-depend-on-advanced/webpack.config.js b/examples/code-splitting-depend-on-advanced/webpack.config.js index fc4b2b3347f..b0be020643e 100644 --- a/examples/code-splitting-depend-on-advanced/webpack.config.js +++ b/examples/code-splitting-depend-on-advanced/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { entry: { app: { import: "./app.js", dependOn: ["other-vendors"] }, diff --git a/examples/code-splitting-depend-on-simple/webpack.config.js b/examples/code-splitting-depend-on-simple/webpack.config.js index 1fd0ca0d2c9..8bc98eb680a 100644 --- a/examples/code-splitting-depend-on-simple/webpack.config.js +++ b/examples/code-splitting-depend-on-simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { entry: { app: { import: "./app.js", dependOn: ["react-vendors"] }, diff --git a/examples/code-splitting-harmony/webpack.config.js b/examples/code-splitting-harmony/webpack.config.js index 2ad01d570d6..c3c8be9ddb8 100644 --- a/examples/code-splitting-harmony/webpack.config.js +++ b/examples/code-splitting-harmony/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only) diff --git a/examples/code-splitting-native-import-context-filter/webpack.config.js b/examples/code-splitting-native-import-context-filter/webpack.config.js index 2ad01d570d6..c3c8be9ddb8 100644 --- a/examples/code-splitting-native-import-context-filter/webpack.config.js +++ b/examples/code-splitting-native-import-context-filter/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only) diff --git a/examples/code-splitting-native-import-context/webpack.config.js b/examples/code-splitting-native-import-context/webpack.config.js index 2ad01d570d6..c3c8be9ddb8 100644 --- a/examples/code-splitting-native-import-context/webpack.config.js +++ b/examples/code-splitting-native-import-context/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only) diff --git a/examples/code-splitting-specify-chunk-name/webpack.config.js b/examples/code-splitting-specify-chunk-name/webpack.config.js index 2ad01d570d6..c3c8be9ddb8 100644 --- a/examples/code-splitting-specify-chunk-name/webpack.config.js +++ b/examples/code-splitting-specify-chunk-name/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only) diff --git a/examples/code-splitting/webpack.config.js b/examples/code-splitting/webpack.config.js index 115df174878..dc38ee12eaf 100644 --- a/examples/code-splitting/webpack.config.js +++ b/examples/code-splitting/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "named" // To keep filename consistent between different modes (for example building only) diff --git a/examples/coffee-script/webpack.config.js b/examples/coffee-script/webpack.config.js index 91c59cf45a7..d647b68205b 100644 --- a/examples/coffee-script/webpack.config.js +++ b/examples/coffee-script/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", module: { diff --git a/examples/common-chunk-and-vendor-chunk/webpack.config.js b/examples/common-chunk-and-vendor-chunk/webpack.config.js index e28ea6b8f53..7b4257f2239 100644 --- a/examples/common-chunk-and-vendor-chunk/webpack.config.js +++ b/examples/common-chunk-and-vendor-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/common-chunk-grandchildren/webpack.config.js b/examples/common-chunk-grandchildren/webpack.config.js index 55aeb1408bf..7ab6386f9bf 100644 --- a/examples/common-chunk-grandchildren/webpack.config.js +++ b/examples/common-chunk-grandchildren/webpack.config.js @@ -1,4 +1,5 @@ "use strict"; + const path = require("path"); module.exports = { diff --git a/examples/css/webpack.config.js b/examples/css/webpack.config.js index 93ef7f910e6..c78441e2828 100644 --- a/examples/css/webpack.config.js +++ b/examples/css/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { uniqueName: "app" diff --git a/examples/custom-json-modules/webpack.config.js b/examples/custom-json-modules/webpack.config.js index 06d92d9232a..8fed42c5448 100644 --- a/examples/custom-json-modules/webpack.config.js +++ b/examples/custom-json-modules/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const toml = require("toml"); const json5 = require("json5"); const yaml = require("yamljs"); diff --git a/examples/dll-entry-only/webpack.config.js b/examples/dll-entry-only/webpack.config.js index 852f8b40949..7a08edb5fab 100644 --- a/examples/dll-entry-only/webpack.config.js +++ b/examples/dll-entry-only/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/dll-user/webpack.config.js b/examples/dll-user/webpack.config.js index d98aa4b32ea..23a7d2a627a 100644 --- a/examples/dll-user/webpack.config.js +++ b/examples/dll-user/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/dll/c.jsx b/examples/dll/c.jsx index c86e38d2a76..fff3c471d1d 100644 --- a/examples/dll/c.jsx +++ b/examples/dll/c.jsx @@ -1 +1 @@ -module.exports = "jsx"; \ No newline at end of file +module.exports = "jsx"; diff --git a/examples/dll/webpack.config.js b/examples/dll/webpack.config.js index 867b2cb05aa..1874fbf7e10 100644 --- a/examples/dll/webpack.config.js +++ b/examples/dll/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/explicit-vendor-chunk/webpack.config.js b/examples/explicit-vendor-chunk/webpack.config.js index 4f539f91ff1..ca35f56d533 100644 --- a/examples/explicit-vendor-chunk/webpack.config.js +++ b/examples/explicit-vendor-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/externals/webpack.config.js b/examples/externals/webpack.config.js index 6a9400effbd..7e310ee03b5 100644 --- a/examples/externals/webpack.config.js +++ b/examples/externals/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", output: { diff --git a/examples/extra-async-chunk-advanced/webpack.config.js b/examples/extra-async-chunk-advanced/webpack.config.js index bf11207f017..273d0366e13 100644 --- a/examples/extra-async-chunk-advanced/webpack.config.js +++ b/examples/extra-async-chunk-advanced/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", optimization: { diff --git a/examples/extra-async-chunk/webpack.config.js b/examples/extra-async-chunk/webpack.config.js index b9e09872147..53072973f86 100644 --- a/examples/extra-async-chunk/webpack.config.js +++ b/examples/extra-async-chunk/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", optimization: { diff --git a/examples/harmony-library/webpack.config.js b/examples/harmony-library/webpack.config.js index 05f74ffede1..76162c6d097 100644 --- a/examples/harmony-library/webpack.config.js +++ b/examples/harmony-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/harmony-unused/webpack.config.js b/examples/harmony-unused/webpack.config.js index f370f58a23b..4b0f2c53094 100644 --- a/examples/harmony-unused/webpack.config.js +++ b/examples/harmony-unused/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", optimization: { diff --git a/examples/harmony/webpack.config.js b/examples/harmony/webpack.config.js index 2ad01d570d6..c3c8be9ddb8 100644 --- a/examples/harmony/webpack.config.js +++ b/examples/harmony/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only) diff --git a/examples/http2-aggressive-splitting/webpack.config.js b/examples/http2-aggressive-splitting/webpack.config.js index 68af8ca20d9..2b8b99e3129 100644 --- a/examples/http2-aggressive-splitting/webpack.config.js +++ b/examples/http2-aggressive-splitting/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/hybrid-routing/webpack.config.js b/examples/hybrid-routing/webpack.config.js index a40cecc2e37..8b81fa45bce 100644 --- a/examples/hybrid-routing/webpack.config.js +++ b/examples/hybrid-routing/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/lazy-compilation/webpack.config.js b/examples/lazy-compilation/webpack.config.js index 5bde7f7cd6f..60a9658d7b4 100644 --- a/examples/lazy-compilation/webpack.config.js +++ b/examples/lazy-compilation/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const { HotModuleReplacementPlugin } = require("../../"); module.exports = { diff --git a/examples/loader/webpack.config.js b/examples/loader/webpack.config.js index b6d7cd8b90c..63f8dc4aee3 100644 --- a/examples/loader/webpack.config.js +++ b/examples/loader/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", module: { diff --git a/examples/many-pages/webpack.config.js b/examples/many-pages/webpack.config.js index 72b9ab5cdf1..bb3f6373c02 100644 --- a/examples/many-pages/webpack.config.js +++ b/examples/many-pages/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", entry: { diff --git a/examples/mixed/webpack.config.js b/examples/mixed/webpack.config.js index 115df174878..dc38ee12eaf 100644 --- a/examples/mixed/webpack.config.js +++ b/examples/mixed/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "named" // To keep filename consistent between different modes (for example building only) diff --git a/examples/module-code-splitting/webpack.config.js b/examples/module-code-splitting/webpack.config.js index f5141e5ff70..a266c010d04 100644 --- a/examples/module-code-splitting/webpack.config.js +++ b/examples/module-code-splitting/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { module: true, diff --git a/examples/module-federation/webpack.config.js b/examples/module-federation/webpack.config.js index 72f1e11ff3c..8a230fc1508 100644 --- a/examples/module-federation/webpack.config.js +++ b/examples/module-federation/webpack.config.js @@ -1,5 +1,8 @@ +"use strict"; + const path = require("path"); const { ModuleFederationPlugin } = require("../../").container; + const rules = [ { test: /\.js$/, @@ -22,6 +25,7 @@ const stats = { chunkModules: true, chunkOrigins: true }; + module.exports = (env = "development") => [ // For this example we have 3 configs in a single file // In practice you probably would have separate config diff --git a/examples/module-library/webpack.config.js b/examples/module-library/webpack.config.js index d7f45aa6917..138daa8df01 100644 --- a/examples/module-library/webpack.config.js +++ b/examples/module-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { module: true, diff --git a/examples/module-worker/webpack.config.js b/examples/module-worker/webpack.config.js index 7787a5113be..a22577adb97 100644 --- a/examples/module-worker/webpack.config.js +++ b/examples/module-worker/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/module/webpack.config.js b/examples/module/webpack.config.js index 0f10a6d3d39..bd581dbb945 100644 --- a/examples/module/webpack.config.js +++ b/examples/module/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { output: { module: true, diff --git a/examples/multi-compiler/webpack.config.js b/examples/multi-compiler/webpack.config.js index e7b01428c58..7e7a40e73b7 100644 --- a/examples/multi-compiler/webpack.config.js +++ b/examples/multi-compiler/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/multi-part-library/webpack.config.js b/examples/multi-part-library/webpack.config.js index 2d829643bcc..6209a0c1939 100644 --- a/examples/multi-part-library/webpack.config.js +++ b/examples/multi-part-library/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/multiple-entry-points/webpack.config.js b/examples/multiple-entry-points/webpack.config.js index 06451696a6e..7ba9f63b417 100644 --- a/examples/multiple-entry-points/webpack.config.js +++ b/examples/multiple-entry-points/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", entry: { diff --git a/examples/named-chunks/webpack.config.js b/examples/named-chunks/webpack.config.js index 0cb61065efb..bb27c633b0c 100644 --- a/examples/named-chunks/webpack.config.js +++ b/examples/named-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "named" diff --git a/examples/nodejs-addons/webpack.config.js b/examples/nodejs-addons/webpack.config.js index 57376a15bb4..eb574760bc6 100644 --- a/examples/nodejs-addons/webpack.config.js +++ b/examples/nodejs-addons/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", target: "node", diff --git a/examples/persistent-caching/webpack.config.js b/examples/persistent-caching/webpack.config.js index 9b7a46907b8..15d8507f531 100644 --- a/examples/persistent-caching/webpack.config.js +++ b/examples/persistent-caching/webpack.config.js @@ -1,4 +1,7 @@ +"use strict"; + const path = require("path"); + module.exports = (env = "development") => ({ mode: env, infrastructureLogging: { diff --git a/examples/reexport-components/webpack.config.js b/examples/reexport-components/webpack.config.js index 051c44201ec..954431715d2 100644 --- a/examples/reexport-components/webpack.config.js +++ b/examples/reexport-components/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/scope-hoisting/webpack.config.js b/examples/scope-hoisting/webpack.config.js index 45c19c752e2..b110b3dcde4 100644 --- a/examples/scope-hoisting/webpack.config.js +++ b/examples/scope-hoisting/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", optimization: { diff --git a/examples/side-effects/webpack.config.js b/examples/side-effects/webpack.config.js index 2bd35aa7c7e..b0c13f1425a 100644 --- a/examples/side-effects/webpack.config.js +++ b/examples/side-effects/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { sideEffects: true diff --git a/examples/source-map/webpack.config.js b/examples/source-map/webpack.config.js index effd0892118..6e3f83908f1 100644 --- a/examples/source-map/webpack.config.js +++ b/examples/source-map/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = [ diff --git a/examples/stats-detailed/webpack.config.js b/examples/stats-detailed/webpack.config.js index a237a81fc37..991bf51ee47 100644 --- a/examples/stats-detailed/webpack.config.js +++ b/examples/stats-detailed/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/stats-minimal/webpack.config.js b/examples/stats-minimal/webpack.config.js index 22fbf8330b2..93e906fdd73 100644 --- a/examples/stats-minimal/webpack.config.js +++ b/examples/stats-minimal/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/stats-none/webpack.config.js b/examples/stats-none/webpack.config.js index 8a687239693..41f75977e62 100644 --- a/examples/stats-none/webpack.config.js +++ b/examples/stats-none/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/stats-normal/webpack.config.js b/examples/stats-normal/webpack.config.js index e741993c8d9..6bd8497112b 100644 --- a/examples/stats-normal/webpack.config.js +++ b/examples/stats-normal/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/stats-summary/webpack.config.js b/examples/stats-summary/webpack.config.js index 94e9a0f0b2d..1cc03fb1f41 100644 --- a/examples/stats-summary/webpack.config.js +++ b/examples/stats-summary/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/top-level-await/webpack.config.js b/examples/top-level-await/webpack.config.js index 115df174878..dc38ee12eaf 100644 --- a/examples/top-level-await/webpack.config.js +++ b/examples/top-level-await/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { optimization: { chunkIds: "named" // To keep filename consistent between different modes (for example building only) diff --git a/examples/two-explicit-vendor-chunks/webpack.config.js b/examples/two-explicit-vendor-chunks/webpack.config.js index f1c79238e54..875b5d53be8 100644 --- a/examples/two-explicit-vendor-chunks/webpack.config.js +++ b/examples/two-explicit-vendor-chunks/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/typescript/webpack.config.js b/examples/typescript/webpack.config.js index b33a1ed24e6..33899b9f3ce 100644 --- a/examples/typescript/webpack.config.js +++ b/examples/typescript/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); module.exports = (env = "development") => ({ diff --git a/examples/wasm-bindgen-esm/pkg/package.json b/examples/wasm-bindgen-esm/pkg/package.json index abdb287b0be..88b55d22fbe 100644 --- a/examples/wasm-bindgen-esm/pkg/package.json +++ b/examples/wasm-bindgen-esm/pkg/package.json @@ -1,14 +1,14 @@ { "name": "hi-wasm", - "type": "module", "version": "0.1.0", + "sideEffects": false, + "type": "module", + "main": "hi_wasm.js", + "types": "hi_wasm.d.ts", "files": [ "hi_wasm_bg.wasm", "hi_wasm.js", "hi_wasm_bg.js", "hi_wasm.d.ts" - ], - "main": "hi_wasm.js", - "types": "hi_wasm.d.ts", - "sideEffects": false + ] } diff --git a/examples/wasm-bindgen-esm/webpack.config.js b/examples/wasm-bindgen-esm/webpack.config.js index 70ba131d8c3..599502e921b 100644 --- a/examples/wasm-bindgen-esm/webpack.config.js +++ b/examples/wasm-bindgen-esm/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development || "production", output: { diff --git a/examples/wasm-complex/webpack.config.js b/examples/wasm-complex/webpack.config.js index 13de5cdac2f..66dd7386705 100644 --- a/examples/wasm-complex/webpack.config.js +++ b/examples/wasm-complex/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", output: { diff --git a/examples/wasm-simple/webpack.config.js b/examples/wasm-simple/webpack.config.js index 990ea91fc6f..a36ee8e32eb 100644 --- a/examples/wasm-simple/webpack.config.js +++ b/examples/wasm-simple/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { // mode: "development" || "production", output: { diff --git a/examples/worker/webpack.config.js b/examples/worker/webpack.config.js index 40032472184..369b1adb050 100644 --- a/examples/worker/webpack.config.js +++ b/examples/worker/webpack.config.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); module.exports = { diff --git a/generate-types-config.js b/generate-types-config.js index b1a47a8285e..a3ce7af1250 100644 --- a/generate-types-config.js +++ b/generate-types-config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { nameMapping: { FsStats: /^Stats Import fs/, diff --git a/hot/log.js b/hot/log.js index 63758822ae6..d3e46e1bf86 100644 --- a/hot/log.js +++ b/hot/log.js @@ -45,6 +45,21 @@ module.exports = function (level, msg) { } }; +/** + * @param {Error} err error + * @returns {string} formatted error + */ +module.exports.formatError = function (err) { + var message = err.message; + var stack = err.stack; + if (!stack) { + return message; + } else if (stack.indexOf(message) < 0) { + return message + "\n" + stack; + } + return stack; +}; + var group = console.group || dummy; var groupCollapsed = console.groupCollapsed || dummy; var groupEnd = console.groupEnd || dummy; @@ -61,18 +76,3 @@ module.exports.groupEnd = logGroup(groupEnd); module.exports.setLogLevel = function (level) { logLevel = level; }; - -/** - * @param {Error} err error - * @returns {string} formatted error - */ -module.exports.formatError = function (err) { - var message = err.message; - var stack = err.stack; - if (!stack) { - return message; - } else if (stack.indexOf(message) < 0) { - return message + "\n" + stack; - } - return stack; -}; diff --git a/hot/poll.js b/hot/poll.js index b87c2525944..a35693cfa6f 100644 --- a/hot/poll.js +++ b/hot/poll.js @@ -4,6 +4,7 @@ */ /* globals __resourceQuery */ if (module.hot) { + // eslint-disable-next-line no-implicit-coercion var hotPollInterval = +__resourceQuery.slice(1) || 10 * 60 * 1000; var log = require("./log"); diff --git a/jest.config.js b/jest.config.js index 2cc6d151b2e..e5421966ba0 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,3 +1,5 @@ +"use strict"; + /** @type {import('jest').Config} */ const config = { prettierPath: require.resolve("prettier-2"), diff --git a/lib/AbstractMethodError.js b/lib/AbstractMethodError.js index 7a9d2f992b4..527d224a473 100644 --- a/lib/AbstractMethodError.js +++ b/lib/AbstractMethodError.js @@ -6,6 +6,7 @@ "use strict"; const WebpackError = require("./WebpackError"); + const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/; /** diff --git a/lib/AutomaticPrefetchPlugin.js b/lib/AutomaticPrefetchPlugin.js index 05eb99b5ad4..b0926614e69 100644 --- a/lib/AutomaticPrefetchPlugin.js +++ b/lib/AutomaticPrefetchPlugin.js @@ -62,4 +62,5 @@ class AutomaticPrefetchPlugin { }); } } + module.exports = AutomaticPrefetchPlugin; diff --git a/lib/BannerPlugin.js b/lib/BannerPlugin.js index 4409c8b8ec0..22ec021f6b9 100644 --- a/lib/BannerPlugin.js +++ b/lib/BannerPlugin.js @@ -20,7 +20,7 @@ const createSchemaValidation = require("./util/create-schema-validation"); const validate = createSchemaValidation( /** @type {((value: typeof import("../schemas/plugins/BannerPlugin.json")) => boolean)} */ - (require("../schemas/plugins/BannerPlugin.check.js")), + (require("../schemas/plugins/BannerPlugin.check")), () => require("../schemas/plugins/BannerPlugin.json"), { name: "Banner Plugin", diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js index 3096d89d41b..1c62adcff63 100644 --- a/lib/ChunkGraph.js +++ b/lib/ChunkGraph.js @@ -420,8 +420,9 @@ class ChunkGraph { */ attachDependentHashModules(chunk, modules) { const cgc = this._getChunkGraphChunk(chunk); - if (cgc.dependentHashModules === undefined) + if (cgc.dependentHashModules === undefined) { cgc.dependentHashModules = new Set(); + } for (const module of modules) { cgc.dependentHashModules.add(module); } @@ -1117,8 +1118,9 @@ class ChunkGraph { */ addDependentHashModuleToChunk(chunk, module) { const cgc = this._getChunkGraphChunk(chunk); - if (cgc.dependentHashModules === undefined) + if (cgc.dependentHashModules === undefined) { cgc.dependentHashModules = new Set(); + } cgc.dependentHashModules.add(module); } @@ -1646,8 +1648,9 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza const module = connection.module; stateInfo += module.getExportsType(this.moduleGraph, strict); // cspell:word Tnamespace - if (stateInfo === "Tnamespace") activeNamespaceModules.add(module); - else { + if (stateInfo === "Tnamespace") { + activeNamespaceModules.add(module); + } else { const oldModule = connectedModules.get(stateInfo); if (oldModule === undefined) { connectedModules.set(stateInfo, module); @@ -1687,8 +1690,9 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza } } // cspell:word Tnamespace - if (activeNamespaceModules.size === 0 && connectedModules.size === 0) + if (activeNamespaceModules.size === 0 && connectedModules.size === 0) { return graphHash; + } const connectedModulesInOrder = connectedModules.size > 1 ? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1)) @@ -1712,22 +1716,21 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza const addModulesToHash = modules => { let xor = ZERO_BIG_INT; for (const m of modules) { - xor = - xor ^ - this._getModuleGraphHashBigInt( - this._getChunkGraphModule(m), - m, - runtime - ); + xor ^= this._getModuleGraphHashBigInt( + this._getChunkGraphModule(m), + m, + runtime + ); } hash.update(xor.toString(16)); }; - if (activeNamespaceModules.size === 1) + if (activeNamespaceModules.size === 1) { addModuleToHash( /** @type {Module} */ (activeNamespaceModules.values().next().value) ); - else if (activeNamespaceModules.size > 1) + } else if (activeNamespaceModules.size > 1) { addModulesToHash(activeNamespaceModules); + } for (const [stateInfo, modules] of connectedModulesInOrder) { hash.update(stateInfo); if (modules instanceof Set) { @@ -1767,12 +1770,13 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza */ module => { const chunkGraph = chunkGraphForModuleMap.get(module); - if (!chunkGraph) + if (!chunkGraph) { throw new Error( `${ deprecateMessage }: There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)` ); + } return chunkGraph; }, `${deprecateMessage}: Use new ChunkGraph API`, @@ -1818,12 +1822,13 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza */ chunk => { const chunkGraph = chunkGraphForChunkMap.get(chunk); - if (!chunkGraph) + if (!chunkGraph) { throw new Error( `${ deprecateMessage }There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)` ); + } return chunkGraph; }, `${deprecateMessage}: Use new ChunkGraph API`, diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js index 9e610d6b30e..e5e806adf97 100644 --- a/lib/CleanPlugin.js +++ b/lib/CleanPlugin.js @@ -37,6 +37,7 @@ const validate = createSchemaValidation( undefined, () => { const { definitions } = require("../schemas/WebpackOptions.json"); + return { definitions, oneOf: [{ $ref: "#/definitions/CleanOptions" }] diff --git a/lib/CompatibilityPlugin.js b/lib/CompatibilityPlugin.js index 05cdeece6c3..759d6a8c534 100644 --- a/lib/CompatibilityPlugin.js +++ b/lib/CompatibilityPlugin.js @@ -44,8 +44,9 @@ class CompatibilityPlugin { if ( parserOptions.browserify !== undefined && !parserOptions.browserify - ) + ) { return; + } parser.hooks.call.for("require").tap( PLUGIN_NAME, @@ -75,8 +76,9 @@ class CompatibilityPlugin { last.options.request === "." && last.userRequest === "." && last.options.recursive - ) + ) { parser.state.current.dependencies.pop(); + } } parser.state.module.addPresentationalDependency(dep); return true; @@ -191,4 +193,5 @@ class CompatibilityPlugin { ); } } + module.exports = CompatibilityPlugin; diff --git a/lib/Compilation.js b/lib/Compilation.js index 02309fdb597..9ddba3b929e 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -530,8 +530,9 @@ class Compilation { if ( /** @type {ProcessedAssets} */ (processedAssets).has(this.assets) - ) + ) { additionalAssetsFn(assets); + } }); } return { @@ -548,8 +549,9 @@ class Compilation { } catch (err) { return callback(/** @type {Error} */ (err)); } - if (processedAssets !== undefined) + if (processedAssets !== undefined) { processedAssets.add(this.assets); + } const newAssets = popNewAssets(assets); if (newAssets !== undefined) { this.hooks.processAdditionalAssets.callAsync( @@ -569,8 +571,9 @@ class Compilation { if ( /** @type {ProcessedAssets} */ (processedAssets).has(this.assets) - ) + ) { return additionalAssetsFn(assets, callback); + } callback(); } ); @@ -591,8 +594,9 @@ class Compilation { */ err => { if (err) return callback(err); - if (processedAssets !== undefined) + if (processedAssets !== undefined) { processedAssets.add(this.assets); + } const newAssets = popNewAssets(assets); if (newAssets !== undefined) { this.hooks.processAdditionalAssets.callAsync( @@ -612,8 +616,9 @@ class Compilation { if ( /** @type {ProcessedAssets} */ (processedAssets).has(this.assets) - ) + ) { return additionalAssetsFn(assets); + } return Promise.resolve(); }); } @@ -627,8 +632,9 @@ class Compilation { const p = fn(assets); if (!p || !p.then) return p; return p.then(() => { - if (processedAssets !== undefined) + if (processedAssets !== undefined) { processedAssets.add(this.assets); + } const newAssets = popNewAssets(assets); if (newAssets !== undefined) { return this.hooks.processAdditionalAssets.promise( @@ -1231,7 +1237,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si // properties in the prototype chain /** @type {Partial} */ const options = {}; - // eslint-disable-next-line guard-for-in for (const key in optionsOrPreset) { options[key] = optionsOrPreset[/** @type {keyof StatsOptions} */ (key)]; } @@ -1444,8 +1449,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } this._modules.set(identifier, module); this.modules.add(module); - if (this._backCompat) + if (this._backCompat) { ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); + } if (currentProfile !== undefined) { currentProfile.markIntegrationEnd(); } @@ -1738,8 +1744,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si inProgressTransitive = -1; onTransitiveTasksFinished(err); } - if (--inProgressTransitive === 0) + if (--inProgressTransitive === 0) { return onTransitiveTasksFinished(); + } } ); if (--inProgressSorting === 0) onDependenciesSorted(); @@ -1890,8 +1897,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this._modules.set(module.identifier(), module); this.modules.add(module); - if (this._backCompat) + if (this._backCompat) { ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); + } this._handleModuleBuildAndDependencies( originModule, @@ -2782,7 +2790,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.factorizeQueue.clear(); if (this.profile) { this.logger.time("finish module profiles"); + const ParallelismFactorCalculator = require("./util/ParallelismFactorCalculator"); + const p = new ParallelismFactorCalculator(); const moduleGraph = this.moduleGraph; /** @type {Map} */ @@ -3455,8 +3465,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } } - if (this.reportDependencyErrorsAndWarnings(module, block.blocks)) + if (this.reportDependencyErrorsAndWarnings(module, block.blocks)) { hasProblems = true; + } } return hasProblems; } @@ -3841,8 +3852,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o */ addRuntimeModule(chunk, module, chunkGraph = this.chunkGraph) { // Deprecated ModuleGraph association - if (this._backCompat) + if (this._backCompat) { ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); + } // add it to the list this.modules.add(module); @@ -3914,7 +3926,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } } const chunkGroup = new ChunkGroup(groupOptions); - if (module) + if (module) { chunkGroup.addOrigin( module, /** @type {DependencyLocation} */ @@ -3922,6 +3934,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o /** @type {string} */ (request) ); + } const chunk = this.addChunk(name); connectChunkGroupAndChunk(chunkGroup, chunk); @@ -3991,8 +4004,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } const chunk = new Chunk(name, this._backCompat); this.chunks.add(chunk); - if (this._backCompat) + if (this._backCompat) { ChunkGraph.setChunkGraphForChunk(chunk, this.chunkGraph); + } if (name) { this.namedChunks.set(name, chunk); } @@ -4772,7 +4786,9 @@ This prevents using hashes of each other and should be avoided.`); newEntry = entry.map(x => (x === file ? newFile : x)); } else if (entry === file) { newEntry = newFile; - } else continue; + } else { + continue; + } this.assetsInfo.set(name, { ...info, related: { @@ -5500,6 +5516,7 @@ This prevents using hashes of each other and should be avoided.`); (moduleArgumentsMap.get(runtimeModule)) ); } + exports = __webpack_require__(module.identifier()); } catch (execErr) { const { message, stack, module } = diff --git a/lib/Compiler.js b/lib/Compiler.js index 8211a867bae..b6a893fb9ab 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -1167,7 +1167,7 @@ ${other}`); try { this.records = parseJson( - /** @type {Buffer} */ (content).toString("utf-8") + /** @type {Buffer} */ (content).toString("utf8") ); } catch (parseErr) { return callback( diff --git a/lib/ConcatenationScope.js b/lib/ConcatenationScope.js index 51f1e510ecb..76b0a1dde56 100644 --- a/lib/ConcatenationScope.js +++ b/lib/ConcatenationScope.js @@ -109,7 +109,7 @@ class ConcatenationScope { ? "_asiSafe0" : ""; const exportData = ids - ? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex") + ? Buffer.from(JSON.stringify(ids), "utf8").toString("hex") : "ns"; // a "._" is appended to allow "delete ...", which would cause a SyntaxError in strict mode return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${deferredImportFlag}${asiSafeFlag}__._`; @@ -137,7 +137,7 @@ class ConcatenationScope { ids: match[2] === "ns" ? [] - : JSON.parse(Buffer.from(match[2], "hex").toString("utf-8")), + : JSON.parse(Buffer.from(match[2], "hex").toString("utf8")), call: Boolean(match[3]), directImport: Boolean(match[4]), deferredImport: Boolean(match[5]), diff --git a/lib/ConstPlugin.js b/lib/ConstPlugin.js index 2950799b6b1..9912fd808a0 100644 --- a/lib/ConstPlugin.js +++ b/lib/ConstPlugin.js @@ -189,8 +189,9 @@ class ConstPlugin { parser.scope.isAsmJs || // Check top level scope here again parser.scope.topLevelScope === true - ) + ) { return; + } this.eliminateUnusedStatement(parser, statement); return true; }); diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 44711c4e314..011ac40329d 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -412,8 +412,9 @@ class ContextModule extends Module { const buildInfo = /** @type {BuildInfo} */ (this.buildInfo); // always build when we have no snapshot and context - if (!buildInfo.snapshot) + if (!buildInfo.snapshot) { return callback(null, Boolean(this.context || this.options.resource)); + } fileSystemInfo.checkSnapshotValid(buildInfo.snapshot, (err, valid) => { callback(err, !valid); @@ -1188,9 +1189,11 @@ module.exports = webpackEmptyAsyncContext;`; this.dependencies.length > 0 ? /** @type {ContextElementDependency[]} */ (this.dependencies).slice() : []; - for (const block of this.blocks) - for (const dep of block.dependencies) + for (const block of this.blocks) { + for (const dep of block.dependencies) { allDeps.push(/** @type {ContextElementDependency} */ (dep)); + } + } set.add(RuntimeGlobals.module); set.add(RuntimeGlobals.hasOwnProperty); if (allDeps.length > 0) { diff --git a/lib/ContextModuleFactory.js b/lib/ContextModuleFactory.js index 65543b5cd61..00359846771 100644 --- a/lib/ContextModuleFactory.js +++ b/lib/ContextModuleFactory.js @@ -344,8 +344,9 @@ module.exports = class ContextModuleFactory extends ModuleFactory { const processedFiles = cmf.hooks.contextModuleFiles.call( /** @type {string[]} */ (files).map(file => file.normalize("NFC")) ); - if (!processedFiles || processedFiles.length === 0) + if (!processedFiles || processedFiles.length === 0) { return callback(null, []); + } asyncLib.map( processedFiles.filter(p => p.indexOf(".") !== 0), (segment, callback) => { diff --git a/lib/DefinePlugin.js b/lib/DefinePlugin.js index 8bc028df3b4..438b91e95bd 100644 --- a/lib/DefinePlugin.js +++ b/lib/DefinePlugin.js @@ -388,8 +388,9 @@ class DefinePlugin { const buildInfo = /** @type {BuildInfo} */ ( parser.state.module.buildInfo ); - if (!buildInfo.valueDependencies) + if (!buildInfo.valueDependencies) { buildInfo.valueDependencies = new Map(); + } buildInfo.valueDependencies.set(VALUE_DEP_MAIN, mainValue); }); @@ -717,4 +718,5 @@ class DefinePlugin { ); } } + module.exports = DefinePlugin; diff --git a/lib/DelegatedModuleFactoryPlugin.js b/lib/DelegatedModuleFactoryPlugin.js index ea9ae3ac0fc..c12c27bd9d2 100644 --- a/lib/DelegatedModuleFactoryPlugin.js +++ b/lib/DelegatedModuleFactoryPlugin.js @@ -110,4 +110,5 @@ class DelegatedModuleFactoryPlugin { } } } + module.exports = DelegatedModuleFactoryPlugin; diff --git a/lib/DependencyTemplate.js b/lib/DependencyTemplate.js index 8402ade157e..a898659439e 100644 --- a/lib/DependencyTemplate.js +++ b/lib/DependencyTemplate.js @@ -62,6 +62,7 @@ class DependencyTemplate { */ apply(dependency, source, templateContext) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } } diff --git a/lib/DllPlugin.js b/lib/DllPlugin.js index cb034431c08..d23c2acba57 100644 --- a/lib/DllPlugin.js +++ b/lib/DllPlugin.js @@ -16,7 +16,7 @@ const createSchemaValidation = require("./util/create-schema-validation"); /** @typedef {import("./DllEntryPlugin").Options} Options */ const validate = createSchemaValidation( - require("../schemas/plugins/DllPlugin.check.js"), + require("../schemas/plugins/DllPlugin.check"), () => require("../schemas/plugins/DllPlugin.json"), { name: "Dll Plugin", diff --git a/lib/DllReferencePlugin.js b/lib/DllReferencePlugin.js index 1325ec51361..0cec5bdcf62 100644 --- a/lib/DllReferencePlugin.js +++ b/lib/DllReferencePlugin.js @@ -22,7 +22,7 @@ const makePathsRelative = require("./util/identifier").makePathsRelative; /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ const validate = createSchemaValidation( - require("../schemas/plugins/DllReferencePlugin.check.js"), + require("../schemas/plugins/DllReferencePlugin.check"), () => require("../schemas/plugins/DllReferencePlugin.json"), { name: "Dll Reference Plugin", @@ -78,7 +78,7 @@ class DllReferencePlugin { // or malformed manifest files don't kill the process. try { data.data = parseJson( - /** @type {Buffer} */ (result).toString("utf-8") + /** @type {Buffer} */ (result).toString("utf8") ); } catch (parseErr) { // Store the error in the params so that it can diff --git a/lib/EntryOptionPlugin.js b/lib/EntryOptionPlugin.js index 25f9d5c1ded..f2ce504f54b 100644 --- a/lib/EntryOptionPlugin.js +++ b/lib/EntryOptionPlugin.js @@ -33,9 +33,11 @@ class EntryOptionPlugin { static applyEntryOption(compiler, context, entry) { if (typeof entry === "function") { const DynamicEntryPlugin = require("./DynamicEntryPlugin"); + new DynamicEntryPlugin(context, entry).apply(compiler); } else { const EntryPlugin = require("./EntryPlugin"); + for (const name of Object.keys(entry)) { const desc = entry[name]; const options = EntryOptionPlugin.entryDescriptionToOptions( @@ -81,14 +83,17 @@ class EntryOptionPlugin { } if (desc.chunkLoading) { const EnableChunkLoadingPlugin = require("./javascript/EnableChunkLoadingPlugin"); + EnableChunkLoadingPlugin.checkEnabled(compiler, desc.chunkLoading); } if (desc.wasmLoading) { const EnableWasmLoadingPlugin = require("./wasm/EnableWasmLoadingPlugin"); + EnableWasmLoadingPlugin.checkEnabled(compiler, desc.wasmLoading); } if (desc.library) { const EnableLibraryPlugin = require("./library/EnableLibraryPlugin"); + EnableLibraryPlugin.checkEnabled(compiler, desc.library.type); } return options; diff --git a/lib/ExportsInfo.js b/lib/ExportsInfo.js index 4289983be2f..e87d99b98c1 100644 --- a/lib/ExportsInfo.js +++ b/lib/ExportsInfo.js @@ -159,8 +159,9 @@ class ExportsInfo { * @returns {ExportInfo} the export info of unlisted exports */ get otherExportsInfo() { - if (this._redirectTo !== undefined) + if (this._redirectTo !== undefined) { return this._redirectTo.otherExportsInfo; + } return this._otherExportsInfo; } @@ -259,8 +260,9 @@ class ExportsInfo { getExportInfo(name) { const info = this._exports.get(name); if (info !== undefined) return info; - if (this._redirectTo !== undefined) + if (this._redirectTo !== undefined) { return this._redirectTo.getExportInfo(name); + } const newInfo = new ExportInfo(name, this._otherExportsInfo); this._exports.set(name, newInfo); this._exportsAreOrdered = false; @@ -274,8 +276,9 @@ class ExportsInfo { getReadOnlyExportInfo(name) { const info = this._exports.get(name); if (info !== undefined) return info; - if (this._redirectTo !== undefined) + if (this._redirectTo !== undefined) { return this._redirectTo.getReadOnlyExportInfo(name); + } return this._otherExportsInfo; } @@ -494,8 +497,9 @@ class ExportsInfo { */ isModuleUsed(runtime) { if (this.isUsed(runtime)) return true; - if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused) + if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused) { return true; + } return false; } @@ -671,8 +675,9 @@ class ExportsInfo { return false; } for (const exportInfo of this.ownedExports) { - if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB)) + if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB)) { return false; + } } return true; } @@ -1294,8 +1299,9 @@ class ExportInfo { _getMaxTarget() { if (this._maxTarget !== undefined) return this._maxTarget; - if (/** @type {Target} */ (this._target).size <= 1) + if (/** @type {Target} */ (this._target).size <= 1) { return (this._maxTarget = this._target); + } let maxPriority = -Infinity; let minPriority = Infinity; for (const { priority } of /** @type {Target} */ (this._target).values()) { @@ -1472,8 +1478,9 @@ class ExportInfo { if ( target.export && !equals(/** @type {ArrayLike} */ (t.export), target.export) - ) + ) { return; + } result = values.next(); } return target; @@ -1521,8 +1528,9 @@ class ExportInfo { * @returns {ExportsInfo} an exports info */ createNestedExportsInfo() { - if (this.exportsInfoOwned) + if (this.exportsInfoOwned) { return /** @type {ExportsInfo} */ (this.exportsInfo); + } this.exportsInfoOwned = true; const oldExportsInfo = this.exportsInfo; this.exportsInfo = new ExportsInfo(); diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index e6777b65eb9..81d71f32ecb 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -352,8 +352,9 @@ const getSourceForModuleExternal = ( runtimeTemplate, dependencyMeta ) => { - if (!Array.isArray(moduleAndSpecifiers)) + if (!Array.isArray(moduleAndSpecifiers)) { moduleAndSpecifiers = [moduleAndSpecifiers]; + } const initFragment = new ModuleExternalInitFragment( moduleAndSpecifiers[0], undefined, @@ -683,8 +684,9 @@ class ExternalModule extends Module { _getRequestAndExternalType() { let { request, externalType } = this; - if (typeof request === "object" && !Array.isArray(request)) + if (typeof request === "object" && !Array.isArray(request)) { request = request[externalType]; + } externalType = this._resolveExternalType(externalType); return { request, externalType }; } @@ -900,8 +902,9 @@ class ExternalModule extends Module { ); let sourceString = sourceData.expression; - if (sourceData.iife) + if (sourceData.iife) { sourceString = `(function() { return ${sourceString}; }())`; + } if (concatenationScope) { sourceString = `${ runtimeTemplate.supportsConst() ? "const" : "var" @@ -912,8 +915,9 @@ class ExternalModule extends Module { } else { sourceString = `module.exports = ${sourceString};`; } - if (sourceData.init) + if (sourceData.init) { sourceString = `${sourceData.init}\n${sourceString}`; + } let data; if (sourceData.chunkInitFragments) { diff --git a/lib/ExternalModuleFactoryPlugin.js b/lib/ExternalModuleFactoryPlugin.js index 5fbf114ddde..5517ffb3d26 100644 --- a/lib/ExternalModuleFactoryPlugin.js +++ b/lib/ExternalModuleFactoryPlugin.js @@ -337,4 +337,5 @@ class ExternalModuleFactoryPlugin { ); } } + module.exports = ExternalModuleFactoryPlugin; diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index dfebcf0c4f2..b15951a633b 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -313,7 +313,7 @@ class Snapshot { * @param {number} value start value */ setStartTime(value) { - this._flags = this._flags | 1; + this._flags |= 1; this.startTime = value; } @@ -350,7 +350,7 @@ class Snapshot { * @param {FileTimestamps} value file timestamps */ setFileTimestamps(value) { - this._flags = this._flags | 2; + this._flags |= 2; this.fileTimestamps = value; } @@ -362,7 +362,7 @@ class Snapshot { * @param {FileHashes} value file hashes */ setFileHashes(value) { - this._flags = this._flags | 4; + this._flags |= 4; this.fileHashes = value; } @@ -374,7 +374,7 @@ class Snapshot { * @param {FileTshs} value file tshs */ setFileTshs(value) { - this._flags = this._flags | 8; + this._flags |= 8; this.fileTshs = value; } @@ -386,7 +386,7 @@ class Snapshot { * @param {ContextTimestamps} value context timestamps */ setContextTimestamps(value) { - this._flags = this._flags | 0x10; + this._flags |= 0x10; this.contextTimestamps = value; } @@ -398,7 +398,7 @@ class Snapshot { * @param {ContextHashes} value context hashes */ setContextHashes(value) { - this._flags = this._flags | 0x20; + this._flags |= 0x20; this.contextHashes = value; } @@ -410,7 +410,7 @@ class Snapshot { * @param {ContextTshs} value context tshs */ setContextTshs(value) { - this._flags = this._flags | 0x40; + this._flags |= 0x40; this.contextTshs = value; } @@ -422,7 +422,7 @@ class Snapshot { * @param {MissingExistence} value context tshs */ setMissingExistence(value) { - this._flags = this._flags | 0x80; + this._flags |= 0x80; this.missingExistence = value; } @@ -434,7 +434,7 @@ class Snapshot { * @param {ManagedItemInfo} value managed item info */ setManagedItemInfo(value) { - this._flags = this._flags | 0x100; + this._flags |= 0x100; this.managedItemInfo = value; } @@ -446,7 +446,7 @@ class Snapshot { * @param {ManagedFiles} value managed files */ setManagedFiles(value) { - this._flags = this._flags | 0x200; + this._flags |= 0x200; this.managedFiles = value; } @@ -458,7 +458,7 @@ class Snapshot { * @param {ManagedContexts} value managed contexts */ setManagedContexts(value) { - this._flags = this._flags | 0x400; + this._flags |= 0x400; this.managedContexts = value; } @@ -470,7 +470,7 @@ class Snapshot { * @param {ManagedMissing} value managed missing */ setManagedMissing(value) { - this._flags = this._flags | 0x800; + this._flags |= 0x800; this.managedMissing = value; } @@ -482,7 +482,7 @@ class Snapshot { * @param {Children} value children */ setChildren(value) { - this._flags = this._flags | 0x1000; + this._flags |= 0x1000; this.children = value; } @@ -792,8 +792,9 @@ class SnapshotOptimization { snapshotContent: new Set(commonMap.keys()), children: undefined }; - if (optimizationEntry.children === undefined) + if (optimizationEntry.children === undefined) { optimizationEntry.children = new Set(); + } optimizationEntry.children.add(newEntry); storeOptimizationEntry(newEntry); this._statSharedSnapshots++; @@ -872,8 +873,9 @@ class SnapshotOptimization { * @returns {string} result */ const parseString = str => { - if (str[0] === "'" || str[0] === "`") + if (str[0] === "'" || str[0] === "`") { str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`; + } return JSON.parse(str); }; @@ -1475,16 +1477,18 @@ class FileSystemInfo { const cache = this._contextHashes.get(path); if (cache !== undefined) { const resolved = getResolvedHash(cache); - if (resolved !== undefined) + if (resolved !== undefined) { return callback(null, /** @type {string} */ (resolved)); + } return this._resolveContextHash(cache, callback); } this.contextHashQueue.add(path, (err, _entry) => { if (err) return callback(err); const entry = /** @type {ContextHash} */ (_entry); const resolved = getResolvedHash(entry); - if (resolved !== undefined) + if (resolved !== undefined) { return callback(null, /** @type {string} */ (resolved)); + } this._resolveContextHash(entry, callback); }); } @@ -1893,8 +1897,9 @@ class FileSystemInfo { }); } let request = subPath.replace(/\\/g, "/"); - if (request.endsWith(".js")) + if (request.endsWith(".js")) { request = request.slice(0, -3); + } push({ type: RBDT_RESOLVE_CJS_FILE_AS_CHILD, context, @@ -1929,7 +1934,9 @@ class FileSystemInfo { ); this._warnAboutExperimentalEsmTracking = true; } + const lexer = require("es-module-lexer"); + lexer.init.then(() => { this.fs.readFile(path, (err, content) => { if (err) return callback(err); @@ -2025,7 +2032,8 @@ class FileSystemInfo { let packageData; try { packageData = JSON.parse( - /** @type {Buffer} */ (content).toString("utf-8") + /** @type {Buffer} */ + (content).toString("utf8") ); } catch (parseErr) { return callback(/** @type {Error} */ (parseErr)); @@ -2099,8 +2107,9 @@ class FileSystemInfo { switch (type) { case "d": resolveContext(context, path, {}, (err, _, result) => { - if (expectedResult === false) + if (expectedResult === false) { return callback(err ? undefined : INVALID); + } if (err) return callback(err); const resultPath = /** @type {ResolveRequest} */ (result).path; if (resultPath !== expectedResult) return callback(INVALID); @@ -2109,8 +2118,9 @@ class FileSystemInfo { break; case "f": resolveCjs(context, path, {}, (err, _, result) => { - if (expectedResult === false) + if (expectedResult === false) { return callback(err ? undefined : INVALID); + } if (err) return callback(err); const resultPath = /** @type {ResolveRequest} */ (result).path; if (resultPath !== expectedResult) return callback(INVALID); @@ -2119,8 +2129,9 @@ class FileSystemInfo { break; case "c": resolveCjsAsChild(context, path, {}, (err, _, result) => { - if (expectedResult === false) + if (expectedResult === false) { return callback(err ? undefined : INVALID); + } if (err) return callback(err); const resultPath = /** @type {ResolveRequest} */ (result).path; if (resultPath !== expectedResult) return callback(INVALID); @@ -2129,8 +2140,9 @@ class FileSystemInfo { break; case "e": resolveEsm(context, path, {}, (err, _, result) => { - if (expectedResult === false) + if (expectedResult === false) { return callback(err ? undefined : INVALID); + } if (err) return callback(err); const resultPath = /** @type {ResolveRequest} */ (result).path; if (resultPath !== expectedResult) return callback(INVALID); @@ -3515,8 +3527,9 @@ class FileSystemInfo { fromFile: (file, stat, callback) => { // Prefer the cached value over our new stat to report consistent results const cache = this._fileTimestamps.get(file); - if (cache !== undefined) + if (cache !== undefined) { return callback(null, cache === "ignore" ? null : cache); + } const mtime = Number(stat.mtime); @@ -4029,7 +4042,7 @@ class FileSystemInfo { } let data; try { - data = JSON.parse(/** @type {Buffer} */ (content).toString("utf-8")); + data = JSON.parse(/** @type {Buffer} */ (content).toString("utf8")); } catch (parseErr) { return callback(/** @type {WebpackError} */ (parseErr)); } @@ -4048,8 +4061,9 @@ class FileSystemInfo { } getDeprecatedFileTimestamps() { - if (this._cachedDeprecatedFileTimestamps !== undefined) + if (this._cachedDeprecatedFileTimestamps !== undefined) { return this._cachedDeprecatedFileTimestamps; + } /** @type {Map} */ const map = new Map(); for (const [path, info] of this._fileTimestamps) { @@ -4059,8 +4073,9 @@ class FileSystemInfo { } getDeprecatedContextTimestamps() { - if (this._cachedDeprecatedContextTimestamps !== undefined) + if (this._cachedDeprecatedContextTimestamps !== undefined) { return this._cachedDeprecatedContextTimestamps; + } /** @type {Map} */ const map = new Map(); for (const [path, info] of this._contextTimestamps) { diff --git a/lib/FlagDependencyExportsPlugin.js b/lib/FlagDependencyExportsPlugin.js index dd984e0e57f..abb93846c1d 100644 --- a/lib/FlagDependencyExportsPlugin.js +++ b/lib/FlagDependencyExportsPlugin.js @@ -200,20 +200,27 @@ class FlagDependencyExportsPlugin { name = exportNameOrSpec; } else { name = exportNameOrSpec.name; - if (exportNameOrSpec.canMangle !== undefined) + if (exportNameOrSpec.canMangle !== undefined) { canMangle = exportNameOrSpec.canMangle; - if (exportNameOrSpec.export !== undefined) + } + if (exportNameOrSpec.export !== undefined) { fromExport = exportNameOrSpec.export; - if (exportNameOrSpec.exports !== undefined) + } + if (exportNameOrSpec.exports !== undefined) { exports = exportNameOrSpec.exports; - if (exportNameOrSpec.from !== undefined) + } + if (exportNameOrSpec.from !== undefined) { from = exportNameOrSpec.from; - if (exportNameOrSpec.priority !== undefined) + } + if (exportNameOrSpec.priority !== undefined) { priority = exportNameOrSpec.priority; - if (exportNameOrSpec.terminalBinding !== undefined) + } + if (exportNameOrSpec.terminalBinding !== undefined) { terminalBinding = exportNameOrSpec.terminalBinding; - if (exportNameOrSpec.hidden !== undefined) + } + if (exportNameOrSpec.hidden !== undefined) { hidden = exportNameOrSpec.hidden; + } } const exportInfo = exportsInfo.getExportInfo(name); diff --git a/lib/Generator.js b/lib/Generator.js index a00b3c644f6..36652c96fd1 100644 --- a/lib/Generator.js +++ b/lib/Generator.js @@ -68,6 +68,7 @@ class Generator { */ getTypes(module) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } @@ -80,6 +81,7 @@ class Generator { */ getSize(module, type) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } @@ -95,6 +97,7 @@ class Generator { { dependencyTemplates, runtimeTemplate, moduleGraph, type } ) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } diff --git a/lib/HookWebpackError.js b/lib/HookWebpackError.js index 127421f36a7..2da30b13c12 100644 --- a/lib/HookWebpackError.js +++ b/lib/HookWebpackError.js @@ -47,6 +47,7 @@ const makeWebpackError = (error, hook) => { if (error instanceof WebpackError) return error; return new HookWebpackError(error, hook); }; + module.exports.makeWebpackError = makeWebpackError; /** diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 824cb433e48..ac76f6bac70 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -110,8 +110,9 @@ class HotModuleReplacementPlugin { */ apply(compiler) { const { _backCompat: backCompat } = compiler; - if (compiler.options.output.strictModuleErrorHandling === undefined) + if (compiler.options.output.strictModuleErrorHandling === undefined) { compiler.options.output.strictModuleErrorHandling = true; + } const runtimeRequirements = [RuntimeGlobals.module]; /** @@ -677,8 +678,9 @@ class HotModuleReplacementPlugin { } else if ( moduleRuntime !== undefined && moduleRuntime.has(/** @type {string} */ (runtime)) - ) + ) { return; + } } const item = /** @type {HotUpdateMainContentByRuntimeItem} */ ( @@ -696,15 +698,17 @@ class HotModuleReplacementPlugin { (newRuntimeModules && newRuntimeModules.length > 0) ) { const hotUpdateChunk = new HotUpdateChunk(); - if (backCompat) + if (backCompat) { ChunkGraph.setChunkGraphForChunk(hotUpdateChunk, chunkGraph); + } hotUpdateChunk.id = chunkId; hotUpdateChunk.runtime = currentChunk ? currentChunk.runtime : newRuntime; if (currentChunk) { - for (const group of currentChunk.groupsIterable) + for (const group of currentChunk.groupsIterable) { hotUpdateChunk.addGroup(group); + } } chunkGraph.attachModules(hotUpdateChunk, newModules || []); chunkGraph.attachRuntimeModules( @@ -796,12 +800,15 @@ The configured output.hotUpdateMainFilename doesn't lead to unique filenames per This might lead to incorrect runtime behavior of the applied update. To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.`) ); - for (const chunkId of removedChunkIds) + for (const chunkId of removedChunkIds) { old.removedChunkIds.add(chunkId); - for (const chunkId of removedModules) + } + for (const chunkId of removedModules) { old.removedModules.add(chunkId); - for (const chunkId of updatedChunkIds) + } + for (const chunkId of updatedChunkIds) { old.updatedChunkIds.add(chunkId); + } continue; } hotUpdateMainContentByFilename.set(filename, { diff --git a/lib/IgnorePlugin.js b/lib/IgnorePlugin.js index 42052a5c497..255d5e23c9d 100644 --- a/lib/IgnorePlugin.js +++ b/lib/IgnorePlugin.js @@ -14,7 +14,7 @@ const createSchemaValidation = require("./util/create-schema-validation"); /** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */ const validate = createSchemaValidation( - require("../schemas/plugins/IgnorePlugin.check.js"), + require("../schemas/plugins/IgnorePlugin.check"), () => require("../schemas/plugins/IgnorePlugin.json"), { name: "Ignore Plugin", diff --git a/lib/LibManifestPlugin.js b/lib/LibManifestPlugin.js index 80ad2c58769..debd500bc44 100644 --- a/lib/LibManifestPlugin.js +++ b/lib/LibManifestPlugin.js @@ -140,4 +140,5 @@ class LibManifestPlugin { ); } } + module.exports = LibManifestPlugin; diff --git a/lib/LoaderOptionsPlugin.js b/lib/LoaderOptionsPlugin.js index 0ff521bf474..c493bc27704 100644 --- a/lib/LoaderOptionsPlugin.js +++ b/lib/LoaderOptionsPlugin.js @@ -20,7 +20,7 @@ const createSchemaValidation = require("./util/create-schema-validation"); */ const validate = createSchemaValidation( - require("../schemas/plugins/LoaderOptionsPlugin.check.js"), + require("../schemas/plugins/LoaderOptionsPlugin.check"), () => require("../schemas/plugins/LoaderOptionsPlugin.json"), { name: "Loader Options Plugin", diff --git a/lib/Module.js b/lib/Module.js index 195ed19360d..0ecf5a21fdb 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -744,8 +744,9 @@ class Module extends DependenciesBlock { // 1. If module is in one of the chunks of the group we can continue checking the next items // because it's accessible. for (const chunk of cg.chunks) { - if (chunk !== ignoreChunk && chunkGraph.isModuleInChunk(this, chunk)) + if (chunk !== ignoreChunk && chunkGraph.isModuleInChunk(this, chunk)) { continue queueFor; + } } // 2. If the chunk group is initial, we can break here because it's not accessible. if (chunkGroup.isInitial()) return false; @@ -773,8 +774,9 @@ class Module extends DependenciesBlock { /** @type {Module} */ (fromModule) )) { // return true if module this is not reachable from originChunk when ignoring chunk - if (!this.isAccessibleInChunk(chunkGraph, originChunk, chunk)) + if (!this.isAccessibleInChunk(chunkGraph, originChunk, chunk)) { return true; + } } } return false; @@ -863,6 +865,7 @@ class Module extends DependenciesBlock { */ identifier() { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } @@ -874,6 +877,7 @@ class Module extends DependenciesBlock { */ readableIdentifier(requestShortener) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } @@ -889,6 +893,7 @@ class Module extends DependenciesBlock { */ build(options, compilation, resolver, fs, callback) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } @@ -915,6 +920,7 @@ class Module extends DependenciesBlock { source(dependencyTemplates, runtimeTemplate, type = "javascript") { if (this.codeGeneration === Module.prototype.codeGeneration) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } const chunkGraph = ChunkGraph.getChunkGraphForModule( @@ -948,6 +954,7 @@ class Module extends DependenciesBlock { */ size(type) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } diff --git a/lib/ModuleFactory.js b/lib/ModuleFactory.js index 26cb9a94a78..a38ae2a67b2 100644 --- a/lib/ModuleFactory.js +++ b/lib/ModuleFactory.js @@ -49,6 +49,7 @@ class ModuleFactory { */ create(data, callback) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } } diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js index 5fa38ea6838..b9d2eddc306 100644 --- a/lib/ModuleGraph.js +++ b/lib/ModuleGraph.js @@ -441,8 +441,9 @@ class ModuleGraph { /** @type {Dependency} */ (connection.dependency), connection ); - if (connection.dependency === dependency) + if (connection.dependency === dependency) { foundConnection = connection; + } } mgm._unassignedConnections.length = 0; if (foundConnection !== undefined) { @@ -879,12 +880,13 @@ class ModuleGraph { */ module => { const moduleGraph = moduleGraphForModuleMap.get(module); - if (!moduleGraph) + if (!moduleGraph) { throw new Error( `${ deprecateMessage }There was no ModuleGraph assigned to the Module for backward-compat (Use the new API)` ); + } return moduleGraph; }, `${deprecateMessage}: Use new ModuleGraph API`, diff --git a/lib/ModuleInfoHeaderPlugin.js b/lib/ModuleInfoHeaderPlugin.js index 5cfac69a88f..28073b67ddc 100644 --- a/lib/ModuleInfoHeaderPlugin.js +++ b/lib/ModuleInfoHeaderPlugin.js @@ -310,4 +310,5 @@ class ModuleInfoHeaderPlugin { return new RawSource(headerStr); } } + module.exports = ModuleInfoHeaderPlugin; diff --git a/lib/ModuleParseError.js b/lib/ModuleParseError.js index f4e39c08cd3..dae44e05839 100644 --- a/lib/ModuleParseError.js +++ b/lib/ModuleParseError.js @@ -62,6 +62,7 @@ class ModuleParseError extends WebpackError { if ( Buffer.isBuffer(source) || + // eslint-disable-next-line no-control-regex /[\0\u0001\u0002\u0003\u0004\u0005\u0006\u0007]/.test(source) ) { // binary file diff --git a/lib/NormalModule.js b/lib/NormalModule.js index fc12bd04b1f..efa95213682 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -184,7 +184,7 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { */ const asString = input => { if (Buffer.isBuffer(input)) { - return input.toString("utf-8"); + return input.toString("utf8"); } return input; }; @@ -195,7 +195,7 @@ const asString = input => { */ const asBuffer = input => { if (!Buffer.isBuffer(input)) { - return Buffer.from(input, "utf-8"); + return Buffer.from(input, "utf8"); } return input; }; @@ -1253,8 +1253,9 @@ class NormalModule extends Module { const checkDependencies = deps => { for (const dep of deps) { if (!ABSOLUTE_PATH_REGEX.test(dep)) { - if (nonAbsoluteDependencies === undefined) + if (nonAbsoluteDependencies === undefined) { nonAbsoluteDependencies = new Set(); + } nonAbsoluteDependencies.add(dep); deps.delete(dep); try { @@ -1379,8 +1380,9 @@ class NormalModule extends Module { if (this.factoryMeta.sideEffectFree === false) return true; } if (this.buildMeta !== undefined && this.buildMeta.sideEffectFree) { - if (this._isEvaluatingSideEffects) + if (this._isEvaluatingSideEffects) { return ModuleGraphConnection.CIRCULAR_CONNECTION; + } this._isEvaluatingSideEffects = true; /** @type {ConnectionState} */ let current = false; diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js index 004d4630b69..65966498eaa 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -352,24 +352,26 @@ class NormalModuleFactory extends ModuleFactory { // direct module if (result instanceof Module) return callback(null, result); - if (typeof result === "object") + if (typeof result === "object") { throw new Error( `${deprecationChangedHookMessage( "resolve", this.hooks.resolve )} Returning a Module object will result in this module used as result.` ); + } this.hooks.afterResolve.callAsync(resolveData, (err, result) => { if (err) return callback(err); - if (typeof result === "object") + if (typeof result === "object") { throw new Error( deprecationChangedHookMessage( "afterResolve", this.hooks.afterResolve ) ); + } // Ignored if (result === false) return callback(); @@ -656,18 +658,27 @@ class NormalModuleFactory extends ModuleFactory { } const allLoaders = /** @type {LoaderItem[]} */ (postLoaders); if (matchResourceData === undefined) { - for (const loader of /** @type {LoaderItem[]} */ (loaders)) + for (const loader of /** @type {LoaderItem[]} */ (loaders)) { allLoaders.push(loader); - for (const loader of /** @type {LoaderItem[]} */ (normalLoaders)) + } + for (const loader of /** @type {LoaderItem[]} */ ( + normalLoaders + )) { allLoaders.push(loader); + } } else { - for (const loader of /** @type {LoaderItem[]} */ (normalLoaders)) + for (const loader of /** @type {LoaderItem[]} */ ( + normalLoaders + )) { allLoaders.push(loader); - for (const loader of /** @type {LoaderItem[]} */ (loaders)) + } + for (const loader of /** @type {LoaderItem[]} */ (loaders)) { allLoaders.push(loader); + } } - for (const loader of /** @type {LoaderItem[]} */ (preLoaders)) + for (const loader of /** @type {LoaderItem[]} */ (preLoaders)) { allLoaders.push(loader); + } const type = /** @type {string} */ (settings.type); const resolveOptions = settings.resolve; const layer = settings.layer; @@ -846,7 +857,9 @@ class NormalModuleFactory extends ModuleFactory { } // resource without scheme and without path - else defaultResolve(context); + else { + defaultResolve(context); + } } ); } @@ -918,13 +931,14 @@ class NormalModuleFactory extends ModuleFactory { return callback(null, factoryResult); } - if (typeof result === "object") + if (typeof result === "object") { throw new Error( deprecationChangedHookMessage( "beforeResolve", this.hooks.beforeResolve ) ); + } this.hooks.factorize.callAsync(resolveData, (err, module) => { if (err) { diff --git a/lib/NullFactory.js b/lib/NullFactory.js index 4665f75902a..f420508ca7d 100644 --- a/lib/NullFactory.js +++ b/lib/NullFactory.js @@ -20,4 +20,5 @@ class NullFactory extends ModuleFactory { return callback(); } } + module.exports = NullFactory; diff --git a/lib/Parser.js b/lib/Parser.js index 8dd02c92bbf..8a5c4fdf704 100644 --- a/lib/Parser.js +++ b/lib/Parser.js @@ -32,6 +32,7 @@ class Parser { */ parse(source, state) { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } } diff --git a/lib/ProgressPlugin.js b/lib/ProgressPlugin.js index cb17eae22d0..4b82f61a232 100644 --- a/lib/ProgressPlugin.js +++ b/lib/ProgressPlugin.js @@ -34,7 +34,7 @@ const { contextify } = require("./util/identifier"); */ const validate = createSchemaValidation( - require("../schemas/plugins/ProgressPlugin.check.js"), + require("../schemas/plugins/ProgressPlugin.check"), () => require("../schemas/plugins/ProgressPlugin.json"), { name: "Progress Plugin", @@ -321,14 +321,16 @@ class ProgressPlugin { skippedDependenciesCount++; } dependenciesCount++; - if (dependenciesCount < 50 || dependenciesCount % 100 === 0) + if (dependenciesCount < 50 || dependenciesCount % 100 === 0) { updateThrottled(); + } }; const factorizeDone = () => { doneDependencies++; - if (doneDependencies < 50 || doneDependencies % 100 === 0) + if (doneDependencies < 50 || doneDependencies % 100 === 0) { updateThrottled(); + } }; /** diff --git a/lib/RecordIdsPlugin.js b/lib/RecordIdsPlugin.js index de52ea04a8c..d649cab28d2 100644 --- a/lib/RecordIdsPlugin.js +++ b/lib/RecordIdsPlugin.js @@ -208,4 +208,5 @@ class RecordIdsPlugin { }); } } + module.exports = RecordIdsPlugin; diff --git a/lib/RuntimeModule.js b/lib/RuntimeModule.js index 6f5e82ea133..d063ff0efe0 100644 --- a/lib/RuntimeModule.js +++ b/lib/RuntimeModule.js @@ -172,6 +172,7 @@ class RuntimeModule extends Module { */ generate() { const AbstractMethodError = require("./AbstractMethodError"); + throw new AbstractMethodError(); } diff --git a/lib/RuntimePlugin.js b/lib/RuntimePlugin.js index 5d4d94d4763..462df520dd3 100644 --- a/lib/RuntimePlugin.js +++ b/lib/RuntimePlugin.js @@ -354,8 +354,9 @@ class RuntimePlugin { /** @type {NonNullable} */ (compilation.outputOptions.hotUpdateChunkFilename) ) - ) + ) { set.add(RuntimeGlobals.getFullHash); + } compilation.addRuntimeModule( chunk, new GetChunkFilenameRuntimeModule( @@ -519,4 +520,5 @@ class RuntimePlugin { }); } } + module.exports = RuntimePlugin; diff --git a/lib/RuntimeTemplate.js b/lib/RuntimeTemplate.js index 48d8934a5a7..e39308911c1 100644 --- a/lib/RuntimeTemplate.js +++ b/lib/RuntimeTemplate.js @@ -76,8 +76,9 @@ function getGlobalObject(definition) { // call expression // expression in parentheses /^([_\p{L}][_0-9\p{L}]*)?\(.*\)$/iu.test(trimmed) - ) + ) { return trimmed; + } return `Object(${trimmed})`; } @@ -220,8 +221,9 @@ class RuntimeTemplate { lastWasExpr = isExpr; } if (lastWasExpr) concatenationCost -= 3; - if (typeof args[0] !== "string" && typeof args[1] === "string") + if (typeof args[0] !== "string" && typeof args[1] === "string") { concatenationCost -= 3; + } if (concatenationCost <= templateCost) return this._es5Concatenation(args); diff --git a/lib/SourceMapDevToolPlugin.js b/lib/SourceMapDevToolPlugin.js index 356493361ba..6b378278194 100644 --- a/lib/SourceMapDevToolPlugin.js +++ b/lib/SourceMapDevToolPlugin.js @@ -33,7 +33,7 @@ const { makePathsAbsolute } = require("./util/identifier"); /** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ const validate = createSchemaValidation( - require("../schemas/plugins/SourceMapDevToolPlugin.check.js"), + require("../schemas/plugins/SourceMapDevToolPlugin.check"), () => require("../schemas/plugins/SourceMapDevToolPlugin.json"), { name: "SourceMap DevTool Plugin", @@ -270,8 +270,9 @@ class SourceMapDevToolPlugin { /** * Add file to chunk, if not presented there */ - if (cachedFile !== file && chunk !== undefined) + if (cachedFile !== file && chunk !== undefined) { chunk.auxiliaryFiles.add(cachedFile); + } } reportProgress( @@ -548,8 +549,9 @@ class SourceMapDevToolPlugin { sourceMapAsset, sourceMapAssetInfo ); - if (chunk !== undefined) + if (chunk !== undefined) { chunk.auxiliaryFiles.add(sourceMapFile); + } } else { if (currentSourceMappingURLComment === false) { throw new Error( @@ -573,7 +575,7 @@ class SourceMapDevToolPlugin { () => `data:application/json;charset=utf-8;base64,${Buffer.from( sourceMapString, - "utf-8" + "utf8" ).toString("base64")}` ) ); diff --git a/lib/WatchIgnorePlugin.js b/lib/WatchIgnorePlugin.js index ce72ae8ed33..54046458b1a 100644 --- a/lib/WatchIgnorePlugin.js +++ b/lib/WatchIgnorePlugin.js @@ -16,7 +16,7 @@ const createSchemaValidation = require("./util/create-schema-validation"); /** @typedef {import("./util/fs").WatchMethod} WatchMethod */ /** @typedef {import("./util/fs").Watcher} Watcher */ const validate = createSchemaValidation( - require("../schemas/plugins/WatchIgnorePlugin.check.js"), + require("../schemas/plugins/WatchIgnorePlugin.check"), () => require("../schemas/plugins/WatchIgnorePlugin.json"), { name: "Watch Ignore Plugin", diff --git a/lib/WebpackIsIncludedPlugin.js b/lib/WebpackIsIncludedPlugin.js index 981cf8f6dff..4b18790b2e5 100644 --- a/lib/WebpackIsIncludedPlugin.js +++ b/lib/WebpackIsIncludedPlugin.js @@ -55,8 +55,9 @@ class WebpackIsIncludedPlugin { expr.type !== "CallExpression" || expr.arguments.length !== 1 || expr.arguments[0].type === "SpreadElement" - ) + ) { return; + } const request = parser.evaluateExpression(expr.arguments[0]); diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index 00dddb42366..be953b2de4e 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -84,6 +84,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.externals) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const ExternalsPlugin = require("./ExternalsPlugin"); + new ExternalsPlugin(options.externalsType, options.externals).apply( compiler ); @@ -91,21 +92,25 @@ class WebpackOptionsApply extends OptionsApply { if (options.externalsPresets.node) { const NodeTargetPlugin = require("./node/NodeTargetPlugin"); + new NodeTargetPlugin().apply(compiler); } if (options.externalsPresets.electronMain) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin"); + new ElectronTargetPlugin("main").apply(compiler); } if (options.externalsPresets.electronPreload) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin"); + new ElectronTargetPlugin("preload").apply(compiler); } if (options.externalsPresets.electronRenderer) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin"); + new ElectronTargetPlugin("renderer").apply(compiler); } if ( @@ -116,29 +121,35 @@ class WebpackOptionsApply extends OptionsApply { ) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin"); + new ElectronTargetPlugin().apply(compiler); } if (options.externalsPresets.nwjs) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const ExternalsPlugin = require("./ExternalsPlugin"); + new ExternalsPlugin("node-commonjs", "nw.gui").apply(compiler); } if (options.externalsPresets.webAsync) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const ExternalsPlugin = require("./ExternalsPlugin"); + new ExternalsPlugin("import", ({ request, dependencyType }, callback) => { if (dependencyType === "url") { - if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) + if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) { return callback(null, `asset ${request}`); + } } else if (options.experiments.css && dependencyType === "css-import") { - if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) + if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) { return callback(null, `css-import ${request}`); + } } else if ( options.experiments.css && /^(\/\/|https?:\/\/|std:)/.test(/** @type {string} */ (request)) ) { - if (/^\.css(\?|$)/.test(/** @type {string} */ (request))) + if (/^\.css(\?|$)/.test(/** @type {string} */ (request))) { return callback(null, `css-import ${request}`); + } return callback(null, `import ${request}`); } callback(); @@ -146,21 +157,25 @@ class WebpackOptionsApply extends OptionsApply { } else if (options.externalsPresets.web) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const ExternalsPlugin = require("./ExternalsPlugin"); + new ExternalsPlugin("module", ({ request, dependencyType }, callback) => { if (dependencyType === "url") { - if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) + if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) { return callback(null, `asset ${request}`); + } } else if (options.experiments.css && dependencyType === "css-import") { - if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) + if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) { return callback(null, `css-import ${request}`); + } } else if ( /^(\/\/|https?:\/\/|std:)/.test(/** @type {string} */ (request)) ) { if ( options.experiments.css && /^\.css((\?)|$)/.test(/** @type {string} */ (request)) - ) + ) { return callback(null, `css-import ${request}`); + } return callback(null, `module ${request}`); } callback(); @@ -168,18 +183,22 @@ class WebpackOptionsApply extends OptionsApply { } else if (options.externalsPresets.node && options.experiments.css) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const ExternalsPlugin = require("./ExternalsPlugin"); + new ExternalsPlugin("module", ({ request, dependencyType }, callback) => { if (dependencyType === "url") { - if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) + if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) { return callback(null, `asset ${request}`); + } } else if (dependencyType === "css-import") { - if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) + if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) { return callback(null, `css-import ${request}`); + } } else if ( /^(\/\/|https?:\/\/|std:)/.test(/** @type {string} */ (request)) ) { - if (/^\.css(\?|$)/.test(/** @type {string} */ (request))) + if (/^\.css(\?|$)/.test(/** @type {string} */ (request))) { return callback(null, `css-import ${request}`); + } return callback(null, `module ${request}`); } callback(); @@ -192,16 +211,19 @@ class WebpackOptionsApply extends OptionsApply { switch (options.output.chunkFormat) { case "array-push": { const ArrayPushCallbackChunkFormatPlugin = require("./javascript/ArrayPushCallbackChunkFormatPlugin"); + new ArrayPushCallbackChunkFormatPlugin().apply(compiler); break; } case "commonjs": { const CommonJsChunkFormatPlugin = require("./javascript/CommonJsChunkFormatPlugin"); + new CommonJsChunkFormatPlugin().apply(compiler); break; } case "module": { const ModuleChunkFormatPlugin = require("./esm/ModuleChunkFormatPlugin"); + new ModuleChunkFormatPlugin().apply(compiler); break; } @@ -219,6 +241,7 @@ class WebpackOptionsApply extends OptionsApply { if (enabledChunkLoadingTypes.length > 0) { for (const type of enabledChunkLoadingTypes) { const EnableChunkLoadingPlugin = require("./javascript/EnableChunkLoadingPlugin"); + new EnableChunkLoadingPlugin(type).apply(compiler); } } @@ -230,6 +253,7 @@ class WebpackOptionsApply extends OptionsApply { if (enabledWasmLoadingTypes.length > 0) { for (const type of enabledWasmLoadingTypes) { const EnableWasmLoadingPlugin = require("./wasm/EnableWasmLoadingPlugin"); + new EnableWasmLoadingPlugin(type).apply(compiler); } } @@ -242,6 +266,7 @@ class WebpackOptionsApply extends OptionsApply { let once = true; for (const type of enabledLibraryTypes) { const EnableLibraryPlugin = require("./library/EnableLibraryPlugin"); + new EnableLibraryPlugin(type, { // eslint-disable-next-line no-loop-func additionalApply: () => { @@ -262,6 +287,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.output.pathinfo) { const ModuleInfoHeaderPlugin = require("./ModuleInfoHeaderPlugin"); + new ModuleInfoHeaderPlugin(options.output.pathinfo !== true).apply( compiler ); @@ -269,6 +295,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.output.clean) { const CleanPlugin = require("./CleanPlugin"); + new CleanPlugin( options.output.clean === true ? {} : options.output.clean ).apply(compiler); @@ -300,6 +327,7 @@ class WebpackOptionsApply extends OptionsApply { }).apply(compiler); } else if (options.devtool.includes("eval")) { const EvalDevToolModulePlugin = require("./EvalDevToolModulePlugin"); + new EvalDevToolModulePlugin({ moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, namespace: options.output.devtoolNamespace @@ -339,6 +367,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.experiments.syncWebAssembly) { const WebAssemblyModulesPlugin = require("./wasm-sync/WebAssemblyModulesPlugin"); + new WebAssemblyModulesPlugin({ mangleImports: options.optimization.mangleWasmImports }).apply(compiler); @@ -346,6 +375,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.experiments.asyncWebAssembly) { const AsyncWebAssemblyModulesPlugin = require("./wasm-async/AsyncWebAssemblyModulesPlugin"); + new AsyncWebAssemblyModulesPlugin({ mangleImports: options.optimization.mangleWasmImports }).apply(compiler); @@ -353,11 +383,13 @@ class WebpackOptionsApply extends OptionsApply { if (options.experiments.css) { const CssModulesPlugin = require("./css/CssModulesPlugin"); + new CssModulesPlugin().apply(compiler); } if (options.experiments.lazyCompilation) { const LazyCompilationPlugin = require("./hmr/LazyCompilationPlugin"); + const lazyOptions = typeof options.experiments.lazyCompilation === "object" ? options.experiments.lazyCompilation @@ -384,6 +416,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.experiments.buildHttp) { const HttpUriPlugin = require("./schemes/HttpUriPlugin"); + const httpOptions = options.experiments.buildHttp; new HttpUriPlugin(httpOptions).apply(compiler); } @@ -410,6 +443,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.amd !== false) { const AMDPlugin = require("./dependencies/AMDPlugin"); const RequireJsStuffPlugin = require("./RequireJsStuffPlugin"); + new AMDPlugin(options.amd || {}).apply(compiler); new RequireJsStuffPlugin().apply(compiler); } @@ -417,6 +451,7 @@ class WebpackOptionsApply extends OptionsApply { new LoaderPlugin().apply(compiler); if (options.node !== false) { const NodeStuffPlugin = require("./NodeStuffPlugin"); + new NodeStuffPlugin(options.node).apply(compiler); } new APIPlugin({ @@ -449,29 +484,36 @@ class WebpackOptionsApply extends OptionsApply { if (typeof options.mode !== "string") { const WarnNoModeSetPlugin = require("./WarnNoModeSetPlugin"); + new WarnNoModeSetPlugin().apply(compiler); } const EnsureChunkConditionsPlugin = require("./optimize/EnsureChunkConditionsPlugin"); + new EnsureChunkConditionsPlugin().apply(compiler); if (options.optimization.removeAvailableModules) { const RemoveParentModulesPlugin = require("./optimize/RemoveParentModulesPlugin"); + new RemoveParentModulesPlugin().apply(compiler); } if (options.optimization.removeEmptyChunks) { const RemoveEmptyChunksPlugin = require("./optimize/RemoveEmptyChunksPlugin"); + new RemoveEmptyChunksPlugin().apply(compiler); } if (options.optimization.mergeDuplicateChunks) { const MergeDuplicateChunksPlugin = require("./optimize/MergeDuplicateChunksPlugin"); + new MergeDuplicateChunksPlugin().apply(compiler); } if (options.optimization.flagIncludedChunks) { const FlagIncludedChunksPlugin = require("./optimize/FlagIncludedChunksPlugin"); + new FlagIncludedChunksPlugin().apply(compiler); } if (options.optimization.sideEffects) { const SideEffectsFlagPlugin = require("./optimize/SideEffectsFlagPlugin"); + new SideEffectsFlagPlugin( options.optimization.sideEffects === true ).apply(compiler); @@ -481,38 +523,46 @@ class WebpackOptionsApply extends OptionsApply { } if (options.optimization.usedExports) { const FlagDependencyUsagePlugin = require("./FlagDependencyUsagePlugin"); + new FlagDependencyUsagePlugin( options.optimization.usedExports === "global" ).apply(compiler); } if (options.optimization.innerGraph) { const InnerGraphPlugin = require("./optimize/InnerGraphPlugin"); + new InnerGraphPlugin().apply(compiler); } if (options.optimization.mangleExports) { const MangleExportsPlugin = require("./optimize/MangleExportsPlugin"); + new MangleExportsPlugin( options.optimization.mangleExports !== "size" ).apply(compiler); } if (options.optimization.concatenateModules) { const ModuleConcatenationPlugin = require("./optimize/ModuleConcatenationPlugin"); + new ModuleConcatenationPlugin().apply(compiler); } if (options.optimization.splitChunks) { const SplitChunksPlugin = require("./optimize/SplitChunksPlugin"); + new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler); } if (options.optimization.runtimeChunk) { const RuntimeChunkPlugin = require("./optimize/RuntimeChunkPlugin"); + new RuntimeChunkPlugin(options.optimization.runtimeChunk).apply(compiler); } if (!options.optimization.emitOnErrors) { const NoEmitOnErrorsPlugin = require("./NoEmitOnErrorsPlugin"); + new NoEmitOnErrorsPlugin().apply(compiler); } if (options.optimization.realContentHash) { const RealContentHashPlugin = require("./optimize/RealContentHashPlugin"); + new RealContentHashPlugin({ hashFunction: /** @type {NonNullable} */ @@ -524,6 +574,7 @@ class WebpackOptionsApply extends OptionsApply { } if (options.optimization.checkWasmTypes) { const WasmFinalizeExportsPlugin = require("./wasm-sync/WasmFinalizeExportsPlugin"); + new WasmFinalizeExportsPlugin().apply(compiler); } const moduleIds = options.optimization.moduleIds; @@ -531,17 +582,20 @@ class WebpackOptionsApply extends OptionsApply { switch (moduleIds) { case "natural": { const NaturalModuleIdsPlugin = require("./ids/NaturalModuleIdsPlugin"); + new NaturalModuleIdsPlugin().apply(compiler); break; } case "named": { const NamedModuleIdsPlugin = require("./ids/NamedModuleIdsPlugin"); + new NamedModuleIdsPlugin().apply(compiler); break; } case "hashed": { const WarnDeprecatedOptionPlugin = require("./WarnDeprecatedOptionPlugin"); const HashedModuleIdsPlugin = require("./ids/HashedModuleIdsPlugin"); + new WarnDeprecatedOptionPlugin( "optimization.moduleIds", "hashed", @@ -554,11 +608,13 @@ class WebpackOptionsApply extends OptionsApply { } case "deterministic": { const DeterministicModuleIdsPlugin = require("./ids/DeterministicModuleIdsPlugin"); + new DeterministicModuleIdsPlugin().apply(compiler); break; } case "size": { const OccurrenceModuleIdsPlugin = require("./ids/OccurrenceModuleIdsPlugin"); + new OccurrenceModuleIdsPlugin({ prioritiseInitial: true }).apply(compiler); @@ -575,22 +631,26 @@ class WebpackOptionsApply extends OptionsApply { switch (chunkIds) { case "natural": { const NaturalChunkIdsPlugin = require("./ids/NaturalChunkIdsPlugin"); + new NaturalChunkIdsPlugin().apply(compiler); break; } case "named": { const NamedChunkIdsPlugin = require("./ids/NamedChunkIdsPlugin"); + new NamedChunkIdsPlugin().apply(compiler); break; } case "deterministic": { const DeterministicChunkIdsPlugin = require("./ids/DeterministicChunkIdsPlugin"); + new DeterministicChunkIdsPlugin().apply(compiler); break; } case "size": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const OccurrenceChunkIdsPlugin = require("./ids/OccurrenceChunkIdsPlugin"); + new OccurrenceChunkIdsPlugin({ prioritiseInitial: true }).apply(compiler); @@ -599,6 +659,7 @@ class WebpackOptionsApply extends OptionsApply { case "total-size": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const OccurrenceChunkIdsPlugin = require("./ids/OccurrenceChunkIdsPlugin"); + new OccurrenceChunkIdsPlugin({ prioritiseInitial: false }).apply(compiler); @@ -612,6 +673,7 @@ class WebpackOptionsApply extends OptionsApply { } if (options.optimization.nodeEnv) { const DefinePlugin = require("./DefinePlugin"); + new DefinePlugin({ "process.env.NODE_ENV": JSON.stringify(options.optimization.nodeEnv) }).apply(compiler); @@ -631,6 +693,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.performance) { const SizeLimitsPlugin = require("./performance/SizeLimitsPlugin"); + new SizeLimitsPlugin(options.performance).apply(compiler); } @@ -643,6 +706,7 @@ class WebpackOptionsApply extends OptionsApply { new WarnCaseSensitiveModulesPlugin().apply(compiler); const AddManagedPathsPlugin = require("./cache/AddManagedPathsPlugin"); + new AddManagedPathsPlugin( /** @type {NonNullable} */ (options.snapshot.managedPaths), @@ -659,6 +723,7 @@ class WebpackOptionsApply extends OptionsApply { if (Number.isFinite(cacheOptions.maxGenerations)) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const MemoryWithGcCachePlugin = require("./cache/MemoryWithGcCachePlugin"); + new MemoryWithGcCachePlugin({ maxGenerations: /** @type {number} */ @@ -667,6 +732,7 @@ class WebpackOptionsApply extends OptionsApply { } else { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const MemoryCachePlugin = require("./cache/MemoryCachePlugin"); + new MemoryCachePlugin().apply(compiler); } if (cacheOptions.cacheUnaffected) { @@ -681,7 +747,7 @@ class WebpackOptionsApply extends OptionsApply { } case "filesystem": { const AddBuildDependenciesPlugin = require("./cache/AddBuildDependenciesPlugin"); - // eslint-disable-next-line guard-for-in + for (const key in cacheOptions.buildDependencies) { const list = cacheOptions.buildDependencies[key]; new AddBuildDependenciesPlugin(list).apply(compiler); @@ -689,10 +755,12 @@ class WebpackOptionsApply extends OptionsApply { if (!Number.isFinite(cacheOptions.maxMemoryGenerations)) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const MemoryCachePlugin = require("./cache/MemoryCachePlugin"); + new MemoryCachePlugin().apply(compiler); } else if (cacheOptions.maxMemoryGenerations !== 0) { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const MemoryWithGcCachePlugin = require("./cache/MemoryWithGcCachePlugin"); + new MemoryWithGcCachePlugin({ maxGenerations: /** @type {number} */ @@ -711,6 +779,7 @@ class WebpackOptionsApply extends OptionsApply { case "pack": { const IdleFileCachePlugin = require("./cache/IdleFileCachePlugin"); const PackFileCacheStrategy = require("./cache/PackFileCacheStrategy"); + new IdleFileCachePlugin( new PackFileCacheStrategy({ compiler, @@ -755,6 +824,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.ignoreWarnings && options.ignoreWarnings.length > 0) { const IgnoreWarningsPlugin = require("./IgnoreWarningsPlugin"); + new IgnoreWarningsPlugin(options.ignoreWarnings).apply(compiler); } diff --git a/lib/asset/AssetGenerator.js b/lib/asset/AssetGenerator.js index b145641d70b..3f33a590aea 100644 --- a/lib/asset/AssetGenerator.js +++ b/lib/asset/AssetGenerator.js @@ -144,7 +144,7 @@ const encodeDataUri = (encoding, source) => { const content = source.source(); if (typeof content !== "string") { - encodedContent = content.toString("utf-8"); + encodedContent = content.toString("utf8"); } encodedContent = encodeURIComponent( diff --git a/lib/asset/AssetModulesPlugin.js b/lib/asset/AssetModulesPlugin.js index 4cb5948e6d8..bcd8145bc07 100644 --- a/lib/asset/AssetModulesPlugin.js +++ b/lib/asset/AssetModulesPlugin.js @@ -32,6 +32,7 @@ const memoize = require("../util/memoize"); */ const getSchema = name => { const { definitions } = require("../../schemas/WebpackOptions.json"); + return { definitions, oneOf: [{ $ref: `#/definitions/${name}` }] @@ -44,24 +45,24 @@ const generatorValidationOptions = { }; const validateGeneratorOptions = { asset: createSchemaValidation( - require("../../schemas/plugins/asset/AssetGeneratorOptions.check.js"), + require("../../schemas/plugins/asset/AssetGeneratorOptions.check"), () => getSchema("AssetGeneratorOptions"), generatorValidationOptions ), "asset/resource": createSchemaValidation( - require("../../schemas/plugins/asset/AssetResourceGeneratorOptions.check.js"), + require("../../schemas/plugins/asset/AssetResourceGeneratorOptions.check"), () => getSchema("AssetResourceGeneratorOptions"), generatorValidationOptions ), "asset/inline": createSchemaValidation( - require("../../schemas/plugins/asset/AssetInlineGeneratorOptions.check.js"), + require("../../schemas/plugins/asset/AssetInlineGeneratorOptions.check"), () => getSchema("AssetInlineGeneratorOptions"), generatorValidationOptions ) }; const validateParserOptions = createSchemaValidation( - require("../../schemas/plugins/asset/AssetParserOptions.check.js"), + require("../../schemas/plugins/asset/AssetParserOptions.check"), () => getSchema("AssetParserOptions"), { name: "Asset Modules Plugin", diff --git a/lib/asset/AssetSourceGenerator.js b/lib/asset/AssetSourceGenerator.js index 512fb440966..1ce3cf89c2c 100644 --- a/lib/asset/AssetSourceGenerator.js +++ b/lib/asset/AssetSourceGenerator.js @@ -53,7 +53,7 @@ class AssetSourceGenerator extends Generator { const content = originalSource.source(); const encodedSource = - typeof content === "string" ? content : content.toString("utf-8"); + typeof content === "string" ? content : content.toString("utf8"); let sourceContent; if (concatenationScope) { @@ -78,7 +78,7 @@ class AssetSourceGenerator extends Generator { const content = originalSource.source(); const encodedSource = - typeof content === "string" ? content : content.toString("utf-8"); + typeof content === "string" ? content : content.toString("utf8"); if (data) { data.set("url", { [type]: encodedSource }); diff --git a/lib/asset/RawDataUrlModule.js b/lib/asset/RawDataUrlModule.js index fd5af3d750d..b15973e2f48 100644 --- a/lib/asset/RawDataUrlModule.js +++ b/lib/asset/RawDataUrlModule.js @@ -62,8 +62,9 @@ class RawDataUrlModule extends Module { * @returns {number} the estimated size of the module (must be non-zero) */ size(type) { - if (this.url === undefined) + if (this.url === undefined) { this.url = /** @type {Buffer} */ (this.urlBuffer).toString(); + } return Math.max(1, this.url.length); } @@ -107,8 +108,9 @@ class RawDataUrlModule extends Module { * @returns {CodeGenerationResult} result */ codeGeneration(context) { - if (this.url === undefined) + if (this.url === undefined) { this.url = /** @type {Buffer} */ (this.urlBuffer).toString(); + } const sources = new Map(); sources.set( "javascript", diff --git a/lib/buildChunkGraph.js b/lib/buildChunkGraph.js index 853b5f14b4f..9cd54164b96 100644 --- a/lib/buildChunkGraph.js +++ b/lib/buildChunkGraph.js @@ -315,8 +315,9 @@ const visitModules = ( return map; } ); - for (const [block, blockModules] of map) + for (const [block, blockModules] of map) { blockModulesMap.set(block, blockModules); + } return map.get(block); } logger.time("visitModules: prepare"); @@ -892,8 +893,9 @@ const visitModules = ( * @returns {bigint} The mask of available modules after the chunk group */ const calculateResultingAvailableModules = chunkGroupInfo => { - if (chunkGroupInfo.resultingAvailableModules !== undefined) + if (chunkGroupInfo.resultingAvailableModules !== undefined) { return chunkGroupInfo.resultingAvailableModules; + } let resultingAvailableModules = /** @type {bigint} */ ( chunkGroupInfo.minAvailableModules @@ -1345,8 +1347,9 @@ const buildChunkGraph = (compilation, inputEntrypointsAndModules) => { logger.timeEnd("connectChunkGroups"); for (const [chunkGroup, chunkGroupInfo] of chunkGroupInfoMap) { - for (const chunk of chunkGroup.chunks) + for (const chunk of chunkGroup.chunks) { chunk.runtime = mergeRuntime(chunk.runtime, chunkGroupInfo.runtime); + } } // Cleanup work diff --git a/lib/cache/MemoryCachePlugin.js b/lib/cache/MemoryCachePlugin.js index 6e498fe258d..88248ce2120 100644 --- a/lib/cache/MemoryCachePlugin.js +++ b/lib/cache/MemoryCachePlugin.js @@ -55,4 +55,5 @@ class MemoryCachePlugin { ); } } + module.exports = MemoryCachePlugin; diff --git a/lib/cache/MemoryWithGcCachePlugin.js b/lib/cache/MemoryWithGcCachePlugin.js index aa2aaf4442f..e42e49eed2f 100644 --- a/lib/cache/MemoryWithGcCachePlugin.js +++ b/lib/cache/MemoryWithGcCachePlugin.js @@ -139,4 +139,5 @@ class MemoryWithGcCachePlugin { ); } } + module.exports = MemoryWithGcCachePlugin; diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index eca497b116d..22efe45bcee 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -292,8 +292,9 @@ class Pack { return pack; }; let pack = createNextPack(); - if (this.requestsTimeout !== undefined) + if (this.requestsTimeout !== undefined) { clearTimeout(this.requestsTimeout); + } for (const identifier of this.requests) { if (identifier === undefined) { if (ignoreNextTimeTick) { @@ -379,7 +380,9 @@ class Pack { smallUnusedContentSize > MIN_CONTENT_SIZE ) { mergedIndices = smallUnusedContents; - } else return; + } else { + return; + } /** @type {PackContent[] } */ const mergedContent = []; @@ -690,15 +693,17 @@ class PackContentItems { const durationHr = process.hrtime(start); const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; if (duration > 1) { - if (duration > 500) + if (duration > 500) { logger.error(`Serialization of '${key}': ${duration} ms`); - else if (duration > 50) + } else if (duration > 50) { logger.warn(`Serialization of '${key}': ${duration} ms`); - else if (duration > 10) + } else if (duration > 10) { logger.info(`Serialization of '${key}': ${duration} ms`); - else if (duration > 5) + } else if (duration > 5) { logger.log(`Serialization of '${key}': ${duration} ms`); - else logger.debug(`Serialization of '${key}': ${duration} ms`); + } else { + logger.debug(`Serialization of '${key}': ${duration} ms`); + } } } catch (err) { rollback(s); @@ -765,15 +770,17 @@ class PackContentItems { const durationHr = process.hrtime(start); const duration = durationHr[0] * 1000 + durationHr[1] / 1e6; if (duration > 1) { - if (duration > 100) + if (duration > 100) { logger.error(`Deserialization of '${key}': ${duration} ms`); - else if (duration > 20) + } else if (duration > 20) { logger.warn(`Deserialization of '${key}': ${duration} ms`); - else if (duration > 5) + } else if (duration > 5) { logger.info(`Deserialization of '${key}': ${duration} ms`); - else if (duration > 2) + } else if (duration > 2) { logger.log(`Deserialization of '${key}': ${duration} ms`); - else logger.debug(`Deserialization of '${key}': ${duration} ms`); + } else { + logger.debug(`Deserialization of '${key}': ${duration} ms`); + } } map.set(key, value); key = read(); @@ -1290,8 +1297,9 @@ class PackFileCacheStrategy { pack.maxAge = this.maxAge; this.buildSnapshot = buildSnapshot; if (buildDependencies) this.buildDependencies = buildDependencies; - if (newBuildDependencies) + if (newBuildDependencies) { this.newBuildDependencies.addAll(newBuildDependencies); + } this.resolveResults = resolveResults; this.resolveBuildDependenciesSnapshot = resolveBuildDependenciesSnapshot; diff --git a/lib/cache/ResolverCachePlugin.js b/lib/cache/ResolverCachePlugin.js index 013838a507e..8e918546a02 100644 --- a/lib/cache/ResolverCachePlugin.js +++ b/lib/cache/ResolverCachePlugin.js @@ -219,15 +219,18 @@ class ResolverCachePlugin { const resolveResult = withYield ? yieldResult : result; // since we intercept resolve hook // we still can get result in callback - if (withYield && result) - /** @type {ResolveRequest[]} */ (yieldResult).push(result); + if (withYield && result) { + /** @type {ResolveRequest[]} */ + (yieldResult).push(result); + } if (!snapshot) { - if (resolveResult) + if (resolveResult) { return callback( null, /** @type {ResolveRequest} */ (resolveResult) ); + } return callback(); } itemCache.store( @@ -238,12 +241,13 @@ class ResolverCachePlugin { ), storeErr => { if (storeErr) return callback(storeErr); - if (resolveResult) + if (resolveResult) { return callback( null, /** @type {ResolveRequest} */ (resolveResult) ); + } callback(); } ); @@ -266,8 +270,9 @@ class ResolverCachePlugin { if ( /** @type {ResolveOptions & { cache: boolean }} */ (options).cache !== true - ) + ) { return; + } const optionsIdent = objectToString(userOptions, false); const cacheWithContext = options.cacheWithContext !== undefined @@ -323,13 +328,14 @@ class ResolverCachePlugin { if (err) { callback(err); } else { - if (result) + if (result) { for (const r of /** @type {ResolveRequest[]} */ ( result )) { /** @type {Yield} */ (resolveContext.yield)(r); } + } callback(null, null); } yields = undefined; @@ -345,11 +351,13 @@ class ResolverCachePlugin { for (let i = 0; i < definedCallbacks.length; i++) { const cb = definedCallbacks[i]; const yield_ = /** @type {Yield[]} */ (yields)[i]; - if (result) + if (result) { for (const r of /** @type {ResolveRequest[]} */ ( result - )) + )) { yield_(r); + } + } cb(null, null); } } diff --git a/lib/cli.js b/lib/cli.js index 168bdef7ad2..c7efa90ce1c 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -632,16 +632,18 @@ const parseValueForArgumentConfig = (argConfig, value) => { if (typeof value === "string") { // cspell:word yugi const match = /^\/(.*)\/([yugi]*)$/.exec(value); - if (match && !/[^\\]\//.test(match[1])) + if (match && !/[^\\]\//.test(match[1])) { return new RegExp(match[1], match[2]); + } } break; case "enum": { const values = /** @type {EnumValue[]} */ (argConfig.values); - if (values.includes(/** @type {Exclude} */ (value))) + if (values.includes(/** @type {Exclude} */ (value))) { return value; + } for (const item of values) { if (`${item}` === value) return item; } diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 09759c5fd34..f949157a641 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -287,6 +287,7 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => { F(options, "externalsType", () => { const validExternalTypes = require("../../schemas/WebpackOptions.json") .definitions.ExternalsType.enum; + return options.output.library && validExternalTypes.includes(options.output.library.type) ? /** @type {ExternalsType} */ (options.output.library.type) @@ -994,7 +995,7 @@ const applyOutputDefaults = ( if (libraryName) return libraryName; const pkgPath = path.resolve(context, "package.json"); try { - const packageInfo = JSON.parse(fs.readFileSync(pkgPath, "utf-8")); + const packageInfo = JSON.parse(fs.readFileSync(pkgPath, "utf8")); return packageInfo.name || ""; } catch (err) { if (/** @type {Error & { code: string }} */ (err).code !== "ENOENT") { @@ -1485,8 +1486,9 @@ const applyNodeDefaults = ( }); const handlerForNames = () => { - if (targetProperties && targetProperties.node) + if (targetProperties && targetProperties.node) { return outputModule ? "node-module" : "eval-only"; + } // TODO webpack 6 should always default to false return futureDefaults ? "warn-mock" : "mock"; }; @@ -1554,6 +1556,7 @@ const applyOptimizationDefaults = ( apply: compiler => { // Lazy load the Terser plugin const TerserPlugin = require("terser-webpack-plugin"); + new TerserPlugin({ terserOptions: { compress: { diff --git a/lib/config/normalization.js b/lib/config/normalization.js index bfc0a93abee..04a7a2d4ab2 100644 --- a/lib/config/normalization.js +++ b/lib/config/normalization.js @@ -386,8 +386,9 @@ const getNormalizedWebpackOptions = config => ({ strictModuleExceptionHandling: output.strictModuleExceptionHandling, trustedTypes: optionalNestedConfig(output.trustedTypes, trustedTypes => { if (trustedTypes === true) return {}; - if (typeof trustedTypes === "string") + if (typeof trustedTypes === "string") { return { policyName: trustedTypes }; + } return { ...trustedTypes }; }), uniqueName: output.uniqueName, diff --git a/lib/config/target.js b/lib/config/target.js index 230808b9cef..2ddb5456a31 100644 --- a/lib/config/target.js +++ b/lib/config/target.js @@ -289,7 +289,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis /^es(\d+)$/, version => { let v = Number(version); - if (v < 1000) v = v + 2009; + if (v < 1000) v += 2009; return { const: v >= 2015, templateLiteral: v >= 2015, @@ -357,9 +357,10 @@ const mergeTargetProperties = targetProperties => { break; } } - if (hasTrue || hasFalse) + if (hasTrue || hasFalse) { /** @type {TargetProperties} */ (result)[key] = hasFalse && hasTrue ? null : Boolean(hasTrue); + } } return result; }; diff --git a/lib/container/ContainerPlugin.js b/lib/container/ContainerPlugin.js index ec3fe84091d..9a497fc5ad8 100644 --- a/lib/container/ContainerPlugin.js +++ b/lib/container/ContainerPlugin.js @@ -22,7 +22,7 @@ const getModuleFederationPlugin = memoize(() => ); const validate = createSchemaValidation( - require("../../schemas/plugins/container/ContainerPlugin.check.js"), + require("../../schemas/plugins/container/ContainerPlugin.check"), () => require("../../schemas/plugins/container/ContainerPlugin.json"), { name: "Container Plugin", diff --git a/lib/container/ContainerReferencePlugin.js b/lib/container/ContainerReferencePlugin.js index ba7bb011bbf..207329afe61 100644 --- a/lib/container/ContainerReferencePlugin.js +++ b/lib/container/ContainerReferencePlugin.js @@ -21,7 +21,7 @@ const { parseOptions } = require("./options"); /** @typedef {import("../Compiler")} Compiler */ const validate = createSchemaValidation( - require("../../schemas/plugins/container/ContainerReferencePlugin.check.js"), + require("../../schemas/plugins/container/ContainerReferencePlugin.check"), () => require("../../schemas/plugins/container/ContainerReferencePlugin.json"), { diff --git a/lib/container/FallbackModule.js b/lib/container/FallbackModule.js index 07963382944..7e0be846aa9 100644 --- a/lib/container/FallbackModule.js +++ b/lib/container/FallbackModule.js @@ -104,8 +104,9 @@ class FallbackModule extends Module { }; this.clearDependenciesAndBlocks(); - for (const request of this.requests) + for (const request of this.requests) { this.addDependency(new FallbackItemDependency(request)); + } callback(); } diff --git a/lib/container/ModuleFederationPlugin.js b/lib/container/ModuleFederationPlugin.js index adbf36e1e2c..721f8ae8551 100644 --- a/lib/container/ModuleFederationPlugin.js +++ b/lib/container/ModuleFederationPlugin.js @@ -6,7 +6,7 @@ "use strict"; const { SyncHook } = require("tapable"); -const isValidExternalsType = require("../../schemas/plugins/container/ExternalsType.check.js"); +const isValidExternalsType = require("../../schemas/plugins/container/ExternalsType.check"); const Compilation = require("../Compilation"); const SharePlugin = require("../sharing/SharePlugin"); const createSchemaValidation = require("../util/create-schema-validation"); @@ -27,7 +27,7 @@ const HoistContainerReferences = require("./HoistContainerReferencesPlugin"); */ const validate = createSchemaValidation( - require("../../schemas/plugins/container/ModuleFederationPlugin.check.js"), + require("../../schemas/plugins/container/ModuleFederationPlugin.check"), () => require("../../schemas/plugins/container/ModuleFederationPlugin.json"), { name: "Module Federation Plugin", diff --git a/lib/css/CssGenerator.js b/lib/css/CssGenerator.js index d717d9b4899..7709e23bd43 100644 --- a/lib/css/CssGenerator.js +++ b/lib/css/CssGenerator.js @@ -155,7 +155,9 @@ class CssGenerator extends Generator { continue; } let identifier = Template.toIdentifier(usedName); + const { RESERVED_IDENTIFIER } = require("../util/propertyName"); + if (RESERVED_IDENTIFIER.has(identifier)) { identifier = `_${identifier}`; } @@ -260,8 +262,9 @@ class CssGenerator extends Generator { if (!connection.originModule) { continue; } - if (connection.originModule.type.split("/")[0] !== CSS_TYPE) + if (connection.originModule.type.split("/")[0] !== CSS_TYPE) { sourceTypes.add(JS_TYPE); + } } if (sourceTypes.has(JS_TYPE)) { return JS_AND_CSS_TYPES; diff --git a/lib/css/CssModulesPlugin.js b/lib/css/CssModulesPlugin.js index 4e0a569adab..9a9cbd9be11 100644 --- a/lib/css/CssModulesPlugin.js +++ b/lib/css/CssModulesPlugin.js @@ -99,6 +99,7 @@ const getCssLoadingRuntimeModule = memoize(() => */ const getSchema = name => { const { definitions } = require("../../schemas/WebpackOptions.json"); + return { definitions, oneOf: [{ $ref: `#/definitions/${name}` }] @@ -111,22 +112,22 @@ const generatorValidationOptions = { }; const validateGeneratorOptions = { css: createSchemaValidation( - require("../../schemas/plugins/css/CssGeneratorOptions.check.js"), + require("../../schemas/plugins/css/CssGeneratorOptions.check"), () => getSchema("CssGeneratorOptions"), generatorValidationOptions ), "css/auto": createSchemaValidation( - require("../../schemas/plugins/css/CssAutoGeneratorOptions.check.js"), + require("../../schemas/plugins/css/CssAutoGeneratorOptions.check"), () => getSchema("CssAutoGeneratorOptions"), generatorValidationOptions ), "css/module": createSchemaValidation( - require("../../schemas/plugins/css/CssModuleGeneratorOptions.check.js"), + require("../../schemas/plugins/css/CssModuleGeneratorOptions.check"), () => getSchema("CssModuleGeneratorOptions"), generatorValidationOptions ), "css/global": createSchemaValidation( - require("../../schemas/plugins/css/CssGlobalGeneratorOptions.check.js"), + require("../../schemas/plugins/css/CssGlobalGeneratorOptions.check"), () => getSchema("CssGlobalGeneratorOptions"), generatorValidationOptions ) @@ -138,22 +139,22 @@ const parserValidationOptions = { }; const validateParserOptions = { css: createSchemaValidation( - require("../../schemas/plugins/css/CssParserOptions.check.js"), + require("../../schemas/plugins/css/CssParserOptions.check"), () => getSchema("CssParserOptions"), parserValidationOptions ), "css/auto": createSchemaValidation( - require("../../schemas/plugins/css/CssAutoParserOptions.check.js"), + require("../../schemas/plugins/css/CssAutoParserOptions.check"), () => getSchema("CssAutoParserOptions"), parserValidationOptions ), "css/module": createSchemaValidation( - require("../../schemas/plugins/css/CssModuleParserOptions.check.js"), + require("../../schemas/plugins/css/CssModuleParserOptions.check"), () => getSchema("CssModuleParserOptions"), parserValidationOptions ), "css/global": createSchemaValidation( - require("../../schemas/plugins/css/CssGlobalParserOptions.check.js"), + require("../../schemas/plugins/css/CssGlobalParserOptions.check"), () => getSchema("CssGlobalParserOptions"), parserValidationOptions ) @@ -622,8 +623,9 @@ class CssModulesPlugin { return { list: sortedModules, set: new Set(sortedModules) }; }); - if (modulesByChunkGroup.length === 1) + if (modulesByChunkGroup.length === 1) { return modulesByChunkGroup[0].list.reverse(); + } const boundCompareModulesByIdOrIdentifier = compareModulesByIdOrIdentifier( compilation.chunkGraph @@ -698,8 +700,9 @@ class CssModulesPlugin { // Remove the selected module from all lists for (const { list, set } of modulesByChunkGroup) { const lastModule = list[list.length - 1]; - if (lastModule === selectedModule) list.pop(); - else if (hasFailed && set.has(selectedModule)) { + if (lastModule === selectedModule) { + list.pop(); + } else if (hasFailed && set.has(selectedModule)) { const idx = list.indexOf(selectedModule); if (idx >= 0) list.splice(idx, 1); } diff --git a/lib/css/CssParser.js b/lib/css/CssParser.js index f04a9ee2fd4..c4987c23fc4 100644 --- a/lib/css/CssParser.js +++ b/lib/css/CssParser.js @@ -117,6 +117,7 @@ const escapeIdentifier = str => { let value; + // eslint-disable-next-line no-control-regex if (/[\t\n\f\r\u000B]/.test(character)) { const codePoint = character.charCodeAt(0); @@ -254,8 +255,9 @@ class LocConverter { } else { this.column = str.length - i - 1; this.line++; - while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1) + while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1) { this.line++; + } } } else { let i = this._input.lastIndexOf("\n", this.pos); @@ -337,7 +339,7 @@ class CssParser extends Parser { */ parse(source, state) { if (Buffer.isBuffer(source)) { - source = source.toString("utf-8"); + source = source.toString("utf8"); } else if (typeof source === "object") { throw new Error("webpackAst is unexpected for the CssParser"); } diff --git a/lib/css/walkCssTokens.js b/lib/css/walkCssTokens.js index ea019b3e4b6..27f7644d7a1 100644 --- a/lib/css/walkCssTokens.js +++ b/lib/css/walkCssTokens.js @@ -1409,7 +1409,7 @@ module.exports.eatImageSetStrings = (input, pos, cbs) => { module.exports.eatImportTokens = (input, pos, cbs) => { const result = /** @type {[[number, number, number, number] | undefined, [number, number] | undefined, [number, number] | undefined, [number, number] | undefined]} */ - (new Array(4)); + (Array.from({ length: 4 })); /** @type {0 | 1 | 2 | undefined} */ let scope; diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js index 23efe5d3007..b5b3d16ed65 100644 --- a/lib/debug/ProfilingPlugin.js +++ b/lib/debug/ProfilingPlugin.js @@ -27,7 +27,7 @@ const { dirname, mkdirpSync } = require("../util/fs"); /** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ const validate = createSchemaValidation( - require("../../schemas/plugins/debug/ProfilingPlugin.check.js"), + require("../../schemas/plugins/debug/ProfilingPlugin.check"), () => require("../../schemas/plugins/debug/ProfilingPlugin.json"), { name: "Profiling Plugin", diff --git a/lib/dependencies/AMDDefineDependencyParserPlugin.js b/lib/dependencies/AMDDefineDependencyParserPlugin.js index 964c9b7e795..43bb2763e30 100644 --- a/lib/dependencies/AMDDefineDependencyParserPlugin.js +++ b/lib/dependencies/AMDDefineDependencyParserPlugin.js @@ -105,10 +105,11 @@ class AMDDefineDependencyParserPlugin { ["require", "module", "exports"].includes( /** @type {string} */ (item.string) ) - ) - identifiers[/** @type {number} */ (idx)] = /** @type {string} */ ( - item.string - ); + ) { + identifiers[/** @type {number} */ (idx)] = + /** @type {string} */ + (item.string); + } const result = this.processItem(parser, expr, item, namedModule); if (result === undefined) { this.processContext(parser, expr, item); diff --git a/lib/dependencies/AMDPlugin.js b/lib/dependencies/AMDPlugin.js index be8ab4ee641..29ebc30edda 100644 --- a/lib/dependencies/AMDPlugin.js +++ b/lib/dependencies/AMDPlugin.js @@ -156,14 +156,14 @@ class AMDPlugin { ); parser.hooks.evaluateIdentifier .for(optionExpr) - .tap(PLUGIN_NAME, function (expr) { - return evaluateToIdentifier( + .tap(PLUGIN_NAME, expr => + evaluateToIdentifier( optionExpr, rootName, getMembers, true - )(expr); - }); + )(expr) + ); parser.hooks.evaluateTypeof .for(optionExpr) .tap(PLUGIN_NAME, evaluateToString("object")); diff --git a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js index 9ef26dfaa80..e0bbf60b926 100644 --- a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +++ b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js @@ -416,4 +416,5 @@ class AMDRequireDependenciesBlockParserPlugin { return new AMDRequireArrayDependency(depsArray, range); } } + module.exports = AMDRequireDependenciesBlockParserPlugin; diff --git a/lib/dependencies/CommonJsExportRequireDependency.js b/lib/dependencies/CommonJsExportRequireDependency.js index cf00ffae801..497a2f23696 100644 --- a/lib/dependencies/CommonJsExportRequireDependency.js +++ b/lib/dependencies/CommonJsExportRequireDependency.js @@ -223,14 +223,16 @@ class CommonJsExportRequireDependency extends ModuleDependency { /** @type {ExportsInfo | undefined} */ let importedExportsInfo = moduleGraph.getExportsInfo(importedModule); const ids = this.getIds(moduleGraph); - if (ids.length > 0) + if (ids.length > 0) { importedExportsInfo = importedExportsInfo.getNestedExportsInfo(ids); + } /** @type {ExportsInfo | undefined} */ let exportsInfo = moduleGraph.getExportsInfo( /** @type {Module} */ (moduleGraph.getParentModule(this)) ); - if (this.names.length > 0) + if (this.names.length > 0) { exportsInfo = exportsInfo.getNestedExportsInfo(this.names); + } const noExtraExports = importedExportsInfo && diff --git a/lib/dependencies/CommonJsExportsParserPlugin.js b/lib/dependencies/CommonJsExportsParserPlugin.js index e65b66595f4..400882c2999 100644 --- a/lib/dependencies/CommonJsExportsParserPlugin.js +++ b/lib/dependencies/CommonJsExportsParserPlugin.js @@ -404,4 +404,5 @@ class CommonJsExportsParserPlugin { }); } } + module.exports = CommonJsExportsParserPlugin; diff --git a/lib/dependencies/CommonJsImportsParserPlugin.js b/lib/dependencies/CommonJsImportsParserPlugin.js index 23705746716..82962ce7cda 100644 --- a/lib/dependencies/CommonJsImportsParserPlugin.js +++ b/lib/dependencies/CommonJsImportsParserPlugin.js @@ -687,8 +687,9 @@ class CommonJsImportsParserPlugin { statement.specifiers[0].type !== "ImportSpecifier" || statement.specifiers[0].imported.type !== "Identifier" || statement.specifiers[0].imported.name !== specifierName - ) + ) { return; + } // clear for 'import { createRequire as x } from "module"' // if any other specifier was used import module const clearDep = new ConstDependency( @@ -720,8 +721,9 @@ class CommonJsImportsParserPlugin { !declarator.init || declarator.init.type !== "CallExpression" || declarator.init.callee.type !== "Identifier" - ) + ) { return; + } const variableInfo = parser.getVariableInfo(declarator.init.callee.name); if ( variableInfo instanceof VariableInfo && @@ -745,8 +747,9 @@ class CommonJsImportsParserPlugin { calleeMembers.length !== 0 || members.length !== 1 || members[0] !== "cache" - ) + ) { return; + } // createRequire().cache const context = parseCreateRequireArguments(callExpr); if (context === undefined) return; @@ -759,8 +762,9 @@ class CommonJsImportsParserPlugin { calleeMembers.length !== 0 || members.length !== 1 || members[0] !== "resolve" - ) + ) { return; + } // createRequire().resolve() return processResolve(expr, false); }); @@ -792,4 +796,5 @@ class CommonJsImportsParserPlugin { // #endregion } } + module.exports = CommonJsImportsParserPlugin; diff --git a/lib/dependencies/CommonJsPlugin.js b/lib/dependencies/CommonJsPlugin.js index b148b17b0b9..472022e530c 100644 --- a/lib/dependencies/CommonJsPlugin.js +++ b/lib/dependencies/CommonJsPlugin.js @@ -180,8 +180,9 @@ class CommonJsPlugin { * @returns {void} */ const handler = (parser, parserOptions) => { - if (parserOptions.commonjs !== undefined && !parserOptions.commonjs) + if (parserOptions.commonjs !== undefined && !parserOptions.commonjs) { return; + } parser.hooks.typeof .for("module") .tap( diff --git a/lib/dependencies/ContextDependencyHelpers.js b/lib/dependencies/ContextDependencyHelpers.js index e7ecc8652af..6f18e062ca8 100644 --- a/lib/dependencies/ContextDependencyHelpers.js +++ b/lib/dependencies/ContextDependencyHelpers.js @@ -236,11 +236,12 @@ module.exports.create = ( if (parser && param.wrappedInnerExpressions) { for (const part of param.wrappedInnerExpressions) { - if (part.expression) + if (part.expression) { parser.walkExpression( /** @type {Expression} */ (part.expression) ); + } } } diff --git a/lib/dependencies/ContextDependencyTemplateAsId.js b/lib/dependencies/ContextDependencyTemplateAsId.js index b0eb8b2c318..da119adb09f 100644 --- a/lib/dependencies/ContextDependencyTemplateAsId.js +++ b/lib/dependencies/ContextDependencyTemplateAsId.js @@ -59,4 +59,5 @@ class ContextDependencyTemplateAsId extends ContextDependency.Template { } } } + module.exports = ContextDependencyTemplateAsId; diff --git a/lib/dependencies/ContextDependencyTemplateAsRequireCall.js b/lib/dependencies/ContextDependencyTemplateAsRequireCall.js index 8907f9f55d8..ef02cce675f 100644 --- a/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +++ b/lib/dependencies/ContextDependencyTemplateAsRequireCall.js @@ -56,4 +56,5 @@ class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template } } } + module.exports = ContextDependencyTemplateAsRequireCall; diff --git a/lib/dependencies/CssSelfLocalIdentifierDependency.js b/lib/dependencies/CssSelfLocalIdentifierDependency.js index b63ff53a74e..6d4ac1ed180 100644 --- a/lib/dependencies/CssSelfLocalIdentifierDependency.js +++ b/lib/dependencies/CssSelfLocalIdentifierDependency.js @@ -63,8 +63,9 @@ class CssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency { * @returns {(string[] | ReferencedExport)[]} referenced exports */ getReferencedExports(moduleGraph, runtime) { - if (this.declaredSet && !this.declaredSet.has(this.name)) + if (this.declaredSet && !this.declaredSet.has(this.name)) { return Dependency.NO_EXPORTS_REFERENCED; + } return [[this.name]]; } diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index cd95213ee26..a5e9b4ab7e2 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -583,8 +583,9 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { return Dependency.EXPORTS_OBJECT_REFERENCED; case "reexport-named-default": { - if (!mode.partialNamespaceExportInfo) + if (!mode.partialNamespaceExportInfo) { return Dependency.EXPORTS_OBJECT_REFERENCED; + } /** @type {ReferencedExports} */ const referencedExports = []; processExportInfo( @@ -598,8 +599,9 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { case "reexport-namespace-object": case "reexport-fake-namespace-object": { - if (!mode.partialNamespaceExportInfo) + if (!mode.partialNamespaceExportInfo) { return Dependency.EXPORTS_OBJECT_REFERENCED; + } /** @type {ReferencedExports} */ const referencedExports = []; processExportInfo( @@ -817,8 +819,9 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { * @returns {ExportPresenceMode} effective mode */ _getEffectiveExportPresenceLevel(moduleGraph) { - if (this.exportPresenceMode !== ExportPresenceModes.AUTO) + if (this.exportPresenceMode !== ExportPresenceModes.AUTO) { return this.exportPresenceMode; + } const module = /** @type {Module} */ (moduleGraph.getParentModule(this)); return /** @type {BuildMeta} */ (module.buildMeta).strictHarmonyModule ? ExportPresenceModes.ERROR diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index 65a722814dc..a497bc3a29d 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -190,8 +190,9 @@ module.exports = class HarmonyImportDependencyParserPlugin { !rootInfo || !rootInfo.tagInfo || rootInfo.tagInfo.tag !== harmonySpecifierTag - ) + ) { return; + } const settings = /** @type {TagData} */ (rootInfo.tagInfo.data); const members = /** @type {(() => string[])} */ diff --git a/lib/dependencies/HarmonyImportSpecifierDependency.js b/lib/dependencies/HarmonyImportSpecifierDependency.js index 8b30d7947ca..3a56bc00098 100644 --- a/lib/dependencies/HarmonyImportSpecifierDependency.js +++ b/lib/dependencies/HarmonyImportSpecifierDependency.js @@ -167,8 +167,9 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { ) { case "default-only": case "default-with-named": - if (ids.length === 1) + if (ids.length === 1) { return this._getReferencedExportsInDestructuring(); + } ids = ids.slice(1); namespaceObjectAsContext = true; break; @@ -210,8 +211,9 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { * @returns {ExportPresenceMode} effective mode */ _getEffectiveExportPresenceLevel(moduleGraph) { - if (this.exportPresenceMode !== ExportPresenceModes.AUTO) + if (this.exportPresenceMode !== ExportPresenceModes.AUTO) { return this.exportPresenceMode; + } const buildMeta = /** @type {BuildMeta} */ ( diff --git a/lib/dependencies/HarmonyModulesPlugin.js b/lib/dependencies/HarmonyModulesPlugin.js index 5665a21edfd..45492441840 100644 --- a/lib/dependencies/HarmonyModulesPlugin.js +++ b/lib/dependencies/HarmonyModulesPlugin.js @@ -130,8 +130,9 @@ class HarmonyModulesPlugin { */ const handler = (parser, parserOptions) => { // TODO webpack 6: rename harmony to esm or module - if (parserOptions.harmony !== undefined && !parserOptions.harmony) + if (parserOptions.harmony !== undefined && !parserOptions.harmony) { return; + } new HarmonyDetectionParserPlugin(this.options).apply(parser); new HarmonyImportDependencyParserPlugin( @@ -155,4 +156,5 @@ class HarmonyModulesPlugin { ); } } + module.exports = HarmonyModulesPlugin; diff --git a/lib/dependencies/ImportMetaContextDependencyParserPlugin.js b/lib/dependencies/ImportMetaContextDependencyParserPlugin.js index 1ad181a7baf..6b5c2bb6aaa 100644 --- a/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +++ b/lib/dependencies/ImportMetaContextDependencyParserPlugin.js @@ -186,6 +186,7 @@ module.exports = class ImportMetaContextDependencyParserPlugin { }) ) { exports = []; + for (const i1 of items) { /** @type {string[]} */ const export_ = []; diff --git a/lib/dependencies/ImportMetaContextPlugin.js b/lib/dependencies/ImportMetaContextPlugin.js index ed9ac05da53..d3b96203e84 100644 --- a/lib/dependencies/ImportMetaContextPlugin.js +++ b/lib/dependencies/ImportMetaContextPlugin.js @@ -52,8 +52,9 @@ class ImportMetaContextPlugin { if ( parserOptions.importMetaContext !== undefined && !parserOptions.importMetaContext - ) + ) { return; + } new ImportMetaContextDependencyParserPlugin().apply(parser); }; diff --git a/lib/dependencies/ImportParserPlugin.js b/lib/dependencies/ImportParserPlugin.js index e32b7469129..7c28451edd1 100644 --- a/lib/dependencies/ImportParserPlugin.js +++ b/lib/dependencies/ImportParserPlugin.js @@ -63,20 +63,26 @@ class ImportParserPlugin { dynamicImportPrefetch, dynamicImportFetchPriority } = this.options; - if (dynamicImportPreload !== undefined && dynamicImportPreload !== false) + if ( + dynamicImportPreload !== undefined && + dynamicImportPreload !== false + ) { groupOptions.preloadOrder = dynamicImportPreload === true ? 0 : dynamicImportPreload; + } if ( dynamicImportPrefetch !== undefined && dynamicImportPrefetch !== false - ) + ) { groupOptions.prefetchOrder = dynamicImportPrefetch === true ? 0 : dynamicImportPrefetch; + } if ( dynamicImportFetchPriority !== undefined && dynamicImportFetchPriority !== false - ) + ) { groupOptions.fetchPriority = dynamicImportFetchPriority; + } const { options: importOptions, errors: commentErrors } = parser.parseCommentOptions(/** @type {Range} */ (expr.range)); @@ -278,6 +284,7 @@ class ImportParserPlugin { ) ); } + exports = exportsFromEnumerable( [...referencedPropertiesInDestructuring].map(({ id }) => id) ); diff --git a/lib/dependencies/ImportPlugin.js b/lib/dependencies/ImportPlugin.js index 4ee51a8f748..50537ad6ffc 100644 --- a/lib/dependencies/ImportPlugin.js +++ b/lib/dependencies/ImportPlugin.js @@ -74,8 +74,9 @@ class ImportPlugin { * @returns {void} */ const handler = (parser, parserOptions) => { - if (parserOptions.import !== undefined && !parserOptions.import) + if (parserOptions.import !== undefined && !parserOptions.import) { return; + } new ImportParserPlugin(parserOptions).apply(parser); }; @@ -93,4 +94,5 @@ class ImportPlugin { ); } } + module.exports = ImportPlugin; diff --git a/lib/dependencies/LoaderPlugin.js b/lib/dependencies/LoaderPlugin.js index fe7cdd51fe2..b61bfa303e1 100644 --- a/lib/dependencies/LoaderPlugin.js +++ b/lib/dependencies/LoaderPlugin.js @@ -281,4 +281,5 @@ class LoaderPlugin { }); } } + module.exports = LoaderPlugin; diff --git a/lib/dependencies/ModuleDependencyTemplateAsRequireId.js b/lib/dependencies/ModuleDependencyTemplateAsRequireId.js index 9e05906cfe1..6b164178979 100644 --- a/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +++ b/lib/dependencies/ModuleDependencyTemplateAsRequireId.js @@ -35,4 +35,5 @@ class ModuleDependencyTemplateAsRequireId extends ModuleDependency.Template { source.replace(dep.range[0], dep.range[1] - 1, content); } } + module.exports = ModuleDependencyTemplateAsRequireId; diff --git a/lib/dependencies/RequireContextPlugin.js b/lib/dependencies/RequireContextPlugin.js index 5add053d062..5ac66f930e4 100644 --- a/lib/dependencies/RequireContextPlugin.js +++ b/lib/dependencies/RequireContextPlugin.js @@ -57,8 +57,9 @@ class RequireContextPlugin { if ( parserOptions.requireContext !== undefined && !parserOptions.requireContext - ) + ) { return; + } new RequireContextDependencyParserPlugin().apply(parser); }; @@ -161,4 +162,5 @@ class RequireContextPlugin { ); } } + module.exports = RequireContextPlugin; diff --git a/lib/dependencies/RequireEnsurePlugin.js b/lib/dependencies/RequireEnsurePlugin.js index 5a1dc31dbdd..6ae920af5b3 100644 --- a/lib/dependencies/RequireEnsurePlugin.js +++ b/lib/dependencies/RequireEnsurePlugin.js @@ -58,8 +58,9 @@ class RequireEnsurePlugin { if ( parserOptions.requireEnsure !== undefined && !parserOptions.requireEnsure - ) + ) { return; + } new RequireEnsureDependenciesBlockParserPlugin().apply(parser); parser.hooks.evaluateTypeof @@ -83,4 +84,5 @@ class RequireEnsurePlugin { ); } } + module.exports = RequireEnsurePlugin; diff --git a/lib/dependencies/RequireIncludePlugin.js b/lib/dependencies/RequireIncludePlugin.js index af5bd0215fd..850d69549e3 100644 --- a/lib/dependencies/RequireIncludePlugin.js +++ b/lib/dependencies/RequireIncludePlugin.js @@ -59,4 +59,5 @@ class RequireIncludePlugin { ); } } + module.exports = RequireIncludePlugin; diff --git a/lib/dependencies/WorkerPlugin.js b/lib/dependencies/WorkerPlugin.js index 9205d3147bf..cd033354842 100644 --- a/lib/dependencies/WorkerPlugin.js +++ b/lib/dependencies/WorkerPlugin.js @@ -122,8 +122,9 @@ class WorkerPlugin { * @returns {[string, Range] | void} parsed */ const parseModuleUrl = (parser, expr) => { - if (expr.type !== "NewExpression" || expr.callee.type === "Super") + if (expr.type !== "NewExpression" || expr.callee.type === "Super") { return; + } if ( expr.arguments.length === 1 && expr.arguments[0].type === "MemberExpression" && @@ -179,8 +180,9 @@ class WorkerPlugin { chain.object.meta.name !== "import" || chain.object.property.name !== "meta" || chain.members[0] !== "url" - ) + ) { return false; + } return true; }; @@ -215,8 +217,9 @@ class WorkerPlugin { /** @type {Expression} */ (prop.value) ); - if (value.isCompileTimeValue()) + if (value.isCompileTimeValue()) { values[prop.key.name] = value.asCompileTimeValue(); + } } } else { otherElements.push(prop); @@ -251,8 +254,9 @@ class WorkerPlugin { * @returns {boolean | void} true when handled */ const handleNewWorker = expr => { - if (expr.arguments.length === 0 || expr.arguments.length > 2) + if (expr.arguments.length === 0 || expr.arguments.length > 2) { return; + } const [arg1, arg2] = expr.arguments; if (arg1.type === "SpreadElement") return; if (arg2 && arg2.type === "SpreadElement") return; @@ -543,7 +547,9 @@ class WorkerPlugin { for (const itemFromDefault of DEFAULT_SYNTAX) { processItem(itemFromDefault); } - } else processItem(item); + } else { + processItem(item); + } } }; normalModuleFactory.hooks.parser @@ -556,4 +562,5 @@ class WorkerPlugin { ); } } + module.exports = WorkerPlugin; diff --git a/lib/dependencies/processExportInfo.js b/lib/dependencies/processExportInfo.js index 9bafcae635a..742b9bca005 100644 --- a/lib/dependencies/processExportInfo.js +++ b/lib/dependencies/processExportInfo.js @@ -64,4 +64,5 @@ const processExportInfo = ( } alreadyVisited.delete(exportInfo); }; + module.exports = processExportInfo; diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index f3136eac893..6f0b8e6f874 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -239,8 +239,12 @@ class ModuleChunkFormatPlugin { ); const processChunks = new Set(); for (const _chunk of chunks) { - if (loadedChunks.has(_chunk) || entryDependentChunks.has(_chunk)) + if ( + loadedChunks.has(_chunk) || + entryDependentChunks.has(_chunk) + ) { continue; + } loadedChunks.add(_chunk); processChunks.add(_chunk); } diff --git a/lib/hmr/HotModuleReplacement.runtime.js b/lib/hmr/HotModuleReplacement.runtime.js index e9fec891700..cb6d22d1562 100644 --- a/lib/hmr/HotModuleReplacement.runtime.js +++ b/lib/hmr/HotModuleReplacement.runtime.js @@ -8,7 +8,6 @@ var $interceptModuleExecution$ = undefined; var $moduleCache$ = undefined; -// eslint-disable-next-line no-unused-vars var $hmrModuleData$ = undefined; /** @type {() => Promise} */ var $hmrDownloadManifest$ = undefined; diff --git a/lib/hmr/HotModuleReplacementRuntimeModule.js b/lib/hmr/HotModuleReplacementRuntimeModule.js index b1a254b6db9..67b1a983ae5 100644 --- a/lib/hmr/HotModuleReplacementRuntimeModule.js +++ b/lib/hmr/HotModuleReplacementRuntimeModule.js @@ -19,7 +19,7 @@ class HotModuleReplacementRuntimeModule extends RuntimeModule { */ generate() { return Template.getFunctionContent( - require("./HotModuleReplacement.runtime.js") + require("./HotModuleReplacement.runtime") ) .replace( /\$interceptModuleExecution\$/g, diff --git a/lib/hmr/JavascriptHotModuleReplacementHelper.js b/lib/hmr/JavascriptHotModuleReplacementHelper.js index 3e786d80106..9974735732b 100644 --- a/lib/hmr/JavascriptHotModuleReplacementHelper.js +++ b/lib/hmr/JavascriptHotModuleReplacementHelper.js @@ -15,7 +15,7 @@ const Template = require("../Template"); */ const generateJavascriptHMR = type => Template.getFunctionContent( - require("../hmr/JavascriptHotModuleReplacement.runtime.js") + require("../hmr/JavascriptHotModuleReplacement.runtime") ) .replace(/\$key\$/g, type) .replace(/\$installedChunks\$/g, "installedChunks") diff --git a/lib/hmr/LazyCompilationPlugin.js b/lib/hmr/LazyCompilationPlugin.js index f4a3f704327..e4b4edc6dd1 100644 --- a/lib/hmr/LazyCompilationPlugin.js +++ b/lib/hmr/LazyCompilationPlugin.js @@ -424,15 +424,17 @@ class LazyCompilationPlugin { dep.type === "import() context element")) || (this.entries && dep.type === "entry") ) - ) + ) { return module; + } if ( /webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client|webpack-hot-middleware[/\\]client/.test( resolveData.request ) || !checkTest(this.test, module) - ) + ) { return module; + } const moduleInfo = backend.module(module); if (!moduleInfo) return module; const { client, data, active } = moduleInfo; diff --git a/lib/hmr/lazyCompilationBackend.js b/lib/hmr/lazyCompilationBackend.js index 479e3cd599f..31b8ced3b3f 100644 --- a/lib/hmr/lazyCompilationBackend.js +++ b/lib/hmr/lazyCompilationBackend.js @@ -49,8 +49,9 @@ module.exports = options => (compiler, callback) => { ? options.listen : server => { let listen = options.listen; - if (typeof listen === "object" && !("port" in listen)) + if (typeof listen === "object" && !("port" in listen)) { listen = { ...listen, port: undefined }; + } server.listen(listen); }; @@ -119,8 +120,9 @@ module.exports = options => (compiler, callback) => { err => { if (err) return callback(err); const _addr = server.address(); - if (typeof _addr === "string") + if (typeof _addr === "string") { throw new Error("addr must not be a string"); + } const addr = /** @type {AddressInfo} */ (_addr); const urlBase = addr.address === "::" || addr.address === "0.0.0.0" diff --git a/lib/ids/ChunkModuleIdRangePlugin.js b/lib/ids/ChunkModuleIdRangePlugin.js index 01894e08395..64103224066 100644 --- a/lib/ids/ChunkModuleIdRangePlugin.js +++ b/lib/ids/ChunkModuleIdRangePlugin.js @@ -86,4 +86,5 @@ class ChunkModuleIdRangePlugin { }); } } + module.exports = ChunkModuleIdRangePlugin; diff --git a/lib/ids/DeterministicModuleIdsPlugin.js b/lib/ids/DeterministicModuleIdsPlugin.js index bc3ad4dcc92..a981276242d 100644 --- a/lib/ids/DeterministicModuleIdsPlugin.js +++ b/lib/ids/DeterministicModuleIdsPlugin.js @@ -82,12 +82,13 @@ class DeterministicModuleIdsPlugin { usedIds.size, salt ); - if (failOnConflict && conflicts) + if (failOnConflict && conflicts) { throw new Error( `Assigning deterministic module ids has lead to ${conflicts} conflict${ conflicts > 1 ? "s" : "" }.\nIncrease the 'maxLength' to increase the id space and make conflicts less likely (recommended when there are many conflicts or application is expected to grow), or add an 'salt' number to try another hash starting value in the same id space (recommended when there is only a single conflict).` ); + } }); }); } diff --git a/lib/ids/HashedModuleIdsPlugin.js b/lib/ids/HashedModuleIdsPlugin.js index 2bbb3d1a093..d338fc02b89 100644 --- a/lib/ids/HashedModuleIdsPlugin.js +++ b/lib/ids/HashedModuleIdsPlugin.js @@ -20,7 +20,7 @@ const { /** @typedef {import("../Compiler")} Compiler */ const validate = createSchemaValidation( - require("../../schemas/plugins/HashedModuleIdsPlugin.check.js"), + require("../../schemas/plugins/HashedModuleIdsPlugin.check"), () => require("../../schemas/plugins/HashedModuleIdsPlugin.json"), { name: "Hashed Module Ids Plugin", @@ -77,8 +77,9 @@ class HashedModuleIdsPlugin { hash.digest(options.hashDigest) ); let len = options.hashDigestLength; - while (usedIds.has(hashId.slice(0, len))) + while (usedIds.has(hashId.slice(0, len))) { /** @type {number} */ (len)++; + } const moduleId = hashId.slice(0, len); chunkGraph.setModuleId(module, moduleId); usedIds.add(moduleId); diff --git a/lib/ids/IdHelpers.js b/lib/ids/IdHelpers.js index 5a4c9f04bb3..ac05534b34b 100644 --- a/lib/ids/IdHelpers.js +++ b/lib/ids/IdHelpers.js @@ -56,6 +56,7 @@ const avoidNumber = str => { */ const requestToId = request => request.replace(/^(\.\.?\/)+/, "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); + module.exports.requestToId = requestToId; /** @@ -83,12 +84,14 @@ const getShortModuleName = (module, context, associatedObjectForCache) => { const libIdent = module.libIdent({ context, associatedObjectForCache }); if (libIdent) return avoidNumber(libIdent); const nameForCondition = module.nameForCondition(); - if (nameForCondition) + if (nameForCondition) { return avoidNumber( makePathsRelative(context, nameForCondition, associatedObjectForCache) ); + } return ""; }; + module.exports.getShortModuleName = getShortModuleName; /** @@ -109,6 +112,7 @@ const getLongModuleName = ( const fullName = getFullModuleName(module, context, associatedObjectForCache); return `${shortName}?${getHash(fullName, 4, hashFunction)}`; }; + module.exports.getLongModuleName = getLongModuleName; /** @@ -119,6 +123,7 @@ module.exports.getLongModuleName = getLongModuleName; */ const getFullModuleName = (module, context, associatedObjectForCache) => makePathsRelative(context, module.identifier(), associatedObjectForCache); + module.exports.getFullModuleName = getFullModuleName; /** @@ -149,6 +154,7 @@ const getShortChunkName = ( .join(delimiter); return shortenLongString(chunkName, delimiter, hashFunction); }; + module.exports.getShortChunkName = getShortChunkName; /** @@ -184,6 +190,7 @@ const getLongChunkName = ( .join(delimiter); return shortenLongString(chunkName, delimiter, hashFunction); }; + module.exports.getLongChunkName = getLongChunkName; /** @@ -206,6 +213,7 @@ const getFullChunkName = ( ); return fullModuleNames.join(); }; + module.exports.getFullChunkName = getFullChunkName; /** @@ -258,6 +266,7 @@ const getUsedModuleIdsAndModules = (compilation, filter) => { return [usedIds, modules]; }; + module.exports.getUsedModuleIdsAndModules = getUsedModuleIdsAndModules; /** @@ -282,6 +291,7 @@ const getUsedChunkIds = compilation => { return usedIds; }; + module.exports.getUsedChunkIds = getUsedChunkIds; /** @@ -350,6 +360,7 @@ const assignNames = ( unnamedItems.sort(comparator); return unnamedItems; }; + module.exports.assignNames = assignNames; /** @@ -404,6 +415,7 @@ const assignDeterministicIds = ( } while (!assignId(item, id)); } }; + module.exports.assignDeterministicIds = assignDeterministicIds; /** @@ -441,6 +453,7 @@ const assignAscendingModuleIds = (usedIds, modules, compilation) => { assignId(module); } }; + module.exports.assignAscendingModuleIds = assignAscendingModuleIds; /** @@ -471,4 +484,5 @@ const assignAscendingChunkIds = (chunks, compilation) => { } } }; + module.exports.assignAscendingChunkIds = assignAscendingChunkIds; diff --git a/lib/ids/OccurrenceChunkIdsPlugin.js b/lib/ids/OccurrenceChunkIdsPlugin.js index 3034e32f2a4..7dd97c3a761 100644 --- a/lib/ids/OccurrenceChunkIdsPlugin.js +++ b/lib/ids/OccurrenceChunkIdsPlugin.js @@ -15,7 +15,7 @@ const { assignAscendingChunkIds } = require("./IdHelpers"); /** @typedef {import("../Module")} Module */ const validate = createSchemaValidation( - require("../../schemas/plugins/ids/OccurrenceChunkIdsPlugin.check.js"), + require("../../schemas/plugins/ids/OccurrenceChunkIdsPlugin.check"), () => require("../../schemas/plugins/ids/OccurrenceChunkIdsPlugin.json"), { name: "Occurrence Order Chunk Ids Plugin", diff --git a/lib/ids/OccurrenceModuleIdsPlugin.js b/lib/ids/OccurrenceModuleIdsPlugin.js index 72ddd41bcab..71ca1cc1194 100644 --- a/lib/ids/OccurrenceModuleIdsPlugin.js +++ b/lib/ids/OccurrenceModuleIdsPlugin.js @@ -20,7 +20,7 @@ const { /** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ const validate = createSchemaValidation( - require("../../schemas/plugins/ids/OccurrenceModuleIdsPlugin.check.js"), + require("../../schemas/plugins/ids/OccurrenceModuleIdsPlugin.check"), () => require("../../schemas/plugins/ids/OccurrenceModuleIdsPlugin.json"), { name: "Occurrence Order Module Ids Plugin", diff --git a/lib/index.js b/lib/index.js index e3ca2ce9da3..50a1bd15106 100644 --- a/lib/index.js +++ b/lib/index.js @@ -126,6 +126,7 @@ const mergeExports = (obj, exports) => { }; const fn = lazyFunction(() => require("./webpack")); + module.exports = mergeExports(fn, { get webpack() { return require("./webpack"); @@ -134,7 +135,8 @@ module.exports = mergeExports(fn, { * @returns {(configuration: Configuration | Configuration[]) => void} validate fn */ get validate() { - const webpackOptionsSchemaCheck = require("../schemas/WebpackOptions.check.js"); + const webpackOptionsSchemaCheck = require("../schemas/WebpackOptions.check"); + const getRealValidate = memoize( /** * @returns {(configuration: Configuration | Configuration[]) => void} validate fn @@ -142,16 +144,19 @@ module.exports = mergeExports(fn, { () => { const validateSchema = require("./validateSchema"); const webpackOptionsSchema = require("../schemas/WebpackOptions.json"); + return options => validateSchema(webpackOptionsSchema, options); } ); return options => { - if (!webpackOptionsSchemaCheck(/** @type {TODO} */ (options))) + if (!webpackOptionsSchemaCheck(/** @type {TODO} */ (options))) { getRealValidate()(options); + } }; }, get validateSchema() { const validateSchema = require("./validateSchema"); + return validateSchema; }, get version() { @@ -455,7 +460,7 @@ module.exports = mergeExports(fn, { return require("./optimize/LimitChunkCountPlugin"); }, get MergeDuplicateChunksPlugin() { - return require("./optimize/MergeDuplicateChunksPlugin.js"); + return require("./optimize/MergeDuplicateChunksPlugin"); }, get MinChunkSizePlugin() { return require("./optimize/MinChunkSizePlugin"); diff --git a/lib/javascript/BasicEvaluatedExpression.js b/lib/javascript/BasicEvaluatedExpression.js index 6615c5bd1b6..e322bf9b5c4 100644 --- a/lib/javascript/BasicEvaluatedExpression.js +++ b/lib/javascript/BasicEvaluatedExpression.js @@ -566,7 +566,7 @@ BasicEvaluatedExpression.isValidRegExpFlags = flags => { // cspell:word gimy let remaining = 0b0000; // bit per RegExp flag: gimy - for (let i = 0; i < len; i++) + for (let i = 0; i < len; i++) { switch (flags.charCodeAt(i)) { case 103 /* g */: if (remaining & 0b1000) return false; @@ -587,6 +587,7 @@ BasicEvaluatedExpression.isValidRegExpFlags = flags => { default: return false; } + } return true; }; diff --git a/lib/javascript/ChunkHelpers.js b/lib/javascript/ChunkHelpers.js index f2e8a12a996..30c88653d55 100644 --- a/lib/javascript/ChunkHelpers.js +++ b/lib/javascript/ChunkHelpers.js @@ -30,4 +30,5 @@ const getAllChunks = (entrypoint, excludedChunk1, excludedChunk2) => { } return chunks; }; + module.exports.getAllChunks = getAllChunks; diff --git a/lib/javascript/EnableChunkLoadingPlugin.js b/lib/javascript/EnableChunkLoadingPlugin.js index 4e7263a5309..7125596ba20 100644 --- a/lib/javascript/EnableChunkLoadingPlugin.js +++ b/lib/javascript/EnableChunkLoadingPlugin.js @@ -77,17 +77,20 @@ class EnableChunkLoadingPlugin { switch (type) { case "jsonp": { const JsonpChunkLoadingPlugin = require("../web/JsonpChunkLoadingPlugin"); + new JsonpChunkLoadingPlugin().apply(compiler); break; } case "import-scripts": { const ImportScriptsChunkLoadingPlugin = require("../webworker/ImportScriptsChunkLoadingPlugin"); + new ImportScriptsChunkLoadingPlugin().apply(compiler); break; } case "require": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const CommonJsChunkLoadingPlugin = require("../node/CommonJsChunkLoadingPlugin"); + new CommonJsChunkLoadingPlugin({ asyncChunkLoading: false }).apply(compiler); @@ -96,6 +99,7 @@ class EnableChunkLoadingPlugin { case "async-node": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const CommonJsChunkLoadingPlugin = require("../node/CommonJsChunkLoadingPlugin"); + new CommonJsChunkLoadingPlugin({ asyncChunkLoading: true }).apply(compiler); @@ -104,6 +108,7 @@ class EnableChunkLoadingPlugin { case "import": case "universal": { const ModuleChunkLoadingPlugin = require("../esm/ModuleChunkLoadingPlugin"); + new ModuleChunkLoadingPlugin().apply(compiler); break; } diff --git a/lib/javascript/JavascriptModulesPlugin.js b/lib/javascript/JavascriptModulesPlugin.js index 2db36cb58cc..53ee1211cb0 100644 --- a/lib/javascript/JavascriptModulesPlugin.js +++ b/lib/javascript/JavascriptModulesPlugin.js @@ -95,8 +95,9 @@ const chunkHasRuntimeOrJs = (chunk, chunkGraph) => { chunk, WEBPACK_MODULE_TYPE_RUNTIME ) - ) + ) { return true; + } return Boolean( chunkGraph.getChunkModulesIterableBySourceType(chunk, "javascript") @@ -594,8 +595,9 @@ class JavascriptModulesPlugin { if (codeGenResult.data !== undefined) { const chunkInitFragments = codeGenResult.data.get("chunkInitFragments"); if (chunkInitFragments) { - for (const i of chunkInitFragments) + for (const i of chunkInitFragments) { renderContext.chunkInitFragments.push(i); + } } } const moduleSourcePostContent = tryRunOrWebpackError( @@ -636,18 +638,20 @@ class JavascriptModulesPlugin { } else { const factorySource = new ConcatSource(); const args = []; - if (needExports || needRequire || needModule) + if (needExports || needRequire || needModule) { args.push( needModule ? module.moduleArgument : `__unused_webpack_${module.moduleArgument}` ); - if (needExports || needRequire) + } + if (needExports || needRequire) { args.push( needExports ? module.exportsArgument : `__unused_webpack_${module.exportsArgument}` ); + } if (needRequire) args.push(RuntimeGlobals.require); if (!needThisAsExports && runtimeTemplate.supportsArrowFunction()) { factorySource.add(`/***/ ((${args.join(", ")}) => {\n\n`); @@ -964,12 +968,13 @@ class JavascriptModulesPlugin { footer = "\n"; } if (exports) { - if (m !== lastInlinedModule) + if (m !== lastInlinedModule) { startupSource.add(`var ${m.exportsArgument} = {};\n`); - else if (m.exportsArgument !== RuntimeGlobals.exports) + } else if (m.exportsArgument !== RuntimeGlobals.exports) { startupSource.add( `var ${m.exportsArgument} = ${RuntimeGlobals.exports};\n` ); + } } startupSource.add(renderedModule); startupSource.add(footer); diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index eed51824c83..426e3b573b1 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -791,8 +791,9 @@ class JavascriptParser extends Parser { } else if ( expr.arguments.length > 2 || this.getVariableInfo("RegExp") !== "RegExp" - ) + ) { return; + } let regExp; const arg1 = expr.arguments[0]; @@ -832,8 +833,9 @@ class JavascriptParser extends Parser { if ( flags === undefined || !BasicEvaluatedExpression.isValidRegExpFlags(flags) - ) + ) { return; + } } } @@ -850,23 +852,28 @@ class JavascriptParser extends Parser { let allowedRight; if (expr.operator === "&&") { const leftAsBool = left.asBool(); - if (leftAsBool === false) + if (leftAsBool === false) { return left.setRange(/** @type {Range} */ (expr.range)); + } returnRight = leftAsBool === true; allowedRight = false; } else if (expr.operator === "||") { const leftAsBool = left.asBool(); - if (leftAsBool === true) + if (leftAsBool === true) { return left.setRange(/** @type {Range} */ (expr.range)); + } returnRight = leftAsBool === false; allowedRight = true; } else if (expr.operator === "??") { const leftAsNullish = left.asNullish(); - if (leftAsNullish === false) + if (leftAsNullish === false) { return left.setRange(/** @type {Range} */ (expr.range)); + } if (leftAsNullish !== true) return; returnRight = true; - } else return; + } else { + return; + } const right = this.evaluateExpression(expr.right); if (returnRight) { if (left.couldHaveSideEffects()) right.setSideEffects(); @@ -1313,8 +1320,9 @@ class JavascriptParser extends Parser { } else { return; } - if (left.couldHaveSideEffects() || right.couldHaveSideEffects()) + if (left.couldHaveSideEffects() || right.couldHaveSideEffects()) { res.setSideEffects(); + } res.setRange(/** @type {Range} */ (expr.range)); return res; } else if (expr.operator === "-") { @@ -2689,8 +2697,9 @@ class JavascriptParser extends Parser { if ( expression.left.type !== "ObjectPattern" || !this.destructuringAssignmentProperties - ) + ) { return; + } const keys = this._preWalkObjectPattern(expression.left); if (!keys) return; @@ -3052,8 +3061,9 @@ class JavascriptParser extends Parser { !declarator.init || declarator.id.type !== "ObjectPattern" || !this.destructuringAssignmentProperties - ) + ) { return; + } const keys = this._preWalkObjectPattern(declarator.id); if (!keys) return; @@ -3359,8 +3369,9 @@ class JavascriptParser extends Parser { * @param {AwaitExpression} expression await expression */ walkAwaitExpression(expression) { - if (this.scope.topLevelScope === true) + if (this.scope.topLevelScope === true) { this.hooks.topLevelAwait.call(expression); + } this.walkExpression(expression.argument); } @@ -3913,8 +3924,9 @@ class JavascriptParser extends Parser { if (expression.callee.type === "MemberExpression") { // because of call context we need to walk the call context as expression this.walkExpression(expression.callee.object); - if (expression.callee.computed === true) + if (expression.callee.computed === true) { this.walkExpression(expression.callee.property); + } } else { this.walkExpression(expression.callee); } @@ -4618,7 +4630,7 @@ class JavascriptParser extends Parser { throw new Error("source must not be null"); } if (Buffer.isBuffer(source)) { - source = source.toString("utf-8"); + source = source.toString("utf8"); } if (typeof source === "object") { ast = /** @type {Program} */ (source); @@ -4971,8 +4983,12 @@ class JavascriptParser extends Parser { defineVariable(name) { const oldInfo = this.scope.definitions.get(name); // Don't redefine variable in same scope to keep existing tags - if (oldInfo instanceof VariableInfo && oldInfo.declaredScope === this.scope) + if ( + oldInfo instanceof VariableInfo && + oldInfo.declaredScope === this.scope + ) { return; + } this.scope.definitions.set(name, this.scope); } diff --git a/lib/json/JsonGenerator.js b/lib/json/JsonGenerator.js index bbe64926710..a61e514c53d 100644 --- a/lib/json/JsonGenerator.js +++ b/lib/json/JsonGenerator.js @@ -47,8 +47,9 @@ const stringifySafe = data => { * @returns {JsonObject | JsonArray} reduced data */ const createObjectForExportsInfo = (data, exportsInfo, runtime) => { - if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) + if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) { return data; + } const isArray = Array.isArray(data); /** @type {JsonObject | JsonArray} */ const reducedData = isArray ? [] : {}; @@ -95,13 +96,14 @@ const createObjectForExportsInfo = (data, exportsInfo, runtime) => { 8 - (arrayLengthWhenUsed - reducedDataLength) * 2; } - if (sizeObjectMinusArray < 0) + if (sizeObjectMinusArray < 0) { return Object.assign( arrayLengthWhenUsed === undefined ? {} : { length: arrayLengthWhenUsed }, reducedData ); + } /** @type {number} */ const generatedLength = arrayLengthWhenUsed !== undefined diff --git a/lib/json/JsonModulesPlugin.js b/lib/json/JsonModulesPlugin.js index b4a6cfcfdc9..f1850a28532 100644 --- a/lib/json/JsonModulesPlugin.js +++ b/lib/json/JsonModulesPlugin.js @@ -16,7 +16,7 @@ const JsonParser = require("./JsonParser"); /** @typedef {import("../util/fs").JsonValue} JsonValue */ const validate = createSchemaValidation( - require("../../schemas/plugins/json/JsonModulesPluginParser.check.js"), + require("../../schemas/plugins/json/JsonModulesPluginParser.check"), () => require("../../schemas/plugins/json/JsonModulesPluginParser.json"), { name: "Json Modules Plugin", @@ -25,7 +25,7 @@ const validate = createSchemaValidation( ); const validateGenerator = createSchemaValidation( - require("../../schemas/plugins/json/JsonModulesPluginGenerator.check.js"), + require("../../schemas/plugins/json/JsonModulesPluginGenerator.check"), () => require("../../schemas/plugins/json/JsonModulesPluginGenerator.json"), { name: "Json Modules Plugin", diff --git a/lib/json/JsonParser.js b/lib/json/JsonParser.js index 4dbe0fa573c..983ed2896bd 100644 --- a/lib/json/JsonParser.js +++ b/lib/json/JsonParser.js @@ -35,7 +35,7 @@ class JsonParser extends Parser { */ parse(source, state) { if (Buffer.isBuffer(source)) { - source = source.toString("utf-8"); + source = source.toString("utf8"); } /** @type {NonNullable} */ diff --git a/lib/library/AbstractLibraryPlugin.js b/lib/library/AbstractLibraryPlugin.js index 647c92c031f..ec6a3c135d3 100644 --- a/lib/library/AbstractLibraryPlugin.js +++ b/lib/library/AbstractLibraryPlugin.js @@ -96,8 +96,9 @@ class AbstractLibraryPlugin { * @returns {T | false} options for the chunk */ const getOptionsForChunk = chunk => { - if (compilation.chunkGraph.getNumberOfEntryModules(chunk) === 0) + if (compilation.chunkGraph.getNumberOfEntryModules(chunk) === 0) { return false; + } const options = chunk.getEntryOptions(); const library = options && options.library; return this._parseOptionsCached( @@ -223,6 +224,7 @@ class AbstractLibraryPlugin { */ parseOptions(library) { const AbstractMethodError = require("../AbstractMethodError"); + throw new AbstractMethodError(); } @@ -260,8 +262,9 @@ class AbstractLibraryPlugin { * @returns {void} */ runtimeRequirements(chunk, set, libraryContext) { - if (this.render !== AbstractLibraryPlugin.prototype.render) + if (this.render !== AbstractLibraryPlugin.prototype.render) { set.add(RuntimeGlobals.returnExportsFromRuntime); + } } /** @@ -302,4 +305,5 @@ class AbstractLibraryPlugin { } AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE = COMMON_LIBRARY_NAME_MESSAGE; + module.exports = AbstractLibraryPlugin; diff --git a/lib/library/AssignLibraryPlugin.js b/lib/library/AssignLibraryPlugin.js index e7d3d761159..1c1d89dfab9 100644 --- a/lib/library/AssignLibraryPlugin.js +++ b/lib/library/AssignLibraryPlugin.js @@ -82,8 +82,9 @@ const accessWithInit = (accessor, existingLength, initLast = false) => { } // print the last property as property access if not yet printed - if (i < accessor.length) + if (i < accessor.length) { current = `${current}${propertyAccess([accessor[accessor.length - 1]])}`; + } return current; }; @@ -241,16 +242,18 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin { const topLevelDeclarations = (data && data.get("topLevelDeclarations")) || (module.buildInfo && module.buildInfo.topLevelDeclarations); - if (!topLevelDeclarations) + if (!topLevelDeclarations) { return "it doesn't tell about top level declarations."; + } const fullNameResolved = this._getResolvedFullName( options, chunk, compilation ); const base = fullNameResolved[0]; - if (topLevelDeclarations.has(base)) + if (topLevelDeclarations.has(base)) { return `it declares '${base}' on top-level, which conflicts with the current library output.`; + } } /** @@ -325,6 +328,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin { result.add( `var __webpack_exports_export__ = ${RuntimeGlobals.exports}${exportAccess};\n` ); + exports = "__webpack_exports_export__"; } result.add(`for(var __webpack_i__ in ${exports}) {\n`); @@ -355,6 +359,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin { result.add( `var __webpack_exports_export__ = ${RuntimeGlobals.exports}${exportAccess};\n` ); + exports = "__webpack_exports_export__"; } result.add( diff --git a/lib/library/EnableLibraryPlugin.js b/lib/library/EnableLibraryPlugin.js index 0b87737b176..6f1de38e8a7 100644 --- a/lib/library/EnableLibraryPlugin.js +++ b/lib/library/EnableLibraryPlugin.js @@ -90,6 +90,7 @@ class EnableLibraryPlugin { if (typeof type === "string") { const enableExportProperty = () => { const ExportPropertyTemplatePlugin = require("./ExportPropertyLibraryPlugin"); + new ExportPropertyTemplatePlugin({ type, nsObjectUsed: !["module", "modern-module"].includes(type), @@ -101,6 +102,7 @@ class EnableLibraryPlugin { case "var": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: [], @@ -112,6 +114,7 @@ class EnableLibraryPlugin { case "assign-properties": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: [], @@ -124,6 +127,7 @@ class EnableLibraryPlugin { case "assign": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: [], @@ -135,6 +139,7 @@ class EnableLibraryPlugin { case "this": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: ["this"], @@ -146,6 +151,7 @@ class EnableLibraryPlugin { case "window": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: ["window"], @@ -157,6 +163,7 @@ class EnableLibraryPlugin { case "self": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: ["self"], @@ -168,6 +175,7 @@ class EnableLibraryPlugin { case "global": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: "global", @@ -179,6 +187,7 @@ class EnableLibraryPlugin { case "commonjs": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: ["exports"], @@ -190,6 +199,7 @@ class EnableLibraryPlugin { case "commonjs-static": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: ["exports"], @@ -202,6 +212,7 @@ class EnableLibraryPlugin { case "commonjs-module": { // @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 const AssignLibraryPlugin = require("./AssignLibraryPlugin"); + new AssignLibraryPlugin({ type, prefix: ["module", "exports"], @@ -213,7 +224,9 @@ class EnableLibraryPlugin { case "amd": case "amd-require": { enableExportProperty(); + const AmdLibraryPlugin = require("./AmdLibraryPlugin"); + new AmdLibraryPlugin({ type, requireAsWrapper: type === "amd-require" @@ -234,6 +247,7 @@ class EnableLibraryPlugin { "WarnFalseIifeUmdPlugin", compilation => { const FalseIIFEUmdWarning = require("../FalseIIFEUmdWarning"); + compilation.warnings.push(new FalseIIFEUmdWarning()); } ); @@ -243,7 +257,9 @@ class EnableLibraryPlugin { new WarnFalseIifeUmdPlugin().apply(compiler); } enableExportProperty(); + const UmdLibraryPlugin = require("./UmdLibraryPlugin"); + new UmdLibraryPlugin({ type, optionalAmdExternalAsGlobal: type === "umd2" @@ -252,7 +268,9 @@ class EnableLibraryPlugin { } case "system": { enableExportProperty(); + const SystemLibraryPlugin = require("./SystemLibraryPlugin"); + new SystemLibraryPlugin({ type }).apply(compiler); @@ -260,7 +278,9 @@ class EnableLibraryPlugin { } case "jsonp": { enableExportProperty(); + const JsonpLibraryPlugin = require("./JsonpLibraryPlugin"); + new JsonpLibraryPlugin({ type }).apply(compiler); @@ -269,7 +289,9 @@ class EnableLibraryPlugin { case "module": case "modern-module": { enableExportProperty(); + const ModuleLibraryPlugin = require("./ModuleLibraryPlugin"); + new ModuleLibraryPlugin({ type }).apply(compiler); diff --git a/lib/library/UmdLibraryPlugin.js b/lib/library/UmdLibraryPlugin.js index b21066d3934..7a47738fde9 100644 --- a/lib/library/UmdLibraryPlugin.js +++ b/lib/library/UmdLibraryPlugin.js @@ -47,8 +47,9 @@ const accessorAccess = (base, accessor, joinWith = ", ") => { ? base + accessorToObjectAccess(accessors.slice(0, idx + 1)) : accessors[0] + accessorToObjectAccess(accessors.slice(1, idx + 1)); if (idx === accessors.length - 1) return a; - if (idx === 0 && base === undefined) + if (idx === 0 && base === undefined) { return `${a} = typeof ${a} === "object" ? ${a} : {}`; + } return `${a} = ${a} || {}`; }) .join(joinWith); @@ -188,10 +189,11 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { modules .map(m => { let request = m.request; - if (typeof request === "object") + if (typeof request === "object") { request = /** @type {RequestRecord} */ (request).root; + } return `root${accessorToObjectAccess(/** @type {string[]} */ ([]).concat(request))}`; }) .join(", ") @@ -281,8 +283,9 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { */ const getAuxiliaryComment = type => { if (auxiliaryComment) { - if (typeof auxiliaryComment === "string") + if (typeof auxiliaryComment === "string") { return `\t//${auxiliaryComment}\n`; + } if (auxiliaryComment[type]) return `\t//${auxiliaryComment[type]}\n`; } return ""; diff --git a/lib/node/nodeConsole.js b/lib/node/nodeConsole.js index f1ddda00c3b..8c25c60cb62 100644 --- a/lib/node/nodeConsole.js +++ b/lib/node/nodeConsole.js @@ -124,9 +124,11 @@ module.exports = ({ colors, appendOnly, stream }) => { currentCollapsed++; }, groupEnd: () => { - if (currentCollapsed > 0) currentCollapsed--; - else if (currentIndent.length >= 2) + if (currentCollapsed > 0) { + currentCollapsed--; + } else if (currentIndent.length >= 2) { currentIndent = currentIndent.slice(0, -2); + } }, profile: console.profile && (name => console.profile(name)), profileEnd: console.profileEnd && (name => console.profileEnd(name)), diff --git a/lib/optimize/AggressiveSplittingPlugin.js b/lib/optimize/AggressiveSplittingPlugin.js index 0b29c1365c8..53efe9d2714 100644 --- a/lib/optimize/AggressiveSplittingPlugin.js +++ b/lib/optimize/AggressiveSplittingPlugin.js @@ -21,7 +21,7 @@ const identifierUtils = require("../util/identifier"); /** @typedef {import("../Module")} Module */ const validate = createSchemaValidation( - require("../../schemas/plugins/optimize/AggressiveSplittingPlugin.check.js"), + require("../../schemas/plugins/optimize/AggressiveSplittingPlugin.check"), () => require("../../schemas/plugins/optimize/AggressiveSplittingPlugin.json"), { @@ -338,4 +338,5 @@ class AggressiveSplittingPlugin { }); } } + module.exports = AggressiveSplittingPlugin; diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index 4b237929ff5..b6bf07073db 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -956,16 +956,18 @@ class ConcatenatedModule extends Module { moduleGraph.getOutgoingConnections(module) ); if (module === rootModule) { - for (const c of moduleGraph.getOutgoingConnections(this)) + for (const c of moduleGraph.getOutgoingConnections(this)) { connections.push(c); + } } /** * @type {Array<{ connection: ModuleGraphConnection, sourceOrder: number, rangeStart: number, defer?: boolean }>} */ const references = connections .filter(connection => { - if (!(connection.dependency instanceof HarmonyImportDependency)) + if (!(connection.dependency instanceof HarmonyImportDependency)) { return false; + } return ( connection && connection.resolvedOriginModule === module && @@ -1050,8 +1052,9 @@ class ConcatenatedModule extends Module { ); } const imports = getConcatenatedImports(module); - for (const { connection, runtimeCondition } of imports) + for (const { connection, runtimeCondition } of imports) { enterModule(connection, runtimeCondition); + } list.push({ type: "concatenated", module: connection.module, @@ -1106,8 +1109,9 @@ class ConcatenatedModule extends Module { existingEntries.set(rootModule, true); const imports = getConcatenatedImports(rootModule); - for (const { connection, runtimeCondition } of imports) + for (const { connection, runtimeCondition } of imports) { enterModule(connection, runtimeCondition); + } list.push({ type: "concatenated", module: rootModule, @@ -1268,8 +1272,9 @@ class ConcatenatedModule extends Module { const match = ConcatenationScope.matchModuleReference(name); if (!match) continue; const referencedInfo = modulesWithInfo[match.index]; - if (referencedInfo.type === "reference") + if (referencedInfo.type === "reference") { throw new Error("Module reference can't point to a reference"); + } const binding = getFinalBinding( moduleGraph, referencedInfo, @@ -1494,8 +1499,9 @@ class ConcatenatedModule extends Module { const match = ConcatenationScope.matchModuleReference(name); if (match) { const referencedInfo = modulesWithInfo[match.index]; - if (referencedInfo.type === "reference") + if (referencedInfo.type === "reference") { throw new Error("Module reference can't point to a reference"); + } const finalName = getFinalName( moduleGraph, referencedInfo, @@ -1681,8 +1687,9 @@ class ConcatenatedModule extends Module { "," )}\n});\n` : ""; - if (nsObj.length > 0) + if (nsObj.length > 0) { runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); + } namespaceObjectSources.set( info, ` @@ -1835,8 +1842,9 @@ ${defineGetters}` } const data = new Map(); - if (chunkInitFragments.length > 0) + if (chunkInitFragments.length > 0) { data.set("chunkInitFragments", chunkInitFragments); + } data.set("topLevelDeclarations", topLevelDeclarations); /** @type {CodeGenerationResult} */ diff --git a/lib/optimize/EnsureChunkConditionsPlugin.js b/lib/optimize/EnsureChunkConditionsPlugin.js index 2def4c2350f..ab740727b5a 100644 --- a/lib/optimize/EnsureChunkConditionsPlugin.js +++ b/lib/optimize/EnsureChunkConditionsPlugin.js @@ -84,4 +84,5 @@ class EnsureChunkConditionsPlugin { }); } } + module.exports = EnsureChunkConditionsPlugin; diff --git a/lib/optimize/FlagIncludedChunksPlugin.js b/lib/optimize/FlagIncludedChunksPlugin.js index 216e26cc559..96a3ed2df0d 100644 --- a/lib/optimize/FlagIncludedChunksPlugin.js +++ b/lib/optimize/FlagIncludedChunksPlugin.js @@ -78,8 +78,9 @@ class FlagIncludedChunksPlugin { bestModule === undefined || chunkGraph.getNumberOfModuleChunks(bestModule) > chunkGraph.getNumberOfModuleChunks(module) - ) + ) { bestModule = module; + } } loopB: for (const chunkB of chunkGraph.getModuleChunksIterable( /** @type {Module} */ (bestModule) @@ -122,4 +123,5 @@ class FlagIncludedChunksPlugin { }); } } + module.exports = FlagIncludedChunksPlugin; diff --git a/lib/optimize/InnerGraph.js b/lib/optimize/InnerGraph.js index b5c836fb827..ea193f116d2 100644 --- a/lib/optimize/InnerGraph.js +++ b/lib/optimize/InnerGraph.js @@ -303,8 +303,9 @@ module.exports.isDependencyUsedByExports = ( const exportsInfo = moduleGraph.getExportsInfo(selfModule); let used = false; for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { used = true; + } } if (!used) return false; } @@ -330,8 +331,9 @@ module.exports.getDependencyUsedByExportsCondition = ( const exportsInfo = moduleGraph.getExportsInfo(selfModule); return (connections, runtime) => { for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { return true; + } } return false; }; diff --git a/lib/optimize/LimitChunkCountPlugin.js b/lib/optimize/LimitChunkCountPlugin.js index f20acb86d01..9512958d845 100644 --- a/lib/optimize/LimitChunkCountPlugin.js +++ b/lib/optimize/LimitChunkCountPlugin.js @@ -15,7 +15,7 @@ const createSchemaValidation = require("../util/create-schema-validation"); /** @typedef {import("../Compiler")} Compiler */ const validate = createSchemaValidation( - require("../../schemas/plugins/optimize/LimitChunkCountPlugin.check.js"), + require("../../schemas/plugins/optimize/LimitChunkCountPlugin.check"), () => require("../../schemas/plugins/optimize/LimitChunkCountPlugin.json"), { name: "Limit Chunk Count Plugin", @@ -296,4 +296,5 @@ class LimitChunkCountPlugin { }); } } + module.exports = LimitChunkCountPlugin; diff --git a/lib/optimize/MangleExportsPlugin.js b/lib/optimize/MangleExportsPlugin.js index 18ec2864ee9..d88a2c6d9bc 100644 --- a/lib/optimize/MangleExportsPlugin.js +++ b/lib/optimize/MangleExportsPlugin.js @@ -23,8 +23,9 @@ const { compareSelect, compareStringsNumeric } = require("../util/comparators"); * @returns {boolean} mangle is possible */ const canMangle = exportsInfo => { - if (exportsInfo.otherExportsInfo.getUsed(undefined) !== UsageState.Unused) + if (exportsInfo.otherExportsInfo.getUsed(undefined) !== UsageState.Unused) { return false; + } let hasSomethingToMangle = false; for (const exportInfo of exportsInfo.exports) { if (exportInfo.canMangle === true) { diff --git a/lib/optimize/MergeDuplicateChunksPlugin.js b/lib/optimize/MergeDuplicateChunksPlugin.js index 6e4c3c95424..b37fbd891e7 100644 --- a/lib/optimize/MergeDuplicateChunksPlugin.js +++ b/lib/optimize/MergeDuplicateChunksPlugin.js @@ -13,7 +13,7 @@ const { runtimeEqual } = require("../util/runtime"); /** @typedef {import("../Compiler")} Compiler */ const validate = createSchemaValidation( - require("../../schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.js"), + require("../../schemas/plugins/optimize/MergeDuplicateChunksPlugin.check"), () => require("../../schemas/plugins/optimize/MergeDuplicateChunksPlugin.json"), { @@ -96,8 +96,9 @@ class MergeDuplicateChunksPlugin { outer: for (const otherChunk of possibleDuplicates) { if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue; if (chunkGraph.getNumberOfEntryModules(chunk) > 0) continue; - if (chunkGraph.getNumberOfEntryModules(otherChunk) > 0) + if (chunkGraph.getNumberOfEntryModules(otherChunk) > 0) { continue; + } if (!runtimeEqual(chunk.runtime, otherChunk.runtime)) { for (const module of chunkGraph.getChunkModulesIterable( chunk @@ -129,4 +130,5 @@ class MergeDuplicateChunksPlugin { }); } } + module.exports = MergeDuplicateChunksPlugin; diff --git a/lib/optimize/MinChunkSizePlugin.js b/lib/optimize/MinChunkSizePlugin.js index 44ba8d389fe..6d5024b5e35 100644 --- a/lib/optimize/MinChunkSizePlugin.js +++ b/lib/optimize/MinChunkSizePlugin.js @@ -13,7 +13,7 @@ const createSchemaValidation = require("../util/create-schema-validation"); /** @typedef {import("../Compiler")} Compiler */ const validate = createSchemaValidation( - require("../../schemas/plugins/optimize/MinChunkSizePlugin.check.js"), + require("../../schemas/plugins/optimize/MinChunkSizePlugin.check"), () => require("../../schemas/plugins/optimize/MinChunkSizePlugin.json"), { name: "Min Chunk Size Plugin", @@ -65,13 +65,15 @@ class MinChunkSizePlugin { if (chunkGraph.getChunkSize(a, equalOptions) < minChunkSize) { smallChunks.push(a); for (const b of visitedChunks) { - if (chunkGraph.canChunksBeIntegrated(b, a)) + if (chunkGraph.canChunksBeIntegrated(b, a)) { combinations.push([b, a]); + } } } else { for (const b of smallChunks) { - if (chunkGraph.canChunksBeIntegrated(b, a)) + if (chunkGraph.canChunksBeIntegrated(b, a)) { combinations.push([b, a]); + } } } chunkSizesMap.set(a, chunkGraph.getChunkSize(a, options)); @@ -112,4 +114,5 @@ class MinChunkSizePlugin { }); } } + module.exports = MinChunkSizePlugin; diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index b54c85cf43d..cec2c98973c 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -677,8 +677,9 @@ class ModuleConcatenationPlugin { const activeConnections = connections.filter(connection => connection.isActive(runtime) ); - if (activeConnections.length > 0) + if (activeConnections.length > 0) { incomingConnectionsFromModules.set(originModule, activeConnections); + } } } @@ -723,8 +724,9 @@ class ModuleConcatenationPlugin { !connection.dependency || !(connection.dependency instanceof HarmonyImportDependency) ); - if (selected.length > 0) + if (selected.length > 0) { nonHarmonyConnections.set(originModule, connections); + } } if (nonHarmonyConnections.size > 0) { /** diff --git a/lib/optimize/RealContentHashPlugin.js b/lib/optimize/RealContentHashPlugin.js index 66b568c8b18..dc5bccccad1 100644 --- a/lib/optimize/RealContentHashPlugin.js +++ b/lib/optimize/RealContentHashPlugin.js @@ -363,8 +363,9 @@ ${referencingAssets * @returns {Promise} */ const computeNewContentWithoutOwn = asset => { - if (asset.contentComputeWithoutOwnPromise) + if (asset.contentComputeWithoutOwnPromise) { return asset.contentComputeWithoutOwnPromise; + } return (asset.contentComputeWithoutOwnPromise = (async () => { if ( /** @type {OwnHashes} */ (asset.ownHashes).size > 0 || diff --git a/lib/optimize/RemoveEmptyChunksPlugin.js b/lib/optimize/RemoveEmptyChunksPlugin.js index c8ad85c617f..520b4784920 100644 --- a/lib/optimize/RemoveEmptyChunksPlugin.js +++ b/lib/optimize/RemoveEmptyChunksPlugin.js @@ -56,4 +56,5 @@ class RemoveEmptyChunksPlugin { }); } } + module.exports = RemoveEmptyChunksPlugin; diff --git a/lib/optimize/RemoveParentModulesPlugin.js b/lib/optimize/RemoveParentModulesPlugin.js index 2cfd764d47d..1f38c0f4b8a 100644 --- a/lib/optimize/RemoveParentModulesPlugin.js +++ b/lib/optimize/RemoveParentModulesPlugin.js @@ -203,4 +203,5 @@ class RemoveParentModulesPlugin { }); } } + module.exports = RemoveParentModulesPlugin; diff --git a/lib/optimize/SideEffectsFlagPlugin.js b/lib/optimize/SideEffectsFlagPlugin.js index 9df089775ba..3824a92a832 100644 --- a/lib/optimize/SideEffectsFlagPlugin.js +++ b/lib/optimize/SideEffectsFlagPlugin.js @@ -400,4 +400,5 @@ class SideEffectsFlagPlugin { } } } + module.exports = SideEffectsFlagPlugin; diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index 3589d110223..226907c5e2b 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -853,7 +853,7 @@ module.exports = class SplitChunksPlugin { chunk, index | BigInt((Math.random() * 0x7fffffff) | 0) ); - index = index << ONE; + index <<= ONE; } /** * @param {Iterable} chunks list of chunks @@ -871,7 +871,7 @@ module.exports = class SplitChunksPlugin { /** @type {bigint} */ (chunkIndexMap.get(result.value)); while (!(result = iterator.next()).done) { const raw = chunkIndexMap.get(result.value); - key = key ^ /** @type {bigint} */ (raw); + key ^= /** @type {bigint} */ (raw); } return key; }; @@ -1270,8 +1270,9 @@ module.exports = class SplitChunksPlugin { (groupedByExportsMap.get(module)); for (const chunks of groupedByUsedExports) { const chunksKey = getKey(chunks); - for (const comb of getExportsCombinations(chunksKey)) + for (const comb of getExportsCombinations(chunksKey)) { set.add(comb); + } } return set; }); @@ -1489,8 +1490,9 @@ module.exports = class SplitChunksPlugin { // Were some (invalid) chunks removed from usedChunks? // => readd all modules to the queue, as things could have been changed if (usedChunks.size < item.chunks.size) { - if (isExistingChunk) + if (isExistingChunk) { usedChunks.add(/** @type {Chunk} */ (newChunk)); + } if (usedChunks.size >= item.cacheGroup.minChunks) { const chunksArr = Array.from(usedChunks); for (const module of item.modules) { @@ -1680,8 +1682,9 @@ module.exports = class SplitChunksPlugin { maxInitialSize, automaticNameDelimiter } = chunkConfig || fallbackCacheGroup; - if (!chunkConfig && !fallbackCacheGroup.chunksFilter(chunk)) + if (!chunkConfig && !fallbackCacheGroup.chunksFilter(chunk)) { continue; + } /** @type {SplitChunksSizes} */ let maxSize; if (chunk.isOnlyInitial()) { diff --git a/lib/rules/RuleSetCompiler.js b/lib/rules/RuleSetCompiler.js index ab99b19b1ba..d1afde72c4f 100644 --- a/lib/rules/RuleSetCompiler.js +++ b/lib/rules/RuleSetCompiler.js @@ -227,16 +227,18 @@ class RuleSetCompiler { if (unhandledProperties.has("rules")) { unhandledProperties.delete("rules"); const rules = rule.rules; - if (!Array.isArray(rules)) + if (!Array.isArray(rules)) { throw this.error(path, rules, "Rule.rules must be an array of rules"); + } compiledRule.rules = this.compileRules(`${path}.rules`, rules, refs); } if (unhandledProperties.has("oneOf")) { unhandledProperties.delete("oneOf"); const oneOf = rule.oneOf; - if (!Array.isArray(oneOf)) + if (!Array.isArray(oneOf)) { throw this.error(path, oneOf, "Rule.oneOf must be an array of rules"); + } compiledRule.oneOf = this.compileRules(`${path}.oneOf`, oneOf, refs); } diff --git a/lib/runtime/RuntimeIdRuntimeModule.js b/lib/runtime/RuntimeIdRuntimeModule.js index 1923bafca7e..df75d22ca59 100644 --- a/lib/runtime/RuntimeIdRuntimeModule.js +++ b/lib/runtime/RuntimeIdRuntimeModule.js @@ -22,8 +22,9 @@ class RuntimeIdRuntimeModule extends RuntimeModule { const chunkGraph = /** @type {ChunkGraph} */ (this.chunkGraph); const chunk = /** @type {Chunk} */ (this.chunk); const runtime = chunk.runtime; - if (typeof runtime !== "string") + if (typeof runtime !== "string") { throw new Error("RuntimeIdRuntimeModule must be in a single runtime"); + } const id = chunkGraph.getRuntimeId(runtime); return `${RuntimeGlobals.runtimeId} = ${JSON.stringify(id)};`; } diff --git a/lib/schemes/HttpUriPlugin.js b/lib/schemes/HttpUriPlugin.js index d9d8b5bb37c..d29b9c2e9a3 100644 --- a/lib/schemes/HttpUriPlugin.js +++ b/lib/schemes/HttpUriPlugin.js @@ -8,7 +8,12 @@ const EventEmitter = require("events"); const { extname, basename } = require("path"); const { URL } = require("url"); -const { createGunzip, createBrotliDecompress, createInflate } = require("zlib"); +const { + createGunzip, + // eslint-disable-next-line n/no-unsupported-features/node-builtins + createBrotliDecompress, + createInflate +} = require("zlib"); const NormalModule = require("../NormalModule"); const createSchemaValidation = require("../util/create-schema-validation"); const createHash = require("../util/createHash"); @@ -85,7 +90,7 @@ const proxyFetch = (request, proxy) => (url, options, callback) => { let inProgressWrite; const validate = createSchemaValidation( - require("../../schemas/plugins/schemes/HttpUriPlugin.check.js"), + require("../../schemas/plugins/schemes/HttpUriPlugin.check"), () => require("../../schemas/plugins/schemes/HttpUriPlugin.json"), { name: "Http Uri Plugin", @@ -210,8 +215,9 @@ class Lockfile { static parse(content) { // TODO handle merge conflicts const data = JSON.parse(content); - if (data.version !== 1) + if (data.version !== 1) { throw new Error(`Unsupported lockfile version ${data.version}`); + } const lockfile = new Lockfile(); for (const key of Object.keys(data)) { if (key === "version") continue; @@ -242,8 +248,9 @@ class Lockfile { str += ` ${JSON.stringify(key)}: ${JSON.stringify(entry)},\n`; } else { str += ` ${JSON.stringify(key)}: { `; - if (entry.resolved !== key) + if (entry.resolved !== key) { str += `"resolved": ${JSON.stringify(entry.resolved)}, `; + } str += `"integrity": ${JSON.stringify( entry.integrity )}, "contentType": ${JSON.stringify(entry.contentType)} },\n`; @@ -330,8 +337,9 @@ const cachedWithKey = (fn, forceFn = fn) => { const resultFn = (arg, callback) => { const cacheEntry = cache.get(arg); if (cacheEntry !== undefined) { - if (cacheEntry.result !== undefined) + if (cacheEntry.result !== undefined) { return callback(null, cacheEntry.result); + } if (cacheEntry.error !== undefined) return callback(cacheEntry.error); if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; else cacheEntry.callbacks.push(callback); @@ -361,8 +369,9 @@ const cachedWithKey = (fn, forceFn = fn) => { resultFn.force = (arg, callback) => { const cacheEntry = cache.get(arg); if (cacheEntry !== undefined && cacheEntry.force) { - if (cacheEntry.result !== undefined) + if (cacheEntry.result !== undefined) { return callback(null, cacheEntry.result); + } if (cacheEntry.error !== undefined) return callback(cacheEntry.error); if (cacheEntry.callbacks === undefined) cacheEntry.callbacks = [callback]; else cacheEntry.callbacks.push(callback); @@ -531,7 +540,7 @@ class HttpUriPlugin { (err, s) => { if (err) return callback(err); const lockfile = buffer - ? Lockfile.parse(buffer.toString("utf-8")) + ? Lockfile.parse(buffer.toString("utf8")) : new Lockfile(); lockfileCache = { lockfile, @@ -611,8 +620,9 @@ class HttpUriPlugin { const storeResult = (lockfile, url, result, callback) => { if (result.storeLock) { storeLockEntry(lockfile, url, result.entry); - if (!cacheLocation || !result.content) + if (!cacheLocation || !result.content) { return callback(null, result); + } const key = getCacheKey(result.entry.resolved); const filePath = join(intermediateFs, cacheLocation, key); mkdirp(intermediateFs, dirname(intermediateFs, filePath), err => { @@ -831,7 +841,7 @@ class HttpUriPlugin { new Error( `${url} request status code = ${ res.statusCode - }\n${content.toString("utf-8")}` + }\n${content.toString("utf8")}` ) ); } @@ -938,8 +948,9 @@ class HttpUriPlugin { const result = /** @type {ResolveContentResult} */ (_result); - if (!result.storeLock || entryTag === "ignore") + if (!result.storeLock || entryTag === "ignore") { return callback(null, result); + } if (frozen) { return callback( new Error( @@ -1058,7 +1069,7 @@ Remove this line from the lockfile to force upgrading.` let isEolChanged = false; try { contentWithChangedEol = Buffer.from( - content.toString("utf-8").replace(/\r\n/g, "\n") + content.toString("utf8").replace(/\r\n/g, "\n") ); isEolChanged = verifyIntegrity( contentWithChangedEol, @@ -1245,7 +1256,7 @@ Run build with un-frozen lockfile to automatically fix lockfile.` return callback(err); } const lockfile = buffer - ? Lockfile.parse(buffer.toString("utf-8")) + ? Lockfile.parse(buffer.toString("utf8")) : new Lockfile(); for (const [key, value] of /** @type {LockfileUpdates} */ ( lockfileUpdates diff --git a/lib/serialization/AggregateErrorSerializer.js b/lib/serialization/AggregateErrorSerializer.js index bebf83362f8..82ec4314bc4 100644 --- a/lib/serialization/AggregateErrorSerializer.js +++ b/lib/serialization/AggregateErrorSerializer.js @@ -28,7 +28,7 @@ class AggregateErrorSerializer { deserialize(context) { const errors = context.read(); // @ts-expect-error ES2018 doesn't `AggregateError`, but it can be used by developers - // eslint-disable-next-line n/no-unsupported-features/es-builtins, n/no-unsupported-features/es-syntax + // eslint-disable-next-line n/no-unsupported-features/es-builtins, n/no-unsupported-features/es-syntax, unicorn/error-message const err = new AggregateError(errors); err.message = context.read(); diff --git a/lib/serialization/BinaryMiddleware.js b/lib/serialization/BinaryMiddleware.js index 860b22f0f6f..44ec4aa0278 100644 --- a/lib/serialization/BinaryMiddleware.js +++ b/lib/serialization/BinaryMiddleware.js @@ -215,7 +215,7 @@ class BinaryMiddleware extends SerializerMiddleware { (allocationScope.increaseCounter + 1) % 4) && allocationScope.allocationSize < 16777216 ) { - allocationScope.allocationSize = allocationScope.allocationSize << 1; + allocationScope.allocationSize <<= 1; } } }; @@ -281,8 +281,9 @@ class BinaryMiddleware extends SerializerMiddleware { const thing = data[i]; switch (typeof thing) { case "function": { - if (!SerializerMiddleware.isLazy(thing)) + if (!SerializerMiddleware.isLazy(thing)) { throw new Error(`Unexpected function ${thing}`); + } /** @type {SerializedType | LazyFunction | undefined} */ let serializedData = SerializerMiddleware.getLazySerializedValue(thing); @@ -801,7 +802,7 @@ class BinaryMiddleware extends SerializerMiddleware { let mask = 1; while (n !== 0) { result.push((data & mask) !== 0); - mask = mask << 1; + mask <<= 1; n--; } }; diff --git a/lib/serialization/FileMiddleware.js b/lib/serialization/FileMiddleware.js index 375dc61a726..c70ce71d779 100644 --- a/lib/serialization/FileMiddleware.js +++ b/lib/serialization/FileMiddleware.js @@ -7,7 +7,9 @@ const { constants } = require("buffer"); const { pipeline } = require("stream"); const { + // eslint-disable-next-line n/no-unsupported-features/node-builtins createBrotliCompress, + // eslint-disable-next-line n/no-unsupported-features/node-builtins createBrotliDecompress, createGzip, createGunzip, @@ -117,8 +119,9 @@ const serialize = async ( let lastBuffers; for (const item of await data) { if (typeof item === "function") { - if (!SerializerMiddleware.isLazy(item)) + if (!SerializerMiddleware.isLazy(item)) { throw new Error("Unexpected function"); + } if (!SerializerMiddleware.isLazy(item, middleware)) { throw new Error( "Unexpected lazy value with non-this target (can't pass through lazy values)" diff --git a/lib/serialization/ObjectMiddleware.js b/lib/serialization/ObjectMiddleware.js index b79a76147b3..74884b7fff8 100644 --- a/lib/serialization/ObjectMiddleware.js +++ b/lib/serialization/ObjectMiddleware.js @@ -439,11 +439,13 @@ class ObjectMiddleware extends SerializerMiddleware { } if (typeof item === "object" && item !== null) { if (item.constructor) { - if (item.constructor === Object) + if (item.constructor === Object) { return `Object { ${Object.keys(item).join(", ")} }`; + } if (item.constructor === Map) return `Map { ${item.size} items }`; - if (item.constructor === Array) + if (item.constructor === Array) { return `Array { ${item.length} items }`; + } if (item.constructor === Set) return `Set { ${item.size} items }`; if (item.constructor === RegExp) return item.toString(); return `${item.constructor.name}`; @@ -472,8 +474,9 @@ class ObjectMiddleware extends SerializerMiddleware { process(value); } catch (err) { if (err !== NOT_SERIALIZABLE) { - if (hasDebugInfoAttached === undefined) + if (hasDebugInfoAttached === undefined) { hasDebugInfoAttached = new WeakSet(); + } if (!hasDebugInfoAttached.has(/** @type {Error} */ (err))) { /** @type {Error} */ (err).message += `\nwhile serializing ${stackToString(value)}`; @@ -596,8 +599,9 @@ class ObjectMiddleware extends SerializerMiddleware { result.push(item); } else if (typeof item === "function") { - if (!SerializerMiddleware.isLazy(item)) + if (!SerializerMiddleware.isLazy(item)) { throw new Error(`Unexpected function ${item}`); + } /** @type {SerializedType | undefined} */ const serializedData = @@ -658,14 +662,16 @@ class ObjectMiddleware extends SerializerMiddleware { deserialize(data, context) { let currentDataPos = 0; const read = () => { - if (currentDataPos >= data.length) + if (currentDataPos >= data.length) { throw new Error("Unexpected end of stream"); + } return data[currentDataPos++]; }; - if (read() !== CURRENT_VERSION) + if (read() !== CURRENT_VERSION) { throw new Error("Version mismatch, serializer changed"); + } let currentPos = 0; /** @type {ReferenceableItem[]} */ diff --git a/lib/serialization/Serializer.js b/lib/serialization/Serializer.js index fcbc002b3ac..ef1817254d7 100644 --- a/lib/serialization/Serializer.js +++ b/lib/serialization/Serializer.js @@ -49,7 +49,9 @@ class Serializer { } catch (err) { current = Promise.reject(err); } - } else break; + } else { + break; + } } return /** @type {Promise} */ (current); } diff --git a/lib/serialization/SerializerMiddleware.js b/lib/serialization/SerializerMiddleware.js index ab15c927989..fce70d10a9d 100644 --- a/lib/serialization/SerializerMiddleware.js +++ b/lib/serialization/SerializerMiddleware.js @@ -35,6 +35,7 @@ class SerializerMiddleware { */ serialize(data, context) { const AbstractMethodError = require("../AbstractMethodError"); + throw new AbstractMethodError(); } @@ -47,6 +48,7 @@ class SerializerMiddleware { */ deserialize(data, context) { const AbstractMethodError = require("../AbstractMethodError"); + throw new AbstractMethodError(); } diff --git a/lib/sharing/ConsumeSharedPlugin.js b/lib/sharing/ConsumeSharedPlugin.js index e6fab76f1d9..3a9b22aa183 100644 --- a/lib/sharing/ConsumeSharedPlugin.js +++ b/lib/sharing/ConsumeSharedPlugin.js @@ -32,7 +32,7 @@ const { /** @typedef {import("./utils").DescriptionFile} DescriptionFile */ const validate = createSchemaValidation( - require("../../schemas/plugins/sharing/ConsumeSharedPlugin.check.js"), + require("../../schemas/plugins/sharing/ConsumeSharedPlugin.check"), () => require("../../schemas/plugins/sharing/ConsumeSharedPlugin.json"), { name: "Consume Shared Plugin", diff --git a/lib/sharing/ProvideSharedPlugin.js b/lib/sharing/ProvideSharedPlugin.js index b4977e6b026..d08c4693b23 100644 --- a/lib/sharing/ProvideSharedPlugin.js +++ b/lib/sharing/ProvideSharedPlugin.js @@ -18,7 +18,7 @@ const ProvideSharedModuleFactory = require("./ProvideSharedModuleFactory"); /** @typedef {import("../NormalModuleFactory").NormalModuleCreateData} NormalModuleCreateData */ const validate = createSchemaValidation( - require("../../schemas/plugins/sharing/ProvideSharedPlugin.check.js"), + require("../../schemas/plugins/sharing/ProvideSharedPlugin.check"), () => require("../../schemas/plugins/sharing/ProvideSharedPlugin.json"), { name: "Provide Shared Plugin", @@ -49,8 +49,9 @@ class ProvideSharedPlugin { parseOptions( options.provides, item => { - if (Array.isArray(item)) + if (Array.isArray(item)) { throw new Error("Unexpected array of provides"); + } /** @type {ProvideOptions} */ const result = { shareKey: item, diff --git a/lib/sharing/SharePlugin.js b/lib/sharing/SharePlugin.js index 65935b30b99..0c2c610a9be 100644 --- a/lib/sharing/SharePlugin.js +++ b/lib/sharing/SharePlugin.js @@ -27,8 +27,9 @@ class SharePlugin { const sharedOptions = parseOptions( options.shared, (item, key) => { - if (typeof item !== "string") + if (typeof item !== "string") { throw new Error("Unexpected array in shared"); + } /** @type {SharedConfig} */ const config = item === key || !isRequiredVersion(item) diff --git a/lib/sharing/utils.js b/lib/sharing/utils.js index 037fcb17604..61bc7772dc2 100644 --- a/lib/sharing/utils.js +++ b/lib/sharing/utils.js @@ -391,6 +391,7 @@ const getDescriptionFile = ( }; tryLoadCurrent(); }; + module.exports.getDescriptionFile = getDescriptionFile; /** @@ -421,5 +422,6 @@ const getRequiredVersionFromDescriptionFile = (data, packageName) => { } } }; + module.exports.getRequiredVersionFromDescriptionFile = getRequiredVersionFromDescriptionFile; diff --git a/lib/stats/DefaultStatsFactoryPlugin.js b/lib/stats/DefaultStatsFactoryPlugin.js index 95826dd1cd3..a366564923f 100644 --- a/lib/stats/DefaultStatsFactoryPlugin.js +++ b/lib/stats/DefaultStatsFactoryPlugin.js @@ -582,6 +582,7 @@ const SIMPLE_EXTRACTORS = { const { logging, loggingDebug, loggingTrace } = options; if (logging || (loggingDebug && loggingDebug.length > 0)) { const util = require("util"); + object.logging = {}; let acceptedTypes; let collapsedGroups = false; @@ -654,8 +655,9 @@ const SIMPLE_EXTRACTORS = { if ( type === LogType.groupCollapsed && (debugMode || collapsedGroups) - ) + ) { type = LogType.group; + } if (depthInCollapsedGroup === 0) { processedLogEntries++; @@ -980,9 +982,10 @@ const SIMPLE_EXTRACTORS = { !warningsFilter && /** @type {KnownNormalizedStatsOptions["warningsFilter"]} */ (warningsFilter).length === 0 - ) + ) { // Type is wrong, because we don't need the real value for counting return /** @type {EXPECTED_ANY[]} */ (cachedGetWarnings(c)); + } return factory .create(`${type}${childType}.warnings`, cachedGetWarnings(c), context) .filter( @@ -1543,8 +1546,9 @@ const SIMPLE_EXTRACTORS = { } } for (const sibling of chunkGroup.chunks) { - if (sibling !== chunk) + if (sibling !== chunk) { siblings.add(/** @type {ChunkId} */ (sibling.id)); + } } } object.siblings = Array.from(siblings).sort(compareIds); @@ -1956,7 +1960,7 @@ const errorsSpaceLimit = (errors, max) => { let filtered = 0; // Can not fit into limit // print only messages - if (errors.length + 1 >= max) + if (errors.length + 1 >= max) { return [ errors.map(error => { if (typeof error === "string" || !error.details) return error; @@ -1965,6 +1969,7 @@ const errorsSpaceLimit = (errors, max) => { }), filtered ]; + } let fullLength = errors.length; let result = errors; @@ -2123,12 +2128,13 @@ const ASSETS_GROUPERS = { const keys = []; if (groupAssetsByPath) { keys.push("."); - if (extension) + if (extension) { keys.push( path.length ? `${path.join("/")}/*${extension}` : `*${extension}` ); + } while (path.length > 0) { keys.push(`${path.join("/")}/`); path.pop(); @@ -2319,12 +2325,13 @@ const MODULES_GROUPERS = type => ({ const path = pathMatch ? pathMatch[1].split(/[/\\]/) : []; const keys = []; if (groupModulesByPath) { - if (extension) + if (extension) { keys.push( path.length ? `${path.join("/")}/*${extension}` : `*${extension}` ); + } while (path.length > 0) { keys.push(`${path.join("/")}/`); path.pop(); @@ -2511,8 +2518,9 @@ const iterateConfig = (config, options, fn) => { value === false || value === undefined || (Array.isArray(value) && value.length === 0) - ) + ) { continue; + } } } fn(hookFor, subConfig[option]); @@ -2684,4 +2692,5 @@ class DefaultStatsFactoryPlugin { }); } } + module.exports = DefaultStatsFactoryPlugin; diff --git a/lib/stats/DefaultStatsPresetPlugin.js b/lib/stats/DefaultStatsPresetPlugin.js index c3d5ca21071..96b26d74ded 100644 --- a/lib/stats/DefaultStatsPresetPlugin.js +++ b/lib/stats/DefaultStatsPresetPlugin.js @@ -390,7 +390,7 @@ class DefaultStatsPresetPlugin { } compilation.hooks.statsNormalize.tap(PLUGIN_NAME, (options, context) => { for (const key of Object.keys(DEFAULTS)) { - if (options[key] === undefined) + if (options[key] === undefined) { options[key] = /** @type {Defaults[DefaultsKeys]} */ (DEFAULTS[/** @type {DefaultsKeys} */ (key)])( @@ -398,6 +398,7 @@ class DefaultStatsPresetPlugin { context, compilation ); + } } for (const key of Object.keys(NORMALIZER)) { options[key] = @@ -408,4 +409,5 @@ class DefaultStatsPresetPlugin { }); } } + module.exports = DefaultStatsPresetPlugin; diff --git a/lib/stats/DefaultStatsPrinterPlugin.js b/lib/stats/DefaultStatsPrinterPlugin.js index 30f260da974..31949c08075 100644 --- a/lib/stats/DefaultStatsPrinterPlugin.js +++ b/lib/stats/DefaultStatsPrinterPlugin.js @@ -277,8 +277,9 @@ const COMPILATION_SIMPLE_PRINTERS = { (errorsCount === 0 && warningsCount === 0) || timeMessage || hashMessage - ) + ) { return `${builtAtMessage}${subjectMessage} ${statusMessage}${timeMessage}${hashMessage}`; + } }, "compilation.filteredWarningDetailsCount": count => count @@ -547,8 +548,9 @@ const MODULE_SIMPLE_PRINTERS = { if (usedExports === null) return cyan(formatFlag("used exports unknown")); if (usedExports === false) return cyan(formatFlag("module unused")); if (Array.isArray(usedExports)) { - if (usedExports.length === 0) + if (usedExports.length === 0) { return cyan(formatFlag("no exports used")); + } const providedExportsCount = Array.isArray(module.providedExports) ? module.providedExports.length : null; @@ -1407,15 +1409,17 @@ const SIMPLE_ELEMENT_JOINERS = { items.map(item => { switch (item.element) { case "moduleId": - if (moduleReason.moduleId === moduleReason.module && item.content) + if (moduleReason.moduleId === moduleReason.module && item.content) { hasName = true; + } break; case "module": if (hasName) return false; break; case "resolvedModule": - if (moduleReason.module === moduleReason.resolvedModule) + if (moduleReason.module === moduleReason.resolvedModule) { return false; + } break; case "children": if (item.content) { @@ -1621,6 +1625,7 @@ class DefaultStatsPrinterPlugin { `${start}${ typeof str === "string" ? str.replace( + // eslint-disable-next-line no-control-regex /((\u001B\[39m|\u001B\[22m|\u001B\[0m)+)/g, `$1${start}` ) @@ -1886,4 +1891,5 @@ class DefaultStatsPrinterPlugin { }); } } + module.exports = DefaultStatsPrinterPlugin; diff --git a/lib/stats/StatsFactory.js b/lib/stats/StatsFactory.js index e1dcf280d21..4c8214190f0 100644 --- a/lib/stats/StatsFactory.js +++ b/lib/stats/StatsFactory.js @@ -236,8 +236,9 @@ class StatsFactory { this._inCreate = true; return this._create(type, data, baseContext); } finally { - for (const key of Object.keys(this._caches)) + for (const key of Object.keys(this._caches)) { this._caches[/** @type {keyof StatsFactoryHooks} */ (key)].clear(); + } this._inCreate = false; } } @@ -397,4 +398,5 @@ class StatsFactory { ); } } + module.exports = StatsFactory; diff --git a/lib/stats/StatsPrinter.js b/lib/stats/StatsPrinter.js index 40866edf5fe..34bd4ac3f98 100644 --- a/lib/stats/StatsPrinter.js +++ b/lib/stats/StatsPrinter.js @@ -298,4 +298,5 @@ class StatsPrinter { ); } } + module.exports = StatsPrinter; diff --git a/lib/url/URLParserPlugin.js b/lib/url/URLParserPlugin.js index 3fc13c1778d..24c6eab2ab8 100644 --- a/lib/url/URLParserPlugin.js +++ b/lib/url/URLParserPlugin.js @@ -49,8 +49,9 @@ const isMetaUrl = (parser, arg) => { chain.object.meta.name !== "import" || chain.object.property.name !== "meta" || chain.members[0] !== "url" - ) + ) { return false; + } return true; }; @@ -77,8 +78,9 @@ const getEvaluatedExpr = (expr, parser) => { const [arg1, arg2] = expr.arguments; - if (arg2.type !== "MemberExpression" || arg1.type === "SpreadElement") + if (arg2.type !== "MemberExpression" || arg1.type === "SpreadElement") { return; + } if (!isMetaUrl(parser, arg2)) return; return parser.evaluateExpression(arg1); @@ -148,8 +150,9 @@ class URLParserPlugin { const [, arg2] = expr.arguments; - if (arg2.type !== "MemberExpression" || !isMetaUrl(parser, arg2)) + if (arg2.type !== "MemberExpression" || !isMetaUrl(parser, arg2)) { return; + } const dep = new ConstDependency( RuntimeGlobals.baseURI, diff --git a/lib/util/Hash.js b/lib/util/Hash.js index a0078275327..667add22380 100644 --- a/lib/util/Hash.js +++ b/lib/util/Hash.js @@ -16,6 +16,7 @@ class Hash { */ update(data, inputEncoding) { const AbstractMethodError = require("../AbstractMethodError"); + throw new AbstractMethodError(); } @@ -28,6 +29,7 @@ class Hash { */ digest(encoding) { const AbstractMethodError = require("../AbstractMethodError"); + throw new AbstractMethodError(); } } diff --git a/lib/util/LazyBucketSortedSet.js b/lib/util/LazyBucketSortedSet.js index c1cd0b0e9b4..74030ce9242 100644 --- a/lib/util/LazyBucketSortedSet.js +++ b/lib/util/LazyBucketSortedSet.js @@ -225,8 +225,9 @@ class LazyBucketSortedSet { * @returns {void} */ _appendIterators(iterators) { - if (this._unsortedItems.size > 0) + if (this._unsortedItems.size > 0) { iterators.push(this._unsortedItems[Symbol.iterator]()); + } for (const key of this._keys) { const entry = this._map.get(key); if (this._leaf) { diff --git a/lib/util/LazySet.js b/lib/util/LazySet.js index 5d4fcb7059c..cfcc6691a66 100644 --- a/lib/util/LazySet.js +++ b/lib/util/LazySet.js @@ -5,7 +5,7 @@ "use strict"; -const makeSerializable = require("./makeSerializable.js"); +const makeSerializable = require("./makeSerializable"); /** * @template T @@ -161,7 +161,7 @@ class LazySet { forEach(callbackFn, thisArg) { this._deopt = true; if (this._needMerge) this._merge(); - // eslint-disable-next-line unicorn/no-array-for-each + // eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-method-this-argument this._set.forEach(callbackFn, thisArg); } diff --git a/lib/util/StringXor.js b/lib/util/StringXor.js index ea5c8f83544..785af5f610b 100644 --- a/lib/util/StringXor.js +++ b/lib/util/StringXor.js @@ -71,6 +71,7 @@ class StringXor { } } else { for (let i = 0; i < len; i++) { + // eslint-disable-next-line operator-assignment value[i] = value[i] ^ str.charCodeAt(i); } } diff --git a/lib/util/cleverMerge.js b/lib/util/cleverMerge.js index 93fcdce88de..43984725ae4 100644 --- a/lib/util/cleverMerge.js +++ b/lib/util/cleverMerge.js @@ -30,10 +30,12 @@ const DYNAMIC_INFO = Symbol("cleverMerge dynamic info"); const cachedCleverMerge = (first, second) => { if (second === undefined) return /** @type {T} */ (first); if (first === undefined) return /** @type {O} */ (second); - if (typeof second !== "object" || second === null) + if (typeof second !== "object" || second === null) { return /** @type {O} */ (second); - if (typeof first !== "object" || first === null) + } + if (typeof first !== "object" || first === null) { return /** @type {T} */ (first); + } let innerCache = mergeCache.get(first); if (innerCache === undefined) { @@ -171,9 +173,10 @@ const parseObject = obj => { /** @type {ByValues} */ (entry.byValues).has(otherByValue) ) - ) + ) { /** @type {ByValues} */ (entry.byValues).set(otherByValue, undefined); + } } } } @@ -438,8 +441,9 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => { } else { // = first.base + ((first.byProperty (+default) + second.base) + second.byProperty) newBase = firstEntry.base; - if (!intermediateByValues.has("default")) + if (!intermediateByValues.has("default")) { intermediateByValues.set("default", secondEntry.base); + } } if (!secondEntry.byProperty) { // = first.base + (first.byProperty + second.base) diff --git a/lib/util/comparators.js b/lib/util/comparators.js index 9e7df86c3e8..4b6d2e49130 100644 --- a/lib/util/comparators.js +++ b/lib/util/comparators.js @@ -81,6 +81,7 @@ const compareModulesById = (chunkGraph, a, b) => /** @type {ModuleId} */ (chunkGraph.getModuleId(a)), /** @type {ModuleId} */ (chunkGraph.getModuleId(b)) ); + /** @type {ParameterizedComparator} */ module.exports.compareModulesById = createCachedParameterizedComparator(compareModulesById); @@ -98,6 +99,7 @@ const compareNumbers = (a, b) => { if (a > b) return 1; return 0; }; + module.exports.compareNumbers = compareNumbers; /** @@ -170,6 +172,7 @@ const compareStringsNumeric = (a, b) => { return 0; }; + module.exports.compareStringsNumeric = compareStringsNumeric; /** @@ -186,6 +189,7 @@ const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => { if (cmp !== 0) return cmp; return compareIds(a.identifier(), b.identifier()); }; + /** @type {ParameterizedComparator} */ module.exports.compareModulesByPostOrderIndexOrIdentifier = createCachedParameterizedComparator( @@ -206,6 +210,7 @@ const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => { if (cmp !== 0) return cmp; return compareIds(a.identifier(), b.identifier()); }; + /** @type {ParameterizedComparator} */ module.exports.compareModulesByPreOrderIndexOrIdentifier = createCachedParameterizedComparator( @@ -226,6 +231,7 @@ const compareModulesByIdOrIdentifier = (chunkGraph, a, b) => { if (cmp !== 0) return cmp; return compareIds(a.identifier(), b.identifier()); }; + /** @type {ParameterizedComparator} */ module.exports.compareModulesByIdOrIdentifier = createCachedParameterizedComparator(compareModulesByIdOrIdentifier); @@ -237,6 +243,7 @@ module.exports.compareModulesByIdOrIdentifier = * @returns {-1 | 0 | 1} compare result */ const compareChunks = (chunkGraph, a, b) => chunkGraph.compareChunks(a, b); + /** @type {ParameterizedComparator} */ module.exports.compareChunks = createCachedParameterizedComparator(compareChunks); @@ -277,6 +284,7 @@ module.exports.compareStrings = compareStrings; */ const compareChunkGroupsByIndex = (a, b) => /** @type {number} */ (a.index) < /** @type {number} */ (b.index) ? -1 : 1; + module.exports.compareChunkGroupsByIndex = compareChunkGroupsByIndex; /** @@ -354,6 +362,7 @@ const concatComparators = (c1, c2, ...cRest) => { concatComparatorsCache.set(c1, c2, result); return result; }; + module.exports.concatComparators = concatComparators; /** @@ -396,6 +405,7 @@ const compareSelect = (getter, comparator) => { compareSelectCache.set(getter, comparator, result); return result; }; + module.exports.compareSelect = compareSelect; /** @type {WeakMap, Comparator>>} */ @@ -432,6 +442,7 @@ const compareIterables = elementComparator => { compareIteratorsCache.set(elementComparator, result); return result; }; + module.exports.compareIterables = compareIterables; // TODO this is no longer needed when minimum node.js version is >= 12 @@ -499,25 +510,45 @@ module.exports.compareLocations = (a, b) => { const bp = b.start; if (ap.line < bp.line) return -1; if (ap.line > bp.line) return 1; - if (/** @type {number} */ (ap.column) < /** @type {number} */ (bp.column)) + if ( + /** @type {number} */ (ap.column) < /** @type {number} */ (bp.column) + ) { return -1; - if (/** @type {number} */ (ap.column) > /** @type {number} */ (bp.column)) + } + if ( + /** @type {number} */ (ap.column) > /** @type {number} */ (bp.column) + ) { return 1; - } else return -1; - } else if ("start" in b) return 1; + } + } else { + return -1; + } + } else if ("start" in b) { + return 1; + } if ("name" in a) { if ("name" in b) { if (a.name < b.name) return -1; if (a.name > b.name) return 1; - } else return -1; - } else if ("name" in b) return 1; + } else { + return -1; + } + } else if ("name" in b) { + return 1; + } if ("index" in a) { if ("index" in b) { - if (/** @type {number} */ (a.index) < /** @type {number} */ (b.index)) + if (/** @type {number} */ (a.index) < /** @type {number} */ (b.index)) { return -1; - if (/** @type {number} */ (a.index) > /** @type {number} */ (b.index)) + } + if (/** @type {number} */ (a.index) > /** @type {number} */ (b.index)) { return 1; - } else return -1; - } else if ("index" in b) return 1; + } + } else { + return -1; + } + } else if ("index" in b) { + return 1; + } return 0; }; diff --git a/lib/util/compileBooleanMatcher.js b/lib/util/compileBooleanMatcher.js index 88b7883c55e..1c17daf21ec 100644 --- a/lib/util/compileBooleanMatcher.js +++ b/lib/util/compileBooleanMatcher.js @@ -42,10 +42,12 @@ const compileBooleanMatcher = map => { const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => { if (positiveItems.length === 0) return () => "false"; if (negativeItems.length === 0) return () => "true"; - if (positiveItems.length === 1) + if (positiveItems.length === 1) { return value => `${toSimpleString(positiveItems[0])} == ${value}`; - if (negativeItems.length === 1) + } + if (negativeItems.length === 1) { return value => `${toSimpleString(negativeItems[0])} != ${value}`; + } const positiveRegexp = itemsToRegexp(positiveItems); const negativeRegexp = itemsToRegexp(negativeItems); if (positiveRegexp.length <= negativeRegexp.length) { @@ -231,4 +233,5 @@ const itemsToRegexp = itemsArr => { compileBooleanMatcher.fromLists = compileBooleanMatcherFromLists; compileBooleanMatcher.itemsToRegexp = itemsToRegexp; + module.exports = compileBooleanMatcher; diff --git a/lib/util/concatenate.js b/lib/util/concatenate.js index bc2297b0f23..e7a727702cc 100644 --- a/lib/util/concatenate.js +++ b/lib/util/concatenate.js @@ -122,8 +122,9 @@ function findNewName(oldName, usedNamed1, usedNamed2, extraInfo) { if ( !usedNamed1.has(nameIdent) && (!usedNamed2 || !usedNamed2.has(nameIdent)) - ) + ) { return nameIdent; + } } let i = 0; diff --git a/lib/util/createHash.js b/lib/util/createHash.js index 098eacb4a8f..a3ad731cb85 100644 --- a/lib/util/createHash.js +++ b/lib/util/createHash.js @@ -48,8 +48,9 @@ class BulkUpdateDecorator extends Hash { typeof data !== "string" || data.length > BULK_SIZE ) { - if (this.hash === undefined) + if (this.hash === undefined) { this.hash = /** @type {HashFactory} */ (this.hashFactory)(); + } if (this.buffer.length > 0) { this.hash.update(this.buffer); this.buffer = ""; @@ -58,8 +59,9 @@ class BulkUpdateDecorator extends Hash { } else { this.buffer += data; if (this.buffer.length > BULK_SIZE) { - if (this.hash === undefined) + if (this.hash === undefined) { this.hash = /** @type {HashFactory} */ (this.hashFactory)(); + } this.hash.update(this.buffer); this.buffer = ""; } @@ -113,13 +115,17 @@ class DebugHash extends Hash { * @returns {this} updated hash */ update(data, inputEncoding) { - if (typeof data !== "string") data = data.toString("utf-8"); + if (typeof data !== "string") data = data.toString("utf8"); const prefix = Buffer.from("@webpack-debug-digest@").toString("hex"); if (data.startsWith(prefix)) { data = Buffer.from(data.slice(prefix.length), "hex").toString(); } this.string += `[${data}](${ - /** @type {string} */ (new Error().stack).split("\n", 3)[2] + /** @type {string} */ + ( + // eslint-disable-next-line unicorn/error-message + new Error().stack + ).split("\n", 3)[2] })\n`; return this; } diff --git a/lib/util/deprecation.js b/lib/util/deprecation.js index 79dc4ae12fc..6127380599e 100644 --- a/lib/util/deprecation.js +++ b/lib/util/deprecation.js @@ -330,6 +330,7 @@ const deprecateAllProperties = (obj, message, code) => { } return /** @type {T} */ (newObj); }; + module.exports.deprecateAllProperties = deprecateAllProperties; /** diff --git a/lib/util/deterministicGrouping.js b/lib/util/deterministicGrouping.js index 6978ef3014c..ea289983bfd 100644 --- a/lib/util/deterministicGrouping.js +++ b/lib/util/deterministicGrouping.js @@ -343,13 +343,15 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => { group, problemTypes ); - if (minMatches !== groupMatches) + if (minMatches !== groupMatches) { return minMatches < groupMatches ? group : min; + } if ( selectiveSizeSum(min.size, problemTypes) > selectiveSizeSum(group.size, problemTypes) - ) + ) { return group; + } return min; }); for (const node of problemNodes) bestGroup.nodes.push(node); diff --git a/lib/util/extractUrlAndGlobal.js b/lib/util/extractUrlAndGlobal.js index ade0a7cf25c..394924a5324 100644 --- a/lib/util/extractUrlAndGlobal.js +++ b/lib/util/extractUrlAndGlobal.js @@ -14,5 +14,5 @@ module.exports = function extractUrlAndGlobal(urlAndGlobal) { if (index <= 0 || index === urlAndGlobal.length - 1) { throw new Error(`Invalid request "${urlAndGlobal}"`); } - return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)]; + return [urlAndGlobal.slice(index + 1), urlAndGlobal.slice(0, index)]; }; diff --git a/lib/util/fs.js b/lib/util/fs.js index d38331827c9..ae463572add 100644 --- a/lib/util/fs.js +++ b/lib/util/fs.js @@ -48,7 +48,6 @@ const path = require("path"); * @typedef {IStatsBase & { atimeNs: bigint, mtimeNs: bigint, ctimeNs: bigint, birthtimeNs: bigint }} IBigIntStats */ -/* eslint-disable jsdoc/require-template */ /** * @template {string | Buffer} [T=string] * @typedef {object} Dirent @@ -63,7 +62,6 @@ const path = require("path"); * @property {string} parentPath path * @property {string=} path path */ -/* eslint-enable jsdoc/require-template */ /** @typedef {string | number | boolean | null} JsonPrimitive */ /** @typedef {JsonValue[]} JsonArray */ @@ -480,6 +478,7 @@ const relative = (fs, rootPath, targetPath) => { `${rootPath} is neither a posix nor a windows path, and there is no 'relative' method defined in the file system` ); }; + module.exports.relative = relative; /** @@ -500,6 +499,7 @@ const join = (fs, rootPath, filename) => { `${rootPath} is neither a posix nor a windows path, and there is no 'join' method defined in the file system` ); }; + module.exports.join = join; /** @@ -519,6 +519,7 @@ const dirname = (fs, absPath) => { `${absPath} is neither a posix nor a windows path, and there is no 'dirname' method defined in the file system` ); }; + module.exports.dirname = dirname; /** @@ -564,6 +565,7 @@ const mkdirp = (fs, p, callback) => { callback(); }); }; + module.exports.mkdirp = mkdirp; /** @@ -591,6 +593,7 @@ const mkdirpSync = (fs, p) => { } } }; + module.exports.mkdirpSync = mkdirpSync; /** @@ -600,21 +603,23 @@ module.exports.mkdirpSync = mkdirpSync; * @returns {void} */ const readJson = (fs, p, callback) => { - if ("readJson" in fs) + if ("readJson" in fs) { return /** @type {NonNullable} */ ( fs.readJson )(p, callback); + } fs.readFile(p, (err, buf) => { if (err) return callback(err); let data; try { - data = JSON.parse(/** @type {Buffer} */ (buf).toString("utf-8")); + data = JSON.parse(/** @type {Buffer} */ (buf).toString("utf8")); } catch (err1) { return callback(/** @type {Error} */ (err1)); } return callback(null, data); }); }; + module.exports.readJson = readJson; /** @@ -655,4 +660,5 @@ const lstatReadlinkAbsolute = (fs, p, callback) => { if ("lstat" in fs) return doStat(); doReadLink(); }; + module.exports.lstatReadlinkAbsolute = lstatReadlinkAbsolute; diff --git a/lib/util/hash/wasm-hash.js b/lib/util/hash/wasm-hash.js index 289d6fb2081..fbc3f3909f0 100644 --- a/lib/util/hash/wasm-hash.js +++ b/lib/util/hash/wasm-hash.js @@ -61,12 +61,14 @@ class WasmHash { const { exports, buffered, mem, chunkSize } = this; let endPos; if (data.length < 70) { + // eslint-disable-next-line unicorn/text-encoding-identifier-case if (!encoding || encoding === "utf-8" || encoding === "utf8") { endPos = buffered; for (let i = 0; i < data.length; i++) { const cc = data.charCodeAt(i); - if (cc < 0x80) mem[endPos++] = cc; - else if (cc < 0x800) { + if (cc < 0x80) { + mem[endPos++] = cc; + } else if (cc < 0x800) { mem[endPos] = (cc >> 6) | 0xc0; mem[endPos + 1] = (cc & 0x3f) | 0x80; endPos += 2; diff --git a/lib/util/identifier.js b/lib/util/identifier.js index 99bff981bc8..551e519f0ed 100644 --- a/lib/util/identifier.js +++ b/lib/util/identifier.js @@ -75,8 +75,9 @@ const absoluteToRequest = (context, maybeAbsolutePath) => { * @returns {string} absolute path */ const requestToAbsolute = (context, relativePath) => { - if (relativePath.startsWith("./") || relativePath.startsWith("../")) + if (relativePath.startsWith("./") || relativePath.startsWith("../")) { return path.join(context, relativePath); + } return relativePath; }; @@ -307,6 +308,7 @@ const _contextify = (context, request) => .join("!"); const contextify = makeCacheableWithContext(_contextify); + module.exports.contextify = contextify; /** @@ -321,6 +323,7 @@ const _absolutify = (context, request) => .join("!"); const absolutify = makeCacheableWithContext(_absolutify); + module.exports.absolutify = absolutify; const PATH_QUERY_FRAGMENT_REGEXP = @@ -345,6 +348,7 @@ const _parseResource = str => { fragment: match[3] || "" }; }; + module.exports.parseResource = makeCacheable(_parseResource); /** @@ -362,6 +366,7 @@ const _parseResourceWithoutFragment = str => { query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "" }; }; + module.exports.parseResourceWithoutFragment = makeCacheable( _parseResourceWithoutFragment ); diff --git a/lib/util/removeBOM.js b/lib/util/removeBOM.js index f084ae85871..6ac60dfbd97 100644 --- a/lib/util/removeBOM.js +++ b/lib/util/removeBOM.js @@ -11,7 +11,7 @@ */ module.exports = strOrBuffer => { if (typeof strOrBuffer === "string" && strOrBuffer.charCodeAt(0) === 0xfeff) { - return strOrBuffer.substr(1); + return strOrBuffer.slice(1); } else if ( Buffer.isBuffer(strOrBuffer) && strOrBuffer[0] === 0xef && diff --git a/lib/util/runtime.js b/lib/util/runtime.js index 36bc6a2a91b..38dc29a894f 100644 --- a/lib/util/runtime.js +++ b/lib/util/runtime.js @@ -68,6 +68,7 @@ const forEachRuntime = (runtime, fn, deterministicOrder = false) => { } } }; + module.exports.forEachRuntime = forEachRuntime; /** @@ -89,6 +90,7 @@ const getRuntimeKey = runtime => { if (typeof runtime === "string") return runtime; return runtime.getFromUnorderedCache(getRuntimesKey); }; + module.exports.getRuntimeKey = getRuntimeKey; /** @@ -101,6 +103,7 @@ const keyToRuntime = key => { if (items.length === 1) return items[0]; return new SortableSet(items); }; + module.exports.keyToRuntime = keyToRuntime; /** @@ -122,6 +125,7 @@ const runtimeToString = runtime => { if (typeof runtime === "string") return runtime; return runtime.getFromUnorderedCache(getRuntimesString); }; + module.exports.runtimeToString = runtimeToString; /** @@ -163,6 +167,7 @@ const runtimeEqual = (a, b) => { if (aV.value !== bV.value) return false; } }; + module.exports.runtimeEqual = runtimeEqual; /** @@ -221,6 +226,7 @@ const mergeRuntime = (a, b) => { if (set.size === a.size) return a; return set; }; + module.exports.mergeRuntime = mergeRuntime; /** @@ -296,6 +302,7 @@ const mergeRuntimeOwned = (a, b) => { for (const item of b) a.add(item); return a; }; + module.exports.mergeRuntimeOwned = mergeRuntimeOwned; /** @@ -376,6 +383,7 @@ const subtractRuntime = (a, b) => { } return set; }; + module.exports.subtractRuntime = subtractRuntime; /** @@ -604,9 +612,10 @@ class RuntimeSpecMap { /** @type {RuntimeSpecMapInnerMap} */ (this._map).get(key); const newValue = fn(oldValue); - if (newValue !== oldValue) + if (newValue !== oldValue) { /** @type {RuntimeSpecMapInnerMap} */ (this._map).set(key, newValue); + } } } } diff --git a/lib/util/serialization.js b/lib/util/serialization.js index d6de3ec47bc..731cc39bf0f 100644 --- a/lib/util/serialization.js +++ b/lib/util/serialization.js @@ -41,6 +41,7 @@ const registerSerializers = memoize(() => { // Load internal paths with a relative require // This allows bundling all internal serializers const internalSerializables = require("./internalSerializables"); + getObjectMiddleware().registerLoader(/^webpack\/lib\//, req => { const loader = internalSerializables[ @@ -116,7 +117,9 @@ module.exports = { createFileSerializer: (fs, hashFunction) => { registerSerializers(); const Serializer = getSerializer(); + const FileMiddleware = require("../serialization/FileMiddleware"); + const fileMiddleware = new FileMiddleware(fs, hashFunction); const binaryMiddleware = getBinaryMiddlewareInstance(); const SerializerMiddleware = getSerializerMiddleware(); diff --git a/lib/util/source.js b/lib/util/source.js index b9516786ba1..065c7a605bf 100644 --- a/lib/util/source.js +++ b/lib/util/source.js @@ -23,8 +23,8 @@ const _isSourceEqual = (a, b) => { let bSource = typeof b.buffer === "function" ? b.buffer() : b.source(); if (aSource === bSource) return true; if (typeof aSource === "string" && typeof bSource === "string") return false; - if (!Buffer.isBuffer(aSource)) aSource = Buffer.from(aSource, "utf-8"); - if (!Buffer.isBuffer(bSource)) bSource = Buffer.from(bSource, "utf-8"); + if (!Buffer.isBuffer(aSource)) aSource = Buffer.from(aSource, "utf8"); + if (!Buffer.isBuffer(bSource)) bSource = Buffer.from(bSource, "utf8"); return aSource.equals(bSource); }; @@ -58,4 +58,5 @@ const isSourceEqual = (a, b) => { } return result; }; + module.exports.isSourceEqual = isSourceEqual; diff --git a/lib/validateSchema.js b/lib/validateSchema.js index 83841b61119..d10f3454ba6 100644 --- a/lib/validateSchema.js +++ b/lib/validateSchema.js @@ -173,4 +173,5 @@ const validateSchema = (schema, options, validationConfiguration) => { } ); }; + module.exports = validateSchema; diff --git a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js index 90020b3d5de..cb8b47108dc 100644 --- a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +++ b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js @@ -169,8 +169,9 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator { chunkGraph.getRenderedModuleHash(module, runtime) )}${importsObj ? `, ${importsObj})` : ")"}`; - if (promises.length > 0) + if (promises.length > 0) { runtimeRequirements.add(RuntimeGlobals.asyncModule); + } const source = new RawSource( promises.length > 0 diff --git a/lib/wasm-sync/WebAssemblyInInitialChunkError.js b/lib/wasm-sync/WebAssemblyInInitialChunkError.js index 9d78ed205f4..8de4c352688 100644 --- a/lib/wasm-sync/WebAssemblyInInitialChunkError.js +++ b/lib/wasm-sync/WebAssemblyInInitialChunkError.js @@ -42,8 +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; if (alreadyReferencedModules.has(newHead)) continue; alreadyReferencedModules.add(newHead); diff --git a/lib/wasm/EnableWasmLoadingPlugin.js b/lib/wasm/EnableWasmLoadingPlugin.js index 4d4dace131b..9af839e170f 100644 --- a/lib/wasm/EnableWasmLoadingPlugin.js +++ b/lib/wasm/EnableWasmLoadingPlugin.js @@ -80,6 +80,7 @@ class EnableWasmLoadingPlugin { if (compiler.options.experiments.syncWebAssembly) { // TODO webpack 6 remove FetchCompileWasmPlugin const FetchCompileWasmPlugin = require("../web/FetchCompileWasmPlugin"); + new FetchCompileWasmPlugin({ mangleImports: compiler.options.optimization.mangleWasmImports }).apply(compiler); @@ -87,6 +88,7 @@ class EnableWasmLoadingPlugin { if (compiler.options.experiments.asyncWebAssembly) { const FetchCompileAsyncWasmPlugin = require("../web/FetchCompileAsyncWasmPlugin"); + new FetchCompileAsyncWasmPlugin().apply(compiler); } @@ -96,6 +98,7 @@ class EnableWasmLoadingPlugin { if (compiler.options.experiments.syncWebAssembly) { // TODO webpack 6 remove ReadFileCompileWasmPlugin const ReadFileCompileWasmPlugin = require("../node/ReadFileCompileWasmPlugin"); + new ReadFileCompileWasmPlugin({ mangleImports: compiler.options.optimization.mangleWasmImports, import: @@ -106,6 +109,7 @@ class EnableWasmLoadingPlugin { if (compiler.options.experiments.asyncWebAssembly) { const ReadFileCompileAsyncWasmPlugin = require("../node/ReadFileCompileAsyncWasmPlugin"); + new ReadFileCompileAsyncWasmPlugin({ import: compiler.options.output.module && @@ -117,6 +121,7 @@ class EnableWasmLoadingPlugin { } case "universal": { const UniversalCompileAsyncWasmPlugin = require("../wasm-async/UniversalCompileAsyncWasmPlugin"); + new UniversalCompileAsyncWasmPlugin().apply(compiler); break; } diff --git a/lib/webpack.js b/lib/webpack.js index b4205d74cc3..181340071b4 100644 --- a/lib/webpack.js +++ b/lib/webpack.js @@ -6,7 +6,7 @@ "use strict"; const util = require("util"); -const webpackOptionsSchemaCheck = require("../schemas/WebpackOptions.check.js"); +const webpackOptionsSchemaCheck = require("../schemas/WebpackOptions.check"); const webpackOptionsSchema = require("../schemas/WebpackOptions.json"); const Compiler = require("./Compiler"); const MultiCompiler = require("./MultiCompiler"); diff --git a/lib/webworker/ImportScriptsChunkLoadingPlugin.js b/lib/webworker/ImportScriptsChunkLoadingPlugin.js index c26e7f602c8..60b15ce27a3 100644 --- a/lib/webworker/ImportScriptsChunkLoadingPlugin.js +++ b/lib/webworker/ImportScriptsChunkLoadingPlugin.js @@ -104,4 +104,5 @@ class ImportScriptsChunkLoadingPlugin { }); } } + module.exports = ImportScriptsChunkLoadingPlugin; diff --git a/lib/webworker/WebWorkerTemplatePlugin.js b/lib/webworker/WebWorkerTemplatePlugin.js index 382c81243e8..4001aa1a9fc 100644 --- a/lib/webworker/WebWorkerTemplatePlugin.js +++ b/lib/webworker/WebWorkerTemplatePlugin.js @@ -22,4 +22,5 @@ class WebWorkerTemplatePlugin { new EnableChunkLoadingPlugin("import-scripts").apply(compiler); } } + module.exports = WebWorkerTemplatePlugin; diff --git a/package.json b/package.json index 7f692c53e09..3471f673175 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,85 @@ { "name": "webpack", "version": "5.99.9", - "author": "Tobias Koppers @sokra", "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", + "repository": { + "type": "git", + "url": "https://github.com/webpack/webpack.git" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, "license": "MIT", + "author": "Tobias Koppers @sokra", + "main": "lib/index.js", + "types": "types.d.ts", + "bin": { + "webpack": "bin/webpack.js" + }, + "files": [ + "lib/", + "bin/", + "hot/", + "schemas/", + "SECURITY.md", + "module.d.ts", + "types.d.ts" + ], + "scripts": { + "prepare": "husky", + "setup": "node ./setup/setup.js", + "prelint": "yarn setup", + "lint": "yarn lint:code && yarn lint:special && yarn lint:types && yarn lint:types-test && yarn lint:types-module-test && yarn lint:yarn && yarn fmt:check && yarn lint:spellcheck", + "lint:code": "node node_modules/eslint/bin/eslint.js --cache .", + "lint:special": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals", + "lint:types": "tsc", + "lint:types-test": "tsc -p tsconfig.types.test.json", + "lint:types-module-test": "tsc -p tsconfig.module.test.json", + "lint:yarn": "yarn-deduplicate --fail --list -s highest yarn.lock", + "lint:spellcheck": "cspell --cache --no-must-find-files --quiet \"**/*.*\"", + "report:types": "rimraf coverage && yarn cover:types && yarn cover:report && open-cli coverage/lcov-report/index.html", + "validate:types": "tsc -p tsconfig.validation.json", + "fmt": "yarn fmt:base --log-level warn --write", + "fmt:check": "yarn fmt:base --check", + "fmt:base": "node node_modules/prettier/bin/prettier.cjs --cache --ignore-unknown .", + "fix": "yarn fix:code && yarn fix:yarn && yarn fix:special && yarn fmt", + "fix:code": "yarn lint:code --fix", + "fix:yarn": "yarn-deduplicate -s highest yarn.lock", + "fix:special": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write", + "build:examples": "cd examples && node buildAll.js", + "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation --hash-seed=1 --random-seed=1 --no-opt --predictable --predictable-gc-schedule --interpreted-frames-native-stack --allow-natives-syntax --expose-gc --no-concurrent-sweeping ./test/BenchmarkTestCases.benchmark.mjs", + "pretest": "yarn lint", + "test": "yarn test:base", + "test:update-snapshots": "yarn test:base -u", + "test:basic": "yarn test:base --testMatch \"/test/*.basictest.js\"", + "test:unit": "yarn test:base --testMatch \"/test/*.unittest.js\"", + "test:integration": "yarn test:base --testMatch \"/test/*.{basictest,longtest,test}.js\"", + "test:base": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage", + "cover": "yarn cover:all && yarn cover:report", + "cover:clean": "rimraf .nyc_output coverage", + "cover:all": "yarn cover:base --coverage", + "cover:unit": "yarn cover:base --testMatch \"/test/*.unittest.js\" --coverage", + "cover:basic": "yarn cover:base --testMatch \"/test/*.basictest.js\" --coverage", + "cover:integration": "yarn cover:base --testMatch \"/test/*.{basictest,longtest,test}.js\" --coverage", + "cover:integration:a": "yarn cover:base --testMatch \"/test/*.{basictest,test}.js\" --coverage", + "cover:integration:b": "yarn cover:base --testMatch \"/test/*.longtest.js\" --coverage", + "cover:base": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage", + "cover:types": "node node_modules/tooling/type-coverage", + "cover:merge": "yarn mkdirp .nyc_output && nyc merge .nyc_output coverage/coverage-nyc.json && rimraf .nyc_output", + "cover:report": "nyc report --reporter=lcov --reporter=text -t coverage" + }, + "lint-staged": { + "*.{js,cjs,mjs}": [ + "node node_modules/eslint/bin/eslint.js --cache --fix" + ], + "*": [ + "node node_modules/prettier/bin/prettier.cjs --cache --write --ignore-unknown", + "cspell --cache --no-must-find-files" + ] + }, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -30,16 +106,12 @@ "watchpack": "^2.4.1", "webpack-sources": "^3.3.3" }, - "peerDependenciesMeta": { - "webpack-cli": { - "optional": true - } - }, "devDependencies": { "@babel/core": "^7.27.1", "@babel/preset-react": "^7.27.1", "@codspeed/tinybench-plugin": "^4.0.1", "@eslint/js": "^9.29.0", + "@eslint/markdown": "^6.6.0", "@stylistic/eslint-plugin": "^5.0.0", "@types/glob-to-regexp": "^0.4.4", "@types/graceful-fs": "^4.1.9", @@ -60,11 +132,13 @@ "es6-promise-polyfill": "^1.2.0", "eslint": "^9.29.0", "eslint-config-prettier": "^10.1.1", + "eslint-config-webpack": "^4.3.0", + "eslint-plugin-import": "^2.32.0", "eslint-plugin-jest": "^29.0.1", - "eslint-plugin-jsdoc": "^51.2.2", + "eslint-plugin-jsdoc": "^51.2.3", "eslint-plugin-n": "^17.20.0", "eslint-plugin-prettier": "^5.5.0", - "eslint-plugin-unicorn": "^59.0.0", + "eslint-plugin-unicorn": "^59.0.1", "file-loader": "^6.0.0", "fork-ts-checker-webpack-plugin": "^9.0.2", "globals": "^16.0.0", @@ -118,84 +192,13 @@ "yamljs": "^0.3.0", "yarn-deduplicate": "^6.0.1" }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", "engines": { "node": ">=10.13.0" - }, - "repository": { - "type": "git", - "url": "https://github.com/webpack/webpack.git" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "homepage": "https://github.com/webpack/webpack", - "bugs": "https://github.com/webpack/webpack/issues", - "main": "lib/index.js", - "bin": { - "webpack": "bin/webpack.js" - }, - "types": "types.d.ts", - "files": [ - "lib/", - "bin/", - "hot/", - "schemas/", - "SECURITY.md", - "module.d.ts", - "types.d.ts" - ], - "scripts": { - "prepare": "husky", - "setup": "node ./setup/setup.js", - "prelint": "yarn setup", - "lint": "yarn lint:code && yarn lint:special && yarn lint:types && yarn lint:types-test && yarn lint:types-module-test && yarn lint:yarn && yarn fmt:check && yarn lint:spellcheck", - "lint:code": "node node_modules/eslint/bin/eslint.js --cache .", - "lint:special": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals", - "lint:types": "tsc", - "lint:types-test": "tsc -p tsconfig.types.test.json", - "lint:types-module-test": "tsc -p tsconfig.module.test.json", - "lint:yarn": "yarn-deduplicate --fail --list -s highest yarn.lock", - "lint:spellcheck": "cspell --cache --no-must-find-files --quiet \"**/*.*\"", - "report:types": "rimraf coverage && yarn cover:types && yarn cover:report && open-cli coverage/lcov-report/index.html", - "validate:types": "tsc -p tsconfig.validation.json", - "fmt": "yarn fmt:base --log-level warn --write", - "fmt:check": "yarn fmt:base --check", - "fmt:base": "node node_modules/prettier/bin/prettier.cjs --cache --ignore-unknown .", - "fix": "yarn fix:code && yarn fix:yarn && yarn fix:special && yarn fmt", - "fix:code": "yarn lint:code --fix", - "fix:yarn": "yarn-deduplicate -s highest yarn.lock", - "fix:special": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write", - "build:examples": "cd examples && node buildAll.js", - "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation --hash-seed=1 --random-seed=1 --no-opt --predictable --predictable-gc-schedule --interpreted-frames-native-stack --allow-natives-syntax --expose-gc --no-concurrent-sweeping ./test/BenchmarkTestCases.benchmark.mjs", - "pretest": "yarn lint", - "test": "yarn test:base", - "test:update-snapshots": "yarn test:base -u", - "test:basic": "yarn test:base --testMatch \"/test/*.basictest.js\"", - "test:unit": "yarn test:base --testMatch \"/test/*.unittest.js\"", - "test:integration": "yarn test:base --testMatch \"/test/*.{basictest,longtest,test}.js\"", - "test:base": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage", - "cover": "yarn cover:all && yarn cover:report", - "cover:clean": "rimraf .nyc_output coverage", - "cover:all": "yarn cover:base --coverage", - "cover:unit": "yarn cover:base --testMatch \"/test/*.unittest.js\" --coverage", - "cover:basic": "yarn cover:base --testMatch \"/test/*.basictest.js\" --coverage", - "cover:integration": "yarn cover:base --testMatch \"/test/*.{basictest,longtest,test}.js\" --coverage", - "cover:integration:a": "yarn cover:base --testMatch \"/test/*.{basictest,test}.js\" --coverage", - "cover:integration:b": "yarn cover:base --testMatch \"/test/*.longtest.js\" --coverage", - "cover:base": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage", - "cover:types": "node node_modules/tooling/type-coverage", - "cover:merge": "yarn mkdirp .nyc_output && nyc merge .nyc_output coverage/coverage-nyc.json && rimraf .nyc_output", - "cover:report": "nyc report --reporter=lcov --reporter=text -t coverage" - }, - "lint-staged": { - "*.{js,cjs,mjs}": [ - "node node_modules/eslint/bin/eslint.js --cache --fix" - ], - "*": [ - "node node_modules/prettier/bin/prettier.cjs --cache --write --ignore-unknown", - "cspell --cache --no-must-find-files" - ] - }, - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" + } } diff --git a/setup/setup.js b/setup/setup.js index 1e9c973de97..d109aaf779b 100644 --- a/setup/setup.js +++ b/setup/setup.js @@ -2,6 +2,7 @@ const fs = require("fs"); const path = require("path"); + const root = process.cwd(); const nodeModulesFolder = path.resolve(root, "node_modules"); const webpackDependencyFolder = path.resolve(root, "node_modules/webpack"); @@ -10,8 +11,8 @@ const webpackDependencyFolder = path.resolve(root, "node_modules/webpack"); * @returns {Promise} result */ function setup() { - return Promise.all([ - checkSymlinkExistsAsync().then(async hasSymlink => { + return checkSymlinkExistsAsync() + .then(async hasSymlink => { if (!hasSymlink) { await ensureYarnInstalledAsync(); await runSetupSymlinkAsync(); @@ -20,7 +21,6 @@ function setup() { } } }) - ]) .then(() => { process.exitCode = 0; }) @@ -93,12 +93,13 @@ function exec(command, args, description) { stdio: "inherit", shell: true }); + cp.on("error", error => { reject(new Error(`${description} failed with ${error}`)); }); cp.on("exit", exitCode => { if (exitCode) { - reject(`${description} failed with exit code ${exitCode}`); + reject(new Error(`${description} failed with exit code ${exitCode}`)); } else { resolve(); } @@ -120,14 +121,15 @@ function execGetOutput(command, args, description) { stdio: [process.stdin, "pipe", process.stderr], shell: true }); + cp.on("error", error => { reject(new Error(`${description} failed with ${error}`)); }); cp.on("exit", exitCode => { if (exitCode) { - reject(`${description} failed with exit code ${exitCode}`); + reject(new Error(`${description} failed with exit code ${exitCode}`)); } else { - resolve(Buffer.concat(buffers).toString("utf-8").trim()); + resolve(Buffer.concat(buffers).toString("utf8").trim()); } }); /** @type {Buffer[]} */ diff --git a/test/AbstractMethodError.unittest.js b/test/AbstractMethodError.unittest.js index 862a2860409..7f03906ad39 100644 --- a/test/AbstractMethodError.unittest.js +++ b/test/AbstractMethodError.unittest.js @@ -13,7 +13,7 @@ describe("WebpackError", () => { const expectedMessage = "Abstract method $1. Must be overridden."; - it("Should construct message with caller info", () => { + it("should construct message with caller info", () => { const fooClassError = new Foo().abstractMethod(); const childClassError = new Child().abstractMethod(); diff --git a/test/ArrayHelpers.unittest.js b/test/ArrayHelpers.unittest.js index 911174dd2fa..d34c6f9ec1c 100644 --- a/test/ArrayHelpers.unittest.js +++ b/test/ArrayHelpers.unittest.js @@ -11,6 +11,7 @@ describe("ArrayHelpers", () => { [1, 3, 5] ]); }); + it("groupBy works with empty array", () => { expect(ArrayHelpers.groupBy([], x => x % 2 === 0)).toStrictEqual([[], []]); }); diff --git a/test/BannerPlugin.test.js b/test/BannerPlugin.test.js index e3948b3b390..0395467e0c7 100644 --- a/test/BannerPlugin.test.js +++ b/test/BannerPlugin.test.js @@ -8,109 +8,111 @@ const webpack = require(".."); const pluginDir = path.join(__dirname, "js", "BannerPlugin"); const outputDir = path.join(pluginDir, "output"); -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"); - try { - fs.mkdirSync(path.join(pluginDir), { - recursive: true +describe("BannerPlugin", () => { + 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"); + try { + fs.mkdirSync(path.join(pluginDir), { + recursive: true + }); + } catch (_err) { + // empty + } + const compiler = webpack({ + mode: "development", + entry: { + entry1: entry1File, + entry2: entry2File + }, + output: { + path: outputDir + }, + plugins: [new webpack.BannerPlugin("banner is a string")] }); - } catch (_err) { - // empty - } - const compiler = webpack({ - mode: "development", - entry: { - entry1: entry1File, - entry2: entry2File - }, - output: { - path: outputDir - }, - plugins: [new webpack.BannerPlugin("banner is a string")] - }); - fs.writeFileSync(entry1File, "1", "utf-8"); - fs.writeFileSync(entry2File, "1", "utf-8"); - 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", "utf-8"); - 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); - done(err); + fs.writeFileSync(entry1File, "1", "utf8"); + fs.writeFileSync(entry2File, "1", "utf8"); + 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); + done(err); + }); }); }); -}); -it("can place banner as footer", done => { - const footerFile = path.join(pluginDir, "footerFile.js"); - const outputFile = path.join(outputDir, "footerFile.js"); - try { - fs.mkdirSync(path.join(pluginDir), { - recursive: true + it("can place banner as footer", done => { + const footerFile = path.join(pluginDir, "footerFile.js"); + const outputFile = path.join(outputDir, "footerFile.js"); + try { + fs.mkdirSync(path.join(pluginDir), { + recursive: true + }); + } catch (_err) { + // empty + } + const compiler = webpack({ + mode: "development", + entry: { + footerFile + }, + output: { + path: outputDir + }, + plugins: [ + new webpack.BannerPlugin({ + banner: "banner is a string", + footer: true + }) + ] + }); + fs.writeFileSync(footerFile, "footer", "utf8"); + compiler.run(err => { + if (err) return done(err); + const footerFileResults = fs.readFileSync(outputFile, "utf8").split("\n"); + expect(footerFileResults.pop()).toBe("/*! banner is a string */"); + done(); }); - } catch (_err) { - // empty - } - const compiler = webpack({ - mode: "development", - entry: { - footerFile - }, - output: { - path: outputDir - }, - plugins: [ - new webpack.BannerPlugin({ - banner: "banner is a string", - footer: true - }) - ] - }); - fs.writeFileSync(footerFile, "footer", "utf-8"); - compiler.run(err => { - if (err) return done(err); - const footerFileResults = fs.readFileSync(outputFile, "utf8").split("\n"); - expect(footerFileResults.pop()).toBe("/*! banner is a string */"); - done(); }); -}); -it("should allow to change stage", done => { - const entryFile = path.join(pluginDir, "entry3.js"); - const outputFile = path.join(outputDir, "entry3.js"); - try { - fs.mkdirSync(path.join(pluginDir), { - recursive: true + it("should allow to change stage", done => { + const entryFile = path.join(pluginDir, "entry3.js"); + const outputFile = path.join(outputDir, "entry3.js"); + try { + fs.mkdirSync(path.join(pluginDir), { + recursive: true + }); + } catch (_err) { + // empty + } + const compiler = webpack({ + mode: "production", + entry: { + entry3: entryFile + }, + output: { + path: outputDir + }, + plugins: [ + new webpack.BannerPlugin({ + raw: true, + banner: "/* banner is a string */", + stage: webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT + }) + ] + }); + fs.writeFileSync(entryFile, "console.log(1 + 1);", "utf8"); + compiler.run(err => { + if (err) return done(err); + const fileResult = fs.readFileSync(outputFile, "utf8").split("\n"); + expect(fileResult[0]).toBe("/* banner is a string */"); + done(); }); - } catch (_err) { - // empty - } - const compiler = webpack({ - mode: "production", - entry: { - entry3: entryFile - }, - output: { - path: outputDir - }, - plugins: [ - new webpack.BannerPlugin({ - raw: true, - banner: "/* banner is a string */", - stage: webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT - }) - ] - }); - fs.writeFileSync(entryFile, "console.log(1 + 1);", "utf-8"); - compiler.run(err => { - if (err) return done(err); - const fileResult = fs.readFileSync(outputFile, "utf8").split("\n"); - expect(fileResult[0]).toBe("/* banner is a string */"); - done(); }); }); diff --git a/test/BenchmarkTestCases.benchmark.mjs b/test/BenchmarkTestCases.benchmark.mjs index a64a67cc799..0ebdc7cf4a9 100644 --- a/test/BenchmarkTestCases.benchmark.mjs +++ b/test/BenchmarkTestCases.benchmark.mjs @@ -3,7 +3,7 @@ import fs from "fs/promises"; import { constants, writeFile } from "fs"; import { Bench, hrtimeNow } from "tinybench"; import { fileURLToPath, pathToFileURL } from "url"; -import simpleGit from "simple-git"; +import { simpleGit } from "simple-git"; import { withCodSpeed } from "@codspeed/tinybench-plugin"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -14,7 +14,8 @@ const REV_LIST_REGEXP = /^([a-f0-9]+)\s*([a-f0-9]+)\s*([a-f0-9]+)?\s*$/; const getV8Flags = () => { const nodeVersionMajor = Number.parseInt( - process.version.slice(1).split(".")[0] + process.version.slice(1).split(".")[0], + 10 ); const flags = [ "--hash-seed=1", @@ -205,7 +206,7 @@ for (const baselineInfo of baselineRevisions) { webpack: async () => { const webpack = ( await import( - pathToFileURL(path.resolve(baselinePath, `./lib/index.js`)) + pathToFileURL(path.resolve(baselinePath, "./lib/index.js")) ) ).default; @@ -358,7 +359,7 @@ async function registerSuite(bench, test, baselines) { const realConfig = ( await import( - `${pathToFileURL(path.join(testDirectory, `webpack.config.js`))}` + `${pathToFileURL(path.join(testDirectory, "webpack.config.js"))}` ) ).default; @@ -384,7 +385,7 @@ async function registerSuite(bench, test, baselines) { if (scenario.watch) { const entry = path.resolve(config.entry); - const originalEntryContent = await fs.readFile(entry, "utf-8"); + const originalEntryContent = await fs.readFile(entry, "utf8"); let watching; let watchingResolve; diff --git a/test/BinaryMiddleware.unittest.js b/test/BinaryMiddleware.unittest.js index e22ed0eafdf..143833e5aec 100644 --- a/test/BinaryMiddleware.unittest.js +++ b/test/BinaryMiddleware.unittest.js @@ -114,8 +114,10 @@ describe("BinaryMiddleware", () => { if (data.length * c > 200000) continue; if (data.length === 0) continue; let key = JSON.stringify(data.map(resolveLazy)); - if (key.length > 100) + if (key.length > 100) { key = `${key.slice(0, 50)} ... ${key.slice(-50)}`; + } + it(`should serialize ${c} x ${key} (${data.length}) correctly`, () => { // process.stderr.write( // `${c} x ${key.slice(0, 20)} (${data.length})\n` diff --git a/test/BuildDependencies.longtest.js b/test/BuildDependencies.longtest.js index 5bc7fef68ca..cf0824b473b 100644 --- a/test/BuildDependencies.longtest.js +++ b/test/BuildDependencies.longtest.js @@ -12,6 +12,7 @@ const inputDirectory = path.resolve(__dirname, "js/buildDepsInput"); const exec = (n, options = {}) => new Promise((resolve, reject) => { const webpack = require("../"); + const coverageEnabled = webpack.toString().includes("++"); const p = childProcess.execFile( @@ -80,8 +81,9 @@ const exec = (n, options = {}) => ); } if (code === 0) { - if (!options.ignoreErrors && /<[ew]>/.test(stdout)) + if (!options.ignoreErrors && /<[ew]>/.test(stdout)) { return reject(new Error(stdout)); + } resolve(stdout); } else { reject(new Error(`Code ${code}: ${stdout}`)); @@ -98,18 +100,15 @@ const supportsEsm = Number(process.versions.modules) >= 83; describe("BuildDependencies", () => { beforeEach(done => { - rimraf(cacheDirectory, done); - }); - beforeEach(done => { - rimraf(outputDirectory, done); + rimraf(cacheDirectory, () => { + rimraf(outputDirectory, () => { + rimraf(inputDirectory, () => { + fs.mkdir(inputDirectory, { recursive: true }, done); + }); + }); + }); }); - beforeEach(done => { - rimraf(inputDirectory, done); - }); - beforeEach(done => { - fs.mkdir(inputDirectory, { recursive: true }, done); - }); it("should capture loader and config dependencies", async () => { fs.writeFileSync( path.resolve(inputDirectory, "package.json"), diff --git a/test/ChangesAndRemovals.test.js b/test/ChangesAndRemovals.test.js index e39c83fc27a..544bdcd8648 100644 --- a/test/ChangesAndRemovals.test.js +++ b/test/ChangesAndRemovals.test.js @@ -9,6 +9,7 @@ const rimraf = require("rimraf"); const createCompiler = config => { const webpack = require(".."); + const compiler = webpack(config); compiler.outputFileSystem = createFsFromVolume(new Volume()); return compiler; @@ -61,25 +62,19 @@ function createFiles() { fs.writeFileSync( tempFilePath, "module.exports = function temp() {return 'temp file';};\n require('./temp-file2')", - "utf-8" + "utf8" ); fs.writeFileSync( tempFile2Path, "module.exports = function temp2() {return 'temp file 2';};", - "utf-8" + "utf8" ); } -describe("ChangesAndRemovals", () => { - if (process.env.NO_WATCH_TESTS) { - // eslint-disable-next-line jest/no-disabled-tests - it.skip("watch tests excluded", () => {}); - return; - } - - jest.setTimeout(30000); +jest.setTimeout(30000); +describe("ChangesAndRemovals", () => { beforeEach(done => { cleanup(err => { if (err) return done(err); @@ -89,8 +84,16 @@ describe("ChangesAndRemovals", () => { setTimeout(done, 2500); }); }); + afterEach(cleanup); + if (process.env.NO_WATCH_TESTS) { + // eslint-disable-next-line jest/no-disabled-tests + it.skip("watch tests excluded", () => {}); + + return; + } + it("should not track modified/removed files during initial watchRun", done => { const compiler = createSingleCompiler(); const watchRunFinished = new Promise(resolve => { diff --git a/test/Compiler-caching.test.js b/test/Compiler-caching.test.js index 8a16769bd9c..e30346d8cee 100644 --- a/test/Compiler-caching.test.js +++ b/test/Compiler-caching.test.js @@ -13,6 +13,7 @@ describe("Compiler (caching)", () => { function compile(entry, options, callback) { const webpack = require(".."); + options = webpack.config.getNormalizedWebpackOptions(options); options.mode = "none"; options.cache = true; @@ -33,13 +34,13 @@ describe("Compiler (caching)", () => { c.outputFileSystem = { mkdir(path, callback) { logs.mkdir.push(path); - const err = new Error(); + const err = new Error("error"); err.code = "EEXIST"; callback(err); }, writeFile(name, content, callback) { logs.writeFile.push(name, content); - files[name] = content.toString("utf-8"); + files[name] = content.toString("utf8"); callback(); }, stat(path, callback) { @@ -101,6 +102,7 @@ describe("Compiler (caching)", () => { } beforeAll(cleanup); + afterAll(cleanup); /** diff --git a/test/Compiler-filesystem-caching.test.js b/test/Compiler-filesystem-caching.test.js index a3367e9c123..8c62cc40044 100644 --- a/test/Compiler-filesystem-caching.test.js +++ b/test/Compiler-filesystem-caching.test.js @@ -19,6 +19,7 @@ describe("Compiler (filesystem caching)", () => { function compile(entry, onSuccess, onError) { const webpack = require(".."); + const options = webpack.config.getNormalizedWebpackOptions({}); options.cache = { type: "filesystem", @@ -68,13 +69,13 @@ describe("Compiler (filesystem caching)", () => { const result = await cacheItem.getPromise(ident); if (result) { - expect(result.number).toEqual(42); - expect(result.number1).toEqual(3.14); - expect(result.number2).toEqual(6.2); - expect(result.string).toEqual("string"); + expect(result.number).toBe(42); + expect(result.number1).toBe(3.14); + expect(result.number2).toBe(6.2); + expect(result.string).toBe("string"); if (isErrorCaseSupported) { - expect(result.error.cause.message).toEqual("cause"); + expect(result.error.cause.message).toBe("cause"); expect(result.error1.cause.string).toBe("string"); expect(result.error1.cause.number).toBe(42); } @@ -84,21 +85,21 @@ describe("Compiler (filesystem caching)", () => { new Error("first", { cause: "nested cause" }), "second" ]); - expect(result.aggregateError.message).toEqual( + expect(result.aggregateError.message).toBe( "aggregate error" ); expect(result.aggregateError.cause.message).toBe("cause"); } if (isBigIntSupported) { - expect(result.bigint).toEqual(5n); - expect(result.bigint1).toEqual(124n); - expect(result.bigint2).toEqual(125n); - expect(result.bigint3).toEqual(12345678901234567890n); - expect(result.bigint4).toEqual(5n); - expect(result.bigint5).toEqual(1000000n); - expect(result.bigint6).toEqual(128n); - expect(result.bigint7).toEqual(2147483647n); + expect(result.bigint).toBe(5n); + expect(result.bigint1).toBe(124n); + expect(result.bigint2).toBe(125n); + expect(result.bigint3).toBe(12345678901234567890n); + expect(result.bigint4).toBe(5n); + expect(result.bigint5).toBe(1000000n); + expect(result.bigint6).toBe(128n); + expect(result.bigint7).toBe(2147483647n); expect(result.obj.foo).toBe(BigInt(-10)); expect(Array.from(result.set)).toEqual([ BigInt(1), @@ -196,6 +197,7 @@ describe("Compiler (filesystem caching)", () => { } beforeAll(cleanup); + afterAll(cleanup); /** diff --git a/test/Compiler.test.js b/test/Compiler.test.js index baebf9aadf6..a7d9b787ac6 100644 --- a/test/Compiler.test.js +++ b/test/Compiler.test.js @@ -12,7 +12,9 @@ describe("Compiler", () => { jest.setTimeout(20000); function compile(entry, options, callback) { const noOutputPath = !options.output || !options.output.path; + const webpack = require(".."); + options = webpack.config.getNormalizedWebpackOptions(options); if (!options.mode) options.mode = "production"; options.entry = entry; @@ -32,13 +34,13 @@ describe("Compiler", () => { c.outputFileSystem = { mkdir(path, callback) { logs.mkdir.push(path); - const err = new Error(); + const err = new Error("error"); err.code = "EEXIST"; callback(err); }, writeFile(name, content, callback) { logs.writeFile.push(name, content); - files[name] = content.toString("utf-8"); + files[name] = content.toString("utf8"); callback(); }, stat(path, callback) { @@ -73,6 +75,7 @@ describe("Compiler", () => { } let compiler; + afterEach(callback => { if (compiler) { compiler.close(callback); @@ -207,8 +210,10 @@ describe("Compiler", () => { describe("methods", () => { let compiler; + beforeEach(() => { const webpack = require(".."); + compiler = webpack({ entry: "./c", context: path.join(__dirname, "fixtures"), @@ -218,6 +223,7 @@ describe("Compiler", () => { } }); }); + afterEach(callback => { if (compiler) { compiler.close(callback); @@ -226,12 +232,14 @@ describe("Compiler", () => { callback(); } }); + it("default platform info", done => { const platform = compiler.platform; expect(platform.web).toBe(true); expect(platform.node).toBe(false); done(); }); + describe("purgeInputFileSystem", () => { it("invokes purge() if inputFileSystem.purge", done => { const mockPurge = jest.fn(); @@ -239,17 +247,19 @@ describe("Compiler", () => { purge: mockPurge }; compiler.purgeInputFileSystem(); - expect(mockPurge.mock.calls.length).toBe(1); + expect(mockPurge.mock.calls).toHaveLength(1); done(); }); + it("does NOT invoke purge() if !inputFileSystem.purge", done => { const mockPurge = jest.fn(); compiler.inputFileSystem = null; compiler.purgeInputFileSystem(); - expect(mockPurge.mock.calls.length).toBe(0); + expect(mockPurge.mock.calls).toHaveLength(0); done(); }); }); + describe("isChild", () => { it("returns booleanized this.parentCompilation", done => { compiler.parentCompilation = "stringyStringString"; @@ -294,8 +304,9 @@ describe("Compiler", () => { }); }); - it("PlatformPlugin", done => { + it("platformPlugin", done => { const webpack = require(".."); + const compiler = webpack({ entry: "./c", context: path.join(__dirname, "fixtures"), @@ -318,6 +329,7 @@ describe("Compiler", () => { it("should not emit on errors", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -330,17 +342,20 @@ describe("Compiler", () => { compiler.outputFileSystem = createFsFromVolume(new Volume()); compiler.run((err, stats) => { if (err) return done(err); - if (compiler.outputFileSystem.existsSync("/bundle.js")) + if (compiler.outputFileSystem.existsSync("/bundle.js")) { return done(new Error("Bundle should not be created on error")); + } done(); }); }); + it("should bubble up errors when wrapped in a promise and bail is true", async () => { let errored; try { const createCompiler = options => new Promise((resolve, reject) => { const webpack = require(".."); + const c = webpack(options); c.run((err, stats) => { if (err) { @@ -375,10 +390,12 @@ describe("Compiler", () => { "ModuleNotFoundError: Module not found: Error: Can't resolve './missing-file'" ); }); + it("should not emit compilation errors in async (watch)", async () => { const createStats = options => new Promise((resolve, reject) => { const webpack = require(".."); + const c = webpack(options); c.outputFileSystem = createFsFromVolume(new Volume()); const watching = c.watch({}, (err, stats) => { @@ -402,6 +419,7 @@ describe("Compiler", () => { it("should not emit on errors (watch)", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -415,13 +433,16 @@ describe("Compiler", () => { const watching = compiler.watch({}, (err, stats) => { watching.close(); if (err) return done(err); - if (compiler.outputFileSystem.existsSync("/bundle.js")) + if (compiler.outputFileSystem.existsSync("/bundle.js")) { return done(new Error("Bundle should not be created on error")); + } done(); }); }); + it("should not be running twice at a time (run)", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -439,8 +460,10 @@ describe("Compiler", () => { if (err) return done(); }); }); + it("should not be running twice at a time (watch)", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -458,8 +481,10 @@ describe("Compiler", () => { if (err) return done(); }); }); + it("should not be running twice at a time (run - watch)", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -477,8 +502,10 @@ describe("Compiler", () => { if (err) return done(); }); }); + it("should not be running twice at a time (watch - run)", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -496,8 +523,10 @@ describe("Compiler", () => { if (err) return done(); }); }); + it("should not be running twice at a time (instance cb)", done => { const webpack = require(".."); + compiler = webpack( { context: __dirname, @@ -515,8 +544,10 @@ describe("Compiler", () => { if (err) return done(); }); }); + it("should run again correctly after first compilation", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -537,8 +568,10 @@ describe("Compiler", () => { }); }); }); + it("should watch again correctly after first compilation", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -558,8 +591,10 @@ describe("Compiler", () => { }); }); }); + it("should run again correctly after first closed watch", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -580,8 +615,10 @@ describe("Compiler", () => { }); }); }); - it("should set compiler.watching correctly", function (done) { + + it("should set compiler.watching correctly", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -598,8 +635,10 @@ describe("Compiler", () => { }); expect(compiler.watching).toBe(watching); }); + it("should watch again correctly after first closed watch", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -620,8 +659,10 @@ describe("Compiler", () => { }); }); }); + it("should run again correctly inside afterDone hook", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -645,8 +686,10 @@ describe("Compiler", () => { if (err) return done(err); }); }); + it("should call afterDone hook after other callbacks (run)", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -670,9 +713,12 @@ describe("Compiler", () => { runCb(); }); }); + it("should call afterDone hook after other callbacks (instance cb)", done => { const instanceCb = jest.fn(); + const webpack = require(".."); + compiler = webpack( { context: __dirname, @@ -697,8 +743,10 @@ describe("Compiler", () => { done(); }); }); + it("should call afterDone hook after other callbacks (watch)", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -730,8 +778,10 @@ describe("Compiler", () => { watching.invalidate(invalidateCb); }); }); + it("should call afterDone hook after other callbacks (watch close)", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -763,8 +813,10 @@ describe("Compiler", () => { watch.invalidate(invalidateCb); }); }); + it("should flag watchMode as true in watch", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "production", @@ -786,8 +838,10 @@ describe("Compiler", () => { }); }); }); + it("should use cache on second run call", done => { const webpack = require(".."); + compiler = webpack({ context: __dirname, mode: "development", @@ -802,16 +856,19 @@ describe("Compiler", () => { compiler.run(() => { const result = compiler.outputFileSystem.readFileSync( "/directory/main.js", - "utf-8" + "utf8" ); expect(result).toContain("module.exports = 0;"); done(); }); }); }); + it("should call the failed-hook on error", done => { const failedSpy = jest.fn(); + const webpack = require(".."); + compiler = webpack({ bail: true, context: __dirname, @@ -831,9 +888,12 @@ describe("Compiler", () => { done(); }); }); + it("should deprecate when watch option is used without callback", () => { const tracker = deprecationTracking.start(); + const webpack = require(".."); + compiler = webpack({ watch: true }); @@ -844,14 +904,18 @@ describe("Compiler", () => { }) ]); }); + describe("infrastructure logging", () => { let capture; + beforeEach(() => { capture = captureStdio(process.stderr); }); + afterEach(() => { capture.restore(); }); + const escapeAnsi = stringRaw => stringRaw .replace(/\u001B\[1m\u001B\[([0-9;]*)m/g, "") @@ -875,8 +939,10 @@ describe("Compiler", () => { logger.timeEnd("Time"); } } + it("should log to the console (verbose)", done => { const webpack = require(".."); + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", @@ -906,8 +972,10 @@ describe("Compiler", () => { done(); }); }); + it("should log to the console (debug mode)", done => { const webpack = require(".."); + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", @@ -939,8 +1007,10 @@ describe("Compiler", () => { done(); }); }); + it("should log to the console (none)", done => { const webpack = require(".."); + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", @@ -959,8 +1029,10 @@ describe("Compiler", () => { done(); }); }); + it("should log to the console with colors (verbose)", done => { const webpack = require(".."); + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", @@ -991,8 +1063,10 @@ describe("Compiler", () => { done(); }); }); + it("should log to the console with colors (debug mode)", done => { const webpack = require(".."); + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", diff --git a/test/ConfigTestCases.template.js b/test/ConfigTestCases.template.js index 0517ef716e8..648762adfd6 100644 --- a/test/ConfigTestCases.template.js +++ b/test/ConfigTestCases.template.js @@ -46,12 +46,15 @@ const createLogger = appendTarget => ({ const describeCases = config => { describe(config.name, () => { let stderr; + beforeEach(() => { stderr = captureStdio(process.stderr, true); }); + afterEach(() => { stderr.restore(); }); + jest.setTimeout(20000); for (const category of categories) { @@ -59,7 +62,7 @@ const describeCases = config => { describe(category.name, () => { for (const testName of category.tests) { // eslint-disable-next-line no-loop-func - describe(testName, function () { + describe(testName, () => { const testDirectory = path.join(casesPath, category.name, testName); const filterPath = path.join(testDirectory, "test.filter.js"); if (fs.existsSync(filterPath) && !require(filterPath)(config)) { @@ -67,6 +70,7 @@ const describeCases = config => { describe.skip(testName, () => { it("filtered", () => {}); }); + return; } const infraStructureLog = []; @@ -77,6 +81,7 @@ const describeCases = config => { let options; let optionsArr; let testConfig; + beforeAll(() => { options = prepareOptions( require(path.join(testDirectory, "webpack.config.js")), @@ -87,8 +92,9 @@ const describeCases = config => { if (!options.context) options.context = testDirectory; if (!options.mode) options.mode = "production"; if (!options.optimization) options.optimization = {}; - if (options.optimization.minimize === undefined) + if (options.optimization.minimize === undefined) { options.optimization.minimize = false; + } if (options.optimization.minimizer === undefined) { options.optimization.minimizer = [ new (require("terser-webpack-plugin"))({ @@ -100,14 +106,16 @@ const describeCases = config => { if (!options.target) options.target = "async-node"; if (!options.output) options.output = {}; if (!options.output.path) options.output.path = outputDirectory; - if (typeof options.output.pathinfo === "undefined") + if (typeof options.output.pathinfo === "undefined") { options.output.pathinfo = true; - if (!options.output.filename) + } + if (!options.output.filename) { options.output.filename = `bundle${idx}${ options.experiments && options.experiments.outputModule ? ".mjs" : ".js" }`; + } if (config.cache) { options.cache = { cacheDirectory, @@ -157,15 +165,19 @@ const describeCases = config => { } if (testConfig.timeout) setDefaultTimeout(testConfig.timeout); }); + + // eslint-disable-next-line jest/no-duplicate-hooks + beforeAll(() => { + rimraf.sync(cacheDirectory); + }); + afterAll(() => { // cleanup options = undefined; optionsArr = undefined; testConfig = undefined; }); - beforeAll(() => { - rimraf.sync(cacheDirectory); - }); + const handleFatalError = (err, done) => { const fakeStats = { errors: [ @@ -196,7 +208,9 @@ const describeCases = config => { fs.mkdirSync(outputDirectory, { recursive: true }); infraStructureLog.length = 0; const deprecationTracker = deprecationTracking.start(); + const compiler = require("..")(options); + compiler.run(err => { deprecationTracker(); if (err) return handleFatalError(err, done); @@ -237,12 +251,15 @@ const describeCases = config => { }); }); }, 60000); + it(`${testName} should pre-compile to fill disk cache (2nd)`, done => { rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); infraStructureLog.length = 0; const deprecationTracker = deprecationTracking.start(); + const compiler = require("..")(options); + compiler.run((err, stats) => { deprecationTracker(); if (err) return handleFatalError(err, done); @@ -312,6 +329,7 @@ const describeCases = config => { }); }, 40000); } + it(`${testName} should compile`, done => { rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); @@ -328,7 +346,7 @@ const describeCases = config => { fs.writeFileSync( path.join(outputDirectory, "stats.txt"), stats.toString(statOptions), - "utf-8" + "utf8" ); const jsonStats = stats.toJson({ errorDetails: true @@ -336,7 +354,7 @@ const describeCases = config => { fs.writeFileSync( path.join(outputDirectory, "stats.json"), JSON.stringify(jsonStats, null, 2), - "utf-8" + "utf8" ); if ( checkArrayExpectation( @@ -459,8 +477,9 @@ const describeCases = config => { } Promise.all(results) .then(() => { - if (testConfig.afterExecute) + if (testConfig.afterExecute) { testConfig.afterExecute(options); + } for (const key of Object.keys(global)) { if (key.includes("webpack")) delete global[key]; } @@ -474,6 +493,7 @@ const describeCases = config => { if (config.cache) { try { const compiler = require("..")(options); + compiler.run(err => { if (err) return handleFatalError(err, done); compiler.run((error, stats) => { diff --git a/test/ContextModule.unittest.js b/test/ContextModule.unittest.js index ae3ab350377..c0bb62d3ffd 100644 --- a/test/ContextModule.unittest.js +++ b/test/ContextModule.unittest.js @@ -5,9 +5,11 @@ const ContextModule = require("../lib/ContextModule"); describe("contextModule", () => { let contextModule; let request; + beforeEach(() => { request = "/some/request"; }); + describe("#identifier", () => { it("returns an safe identifier for this module", () => { contextModule = new ContextModule(() => {}, { diff --git a/test/ContextModuleFactory.unittest.js b/test/ContextModuleFactory.unittest.js index db673a7e967..f4fa498f036 100644 --- a/test/ContextModuleFactory.unittest.js +++ b/test/ContextModuleFactory.unittest.js @@ -7,10 +7,12 @@ describe("ContextModuleFactory", () => { describe("resolveDependencies", () => { let factory; let memfs; + beforeEach(() => { factory = new ContextModuleFactory([]); memfs = createFsFromVolume(new Volume()); }); + it("should not report an error when ENOENT errors happen", done => { memfs.readdir = (dir, callback) => { setTimeout(() => callback(null, ["/file"])); @@ -30,11 +32,12 @@ describe("ContextModuleFactory", () => { (err, res) => { expect(err).toBeFalsy(); expect(Array.isArray(res)).toBe(true); - expect(res.length).toBe(0); + expect(res).toHaveLength(0); done(); } ); }); + it("should report an error when non-ENOENT errors happen", done => { memfs.readdir = (dir, callback) => { setTimeout(() => callback(null, ["/file"])); @@ -58,6 +61,7 @@ describe("ContextModuleFactory", () => { } ); }); + it("should return callback with [] if circular symlinks exist", done => { let statDirStatus = 0; memfs.readdir = (dir, callback) => { @@ -88,6 +92,7 @@ describe("ContextModuleFactory", () => { } ); }); + it("should not return callback with [] if there are no circular symlinks", done => { let statDirStatus = 0; memfs.readdir = (dir, callback) => { @@ -115,7 +120,7 @@ describe("ContextModuleFactory", () => { (err, res) => { expect(res).not.toStrictEqual([]); expect(Array.isArray(res)).toBe(true); - expect(res.length).toBe(1); + expect(res).toHaveLength(1); done(); } ); diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js index 26bcef42680..61b758e9fcd 100644 --- a/test/Defaults.unittest.js +++ b/test/Defaults.unittest.js @@ -62,6 +62,7 @@ expect.addSnapshotSerializer({ const getDefaultConfig = config => { const { applyWebpackOptionsDefaults, getNormalizedWebpackOptions } = require("..").config; + config = getNormalizedWebpackOptions(config); applyWebpackOptionsDefaults(config); process.chdir(cwd); @@ -693,9 +694,11 @@ describe("snapshots", () => { test("empty config", {}, e => e.toMatchInlineSnapshot("Compared values have no visual difference.") ); + test("none mode", { mode: "none" }, e => e.toMatchInlineSnapshot("Compared values have no visual difference.") ); + test("no mode provided", { mode: undefined }, e => e.toMatchInlineSnapshot(` - Expected @@ -765,6 +768,7 @@ describe("snapshots", () => { + "hash": true, `) ); + test("production", { mode: "production" }, e => e.toMatchInlineSnapshot(` - Expected @@ -834,6 +838,7 @@ describe("snapshots", () => { + "hash": true, `) ); + test("development", { mode: "development" }, e => e.toMatchInlineSnapshot(` - Expected @@ -883,6 +888,7 @@ describe("snapshots", () => { + "cache": true, `) ); + test("sync wasm", { experiments: { syncWebAssembly: true } }, e => e.toMatchInlineSnapshot(` - Expected @@ -922,6 +928,7 @@ describe("snapshots", () => { + "type": "webassembly/sync", `) ); + test("output module", { experiments: { outputModule: true } }, e => e.toMatchInlineSnapshot(` - Expected @@ -984,6 +991,7 @@ describe("snapshots", () => { + "workerChunkLoading": "import", `) ); + test("async wasm", { experiments: { asyncWebAssembly: true } }, e => e.toMatchInlineSnapshot(` - Expected @@ -1023,6 +1031,7 @@ describe("snapshots", () => { + "type": "webassembly/async", `) ); + test( "both wasm", { experiments: { syncWebAssembly: true, asyncWebAssembly: true } }, @@ -1068,6 +1077,7 @@ describe("snapshots", () => { + "type": "webassembly/async", `) ); + test("const filename", { output: { filename: "bundle.js" } }, e => e.toMatchInlineSnapshot(` - Expected @@ -1086,6 +1096,7 @@ describe("snapshots", () => { + "filename": "bundle.js", `) ); + test("function filename", { output: { filename: () => "bundle.js" } }, e => e.toMatchInlineSnapshot(` - Expected @@ -1104,6 +1115,7 @@ describe("snapshots", () => { + "filename": [Function filename], `) ); + test("library", { output: { library: ["myLib", "awesome"] } }, e => e.toMatchInlineSnapshot(` - Expected @@ -1141,6 +1153,7 @@ describe("snapshots", () => { + "uniqueName": "myLib.awesome", `) ); + test( "library contains [name] placeholder", { @@ -1185,6 +1198,7 @@ describe("snapshots", () => { + "uniqueName": "myLib", `) ); + test( "library.name contains [name] placeholder", { @@ -1233,6 +1247,7 @@ describe("snapshots", () => { + "uniqueName": "myLib.lib", `) ); + test( "library.name.root contains [name] placeholder", { @@ -1284,6 +1299,7 @@ describe("snapshots", () => { + "uniqueName": "myLib", `) ); + test( "library.name.root contains escaped placeholder", { @@ -1336,6 +1352,7 @@ describe("snapshots", () => { + "uniqueName": "[name].my[name]Lib.[name]", `) ); + test("target node", { target: "node" }, e => e.toMatchInlineSnapshot(` - Expected @@ -1465,6 +1482,7 @@ describe("snapshots", () => { + "target": "node", `) ); + test("target webworker", { target: "webworker" }, e => e.toMatchInlineSnapshot(` - Expected @@ -1488,6 +1506,7 @@ describe("snapshots", () => { + "target": "webworker", `) ); + test("target electron-main", { target: "electron-main" }, e => e.toMatchInlineSnapshot(` - Expected @@ -1623,6 +1642,7 @@ describe("snapshots", () => { + "target": "electron-main", `) ); + test("target electron-main", { target: "electron-preload" }, e => e.toMatchInlineSnapshot(` - Expected @@ -1756,6 +1776,7 @@ describe("snapshots", () => { + "target": "electron-preload", `) ); + test("records", { recordsPath: "some-path" }, e => e.toMatchInlineSnapshot(` - Expected @@ -1771,9 +1792,11 @@ describe("snapshots", () => { + "recordsOutputPath": "some-path", `) ); + test("ecmaVersion", { output: { ecmaVersion: 2020 } }, e => e.toMatchInlineSnapshot("Compared values have no visual difference.") ); + test("single runtimeChunk", { optimization: { runtimeChunk: "single" } }, e => e.toMatchInlineSnapshot(` - Expected @@ -1786,6 +1809,7 @@ describe("snapshots", () => { + }, `) ); + test( "single runtimeChunk", { optimization: { runtimeChunk: "multiple" } }, @@ -1801,6 +1825,7 @@ describe("snapshots", () => { + }, `) ); + test("single runtimeChunk", { optimization: { runtimeChunk: true } }, e => e.toMatchInlineSnapshot(` - Expected @@ -1813,6 +1838,7 @@ describe("snapshots", () => { + }, `) ); + test("cache true", { cache: true }, e => e.toMatchInlineSnapshot(` - Expected @@ -1836,6 +1862,7 @@ describe("snapshots", () => { + "cache": true, `) ); + test("cache filesystem", { cache: { type: "filesystem" } }, e => e.toMatchInlineSnapshot(` - Expected @@ -1878,6 +1905,7 @@ describe("snapshots", () => { + "cache": true, `) ); + test( "cache filesystem development", { mode: "development", cache: { type: "filesystem" } }, @@ -1949,6 +1977,7 @@ describe("snapshots", () => { + "cache": true, `) ); + test( "cache filesystem and futureDefaults", { cache: { type: "filesystem" }, experiments: { futureDefaults: true } }, @@ -2661,21 +2690,22 @@ describe("snapshots", () => { ); }); -it("should result in the same target options for same target", () => { - const inlineTarget = getDefaultConfig({ target: "node12.17" }); - const browserslistTarget = getDefaultConfig({ - target: "browserslist: node 12.17" - }); - const diff = stripVTControlCharacters( - jestDiff(inlineTarget, browserslistTarget, { - expand: false, - contextLines: 0 - }) - ); +describe("Targets", () => { + it("should result in the same target options for same target", () => { + const inlineTarget = getDefaultConfig({ target: "node12.17" }); + const browserslistTarget = getDefaultConfig({ + target: "browserslist: node 12.17" + }); + const diff = stripVTControlCharacters( + jestDiff(inlineTarget, browserslistTarget, { + expand: false, + contextLines: 0 + }) + ); - expect(inlineTarget.output.environment.module).toBe(true); - expect(inlineTarget.output.environment.dynamicImport).toBe(true); - expect(new Diff(diff)).toMatchInlineSnapshot(` + expect(inlineTarget.output.environment.module).toBe(true); + expect(inlineTarget.output.environment.dynamicImport).toBe(true); + expect(new Diff(diff)).toMatchInlineSnapshot(` - Expected + Received @@ -2683,4 +2713,5 @@ it("should result in the same target options for same target", () => { - "target": "node12.17", + "target": "browserslist: node 12.17", `); + }); }); diff --git a/test/Errors.test.js b/test/Errors.test.js index 6ea03027f61..29c2e617d61 100644 --- a/test/Errors.test.js +++ b/test/Errors.test.js @@ -133,7 +133,7 @@ async function compile(options) { } }); - expect(typeof stats).toEqual("object"); + expect(typeof stats).toBe("object"); const statsResult = stats.toJson({ errorDetails: false }); expect(typeof statsResult).toBe("object"); const { errors, warnings } = statsResult; @@ -143,12 +143,13 @@ async function compile(options) { return { errors, warnings }; } -it("should emit warning for missingFile", async () => { - await expect( - compile({ - entry: "./missingFile" - }) - ).resolves.toMatchInlineSnapshot(` +describe("Errors", () => { + it("should emit warning for missingFile", async () => { + await expect( + compile({ + entry: "./missingFile" + }) + ).resolves.toMatchInlineSnapshot(` Object { "errors": Array [ Object { @@ -173,11 +174,11 @@ it("should emit warning for missingFile", async () => { "warnings": Array [], } `); -}, 20000); + }, 20000); -it("should emit warning for require.extensions", async () => { - await expect(compile({ entry: "./require.extensions" })).resolves - .toMatchInlineSnapshot(` + it("should emit warning for require.extensions", async () => { + await expect(compile({ entry: "./require.extensions" })).resolves + .toMatchInlineSnapshot(` Object { "errors": Array [], "warnings": Array [ @@ -193,11 +194,11 @@ it("should emit warning for require.extensions", async () => { ], } `); -}); + }); -it("should emit warning for require.main.require", async () => { - await expect(compile({ entry: "./require.main.require" })).resolves - .toMatchInlineSnapshot(` + it("should emit warning for require.main.require", async () => { + await expect(compile({ entry: "./require.main.require" })).resolves + .toMatchInlineSnapshot(` Object { "errors": Array [], "warnings": Array [ @@ -213,10 +214,11 @@ it("should emit warning for require.main.require", async () => { ], } `); -}); -it("should emit warning for module.parent.require", async () => { - await expect(compile({ entry: "./module.parent.require" })).resolves - .toMatchInlineSnapshot(` + }); + + it("should emit warning for module.parent.require", async () => { + await expect(compile({ entry: "./module.parent.require" })).resolves + .toMatchInlineSnapshot(` Object { "errors": Array [], "warnings": Array [ @@ -232,18 +234,18 @@ it("should emit warning for module.parent.require", async () => { ], } `); -}); + }); -const isCaseInsensitiveFilesystem = fs.existsSync( - path.resolve(__dirname, "fixtures", "errors", "FILE.js") -); -if (isCaseInsensitiveFilesystem) { - it("should emit warning for case-preserved disk", async () => { - const result = await compile({ - mode: "development", - entry: "./case-sensitive" - }); - expect(result).toMatchInlineSnapshot(` + const isCaseInsensitiveFilesystem = fs.existsSync( + path.resolve(__dirname, "fixtures", "errors", "FILE.js") + ); + if (isCaseInsensitiveFilesystem) { + it("should emit warning for case-preserved disk", async () => { + const result = await compile({ + mode: "development", + entry: "./case-sensitive" + }); + expect(result).toMatchInlineSnapshot(` Object { "errors": Array [], "warnings": Array [ @@ -272,14 +274,14 @@ if (isCaseInsensitiveFilesystem) { ], } `); - }); -} else { - it("should emit error for case-sensitive", async () => { - const result = await compile({ - mode: "development", - entry: "./case-sensitive" }); - expect(result).toMatchInlineSnapshot(` + } else { + it("should emit error for case-sensitive", async () => { + const result = await compile({ + mode: "development", + entry: "./case-sensitive" + }); + expect(result).toMatchInlineSnapshot(` Object { "errors": Array [ Object { @@ -295,12 +297,12 @@ if (isCaseInsensitiveFilesystem) { "warnings": Array [], } `); - }); -} + }); + } -it("should emit warning for undef mode", async () => { - await expect(compile({ mode: undefined, entry: "./entry-point" })).resolves - .toMatchInlineSnapshot(` + it("should emit warning for undef mode", async () => { + await expect(compile({ mode: undefined, entry: "./entry-point" })).resolves + .toMatchInlineSnapshot(` Object { "errors": Array [], "warnings": Array [ @@ -311,20 +313,22 @@ it("should emit warning for undef mode", async () => { ], } `); -}); -it("should emit no errors or warnings for no-errors-deprecate", async () => { - await expect(compile({ mode: "production", entry: "./no-errors-deprecate" })) - .resolves.toMatchInlineSnapshot(` + }); + + it("should emit no errors or warnings for no-errors-deprecate", async () => { + await expect( + compile({ mode: "production", entry: "./no-errors-deprecate" }) + ).resolves.toMatchInlineSnapshot(` Object { "errors": Array [], "warnings": Array [], } `); -}); + }); -it("should emit errors for missingFile for production", async () => { - await expect(compile({ mode: "production", entry: "./missingFile" })).resolves - .toMatchInlineSnapshot(` + it("should emit errors for missingFile for production", async () => { + await expect(compile({ mode: "production", entry: "./missingFile" })) + .resolves.toMatchInlineSnapshot(` Object { "errors": Array [ Object { @@ -349,11 +353,11 @@ it("should emit errors for missingFile for production", async () => { "warnings": Array [], } `); -}); + }); -it("should emit module build errors", async () => { - await expect(compile({ entry: "./has-syntax-error" })).resolves - .toMatchInlineSnapshot(` + it("should emit module build errors", async () => { + await expect(compile({ entry: "./has-syntax-error" })).resolves + .toMatchInlineSnapshot(` Object { "errors": Array [ Object { @@ -369,30 +373,30 @@ it("should emit module build errors", async () => { "warnings": Array [], } `); -}); + }); -it("should bao; thrown sync error from plugin", async () => { - await expect( - compile({ - entry: "./no-errors-deprecate", - plugins: [require("./fixtures/errors/throw-error-plugin")] - }) - ).rejects.toMatchInlineSnapshot(` + it("should bao; thrown sync error from plugin", async () => { + await expect( + compile({ + entry: "./no-errors-deprecate", + plugins: [require("./fixtures/errors/throw-error-plugin")] + }) + ).rejects.toMatchInlineSnapshot(` Object { "message": "foo", "stack": "Error: foo", } `); -}); + }); -it("should emit warning when 'output.iife'=false is used with 'output.library.type'='umd'", async () => { - await expect( - compile({ - mode: "production", - entry: "./false-iife-umd.js", - output: { library: { type: "umd" }, iife: false } - }) - ).resolves.toMatchInlineSnapshot(` + it("should emit warning when 'output.iife'=false is used with 'output.library.type'='umd'", async () => { + await expect( + compile({ + mode: "production", + entry: "./false-iife-umd.js", + output: { library: { type: "umd" }, iife: false } + }) + ).resolves.toMatchInlineSnapshot(` Object { "errors": Array [], "warnings": Array [ @@ -403,9 +407,10 @@ it("should emit warning when 'output.iife'=false is used with 'output.library.ty ], } `); + }); }); -describe("loaders", () => { +describe("Loaders", () => { it("should emit error thrown at module level", async () => { await expect( compile({ @@ -427,6 +432,7 @@ describe("loaders", () => { } `); }); + it("should emit errors & warnings for emit-error-loader", async () => { await expect(compile({ entry: "./entry-point-error-loader-required.js" })) .resolves.toMatchInlineSnapshot(` @@ -510,6 +516,7 @@ describe("loaders", () => { } `); }); + it("should emit error for json-loader when not json", async () => { await expect(compile({ entry: "json-loader!./not-a-json.js" })).resolves .toMatchInlineSnapshot(` @@ -585,6 +592,7 @@ describe("loaders", () => { } `); }); + it("should emit error thrown from yaw loader", async () => { await expect(compile({ entry: "./throw-error-loader!./entry-point.js" })) .resolves.toMatchInlineSnapshot(` diff --git a/test/Examples.test.js b/test/Examples.test.js index 3ca57157a4e..ce7d9f61a51 100644 --- a/test/Examples.test.js +++ b/test/Examples.test.js @@ -7,7 +7,8 @@ const fs = require("graceful-fs"); describe("Examples", () => { const basePath = path.join(__dirname, "..", "examples"); - const examples = require("../examples/examples.js"); + + const examples = require("../examples/examples"); for (const examplePath of examples) { const filterPath = path.join(examplePath, "test.filter.js"); @@ -19,16 +20,19 @@ describe("Examples", () => { done(); }) ); + continue; } - it(`should compile ${relativePath}`, function (done) { + + it(`should compile ${relativePath}`, done => { let options = {}; let webpackConfigPath = path.join(examplePath, "webpack.config.js"); webpackConfigPath = webpackConfigPath.slice(0, 1).toUpperCase() + webpackConfigPath.slice(1); - if (fs.existsSync(webpackConfigPath)) + if (fs.existsSync(webpackConfigPath)) { options = require(webpackConfigPath); + } if (typeof options === "function") options = options(); if (Array.isArray(options)) { for (const [_, item] of options.entries()) { @@ -50,7 +54,9 @@ describe("Examples", () => { if (!options.entry) options.entry = "./example.js"; if (!options.plugins) options.plugins = []; } + const webpack = require(".."); + webpack(options, (err, stats) => { if (err) return done(err); if (stats.hasErrors()) { diff --git a/test/FileSystemInfo.unittest.js b/test/FileSystemInfo.unittest.js index ec6716bd631..ae0a778041e 100644 --- a/test/FileSystemInfo.unittest.js +++ b/test/FileSystemInfo.unittest.js @@ -244,7 +244,7 @@ ${details(snapshot)}`) }; const updateFile = (fs, filename) => { - const oldContent = fs.readFileSync(filename, "utf-8"); + const oldContent = fs.readFileSync(filename, "utf8"); if (filename.endsWith(".json")) { const data = JSON.parse(oldContent); fs.writeFileSync( @@ -494,7 +494,7 @@ ${details(snapshot)}`) missing, ["timestamp", { timestamp: true }], (err, snapshot) => { - expect(snapshot).toBe(null); + expect(snapshot).toBeNull(); done(); } ); diff --git a/test/HotModuleReplacementPlugin.test.js b/test/HotModuleReplacementPlugin.test.js index ab54eb36c24..fce2e387db5 100644 --- a/test/HotModuleReplacementPlugin.test.js +++ b/test/HotModuleReplacementPlugin.test.js @@ -7,6 +7,7 @@ const webpack = require(".."); describe("HotModuleReplacementPlugin", () => { jest.setTimeout(20000); + it("should not have circular hashes but equal if unmodified", done => { const entryFile = path.join( __dirname, @@ -57,7 +58,7 @@ describe("HotModuleReplacementPlugin", () => { chunkIds: "size" } }); - fs.writeFileSync(entryFile, "1", "utf-8"); + fs.writeFileSync(entryFile, "1", "utf8"); compiler.run((err, stats) => { if (err) throw err; const oldHash1 = stats.toJson().hash; @@ -67,19 +68,19 @@ describe("HotModuleReplacementPlugin", () => { const lastHash1 = stats.toJson().hash; fs.writeFileSync(statsFile2, stats.toString()); expect(lastHash1).toBe(oldHash1); // hash shouldn't change when bundle stay equal - fs.writeFileSync(entryFile, "2", "utf-8"); + fs.writeFileSync(entryFile, "2", "utf8"); compiler.run((err, stats) => { if (err) throw err; const lastHash2 = stats.toJson().hash; fs.writeFileSync(statsFile1, stats.toString()); expect(lastHash2).not.toBe(lastHash1); // hash should change when bundle changes - fs.writeFileSync(entryFile, "1", "utf-8"); + fs.writeFileSync(entryFile, "1", "utf8"); compiler.run((err, stats) => { if (err) throw err; const currentHash1 = stats.toJson().hash; fs.writeFileSync(statsFile2, stats.toString()); expect(currentHash1).not.toBe(lastHash1); // hash shouldn't change to the first hash if bundle changed back to first bundle - fs.writeFileSync(entryFile, "2", "utf-8"); + fs.writeFileSync(entryFile, "2", "utf8"); compiler.run((err, stats) => { if (err) throw err; const currentHash2 = stats.toJson().hash; @@ -110,7 +111,7 @@ describe("HotModuleReplacementPlugin", () => { } catch (_err) { // empty } - fs.writeFileSync(entryFile, `${++step}`, "utf-8"); + fs.writeFileSync(entryFile, `${++step}`, "utf8"); const updates = new Set(); const hasFile = file => { try { @@ -155,7 +156,7 @@ describe("HotModuleReplacementPlugin", () => { expect(hasFile(file)).toBe(true); } return setTimeout(() => { - fs.writeFileSync(entryFile, `${++step}`, "utf-8"); + fs.writeFileSync(entryFile, `${++step}`, "utf8"); compiler.run(err => { if (err) return done(err); for (const file of updates) { @@ -167,7 +168,7 @@ describe("HotModuleReplacementPlugin", () => { } updates.add(hmrUpdateMainFileName); - fs.writeFileSync(entryFile, `${++step}`, "utf-8"); + fs.writeFileSync(entryFile, `${++step}`, "utf8"); compiler.run(callback); }; @@ -211,7 +212,7 @@ describe("HotModuleReplacementPlugin", () => { chunkIds: "named" } }); - fs.writeFileSync(entryFile, "1", "utf-8"); + fs.writeFileSync(entryFile, "1", "utf8"); compiler.run((err, stats) => { if (err) throw err; const jsonStats = stats.toJson(); @@ -221,14 +222,14 @@ describe("HotModuleReplacementPlugin", () => { compiler.run((err, stats) => { if (err) throw err; fs.writeFileSync(statsFile4, stats.toString()); - fs.writeFileSync(entryFile, "2", "utf-8"); + fs.writeFileSync(entryFile, "2", "utf8"); compiler.run((err, stats) => { if (err) throw err; fs.writeFileSync(statsFile3, stats.toString()); const result = JSON.parse( fs.readFileSync( path.join(outputPath, `0.${hash}.hot-update.json`), - "utf-8" + "utf8" ) ).c; expect(result).toEqual([chunkName]); @@ -298,14 +299,14 @@ describe("HotModuleReplacementPlugin", () => { chunkIds: "named" } }); - fs.writeFileSync(entryFile, "1", "utf-8"); + fs.writeFileSync(entryFile, "1", "utf8"); compiler.run((err, stats) => { if (err) return done(err); fs.writeFileSync(statsFile3, stats.toString()); compiler.run((err, stats) => { if (err) return done(err); fs.writeFileSync(statsFile4, stats.toString()); - fs.writeFileSync(entryFile, "2", "utf-8"); + fs.writeFileSync(entryFile, "2", "utf8"); compiler.run((err, stats) => { if (err) return done(err); fs.writeFileSync(statsFile3, stats.toString()); diff --git a/test/HotTestCases.template.js b/test/HotTestCases.template.js index b376c77e408..7b646c18e66 100644 --- a/test/HotTestCases.template.js +++ b/test/HotTestCases.template.js @@ -32,10 +32,13 @@ const describeCases = config => { describe.skip(testName, () => { it("filtered", () => {}); }); + continue; } + describe(testName, () => { let compiler; + afterAll(callback => { compiler.close(callback); compiler = undefined; @@ -43,6 +46,7 @@ const describeCases = config => { it(`${testName} should compile`, done => { const webpack = require(".."); + const outputDirectory = path.join( __dirname, "js", @@ -67,23 +71,29 @@ const describeCases = config => { if (!options.entry) options.entry = "./index.js"; if (!options.output) options.output = {}; if (!options.output.path) options.output.path = outputDirectory; - if (!options.output.filename) + if (!options.output.filename) { options.output.filename = `bundle${ options.experiments && options.experiments.outputModule ? ".mjs" : ".js" }`; - if (!options.output.chunkFilename) + } + if (!options.output.chunkFilename) { options.output.chunkFilename = "[name].chunk.[fullhash].js"; - if (options.output.pathinfo === undefined) + } + if (options.output.pathinfo === undefined) { options.output.pathinfo = true; - if (options.output.publicPath === undefined) + } + if (options.output.publicPath === undefined) { options.output.publicPath = "https://test.cases/path/"; - if (options.output.library === undefined) + } + if (options.output.library === undefined) { options.output.library = { type: "commonjs2" }; + } if (!options.optimization) options.optimization = {}; - if (!options.optimization.moduleIds) + if (!options.optimization.moduleIds) { options.optimization.moduleIds = "named"; + } if (!options.module) options.module = {}; if (!options.module.rules) options.module.rules = []; options.module.rules.push({ @@ -216,8 +226,9 @@ const describeCases = config => { outputDirectory, `./${file.name}` ); - if (typeof result === "object" && "then" in result) + if (typeof result === "object" && "then" in result) { promise = promise.then(() => result); + } } } } else { @@ -226,13 +237,15 @@ const describeCases = config => { outputDirectory, `./${assets[assets.length - 1].name}` ); - if (typeof result === "object" && "then" in result) + if (typeof result === "object" && "then" in result) { promise = promise.then(() => result); + } } promise.then( () => { - if (getNumberOfTests() < 1) + if (getNumberOfTests() < 1) { return done(new Error("No tests exported by test case")); + } done(); }, diff --git a/test/JavascriptParser.unittest.js b/test/JavascriptParser.unittest.js index 21982807af7..8283c109186 100644 --- a/test/JavascriptParser.unittest.js +++ b/test/JavascriptParser.unittest.js @@ -1,5 +1,7 @@ "use strict"; +/* eslint-disable no-unused-expressions, no-unassigned-vars */ + // cspell:ignore fghsub notry fghsub notry notry this's ijksub this's ijksub fghsub fghsub notry ijksub ijksub strrring strrring strr strrring strrring strr Sstrrringy strone stronetwo stronetwothree stronetwo stronetwothree stronetwothreefour onetwo onetwo twothree twothree twothree threefour onetwo onetwo threefour threefour fourfive startstrmid igmy igmyi igmya const BasicEvaluatedExpression = require("../lib/javascript/BasicEvaluatedExpression"); const JavascriptParser = require("../lib/javascript/JavascriptParser"); @@ -69,6 +71,7 @@ describe("JavascriptParser", () => { "member expression": [ function () { test[memberExpr]; + // eslint-disable-next-line no-implicit-coercion test[+memberExpr]; }, @@ -237,7 +240,7 @@ describe("JavascriptParser", () => { ], "new Foo(...)": [ function () { - // eslint-disable-next-line new-cap + // eslint-disable-next-line new-cap, no-new new xyz("membertest"); }, { @@ -587,26 +590,31 @@ describe("JavascriptParser", () => { if (evalExpr.isBigInt()) result.push(`bigint=${evalExpr.bigint}`); if (evalExpr.isBoolean()) result.push(`bool=${evalExpr.bool}`); if (evalExpr.isRegExp()) result.push(`regExp=${evalExpr.regExp}`); - if (evalExpr.isConditional()) + if (evalExpr.isConditional()) { result.push( `options=[${evalExpr.options.map(evalExprToString).join("],[")}]` ); - if (evalExpr.isArray()) + } + if (evalExpr.isArray()) { result.push( `items=[${evalExpr.items.map(evalExprToString).join("],[")}]` ); - if (evalExpr.isConstArray()) + } + if (evalExpr.isConstArray()) { result.push(`array=[${evalExpr.array.join("],[")}]`); - if (evalExpr.isTemplateString()) + } + if (evalExpr.isTemplateString()) { result.push( `template=[${evalExpr.quasis.map(evalExprToString).join("],[")}]` ); - if (evalExpr.isWrapped()) + } + if (evalExpr.isWrapped()) { result.push( `wrapped=[${evalExprToString(evalExpr.prefix)}]+[${evalExprToString( evalExpr.postfix )}]` ); + } if (evalExpr.range) { const start = evalExpr.range[0] - 5; const end = evalExpr.range[1] - 5; @@ -638,12 +646,14 @@ describe("JavascriptParser", () => { const parser = new JavascriptParser(); for (const name of Object.keys(cases)) { const expr = cases[name]; + it(name, () => { const actual = parser.parse(expr, {}); expect(typeof actual).toBe("object"); }); } }); + describe("should parse await", () => { const cases = { require: [ @@ -687,6 +697,7 @@ describe("JavascriptParser", () => { }; for (const name of Object.keys(cases)) { const expr = cases[name]; + it(name, () => { const actual = JavascriptParser._parse(expr, {}); expect(typeof actual).toBe("object"); @@ -818,6 +829,7 @@ describe("JavascriptParser", () => { }; for (const name of Object.keys(cases)) { const expr = cases[name]; + it(name, () => { const parser = new JavascriptParser(); const actual = JavascriptParser._parse(expr.code); diff --git a/test/LocalModulesHelpers.unittest.js b/test/LocalModulesHelpers.unittest.js index f4d98b00a91..dbd489b21f1 100644 --- a/test/LocalModulesHelpers.unittest.js +++ b/test/LocalModulesHelpers.unittest.js @@ -18,7 +18,7 @@ describe("LocalModulesHelpers", () => { idx: 2, used: false }); - expect(state.localModules.length).toBe(3); + expect(state.localModules).toHaveLength(3); }); }); @@ -35,7 +35,7 @@ describe("LocalModulesHelpers", () => { } ] }; - expect(getLocalModule(state, "local_module_sample")).toBe(null); + expect(getLocalModule(state, "local_module_sample")).toBeNull(); }); it("returns local module information", () => { diff --git a/test/MemoryLimitTestCases.test.js b/test/MemoryLimitTestCases.test.js index 84e107ed9c8..cd84daa708f 100644 --- a/test/MemoryLimitTestCases.test.js +++ b/test/MemoryLimitTestCases.test.js @@ -1,6 +1,7 @@ "use strict"; require("./helpers/warmup-webpack"); + const path = require("path"); const fs = require("graceful-fs"); const rimraf = require("rimraf"); @@ -23,6 +24,7 @@ const tests = fs if (fs.existsSync(filterPath) && !require(filterPath)()) { // eslint-disable-next-line jest/no-disabled-tests, jest/valid-describe-callback describe.skip(testName, () => it("filtered")); + return false; } return true; @@ -31,6 +33,7 @@ const tests = fs describe("MemoryLimitTestCases", () => { jest.setTimeout(40000); let stderr; + beforeEach(() => { stderr = captureStdio(process.stderr, true); if (global.gc) { @@ -38,9 +41,11 @@ describe("MemoryLimitTestCases", () => { global.gc(); } }); + afterEach(() => { stderr.restore(); }); + for (const testName of tests) { let testConfig = { heapSizeLimitBytes: 250 * 1024 * 1024 @@ -55,6 +60,7 @@ describe("MemoryLimitTestCases", () => { // ignored } const size = toMiB(testConfig.heapSizeLimitBytes); + // eslint-disable-next-line no-loop-func it(`should build ${JSON.stringify(testName)} with heap limit of ${size}`, done => { const outputDirectory = path.join(outputBase, testName); @@ -78,8 +84,9 @@ describe("MemoryLimitTestCases", () => { if (!options.output.path) options.output.path = outputDirectory; if (!options.plugins) options.plugins = []; if (!options.optimization) options.optimization = {}; - if (options.optimization.minimize === undefined) + if (options.optimization.minimize === undefined) { options.optimization.minimize = false; + } } const heapSizeStart = process.memoryUsage().heapUsed; const c = webpack(options); @@ -97,9 +104,10 @@ describe("MemoryLimitTestCases", () => { args.concat([ (err, result) => { if (err) return callback(err); - if (!/\.(js|json|txt)$/.test(args[0])) + if (!/\.(js|json|txt)$/.test(args[0])) { return callback(null, result); - callback(null, result.toString("utf-8").replace(/\r/g, "")); + } + callback(null, result.toString("utf8").replace(/\r/g, "")); } ]) ); diff --git a/test/MultiCompiler.test.js b/test/MultiCompiler.test.js index f75175f9da3..f558a3513ee 100644 --- a/test/MultiCompiler.test.js +++ b/test/MultiCompiler.test.js @@ -1,6 +1,7 @@ "use strict"; require("./helpers/warmup-webpack"); + const path = require("path"); const { createFsFromVolume, Volume } = require("memfs"); const webpack = require(".."); @@ -30,7 +31,7 @@ const createMultiCompiler = options => { return compiler; }; -describe("MultiCompiler", function () { +describe("MultiCompiler", () => { jest.setTimeout(20000); it("should trigger 'run' for each child compiler", done => { @@ -72,6 +73,7 @@ describe("MultiCompiler", function () { } }); }); + it("should not be running twice at a time (watch)", done => { const compiler = createMultiCompiler(); compiler.watch({}, (err, stats) => { @@ -83,6 +85,7 @@ describe("MultiCompiler", function () { } }); }); + it("should not be running twice at a time (run - watch)", done => { const compiler = createMultiCompiler(); compiler.run((err, stats) => { @@ -94,6 +97,7 @@ describe("MultiCompiler", function () { } }); }); + it("should not be running twice at a time (watch - run)", done => { const compiler = createMultiCompiler(); compiler.watch({}, (err, stats) => { @@ -105,6 +109,7 @@ describe("MultiCompiler", function () { } }); }); + it("should not be running twice at a time (instance cb)", done => { const compiler = webpack( { @@ -125,6 +130,7 @@ describe("MultiCompiler", function () { } }); }); + it("should run again correctly after first compilation", done => { const compiler = createMultiCompiler(); compiler.run((err, stats) => { @@ -136,6 +142,7 @@ describe("MultiCompiler", function () { }); }); }); + it("should watch again correctly after first compilation", done => { const compiler = createMultiCompiler(); compiler.run((err, stats) => { @@ -147,6 +154,7 @@ describe("MultiCompiler", function () { }); }); }); + it("should run again correctly after first closed watch", done => { const compiler = createMultiCompiler(); const watching = compiler.watch({}, (err, stats) => { @@ -159,6 +167,7 @@ describe("MultiCompiler", function () { }); }); }); + it("should watch again correctly after first closed watch", done => { const compiler = createMultiCompiler(); const watching = compiler.watch({}, (err, stats) => { @@ -171,6 +180,7 @@ describe("MultiCompiler", function () { }); }); }); + it("should respect parallelism and dependencies for running", done => { const compiler = createMultiCompiler({ parallelism: 1, @@ -207,6 +217,7 @@ describe("MultiCompiler", function () { compiler.close(done); }); }); + it("should respect parallelism and dependencies for watching", done => { const compiler = webpack( Object.assign( @@ -280,8 +291,8 @@ describe("MultiCompiler", function () { c: c compiled successfully" `); - expect(compiler.compilers[0].modifiedFiles).toBe(undefined); - expect(compiler.compilers[0].removedFiles).toBe(undefined); + expect(compiler.compilers[0].modifiedFiles).toBeUndefined(); + expect(compiler.compilers[0].removedFiles).toBeUndefined(); expect(events).toMatchInlineSnapshot(` Array [ "b run", diff --git a/test/MultiItemCache.unittest.js b/test/MultiItemCache.unittest.js index f78989ddd33..55fe56d373b 100644 --- a/test/MultiItemCache.unittest.js +++ b/test/MultiItemCache.unittest.js @@ -4,18 +4,18 @@ const Cache = require("../lib/Cache"); const { ItemCacheFacade, MultiItemCache } = require("../lib/CacheFacade"); describe("MultiItemCache", () => { - it("Throws when getting items from an empty Cache", () => { + it("throws when getting items from an empty Cache", () => { const multiItemCache = new MultiItemCache(generateItemCaches(0)); - expect(() => multiItemCache.get(_ => _())).toThrow(); + expect(() => multiItemCache.get(_ => _())).toThrow(/_ is not a function/); }); - it("Returns the single ItemCacheFacade when passed an array of length 1", () => { + it("returns the single ItemCacheFacade when passed an array of length 1", () => { const itemCaches = generateItemCaches(1); const multiItemCache = new MultiItemCache(itemCaches); expect(multiItemCache).toBe(itemCaches[0]); }); - it("Retrieves items from the underlying Cache when get is called", () => { + it("retrieves items from the underlying Cache when get is called", () => { const itemCaches = generateItemCaches(10); const multiItemCache = new MultiItemCache(itemCaches); const callback = (err, res) => { @@ -27,7 +27,7 @@ describe("MultiItemCache", () => { } }); - it("Can get() a large number of items without exhausting the stack", () => { + it("can get() a large number of items without exhausting the stack", () => { const itemCaches = generateItemCaches(10000, () => undefined); const multiItemCache = new MultiItemCache(itemCaches); let callbacks = 0; @@ -37,7 +37,7 @@ describe("MultiItemCache", () => { ++callbacks; }; multiItemCache.get(callback); - expect(callbacks).toEqual(1); + expect(callbacks).toBe(1); }); /** diff --git a/test/MultiStats.test.js b/test/MultiStats.test.js index df12659778d..cd3d36e0921 100644 --- a/test/MultiStats.test.js +++ b/test/MultiStats.test.js @@ -7,6 +7,7 @@ const { createFsFromVolume, Volume } = require("memfs"); describe("MultiStats", () => { it("should create JSON of children stats", done => { const webpack = require(".."); + const compiler = webpack([ { context: __dirname, diff --git a/test/MultiWatching.unittest.js b/test/MultiWatching.unittest.js index 051b2a9fa7f..d8f502be509 100644 --- a/test/MultiWatching.unittest.js +++ b/test/MultiWatching.unittest.js @@ -36,22 +36,22 @@ describe("MultiWatching", () => { }); it("invalidates each watching", () => { - expect(watchings[0].invalidate.mock.calls.length).toBe(1); - expect(watchings[1].invalidate.mock.calls.length).toBe(1); + expect(watchings[0].invalidate.mock.calls).toHaveLength(1); + expect(watchings[1].invalidate.mock.calls).toHaveLength(1); }); }); describe("suspend", () => { it("suspends each watching", () => { myMultiWatching.suspend(); - expect(watchings[0].suspend.mock.calls.length).toBe(1); - expect(watchings[1].suspend.mock.calls.length).toBe(1); + expect(watchings[0].suspend.mock.calls).toHaveLength(1); + expect(watchings[1].suspend.mock.calls).toHaveLength(1); }); it("resume each watching", () => { myMultiWatching.resume(); - expect(watchings[0].resume.mock.calls.length).toBe(1); - expect(watchings[1].resume.mock.calls.length).toBe(1); + expect(watchings[0].resume.mock.calls).toHaveLength(1); + expect(watchings[1].resume.mock.calls).toHaveLength(1); }); }); @@ -67,14 +67,14 @@ describe("MultiWatching", () => { }); it("closes each watching", () => { - expect(watchings[0].close.mock.calls.length).toBe(1); - expect(watchings[1].close.mock.calls.length).toBe(1); + expect(watchings[0].close.mock.calls).toHaveLength(1); + expect(watchings[1].close.mock.calls).toHaveLength(1); }); it("calls callback after each watching has closed", () => { callClosedFinishedCallback(watchings[0]); callClosedFinishedCallback(watchings[1]); - expect(callback.mock.calls.length).toBe(1); + expect(callback.mock.calls).toHaveLength(1); }); }); }); diff --git a/test/NodeTemplatePlugin.test.js b/test/NodeTemplatePlugin.test.js index 9e705b46b74..dadf6095409 100644 --- a/test/NodeTemplatePlugin.test.js +++ b/test/NodeTemplatePlugin.test.js @@ -7,8 +7,10 @@ const path = require("path"); // cspell:word nodetest describe("NodeTemplatePlugin", () => { jest.setTimeout(20000); + it("should compile and run a simple module", done => { const webpack = require(".."); + webpack( { mode: "production", @@ -27,7 +29,9 @@ describe("NodeTemplatePlugin", () => { if (err) return err; expect(stats.hasErrors()).toBe(false); expect(stats.hasWarnings()).toBe(false); + const result = require("./js/NodeTemplatePlugin/result").abc; + expect(result.nextTick).toBe(process.nextTick); expect(result.fs).toBe(require("fs")); result.loadChunk(456, chunk => { @@ -45,6 +49,7 @@ describe("NodeTemplatePlugin", () => { it("should compile and run a simple module in single mode", done => { const webpack = require(".."); + webpack( { mode: "production", @@ -68,7 +73,9 @@ describe("NodeTemplatePlugin", () => { (err, stats) => { if (err) return err; expect(stats.hasErrors()).toBe(false); + const result = require("./js/NodeTemplatePluginSingle/result2"); + expect(result.nextTick).toBe(process.nextTick); expect(result.fs).toBe(require("fs")); const sameTick = true; diff --git a/test/NormalModule.unittest.js b/test/NormalModule.unittest.js index 14ae35f46a9..07d4c2c79a8 100644 --- a/test/NormalModule.unittest.js +++ b/test/NormalModule.unittest.js @@ -13,6 +13,7 @@ describe("NormalModule", () => { let loaders; let resource; let parser; + beforeEach(() => { request = "/some/request"; userRequest = "/some/userRequest"; @@ -38,10 +39,12 @@ describe("NormalModule", () => { }; normalModule.useSimpleSourceMap = true; }); + describe("#identifier", () => { it("returns an identifier for this module", () => { expect(normalModule.identifier()).toBe(request); }); + it("returns an identifier from toString", () => { normalModule.debugId = 1000; expect(normalModule.toString()).toBe("Module[1000: /some/request]"); @@ -54,7 +57,7 @@ describe("NormalModule", () => { normalModule.readableIdentifier({ shorten: spy }); - expect(spy.mock.calls.length).toBe(1); + expect(spy.mock.calls).toHaveLength(1); expect(spy.mock.calls[0][0]).toBe(userRequest); }); }); @@ -67,6 +70,7 @@ describe("NormalModule", () => { }) ).toBe("../userRequest"); }); + describe("given a userRequest containing loaders", () => { beforeEach(() => { userRequest = @@ -81,6 +85,7 @@ describe("NormalModule", () => { parser }); }); + it("contextifies every path in the userRequest", () => { expect( normalModule.libIdent({ @@ -89,6 +94,7 @@ describe("NormalModule", () => { ).toBe("../userRequest!../other/userRequest!../thing/is/off/here"); }); }); + describe("given a userRequest containing query parameters", () => { it("ignores paths in query parameters", () => { // cspell:word testpath @@ -116,8 +122,10 @@ describe("NormalModule", () => { it("return the resource", () => { expect(normalModule.nameForCondition()).toBe(resource); }); + describe("given a resource containing a ?-sign", () => { const baseResource = "some/resource"; + beforeEach(() => { resource = `${baseResource}?some=query`; normalModule = new NormalModule({ @@ -130,6 +138,7 @@ describe("NormalModule", () => { parser }); }); + it("return only the part before the ?-sign", () => { expect(normalModule.nameForCondition()).toBe(baseResource); }); @@ -140,11 +149,13 @@ describe("NormalModule", () => { let name; let content; let sourceMap; + beforeEach(() => { name = "some name"; content = "some content"; sourceMap = "some sourcemap"; }); + describe("given no sourcemap", () => { it("returns a RawSource", () => { expect( @@ -152,6 +163,7 @@ describe("NormalModule", () => { ).toBeInstanceOf(RawSource); }); }); + describe("given a string as the sourcemap", () => { it("returns a OriginalSource", () => { expect( @@ -159,32 +171,38 @@ describe("NormalModule", () => { ).toBeInstanceOf(OriginalSource); }); }); + describe("given a some other kind of sourcemap (source maps disabled)", () => { beforeEach(() => { sourceMap = () => {}; normalModule.useSimpleSourceMap = false; }); + it("returns a SourceMapSource", () => { expect( normalModule.createSourceForAsset("/", name, content, sourceMap) ).toBeInstanceOf(RawSource); }); }); + describe("given a some other kind of sourcemap (simple source maps enabled)", () => { beforeEach(() => { sourceMap = () => {}; }); + it("returns a SourceMapSource", () => { expect( normalModule.createSourceForAsset("/", name, content, sourceMap) ).toBeInstanceOf(RawSource); }); }); + describe("given a some other kind of sourcemap (source maps enabled)", () => { beforeEach(() => { sourceMap = () => {}; normalModule.useSourceMap = true; }); + it("returns a SourceMapSource", () => { expect( normalModule.createSourceForAsset("/", name, content, sourceMap) @@ -195,9 +213,11 @@ describe("NormalModule", () => { describe("#originalSource", () => { const expectedSource = "some source"; + beforeEach(() => { normalModule._source = new RawSource(expectedSource); }); + it("returns an original Source", () => { expect(normalModule.originalSource()).toBe(normalModule._source); }); @@ -206,43 +226,53 @@ describe("NormalModule", () => { describe("#applyNoParseRule", () => { let rule; let content; + describe("given a string as rule", () => { beforeEach(() => { rule = "some-rule"; }); + describe("and the content starting with the string specified in rule", () => { beforeEach(() => { content = `${rule}some-content`; }); + it("returns true", () => { expect(normalModule.shouldPreventParsing(rule, content)).toBe(true); }); }); + describe("and the content does not start with the string specified in rule", () => { beforeEach(() => { content = "some-content"; }); + it("returns false", () => { expect(normalModule.shouldPreventParsing(rule, content)).toBe(false); }); }); }); + describe("given a regex as rule", () => { beforeEach(() => { rule = /some-rule/; }); + describe("and the content matches the rule", () => { beforeEach(() => { content = `${rule}some-content`; }); + it("returns true", () => { expect(normalModule.shouldPreventParsing(rule, content)).toBe(true); }); }); + describe("and the content does not match the rule", () => { beforeEach(() => { content = "some-content"; }); + it("returns false", () => { expect(normalModule.shouldPreventParsing(rule, content)).toBe(false); }); @@ -252,68 +282,81 @@ describe("NormalModule", () => { describe("#shouldPreventParsing", () => { let applyNoParseRuleSpy; + beforeEach(() => { applyNoParseRuleSpy = jest.fn(); normalModule.applyNoParseRule = applyNoParseRuleSpy; }); + describe("given no noParseRule", () => { it("returns false", () => { expect(normalModule.shouldPreventParsing()).toBe(false); - expect(applyNoParseRuleSpy.mock.calls.length).toBe(0); + expect(applyNoParseRuleSpy.mock.calls).toHaveLength(0); }); }); + describe("given a noParseRule", () => { let returnValOfSpy; + beforeEach(() => { returnValOfSpy = true; applyNoParseRuleSpy.mockReturnValue(returnValOfSpy); }); + describe("that is a string", () => { it("calls and returns whatever applyNoParseRule returns", () => { expect(normalModule.shouldPreventParsing("some rule")).toBe( returnValOfSpy ); - expect(applyNoParseRuleSpy.mock.calls.length).toBe(1); + expect(applyNoParseRuleSpy.mock.calls).toHaveLength(1); }); }); + describe("that is a regex", () => { it("calls and returns whatever applyNoParseRule returns", () => { expect(normalModule.shouldPreventParsing("some rule")).toBe( returnValOfSpy ); - expect(applyNoParseRuleSpy.mock.calls.length).toBe(1); + expect(applyNoParseRuleSpy.mock.calls).toHaveLength(1); }); }); + describe("that is an array", () => { describe("of strings and or regexps", () => { let someRules; + beforeEach(() => { someRules = ["some rule", /some rule1/, "some rule2"]; }); + describe("and none of them match", () => { beforeEach(() => { returnValOfSpy = false; applyNoParseRuleSpy.mockReturnValue(returnValOfSpy); }); + it("returns false", () => { expect(normalModule.shouldPreventParsing(someRules)).toBe( returnValOfSpy ); - expect(applyNoParseRuleSpy.mock.calls.length).toBe(3); + expect(applyNoParseRuleSpy.mock.calls).toHaveLength(3); }); }); + describe("and the first of them matches", () => { beforeEach(() => { returnValOfSpy = true; applyNoParseRuleSpy.mockReturnValue(returnValOfSpy); }); + it("returns true", () => { expect(normalModule.shouldPreventParsing(someRules)).toBe( returnValOfSpy ); - expect(applyNoParseRuleSpy.mock.calls.length).toBe(1); + expect(applyNoParseRuleSpy.mock.calls).toHaveLength(1); }); }); + describe("and the last of them matches", () => { beforeEach(() => { returnValOfSpy = true; @@ -321,11 +364,12 @@ describe("NormalModule", () => { applyNoParseRuleSpy.mockReturnValueOnce(false); applyNoParseRuleSpy.mockReturnValue(true); }); + it("returns true", () => { expect(normalModule.shouldPreventParsing(someRules)).toBe( returnValOfSpy ); - expect(applyNoParseRuleSpy.mock.calls.length).toBe(3); + expect(applyNoParseRuleSpy.mock.calls).toHaveLength(3); }); }); }); diff --git a/test/PersistentCaching.test.js b/test/PersistentCaching.test.js index 28dd169a71e..f57ad24f367 100644 --- a/test/PersistentCaching.test.js +++ b/test/PersistentCaching.test.js @@ -63,6 +63,7 @@ describe("Persistent Caching", () => { const compile = async (configAdditions = {}) => new Promise((resolve, reject) => { const webpack = require("../"); + webpack( { ...config, @@ -71,8 +72,9 @@ describe("Persistent Caching", () => { }, (err, stats) => { if (err) return reject(err); - if (stats.hasErrors()) + if (stats.hasErrors()) { return reject(stats.toString({ preset: "errors-only" })); + } resolve(stats); } ); @@ -84,7 +86,7 @@ describe("Persistent Caching", () => { if (cache[name]) return cache[name].exports; if (!name.endsWith(".js")) name += ".js"; const p = path.resolve(outputPath, name); - const source = fs.readFileSync(p, "utf-8"); + const source = fs.readFileSync(p, "utf8"); const context = {}; const fn = vm.runInThisContext( `(function(require, module, exports) { ${source} })`, @@ -181,7 +183,9 @@ export { style }; "lib2.js": "export default 21" }; await updateSrc(data); + const webpack = require("../"); + const configAdditions = { plugins: [ new webpack.container.ModuleFederationPlugin({ diff --git a/test/ProfilingPlugin.test.js b/test/ProfilingPlugin.test.js index ddd127d4faf..1af33d26cbd 100644 --- a/test/ProfilingPlugin.test.js +++ b/test/ProfilingPlugin.test.js @@ -6,11 +6,12 @@ const path = require("path"); const fs = require("graceful-fs"); const rimraf = require("rimraf"); -describe("Profiling Plugin", function () { +describe("Profiling Plugin", () => { jest.setTimeout(120000); it("should handle output path with folder creation", done => { const webpack = require("../"); + const outputPath = path.join(__dirname, "js/profilingPath"); const finalPath = path.join(outputPath, "events.json"); let counter = 0; @@ -55,9 +56,12 @@ describe("Profiling Plugin", function () { compiler.run(err => { if (err) return done(err); const testDuration = process.hrtime(startTime); - if (!fs.existsSync(outputPath)) + if (!fs.existsSync(outputPath)) { return done(new Error("Folder should be created.")); + } + const data = require(finalPath); + const maxTs = data.reduce((max, entry) => Math.max(max, entry.ts), 0); const minTs = data[0].ts; const duration = maxTs - minTs; diff --git a/test/ProgressPlugin.test.js b/test/ProgressPlugin.test.js index 8e9676cd12f..540f7ddd0ec 100644 --- a/test/ProgressPlugin.test.js +++ b/test/ProgressPlugin.test.js @@ -81,7 +81,7 @@ const runCompilerAsync = compiler => }); }); -describe("ProgressPlugin", function () { +describe("ProgressPlugin", () => { let stderr; let stdout; @@ -89,8 +89,11 @@ describe("ProgressPlugin", function () { stderr = captureStdio(process.stderr, true); stdout = captureStdio(process.stdout, true); }); + afterEach(() => { + // eslint-disable-next-line no-unused-expressions stderr && stderr.restore(); + // eslint-disable-next-line no-unused-expressions stdout && stdout.restore(); }); @@ -107,10 +110,12 @@ describe("ProgressPlugin", function () { "should not contain NaN as a percentage when it is applied to Compiler", nanTest(createSimpleCompiler) ); + it( "should not contain NaN as a percentage when it is applied to MultiCompiler", nanTest(createMultiCompiler) ); + it( "should not contain NaN as a percentage when it is applied to MultiCompiler (parallelism: 1)", nanTest(() => createMultiCompiler(undefined, { parallelism: 1 })) @@ -182,10 +187,12 @@ describe("ProgressPlugin", function () { "should have monotonic increasing progress", monotonicTest(createSimpleCompiler) ); + it( "should have monotonic increasing progress (multi compiler)", monotonicTest(createMultiCompiler) ); + it( "should have monotonic increasing progress (multi compiler, parallelism)", monotonicTest(o => createMultiCompiler(o, { parallelism: 1 })) diff --git a/test/Queue.unittest.js b/test/Queue.unittest.js index 4c650ebc9c0..cb234d2af29 100644 --- a/test/Queue.unittest.js +++ b/test/Queue.unittest.js @@ -43,14 +43,14 @@ describe("Queue", () => { q.enqueue("item1"); q.enqueue("item2"); - expect(q.length).toBe(2); + expect(q).toHaveLength(2); q.dequeue(); - expect(q.length).toBe(1); + expect(q).toHaveLength(1); q.dequeue(); - expect(q.length).toBe(0); + expect(q).toHaveLength(0); }); }); diff --git a/test/RequestShortener.unittest.js b/test/RequestShortener.unittest.js index 84dd3c6bb5a..014c7be53af 100644 --- a/test/RequestShortener.unittest.js +++ b/test/RequestShortener.unittest.js @@ -5,17 +5,17 @@ const RequestShortener = require("../lib/RequestShortener"); describe("RequestShortener", () => { it("should create RequestShortener and shorten with ./ file in directory", () => { const shortener = new RequestShortener("/foo/bar"); - expect(shortener.shorten("/foo/bar/some.js")).toEqual("./some.js"); + expect(shortener.shorten("/foo/bar/some.js")).toBe("./some.js"); }); it("should create RequestShortener and shorten with ../ file in parent directory", () => { const shortener = new RequestShortener("/foo/bar"); - expect(shortener.shorten("/foo/baz/some.js")).toEqual("../baz/some.js"); + expect(shortener.shorten("/foo/baz/some.js")).toBe("../baz/some.js"); }); it("should create RequestShortener and not shorten parent directory neighbor", () => { const shortener = new RequestShortener("/foo/bar"); - expect(shortener.shorten("/foo_baz/bar/some.js")).toEqual( + expect(shortener.shorten("/foo_baz/bar/some.js")).toBe( "../../foo_baz/bar/some.js" ); }); diff --git a/test/SemVer.unittest.js b/test/SemVer.unittest.js index 94cc46da336..6ad93553386 100644 --- a/test/SemVer.unittest.js +++ b/test/SemVer.unittest.js @@ -153,10 +153,11 @@ describe("SemVer", () => { }; for (const key of Object.keys(cases)) { describe(key, () => { - for (const c of cases[key]) + for (const c of cases[key]) { it(`should be equal ${c}`, () => { expect(parseRange(c)).toEqual(parseRange(key)); }); + } }); } }); @@ -567,6 +568,7 @@ describe("SemVer", () => { it(`should be able to parse ${range}`, () => { parseRange(range); }); + for (const item of cases[range]) { for (const [name, fn] of [ ["normal", satisfy], diff --git a/test/SortableSet.unittest.js b/test/SortableSet.unittest.js index ea01af72887..65b39a075eb 100644 --- a/test/SortableSet.unittest.js +++ b/test/SortableSet.unittest.js @@ -3,12 +3,12 @@ const SortableSet = require("../lib/util/SortableSet"); describe("util/SortableSet", () => { - it("Can be constructed like a normal Set", () => { + it("can be constructed like a normal Set", () => { const sortableSet = new SortableSet([1, 1, 1, 1, 1, 4, 5, 2], () => {}); expect(Array.from(sortableSet)).toEqual([1, 4, 5, 2]); }); - it("Can sort its content", () => { + it("can sort its content", () => { const sortableSet = new SortableSet( [1, 1, 1, 6, 6, 1, 1, 4, 5, 2, 3, 8, 5, 7, 9, 0, 3, 1], (a, b) => a - b @@ -17,7 +17,7 @@ describe("util/SortableSet", () => { expect(Array.from(sortableSet)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); }); - it("Can sort by a specified function", () => { + it("can sort by a specified function", () => { const sortableSet = new SortableSet( [1, 1, 1, 6, 6, 1, 1, 4, 5, 2, 3, 8, 5, 7, 9, 0, 3, 1], (a, b) => a - b diff --git a/test/Stats.test.js b/test/Stats.test.js index 704a3494fe9..d8c65afbd25 100644 --- a/test/Stats.test.js +++ b/test/Stats.test.js @@ -7,6 +7,7 @@ const { createFsFromVolume, Volume } = require("memfs"); const compile = options => new Promise((resolve, reject) => { const webpack = require(".."); + const compiler = webpack(options); compiler.outputFileSystem = createFsFromVolume(new Volume()); compiler.run((err, stats) => { @@ -50,6 +51,7 @@ describe("Stats", () => { "}" ); }); + it("should omit all properties with all false", async () => { const stats = await compile({ context: __dirname, @@ -61,6 +63,7 @@ describe("Stats", () => { }) ).toEqual({}); }); + it("should the results of hasWarnings() be affected by ignoreWarnings", async () => { const stats = await compile({ mode: "development", @@ -77,6 +80,7 @@ describe("Stats", () => { }); expect(stats.hasWarnings()).toBeFalsy(); }); + describe("chunkGroups", () => { it("should be empty when there is no additional chunks", async () => { const stats = await compile({ @@ -134,6 +138,7 @@ describe("Stats", () => { } `); }); + it("should contain additional chunks", async () => { const stats = await compile({ context: __dirname, @@ -207,6 +212,7 @@ describe("Stats", () => { } `); }); + it("should contain assets", async () => { const stats = await compile({ context: __dirname, diff --git a/test/StatsTestCases.basictest.js b/test/StatsTestCases.basictest.js index 7c3f44db8d3..207730776f1 100644 --- a/test/StatsTestCases.basictest.js +++ b/test/StatsTestCases.basictest.js @@ -1,6 +1,7 @@ "use strict"; require("./helpers/warmup-webpack"); + const path = require("path"); const fs = require("graceful-fs"); const rimraf = require("rimraf"); @@ -29,6 +30,7 @@ const tests = fs if (fs.existsSync(filterPath) && !require(filterPath)()) { // eslint-disable-next-line jest/no-disabled-tests, jest/valid-describe-callback describe.skip(testName, () => it("filtered", () => {})); + return false; } return true; @@ -37,12 +39,15 @@ const tests = fs describe("StatsTestCases", () => { jest.setTimeout(30000); let stderr; + beforeEach(() => { stderr = captureStdio(process.stderr, true); }); + afterEach(() => { stderr.restore(); }); + for (const testName of tests) { // eslint-disable-next-line no-loop-func it(`should print correct stats for ${testName}`, done => { @@ -77,8 +82,9 @@ describe("StatsTestCases", () => { if (!options.output.path) options.output.path = outputDirectory; if (!options.plugins) options.plugins = []; if (!options.optimization) options.optimization = {}; - if (options.optimization.minimize === undefined) + if (options.optimization.minimize === undefined) { options.optimization.minimize = false; + } if ( options.cache && options.cache !== true && @@ -106,9 +112,10 @@ describe("StatsTestCases", () => { args.concat([ (err, result) => { if (err) return callback(err); - if (!/\.(js|json|txt)$/.test(args[0])) + if (!/\.(js|json|txt)$/.test(args[0])) { return callback(null, result); - callback(null, result.toString("utf-8").replace(/\r/g, "")); + } + callback(null, result.toString("utf8").replace(/\r/g, "")); } ]) ); @@ -155,7 +162,7 @@ describe("StatsTestCases", () => { context: path.join(base, testName), colors: false }), - "utf-8" + "utf8" ); let toStringOptions = { @@ -165,10 +172,12 @@ describe("StatsTestCases", () => { let hasColorSetting = false; if (typeof c.options.stats !== "undefined") { toStringOptions = c.options.stats; - if (toStringOptions === null || typeof toStringOptions !== "object") + if (toStringOptions === null || typeof toStringOptions !== "object") { toStringOptions = { preset: toStringOptions }; - if (!toStringOptions.context) + } + if (!toStringOptions.context) { toStringOptions.context = path.join(base, testName); + } hasColorSetting = typeof toStringOptions.colors !== "undefined"; } if (Array.isArray(c.options) && !toStringOptions.children) { diff --git a/test/Template.unittest.js b/test/Template.unittest.js index 7740884ac15..78eeae4b52e 100644 --- a/test/Template.unittest.js +++ b/test/Template.unittest.js @@ -6,6 +6,7 @@ describe("Template", () => { it("should generate valid identifiers", () => { expect(Template.toIdentifier("0abc-def9")).toBe("_0abc_def9"); }); + it("should generate valid number identifiers", () => { const items = []; let item; @@ -16,6 +17,7 @@ describe("Template", () => { items.push(item); } }); + // cspell:ignore sdfas sadfome it("should generate sanitized path identifiers", () => { expect(Template.toPath("path/to-sdfas/sadfome$$.js")).toBe( diff --git a/test/TestCases.template.js b/test/TestCases.template.js index 9c4b9768730..fda386f988d 100644 --- a/test/TestCases.template.js +++ b/test/TestCases.template.js @@ -1,6 +1,7 @@ "use strict"; require("./helpers/warmup-webpack"); + const path = require("path"); const fs = require("graceful-fs"); const vm = require("vm"); @@ -42,15 +43,18 @@ const createLogger = appendTarget => ({ const describeCases = config => { describe(config.name, () => { let stderr; + beforeEach(() => { stderr = captureStdio(process.stderr, true); }); + afterEach(() => { stderr.restore(); }); + for (const category of categories) { // eslint-disable-next-line no-loop-func - describe(category.name, function () { + describe(category.name, () => { jest.setTimeout(20000); for (const testName of category.tests.filter(test => { @@ -61,6 +65,7 @@ const describeCases = config => { describe.skip(test, () => { it("filtered", () => {}); }); + return false; } return true; @@ -89,7 +94,9 @@ const describeCases = config => { if (fs.existsSync(testConfigPath)) { testConfig = require(testConfigPath); } + const TerserPlugin = require("terser-webpack-plugin"); + const terserForTesting = new TerserPlugin({ parallel: false }); @@ -208,15 +215,19 @@ const describeCases = config => { console: createLogger(infraStructureLog) } }; + + beforeAll(done => { + rimraf(cacheDirectory, done); + }); + const cleanups = []; + afterAll(() => { options = undefined; testConfig = undefined; for (const fn of cleanups) fn(); }); - beforeAll(done => { - rimraf(cacheDirectory, done); - }); + if (config.cache) { it( `${testName} should pre-compile to fill disk cache (1st)`, @@ -228,7 +239,9 @@ const describeCases = config => { ); infraStructureLog.length = 0; const deprecationTracker = deprecationTracking.start(); + const webpack = require(".."); + webpack(options, err => { deprecationTracker(); options.output.path = oldPath; @@ -259,6 +272,7 @@ const describeCases = config => { }, testConfig.timeout || 60000 ); + it( `${testName} should pre-compile to fill disk cache (2nd)`, done => { @@ -269,7 +283,9 @@ const describeCases = config => { ); infraStructureLog.length = 0; const deprecationTracker = deprecationTracking.start(); + const webpack = require(".."); + webpack(options, err => { deprecationTracker(); options.output.path = oldPath; @@ -301,11 +317,14 @@ const describeCases = config => { testConfig.cachedTimeout || testConfig.timeout || 10000 ); } + it( `${testName} should compile`, done => { infraStructureLog.length = 0; + const webpack = require(".."); + const compiler = webpack(options); const run = () => { const deprecationTracker = deprecationTracking.start(); @@ -345,7 +364,7 @@ const describeCases = config => { fs.writeFileSync( path.join(outputDirectory, "stats.txt"), stats.toString(statOptions), - "utf-8" + "utf8" ); const jsonStats = stats.toJson({ errorDetails: true, @@ -439,7 +458,7 @@ const describeCases = config => { function _require(module, esmMode) { if (module.startsWith("./")) { const p = path.join(outputDirectory, module); - const content = fs.readFileSync(p, "utf-8"); + const content = fs.readFileSync(p, "utf8"); if (p.endsWith(".mjs")) { let esm; try { @@ -510,8 +529,9 @@ const describeCases = config => { Promise.resolve() .then(() => _require(`./${options.output.filename}`)) .then(() => { - if (getNumberOfTests() === 0) + if (getNumberOfTests() === 0) { return done(new Error("No tests exported by test case")); + } done(); }, done); }, 10000); diff --git a/test/TestCasesAllCombined.longtest.js b/test/TestCasesAllCombined.longtest.js index 1d193c5f601..f59ba3b4f73 100644 --- a/test/TestCasesAllCombined.longtest.js +++ b/test/TestCasesAllCombined.longtest.js @@ -13,6 +13,7 @@ describe("TestCases", () => { plugins: [ c => { const webpack = require(".."); + new webpack.HotModuleReplacementPlugin().apply(c); } ] diff --git a/test/Validation.test.js b/test/Validation.test.js index 8f1ed95c4d7..502fc1b6f7b 100644 --- a/test/Validation.test.js +++ b/test/Validation.test.js @@ -9,6 +9,7 @@ describe("Validation", () => { try { const webpack = require(".."); + webpack(config); } catch (err) { if (err.name !== "ValidationError") throw err; diff --git a/test/WasmHashes.unittest.js b/test/WasmHashes.unittest.js index e5b5416e1cb..23d4e552673 100644 --- a/test/WasmHashes.unittest.js +++ b/test/WasmHashes.unittest.js @@ -4,7 +4,8 @@ const wasmHashes = { xxhash64: () => { const createHash = require("../lib/util/hash/xxhash64"); const createReferenceHash = - require("hash-wasm/dist/xxhash64.umd.min.js").createXXHash64; + require("hash-wasm/dist/xxhash64.umd.min").createXXHash64; + return { createHash, createReferenceHash: async () => (await createReferenceHash()).init(), @@ -14,6 +15,7 @@ const wasmHashes = { "xxhash64-createHash": () => { const createXxHash = require("../lib/util/hash/xxhash64"); const createHash = require("../lib/util/createHash"); + return { createHash: () => createHash("xxhash64"), createReferenceHash: createXxHash, @@ -22,6 +24,7 @@ const wasmHashes = { }, md4: () => { const createMd4Hash = require("../lib/util/hash/md4"); + return { createHash: createMd4Hash, createReferenceHash: @@ -34,6 +37,7 @@ const wasmHashes = { "md4-createHash": () => { const createMd4Hash = require("../lib/util/hash/md4"); const createHash = require("../lib/util/createHash"); + return { createHash: () => createHash("md4"), createReferenceHash: createMd4Hash, @@ -109,9 +113,13 @@ for (const name of Object.keys(wasmHashes)) { test(`two updates ${size1} + ${size2} bytes`, [size1, size2]); } } + test("many updates 1", sizes); + test("many updates 2", sizes.slice().reverse()); + test("many updates 3", sizes.concat(sizes.slice().reverse())); + test("many updates 4", sizes.slice().reverse().concat(sizes)); const unicodeTest = (name, codePoints) => { diff --git a/test/Watch.test.js b/test/Watch.test.js index cba04e35eab..d939dd36397 100644 --- a/test/Watch.test.js +++ b/test/Watch.test.js @@ -6,9 +6,9 @@ const path = require("path"); const webpack = require(".."); const { createFsFromVolume, Volume } = require("memfs"); -describe("Watch", () => { - jest.setTimeout(10000); +jest.setTimeout(10000); +describe("Watch", () => { it("should only compile a single time", done => { let counterBeforeCompile = 0; let counterDone = 0; diff --git a/test/WatchClose.test.js b/test/WatchClose.test.js index 9048bf97965..bc590fb26e4 100644 --- a/test/WatchClose.test.js +++ b/test/WatchClose.test.js @@ -17,6 +17,7 @@ describe("WatchClose", () => { beforeEach(() => { const webpack = require("../"); + compiler = webpack({ mode: "development", entry: filePath, diff --git a/test/WatchDetection.test.js b/test/WatchDetection.test.js index f2123c56690..477948ecee1 100644 --- a/test/WatchDetection.test.js +++ b/test/WatchDetection.test.js @@ -10,6 +10,7 @@ describe("WatchDetection", () => { if (process.env.NO_WATCH_TESTS) { // eslint-disable-next-line jest/no-disabled-tests it.skip("long running tests excluded", () => {}); + return; } @@ -48,8 +49,8 @@ describe("WatchDetection", () => { } catch (_err) { // empty } - fs.writeFileSync(filePath, "require('./file2')", "utf-8"); - fs.writeFileSync(file2Path, "original", "utf-8"); + fs.writeFileSync(filePath, "require('./file2')", "utf8"); + fs.writeFileSync(file2Path, "original", "utf8"); }); afterAll(done => { @@ -105,8 +106,9 @@ describe("WatchDetection", () => { .readFileSync("/directory/bundle.js") .toString() .includes("original") - ) + ) { step2(); + } }; watcher = compiler.watch( @@ -122,14 +124,14 @@ describe("WatchDetection", () => { */ function step2() { onChange = () => { - expect(compiler.modifiedFiles).not.toBe(undefined); - expect(compiler.removedFiles).not.toBe(undefined); + expect(compiler.modifiedFiles).toBeDefined(); + expect(compiler.removedFiles).toBeDefined(); }; fs.writeFile( filePath, "require('./file2'); again", - "utf-8", + "utf8", handleError ); @@ -141,7 +143,7 @@ describe("WatchDetection", () => { */ function step3() { if (invalidate) watcher.invalidate(); - fs.writeFile(file2Path, "wrong", "utf-8", handleError); + fs.writeFile(file2Path, "wrong", "utf8", handleError); setTimeout(step4, changeTimeout); } @@ -151,18 +153,19 @@ describe("WatchDetection", () => { */ function step4() { onChange = () => { - expect(compiler.modifiedFiles).not.toBe(undefined); - expect(compiler.removedFiles).not.toBe(undefined); + expect(compiler.modifiedFiles).toBeDefined(); + expect(compiler.removedFiles).toBeDefined(); if ( memfs .readFileSync("/directory/bundle.js") .toString() .includes("correct") - ) + ) { step5(); + } }; - fs.writeFile(file2Path, "correct", "utf-8", handleError); + fs.writeFile(file2Path, "correct", "utf8", handleError); } /** diff --git a/test/WatchSuspend.test.js b/test/WatchSuspend.test.js index 5e0d572e432..8534e1e3036 100644 --- a/test/WatchSuspend.test.js +++ b/test/WatchSuspend.test.js @@ -9,6 +9,7 @@ describe("WatchSuspend", () => { if (process.env.NO_WATCH_TESTS) { // eslint-disable-next-line jest/no-disabled-tests it.skip("long running tests excluded", () => {}); + return; } @@ -36,13 +37,15 @@ describe("WatchSuspend", () => { // skip } try { - fs.writeFileSync(filePath, "'foo'", "utf-8"); - fs.writeFileSync(file2Path, "'file2'", "utf-8"); - fs.writeFileSync(file3Path, "'file3'", "utf-8"); + fs.writeFileSync(filePath, "'foo'", "utf8"); + fs.writeFileSync(file2Path, "'file2'", "utf8"); + fs.writeFileSync(file3Path, "'file3'", "utf8"); } catch (_err) { // skip } + const webpack = require("../"); + compiler = webpack({ mode: "development", entry: filePath, @@ -75,7 +78,7 @@ describe("WatchSuspend", () => { it("should compile successfully", done => { onChange = () => { - expect(fs.readFileSync(outputFile, "utf-8")).toContain("'foo'"); + expect(fs.readFileSync(outputFile, "utf8")).toContain("'foo'"); onChange = null; done(); }; @@ -84,9 +87,9 @@ describe("WatchSuspend", () => { it("should suspend compilation", done => { onChange = jest.fn(); watching.suspend(); - fs.writeFileSync(filePath, "'bar'", "utf-8"); + fs.writeFileSync(filePath, "'bar'", "utf8"); setTimeout(() => { - expect(onChange.mock.calls.length).toBe(0); + expect(onChange.mock.calls).toHaveLength(0); onChange = null; done(); }, 1000); @@ -94,14 +97,14 @@ describe("WatchSuspend", () => { it("should resume compilation", done => { onChange = () => { - expect(fs.readFileSync(outputFile, "utf-8")).toContain("'bar'"); + expect(fs.readFileSync(outputFile, "utf8")).toContain("'bar'"); onChange = null; done(); }; watching.resume(); }); - for (const changeBefore of [false, true]) + for (const changeBefore of [false, true]) { for (const delay of [200, 1500]) { // eslint-disable-next-line no-loop-func it(`should not ignore changes during resumed compilation (changeBefore: ${changeBefore}, delay: ${delay}ms)`, async () => { @@ -115,15 +118,15 @@ describe("WatchSuspend", () => { }); }); return new Promise(resolve => { - if (changeBefore) fs.writeFileSync(filePath, "'bar'", "utf-8"); + if (changeBefore) fs.writeFileSync(filePath, "'bar'", "utf8"); setTimeout(() => { watching.suspend(); - fs.writeFileSync(filePath, "'baz'", "utf-8"); + fs.writeFileSync(filePath, "'baz'", "utf8"); onChange = "throw"; setTimeout(() => { onChange = () => { - expect(fs.readFileSync(outputFile, "utf-8")).toContain( + expect(fs.readFileSync(outputFile, "utf8")).toContain( "'baz'" ); expect( @@ -142,6 +145,7 @@ describe("WatchSuspend", () => { }); }); } + } it("should not drop changes when suspended", done => { const aggregateTimeout = 50; @@ -149,7 +153,7 @@ describe("WatchSuspend", () => { fs.writeFileSync( filePath, 'require("./file2.js"); require("./file3.js")', - "utf-8" + "utf8" ); onChange = () => { @@ -157,11 +161,11 @@ describe("WatchSuspend", () => { watching.suspend(); // Trigger the first change (works as expected): - fs.writeFileSync(file2Path, "'foo'", "utf-8"); + fs.writeFileSync(file2Path, "'foo'", "utf8"); // Trigger the second change _after_ aggregation timeout of the first setTimeout(() => { - fs.writeFileSync(file3Path, "'bar'", "utf-8"); + fs.writeFileSync(file3Path, "'bar'", "utf8"); // Wait when the file3 edit is settled and re-compile setTimeout(() => { @@ -169,7 +173,7 @@ describe("WatchSuspend", () => { onChange = () => { onChange = null; - expect(fs.readFileSync(outputFile, "utf-8")).toContain("'bar'"); + expect(fs.readFileSync(outputFile, "utf8")).toContain("'bar'"); done(); }; }, 200); diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js index 6b0b9a1609d..5b5725ece55 100644 --- a/test/WatchTestCases.template.js +++ b/test/WatchTestCases.template.js @@ -31,9 +31,9 @@ function copyDiff(src, dest, initial) { copyDiff(srcFile, destFile, initial); } else { const content = fs.readFileSync(srcFile); - if (/^DELETE\s*$/.test(content.toString("utf-8"))) { + if (/^DELETE\s*$/.test(content.toString("utf8"))) { fs.unlinkSync(destFile); - } else if (/^DELETE_DIRECTORY\s*$/.test(content.toString("utf-8"))) { + } else if (/^DELETE_DIRECTORY\s*$/.test(content.toString("utf8"))) { rimraf.sync(destFile); } else { fs.writeFileSync(destFile, content); @@ -52,9 +52,17 @@ function copyDiff(src, dest, initial) { const describeCases = config => { describe(config.name, () => { + beforeAll(() => { + let dest = path.join(__dirname, "js"); + if (!fs.existsSync(dest)) fs.mkdirSync(dest); + dest = path.join(__dirname, "js", `${config.name}-src`); + if (!fs.existsSync(dest)) fs.mkdirSync(dest); + }); + if (process.env.NO_WATCH_TESTS) { // eslint-disable-next-line jest/no-disabled-tests it.skip("long running tests excluded", () => {}); + return; } @@ -70,19 +78,16 @@ const describeCases = config => { if (fs.existsSync(filterPath) && !require(filterPath)(config)) { // eslint-disable-next-line jest/no-disabled-tests, jest/valid-describe-callback describe.skip(testName, () => it("filtered", () => {})); + return false; } return true; }) .sort() })); - beforeAll(() => { - let dest = path.join(__dirname, "js"); - if (!fs.existsSync(dest)) fs.mkdirSync(dest); - dest = path.join(__dirname, "js", `${config.name}-src`); - if (!fs.existsSync(dest)) fs.mkdirSync(dest); - }); + for (const category of categories) { + // eslint-disable-next-line jest/prefer-hooks-on-top, jest/no-duplicate-hooks beforeAll(() => { const dest = path.join( __dirname, @@ -92,6 +97,7 @@ const describeCases = config => { ); if (!fs.existsSync(dest)) fs.mkdirSync(dest); }); + describe(category.name, () => { for (const testName of category.tests) { describe(testName, () => { @@ -141,17 +147,20 @@ const describeCases = config => { if (!options.entry) options.entry = "./index.js"; if (!options.target) options.target = "async-node"; if (!options.output) options.output = {}; - if (options.output.clean === undefined) + if (options.output.clean === undefined) { options.output.clean = true; + } if (!options.output.path) options.output.path = outputDirectory; - if (typeof options.output.pathinfo === "undefined") + if (typeof options.output.pathinfo === "undefined") { options.output.pathinfo = true; - if (!options.output.filename) + } + if (!options.output.filename) { options.output.filename = `bundle${ options.experiments && options.experiments.outputModule ? ".mjs" : ".js" }`; + } if (options.cache && options.cache.type === "filesystem") { const cacheDirectory = path.join(tempDirectory, ".cache"); options.cache.cacheDirectory = cacheDirectory; @@ -160,15 +169,17 @@ const describeCases = config => { if (config.experiments) { if (!options.experiments) options.experiments = {}; for (const key of Object.keys(config.experiments)) { - if (options.experiments[key] === undefined) + if (options.experiments[key] === undefined) { options.experiments[key] = config.experiments[key]; + } } } if (config.optimization) { if (!options.optimization) options.optimization = {}; for (const key of Object.keys(config.optimization)) { - if (options.optimization[key] === undefined) + if (options.optimization[key] === undefined) { options.optimization[key] = config.optimization[key]; + } } } }; @@ -186,14 +197,18 @@ const describeCases = config => { let run = runs[runIdx]; let triggeringFilename; let lastHash = ""; + const currentWatchStepModule = require("./helpers/currentWatchStep"); + let compilationFinished = done; currentWatchStepModule.step = run.name; copyDiff(path.join(testDirectory, run.name), tempDirectory, true); setTimeout(() => { const deprecationTracker = deprecationTracking.start(); + const webpack = require(".."); + const compiler = webpack(options); compiler.hooks.invalid.tap( "WatchTestCasesTest", @@ -242,7 +257,7 @@ const describeCases = config => { `stats.${runs[runIdx] && runs[runIdx].name}.txt` ), stats.toString(statOptions), - "utf-8" + "utf8" ); const jsonStats = stats.toJson({ errorDetails: true @@ -256,8 +271,9 @@ const describeCases = config => { options, compilationFinished ) - ) + ) { return; + } if ( checkArrayExpectation( path.join(testDirectory, run.name), @@ -267,8 +283,9 @@ const describeCases = config => { options, compilationFinished ) - ) + ) { return; + } let testConfig = {}; try { @@ -280,8 +297,9 @@ const describeCases = config => { // empty } - if (testConfig.noTests) + if (testConfig.noTests) { return process.nextTick(compilationFinished); + } const runner = new TestRunner({ target: options.target, outputDirectory, @@ -331,10 +349,11 @@ const describeCases = config => { } await Promise.all(promises); - if (run.getNumberOfTests() < 1) + if (run.getNumberOfTests() < 1) { return compilationFinished( new Error("No tests exported by test case") ); + } run.it( "should compile the next step", @@ -387,6 +406,7 @@ const describeCases = config => { ); run.it = _it; run.getNumberOfTests = getNumberOfTests; + it(`${run.name} should allow to read stats`, done => { if (run.stats) { run.stats.toString({ all: true }); @@ -396,6 +416,7 @@ const describeCases = config => { }); } + // eslint-disable-next-line jest/prefer-hooks-on-top afterAll(() => { remove(tempDirectory); }); diff --git a/test/WatcherEvents.test.js b/test/WatcherEvents.test.js index fee7a7912f5..3f76ae0aa65 100644 --- a/test/WatcherEvents.test.js +++ b/test/WatcherEvents.test.js @@ -28,6 +28,7 @@ describe("WatcherEvents", () => { if (process.env.NO_WATCH_TESTS) { // eslint-disable-next-line jest/no-disabled-tests it.skip("long running tests excluded", () => {}); + return; } diff --git a/test/WebpackError.unittest.js b/test/WebpackError.unittest.js index 3b1151a1c46..19e59b59378 100644 --- a/test/WebpackError.unittest.js +++ b/test/WebpackError.unittest.js @@ -15,7 +15,7 @@ describe("WebpackError", () => { } } - it("Should provide inspect method for use by for util.inspect", () => { + it("should provide inspect method for use by for util.inspect", () => { const error = new CustomError("Message"); expect(error.toString()).toContain("CustomError: CustomMessage"); expect(error.stack).toContain(__filename); diff --git a/test/checkArrayExpectation.js b/test/checkArrayExpectation.js index 9148b753fda..d304170849f 100644 --- a/test/checkArrayExpectation.js +++ b/test/checkArrayExpectation.js @@ -1,4 +1,5 @@ "use strict"; + const fs = require("graceful-fs"); const path = require("path"); @@ -29,8 +30,9 @@ const explain = object => { value = JSON.stringify(value); } let msg = `${key} = ${value}`; - if (key !== "stack" && key !== "details" && msg.length > 100) + if (key !== "stack" && key !== "details" && msg.length > 100) { msg = `${msg.slice(0, 97)}...`; + } return msg; }) .join("; "); @@ -83,7 +85,9 @@ module.exports = function checkArrayExpectation( } if (fs.existsSync(path.join(testDirectory, `${filename}.js`))) { const expectedFilename = path.join(testDirectory, `${filename}.js`); + let expected = require(expectedFilename); + if (typeof expected === "function") { expected = expected(options); } diff --git a/test/cleverMerge.unittest.js b/test/cleverMerge.unittest.js index 16d9e0306f2..2aa991f786f 100644 --- a/test/cleverMerge.unittest.js +++ b/test/cleverMerge.unittest.js @@ -658,6 +658,7 @@ describe("cleverMerge", () => { }; for (const key of Object.keys(cases)) { const testCase = cases[key]; + it(`should merge ${key} correctly`, () => { let merged = cleverMerge(testCase[0], testCase[1]); let merged1 = cachedCleverMerge(testCase[0], testCase[1]); diff --git a/test/compareLocations.unittest.js b/test/compareLocations.unittest.js index 3c7a03d084e..b5b4d4623c5 100644 --- a/test/compareLocations.unittest.js +++ b/test/compareLocations.unittest.js @@ -1,6 +1,7 @@ "use strict"; const { compareLocations } = require("../lib/util/comparators"); + const createPosition = overrides => ({ line: 10, column: 5, diff --git a/test/compareStringsNumeric.unittest.js b/test/compareStringsNumeric.unittest.js index 061729ddfc8..aa1716adf42 100644 --- a/test/compareStringsNumeric.unittest.js +++ b/test/compareStringsNumeric.unittest.js @@ -1,4 +1,4 @@ -const { compareStringsNumeric } = require("../lib/util/comparators.js"); +const { compareStringsNumeric } = require("../lib/util/comparators"); /** * @param {string} a string @@ -85,6 +85,7 @@ describe(compareStringsNumeric.name, () => { for (const testCase of testCases) { const [a, b, expected] = testCase; + it(`returns ${expected} when comparing "${a}" to "${b}"`, () => { expect(referenceComparer(a, b)).toBe(expected); expect(compareStringsNumeric(a, b)).toBe(expected); diff --git a/test/compileBooleanMatcher.unittest.js b/test/compileBooleanMatcher.unittest.js index 7b2f1998dac..b2af43e6e6f 100644 --- a/test/compileBooleanMatcher.unittest.js +++ b/test/compileBooleanMatcher.unittest.js @@ -1,6 +1,7 @@ "use strict"; const { itemsToRegexp } = require("../lib/util/compileBooleanMatcher"); + describe("itemsToRegexp", () => { const expectCompiled = (name, input, fn) => { it(`should compile ${name}`, () => { diff --git a/test/configCases/additional-pass/simple/webpack.config.js b/test/configCases/additional-pass/simple/webpack.config.js index eb01a4b25e8..aa5d36ce56d 100644 --- a/test/configCases/additional-pass/simple/webpack.config.js +++ b/test/configCases/additional-pass/simple/webpack.config.js @@ -3,7 +3,7 @@ function testPlugin() { let counter = 1; this.hooks.compilation.tap("TestPlugin", compilation => { const nr = counter++; - compilation.hooks.needAdditionalPass.tap("TestPlugin", function () { + compilation.hooks.needAdditionalPass.tap("TestPlugin", () => { if (nr < 5) return true; }); }); diff --git a/test/configCases/asset-modules/errored/webpack.config.js b/test/configCases/asset-modules/errored/webpack.config.js index f615c96802f..febc2672cff 100644 --- a/test/configCases/asset-modules/errored/webpack.config.js +++ b/test/configCases/asset-modules/errored/webpack.config.js @@ -10,7 +10,7 @@ module.exports = { test: /\.css$/i, type: "asset/resource", generator: { - filename: () => `css/style.[contenthash].css` + filename: () => "css/style.[contenthash].css" }, use: [ { diff --git a/test/configCases/asset-modules/file-url/webpack.config.js b/test/configCases/asset-modules/file-url/webpack.config.js index 81395d57854..9536cf18b55 100644 --- a/test/configCases/asset-modules/file-url/webpack.config.js +++ b/test/configCases/asset-modules/file-url/webpack.config.js @@ -1,6 +1,7 @@ const fs = require("fs"); const path = require("path"); const { pathToFileURL } = require("url"); + const dir = path.resolve(__dirname, "temp"); const file = path.resolve(dir, "index.js"); diff --git a/test/configCases/assets/delete-asset/webpack.config.js b/test/configCases/assets/delete-asset/webpack.config.js index 8f2a1c7f2a9..e66151b3d36 100644 --- a/test/configCases/assets/delete-asset/webpack.config.js +++ b/test/configCases/assets/delete-asset/webpack.config.js @@ -36,13 +36,11 @@ module.exports = { stage: Compilation.PROCESS_ASSETS_STAGE_ANALYSE }, () => { - expect(compilation.getAsset("chunk_js.bundle0.js")).not.toBe( - undefined - ); - expect(compilation.getAsset("chunk_js.bundle0.js.map")).not.toBe( - undefined - ); - expect(compilation.getAsset("LICENSES.txt")).not.toBe(undefined); + expect(compilation.getAsset("chunk_js.bundle0.js")).toBeDefined(); + expect( + compilation.getAsset("chunk_js.bundle0.js.map") + ).toBeDefined(); + expect(compilation.getAsset("LICENSES.txt")).toBeDefined(); // TODO: terser-webpack-plugin should set related info compilation.updateAsset( "chunk_js.bundle0.js", @@ -59,17 +57,17 @@ module.exports = { } ); compilation.deleteAsset("chunk_js.bundle0.js"); - expect(compilation.getAsset("chunk_js.bundle0.js")).toBe(undefined); - expect(compilation.getAsset("chunk_js.bundle0.js.map")).toBe( - undefined - ); - expect(compilation.getAsset("chunk2_js.bundle0.js")).toBe( - undefined - ); - expect(compilation.getAsset("chunk2_js.bundle0.js.map")).toBe( - undefined - ); - expect(compilation.getAsset("LICENSES.txt")).not.toBe(undefined); + expect(compilation.getAsset("chunk_js.bundle0.js")).toBeUndefined(); + expect( + compilation.getAsset("chunk_js.bundle0.js.map") + ).toBeUndefined(); + expect( + compilation.getAsset("chunk2_js.bundle0.js") + ).toBeUndefined(); + expect( + compilation.getAsset("chunk2_js.bundle0.js.map") + ).toBeUndefined(); + expect(compilation.getAsset("LICENSES.txt")).toBeDefined(); } ); }); 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 00b452aa9ef..112fa65a2fd 100644 --- a/test/configCases/chunk-index/order-multiple-entries/webpack.config.js +++ b/test/configCases/chunk-index/order-multiple-entries/webpack.config.js @@ -110,10 +110,10 @@ module.exports = { `${i}: ${m.readableIdentifier(compilation.requestShortener)}` ) .join(", "); - expect(indices).toEqual( + expect(indices).toBe( "0: ./entry1.js, 1: ./a.js, 2: ./shared.js, 3: ./b.js, 4: ./c.js, 5: ./entry2.js, 6: ./async.js" ); - expect(indices2).toEqual( + expect(indices2).toBe( "0: ./shared.js, 1: ./a.js, 2: ./b.js, 3: ./c.js, 4: ./entry1.js, 5: ./entry2.js, 6: ./async.js" ); }); diff --git a/test/configCases/container/2-container-full/webpack.config.js b/test/configCases/container/2-container-full/webpack.config.js index 8f8dc9aac55..5f2872dc80e 100644 --- a/test/configCases/container/2-container-full/webpack.config.js +++ b/test/configCases/container/2-container-full/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/3-container-full/webpack.config.js b/test/configCases/container/3-container-full/webpack.config.js index a20051ec9af..1d38b82ba2b 100644 --- a/test/configCases/container/3-container-full/webpack.config.js +++ b/test/configCases/container/3-container-full/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require 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 cc5aa51bb95..525c2710ba0 100644 --- a/test/configCases/container/exposed-overridables/webpack.config.js +++ b/test/configCases/container/exposed-overridables/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/css/css-modules-in-node/warnings.js b/test/configCases/css/css-modules-in-node/warnings.js index 6dd56176214..0f96e43f9bf 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 @@ module.exports = require("../css-modules/warnings"); -for (const item of module.exports.slice(0, module.exports.length / 2)) + +for (const item of module.exports.slice(0, module.exports.length / 2)) { module.exports.push(item); +} diff --git a/test/configCases/css/import-module/webpack.config.js b/test/configCases/css/import-module/webpack.config.js index 06bb9ba027a..bb3e4a8ef0e 100644 --- a/test/configCases/css/import-module/webpack.config.js +++ b/test/configCases/css/import-module/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../").Configuration} */ module.exports = { plugins: [new webpack.HotModuleReplacementPlugin()], 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 fd533708688..92836b7847c 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 @@ -4,9 +4,9 @@ module.exports = { case 0: return ["test.js"]; case 1: - return ["test.js", `1/main.js`]; + return ["test.js", "1/main.js"]; case 2: - return ["test.js", `2/main.js`]; + return ["test.js", "2/main.js"]; } } }; 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 6d994ee74e7..020b694bc7f 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 @@ -70,4 +70,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/pathinfo/test.config.js b/test/configCases/css/pathinfo/test.config.js index eb641abf5f0..3ec505d4261 100644 --- a/test/configCases/css/pathinfo/test.config.js +++ b/test/configCases/css/pathinfo/test.config.js @@ -11,7 +11,7 @@ module.exports = { findBundle(i, options) { const source = fs.readFileSync( path.resolve(options.output.path, "bundle0.css"), - "utf-8" + "utf8" ); if ( diff --git a/test/configCases/custom-modules/json-custom/webpack.config.js b/test/configCases/custom-modules/json-custom/webpack.config.js index e756232dcc1..2825987f4dd 100644 --- a/test/configCases/custom-modules/json-custom/webpack.config.js +++ b/test/configCases/custom-modules/json-custom/webpack.config.js @@ -14,7 +14,8 @@ module.exports = [ /** @type {ParserOptionsByModuleTypeKnown['json']} */ parser: { parse(input) { - expect(arguments.length).toBe(1); + // eslint-disable-next-line prefer-rest-params + expect(arguments).toHaveLength(1); return toml.parse(input); } } diff --git a/test/configCases/custom-source-type/localization/webpack.config.js b/test/configCases/custom-source-type/localization/webpack.config.js index c23373fd850..24125460f83 100644 --- a/test/configCases/custom-source-type/localization/webpack.config.js +++ b/test/configCases/custom-source-type/localization/webpack.config.js @@ -150,8 +150,9 @@ module.exports = definitions.map((defs, i) => ({ /** @type {Module[]} */ const localizationModules = []; for (const module of chunkGraph.getChunkModulesIterable(chunk)) { - if (module.getSourceTypes().has("localization")) + if (module.getSourceTypes().has("localization")) { localizationModules.push(module); + } } result.push({ 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 cc78a9b6e5c..8916117ccfb 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 @@ -23,8 +23,9 @@ module.exports = { const module = /** @type {Module} */ (compilation.moduleGraph.getParentModule(dep)); - if (!module.identifier().endsWith("module.js")) + if (!module.identifier().endsWith("module.js")) { return referencedExports; + } const refModule = compilation.moduleGraph.getModule(dep); if ( refModule && 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 55d888cc030..188de505ba6 100644 --- a/test/configCases/deep-scope-analysis/remove-export/webpack.config.js +++ b/test/configCases/deep-scope-analysis/remove-export/webpack.config.js @@ -17,8 +17,9 @@ module.exports = { const module = /** @type {Module} */ (compilation.moduleGraph.getParentModule(dep)); - if (!module.identifier().endsWith("module.js")) + if (!module.identifier().endsWith("module.js")) { return referencedExports; + } const refModule = compilation.moduleGraph.getModule(dep); if ( refModule && diff --git a/test/configCases/deprecations/chunk-and-module/webpack.config.js b/test/configCases/deprecations/chunk-and-module/webpack.config.js index bc905194fdc..e6f03305abe 100644 --- a/test/configCases/deprecations/chunk-and-module/webpack.config.js +++ b/test/configCases/deprecations/chunk-and-module/webpack.config.js @@ -46,7 +46,7 @@ module.exports = { ).toMatch(/should compile with deprecations/); expect(m.hash).toMatch(/^[0-9a-f]{32}$/); expect(m.renderedHash).toMatch(/^[0-9a-f]{20}$/); - expect(m.profile).toBe(undefined); + expect(m.profile).toBeUndefined(); expect(m.index).toBe(0); m.index = 1000; expect(m.index).toBe(1000); @@ -56,7 +56,7 @@ module.exports = { expect(m.depth).toBe(0); m.depth = 1000; expect(m.depth).toBe(1000); - expect(m.issuer).toBe(null); + expect(m.issuer).toBeNull(); m.issuer = module; expect(m.issuer).toBe(module); expect( diff --git a/test/configCases/deprecations/chunk-files/webpack.config.js b/test/configCases/deprecations/chunk-files/webpack.config.js index b393f4cfbc2..13381c8085b 100644 --- a/test/configCases/deprecations/chunk-files/webpack.config.js +++ b/test/configCases/deprecations/chunk-files/webpack.config.js @@ -8,11 +8,15 @@ module.exports = { /** @type {{ files: string[] } & import("../../../../").Chunk} */ ( c ); - expect(chunk.files.length).toBe(chunk.files.size); + expect(chunk.files).toHaveLength(chunk.files.size); expect(chunk.files[0]).toBe(Array.from(chunk.files)[0]); expect(chunk.files.join(",")).toBe(Array.from(chunk.files).join(",")); - expect(() => (chunk.files.length = 0)).toThrow(); - expect(() => chunk.files.pop()).toThrow(); + expect(() => (chunk.files.length = 0)).toThrow( + /chunk\.files was changed from Array to Set \(writing to Array property 'length' is not possible\)/ + ); + expect(() => chunk.files.pop()).toThrow( + /chunk\.files was changed from Array to Set \(using Array method 'pop' is not possible\)/ + ); chunk.files.push("test.js"); expect(chunk.files).toContain("test.js"); chunk.files.delete("test.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 994b605b471..6c71cfb80c0 100644 --- a/test/configCases/entry/adding-multiple-entry-points/webpack.config.js +++ b/test/configCases/entry/adding-multiple-entry-points/webpack.config.js @@ -1,4 +1,5 @@ const EntryPlugin = require("../../../../").EntryPlugin; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: () => ({}), 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 9799f5c71a8..e832f4a8c16 100644 --- a/test/configCases/errors/multi-entry-missing-module/webpack.config.js +++ b/test/configCases/errors/multi-entry-missing-module/webpack.config.js @@ -1,4 +1,5 @@ const IgnorePlugin = require("../../../../").IgnorePlugin; + /** @type {import("../../../../").Configuration} */ module.exports = { entry: { diff --git a/test/configCases/externals/externals-array/webpack.config.js b/test/configCases/externals/externals-array/webpack.config.js index 3c4de33bf9e..e33673e334b 100644 --- a/test/configCases/externals/externals-array/webpack.config.js +++ b/test/configCases/externals/externals-array/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { 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 119fba2ec7d..6014360c8ad 100644 --- a/test/configCases/externals/non-amd-externals-amd/webpack.config.js +++ b/test/configCases/externals/non-amd-externals-amd/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/externals/resolve-callback/webpack.config.js b/test/configCases/externals/resolve-callback/webpack.config.js index 9769d7f9bad..6590f004090 100644 --- a/test/configCases/externals/resolve-callback/webpack.config.js +++ b/test/configCases/externals/resolve-callback/webpack.config.js @@ -28,12 +28,15 @@ module.exports = { resolve(context, request, callback); } else { resolve(context, request, (err, resolved, resolveRequest) => { - if (err) callback(err); - else if ( + if (err) { + callback(err); + } else if ( resolved !== /** @type {ResolveRequest} */ (resolveRequest).path - ) + ) { callback(new Error("Error")); - else callback(null, `var ${JSON.stringify(resolved)}`); + } else { + callback(null, `var ${JSON.stringify(resolved)}`); + } }); } } diff --git a/test/configCases/finish-modules/simple/webpack.config.js b/test/configCases/finish-modules/simple/webpack.config.js index 2d9b3ad2b3b..0b14696c4c4 100644 --- a/test/configCases/finish-modules/simple/webpack.config.js +++ b/test/configCases/finish-modules/simple/webpack.config.js @@ -5,7 +5,7 @@ function testPlugin() { this.hooks.compilation.tap("TestPlugin", compilation => { compilation.hooks.finishModules.tapAsync( "TestPlugin", - function (_modules, callback) { + (_modules, callback) => { callback(); } ); diff --git a/test/configCases/hash-length/output-filename/test.config.js b/test/configCases/hash-length/output-filename/test.config.js index 096bd9c3548..63519c2815b 100644 --- a/test/configCases/hash-length/output-filename/test.config.js +++ b/test/configCases/hash-length/output-filename/test.config.js @@ -1,7 +1,7 @@ const fs = require("fs"); const findFile = (files, regex) => - files.find(function (file) { + files.find(file => { if (regex.test(file)) { return true; } diff --git a/test/configCases/inner-graph/altaskitButton/webpack.config.js b/test/configCases/inner-graph/altaskitButton/webpack.config.js index 080c4be2894..0855084e75c 100644 --- a/test/configCases/inner-graph/altaskitButton/webpack.config.js +++ b/test/configCases/inner-graph/altaskitButton/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/basic/webpack.config.js b/test/configCases/inner-graph/basic/webpack.config.js index 3c720109f98..5afb924300a 100644 --- a/test/configCases/inner-graph/basic/webpack.config.js +++ b/test/configCases/inner-graph/basic/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/blockScopes/webpack.config.js b/test/configCases/inner-graph/blockScopes/webpack.config.js index 6df8a488b0b..192562029d4 100644 --- a/test/configCases/inner-graph/blockScopes/webpack.config.js +++ b/test/configCases/inner-graph/blockScopes/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/class/webpack.config.js b/test/configCases/inner-graph/class/webpack.config.js index ae7268a990e..8b9ff9c9785 100644 --- a/test/configCases/inner-graph/class/webpack.config.js +++ b/test/configCases/inner-graph/class/webpack.config.js @@ -1,5 +1,7 @@ const createTestCases = require("../_helpers/createTestCases"); + const base = ["getNameA", "getNameB"]; + module.exports = createTestCases({ nothing: { usedExports: [], @@ -43,7 +45,6 @@ module.exports = createTestCases({ "./assert": [...base, "definiteEqual"] } }, - // eslint-disable-next-line camelcase ExportCls1_2: { usedExports: ["ExportCls1", "ExportCls2"], expect: { diff --git a/test/configCases/inner-graph/const/webpack.config.js b/test/configCases/inner-graph/const/webpack.config.js index a8a883d5302..2500b9980fd 100644 --- a/test/configCases/inner-graph/const/webpack.config.js +++ b/test/configCases/inner-graph/const/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/defaultArrow/webpack.config.js b/test/configCases/inner-graph/defaultArrow/webpack.config.js index d72974a17c1..1f88aa09da1 100644 --- a/test/configCases/inner-graph/defaultArrow/webpack.config.js +++ b/test/configCases/inner-graph/defaultArrow/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/defaultClass/webpack.config.js b/test/configCases/inner-graph/defaultClass/webpack.config.js index 1964d420598..25bbfa8dc80 100644 --- a/test/configCases/inner-graph/defaultClass/webpack.config.js +++ b/test/configCases/inner-graph/defaultClass/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/defaultExpression/webpack.config.js b/test/configCases/inner-graph/defaultExpression/webpack.config.js index 55deb757e9e..a1310655931 100644 --- a/test/configCases/inner-graph/defaultExpression/webpack.config.js +++ b/test/configCases/inner-graph/defaultExpression/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/defaultFunction/webpack.config.js b/test/configCases/inner-graph/defaultFunction/webpack.config.js index d6b1ee12a9f..8fbe41b2fa8 100644 --- a/test/configCases/inner-graph/defaultFunction/webpack.config.js +++ b/test/configCases/inner-graph/defaultFunction/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/defaultFunctionExpression/webpack.config.js b/test/configCases/inner-graph/defaultFunctionExpression/webpack.config.js index d6b1ee12a9f..8fbe41b2fa8 100644 --- a/test/configCases/inner-graph/defaultFunctionExpression/webpack.config.js +++ b/test/configCases/inner-graph/defaultFunctionExpression/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/defaultId/webpack.config.js b/test/configCases/inner-graph/defaultId/webpack.config.js index d6b1ee12a9f..8fbe41b2fa8 100644 --- a/test/configCases/inner-graph/defaultId/webpack.config.js +++ b/test/configCases/inner-graph/defaultId/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/defaultNamedFunction/webpack.config.js b/test/configCases/inner-graph/defaultNamedFunction/webpack.config.js index d6b1ee12a9f..8fbe41b2fa8 100644 --- a/test/configCases/inner-graph/defaultNamedFunction/webpack.config.js +++ b/test/configCases/inner-graph/defaultNamedFunction/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/defaultNamedFunctionExpression/webpack.config.js b/test/configCases/inner-graph/defaultNamedFunctionExpression/webpack.config.js index d6b1ee12a9f..8fbe41b2fa8 100644 --- a/test/configCases/inner-graph/defaultNamedFunctionExpression/webpack.config.js +++ b/test/configCases/inner-graph/defaultNamedFunctionExpression/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/eval-bailout/webpack.config.js b/test/configCases/inner-graph/eval-bailout/webpack.config.js index 5953593079c..92a87dd7d08 100644 --- a/test/configCases/inner-graph/eval-bailout/webpack.config.js +++ b/test/configCases/inner-graph/eval-bailout/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/export/webpack.config.js b/test/configCases/inner-graph/export/webpack.config.js index f4530e5b190..72e7846c297 100644 --- a/test/configCases/inner-graph/export/webpack.config.js +++ b/test/configCases/inner-graph/export/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/importAll/webpack.config.js b/test/configCases/inner-graph/importAll/webpack.config.js index ef8c4392478..56826cc2b4b 100644 --- a/test/configCases/inner-graph/importAll/webpack.config.js +++ b/test/configCases/inner-graph/importAll/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/issue-11678/webpack.config.js b/test/configCases/inner-graph/issue-11678/webpack.config.js index b66e005aac9..400bb0b6812 100644 --- a/test/configCases/inner-graph/issue-11678/webpack.config.js +++ b/test/configCases/inner-graph/issue-11678/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], 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 f5364e386fa..879caaf7f9f 100644 --- a/test/configCases/inner-graph/issue-12669-mini/webpack.config.js +++ b/test/configCases/inner-graph/issue-12669-mini/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ // nothing: { // usedExports: [], diff --git a/test/configCases/inner-graph/issue-12669/webpack.config.js b/test/configCases/inner-graph/issue-12669/webpack.config.js index b9335c2ce7d..735f61d3f64 100644 --- a/test/configCases/inner-graph/issue-12669/webpack.config.js +++ b/test/configCases/inner-graph/issue-12669/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/localReference/webpack.config.js b/test/configCases/inner-graph/localReference/webpack.config.js index 6701f76bd6a..030ae45e0a1 100644 --- a/test/configCases/inner-graph/localReference/webpack.config.js +++ b/test/configCases/inner-graph/localReference/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/nested/webpack.config.js b/test/configCases/inner-graph/nested/webpack.config.js index 97e70b336d1..86ac4f223a1 100644 --- a/test/configCases/inner-graph/nested/webpack.config.js +++ b/test/configCases/inner-graph/nested/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/pure/webpack.config.js b/test/configCases/inner-graph/pure/webpack.config.js index 91ec83d9fa1..ee9fe7e3352 100644 --- a/test/configCases/inner-graph/pure/webpack.config.js +++ b/test/configCases/inner-graph/pure/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/ramdaIdentical/webpack.config.js b/test/configCases/inner-graph/ramdaIdentical/webpack.config.js index 788a7716c0d..902433dda9d 100644 --- a/test/configCases/inner-graph/ramdaIdentical/webpack.config.js +++ b/test/configCases/inner-graph/ramdaIdentical/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/specifier/webpack.config.js b/test/configCases/inner-graph/specifier/webpack.config.js index 9fe4669e9b3..aab43f7f1be 100644 --- a/test/configCases/inner-graph/specifier/webpack.config.js +++ b/test/configCases/inner-graph/specifier/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/inner-graph/varWritten/webpack.config.js b/test/configCases/inner-graph/varWritten/webpack.config.js index 2ba36d9465b..38f2876301e 100644 --- a/test/configCases/inner-graph/varWritten/webpack.config.js +++ b/test/configCases/inner-graph/varWritten/webpack.config.js @@ -1,4 +1,5 @@ const createTestCases = require("../_helpers/createTestCases"); + module.exports = createTestCases({ nothing: { usedExports: [], diff --git a/test/configCases/issues/issue-3596/webpack.config.js b/test/configCases/issues/issue-3596/webpack.config.js index 61b66c9adb4..c2d76a5e05d 100644 --- a/test/configCases/issues/issue-3596/webpack.config.js +++ b/test/configCases/issues/issue-3596/webpack.config.js @@ -9,8 +9,8 @@ module.exports = { }, plugins: [ function () { - this.hooks.compilation.tap("TestPlugin", function (compilation) { - compilation.hooks.processAssets.tap("TestPlugin", function (assets) { + this.hooks.compilation.tap("TestPlugin", compilation => { + compilation.hooks.processAssets.tap("TestPlugin", assets => { 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 9c85373c1d7..8199264de73 100644 --- a/test/configCases/issues/issue-7563/test.config.js +++ b/test/configCases/issues/issue-7563/test.config.js @@ -5,9 +5,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(function (file) { - return regex.test(file); - }); + const bundle = files.find(file => regex.test(file)); if (!bundle) { throw new Error( 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 f30bcbf867b..1b640981249 100644 --- a/test/configCases/json/top-level-json-parser/webpack.config.js +++ b/test/configCases/json/top-level-json-parser/webpack.config.js @@ -8,7 +8,8 @@ module.exports = [ parser: { json: { parse(input) { - expect(arguments.length).toBe(1); + // eslint-disable-next-line prefer-rest-params + expect(arguments).toHaveLength(1); return toml.parse(input); } } diff --git a/test/configCases/library/disable-provided-export/webpack.config.js b/test/configCases/library/disable-provided-export/webpack.config.js index dafe4231bf2..235c0a2de0e 100644 --- a/test/configCases/library/disable-provided-export/webpack.config.js +++ b/test/configCases/library/disable-provided-export/webpack.config.js @@ -74,8 +74,8 @@ module.exports = [ expect( compiler.hooks.compilation.taps.filter( tap => tap.name === "FlagDependencyExportsPlugin" - ).length - ).toBe(1); + ) + ).toHaveLength(1); } ); } 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 30d47118b59..226726b9397 100644 --- a/test/configCases/loaders-and-plugins-falsy/basic/webpack.config.js +++ b/test/configCases/loaders-and-plugins-falsy/basic/webpack.config.js @@ -13,8 +13,6 @@ class FailPlugin { } class TestChildCompilationPlugin { - constructor() {} - /** * @param {TODO} compiler compiler */ diff --git a/test/configCases/loaders/hot-in-context/webpack.config.js b/test/configCases/loaders/hot-in-context/webpack.config.js index d4d85f9d80f..322b76c0fbb 100644 --- a/test/configCases/loaders/hot-in-context/webpack.config.js +++ b/test/configCases/loaders/hot-in-context/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../").Configuration[]} */ module.exports = [ { diff --git a/test/configCases/loaders/pr-14384/webpack.config.js b/test/configCases/loaders/pr-14384/webpack.config.js index edf691513a7..a8faf09f3ac 100644 --- a/test/configCases/loaders/pr-14384/webpack.config.js +++ b/test/configCases/loaders/pr-14384/webpack.config.js @@ -1,4 +1,4 @@ -const PluginWithLoader = require("./PluginWithLoader.js"); +const PluginWithLoader = require("./PluginWithLoader"); /** @type {import("../../../../").Configuration} */ module.exports = { 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 8f2404a0cd6..80d543f7851 100644 --- a/test/configCases/mangle/mangle-with-object-prop/webpack.config.js +++ b/test/configCases/mangle/mangle-with-object-prop/webpack.config.js @@ -1,4 +1,5 @@ const { DefinePlugin } = require("../../../../"); + /** @type {import("../../../../").Configuration} */ module.exports = [ { diff --git a/test/configCases/module/circular-externals/webpack.config.js b/test/configCases/module/circular-externals/webpack.config.js index 4d111f5883b..bbc92fd4361 100644 --- a/test/configCases/module/circular-externals/webpack.config.js +++ b/test/configCases/module/circular-externals/webpack.config.js @@ -39,11 +39,11 @@ module.exports = { // Read the external module files const externalA = fs.readFileSync( path.join(__dirname, "external-a.mjs"), - "utf-8" + "utf8" ); const externalB = fs.readFileSync( path.join(__dirname, "external-b.mjs"), - "utf-8" + "utf8" ); // Emit them as assets diff --git a/test/configCases/optimization/chunk/webpack.config.js b/test/configCases/optimization/chunk/webpack.config.js index 35b1f3a3245..e47672c7448 100644 --- a/test/configCases/optimization/chunk/webpack.config.js +++ b/test/configCases/optimization/chunk/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { diff --git a/test/configCases/output-module/reuse-webpack-esm-library/webpack.config.js b/test/configCases/output-module/reuse-webpack-esm-library/webpack.config.js index 8d969d27bc5..714354b809d 100644 --- a/test/configCases/output-module/reuse-webpack-esm-library/webpack.config.js +++ b/test/configCases/output-module/reuse-webpack-esm-library/webpack.config.js @@ -1,4 +1,5 @@ const path = require("path"); + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", diff --git a/test/configCases/parsing/bom/test.config.js b/test/configCases/parsing/bom/test.config.js index 4fbd9f6b51e..cceab964383 100644 --- a/test/configCases/parsing/bom/test.config.js +++ b/test/configCases/parsing/bom/test.config.js @@ -8,7 +8,7 @@ module.exports = { for (const file of files) { const filename = path.resolve(outputPath, file); - const source = fs.readFileSync(filename, "utf-8"); + const source = fs.readFileSync(filename, "utf8"); switch (file) { case "resource-with-bom.ext": { diff --git a/test/configCases/parsing/dead-code-elimination/test.config.js b/test/configCases/parsing/dead-code-elimination/test.config.js index ec5cd05981f..69937cfcbe4 100644 --- a/test/configCases/parsing/dead-code-elimination/test.config.js +++ b/test/configCases/parsing/dead-code-elimination/test.config.js @@ -1,5 +1,5 @@ module.exports = { findBundle() { - return ["test.js", `bundle0.js`]; + return ["test.js", "bundle0.js"]; } }; diff --git a/test/configCases/plugins/define-plugin/webpack.config.js b/test/configCases/plugins/define-plugin/webpack.config.js index 4927a4370ce..ae2f326a586 100644 --- a/test/configCases/plugins/define-plugin/webpack.config.js +++ b/test/configCases/plugins/define-plugin/webpack.config.js @@ -54,9 +54,7 @@ module.exports = { wurst: "suppe", suppe: "wurst", RUNTIMEVALUE_CALLBACK_ARGUMENT_IS_A_MODULE: DefinePlugin.runtimeValue( - function ({ module }) { - return module instanceof Module; - } + ({ module }) => module instanceof Module ), A_DOT_J: '"a.j"', OBJECT2: { diff --git a/test/configCases/plugins/profiling-plugin/webpack.config.js b/test/configCases/plugins/profiling-plugin/webpack.config.js index b6c457e47e5..07035fd7374 100644 --- a/test/configCases/plugins/profiling-plugin/webpack.config.js +++ b/test/configCases/plugins/profiling-plugin/webpack.config.js @@ -1,4 +1,5 @@ const rootPath = "../../../../"; + const webpack = require(rootPath); const path = require("path"); diff --git a/test/configCases/plugins/progress-plugin/test.config.js b/test/configCases/plugins/progress-plugin/test.config.js index 67135d9ebe1..57d3499a591 100644 --- a/test/configCases/plugins/progress-plugin/test.config.js +++ b/test/configCases/plugins/progress-plugin/test.config.js @@ -3,6 +3,6 @@ const path = require("path"); module.exports = { // sharing global require cache between webpack.config.js and testing file modules: { - [path.resolve(__dirname, "data.js")]: require("./data.js") + [path.resolve(__dirname, "data.js")]: require("./data") } }; diff --git a/test/configCases/plugins/provide-plugin/webpack.config.js b/test/configCases/plugins/provide-plugin/webpack.config.js index 83866bd78ee..877c451c9bd 100644 --- a/test/configCases/plugins/provide-plugin/webpack.config.js +++ b/test/configCases/plugins/provide-plugin/webpack.config.js @@ -8,15 +8,11 @@ module.exports = { "bbb.ccc": "./bbbccc", dddeeefff: ["./ddd", "eee", "3-f"], aa1: ["./a", "c", "cube"], - // eslint-disable-next-line camelcase es2015_aUsed: ["./harmony2", "aUsed"], "process.env.NODE_ENV": "./env", es2015: "./harmony", - // eslint-disable-next-line camelcase es2015_name: ["./harmony", "default"], - // eslint-disable-next-line camelcase es2015_alias: ["./harmony", "alias"], - // eslint-disable-next-line camelcase es2015_year: ["./harmony", "year"], "this.aaa": "./aaa", esm: "./esm.js" diff --git a/test/configCases/plugins/terser-plugin/webpack.config.js b/test/configCases/plugins/terser-plugin/webpack.config.js index 4b42cbf3117..e7717a60588 100644 --- a/test/configCases/plugins/terser-plugin/webpack.config.js +++ b/test/configCases/plugins/terser-plugin/webpack.config.js @@ -1,4 +1,5 @@ const TerserPlugin = require("terser-webpack-plugin"); + /** @type {import("../../../../").Configuration} */ module.exports = { node: { diff --git a/test/configCases/plugins/virtual-url-plugin/webpack.config.js b/test/configCases/plugins/virtual-url-plugin/webpack.config.js index 9adad4bb103..c14c93fee40 100644 --- a/test/configCases/plugins/virtual-url-plugin/webpack.config.js +++ b/test/configCases/plugins/virtual-url-plugin/webpack.config.js @@ -1,6 +1,7 @@ const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); + const { VirtualUrlPlugin } = webpack.experiments.schemes; const watchDir = path.join(__dirname, "./routes"); @@ -14,14 +15,14 @@ const config = { return ` export const routes = { ${files.map(key => `${key.split(".")[0]}: () => import('./routes/${key}')`).join(",\n")} - } + } `; }, app: "export const app = 'app'", config: { type: ".json", source() { - return `{"name": "virtual-url-plugin"}`; + return '{"name": "virtual-url-plugin"}'; } }, ts: { @@ -36,13 +37,13 @@ const config = { style: { type: ".css", source() { - return `body{background-color: powderblue;}`; + return "body{background-color: powderblue;}"; } }, txt: { type: ".txt", source() { - return `Hello world`; + return "Hello world"; } } }) diff --git a/test/configCases/process-assets/html-plugin/webpack.config.js b/test/configCases/process-assets/html-plugin/webpack.config.js index 041ae9b9e74..e7d0b991a17 100644 --- a/test/configCases/process-assets/html-plugin/webpack.config.js +++ b/test/configCases/process-assets/html-plugin/webpack.config.js @@ -68,8 +68,9 @@ class HtmlPlugin { for (const name of this.entrypoints) { for (const file of /** @type {Entrypoint} */ ( compilation.entrypoints.get(name) - ).getFiles()) + ).getFiles()) { files.push(file); + } } /** * @param {string} file file @@ -151,8 +152,9 @@ class HtmlInlinePlugin { let match = regExp.exec(content); while (match) { let url = match[1]; - if (url.startsWith(publicPath)) + if (url.startsWith(publicPath)) { url = url.slice(publicPath.length); + } if (this.inline.test(url)) { const asset = /** @type {Asset} */ ( compilation.getAsset(url) diff --git a/test/configCases/rebuild/finishModules/webpack.config.js b/test/configCases/rebuild/finishModules/webpack.config.js index 36aba8d5c7f..ef36cedc15a 100644 --- a/test/configCases/rebuild/finishModules/webpack.config.js +++ b/test/configCases/rebuild/finishModules/webpack.config.js @@ -20,7 +20,7 @@ const testPlugin = compiler => { ); compilation.hooks.finishModules.tapAsync( "TestPlugin", - function (modules, callback) { + (modules, callback) => { const src = resolve(join(__dirname, "other-file.js")); /** @@ -45,8 +45,9 @@ const testPlugin = compiler => { if ( /** @type {NonNullable} */ (module.buildInfo)._isReplaced - ) + ) { return callback(); + } shouldReplace = true; compilation.rebuildModule(module, err => { diff --git a/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js b/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js index f881d5fb68c..54c5c48cb2b 100644 --- a/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js +++ b/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js @@ -18,7 +18,7 @@ const testPlugin = compiler => { ); compilation.hooks.finishModules.tapAsync( "TestPlugin", - function (modules, callback) { + (modules, callback) => { const src = resolve(join(__dirname, "a.js")); /** @@ -43,8 +43,9 @@ const testPlugin = compiler => { if ( /** @type {NonNullable} */ (module.buildInfo)._isReplaced - ) + ) { return callback(); + } shouldReplace = true; compilation.rebuildModule(module, err => { diff --git a/test/configCases/resolve/fallback/webpack.config.js b/test/configCases/resolve/fallback/webpack.config.js index 65417c326c0..8c173e91a83 100644 --- a/test/configCases/resolve/fallback/webpack.config.js +++ b/test/configCases/resolve/fallback/webpack.config.js @@ -1,4 +1,5 @@ const path = require("path"); + /** @type {import("../../../../").Configuration} */ module.exports = { resolve: { diff --git a/test/configCases/resolve/multi-alias/webpack.config.js b/test/configCases/resolve/multi-alias/webpack.config.js index 5d07a13869c..5ba1fdc2c47 100644 --- a/test/configCases/resolve/multi-alias/webpack.config.js +++ b/test/configCases/resolve/multi-alias/webpack.config.js @@ -1,4 +1,5 @@ const path = require("path"); + /** @type {import("../../../../").Configuration} */ module.exports = { resolve: { diff --git a/test/configCases/resolve/only-module/webpack.config.js b/test/configCases/resolve/only-module/webpack.config.js index f5e18d67593..2b59831e34e 100644 --- a/test/configCases/resolve/only-module/webpack.config.js +++ b/test/configCases/resolve/only-module/webpack.config.js @@ -1,4 +1,5 @@ const path = require("path"); + /** @type {import("../../../../").Configuration} */ module.exports = { resolve: { diff --git a/test/configCases/resolving/prefer-absolute/webpack.config.js b/test/configCases/resolving/prefer-absolute/webpack.config.js index 4e6a640257b..9d5b634248a 100644 --- a/test/configCases/resolving/prefer-absolute/webpack.config.js +++ b/test/configCases/resolving/prefer-absolute/webpack.config.js @@ -24,8 +24,9 @@ module.exports = { /** @type {string} */ (request.path) ) - ) + ) { throw new Error("Trying to resolve as root path"); + } }); } } diff --git a/test/configCases/resolving/prefer-root/webpack.config.js b/test/configCases/resolving/prefer-root/webpack.config.js index a7ad545c248..36a2fd09e35 100644 --- a/test/configCases/resolving/prefer-root/webpack.config.js +++ b/test/configCases/resolving/prefer-root/webpack.config.js @@ -17,8 +17,9 @@ module.exports = { */ apply(resolver) { resolver.hooks.file.tap("Test", (request, resolverContext) => { - if (request.path === "/index.js") + if (request.path === "/index.js") { throw new Error("Trying to resolve as absolute path"); + } }); } } 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 0107f584d06..71a4dca42a1 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 @@ -3,11 +3,12 @@ * @returns {EXPECTED_FUNCTION[]} functions */ function createFunctionArrayFromUseArray(useArray) { - return useArray.map(function (useItem) { - return function () { - return useItem; - }; - }); + return useArray.map( + useItem => + function () { + return useItem; + } + ); } const useArray = createFunctionArrayFromUseArray([ 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 71ab80f7796..d148e12b7ec 100644 --- a/test/configCases/sharing/consume-module-ignore-warnings/webpack.config.js +++ b/test/configCases/sharing/consume-module-ignore-warnings/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require const { ConsumeSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/sharing/consume-module/webpack.config.js b/test/configCases/sharing/consume-module/webpack.config.js index a7db1fca485..37a3c42901c 100644 --- a/test/configCases/sharing/consume-module/webpack.config.js +++ b/test/configCases/sharing/consume-module/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require 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 56d463786f4..59376be223b 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,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require 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 2a435c43f35..2ca3aaa9d5e 100644 --- a/test/configCases/sharing/consume-multiple-versions/webpack.config.js +++ b/test/configCases/sharing/consume-multiple-versions/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require 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 fc3d79631be..a6ece7dd9fb 100644 --- a/test/configCases/sharing/consume-self-reference/webpack.config.js +++ b/test/configCases/sharing/consume-self-reference/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require 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 1752fcbb876..c626d7a5bec 100644 --- a/test/configCases/sharing/no-override-loaded/webpack.config.js +++ b/test/configCases/sharing/no-override-loaded/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require 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 fcdb7b81417..e8e02441d98 100644 --- a/test/configCases/sharing/provide-eager-module/webpack.config.js +++ b/test/configCases/sharing/provide-eager-module/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require 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 5d677e5f339..14383b0b771 100644 --- a/test/configCases/sharing/provide-module/webpack.config.js +++ b/test/configCases/sharing/provide-module/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require 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 797c44ffba6..59fcca431d1 100644 --- a/test/configCases/sharing/provide-multiple-versions/webpack.config.js +++ b/test/configCases/sharing/provide-multiple-versions/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require const { ProvideSharedPlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ 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 2fbf17772ea..3bd7b407fec 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,4 +1,5 @@ const { ProvideSharedPlugin } = require("../../../../").sharing; + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/sharing/share-multiple-versions/webpack.config.js b/test/configCases/sharing/share-multiple-versions/webpack.config.js index 5e2b9102f8c..a138c884c31 100644 --- a/test/configCases/sharing/share-multiple-versions/webpack.config.js +++ b/test/configCases/sharing/share-multiple-versions/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require 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 824b0358f57..58de7a92b51 100644 --- a/test/configCases/sharing/share-plugin-dual-mode/webpack.config.js +++ b/test/configCases/sharing/share-plugin-dual-mode/webpack.config.js @@ -1,14 +1,13 @@ -// eslint-disable-next-line n/no-unpublished-require +const path = require("path"); const { SharePlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ module.exports = { - context: `${__dirname}/cjs`, + context: path.resolve(__dirname, "./cjs"), plugins: [ new SharePlugin({ shared: { lib: {}, - // eslint-disable-next-line camelcase transitive_lib: {} } }) diff --git a/test/configCases/sharing/share-plugin-monorepo/webpack.config.js b/test/configCases/sharing/share-plugin-monorepo/webpack.config.js index 74c3e8ad25e..102015e980f 100644 --- a/test/configCases/sharing/share-plugin-monorepo/webpack.config.js +++ b/test/configCases/sharing/share-plugin-monorepo/webpack.config.js @@ -1,9 +1,9 @@ -// eslint-disable-next-line n/no-unpublished-require +const path = require("path"); const { SharePlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ module.exports = { - context: `${__dirname}/app1`, + context: path.resolve(__dirname, "./app1"), plugins: [ new SharePlugin({ shared: { diff --git a/test/configCases/sharing/share-plugin/webpack.config.js b/test/configCases/sharing/share-plugin/webpack.config.js index 562630b8e50..89ca53ad7ab 100644 --- a/test/configCases/sharing/share-plugin/webpack.config.js +++ b/test/configCases/sharing/share-plugin/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require const { SharePlugin } = require("../../../../").sharing; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/side-effects/issue-13063/webpack.config.js b/test/configCases/side-effects/issue-13063/webpack.config.js index 3c7e013a497..e0ae0496602 100644 --- a/test/configCases/side-effects/issue-13063/webpack.config.js +++ b/test/configCases/side-effects/issue-13063/webpack.config.js @@ -1,8 +1,6 @@ module.exports = { entry: { - // eslint-disable-next-line camelcase tst_examples_uiform: "./tst_examples_uiform", - // eslint-disable-next-line camelcase tst_examples_uitable: "./tst_examples_uitable", another: "./another" }, 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 8270d622097..1f868402b50 100644 --- a/test/configCases/side-effects/side-effects-override/webpack.config.js +++ b/test/configCases/side-effects/side-effects-override/webpack.config.js @@ -1,4 +1,5 @@ const path = require("path"); + /** @type {import("../../../../").Configuration} */ module.exports = { mode: "production", 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 954cbe9dc67..b16d93f68cd 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 @@ -2,8 +2,6 @@ /** @typedef {import("../../../../").NormalModule} NormalModule */ class ReorderModulesPlugin { - constructor() {} - /** * @param {Compiler} compiler compiler */ 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 6ccf9011e2b..92592515cff 100644 --- a/test/configCases/source-map/no-source-map/webpack.config.js +++ b/test/configCases/source-map/no-source-map/webpack.config.js @@ -7,7 +7,7 @@ const plugins = [ for (const asset of compilation.getAssets()) { const result = asset.source.sourceAndMap(); try { - expect(result.map).toBe(null); + expect(result.map).toBeNull(); } catch (_err) { const err = /** @type {Error} */ (_err); err.message += `\nfor asset ${asset.name}`; diff --git a/test/configCases/split-chunks/asnyc-entries/test.filter.js b/test/configCases/split-chunks/asnyc-entries/test.filter.js index ebb72dc3601..f74eb03f05a 100644 --- a/test/configCases/split-chunks/asnyc-entries/test.filter.js +++ b/test/configCases/split-chunks/asnyc-entries/test.filter.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line n/no-unpublished-require const supportsWorker = require("../../../helpers/supportsWorker"); module.exports = function (config) { diff --git a/test/configCases/target/amd-container-named/webpack.config.js b/test/configCases/target/amd-container-named/webpack.config.js index d44fc56132b..a77d26e8630 100644 --- a/test/configCases/target/amd-container-named/webpack.config.js +++ b/test/configCases/target/amd-container-named/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../types").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/amd-container-require/webpack.config.js b/test/configCases/target/amd-container-require/webpack.config.js index 1d219007109..74ea04edd02 100644 --- a/test/configCases/target/amd-container-require/webpack.config.js +++ b/test/configCases/target/amd-container-require/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../types").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/amd-container-unnamed/webpack.config.js b/test/configCases/target/amd-container-unnamed/webpack.config.js index 6f82e5e8f4d..6a9b47fc534 100644 --- a/test/configCases/target/amd-container-unnamed/webpack.config.js +++ b/test/configCases/target/amd-container-unnamed/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../types").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/amd-named/webpack.config.js b/test/configCases/target/amd-named/webpack.config.js index 42614650312..5f67e29272c 100644 --- a/test/configCases/target/amd-named/webpack.config.js +++ b/test/configCases/target/amd-named/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/amd-require/webpack.config.js b/test/configCases/target/amd-require/webpack.config.js index a280fb2a029..968ab6b0bb3 100644 --- a/test/configCases/target/amd-require/webpack.config.js +++ b/test/configCases/target/amd-require/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../").Configuration} */ module.exports = { output: { diff --git a/test/configCases/target/amd-unnamed/webpack.config.js b/test/configCases/target/amd-unnamed/webpack.config.js index 25015e61039..0569a4488f4 100644 --- a/test/configCases/target/amd-unnamed/webpack.config.js +++ b/test/configCases/target/amd-unnamed/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @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 58f6db92ea2..ad31a215df0 100644 --- a/test/configCases/target/system-named-assets-path/test.config.js +++ b/test/configCases/target/system-named-assets-path/test.config.js @@ -1,4 +1,5 @@ const System = require("../../../helpers/fakeSystem"); + module.exports = { beforeExecute: () => { System.init(); diff --git a/test/configCases/umd/issue-15545/test.config.js b/test/configCases/umd/issue-15545/test.config.js index edc0b991968..2b00586a46d 100644 --- a/test/configCases/umd/issue-15545/test.config.js +++ b/test/configCases/umd/issue-15545/test.config.js @@ -1,4 +1,5 @@ const CONTEXT = {}; + module.exports = { nonEsmThis(module) { return CONTEXT; diff --git a/test/configCases/web/nonce/webpack.config.js b/test/configCases/web/nonce/webpack.config.js index eea796e3042..b034ef3c8d2 100644 --- a/test/configCases/web/nonce/webpack.config.js +++ b/test/configCases/web/nonce/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require("../../../../"); + /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", diff --git a/test/deterministicGrouping.unittest.js b/test/deterministicGrouping.unittest.js index ffe68c73559..3f36da343f3 100644 --- a/test/deterministicGrouping.unittest.js +++ b/test/deterministicGrouping.unittest.js @@ -9,6 +9,7 @@ describe("deterministicGrouping", () => { getKey: ([key]) => `${100000 + key}`, getSize: ([, size]) => size }).map(group => ({ items: group.items.map(([i]) => i), size: group.size })); + it("should split large chunks with different size types", () => { expect( group( @@ -45,6 +46,7 @@ describe("deterministicGrouping", () => { ] `); }); + it("should separate items with different size types when unsplittable", () => { expect( group( @@ -105,6 +107,7 @@ describe("deterministicGrouping", () => { ] `); }); + it("should handle entangled size types (case 1)", () => { expect( group( @@ -141,6 +144,7 @@ describe("deterministicGrouping", () => { ] `); }); + it("should handle entangled size types (case 2)", () => { expect( group( diff --git a/test/extractUrlAndGlobal.unittest.js b/test/extractUrlAndGlobal.unittest.js index c57b6289dc2..4c7eb7683aa 100644 --- a/test/extractUrlAndGlobal.unittest.js +++ b/test/extractUrlAndGlobal.unittest.js @@ -12,6 +12,7 @@ describe("extractUrlAndGlobal", () => { "jQuery" ]); }); + it("should return _", () => { const result = extractUrlAndGlobal( "_@https://cdn.jsdelivr.net/npm/lodash@4.17.19/lodash.min.js" @@ -21,15 +22,22 @@ describe("extractUrlAndGlobal", () => { "_" ]); }); + it("should throw error if starts with @", () => { - expect(() => extractUrlAndGlobal("@something")).toThrow(); + expect(() => extractUrlAndGlobal("@something")).toThrow( + /Invalid request "@something"/ + ); }); it("should throw error if ends with @", () => { - expect(() => extractUrlAndGlobal("something@")).toThrow(); + expect(() => extractUrlAndGlobal("something@")).toThrow( + /Invalid request "something@"/ + ); }); it("should throw error if do not have @", () => { - expect(() => extractUrlAndGlobal("something")).toThrow(); + expect(() => extractUrlAndGlobal("something")).toThrow( + /Invalid request "something"/ + ); }); }); diff --git a/test/helpers/EventSourceForNode.js b/test/helpers/EventSourceForNode.js index 17f30aad6c8..c9e21fdeb8e 100644 --- a/test/helpers/EventSourceForNode.js +++ b/test/helpers/EventSourceForNode.js @@ -34,10 +34,12 @@ module.exports = class EventSource { this.response.destroy(); } + // eslint-disable-next-line accessor-pairs set onopen(value) { throw new Error("not implemented"); } + // eslint-disable-next-line accessor-pairs set onmessage(value) { throw new Error("not implemented"); } diff --git a/test/helpers/FakeDocument.js b/test/helpers/FakeDocument.js index fe02264c09a..c0e869d1c12 100644 --- a/test/helpers/FakeDocument.js +++ b/test/helpers/FakeDocument.js @@ -181,7 +181,7 @@ class FakeSheet { .replace(/^https:\/\/test\.cases\/path\//, "") .replace(/^https:\/\/example\.com\//, "") ), - "utf-8" + "utf8" ); css = css.replace(/@import url\("([^"]+)"\);/g, (match, url) => { @@ -198,7 +198,7 @@ class FakeSheet { this._basePath, url.replace(/^https:\/\/test\.cases\/path\//, "") ), - "utf-8" + "utf8" ); }); @@ -207,6 +207,7 @@ class FakeSheet { get cssRules() { const walkCssTokens = require("../../lib/css/walkCssTokens"); + const rules = []; let currentRule = { getPropertyValue }; let selector; @@ -228,7 +229,7 @@ class FakeSheet { .replace(/^https:\/\/example\.com\/public\/path\//, "") .replace(/^https:\/\/example\.com\//, "") ); - let css = fs.readFileSync(filepath, "utf-8"); + let css = fs.readFileSync(filepath, "utf8"); css = css // Remove comments // @ts-expect-error we use es2018 for such tests @@ -247,7 +248,7 @@ class FakeSheet { this._basePath, url.replace(/^https:\/\/test\.cases\/path\//, "") ), - "utf-8" + "utf8" ); }); walkCssTokens(css, 0, { diff --git a/test/helpers/createFakeWorker.js b/test/helpers/createFakeWorker.js index bb7f81cf346..d2fbadf6054 100644 --- a/test/helpers/createFakeWorker.js +++ b/test/helpers/createFakeWorker.js @@ -97,6 +97,7 @@ if (${options.type === "module"}) { this._onmessage = undefined; } + // eslint-disable-next-line accessor-pairs set onmessage(value) { if (this._onmessage) this.worker.off("message", this._onmessage); this.worker.on( diff --git a/test/helpers/createLazyTestEnv.js b/test/helpers/createLazyTestEnv.js index 5702584a2e6..afb9ed0a480 100644 --- a/test/helpers/createLazyTestEnv.js +++ b/test/helpers/createLazyTestEnv.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line jest/no-export module.exports = (globalTimeout = 2000, nameSuffix = "") => { const state = global.JEST_STATE_SYMBOL; let currentDescribeBlock; @@ -59,9 +58,11 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => { try { fn(); } catch (err) { + /* eslint-disable no-unused-expressions */ // avoid leaking memory /** @type {EXPECTED_ANY} */ (err).stack; + /* eslint-enable no-unused-expressions */ throw err; } state.currentDescribeBlock = oldCurrentDescribeBlock; @@ -93,7 +94,6 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => { args[2] = args[2] || globalTimeout; inSuite(() => { // @ts-expect-error expected - // eslint-disable-next-line jest/no-disabled-tests it(...args); fixAsyncError( currentDescribeBlock.tests[currentDescribeBlock.tests.length - 1] @@ -101,8 +101,9 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => { }); }, beforeEach(...args) { - if (runTests >= numberOfTests) + if (runTests >= numberOfTests) { throw new Error("beforeEach called too late"); + } args[0] = createDisposableFn(args[0]); inSuite(() => { // @ts-expect-error expected @@ -113,8 +114,9 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => { }); }, afterEach(...args) { - if (runTests >= numberOfTests) + if (runTests >= numberOfTests) { throw new Error("afterEach called too late"); + } args[0] = createDisposableFn(args[0]); inSuite(() => { // @ts-expect-error expected diff --git a/test/helpers/expectSource.js b/test/helpers/expectSource.js index 9c116a228aa..116216ca59c 100644 --- a/test/helpers/expectSource.js +++ b/test/helpers/expectSource.js @@ -1,4 +1,4 @@ -const regexEscape = require("./regexEscape.js"); +const regexEscape = require("./regexEscape"); // These expect* methods are necessary because 'source' contains the code for this test file, which will always contain the string // being tested for, so we have to use the "DO NOT MATCH BELOW..." technique to exclude the actual testing code from the test. diff --git a/test/helpers/fakeSystem.js b/test/helpers/fakeSystem.js index 4f745627d52..cb0c2bafaa0 100644 --- a/test/helpers/fakeSystem.js +++ b/test/helpers/fakeSystem.js @@ -118,4 +118,5 @@ const System = { return m.exports; } }; + module.exports = System; diff --git a/test/helpers/supportsSpread.js b/test/helpers/supportsSpread.js index 5d50ecd8b63..05ecd49306d 100644 --- a/test/helpers/supportsSpread.js +++ b/test/helpers/supportsSpread.js @@ -1,6 +1,7 @@ module.exports = function supportsSpread() { try { const x = { a: true }; + // eslint-disable-next-line no-unassigned-vars let y; eval("y = { ...x }"); return y !== x && y.a; diff --git a/test/helpers/warmup-webpack.js b/test/helpers/warmup-webpack.js index 4a261e5d8cc..1d465d08dff 100644 --- a/test/helpers/warmup-webpack.js +++ b/test/helpers/warmup-webpack.js @@ -2,6 +2,7 @@ describe("warmup", () => { it("should warmup webpack", done => { /** @type {typeof import("../../") | undefined} */ let webpack = require("../../"); + const END = new Error("end warmup"); webpack( { diff --git a/test/hotCases/loader-import-module/css/webpack.config.js b/test/hotCases/loader-import-module/css/webpack.config.js index fbf07de8af2..61cc3d5069a 100644 --- a/test/hotCases/loader-import-module/css/webpack.config.js +++ b/test/hotCases/loader-import-module/css/webpack.config.js @@ -26,7 +26,7 @@ module.exports = { const png = stats.compilation.getAsset("assets/file.png"); const jpg = stats.compilation.getAsset("assets/file.jpg"); if (png) { - expect(jpg).toBe(undefined); + expect(jpg).toBeUndefined(); expect(png).toHaveProperty( "info", expect.objectContaining({ sourceFilename: "file.png" }) diff --git a/test/hotPlayground/webpack.config.js b/test/hotPlayground/webpack.config.js index 40eb89955ba..8890444988f 100644 --- a/test/hotPlayground/webpack.config.js +++ b/test/hotPlayground/webpack.config.js @@ -1,3 +1,4 @@ +const path = require("path"); const webpack = require("../../"); /** @type {import("../../").Configuration} */ @@ -9,5 +10,5 @@ module.exports = { hashDigestLength: 4 }, plugins: [new webpack.HotModuleReplacementPlugin()], - recordsPath: `${__dirname}/records.json` // this is not required for the webpack-dev-server, but when compiled. + recordsPath: path.resolve(__dirname, "./records.json") // this is not required for the webpack-dev-server, but when compiled. }; diff --git a/test/nonNumericOnlyHash.unittest.js b/test/nonNumericOnlyHash.unittest.js index 00002648b85..9d272a5f362 100644 --- a/test/nonNumericOnlyHash.unittest.js +++ b/test/nonNumericOnlyHash.unittest.js @@ -2,30 +2,32 @@ const nonNumericOnlyHash = require("../lib/util/nonNumericOnlyHash"); -it("hashLength=0", () => { - expect(nonNumericOnlyHash("111", 0)).toBe(""); -}); - -it("abc", () => { - expect(nonNumericOnlyHash("abc", 10)).toBe("abc"); -}); - -it("abc1", () => { - expect(nonNumericOnlyHash("abc1", 3)).toBe("abc"); -}); - -it("ab11", () => { - expect(nonNumericOnlyHash("ab11", 3)).toBe("ab1"); -}); - -it("0111", () => { - expect(nonNumericOnlyHash("0111", 3)).toBe("a11"); -}); - -it("911a", () => { - expect(nonNumericOnlyHash("911a", 3)).toBe("d11"); -}); - -it("511a", () => { - expect(nonNumericOnlyHash("511a", 3)).toBe("f11"); +describe("nonNumericOnlyHash", () => { + it("hashLength=0", () => { + expect(nonNumericOnlyHash("111", 0)).toBe(""); + }); + + it("abc", () => { + expect(nonNumericOnlyHash("abc", 10)).toBe("abc"); + }); + + it("abc1", () => { + expect(nonNumericOnlyHash("abc1", 3)).toBe("abc"); + }); + + it("ab11", () => { + expect(nonNumericOnlyHash("ab11", 3)).toBe("ab1"); + }); + + it("0111", () => { + expect(nonNumericOnlyHash("0111", 3)).toBe("a11"); + }); + + it("911a", () => { + expect(nonNumericOnlyHash("911a", 3)).toBe("d11"); + }); + + it("511a", () => { + expect(nonNumericOnlyHash("511a", 3)).toBe("f11"); + }); }); diff --git a/test/setupTestFramework.js b/test/setupTestFramework.js index a0a98312435..f86469b42c4 100644 --- a/test/setupTestFramework.js +++ b/test/setupTestFramework.js @@ -43,6 +43,7 @@ expect.extend({ if (process.env.ALTERNATIVE_SORT) { const oldSort = Array.prototype.sort; + // eslint-disable-next-line no-extend-native Array.prototype.sort = function (cmp) { oldSort.call(this, cmp); if (cmp) { @@ -116,6 +117,7 @@ if (process.env.DEBUG_INFO) { ); } }; + // eslint-disable-next-line no-global-assign it = addDebugInfo(it); } diff --git a/test/statsCases/aggressive-splitting-entry/webpack.config.js b/test/statsCases/aggressive-splitting-entry/webpack.config.js index c4c2b11446c..7357bf4295f 100644 --- a/test/statsCases/aggressive-splitting-entry/webpack.config.js +++ b/test/statsCases/aggressive-splitting-entry/webpack.config.js @@ -1,3 +1,4 @@ +const path = require("path"); const webpack = require("../../../"); /** @type {import("../../../").Configuration[]} */ @@ -18,7 +19,7 @@ module.exports = ["fitting", "content-change"].map(type => ({ maxSize: 2500 }) ], - recordsInputPath: `${__dirname}/input-records-${type}.json`, + recordsInputPath: path.resolve(__dirname, `./input-records-${type}.json`), // recordsOutputPath: __dirname + `/records-${type}.json`, stats: { chunks: true, diff --git a/test/statsCases/aggressive-splitting-on-demand/webpack.config.js b/test/statsCases/aggressive-splitting-on-demand/webpack.config.js index 7c3cc713f81..9fdb93e7412 100644 --- a/test/statsCases/aggressive-splitting-on-demand/webpack.config.js +++ b/test/statsCases/aggressive-splitting-on-demand/webpack.config.js @@ -1,3 +1,4 @@ +const path = require("path"); const webpack = require("../../../"); /** @type {import("../../../").Configuration} */ @@ -15,7 +16,7 @@ module.exports = { maxSize: 2500 }) ], - recordsInputPath: `${__dirname}/input-records.json`, + recordsInputPath: path.resolve(__dirname, "./input-records.json"), // recordsOutputPath: __dirname + "/records.json", stats: { chunks: true, diff --git a/test/statsCases/async-commons-chunk-auto/webpack.config.js b/test/statsCases/async-commons-chunk-auto/webpack.config.js index 048405c3017..68848614104 100644 --- a/test/statsCases/async-commons-chunk-auto/webpack.config.js +++ b/test/statsCases/async-commons-chunk-auto/webpack.config.js @@ -1,4 +1,5 @@ const path = require("path"); + const stats = { hash: false, timings: false, @@ -96,11 +97,12 @@ module.exports = [ const name = module.nameForCondition(); if (!name) return; const match = /[\\/](xyz|x)\.js/.exec(name); - if (match) + if (match) { return { name: `libs-${match[1]}`, enforce: true }; + } }, vendors: path.resolve(__dirname, "node_modules") } diff --git a/test/statsCases/cause-error/webpack.config.js b/test/statsCases/cause-error/webpack.config.js index c12cd076fd6..9eb4f495f0f 100644 --- a/test/statsCases/cause-error/webpack.config.js +++ b/test/statsCases/cause-error/webpack.config.js @@ -67,7 +67,7 @@ function createAggregateError(errors, message, options = {}) { /** @type {import("../../../").Configuration} */ module.exports = { - name: `error cause`, + name: "error cause", mode: "development", entry: "./index.js", plugins: [ diff --git a/test/statsCases/custom-terser/webpack.config.js b/test/statsCases/custom-terser/webpack.config.js index 1216f81decc..21e0cf7413b 100644 --- a/test/statsCases/custom-terser/webpack.config.js +++ b/test/statsCases/custom-terser/webpack.config.js @@ -1,4 +1,5 @@ const TerserPlugin = require("terser-webpack-plugin"); + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", 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 72ca2fa1371..b3676547e7b 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,4 @@ +const path = require("path"); const webpack = require("../../../"); /** @type {import("../../../").Configuration} */ @@ -9,7 +10,7 @@ module.exports = { }, plugins: [ new webpack.DllReferencePlugin({ - manifest: `${__dirname}/blank-manifest.json`, + manifest: path.resolve(__dirname, "./blank-manifest.json"), name: "blank-manifest" }) ] 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 18e1b93235f..746a27eb8e7 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,4 @@ +const path = require("path"); const webpack = require("../../../"); /** @type {import("../../../").Configuration} */ @@ -9,7 +10,7 @@ module.exports = { }, plugins: [ new webpack.DllReferencePlugin({ - manifest: `${__dirname}/non-blank-manifest.json`, + manifest: path.resolve(__dirname, "./non-blank-manifest.json"), name: "non-blank-manifest" }) ] diff --git a/test/statsCases/issue-7577/webpack.config.js b/test/statsCases/issue-7577/webpack.config.js index 423cb47a4c7..8468e20b49c 100644 --- a/test/statsCases/issue-7577/webpack.config.js +++ b/test/statsCases/issue-7577/webpack.config.js @@ -15,6 +15,7 @@ const base = { } } }; + /** @type {import("../../../").Configuration[]} */ module.exports = [ { diff --git a/test/statsCases/real-content-hash/test.config.js b/test/statsCases/real-content-hash/test.config.js index a0a96aea222..d9954ee4666 100644 --- a/test/statsCases/real-content-hash/test.config.js +++ b/test/statsCases/real-content-hash/test.config.js @@ -16,7 +16,7 @@ module.exports = { const b = stats.stats[i + 1].toJson({ assets: true }); - expect(Object.keys(a.assetsByChunkName).length).toBe(5); + expect(Object.keys(a.assetsByChunkName)).toHaveLength(5); expect(a.assetsByChunkName.main).toEqual(b.assetsByChunkName.main); expect(a.assetsByChunkName.lazy).toEqual(b.assetsByChunkName.lazy); expect(a.assetsByChunkName.a).toEqual(b.assetsByChunkName.a); @@ -29,7 +29,7 @@ module.exports = { }); for (const name of Object.keys(hashedFiles)) { const asset = statsData.assets.find(hashedFiles[name]); - expect(asset).not.toBe(undefined); + expect(asset).toBeDefined(); const content = fs.readFileSync(path.resolve(__dirname, "a", name)); const hash = createHash("md4") .update(content) diff --git a/test/statsCases/split-chunks-automatic-name/webpack.config.js b/test/statsCases/split-chunks-automatic-name/webpack.config.js index fc73caaf92a..ff2bc55260d 100644 --- a/test/statsCases/split-chunks-automatic-name/webpack.config.js +++ b/test/statsCases/split-chunks-automatic-name/webpack.config.js @@ -9,6 +9,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration} */ module.exports = { name: "production", diff --git a/test/statsCases/split-chunks-chunk-name/webpack.config.js b/test/statsCases/split-chunks-chunk-name/webpack.config.js index 8fff0da3530..8a55e57c88f 100644 --- a/test/statsCases/split-chunks-chunk-name/webpack.config.js +++ b/test/statsCases/split-chunks-chunk-name/webpack.config.js @@ -11,6 +11,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/split-chunks-combinations/webpack.config.js b/test/statsCases/split-chunks-combinations/webpack.config.js index da6f5b22dd1..fb9892eb412 100644 --- a/test/statsCases/split-chunks-combinations/webpack.config.js +++ b/test/statsCases/split-chunks-combinations/webpack.config.js @@ -9,6 +9,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/split-chunks-dedup/webpack.config.js b/test/statsCases/split-chunks-dedup/webpack.config.js index 8558a1194cb..2a47cdaff6d 100644 --- a/test/statsCases/split-chunks-dedup/webpack.config.js +++ b/test/statsCases/split-chunks-dedup/webpack.config.js @@ -1,11 +1,12 @@ /** @typedef {import("../../../").Module} Module */ const webpack = require("../../../"); -const { ModuleFederationPlugin } = webpack.container; const { WEBPACK_MODULE_TYPE_PROVIDE } = require("../../../lib/ModuleTypeConstants"); +const { ModuleFederationPlugin } = webpack.container; + const chunkIdChunkNameMap = new Map(); const usedSharedModuleNames = new Set(); diff --git a/test/statsCases/split-chunks-issue-6413/webpack.config.js b/test/statsCases/split-chunks-issue-6413/webpack.config.js index ba523d3f0f6..2deec6baab4 100644 --- a/test/statsCases/split-chunks-issue-6413/webpack.config.js +++ b/test/statsCases/split-chunks-issue-6413/webpack.config.js @@ -9,6 +9,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration} */ module.exports = { name: "default", diff --git a/test/statsCases/split-chunks-issue-6696/webpack.config.js b/test/statsCases/split-chunks-issue-6696/webpack.config.js index 5cdafb24531..2017aa984e6 100644 --- a/test/statsCases/split-chunks-issue-6696/webpack.config.js +++ b/test/statsCases/split-chunks-issue-6696/webpack.config.js @@ -9,6 +9,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration} */ module.exports = { name: "default", diff --git a/test/statsCases/split-chunks-issue-7401/webpack.config.js b/test/statsCases/split-chunks-issue-7401/webpack.config.js index 891845a835c..051fcf83d54 100644 --- a/test/statsCases/split-chunks-issue-7401/webpack.config.js +++ b/test/statsCases/split-chunks-issue-7401/webpack.config.js @@ -10,6 +10,7 @@ const stats = { chunkGroups: true, modules: false }; + /** @type {import("../../../").Configuration} */ module.exports = { name: "default", 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 3ecbdc398ab..3f230099452 100644 --- a/test/statsCases/split-chunks-keep-remaining-size/webpack.config.js +++ b/test/statsCases/split-chunks-keep-remaining-size/webpack.config.js @@ -11,6 +11,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/split-chunks-max-size/webpack.config.js b/test/statsCases/split-chunks-max-size/webpack.config.js index 32eb3c7ecc8..8bc668b115b 100644 --- a/test/statsCases/split-chunks-max-size/webpack.config.js +++ b/test/statsCases/split-chunks-max-size/webpack.config.js @@ -9,6 +9,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration[]} */ module.exports = [ { 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 538eef92931..0e65c02453c 100644 --- a/test/statsCases/split-chunks-min-size-reduction/webpack.config.js +++ b/test/statsCases/split-chunks-min-size-reduction/webpack.config.js @@ -11,6 +11,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", 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 49a833b9f06..90fff485fa6 100644 --- a/test/statsCases/split-chunks-prefer-bigger-splits/webpack.config.js +++ b/test/statsCases/split-chunks-prefer-bigger-splits/webpack.config.js @@ -9,6 +9,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", diff --git a/test/statsCases/split-chunks/webpack.config.js b/test/statsCases/split-chunks/webpack.config.js index 8370c7e4957..7ae86c74c67 100644 --- a/test/statsCases/split-chunks/webpack.config.js +++ b/test/statsCases/split-chunks/webpack.config.js @@ -9,6 +9,7 @@ const stats = { entrypoints: true, modules: false }; + /** @type {import("../../../").Configuration[]} */ module.exports = [ { diff --git a/test/walkCssTokens.unittest.js b/test/walkCssTokens.unittest.js index 79523ba1100..a179740b79d 100644 --- a/test/walkCssTokens.unittest.js +++ b/test/walkCssTokens.unittest.js @@ -78,7 +78,7 @@ describe("walkCssTokens", () => { .filter(test => /\.css/.test(test)) .map(item => [ item, - fs.readFileSync(path.resolve(casesPath, item), "utf-8") + fs.readFileSync(path.resolve(casesPath, item), "utf8") ]); for (const [name, code] of tests) { diff --git a/test/watchCases/plugins/define-plugin/webpack.config.js b/test/watchCases/plugins/define-plugin/webpack.config.js index 927b02be100..5c06191dc55 100644 --- a/test/watchCases/plugins/define-plugin/webpack.config.js +++ b/test/watchCases/plugins/define-plugin/webpack.config.js @@ -9,19 +9,19 @@ module.exports = (env, { srcPath }) => { plugins: [ new webpack.DefinePlugin({ TEST_VALUE: webpack.DefinePlugin.runtimeValue( - () => JSON.stringify(fs.readFileSync(valueFile, "utf-8").trim()), + () => JSON.stringify(fs.readFileSync(valueFile, "utf8").trim()), [valueFile] ), TEST_VALUE2: webpack.DefinePlugin.runtimeValue( - () => JSON.stringify(fs.readFileSync(valueFile, "utf-8").trim()), + () => JSON.stringify(fs.readFileSync(valueFile, "utf8").trim()), [] ), TEST_VALUE3: webpack.DefinePlugin.runtimeValue( - () => JSON.stringify(fs.readFileSync(valueFile, "utf-8").trim()), + () => JSON.stringify(fs.readFileSync(valueFile, "utf8").trim()), true ), TEST_VALUE4: webpack.DefinePlugin.runtimeValue( - () => JSON.stringify(fs.readFileSync(valueFile, "utf-8").trim()), + () => JSON.stringify(fs.readFileSync(valueFile, "utf8").trim()), { fileDependencies: [valueFile] } @@ -29,7 +29,7 @@ module.exports = (env, { srcPath }) => { TEST_VALUE5: webpack.DefinePlugin.runtimeValue( ({ version, key }) => JSON.stringify({ version, key }), { - version: () => fs.readFileSync(valueFile, "utf-8").trim() + version: () => fs.readFileSync(valueFile, "utf8").trim() } ) }) diff --git a/test/watchCases/plugins/virtual-url-plugin-version/webpack.config.js b/test/watchCases/plugins/virtual-url-plugin-version/webpack.config.js index eb71873bed1..04207f81490 100644 --- a/test/watchCases/plugins/virtual-url-plugin-version/webpack.config.js +++ b/test/watchCases/plugins/virtual-url-plugin-version/webpack.config.js @@ -1,6 +1,9 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); + const { VirtualUrlPlugin } = webpack.experiments.schemes; let watchStep = -1; @@ -13,7 +16,7 @@ module.exports = { source: () => fs.readFileSync(path.join(__dirname, `./${watchStep}/v.js`), "utf8"), version: () => { - watchStep = watchStep + 1; + watchStep += 1; return `v${watchStep}`; } }, diff --git a/tooling/decode-debug-hash.js b/tooling/decode-debug-hash.js index ac5640c5c33..e05b92c8f6a 100644 --- a/tooling/decode-debug-hash.js +++ b/tooling/decode-debug-hash.js @@ -1,10 +1,12 @@ +"use strict"; + const fs = require("fs"); const file = process.argv[2]; -let content = fs.readFileSync(file, "utf-8"); +let content = fs.readFileSync(file, "utf8"); content = content.replace(/debug-digest-([a-f0-9]+)/g, (match, bin) => - Buffer.from(bin, "hex").toString("utf-8") + Buffer.from(bin, "hex").toString("utf8") ); fs.writeFileSync(file, content); diff --git a/tooling/generate-runtime-code.js b/tooling/generate-runtime-code.js index 6772fda53f6..7fa3a5e681e 100644 --- a/tooling/generate-runtime-code.js +++ b/tooling/generate-runtime-code.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const fs = require("fs"); const terser = require("terser"); @@ -12,7 +14,8 @@ const files = ["lib/util/semver.js"]; (async () => { for (const file of files) { const filePath = path.resolve(__dirname, "..", file); - const content = fs.readFileSync(filePath, "utf-8"); + const content = fs.readFileSync(filePath, "utf8"); + const exports = require(`../${file}`); const regexp = @@ -30,7 +33,7 @@ const files = ["lib/util/semver.js"]; const body = originalCode.slice(header[0].length, -1); const result = await terser.minify( { - ["input.js"]: body + "input.js": body }, { compress: true, @@ -88,7 +91,7 @@ exports.${name}RuntimeCode = runtimeTemplate => \`var ${name} = \${runtimeTempla if (newContent !== content) { if (doWrite) { - fs.writeFileSync(filePath, newContent, "utf-8"); + fs.writeFileSync(filePath, newContent, "utf8"); console.error(`${file} updated`); } else { console.error(`${file} need to be updated`); diff --git a/tooling/generate-wasm-code.js b/tooling/generate-wasm-code.js index 582b8ef9ca9..d935e9b86ff 100644 --- a/tooling/generate-wasm-code.js +++ b/tooling/generate-wasm-code.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const fs = require("fs"); @@ -11,12 +13,12 @@ const files = ["lib/util/hash/xxhash64.js", "lib/util/hash/md4.js"]; // TODO: fix me after update typescript to v5 // eslint-disable-next-line no-warning-comments // @ts-ignore - // eslint-disable-next-line n/no-unsupported-features/es-syntax + // eslint-disable-next-line import/no-unresolved, n/no-unsupported-features/es-syntax const asc = (await import("assemblyscript/asc")).default; for (const file of files) { const filePath = path.resolve(__dirname, "..", file); - const content = fs.readFileSync(filePath, "utf-8"); + const content = fs.readFileSync(filePath, "utf8"); const regexp = /\n\/\/[\s]*#region wasm code: (.+) \((.+)\)(.*)\n[\s\S]+?\/\/[\s+]*#endregion\n/g; @@ -79,7 +81,7 @@ const ${identifier} = new WebAssembly.Module( if (newContent !== content) { if (doWrite) { - fs.writeFileSync(filePath, newContent, "utf-8"); + fs.writeFileSync(filePath, newContent, "utf8"); console.error(`${file} updated`); } else { console.error(`${file} need to be updated`); diff --git a/tooling/print-cache-file.js b/tooling/print-cache-file.js index 8f1077152b8..b9882d020f1 100644 --- a/tooling/print-cache-file.js +++ b/tooling/print-cache-file.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const fs = require("fs"); const BinaryMiddleware = require("../lib/serialization/BinaryMiddleware"); diff --git a/yarn.lock b/yarn.lock index 28934c63769..e138b0d2aa9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -861,6 +861,20 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.29.0.tgz#dc6fd117c19825f8430867a662531da36320fe56" integrity sha512-3PIF4cBw/y+1u2EazflInpV+lYsSG0aByVIQzAgb1m1MhHFSbqTyNqtBKHgWf/9Ykud+DhILS9EGkmekVhbKoQ== +"@eslint/markdown@^6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@eslint/markdown/-/markdown-6.6.0.tgz#b9f226f9f464de161be7136e5c879239a4339631" + integrity sha512-IsWPy2jU3gaQDlioDC4sT4I4kG1hX1OMWs/q2sWwJrPoMASHW/Z4SDw+6Aql6EsHejGbagYuJbFq9Zvx+Y1b1Q== + dependencies: + "@eslint/core" "^0.14.0" + "@eslint/plugin-kit" "^0.3.1" + github-slugger "^2.0.0" + mdast-util-from-markdown "^2.0.2" + mdast-util-frontmatter "^2.0.1" + mdast-util-gfm "^3.0.0" + micromark-extension-frontmatter "^2.0.0" + micromark-extension-gfm "^3.0.0" + "@eslint/object-schema@^2.1.6": version "2.1.6" resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.6.tgz#58369ab5b5b3ca117880c0f6c0b0f32f6950f24f" @@ -1300,6 +1314,11 @@ resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.7.tgz#eb5014dfd0b03e7f3ba2eeeff506eed89b028058" integrity sha512-YLT9Zo3oNPJoBjBc4q8G2mjU4tqIbf5CEOORbUUr48dCD9q3umJ3IPlVqOqDakPfd2HuwccBaqlGhN4Gmr5OWg== +"@rtsao/scc@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@rtsao/scc/-/scc-1.1.0.tgz#927dd2fae9bc3361403ac2c7a00c32ddce9ad7e8" + integrity sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g== + "@sinclair/typebox@^0.34.0": version "0.34.33" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.34.33.tgz#10ab3f1261ed9e754660250fad3e69cca1fa44b2" @@ -1376,6 +1395,13 @@ dependencies: "@babel/types" "^7.20.7" +"@types/debug@^4.0.0": + version "4.1.12" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" + integrity sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ== + dependencies: + "@types/ms" "*" + "@types/eslint-scope@^3.7.7": version "3.7.7" resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" @@ -1441,11 +1467,28 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== + +"@types/mdast@^4.0.0": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-4.0.4.tgz#7ccf72edd2f1aa7dd3437e180c64373585804dd6" + integrity sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA== + dependencies: + "@types/unist" "*" + "@types/mime-types@^2.1.4": version "2.1.4" resolved "https://registry.yarnpkg.com/@types/mime-types/-/mime-types-2.1.4.tgz#93a1933e24fed4fb9e4adc5963a63efcbb3317a2" integrity sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w== +"@types/ms@*": + version "2.1.0" + 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.3": version "24.0.4" resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.4.tgz#dbae889912bda33a7f57669fb8587c1a56bc0c1f" @@ -1458,6 +1501,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== +"@types/unist@*", "@types/unist@^3.0.0": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/unist/-/unist-3.0.3.tgz#acaab0f919ce69cce629c2d4ed2eb4adc1b6c20c" + integrity sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q== + "@types/xxhashjs@^0.2.4": version "0.2.4" resolved "https://registry.yarnpkg.com/@types/xxhashjs/-/xxhashjs-0.2.4.tgz#fd35be1a3673295337f932c182e02ade748c1922" @@ -1813,7 +1861,7 @@ acorn@^7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.14.0, acorn@^8.15.0: +acorn@^8.14.0, acorn@^8.15.0, acorn@^8.5.0, acorn@^8.9.0: version "8.15.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== @@ -1958,11 +2006,79 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +array-buffer-byte-length@^1.0.1, array-buffer-byte-length@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz#384d12a37295aec3769ab022ad323a18a51ccf8b" + integrity sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw== + dependencies: + call-bound "^1.0.3" + is-array-buffer "^3.0.5" + +array-includes@^3.1.9: + version "3.1.9" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.9.tgz#1f0ccaa08e90cdbc3eb433210f903ad0f17c3f3a" + integrity sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ== + dependencies: + call-bind "^1.0.8" + call-bound "^1.0.4" + define-properties "^1.2.1" + es-abstract "^1.24.0" + es-object-atoms "^1.1.1" + get-intrinsic "^1.3.0" + is-string "^1.1.1" + math-intrinsics "^1.1.0" + array-timsort@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/array-timsort/-/array-timsort-1.0.3.tgz#3c9e4199e54fb2b9c3fe5976396a21614ef0d926" integrity sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ== +array.prototype.findlastindex@^1.2.6: + version "1.2.6" + resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz#cfa1065c81dcb64e34557c9b81d012f6a421c564" + integrity sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ== + dependencies: + call-bind "^1.0.8" + call-bound "^1.0.4" + define-properties "^1.2.1" + es-abstract "^1.23.9" + es-errors "^1.3.0" + es-object-atoms "^1.1.1" + es-shim-unscopables "^1.1.0" + +array.prototype.flat@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz#534aaf9e6e8dd79fb6b9a9917f839ef1ec63afe5" + integrity sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg== + dependencies: + call-bind "^1.0.8" + define-properties "^1.2.1" + es-abstract "^1.23.5" + es-shim-unscopables "^1.0.2" + +array.prototype.flatmap@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz#712cc792ae70370ae40586264629e33aab5dd38b" + integrity sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg== + dependencies: + call-bind "^1.0.8" + define-properties "^1.2.1" + es-abstract "^1.23.5" + es-shim-unscopables "^1.0.2" + +arraybuffer.prototype.slice@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz#9d760d84dbdd06d0cbf92c8849615a1a7ab3183c" + integrity sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ== + dependencies: + array-buffer-byte-length "^1.0.1" + call-bind "^1.0.8" + define-properties "^1.2.1" + es-abstract "^1.23.5" + es-errors "^1.3.0" + get-intrinsic "^1.2.6" + is-array-buffer "^3.0.4" + asap@~2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" @@ -1981,6 +2097,11 @@ assert-never@^1.2.1: resolved "https://registry.yarnpkg.com/assert-never/-/assert-never-1.4.0.tgz#b0d4988628c87f35eb94716cc54422a63927e175" integrity sha512-5oJg84os6NMQNl27T9LnZkvvqzvAnHu03ShCnoj6bsJwS7L8AO4lf+C/XjK/nvzEqQB744moC6V128RucQd1jA== +async-function@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/async-function/-/async-function-1.0.0.tgz#509c9fca60eaf85034c6829838188e4e4c8ffb2b" + integrity sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA== + async@1.x: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -1991,6 +2112,13 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== +available-typed-arrays@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846" + integrity sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ== + dependencies: + possible-typed-array-names "^1.0.0" + axios@^1.4.0: version "1.9.0" resolved "https://registry.yarnpkg.com/axios/-/axios-1.9.0.tgz#25534e3b72b54540077d33046f77e3b8d7081901" @@ -2195,7 +2323,7 @@ caching-transform@^4.0.0: package-hash "^4.0.0" write-file-atomic "^3.0.0" -call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: +call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== @@ -2203,7 +2331,17 @@ call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: es-errors "^1.3.0" function-bind "^1.1.2" -call-bound@^1.0.2: +call-bind@^1.0.7, call-bind@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.8.tgz#0736a9660f537e3388826f440d5ec45f744eaa4c" + integrity sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww== + dependencies: + call-bind-apply-helpers "^1.0.0" + es-define-property "^1.0.0" + get-intrinsic "^1.2.4" + set-function-length "^1.2.2" + +call-bound@^1.0.2, call-bound@^1.0.3, call-bound@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.4.tgz#238de935d2a2a692928c538c7ccfa91067fd062a" integrity sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg== @@ -2236,6 +2374,11 @@ caniuse-lite@^1.0.30001726: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001726.tgz#a15bd87d5a4bf01f6b6f70ae7c97fdfd28b5ae47" integrity sha512-VQAUIUzBiZ/UnlM28fSp2CRF3ivUn1BWEvxMcVTNwpw91Py1pGbPIyIKtd+tzct9C3ouceCVdGAXxZOpZAsgdw== +ccount@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/ccount/-/ccount-2.0.1.tgz#17a3bf82302e0870d6da43a01311a8bc02a3ecf5" + integrity sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg== + chalk-template@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/chalk-template/-/chalk-template-1.1.0.tgz#ffc55db6dd745e9394b85327c8ac8466edb7a7b1" @@ -2261,6 +2404,11 @@ char-regex@^1.0.2: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== +character-entities@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/character-entities/-/character-entities-2.0.2.tgz#2d09c2e72cd9523076ccb21157dff66ad43fcc22" + integrity sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ== + character-parser@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/character-parser/-/character-parser-2.2.0.tgz#c7ce28f36d4bcd9744e5ffc2c5fcde1c73261fc0" @@ -2682,23 +2830,64 @@ d@1, d@^1.0.1, d@^1.0.2: es5-ext "^0.10.64" type "^2.7.2" +data-view-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.2.tgz#211a03ba95ecaf7798a8c7198d79536211f88570" + integrity sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ== + dependencies: + call-bound "^1.0.3" + es-errors "^1.3.0" + is-data-view "^1.0.2" + +data-view-byte-length@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz#9e80f7ca52453ce3e93d25a35318767ea7704735" + integrity sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ== + dependencies: + call-bound "^1.0.3" + es-errors "^1.3.0" + is-data-view "^1.0.2" + +data-view-byte-offset@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz#068307f9b71ab76dbbe10291389e020856606191" + integrity sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + is-data-view "^1.0.1" + date-fns@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-4.1.0.tgz#64b3d83fff5aa80438f5b1a633c2e83b8a1c2d14" integrity sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg== -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.4.0, debug@^4.4.1: +debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.4.0, debug@^4.4.1: version "4.4.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== dependencies: ms "^2.1.3" +debug@^3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" + integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== + dependencies: + ms "^2.1.1" + decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== +decode-named-character-reference@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz#25c32ae6dd5e21889549d40f676030e9514cc0ed" + integrity sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q== + dependencies: + character-entities "^2.0.0" + dedent@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.6.0.tgz#79d52d6389b1ffa67d2bcef59ba51847a9d503b2" @@ -2734,27 +2923,74 @@ default-require-extensions@^3.0.0: dependencies: strip-bom "^4.0.0" +define-data-property@^1.0.1, define-data-property@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + define-lazy-prop@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz#dbb19adfb746d7fc6d734a06b72f4a00d021255f" integrity sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg== +define-properties@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" + integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== + dependencies: + define-data-property "^1.0.1" + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== +dequal@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" + integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== + +detect-indent@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-7.0.1.tgz#cbb060a12842b9c4d333f1cac4aa4da1bb66bc25" + integrity sha512-Mc7QhQ8s+cLrnUfU/Ji94vG/r8M26m8f++vyres4ZoojaRDpZ1eSIh/EpzLNwlWuvzSZ3UbDFspjFvTDXe6e/g== + detect-newline@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== +detect-newline@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-4.0.1.tgz#fcefdb5713e1fb8cb2839b8b6ee22e6716ab8f23" + integrity sha512-qE3Veg1YXzGHQhlA6jzebZN2qVf6NX+A7m7qlhCGG30dJixrAQhYOsJjsnBjJkCSmuOPpCk30145fr8FV0bzog== + +devlop@^1.0.0, devlop@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/devlop/-/devlop-1.1.0.tgz#4db7c2ca4dc6e0e834c30be70c94bbc976dc7018" + integrity sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA== + dependencies: + dequal "^2.0.0" + +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + dependencies: + esutils "^2.0.2" + doctypes@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/doctypes/-/doctypes-1.1.0.tgz#ea80b106a87538774e8a3a4a5afe293de489e0a9" integrity sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ== -dunder-proto@^1.0.1: +dunder-proto@^1.0.0, dunder-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== @@ -2852,7 +3088,67 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-define-property@^1.0.1: +es-abstract@^1.23.2, es-abstract@^1.23.5, es-abstract@^1.23.9, es-abstract@^1.24.0: + version "1.24.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.24.0.tgz#c44732d2beb0acc1ed60df840869e3106e7af328" + integrity sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg== + dependencies: + array-buffer-byte-length "^1.0.2" + arraybuffer.prototype.slice "^1.0.4" + available-typed-arrays "^1.0.7" + call-bind "^1.0.8" + call-bound "^1.0.4" + data-view-buffer "^1.0.2" + data-view-byte-length "^1.0.2" + data-view-byte-offset "^1.0.1" + es-define-property "^1.0.1" + es-errors "^1.3.0" + es-object-atoms "^1.1.1" + es-set-tostringtag "^2.1.0" + es-to-primitive "^1.3.0" + function.prototype.name "^1.1.8" + get-intrinsic "^1.3.0" + get-proto "^1.0.1" + get-symbol-description "^1.1.0" + globalthis "^1.0.4" + gopd "^1.2.0" + has-property-descriptors "^1.0.2" + has-proto "^1.2.0" + has-symbols "^1.1.0" + hasown "^2.0.2" + internal-slot "^1.1.0" + is-array-buffer "^3.0.5" + is-callable "^1.2.7" + is-data-view "^1.0.2" + is-negative-zero "^2.0.3" + is-regex "^1.2.1" + is-set "^2.0.3" + is-shared-array-buffer "^1.0.4" + is-string "^1.1.1" + is-typed-array "^1.1.15" + is-weakref "^1.1.1" + math-intrinsics "^1.1.0" + object-inspect "^1.13.4" + object-keys "^1.1.1" + object.assign "^4.1.7" + own-keys "^1.0.1" + regexp.prototype.flags "^1.5.4" + safe-array-concat "^1.1.3" + safe-push-apply "^1.0.0" + safe-regex-test "^1.1.0" + set-proto "^1.0.0" + stop-iteration-iterator "^1.1.0" + string.prototype.trim "^1.2.10" + string.prototype.trimend "^1.0.9" + string.prototype.trimstart "^1.0.8" + typed-array-buffer "^1.0.3" + typed-array-byte-length "^1.0.3" + typed-array-byte-offset "^1.0.4" + typed-array-length "^1.0.7" + unbox-primitive "^1.1.0" + which-typed-array "^1.1.19" + +es-define-property@^1.0.0, es-define-property@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== @@ -2884,6 +3180,22 @@ es-set-tostringtag@^2.1.0: has-tostringtag "^1.0.2" hasown "^2.0.2" +es-shim-unscopables@^1.0.2, es-shim-unscopables@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz#438df35520dac5d105f3943d927549ea3b00f4b5" + integrity sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw== + dependencies: + hasown "^2.0.2" + +es-to-primitive@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.3.0.tgz#96c89c82cc49fd8794a24835ba3e1ff87f214e18" + integrity sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g== + dependencies: + is-callable "^1.2.7" + is-date-object "^1.0.5" + is-symbol "^1.0.4" + es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.53, es5-ext@^0.10.62, es5-ext@^0.10.64, es5-ext@~0.10.14, es5-ext@~0.10.2: version "0.10.64" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714" @@ -2951,6 +3263,11 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +escape-string-regexp@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8" + integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw== + escodegen@1.8.x: version "1.8.1" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" @@ -2975,6 +3292,32 @@ eslint-config-prettier@^10.1.1: resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-10.1.5.tgz#00c18d7225043b6fbce6a665697377998d453782" integrity sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw== +eslint-config-webpack@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/eslint-config-webpack/-/eslint-config-webpack-4.3.0.tgz#2ffb28164b827c15977e0dedb85b7b863ec5aea5" + integrity sha512-G2mePdT5zOOPS+lYtNKAdLqIgSSRCswirgrWh1+Lk1R2UY2r7q5XTtJbTguOR3ukfFySpYx0vHPTdN8TxpFQtw== + dependencies: + detect-indent "^7.0.1" + jsonc-eslint-parser "^2.4.0" + semver "^7.7.2" + sort-package-json "^3.3.1" + +eslint-import-resolver-node@^0.3.9: + version "0.3.9" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac" + integrity sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g== + dependencies: + debug "^3.2.7" + is-core-module "^2.13.0" + resolve "^1.22.4" + +eslint-module-utils@^2.12.1: + version "2.12.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz#f76d3220bfb83c057651359295ab5854eaad75ff" + integrity sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw== + dependencies: + debug "^3.2.7" + eslint-plugin-es-x@^7.8.0: version "7.8.0" resolved "https://registry.yarnpkg.com/eslint-plugin-es-x/-/eslint-plugin-es-x-7.8.0.tgz#a207aa08da37a7923f2a9599e6d3eb73f3f92b74" @@ -2984,6 +3327,31 @@ eslint-plugin-es-x@^7.8.0: "@eslint-community/regexpp" "^4.11.0" eslint-compat-utils "^0.5.1" +eslint-plugin-import@^2.32.0: + version "2.32.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz#602b55faa6e4caeaa5e970c198b5c00a37708980" + integrity sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA== + dependencies: + "@rtsao/scc" "^1.1.0" + array-includes "^3.1.9" + array.prototype.findlastindex "^1.2.6" + array.prototype.flat "^1.3.3" + array.prototype.flatmap "^1.3.3" + debug "^3.2.7" + doctrine "^2.1.0" + eslint-import-resolver-node "^0.3.9" + eslint-module-utils "^2.12.1" + hasown "^2.0.2" + is-core-module "^2.16.1" + is-glob "^4.0.3" + minimatch "^3.1.2" + object.fromentries "^2.0.8" + object.groupby "^1.0.3" + object.values "^1.2.1" + semver "^6.3.1" + string.prototype.trimend "^1.0.9" + tsconfig-paths "^3.15.0" + eslint-plugin-jest@^29.0.1: version "29.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-29.0.1.tgz#0f72a81349409d20742208260c9a6cb9efed4df5" @@ -2991,10 +3359,10 @@ eslint-plugin-jest@^29.0.1: dependencies: "@typescript-eslint/utils" "^8.0.0" -eslint-plugin-jsdoc@^51.2.2: - version "51.2.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-51.2.2.tgz#bbae4e07c218ec6e7b36b6385a2c86a8a05ad0f8" - integrity sha512-5e3VGUk3rvZ6ZuxJr5fCTVMj7TrMC80F1GbymjyUkplCbj6dXW41qX3ZzF8YULXM74cBfjnWy/nSp/I0eLl3vg== +eslint-plugin-jsdoc@^51.2.3: + version "51.2.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-51.2.3.tgz#59b373c53458ef64700d57985a9622cf7021b0d2" + integrity sha512-pagzxFubOih+O6XSB1D8BkDkJjF4G4/v8s9pRg4FkXQJLu0e3QJg621ayhmnhyc5mNBpp3cYCNiUyeLQs7oz7w== dependencies: "@es-joy/jsdoccomment" "~0.52.0" are-docs-informative "^0.0.2" @@ -3031,7 +3399,7 @@ eslint-plugin-prettier@^5.5.0: prettier-linter-helpers "^1.0.0" synckit "^0.11.7" -eslint-plugin-unicorn@^59.0.0: +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== @@ -3070,7 +3438,7 @@ eslint-scope@^8.4.0: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-visitor-keys@^3.4.3: +eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== @@ -3140,6 +3508,15 @@ espree@^10.0.1, espree@^10.4.0: acorn-jsx "^5.3.2" eslint-visitor-keys "^4.2.1" +espree@^9.0.0: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== + dependencies: + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + esprima@2.7.x, esprima@^2.7.1: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" @@ -3304,6 +3681,13 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" +fault@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fault/-/fault-2.0.1.tgz#d47ca9f37ca26e4bd38374a7c500b5a384755b6c" + integrity sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ== + dependencies: + format "^0.2.0" + fb-watchman@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" @@ -3423,6 +3807,13 @@ follow-redirects@^1.15.6: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== +for-each@^0.3.3, for-each@^0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.5.tgz#d650688027826920feeb0af747ee7b9421a41d47" + integrity sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg== + dependencies: + is-callable "^1.2.7" + foreground-child@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-2.0.0.tgz#71b32800c9f15aa8f2f83f4a6bd9bff35d861a53" @@ -3467,6 +3858,11 @@ form-data@^4.0.0: es-set-tostringtag "^2.1.0" mime-types "^2.1.12" +format@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" + integrity sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww== + fromentries@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/fromentries/-/fromentries-1.3.2.tgz#e4bca6808816bf8f93b52750f1127f5a6fd86e3a" @@ -3508,6 +3904,23 @@ function-bind@^1.1.2: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== +function.prototype.name@^1.1.6, function.prototype.name@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.8.tgz#e68e1df7b259a5c949eeef95cdbde53edffabb78" + integrity sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q== + dependencies: + call-bind "^1.0.8" + call-bound "^1.0.3" + define-properties "^1.2.1" + functions-have-names "^1.2.3" + hasown "^2.0.2" + is-callable "^1.2.7" + +functions-have-names@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== + gensequence@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/gensequence/-/gensequence-7.0.0.tgz#bb6aedec8ff665e3a6c42f92823121e3a6ea7718" @@ -3528,7 +3941,7 @@ get-east-asian-width@^1.0.0: resolved "https://registry.yarnpkg.com/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz#21b4071ee58ed04ee0db653371b55b4299875389" integrity sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ== -get-intrinsic@^1.2.6, get-intrinsic@^1.3.0: +get-intrinsic@^1.2.4, get-intrinsic@^1.2.5, get-intrinsic@^1.2.6, get-intrinsic@^1.2.7, get-intrinsic@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== @@ -3549,7 +3962,7 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-proto@^1.0.1: +get-proto@^1.0.0, get-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== @@ -3567,6 +3980,15 @@ get-stream@^6.0.0: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== +get-symbol-description@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.1.0.tgz#7bdd54e0befe8ffc9f3b4e203220d9f1e881b6ee" + integrity sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg== + dependencies: + call-bound "^1.0.3" + es-errors "^1.3.0" + get-intrinsic "^1.2.6" + get-tsconfig@^4.8.1: version "4.10.0" resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.10.0.tgz#403a682b373a823612475a4c2928c7326fc0f6bb" @@ -3574,6 +3996,16 @@ get-tsconfig@^4.8.1: dependencies: resolve-pkg-maps "^1.0.0" +git-hooks-list@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/git-hooks-list/-/git-hooks-list-4.1.1.tgz#ae340b82a9312354c73b48007f33840bbd83d3c0" + integrity sha512-cmP497iLq54AZnv4YRAEMnEyQ1eIn4tGKbmswqwmFV4GBnAqE8NLtWxxdXa++AalfgL5EBH4IxTPyquEuGY/jA== + +github-slugger@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-2.0.0.tgz#52cf2f9279a21eb6c59dd385b410f0c0adda8f1a" + integrity sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw== + glob-parent@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" @@ -3655,7 +4087,15 @@ globals@^16.0.0: resolved "https://registry.yarnpkg.com/globals/-/globals-16.2.0.tgz#19efcd1ddde2bd5efce128e5c2e441df1abc6f7c" integrity sha512-O+7l9tPdHCU320IigZZPj5zmRCFG9xHmx9cU8FqU2Rp+JN714seHV+2S9+JslCpY4gJwU2vOGox0wzgae/MCEg== -gopd@^1.2.0: +globalthis@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236" + integrity sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ== + dependencies: + define-properties "^1.2.1" + gopd "^1.0.1" + +gopd@^1.0.1, gopd@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== @@ -3677,6 +4117,11 @@ handlebars@^4.0.1: optionalDependencies: uglify-js "^3.1.4" +has-bigints@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.1.0.tgz#28607e965ac967e03cd2a2c70a2636a1edad49fe" + integrity sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg== + has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" @@ -3692,6 +4137,20 @@ has-own-prop@^2.0.0: resolved "https://registry.yarnpkg.com/has-own-prop/-/has-own-prop-2.0.0.tgz#f0f95d58f65804f5d218db32563bb85b8e0417af" integrity sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ== +has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== + dependencies: + es-define-property "^1.0.0" + +has-proto@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.2.0.tgz#5de5a6eabd95fdffd9818b43055e8065e39fe9d5" + integrity sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ== + dependencies: + dunder-proto "^1.0.0" + has-symbols@^1.0.3, has-symbols@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" @@ -3846,6 +4305,15 @@ ini@4.1.1: resolved "https://registry.yarnpkg.com/ini/-/ini-4.1.1.tgz#d95b3d843b1e906e56d6747d5447904ff50ce7a1" integrity sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g== +internal-slot@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.1.0.tgz#1eac91762947d2f7056bc838d93e13b2e9604961" + integrity sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw== + dependencies: + es-errors "^1.3.0" + hasown "^2.0.2" + side-channel "^1.1.0" + interpret@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" @@ -3859,11 +4327,46 @@ ip-address@^9.0.5: jsbn "1.1.0" sprintf-js "^1.1.3" +is-array-buffer@^3.0.4, is-array-buffer@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.5.tgz#65742e1e687bd2cc666253068fd8707fe4d44280" + integrity sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A== + dependencies: + call-bind "^1.0.8" + call-bound "^1.0.3" + get-intrinsic "^1.2.6" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== +is-async-function@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-async-function/-/is-async-function-2.1.1.tgz#3e69018c8e04e73b738793d020bfe884b9fd3523" + integrity sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ== + dependencies: + async-function "^1.0.0" + call-bound "^1.0.3" + get-proto "^1.0.1" + has-tostringtag "^1.0.2" + safe-regex-test "^1.1.0" + +is-bigint@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.1.0.tgz#dda7a3445df57a42583db4228682eba7c4170672" + integrity sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ== + dependencies: + has-bigints "^1.0.2" + +is-boolean-object@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.2.2.tgz#7067f47709809a393c71ff5bb3e135d8a9215d9e" + integrity sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A== + dependencies: + call-bound "^1.0.3" + has-tostringtag "^1.0.2" + is-builtin-module@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-5.0.0.tgz#19df4b9c7451149b68176b0e06d18646db6308dd" @@ -3871,13 +4374,35 @@ is-builtin-module@^5.0.0: dependencies: builtin-modules "^5.0.0" -is-core-module@^2.16.0: +is-callable@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" + integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== + +is-core-module@^2.13.0, is-core-module@^2.16.0, is-core-module@^2.16.1: version "2.16.1" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== dependencies: hasown "^2.0.2" +is-data-view@^1.0.1, is-data-view@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-data-view/-/is-data-view-1.0.2.tgz#bae0a41b9688986c2188dda6657e56b8f9e63b8e" + integrity sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw== + dependencies: + call-bound "^1.0.2" + get-intrinsic "^1.2.6" + is-typed-array "^1.1.13" + +is-date-object@^1.0.5, is-date-object@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.1.0.tgz#ad85541996fc7aa8b2729701d27b7319f95d82f7" + integrity sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg== + dependencies: + call-bound "^1.0.2" + has-tostringtag "^1.0.2" + is-docker@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200" @@ -3896,6 +4421,13 @@ is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== +is-finalizationregistry@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz#eefdcdc6c94ddd0674d9c85887bf93f944a97c90" + integrity sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg== + dependencies: + call-bound "^1.0.3" + is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -3918,6 +4450,16 @@ is-generator-fn@^2.1.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== +is-generator-function@^1.0.10: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.1.0.tgz#bf3eeda931201394f57b5dba2800f91a238309ca" + integrity sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ== + dependencies: + call-bound "^1.0.3" + get-proto "^1.0.0" + has-tostringtag "^1.0.2" + safe-regex-test "^1.1.0" + is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" @@ -3932,11 +4474,34 @@ is-inside-container@^1.0.0: dependencies: is-docker "^3.0.0" +is-map@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.3.tgz#ede96b7fe1e270b3c4465e3a465658764926d62e" + integrity sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw== + +is-negative-zero@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz#ced903a027aca6381b777a5743069d7376a49747" + integrity sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw== + +is-number-object@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.1.1.tgz#144b21e95a1bc148205dcc2814a9134ec41b2541" + integrity sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw== + dependencies: + call-bound "^1.0.3" + has-tostringtag "^1.0.2" + is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-plain-obj@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-4.1.0.tgz#d65025edec3657ce032fd7db63c97883eaed71f0" + integrity sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg== + is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" @@ -3949,7 +4514,7 @@ is-promise@^2.0.0, is-promise@^2.2.2: resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== -is-regex@^1.0.3: +is-regex@^1.0.3, is-regex@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.2.1.tgz#76d70a3ed10ef9be48eb577887d74205bf0cad22" integrity sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g== @@ -3959,6 +4524,18 @@ is-regex@^1.0.3: has-tostringtag "^1.0.2" hasown "^2.0.2" +is-set@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.3.tgz#8ab209ea424608141372ded6e0cb200ef1d9d01d" + integrity sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg== + +is-shared-array-buffer@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz#9b67844bd9b7f246ba0708c3a93e34269c774f6f" + integrity sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A== + dependencies: + call-bound "^1.0.3" + is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" @@ -3969,11 +4546,55 @@ is-stream@^3.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== +is-string@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.1.1.tgz#92ea3f3d5c5b6e039ca8677e5ac8d07ea773cbb9" + integrity sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA== + dependencies: + call-bound "^1.0.3" + has-tostringtag "^1.0.2" + +is-symbol@^1.0.4, is-symbol@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.1.1.tgz#f47761279f532e2b05a7024a7506dbbedacd0634" + integrity sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w== + dependencies: + call-bound "^1.0.2" + has-symbols "^1.1.0" + safe-regex-test "^1.1.0" + +is-typed-array@^1.1.13, is-typed-array@^1.1.14, is-typed-array@^1.1.15: + version "1.1.15" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.15.tgz#4bfb4a45b61cee83a5a46fba778e4e8d59c0ce0b" + integrity sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ== + dependencies: + which-typed-array "^1.1.16" + is-typedarray@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== +is-weakmap@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.2.tgz#bf72615d649dfe5f699079c54b83e47d1ae19cfd" + integrity sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w== + +is-weakref@^1.0.2, is-weakref@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.1.1.tgz#eea430182be8d64174bd96bffbc46f21bf3f9293" + integrity sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew== + dependencies: + call-bound "^1.0.3" + +is-weakset@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.4.tgz#c9f5deb0bc1906c6d6f1027f284ddf459249daca" + integrity sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ== + dependencies: + call-bound "^1.0.3" + get-intrinsic "^1.2.6" + is-what@^3.14.1: version "3.14.1" resolved "https://registry.yarnpkg.com/is-what/-/is-what-3.14.1.tgz#e1222f46ddda85dead0fd1c9df131760e77755c1" @@ -3991,6 +4612,11 @@ is-wsl@^3.1.0: dependencies: is-inside-container "^1.0.0" +isarray@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -4585,7 +5211,7 @@ json-stringify-safe@^5.0.1: resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== -json5@^1.0.1: +json5@^1.0.1, json5@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== @@ -4597,6 +5223,16 @@ json5@^2.1.2, json5@^2.1.3, json5@^2.2.3: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== +jsonc-eslint-parser@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/jsonc-eslint-parser/-/jsonc-eslint-parser-2.4.0.tgz#74ded53f9d716e8d0671bd167bf5391f452d5461" + integrity sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg== + dependencies: + acorn "^8.5.0" + eslint-visitor-keys "^3.0.0" + espree "^9.0.0" + semver "^7.3.5" + jsonfile@^6.0.1: version "6.1.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" @@ -4787,6 +5423,11 @@ long@^5.2.4: resolved "https://registry.yarnpkg.com/long/-/long-5.3.1.tgz#9d4222d3213f38a5ec809674834e0f0ab21abe96" integrity sha512-ka87Jz3gcx/I7Hal94xaN2tZEOPoUOEVftkQqZx2EeQRN7LGdfLlI3FvZ+7WDplm+vK2Urx9ULrvSowtdCieng== +longest-streak@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-3.1.0.tgz#62fa67cd958742a1574af9f39866364102d90cd4" + integrity sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g== + lru-cache@^10.0.1, lru-cache@^10.2.0: version "10.4.3" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" @@ -4852,11 +5493,151 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" +markdown-table@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-3.0.4.tgz#fe44d6d410ff9d6f2ea1797a3f60aa4d2b631c2a" + integrity sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw== + math-intrinsics@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== +mdast-util-find-and-replace@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz#70a3174c894e14df722abf43bc250cbae44b11df" + integrity sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg== + dependencies: + "@types/mdast" "^4.0.0" + escape-string-regexp "^5.0.0" + unist-util-is "^6.0.0" + unist-util-visit-parents "^6.0.0" + +mdast-util-from-markdown@^2.0.0, mdast-util-from-markdown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz#4850390ca7cf17413a9b9a0fbefcd1bc0eb4160a" + integrity sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA== + dependencies: + "@types/mdast" "^4.0.0" + "@types/unist" "^3.0.0" + decode-named-character-reference "^1.0.0" + devlop "^1.0.0" + mdast-util-to-string "^4.0.0" + micromark "^4.0.0" + micromark-util-decode-numeric-character-reference "^2.0.0" + micromark-util-decode-string "^2.0.0" + micromark-util-normalize-identifier "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + unist-util-stringify-position "^4.0.0" + +mdast-util-frontmatter@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/mdast-util-frontmatter/-/mdast-util-frontmatter-2.0.1.tgz#f5f929eb1eb36c8a7737475c7eb438261f964ee8" + integrity sha512-LRqI9+wdgC25P0URIJY9vwocIzCcksduHQ9OF2joxQoyTNVduwLAFUzjoopuRJbJAReaKrNQKAZKL3uCMugWJA== + dependencies: + "@types/mdast" "^4.0.0" + devlop "^1.0.0" + escape-string-regexp "^5.0.0" + mdast-util-from-markdown "^2.0.0" + mdast-util-to-markdown "^2.0.0" + micromark-extension-frontmatter "^2.0.0" + +mdast-util-gfm-autolink-literal@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz#abd557630337bd30a6d5a4bd8252e1c2dc0875d5" + integrity sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ== + dependencies: + "@types/mdast" "^4.0.0" + ccount "^2.0.0" + devlop "^1.0.0" + mdast-util-find-and-replace "^3.0.0" + micromark-util-character "^2.0.0" + +mdast-util-gfm-footnote@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz#7778e9d9ca3df7238cc2bd3fa2b1bf6a65b19403" + integrity sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ== + dependencies: + "@types/mdast" "^4.0.0" + devlop "^1.1.0" + mdast-util-from-markdown "^2.0.0" + mdast-util-to-markdown "^2.0.0" + micromark-util-normalize-identifier "^2.0.0" + +mdast-util-gfm-strikethrough@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz#d44ef9e8ed283ac8c1165ab0d0dfd058c2764c16" + integrity sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg== + dependencies: + "@types/mdast" "^4.0.0" + mdast-util-from-markdown "^2.0.0" + mdast-util-to-markdown "^2.0.0" + +mdast-util-gfm-table@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz#7a435fb6223a72b0862b33afbd712b6dae878d38" + integrity sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg== + dependencies: + "@types/mdast" "^4.0.0" + devlop "^1.0.0" + markdown-table "^3.0.0" + mdast-util-from-markdown "^2.0.0" + mdast-util-to-markdown "^2.0.0" + +mdast-util-gfm-task-list-item@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz#e68095d2f8a4303ef24094ab642e1047b991a936" + integrity sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ== + dependencies: + "@types/mdast" "^4.0.0" + devlop "^1.0.0" + mdast-util-from-markdown "^2.0.0" + mdast-util-to-markdown "^2.0.0" + +mdast-util-gfm@^3.0.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== + dependencies: + mdast-util-from-markdown "^2.0.0" + mdast-util-gfm-autolink-literal "^2.0.0" + mdast-util-gfm-footnote "^2.0.0" + mdast-util-gfm-strikethrough "^2.0.0" + mdast-util-gfm-table "^2.0.0" + mdast-util-gfm-task-list-item "^2.0.0" + mdast-util-to-markdown "^2.0.0" + +mdast-util-phrasing@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz#7cc0a8dec30eaf04b7b1a9661a92adb3382aa6e3" + integrity sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w== + dependencies: + "@types/mdast" "^4.0.0" + unist-util-is "^6.0.0" + +mdast-util-to-markdown@^2.0.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz#f910ffe60897f04bb4b7e7ee434486f76288361b" + integrity sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA== + dependencies: + "@types/mdast" "^4.0.0" + "@types/unist" "^3.0.0" + longest-streak "^3.0.0" + mdast-util-phrasing "^4.0.0" + mdast-util-to-string "^4.0.0" + micromark-util-classify-character "^2.0.0" + micromark-util-decode-string "^2.0.0" + unist-util-visit "^5.0.0" + zwitch "^2.0.0" + +mdast-util-to-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz#7a5121475556a04e7eddeb67b264aae79d312814" + integrity sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg== + dependencies: + "@types/mdast" "^4.0.0" + memfs@^3.4.1: version "3.6.0" resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.6.0.tgz#d7a2110f86f79dd950a8b6df6d57bc984aa185f6" @@ -4903,6 +5684,289 @@ merge2@^1.3.0: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== +micromark-core-commonmark@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz#c691630e485021a68cf28dbc2b2ca27ebf678cd4" + integrity sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg== + dependencies: + decode-named-character-reference "^1.0.0" + devlop "^1.0.0" + micromark-factory-destination "^2.0.0" + micromark-factory-label "^2.0.0" + micromark-factory-space "^2.0.0" + micromark-factory-title "^2.0.0" + micromark-factory-whitespace "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-chunked "^2.0.0" + micromark-util-classify-character "^2.0.0" + micromark-util-html-tag-name "^2.0.0" + micromark-util-normalize-identifier "^2.0.0" + micromark-util-resolve-all "^2.0.0" + micromark-util-subtokenize "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-extension-frontmatter@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-extension-frontmatter/-/micromark-extension-frontmatter-2.0.0.tgz#651c52ffa5d7a8eeed687c513cd869885882d67a" + integrity sha512-C4AkuM3dA58cgZha7zVnuVxBhDsbttIMiytjgsM2XbHAB2faRVaHRle40558FBN+DJcrLNCoqG5mlrpdU4cRtg== + dependencies: + fault "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-extension-gfm-autolink-literal@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz#6286aee9686c4462c1e3552a9d505feddceeb935" + integrity sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-sanitize-uri "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-extension-gfm-footnote@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz#4dab56d4e398b9853f6fe4efac4fc9361f3e0750" + integrity sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw== + dependencies: + devlop "^1.0.0" + micromark-core-commonmark "^2.0.0" + micromark-factory-space "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-normalize-identifier "^2.0.0" + micromark-util-sanitize-uri "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-extension-gfm-strikethrough@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz#86106df8b3a692b5f6a92280d3879be6be46d923" + integrity sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw== + dependencies: + devlop "^1.0.0" + micromark-util-chunked "^2.0.0" + micromark-util-classify-character "^2.0.0" + micromark-util-resolve-all "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-extension-gfm-table@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz#fac70bcbf51fe65f5f44033118d39be8a9b5940b" + integrity sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg== + dependencies: + devlop "^1.0.0" + micromark-factory-space "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-extension-gfm-tagfilter@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz#f26d8a7807b5985fba13cf61465b58ca5ff7dc57" + integrity sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg== + dependencies: + micromark-util-types "^2.0.0" + +micromark-extension-gfm-task-list-item@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz#bcc34d805639829990ec175c3eea12bb5b781f2c" + integrity sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw== + dependencies: + devlop "^1.0.0" + micromark-factory-space "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-extension-gfm@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz#3e13376ab95dd7a5cfd0e29560dfe999657b3c5b" + integrity sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w== + dependencies: + micromark-extension-gfm-autolink-literal "^2.0.0" + micromark-extension-gfm-footnote "^2.0.0" + micromark-extension-gfm-strikethrough "^2.0.0" + micromark-extension-gfm-table "^2.0.0" + micromark-extension-gfm-tagfilter "^2.0.0" + micromark-extension-gfm-task-list-item "^2.0.0" + micromark-util-combine-extensions "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-factory-destination@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz#8fef8e0f7081f0474fbdd92deb50c990a0264639" + integrity sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-factory-label@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz#5267efa97f1e5254efc7f20b459a38cb21058ba1" + integrity sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg== + dependencies: + devlop "^1.0.0" + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-factory-space@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz#36d0212e962b2b3121f8525fc7a3c7c029f334fc" + integrity sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-factory-title@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz#237e4aa5d58a95863f01032d9ee9b090f1de6e94" + integrity sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw== + dependencies: + micromark-factory-space "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-factory-whitespace@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz#06b26b2983c4d27bfcc657b33e25134d4868b0b1" + integrity sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ== + dependencies: + micromark-factory-space "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-util-character@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/micromark-util-character/-/micromark-util-character-2.1.1.tgz#2f987831a40d4c510ac261e89852c4e9703ccda6" + integrity sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q== + dependencies: + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-util-chunked@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz#47fbcd93471a3fccab86cff03847fc3552db1051" + integrity sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA== + dependencies: + micromark-util-symbol "^2.0.0" + +micromark-util-classify-character@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz#d399faf9c45ca14c8b4be98b1ea481bced87b629" + integrity sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-util-combine-extensions@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz#2a0f490ab08bff5cc2fd5eec6dd0ca04f89b30a9" + integrity sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg== + dependencies: + micromark-util-chunked "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-util-decode-numeric-character-reference@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz#fcf15b660979388e6f118cdb6bf7d79d73d26fe5" + integrity sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw== + dependencies: + micromark-util-symbol "^2.0.0" + +micromark-util-decode-string@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz#6cb99582e5d271e84efca8e61a807994d7161eb2" + integrity sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ== + dependencies: + decode-named-character-reference "^1.0.0" + micromark-util-character "^2.0.0" + micromark-util-decode-numeric-character-reference "^2.0.0" + micromark-util-symbol "^2.0.0" + +micromark-util-encode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz#0d51d1c095551cfaac368326963cf55f15f540b8" + integrity sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw== + +micromark-util-html-tag-name@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz#e40403096481986b41c106627f98f72d4d10b825" + integrity sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA== + +micromark-util-normalize-identifier@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz#c30d77b2e832acf6526f8bf1aa47bc9c9438c16d" + integrity sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q== + dependencies: + micromark-util-symbol "^2.0.0" + +micromark-util-resolve-all@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz#e1a2d62cdd237230a2ae11839027b19381e31e8b" + integrity sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg== + dependencies: + micromark-util-types "^2.0.0" + +micromark-util-sanitize-uri@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz#ab89789b818a58752b73d6b55238621b7faa8fd7" + integrity sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-encode "^2.0.0" + micromark-util-symbol "^2.0.0" + +micromark-util-subtokenize@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz#d8ade5ba0f3197a1cf6a2999fbbfe6357a1a19ee" + integrity sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA== + dependencies: + devlop "^1.0.0" + micromark-util-chunked "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-util-symbol@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz#e5da494e8eb2b071a0d08fb34f6cefec6c0a19b8" + integrity sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q== + +micromark-util-types@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/micromark-util-types/-/micromark-util-types-2.0.2.tgz#f00225f5f5a0ebc3254f96c36b6605c4b393908e" + integrity sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA== + +micromark@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/micromark/-/micromark-4.0.2.tgz#91395a3e1884a198e62116e33c9c568e39936fdb" + integrity sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA== + dependencies: + "@types/debug" "^4.0.0" + debug "^4.0.0" + decode-named-character-reference "^1.0.0" + devlop "^1.0.0" + micromark-core-commonmark "^2.0.0" + micromark-factory-space "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-chunked "^2.0.0" + micromark-util-combine-extensions "^2.0.0" + micromark-util-decode-numeric-character-reference "^2.0.0" + micromark-util-encode "^2.0.0" + micromark-util-normalize-identifier "^2.0.0" + micromark-util-resolve-all "^2.0.0" + micromark-util-sanitize-uri "^2.0.0" + micromark-util-subtokenize "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + micromatch@^4.0.0, micromatch@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" @@ -5050,7 +6114,7 @@ mkdirp@^3.0.1: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg== -ms@^2.1.3: +ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -5214,6 +6278,57 @@ object-assign@^4.0.1, object-assign@^4.1.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== +object-inspect@^1.13.3, object-inspect@^1.13.4: + version "1.13.4" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" + integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== + +object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object.assign@^4.1.7: + version "4.1.7" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.7.tgz#8c14ca1a424c6a561b0bb2a22f66f5049a945d3d" + integrity sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw== + dependencies: + call-bind "^1.0.8" + call-bound "^1.0.3" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" + has-symbols "^1.1.0" + object-keys "^1.1.1" + +object.fromentries@^2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.8.tgz#f7195d8a9b97bd95cbc1999ea939ecd1a2b00c65" + integrity sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-object-atoms "^1.0.0" + +object.groupby@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.3.tgz#9b125c36238129f6f7b61954a1e7176148d5002e" + integrity sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + +object.values@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.2.1.tgz#deed520a50809ff7f75a7cfd4bc64c7a038c6216" + integrity sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA== + dependencies: + call-bind "^1.0.8" + call-bound "^1.0.3" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" + once@1.x, once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -5280,6 +6395,15 @@ optionator@^0.9.3: type-check "^0.4.0" word-wrap "^1.2.5" +own-keys@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/own-keys/-/own-keys-1.0.1.tgz#e4006910a2bf913585289676eebd6f390cf51358" + integrity sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg== + dependencies: + get-intrinsic "^1.2.6" + object-keys "^1.1.1" + safe-push-apply "^1.0.0" + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -5480,6 +6604,11 @@ pluralize@^8.0.0: resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== +possible-typed-array-names@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz#93e3582bc0e5426586d9d07b79ee40fc841de4ae" + integrity sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg== + postcss-modules-extract-imports@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz#b4497cb85a9c0c4b5aabeb759bb25e8d89f15002" @@ -5812,11 +6941,37 @@ rechoir@^0.8.0: dependencies: resolve "^1.20.0" +reflect.getprototypeof@^1.0.6, reflect.getprototypeof@^1.0.9: + version "1.0.10" + resolved "https://registry.yarnpkg.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz#c629219e78a3316d8b604c765ef68996964e7bf9" + integrity sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw== + dependencies: + call-bind "^1.0.8" + define-properties "^1.2.1" + es-abstract "^1.23.9" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + get-intrinsic "^1.2.7" + get-proto "^1.0.1" + which-builtin-type "^1.2.1" + regexp-tree@^0.1.27: version "0.1.27" resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.27.tgz#2198f0ef54518ffa743fe74d983b56ffd631b6cd" integrity sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA== +regexp.prototype.flags@^1.5.4: + version "1.5.4" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz#1ad6c62d44a259007e55b3970e00f746efbcaa19" + integrity sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA== + dependencies: + call-bind "^1.0.8" + define-properties "^1.2.1" + es-errors "^1.3.0" + get-proto "^1.0.1" + gopd "^1.2.0" + set-function-name "^2.0.2" + regjsparser@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.12.0.tgz#0e846df6c6530586429377de56e0475583b088dc" @@ -5878,7 +7033,7 @@ resolve@1.1.x: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg== -resolve@^1.1.7, resolve@^1.15.1, resolve@^1.20.0: +resolve@^1.1.7, resolve@^1.15.1, resolve@^1.20.0, resolve@^1.22.4: version "1.22.10" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== @@ -5929,11 +7084,39 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +safe-array-concat@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.1.3.tgz#c9e54ec4f603b0bbb8e7e5007a5ee7aecd1538c3" + integrity sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q== + dependencies: + call-bind "^1.0.8" + call-bound "^1.0.2" + get-intrinsic "^1.2.6" + has-symbols "^1.1.0" + isarray "^2.0.5" + safe-buffer@^5.1.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== +safe-push-apply@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/safe-push-apply/-/safe-push-apply-1.0.0.tgz#01850e981c1602d398c85081f360e4e6d03d27f5" + integrity sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA== + dependencies: + es-errors "^1.3.0" + isarray "^2.0.5" + +safe-regex-test@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.1.0.tgz#7f87dfb67a3150782eaaf18583ff5d1711ac10c1" + integrity sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + is-regex "^1.2.1" + "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -6002,6 +7185,37 @@ set-blocking@^2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== +set-function-length@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" + integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== + dependencies: + define-data-property "^1.1.4" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" + +set-function-name@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.2.tgz#16a705c5a0dc2f5e638ca96d8a8cd4e1c2b90985" + integrity sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ== + dependencies: + define-data-property "^1.1.4" + es-errors "^1.3.0" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.2" + +set-proto@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/set-proto/-/set-proto-1.0.0.tgz#0760dbcff30b2d7e801fd6e19983e56da337565e" + integrity sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw== + dependencies: + dunder-proto "^1.0.1" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + shallow-clone@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" @@ -6021,6 +7235,46 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +side-channel-list@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" + integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== + dependencies: + es-errors "^1.3.0" + object-inspect "^1.13.3" + +side-channel-map@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/side-channel-map/-/side-channel-map-1.0.1.tgz#d6bb6b37902c6fef5174e5f533fab4c732a26f42" + integrity sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + get-intrinsic "^1.2.5" + object-inspect "^1.13.3" + +side-channel-weakmap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz#11dda19d5368e40ce9ec2bdc1fb0ecbc0790ecea" + integrity sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + get-intrinsic "^1.2.5" + object-inspect "^1.13.3" + side-channel-map "^1.0.1" + +side-channel@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" + integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== + dependencies: + es-errors "^1.3.0" + object-inspect "^1.13.3" + side-channel-list "^1.0.0" + side-channel-map "^1.0.1" + side-channel-weakmap "^1.0.2" + signal-exit@^3.0.2, signal-exit@^3.0.3: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" @@ -6083,6 +7337,24 @@ socks@^2.8.3: ip-address "^9.0.5" smart-buffer "^4.2.0" +sort-object-keys@^1.1.3: + version "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: + version "3.3.1" + resolved "https://registry.yarnpkg.com/sort-package-json/-/sort-package-json-3.3.1.tgz#c31c0b4cd970b7fde6b1d0197f8b768584e2e65c" + integrity sha512-awjhQR2Iy5UN3NuguAK5+RezcEuUg9Ra4O8y2Aj+DlJa7MywyHaipAPf9bu4qqFj0hsYHHoT9sS3aV7Ucu728g== + dependencies: + detect-indent "^7.0.1" + detect-newline "^4.0.1" + git-hooks-list "^4.0.0" + is-plain-obj "^4.1.0" + semver "^7.7.1" + sort-object-keys "^1.1.3" + tinyglobby "^0.2.12" + source-map-js@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" @@ -6185,6 +7457,14 @@ stdin@0.0.1: resolved "https://registry.yarnpkg.com/stdin/-/stdin-0.0.1.tgz#d3041981aaec3dfdbc77a1b38d6372e38f5fb71e" integrity sha512-2bacd1TXzqOEsqRa+eEWkRdOSznwptrs4gqFcpMq5tOtmJUGPZd10W5Lam6wQ4YQ/+qjQt4e9u35yXCF6mrlfQ== +stop-iteration-iterator@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz#f481ff70a548f6124d0312c3aa14cbfa7aa542ad" + integrity sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ== + dependencies: + es-errors "^1.3.0" + internal-slot "^1.1.0" + string-argv@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" @@ -6234,6 +7514,38 @@ string-width@^7.0.0: get-east-asian-width "^1.0.0" strip-ansi "^7.1.0" +string.prototype.trim@^1.2.10: + version "1.2.10" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz#40b2dd5ee94c959b4dcfb1d65ce72e90da480c81" + integrity sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA== + dependencies: + call-bind "^1.0.8" + call-bound "^1.0.2" + define-data-property "^1.1.4" + define-properties "^1.2.1" + es-abstract "^1.23.5" + es-object-atoms "^1.0.0" + has-property-descriptors "^1.0.2" + +string.prototype.trimend@^1.0.9: + version "1.0.9" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz#62e2731272cd285041b36596054e9f66569b6942" + integrity sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ== + dependencies: + call-bind "^1.0.8" + call-bound "^1.0.2" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" + +string.prototype.trimstart@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz#7ee834dda8c7c17eff3118472bb35bfedaa34dde" + integrity sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" + string_decoder@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -6262,6 +7574,11 @@ strip-ansi@^7.0.1, strip-ansi@^7.1.0: dependencies: ansi-regex "^6.0.1" +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== + strip-bom@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" @@ -6507,6 +7824,16 @@ ts-loader@^9.5.1: semver "^7.3.4" source-map "^0.7.4" +tsconfig-paths@^3.15.0: + version "3.15.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4" + integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.2" + minimist "^1.2.6" + strip-bom "^3.0.0" + tslib@^2.0.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.5.0: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" @@ -6556,6 +7883,51 @@ type@^2.7.2: resolved "https://registry.yarnpkg.com/type/-/type-2.7.3.tgz#436981652129285cc3ba94f392886c2637ea0486" integrity sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ== +typed-array-buffer@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz#a72395450a4869ec033fd549371b47af3a2ee536" + integrity sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw== + dependencies: + call-bound "^1.0.3" + es-errors "^1.3.0" + is-typed-array "^1.1.14" + +typed-array-byte-length@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz#8407a04f7d78684f3d252aa1a143d2b77b4160ce" + integrity sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg== + dependencies: + call-bind "^1.0.8" + for-each "^0.3.3" + gopd "^1.2.0" + has-proto "^1.2.0" + is-typed-array "^1.1.14" + +typed-array-byte-offset@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz#ae3698b8ec91a8ab945016108aef00d5bff12355" + integrity sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ== + dependencies: + available-typed-arrays "^1.0.7" + call-bind "^1.0.8" + for-each "^0.3.3" + gopd "^1.2.0" + has-proto "^1.2.0" + is-typed-array "^1.1.15" + reflect.getprototypeof "^1.0.9" + +typed-array-length@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.7.tgz#ee4deff984b64be1e118b0de8c9c877d5ce73d3d" + integrity sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg== + dependencies: + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + is-typed-array "^1.1.13" + possible-typed-array-names "^1.0.0" + reflect.getprototypeof "^1.0.6" + typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" @@ -6573,6 +7945,16 @@ uglify-js@^3.1.4: resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== +unbox-primitive@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.1.0.tgz#8d9d2c9edeea8460c7f35033a88867944934d1e2" + integrity sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw== + dependencies: + call-bound "^1.0.3" + has-bigints "^1.0.2" + has-symbols "^1.1.0" + which-boxed-primitive "^1.1.1" + undici-types@~7.8.0: version "7.8.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" @@ -6599,6 +7981,37 @@ unique-string@^3.0.0: dependencies: crypto-random-string "^4.0.0" +unist-util-is@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-6.0.0.tgz#b775956486aff107a9ded971d996c173374be424" + integrity sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw== + dependencies: + "@types/unist" "^3.0.0" + +unist-util-stringify-position@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz#449c6e21a880e0855bf5aabadeb3a740314abac2" + integrity sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ== + dependencies: + "@types/unist" "^3.0.0" + +unist-util-visit-parents@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz#4d5f85755c3b8f0dc69e21eca5d6d82d22162815" + integrity sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw== + dependencies: + "@types/unist" "^3.0.0" + unist-util-is "^6.0.0" + +unist-util-visit@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-5.0.0.tgz#a7de1f31f72ffd3519ea71814cccf5fd6a9217d6" + integrity sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg== + dependencies: + "@types/unist" "^3.0.0" + unist-util-is "^6.0.0" + unist-util-visit-parents "^6.0.0" + universalify@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" @@ -6752,11 +8165,64 @@ webpack-sources@^3.3.3: resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.3.tgz#d4bf7f9909675d7a070ff14d0ef2a4f3c982c723" integrity sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg== +which-boxed-primitive@^1.1.0, which-boxed-primitive@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz#d76ec27df7fa165f18d5808374a5fe23c29b176e" + integrity sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA== + dependencies: + is-bigint "^1.1.0" + is-boolean-object "^1.2.1" + is-number-object "^1.1.1" + is-string "^1.1.1" + is-symbol "^1.1.1" + +which-builtin-type@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/which-builtin-type/-/which-builtin-type-1.2.1.tgz#89183da1b4907ab089a6b02029cc5d8d6574270e" + integrity sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q== + dependencies: + call-bound "^1.0.2" + function.prototype.name "^1.1.6" + has-tostringtag "^1.0.2" + is-async-function "^2.0.0" + is-date-object "^1.1.0" + is-finalizationregistry "^1.1.0" + is-generator-function "^1.0.10" + is-regex "^1.2.1" + is-weakref "^1.0.2" + isarray "^2.0.5" + which-boxed-primitive "^1.1.0" + which-collection "^1.0.2" + which-typed-array "^1.1.16" + +which-collection@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.2.tgz#627ef76243920a107e7ce8e96191debe4b16c2a0" + integrity sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw== + dependencies: + is-map "^2.0.3" + is-set "^2.0.3" + is-weakmap "^2.0.2" + is-weakset "^2.0.3" + which-module@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" integrity sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ== +which-typed-array@^1.1.16, which-typed-array@^1.1.19: + version "1.1.19" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.19.tgz#df03842e870b6b88e117524a4b364b6fc689f956" + integrity sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw== + dependencies: + available-typed-arrays "^1.0.7" + call-bind "^1.0.8" + call-bound "^1.0.4" + for-each "^0.3.5" + get-proto "^1.0.1" + gopd "^1.2.0" + has-tostringtag "^1.0.2" + which@^1.1.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" @@ -7006,3 +8472,8 @@ yocto-queue@^1.0.0: version "1.2.1" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.2.1.tgz#36d7c4739f775b3cbc28e6136e21aa057adec418" integrity sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg== + +zwitch@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-2.0.4.tgz#c827d4b0acb76fc3e685a4c6ec2902d51070e9d7" + integrity sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A== From 87f648ebf0cadd13a2a6907ff5aa75c420f38fa0 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 3 Jul 2025 12:06:45 +0300 Subject: [PATCH 39/56] chore: eslint more rules (#19648) --- bin/webpack.js | 5 +- eslint.config.mjs | 27 +- .../custom-json-modules/webpack.config.js | 2 +- lib/APIPlugin.js | 4 +- lib/CaseSensitiveModulesWarning.js | 8 +- lib/Chunk.js | 12 +- lib/ChunkGraph.js | 31 +- lib/ChunkGroup.js | 8 +- lib/ChunkTemplate.js | 2 +- lib/CleanPlugin.js | 2 +- lib/CodeGenerationResults.js | 2 +- lib/Compilation.js | 38 +- lib/Compiler.js | 17 +- lib/ConstPlugin.js | 3 +- lib/ContextModule.js | 19 +- lib/DefinePlugin.js | 4 +- lib/ErrorHelpers.js | 8 +- lib/ExportsInfo.js | 17 +- lib/ExternalModule.js | 4 +- lib/ExternalModuleFactoryPlugin.js | 2 +- lib/FileSystemInfo.js | 12 +- lib/FlagDependencyUsagePlugin.js | 2 +- lib/HotModuleReplacementPlugin.js | 44 ++- lib/InvalidDependenciesModuleWarning.js | 2 +- lib/LibManifestPlugin.js | 5 +- lib/MainTemplate.js | 4 +- lib/Module.js | 4 +- lib/ModuleGraph.js | 3 +- lib/ModuleGraphConnection.js | 10 +- lib/ModuleInfoHeaderPlugin.js | 2 +- lib/ModuleSourceTypesConstants.js | 24 +- lib/ModuleTemplate.js | 2 +- lib/ModuleTypeConstants.js | 42 +-- lib/MultiCompiler.js | 4 +- lib/NormalModule.js | 10 +- lib/NormalModuleFactory.js | 8 +- lib/NormalModuleReplacementPlugin.js | 2 +- lib/OptimizationStages.js | 2 +- lib/ProvidePlugin.js | 6 +- lib/RecordIdsPlugin.js | 4 +- lib/RuntimeGlobals.js | 336 +++++++++--------- lib/RuntimeTemplate.js | 8 +- lib/SourceMapDevToolPlugin.js | 16 +- lib/Template.js | 4 +- lib/TemplatedPathPlugin.js | 2 +- lib/WatchIgnorePlugin.js | 5 +- lib/WebpackOptionsApply.js | 49 ++- lib/asset/AssetGenerator.js | 16 +- lib/asset/AssetModulesPlugin.js | 4 +- lib/asset/AssetSourceGenerator.js | 4 +- .../AwaitDependenciesInitFragment.js | 2 +- lib/cache/IdleFileCachePlugin.js | 2 +- lib/cache/PackFileCacheStrategy.js | 8 +- lib/config/browserslistTargetHandler.js | 6 +- lib/config/defaults.js | 26 +- lib/css/CssGenerator.js | 10 +- lib/css/CssModulesPlugin.js | 14 +- lib/css/CssParser.js | 4 +- lib/css/walkCssTokens.js | 63 ++-- lib/debug/ProfilingPlugin.js | 6 +- .../CommonJsExportRequireDependency.js | 4 +- lib/dependencies/CommonJsPlugin.js | 24 +- lib/dependencies/CssIcssExportDependency.js | 2 +- .../CssLocalIdentifierDependency.js | 4 +- lib/dependencies/DynamicExports.js | 18 +- lib/dependencies/ExportsInfoDependency.js | 2 +- .../HarmonyExportDependencyParserPlugin.js | 9 +- ...armonyExportImportedSpecifierDependency.js | 19 +- lib/dependencies/HarmonyExportInitFragment.js | 2 +- .../HarmonyImportDependencyParserPlugin.js | 13 +- .../HarmonyImportSpecifierDependency.js | 5 +- lib/dependencies/HarmonyModulesPlugin.js | 14 +- lib/dependencies/ImportMetaPlugin.js | 4 +- lib/dependencies/RequireEnsurePlugin.js | 8 +- .../RuntimeRequirementsDependency.js | 2 +- lib/dependencies/processExportInfo.js | 2 +- lib/esm/ModuleChunkFormatPlugin.js | 14 +- lib/esm/ModuleChunkLoadingRuntimeModule.js | 4 +- lib/ids/ChunkModuleIdRangePlugin.js | 8 +- lib/ids/DeterministicChunkIdsPlugin.js | 6 +- lib/ids/DeterministicModuleIdsPlugin.js | 4 +- lib/ids/HashedModuleIdsPlugin.js | 4 +- lib/ids/IdHelpers.js | 46 +-- lib/ids/NamedChunkIdsPlugin.js | 10 +- lib/ids/NamedModuleIdsPlugin.js | 8 +- lib/ids/NaturalChunkIdsPlugin.js | 3 +- lib/ids/OccurrenceChunkIdsPlugin.js | 3 +- lib/ids/SyncModuleIdsPlugin.js | 2 +- .../ArrayPushCallbackChunkFormatPlugin.js | 15 +- lib/javascript/CommonJsChunkFormatPlugin.js | 12 +- lib/javascript/EnableChunkLoadingPlugin.js | 4 +- lib/javascript/JavascriptModulesPlugin.js | 32 +- lib/javascript/JavascriptParser.js | 51 +-- lib/javascript/JavascriptParserHelpers.js | 82 ++--- lib/javascript/StartupHelpers.js | 34 +- lib/library/AssignLibraryPlugin.js | 7 +- lib/library/EnableLibraryPlugin.js | 4 +- lib/library/UmdLibraryPlugin.js | 12 +- lib/logging/createConsoleLogger.js | 6 +- lib/logging/runtime.js | 18 +- lib/optimize/AggressiveSplittingPlugin.js | 19 +- lib/optimize/ConcatenatedModule.js | 15 +- lib/optimize/InnerGraph.js | 229 ++++++------ lib/optimize/LimitChunkCountPlugin.js | 3 +- lib/optimize/MangleExportsPlugin.js | 4 +- lib/optimize/ModuleConcatenationPlugin.js | 44 +-- lib/optimize/RealContentHashPlugin.js | 43 ++- lib/optimize/RemoveEmptyChunksPlugin.js | 2 +- lib/optimize/SideEffectsFlagPlugin.js | 4 +- lib/optimize/SplitChunksPlugin.js | 12 +- lib/rules/RuleSetCompiler.js | 3 +- .../MakeDeferredNamespaceObjectRuntime.js | 6 +- .../StartupChunkDependenciesRuntimeModule.js | 15 +- lib/schemes/HttpUriPlugin.js | 10 +- lib/serialization/BinaryMiddleware.js | 2 +- lib/serialization/FileMiddleware.js | 4 +- lib/serialization/ObjectMiddleware.js | 4 +- lib/serialization/Serializer.js | 4 +- lib/sharing/ConsumeSharedPlugin.js | 4 +- lib/sharing/ConsumeSharedRuntimeModule.js | 4 +- lib/sharing/ShareRuntimeModule.js | 8 +- lib/sharing/utils.js | 66 ++-- lib/stats/DefaultStatsFactoryPlugin.js | 60 ++-- lib/stats/DefaultStatsPrinterPlugin.js | 2 +- lib/stats/StatsFactory.js | 2 +- lib/stats/StatsPrinter.js | 4 +- lib/util/ArrayQueue.js | 2 +- lib/util/AsyncQueue.js | 2 +- lib/util/IterableHelpers.js | 2 +- lib/util/ParallelismFactorCalculator.js | 2 +- lib/util/SetHelpers.js | 6 +- lib/util/SortableSet.js | 4 +- lib/util/StackedMap.js | 4 +- lib/util/TupleSet.js | 1 + lib/util/URLAbsoluteSpecifier.js | 2 +- lib/util/cleverMerge.js | 8 +- lib/util/comparators.js | 312 ++++++++-------- lib/util/compileBooleanMatcher.js | 4 +- lib/util/concatenate.js | 12 +- lib/util/conventions.js | 145 ++++---- lib/util/deprecation.js | 136 +++---- lib/util/findGraphRoots.js | 4 +- lib/util/fs.js | 18 +- lib/util/identifier.js | 26 +- lib/util/magicComment.js | 10 +- lib/util/processAsyncTree.js | 2 +- lib/util/propertyAccess.js | 2 +- lib/util/propertyName.js | 2 +- lib/util/registerExternalSerializer.js | 3 +- lib/util/runtime.js | 55 ++- .../WasmChunkLoadingRuntimeModule.js | 4 +- lib/wasm-sync/WebAssemblyGenerator.js | 5 +- .../WebAssemblyInInitialChunkError.js | 2 +- lib/wasm-sync/WebAssemblyUtils.js | 2 +- lib/wasm/EnableWasmLoadingPlugin.js | 4 +- lib/webpack.js | 7 +- .../ImportScriptsChunkLoadingRuntimeModule.js | 4 +- test/BenchmarkTestCases.benchmark.mjs | 8 +- test/BinaryMiddleware.unittest.js | 6 +- test/BuildDependencies.longtest.js | 2 +- test/ChangesAndRemovals.test.js | 6 +- test/CleanPlugin.unittest.js | 13 +- test/Compiler-filesystem-caching.test.js | 5 +- test/Compiler.test.js | 2 +- test/ConfigTestCases.template.js | 10 +- test/ContextModuleFactory.unittest.js | 2 +- test/Errors.test.js | 2 +- test/Examples.test.js | 2 + test/FileSystemInfo.unittest.js | 2 +- test/JavascriptParser.unittest.js | 4 +- test/MemoryLimitTestCases.test.js | 26 +- test/MultiCompiler.test.js | 2 +- test/MultiStats.test.js | 2 +- test/NormalModule.unittest.js | 2 +- test/PersistentCaching.test.js | 6 +- test/ProgressPlugin.test.js | 4 +- test/RawModule.unittest.js | 2 +- test/RuntimeTemplate.unittest.js | 2 +- test/SemVer.unittest.js | 8 +- test/SortableSet.unittest.js | 15 +- test/Stats.test.js | 2 +- test/StatsTestCases.basictest.js | 34 +- test/TestCases.template.js | 43 +-- test/TestCasesHot.test.js | 2 +- test/TestCasesModule.test.js | 2 +- test/URLAbsoluteSpecifier.unittest.js | 2 +- test/WasmHashes.unittest.js | 8 +- test/Watch.test.js | 2 +- test/WatchDetection.test.js | 2 +- test/WatchSuspend.test.js | 7 +- test/WatchTestCases.template.js | 4 +- test/WatcherEvents.test.js | 2 +- .../context-commonjs/options.mjs | 6 +- test/benchmarkCases/context-esm/options.mjs | 6 +- .../devtool-eval-source-map/options.mjs | 6 +- test/benchmarkCases/devtool-eval/options.mjs | 6 +- .../devtool-source-map/options.mjs | 6 +- .../future-defaults/options.mjs | 6 +- .../many-chunks-commonjs/options.mjs | 6 +- .../many-chunks-esm/options.mjs | 6 +- .../many-modules-commonjs/options.mjs | 6 +- .../many-modules-esm/options.mjs | 6 +- .../micro-ticks-parents/test.filter.js | 5 +- .../destructuring-assignment/test.filter.js | 2 +- test/cases/chunks/runtime/test.filter.js | 5 +- .../errors/case-sensitive/test.filter.js | 4 +- .../class-dynamic-props/test.filter.js | 4 +- .../inner-graph/extend-class/test.filter.js | 4 +- .../inner-graph/extend-class2/test.filter.js | 4 +- test/cases/large/big-assets/test.filter.js | 4 +- .../large/many-replacements/test.filter.js | 4 +- .../loaders/_esm-loader-type/test.filter.js | 5 +- test/cases/loaders/emit-file/test.filter.js | 4 +- .../mjs/namespace-object-lazy/test.filter.js | 4 +- .../test.filter.js | 4 +- .../test.filter.js | 4 +- .../side-effects-all-used/test.filter.js | 4 +- .../test.filter.js | 4 +- .../test.filter.js | 4 +- .../side-effects-root-unused/test.filter.js | 4 +- .../side-effects-simple-unused/test.filter.js | 4 +- .../test.filter.js | 4 +- test/cases/parsing/chunks/test.filter.js | 4 +- .../parsing/class-properties/test.filter.js | 4 +- test/cases/parsing/class/test.filter.js | 4 +- .../parsing/complex-require/test.filter.js | 4 +- test/cases/parsing/es2020/test.filter.js | 4 +- .../parsing/evaluate-nullish/test.filter.js | 4 +- .../test.filter.js | 5 +- test/cases/parsing/harmony-tdz/test.filter.js | 4 +- test/cases/parsing/iife/test.filter.js | 5 +- test/cases/parsing/issue-16763/test.filter.js | 4 +- test/cases/parsing/issue-2522/test.filter.js | 4 +- test/cases/parsing/issue-2523/test.filter.js | 4 +- test/cases/parsing/issue-2618/test.filter.js | 4 +- test/cases/parsing/issue-2622/test.filter.js | 4 +- test/cases/parsing/issue-2895/test.filter.js | 4 +- test/cases/parsing/issue-3238/test.filter.js | 4 +- test/cases/parsing/issue-3252/test.filter.js | 4 +- test/cases/parsing/issue-3273/test.filter.js | 5 +- test/cases/parsing/issue-4357/test.filter.js | 5 +- .../issue-4608-1-non-strict/test.filter.js | 4 +- .../cases/parsing/issue-4608-2/test.filter.js | 4 +- test/cases/parsing/issue-4870/test.filter.js | 5 +- test/cases/parsing/issue-7519/test.filter.js | 4 +- .../parsing/logical-assignment/test.filter.js | 4 +- .../parsing/nullish-coalescing/test.filter.js | 4 +- .../optional-catch-binding/test.filter.js | 2 +- .../parsing/optional-chaining/test.filter.js | 4 +- test/cases/parsing/spread/test.filter.js | 4 +- .../parsing/typeof-non-module/test.filter.js | 4 +- test/cases/parsing/using/test.filter.js | 2 +- .../inside-class/test.filter.js | 4 +- .../renaming-shorthand-5027/test.filter.js | 19 +- .../side-effects/issue-11673/test.filter.js | 4 +- test/cases/wasm/decoding/test.filter.js | 4 +- .../export-imported-global/test.filter.js | 4 +- .../test.filter.js | 4 +- .../test.filter.js | 4 +- .../wasm/import-wasm-wasm/test.filter.js | 4 +- .../test.filter.js | 4 +- .../test.filter.js | 4 +- .../wasm/imports-circular/test.filter.js | 4 +- .../wasm/imports-complex-types/test.filter.js | 4 +- .../wasm/imports-many-direct/test.filter.js | 4 +- .../wasm/imports-multiple/test.filter.js | 4 +- test/cases/wasm/imports/test.filter.js | 4 +- test/cases/wasm/memory/test.filter.js | 4 +- test/cases/wasm/order/test.filter.js | 4 +- test/cases/wasm/simple/test.filter.js | 4 +- test/cases/wasm/table/test.filter.js | 4 +- .../wasm/two-files-loader/test.filter.js | 4 +- test/cases/wasm/unused-export/test.filter.js | 4 +- test/cases/wasm/v128/test.filter.js | 5 +- .../test.filter.js | 4 +- .../test.filter.js | 4 +- test/checkArrayExpectation.js | 6 +- test/cleverMerge.unittest.js | 6 +- .../asset-emitted/normal/webpack.config.js | 2 +- .../entry-with-runtimeChunk/webpack.config.js | 2 +- .../global-options/webpack.config.js | 2 +- .../only-entry/webpack.config.js | 2 +- .../webpack.config.js | 2 +- .../assets/delete-asset/webpack.config.js | 2 +- .../test.filter.js | 4 +- .../webpack.config.js | 2 +- .../managed-items/webpack.config.js | 2 +- .../chunk-index/issue-18008/webpack.config.js | 6 +- .../order-multiple-entries/webpack.config.js | 14 +- .../recalc-index/webpack.config.js | 6 +- .../clean/ignore-hook/webpack.config.js | 2 +- .../lib-manifest-plugin/webpack.config.js | 2 +- .../re-export-namespace-concat/test.filter.js | 4 +- .../re-export-namespace/test.filter.js | 4 +- .../0-eager-shared/webpack.config.js | 2 +- .../container/eager-shared/webpack.config.js | 2 +- .../webpack.config.js | 2 +- .../css/css-modules/webpack.config.js | 2 +- .../webpack.config.js | 2 +- test/configCases/css/universal/test.filter.js | 4 +- .../localization/webpack.config.js | 1 + .../webpack.config.js | 2 +- .../remove-export/webpack.config.js | 2 +- .../chunk-and-module/webpack.config.js | 2 +- .../chunk-files/webpack.config.js | 4 +- .../invalid-dependencies/webpack.config.js | 10 +- .../depend-on-advanced/webpack.config.js | 2 +- .../entry/depend-on-simple/webpack.config.js | 2 +- .../generator-generate-error/test.filter.js | 4 +- .../import-assertion/webpack.config.js | 2 +- .../import-attributes/webpack.config.js | 2 +- .../externals/module-import/webpack.config.js | 2 +- .../inner-graph/class/test.filter.js | 4 +- .../inner-graph/issue-17565/test.filter.js | 4 +- .../issues/issue-14974/test.filter.js | 4 +- .../issues/issue-3596/webpack.config.js | 2 +- .../library/1-use-library/webpack.config.js | 4 +- .../webpack.config.js | 2 +- .../module-reexport-type/test.filter.js | 4 +- .../module-reexport-type/webpack.config.js | 2 +- .../node/prefix-in-runtime/test.filter.js | 4 +- .../optimization/minimizer/webpack.config.js | 2 +- .../output/worker-public-path/test.filter.js | 4 +- .../dead-code-elimination/webpack.config.js | 2 +- .../parsing/optional-chaining/test.filter.js | 4 +- .../plugins/profiling-plugin/test.filter.js | 4 +- .../webpack.config.js | 2 +- .../webpack.config.js | 2 +- .../webpack.config.js | 2 +- .../import-module/test.filter.js | 2 +- .../rebuild/finishModules/webpack.config.js | 4 +- .../webpack.config.js | 4 +- .../simple-use-fn-array/webpack.config.js | 2 +- .../webpack.config.js | 2 +- .../webpack.config.js | 2 +- .../webpack.config.js | 2 +- .../eval-nosources-source-map/test.filter.js | 4 +- .../source-map/eval-source-map/test.filter.js | 4 +- .../test.filter.js | 4 +- .../webpack.config.js | 4 +- .../split-chunks/asnyc-entries/test.filter.js | 4 +- .../target/node-dynamic-import/test.filter.js | 4 +- .../trusted-types/web-worker/test.filter.js | 4 +- .../types/filesystems/webpack.config.js | 2 +- .../utils/lazy-set/webpack.config.js | 2 +- .../wasm/async-node/test.filter.js | 4 +- test/configCases/wasm/bigints/test.filter.js | 5 +- .../export-imported-global/test.filter.js | 4 +- .../configCases/wasm/externref/test.filter.js | 2 +- test/configCases/wasm/fetch/test.config.js | 2 +- test/configCases/wasm/fetch/test.filter.js | 6 +- .../configCases/wasm/identical/test.filter.js | 4 +- .../wasm/identical/webpack.config.js | 2 +- .../wasm/import-wasm-wasm/test.filter.js | 4 +- .../wasm/reference-types/test.filter.js | 2 +- .../configCases/wasm/universal/test.filter.js | 6 +- .../test.filter.js | 4 +- test/configCases/worker/blob/test.filter.js | 6 +- .../worker/custom-worker/test.filter.js | 4 +- .../worker/issue-17489/test.filter.js | 4 +- .../worker/node-worker-hmr/test.filter.js | 4 +- .../worker/node-worker-named/test.filter.js | 4 +- .../worker/node-worker/test.filter.js | 4 +- .../worker/self-import/test.filter.js | 4 +- .../worker/universal/test.filter.js | 4 +- .../worker/web-worker/test.filter.js | 4 +- .../worker/worker-contenthash/test.filter.js | 4 +- .../configCases/worker/worklet/test.filter.js | 6 +- test/helpers/PluginEnvironment.js | 4 +- test/helpers/captureStdio.js | 2 +- test/helpers/deprecationTracking.js | 4 +- test/hotCases/css/imported-css/test.filter.js | 4 +- .../css/single-css-entry/test.filter.js | 4 +- .../css/with-lazy-compilation/test.filter.js | 4 +- .../test.filter.js | 4 +- .../runtime/add-runtime/test.filter.js | 2 +- .../move-between-runtime/test.filter.js | 4 +- .../worker/remove-add-worker/test.filter.js | 4 +- .../worker/update-in-worker/test.filter.js | 4 +- test/numberHash.unittest.js | 2 +- test/setupTestFramework.js | 2 +- .../define-plugin/webpack.config.js | 2 +- .../test.filter.js | 4 +- .../cache/add-defines/test.filter.js | 5 +- .../cache/asset-concat/test.filter.js | 5 +- .../plugins/define-plugin/webpack.config.js | 2 +- .../side-effects/issue-7400/test.filter.js | 5 +- test/watchCases/wasm/caching/test.filter.js | 4 +- tooling/generate-runtime-code.js | 4 +- tooling/generate-wasm-code.js | 2 +- tooling/print-cache-file.js | 4 +- types.d.ts | 280 +++++++-------- 392 files changed, 1968 insertions(+), 2202 deletions(-) diff --git a/bin/webpack.js b/bin/webpack.js index a87c340fe44..26273bdbc75 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -176,8 +176,9 @@ if (!cli.installed) { ); runCommand( - /** @type {string} */ (packageManager), - installOptions.concat(cli.package) + /** @type {string} */ + (packageManager), + [...installOptions, cli.package] ) .then(() => { runCli(cli); diff --git a/eslint.config.mjs b/eslint.config.mjs index 50c722508cf..6c7f9329f40 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -51,10 +51,8 @@ export default defineConfig([ ignores: ["lib/**/*.runtime.js", "hot/*.js"], extends: [config], rules: { - // Revisit it in future - "id-length": "off", - // Revisit it in future - "no-use-before-define": "off", + // Too noise + "jsdoc/require-property-description": "off", // We have helpers for the default configuration "new-cap": [ "error", @@ -63,15 +61,11 @@ export default defineConfig([ capIsNewExceptions: ["A", "F", "D", "MODULES_GROUPERS"] } ], + // Revisit it in future + "id-length": "off", + // Revisit it in future + "no-use-before-define": "off", - // TODO enable me in future - "prefer-destructuring": "off", - // TODO enable me in future, we need to ignore Object.define - "func-names": "off", - // TODO enable me in future - "unicorn/prefer-spread": "off", - // TODO need patch in tooling, now we are doing weird order for destructuring in cjs import - "import/order": "off", // TODO We need allow to have `_arg` in tooling and use `after-used` value for `args` "no-unused-vars": [ "error", @@ -88,17 +82,14 @@ export default defineConfig([ reportUsedIgnorePattern: false } ], - - // Too noise - "jsdoc/require-property-description": "off", - // TODO enable me in future "unicorn/prefer-regexp-test": "off", "unicorn/prefer-string-slice": "off", - // TODO false positive, need to fix in upstream "n/prefer-node-protocol": "off", - "n/prefer-global/url": "off" + "n/prefer-global/url": "off", + // TODO enable me in future + "prefer-destructuring": "off" } }, { diff --git a/examples/custom-json-modules/webpack.config.js b/examples/custom-json-modules/webpack.config.js index 8fed42c5448..ef7be2e2ee1 100644 --- a/examples/custom-json-modules/webpack.config.js +++ b/examples/custom-json-modules/webpack.config.js @@ -1,7 +1,7 @@ "use strict"; -const toml = require("toml"); const json5 = require("json5"); +const toml = require("toml"); const yaml = require("yamljs"); module.exports = { diff --git a/lib/APIPlugin.js b/lib/APIPlugin.js index 9305f6f3fe0..d51fb7a1ef3 100644 --- a/lib/APIPlugin.js +++ b/lib/APIPlugin.js @@ -17,8 +17,8 @@ const ConstDependency = require("./dependencies/ConstDependency"); const BasicEvaluatedExpression = require("./javascript/BasicEvaluatedExpression"); const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin"); const { - toConstantDependency, - evaluateToString + evaluateToString, + toConstantDependency } = require("./javascript/JavascriptParserHelpers"); const ChunkNameRuntimeModule = require("./runtime/ChunkNameRuntimeModule"); const GetFullHashRuntimeModule = require("./runtime/GetFullHashRuntimeModule"); diff --git a/lib/CaseSensitiveModulesWarning.js b/lib/CaseSensitiveModulesWarning.js index 58a38e5506e..2680753fa1b 100644 --- a/lib/CaseSensitiveModulesWarning.js +++ b/lib/CaseSensitiveModulesWarning.js @@ -35,9 +35,9 @@ const createModulesListMessage = (modules, moduleGraph) => modules .map(m => { let message = `* ${m.identifier()}`; - const validReasons = Array.from( - moduleGraph.getIncomingConnectionsByOriginModule(m).keys() - ).filter(Boolean); + const validReasons = [ + ...moduleGraph.getIncomingConnectionsByOriginModule(m).keys() + ].filter(Boolean); if (validReasons.length > 0) { message += `\n Used by ${validReasons.length} module(s), i. e.`; @@ -56,7 +56,7 @@ class CaseSensitiveModulesWarning extends WebpackError { * @param {ModuleGraph} moduleGraph the module graph */ constructor(modules, moduleGraph) { - const sortedModules = sortModules(Array.from(modules)); + const sortedModules = sortModules([...modules]); const modulesList = createModulesListMessage(sortedModules, moduleGraph); super(`There are multiple modules with names that only differ in casing. This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. diff --git a/lib/Chunk.js b/lib/Chunk.js index dcd0d84ff80..b19d06b6b9d 100644 --- a/lib/Chunk.js +++ b/lib/Chunk.js @@ -11,9 +11,9 @@ const { intersect } = require("./util/SetHelpers"); const SortableSet = require("./util/SortableSet"); const StringXor = require("./util/StringXor"); const { - compareModulesByIdentifier, compareChunkGroupsByIndex, - compareModulesById + compareModulesById, + compareModulesByIdentifier } = require("./util/comparators"); const { createArrayToSetDeprecationSet } = require("./util/deprecation"); const { mergeRuntime } = require("./util/runtime"); @@ -116,13 +116,13 @@ class Chunk { // TODO remove in webpack 6 // BACKWARD-COMPAT START get entryModule() { - const entryModules = Array.from( - ChunkGraph.getChunkGraphForChunk( + const entryModules = [ + ...ChunkGraph.getChunkGraphForChunk( this, "Chunk.entryModule", "DEP_WEBPACK_CHUNK_ENTRY_MODULE" ).getChunkEntryModulesIterable(this) - ); + ]; if (entryModules.length === 0) { return undefined; } else if (entryModules.length === 1) { @@ -747,7 +747,7 @@ class Chunk { } } if (chunkIdSet.size > 0) { - result[name] = Array.from(chunkIdSet); + result[name] = [...chunkIdSet]; } } return result; diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js index 1c62adcff63..0998125b286 100644 --- a/lib/ChunkGraph.js +++ b/lib/ChunkGraph.js @@ -12,21 +12,21 @@ const { DEFAULTS } = require("./config/defaults"); const { first } = require("./util/SetHelpers"); const SortableSet = require("./util/SortableSet"); const { - compareModulesById, + compareIds, compareIterables, + compareModulesById, compareModulesByIdentifier, - concatComparators, compareSelect, - compareIds + concatComparators } = require("./util/comparators"); const createHash = require("./util/createHash"); const findGraphRoots = require("./util/findGraphRoots"); const { RuntimeSpecMap, RuntimeSpecSet, - runtimeToString, + forEachRuntime, mergeRuntime, - forEachRuntime + runtimeToString } = require("./util/runtime"); /** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ @@ -76,7 +76,7 @@ class ModuleHashInfo { * @param {SortableSet} set the set * @returns {T[]} set as array */ -const getArray = set => Array.from(set); +const getArray = set => [...set]; /** * @param {SortableSet} chunks the chunks @@ -141,7 +141,7 @@ const createOrderedArrayFunction = comparator => { if (fn !== undefined) return fn; fn = set => { set.sortWith(comparator); - return Array.from(set); + return [...set]; }; createOrderedArrayFunctionMap.set(comparator, fn); return fn; @@ -310,8 +310,8 @@ class ChunkGraph { */ _getGraphRoots(set) { const { moduleGraph } = this; - return Array.from( - findGraphRoots(set, module => { + return [ + ...findGraphRoots(set, module => { /** @type {Set} */ const set = new Set(); /** @@ -332,7 +332,7 @@ class ChunkGraph { addDependencies(module); return set; }) - ).sort(compareModulesByIdentifier); + ].sort(compareModulesByIdentifier); } /** @@ -1022,9 +1022,10 @@ class ChunkGraph { this.connectChunkAndModule(chunkA, module); } - for (const [module, chunkGroup] of Array.from( - this.getChunkEntryModulesWithChunkGroupIterable(chunkB) - )) { + for (const [ + module, + chunkGroup + ] of this.getChunkEntryModulesWithChunkGroupIterable(chunkB)) { this.disconnectChunkAndEntryModule(chunkB, module); this.connectChunkAndEntryModule( chunkA, @@ -1268,7 +1269,7 @@ class ChunkGraph { */ getChunkRuntimeModulesInOrder(chunk) { const cgc = this._getChunkGraphChunk(chunk); - const array = Array.from(cgc.runtimeModules); + const array = [...cgc.runtimeModules]; array.sort( concatComparators( compareSelect(r => /** @type {RuntimeModule} */ (r).stage, compareIds), @@ -1695,7 +1696,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza } const connectedModulesInOrder = connectedModules.size > 1 - ? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1)) + ? [...connectedModules].sort(([a], [b]) => (a < b ? -1 : 1)) : connectedModules; const hash = createHash(this._hashFunction); /** diff --git a/lib/ChunkGroup.js b/lib/ChunkGroup.js index ab0fbde0351..5306625a6bc 100644 --- a/lib/ChunkGroup.js +++ b/lib/ChunkGroup.js @@ -8,9 +8,9 @@ const util = require("util"); const SortableSet = require("./util/SortableSet"); const { - compareLocations, compareChunks, - compareIterables + compareIterables, + compareLocations } = require("./util/comparators"); /** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */ @@ -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 => Array.from(set); +const getArray = set => [...set]; /** * A convenience method used to sort chunks based on their id's @@ -436,7 +436,7 @@ class ChunkGroup { } } - return Array.from(files); + return [...files]; } /** diff --git a/lib/ChunkTemplate.js b/lib/ChunkTemplate.js index f76557e9e15..fa81ad07891 100644 --- a/lib/ChunkTemplate.js +++ b/lib/ChunkTemplate.js @@ -170,7 +170,7 @@ Object.defineProperty(ChunkTemplate.prototype, "outputOptions", { * @this {ChunkTemplate} * @returns {OutputOptions} output options */ - function () { + function outputOptions() { return this._outputOptions; }, "ChunkTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js index e5e806adf97..cdc39201035 100644 --- a/lib/CleanPlugin.js +++ b/lib/CleanPlugin.js @@ -5,8 +5,8 @@ "use strict"; -const asyncLib = require("neo-async"); const path = require("path"); +const asyncLib = require("neo-async"); const { SyncBailHook } = require("tapable"); const Compilation = require("./Compilation"); const createSchemaValidation = require("./util/create-schema-validation"); diff --git a/lib/CodeGenerationResults.js b/lib/CodeGenerationResults.js index 24f232de9ae..3ba4e8028a3 100644 --- a/lib/CodeGenerationResults.js +++ b/lib/CodeGenerationResults.js @@ -9,7 +9,7 @@ const { DEFAULTS } = require("./config/defaults"); const { getOrInsert } = require("./util/MapHelpers"); const { first } = require("./util/SetHelpers"); const createHash = require("./util/createHash"); -const { runtimeToString, RuntimeSpecMap } = require("./util/runtime"); +const { RuntimeSpecMap, runtimeToString } = require("./util/runtime"); /** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("./Module")} Module */ diff --git a/lib/Compilation.js b/lib/Compilation.js index 9ddba3b929e..b8f83d59e94 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -5,17 +5,17 @@ "use strict"; +const util = require("util"); const asyncLib = require("neo-async"); const { + AsyncParallelHook, + AsyncSeriesBailHook, + AsyncSeriesHook, HookMap, - SyncHook, SyncBailHook, - SyncWaterfallHook, - AsyncSeriesHook, - AsyncSeriesBailHook, - AsyncParallelHook + SyncHook, + SyncWaterfallHook } = require("tapable"); -const util = require("util"); const { CachedSource } = require("webpack-sources"); const { MultiItemCache } = require("./CacheFacade"); const Chunk = require("./Chunk"); @@ -56,7 +56,7 @@ const Stats = require("./Stats"); const WebpackError = require("./WebpackError"); const buildChunkGraph = require("./buildChunkGraph"); const BuildCycleError = require("./errors/BuildCycleError"); -const { Logger, LogType } = require("./logging/Logger"); +const { LogType, Logger } = require("./logging/Logger"); const StatsFactory = require("./stats/StatsFactory"); const StatsPrinter = require("./stats/StatsPrinter"); const { equals: arrayEquals } = require("./util/ArrayHelpers"); @@ -66,18 +66,18 @@ const { getOrInsert } = require("./util/MapHelpers"); const WeakTupleMap = require("./util/WeakTupleMap"); const { cachedCleverMerge } = require("./util/cleverMerge"); const { + compareIds, compareLocations, - concatComparators, + compareModulesByIdentifier, compareSelect, - compareIds, compareStringsNumeric, - compareModulesByIdentifier + concatComparators } = require("./util/comparators"); const createHash = require("./util/createHash"); const { arrayToSetDeprecation, - soonFrozenObjectDeprecation, - createFakeHook + createFakeHook, + soonFrozenObjectDeprecation } = require("./util/deprecation"); const processAsyncTree = require("./util/processAsyncTree"); const { getRuntimeKey } = require("./util/runtime"); @@ -2449,8 +2449,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si */ _rebuildModule(module, callback) { this.hooks.rebuildModule.call(module); - const oldDependencies = module.dependencies.slice(); - const oldBlocks = module.blocks.slice(); + const oldDependencies = [...module.dependencies]; + const oldBlocks = [...module.blocks]; module.invalidateBuild(); this.buildQueue.invalidate(module); this.buildModule(module, err => { @@ -2700,7 +2700,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } if (module.blocks.length > 0) { blocks = []; - const queue = Array.from(module.blocks); + const queue = [...module.blocks]; for (const block of queue) { const chunkGroup = chunkGraph.getBlockChunkGroup(block); if (chunkGroup) { @@ -2732,7 +2732,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } } if (blocks !== undefined) { - const queue = Array.from(module.blocks); + const queue = [...module.blocks]; let i = 0; for (const block of queue) { const chunkGroup = chunkGraph.getBlockChunkGroup(block); @@ -4409,7 +4409,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o let remaining = 0; for (const info of runtimeChunksMap.values()) { for (const other of new Set( - Array.from(info.chunk.getAllReferencedAsyncEntrypoints()).map( + [...info.chunk.getAllReferencedAsyncEntrypoints()].map( e => e.chunks[e.chunks.length - 1] ) )) { @@ -5616,7 +5616,7 @@ Compilation.prototype.factorizeModule = /** (options: FactorizeModuleOptions & { factoryResult?: false }, callback: ModuleCallback): void; (options: FactorizeModuleOptions & { factoryResult: true }, callback: ModuleFactoryResultCallback): void; }} */ ( - function (options, callback) { + function factorizeModule(options, callback) { this.factorizeQueue.add(options, /** @type {TODO} */ (callback)); } ); @@ -5646,7 +5646,7 @@ Object.defineProperty(compilationPrototype, "cache", { * @this {Compilation} the compilation * @returns {Cache} the cache */ - function () { + function cache() { return this.compiler.cache; }, "Compilation.cache was removed in favor of Compilation.getCache()", diff --git a/lib/Compiler.js b/lib/Compiler.js index b6a893fb9ab..24a72571cd2 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -8,13 +8,12 @@ const parseJson = require("json-parse-even-better-errors"); const asyncLib = require("neo-async"); const { - SyncHook, - SyncBailHook, AsyncParallelHook, - AsyncSeriesHook + AsyncSeriesHook, + SyncBailHook, + SyncHook } = require("tapable"); const { SizeOnlySource } = require("webpack-sources"); -const webpack = require("."); const Cache = require("./Cache"); const CacheFacade = require("./CacheFacade"); const ChunkGraph = require("./ChunkGraph"); @@ -29,9 +28,10 @@ const Stats = require("./Stats"); const Watching = require("./Watching"); const WebpackError = require("./WebpackError"); const { Logger } = require("./logging/Logger"); -const { join, dirname, mkdirp } = require("./util/fs"); +const { dirname, join, mkdirp } = require("./util/fs"); const { makePathsRelative } = require("./util/identifier"); const { isSourceEqual } = require("./util/source"); +const webpack = require("."); /** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */ @@ -1260,11 +1260,12 @@ ${other}`); childCompiler.hooks[ /** @type {keyof Compiler["hooks"]} */ (name) - ].taps = - this.hooks[ + ].taps = [ + ...this.hooks[ /** @type {keyof Compiler["hooks"]} */ (name) - ].taps.slice(); + ].taps + ]; } } diff --git a/lib/ConstPlugin.js b/lib/ConstPlugin.js index 9912fd808a0..d79fa0215eb 100644 --- a/lib/ConstPlugin.js +++ b/lib/ConstPlugin.js @@ -68,6 +68,7 @@ const collectDeclaration = (declarations, pattern) => { * @returns {Array} hoisted declarations */ const getHoistedDeclarations = (branch, includeFunctionDeclarations) => { + /** @type {Set} */ const declarations = new Set(); /** @type {Array} */ const stack = [branch]; @@ -129,7 +130,7 @@ const getHoistedDeclarations = (branch, includeFunctionDeclarations) => { break; } } - return Array.from(declarations); + return [...declarations]; }; const PLUGIN_NAME = "ConstPlugin"; diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 011ac40329d..6cbbc7aa0e2 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -16,15 +16,15 @@ const Template = require("./Template"); const WebpackError = require("./WebpackError"); const { compareLocations, - concatComparators, + compareModulesById, compareSelect, - keepOriginalOrder, - compareModulesById + concatComparators, + keepOriginalOrder } = require("./util/comparators"); const { contextify, - parseResource, - makePathsRelative + makePathsRelative, + parseResource } = require("./util/identifier"); const makeSerializable = require("./util/makeSerializable"); @@ -997,10 +997,11 @@ module.exports = webpackAsyncContext;`; if (hasFakeMap) { arrayStart.push(fakeMap[moduleId]); } - map[item.userRequest] = arrayStart.concat( - /** @type {Chunk[]} */ + map[item.userRequest] = [ + ...arrayStart, + .../** @type {Chunk[]} */ (item.chunks).map(chunk => /** @type {ChunkId} */ (chunk.id)) - ); + ]; } } @@ -1187,7 +1188,7 @@ module.exports = webpackEmptyAsyncContext;`; const set = new Set(); const allDeps = this.dependencies.length > 0 - ? /** @type {ContextElementDependency[]} */ (this.dependencies).slice() + ? /** @type {ContextElementDependency[]} */ [...this.dependencies] : []; for (const block of this.blocks) { for (const dep of block.dependencies) { diff --git a/lib/DefinePlugin.js b/lib/DefinePlugin.js index 438b91e95bd..0bc4a6847fa 100644 --- a/lib/DefinePlugin.js +++ b/lib/DefinePlugin.js @@ -7,8 +7,8 @@ const { JAVASCRIPT_MODULE_TYPE_AUTO, - JAVASCRIPT_MODULE_TYPE_ESM, - JAVASCRIPT_MODULE_TYPE_DYNAMIC + JAVASCRIPT_MODULE_TYPE_DYNAMIC, + JAVASCRIPT_MODULE_TYPE_ESM } = require("./ModuleTypeConstants"); const RuntimeGlobals = require("./RuntimeGlobals"); const WebpackError = require("./WebpackError"); diff --git a/lib/ErrorHelpers.js b/lib/ErrorHelpers.js index 58c11554193..af5801786bd 100644 --- a/lib/ErrorHelpers.js +++ b/lib/ErrorHelpers.js @@ -91,10 +91,10 @@ const cleanUpWebpackOptions = (stack, message) => { return stack; }; +module.exports.cleanUp = cleanUp; +module.exports.cleanUpWebpackOptions = cleanUpWebpackOptions; module.exports.cutOffByFlag = cutOffByFlag; module.exports.cutOffLoaderExecution = cutOffLoaderExecution; -module.exports.cutOffWebpackOptions = cutOffWebpackOptions; -module.exports.cutOffMultilineMessage = cutOffMultilineMessage; module.exports.cutOffMessage = cutOffMessage; -module.exports.cleanUp = cleanUp; -module.exports.cleanUpWebpackOptions = cleanUpWebpackOptions; +module.exports.cutOffMultilineMessage = cutOffMultilineMessage; +module.exports.cutOffWebpackOptions = cutOffWebpackOptions; diff --git a/lib/ExportsInfo.js b/lib/ExportsInfo.js index e87d99b98c1..a7d7e9ce682 100644 --- a/lib/ExportsInfo.js +++ b/lib/ExportsInfo.js @@ -727,9 +727,9 @@ class ExportsInfo { ) { const nested = info.exportsInfo.getUsedName(name.slice(1), runtime); if (!nested) return false; - return arr.concat(nested); + return [...arr, ...(Array.isArray(nested) ? nested : [nested])]; } - return arr.concat(name.slice(1)); + return [...arr, ...name.slice(1)]; } const info = this.getReadOnlyExportInfo(name); const usedName = info.getUsedName(name, runtime); @@ -1250,7 +1250,7 @@ class ExportInfo { } } else if ( runtime !== undefined && - Array.from(runtime).every( + [...runtime].every( runtime => !(/** @type {UsedInRuntime} */ (this._usedInRuntime).has(runtime)) ) @@ -1369,7 +1369,7 @@ class ExportInfo { target = { module: newTarget.module, export: newTarget.export - ? newTarget.export.concat(target.export.slice(1)) + ? [...newTarget.export, ...target.export.slice(1)] : target.export.slice(1), deferred: newTarget.deferred }; @@ -1443,10 +1443,11 @@ class ExportInfo { module: newTarget.module, connection: newTarget.connection, export: newTarget.export - ? newTarget.export.concat( - /** @type {NonNullable} */ + ? [ + ...newTarget.export, + .../** @type {NonNullable} */ (target.export).slice(1) - ) + ] : /** @type {NonNullable} */ (target.export).slice(1) }; @@ -1683,5 +1684,5 @@ class ExportInfo { module.exports = ExportsInfo; module.exports.ExportInfo = ExportInfo; -module.exports.UsageState = UsageState; module.exports.RestoreProvidedData = RestoreProvidedData; +module.exports.UsageState = UsageState; diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index 81d71f32ecb..488fe187678 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -12,9 +12,9 @@ const { UsageState } = require("./ExportsInfo"); const InitFragment = require("./InitFragment"); const Module = require("./Module"); const { - JS_TYPES, + CSS_IMPORT_TYPES, CSS_URL_TYPES, - CSS_IMPORT_TYPES + JS_TYPES } = require("./ModuleSourceTypesConstants"); const { JAVASCRIPT_MODULE_TYPE_DYNAMIC } = require("./ModuleTypeConstants"); const RuntimeGlobals = require("./RuntimeGlobals"); diff --git a/lib/ExternalModuleFactoryPlugin.js b/lib/ExternalModuleFactoryPlugin.js index 5517ffb3d26..85b95b95d52 100644 --- a/lib/ExternalModuleFactoryPlugin.js +++ b/lib/ExternalModuleFactoryPlugin.js @@ -12,7 +12,7 @@ const CssImportDependency = require("./dependencies/CssImportDependency"); const CssUrlDependency = require("./dependencies/CssUrlDependency"); const HarmonyImportDependency = require("./dependencies/HarmonyImportDependency"); const ImportDependency = require("./dependencies/ImportDependency"); -const { resolveByProperty, cachedSetProperty } = require("./util/cleverMerge"); +const { cachedSetProperty, resolveByProperty } = require("./util/cleverMerge"); /** @typedef {import("../declarations/WebpackOptions").ExternalItemFunctionData} ExternalItemFunctionData */ /** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectKnown} ExternalItemObjectKnown */ diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index b15951a633b..3cb447e316f 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -5,15 +5,15 @@ "use strict"; -const { create: createResolver } = require("enhanced-resolve"); const nodeModule = require("module"); -const asyncLib = require("neo-async"); const { isAbsolute } = require("path"); +const { create: createResolver } = require("enhanced-resolve"); +const asyncLib = require("neo-async"); const { DEFAULTS } = require("./config/defaults"); const AsyncQueue = require("./util/AsyncQueue"); const StackedCacheMap = require("./util/StackedCacheMap"); const createHash = require("./util/createHash"); -const { join, dirname, relative, lstatReadlinkAbsolute } = require("./util/fs"); +const { dirname, join, lstatReadlinkAbsolute, relative } = require("./util/fs"); const makeSerializable = require("./util/makeSerializable"); const processAsyncTree = require("./util/processAsyncTree"); @@ -1199,7 +1199,7 @@ class FileSystemInfo { parallelism: 10, processor: this._getManagedItemDirectoryInfo.bind(this) }); - const _unmanagedPaths = Array.from(unmanagedPaths); + const _unmanagedPaths = [...unmanagedPaths]; this.unmanagedPathsWithSlash = /** @type {string[]} */ (_unmanagedPaths.filter(p => typeof p === "string")).map(p => @@ -1209,7 +1209,7 @@ class FileSystemInfo { /** @type {RegExp[]} */ (_unmanagedPaths.filter(p => typeof p !== "string")); - this.managedPaths = Array.from(managedPaths); + this.managedPaths = [...managedPaths]; this.managedPathsWithSlash = /** @type {string[]} */ (this.managedPaths.filter(p => typeof p === "string")).map(p => @@ -1219,7 +1219,7 @@ class FileSystemInfo { this.managedPathsRegExps = /** @type {RegExp[]} */ (this.managedPaths.filter(p => typeof p !== "string")); - this.immutablePaths = Array.from(immutablePaths); + this.immutablePaths = [...immutablePaths]; this.immutablePathsWithSlash = /** @type {string[]} */ (this.immutablePaths.filter(p => typeof p === "string")).map(p => diff --git a/lib/FlagDependencyUsagePlugin.js b/lib/FlagDependencyUsagePlugin.js index 3d25a2d0fff..bce1dbe403d 100644 --- a/lib/FlagDependencyUsagePlugin.js +++ b/lib/FlagDependencyUsagePlugin.js @@ -274,7 +274,7 @@ class FlagDependencyUsagePlugin { } else { processReferencedModule( module, - Array.from(referencedExports.values()), + [...referencedExports.values()], runtime, forceSideEffects ); diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index ac76f6bac70..9e63892ad81 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -10,6 +10,12 @@ const { RawSource } = require("webpack-sources"); const ChunkGraph = require("./ChunkGraph"); const Compilation = require("./Compilation"); const HotUpdateChunk = require("./HotUpdateChunk"); +const { + JAVASCRIPT_MODULE_TYPE_AUTO, + JAVASCRIPT_MODULE_TYPE_DYNAMIC, + JAVASCRIPT_MODULE_TYPE_ESM, + WEBPACK_MODULE_TYPE_RUNTIME +} = require("./ModuleTypeConstants"); const NormalModule = require("./NormalModule"); const RuntimeGlobals = require("./RuntimeGlobals"); const WebpackError = require("./WebpackError"); @@ -27,21 +33,14 @@ const { find, isSubset } = require("./util/SetHelpers"); const TupleSet = require("./util/TupleSet"); const { compareModulesById } = require("./util/comparators"); const { + forEachRuntime, getRuntimeKey, + intersectRuntime, keyToRuntime, - forEachRuntime, mergeRuntimeOwned, - subtractRuntime, - intersectRuntime + subtractRuntime } = require("./util/runtime"); -const { - JAVASCRIPT_MODULE_TYPE_AUTO, - JAVASCRIPT_MODULE_TYPE_DYNAMIC, - JAVASCRIPT_MODULE_TYPE_ESM, - WEBPACK_MODULE_TYPE_RUNTIME -} = require("./ModuleTypeConstants"); - /** @typedef {import("estree").CallExpression} CallExpression */ /** @typedef {import("estree").Expression} Expression */ /** @typedef {import("estree").SpreadElement} SpreadElement */ @@ -601,21 +600,21 @@ class HotModuleReplacementPlugin { newModules = chunkGraph .getChunkModules(currentChunk) .filter(module => updatedModules.has(module, currentChunk)); - newRuntimeModules = Array.from( - chunkGraph.getChunkRuntimeModulesIterable(currentChunk) - ).filter(module => updatedModules.has(module, currentChunk)); + newRuntimeModules = [ + ...chunkGraph.getChunkRuntimeModulesIterable(currentChunk) + ].filter(module => updatedModules.has(module, currentChunk)); const fullHashModules = chunkGraph.getChunkFullHashModulesIterable(currentChunk); newFullHashModules = fullHashModules && - Array.from(fullHashModules).filter(module => + [...fullHashModules].filter(module => updatedModules.has(module, currentChunk) ); const dependentHashModules = chunkGraph.getChunkDependentHashModulesIterable(currentChunk); newDependentHashModules = dependentHashModules && - Array.from(dependentHashModules).filter(module => + [...dependentHashModules].filter(module => updatedModules.has(module, currentChunk) ); removedFromRuntime = subtractRuntime(oldRuntime, newRuntime); @@ -776,9 +775,7 @@ class HotModuleReplacementPlugin { }); } } - const completelyRemovedModulesArray = Array.from( - completelyRemovedModules - ); + const completelyRemovedModulesArray = [...completelyRemovedModules]; const hotUpdateMainContentByFilename = new Map(); for (const { removedChunkIds, @@ -823,18 +820,19 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename { removedChunkIds, removedModules, updatedChunkIds, assetInfo } ] of hotUpdateMainContentByFilename) { const hotUpdateMainJson = { - c: Array.from(updatedChunkIds), - r: Array.from(removedChunkIds), + c: [...updatedChunkIds], + r: [...removedChunkIds], m: removedModules.size === 0 ? completelyRemovedModulesArray - : completelyRemovedModulesArray.concat( - Array.from( + : [ + ...completelyRemovedModulesArray, + ...Array.from( removedModules, m => /** @type {ModuleId} */ (chunkGraph.getModuleId(m)) ) - ) + ] }; const source = new RawSource( diff --git a/lib/InvalidDependenciesModuleWarning.js b/lib/InvalidDependenciesModuleWarning.js index a69eed58d92..b77d991b379 100644 --- a/lib/InvalidDependenciesModuleWarning.js +++ b/lib/InvalidDependenciesModuleWarning.js @@ -17,7 +17,7 @@ class InvalidDependenciesModuleWarning extends WebpackError { * @param {Iterable} deps invalid dependencies */ constructor(module, deps) { - const orderedDeps = deps ? Array.from(deps).sort() : []; + const orderedDeps = deps ? [...deps].sort() : []; 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. diff --git a/lib/LibManifestPlugin.js b/lib/LibManifestPlugin.js index debd500bc44..b364564dd34 100644 --- a/lib/LibManifestPlugin.js +++ b/lib/LibManifestPlugin.js @@ -56,7 +56,7 @@ class LibManifestPlugin { // store used paths to detect issue and output an error. #18200 const usedPaths = new Set(); asyncLib.each( - Array.from(compilation.chunks), + [...compilation.chunks], (chunk, callback) => { if (!chunk.canBeInitial()) { callback(); @@ -94,7 +94,8 @@ class LibManifestPlugin { const ident = module.libIdent({ context: this.options.context || - /** @type {string} */ (compiler.options.context), + /** @type {string} */ + (compiler.options.context), associatedObjectForCache: compiler.root }); if (ident) { diff --git a/lib/MainTemplate.js b/lib/MainTemplate.js index 06ecbb04552..599f4fe1c16 100644 --- a/lib/MainTemplate.js +++ b/lib/MainTemplate.js @@ -5,8 +5,8 @@ "use strict"; -const { SyncWaterfallHook } = require("tapable"); const util = require("util"); +const { SyncWaterfallHook } = require("tapable"); const RuntimeGlobals = require("./RuntimeGlobals"); const memoize = require("./util/memoize"); @@ -371,7 +371,7 @@ Object.defineProperty(MainTemplate.prototype, "outputOptions", { * @this {MainTemplate} * @returns {OutputOptions} output options */ - function () { + function outputOptions() { return this._outputOptions; }, "MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", diff --git a/lib/Module.js b/lib/Module.js index 0ecf5a21fdb..f8b967212d9 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -1188,7 +1188,7 @@ Object.defineProperty(Module.prototype, "errors", { * @this {Module} * @returns {WebpackError[]} errors */ - function () { + function errors() { if (this._errors === undefined) { this._errors = []; } @@ -1210,7 +1210,7 @@ Object.defineProperty(Module.prototype, "warnings", { * @this {Module} * @returns {WebpackError[]} warnings */ - function () { + function warnings() { if (this._warnings === undefined) { this._warnings = []; } diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js index b9d2eddc306..a79c7b045e3 100644 --- a/lib/ModuleGraph.js +++ b/lib/ModuleGraph.js @@ -765,8 +765,9 @@ class ModuleGraph { !connection.dependency || connection.dependency instanceof require("./dependencies/CommonJsSelfReferenceDependency") - ) + ) { continue; + } if (connection.dependency.defer) return true; } return false; diff --git a/lib/ModuleGraphConnection.js b/lib/ModuleGraphConnection.js index 5b06d758781..def4ff759c1 100644 --- a/lib/ModuleGraphConnection.js +++ b/lib/ModuleGraphConnection.js @@ -132,7 +132,7 @@ class ModuleGraphConnection { get explanation() { if (this.explanations === undefined) return ""; - return Array.from(this.explanations).join(" "); + return [...this.explanations].join(" "); } /** @@ -190,10 +190,10 @@ class ModuleGraphConnection { /** @typedef {typeof CIRCULAR_CONNECTION} CIRCULAR_CONNECTION */ module.exports = ModuleGraphConnection; -module.exports.addConnectionStates = addConnectionStates; -module.exports.TRANSITIVE_ONLY = /** @type {typeof TRANSITIVE_ONLY} */ ( - TRANSITIVE_ONLY -); module.exports.CIRCULAR_CONNECTION = /** @type {typeof CIRCULAR_CONNECTION} */ ( CIRCULAR_CONNECTION ); +module.exports.TRANSITIVE_ONLY = /** @type {typeof TRANSITIVE_ONLY} */ ( + TRANSITIVE_ONLY +); +module.exports.addConnectionStates = addConnectionStates; diff --git a/lib/ModuleInfoHeaderPlugin.js b/lib/ModuleInfoHeaderPlugin.js index 28073b67ddc..58ad847d3f1 100644 --- a/lib/ModuleInfoHeaderPlugin.js +++ b/lib/ModuleInfoHeaderPlugin.js @@ -5,7 +5,7 @@ "use strict"; -const { ConcatSource, RawSource, CachedSource } = require("webpack-sources"); +const { CachedSource, ConcatSource, RawSource } = require("webpack-sources"); const { UsageState } = require("./ExportsInfo"); const Template = require("./Template"); const CssModulesPlugin = require("./css/CssModulesPlugin"); diff --git a/lib/ModuleSourceTypesConstants.js b/lib/ModuleSourceTypesConstants.js index f78d70a57b6..d81fc8aa066 100644 --- a/lib/ModuleSourceTypesConstants.js +++ b/lib/ModuleSourceTypesConstants.js @@ -102,22 +102,22 @@ const CONSUME_SHARED_TYPES = new Set(["consume-shared"]); */ const SHARED_INIT_TYPES = new Set(["share-init"]); -module.exports.NO_TYPES = NO_TYPES; -module.exports.JS_TYPE = JS_TYPE; -module.exports.JS_TYPES = JS_TYPES; -module.exports.JS_AND_CSS_TYPES = JS_AND_CSS_TYPES; -module.exports.JS_AND_CSS_URL_TYPES = JS_AND_CSS_URL_TYPES; -module.exports.JS_AND_CSS_EXPORT_TYPES = JS_AND_CSS_EXPORT_TYPES; -module.exports.ASSET_TYPES = ASSET_TYPES; -module.exports.ASSET_AND_JS_TYPES = ASSET_AND_JS_TYPES; module.exports.ASSET_AND_CSS_URL_TYPES = ASSET_AND_CSS_URL_TYPES; module.exports.ASSET_AND_JS_AND_CSS_URL_TYPES = ASSET_AND_JS_AND_CSS_URL_TYPES; +module.exports.ASSET_AND_JS_TYPES = ASSET_AND_JS_TYPES; +module.exports.ASSET_TYPES = ASSET_TYPES; +module.exports.CONSUME_SHARED_TYPES = CONSUME_SHARED_TYPES; +module.exports.CSS_IMPORT_TYPES = CSS_IMPORT_TYPES; module.exports.CSS_TYPE = CSS_TYPE; module.exports.CSS_TYPES = CSS_TYPES; module.exports.CSS_URL_TYPES = CSS_URL_TYPES; -module.exports.CSS_IMPORT_TYPES = CSS_IMPORT_TYPES; -module.exports.WEBASSEMBLY_TYPES = WEBASSEMBLY_TYPES; -module.exports.RUNTIME_TYPES = RUNTIME_TYPES; +module.exports.JS_AND_CSS_EXPORT_TYPES = JS_AND_CSS_EXPORT_TYPES; +module.exports.JS_AND_CSS_TYPES = JS_AND_CSS_TYPES; +module.exports.JS_AND_CSS_URL_TYPES = JS_AND_CSS_URL_TYPES; +module.exports.JS_TYPE = JS_TYPE; +module.exports.JS_TYPES = JS_TYPES; +module.exports.NO_TYPES = NO_TYPES; module.exports.REMOTE_AND_SHARE_INIT_TYPES = REMOTE_AND_SHARE_INIT_TYPES; -module.exports.CONSUME_SHARED_TYPES = CONSUME_SHARED_TYPES; +module.exports.RUNTIME_TYPES = RUNTIME_TYPES; module.exports.SHARED_INIT_TYPES = SHARED_INIT_TYPES; +module.exports.WEBASSEMBLY_TYPES = WEBASSEMBLY_TYPES; diff --git a/lib/ModuleTemplate.js b/lib/ModuleTemplate.js index 38f2bd78670..d79802ece00 100644 --- a/lib/ModuleTemplate.js +++ b/lib/ModuleTemplate.js @@ -163,7 +163,7 @@ Object.defineProperty(ModuleTemplate.prototype, "runtimeTemplate", { * @this {ModuleTemplate} * @returns {RuntimeTemplate} output options */ - function () { + function runtimeTemplate() { return this._runtimeTemplate; }, "ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)", diff --git a/lib/ModuleTypeConstants.js b/lib/ModuleTypeConstants.js index 82d8bcfc1d5..484d6d86efb 100644 --- a/lib/ModuleTypeConstants.js +++ b/lib/ModuleTypeConstants.js @@ -144,40 +144,40 @@ const WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = "lazy-compilation-proxy"; /** @typedef {JavaScriptModuleTypes | JSONModuleType | WebAssemblyModuleTypes | CSSModuleTypes | AssetModuleTypes | WebpackModuleTypes | UnknownModuleTypes} ModuleTypes */ module.exports.ASSET_MODULE_TYPE = ASSET_MODULE_TYPE; +module.exports.ASSET_MODULE_TYPE_INLINE = ASSET_MODULE_TYPE_INLINE; module.exports.ASSET_MODULE_TYPE_RAW_DATA_URL = ASSET_MODULE_TYPE_RAW_DATA_URL; -module.exports.ASSET_MODULE_TYPE_SOURCE = ASSET_MODULE_TYPE_SOURCE; module.exports.ASSET_MODULE_TYPE_RESOURCE = ASSET_MODULE_TYPE_RESOURCE; -module.exports.ASSET_MODULE_TYPE_INLINE = ASSET_MODULE_TYPE_INLINE; -module.exports.JAVASCRIPT_MODULE_TYPE_AUTO = JAVASCRIPT_MODULE_TYPE_AUTO; -module.exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = JAVASCRIPT_MODULE_TYPE_DYNAMIC; -module.exports.JAVASCRIPT_MODULE_TYPE_ESM = JAVASCRIPT_MODULE_TYPE_ESM; +module.exports.ASSET_MODULE_TYPE_SOURCE = ASSET_MODULE_TYPE_SOURCE; +module.exports.CSS_MODULES = [ + CSS_MODULE_TYPE, + CSS_MODULE_TYPE_GLOBAL, + CSS_MODULE_TYPE_MODULE, + CSS_MODULE_TYPE_AUTO +]; +module.exports.CSS_MODULE_TYPE = CSS_MODULE_TYPE; +module.exports.CSS_MODULE_TYPE_AUTO = CSS_MODULE_TYPE_AUTO; +module.exports.CSS_MODULE_TYPE_GLOBAL = CSS_MODULE_TYPE_GLOBAL; +module.exports.CSS_MODULE_TYPE_MODULE = CSS_MODULE_TYPE_MODULE; module.exports.JAVASCRIPT_MODULES = [ JAVASCRIPT_MODULE_TYPE_AUTO, JAVASCRIPT_MODULE_TYPE_DYNAMIC, JAVASCRIPT_MODULE_TYPE_ESM ]; +module.exports.JAVASCRIPT_MODULE_TYPE_AUTO = JAVASCRIPT_MODULE_TYPE_AUTO; +module.exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = JAVASCRIPT_MODULE_TYPE_DYNAMIC; +module.exports.JAVASCRIPT_MODULE_TYPE_ESM = JAVASCRIPT_MODULE_TYPE_ESM; module.exports.JSON_MODULE_TYPE = JSON_MODULE_TYPE; -module.exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = WEBASSEMBLY_MODULE_TYPE_ASYNC; -module.exports.WEBASSEMBLY_MODULE_TYPE_SYNC = WEBASSEMBLY_MODULE_TYPE_SYNC; module.exports.WEBASSEMBLY_MODULES = [ WEBASSEMBLY_MODULE_TYPE_SYNC, WEBASSEMBLY_MODULE_TYPE_SYNC ]; -module.exports.CSS_MODULE_TYPE = CSS_MODULE_TYPE; -module.exports.CSS_MODULE_TYPE_GLOBAL = CSS_MODULE_TYPE_GLOBAL; -module.exports.CSS_MODULE_TYPE_MODULE = CSS_MODULE_TYPE_MODULE; -module.exports.CSS_MODULE_TYPE_AUTO = CSS_MODULE_TYPE_AUTO; -module.exports.CSS_MODULES = [ - CSS_MODULE_TYPE, - CSS_MODULE_TYPE_GLOBAL, - CSS_MODULE_TYPE_MODULE, - CSS_MODULE_TYPE_AUTO -]; -module.exports.WEBPACK_MODULE_TYPE_RUNTIME = WEBPACK_MODULE_TYPE_RUNTIME; -module.exports.WEBPACK_MODULE_TYPE_FALLBACK = WEBPACK_MODULE_TYPE_FALLBACK; -module.exports.WEBPACK_MODULE_TYPE_REMOTE = WEBPACK_MODULE_TYPE_REMOTE; -module.exports.WEBPACK_MODULE_TYPE_PROVIDE = WEBPACK_MODULE_TYPE_PROVIDE; +module.exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = WEBASSEMBLY_MODULE_TYPE_ASYNC; +module.exports.WEBASSEMBLY_MODULE_TYPE_SYNC = WEBASSEMBLY_MODULE_TYPE_SYNC; module.exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE; +module.exports.WEBPACK_MODULE_TYPE_FALLBACK = WEBPACK_MODULE_TYPE_FALLBACK; module.exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY; +module.exports.WEBPACK_MODULE_TYPE_PROVIDE = WEBPACK_MODULE_TYPE_PROVIDE; +module.exports.WEBPACK_MODULE_TYPE_REMOTE = WEBPACK_MODULE_TYPE_REMOTE; +module.exports.WEBPACK_MODULE_TYPE_RUNTIME = WEBPACK_MODULE_TYPE_RUNTIME; diff --git a/lib/MultiCompiler.js b/lib/MultiCompiler.js index 28e544ca618..5b8a6597d84 100644 --- a/lib/MultiCompiler.js +++ b/lib/MultiCompiler.js @@ -6,7 +6,7 @@ "use strict"; const asyncLib = require("neo-async"); -const { SyncHook, MultiHook } = require("tapable"); +const { MultiHook, SyncHook } = require("tapable"); const ConcurrentCompilationError = require("./ConcurrentCompilationError"); const MultiStats = require("./MultiStats"); @@ -305,7 +305,7 @@ module.exports = class MultiCompiler { } if (edges.size > 0) { /** @type {string[]} */ - const lines = Array.from(edges) + const lines = [...edges] .sort(sortEdges) .map(edge => `${edge.source.name} -> ${edge.target.name}`); lines.unshift("Circular dependency found in compiler dependencies."); diff --git a/lib/NormalModule.js b/lib/NormalModule.js index efa95213682..0e2d41ef25b 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -5,14 +5,14 @@ "use strict"; +const querystring = require("querystring"); const parseJson = require("json-parse-even-better-errors"); const { getContext, runLoaders } = require("loader-runner"); -const querystring = require("querystring"); const { + AsyncSeriesBailHook, HookMap, SyncHook, - SyncWaterfallHook, - AsyncSeriesBailHook + SyncWaterfallHook } = require("tapable"); const { CachedSource, @@ -38,16 +38,16 @@ const { isSubset } = require("./util/SetHelpers"); const { getScheme } = require("./util/URLAbsoluteSpecifier"); const { compareLocations, - concatComparators, compareSelect, + concatComparators, keepOriginalOrder } = require("./util/comparators"); const createHash = require("./util/createHash"); const { createFakeHook } = require("./util/deprecation"); const { join } = require("./util/fs"); const { - contextify, absolutify, + contextify, makePathsRelative } = require("./util/identifier"); const makeSerializable = require("./util/makeSerializable"); diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js index 65966498eaa..09cb4f594af 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -9,10 +9,10 @@ const { getContext } = require("loader-runner"); const asyncLib = require("neo-async"); const { AsyncSeriesBailHook, - SyncWaterfallHook, + HookMap, SyncBailHook, SyncHook, - HookMap + SyncWaterfallHook } = require("tapable"); const ChunkGraph = require("./ChunkGraph"); const Module = require("./Module"); @@ -1011,9 +1011,7 @@ ${hints.join("\n\n")}`; // Check if the extension is missing a leading dot (e.g. "js" instead of ".js") let appendResolveExtensionsHint = false; - const specifiedExtensions = Array.from( - resolver.options.extensions - ); + const specifiedExtensions = [...resolver.options.extensions]; const expectedExtensions = specifiedExtensions.map(extension => { if (LEADING_DOT_EXTENSION_REGEX.test(extension)) { appendResolveExtensionsHint = true; diff --git a/lib/NormalModuleReplacementPlugin.js b/lib/NormalModuleReplacementPlugin.js index f816d5018de..80206f26ac0 100644 --- a/lib/NormalModuleReplacementPlugin.js +++ b/lib/NormalModuleReplacementPlugin.js @@ -5,7 +5,7 @@ "use strict"; -const { join, dirname } = require("./util/fs"); +const { dirname, join } = require("./util/fs"); /** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */ diff --git a/lib/OptimizationStages.js b/lib/OptimizationStages.js index 102d613c5aa..c464b8abef3 100644 --- a/lib/OptimizationStages.js +++ b/lib/OptimizationStages.js @@ -5,6 +5,6 @@ "use strict"; +module.exports.STAGE_ADVANCED = 10; module.exports.STAGE_BASIC = -10; module.exports.STAGE_DEFAULT = 0; -module.exports.STAGE_ADVANCED = 10; diff --git a/lib/ProvidePlugin.js b/lib/ProvidePlugin.js index 28c3ce5d590..dbf98a69a41 100644 --- a/lib/ProvidePlugin.js +++ b/lib/ProvidePlugin.js @@ -61,7 +61,11 @@ class ProvidePlugin { for (const name of Object.keys(definitions)) { const request = /** @type {string[]} */ - ([]).concat(definitions[name]); + ([ + ...(Array.isArray(definitions[name]) + ? definitions[name] + : [definitions[name]]) + ]); const splittedName = name.split("."); if (splittedName.length > 0) { for (const [i, _] of splittedName.slice(1).entries()) { diff --git a/lib/RecordIdsPlugin.js b/lib/RecordIdsPlugin.js index d649cab28d2..f3e11443905 100644 --- a/lib/RecordIdsPlugin.js +++ b/lib/RecordIdsPlugin.js @@ -84,7 +84,7 @@ class RecordIdsPlugin { records.modules.byIdentifier[identifier] = moduleId; usedIds.add(moduleId); } - records.modules.usedIds = Array.from(usedIds).sort(compareNumbers); + records.modules.usedIds = [...usedIds].sort(compareNumbers); }); compilation.hooks.reviveModules.tap(PLUGIN_NAME, (modules, records) => { if (!records.modules) return; @@ -168,7 +168,7 @@ class RecordIdsPlugin { } usedIds.add(chunk.id); } - records.chunks.usedIds = Array.from(usedIds).sort(compareNumbers); + records.chunks.usedIds = [...usedIds].sort(compareNumbers); }); compilation.hooks.reviveChunks.tap(PLUGIN_NAME, (chunks, records) => { if (!records.chunks) return; diff --git a/lib/RuntimeGlobals.js b/lib/RuntimeGlobals.js index 84a69fbb62a..753d6891ea4 100644 --- a/lib/RuntimeGlobals.js +++ b/lib/RuntimeGlobals.js @@ -6,69 +6,87 @@ "use strict"; /** - * the internal require function + * the AMD define function */ -module.exports.require = "__webpack_require__"; +module.exports.amdDefine = "__webpack_require__.amdD"; /** - * access to properties of the internal require function/object + * the AMD options */ -module.exports.requireScope = "__webpack_require__.*"; +module.exports.amdOptions = "__webpack_require__.amdO"; /** - * the internal exports object + * Creates an async module. The body function must be a async function. + * "module.exports" will be decorated with an AsyncModulePromise. + * The body function will be called. + * To handle async dependencies correctly do this: "([a, b, c] = await handleDependencies([a, b, c]));". + * If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function. + * Signature: function( + * module: Module, + * body: (handleDependencies: (deps: AsyncModulePromise[]) => Promise & () => void, + * hasAwaitAfterDependencies?: boolean + * ) => void */ -module.exports.exports = "__webpack_exports__"; +module.exports.asyncModule = "__webpack_require__.a"; /** - * top-level this need to be the exports object + * The internal symbol that asyncModule is using. */ -module.exports.thisAsExports = "top-level-this-exports"; +module.exports.asyncModuleDoneSymbol = "__webpack_require__.aD"; /** - * runtime need to return the exports of the last entry module + * The internal symbol that asyncModule is using. */ -module.exports.returnExportsFromRuntime = "return-exports-from-runtime"; +module.exports.asyncModuleExportSymbol = "__webpack_require__.aE"; /** - * the internal module object + * the baseURI of current document */ -module.exports.module = "module"; +module.exports.baseURI = "__webpack_require__.b"; /** - * the internal module object + * global callback functions for installing chunks */ -module.exports.moduleId = "module.id"; +module.exports.chunkCallback = "webpackChunk"; /** - * the internal module object + * the chunk name of the chunk with the runtime */ -module.exports.moduleLoaded = "module.loaded"; +module.exports.chunkName = "__webpack_require__.cn"; /** - * the bundle public path + * compatibility get default export */ -module.exports.publicPath = "__webpack_require__.p"; +module.exports.compatGetDefaultExport = "__webpack_require__.n"; /** - * the module id of the entry point + * create a fake namespace object */ -module.exports.entryModuleId = "__webpack_require__.s"; +module.exports.createFakeNamespaceObject = "__webpack_require__.t"; /** - * the module cache + * function to promote a string to a TrustedScript using webpack's Trusted + * Types policy + * Arguments: (script: string) => TrustedScript */ -module.exports.moduleCache = "__webpack_require__.c"; +module.exports.createScript = "__webpack_require__.ts"; /** - * the module functions + * function to promote a string to a TrustedScriptURL using webpack's Trusted + * Types policy + * Arguments: (url: string) => TrustedScriptURL */ -module.exports.moduleFactories = "__webpack_require__.m"; +module.exports.createScriptUrl = "__webpack_require__.tu"; /** - * the module functions, with only write access + * The current scope when getting a module from a remote */ -module.exports.moduleFactoriesAddOnly = "__webpack_require__.m (add only)"; +module.exports.currentRemoteGetScope = "__webpack_require__.R"; + +/** + * the exported property define getters function + */ +module.exports.definePropertyGetters = "__webpack_require__.d"; /** * the chunk ensure function @@ -87,191 +105,182 @@ module.exports.ensureChunkIncludeEntries = "__webpack_require__.f (include entries)"; /** - * the chunk prefetch function - */ -module.exports.prefetchChunk = "__webpack_require__.E"; - -/** - * an object with handlers to prefetch a chunk + * the module id of the entry point */ -module.exports.prefetchChunkHandlers = "__webpack_require__.F"; +module.exports.entryModuleId = "__webpack_require__.s"; /** - * the chunk preload function + * the internal exports object */ -module.exports.preloadChunk = "__webpack_require__.G"; +module.exports.exports = "__webpack_exports__"; /** - * an object with handlers to preload a chunk + * method to install a chunk that was loaded somehow + * Signature: ({ id, ids, modules, runtime }) => void */ -module.exports.preloadChunkHandlers = "__webpack_require__.H"; +module.exports.externalInstallChunk = "__webpack_require__.C"; /** - * the exported property define getters function + * the filename of the css part of the chunk */ -module.exports.definePropertyGetters = "__webpack_require__.d"; +module.exports.getChunkCssFilename = "__webpack_require__.k"; /** - * define compatibility on export + * the filename of the script part of the chunk */ -module.exports.makeNamespaceObject = "__webpack_require__.r"; +module.exports.getChunkScriptFilename = "__webpack_require__.u"; /** - * make a deferred namespace object + * the filename of the css part of the hot update chunk */ -module.exports.makeDeferredNamespaceObject = "__webpack_require__.z"; +module.exports.getChunkUpdateCssFilename = "__webpack_require__.hk"; /** - * the internal symbol that makeDeferredNamespaceObject is using. + * the filename of the script part of the hot update chunk */ -module.exports.makeDeferredNamespaceObjectSymbol = "__webpack_require__.zS"; +module.exports.getChunkUpdateScriptFilename = "__webpack_require__.hu"; /** - * create a fake namespace object + * the webpack hash */ -module.exports.createFakeNamespaceObject = "__webpack_require__.t"; +module.exports.getFullHash = "__webpack_require__.h"; /** - * compatibility get default export + * function to return webpack's Trusted Types policy + * Arguments: () => TrustedTypePolicy */ -module.exports.compatGetDefaultExport = "__webpack_require__.n"; +module.exports.getTrustedTypesPolicy = "__webpack_require__.tt"; /** - * harmony module decorator + * the filename of the HMR manifest */ -module.exports.harmonyModuleDecorator = "__webpack_require__.hmd"; +module.exports.getUpdateManifestFilename = "__webpack_require__.hmrF"; /** - * node.js module decorator + * the global object */ -module.exports.nodeModuleDecorator = "__webpack_require__.nmd"; +module.exports.global = "__webpack_require__.g"; /** - * the webpack hash + * harmony module decorator */ -module.exports.getFullHash = "__webpack_require__.h"; +module.exports.harmonyModuleDecorator = "__webpack_require__.hmd"; /** - * an object containing all installed WebAssembly.Instance export objects keyed by module id + * a flag when a module/chunk/tree has css modules */ -module.exports.wasmInstances = "__webpack_require__.w"; +module.exports.hasCssModules = "has css modules"; /** - * instantiate a wasm instance from module exports object, id, hash and importsObject + * a flag when a chunk has a fetch priority */ -module.exports.instantiateWasm = "__webpack_require__.v"; +module.exports.hasFetchPriority = "has fetch priority"; /** - * the uncaught error handler for the webpack runtime + * the shorthand for Object.prototype.hasOwnProperty + * using of it decreases the compiled bundle size */ -module.exports.uncaughtErrorHandler = "__webpack_require__.oe"; +module.exports.hasOwnProperty = "__webpack_require__.o"; /** - * the script nonce + * function downloading the update manifest */ -module.exports.scriptNonce = "__webpack_require__.nc"; +module.exports.hmrDownloadManifest = "__webpack_require__.hmrM"; /** - * function to load a script tag. - * Arguments: (url: string, done: (event) => void), key?: string | number, chunkId?: string | number) => void - * done function is called when loading has finished or timeout occurred. - * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url. + * array with handler functions to download chunk updates */ -module.exports.loadScript = "__webpack_require__.l"; +module.exports.hmrDownloadUpdateHandlers = "__webpack_require__.hmrC"; /** - * function to promote a string to a TrustedScript using webpack's Trusted - * Types policy - * Arguments: (script: string) => TrustedScript + * array with handler functions when a module should be invalidated */ -module.exports.createScript = "__webpack_require__.ts"; +module.exports.hmrInvalidateModuleHandlers = "__webpack_require__.hmrI"; /** - * function to promote a string to a TrustedScriptURL using webpack's Trusted - * Types policy - * Arguments: (url: string) => TrustedScriptURL + * object with all hmr module data for all modules */ -module.exports.createScriptUrl = "__webpack_require__.tu"; +module.exports.hmrModuleData = "__webpack_require__.hmrD"; /** - * function to return webpack's Trusted Types policy - * Arguments: () => TrustedTypePolicy + * the prefix for storing state of runtime modules when hmr is enabled */ -module.exports.getTrustedTypesPolicy = "__webpack_require__.tt"; +module.exports.hmrRuntimeStatePrefix = "__webpack_require__.hmrS"; /** - * a flag when a chunk has a fetch priority + * The sharing init sequence function (only runs once per share scope). + * Has one argument, the name of the share scope. + * Creates a share scope if not existing */ -module.exports.hasFetchPriority = "has fetch priority"; +module.exports.initializeSharing = "__webpack_require__.I"; /** - * the chunk name of the chunk with the runtime + * instantiate a wasm instance from module exports object, id, hash and importsObject */ -module.exports.chunkName = "__webpack_require__.cn"; +module.exports.instantiateWasm = "__webpack_require__.v"; /** - * the runtime id of the current runtime + * interceptor for module executions */ -module.exports.runtimeId = "__webpack_require__.j"; +module.exports.interceptModuleExecution = "__webpack_require__.i"; /** - * the filename of the script part of the chunk + * function to load a script tag. + * Arguments: (url: string, done: (event) => void), key?: string | number, chunkId?: string | number) => void + * done function is called when loading has finished or timeout occurred. + * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url. */ -module.exports.getChunkScriptFilename = "__webpack_require__.u"; +module.exports.loadScript = "__webpack_require__.l"; /** - * the filename of the css part of the chunk + * make a deferred namespace object */ -module.exports.getChunkCssFilename = "__webpack_require__.k"; +module.exports.makeDeferredNamespaceObject = "__webpack_require__.z"; /** - * a flag when a module/chunk/tree has css modules + * the internal symbol that makeDeferredNamespaceObject is using. */ -module.exports.hasCssModules = "has css modules"; +module.exports.makeDeferredNamespaceObjectSymbol = "__webpack_require__.zS"; /** - * the filename of the script part of the hot update chunk + * define compatibility on export */ -module.exports.getChunkUpdateScriptFilename = "__webpack_require__.hu"; +module.exports.makeNamespaceObject = "__webpack_require__.r"; /** - * the filename of the css part of the hot update chunk + * the internal module object */ -module.exports.getChunkUpdateCssFilename = "__webpack_require__.hk"; +module.exports.module = "module"; /** - * startup signal from runtime - * This will be called when the runtime chunk has been loaded. + * the module cache */ -module.exports.startup = "__webpack_require__.x"; +module.exports.moduleCache = "__webpack_require__.c"; /** - * @deprecated - * creating a default startup function with the entry modules + * the module functions */ -module.exports.startupNoDefault = "__webpack_require__.x (no default handler)"; +module.exports.moduleFactories = "__webpack_require__.m"; /** - * startup signal from runtime but only used to add logic after the startup + * the module functions, with only write access */ -module.exports.startupOnlyAfter = "__webpack_require__.x (only after)"; +module.exports.moduleFactoriesAddOnly = "__webpack_require__.m (add only)"; /** - * startup signal from runtime but only used to add sync logic before the startup + * the internal module object */ -module.exports.startupOnlyBefore = "__webpack_require__.x (only before)"; +module.exports.moduleId = "module.id"; /** - * global callback functions for installing chunks + * the internal module object */ -module.exports.chunkCallback = "webpackChunk"; +module.exports.moduleLoaded = "module.loaded"; /** - * method to startup an entrypoint with needed chunks. - * Signature: (moduleId: Id, chunkIds: Id[]) => any. - * Returns the exports of the module or a Promise + * node.js module decorator */ -module.exports.startupEntrypoint = "__webpack_require__.X"; +module.exports.nodeModuleDecorator = "__webpack_require__.nmd"; /** * register deferred code, which will run when certain @@ -284,124 +293,115 @@ module.exports.startupEntrypoint = "__webpack_require__.X"; module.exports.onChunksLoaded = "__webpack_require__.O"; /** - * method to install a chunk that was loaded somehow - * Signature: ({ id, ids, modules, runtime }) => void + * the chunk prefetch function */ -module.exports.externalInstallChunk = "__webpack_require__.C"; +module.exports.prefetchChunk = "__webpack_require__.E"; /** - * interceptor for module executions + * an object with handlers to prefetch a chunk */ -module.exports.interceptModuleExecution = "__webpack_require__.i"; +module.exports.prefetchChunkHandlers = "__webpack_require__.F"; /** - * the global object + * the chunk preload function */ -module.exports.global = "__webpack_require__.g"; +module.exports.preloadChunk = "__webpack_require__.G"; /** - * an object with all share scopes + * an object with handlers to preload a chunk */ -module.exports.shareScopeMap = "__webpack_require__.S"; +module.exports.preloadChunkHandlers = "__webpack_require__.H"; /** - * The sharing init sequence function (only runs once per share scope). - * Has one argument, the name of the share scope. - * Creates a share scope if not existing + * the bundle public path */ -module.exports.initializeSharing = "__webpack_require__.I"; +module.exports.publicPath = "__webpack_require__.p"; /** - * The current scope when getting a module from a remote + * a RelativeURL class when relative URLs are used */ -module.exports.currentRemoteGetScope = "__webpack_require__.R"; +module.exports.relativeUrl = "__webpack_require__.U"; /** - * the filename of the HMR manifest + * the internal require function */ -module.exports.getUpdateManifestFilename = "__webpack_require__.hmrF"; +module.exports.require = "__webpack_require__"; /** - * function downloading the update manifest + * access to properties of the internal require function/object */ -module.exports.hmrDownloadManifest = "__webpack_require__.hmrM"; +module.exports.requireScope = "__webpack_require__.*"; /** - * array with handler functions to download chunk updates + * runtime need to return the exports of the last entry module */ -module.exports.hmrDownloadUpdateHandlers = "__webpack_require__.hmrC"; +module.exports.returnExportsFromRuntime = "return-exports-from-runtime"; /** - * object with all hmr module data for all modules + * the runtime id of the current runtime */ -module.exports.hmrModuleData = "__webpack_require__.hmrD"; +module.exports.runtimeId = "__webpack_require__.j"; /** - * array with handler functions when a module should be invalidated + * the script nonce */ -module.exports.hmrInvalidateModuleHandlers = "__webpack_require__.hmrI"; +module.exports.scriptNonce = "__webpack_require__.nc"; /** - * the prefix for storing state of runtime modules when hmr is enabled + * an object with all share scopes */ -module.exports.hmrRuntimeStatePrefix = "__webpack_require__.hmrS"; +module.exports.shareScopeMap = "__webpack_require__.S"; /** - * the AMD define function + * startup signal from runtime + * This will be called when the runtime chunk has been loaded. */ -module.exports.amdDefine = "__webpack_require__.amdD"; +module.exports.startup = "__webpack_require__.x"; /** - * the AMD options + * method to startup an entrypoint with needed chunks. + * Signature: (moduleId: Id, chunkIds: Id[]) => any. + * Returns the exports of the module or a Promise */ -module.exports.amdOptions = "__webpack_require__.amdO"; +module.exports.startupEntrypoint = "__webpack_require__.X"; /** - * the System polyfill object + * @deprecated + * creating a default startup function with the entry modules */ -module.exports.system = "__webpack_require__.System"; +module.exports.startupNoDefault = "__webpack_require__.x (no default handler)"; /** - * the shorthand for Object.prototype.hasOwnProperty - * using of it decreases the compiled bundle size + * startup signal from runtime but only used to add logic after the startup */ -module.exports.hasOwnProperty = "__webpack_require__.o"; +module.exports.startupOnlyAfter = "__webpack_require__.x (only after)"; /** - * the System.register context object + * startup signal from runtime but only used to add sync logic before the startup */ -module.exports.systemContext = "__webpack_require__.y"; +module.exports.startupOnlyBefore = "__webpack_require__.x (only before)"; /** - * the baseURI of current document + * the System polyfill object */ -module.exports.baseURI = "__webpack_require__.b"; +module.exports.system = "__webpack_require__.System"; /** - * a RelativeURL class when relative URLs are used + * the System.register context object */ -module.exports.relativeUrl = "__webpack_require__.U"; +module.exports.systemContext = "__webpack_require__.y"; /** - * Creates an async module. The body function must be a async function. - * "module.exports" will be decorated with an AsyncModulePromise. - * The body function will be called. - * To handle async dependencies correctly do this: "([a, b, c] = await handleDependencies([a, b, c]));". - * If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function. - * Signature: function( - * module: Module, - * body: (handleDependencies: (deps: AsyncModulePromise[]) => Promise & () => void, - * hasAwaitAfterDependencies?: boolean - * ) => void + * top-level this need to be the exports object */ -module.exports.asyncModule = "__webpack_require__.a"; +module.exports.thisAsExports = "top-level-this-exports"; /** - * The internal symbol that asyncModule is using. + * the uncaught error handler for the webpack runtime */ -module.exports.asyncModuleExportSymbol = "__webpack_require__.aE"; +module.exports.uncaughtErrorHandler = "__webpack_require__.oe"; /** - * The internal symbol that asyncModule is using. + * an object containing all installed WebAssembly.Instance export objects keyed by module id */ -module.exports.asyncModuleDoneSymbol = "__webpack_require__.aD"; +module.exports.wasmInstances = "__webpack_require__.w"; diff --git a/lib/RuntimeTemplate.js b/lib/RuntimeTemplate.js index e39308911c1..b56296e3109 100644 --- a/lib/RuntimeTemplate.js +++ b/lib/RuntimeTemplate.js @@ -55,9 +55,7 @@ Module has these incoming connections: ${Array.from( `\n - ${ connection.originModule && connection.originModule.identifier() } ${connection.dependency && connection.dependency.type} ${ - (connection.explanations && - Array.from(connection.explanations).join(", ")) || - "" + (connection.explanations && [...connection.explanations].join(", ")) || "" }` ).join("")}`; @@ -776,8 +774,8 @@ class RuntimeTemplate { ); runtimeRequirements.add(RuntimeGlobals.runtimeId); return compileBooleanMatcher.fromLists( - Array.from(positiveRuntimeIds), - Array.from(negativeRuntimeIds) + [...positiveRuntimeIds], + [...negativeRuntimeIds] )(RuntimeGlobals.runtimeId); } diff --git a/lib/SourceMapDevToolPlugin.js b/lib/SourceMapDevToolPlugin.js index 6b378278194..f5f28efd533 100644 --- a/lib/SourceMapDevToolPlugin.js +++ b/lib/SourceMapDevToolPlugin.js @@ -13,7 +13,7 @@ const ProgressPlugin = require("./ProgressPlugin"); const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOptionsPlugin"); const createSchemaValidation = require("./util/create-schema-validation"); const createHash = require("./util/createHash"); -const { relative, dirname } = require("./util/fs"); +const { dirname, relative } = require("./util/fs"); const generateDebugId = require("./util/generateDebugId"); const { makePathsAbsolute } = require("./util/identifier"); @@ -363,13 +363,13 @@ class SourceMapDevToolPlugin { * all modules in defined order (longest identifier first) * @type {Array} */ - const allModules = Array.from( - moduleToSourceNameMapping.keys() - ).sort((a, b) => { - const ai = typeof a === "string" ? a : a.identifier(); - const bi = typeof b === "string" ? b : b.identifier(); - return ai.length - bi.length; - }); + const allModules = [...moduleToSourceNameMapping.keys()].sort( + (a, b) => { + const ai = typeof a === "string" ? a : a.identifier(); + const bi = typeof b === "string" ? b : b.identifier(); + return ai.length - bi.length; + } + ); // find modules with conflicting source names for (let idx = 0; idx < allModules.length; idx++) { diff --git a/lib/Template.js b/lib/Template.js index 6ca6f1205ac..9b91ac0f040 100644 --- a/lib/Template.js +++ b/lib/Template.js @@ -410,7 +410,7 @@ class Template { } module.exports = Template; -module.exports.NUMBER_OF_IDENTIFIER_START_CHARS = - NUMBER_OF_IDENTIFIER_START_CHARS; module.exports.NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS; +module.exports.NUMBER_OF_IDENTIFIER_START_CHARS = + NUMBER_OF_IDENTIFIER_START_CHARS; diff --git a/lib/TemplatedPathPlugin.js b/lib/TemplatedPathPlugin.js index 4f79169c34e..3439bfd4b46 100644 --- a/lib/TemplatedPathPlugin.js +++ b/lib/TemplatedPathPlugin.js @@ -5,9 +5,9 @@ "use strict"; -const mime = require("mime-types"); const { basename, extname } = require("path"); const util = require("util"); +const mime = require("mime-types"); const Chunk = require("./Chunk"); const Module = require("./Module"); const { parseResource } = require("./util/identifier"); diff --git a/lib/WatchIgnorePlugin.js b/lib/WatchIgnorePlugin.js index 54046458b1a..0840575fc23 100644 --- a/lib/WatchIgnorePlugin.js +++ b/lib/WatchIgnorePlugin.js @@ -15,6 +15,7 @@ const createSchemaValidation = require("./util/create-schema-validation"); /** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ /** @typedef {import("./util/fs").WatchMethod} WatchMethod */ /** @typedef {import("./util/fs").Watcher} Watcher */ + const validate = createSchemaValidation( require("../schemas/plugins/WatchIgnorePlugin.check"), () => require("../schemas/plugins/WatchIgnorePlugin.json"), @@ -38,8 +39,8 @@ class IgnoringWatchFileSystem { /** @type {WatchMethod} */ watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) { - files = Array.from(files); - dirs = Array.from(dirs); + files = [...files]; + dirs = [...dirs]; /** * @param {string} path path to check * @returns {boolean} true, if path is ignored diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index be953b2de4e..070ecef3b0f 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -5,51 +5,68 @@ "use strict"; -const OptionsApply = require("./OptionsApply"); +const APIPlugin = require("./APIPlugin"); -const AssetModulesPlugin = require("./asset/AssetModulesPlugin"); -const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin"); -const JsonModulesPlugin = require("./json/JsonModulesPlugin"); +const CompatibilityPlugin = require("./CompatibilityPlugin"); -const ChunkPrefetchPreloadPlugin = require("./prefetch/ChunkPrefetchPreloadPlugin"); +const ConstPlugin = require("./ConstPlugin"); const EntryOptionPlugin = require("./EntryOptionPlugin"); + +const ExportsInfoApiPlugin = require("./ExportsInfoApiPlugin"); +const FlagDependencyExportsPlugin = require("./FlagDependencyExportsPlugin"); + +const JavascriptMetaInfoPlugin = require("./JavascriptMetaInfoPlugin"); + +const OptionsApply = require("./OptionsApply"); + const RecordIdsPlugin = require("./RecordIdsPlugin"); const RuntimePlugin = require("./RuntimePlugin"); -const APIPlugin = require("./APIPlugin"); -const CompatibilityPlugin = require("./CompatibilityPlugin"); -const ConstPlugin = require("./ConstPlugin"); -const ExportsInfoApiPlugin = require("./ExportsInfoApiPlugin"); -const WebpackIsIncludedPlugin = require("./WebpackIsIncludedPlugin"); - const TemplatedPathPlugin = require("./TemplatedPathPlugin"); + const UseStrictPlugin = require("./UseStrictPlugin"); + const WarnCaseSensitiveModulesPlugin = require("./WarnCaseSensitiveModulesPlugin"); -const DataUriPlugin = require("./schemes/DataUriPlugin"); -const FileUriPlugin = require("./schemes/FileUriPlugin"); +const WebpackIsIncludedPlugin = require("./WebpackIsIncludedPlugin"); + +const AssetModulesPlugin = require("./asset/AssetModulesPlugin"); + +const InferAsyncModulesPlugin = require("./async-modules/InferAsyncModulesPlugin"); const ResolverCachePlugin = require("./cache/ResolverCachePlugin"); const CommonJsPlugin = require("./dependencies/CommonJsPlugin"); + const HarmonyModulesPlugin = require("./dependencies/HarmonyModulesPlugin"); + const ImportMetaContextPlugin = require("./dependencies/ImportMetaContextPlugin"); const ImportMetaPlugin = require("./dependencies/ImportMetaPlugin"); + const ImportPlugin = require("./dependencies/ImportPlugin"); const LoaderPlugin = require("./dependencies/LoaderPlugin"); + const RequireContextPlugin = require("./dependencies/RequireContextPlugin"); const RequireEnsurePlugin = require("./dependencies/RequireEnsurePlugin"); const RequireIncludePlugin = require("./dependencies/RequireIncludePlugin"); + const SystemPlugin = require("./dependencies/SystemPlugin"); + const URLPlugin = require("./dependencies/URLPlugin"); + const WorkerPlugin = require("./dependencies/WorkerPlugin"); -const InferAsyncModulesPlugin = require("./async-modules/InferAsyncModulesPlugin"); +const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin"); + +const JsonModulesPlugin = require("./json/JsonModulesPlugin"); + +const ChunkPrefetchPreloadPlugin = require("./prefetch/ChunkPrefetchPreloadPlugin"); + +const DataUriPlugin = require("./schemes/DataUriPlugin"); +const FileUriPlugin = require("./schemes/FileUriPlugin"); -const FlagDependencyExportsPlugin = require("./FlagDependencyExportsPlugin"); -const JavascriptMetaInfoPlugin = require("./JavascriptMetaInfoPlugin"); const DefaultStatsFactoryPlugin = require("./stats/DefaultStatsFactoryPlugin"); const DefaultStatsPresetPlugin = require("./stats/DefaultStatsPresetPlugin"); const DefaultStatsPrinterPlugin = require("./stats/DefaultStatsPrinterPlugin"); diff --git a/lib/asset/AssetGenerator.js b/lib/asset/AssetGenerator.js index 3f33a590aea..5b97130691f 100644 --- a/lib/asset/AssetGenerator.js +++ b/lib/asset/AssetGenerator.js @@ -5,20 +5,20 @@ "use strict"; -const mimeTypes = require("mime-types"); const path = require("path"); +const mimeTypes = require("mime-types"); const { RawSource } = require("webpack-sources"); const ConcatenationScope = require("../ConcatenationScope"); const Generator = require("../Generator"); const { - NO_TYPES, - ASSET_TYPES, - ASSET_AND_JS_TYPES, - ASSET_AND_JS_AND_CSS_URL_TYPES, ASSET_AND_CSS_URL_TYPES, - JS_TYPES, + ASSET_AND_JS_AND_CSS_URL_TYPES, + ASSET_AND_JS_TYPES, + ASSET_TYPES, + CSS_URL_TYPES, JS_AND_CSS_URL_TYPES, - CSS_URL_TYPES + JS_TYPES, + NO_TYPES } = require("../ModuleSourceTypesConstants"); const { ASSET_MODULE_TYPE } = require("../ModuleTypeConstants"); const RuntimeGlobals = require("../RuntimeGlobals"); @@ -67,7 +67,7 @@ const mergeMaybeArrays = (a, b) => { else set.add(a); if (Array.isArray(b)) for (const item of b) set.add(item); else set.add(b); - return Array.from(set); + return [...set]; }; /** diff --git a/lib/asset/AssetModulesPlugin.js b/lib/asset/AssetModulesPlugin.js index bcd8145bc07..bc43355cc86 100644 --- a/lib/asset/AssetModulesPlugin.js +++ b/lib/asset/AssetModulesPlugin.js @@ -6,9 +6,9 @@ "use strict"; const { - ASSET_MODULE_TYPE_RESOURCE, - ASSET_MODULE_TYPE_INLINE, ASSET_MODULE_TYPE, + ASSET_MODULE_TYPE_INLINE, + ASSET_MODULE_TYPE_RESOURCE, ASSET_MODULE_TYPE_SOURCE } = require("../ModuleTypeConstants"); const { cleverMerge } = require("../util/cleverMerge"); diff --git a/lib/asset/AssetSourceGenerator.js b/lib/asset/AssetSourceGenerator.js index 1ce3cf89c2c..90b8145c2ac 100644 --- a/lib/asset/AssetSourceGenerator.js +++ b/lib/asset/AssetSourceGenerator.js @@ -9,10 +9,10 @@ const { RawSource } = require("webpack-sources"); const ConcatenationScope = require("../ConcatenationScope"); const Generator = require("../Generator"); const { - NO_TYPES, CSS_URL_TYPES, + JS_AND_CSS_URL_TYPES, JS_TYPES, - JS_AND_CSS_URL_TYPES + NO_TYPES } = require("../ModuleSourceTypesConstants"); const RuntimeGlobals = require("../RuntimeGlobals"); diff --git a/lib/async-modules/AwaitDependenciesInitFragment.js b/lib/async-modules/AwaitDependenciesInitFragment.js index 84abf28107d..178834b06e7 100644 --- a/lib/async-modules/AwaitDependenciesInitFragment.js +++ b/lib/async-modules/AwaitDependenciesInitFragment.js @@ -59,7 +59,7 @@ class AwaitDependenciesInitFragment extends InitFragment { "" ]); } - const sepPromises = Array.from(promises).join(", "); + const sepPromises = [...promises].join(", "); // TODO check if destructuring is supported return Template.asString([ `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${sepPromises}]);`, diff --git a/lib/cache/IdleFileCachePlugin.js b/lib/cache/IdleFileCachePlugin.js index 2fa1cc25504..555a587b71c 100644 --- a/lib/cache/IdleFileCachePlugin.js +++ b/lib/cache/IdleFileCachePlugin.js @@ -111,7 +111,7 @@ class IdleFileCachePlugin { } isIdle = false; const reportProgress = ProgressPlugin.getReporter(compiler); - const jobs = Array.from(pendingIdleTasks.values()); + const jobs = [...pendingIdleTasks.values()]; if (reportProgress) reportProgress(0, "process pending cache items"); const promises = jobs.map(fn => fn()); pendingIdleTasks.clear(); diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index 22efe45bcee..57f1375e0ef 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -13,8 +13,8 @@ const LazySet = require("../util/LazySet"); const makeSerializable = require("../util/makeSerializable"); const memoize = require("../util/memoize"); const { - createFileSerializer, - NOT_SERIALIZABLE + NOT_SERIALIZABLE, + createFileSerializer } = require("../util/serialization"); /** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */ @@ -1378,9 +1378,7 @@ class PackFileCacheStrategy { if (newBuildDependencies.size > 0 || !this.buildSnapshot) { if (reportProgress) reportProgress(0.5, "resolve build dependencies"); this.logger.debug( - `Capturing build dependencies... (${Array.from( - newBuildDependencies - ).join(", ")})` + `Capturing build dependencies... (${[...newBuildDependencies].join(", ")})` ); promise = new Promise( /** diff --git a/lib/config/browserslistTargetHandler.js b/lib/config/browserslistTargetHandler.js index 51b0896ab0c..09bf23dd336 100644 --- a/lib/config/browserslistTargetHandler.js +++ b/lib/config/browserslistTargetHandler.js @@ -5,8 +5,8 @@ "use strict"; -const browserslist = require("browserslist"); const path = require("path"); +const browserslist = require("browserslist"); /** @typedef {import("./target").ApiTargetProperties} ApiTargetProperties */ /** @typedef {import("./target").EcmaTargetProperties} EcmaTargetProperties */ @@ -358,6 +358,6 @@ const resolve = browsers => { }; module.exports = { - resolve, - load + load, + resolve }; diff --git a/lib/config/defaults.js b/lib/config/defaults.js index f949157a641..cbeb5ad74ea 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -8,26 +8,26 @@ const fs = require("fs"); const path = require("path"); const { - JAVASCRIPT_MODULE_TYPE_AUTO, - JAVASCRIPT_MODULE_TYPE_ESM, - JAVASCRIPT_MODULE_TYPE_DYNAMIC, - JSON_MODULE_TYPE, - WEBASSEMBLY_MODULE_TYPE_ASYNC, - WEBASSEMBLY_MODULE_TYPE_SYNC, ASSET_MODULE_TYPE, ASSET_MODULE_TYPE_INLINE, ASSET_MODULE_TYPE_RESOURCE, - CSS_MODULE_TYPE_AUTO, CSS_MODULE_TYPE, + CSS_MODULE_TYPE_AUTO, + CSS_MODULE_TYPE_GLOBAL, CSS_MODULE_TYPE_MODULE, - CSS_MODULE_TYPE_GLOBAL + JAVASCRIPT_MODULE_TYPE_AUTO, + JAVASCRIPT_MODULE_TYPE_DYNAMIC, + JAVASCRIPT_MODULE_TYPE_ESM, + JSON_MODULE_TYPE, + WEBASSEMBLY_MODULE_TYPE_ASYNC, + WEBASSEMBLY_MODULE_TYPE_SYNC } = require("../ModuleTypeConstants"); const Template = require("../Template"); const { cleverMerge } = require("../util/cleverMerge"); const { - getTargetsProperties, + getDefaultTarget, getTargetProperties, - getDefaultTarget + getTargetsProperties } = require("./target"); /** @typedef {import("../../declarations/WebpackOptions").CacheOptions} CacheOptions */ @@ -1354,7 +1354,7 @@ const applyOutputDefaults = ( enabledChunkLoadingTypes.add(desc.chunkLoading); } }); - return Array.from(enabledChunkLoadingTypes); + return [...enabledChunkLoadingTypes]; }); A(output, "enabledWasmLoadingTypes", () => { @@ -1370,7 +1370,7 @@ const applyOutputDefaults = ( enabledWasmLoadingTypes.add(desc.wasmLoading); } }); - return Array.from(enabledWasmLoadingTypes); + return [...enabledWasmLoadingTypes]; }); }; @@ -1746,7 +1746,7 @@ const applyInfrastructureLoggingDefaults = infrastructureLogging => { D(infrastructureLogging, "appendOnly", !tty); }; +module.exports.DEFAULTS = DEFAULTS; module.exports.applyWebpackOptionsBaseDefaults = applyWebpackOptionsBaseDefaults; module.exports.applyWebpackOptionsDefaults = applyWebpackOptionsDefaults; -module.exports.DEFAULTS = DEFAULTS; diff --git a/lib/css/CssGenerator.js b/lib/css/CssGenerator.js index 7709e23bd43..a40ca9ad59f 100644 --- a/lib/css/CssGenerator.js +++ b/lib/css/CssGenerator.js @@ -5,16 +5,16 @@ "use strict"; -const { ReplaceSource, RawSource, ConcatSource } = require("webpack-sources"); +const { ConcatSource, RawSource, ReplaceSource } = require("webpack-sources"); const { UsageState } = require("../ExportsInfo"); const Generator = require("../Generator"); const InitFragment = require("../InitFragment"); const { + CSS_TYPE, + CSS_TYPES, JS_AND_CSS_EXPORT_TYPES, JS_AND_CSS_TYPES, - CSS_TYPES, - JS_TYPE, - CSS_TYPE + JS_TYPE } = require("../ModuleSourceTypesConstants"); const RuntimeGlobals = require("../RuntimeGlobals"); const Template = require("../Template"); @@ -292,7 +292,7 @@ class CssGenerator extends Generator { } const exports = cssData.exports; const stringifiedExports = JSON.stringify( - Array.from(exports).reduce((obj, [key, value]) => { + [...exports].reduce((obj, [key, value]) => { obj[key] = value; return obj; }, /** @type {Record} */ ({})) diff --git a/lib/css/CssModulesPlugin.js b/lib/css/CssModulesPlugin.js index 9a9cbd9be11..11a5fec56cd 100644 --- a/lib/css/CssModulesPlugin.js +++ b/lib/css/CssModulesPlugin.js @@ -5,13 +5,13 @@ "use strict"; -const { SyncWaterfallHook, SyncHook } = require("tapable"); +const { SyncHook, SyncWaterfallHook } = require("tapable"); const { + CachedSource, ConcatSource, PrefixSource, - ReplaceSource, - CachedSource, - RawSource + RawSource, + ReplaceSource } = require("webpack-sources"); const Compilation = require("../Compilation"); const CssModule = require("../CssModule"); @@ -19,9 +19,9 @@ const { tryRunOrWebpackError } = require("../HookWebpackError"); const HotUpdateChunk = require("../HotUpdateChunk"); const { CSS_MODULE_TYPE, + CSS_MODULE_TYPE_AUTO, CSS_MODULE_TYPE_GLOBAL, - CSS_MODULE_TYPE_MODULE, - CSS_MODULE_TYPE_AUTO + CSS_MODULE_TYPE_MODULE } = require("../ModuleTypeConstants"); const NormalModule = require("../NormalModule"); const RuntimeGlobals = require("../RuntimeGlobals"); @@ -393,7 +393,7 @@ class CssModulesPlugin { const exports = cssData.exports; const stringifiedExports = JSON.stringify( JSON.stringify( - Array.from(exports).reduce((obj, [key, value]) => { + [...exports].reduce((obj, [key, value]) => { obj[key] = value; return obj; }, /** @type {Record} */ ({})) diff --git a/lib/css/CssParser.js b/lib/css/CssParser.js index c4987c23fc4..7d19ba4def3 100644 --- a/lib/css/CssParser.js +++ b/lib/css/CssParser.js @@ -24,8 +24,8 @@ const StaticExportsDependency = require("../dependencies/StaticExportsDependency const binarySearchBounds = require("../util/binarySearchBounds"); const { parseResource } = require("../util/identifier"); const { - webpackCommentRegExp, - createMagicCommentContext + createMagicCommentContext, + webpackCommentRegExp } = require("../util/magicComment"); const walkCssTokens = require("./walkCssTokens"); diff --git a/lib/css/walkCssTokens.js b/lib/css/walkCssTokens.js index 27f7644d7a1..4fb7808c349 100644 --- a/lib/css/walkCssTokens.js +++ b/lib/css/walkCssTokens.js @@ -1196,14 +1196,12 @@ module.exports = (input, pos = 0, callbacks = {}) => { return pos; }; -module.exports.isIdentStartCodePoint = isIdentStartCodePoint; - /** * @param {string} input input * @param {number} pos position * @returns {number} position after comments */ -module.exports.eatComments = (input, pos) => { +const eatComments = (input, pos) => { for (;;) { const originalPos = pos; pos = consumeComments(input, pos, {}); @@ -1220,7 +1218,7 @@ module.exports.eatComments = (input, pos) => { * @param {number} pos position * @returns {number} position after whitespace */ -module.exports.eatWhitespace = (input, pos) => { +const eatWhitespace = (input, pos) => { while (_isWhiteSpace(input.charCodeAt(pos))) { pos++; } @@ -1233,7 +1231,7 @@ module.exports.eatWhitespace = (input, pos) => { * @param {number} pos position * @returns {number} position after whitespace and comments */ -module.exports.eatWhitespaceAndComments = (input, pos) => { +const eatWhitespaceAndComments = (input, pos) => { for (;;) { const originalPos = pos; pos = consumeComments(input, pos, {}); @@ -1248,29 +1246,12 @@ module.exports.eatWhitespaceAndComments = (input, pos) => { return pos; }; -/** - * @param {string} input input - * @param {number} pos position - * @returns {number} position after whitespace and comments - */ -module.exports.eatComments = (input, pos) => { - for (;;) { - const originalPos = pos; - pos = consumeComments(input, pos, {}); - if (originalPos === pos) { - break; - } - } - - return pos; -}; - /** * @param {string} input input * @param {number} pos position * @returns {number} position after whitespace */ -module.exports.eatWhiteLine = (input, pos) => { +const eatWhiteLine = (input, pos) => { for (;;) { const cc = input.charCodeAt(pos); if (_isSpace(cc)) { @@ -1290,8 +1271,8 @@ module.exports.eatWhiteLine = (input, pos) => { * @param {number} pos position * @returns {[number, number] | undefined} positions of ident sequence */ -module.exports.skipCommentsAndEatIdentSequence = (input, pos) => { - pos = module.exports.eatComments(input, pos); +const skipCommentsAndEatIdentSequence = (input, pos) => { + pos = eatComments(input, pos); const start = pos; @@ -1315,8 +1296,8 @@ module.exports.skipCommentsAndEatIdentSequence = (input, pos) => { * @param {number} pos position * @returns {[number, number] | undefined} positions of ident sequence */ -module.exports.eatString = (input, pos) => { - pos = module.exports.eatWhitespaceAndComments(input, pos); +const eatString = (input, pos) => { + pos = eatWhitespaceAndComments(input, pos); const start = pos; @@ -1336,7 +1317,7 @@ module.exports.eatString = (input, pos) => { * @param {CssTokenCallbacks} cbs callbacks * @returns {[number, number][]} positions of ident sequence */ -module.exports.eatImageSetStrings = (input, pos, cbs) => { +const eatImageSetStrings = (input, pos, cbs) => { /** @type {[number, number][]} */ const result = []; @@ -1406,7 +1387,7 @@ module.exports.eatImageSetStrings = (input, pos, cbs) => { * @param {CssTokenCallbacks} cbs callbacks * @returns {[[number, number, number, number] | undefined, [number, number] | undefined, [number, number] | undefined, [number, number] | undefined]} positions of top level tokens */ -module.exports.eatImportTokens = (input, pos, cbs) => { +const eatImportTokens = (input, pos, cbs) => { const result = /** @type {[[number, number, number, number] | undefined, [number, number] | undefined, [number, number] | undefined, [number, number] | undefined]} */ (Array.from({ length: 4 })); @@ -1548,8 +1529,8 @@ module.exports.eatImportTokens = (input, pos, cbs) => { * @param {number} pos position * @returns {[number, number] | undefined} positions of ident sequence */ -module.exports.eatIdentSequence = (input, pos) => { - pos = module.exports.eatWhitespaceAndComments(input, pos); +const eatIdentSequence = (input, pos) => { + pos = eatWhitespaceAndComments(input, pos); const start = pos; @@ -1573,8 +1554,8 @@ module.exports.eatIdentSequence = (input, pos) => { * @param {number} pos position * @returns {[number, number, boolean] | undefined} positions of ident sequence or string */ -module.exports.eatIdentSequenceOrString = (input, pos) => { - pos = module.exports.eatWhitespaceAndComments(input, pos); +const eatIdentSequenceOrString = (input, pos) => { + pos = eatWhitespaceAndComments(input, pos); const start = pos; @@ -1602,7 +1583,7 @@ module.exports.eatIdentSequenceOrString = (input, pos) => { * @param {string} chars characters * @returns {(input: string, pos: number) => number} function to eat characters */ -module.exports.eatUntil = chars => { +const eatUntil = chars => { const charCodes = Array.from({ length: chars.length }, (_, i) => chars.charCodeAt(i) ); @@ -1625,3 +1606,17 @@ module.exports.eatUntil = chars => { } }; }; + +module.exports.eatComments = eatComments; +module.exports.eatIdentSequence = eatIdentSequence; +module.exports.eatIdentSequenceOrString = eatIdentSequenceOrString; +module.exports.eatImageSetStrings = eatImageSetStrings; +module.exports.eatImportTokens = eatImportTokens; +module.exports.eatString = eatString; +module.exports.eatUntil = eatUntil; +module.exports.eatWhiteLine = eatWhiteLine; +module.exports.eatWhitespace = eatWhitespace; +module.exports.eatWhitespaceAndComments = eatWhitespaceAndComments; +module.exports.isIdentStartCodePoint = isIdentStartCodePoint; +module.exports.skipCommentsAndEatIdentSequence = + skipCommentsAndEatIdentSequence; diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js index b5b3d16ed65..c28d3bc1c80 100644 --- a/lib/debug/ProfilingPlugin.js +++ b/lib/debug/ProfilingPlugin.js @@ -6,10 +6,10 @@ const { Tracer } = require("chrome-trace-event"); const { - JAVASCRIPT_MODULES, CSS_MODULES, - WEBASSEMBLY_MODULES, - JSON_MODULE_TYPE + JAVASCRIPT_MODULES, + JSON_MODULE_TYPE, + WEBASSEMBLY_MODULES } = require("../ModuleTypeConstants"); const createSchemaValidation = require("../util/create-schema-validation"); const { dirname, mkdirpSync } = require("../util/fs"); diff --git a/lib/dependencies/CommonJsExportRequireDependency.js b/lib/dependencies/CommonJsExportRequireDependency.js index 497a2f23696..3f7c66cf3bc 100644 --- a/lib/dependencies/CommonJsExportRequireDependency.js +++ b/lib/dependencies/CommonJsExportRequireDependency.js @@ -126,7 +126,7 @@ class CommonJsExportRequireDependency extends ModuleDependency { processExportInfo( runtime, referencedExports, - ids.concat(exportInfo.name), + [...ids, exportInfo.name], exportInfo, false ); @@ -193,7 +193,7 @@ class CommonJsExportRequireDependency extends ModuleDependency { name => ({ name, from, - export: ids.concat(name), + export: [...ids, name], canMangle: !(name in EMPTY_OBJECT) && false }) ), diff --git a/lib/dependencies/CommonJsPlugin.js b/lib/dependencies/CommonJsPlugin.js index 472022e530c..1f5e2848411 100644 --- a/lib/dependencies/CommonJsPlugin.js +++ b/lib/dependencies/CommonJsPlugin.js @@ -5,12 +5,23 @@ "use strict"; +const { + JAVASCRIPT_MODULE_TYPE_AUTO, + JAVASCRIPT_MODULE_TYPE_DYNAMIC +} = require("../ModuleTypeConstants"); const RuntimeGlobals = require("../RuntimeGlobals"); const RuntimeModule = require("../RuntimeModule"); const SelfModuleFactory = require("../SelfModuleFactory"); const Template = require("../Template"); +const { + evaluateToIdentifier, + toConstantDependency +} = require("../javascript/JavascriptParserHelpers"); +const CommonJsExportRequireDependency = require("./CommonJsExportRequireDependency"); const CommonJsExportsDependency = require("./CommonJsExportsDependency"); +const CommonJsExportsParserPlugin = require("./CommonJsExportsParserPlugin"); const CommonJsFullRequireDependency = require("./CommonJsFullRequireDependency"); +const CommonJsImportsParserPlugin = require("./CommonJsImportsParserPlugin"); const CommonJsRequireContextDependency = require("./CommonJsRequireContextDependency"); const CommonJsRequireDependency = require("./CommonJsRequireDependency"); const CommonJsSelfReferenceDependency = require("./CommonJsSelfReferenceDependency"); @@ -21,19 +32,6 @@ const RequireResolveDependency = require("./RequireResolveDependency"); const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency"); const RuntimeRequirementsDependency = require("./RuntimeRequirementsDependency"); -const CommonJsExportsParserPlugin = require("./CommonJsExportsParserPlugin"); -const CommonJsImportsParserPlugin = require("./CommonJsImportsParserPlugin"); - -const { - JAVASCRIPT_MODULE_TYPE_AUTO, - JAVASCRIPT_MODULE_TYPE_DYNAMIC -} = require("../ModuleTypeConstants"); -const { - evaluateToIdentifier, - toConstantDependency -} = require("../javascript/JavascriptParserHelpers"); -const CommonJsExportRequireDependency = require("./CommonJsExportRequireDependency"); - /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ /** @typedef {import("../Compilation")} Compilation */ /** @typedef {import("../Compiler")} Compiler */ diff --git a/lib/dependencies/CssIcssExportDependency.js b/lib/dependencies/CssIcssExportDependency.js index eae414c6403..5b03b9ff6bb 100644 --- a/lib/dependencies/CssIcssExportDependency.js +++ b/lib/dependencies/CssIcssExportDependency.js @@ -145,7 +145,7 @@ CssIcssExportDependency.Template = class CssIcssExportDependencyTemplate extends .filter(Boolean) ); - for (const used of usedNames.concat(names)) { + for (const used of [...usedNames, ...names]) { cssData.exports.set(used, dep.value); } } diff --git a/lib/dependencies/CssLocalIdentifierDependency.js b/lib/dependencies/CssLocalIdentifierDependency.js index 21e76e8b25b..4592c45b1df 100644 --- a/lib/dependencies/CssLocalIdentifierDependency.js +++ b/lib/dependencies/CssLocalIdentifierDependency.js @@ -222,7 +222,7 @@ CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTempla (generator.convention) ); const usedNames = - /** @type {(string)[]} */ + /** @type {string[]} */ ( names .map(name => @@ -239,7 +239,7 @@ CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTempla source.replace(dep.range[0], dep.range[1] - 1, identifier); - for (const used of usedNames.concat(names)) { + for (const used of [...usedNames, ...names]) { cssData.exports.set(used, getCssParser().unescapeIdentifier(identifier)); } } diff --git a/lib/dependencies/DynamicExports.js b/lib/dependencies/DynamicExports.js index cdc5e9c9820..4e983ddbddb 100644 --- a/lib/dependencies/DynamicExports.js +++ b/lib/dependencies/DynamicExports.js @@ -42,14 +42,11 @@ module.exports.enable = parserState => { /** * @param {ParserState} parserState parser state - * @returns {void} + * @returns {boolean} true, when enabled */ -module.exports.setFlagged = parserState => { +module.exports.isEnabled = parserState => { const value = parserStateExportsState.get(parserState); - if (value !== true) return; - const buildMeta = /** @type {BuildMeta} */ (parserState.module.buildMeta); - if (buildMeta.exportsType === "dynamic") return; - buildMeta.exportsType = "flagged"; + return value === true; }; /** @@ -65,9 +62,12 @@ module.exports.setDynamic = parserState => { /** * @param {ParserState} parserState parser state - * @returns {boolean} true, when enabled + * @returns {void} */ -module.exports.isEnabled = parserState => { +module.exports.setFlagged = parserState => { const value = parserStateExportsState.get(parserState); - return value === true; + if (value !== true) return; + const buildMeta = /** @type {BuildMeta} */ (parserState.module.buildMeta); + if (buildMeta.exportsType === "dynamic") return; + buildMeta.exportsType = "flagged"; }; diff --git a/lib/dependencies/ExportsInfoDependency.js b/lib/dependencies/ExportsInfoDependency.js index 7fa1a4f56a3..dd78aa16051 100644 --- a/lib/dependencies/ExportsInfoDependency.js +++ b/lib/dependencies/ExportsInfoDependency.js @@ -49,7 +49,7 @@ const getProperty = (moduleGraph, module, _exportName, property, runtime) => { ) { return usedExports; } - return Array.from(usedExports).sort(); + return [...usedExports].sort(); } } } diff --git a/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/lib/dependencies/HarmonyExportDependencyParserPlugin.js index a80766b80b0..b51c0e1d9c6 100644 --- a/lib/dependencies/HarmonyExportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyExportDependencyParserPlugin.js @@ -15,8 +15,8 @@ const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImporte const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency"); const { ExportPresenceModes } = require("./HarmonyImportDependency"); const { - harmonySpecifierTag, - getImportMode + getImportMode, + harmonySpecifierTag } = require("./HarmonyImportDependencyParserPlugin"); const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency"); @@ -198,6 +198,7 @@ module.exports = class HarmonyExportDependencyParserPlugin { (statement, source, id, name, idx) => { const harmonyNamedExports = (parser.state.harmonyNamedExports = parser.state.harmonyNamedExports || new Set()); + /** @type {InstanceType | null} */ let harmonyStarExports = null; if (name) { harmonyNamedExports.add(name); @@ -213,11 +214,13 @@ module.exports = class HarmonyExportDependencyParserPlugin { false ); const dep = new HarmonyExportImportedSpecifierDependency( - /** @type {string} */ (source), + /** @type {string} */ + (source), parser.state.lastHarmonyImportOrder, id ? [id] : [], name, harmonyNamedExports, + // eslint-disable-next-line unicorn/prefer-spread harmonyStarExports && harmonyStarExports.slice(), exportPresenceMode, harmonyStarExports, diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index a5e9b4ab7e2..07fad95ccd4 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -16,14 +16,14 @@ const { getMakeDeferredNamespaceModeFromExportsType } = require("../runtime/MakeDeferredNamespaceObjectRuntime"); const { countIterable } = require("../util/IterableHelpers"); -const { first, combine } = require("../util/SetHelpers"); +const { combine, first } = require("../util/SetHelpers"); const makeSerializable = require("../util/makeSerializable"); const propertyAccess = require("../util/propertyAccess"); const { propertyName } = require("../util/propertyName"); const { + filterRuntime, getRuntimeKey, - keyToRuntime, - filterRuntime + keyToRuntime } = require("../util/runtime"); const HarmonyExportInitFragment = require("./HarmonyExportInitFragment"); const HarmonyImportDependency = require("./HarmonyImportDependency"); @@ -133,12 +133,13 @@ const determineExportAssignments = ( dependencies, additionalDependency ) => { + /** @type {Set} */ const names = new Set(); /** @type {number[]} */ const dependencyIndices = []; if (additionalDependency) { - dependencies = dependencies.concat(additionalDependency); + dependencies = [...dependencies, additionalDependency]; } for (const dep of dependencies) { @@ -161,7 +162,7 @@ const determineExportAssignments = ( } dependencyIndices.push(names.size); - return { names: Array.from(names), dependencyIndices }; + return { names: [...names], dependencyIndices }; }; /** @@ -1245,9 +1246,9 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS // Filter out exports which are defined by other exports // and filter out default export because it cannot be reexported with * if (ignored.size > 1) { - content += `if(${JSON.stringify( - Array.from(ignored) - )}.indexOf(__WEBPACK_IMPORT_KEY__) < 0) `; + content += `if(${JSON.stringify([ + ...ignored + ])}.indexOf(__WEBPACK_IMPORT_KEY__) < 0) `; } else if (ignored.size === 1) { content += `if(__WEBPACK_IMPORT_KEY__ !== ${JSON.stringify( first(ignored) @@ -1458,7 +1459,7 @@ class HarmonyStarExportsList { } slice() { - return this.dependencies.slice(); + return [...this.dependencies]; } /** diff --git a/lib/dependencies/HarmonyExportInitFragment.js b/lib/dependencies/HarmonyExportInitFragment.js index 8125cc2db8b..9b4b025c145 100644 --- a/lib/dependencies/HarmonyExportInitFragment.js +++ b/lib/dependencies/HarmonyExportInitFragment.js @@ -154,7 +154,7 @@ class HarmonyExportInitFragment extends InitFragment { ? `/* unused harmony export ${first(this.unusedExports)} */\n` : ""; const definitions = []; - const orderedExportMap = Array.from(this.exportMap).sort(([a], [b]) => + const orderedExportMap = [...this.exportMap].sort(([a], [b]) => a < b ? -1 : 1 ); for (const [key, value] of orderedExportMap) { diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index a497bc3a29d..3b77a7a04ce 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -178,6 +178,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { const leftPartEvaluated = parser.evaluateExpression(expression.left); if (leftPartEvaluated.couldHaveSideEffects()) return; + /** @type {string | undefined} */ const leftPart = leftPartEvaluated.asString(); if (!leftPart) return; @@ -193,14 +194,16 @@ module.exports = class HarmonyImportDependencyParserPlugin { ) { return; } - const settings = /** @type {TagData} */ (rootInfo.tagInfo.data); + const settings = + /** @type {TagData} */ + (rootInfo.tagInfo.data); const members = /** @type {(() => string[])} */ (rightPart.getMembers)(); const dep = new HarmonyEvaluatedImportSpecifierDependency( settings.source, settings.sourceOrder, - settings.ids.concat(members).concat([leftPart]), + [...settings.ids, ...members, leftPart], settings.name, /** @type {Range} */ (expression.range), settings.attributes, @@ -264,7 +267,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { members.length - nonOptionalMembers.length ) : expression; - const ids = settings.ids.concat(nonOptionalMembers); + const ids = [...settings.ids, ...nonOptionalMembers]; const dep = new HarmonyImportSpecifierDependency( settings.source, settings.sourceOrder, @@ -315,7 +318,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { members.length - nonOptionalMembers.length ) : callee; - const ids = settings.ids.concat(nonOptionalMembers); + const ids = [...settings.ids, ...nonOptionalMembers]; const dep = new HarmonyImportSpecifierDependency( settings.source, settings.sourceOrder, @@ -444,5 +447,5 @@ function getImportMode(parser, node, deferImportEnabled, reportSyntaxError) { return result; } -module.exports.harmonySpecifierTag = harmonySpecifierTag; module.exports.getImportMode = getImportMode; +module.exports.harmonySpecifierTag = harmonySpecifierTag; diff --git a/lib/dependencies/HarmonyImportSpecifierDependency.js b/lib/dependencies/HarmonyImportSpecifierDependency.js index 3a56bc00098..a6d0c140de2 100644 --- a/lib/dependencies/HarmonyImportSpecifierDependency.js +++ b/lib/dependencies/HarmonyImportSpecifierDependency.js @@ -199,7 +199,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { /** @type {string[][]} */ const refs = []; for (const { id } of this.referencedPropertiesInDestructuring) { - refs.push(ids ? ids.concat([id]) : [id]); + refs.push(ids ? [...ids, id] : [id]); } return refs; } @@ -381,7 +381,8 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen shorthand, range } of dep.referencedPropertiesInDestructuring) { - const concatedIds = prefixedIds.concat([id]); + /** @type {string[]} */ + const concatedIds = [...prefixedIds, id]; const module = /** @type {Module} */ (moduleGraph.getModule(dep)); const used = moduleGraph .getExportsInfo(module) diff --git a/lib/dependencies/HarmonyModulesPlugin.js b/lib/dependencies/HarmonyModulesPlugin.js index 45492441840..77d3d9c3dc9 100644 --- a/lib/dependencies/HarmonyModulesPlugin.js +++ b/lib/dependencies/HarmonyModulesPlugin.js @@ -5,24 +5,24 @@ "use strict"; +const { + JAVASCRIPT_MODULE_TYPE_AUTO, + JAVASCRIPT_MODULE_TYPE_ESM +} = require("../ModuleTypeConstants"); const HarmonyAcceptDependency = require("./HarmonyAcceptDependency"); const HarmonyAcceptImportDependency = require("./HarmonyAcceptImportDependency"); const HarmonyCompatibilityDependency = require("./HarmonyCompatibilityDependency"); +const HarmonyDetectionParserPlugin = require("./HarmonyDetectionParserPlugin"); const HarmonyEvaluatedImportSpecifierDependency = require("./HarmonyEvaluatedImportSpecifierDependency"); +const HarmonyExportDependencyParserPlugin = require("./HarmonyExportDependencyParserPlugin"); const HarmonyExportExpressionDependency = require("./HarmonyExportExpressionDependency"); const HarmonyExportHeaderDependency = require("./HarmonyExportHeaderDependency"); const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImportedSpecifierDependency"); const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency"); +const HarmonyImportDependencyParserPlugin = require("./HarmonyImportDependencyParserPlugin"); const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency"); const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency"); -const { - JAVASCRIPT_MODULE_TYPE_AUTO, - JAVASCRIPT_MODULE_TYPE_ESM -} = require("../ModuleTypeConstants"); -const HarmonyDetectionParserPlugin = require("./HarmonyDetectionParserPlugin"); -const HarmonyExportDependencyParserPlugin = require("./HarmonyExportDependencyParserPlugin"); -const HarmonyImportDependencyParserPlugin = require("./HarmonyImportDependencyParserPlugin"); const HarmonyTopLevelThisParserPlugin = require("./HarmonyTopLevelThisParserPlugin"); /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ diff --git a/lib/dependencies/ImportMetaPlugin.js b/lib/dependencies/ImportMetaPlugin.js index ff9231d21d0..779f44b921f 100644 --- a/lib/dependencies/ImportMetaPlugin.js +++ b/lib/dependencies/ImportMetaPlugin.js @@ -15,9 +15,9 @@ const Template = require("../Template"); const BasicEvaluatedExpression = require("../javascript/BasicEvaluatedExpression"); const { evaluateToIdentifier, - toConstantDependency, + evaluateToNumber, evaluateToString, - evaluateToNumber + toConstantDependency } = require("../javascript/JavascriptParserHelpers"); const memoize = require("../util/memoize"); const propertyAccess = require("../util/propertyAccess"); diff --git a/lib/dependencies/RequireEnsurePlugin.js b/lib/dependencies/RequireEnsurePlugin.js index 6ae920af5b3..bcca946fa68 100644 --- a/lib/dependencies/RequireEnsurePlugin.js +++ b/lib/dependencies/RequireEnsurePlugin.js @@ -5,11 +5,6 @@ "use strict"; -const RequireEnsureDependency = require("./RequireEnsureDependency"); -const RequireEnsureItemDependency = require("./RequireEnsureItemDependency"); - -const RequireEnsureDependenciesBlockParserPlugin = require("./RequireEnsureDependenciesBlockParserPlugin"); - const { JAVASCRIPT_MODULE_TYPE_AUTO, JAVASCRIPT_MODULE_TYPE_DYNAMIC @@ -18,6 +13,9 @@ const { evaluateToString, toConstantDependency } = require("../javascript/JavascriptParserHelpers"); +const RequireEnsureDependenciesBlockParserPlugin = require("./RequireEnsureDependenciesBlockParserPlugin"); +const RequireEnsureDependency = require("./RequireEnsureDependency"); +const RequireEnsureItemDependency = require("./RequireEnsureItemDependency"); /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ /** @typedef {import("../Compiler")} Compiler */ diff --git a/lib/dependencies/RuntimeRequirementsDependency.js b/lib/dependencies/RuntimeRequirementsDependency.js index 714567b7140..0eee6e716ba 100644 --- a/lib/dependencies/RuntimeRequirementsDependency.js +++ b/lib/dependencies/RuntimeRequirementsDependency.js @@ -36,7 +36,7 @@ class RuntimeRequirementsDependency extends NullDependency { */ updateHash(hash, context) { if (this._hashUpdate === undefined) { - this._hashUpdate = `${Array.from(this.runtimeRequirements).join()}`; + this._hashUpdate = `${[...this.runtimeRequirements].join()}`; } hash.update(this._hashUpdate); } diff --git a/lib/dependencies/processExportInfo.js b/lib/dependencies/processExportInfo.js index 742b9bca005..ff43885570f 100644 --- a/lib/dependencies/processExportInfo.js +++ b/lib/dependencies/processExportInfo.js @@ -56,7 +56,7 @@ const processExportInfo = ( referencedExports, defaultPointsToSelf && exportInfo.name === "default" ? prefix - : prefix.concat(exportInfo.name), + : [...prefix, exportInfo.name], exportInfo, false, alreadyVisited diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index 6f0b8e6f874..5915f20e281 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -6,13 +6,13 @@ "use strict"; const { ConcatSource } = require("webpack-sources"); -const { RuntimeGlobals, HotUpdateChunk } = require(".."); +const { HotUpdateChunk, RuntimeGlobals } = require(".."); const Template = require("../Template"); const { getAllChunks } = require("../javascript/ChunkHelpers"); const { chunkHasJs, - getCompilationHooks, - getChunkFilenameTemplate + getChunkFilenameTemplate, + getCompilationHooks } = require("../javascript/JavascriptModulesPlugin"); const { updateHashForEntryStartup } = require("../javascript/StartupHelpers"); const { getUndoPath } = require("../util/identifier"); @@ -34,9 +34,9 @@ const { getUndoPath } = require("../util/identifier"); * @returns {{entries: Array<[Module, Entrypoint | undefined]>, runtimeChunk: Chunk|null}} Object containing chunk entries and runtime chunk */ function getChunkInfo(chunk, chunkGraph) { - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); + const entries = [ + ...chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ]; const runtimeChunk = entries.length > 0 ? /** @type {Entrypoint[][]} */ @@ -66,7 +66,7 @@ const getRelativePath = (compilation, chunk, runtimeChunk) => { ) .replace(/^\/+/g, "") .split("/"); - const baseOutputName = currentOutputName.slice(); + const baseOutputName = [...currentOutputName]; const chunkOutputName = compilation .getPath(getChunkFilenameTemplate(chunk, compilation.outputOptions), { chunk, diff --git a/lib/esm/ModuleChunkLoadingRuntimeModule.js b/lib/esm/ModuleChunkLoadingRuntimeModule.js index 3a3b5c5e803..7c3e94d136a 100644 --- a/lib/esm/ModuleChunkLoadingRuntimeModule.js +++ b/lib/esm/ModuleChunkLoadingRuntimeModule.js @@ -13,8 +13,8 @@ const { generateJavascriptHMR } = require("../hmr/JavascriptHotModuleReplacementHelper"); const { - getChunkFilenameTemplate, - chunkHasJs + chunkHasJs, + getChunkFilenameTemplate } = require("../javascript/JavascriptModulesPlugin"); const { getInitialChunkIds } = require("../javascript/StartupHelpers"); const compileBooleanMatcher = require("../util/compileBooleanMatcher"); diff --git a/lib/ids/ChunkModuleIdRangePlugin.js b/lib/ids/ChunkModuleIdRangePlugin.js index 64103224066..3a62447d0a1 100644 --- a/lib/ids/ChunkModuleIdRangePlugin.js +++ b/lib/ids/ChunkModuleIdRangePlugin.js @@ -7,11 +7,12 @@ const { find } = require("../util/SetHelpers"); const { - compareModulesByPreOrderIndexOrIdentifier, - compareModulesByPostOrderIndexOrIdentifier + compareModulesByPostOrderIndexOrIdentifier, + compareModulesByPreOrderIndexOrIdentifier } = require("../util/comparators"); /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ /** * @typedef {object} ChunkModuleIdRangePluginOptions @@ -52,6 +53,7 @@ class ChunkModuleIdRangePlugin { ); } + /** @type {Module[]} */ let chunkModules; if (options.order) { let cmpFn; @@ -69,7 +71,7 @@ class ChunkModuleIdRangePlugin { } chunkModules = chunkGraph.getOrderedChunkModules(chunk, cmpFn); } else { - chunkModules = Array.from(modules) + chunkModules = [...modules] .filter(m => chunkGraph.isModuleInChunk(m, chunk)) .sort(compareModulesByPreOrderIndexOrIdentifier(moduleGraph)); } diff --git a/lib/ids/DeterministicChunkIdsPlugin.js b/lib/ids/DeterministicChunkIdsPlugin.js index 2bfdbab76f5..b4fa8ca2151 100644 --- a/lib/ids/DeterministicChunkIdsPlugin.js +++ b/lib/ids/DeterministicChunkIdsPlugin.js @@ -7,9 +7,9 @@ const { compareChunksNatural } = require("../util/comparators"); const { + assignDeterministicIds, getFullChunkName, - getUsedChunkIds, - assignDeterministicIds + getUsedChunkIds } = require("./IdHelpers"); /** @typedef {import("../Compiler")} Compiler */ @@ -49,7 +49,7 @@ class DeterministicChunkIdsPlugin { const usedIds = getUsedChunkIds(compilation); assignDeterministicIds( - Array.from(chunks).filter(chunk => chunk.id === null), + [...chunks].filter(chunk => chunk.id === null), chunk => getFullChunkName(chunk, chunkGraph, context, compiler.root), compareNatural, (chunk, id) => { diff --git a/lib/ids/DeterministicModuleIdsPlugin.js b/lib/ids/DeterministicModuleIdsPlugin.js index a981276242d..813ab8729c3 100644 --- a/lib/ids/DeterministicModuleIdsPlugin.js +++ b/lib/ids/DeterministicModuleIdsPlugin.js @@ -9,9 +9,9 @@ const { compareModulesByPreOrderIndexOrIdentifier } = require("../util/comparators"); const { - getUsedModuleIdsAndModules, + assignDeterministicIds, getFullModuleName, - assignDeterministicIds + getUsedModuleIdsAndModules } = require("./IdHelpers"); /** @typedef {import("../Compiler")} Compiler */ diff --git a/lib/ids/HashedModuleIdsPlugin.js b/lib/ids/HashedModuleIdsPlugin.js index d338fc02b89..a67f6e382b8 100644 --- a/lib/ids/HashedModuleIdsPlugin.js +++ b/lib/ids/HashedModuleIdsPlugin.js @@ -12,8 +12,8 @@ const { const createSchemaValidation = require("../util/create-schema-validation"); const createHash = require("../util/createHash"); const { - getUsedModuleIdsAndModules, - getFullModuleName + getFullModuleName, + getUsedModuleIdsAndModules } = require("./IdHelpers"); /** @typedef {import("../../declarations/plugins/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions} HashedModuleIdsPluginOptions */ diff --git a/lib/ids/IdHelpers.js b/lib/ids/IdHelpers.js index ac05534b34b..2e97a015ee8 100644 --- a/lib/ids/IdHelpers.js +++ b/lib/ids/IdHelpers.js @@ -57,8 +57,6 @@ const avoidNumber = str => { const requestToId = request => request.replace(/^(\.\.?\/)+/, "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_"); -module.exports.requestToId = requestToId; - /** * @param {string} string the string * @param {string} delimiter separator for string and hash @@ -92,8 +90,6 @@ const getShortModuleName = (module, context, associatedObjectForCache) => { return ""; }; -module.exports.getShortModuleName = getShortModuleName; - /** * @param {string} shortName the short name * @param {Module} module the module @@ -113,8 +109,6 @@ const getLongModuleName = ( return `${shortName}?${getHash(fullName, 4, hashFunction)}`; }; -module.exports.getLongModuleName = getLongModuleName; - /** * @param {Module} module the module * @param {string} context context directory @@ -124,8 +118,6 @@ module.exports.getLongModuleName = getLongModuleName; const getFullModuleName = (module, context, associatedObjectForCache) => makePathsRelative(context, module.identifier(), associatedObjectForCache); -module.exports.getFullModuleName = getFullModuleName; - /** * @param {Chunk} chunk the chunk * @param {ChunkGraph} chunkGraph the chunk graph @@ -148,15 +140,12 @@ const getShortChunkName = ( requestToId(getShortModuleName(m, context, associatedObjectForCache)) ); chunk.idNameHints.sort(); - const chunkName = Array.from(chunk.idNameHints) - .concat(shortModuleNames) + const chunkName = [...chunk.idNameHints, ...shortModuleNames] .filter(Boolean) .join(delimiter); return shortenLongString(chunkName, delimiter, hashFunction); }; -module.exports.getShortChunkName = getShortChunkName; - /** * @param {Chunk} chunk the chunk * @param {ChunkGraph} chunkGraph the chunk graph @@ -184,15 +173,16 @@ const getLongChunkName = ( ) ); chunk.idNameHints.sort(); - const chunkName = Array.from(chunk.idNameHints) - .concat(shortModuleNames, longModuleNames) + const chunkName = [ + ...chunk.idNameHints, + ...shortModuleNames, + ...longModuleNames + ] .filter(Boolean) .join(delimiter); return shortenLongString(chunkName, delimiter, hashFunction); }; -module.exports.getLongChunkName = getLongChunkName; - /** * @param {Chunk} chunk the chunk * @param {ChunkGraph} chunkGraph the chunk graph @@ -214,8 +204,6 @@ const getFullChunkName = ( return fullModuleNames.join(); }; -module.exports.getFullChunkName = getFullChunkName; - /** * @template K * @template V @@ -267,8 +255,6 @@ const getUsedModuleIdsAndModules = (compilation, filter) => { return [usedIds, modules]; }; -module.exports.getUsedModuleIdsAndModules = getUsedModuleIdsAndModules; - /** * @param {Compilation} compilation the compilation * @returns {Set} used chunk ids as strings @@ -292,8 +278,6 @@ const getUsedChunkIds = compilation => { return usedIds; }; -module.exports.getUsedChunkIds = getUsedChunkIds; - /** * @template T * @param {Iterable} items list of items to be named @@ -361,8 +345,6 @@ const assignNames = ( return unnamedItems; }; -module.exports.assignNames = assignNames; - /** * @template T * @param {T[]} items list of items to be named @@ -416,8 +398,6 @@ const assignDeterministicIds = ( } }; -module.exports.assignDeterministicIds = assignDeterministicIds; - /** * @param {Set} usedIds used ids * @param {Iterable} modules the modules @@ -454,8 +434,6 @@ const assignAscendingModuleIds = (usedIds, modules, compilation) => { } }; -module.exports.assignAscendingModuleIds = assignAscendingModuleIds; - /** * @param {Iterable} chunks the chunks * @param {Compilation} compilation the compilation @@ -486,3 +464,15 @@ const assignAscendingChunkIds = (chunks, compilation) => { }; module.exports.assignAscendingChunkIds = assignAscendingChunkIds; +module.exports.assignAscendingModuleIds = assignAscendingModuleIds; +module.exports.assignDeterministicIds = assignDeterministicIds; +module.exports.assignNames = assignNames; +module.exports.getFullChunkName = getFullChunkName; +module.exports.getFullModuleName = getFullModuleName; +module.exports.getLongChunkName = getLongChunkName; +module.exports.getLongModuleName = getLongModuleName; +module.exports.getShortChunkName = getShortChunkName; +module.exports.getShortModuleName = getShortModuleName; +module.exports.getUsedChunkIds = getUsedChunkIds; +module.exports.getUsedModuleIdsAndModules = getUsedModuleIdsAndModules; +module.exports.requestToId = requestToId; diff --git a/lib/ids/NamedChunkIdsPlugin.js b/lib/ids/NamedChunkIdsPlugin.js index d1c342aa223..7d4337d45ad 100644 --- a/lib/ids/NamedChunkIdsPlugin.js +++ b/lib/ids/NamedChunkIdsPlugin.js @@ -7,11 +7,11 @@ const { compareChunksNatural } = require("../util/comparators"); const { - getShortChunkName, - getLongChunkName, + assignAscendingChunkIds, assignNames, - getUsedChunkIds, - assignAscendingChunkIds + getLongChunkName, + getShortChunkName, + getUsedChunkIds } = require("./IdHelpers"); /** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} Output */ @@ -52,7 +52,7 @@ class NamedChunkIdsPlugin { const delimiter = this.delimiter; const unnamedChunks = assignNames( - Array.from(chunks).filter(chunk => { + [...chunks].filter(chunk => { if (chunk.name) { chunk.id = chunk.name; chunk.ids = [chunk.name]; diff --git a/lib/ids/NamedModuleIdsPlugin.js b/lib/ids/NamedModuleIdsPlugin.js index f52493b2b6e..9922516cb09 100644 --- a/lib/ids/NamedModuleIdsPlugin.js +++ b/lib/ids/NamedModuleIdsPlugin.js @@ -7,11 +7,11 @@ const { compareModulesByIdentifier } = require("../util/comparators"); const { - getShortModuleName, - getLongModuleName, + assignAscendingModuleIds, assignNames, - getUsedModuleIdsAndModules, - assignAscendingModuleIds + getLongModuleName, + getShortModuleName, + getUsedModuleIdsAndModules } = require("./IdHelpers"); /** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} Output */ diff --git a/lib/ids/NaturalChunkIdsPlugin.js b/lib/ids/NaturalChunkIdsPlugin.js index 1b24d3cdaf9..a45e6c7fbd6 100644 --- a/lib/ids/NaturalChunkIdsPlugin.js +++ b/lib/ids/NaturalChunkIdsPlugin.js @@ -25,7 +25,8 @@ class NaturalChunkIdsPlugin { compilation.hooks.chunkIds.tap(PLUGIN_NAME, chunks => { const chunkGraph = compilation.chunkGraph; const compareNatural = compareChunksNatural(chunkGraph); - const chunksInNaturalOrder = Array.from(chunks).sort(compareNatural); + /** @type {Chunk[]} */ + const chunksInNaturalOrder = [...chunks].sort(compareNatural); assignAscendingChunkIds(chunksInNaturalOrder, compilation); }); }); diff --git a/lib/ids/OccurrenceChunkIdsPlugin.js b/lib/ids/OccurrenceChunkIdsPlugin.js index 7dd97c3a761..b37703db2a6 100644 --- a/lib/ids/OccurrenceChunkIdsPlugin.js +++ b/lib/ids/OccurrenceChunkIdsPlugin.js @@ -60,7 +60,8 @@ class OccurrenceChunkIdsPlugin { occursInInitialChunksMap.set(c, occurs); } - const chunksInOccurrenceOrder = Array.from(chunks).sort((a, b) => { + /** @type {Chunk[]} */ + const chunksInOccurrenceOrder = [...chunks].sort((a, b) => { if (prioritiseInitial) { const aEntryOccurs = /** @type {number} */ diff --git a/lib/ids/SyncModuleIdsPlugin.js b/lib/ids/SyncModuleIdsPlugin.js index c29c42c0c49..349a69dc8b9 100644 --- a/lib/ids/SyncModuleIdsPlugin.js +++ b/lib/ids/SyncModuleIdsPlugin.js @@ -72,7 +72,7 @@ class SyncModuleIdsPlugin { if (!data || !dataChanged) return callback(); /** @type {{[key: string]: string | number}} */ const json = {}; - const sorted = Array.from(data).sort(([a], [b]) => (a < b ? -1 : 1)); + const sorted = [...data].sort(([a], [b]) => (a < b ? -1 : 1)); for (const [key, value] of sorted) { json[key] = value; } diff --git a/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js b/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js index 53fe9e6f049..df4d6a55509 100644 --- a/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +++ b/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js @@ -16,6 +16,7 @@ const { } = require("./StartupHelpers"); /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../ChunkGraph").EntryModuleWithChunkGroup} EntryModuleWithChunkGroup */ const PLUGIN_NAME = "ArrayPushCallbackChunkFormatPlugin"; @@ -72,9 +73,10 @@ class ArrayPushCallbackChunkFormatPlugin { ); source.add(`${JSON.stringify(chunk.ids)},`); source.add(modules); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); + /** @type {EntryModuleWithChunkGroup[]} */ + const entries = [ + ...chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ]; if (runtimeModules.length > 0 || entries.length > 0) { const runtime = new ConcatSource( `${ @@ -134,9 +136,10 @@ class ArrayPushCallbackChunkFormatPlugin { hash.update( `${PLUGIN_NAME}1${runtimeTemplate.outputOptions.chunkLoadingGlobal}${runtimeTemplate.outputOptions.hotUpdateGlobal}${runtimeTemplate.globalObject}` ); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); + /** @type {EntryModuleWithChunkGroup[]} */ + const entries = [ + ...chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ]; updateHashForEntryStartup(hash, chunkGraph, entries, chunk); } ); diff --git a/lib/javascript/CommonJsChunkFormatPlugin.js b/lib/javascript/CommonJsChunkFormatPlugin.js index 59d4a6be88c..48b4dce8c43 100644 --- a/lib/javascript/CommonJsChunkFormatPlugin.js +++ b/lib/javascript/CommonJsChunkFormatPlugin.js @@ -59,9 +59,9 @@ class CommonJsChunkFormatPlugin { Template.renderChunkRuntimeModules(runtimeModules, renderContext) ); } - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); + const entries = [ + ...chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ]; if (entries.length > 0) { const runtimeChunk = /** @type {Entrypoint} */ @@ -148,9 +148,9 @@ class CommonJsChunkFormatPlugin { if (chunk.hasRuntime()) return; hash.update(PLUGIN_NAME); hash.update("1"); - const entries = Array.from( - chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) - ); + const entries = [ + ...chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) + ]; updateHashForEntryStartup(hash, chunkGraph, entries, chunk); }); }); diff --git a/lib/javascript/EnableChunkLoadingPlugin.js b/lib/javascript/EnableChunkLoadingPlugin.js index 7125596ba20..a06ba03259f 100644 --- a/lib/javascript/EnableChunkLoadingPlugin.js +++ b/lib/javascript/EnableChunkLoadingPlugin.js @@ -53,9 +53,7 @@ class EnableChunkLoadingPlugin { "EnableChunkLoadingPlugin need to be used to enable this type of chunk loading. " + 'This usually happens through the "output.enabledChunkLoadingTypes" option. ' + 'If you are using a function as entry which sets "chunkLoading", you need to add all potential chunk loading types to "output.enabledChunkLoadingTypes". ' + - `These types are enabled: ${Array.from( - getEnabledTypes(compiler) - ).join(", ")}` + `These types are enabled: ${[...getEnabledTypes(compiler)].join(", ")}` ); } } diff --git a/lib/javascript/JavascriptModulesPlugin.js b/lib/javascript/JavascriptModulesPlugin.js index 53ee1211cb0..d58f7003d09 100644 --- a/lib/javascript/JavascriptModulesPlugin.js +++ b/lib/javascript/JavascriptModulesPlugin.js @@ -5,15 +5,15 @@ "use strict"; -const eslintScope = require("eslint-scope"); -const { SyncWaterfallHook, SyncHook, SyncBailHook } = require("tapable"); const vm = require("vm"); +const eslintScope = require("eslint-scope"); +const { SyncBailHook, SyncHook, SyncWaterfallHook } = require("tapable"); const { + CachedSource, ConcatSource, OriginalSource, PrefixSource, RawSource, - CachedSource, ReplaceSource } = require("webpack-sources"); const Compilation = require("../Compilation"); @@ -33,11 +33,11 @@ const { last, someInIterable } = require("../util/IterableHelpers"); const StringXor = require("../util/StringXor"); const { compareModulesByIdOrIdentifier } = require("../util/comparators"); const { - getPathInAst, - getAllReferences, RESERVED_NAMES, - findNewName, addScopeSymbols, + findNewName, + getAllReferences, + getPathInAst, getUsedNamesInScopeInfo } = require("../util/concatenate"); const createHash = require("../util/createHash"); @@ -708,7 +708,7 @@ class JavascriptModulesPlugin { "javascript", compareModulesByIdOrIdentifier(chunkGraph) ); - const allModules = modules ? Array.from(modules) : []; + const allModules = modules ? [...modules] : []; let strictHeader; let allStrict = renderContext.strictMode; if ( @@ -781,13 +781,14 @@ class JavascriptModulesPlugin { const bootstrap = this.renderBootstrap(renderContext, hooks); const useSourceMap = hooks.useSourceMap.call(chunk, renderContext); - const allModules = Array.from( - chunkGraph.getOrderedChunkModulesIterableBySourceType( + /** @type {Module[]} */ + const allModules = [ + ...(chunkGraph.getOrderedChunkModulesIterableBySourceType( chunk, "javascript", compareModulesByIdOrIdentifier(chunkGraph) - ) || [] - ); + ) || []) + ]; const hasEntryModules = chunkGraph.getNumberOfEntryModules(chunk) > 0; /** @type {Set | undefined} */ @@ -1018,7 +1019,7 @@ class JavascriptModulesPlugin { toSource(bootstrap.beforeStartup, "webpack/before-startup"), "\n", hooks.renderStartup.call( - toSource(bootstrap.startup.concat(""), "webpack/startup"), + toSource([...bootstrap.startup, ""], "webpack/startup"), lastEntryModule, { ...renderContext, @@ -1658,9 +1659,10 @@ class JavascriptModulesPlugin { if (allUsedNames.has(name) || usedNames.has(name)) { const references = getAllReferences(variable); - const allIdentifiers = new Set( - references.map(r => r.identifier).concat(variable.identifiers) - ); + const allIdentifiers = new Set([ + ...references.map(r => r.identifier), + ...variable.identifiers + ]); for (const ref of references) { addScopeSymbols( ref.from, diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index 426e3b573b1..ede5fcf0558 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -5,15 +5,15 @@ "use strict"; -const { Parser: AcornParser, tokTypes } = require("acorn"); -const { SyncBailHook, HookMap } = require("tapable"); const vm = require("vm"); +const { Parser: AcornParser, tokTypes } = require("acorn"); +const { HookMap, SyncBailHook } = require("tapable"); const Parser = require("../Parser"); const StackedMap = require("../util/StackedMap"); const binarySearchBounds = require("../util/binarySearchBounds"); const { - webpackCommentRegExp, - createMagicCommentContext + createMagicCommentContext, + webpackCommentRegExp } = require("../util/magicComment"); const memoize = require("../util/memoize"); const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); @@ -1284,11 +1284,12 @@ class JavascriptParser extends Parser { left.prefix, right.postfix, left.wrappedInnerExpressions && - right.wrappedInnerExpressions && - left.wrappedInnerExpressions - .concat(left.postfix ? [left.postfix] : []) - .concat(right.prefix ? [right.prefix] : []) - .concat(right.wrappedInnerExpressions) + right.wrappedInnerExpressions && [ + ...left.wrappedInnerExpressions, + ...(left.postfix ? [left.postfix] : []), + ...(right.prefix ? [right.prefix] : []), + ...right.wrappedInnerExpressions + ] ); } else { // ("prefix" + inner + postfix) + expr @@ -1296,10 +1297,10 @@ class JavascriptParser extends Parser { res.setWrapped( left.prefix, null, - left.wrappedInnerExpressions && - left.wrappedInnerExpressions.concat( - left.postfix ? [left.postfix, right] : [right] - ) + left.wrappedInnerExpressions && [ + ...left.wrappedInnerExpressions, + ...(left.postfix ? [left.postfix, right] : [right]) + ] ); } } else if (right.isString()) { @@ -1312,10 +1313,10 @@ class JavascriptParser extends Parser { res.setWrapped( null, right.postfix, - right.wrappedInnerExpressions && - (right.prefix ? [left, right.prefix] : [left]).concat( - right.wrappedInnerExpressions - ) + right.wrappedInnerExpressions && [ + ...(right.prefix ? [left, right.prefix] : [left]), + ...right.wrappedInnerExpressions + ] ); } else { return; @@ -1813,6 +1814,7 @@ class JavascriptParser extends Parser { if (!param.isString() && !param.isWrapped()) return; let stringSuffix = null; let hasUnknownParams = false; + /** @type {BasicEvaluatedExpression[]} */ const innerExpressions = []; for (let i = expr.arguments.length - 1; i >= 0; i--) { const arg = expr.arguments[i]; @@ -1852,7 +1854,10 @@ class JavascriptParser extends Parser { const prefix = param.isString() ? param : param.prefix; const inner = param.isWrapped() && param.wrappedInnerExpressions - ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) + ? [ + ...param.wrappedInnerExpressions, + ...innerExpressions.reverse() + ] : innerExpressions.reverse(); return new BasicEvaluatedExpression() .setWrapped(prefix, stringSuffix, inner) @@ -1860,7 +1865,7 @@ class JavascriptParser extends Parser { } else if (param.isWrapped()) { const postfix = stringSuffix || param.postfix; const inner = param.wrappedInnerExpressions - ? param.wrappedInnerExpressions.concat(innerExpressions.reverse()) + ? [...param.wrappedInnerExpressions, ...innerExpressions.reverse()] : innerExpressions.reverse(); return new BasicEvaluatedExpression() .setWrapped(param.prefix, postfix, inner) @@ -3968,7 +3973,7 @@ class JavascriptParser extends Parser { expression, exprInfo.name, exprInfo.rootInfo, - members.slice(), + [...members], () => this.callHooksForInfo( this.hooks.unhandledExpressionMemberChain, @@ -5269,9 +5274,9 @@ class JavascriptParser extends Parser { module.exports = JavascriptParser; module.exports.ALLOWED_MEMBER_TYPES_ALL = ALLOWED_MEMBER_TYPES_ALL; -module.exports.ALLOWED_MEMBER_TYPES_EXPRESSION = - ALLOWED_MEMBER_TYPES_EXPRESSION; module.exports.ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = ALLOWED_MEMBER_TYPES_CALL_EXPRESSION; -module.exports.getImportAttributes = getImportAttributes; +module.exports.ALLOWED_MEMBER_TYPES_EXPRESSION = + ALLOWED_MEMBER_TYPES_EXPRESSION; module.exports.VariableInfo = VariableInfo; +module.exports.getImportAttributes = getImportAttributes; diff --git a/lib/javascript/JavascriptParserHelpers.js b/lib/javascript/JavascriptParserHelpers.js index ebd912c0250..5ccd4e6fdbc 100644 --- a/lib/javascript/JavascriptParserHelpers.js +++ b/lib/javascript/JavascriptParserHelpers.js @@ -15,46 +15,7 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); /** @typedef {import("./JavascriptParser")} JavascriptParser */ /** @typedef {import("./JavascriptParser").Range} Range */ -/** - * @param {JavascriptParser} parser the parser - * @param {string} value the const value - * @param {(string[] | null)=} runtimeRequirements runtime requirements - * @returns {(expression: Expression) => true} plugin function - */ -module.exports.toConstantDependency = (parser, value, runtimeRequirements) => - function constDependency(expr) { - const dep = new ConstDependency( - value, - /** @type {Range} */ - (expr.range), - runtimeRequirements - ); - dep.loc = /** @type {SourceLocation} */ (expr.loc); - parser.state.module.addPresentationalDependency(dep); - return true; - }; - -/** - * @param {string} value the string value - * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function - */ -module.exports.evaluateToString = value => - function stringExpression(expr) { - return new BasicEvaluatedExpression() - .setString(value) - .setRange(/** @type {Range} */ (expr.range)); - }; - -/** - * @param {number} value the number value - * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function - */ -module.exports.evaluateToNumber = value => - function stringExpression(expr) { - return new BasicEvaluatedExpression() - .setNumber(value) - .setRange(/** @type {Range} */ (expr.range)); - }; +module.exports.approve = () => true; /** * @param {boolean} value the boolean value @@ -100,6 +61,28 @@ module.exports.evaluateToIdentifier = ( return evaluatedExpression; }; +/** + * @param {number} value the number value + * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function + */ +module.exports.evaluateToNumber = value => + function stringExpression(expr) { + return new BasicEvaluatedExpression() + .setNumber(value) + .setRange(/** @type {Range} */ (expr.range)); + }; + +/** + * @param {string} value the string value + * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function + */ +module.exports.evaluateToString = value => + function stringExpression(expr) { + return new BasicEvaluatedExpression() + .setString(value) + .setRange(/** @type {Range} */ (expr.range)); + }; + /** * @param {JavascriptParser} parser the parser * @param {string} message the message @@ -126,4 +109,21 @@ module.exports.expressionIsUnsupported = (parser, message) => module.exports.skipTraversal = () => true; -module.exports.approve = () => true; +/** + * @param {JavascriptParser} parser the parser + * @param {string} value the const value + * @param {(string[] | null)=} runtimeRequirements runtime requirements + * @returns {(expression: Expression) => true} plugin function + */ +module.exports.toConstantDependency = (parser, value, runtimeRequirements) => + function constDependency(expr) { + const dep = new ConstDependency( + value, + /** @type {Range} */ + (expr.range), + runtimeRequirements + ); + dep.loc = /** @type {SourceLocation} */ (expr.loc); + parser.state.module.addPresentationalDependency(dep); + return true; + }; diff --git a/lib/javascript/StartupHelpers.js b/lib/javascript/StartupHelpers.js index fe6a05c4a40..b06479527b5 100644 --- a/lib/javascript/StartupHelpers.js +++ b/lib/javascript/StartupHelpers.js @@ -133,6 +133,23 @@ module.exports.generateEntryStartup = ( return Template.asString(runtime); }; +/** + * @param {Chunk} chunk the chunk + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {(chunk: Chunk, chunkGraph: ChunkGraph) => boolean} filterFn filter function + * @returns {Set} initially fulfilled chunk ids + */ +module.exports.getInitialChunkIds = (chunk, chunkGraph, filterFn) => { + const initialChunkIds = new Set(chunk.ids); + for (const c of chunk.getAllInitialChunks()) { + if (c === chunk || filterFn(c, chunkGraph)) continue; + for (const id of /** @type {ChunkId[]} */ (c.ids)) { + initialChunkIds.add(id); + } + } + return initialChunkIds; +}; + /** * @param {Hash} hash the hash to update * @param {ChunkGraph} chunkGraph chunkGraph @@ -161,20 +178,3 @@ module.exports.updateHashForEntryStartup = ( } } }; - -/** - * @param {Chunk} chunk the chunk - * @param {ChunkGraph} chunkGraph the chunk graph - * @param {(chunk: Chunk, chunkGraph: ChunkGraph) => boolean} filterFn filter function - * @returns {Set} initially fulfilled chunk ids - */ -module.exports.getInitialChunkIds = (chunk, chunkGraph, filterFn) => { - const initialChunkIds = new Set(chunk.ids); - for (const c of chunk.getAllInitialChunks()) { - if (c === chunk || filterFn(c, chunkGraph)) continue; - for (const id of /** @type {ChunkId[]} */ (c.ids)) { - initialChunkIds.add(id); - } - } - return initialChunkIds; -}; diff --git a/lib/library/AssignLibraryPlugin.js b/lib/library/AssignLibraryPlugin.js index 1c1d89dfab9..f8c8856f620 100644 --- a/lib/library/AssignLibraryPlugin.js +++ b/lib/library/AssignLibraryPlugin.js @@ -191,7 +191,12 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin { */ _getResolvedFullName(options, chunk, compilation) { const prefix = this._getPrefix(compilation); - const fullName = options.name ? prefix.concat(options.name) : prefix; + const fullName = options.name + ? [ + ...prefix, + ...(Array.isArray(options.name) ? options.name : [options.name]) + ] + : prefix; return fullName.map(n => compilation.getPath(n, { chunk diff --git a/lib/library/EnableLibraryPlugin.js b/lib/library/EnableLibraryPlugin.js index 6f1de38e8a7..4369076e422 100644 --- a/lib/library/EnableLibraryPlugin.js +++ b/lib/library/EnableLibraryPlugin.js @@ -63,9 +63,7 @@ class EnableLibraryPlugin { "EnableLibraryPlugin need to be used to enable this type of library. " + 'This usually happens through the "output.enabledLibraryTypes" option. ' + 'If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". ' + - `These types are enabled: ${Array.from( - getEnabledTypes(compiler) - ).join(", ")}` + `These types are enabled: ${[...getEnabledTypes(compiler)].join(", ")}` ); } } diff --git a/lib/library/UmdLibraryPlugin.js b/lib/library/UmdLibraryPlugin.js index 7a47738fde9..d2676aae78c 100644 --- a/lib/library/UmdLibraryPlugin.js +++ b/lib/library/UmdLibraryPlugin.js @@ -148,7 +148,7 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { requiredExternals.push(m); } } - externals = requiredExternals.concat(optionalExternals); + externals = [...requiredExternals, ...optionalExternals]; } else { requiredExternals = externals; } @@ -194,7 +194,10 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { /** @type {RequestRecord} */ (request).root; } - return `root${accessorToObjectAccess(/** @type {string[]} */ ([]).concat(request))}`; + return `root${accessorToObjectAccess( + /** @type {string[]} */ + ([...(Array.isArray(request) ? request : [request])]) + )}`; }) .join(", ") ); @@ -254,7 +257,10 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { JSON.stringify( replaceKeys( /** @type {string} */ - (/** @type {string[]} */ ([]).concat(library).pop()) + ( + /** @type {string[]} */ + ([...(Array.isArray(library) ? library : [library])]).pop() + ) ) ); diff --git a/lib/logging/createConsoleLogger.js b/lib/logging/createConsoleLogger.js index 28596fed321..230ec7ccb37 100644 --- a/lib/logging/createConsoleLogger.js +++ b/lib/logging/createConsoleLogger.js @@ -85,9 +85,9 @@ module.exports = ({ level = "info", debug = false, console }) => { ( typeof debug === "boolean" ? [() => debug] - : /** @type {FilterItemTypes[]} */ ([]) - .concat(debug) - .map(filterToFunction) + : /** @type {FilterItemTypes[]} */ ([ + ...(Array.isArray(debug) ? debug : [debug]) + ]).map(filterToFunction) ); const loglevel = LogLevel[`${level}`] || 0; diff --git a/lib/logging/runtime.js b/lib/logging/runtime.js index b0c614081f0..5fb33701577 100644 --- a/lib/logging/runtime.js +++ b/lib/logging/runtime.js @@ -17,6 +17,15 @@ const currentDefaultLoggerOptions = { }; let currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions); +/** + * @param {createConsoleLogger.LoggerOptions} options new options, merge with old options + * @returns {void} + */ +module.exports.configureDefaultLogger = options => { + Object.assign(currentDefaultLoggerOptions, options); + currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions); +}; + /** * @param {string} name name of the logger * @returns {Logger} a logger @@ -31,15 +40,6 @@ module.exports.getLogger = name => childName => module.exports.getLogger(`${name}/${childName}`) ); -/** - * @param {createConsoleLogger.LoggerOptions} options new options, merge with old options - * @returns {void} - */ -module.exports.configureDefaultLogger = options => { - Object.assign(currentDefaultLoggerOptions, options); - currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions); -}; - module.exports.hooks = { log: new SyncBailHook(["origin", "type", "args"]) }; diff --git a/lib/optimize/AggressiveSplittingPlugin.js b/lib/optimize/AggressiveSplittingPlugin.js index 53efe9d2714..0a01b066dfc 100644 --- a/lib/optimize/AggressiveSplittingPlugin.js +++ b/lib/optimize/AggressiveSplittingPlugin.js @@ -8,8 +8,8 @@ const { STAGE_ADVANCED } = require("../OptimizationStages"); const { intersect } = require("../util/SetHelpers"); const { - compareModulesByIdentifier, - compareChunks + compareChunks, + compareModulesByIdentifier } = require("../util/comparators"); const createSchemaValidation = require("../util/create-schema-validation"); const identifierUtils = require("../util/identifier"); @@ -135,7 +135,7 @@ class AggressiveSplittingPlugin { const recordedSplits = (compilation.records && compilation.records.aggressiveSplits) || []; const usedSplits = newSplits - ? recordedSplits.concat(newSplits) + ? [...recordedSplits, ...newSplits] : recordedSplits; const minSize = /** @type {number} */ (this.options.minSize); @@ -177,11 +177,10 @@ class AggressiveSplittingPlugin { // The found chunk is already the split or similar if ( selectedChunks.size === 1 && - chunkGraph.getNumberOfChunkModules( - Array.from(selectedChunks)[0] - ) === selectedModules.length + chunkGraph.getNumberOfChunkModules([...selectedChunks][0]) === + selectedModules.length ) { - const chunk = Array.from(selectedChunks)[0]; + const chunk = [...selectedChunks][0]; if (fromAggressiveSplittingSet.has(chunk)) return false; fromAggressiveSplittingSet.add(chunk); chunkSplitDataMap.set(chunk, splitData); @@ -218,7 +217,7 @@ class AggressiveSplittingPlugin { // for any chunk which isn't splitted yet, split it and create a new entry // start with the biggest chunk const cmpFn = compareChunks(chunkGraph); - const sortedChunks = Array.from(chunks).sort((a, b) => { + const sortedChunks = [...chunks].sort((a, b) => { const diff1 = chunkGraph.getChunkModulesSize(b) - chunkGraph.getChunkModulesSize(a); @@ -260,7 +259,7 @@ class AggressiveSplittingPlugin { }; if (applySplit(splitData)) { - newSplits = (newSplits || []).concat(splitData); + newSplits = [...(newSplits || []), splitData]; changed = true; } } @@ -324,7 +323,7 @@ class AggressiveSplittingPlugin { } // record all splits - records.aggressiveSplits = Array.from(allSplits); + records.aggressiveSplits = [...allSplits]; needAdditionalSeal = false; } diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index b6bf07073db..3f416761274 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -33,8 +33,8 @@ const LazySet = require("../util/LazySet"); const { concatComparators } = require("../util/comparators"); const { RESERVED_NAMES, - findNewName, addScopeSymbols, + findNewName, getAllReferences, getPathInAst, getUsedNamesInScopeInfo @@ -764,7 +764,7 @@ class ConcatenatedModule extends Module { } get modules() { - return Array.from(this._modules); + return [...this._modules]; } /** @@ -952,9 +952,7 @@ class ConcatenatedModule extends Module { * @returns {Iterable<{ connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} imported modules in order */ const getConcatenatedImports = module => { - const connections = Array.from( - moduleGraph.getOutgoingConnections(module) - ); + const connections = [...moduleGraph.getOutgoingConnections(module)]; if (module === rootModule) { for (const c of moduleGraph.getOutgoingConnections(this)) { connections.push(c); @@ -1360,9 +1358,10 @@ class ConcatenatedModule extends Module { info.internalNames.set(name, newName); topLevelDeclarations.add(newName); const source = /** @type {ReplaceSource} */ (info.source); - const allIdentifiers = new Set( - references.map(r => r.identifier).concat(variable.identifiers) - ); + const allIdentifiers = new Set([ + ...references.map(r => r.identifier), + ...variable.identifiers + ]); for (const identifier of allIdentifiers) { const r = /** @type {Range} */ (identifier.range); const path = getPathInAst( diff --git a/lib/optimize/InnerGraph.js b/lib/optimize/InnerGraph.js index ea193f116d2..a4dbfddede0 100644 --- a/lib/optimize/InnerGraph.js +++ b/lib/optimize/InnerGraph.js @@ -30,6 +30,17 @@ const { UsageState } = require("../ExportsInfo"); /** @typedef {false|StateObject} State */ +class TopLevelSymbol { + /** + * @param {string} name name of the variable + */ + constructor(name) { + this.name = name; + } +} + +module.exports.TopLevelSymbol = TopLevelSymbol; + /** @type {WeakMap} */ const parserStateMap = new WeakMap(); const topLevelSymbolTag = Symbol("top level symbol"); @@ -42,39 +53,6 @@ function getState(parserState) { return parserStateMap.get(parserState); } -/** - * @param {ParserState} parserState parser state - * @returns {void} - */ -module.exports.bailout = parserState => { - parserStateMap.set(parserState, false); -}; - -/** - * @param {ParserState} parserState parser state - * @returns {void} - */ -module.exports.enable = parserState => { - const state = parserStateMap.get(parserState); - if (state === false) { - return; - } - parserStateMap.set(parserState, { - innerGraph: new Map(), - currentTopLevelSymbol: undefined, - usageCallbackMap: new Map() - }); -}; - -/** - * @param {ParserState} parserState parser state - * @returns {boolean} true, when enabled - */ -module.exports.isEnabled = parserState => { - const state = parserStateMap.get(parserState); - return Boolean(state); -}; - /** * @param {ParserState} state parser state * @param {TopLevelSymbol | null} symbol the symbol, or null for all symbols @@ -113,6 +91,71 @@ module.exports.addVariableUsage = (parser, name, usage) => { } }; +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +module.exports.bailout = parserState => { + parserStateMap.set(parserState, false); +}; + +/** + * @param {ParserState} parserState parser state + * @returns {void} + */ +module.exports.enable = parserState => { + const state = parserStateMap.get(parserState); + if (state === false) { + return; + } + parserStateMap.set(parserState, { + innerGraph: new Map(), + currentTopLevelSymbol: undefined, + usageCallbackMap: new Map() + }); +}; + +/** + * @param {Dependency} dependency the dependency + * @param {Set | boolean | undefined} usedByExports usedByExports info + * @param {ModuleGraph} moduleGraph moduleGraph + * @returns {null | false | GetConditionFn} function to determine if the connection is active + */ +module.exports.getDependencyUsedByExportsCondition = ( + dependency, + usedByExports, + moduleGraph +) => { + if (usedByExports === false) return false; + if (usedByExports !== true && usedByExports !== undefined) { + const selfModule = + /** @type {Module} */ + (moduleGraph.getParentModule(dependency)); + const exportsInfo = moduleGraph.getExportsInfo(selfModule); + return (connections, runtime) => { + for (const exportName of usedByExports) { + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { + return true; + } + } + return false; + }; + } + return null; +}; + +/** + * @param {ParserState} state parser state + * @returns {TopLevelSymbol|void} usage data + */ +module.exports.getTopLevelSymbol = state => { + const innerGraphState = getState(state); + + if (innerGraphState) { + return innerGraphState.currentTopLevelSymbol; + } +}; + /** * @param {ParserState} state parser state * @returns {void} @@ -209,6 +252,45 @@ module.exports.inferDependencyUsage = state => { } }; +/** + * @param {Dependency} dependency the dependency + * @param {Set | boolean} usedByExports usedByExports info + * @param {ModuleGraph} moduleGraph moduleGraph + * @param {RuntimeSpec} runtime runtime + * @returns {boolean} false, when unused. Otherwise true + */ +module.exports.isDependencyUsedByExports = ( + dependency, + usedByExports, + moduleGraph, + runtime +) => { + if (usedByExports === false) return false; + if (usedByExports !== true && usedByExports !== undefined) { + const selfModule = + /** @type {Module} */ + (moduleGraph.getParentModule(dependency)); + const exportsInfo = moduleGraph.getExportsInfo(selfModule); + let used = false; + for (const exportName of usedByExports) { + if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { + used = true; + } + } + if (!used) return false; + } + return true; +}; + +/** + * @param {ParserState} parserState parser state + * @returns {boolean} true, when enabled + */ +module.exports.isEnabled = parserState => { + const state = parserStateMap.get(parserState); + return Boolean(state); +}; + /** * @param {ParserState} state parser state * @param {UsageCallback} onUsageCallback on usage callback @@ -247,18 +329,6 @@ module.exports.setTopLevelSymbol = (state, symbol) => { } }; -/** - * @param {ParserState} state parser state - * @returns {TopLevelSymbol|void} usage data - */ -module.exports.getTopLevelSymbol = state => { - const innerGraphState = getState(state); - - if (innerGraphState) { - return innerGraphState.currentTopLevelSymbol; - } -}; - /** * @param {JavascriptParser} parser parser * @param {string} name name of variable @@ -282,73 +352,4 @@ module.exports.tagTopLevelSymbol = (parser, name) => { return fn; }; -/** - * @param {Dependency} dependency the dependency - * @param {Set | boolean} usedByExports usedByExports info - * @param {ModuleGraph} moduleGraph moduleGraph - * @param {RuntimeSpec} runtime runtime - * @returns {boolean} false, when unused. Otherwise true - */ -module.exports.isDependencyUsedByExports = ( - dependency, - usedByExports, - moduleGraph, - runtime -) => { - if (usedByExports === false) return false; - if (usedByExports !== true && usedByExports !== undefined) { - const selfModule = - /** @type {Module} */ - (moduleGraph.getParentModule(dependency)); - const exportsInfo = moduleGraph.getExportsInfo(selfModule); - let used = false; - for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { - used = true; - } - } - if (!used) return false; - } - return true; -}; - -/** - * @param {Dependency} dependency the dependency - * @param {Set | boolean | undefined} usedByExports usedByExports info - * @param {ModuleGraph} moduleGraph moduleGraph - * @returns {null | false | GetConditionFn} function to determine if the connection is active - */ -module.exports.getDependencyUsedByExportsCondition = ( - dependency, - usedByExports, - moduleGraph -) => { - if (usedByExports === false) return false; - if (usedByExports !== true && usedByExports !== undefined) { - const selfModule = - /** @type {Module} */ - (moduleGraph.getParentModule(dependency)); - const exportsInfo = moduleGraph.getExportsInfo(selfModule); - return (connections, runtime) => { - for (const exportName of usedByExports) { - if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { - return true; - } - } - return false; - }; - } - return null; -}; - -class TopLevelSymbol { - /** - * @param {string} name name of the variable - */ - constructor(name) { - this.name = name; - } -} - -module.exports.TopLevelSymbol = TopLevelSymbol; module.exports.topLevelSymbolTag = topLevelSymbolTag; diff --git a/lib/optimize/LimitChunkCountPlugin.js b/lib/optimize/LimitChunkCountPlugin.js index 9512958d845..74e1285f7f6 100644 --- a/lib/optimize/LimitChunkCountPlugin.js +++ b/lib/optimize/LimitChunkCountPlugin.js @@ -85,7 +85,8 @@ class LimitChunkCountPlugin { // order chunks in a deterministic way const compareChunksWithGraph = compareChunks(chunkGraph); - const orderedChunks = Array.from(chunks).sort(compareChunksWithGraph); + /** @type {Chunk[]} */ + const orderedChunks = [...chunks].sort(compareChunksWithGraph); // create a lazy sorted data structure to keep all combinations // this is large. Size = chunks * (chunks - 1) / 2 diff --git a/lib/optimize/MangleExportsPlugin.js b/lib/optimize/MangleExportsPlugin.js index d88a2c6d9bc..f99424ae4fd 100644 --- a/lib/optimize/MangleExportsPlugin.js +++ b/lib/optimize/MangleExportsPlugin.js @@ -7,9 +7,9 @@ const { UsageState } = require("../ExportsInfo"); const { - numberToIdentifier, + NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS, NUMBER_OF_IDENTIFIER_START_CHARS, - NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS + numberToIdentifier } = require("../Template"); const { assignDeterministicIds } = require("../ids/IdHelpers"); const { compareSelect, compareStringsNumeric } = require("../util/comparators"); diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index cec2c98973c..383bbcbc410 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -13,11 +13,11 @@ const { STAGE_DEFAULT } = require("../OptimizationStages"); const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency"); const { compareModulesByIdentifier } = require("../util/comparators"); const { + filterRuntime, intersectRuntime, + mergeRuntime, mergeRuntimeOwned, - filterRuntime, - runtimeToString, - mergeRuntime + runtimeToString } = require("../util/runtime"); const ConcatenatedModule = require("./ConcatenatedModule"); @@ -224,7 +224,7 @@ class ModuleConcatenationPlugin { } if (moduleGraph.isDeferred(module)) { - setInnerBailoutReason(module, `Module is deferred`); + setInnerBailoutReason(module, "Module is deferred"); canBeInner = false; } @@ -590,25 +590,27 @@ class ModuleConcatenationPlugin { } // Module must be in the correct chunks - const missingChunks = Array.from( - chunkGraph.getModuleChunksIterable(config.rootModule) - ).filter(chunk => !chunkGraph.isModuleInChunk(module, chunk)); + const missingChunks = [ + ...chunkGraph.getModuleChunksIterable(config.rootModule) + ].filter(chunk => !chunkGraph.isModuleInChunk(module, chunk)); if (missingChunks.length > 0) { /** * @param {RequestShortener} requestShortener request shortener * @returns {string} problem description */ const problem = requestShortener => { - const missingChunksList = Array.from( - new Set(missingChunks.map(chunk => chunk.name || "unnamed chunk(s)")) - ).sort(); - const chunks = Array.from( - new Set( - Array.from(chunkGraph.getModuleChunksIterable(module)).map( + const missingChunksList = [ + ...new Set( + missingChunks.map(chunk => chunk.name || "unnamed chunk(s)") + ) + ].sort(); + const chunks = [ + ...new Set( + [...chunkGraph.getModuleChunksIterable(module)].map( chunk => chunk.name || "unnamed chunk(s)" ) ) - ).sort(); + ].sort(); return `Module ${module.readableIdentifier( requestShortener )} is not in the same chunk(s) (expected in chunk(s) ${missingChunksList.join( @@ -643,7 +645,7 @@ class ModuleConcatenationPlugin { const importingExplanations = new Set( activeNonModulesConnections.map(c => c.explanation).filter(Boolean) ); - const explanations = Array.from(importingExplanations).sort(); + const explanations = [...importingExplanations].sort(); return `Module ${module.readableIdentifier( requestShortener )} is referenced ${ @@ -683,7 +685,7 @@ class ModuleConcatenationPlugin { } } - const incomingModules = Array.from(incomingConnectionsFromModules.keys()); + const incomingModules = [...incomingConnectionsFromModules.keys()]; // Module must be in the same chunks like the referencing module const otherChunkModules = incomingModules.filter(originModule => { @@ -734,18 +736,18 @@ class ModuleConcatenationPlugin { * @returns {string} problem description */ const problem = requestShortener => { - const names = Array.from(nonHarmonyConnections) + const names = [...nonHarmonyConnections] .map( ([originModule, connections]) => `${originModule.readableIdentifier( requestShortener - )} (referenced with ${Array.from( - new Set( + )} (referenced with ${[ + ...new Set( connections .map(c => c.dependency && c.dependency.type) .filter(Boolean) ) - ) + ] .sort() .join(", ")})` ) @@ -905,7 +907,7 @@ class ConcatConfiguration { */ getWarningsSorted() { return new Map( - Array.from(this.warnings).sort((a, b) => { + [...this.warnings].sort((a, b) => { const ai = a[0].identifier(); const bi = b[0].identifier(); if (ai < bi) return -1; diff --git a/lib/optimize/RealContentHashPlugin.js b/lib/optimize/RealContentHashPlugin.js index dc5bccccad1..1a69674e13c 100644 --- a/lib/optimize/RealContentHashPlugin.js +++ b/lib/optimize/RealContentHashPlugin.js @@ -6,7 +6,7 @@ "use strict"; const { SyncBailHook } = require("tapable"); -const { RawSource, CachedSource, CompatSource } = require("webpack-sources"); +const { CachedSource, CompatSource, RawSource } = require("webpack-sources"); const Compilation = require("../Compilation"); const WebpackError = require("../WebpackError"); const { compareSelect, compareStrings } = require("../util/comparators"); @@ -214,7 +214,7 @@ class RealContentHashPlugin { } const etag = cacheAnalyse.mergeEtags( cacheAnalyse.getLazyHashedEtag(source), - Array.from(hashes).join("|") + [...hashes].join("|") ); [asset.referencedHashes, asset.ownHashes] = await cacheAnalyse.providePromise(name, etag, () => { @@ -288,6 +288,7 @@ ${referencingAssets a => a.name )})`; }; + /** @type {Set} */ const hashesInOrder = new Set(); for (const hash of hashToAssets.keys()) { /** @@ -316,6 +317,7 @@ ${referencingAssets if (hashesInOrder.has(hash)) continue; add(hash, new Set()); } + /** @type {Map} */ const hashToNewHash = new Map(); /** * @param {AssetInfoForRealContentHash} asset asset info @@ -338,10 +340,9 @@ ${referencingAssets return (asset.contentComputePromise = (async () => { if ( /** @type {OwnHashes} */ (asset.ownHashes).size > 0 || - Array.from( - /** @type {ReferencedHashes} */ - (asset.referencedHashes) - ).some(hash => hashToNewHash.get(hash) !== hash) + [ + .../** @type {ReferencedHashes} */ (asset.referencedHashes) + ].some(hash => hashToNewHash.get(hash) !== hash) ) { const identifier = asset.name; const etag = getEtag(asset); @@ -349,8 +350,9 @@ ${referencingAssets identifier, etag, () => { - const newContent = asset.content.replace(hashRegExp, hash => - hashToNewHash.get(hash) + const newContent = asset.content.replace( + hashRegExp, + hash => /** @type {string} */ (hashToNewHash.get(hash)) ); return new RawSource(newContent); } @@ -369,10 +371,9 @@ ${referencingAssets return (asset.contentComputeWithoutOwnPromise = (async () => { if ( /** @type {OwnHashes} */ (asset.ownHashes).size > 0 || - Array.from( - /** @type {ReferencedHashes} */ - (asset.referencedHashes) - ).some(hash => hashToNewHash.get(hash) !== hash) + [ + .../** @type {ReferencedHashes} */ (asset.referencedHashes) + ].some(hash => hashToNewHash.get(hash) !== hash) ) { const identifier = `${asset.name}|without-own`; const etag = getEtag(asset); @@ -384,11 +385,12 @@ ${referencingAssets hashRegExp, hash => { if ( - /** @type {OwnHashes} */ (asset.ownHashes).has(hash) + /** @type {OwnHashes} */ + (asset.ownHashes).has(hash) ) { return ""; } - return hashToNewHash.get(hash); + return /** @type {string} */ (hashToNewHash.get(hash)); } ); return new RawSource(newContent); @@ -437,15 +439,18 @@ ${referencingAssets await Promise.all( assetsWithInfo.map(async asset => { await computeNewContent(asset); - const newName = asset.name.replace(hashRegExp, hash => - hashToNewHash.get(hash) + const newName = asset.name.replace( + hashRegExp, + hash => /** @type {string} */ (hashToNewHash.get(hash)) ); const infoUpdate = {}; - const hash = asset.info.contenthash; + const hash = /** @type {string} */ (asset.info.contenthash); infoUpdate.contenthash = Array.isArray(hash) - ? hash.map(hash => hashToNewHash.get(hash)) - : hashToNewHash.get(hash); + ? hash.map( + hash => /** @type {string} */ (hashToNewHash.get(hash)) + ) + : /** @type {string} */ (hashToNewHash.get(hash)); if (asset.newSource !== undefined) { compilation.updateAsset( diff --git a/lib/optimize/RemoveEmptyChunksPlugin.js b/lib/optimize/RemoveEmptyChunksPlugin.js index 520b4784920..3bc0cd4a4ff 100644 --- a/lib/optimize/RemoveEmptyChunksPlugin.js +++ b/lib/optimize/RemoveEmptyChunksPlugin.js @@ -5,7 +5,7 @@ "use strict"; -const { STAGE_BASIC, STAGE_ADVANCED } = require("../OptimizationStages"); +const { STAGE_ADVANCED, STAGE_BASIC } = require("../OptimizationStages"); /** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Compiler")} Compiler */ diff --git a/lib/optimize/SideEffectsFlagPlugin.js b/lib/optimize/SideEffectsFlagPlugin.js index 3824a92a832..2ec9d0fd578 100644 --- a/lib/optimize/SideEffectsFlagPlugin.js +++ b/lib/optimize/SideEffectsFlagPlugin.js @@ -8,8 +8,8 @@ const glob2regexp = require("glob-to-regexp"); const { JAVASCRIPT_MODULE_TYPE_AUTO, - JAVASCRIPT_MODULE_TYPE_ESM, - JAVASCRIPT_MODULE_TYPE_DYNAMIC + JAVASCRIPT_MODULE_TYPE_DYNAMIC, + JAVASCRIPT_MODULE_TYPE_ESM } = require("../ModuleTypeConstants"); const { STAGE_DEFAULT } = require("../OptimizationStages"); const HarmonyExportImportedSpecifierDependency = require("../dependencies/HarmonyExportImportedSpecifierDependency"); diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index 226907c5e2b..321cb423df9 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -12,8 +12,8 @@ const { requestToId } = require("../ids/IdHelpers"); const { isSubset } = require("../util/SetHelpers"); const SortableSet = require("../util/SortableSet"); const { - compareModulesByIdentifier, - compareIterables + compareIterables, + compareModulesByIdentifier } = require("../util/comparators"); const createHash = require("../util/createHash"); const deterministicGrouping = require("../util/deterministicGrouping"); @@ -931,7 +931,7 @@ module.exports = class SplitChunksPlugin { /** @type {Set} */ const singleChunkSets = new Set(); for (const module of compilation.modules) { - const groupedChunks = Array.from(groupChunksByExports(module)); + const groupedChunks = [...groupChunksByExports(module)]; groupedByExportsMap.set(module, groupedChunks); for (const chunks of groupedChunks) { if (chunks.length === 1) { @@ -1494,7 +1494,7 @@ module.exports = class SplitChunksPlugin { usedChunks.add(/** @type {Chunk} */ (newChunk)); } if (usedChunks.size >= item.cacheGroup.minChunks) { - const chunksArr = Array.from(usedChunks); + const chunksArr = [...usedChunks]; for (const module of item.modules) { addModuleToChunksInfoMap( item.cacheGroup, @@ -1620,7 +1620,7 @@ module.exports = class SplitChunksPlugin { : item.cacheGroup.maxInitialSize, automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter, keys: oldMaxSizeSettings - ? oldMaxSizeSettings.keys.concat(item.cacheGroup.key) + ? [...oldMaxSizeSettings.keys, item.cacheGroup.key] : [item.cacheGroup.key] }); } @@ -1674,7 +1674,7 @@ module.exports = class SplitChunksPlugin { // Make sure that maxSize is fulfilled const { fallbackCacheGroup } = this.options; - for (const chunk of Array.from(compilation.chunks)) { + for (const chunk of compilation.chunks) { const chunkConfig = maxSizeQueueMap.get(chunk); const { minSize, diff --git a/lib/rules/RuleSetCompiler.js b/lib/rules/RuleSetCompiler.js index d1afde72c4f..acc42abfe90 100644 --- a/lib/rules/RuleSetCompiler.js +++ b/lib/rules/RuleSetCompiler.js @@ -208,6 +208,7 @@ class RuleSetCompiler { * @returns {CompiledRule} normalized and compiled rule for processing */ compileRule(path, rule, refs) { + /** @type {Set} */ const unhandledProperties = new Set( Object.keys(rule).filter( key => rule[/** @type {keyof RuleSetRule} */ (key)] !== undefined @@ -246,7 +247,7 @@ class RuleSetCompiler { throw this.error( path, rule, - `Properties ${Array.from(unhandledProperties).join(", ")} are unknown` + `Properties ${[...unhandledProperties].join(", ")} are unknown` ); } diff --git a/lib/runtime/MakeDeferredNamespaceObjectRuntime.js b/lib/runtime/MakeDeferredNamespaceObjectRuntime.js index 7e2e3046dc3..e3e5899e31c 100644 --- a/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +++ b/lib/runtime/MakeDeferredNamespaceObjectRuntime.js @@ -152,7 +152,7 @@ class MakeDeferredNamespaceObjectRuntimeModule extends HelperRuntimeModule { ]), "}", init, - `return ns[name];` + "return ns[name];" ])},`, `has: ${runtimeTemplate.basicFunction("_, name", [ "switch (name) {", @@ -170,7 +170,7 @@ class MakeDeferredNamespaceObjectRuntimeModule extends HelperRuntimeModule { ), "}", init, - `return name in ns;` + "return name in ns;" ])},`, `ownKeys: ${runtimeTemplate.basicFunction("", [ init, @@ -187,7 +187,7 @@ class MakeDeferredNamespaceObjectRuntimeModule extends HelperRuntimeModule { "}", init, "var desc = Reflect.getOwnPropertyDescriptor(ns, name);", - `if (mode == 2 && name == "default" && !desc) {`, + 'if (mode == 2 && name == "default" && !desc) {', Template.indent("desc = { value: ns, configurable: true };"), "}", "return desc;" diff --git a/lib/runtime/StartupChunkDependenciesRuntimeModule.js b/lib/runtime/StartupChunkDependenciesRuntimeModule.js index da2ec7548eb..1a834bd9f8c 100644 --- a/lib/runtime/StartupChunkDependenciesRuntimeModule.js +++ b/lib/runtime/StartupChunkDependenciesRuntimeModule.js @@ -28,9 +28,9 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule { generate() { const chunkGraph = /** @type {ChunkGraph} */ (this.chunkGraph); const chunk = /** @type {Chunk} */ (this.chunk); - const chunkIds = Array.from( - chunkGraph.getChunkEntryDependentChunksIterable(chunk) - ).map(chunk => chunk.id); + const chunkIds = [ + ...chunkGraph.getChunkEntryDependentChunksIterable(chunk) + ].map(chunk => chunk.id); const compilation = /** @type {Compilation} */ (this.compilation); const { runtimeTemplate } = compilation; return Template.asString([ @@ -38,11 +38,12 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule { `${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction( "", !this.asyncChunkLoading - ? chunkIds - .map( + ? [ + ...chunkIds.map( id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)});` - ) - .concat("return next();") + ), + "return next();" + ] : chunkIds.length === 1 ? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify( chunkIds[0] diff --git a/lib/schemes/HttpUriPlugin.js b/lib/schemes/HttpUriPlugin.js index d29b9c2e9a3..01b0ed3373e 100644 --- a/lib/schemes/HttpUriPlugin.js +++ b/lib/schemes/HttpUriPlugin.js @@ -6,18 +6,18 @@ "use strict"; const EventEmitter = require("events"); -const { extname, basename } = require("path"); +const { basename, extname } = require("path"); const { URL } = require("url"); const { - createGunzip, // eslint-disable-next-line n/no-unsupported-features/node-builtins createBrotliDecompress, + createGunzip, createInflate } = require("zlib"); const NormalModule = require("../NormalModule"); const createSchemaValidation = require("../util/create-schema-validation"); const createHash = require("../util/createHash"); -const { mkdirp, dirname, join } = require("../util/fs"); +const { dirname, join, mkdirp } = require("../util/fs"); const memoize = require("../util/memoize"); /** @typedef {import("http").IncomingMessage} IncomingMessage */ @@ -240,9 +240,7 @@ class Lockfile { */ toString() { let str = "{\n"; - const entries = Array.from(this.entries).sort(([a], [b]) => - a < b ? -1 : 1 - ); + const entries = [...this.entries].sort(([a], [b]) => (a < b ? -1 : 1)); for (const [key, entry] of entries) { if (typeof entry === "string") { str += ` ${JSON.stringify(key)}: ${JSON.stringify(entry)},\n`; diff --git a/lib/serialization/BinaryMiddleware.js b/lib/serialization/BinaryMiddleware.js index 44ec4aa0278..02060b1fbb2 100644 --- a/lib/serialization/BinaryMiddleware.js +++ b/lib/serialization/BinaryMiddleware.js @@ -1156,5 +1156,5 @@ class BinaryMiddleware extends SerializerMiddleware { module.exports = BinaryMiddleware; -module.exports.MEASURE_START_OPERATION = MEASURE_START_OPERATION; module.exports.MEASURE_END_OPERATION = MEASURE_END_OPERATION; +module.exports.MEASURE_START_OPERATION = MEASURE_START_OPERATION; diff --git a/lib/serialization/FileMiddleware.js b/lib/serialization/FileMiddleware.js index c70ce71d779..1b24bc99275 100644 --- a/lib/serialization/FileMiddleware.js +++ b/lib/serialization/FileMiddleware.js @@ -7,13 +7,13 @@ const { constants } = require("buffer"); const { pipeline } = require("stream"); const { + constants: zConstants, // eslint-disable-next-line n/no-unsupported-features/node-builtins createBrotliCompress, // eslint-disable-next-line n/no-unsupported-features/node-builtins createBrotliDecompress, - createGzip, createGunzip, - constants: zConstants + createGzip } = require("zlib"); const { DEFAULTS } = require("../config/defaults"); const createHash = require("../util/createHash"); diff --git a/lib/serialization/ObjectMiddleware.js b/lib/serialization/ObjectMiddleware.js index 74884b7fff8..affa9306b48 100644 --- a/lib/serialization/ObjectMiddleware.js +++ b/lib/serialization/ObjectMiddleware.js @@ -175,7 +175,7 @@ if (exports.constructor !== Object) { // eslint-disable-next-line n/exports-style const Obj = /** @type {ObjectConstructor} */ (exports.constructor); const Fn = /** @type {FunctionConstructor} */ (Obj.constructor); - for (const [type, config] of Array.from(jsTypes)) { + for (const [type, config] of jsTypes) { if (type) { const Type = new Fn(`return ${type.name};`)(); jsTypes.set(Type, config); @@ -416,7 +416,7 @@ class ObjectMiddleware extends SerializerMiddleware { * @returns {string} stack */ const stackToString = item => { - const arr = Array.from(cycleStack); + const arr = [...cycleStack]; arr.push(item); return arr .map(item => { diff --git a/lib/serialization/Serializer.js b/lib/serialization/Serializer.js index ef1817254d7..cf4a68a5222 100644 --- a/lib/serialization/Serializer.js +++ b/lib/serialization/Serializer.js @@ -20,8 +20,8 @@ class Serializer { * @param {Context=} context context */ constructor(middlewares, context) { - this.serializeMiddlewares = middlewares.slice(); - this.deserializeMiddlewares = middlewares.slice().reverse(); + this.serializeMiddlewares = [...middlewares]; + this.deserializeMiddlewares = [...middlewares].reverse(); this.context = context; } diff --git a/lib/sharing/ConsumeSharedPlugin.js b/lib/sharing/ConsumeSharedPlugin.js index 3a9b22aa183..c1611259c86 100644 --- a/lib/sharing/ConsumeSharedPlugin.js +++ b/lib/sharing/ConsumeSharedPlugin.js @@ -18,9 +18,9 @@ const ConsumeSharedRuntimeModule = require("./ConsumeSharedRuntimeModule"); const ProvideForSharedDependency = require("./ProvideForSharedDependency"); const { resolveMatchedConfigs } = require("./resolveMatchedConfigs"); const { - isRequiredVersion, getDescriptionFile, - getRequiredVersionFromDescriptionFile + getRequiredVersionFromDescriptionFile, + isRequiredVersion } = require("./utils"); /** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */ diff --git a/lib/sharing/ConsumeSharedRuntimeModule.js b/lib/sharing/ConsumeSharedRuntimeModule.js index 095d24c099b..6ee44fe0792 100644 --- a/lib/sharing/ConsumeSharedRuntimeModule.js +++ b/lib/sharing/ConsumeSharedRuntimeModule.js @@ -10,9 +10,9 @@ const RuntimeModule = require("../RuntimeModule"); const Template = require("../Template"); const { parseVersionRuntimeCode, - versionLtRuntimeCode, rangeToStringRuntimeCode, - satisfyRuntimeCode + satisfyRuntimeCode, + versionLtRuntimeCode } = require("../util/semver"); /** @typedef {import("webpack-sources").Source} Source */ diff --git a/lib/sharing/ShareRuntimeModule.js b/lib/sharing/ShareRuntimeModule.js index 0f63ef68d7d..8b4574fa2ab 100644 --- a/lib/sharing/ShareRuntimeModule.js +++ b/lib/sharing/ShareRuntimeModule.js @@ -121,17 +121,15 @@ class ShareRuntimeModule extends RuntimeModule { ])}`, "var promises = [];", "switch(name) {", - ...Array.from(initCodePerScope) + ...[...initCodePerScope] .sort(([a], [b]) => compareStrings(a, b)) .map(([name, stages]) => Template.indent([ `case ${JSON.stringify(name)}: {`, Template.indent( - Array.from(stages) + [...stages] .sort(([a], [b]) => a - b) - .map(([, initCode]) => - Template.asString(Array.from(initCode)) - ) + .map(([, initCode]) => Template.asString([...initCode])) ), "}", "break;" diff --git a/lib/sharing/utils.js b/lib/sharing/utils.js index 61bc7772dc2..26eac0ac6fb 100644 --- a/lib/sharing/utils.js +++ b/lib/sharing/utils.js @@ -5,7 +5,7 @@ "use strict"; -const { join, dirname, readJson } = require("../util/fs"); +const { dirname, join, readJson } = require("../util/fs"); /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ /** @typedef {import("../util/fs").JsonObject} JsonObject */ @@ -292,34 +292,6 @@ function getGitUrlVersion(gitUrl) { return getVersionFromHash(gitUrl); } -/** - * @param {string} str maybe required version - * @returns {boolean} true, if it looks like a version - */ -function isRequiredVersion(str) { - return VERSION_PATTERN_REGEXP.test(str); -} - -module.exports.isRequiredVersion = isRequiredVersion; - -/** - * @see https://docs.npmjs.com/cli/v7/configuring-npm/package-json#urls-as-dependencies - * @param {string} versionDesc version to be normalized - * @returns {string} normalized version - */ -function normalizeVersion(versionDesc) { - versionDesc = (versionDesc && versionDesc.trim()) || ""; - - if (isRequiredVersion(versionDesc)) { - return versionDesc; - } - - // add handle for URL Dependencies - return getGitUrlVersion(versionDesc.toLowerCase()); -} - -module.exports.normalizeVersion = normalizeVersion; - /** @typedef {{ data: JsonObject, path: string }} DescriptionFile */ /** @@ -349,11 +321,9 @@ const getDescriptionFile = ( if (i >= descriptionFiles.length) { const parentDirectory = dirname(fs, directory); if (!parentDirectory || parentDirectory === directory) { - return callback( - null, - undefined, - Array.from(satisfiesDescriptionFileDataInternal.checkedFilePaths) - ); + return callback(null, undefined, [ + ...satisfiesDescriptionFileDataInternal.checkedFilePaths + ]); } return getDescriptionFile( fs, @@ -425,3 +395,31 @@ const getRequiredVersionFromDescriptionFile = (data, packageName) => { module.exports.getRequiredVersionFromDescriptionFile = getRequiredVersionFromDescriptionFile; + +/** + * @param {string} str maybe required version + * @returns {boolean} true, if it looks like a version + */ +function isRequiredVersion(str) { + return VERSION_PATTERN_REGEXP.test(str); +} + +module.exports.isRequiredVersion = isRequiredVersion; + +/** + * @see https://docs.npmjs.com/cli/v7/configuring-npm/package-json#urls-as-dependencies + * @param {string} versionDesc version to be normalized + * @returns {string} normalized version + */ +function normalizeVersion(versionDesc) { + versionDesc = (versionDesc && versionDesc.trim()) || ""; + + if (isRequiredVersion(versionDesc)) { + return versionDesc; + } + + // add handle for URL Dependencies + return getGitUrlVersion(versionDesc.toLowerCase()); +} + +module.exports.normalizeVersion = normalizeVersion; diff --git a/lib/stats/DefaultStatsFactoryPlugin.js b/lib/stats/DefaultStatsFactoryPlugin.js index a366564923f..e51a1248fa9 100644 --- a/lib/stats/DefaultStatsFactoryPlugin.js +++ b/lib/stats/DefaultStatsFactoryPlugin.js @@ -14,13 +14,13 @@ const AggressiveSplittingPlugin = require("../optimize/AggressiveSplittingPlugin const SizeLimitsPlugin = require("../performance/SizeLimitsPlugin"); const { countIterable } = require("../util/IterableHelpers"); const { - compareLocations, compareChunksById, - compareNumbers, compareIds, - concatComparators, + compareLocations, + compareModulesByIdentifier, + compareNumbers, compareSelect, - compareModulesByIdentifier + concatComparators } = require("../util/comparators"); const { makePathsRelative, parseResource } = require("../util/identifier"); @@ -358,7 +358,7 @@ const uniqueArray = (items, selector) => { set.add(i); } } - return Array.from(set); + return [...set]; }; /** @@ -823,15 +823,11 @@ const SIMPLE_EXTRACTORS = { } } - const groupedAssets = factory.create( - `${type}.assets`, - Array.from(assets), - { - ...context, - compilationFileToChunks, - compilationAuxiliaryFileToChunks - } - ); + const groupedAssets = factory.create(`${type}.assets`, [...assets], { + ...context, + compilationFileToChunks, + compilationAuxiliaryFileToChunks + }); const limited = spaceLimited( groupedAssets, /** @type {number} */ (options.assetsSpace) @@ -843,13 +839,13 @@ const SIMPLE_EXTRACTORS = { const { type } = context; object.chunks = factory.create( `${type}.chunks`, - Array.from(compilation.chunks), + [...compilation.chunks], context ); }, modules: (object, compilation, context, options, factory) => { const { type } = context; - const array = Array.from(compilation.modules); + const array = [...compilation.modules]; const groupedModules = factory.create(`${type}.modules`, array, context); const limited = spaceLimited(groupedModules, options.modulesSpace); object.modules = limited.children; @@ -1053,7 +1049,7 @@ const SIMPLE_EXTRACTORS = { ); object.chunkIdHints = uniqueOrderedArray( chunks, - c => Array.from(c.idNameHints), + c => [...c.idNameHints], compareIds ); object.auxiliaryChunkNames = uniqueOrderedArray( @@ -1063,7 +1059,7 @@ const SIMPLE_EXTRACTORS = { ); object.auxiliaryChunkIdHints = uniqueOrderedArray( auxiliaryChunks, - c => Array.from(c.idNameHints), + c => [...c.idNameHints], compareIds ); object.filteredRelated = asset.related ? asset.related.length : undefined; @@ -1203,7 +1199,7 @@ const SIMPLE_EXTRACTORS = { } } } - return Array.from(set); + return [...set]; }) : undefined }; @@ -1333,7 +1329,7 @@ const SIMPLE_EXTRACTORS = { } = context; const groupsReasons = factory.create( `${type.slice(0, -8)}.reasons`, - Array.from(moduleGraph.getIncomingConnections(module)), + [...moduleGraph.getIncomingConnections(module)], context ); const limited = spaceLimited( @@ -1355,7 +1351,7 @@ const SIMPLE_EXTRACTORS = { } else if (typeof usedExports === "boolean") { object.usedExports = usedExports; } else { - object.usedExports = Array.from(usedExports); + object.usedExports = [...usedExports]; } }, providedExports: (object, module, { compilation: { moduleGraph } }) => { @@ -1509,15 +1505,15 @@ const SIMPLE_EXTRACTORS = { size: chunkGraph.getChunkModulesSize(chunk), sizes: chunkGraph.getChunkModulesSizes(chunk), names: chunk.name ? [chunk.name] : [], - idHints: Array.from(chunk.idNameHints), + idHints: [...chunk.idNameHints], runtime: chunk.runtime === undefined ? undefined : typeof chunk.runtime === "string" ? [makePathsRelative(chunk.runtime)] : Array.from(chunk.runtime.sort(), makePathsRelative), - files: Array.from(chunk.files), - auxiliaryFiles: Array.from(chunk.auxiliaryFiles).sort(compareIds), + files: [...chunk.files], + auxiliaryFiles: [...chunk.auxiliaryFiles].sort(compareIds), hash: /** @type {string} */ (chunk.renderedHash), childrenByOrder: childIdByOrder }; @@ -1551,9 +1547,9 @@ const SIMPLE_EXTRACTORS = { } } } - object.siblings = Array.from(siblings).sort(compareIds); - object.parents = Array.from(parents).sort(compareIds); - object.children = Array.from(children).sort(compareIds); + object.siblings = [...siblings].sort(compareIds); + object.parents = [...parents].sort(compareIds); + object.children = [...children].sort(compareIds); }, chunkModules: (object, chunk, context, options, factory) => { const { @@ -1628,15 +1624,13 @@ const SIMPLE_EXTRACTORS = { object.originName = origin.readableIdentifier(requestShortener); object.moduleIdentifier = module.identifier(); object.moduleName = module.readableIdentifier(requestShortener); - const dependencies = Array.from( - moduleGraph.getIncomingConnections(module) - ) + const dependencies = [...moduleGraph.getIncomingConnections(module)] .filter(c => c.resolvedOriginModule === origin && c.dependency) .map(c => c.dependency); object.dependencies = factory.create( `${type}.dependencies`, /** @type {Dependency[]} */ - (Array.from(new Set(dependencies))), + ([...new Set(dependencies)]), context ); }, @@ -1872,7 +1866,7 @@ const spaceLimited = ( if (groupsSize + items.length <= max) { // The total size in the current state fits into the max // keep all - children = groups.length > 0 ? groups.concat(items) : items; + children = groups.length > 0 ? [...groups, ...items] : items; } else if (groups.length === 0) { // slice items to max // inner space marks that lines for filteredChildren already reserved @@ -1935,7 +1929,7 @@ const spaceLimited = ( } } } - children = groups.concat(items); + children = [...groups, ...items]; } else if (limit === max) { // If we have only enough space to show one line per group and one line for the filtered items // collapse all groups and items diff --git a/lib/stats/DefaultStatsPrinterPlugin.js b/lib/stats/DefaultStatsPrinterPlugin.js index 31949c08075..9ffbd6a1b20 100644 --- a/lib/stats/DefaultStatsPrinterPlugin.js +++ b/lib/stats/DefaultStatsPrinterPlugin.js @@ -1568,7 +1568,7 @@ const RESULT_MODIFIER = { * @returns {string[]} result */ const createOrder = (array, preferredOrder) => { - const originalArray = array.slice(); + const originalArray = [...array]; /** @type {Set} */ const set = new Set(array); /** @type {Set} */ diff --git a/lib/stats/StatsFactory.js b/lib/stats/StatsFactory.js index 4c8214190f0..83164ad410f 100644 --- a/lib/stats/StatsFactory.js +++ b/lib/stats/StatsFactory.js @@ -205,7 +205,7 @@ class StatsFactory { */ _forEachLevelFilter(hookMap, cache, type, items, fn, forceClone) { const hooks = this._getAllLevelHooks(hookMap, cache, type); - if (hooks.length === 0) return forceClone ? items.slice() : items; + if (hooks.length === 0) return forceClone ? [...items] : items; let i = 0; return items.filter((item, idx) => { for (const hook of hooks) { diff --git a/lib/stats/StatsPrinter.js b/lib/stats/StatsPrinter.js index 34bd4ac3f98..ac7e02fb991 100644 --- a/lib/stats/StatsPrinter.js +++ b/lib/stats/StatsPrinter.js @@ -5,7 +5,7 @@ "use strict"; -const { HookMap, SyncWaterfallHook, SyncBailHook } = require("tapable"); +const { HookMap, SyncBailHook, SyncWaterfallHook } = require("tapable"); /** @typedef {import("./DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */ /** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */ @@ -217,7 +217,7 @@ class StatsPrinter { ); if (printResult === undefined) { if (Array.isArray(object)) { - const sortedItems = object.slice(); + const sortedItems = [...object]; this._forEachLevel(this.hooks.sortItems, type, h => h.call( sortedItems, diff --git a/lib/util/ArrayQueue.js b/lib/util/ArrayQueue.js index 522abf93de2..f877ca1fee9 100644 --- a/lib/util/ArrayQueue.js +++ b/lib/util/ArrayQueue.js @@ -17,7 +17,7 @@ class ArrayQueue { * @private * @type {T[]} */ - this._list = items ? Array.from(items) : []; + this._list = items ? [...items] : []; /** * @private * @type {T[]} diff --git a/lib/util/AsyncQueue.js b/lib/util/AsyncQueue.js index 5fa5b669039..2ae918b74fb 100644 --- a/lib/util/AsyncQueue.js +++ b/lib/util/AsyncQueue.js @@ -5,7 +5,7 @@ "use strict"; -const { SyncHook, AsyncSeriesHook } = require("tapable"); +const { AsyncSeriesHook, SyncHook } = require("tapable"); const { makeWebpackError } = require("../HookWebpackError"); const WebpackError = require("../WebpackError"); const ArrayQueue = require("./ArrayQueue"); diff --git a/lib/util/IterableHelpers.js b/lib/util/IterableHelpers.js index b981eca88ff..c90f64e21d0 100644 --- a/lib/util/IterableHelpers.js +++ b/lib/util/IterableHelpers.js @@ -40,6 +40,6 @@ const countIterable = iterable => { return i; }; +module.exports.countIterable = countIterable; module.exports.last = last; module.exports.someInIterable = someInIterable; -module.exports.countIterable = countIterable; diff --git a/lib/util/ParallelismFactorCalculator.js b/lib/util/ParallelismFactorCalculator.js index bfb9688f163..4651a53886b 100644 --- a/lib/util/ParallelismFactorCalculator.js +++ b/lib/util/ParallelismFactorCalculator.js @@ -31,7 +31,7 @@ class ParallelismFactorCalculator { } calculate() { - const segments = Array.from(new Set(this._rangePoints)).sort((a, b) => + const segments = [...new Set(this._rangePoints)].sort((a, b) => a < b ? -1 : 1 ); const parallelism = segments.map(() => 0); diff --git a/lib/util/SetHelpers.js b/lib/util/SetHelpers.js index 5876f1cb709..aa5753c25a4 100644 --- a/lib/util/SetHelpers.js +++ b/lib/util/SetHelpers.js @@ -87,8 +87,8 @@ const combine = (a, b) => { return set; }; -module.exports.intersect = intersect; -module.exports.isSubset = isSubset; +module.exports.combine = combine; module.exports.find = find; module.exports.first = first; -module.exports.combine = combine; +module.exports.intersect = intersect; +module.exports.isSubset = isSubset; diff --git a/lib/util/SortableSet.js b/lib/util/SortableSet.js index a8a5a0b6aae..18ad2ca7d1d 100644 --- a/lib/util/SortableSet.js +++ b/lib/util/SortableSet.js @@ -88,7 +88,7 @@ class SortableSet extends Set { return; } - const sortedArray = Array.from(this).sort(sortFn); + const sortedArray = [...this].sort(sortFn); super.clear(); for (let i = 0; i < sortedArray.length; i += 1) { super.add(sortedArray[i]); @@ -168,7 +168,7 @@ class SortableSet extends Set { * @returns {T[]} the raw array */ toJSON() { - return Array.from(this); + return [...this]; } } diff --git a/lib/util/StackedMap.js b/lib/util/StackedMap.js index 0f4011d0ce7..9797713b4da 100644 --- a/lib/util/StackedMap.js +++ b/lib/util/StackedMap.js @@ -45,7 +45,7 @@ class StackedMap { /** @type {Map>} */ this.map = new Map(); /** @type {Map>[]} */ - this.stack = parentStack === undefined ? [] : parentStack.slice(); + this.stack = parentStack === undefined ? [] : [...parentStack]; this.stack.push(this.map); } @@ -134,7 +134,7 @@ class StackedMap { asArray() { this._compress(); - return Array.from(this.map.keys()); + return [...this.map.keys()]; } asSet() { diff --git a/lib/util/TupleSet.js b/lib/util/TupleSet.js index c5e12868ff4..3fba7f7a41c 100644 --- a/lib/util/TupleSet.js +++ b/lib/util/TupleSet.js @@ -165,6 +165,7 @@ class TupleSet { return { done: false, value: + /* eslint-disable unicorn/prefer-spread */ /** @type {[T, V, ...EXPECTED_ANY]} */ (tuple.concat(result.value)) }; diff --git a/lib/util/URLAbsoluteSpecifier.js b/lib/util/URLAbsoluteSpecifier.js index f5cec7e4be0..15382493348 100644 --- a/lib/util/URLAbsoluteSpecifier.js +++ b/lib/util/URLAbsoluteSpecifier.js @@ -83,5 +83,5 @@ function getProtocol(specifier) { return scheme === undefined ? undefined : `${scheme}:`; } -module.exports.getScheme = getScheme; module.exports.getProtocol = getProtocol; +module.exports.getScheme = getScheme; diff --git a/lib/util/cleverMerge.js b/lib/util/cleverMerge.js index 43984725ae4..03d8644d950 100644 --- a/lib/util/cleverMerge.js +++ b/lib/util/cleverMerge.js @@ -427,7 +427,7 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => { ); } if ( - Array.from(firstEntry.byValues.values()).every(value => { + [...firstEntry.byValues.values()].every(value => { const type = getValueType(value); return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE; }) @@ -633,9 +633,9 @@ const resolveByProperty = (obj, byProperty, ...values) => { return obj; }; -module.exports.cachedSetProperty = cachedSetProperty; +module.exports.DELETE = DELETE; module.exports.cachedCleverMerge = cachedCleverMerge; +module.exports.cachedSetProperty = cachedSetProperty; module.exports.cleverMerge = cleverMerge; -module.exports.resolveByProperty = resolveByProperty; module.exports.removeOperations = removeOperations; -module.exports.DELETE = DELETE; +module.exports.resolveByProperty = resolveByProperty; diff --git a/lib/util/comparators.js b/lib/util/comparators.js index 4b6d2e49130..ed01f939cc5 100644 --- a/lib/util/comparators.js +++ b/lib/util/comparators.js @@ -55,20 +55,113 @@ const createCachedParameterizedComparator = fn => { }; /** - * @param {Chunk} a chunk - * @param {Chunk} b chunk - * @returns {-1|0|1} compare result + * @param {string | number} a first id + * @param {string | number} b second id + * @returns {-1 | 0 | 1} compare result */ -module.exports.compareChunksById = (a, b) => - compareIds(/** @type {ChunkId} */ (a.id), /** @type {ChunkId} */ (b.id)); +const compareIds = (a, b) => { + if (typeof a !== typeof b) { + return typeof a < typeof b ? -1 : 1; + } + if (a < b) return -1; + if (a > b) return 1; + return 0; +}; /** - * @param {Module} a module - * @param {Module} b module - * @returns {-1|0|1} compare result + * @template T + * @param {Comparator} elementComparator comparator for elements + * @returns {Comparator>} comparator for iterables of elements */ -module.exports.compareModulesByIdentifier = (a, b) => - compareIds(a.identifier(), b.identifier()); +const compareIterables = elementComparator => { + const cacheEntry = compareIteratorsCache.get(elementComparator); + if (cacheEntry !== undefined) return cacheEntry; + /** + * @param {Iterable} a first value + * @param {Iterable} b second value + * @returns {-1|0|1} compare result + */ + const result = (a, b) => { + const aI = a[Symbol.iterator](); + const bI = b[Symbol.iterator](); + while (true) { + const aItem = aI.next(); + const bItem = bI.next(); + if (aItem.done) { + return bItem.done ? 0 : -1; + } else if (bItem.done) { + return 1; + } + const res = elementComparator(aItem.value, bItem.value); + if (res !== 0) return res; + } + }; + compareIteratorsCache.set(elementComparator, result); + return result; +}; + +/** + * Compare two locations + * @param {DependencyLocation} a A location node + * @param {DependencyLocation} b A location node + * @returns {-1|0|1} sorting comparator value + */ +const compareLocations = (a, b) => { + const isObjectA = typeof a === "object" && a !== null; + const isObjectB = typeof b === "object" && b !== null; + if (!isObjectA || !isObjectB) { + if (isObjectA) return 1; + if (isObjectB) return -1; + return 0; + } + if ("start" in a) { + if ("start" in b) { + const ap = a.start; + const bp = b.start; + if (ap.line < bp.line) return -1; + if (ap.line > bp.line) return 1; + if ( + /** @type {number} */ (ap.column) < /** @type {number} */ (bp.column) + ) { + return -1; + } + if ( + /** @type {number} */ (ap.column) > /** @type {number} */ (bp.column) + ) { + return 1; + } + } else { + return -1; + } + } else if ("start" in b) { + return 1; + } + if ("name" in a) { + if ("name" in b) { + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + } else { + return -1; + } + } else if ("name" in b) { + return 1; + } + if ("index" in a) { + if ("index" in b) { + if (/** @type {number} */ (a.index) < /** @type {number} */ (b.index)) { + return -1; + } + if (/** @type {number} */ (a.index) > /** @type {number} */ (b.index)) { + return 1; + } + } else { + return -1; + } + } else if ("index" in b) { + return 1; + } + return 0; +}; /** * @param {ChunkGraph} chunkGraph the chunk graph @@ -82,10 +175,6 @@ const compareModulesById = (chunkGraph, a, b) => /** @type {ModuleId} */ (chunkGraph.getModuleId(b)) ); -/** @type {ParameterizedComparator} */ -module.exports.compareModulesById = - createCachedParameterizedComparator(compareModulesById); - /** * @param {number} a number * @param {number} b number @@ -100,8 +189,6 @@ const compareNumbers = (a, b) => { return 0; }; -module.exports.compareNumbers = compareNumbers; - /** * @param {string} a string * @param {string} b string @@ -173,8 +260,6 @@ const compareStringsNumeric = (a, b) => { return 0; }; -module.exports.compareStringsNumeric = compareStringsNumeric; - /** * @param {ModuleGraph} moduleGraph the module graph * @param {Module} a module @@ -190,12 +275,6 @@ const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => { return compareIds(a.identifier(), b.identifier()); }; -/** @type {ParameterizedComparator} */ -module.exports.compareModulesByPostOrderIndexOrIdentifier = - createCachedParameterizedComparator( - compareModulesByPostOrderIndexOrIdentifier - ); - /** * @param {ModuleGraph} moduleGraph the module graph * @param {Module} a module @@ -211,12 +290,6 @@ const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => { return compareIds(a.identifier(), b.identifier()); }; -/** @type {ParameterizedComparator} */ -module.exports.compareModulesByPreOrderIndexOrIdentifier = - createCachedParameterizedComparator( - compareModulesByPreOrderIndexOrIdentifier - ); - /** * @param {ChunkGraph} chunkGraph the chunk graph * @param {Module} a module @@ -232,10 +305,6 @@ const compareModulesByIdOrIdentifier = (chunkGraph, a, b) => { return compareIds(a.identifier(), b.identifier()); }; -/** @type {ParameterizedComparator} */ -module.exports.compareModulesByIdOrIdentifier = - createCachedParameterizedComparator(compareModulesByIdOrIdentifier); - /** * @param {ChunkGraph} chunkGraph the chunk graph * @param {Chunk} a chunk @@ -244,26 +313,6 @@ module.exports.compareModulesByIdOrIdentifier = */ const compareChunks = (chunkGraph, a, b) => chunkGraph.compareChunks(a, b); -/** @type {ParameterizedComparator} */ -module.exports.compareChunks = - createCachedParameterizedComparator(compareChunks); - -/** - * @param {string | number} a first id - * @param {string | number} b second id - * @returns {-1 | 0 | 1} compare result - */ -const compareIds = (a, b) => { - if (typeof a !== typeof b) { - return typeof a < typeof b ? -1 : 1; - } - if (a < b) return -1; - if (a > b) return 1; - return 0; -}; - -module.exports.compareIds = compareIds; - /** * @param {string} a first string * @param {string} b second string @@ -275,8 +324,6 @@ const compareStrings = (a, b) => { return 0; }; -module.exports.compareStrings = compareStrings; - /** * @param {ChunkGroup} a first chunk group * @param {ChunkGroup} b second chunk group @@ -285,8 +332,6 @@ module.exports.compareStrings = compareStrings; const compareChunkGroupsByIndex = (a, b) => /** @type {number} */ (a.index) < /** @type {number} */ (b.index) ? -1 : 1; -module.exports.compareChunkGroupsByIndex = compareChunkGroupsByIndex; - /** * @template {EXPECTED_OBJECT} K1 * @template {EXPECTED_OBJECT} K2 @@ -363,8 +408,6 @@ const concatComparators = (c1, c2, ...cRest) => { return result; }; -module.exports.concatComparators = concatComparators; - /** * @template A, B * @typedef {(input: A) => B | undefined | null} Selector @@ -406,45 +449,9 @@ const compareSelect = (getter, comparator) => { return result; }; -module.exports.compareSelect = compareSelect; - /** @type {WeakMap, Comparator>>} */ const compareIteratorsCache = new WeakMap(); -/** - * @template T - * @param {Comparator} elementComparator comparator for elements - * @returns {Comparator>} comparator for iterables of elements - */ -const compareIterables = elementComparator => { - const cacheEntry = compareIteratorsCache.get(elementComparator); - if (cacheEntry !== undefined) return cacheEntry; - /** - * @param {Iterable} a first value - * @param {Iterable} b second value - * @returns {-1|0|1} compare result - */ - const result = (a, b) => { - const aI = a[Symbol.iterator](); - const bI = b[Symbol.iterator](); - while (true) { - const aItem = aI.next(); - const bItem = bI.next(); - if (aItem.done) { - return bItem.done ? 0 : -1; - } else if (bItem.done) { - return 1; - } - const res = elementComparator(aItem.value, bItem.value); - if (res !== 0) return res; - } - }; - compareIteratorsCache.set(elementComparator, result); - return result; -}; - -module.exports.compareIterables = compareIterables; - // TODO this is no longer needed when minimum node.js version is >= 12 // since these versions ship with a stable sort function /** @@ -452,7 +459,7 @@ module.exports.compareIterables = compareIterables; * @param {Iterable} iterable original ordered list * @returns {Comparator} comparator */ -module.exports.keepOriginalOrder = iterable => { +const keepOriginalOrder = iterable => { /** @type {Map} */ const map = new Map(); let i = 0; @@ -470,7 +477,7 @@ module.exports.keepOriginalOrder = iterable => { * @param {ChunkGraph} chunkGraph the chunk graph * @returns {Comparator} comparator */ -module.exports.compareChunksNatural = chunkGraph => { +const compareChunksNatural = chunkGraph => { const cmpFn = module.exports.compareModulesById(chunkGraph); const cmpIterableFn = compareIterables(cmpFn); return concatComparators( @@ -490,65 +497,54 @@ module.exports.compareChunksNatural = chunkGraph => { ); }; +module.exports.compareChunkGroupsByIndex = compareChunkGroupsByIndex; +/** @type {ParameterizedComparator} */ +module.exports.compareChunks = + createCachedParameterizedComparator(compareChunks); /** - * Compare two locations - * @param {DependencyLocation} a A location node - * @param {DependencyLocation} b A location node - * @returns {-1|0|1} sorting comparator value + * @param {Chunk} a chunk + * @param {Chunk} b chunk + * @returns {-1|0|1} compare result */ -module.exports.compareLocations = (a, b) => { - const isObjectA = typeof a === "object" && a !== null; - const isObjectB = typeof b === "object" && b !== null; - if (!isObjectA || !isObjectB) { - if (isObjectA) return 1; - if (isObjectB) return -1; - return 0; - } - if ("start" in a) { - if ("start" in b) { - const ap = a.start; - const bp = b.start; - if (ap.line < bp.line) return -1; - if (ap.line > bp.line) return 1; - if ( - /** @type {number} */ (ap.column) < /** @type {number} */ (bp.column) - ) { - return -1; - } - if ( - /** @type {number} */ (ap.column) > /** @type {number} */ (bp.column) - ) { - return 1; - } - } else { - return -1; - } - } else if ("start" in b) { - return 1; - } - if ("name" in a) { - if ("name" in b) { - if (a.name < b.name) return -1; - if (a.name > b.name) return 1; - } else { - return -1; - } - } else if ("name" in b) { - return 1; - } - if ("index" in a) { - if ("index" in b) { - if (/** @type {number} */ (a.index) < /** @type {number} */ (b.index)) { - return -1; - } - if (/** @type {number} */ (a.index) > /** @type {number} */ (b.index)) { - return 1; - } - } else { - return -1; - } - } else if ("index" in b) { - return 1; - } - return 0; -}; +module.exports.compareChunksById = (a, b) => + compareIds(/** @type {ChunkId} */ (a.id), /** @type {ChunkId} */ (b.id)); +module.exports.compareChunksNatural = compareChunksNatural; + +module.exports.compareIds = compareIds; + +module.exports.compareIterables = compareIterables; + +module.exports.compareLocations = compareLocations; + +/** @type {ParameterizedComparator} */ +module.exports.compareModulesById = + createCachedParameterizedComparator(compareModulesById); +/** @type {ParameterizedComparator} */ +module.exports.compareModulesByIdOrIdentifier = + createCachedParameterizedComparator(compareModulesByIdOrIdentifier); +/** + * @param {Module} a module + * @param {Module} b module + * @returns {-1|0|1} compare result + */ +module.exports.compareModulesByIdentifier = (a, b) => + compareIds(a.identifier(), b.identifier()); +/** @type {ParameterizedComparator} */ +module.exports.compareModulesByPostOrderIndexOrIdentifier = + createCachedParameterizedComparator( + compareModulesByPostOrderIndexOrIdentifier + ); +/** @type {ParameterizedComparator} */ +module.exports.compareModulesByPreOrderIndexOrIdentifier = + createCachedParameterizedComparator( + compareModulesByPreOrderIndexOrIdentifier + ); + +module.exports.compareNumbers = compareNumbers; +module.exports.compareSelect = compareSelect; +module.exports.compareStrings = compareStrings; +module.exports.compareStringsNumeric = compareStringsNumeric; + +module.exports.concatComparators = concatComparators; + +module.exports.keepOriginalOrder = keepOriginalOrder; diff --git a/lib/util/compileBooleanMatcher.js b/lib/util/compileBooleanMatcher.js index 1c17daf21ec..ca17d55b2a7 100644 --- a/lib/util/compileBooleanMatcher.js +++ b/lib/util/compileBooleanMatcher.js @@ -148,6 +148,7 @@ const itemsToRegexp = itemsArr => { if (countOfSingleCharItems === itemsArr.length) { return `[${quoteMeta(itemsArr.sort().join(""))}]`; } + /** @type {Set} */ const items = new Set(itemsArr.sort()); if (countOfSingleCharItems > 2) { let singleCharItems = ""; @@ -226,7 +227,8 @@ const itemsToRegexp = itemsArr => { // TODO further optimize regexp, i. e. // use ranges: (1|2|3|4|a) => [1-4a] - const conditional = finishedItems.concat(Array.from(items, quoteMeta)); + /** @type {string[]} */ + const conditional = [...finishedItems, ...Array.from(items, quoteMeta)]; if (conditional.length === 1) return conditional[0]; return `(${conditional.join("|")})`; }; diff --git a/lib/util/concatenate.js b/lib/util/concatenate.js index e7a727702cc..db799b8891d 100644 --- a/lib/util/concatenate.js +++ b/lib/util/concatenate.js @@ -29,7 +29,7 @@ const getAllReferences = variable => { for (const scope of variable.scope.childScopes) { for (const innerVar of scope.variables) { if (innerVar.identifiers.some(id => identifiers.has(id))) { - set = set.concat(innerVar.references); + set = [...set, ...innerVar.references]; break; } } @@ -221,12 +221,12 @@ const getUsedNamesInScopeInfo = (usedNamesInScopeInfo, module, id) => { }; module.exports = { - getUsedNamesInScopeInfo, + DEFAULT_EXPORT, + NAMESPACE_OBJECT_EXPORT, + RESERVED_NAMES, + addScopeSymbols, findNewName, getAllReferences, getPathInAst, - NAMESPACE_OBJECT_EXPORT, - DEFAULT_EXPORT, - RESERVED_NAMES, - addScopeSymbols + getUsedNamesInScopeInfo }; diff --git a/lib/util/conventions.js b/lib/util/conventions.js index 4f78df1c095..b1ad4ea9e95 100644 --- a/lib/util/conventions.js +++ b/lib/util/conventions.js @@ -6,6 +6,77 @@ "use strict"; /** @typedef {import("../../declarations/WebpackOptions").CssGeneratorExportsConvention} CssGeneratorExportsConvention */ +// Copy from css-loader +/** + * @param {string} string string + * @returns {string} result + */ +const preserveCamelCase = string => { + let result = string; + let isLastCharLower = false; + let isLastCharUpper = false; + let isLastLastCharUpper = false; + + for (let i = 0; i < result.length; i++) { + const character = result[i]; + + if (isLastCharLower && /[\p{Lu}]/u.test(character)) { + result = `${result.slice(0, i)}-${result.slice(i)}`; + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + i += 1; + } else if ( + isLastCharUpper && + isLastLastCharUpper && + /[\p{Ll}]/u.test(character) + ) { + result = `${result.slice(0, i - 1)}-${result.slice(i - 1)}`; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = + character.toLowerCase() === character && + character.toUpperCase() !== character; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = + character.toUpperCase() === character && + character.toLowerCase() !== character; + } + } + + return result; +}; + +// Copy from css-loader +/** + * @param {string} input input + * @returns {string} result + */ +module.exports.camelCase = input => { + let result = input.trim(); + + if (result.length === 0) { + return ""; + } + + if (result.length === 1) { + return result.toLowerCase(); + } + + const hasUpperCase = result !== result.toLowerCase(); + + if (hasUpperCase) { + result = preserveCamelCase(result); + } + + return result + .replace(/^[_.\- ]+/, "") + .toLowerCase() + .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toUpperCase()) + .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toUpperCase()); +}; /** * @param {string} input input @@ -42,7 +113,7 @@ module.exports.cssExportConvention = (input, convention) => { } } } - return Array.from(set); + return [...set]; }; // Copy from css-loader @@ -52,75 +123,3 @@ module.exports.cssExportConvention = (input, convention) => { */ module.exports.dashesCamelCase = input => input.replace(/-+(\w)/g, (match, firstLetter) => firstLetter.toUpperCase()); - -// Copy from css-loader -/** - * @param {string} input input - * @returns {string} result - */ -module.exports.camelCase = input => { - let result = input.trim(); - - if (result.length === 0) { - return ""; - } - - if (result.length === 1) { - return result.toLowerCase(); - } - - const hasUpperCase = result !== result.toLowerCase(); - - if (hasUpperCase) { - result = preserveCamelCase(result); - } - - return result - .replace(/^[_.\- ]+/, "") - .toLowerCase() - .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toUpperCase()) - .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toUpperCase()); -}; - -// Copy from css-loader -/** - * @param {string} string string - * @returns {string} result - */ -const preserveCamelCase = string => { - let result = string; - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - - for (let i = 0; i < result.length; i++) { - const character = result[i]; - - if (isLastCharLower && /[\p{Lu}]/u.test(character)) { - result = `${result.slice(0, i)}-${result.slice(i)}`; - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - i += 1; - } else if ( - isLastCharUpper && - isLastLastCharUpper && - /[\p{Ll}]/u.test(character) - ) { - result = `${result.slice(0, i - 1)}-${result.slice(i - 1)}`; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = - character.toLowerCase() === character && - character.toUpperCase() !== character; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = - character.toUpperCase() === character && - character.toLowerCase() !== character; - } - } - - return result; -}; diff --git a/lib/util/deprecation.js b/lib/util/deprecation.js index 6127380599e..68537a721b1 100644 --- a/lib/util/deprecation.js +++ b/lib/util/deprecation.js @@ -96,8 +96,10 @@ module.exports.arrayToSetDeprecation = (set, name) => { * @this {Set} * @returns {number} count */ + // eslint-disable-next-line func-names set[method] = function () { d(); + // eslint-disable-next-line unicorn/prefer-spread const array = Array.from(this); return Array.prototype[/** @type {keyof COPY_METHODS} */ (method)].apply( array, @@ -123,9 +125,9 @@ module.exports.arrayToSetDeprecation = (set, name) => { * @this {Set} * @returns {number} count */ - set.push = function () { + set.push = function push() { dPush(); - // eslint-disable-next-line prefer-rest-params + // eslint-disable-next-line prefer-rest-params, unicorn/prefer-spread for (const item of Array.from(arguments)) { this.add(item); } @@ -221,6 +223,71 @@ module.exports.createArrayToSetDeprecationSet = name => { return SetDeprecatedArray; }; +/** + * @template {object} T + * @param {T} fakeHook fake hook implementation + * @param {string=} message deprecation message (not deprecated when unset) + * @param {string=} code deprecation code (not deprecated when unset) + * @returns {FakeHook} fake hook which redirects + */ +module.exports.createFakeHook = (fakeHook, message, code) => { + if (message && code) { + fakeHook = deprecateAllProperties(fakeHook, message, code); + } + return Object.freeze( + Object.assign(fakeHook, { _fakeHook: /** @type {true} */ (true) }) + ); +}; + +/** + * @template T + * @param {T} obj object + * @param {string} message deprecation message + * @param {string} code deprecation code + * @returns {T} object with property access deprecated + */ +const deprecateAllProperties = (obj, message, code) => { + const newObj = {}; + const descriptors = Object.getOwnPropertyDescriptors(obj); + for (const name of Object.keys(descriptors)) { + const descriptor = descriptors[name]; + if (typeof descriptor.value === "function") { + Object.defineProperty(newObj, name, { + ...descriptor, + value: util.deprecate(descriptor.value, message, code) + }); + } else if (descriptor.get || descriptor.set) { + Object.defineProperty(newObj, name, { + ...descriptor, + get: descriptor.get && util.deprecate(descriptor.get, message, code), + set: descriptor.set && util.deprecate(descriptor.set, message, code) + }); + } else { + let value = descriptor.value; + Object.defineProperty(newObj, name, { + configurable: descriptor.configurable, + enumerable: descriptor.enumerable, + get: util.deprecate(() => value, message, code), + set: descriptor.writable + ? util.deprecate( + /** + * @template T + * @param {T} v value + * @returns {T} result + */ + v => (value = v), + message, + code + ) + : undefined + }); + } + } + return /** @type {T} */ (newObj); +}; + +module.exports.deprecateAllProperties = deprecateAllProperties; + /** * @template {object} T * @param {T} obj object @@ -283,68 +350,3 @@ module.exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => { }) ); }; - -/** - * @template T - * @param {T} obj object - * @param {string} message deprecation message - * @param {string} code deprecation code - * @returns {T} object with property access deprecated - */ -const deprecateAllProperties = (obj, message, code) => { - const newObj = {}; - const descriptors = Object.getOwnPropertyDescriptors(obj); - for (const name of Object.keys(descriptors)) { - const descriptor = descriptors[name]; - if (typeof descriptor.value === "function") { - Object.defineProperty(newObj, name, { - ...descriptor, - value: util.deprecate(descriptor.value, message, code) - }); - } else if (descriptor.get || descriptor.set) { - Object.defineProperty(newObj, name, { - ...descriptor, - get: descriptor.get && util.deprecate(descriptor.get, message, code), - set: descriptor.set && util.deprecate(descriptor.set, message, code) - }); - } else { - let value = descriptor.value; - Object.defineProperty(newObj, name, { - configurable: descriptor.configurable, - enumerable: descriptor.enumerable, - get: util.deprecate(() => value, message, code), - set: descriptor.writable - ? util.deprecate( - /** - * @template T - * @param {T} v value - * @returns {T} result - */ - v => (value = v), - message, - code - ) - : undefined - }); - } - } - return /** @type {T} */ (newObj); -}; - -module.exports.deprecateAllProperties = deprecateAllProperties; - -/** - * @template {object} T - * @param {T} fakeHook fake hook implementation - * @param {string=} message deprecation message (not deprecated when unset) - * @param {string=} code deprecation code (not deprecated when unset) - * @returns {FakeHook} fake hook which redirects - */ -module.exports.createFakeHook = (fakeHook, message, code) => { - if (message && code) { - fakeHook = deprecateAllProperties(fakeHook, message, code); - } - return Object.freeze( - Object.assign(fakeHook, { _fakeHook: /** @type {true} */ (true) }) - ); -}; diff --git a/lib/util/findGraphRoots.js b/lib/util/findGraphRoots.js index 3db4c146bb3..8b674a8c79d 100644 --- a/lib/util/findGraphRoots.js +++ b/lib/util/findGraphRoots.js @@ -98,7 +98,7 @@ module.exports = (items, getDependencies) => { const stack = [ { node: selectedNode, - openEdges: Array.from(selectedNode.dependencies) + openEdges: [...selectedNode.dependencies] } ]; @@ -118,7 +118,7 @@ module.exports = (items, getDependencies) => { // mark it as in-progress and recurse stack.push({ node: dependency, - openEdges: Array.from(dependency.dependencies) + openEdges: [...dependency.dependencies] }); dependency.marker = IN_PROGRESS_MARKER; break; diff --git a/lib/util/fs.js b/lib/util/fs.js index ae463572add..f6646ddb6be 100644 --- a/lib/util/fs.js +++ b/lib/util/fs.js @@ -479,8 +479,6 @@ const relative = (fs, rootPath, targetPath) => { ); }; -module.exports.relative = relative; - /** * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system * @param {string} rootPath a path @@ -500,8 +498,6 @@ const join = (fs, rootPath, filename) => { ); }; -module.exports.join = join; - /** * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system * @param {string} absPath an absolute path @@ -520,8 +516,6 @@ const dirname = (fs, absPath) => { ); }; -module.exports.dirname = dirname; - /** * @param {OutputFileSystem} fs a file system * @param {string} p an absolute path @@ -566,8 +560,6 @@ const mkdirp = (fs, p, callback) => { }); }; -module.exports.mkdirp = mkdirp; - /** * @param {IntermediateFileSystem} fs a file system * @param {string} p an absolute path @@ -594,8 +586,6 @@ const mkdirpSync = (fs, p) => { } }; -module.exports.mkdirpSync = mkdirpSync; - /** * @param {InputFileSystem} fs a file system * @param {string} p an absolute path @@ -620,8 +610,6 @@ const readJson = (fs, p, callback) => { }); }; -module.exports.readJson = readJson; - /** * @param {InputFileSystem} fs a file system * @param {string} p an absolute path @@ -661,4 +649,10 @@ const lstatReadlinkAbsolute = (fs, p, callback) => { doReadLink(); }; +module.exports.dirname = dirname; +module.exports.join = join; module.exports.lstatReadlinkAbsolute = lstatReadlinkAbsolute; +module.exports.mkdirp = mkdirp; +module.exports.mkdirpSync = mkdirpSync; +module.exports.readJson = readJson; +module.exports.relative = relative; diff --git a/lib/util/identifier.js b/lib/util/identifier.js index 551e519f0ed..b53efcd842a 100644 --- a/lib/util/identifier.js +++ b/lib/util/identifier.js @@ -281,8 +281,6 @@ const _makePathsRelative = (context, identifier) => .map(str => absoluteToRequest(context, str)) .join(""); -module.exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative); - /** * @param {string} context context for relative path * @param {string} identifier identifier for path @@ -294,8 +292,6 @@ const _makePathsAbsolute = (context, identifier) => .map(str => requestToAbsolute(context, str)) .join(""); -module.exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute); - /** * @param {string} context absolute context path * @param {string} request any request string may containing absolute paths, query string, etc. @@ -309,8 +305,6 @@ const _contextify = (context, request) => const contextify = makeCacheableWithContext(_contextify); -module.exports.contextify = contextify; - /** * @param {string} context absolute context path * @param {string} request any request string @@ -324,8 +318,6 @@ const _absolutify = (context, request) => const absolutify = makeCacheableWithContext(_absolutify); -module.exports.absolutify = absolutify; - const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/; @@ -349,8 +341,6 @@ const _parseResource = str => { }; }; -module.exports.parseResource = makeCacheable(_parseResource); - /** * Parse resource, skips fragment part * @param {string} str the path with query and fragment @@ -367,17 +357,13 @@ const _parseResourceWithoutFragment = str => { }; }; -module.exports.parseResourceWithoutFragment = makeCacheable( - _parseResourceWithoutFragment -); - /** * @param {string} filename the filename which should be undone * @param {string} outputPath the output path that is restored (only relevant when filename contains "..") * @param {boolean} enforceRelative true returns ./ for empty paths * @returns {string} repeated ../ to leave the directory of the provided filename to be back on output dir */ -module.exports.getUndoPath = (filename, outputPath, enforceRelative) => { +const getUndoPath = (filename, outputPath, enforceRelative) => { let depth = -1; let append = ""; outputPath = outputPath.replace(/[\\/]$/, ""); @@ -403,3 +389,13 @@ module.exports.getUndoPath = (filename, outputPath, enforceRelative) => { ? `./${append}` : append; }; + +module.exports.absolutify = absolutify; +module.exports.contextify = contextify; +module.exports.getUndoPath = getUndoPath; +module.exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute); +module.exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative); +module.exports.parseResource = makeCacheable(_parseResource); +module.exports.parseResourceWithoutFragment = makeCacheable( + _parseResourceWithoutFragment +); diff --git a/lib/util/magicComment.js b/lib/util/magicComment.js index c47cc5350f4..6abac1ed0b4 100644 --- a/lib/util/magicComment.js +++ b/lib/util/magicComment.js @@ -6,6 +6,11 @@ "use strict"; // regexp to match at least one "magic comment" +module.exports.createMagicCommentContext = () => + require("vm").createContext(undefined, { + name: "Webpack Magic Comment Parser", + codeGeneration: { strings: false, wasm: false } + }); module.exports.webpackCommentRegExp = new RegExp( /(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/ ); @@ -14,8 +19,3 @@ module.exports.webpackCommentRegExp = new RegExp( /** * @returns {import("vm").Context} magic comment context */ -module.exports.createMagicCommentContext = () => - require("vm").createContext(undefined, { - name: "Webpack Magic Comment Parser", - codeGeneration: { strings: false, wasm: false } - }); diff --git a/lib/util/processAsyncTree.js b/lib/util/processAsyncTree.js index 98ed0745e7d..41980c63a7a 100644 --- a/lib/util/processAsyncTree.js +++ b/lib/util/processAsyncTree.js @@ -15,7 +15,7 @@ * @returns {void} */ const processAsyncTree = (items, concurrency, processor, callback) => { - const queue = Array.from(items); + const queue = [...items]; if (queue.length === 0) return callback(); let processing = 0; let finished = false; diff --git a/lib/util/propertyAccess.js b/lib/util/propertyAccess.js index 0cf647bd9e0..10cdc5240ef 100644 --- a/lib/util/propertyAccess.js +++ b/lib/util/propertyAccess.js @@ -5,7 +5,7 @@ "use strict"; -const { SAFE_IDENTIFIER, RESERVED_IDENTIFIER } = require("./propertyName"); +const { RESERVED_IDENTIFIER, SAFE_IDENTIFIER } = require("./propertyName"); /** * @param {ArrayLike} properties properties diff --git a/lib/util/propertyName.js b/lib/util/propertyName.js index a8d58c7d265..a5dab15817b 100644 --- a/lib/util/propertyName.js +++ b/lib/util/propertyName.js @@ -73,4 +73,4 @@ const propertyName = prop => { return JSON.stringify(prop); }; -module.exports = { SAFE_IDENTIFIER, RESERVED_IDENTIFIER, propertyName }; +module.exports = { RESERVED_IDENTIFIER, SAFE_IDENTIFIER, propertyName }; diff --git a/lib/util/registerExternalSerializer.js b/lib/util/registerExternalSerializer.js index 5e20a432535..7b7d747bc0b 100644 --- a/lib/util/registerExternalSerializer.js +++ b/lib/util/registerExternalSerializer.js @@ -5,8 +5,6 @@ "use strict"; -const { register } = require("./serialization"); - const Position = require("acorn").Position; const SourceLocation = require("acorn").SourceLocation; const ValidationError = require("schema-utils").ValidationError; @@ -19,6 +17,7 @@ const { ReplaceSource, SourceMapSource } = require("webpack-sources"); +const { register } = require("./serialization"); /** @typedef {import("acorn").Position} Position */ /** @typedef {import("../Dependency").RealDependencyLocation} RealDependencyLocation */ diff --git a/lib/util/runtime.js b/lib/util/runtime.js index 38dc29a894f..d3c9ec2c48d 100644 --- a/lib/util/runtime.js +++ b/lib/util/runtime.js @@ -19,7 +19,7 @@ const SortableSet = require("./SortableSet"); * @param {EntryOptions=} options optionally already received entry options * @returns {RuntimeSpec} runtime */ -module.exports.getEntryRuntime = (compilation, name, options) => { +const getEntryRuntime = (compilation, name, options) => { let dependOn; let runtime; if (options) { @@ -69,8 +69,6 @@ const forEachRuntime = (runtime, fn, deterministicOrder = false) => { } }; -module.exports.forEachRuntime = forEachRuntime; - /** * @template T * @param {SortableSet} set set @@ -78,7 +76,7 @@ module.exports.forEachRuntime = forEachRuntime; */ const getRuntimesKey = set => { set.sort(); - return Array.from(set).join("\n"); + return [...set].join("\n"); }; /** @@ -91,8 +89,6 @@ const getRuntimeKey = runtime => { return runtime.getFromUnorderedCache(getRuntimesKey); }; -module.exports.getRuntimeKey = getRuntimeKey; - /** * @param {string} key key of runtimes * @returns {RuntimeSpec} runtime(s) @@ -104,8 +100,6 @@ const keyToRuntime = key => { return new SortableSet(items); }; -module.exports.keyToRuntime = keyToRuntime; - /** * @template T * @param {SortableSet} set set @@ -113,7 +107,7 @@ module.exports.keyToRuntime = keyToRuntime; */ const getRuntimesString = set => { set.sort(); - return Array.from(set).join("+"); + return [...set].join("+"); }; /** @@ -126,13 +120,11 @@ const runtimeToString = runtime => { return runtime.getFromUnorderedCache(getRuntimesString); }; -module.exports.runtimeToString = runtimeToString; - /** * @param {RuntimeCondition} runtimeCondition runtime condition * @returns {string} readable version */ -module.exports.runtimeConditionToString = runtimeCondition => { +const runtimeConditionToString = runtimeCondition => { if (runtimeCondition === true) return "true"; if (runtimeCondition === false) return "false"; return runtimeToString(runtimeCondition); @@ -168,14 +160,12 @@ const runtimeEqual = (a, b) => { } }; -module.exports.runtimeEqual = runtimeEqual; - /** * @param {RuntimeSpec} a first * @param {RuntimeSpec} b second * @returns {-1|0|1} compare */ -module.exports.compareRuntime = (a, b) => { +const compareRuntime = (a, b) => { if (a === b) { return 0; } else if (a === undefined) { @@ -227,15 +217,13 @@ const mergeRuntime = (a, b) => { return set; }; -module.exports.mergeRuntime = mergeRuntime; - /** * @param {RuntimeCondition} a first * @param {RuntimeCondition} b second * @param {RuntimeSpec} runtime full runtime * @returns {RuntimeCondition} result */ -module.exports.mergeRuntimeCondition = (a, b, runtime) => { +const mergeRuntimeCondition = (a, b, runtime) => { if (a === false) return b; if (b === false) return a; if (a === true || b === true) return true; @@ -256,7 +244,7 @@ module.exports.mergeRuntimeCondition = (a, b, runtime) => { * @param {RuntimeSpec} runtime full runtime * @returns {RuntimeSpec | true} result */ -module.exports.mergeRuntimeConditionNonFalse = (a, b, runtime) => { +const mergeRuntimeConditionNonFalse = (a, b, runtime) => { if (a === true || b === true) return true; const merged = mergeRuntime(a, b); if (merged === undefined) return; @@ -303,14 +291,12 @@ const mergeRuntimeOwned = (a, b) => { return a; }; -module.exports.mergeRuntimeOwned = mergeRuntimeOwned; - /** * @param {RuntimeSpec} a first * @param {RuntimeSpec} b second * @returns {RuntimeSpec} merged */ -module.exports.intersectRuntime = (a, b) => { +const intersectRuntime = (a, b) => { if (a === undefined) { return b; } else if (b === undefined) { @@ -384,15 +370,13 @@ const subtractRuntime = (a, b) => { return set; }; -module.exports.subtractRuntime = subtractRuntime; - /** * @param {RuntimeCondition} a first * @param {RuntimeCondition} b second * @param {RuntimeSpec} runtime runtime * @returns {RuntimeCondition} result */ -module.exports.subtractRuntimeCondition = (a, b, runtime) => { +const subtractRuntimeCondition = (a, b, runtime) => { if (b === true) return false; if (b === false) return a; if (a === false) return false; @@ -405,7 +389,7 @@ module.exports.subtractRuntimeCondition = (a, b, runtime) => { * @param {(runtime?: RuntimeSpec) => boolean} filter filter function * @returns {boolean | RuntimeSpec} true/false if filter is constant for all runtimes, otherwise runtimes that are active */ -module.exports.filterRuntime = (runtime, filter) => { +const filterRuntime = (runtime, filter) => { if (runtime === undefined) return filter(); if (typeof runtime === "string") return filter(runtime); let some = false; @@ -658,8 +642,6 @@ class RuntimeSpecMap { } } -module.exports.RuntimeSpecMap = RuntimeSpecMap; - class RuntimeSpecSet { /** * @param {Iterable=} iterable iterable @@ -701,4 +683,21 @@ class RuntimeSpecSet { } } +module.exports.RuntimeSpecMap = RuntimeSpecMap; module.exports.RuntimeSpecSet = RuntimeSpecSet; +module.exports.compareRuntime = compareRuntime; +module.exports.filterRuntime = filterRuntime; +module.exports.forEachRuntime = forEachRuntime; +module.exports.getEntryRuntime = getEntryRuntime; +module.exports.getRuntimeKey = getRuntimeKey; +module.exports.intersectRuntime = intersectRuntime; +module.exports.keyToRuntime = keyToRuntime; +module.exports.mergeRuntime = mergeRuntime; +module.exports.mergeRuntimeCondition = mergeRuntimeCondition; +module.exports.mergeRuntimeConditionNonFalse = mergeRuntimeConditionNonFalse; +module.exports.mergeRuntimeOwned = mergeRuntimeOwned; +module.exports.runtimeConditionToString = runtimeConditionToString; +module.exports.runtimeEqual = runtimeEqual; +module.exports.runtimeToString = runtimeToString; +module.exports.subtractRuntime = subtractRuntime; +module.exports.subtractRuntimeCondition = subtractRuntimeCondition; diff --git a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js index 594fb3de8ec..4cd53204313 100644 --- a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +++ b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js @@ -172,9 +172,9 @@ const generateImportObject = ( const moduleIdStringified = JSON.stringify(chunkGraph.getModuleId(module)); if (waitForInstances.size === 1) { - const moduleId = Array.from(waitForInstances.values())[0]; + const moduleId = [...waitForInstances.values()][0]; const promise = `installedWasmModules[${JSON.stringify(moduleId)}]`; - const variable = Array.from(waitForInstances.keys())[0]; + const variable = [...waitForInstances.keys()][0]; return Template.asString([ `${moduleIdStringified}: function() {`, Template.indent([ diff --git a/lib/wasm-sync/WebAssemblyGenerator.js b/lib/wasm-sync/WebAssemblyGenerator.js index a91cb35f82d..5028a622e59 100644 --- a/lib/wasm-sync/WebAssemblyGenerator.js +++ b/lib/wasm-sync/WebAssemblyGenerator.js @@ -7,14 +7,13 @@ const t = require("@webassemblyjs/ast"); const { moduleContextFromModuleAST } = require("@webassemblyjs/ast"); -const { editWithAST, addWithAST } = require("@webassemblyjs/wasm-edit"); +const { addWithAST, editWithAST } = require("@webassemblyjs/wasm-edit"); const { decode } = require("@webassemblyjs/wasm-parser"); const { RawSource } = require("webpack-sources"); const Generator = require("../Generator"); const { WEBASSEMBLY_TYPES } = require("../ModuleSourceTypesConstants"); -const WebAssemblyUtils = require("./WebAssemblyUtils"); - const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency"); +const WebAssemblyUtils = require("./WebAssemblyUtils"); /** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("../DependencyTemplates")} DependencyTemplates */ diff --git a/lib/wasm-sync/WebAssemblyInInitialChunkError.js b/lib/wasm-sync/WebAssemblyInInitialChunkError.js index 8de4c352688..1c09c4a2b54 100644 --- a/lib/wasm-sync/WebAssemblyInInitialChunkError.js +++ b/lib/wasm-sync/WebAssemblyInInitialChunkError.js @@ -77,7 +77,7 @@ const getInitialModuleChains = ( for (const result of incompleteResults) { results.add(result); } - return Array.from(results); + return [...results]; }; module.exports = class WebAssemblyInInitialChunkError extends WebpackError { diff --git a/lib/wasm-sync/WebAssemblyUtils.js b/lib/wasm-sync/WebAssemblyUtils.js index a67f3557268..27c5111d3f1 100644 --- a/lib/wasm-sync/WebAssemblyUtils.js +++ b/lib/wasm-sync/WebAssemblyUtils.js @@ -62,5 +62,5 @@ const getUsedDependencies = (moduleGraph, module, mangle) => { return array; }; -module.exports.getUsedDependencies = getUsedDependencies; module.exports.MANGLED_MODULE = MANGLED_MODULE; +module.exports.getUsedDependencies = getUsedDependencies; diff --git a/lib/wasm/EnableWasmLoadingPlugin.js b/lib/wasm/EnableWasmLoadingPlugin.js index 9af839e170f..dc0b314bdb2 100644 --- a/lib/wasm/EnableWasmLoadingPlugin.js +++ b/lib/wasm/EnableWasmLoadingPlugin.js @@ -54,9 +54,7 @@ class EnableWasmLoadingPlugin { "EnableWasmLoadingPlugin need to be used to enable this type of wasm loading. " + 'This usually happens through the "output.enabledWasmLoadingTypes" option. ' + 'If you are using a function as entry which sets "wasmLoading", you need to add all potential library types to "output.enabledWasmLoadingTypes". ' + - `These types are enabled: ${Array.from( - getEnabledTypes(compiler) - ).join(", ")}` + `These types are enabled: ${[...getEnabledTypes(compiler)].join(", ")}` ); } } diff --git a/lib/webpack.js b/lib/webpack.js index 181340071b4..3b45001de0e 100644 --- a/lib/webpack.js +++ b/lib/webpack.js @@ -12,8 +12,8 @@ const Compiler = require("./Compiler"); const MultiCompiler = require("./MultiCompiler"); const WebpackOptionsApply = require("./WebpackOptionsApply"); const { - applyWebpackOptionsDefaults, - applyWebpackOptionsBaseDefaults + applyWebpackOptionsBaseDefaults, + applyWebpackOptionsDefaults } = require("./config/defaults"); const { getNormalizedWebpackOptions } = require("./config/normalization"); const NodeEnvironmentPlugin = require("./node/NodeEnvironmentPlugin"); @@ -115,8 +115,7 @@ const createCompiler = (rawOptions, compilerIndex) => { * @param {Array | T} options options * @returns {Array} array of options */ -const asArray = options => - Array.isArray(options) ? Array.from(options) : [options]; +const asArray = options => (Array.isArray(options) ? [...options] : [options]); const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ ( /** diff --git a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js index 6b2cf24c163..81ab1923cec 100644 --- a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +++ b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js @@ -11,8 +11,8 @@ const { generateJavascriptHMR } = require("../hmr/JavascriptHotModuleReplacementHelper"); const { - getChunkFilenameTemplate, - chunkHasJs + chunkHasJs, + getChunkFilenameTemplate } = require("../javascript/JavascriptModulesPlugin"); const { getInitialChunkIds } = require("../javascript/StartupHelpers"); const compileBooleanMatcher = require("../util/compileBooleanMatcher"); diff --git a/test/BenchmarkTestCases.benchmark.mjs b/test/BenchmarkTestCases.benchmark.mjs index 0ebdc7cf4a9..16ef2b112cf 100644 --- a/test/BenchmarkTestCases.benchmark.mjs +++ b/test/BenchmarkTestCases.benchmark.mjs @@ -1,10 +1,10 @@ -import path from "path"; -import fs from "fs/promises"; import { constants, writeFile } from "fs"; -import { Bench, hrtimeNow } from "tinybench"; +import fs from "fs/promises"; +import path from "path"; import { fileURLToPath, pathToFileURL } from "url"; -import { simpleGit } from "simple-git"; import { withCodSpeed } from "@codspeed/tinybench-plugin"; +import { simpleGit } from "simple-git"; +import { Bench, hrtimeNow } from "tinybench"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const rootPath = path.join(__dirname, ".."); diff --git a/test/BinaryMiddleware.unittest.js b/test/BinaryMiddleware.unittest.js index 143833e5aec..813eab30310 100644 --- a/test/BinaryMiddleware.unittest.js +++ b/test/BinaryMiddleware.unittest.js @@ -58,11 +58,9 @@ describe("BinaryMiddleware", () => { mw ) ]; + itemsWithLazy.push(SerializerMiddleware.createLazy([...itemsWithLazy], mw)); itemsWithLazy.push( - SerializerMiddleware.createLazy(itemsWithLazy.slice(), mw) - ); - itemsWithLazy.push( - SerializerMiddleware.createLazy(itemsWithLazy.slice(), other) + SerializerMiddleware.createLazy([...itemsWithLazy], other) ); items.push(undefined); diff --git a/test/BuildDependencies.longtest.js b/test/BuildDependencies.longtest.js index cf0824b473b..f3e12faf695 100644 --- a/test/BuildDependencies.longtest.js +++ b/test/BuildDependencies.longtest.js @@ -1,8 +1,8 @@ "use strict"; -const path = require("path"); const childProcess = require("child_process"); const fs = require("fs"); +const path = require("path"); const rimraf = require("rimraf"); const cacheDirectory = path.resolve(__dirname, "js/buildDepsCache"); diff --git a/test/ChangesAndRemovals.test.js b/test/ChangesAndRemovals.test.js index 544bdcd8648..64fca1015d0 100644 --- a/test/ChangesAndRemovals.test.js +++ b/test/ChangesAndRemovals.test.js @@ -3,8 +3,8 @@ require("./helpers/warmup-webpack"); const path = require("path"); -const { createFsFromVolume, Volume } = require("memfs"); const fs = require("graceful-fs"); +const { Volume, createFsFromVolume } = require("memfs"); const rimraf = require("rimraf"); const createCompiler = config => { @@ -41,8 +41,8 @@ const getChanges = compiler => { const modifiedFiles = compiler.modifiedFiles; const removedFiles = compiler.removedFiles; return { - removed: removedFiles && Array.from(removedFiles), - modified: modifiedFiles && Array.from(modifiedFiles) + removed: removedFiles && [...removedFiles], + modified: modifiedFiles && [...modifiedFiles] }; }; diff --git a/test/CleanPlugin.unittest.js b/test/CleanPlugin.unittest.js index 627601723d2..64dfb17b594 100644 --- a/test/CleanPlugin.unittest.js +++ b/test/CleanPlugin.unittest.js @@ -18,13 +18,13 @@ describe("CleanPlugin", () => { it("should extract root directory from single file path", () => { const assets = new Map([["./static.js", 0]]); const result = _getDirectories(assets); - expect(Array.from(result)).toEqual(["."]); + expect([...result]).toEqual(["."]); }); it("should extract all parent directories from deep nested path", () => { const assets = new Map([["this/dir/should/not/be/removed/file.ext", 0]]); const result = _getDirectories(assets); - expect(Array.from(result)).toEqual([ + expect([...result]).toEqual([ "this/dir/should/not/be/removed", "this/dir/should/not/be", "this/dir/should/not", @@ -41,7 +41,7 @@ describe("CleanPlugin", () => { ["./js/main.js", 0] ]); const result = _getDirectories(assets); - expect(Array.from(result)).toEqual([".", "./js"]); + expect([...result]).toEqual([".", "./js"]); }); it("should extract all nested directory levels", () => { @@ -51,12 +51,7 @@ describe("CleanPlugin", () => { ["./static/js/main.js", 0] ]); const result = _getDirectories(assets); - expect(Array.from(result)).toEqual([ - ".", - "./js", - "./static/js", - "./static" - ]); + expect([...result]).toEqual([".", "./js", "./static/js", "./static"]); }); }); diff --git a/test/Compiler-filesystem-caching.test.js b/test/Compiler-filesystem-caching.test.js index 8c62cc40044..484d8b168d7 100644 --- a/test/Compiler-filesystem-caching.test.js +++ b/test/Compiler-filesystem-caching.test.js @@ -101,10 +101,7 @@ describe("Compiler (filesystem caching)", () => { expect(result.bigint6).toBe(128n); expect(result.bigint7).toBe(2147483647n); expect(result.obj.foo).toBe(BigInt(-10)); - expect(Array.from(result.set)).toEqual([ - BigInt(1), - BigInt(2) - ]); + expect([...result.set]).toEqual([BigInt(1), BigInt(2)]); expect(result.arr).toEqual([256n, 257n, 258n]); } diff --git a/test/Compiler.test.js b/test/Compiler.test.js index a7d9b787ac6..161879602f5 100644 --- a/test/Compiler.test.js +++ b/test/Compiler.test.js @@ -3,8 +3,8 @@ require("./helpers/warmup-webpack"); const path = require("path"); +const { Volume, createFsFromVolume } = require("memfs"); const Stats = require("../lib/Stats"); -const { createFsFromVolume, Volume } = require("memfs"); const captureStdio = require("./helpers/captureStdio"); const deprecationTracking = require("./helpers/deprecationTracking"); diff --git a/test/ConfigTestCases.template.js b/test/ConfigTestCases.template.js index 648762adfd6..edaa2f8bd46 100644 --- a/test/ConfigTestCases.template.js +++ b/test/ConfigTestCases.template.js @@ -8,13 +8,13 @@ require("./helpers/warmup-webpack"); const path = require("path"); const fs = require("graceful-fs"); const rimraf = require("rimraf"); +const { parseResource } = require("../lib/util/identifier"); const checkArrayExpectation = require("./checkArrayExpectation"); +const captureStdio = require("./helpers/captureStdio"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const deprecationTracking = require("./helpers/deprecationTracking"); -const prepareOptions = require("./helpers/prepareOptions"); -const { parseResource } = require("../lib/util/identifier"); -const captureStdio = require("./helpers/captureStdio"); const filterInfraStructureErrors = require("./helpers/infrastructureLogErrors"); +const prepareOptions = require("./helpers/prepareOptions"); const { TestRunner } = require("./runner"); const casesPath = path.join(__dirname, "configCases"); @@ -87,7 +87,7 @@ const describeCases = config => { require(path.join(testDirectory, "webpack.config.js")), { testPath: outputDirectory } ); - optionsArr = [].concat(options); + optionsArr = [...(Array.isArray(options) ? options : [options])]; for (const [idx, options] of optionsArr.entries()) { if (!options.context) options.context = testDirectory; if (!options.mode) options.mode = "production"; @@ -281,7 +281,7 @@ const describeCases = config => { } const allModules = children ? children.reduce( - (all, { modules }) => all.concat(modules), + (all, { modules }) => [...all, ...modules], modules || [] ) : modules; diff --git a/test/ContextModuleFactory.unittest.js b/test/ContextModuleFactory.unittest.js index f4fa498f036..4841dc6f8ee 100644 --- a/test/ContextModuleFactory.unittest.js +++ b/test/ContextModuleFactory.unittest.js @@ -1,6 +1,6 @@ "use strict"; -const { createFsFromVolume, Volume } = require("memfs"); +const { Volume, createFsFromVolume } = require("memfs"); const ContextModuleFactory = require("../lib/ContextModuleFactory"); describe("ContextModuleFactory", () => { diff --git a/test/Errors.test.js b/test/Errors.test.js index 29c2e617d61..3f657464a35 100644 --- a/test/Errors.test.js +++ b/test/Errors.test.js @@ -4,8 +4,8 @@ require("./helpers/warmup-webpack"); const path = require("path"); const fs = require("graceful-fs"); -const webpack = require(".."); const prettyFormat = require("pretty-format").default; +const webpack = require(".."); const CWD_PATTERN = new RegExp(process.cwd().replace(/\\/g, "/"), "gm"); const ERROR_STACK_PATTERN = /(?:\n\s+at\s.*)+/gm; diff --git a/test/Examples.test.js b/test/Examples.test.js index ce7d9f61a51..4ae46438839 100644 --- a/test/Examples.test.js +++ b/test/Examples.test.js @@ -5,6 +5,8 @@ require("./helpers/warmup-webpack"); const path = require("path"); const fs = require("graceful-fs"); +jest.setTimeout(30000); + describe("Examples", () => { const basePath = path.join(__dirname, "..", "examples"); diff --git a/test/FileSystemInfo.unittest.js b/test/FileSystemInfo.unittest.js index ae0a778041e..f0c7d3c0c64 100644 --- a/test/FileSystemInfo.unittest.js +++ b/test/FileSystemInfo.unittest.js @@ -1,7 +1,7 @@ "use strict"; -const { createFsFromVolume, Volume } = require("memfs"); const util = require("util"); +const { Volume, createFsFromVolume } = require("memfs"); const FileSystemInfo = require("../lib/FileSystemInfo"); const { buffersSerializer } = require("../lib/util/serialization"); diff --git a/test/JavascriptParser.unittest.js b/test/JavascriptParser.unittest.js index 8283c109186..09d19918c27 100644 --- a/test/JavascriptParser.unittest.js +++ b/test/JavascriptParser.unittest.js @@ -1,6 +1,6 @@ "use strict"; -/* eslint-disable no-unused-expressions, no-unassigned-vars */ +/* eslint-disable no-unused-expressions, no-unassigned-vars, func-names */ // cspell:ignore fghsub notry fghsub notry notry this's ijksub this's ijksub fghsub fghsub notry ijksub ijksub strrring strrring strr strrring strrring strr Sstrrringy strone stronetwo stronetwothree stronetwo stronetwothree stronetwothreefour onetwo onetwo twothree twothree twothree threefour onetwo onetwo threefour threefour fourfive startstrmid igmy igmyi igmya const BasicEvaluatedExpression = require("../lib/javascript/BasicEvaluatedExpression"); @@ -298,7 +298,7 @@ describe("JavascriptParser", () => { .tap("JavascriptParserTest", expr => { if (!testParser.state.fgh) testParser.state.fgh = []; testParser.state.fgh.push( - Array.from(testParser.scope.definitions.asSet()).join(" ") + [...testParser.scope.definitions.asSet()].join(" ") ); return true; }); diff --git a/test/MemoryLimitTestCases.test.js b/test/MemoryLimitTestCases.test.js index cd84daa708f..c44d544008e 100644 --- a/test/MemoryLimitTestCases.test.js +++ b/test/MemoryLimitTestCases.test.js @@ -5,8 +5,8 @@ require("./helpers/warmup-webpack"); const path = require("path"); const fs = require("graceful-fs"); const rimraf = require("rimraf"); -const captureStdio = require("./helpers/captureStdio"); const webpack = require(".."); +const captureStdio = require("./helpers/captureStdio"); const toMiB = bytes => `${Math.round(bytes / 1024 / 1024)}MiB`; const base = path.join(__dirname, "memoryLimitCases"); @@ -94,23 +94,21 @@ describe("MemoryLimitTestCases", () => { for (const c of compilers) { const ifs = c.inputFileSystem; c.inputFileSystem = Object.create(ifs); - c.inputFileSystem.readFile = function () { + c.inputFileSystem.readFile = function readFile() { // eslint-disable-next-line prefer-rest-params const args = Array.prototype.slice.call(arguments); const callback = args.pop(); - // eslint-disable-next-line prefer-spread - ifs.readFile.apply( - ifs, - args.concat([ - (err, result) => { - if (err) return callback(err); - if (!/\.(js|json|txt)$/.test(args[0])) { - return callback(null, result); - } - callback(null, result.toString("utf8").replace(/\r/g, "")); + // eslint-disable-next-line no-useless-call + ifs.readFile.apply(ifs, [ + ...args, + (err, result) => { + if (err) return callback(err); + if (!/\.(js|json|txt)$/.test(args[0])) { + return callback(null, result); } - ]) - ); + callback(null, result.toString("utf8").replace(/\r/g, "")); + } + ]); }; } c.run((err, stats) => { diff --git a/test/MultiCompiler.test.js b/test/MultiCompiler.test.js index f558a3513ee..403d0dfc89d 100644 --- a/test/MultiCompiler.test.js +++ b/test/MultiCompiler.test.js @@ -3,7 +3,7 @@ require("./helpers/warmup-webpack"); const path = require("path"); -const { createFsFromVolume, Volume } = require("memfs"); +const { Volume, createFsFromVolume } = require("memfs"); const webpack = require(".."); const createMultiCompiler = options => { diff --git a/test/MultiStats.test.js b/test/MultiStats.test.js index cd3d36e0921..d1757423bb7 100644 --- a/test/MultiStats.test.js +++ b/test/MultiStats.test.js @@ -2,7 +2,7 @@ require("./helpers/warmup-webpack"); -const { createFsFromVolume, Volume } = require("memfs"); +const { Volume, createFsFromVolume } = require("memfs"); describe("MultiStats", () => { it("should create JSON of children stats", done => { diff --git a/test/NormalModule.unittest.js b/test/NormalModule.unittest.js index 07d4c2c79a8..7c321eafc1c 100644 --- a/test/NormalModule.unittest.js +++ b/test/NormalModule.unittest.js @@ -1,9 +1,9 @@ "use strict"; -const NormalModule = require("../lib/NormalModule"); const SourceMapSource = require("webpack-sources").SourceMapSource; const OriginalSource = require("webpack-sources").OriginalSource; const RawSource = require("webpack-sources").RawSource; +const NormalModule = require("../lib/NormalModule"); describe("NormalModule", () => { let normalModule; diff --git a/test/PersistentCaching.test.js b/test/PersistentCaching.test.js index f57ad24f367..5d7cf21ea40 100644 --- a/test/PersistentCaching.test.js +++ b/test/PersistentCaching.test.js @@ -1,10 +1,10 @@ require("./helpers/warmup-webpack"); +const fs = require("fs"); const path = require("path"); const util = require("util"); -const fs = require("fs"); -const rimraf = require("rimraf"); const vm = require("vm"); +const rimraf = require("rimraf"); const readdir = util.promisify(fs.readdir); const writeFile = util.promisify(fs.writeFile); @@ -161,7 +161,7 @@ export { style }; await updateSrc(data); const c = items => { const entry = {}; - for (const item of items.split("")) entry[item] = `./src/${item}.js`; + for (const item of items) entry[item] = `./src/${item}.js`; return compile({ entry, cache: { compression: false } }); }; await c("abcde"); diff --git a/test/ProgressPlugin.test.js b/test/ProgressPlugin.test.js index 540f7ddd0ec..5834bb42e1e 100644 --- a/test/ProgressPlugin.test.js +++ b/test/ProgressPlugin.test.js @@ -2,9 +2,9 @@ require("./helpers/warmup-webpack"); -const _ = require("lodash"); const path = require("path"); -const { createFsFromVolume, Volume } = require("memfs"); +const _ = require("lodash"); +const { Volume, createFsFromVolume } = require("memfs"); const webpack = require(".."); const captureStdio = require("./helpers/captureStdio"); diff --git a/test/RawModule.unittest.js b/test/RawModule.unittest.js index 4fbbb6e194a..35a680dfb39 100644 --- a/test/RawModule.unittest.js +++ b/test/RawModule.unittest.js @@ -1,8 +1,8 @@ "use strict"; +const path = require("path"); const RawModule = require("../lib/RawModule"); const RequestShortener = require("../lib/RequestShortener"); -const path = require("path"); describe("RawModule", () => { const source = "sourceStr attribute"; diff --git a/test/RuntimeTemplate.unittest.js b/test/RuntimeTemplate.unittest.js index 1cd083e3036..982feab3a8b 100644 --- a/test/RuntimeTemplate.unittest.js +++ b/test/RuntimeTemplate.unittest.js @@ -1,7 +1,7 @@ "use strict"; -const RuntimeTemplate = require("../lib/RuntimeTemplate"); const RequestShortener = require("../lib/RequestShortener"); +const RuntimeTemplate = require("../lib/RuntimeTemplate"); describe("RuntimeTemplate.concatenation", () => { it("no args", () => { diff --git a/test/SemVer.unittest.js b/test/SemVer.unittest.js index 6ad93553386..7b8da21c9f4 100644 --- a/test/SemVer.unittest.js +++ b/test/SemVer.unittest.js @@ -1,15 +1,15 @@ "use strict"; const { + parseRange, parseVersion, parseVersionRuntimeCode, - versionLt, - versionLtRuntimeCode, - parseRange, rangeToString, rangeToStringRuntimeCode, satisfy, - satisfyRuntimeCode + satisfyRuntimeCode, + versionLt, + versionLtRuntimeCode } = require("../lib/util/semver"); describe("SemVer", () => { diff --git a/test/SortableSet.unittest.js b/test/SortableSet.unittest.js index 65b39a075eb..bf8534af81d 100644 --- a/test/SortableSet.unittest.js +++ b/test/SortableSet.unittest.js @@ -5,7 +5,7 @@ const SortableSet = require("../lib/util/SortableSet"); describe("util/SortableSet", () => { it("can be constructed like a normal Set", () => { const sortableSet = new SortableSet([1, 1, 1, 1, 1, 4, 5, 2], () => {}); - expect(Array.from(sortableSet)).toEqual([1, 4, 5, 2]); + expect([...sortableSet]).toEqual([1, 4, 5, 2]); }); it("can sort its content", () => { @@ -14,7 +14,7 @@ describe("util/SortableSet", () => { (a, b) => a - b ); sortableSet.sort(); - expect(Array.from(sortableSet)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); + expect([...sortableSet]).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); }); it("can sort by a specified function", () => { @@ -23,6 +23,15 @@ describe("util/SortableSet", () => { (a, b) => a - b ); sortableSet.sortWith((a, b) => b - a); - expect(Array.from(sortableSet)).toEqual([9, 8, 7, 6, 5, 4, 3, 2, 1, 0]); + expect([...sortableSet]).toEqual([9, 8, 7, 6, 5, 4, 3, 2, 1, 0]); + }); + + it("can sort by a specified function and convert to JSON", () => { + const sortableSet = new SortableSet( + [1, 1, 1, 6, 6, 1, 1, 4, 5, 2, 3, 8, 5, 7, 9, 0, 3, 1], + (a, b) => a - b + ); + sortableSet.sortWith((a, b) => b - a); + expect(sortableSet.toJSON()).toEqual([9, 8, 7, 6, 5, 4, 3, 2, 1, 0]); }); }); diff --git a/test/Stats.test.js b/test/Stats.test.js index d8c65afbd25..3bb9b8f7687 100644 --- a/test/Stats.test.js +++ b/test/Stats.test.js @@ -2,7 +2,7 @@ require("./helpers/warmup-webpack"); -const { createFsFromVolume, Volume } = require("memfs"); +const { Volume, createFsFromVolume } = require("memfs"); const compile = options => new Promise((resolve, reject) => { diff --git a/test/StatsTestCases.basictest.js b/test/StatsTestCases.basictest.js index 207730776f1..97f1380dd2f 100644 --- a/test/StatsTestCases.basictest.js +++ b/test/StatsTestCases.basictest.js @@ -5,8 +5,8 @@ require("./helpers/warmup-webpack"); const path = require("path"); const fs = require("graceful-fs"); const rimraf = require("rimraf"); -const captureStdio = require("./helpers/captureStdio"); const webpack = require(".."); +const captureStdio = require("./helpers/captureStdio"); /** * Escapes regular expression metacharacters @@ -102,23 +102,21 @@ describe("StatsTestCases", () => { for (const c of compilers) { const ifs = c.inputFileSystem; c.inputFileSystem = Object.create(ifs); - c.inputFileSystem.readFile = function () { + c.inputFileSystem.readFile = function readFile() { // eslint-disable-next-line prefer-rest-params const args = Array.prototype.slice.call(arguments); const callback = args.pop(); - // eslint-disable-next-line prefer-spread - ifs.readFile.apply( - ifs, - args.concat([ - (err, result) => { - if (err) return callback(err); - if (!/\.(js|json|txt)$/.test(args[0])) { - return callback(null, result); - } - callback(null, result.toString("utf8").replace(/\r/g, "")); + // eslint-disable-next-line no-useless-call + ifs.readFile.apply(ifs, [ + ...args, + (err, result) => { + if (err) return callback(err); + if (!/\.(js|json|txt)$/.test(args[0])) { + return callback(null, result); } - ]) - ); + callback(null, result.toString("utf8").replace(/\r/g, "")); + } + ]); }; c.hooks.compilation.tap("StatsTestCasesTest", compilation => { for (const hook of [ @@ -137,9 +135,9 @@ describe("StatsTestCases", () => { } c.run((err, stats) => { if (err) return done(err); - for (const compilation of [] - .concat(stats.stats || stats) - .map(s => s.compilation)) { + for (const compilation of [ + ...(stats.stats ? stats.stats : [stats]) + ].map(s => s.compilation)) { compilation.logging.delete("webpack.Compilation.ModuleProfile"); } expect(stats.hasErrors()).toBe(testName.endsWith("error")); @@ -184,7 +182,7 @@ describe("StatsTestCases", () => { toStringOptions.children = c.options.map(o => o.stats); } // mock timestamps - for (const { compilation: s } of [].concat(stats.stats || stats)) { + for (const { compilation: s } of stats.stats ? stats.stats : [stats]) { expect(s.startTime).toBeGreaterThan(0); expect(s.endTime).toBeGreaterThan(0); s.endTime = new Date("04/20/1970, 12:42:42 PM").getTime(); diff --git a/test/TestCases.template.js b/test/TestCases.template.js index fda386f988d..dcb7d3ac9e2 100644 --- a/test/TestCases.template.js +++ b/test/TestCases.template.js @@ -3,15 +3,15 @@ require("./helpers/warmup-webpack"); const path = require("path"); -const fs = require("graceful-fs"); +const { URL, pathToFileURL } = require("url"); const vm = require("vm"); -const { pathToFileURL, URL } = require("url"); +const fs = require("graceful-fs"); const rimraf = require("rimraf"); const checkArrayExpectation = require("./checkArrayExpectation"); +const asModule = require("./helpers/asModule"); +const captureStdio = require("./helpers/captureStdio"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const deprecationTracking = require("./helpers/deprecationTracking"); -const captureStdio = require("./helpers/captureStdio"); -const asModule = require("./helpers/asModule"); const filterInfraStructureErrors = require("./helpers/infrastructureLogErrors"); const casesPath = path.join(__dirname, "cases"); @@ -55,7 +55,7 @@ const describeCases = config => { for (const category of categories) { // eslint-disable-next-line no-loop-func describe(category.name, () => { - jest.setTimeout(20000); + jest.setTimeout(30000); for (const testName of category.tests.filter(test => { const testDirectory = path.join(casesPath, category.name, test); @@ -189,21 +189,24 @@ const describeCases = config => { } ] }, - plugins: (config.plugins || []).concat(function () { - this.hooks.compilation.tap("TestCasesTest", compilation => { - for (const hook of [ - "optimize", - "optimizeModules", - "optimizeChunks", - "afterOptimizeTree", - "afterOptimizeAssets" - ]) { - compilation.hooks[hook].tap("TestCasesTest", () => - compilation.checkConstraints() - ); - } - }); - }), + plugins: [ + ...(config.plugins || []), + function testCasesTest() { + this.hooks.compilation.tap("TestCasesTest", compilation => { + for (const hook of [ + "optimize", + "optimizeModules", + "optimizeChunks", + "afterOptimizeTree", + "afterOptimizeAssets" + ]) { + compilation.hooks[hook].tap("TestCasesTest", () => + compilation.checkConstraints() + ); + } + }); + } + ], experiments: { asyncWebAssembly: true, topLevelAwait: true, diff --git a/test/TestCasesHot.test.js b/test/TestCasesHot.test.js index c4fd8737c03..e0bd6d04410 100644 --- a/test/TestCasesHot.test.js +++ b/test/TestCasesHot.test.js @@ -1,5 +1,5 @@ -const { describeCases } = require("./TestCases.template"); const webpack = require(".."); +const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { describeCases({ diff --git a/test/TestCasesModule.test.js b/test/TestCasesModule.test.js index 2ce910feb75..b99158ee493 100644 --- a/test/TestCasesModule.test.js +++ b/test/TestCasesModule.test.js @@ -1,5 +1,5 @@ -const { describeCases } = require("./TestCases.template"); const vm = require("vm"); +const { describeCases } = require("./TestCases.template"); describe("TestCases", () => { if (!vm.SourceTextModule) { diff --git a/test/URLAbsoluteSpecifier.unittest.js b/test/URLAbsoluteSpecifier.unittest.js index 92f479a2ff4..f02e110c449 100644 --- a/test/URLAbsoluteSpecifier.unittest.js +++ b/test/URLAbsoluteSpecifier.unittest.js @@ -1,4 +1,4 @@ -const { getScheme, getProtocol } = require("../lib/util/URLAbsoluteSpecifier"); +const { getProtocol, getScheme } = require("../lib/util/URLAbsoluteSpecifier"); /** * @type {Array<{specifier: string, expected: string|undefined}>} diff --git a/test/WasmHashes.unittest.js b/test/WasmHashes.unittest.js index 23d4e552673..b3f5323b471 100644 --- a/test/WasmHashes.unittest.js +++ b/test/WasmHashes.unittest.js @@ -1,4 +1,4 @@ -const { randomBytes, createHash } = require("crypto"); +const { createHash, randomBytes } = require("crypto"); const wasmHashes = { xxhash64: () => { @@ -116,11 +116,11 @@ for (const name of Object.keys(wasmHashes)) { test("many updates 1", sizes); - test("many updates 2", sizes.slice().reverse()); + test("many updates 2", [...sizes].reverse()); - test("many updates 3", sizes.concat(sizes.slice().reverse())); + test("many updates 3", [...sizes, ...[...sizes].reverse()]); - test("many updates 4", sizes.slice().reverse().concat(sizes)); + test("many updates 4", [...[...sizes].reverse(), ...sizes]); const unicodeTest = (name, codePoints) => { it(`${name} should hash unicode chars correctly`, async () => { diff --git a/test/Watch.test.js b/test/Watch.test.js index d939dd36397..f7d13c2a0dc 100644 --- a/test/Watch.test.js +++ b/test/Watch.test.js @@ -3,8 +3,8 @@ require("./helpers/warmup-webpack"); const path = require("path"); +const { Volume, createFsFromVolume } = require("memfs"); const webpack = require(".."); -const { createFsFromVolume, Volume } = require("memfs"); jest.setTimeout(10000); diff --git a/test/WatchDetection.test.js b/test/WatchDetection.test.js index 477948ecee1..e59ea707b40 100644 --- a/test/WatchDetection.test.js +++ b/test/WatchDetection.test.js @@ -2,7 +2,7 @@ const path = require("path"); const fs = require("graceful-fs"); -const { createFsFromVolume, Volume } = require("memfs"); +const { Volume, createFsFromVolume } = require("memfs"); const webpack = require(".."); diff --git a/test/WatchSuspend.test.js b/test/WatchSuspend.test.js index 8534e1e3036..4f62156e8ce 100644 --- a/test/WatchSuspend.test.js +++ b/test/WatchSuspend.test.js @@ -2,8 +2,8 @@ require("./helpers/warmup-webpack"); -const path = require("path"); const fs = require("fs"); +const path = require("path"); describe("WatchSuspend", () => { if (process.env.NO_WATCH_TESTS) { @@ -130,11 +130,10 @@ describe("WatchSuspend", () => { "'baz'" ); expect( - compiler.modifiedFiles && - Array.from(compiler.modifiedFiles).sort() + compiler.modifiedFiles && [...compiler.modifiedFiles].sort() ).toEqual([filePath]); expect( - compiler.removedFiles && Array.from(compiler.removedFiles) + compiler.removedFiles && [...compiler.removedFiles] ).toEqual([]); onChange = null; resolve(); diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js index 5b5725ece55..16736a9e454 100644 --- a/test/WatchTestCases.template.js +++ b/test/WatchTestCases.template.js @@ -10,9 +10,9 @@ const fs = require("graceful-fs"); const rimraf = require("rimraf"); const checkArrayExpectation = require("./checkArrayExpectation"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); -const { remove } = require("./helpers/remove"); -const prepareOptions = require("./helpers/prepareOptions"); const deprecationTracking = require("./helpers/deprecationTracking"); +const prepareOptions = require("./helpers/prepareOptions"); +const { remove } = require("./helpers/remove"); const { TestRunner } = require("./runner"); /** diff --git a/test/WatcherEvents.test.js b/test/WatcherEvents.test.js index 3f76ae0aa65..3d0230743ef 100644 --- a/test/WatcherEvents.test.js +++ b/test/WatcherEvents.test.js @@ -1,7 +1,7 @@ "use strict"; const path = require("path"); -const { createFsFromVolume, Volume } = require("memfs"); +const { Volume, createFsFromVolume } = require("memfs"); const webpack = require(".."); const createCompiler = config => { diff --git a/test/benchmarkCases/context-commonjs/options.mjs b/test/benchmarkCases/context-commonjs/options.mjs index 047f4666a80..f876527ef23 100644 --- a/test/benchmarkCases/context-commonjs/options.mjs +++ b/test/benchmarkCases/context-commonjs/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/test/benchmarkCases/context-esm/options.mjs b/test/benchmarkCases/context-esm/options.mjs index 7a132bea247..28c6e340748 100644 --- a/test/benchmarkCases/context-esm/options.mjs +++ b/test/benchmarkCases/context-esm/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/test/benchmarkCases/devtool-eval-source-map/options.mjs b/test/benchmarkCases/devtool-eval-source-map/options.mjs index 168ffedc19f..7fdc64b2698 100644 --- a/test/benchmarkCases/devtool-eval-source-map/options.mjs +++ b/test/benchmarkCases/devtool-eval-source-map/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/test/benchmarkCases/devtool-eval/options.mjs b/test/benchmarkCases/devtool-eval/options.mjs index 168ffedc19f..7fdc64b2698 100644 --- a/test/benchmarkCases/devtool-eval/options.mjs +++ b/test/benchmarkCases/devtool-eval/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/test/benchmarkCases/devtool-source-map/options.mjs b/test/benchmarkCases/devtool-source-map/options.mjs index 168ffedc19f..7fdc64b2698 100644 --- a/test/benchmarkCases/devtool-source-map/options.mjs +++ b/test/benchmarkCases/devtool-source-map/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/test/benchmarkCases/future-defaults/options.mjs b/test/benchmarkCases/future-defaults/options.mjs index 8bdde9b5376..4605e2da259 100644 --- a/test/benchmarkCases/future-defaults/options.mjs +++ b/test/benchmarkCases/future-defaults/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/test/benchmarkCases/many-chunks-commonjs/options.mjs b/test/benchmarkCases/many-chunks-commonjs/options.mjs index d7d7366b0f8..9423d030a95 100644 --- a/test/benchmarkCases/many-chunks-commonjs/options.mjs +++ b/test/benchmarkCases/many-chunks-commonjs/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/test/benchmarkCases/many-chunks-esm/options.mjs b/test/benchmarkCases/many-chunks-esm/options.mjs index dece89a9f12..65f416301b2 100644 --- a/test/benchmarkCases/many-chunks-esm/options.mjs +++ b/test/benchmarkCases/many-chunks-esm/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/test/benchmarkCases/many-modules-commonjs/options.mjs b/test/benchmarkCases/many-modules-commonjs/options.mjs index ae9c7e31074..46e622232bf 100644 --- a/test/benchmarkCases/many-modules-commonjs/options.mjs +++ b/test/benchmarkCases/many-modules-commonjs/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/test/benchmarkCases/many-modules-esm/options.mjs b/test/benchmarkCases/many-modules-esm/options.mjs index 8bdde9b5376..4605e2da259 100644 --- a/test/benchmarkCases/many-modules-esm/options.mjs +++ b/test/benchmarkCases/many-modules-esm/options.mjs @@ -1,7 +1,7 @@ -import createTree from "../_helpers/create-tree.mjs"; -import { resolve, dirname } from "path"; -import { fileURLToPath } from "url"; import fs from "fs/promises"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; +import createTree from "../_helpers/create-tree.mjs"; export async function setup() { const __dirname = dirname(fileURLToPath(import.meta.url)); 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 068f4ef62c5..c27a08c369b 100644 --- a/test/cases/async-modules/micro-ticks-parents/test.filter.js +++ b/test/cases/async-modules/micro-ticks-parents/test.filter.js @@ -1,4 +1,3 @@ -module.exports = function (config) { +module.exports = () => // In node 10 v8 has a bug which inserts an additional micro-tick into async functions - return !process.version.startsWith("v10."); -}; + !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 f176154b261..5619e2881a1 100644 --- a/test/cases/chunks/destructuring-assignment/test.filter.js +++ b/test/cases/chunks/destructuring-assignment/test.filter.js @@ -1,4 +1,4 @@ -module.exports = function (config) { +module.exports = function filter(config) { // This test can't run in development mode return config.mode !== "development"; }; diff --git a/test/cases/chunks/runtime/test.filter.js b/test/cases/chunks/runtime/test.filter.js index 7ba4ada1c94..9e95c3af542 100644 --- a/test/cases/chunks/runtime/test.filter.js +++ b/test/cases/chunks/runtime/test.filter.js @@ -1,4 +1,3 @@ -module.exports = function (config) { +module.exports = config => // This test can't run in development mode as it depends on the flagIncludedChunks optimization - return config.mode !== "development"; -}; + config.mode !== "development"; diff --git a/test/cases/errors/case-sensitive/test.filter.js b/test/cases/errors/case-sensitive/test.filter.js index 001c5f0682f..1960f956b48 100644 --- a/test/cases/errors/case-sensitive/test.filter.js +++ b/test/cases/errors/case-sensitive/test.filter.js @@ -1,6 +1,4 @@ const fs = require("fs"); const path = require("path"); -module.exports = function (config) { - return fs.existsSync(path.join(__dirname, "TEST.FILTER.JS")); -}; +module.exports = () => fs.existsSync(path.join(__dirname, "TEST.FILTER.JS")); 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 b9bdf244d0d..138d995647f 100644 --- a/test/cases/inner-graph/class-dynamic-props/test.filter.js +++ b/test/cases/inner-graph/class-dynamic-props/test.filter.js @@ -1,5 +1,3 @@ const supportsClassFields = require("../../../helpers/supportsClassFields"); -module.exports = function (config) { - return 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 af5bacb6b77..23b06ffb2ff 100644 --- a/test/cases/inner-graph/extend-class/test.filter.js +++ b/test/cases/inner-graph/extend-class/test.filter.js @@ -1,5 +1,3 @@ const supportsClassStaticBlock = require("../../../helpers/supportsClassStaticBlock"); -module.exports = function (config) { - return 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 af5bacb6b77..23b06ffb2ff 100644 --- a/test/cases/inner-graph/extend-class2/test.filter.js +++ b/test/cases/inner-graph/extend-class2/test.filter.js @@ -1,5 +1,3 @@ const supportsClassStaticBlock = require("../../../helpers/supportsClassStaticBlock"); -module.exports = function (config) { - return supportsClassStaticBlock(); -}; +module.exports = () => supportsClassStaticBlock(); diff --git a/test/cases/large/big-assets/test.filter.js b/test/cases/large/big-assets/test.filter.js index 71a71e594ff..1338bc1e7b5 100644 --- a/test/cases/large/big-assets/test.filter.js +++ b/test/cases/large/big-assets/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return !process.env.CI; -}; +module.exports = () => !process.env.CI; diff --git a/test/cases/large/many-replacements/test.filter.js b/test/cases/large/many-replacements/test.filter.js index 71a71e594ff..1338bc1e7b5 100644 --- a/test/cases/large/many-replacements/test.filter.js +++ b/test/cases/large/many-replacements/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return !process.env.CI; -}; +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 7cc1b5dd3d5..294c39f26f3 100644 --- a/test/cases/loaders/_esm-loader-type/test.filter.js +++ b/test/cases/loaders/_esm-loader-type/test.filter.js @@ -1,5 +1,4 @@ -module.exports = function (config) { +module.exports = () => // TODO need fix in v8 https://github.com/nodejs/node/issues/35889 // TODO otherwise this test case cause segment fault - return false; -}; + false; diff --git a/test/cases/loaders/emit-file/test.filter.js b/test/cases/loaders/emit-file/test.filter.js index d957820f37a..e5009984cdb 100644 --- a/test/cases/loaders/emit-file/test.filter.js +++ b/test/cases/loaders/emit-file/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return !config.module; -}; +module.exports = config => !config.module; diff --git a/test/cases/mjs/namespace-object-lazy/test.filter.js b/test/cases/mjs/namespace-object-lazy/test.filter.js index ca08e60111d..43a2afb97bf 100644 --- a/test/cases/mjs/namespace-object-lazy/test.filter.js +++ b/test/cases/mjs/namespace-object-lazy/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return !config.minimize; -}; +module.exports = config => !config.minimize; diff --git a/test/cases/mjs/non-mjs-namespace-object-lazy/test.filter.js b/test/cases/mjs/non-mjs-namespace-object-lazy/test.filter.js index ca08e60111d..43a2afb97bf 100644 --- a/test/cases/mjs/non-mjs-namespace-object-lazy/test.filter.js +++ b/test/cases/mjs/non-mjs-namespace-object-lazy/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return !config.minimize; -}; +module.exports = config => !config.minimize; 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 49ac5066bb8..2d8fc7eb308 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,3 +1 @@ -module.exports = function (config) { - return config.mode !== "development"; -}; +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 49ac5066bb8..2d8fc7eb308 100644 --- a/test/cases/optimize/side-effects-all-used/test.filter.js +++ b/test/cases/optimize/side-effects-all-used/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return config.mode !== "development"; -}; +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 49ac5066bb8..2d8fc7eb308 100644 --- a/test/cases/optimize/side-effects-immediate-unused/test.filter.js +++ b/test/cases/optimize/side-effects-immediate-unused/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return config.mode !== "development"; -}; +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 49ac5066bb8..2d8fc7eb308 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,3 +1 @@ -module.exports = function (config) { - return config.mode !== "development"; -}; +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 49ac5066bb8..2d8fc7eb308 100644 --- a/test/cases/optimize/side-effects-root-unused/test.filter.js +++ b/test/cases/optimize/side-effects-root-unused/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return config.mode !== "development"; -}; +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 49ac5066bb8..2d8fc7eb308 100644 --- a/test/cases/optimize/side-effects-simple-unused/test.filter.js +++ b/test/cases/optimize/side-effects-simple-unused/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return config.mode !== "development"; -}; +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 49ac5066bb8..2d8fc7eb308 100644 --- a/test/cases/optimize/side-effects-transitive-unused/test.filter.js +++ b/test/cases/optimize/side-effects-transitive-unused/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return config.mode !== "development"; -}; +module.exports = config => config.mode !== "development"; diff --git a/test/cases/parsing/chunks/test.filter.js b/test/cases/parsing/chunks/test.filter.js index 9cf8a63f9b6..a5052b0500b 100644 --- a/test/cases/parsing/chunks/test.filter.js +++ b/test/cases/parsing/chunks/test.filter.js @@ -1,5 +1,3 @@ const supportsES6 = require("../../../helpers/supportsES6"); -module.exports = function (config) { - return 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 b9bdf244d0d..138d995647f 100644 --- a/test/cases/parsing/class-properties/test.filter.js +++ b/test/cases/parsing/class-properties/test.filter.js @@ -1,5 +1,3 @@ const supportsClassFields = require("../../../helpers/supportsClassFields"); -module.exports = function (config) { - return supportsClassFields(); -}; +module.exports = () => supportsClassFields(); diff --git a/test/cases/parsing/class/test.filter.js b/test/cases/parsing/class/test.filter.js index 9cf8a63f9b6..a5052b0500b 100644 --- a/test/cases/parsing/class/test.filter.js +++ b/test/cases/parsing/class/test.filter.js @@ -1,5 +1,3 @@ const supportsES6 = require("../../../helpers/supportsES6"); -module.exports = function (config) { - return 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 0fbdba4ea2d..6a3c5ad04bd 100644 --- a/test/cases/parsing/complex-require/test.filter.js +++ b/test/cases/parsing/complex-require/test.filter.js @@ -1,5 +1,3 @@ const supportsTemplateStrings = require("../../../helpers/supportsTemplateStrings"); -module.exports = function (config) { - return supportsTemplateStrings(); -}; +module.exports = () => supportsTemplateStrings(); diff --git a/test/cases/parsing/es2020/test.filter.js b/test/cases/parsing/es2020/test.filter.js index b9bdf244d0d..138d995647f 100644 --- a/test/cases/parsing/es2020/test.filter.js +++ b/test/cases/parsing/es2020/test.filter.js @@ -1,5 +1,3 @@ const supportsClassFields = require("../../../helpers/supportsClassFields"); -module.exports = function (config) { - return supportsClassFields(); -}; +module.exports = () => supportsClassFields(); diff --git a/test/cases/parsing/evaluate-nullish/test.filter.js b/test/cases/parsing/evaluate-nullish/test.filter.js index 90bebcad9fe..e1c1a296cd2 100644 --- a/test/cases/parsing/evaluate-nullish/test.filter.js +++ b/test/cases/parsing/evaluate-nullish/test.filter.js @@ -1,5 +1,3 @@ const supportsNullishCoalescing = require("../../../helpers/supportsNullishCoalescing"); -module.exports = function (config) { - return supportsNullishCoalescing(); -}; +module.exports = () => supportsNullishCoalescing(); diff --git a/test/cases/parsing/harmony-destructuring-assignment/test.filter.js b/test/cases/parsing/harmony-destructuring-assignment/test.filter.js index f176154b261..1c043701ad1 100644 --- a/test/cases/parsing/harmony-destructuring-assignment/test.filter.js +++ b/test/cases/parsing/harmony-destructuring-assignment/test.filter.js @@ -1,4 +1,3 @@ -module.exports = function (config) { +module.exports = config => // This test can't run in development mode - return config.mode !== "development"; -}; + config.mode !== "development"; diff --git a/test/cases/parsing/harmony-tdz/test.filter.js b/test/cases/parsing/harmony-tdz/test.filter.js index ca76a1f9b13..2781bd3aca3 100644 --- a/test/cases/parsing/harmony-tdz/test.filter.js +++ b/test/cases/parsing/harmony-tdz/test.filter.js @@ -1,5 +1,3 @@ const supportsBlockScoping = require("../../../helpers/supportsBlockScoping"); -module.exports = function (config) { - return supportsBlockScoping(); -}; +module.exports = () => supportsBlockScoping(); diff --git a/test/cases/parsing/iife/test.filter.js b/test/cases/parsing/iife/test.filter.js index ca1b2511b77..a05dab2a42b 100644 --- a/test/cases/parsing/iife/test.filter.js +++ b/test/cases/parsing/iife/test.filter.js @@ -1,4 +1,3 @@ -module.exports = function (config) { +module.exports = config => // TODO fails due to minimizer bug: https://github.com/terser/terser/issues/880 - return !config.minimize; -}; + !config.minimize; diff --git a/test/cases/parsing/issue-16763/test.filter.js b/test/cases/parsing/issue-16763/test.filter.js index af5bacb6b77..23b06ffb2ff 100644 --- a/test/cases/parsing/issue-16763/test.filter.js +++ b/test/cases/parsing/issue-16763/test.filter.js @@ -1,5 +1,3 @@ const supportsClassStaticBlock = require("../../../helpers/supportsClassStaticBlock"); -module.exports = function (config) { - return supportsClassStaticBlock(); -}; +module.exports = () => supportsClassStaticBlock(); diff --git a/test/cases/parsing/issue-2522/test.filter.js b/test/cases/parsing/issue-2522/test.filter.js index 9cf8a63f9b6..a5052b0500b 100644 --- a/test/cases/parsing/issue-2522/test.filter.js +++ b/test/cases/parsing/issue-2522/test.filter.js @@ -1,5 +1,3 @@ const supportsES6 = require("../../../helpers/supportsES6"); -module.exports = function (config) { - return 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 9cf8a63f9b6..a5052b0500b 100644 --- a/test/cases/parsing/issue-2523/test.filter.js +++ b/test/cases/parsing/issue-2523/test.filter.js @@ -1,5 +1,3 @@ const supportsES6 = require("../../../helpers/supportsES6"); -module.exports = function (config) { - return supportsES6(); -}; +module.exports = () => supportsES6(); diff --git a/test/cases/parsing/issue-2618/test.filter.js b/test/cases/parsing/issue-2618/test.filter.js index 9cf8a63f9b6..a5052b0500b 100644 --- a/test/cases/parsing/issue-2618/test.filter.js +++ b/test/cases/parsing/issue-2618/test.filter.js @@ -1,5 +1,3 @@ const supportsES6 = require("../../../helpers/supportsES6"); -module.exports = function (config) { - return 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 f9d5b096954..c7920056f0a 100644 --- a/test/cases/parsing/issue-2622/test.filter.js +++ b/test/cases/parsing/issue-2622/test.filter.js @@ -1,5 +1,3 @@ const supportsDefaultArgs = require("../../../helpers/supportsDefaultArgs"); -module.exports = function (config) { - return supportsDefaultArgs(); -}; +module.exports = () => supportsDefaultArgs(); diff --git a/test/cases/parsing/issue-2895/test.filter.js b/test/cases/parsing/issue-2895/test.filter.js index ca76a1f9b13..2781bd3aca3 100644 --- a/test/cases/parsing/issue-2895/test.filter.js +++ b/test/cases/parsing/issue-2895/test.filter.js @@ -1,5 +1,3 @@ const supportsBlockScoping = require("../../../helpers/supportsBlockScoping"); -module.exports = function (config) { - return 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 8de5703b50f..5fdfc3bfa75 100644 --- a/test/cases/parsing/issue-3238/test.filter.js +++ b/test/cases/parsing/issue-3238/test.filter.js @@ -1,5 +1,3 @@ const supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); -module.exports = function (config) { - return 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 c69e762d0d0..ac62718aa04 100644 --- a/test/cases/parsing/issue-3252/test.filter.js +++ b/test/cases/parsing/issue-3252/test.filter.js @@ -1,5 +1,3 @@ const supportsDefaultAssignment = require("../../../helpers/supportDefaultAssignment"); -module.exports = function (config) { - return supportsDefaultAssignment(); -}; +module.exports = () => supportsDefaultAssignment(); diff --git a/test/cases/parsing/issue-3273/test.filter.js b/test/cases/parsing/issue-3273/test.filter.js index 9732f4c201c..aba11ca2cec 100644 --- a/test/cases/parsing/issue-3273/test.filter.js +++ b/test/cases/parsing/issue-3273/test.filter.js @@ -1,6 +1,5 @@ const supportsDefaultAssignment = require("../../../helpers/supportDefaultAssignment"); const supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); -module.exports = function (config) { - return supportsDefaultAssignment() && supportsObjectDestructuring(); -}; +module.exports = () => + supportsDefaultAssignment() && supportsObjectDestructuring(); diff --git a/test/cases/parsing/issue-4357/test.filter.js b/test/cases/parsing/issue-4357/test.filter.js index 79d4c70e76f..c101b0f8aca 100644 --- a/test/cases/parsing/issue-4357/test.filter.js +++ b/test/cases/parsing/issue-4357/test.filter.js @@ -1,6 +1,5 @@ const supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); const supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); -module.exports = function (config) { - return supportsIteratorDestructuring() && supportsObjectDestructuring(); -}; +module.exports = () => + supportsIteratorDestructuring() && 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 d957820f37a..e5009984cdb 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,3 +1 @@ -module.exports = function (config) { - return !config.module; -}; +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 752ae650e17..4e356f55416 100644 --- a/test/cases/parsing/issue-4608-2/test.filter.js +++ b/test/cases/parsing/issue-4608-2/test.filter.js @@ -1,5 +1,3 @@ const supportsForOf = require("../../../helpers/supportsForOf"); -module.exports = function (config) { - return 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 a78e1dd9f14..d049615837b 100644 --- a/test/cases/parsing/issue-4870/test.filter.js +++ b/test/cases/parsing/issue-4870/test.filter.js @@ -1,6 +1,5 @@ const supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); const supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); -module.exports = function (config) { - return supportsObjectDestructuring() && supportsIteratorDestructuring(); -}; +module.exports = () => + supportsObjectDestructuring() && supportsIteratorDestructuring(); diff --git a/test/cases/parsing/issue-7519/test.filter.js b/test/cases/parsing/issue-7519/test.filter.js index 49ac5066bb8..2d8fc7eb308 100644 --- a/test/cases/parsing/issue-7519/test.filter.js +++ b/test/cases/parsing/issue-7519/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return config.mode !== "development"; -}; +module.exports = config => config.mode !== "development"; diff --git a/test/cases/parsing/logical-assignment/test.filter.js b/test/cases/parsing/logical-assignment/test.filter.js index d9ee25da85e..1cf3a4f5cd7 100644 --- a/test/cases/parsing/logical-assignment/test.filter.js +++ b/test/cases/parsing/logical-assignment/test.filter.js @@ -1,5 +1,3 @@ const supportsLogicalAssignment = require("../../../helpers/supportsLogicalAssignment"); -module.exports = function (config) { - return supportsLogicalAssignment(); -}; +module.exports = () => supportsLogicalAssignment(); diff --git a/test/cases/parsing/nullish-coalescing/test.filter.js b/test/cases/parsing/nullish-coalescing/test.filter.js index 90bebcad9fe..e1c1a296cd2 100644 --- a/test/cases/parsing/nullish-coalescing/test.filter.js +++ b/test/cases/parsing/nullish-coalescing/test.filter.js @@ -1,5 +1,3 @@ const supportsNullishCoalescing = require("../../../helpers/supportsNullishCoalescing"); -module.exports = function (config) { - return 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 5e7d911be6e..2ece0f3a34c 100644 --- a/test/cases/parsing/optional-catch-binding/test.filter.js +++ b/test/cases/parsing/optional-catch-binding/test.filter.js @@ -1,6 +1,6 @@ const supportsOptionalCatchBinding = require("../../../helpers/supportsOptionalCatchBinding"); -module.exports = function (config) { +module.exports = config => { // XXX: Disable this test if Terser is used because it does not support ES 2019 if (config.mode === "production") { return false; diff --git a/test/cases/parsing/optional-chaining/test.filter.js b/test/cases/parsing/optional-chaining/test.filter.js index a5caf1901f1..dc7c6d6b814 100644 --- a/test/cases/parsing/optional-chaining/test.filter.js +++ b/test/cases/parsing/optional-chaining/test.filter.js @@ -1,5 +1,3 @@ const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); -module.exports = function (config) { - return !config.minimize && supportsOptionalChaining(); -}; +module.exports = config => !config.minimize && supportsOptionalChaining(); diff --git a/test/cases/parsing/spread/test.filter.js b/test/cases/parsing/spread/test.filter.js index 499ddd1ca43..a0dcbdf7dde 100644 --- a/test/cases/parsing/spread/test.filter.js +++ b/test/cases/parsing/spread/test.filter.js @@ -1,5 +1,3 @@ const supportsSpread = require("../../../helpers/supportsSpread"); -module.exports = function (config) { - return 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 d957820f37a..e5009984cdb 100644 --- a/test/cases/parsing/typeof-non-module/test.filter.js +++ b/test/cases/parsing/typeof-non-module/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return !config.module; -}; +module.exports = config => !config.module; diff --git a/test/cases/parsing/using/test.filter.js b/test/cases/parsing/using/test.filter.js index 62f7583d1ab..8707b455f60 100644 --- a/test/cases/parsing/using/test.filter.js +++ b/test/cases/parsing/using/test.filter.js @@ -1,6 +1,6 @@ const supportsUsing = require("../../../helpers/supportsUsing"); -module.exports = function (config) { +module.exports = config => { // TODO https://github.com/terser/terser/issues/1625 if (config.minimize) { return false; diff --git a/test/cases/scope-hoisting/inside-class/test.filter.js b/test/cases/scope-hoisting/inside-class/test.filter.js index 9cf8a63f9b6..a5052b0500b 100644 --- a/test/cases/scope-hoisting/inside-class/test.filter.js +++ b/test/cases/scope-hoisting/inside-class/test.filter.js @@ -1,5 +1,3 @@ const supportsES6 = require("../../../helpers/supportsES6"); -module.exports = function (config) { - return supportsES6(); -}; +module.exports = () => supportsES6(); 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 c7989392ead..0bf5d06ceec 100644 --- a/test/cases/scope-hoisting/renaming-shorthand-5027/test.filter.js +++ b/test/cases/scope-hoisting/renaming-shorthand-5027/test.filter.js @@ -1,14 +1,11 @@ -const supportsES6 = require("../../../helpers/supportsES6"); const supportDefaultAssignment = require("../../../helpers/supportDefaultAssignment"); -const supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); +const supportsES6 = require("../../../helpers/supportsES6"); const supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); +const supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); -module.exports = function (config) { - return ( - !config.minimize && - supportsES6() && - supportDefaultAssignment() && - supportsObjectDestructuring() && - supportsIteratorDestructuring() - ); -}; +module.exports = config => + !config.minimize && + supportsES6() && + supportDefaultAssignment() && + supportsObjectDestructuring() && + supportsIteratorDestructuring(); diff --git a/test/cases/side-effects/issue-11673/test.filter.js b/test/cases/side-effects/issue-11673/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/cases/side-effects/issue-11673/test.filter.js +++ b/test/cases/side-effects/issue-11673/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/cases/wasm/decoding/test.filter.js b/test/cases/wasm/decoding/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/decoding/test.filter.js +++ b/test/cases/wasm/decoding/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/export-imported-global/test.filter.js +++ b/test/cases/wasm/export-imported-global/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/finalize-exports-issue-8261/test.filter.js +++ b/test/cases/wasm/finalize-exports-issue-8261/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/global-refs-imported-global/test.filter.js +++ b/test/cases/wasm/global-refs-imported-global/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/import-wasm-wasm/test.filter.js +++ b/test/cases/wasm/import-wasm-wasm/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/imported-global-preserve-ordering/test.filter.js +++ b/test/cases/wasm/imported-global-preserve-ordering/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/imported-global-preserve-type/test.filter.js +++ b/test/cases/wasm/imported-global-preserve-type/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/imports-circular/test.filter.js +++ b/test/cases/wasm/imports-circular/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 d8ad45ba057..b432d673632 100644 --- a/test/cases/wasm/imports-complex-types/test.filter.js +++ b/test/cases/wasm/imports-complex-types/test.filter.js @@ -1,5 +1,3 @@ const supports = require("webassembly-feature"); -module.exports = function (config) { - return supports.simd(); -}; +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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/imports-many-direct/test.filter.js +++ b/test/cases/wasm/imports-many-direct/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/imports-multiple/test.filter.js +++ b/test/cases/wasm/imports-multiple/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/imports/test.filter.js b/test/cases/wasm/imports/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/imports/test.filter.js +++ b/test/cases/wasm/imports/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/memory/test.filter.js b/test/cases/wasm/memory/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/memory/test.filter.js +++ b/test/cases/wasm/memory/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/order/test.filter.js b/test/cases/wasm/order/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/order/test.filter.js +++ b/test/cases/wasm/order/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/simple/test.filter.js b/test/cases/wasm/simple/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/simple/test.filter.js +++ b/test/cases/wasm/simple/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/table/test.filter.js b/test/cases/wasm/table/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/table/test.filter.js +++ b/test/cases/wasm/table/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/two-files-loader/test.filter.js +++ b/test/cases/wasm/two-files-loader/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/unused-export/test.filter.js +++ b/test/cases/wasm/unused-export/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/cases/wasm/v128/test.filter.js b/test/cases/wasm/v128/test.filter.js index a4c4664b2ea..35ea01d79ff 100644 --- a/test/cases/wasm/v128/test.filter.js +++ b/test/cases/wasm/v128/test.filter.js @@ -1,8 +1,7 @@ // const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); // const supportsFeature = require("webassembly-feature"); -module.exports = function (config) { +module.exports = () => // TODO fails with CompileError: WebAssembly.instantiate(): Compiling function #0 failed: memory instruction with no memory @+24 - return false; // return supportsWebAssembly() && supportsFeature.simd(); -}; + false; 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/wasm-explorer-examples-async/test.filter.js +++ b/test/cases/wasm/wasm-explorer-examples-async/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return 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 cb37e21905f..8f89b2fa4b7 100644 --- a/test/cases/wasm/wasm-explorer-examples-sync/test.filter.js +++ b/test/cases/wasm/wasm-explorer-examples-sync/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/checkArrayExpectation.js b/test/checkArrayExpectation.js index d304170849f..0b93c73fb54 100644 --- a/test/checkArrayExpectation.js +++ b/test/checkArrayExpectation.js @@ -1,7 +1,7 @@ "use strict"; -const fs = require("graceful-fs"); const path = require("path"); +const fs = require("graceful-fs"); const check = (expected, actual) => { if (expected instanceof RegExp) { @@ -39,8 +39,8 @@ const explain = object => { }; const diffItems = (actual, expected, kind) => { - const tooMuch = actual.slice(); - const missing = expected.slice(); + const tooMuch = [...actual]; + const missing = [...expected]; for (let i = 0; i < missing.length; i++) { const current = missing[i]; for (let j = 0; j < tooMuch.length; j++) { diff --git a/test/cleverMerge.unittest.js b/test/cleverMerge.unittest.js index 2aa991f786f..aed81f57f5e 100644 --- a/test/cleverMerge.unittest.js +++ b/test/cleverMerge.unittest.js @@ -1,11 +1,11 @@ "use strict"; const { - cleverMerge, DELETE, + cachedCleverMerge, + cleverMerge, removeOperations, - resolveByProperty, - cachedCleverMerge + resolveByProperty } = require("../lib/util/cleverMerge"); describe("cleverMerge", () => { diff --git a/test/configCases/asset-emitted/normal/webpack.config.js b/test/configCases/asset-emitted/normal/webpack.config.js index 11df5e9a701..dcf5bbbce3b 100644 --- a/test/configCases/asset-emitted/normal/webpack.config.js +++ b/test/configCases/asset-emitted/normal/webpack.config.js @@ -1,5 +1,5 @@ -const Compilation = require("../../../../").Compilation; const Source = require("webpack-sources").Source; +const Compilation = require("../../../../").Compilation; /** @type {import("../../../../").Configuration} */ module.exports = { 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 72c90f6c7f5..1a07a7561c5 100644 --- a/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js +++ b/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js @@ -1,5 +1,5 @@ -const path = require("path"); const fs = require("fs"); +const path = require("path"); const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/asset-modules/global-options/webpack.config.js b/test/configCases/asset-modules/global-options/webpack.config.js index ca65a9b6839..5c9aaa2cec5 100644 --- a/test/configCases/asset-modules/global-options/webpack.config.js +++ b/test/configCases/asset-modules/global-options/webpack.config.js @@ -1,5 +1,5 @@ -const svgToMiniDataURI = require("mini-svg-data-uri"); const mimeTypes = require("mime-types"); +const svgToMiniDataURI = require("mini-svg-data-uri"); /** @type {import("../../../../").Configuration} */ module.exports = { diff --git a/test/configCases/asset-modules/only-entry/webpack.config.js b/test/configCases/asset-modules/only-entry/webpack.config.js index e823ba3b3de..f196e1dee13 100644 --- a/test/configCases/asset-modules/only-entry/webpack.config.js +++ b/test/configCases/asset-modules/only-entry/webpack.config.js @@ -1,5 +1,5 @@ -const path = require("path"); const fs = require("fs"); +const path = require("path"); const webpack = require("../../../../"); /** @typedef {import("../../../../").Configuration} 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 d478d4929ac..1c22670e597 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,5 +1,5 @@ -const svgToMiniDataURI = require("mini-svg-data-uri"); const mimeTypes = require("mime-types"); +const svgToMiniDataURI = require("mini-svg-data-uri"); /** @typedef {import("../../../../").GeneratorOptionsByModuleTypeKnown} GeneratorOptionsByModuleTypeKnown */ diff --git a/test/configCases/assets/delete-asset/webpack.config.js b/test/configCases/assets/delete-asset/webpack.config.js index e66151b3d36..a0038acc014 100644 --- a/test/configCases/assets/delete-asset/webpack.config.js +++ b/test/configCases/assets/delete-asset/webpack.config.js @@ -1,5 +1,5 @@ -const { Compilation, BannerPlugin } = require("../../../../"); const TerserPlugin = require("terser-webpack-plugin"); +const { BannerPlugin, Compilation } = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { 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 cb37e21905f..8f89b2fa4b7 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,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); 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 b9132adacad..bbf2fa59a9f 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 @@ -8,7 +8,7 @@ module.exports = { plugins: [ compiler => { compiler.hooks.done.tap("Test", ({ compilation }) => { - const fileDeps = Array.from(compilation.fileDependencies); + const fileDeps = [...compilation.fileDependencies]; expect(fileDeps).toContain( path.resolve(__dirname, "node_modules/package/index.js") ); diff --git a/test/configCases/cache-dependencies/managed-items/webpack.config.js b/test/configCases/cache-dependencies/managed-items/webpack.config.js index e79abba3493..bf1482c73d9 100644 --- a/test/configCases/cache-dependencies/managed-items/webpack.config.js +++ b/test/configCases/cache-dependencies/managed-items/webpack.config.js @@ -8,7 +8,7 @@ module.exports = { plugins: [ compiler => { compiler.hooks.done.tap("Test", ({ compilation }) => { - const fileDeps = Array.from(compilation.fileDependencies); + const fileDeps = [...compilation.fileDependencies]; expect(fileDeps).toContain( path.resolve(__dirname, "node_modules/package/index.js") ); diff --git a/test/configCases/chunk-index/issue-18008/webpack.config.js b/test/configCases/chunk-index/issue-18008/webpack.config.js index f066baaf7ed..890cee2949f 100644 --- a/test/configCases/chunk-index/issue-18008/webpack.config.js +++ b/test/configCases/chunk-index/issue-18008/webpack.config.js @@ -13,7 +13,7 @@ module.exports = { chunkIds: "named" }, plugins: [ - function () { + function apply() { /** * @param {Compilation} compilation compilation * @returns {void} @@ -35,9 +35,7 @@ module.exports = { } } } - const sortedModules = Array.from(modules).sort( - (a, b) => a[1] - b[1] - ); + const sortedModules = [...modules].sort((a, b) => a[1] - b[1]); const text = sortedModules .map( ([m, index]) => 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 112fa65a2fd..78db29f493f 100644 --- a/test/configCases/chunk-index/order-multiple-entries/webpack.config.js +++ b/test/configCases/chunk-index/order-multiple-entries/webpack.config.js @@ -14,7 +14,7 @@ module.exports = { concatenateModules: false }, plugins: [ - function () { + function apply() { /** * @param {Compilation} compilation compilation * @returns {void} @@ -43,12 +43,8 @@ module.exports = { } } } - const sortedModules = Array.from(modules).sort( - (a, b) => a[1] - b[1] - ); - const sortedModules2 = Array.from(modules2).sort( - (a, b) => a[1] - b[1] - ); + const sortedModules = [...modules].sort((a, b) => a[1] - b[1]); + const sortedModules2 = [...modules2].sort((a, b) => a[1] - b[1]); const text = sortedModules .map( ([m, index]) => @@ -80,7 +76,7 @@ module.exports = { asyncIndex: "0: ./async.js", asyncIndex2: "0: ./async.js" }); - const indices = Array.from(compilation.modules) + const indices = [...compilation.modules] .map( m => /** @type {[number, Module]} */ ([ @@ -95,7 +91,7 @@ module.exports = { `${i}: ${m.readableIdentifier(compilation.requestShortener)}` ) .join(", "); - const indices2 = Array.from(compilation.modules) + const indices2 = [...compilation.modules] .map( m => /** @type {[number, Module]} */ ([ diff --git a/test/configCases/chunk-index/recalc-index/webpack.config.js b/test/configCases/chunk-index/recalc-index/webpack.config.js index ea9ef52d7db..5dd70bdad07 100644 --- a/test/configCases/chunk-index/recalc-index/webpack.config.js +++ b/test/configCases/chunk-index/recalc-index/webpack.config.js @@ -9,7 +9,7 @@ module.exports = { css: true }, plugins: [ - function () { + function apply() { /** * @param {Compilation} compilation compilation * @returns {void} @@ -31,9 +31,7 @@ module.exports = { } } } - const sortedModules = Array.from(modules).sort( - (a, b) => a[1] - b[1] - ); + const sortedModules = [...modules].sort((a, b) => a[1] - b[1]); const text = sortedModules .map( ([m, index]) => diff --git a/test/configCases/clean/ignore-hook/webpack.config.js b/test/configCases/clean/ignore-hook/webpack.config.js index 312874b4f4d..64bd3efded8 100644 --- a/test/configCases/clean/ignore-hook/webpack.config.js +++ b/test/configCases/clean/ignore-hook/webpack.config.js @@ -1,7 +1,7 @@ const fs = require("fs"); const path = require("path"); -const webpack = require("../../../../"); const { RawSource } = require("webpack-sources"); +const webpack = require("../../../../"); const readDir = require("../enabled/readdir"); /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/clean/lib-manifest-plugin/webpack.config.js b/test/configCases/clean/lib-manifest-plugin/webpack.config.js index 0efe44f4d54..fac31f113ce 100644 --- a/test/configCases/clean/lib-manifest-plugin/webpack.config.js +++ b/test/configCases/clean/lib-manifest-plugin/webpack.config.js @@ -1,6 +1,6 @@ const path = require("path"); -const readDir = require("./readdir"); const webpack = require("../../../../"); +const readDir = require("./readdir"); /** @type {import("../../../../").Configuration} */ module.exports = { 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 846093ba9cf..9486c09cf37 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,5 +1,3 @@ const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); -module.exports = function (config) { - return supportsOptionalChaining(); -}; +module.exports = () => supportsOptionalChaining(); 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 846093ba9cf..9486c09cf37 100644 --- a/test/configCases/code-generation/re-export-namespace/test.filter.js +++ b/test/configCases/code-generation/re-export-namespace/test.filter.js @@ -1,5 +1,3 @@ const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); -module.exports = function (config) { - return supportsOptionalChaining(); -}; +module.exports = () => supportsOptionalChaining(); diff --git a/test/configCases/container/0-eager-shared/webpack.config.js b/test/configCases/container/0-eager-shared/webpack.config.js index f50ceb49734..c01af235fd3 100644 --- a/test/configCases/container/0-eager-shared/webpack.config.js +++ b/test/configCases/container/0-eager-shared/webpack.config.js @@ -1,5 +1,5 @@ -const { dependencies } = require("./package.json"); const { ModuleFederationPlugin } = require("../../../../").container; +const { dependencies } = require("./package.json"); /** @type {import("../../../../").Configuration} */ module.exports = { diff --git a/test/configCases/container/eager-shared/webpack.config.js b/test/configCases/container/eager-shared/webpack.config.js index 0d31eaeb68c..c73f3ade6b0 100644 --- a/test/configCases/container/eager-shared/webpack.config.js +++ b/test/configCases/container/eager-shared/webpack.config.js @@ -1,5 +1,5 @@ -const { dependencies } = require("./package.json"); const { ModuleFederationPlugin } = require("../../../../").container; +const { dependencies } = require("./package.json"); /** @type {import("../../../../").Configuration} */ module.exports = { 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 fdd7f26ad01..6bc17b0232d 100644 --- a/test/configCases/css/css-modules-broken-keyframes/webpack.config.js +++ b/test/configCases/css/css-modules-broken-keyframes/webpack.config.js @@ -1,5 +1,5 @@ -const webpack = require("../../../../"); const path = require("path"); +const webpack = require("../../../../"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration} */ module.exports = (env, { testPath }) => ({ diff --git a/test/configCases/css/css-modules/webpack.config.js b/test/configCases/css/css-modules/webpack.config.js index 03231e71559..c9070ea0cd1 100644 --- a/test/configCases/css/css-modules/webpack.config.js +++ b/test/configCases/css/css-modules/webpack.config.js @@ -1,5 +1,5 @@ -const webpack = require("../../../../"); const path = require("path"); +const webpack = require("../../../../"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration[]} */ module.exports = (env, { testPath }) => [ 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 020b694bc7f..4092e96c704 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,5 +1,5 @@ -const path = require("path"); const fs = require("fs"); +const path = require("path"); const webpack = require("../../../../"); /** diff --git a/test/configCases/css/universal/test.filter.js b/test/configCases/css/universal/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/css/universal/test.filter.js +++ b/test/configCases/css/universal/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/custom-source-type/localization/webpack.config.js b/test/configCases/custom-source-type/localization/webpack.config.js index 24125460f83..36ae26ec2d4 100644 --- a/test/configCases/custom-source-type/localization/webpack.config.js +++ b/test/configCases/custom-source-type/localization/webpack.config.js @@ -74,6 +74,7 @@ ${RuntimeGlobals.ensureChunkHandlers}.localization = (chunkId, promises) => { */ const definitions = ["node", "async-node", "web"].reduce( (arr, target) => + // eslint-disable-next-line unicorn/prefer-spread arr.concat([ { TARGET: JSON.stringify(target), 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 8916117ccfb..02610e9e203 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 @@ -9,7 +9,7 @@ module.exports = { sideEffects: false }, plugins: [ - function () { + function apply() { this.hooks.compilation.tap( "Test", /** 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 188de505ba6..1981cb7a086 100644 --- a/test/configCases/deep-scope-analysis/remove-export/webpack.config.js +++ b/test/configCases/deep-scope-analysis/remove-export/webpack.config.js @@ -9,7 +9,7 @@ module.exports = { sideEffects: false }, plugins: [ - function () { + function apply() { this.hooks.compilation.tap("Test", compilation => { compilation.hooks.dependencyReferencedExports.tap( "Test", diff --git a/test/configCases/deprecations/chunk-and-module/webpack.config.js b/test/configCases/deprecations/chunk-and-module/webpack.config.js index e6f03305abe..c54ee01fe4c 100644 --- a/test/configCases/deprecations/chunk-and-module/webpack.config.js +++ b/test/configCases/deprecations/chunk-and-module/webpack.config.js @@ -70,7 +70,7 @@ module.exports = { expect(m.isEntryModule()).toBe(true); expect(m.getChunks()).toEqual([chunk]); expect(m.getNumberOfChunks()).toBe(1); - expect(Array.from(m.chunksIterable)).toEqual([chunk]); + expect([...m.chunksIterable]).toEqual([chunk]); expect(m.isProvided("testExport")).toBe(true); expect(m.isProvided("otherExport")).toBe(false); } diff --git a/test/configCases/deprecations/chunk-files/webpack.config.js b/test/configCases/deprecations/chunk-files/webpack.config.js index 13381c8085b..8d34f674457 100644 --- a/test/configCases/deprecations/chunk-files/webpack.config.js +++ b/test/configCases/deprecations/chunk-files/webpack.config.js @@ -9,8 +9,8 @@ module.exports = { c ); expect(chunk.files).toHaveLength(chunk.files.size); - expect(chunk.files[0]).toBe(Array.from(chunk.files)[0]); - expect(chunk.files.join(",")).toBe(Array.from(chunk.files).join(",")); + expect(chunk.files[0]).toBe([...chunk.files][0]); + expect(chunk.files.join(",")).toBe([...chunk.files].join(",")); expect(() => (chunk.files.length = 0)).toThrow( /chunk\.files was changed from Array to Set \(writing to Array property 'length' is not possible\)/ ); diff --git a/test/configCases/deprecations/invalid-dependencies/webpack.config.js b/test/configCases/deprecations/invalid-dependencies/webpack.config.js index 5a8344b421c..3722875d8ce 100644 --- a/test/configCases/deprecations/invalid-dependencies/webpack.config.js +++ b/test/configCases/deprecations/invalid-dependencies/webpack.config.js @@ -1,5 +1,5 @@ -const webpack = require("../../../../"); const path = require("path"); +const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { @@ -25,21 +25,21 @@ module.exports = { missingDeps, buildDeps ); - expect(Array.from(fileDeps).sort()).toEqual([ + expect([...fileDeps].sort()).toEqual([ path.join(__dirname, "index.js"), path.join(__dirname, "loader.js") ]); - expect(Array.from(contextDeps).sort()).toEqual([ + expect([...contextDeps].sort()).toEqual([ path.join(__dirname, ".."), __dirname ]); - expect(Array.from(missingDeps).sort()).toEqual([ + expect([...missingDeps].sort()).toEqual([ path.join(__dirname, "missing1.js"), path.join(__dirname, "missing2.js"), path.join(__dirname, "missing3.js"), path.join(__dirname, "missing4.js") ]); - expect(Array.from(fileDeps).sort()).toEqual([ + expect([...fileDeps].sort()).toEqual([ path.join(__dirname, "index.js"), path.join(__dirname, "loader.js") ]); diff --git a/test/configCases/entry/depend-on-advanced/webpack.config.js b/test/configCases/entry/depend-on-advanced/webpack.config.js index 7212cf3a429..f503e4e83f0 100644 --- a/test/configCases/entry/depend-on-advanced/webpack.config.js +++ b/test/configCases/entry/depend-on-advanced/webpack.config.js @@ -27,7 +27,7 @@ module.exports = { /** * @this {Compiler} compiler */ - function () { + function apply() { /** * @param {Compilation} compilation compilation * @returns {void} diff --git a/test/configCases/entry/depend-on-simple/webpack.config.js b/test/configCases/entry/depend-on-simple/webpack.config.js index 7fc599a4e42..d8f6017e1d8 100644 --- a/test/configCases/entry/depend-on-simple/webpack.config.js +++ b/test/configCases/entry/depend-on-simple/webpack.config.js @@ -17,7 +17,7 @@ module.exports = { /** * @this {Compiler} compiler */ - function () { + function apply() { /** * @param {Compilation} compilation compilation * @returns {void} diff --git a/test/configCases/errors/generator-generate-error/test.filter.js b/test/configCases/errors/generator-generate-error/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/configCases/errors/generator-generate-error/test.filter.js +++ b/test/configCases/errors/generator-generate-error/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/externals/import-assertion/webpack.config.js b/test/configCases/externals/import-assertion/webpack.config.js index 7ac26d2244e..b73df70a503 100644 --- a/test/configCases/externals/import-assertion/webpack.config.js +++ b/test/configCases/externals/import-assertion/webpack.config.js @@ -1,5 +1,5 @@ -const path = require("path"); const fs = require("fs"); +const path = require("path"); const { Compilation, sources: { RawSource } diff --git a/test/configCases/externals/import-attributes/webpack.config.js b/test/configCases/externals/import-attributes/webpack.config.js index 7ac26d2244e..b73df70a503 100644 --- a/test/configCases/externals/import-attributes/webpack.config.js +++ b/test/configCases/externals/import-attributes/webpack.config.js @@ -1,5 +1,5 @@ -const path = require("path"); const fs = require("fs"); +const path = require("path"); const { Compilation, sources: { RawSource } diff --git a/test/configCases/externals/module-import/webpack.config.js b/test/configCases/externals/module-import/webpack.config.js index 3758c82bf74..66c1a65ad6e 100644 --- a/test/configCases/externals/module-import/webpack.config.js +++ b/test/configCases/externals/module-import/webpack.config.js @@ -21,7 +21,7 @@ module.exports = { }, externalsType: "module-import", externals: [ - function ( + function externals( { context, request, contextInfo, getResolve, dependencyType }, callback ) { diff --git a/test/configCases/inner-graph/class/test.filter.js b/test/configCases/inner-graph/class/test.filter.js index b9bdf244d0d..138d995647f 100644 --- a/test/configCases/inner-graph/class/test.filter.js +++ b/test/configCases/inner-graph/class/test.filter.js @@ -1,5 +1,3 @@ const supportsClassFields = require("../../../helpers/supportsClassFields"); -module.exports = function (config) { - return supportsClassFields(); -}; +module.exports = () => supportsClassFields(); diff --git a/test/configCases/inner-graph/issue-17565/test.filter.js b/test/configCases/inner-graph/issue-17565/test.filter.js index b9bdf244d0d..138d995647f 100644 --- a/test/configCases/inner-graph/issue-17565/test.filter.js +++ b/test/configCases/inner-graph/issue-17565/test.filter.js @@ -1,5 +1,3 @@ const supportsClassFields = require("../../../helpers/supportsClassFields"); -module.exports = function (config) { - return supportsClassFields(); -}; +module.exports = () => supportsClassFields(); diff --git a/test/configCases/issues/issue-14974/test.filter.js b/test/configCases/issues/issue-14974/test.filter.js index c223174f266..e4bb7db300b 100644 --- a/test/configCases/issues/issue-14974/test.filter.js +++ b/test/configCases/issues/issue-14974/test.filter.js @@ -1,3 +1 @@ -module.exports = function () { - return process.version.slice(0, 4) !== "v10."; -}; +module.exports = () => process.version.slice(0, 4) !== "v10."; diff --git a/test/configCases/issues/issue-3596/webpack.config.js b/test/configCases/issues/issue-3596/webpack.config.js index c2d76a5e05d..614835822ad 100644 --- a/test/configCases/issues/issue-3596/webpack.config.js +++ b/test/configCases/issues/issue-3596/webpack.config.js @@ -8,7 +8,7 @@ module.exports = { filename: "[name].js" }, plugins: [ - function () { + function apply() { this.hooks.compilation.tap("TestPlugin", compilation => { compilation.hooks.processAssets.tap("TestPlugin", assets => { delete compilation.assets["b.js"]; diff --git a/test/configCases/library/1-use-library/webpack.config.js b/test/configCases/library/1-use-library/webpack.config.js index febe3417ec3..6e6b2665e83 100644 --- a/test/configCases/library/1-use-library/webpack.config.js +++ b/test/configCases/library/1-use-library/webpack.config.js @@ -1,8 +1,8 @@ /** @typedef {import("../../../../").Compiler} Compiler */ /** @typedef {import("../../../../").Compilation} Compilation */ -const webpack = require("../../../../"); const path = require("path"); +const webpack = require("../../../../"); const supportsAsync = require("../../../helpers/supportsAsync"); /** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration[]} */ @@ -24,7 +24,7 @@ module.exports = (env, { testPath }) => [ /** * @this {Compiler} compiler */ - function () { + function apply() { /** * @param {Compilation} compilation compilation * @returns {void} diff --git a/test/configCases/library/module-reexport-external/webpack.config.js b/test/configCases/library/module-reexport-external/webpack.config.js index 1b960bf65e9..53abd054ebb 100644 --- a/test/configCases/library/module-reexport-external/webpack.config.js +++ b/test/configCases/library/module-reexport-external/webpack.config.js @@ -24,7 +24,7 @@ module.exports = { concatenateModules: true }, plugins: [ - function () { + function apply() { /** * @param {Compilation} compilation compilation */ diff --git a/test/configCases/library/module-reexport-type/test.filter.js b/test/configCases/library/module-reexport-type/test.filter.js index 846093ba9cf..9486c09cf37 100644 --- a/test/configCases/library/module-reexport-type/test.filter.js +++ b/test/configCases/library/module-reexport-type/test.filter.js @@ -1,5 +1,3 @@ const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); -module.exports = function (config) { - return 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 063b61b5338..ed134a4c227 100644 --- a/test/configCases/library/module-reexport-type/webpack.config.js +++ b/test/configCases/library/module-reexport-type/webpack.config.js @@ -45,7 +45,7 @@ module.exports = { ] }, plugins: [ - function () { + function apply() { /** * @param {Compilation} compilation compilation */ diff --git a/test/configCases/node/prefix-in-runtime/test.filter.js b/test/configCases/node/prefix-in-runtime/test.filter.js index ce19d8618ed..30573896be1 100644 --- a/test/configCases/node/prefix-in-runtime/test.filter.js +++ b/test/configCases/node/prefix-in-runtime/test.filter.js @@ -1,3 +1 @@ -module.exports = function () { - return !process.version.startsWith("v10."); -}; +module.exports = () => !process.version.startsWith("v10."); diff --git a/test/configCases/optimization/minimizer/webpack.config.js b/test/configCases/optimization/minimizer/webpack.config.js index e15c2ba44ea..554aca05538 100644 --- a/test/configCases/optimization/minimizer/webpack.config.js +++ b/test/configCases/optimization/minimizer/webpack.config.js @@ -17,7 +17,7 @@ module.exports = { * @this {Compiler} the compiler * @param {Compiler} compiler the compiler */ - function (compiler) { + function apply(compiler) { expect(compiler).toBe(this); expect(compiler).toBeInstanceOf(Compiler); } diff --git a/test/configCases/output/worker-public-path/test.filter.js b/test/configCases/output/worker-public-path/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/output/worker-public-path/test.filter.js +++ b/test/configCases/output/worker-public-path/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/parsing/dead-code-elimination/webpack.config.js b/test/configCases/parsing/dead-code-elimination/webpack.config.js index 34bd27d45b3..e99e2537c8b 100644 --- a/test/configCases/parsing/dead-code-elimination/webpack.config.js +++ b/test/configCases/parsing/dead-code-elimination/webpack.config.js @@ -1,5 +1,5 @@ -const path = require("path"); const fs = require("fs"); +const path = require("path"); const webpack = require("../../../../"); /** @type {import("../../../../").Configuration[]} */ diff --git a/test/configCases/parsing/optional-chaining/test.filter.js b/test/configCases/parsing/optional-chaining/test.filter.js index 846093ba9cf..9486c09cf37 100644 --- a/test/configCases/parsing/optional-chaining/test.filter.js +++ b/test/configCases/parsing/optional-chaining/test.filter.js @@ -1,5 +1,3 @@ const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); -module.exports = function (config) { - return supportsOptionalChaining(); -}; +module.exports = () => supportsOptionalChaining(); diff --git a/test/configCases/plugins/profiling-plugin/test.filter.js b/test/configCases/plugins/profiling-plugin/test.filter.js index 71a71e594ff..1338bc1e7b5 100644 --- a/test/configCases/plugins/profiling-plugin/test.filter.js +++ b/test/configCases/plugins/profiling-plugin/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return !process.env.CI; -}; +module.exports = () => !process.env.CI; 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 3fa7647084c..8abc9602236 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,5 +1,5 @@ -const webpack = require("../../../../"); const TerserPlugin = require("terser-webpack-plugin"); +const webpack = require("../../../../"); /** @type {import("../../../../types").Configuration} */ module.exports = { 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 ffc668c913c..6ca950d3ffe 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,5 +1,5 @@ -const webpack = require("../../../../"); const TerserPlugin = require("terser-webpack-plugin"); +const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { 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 cb171e7af4d..b230e682bbb 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,5 +1,5 @@ -const webpack = require("../../../../"); const TerserPlugin = require("terser-webpack-plugin"); +const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { diff --git a/test/configCases/race-conditions/import-module/test.filter.js b/test/configCases/race-conditions/import-module/test.filter.js index cfa30cb56d3..daa2b101298 100644 --- a/test/configCases/race-conditions/import-module/test.filter.js +++ b/test/configCases/race-conditions/import-module/test.filter.js @@ -1,4 +1,4 @@ -module.exports = function (config) { +module.exports = () => { const [major] = process.versions.node.split(".").map(Number); return major >= 18; diff --git a/test/configCases/rebuild/finishModules/webpack.config.js b/test/configCases/rebuild/finishModules/webpack.config.js index ef36cedc15a..c97be5a3fc8 100644 --- a/test/configCases/rebuild/finishModules/webpack.config.js +++ b/test/configCases/rebuild/finishModules/webpack.config.js @@ -1,4 +1,4 @@ -const { resolve, join } = require("path"); +const { join, resolve } = require("path"); const { NormalModule } = require("../../../../"); /** @@ -34,7 +34,7 @@ const testPlugin = compiler => { ); } - const module = Array.from(modules).find(matcher); + const module = [...modules].find(matcher); if (!module) { throw new Error("something went wrong"); diff --git a/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js b/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js index 54c5c48cb2b..064fbf46c4a 100644 --- a/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js +++ b/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js @@ -1,4 +1,4 @@ -const { resolve, join } = require("path"); +const { join, resolve } = require("path"); const { NormalModule } = require("../../../../"); /** @typedef {import("../../../../").Module} Module */ @@ -32,7 +32,7 @@ const testPlugin = compiler => { ); } - const module = Array.from(modules).find(matcher); + const module = [...modules].find(matcher); if (!module) { throw new Error("something went wrong"); 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 71a4dca42a1..8e3cee4afc3 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 @@ -5,7 +5,7 @@ function createFunctionArrayFromUseArray(useArray) { return useArray.map( useItem => - function () { + function fn() { return useItem; } ); 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 b16d93f68cd..00ea93201bb 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 @@ -8,7 +8,7 @@ class ReorderModulesPlugin { apply(compiler) { compiler.hooks.compilation.tap("ReorderModulesPlugin", compilation => { compilation.hooks.seal.tap("ReorderModulesPlugin", () => { - const sortedModules = Array.from(compilation.modules).sort((a, _b) => + const sortedModules = [...compilation.modules].sort((a, _b) => /** @type {NormalModule} */ (a).request.includes("b.js") ? -1 : 1 ); 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 129f52d0423..3c9411db856 100644 --- a/test/configCases/simple/multi-compiler-functions-export/webpack.config.js +++ b/test/configCases/simple/multi-compiler-functions-export/webpack.config.js @@ -1,5 +1,5 @@ module.exports.default = [ - function () { + 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 4a405a8b227..4885a78df2c 100644 --- a/test/configCases/simple/multi-compiler-functions/webpack.config.js +++ b/test/configCases/simple/multi-compiler-functions/webpack.config.js @@ -1,6 +1,6 @@ /** @type {import("../../../../").Configuration[]} */ module.exports = [ - function () { + function empty() { return {}; } ]; 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 846093ba9cf..9486c09cf37 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,5 +1,3 @@ const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); -module.exports = function (config) { - return supportsOptionalChaining(); -}; +module.exports = () => supportsOptionalChaining(); 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 846093ba9cf..9486c09cf37 100644 --- a/test/configCases/source-map/eval-source-map/test.filter.js +++ b/test/configCases/source-map/eval-source-map/test.filter.js @@ -1,5 +1,3 @@ const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); -module.exports = function (config) { - return supportsOptionalChaining(); -}; +module.exports = () => supportsOptionalChaining(); 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 71a71e594ff..1338bc1e7b5 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,3 +1 @@ -module.exports = function (config) { - return !process.env.CI; -}; +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 e4ce0a98d18..0f0696754d5 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,6 +1,6 @@ -const webpack = require("../../../../"); -const path = require("path"); const os = require("os"); +const path = require("path"); +const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { diff --git a/test/configCases/split-chunks/asnyc-entries/test.filter.js b/test/configCases/split-chunks/asnyc-entries/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/split-chunks/asnyc-entries/test.filter.js +++ b/test/configCases/split-chunks/asnyc-entries/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/target/node-dynamic-import/test.filter.js b/test/configCases/target/node-dynamic-import/test.filter.js index 05c852cb49c..356ad462e20 100644 --- a/test/configCases/target/node-dynamic-import/test.filter.js +++ b/test/configCases/target/node-dynamic-import/test.filter.js @@ -1,5 +1,3 @@ const supportsArrowFn = require("../../../helpers/supportsArrowFunctionExpression"); -module.exports = function (config) { - return supportsArrowFn(); -}; +module.exports = () => supportsArrowFn(); diff --git a/test/configCases/trusted-types/web-worker/test.filter.js b/test/configCases/trusted-types/web-worker/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/trusted-types/web-worker/test.filter.js +++ b/test/configCases/trusted-types/web-worker/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/types/filesystems/webpack.config.js b/test/configCases/types/filesystems/webpack.config.js index 36c632723c4..db6a5706dcf 100644 --- a/test/configCases/types/filesystems/webpack.config.js +++ b/test/configCases/types/filesystems/webpack.config.js @@ -1,5 +1,5 @@ -const memfs = require("memfs"); const fs = require("fs"); +const memfs = require("memfs"); /** @type {import("../../../../").Configuration} */ module.exports = { diff --git a/test/configCases/utils/lazy-set/webpack.config.js b/test/configCases/utils/lazy-set/webpack.config.js index 5a23d98af40..e438873edc3 100644 --- a/test/configCases/utils/lazy-set/webpack.config.js +++ b/test/configCases/utils/lazy-set/webpack.config.js @@ -3,7 +3,7 @@ module.exports = { plugins: [ compiler => { compiler.hooks.done.tap("Test", ({ compilation }) => { - const items1 = Array.from(compilation.fileDependencies); + const items1 = [...compilation.fileDependencies]; const items2 = new Set(compilation.fileDependencies.keys()); const items3 = new Set(compilation.fileDependencies.values()); const items4 = new Set(compilation.fileDependencies.entries()); diff --git a/test/configCases/wasm/async-node/test.filter.js b/test/configCases/wasm/async-node/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/configCases/wasm/async-node/test.filter.js +++ b/test/configCases/wasm/async-node/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/wasm/bigints/test.filter.js b/test/configCases/wasm/bigints/test.filter.js index 5877dc27294..d8c4a29ca6b 100644 --- a/test/configCases/wasm/bigints/test.filter.js +++ b/test/configCases/wasm/bigints/test.filter.js @@ -1,6 +1,5 @@ const supports = require("webassembly-feature"); -module.exports = function (config) { +module.exports = () => // eslint-disable-next-line new-cap - return supports["JS-BigInt-integration"](); -}; + supports["JS-BigInt-integration"](); diff --git a/test/configCases/wasm/export-imported-global/test.filter.js b/test/configCases/wasm/export-imported-global/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/configCases/wasm/export-imported-global/test.filter.js +++ b/test/configCases/wasm/export-imported-global/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/wasm/externref/test.filter.js b/test/configCases/wasm/externref/test.filter.js index 268b2fc7e60..7eef22e2153 100644 --- a/test/configCases/wasm/externref/test.filter.js +++ b/test/configCases/wasm/externref/test.filter.js @@ -1,6 +1,6 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { +module.exports = () => { const [major] = process.versions.node.split(".").map(Number); return major >= 18 && supportsWebAssembly(); diff --git a/test/configCases/wasm/fetch/test.config.js b/test/configCases/wasm/fetch/test.config.js index 9deeb4af110..3e6e0925a33 100644 --- a/test/configCases/wasm/fetch/test.config.js +++ b/test/configCases/wasm/fetch/test.config.js @@ -1,6 +1,6 @@ const fs = require("fs"); -const url = require("url"); const path = require("path"); +const url = require("url"); module.exports = { findBundle(i, options) { diff --git a/test/configCases/wasm/fetch/test.filter.js b/test/configCases/wasm/fetch/test.filter.js index b9b823dda69..2c96b54d2ba 100644 --- a/test/configCases/wasm/fetch/test.filter.js +++ b/test/configCases/wasm/fetch/test.filter.js @@ -1,6 +1,4 @@ -const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); const supportsResponse = require("../../../helpers/supportsResponse"); +const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly() && supportsResponse(); -}; +module.exports = () => supportsWebAssembly() && supportsResponse(); diff --git a/test/configCases/wasm/identical/test.filter.js b/test/configCases/wasm/identical/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/configCases/wasm/identical/test.filter.js +++ b/test/configCases/wasm/identical/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/wasm/identical/webpack.config.js b/test/configCases/wasm/identical/webpack.config.js index 676ea5c8ef3..a897d4f823c 100644 --- a/test/configCases/wasm/identical/webpack.config.js +++ b/test/configCases/wasm/identical/webpack.config.js @@ -24,7 +24,7 @@ module.exports = { /** * @this {Compiler} compiler */ - function () { + function test() { this.hooks.compilation.tap("Test", compilation => { AsyncWebAssemblyModulesPlugin.getCompilationHooks( compilation diff --git a/test/configCases/wasm/import-wasm-wasm/test.filter.js b/test/configCases/wasm/import-wasm-wasm/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/configCases/wasm/import-wasm-wasm/test.filter.js +++ b/test/configCases/wasm/import-wasm-wasm/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/wasm/reference-types/test.filter.js b/test/configCases/wasm/reference-types/test.filter.js index 268b2fc7e60..7eef22e2153 100644 --- a/test/configCases/wasm/reference-types/test.filter.js +++ b/test/configCases/wasm/reference-types/test.filter.js @@ -1,6 +1,6 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { +module.exports = () => { const [major] = process.versions.node.split(".").map(Number); return major >= 18 && supportsWebAssembly(); diff --git a/test/configCases/wasm/universal/test.filter.js b/test/configCases/wasm/universal/test.filter.js index b9b823dda69..2c96b54d2ba 100644 --- a/test/configCases/wasm/universal/test.filter.js +++ b/test/configCases/wasm/universal/test.filter.js @@ -1,6 +1,4 @@ -const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); const supportsResponse = require("../../../helpers/supportsResponse"); +const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly() && supportsResponse(); -}; +module.exports = () => supportsWebAssembly() && supportsResponse(); 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 3ff8627200e..8f89b2fa4b7 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,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function () { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/configCases/worker/blob/test.filter.js b/test/configCases/worker/blob/test.filter.js index 77b40315781..0d78d1214d1 100644 --- a/test/configCases/worker/blob/test.filter.js +++ b/test/configCases/worker/blob/test.filter.js @@ -1,6 +1,4 @@ -const supportsWorker = require("../../../helpers/supportsWorker"); const supportsBlob = require("../../../helpers/supportsBlob"); +const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker() && supportsBlob(); -}; +module.exports = () => supportsWorker() && supportsBlob(); diff --git a/test/configCases/worker/custom-worker/test.filter.js b/test/configCases/worker/custom-worker/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/worker/custom-worker/test.filter.js +++ b/test/configCases/worker/custom-worker/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/issue-17489/test.filter.js b/test/configCases/worker/issue-17489/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/worker/issue-17489/test.filter.js +++ b/test/configCases/worker/issue-17489/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker-hmr/test.filter.js b/test/configCases/worker/node-worker-hmr/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/worker/node-worker-hmr/test.filter.js +++ b/test/configCases/worker/node-worker-hmr/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker-named/test.filter.js b/test/configCases/worker/node-worker-named/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/worker/node-worker-named/test.filter.js +++ b/test/configCases/worker/node-worker-named/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/node-worker/test.filter.js b/test/configCases/worker/node-worker/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/worker/node-worker/test.filter.js +++ b/test/configCases/worker/node-worker/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/self-import/test.filter.js b/test/configCases/worker/self-import/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/worker/self-import/test.filter.js +++ b/test/configCases/worker/self-import/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/universal/test.filter.js b/test/configCases/worker/universal/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/worker/universal/test.filter.js +++ b/test/configCases/worker/universal/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/web-worker/test.filter.js b/test/configCases/worker/web-worker/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/worker/web-worker/test.filter.js +++ b/test/configCases/worker/web-worker/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/worker-contenthash/test.filter.js b/test/configCases/worker/worker-contenthash/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/configCases/worker/worker-contenthash/test.filter.js +++ b/test/configCases/worker/worker-contenthash/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/configCases/worker/worklet/test.filter.js b/test/configCases/worker/worklet/test.filter.js index 903374717a3..0d61f042810 100644 --- a/test/configCases/worker/worklet/test.filter.js +++ b/test/configCases/worker/worklet/test.filter.js @@ -1,6 +1,4 @@ -const supportsWorker = require("../../../helpers/supportsWorker"); const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); +const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker() && supportsOptionalChaining(); -}; +module.exports = () => supportsWorker() && supportsOptionalChaining(); diff --git a/test/helpers/PluginEnvironment.js b/test/helpers/PluginEnvironment.js index a109386fc4e..15df146259d 100644 --- a/test/helpers/PluginEnvironment.js +++ b/test/helpers/PluginEnvironment.js @@ -25,7 +25,7 @@ module.exports = function PluginEnvironment() { return hookName.replace(/[A-Z]/g, c => `-${c.toLowerCase()}`); } - this.getEnvironmentStub = function () { + this.getEnvironmentStub = function getEnvironmentStub() { const hooks = new Map(); return { plugin: addEvent, @@ -60,7 +60,7 @@ module.exports = function PluginEnvironment() { }; }; - this.getEventBindings = function () { + this.getEventBindings = function getEventBindings() { return events; }; }; diff --git a/test/helpers/captureStdio.js b/test/helpers/captureStdio.js index 3d1945a6ee9..3d616760a52 100644 --- a/test/helpers/captureStdio.js +++ b/test/helpers/captureStdio.js @@ -6,7 +6,7 @@ module.exports = (stdio, tty) => { const write = stdio.write; const isTTY = stdio.isTTY; - stdio.write = function (str) { + stdio.write = function write(str) { logs.push(str); }; if (tty !== undefined) stdio.isTTY = tty; diff --git a/test/helpers/deprecationTracking.js b/test/helpers/deprecationTracking.js index e2ab1020014..17c1c68d6ad 100644 --- a/test/helpers/deprecationTracking.js +++ b/test/helpers/deprecationTracking.js @@ -23,7 +23,7 @@ util.deprecate = (fn, message, _code) => { const original = originalDeprecate(fn, message, _code); // @ts-expect-error expected - return function (...args) { + return function deprecate(...args) { if (interception) { interception.set(`${_code}: ${message}`, { code: /** @type {string} */ (_code), @@ -49,7 +49,7 @@ module.exports.start = handler => { return () => { const map = interception; interception = undefined; - return Array.from(map || []) + return [...(map || [])] .sort(([a], [b]) => { if (a < b) return -1; if (a > b) return 1; diff --git a/test/hotCases/css/imported-css/test.filter.js b/test/hotCases/css/imported-css/test.filter.js index 2be506ab037..c2410949472 100644 --- a/test/hotCases/css/imported-css/test.filter.js +++ b/test/hotCases/css/imported-css/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return config.target === "web"; -}; +module.exports = config => config.target === "web"; diff --git a/test/hotCases/css/single-css-entry/test.filter.js b/test/hotCases/css/single-css-entry/test.filter.js index 2be506ab037..c2410949472 100644 --- a/test/hotCases/css/single-css-entry/test.filter.js +++ b/test/hotCases/css/single-css-entry/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return config.target === "web"; -}; +module.exports = config => config.target === "web"; diff --git a/test/hotCases/css/with-lazy-compilation/test.filter.js b/test/hotCases/css/with-lazy-compilation/test.filter.js index 2be506ab037..c2410949472 100644 --- a/test/hotCases/css/with-lazy-compilation/test.filter.js +++ b/test/hotCases/css/with-lazy-compilation/test.filter.js @@ -1,3 +1 @@ -module.exports = function (config) { - return config.target === "web"; -}; +module.exports = config => config.target === "web"; 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 2be506ab037..c2410949472 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,3 +1 @@ -module.exports = function (config) { - return config.target === "web"; -}; +module.exports = config => config.target === "web"; diff --git a/test/hotCases/runtime/add-runtime/test.filter.js b/test/hotCases/runtime/add-runtime/test.filter.js index 3af8ed89885..b4cd65c5a11 100644 --- a/test/hotCases/runtime/add-runtime/test.filter.js +++ b/test/hotCases/runtime/add-runtime/test.filter.js @@ -1,6 +1,6 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { +module.exports = config => { if (config.target !== "web") { return false; } diff --git a/test/hotCases/worker/move-between-runtime/test.filter.js b/test/hotCases/worker/move-between-runtime/test.filter.js index f74eb03f05a..23936757a41 100644 --- a/test/hotCases/worker/move-between-runtime/test.filter.js +++ b/test/hotCases/worker/move-between-runtime/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = config => supportsWorker(); diff --git a/test/hotCases/worker/remove-add-worker/test.filter.js b/test/hotCases/worker/remove-add-worker/test.filter.js index b3c3b4c2e2b..cac73d61621 100644 --- a/test/hotCases/worker/remove-add-worker/test.filter.js +++ b/test/hotCases/worker/remove-add-worker/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker() && config.target !== "async-node"; -}; +module.exports = config => supportsWorker() && config.target !== "async-node"; diff --git a/test/hotCases/worker/update-in-worker/test.filter.js b/test/hotCases/worker/update-in-worker/test.filter.js index f74eb03f05a..d456e8870d2 100644 --- a/test/hotCases/worker/update-in-worker/test.filter.js +++ b/test/hotCases/worker/update-in-worker/test.filter.js @@ -1,5 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = function (config) { - return supportsWorker(); -}; +module.exports = () => supportsWorker(); diff --git a/test/numberHash.unittest.js b/test/numberHash.unittest.js index ea059297dd1..1378b272861 100644 --- a/test/numberHash.unittest.js +++ b/test/numberHash.unittest.js @@ -1,5 +1,5 @@ -const numberHash = require("../lib/util/numberHash"); const { numberToIdentifier } = require("../lib/Template"); +const numberHash = require("../lib/util/numberHash"); describe("numberHash", () => { for (const n of [10, 100, 1000, 10000]) { diff --git a/test/setupTestFramework.js b/test/setupTestFramework.js index f86469b42c4..2be3218817f 100644 --- a/test/setupTestFramework.js +++ b/test/setupTestFramework.js @@ -44,7 +44,7 @@ if (process.env.ALTERNATIVE_SORT) { const oldSort = Array.prototype.sort; // eslint-disable-next-line no-extend-native - Array.prototype.sort = function (cmp) { + Array.prototype.sort = function sort(cmp) { oldSort.call(this, cmp); if (cmp) { for (let i = 1; i < this.length; i++) { diff --git a/test/statsCases/define-plugin/webpack.config.js b/test/statsCases/define-plugin/webpack.config.js index b8f31259557..802b389c15a 100644 --- a/test/statsCases/define-plugin/webpack.config.js +++ b/test/statsCases/define-plugin/webpack.config.js @@ -1,6 +1,6 @@ -const webpack = require("../../../"); const fs = require("fs"); const join = require("path").join; +const webpack = require("../../../"); /** * @param {string} path path diff --git a/test/statsCases/wasm-explorer-examples-sync/test.filter.js b/test/statsCases/wasm-explorer-examples-sync/test.filter.js index 324b9e82115..e4ae2530c7a 100644 --- a/test/statsCases/wasm-explorer-examples-sync/test.filter.js +++ b/test/statsCases/wasm-explorer-examples-sync/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/test/watchCases/cache/add-defines/test.filter.js b/test/watchCases/cache/add-defines/test.filter.js index 87860f28c19..10518911111 100644 --- a/test/watchCases/cache/add-defines/test.filter.js +++ b/test/watchCases/cache/add-defines/test.filter.js @@ -1,3 +1,2 @@ -module.exports = function (config) { - return !(config.experiments && config.experiments.cacheUnaffected); -}; +module.exports = config => + !(config.experiments && config.experiments.cacheUnaffected); diff --git a/test/watchCases/cache/asset-concat/test.filter.js b/test/watchCases/cache/asset-concat/test.filter.js index 87860f28c19..10518911111 100644 --- a/test/watchCases/cache/asset-concat/test.filter.js +++ b/test/watchCases/cache/asset-concat/test.filter.js @@ -1,3 +1,2 @@ -module.exports = function (config) { - return !(config.experiments && config.experiments.cacheUnaffected); -}; +module.exports = config => + !(config.experiments && config.experiments.cacheUnaffected); diff --git a/test/watchCases/plugins/define-plugin/webpack.config.js b/test/watchCases/plugins/define-plugin/webpack.config.js index 5c06191dc55..48a78da5276 100644 --- a/test/watchCases/plugins/define-plugin/webpack.config.js +++ b/test/watchCases/plugins/define-plugin/webpack.config.js @@ -1,5 +1,5 @@ -const path = require("path"); const fs = require("fs"); +const path = require("path"); const webpack = require("../../../../"); /** @type {(env: Env, options: TestOptions) => 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 87860f28c19..10518911111 100644 --- a/test/watchCases/side-effects/issue-7400/test.filter.js +++ b/test/watchCases/side-effects/issue-7400/test.filter.js @@ -1,3 +1,2 @@ -module.exports = function (config) { - return !(config.experiments && config.experiments.cacheUnaffected); -}; +module.exports = config => + !(config.experiments && config.experiments.cacheUnaffected); diff --git a/test/watchCases/wasm/caching/test.filter.js b/test/watchCases/wasm/caching/test.filter.js index cb37e21905f..8f89b2fa4b7 100644 --- a/test/watchCases/wasm/caching/test.filter.js +++ b/test/watchCases/wasm/caching/test.filter.js @@ -1,5 +1,3 @@ const supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); -module.exports = function (config) { - return supportsWebAssembly(); -}; +module.exports = () => supportsWebAssembly(); diff --git a/tooling/generate-runtime-code.js b/tooling/generate-runtime-code.js index 7fa3a5e681e..696e365369c 100644 --- a/tooling/generate-runtime-code.js +++ b/tooling/generate-runtime-code.js @@ -1,9 +1,9 @@ "use strict"; -const path = require("path"); const fs = require("fs"); -const terser = require("terser"); +const path = require("path"); const prettier = require("prettier"); +const terser = require("terser"); // When --write is set, files will be written in place // Otherwise it only prints outdated files diff --git a/tooling/generate-wasm-code.js b/tooling/generate-wasm-code.js index d935e9b86ff..863f5789de3 100644 --- a/tooling/generate-wasm-code.js +++ b/tooling/generate-wasm-code.js @@ -1,7 +1,7 @@ "use strict"; -const path = require("path"); const fs = require("fs"); +const path = require("path"); // When --write is set, files will be written in place // Otherwise it only prints outdated files diff --git a/tooling/print-cache-file.js b/tooling/print-cache-file.js index b9882d020f1..df9b4386660 100644 --- a/tooling/print-cache-file.js +++ b/tooling/print-cache-file.js @@ -1,7 +1,7 @@ "use strict"; -const path = require("path"); const fs = require("fs"); +const path = require("path"); const BinaryMiddleware = require("../lib/serialization/BinaryMiddleware"); const FileMiddleware = require("../lib/serialization/FileMiddleware"); const Serializer = require("../lib/serialization/Serializer"); @@ -151,7 +151,7 @@ const printData = async (data, indent) => { printLine(String(item)); } } - const refCounters = Array.from(referencedValuesCounters); + const refCounters = [...referencedValuesCounters]; refCounters.sort(([a, A], [b, B]) => B - A); printLine("SUMMARY: top references:"); for (const [ref, count] of refCounters.slice(10)) { diff --git a/types.d.ts b/types.d.ts index f5c9618934c..66cb71930d8 100644 --- a/types.d.ts +++ b/types.d.ts @@ -3032,8 +3032,8 @@ declare interface Configuration { } type ConnectionState = | boolean - | typeof TRANSITIVE_ONLY - | typeof CIRCULAR_CONNECTION; + | typeof CIRCULAR_CONNECTION + | typeof TRANSITIVE_ONLY; declare class ConstDependency extends NullDependency { constructor( expression: string, @@ -7758,8 +7758,9 @@ declare class JavascriptParser extends Parser { getMembers: () => string[]; }; static ALLOWED_MEMBER_TYPES_ALL: 3; - static ALLOWED_MEMBER_TYPES_EXPRESSION: 2; static ALLOWED_MEMBER_TYPES_CALL_EXPRESSION: 1; + static ALLOWED_MEMBER_TYPES_EXPRESSION: 2; + static VariableInfo: typeof VariableInfo; static getImportAttributes: ( node: | ImportDeclarationJavascriptParser @@ -7767,7 +7768,6 @@ declare class JavascriptParser extends Parser { | ExportAllDeclarationJavascriptParser | ImportExpressionJavascriptParser ) => undefined | ImportAttributes; - static VariableInfo: typeof VariableInfo; } /** @@ -9981,12 +9981,12 @@ declare class ModuleGraphConnection { getActiveState(runtime: RuntimeSpec): ConnectionState; setActive(value: boolean): void; active: void; + static CIRCULAR_CONNECTION: typeof CIRCULAR_CONNECTION; + static TRANSITIVE_ONLY: typeof TRANSITIVE_ONLY; static addConnectionStates: ( a: ConnectionState, b: ConnectionState ) => ConnectionState; - static TRANSITIVE_ONLY: typeof TRANSITIVE_ONLY; - static CIRCULAR_CONNECTION: typeof CIRCULAR_CONNECTION; } type ModuleId = string | number; type ModuleInfo = ConcatenatedModuleInfo | ExternalModuleInfo; @@ -16630,8 +16630,8 @@ declare class Template { runtimeModules: RuntimeModule[], renderContext: RenderContextJavascriptModulesPlugin ): Source; - static NUMBER_OF_IDENTIFIER_START_CHARS: number; static NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS: number; + static NUMBER_OF_IDENTIFIER_START_CHARS: number; } type TemplatePath = | string @@ -17457,85 +17457,85 @@ declare namespace exports { export let matchObject: (obj: MatchObject, str: string) => boolean; } export namespace OptimizationStages { + export let STAGE_ADVANCED: 10; export let STAGE_BASIC: -10; export let STAGE_DEFAULT: 0; - export let STAGE_ADVANCED: 10; } export namespace RuntimeGlobals { - export let require: "__webpack_require__"; - export let requireScope: "__webpack_require__.*"; + export let amdDefine: "__webpack_require__.amdD"; + export let amdOptions: "__webpack_require__.amdO"; + export let asyncModule: "__webpack_require__.a"; + export let asyncModuleDoneSymbol: "__webpack_require__.aD"; + export let asyncModuleExportSymbol: "__webpack_require__.aE"; + export let baseURI: "__webpack_require__.b"; + export let chunkCallback: "webpackChunk"; + export let chunkName: "__webpack_require__.cn"; + export let compatGetDefaultExport: "__webpack_require__.n"; + export let createFakeNamespaceObject: "__webpack_require__.t"; + export let createScript: "__webpack_require__.ts"; + export let createScriptUrl: "__webpack_require__.tu"; + export let currentRemoteGetScope: "__webpack_require__.R"; + export let definePropertyGetters: "__webpack_require__.d"; + export let ensureChunk: "__webpack_require__.e"; + export let ensureChunkHandlers: "__webpack_require__.f"; + export let ensureChunkIncludeEntries: "__webpack_require__.f (include entries)"; + export let entryModuleId: "__webpack_require__.s"; export let exports: "__webpack_exports__"; - export let thisAsExports: "top-level-this-exports"; - export let returnExportsFromRuntime: "return-exports-from-runtime"; + export let externalInstallChunk: "__webpack_require__.C"; + export let getChunkCssFilename: "__webpack_require__.k"; + export let getChunkScriptFilename: "__webpack_require__.u"; + export let getChunkUpdateCssFilename: "__webpack_require__.hk"; + export let getChunkUpdateScriptFilename: "__webpack_require__.hu"; + export let getFullHash: "__webpack_require__.h"; + export let getTrustedTypesPolicy: "__webpack_require__.tt"; + export let getUpdateManifestFilename: "__webpack_require__.hmrF"; + export let global: "__webpack_require__.g"; + export let harmonyModuleDecorator: "__webpack_require__.hmd"; + export let hasCssModules: "has css modules"; + export let hasFetchPriority: "has fetch priority"; + export let hasOwnProperty: "__webpack_require__.o"; + export let hmrDownloadManifest: "__webpack_require__.hmrM"; + export let hmrDownloadUpdateHandlers: "__webpack_require__.hmrC"; + export let hmrInvalidateModuleHandlers: "__webpack_require__.hmrI"; + export let hmrModuleData: "__webpack_require__.hmrD"; + export let hmrRuntimeStatePrefix: "__webpack_require__.hmrS"; + export let initializeSharing: "__webpack_require__.I"; + export let instantiateWasm: "__webpack_require__.v"; + export let interceptModuleExecution: "__webpack_require__.i"; + export let loadScript: "__webpack_require__.l"; + export let makeDeferredNamespaceObject: "__webpack_require__.z"; + export let makeDeferredNamespaceObjectSymbol: "__webpack_require__.zS"; + export let makeNamespaceObject: "__webpack_require__.r"; export let module: "module"; - export let moduleId: "module.id"; - export let moduleLoaded: "module.loaded"; - export let publicPath: "__webpack_require__.p"; - export let entryModuleId: "__webpack_require__.s"; export let moduleCache: "__webpack_require__.c"; export let moduleFactories: "__webpack_require__.m"; export let moduleFactoriesAddOnly: "__webpack_require__.m (add only)"; - export let ensureChunk: "__webpack_require__.e"; - export let ensureChunkHandlers: "__webpack_require__.f"; - export let ensureChunkIncludeEntries: "__webpack_require__.f (include entries)"; + export let moduleId: "module.id"; + export let moduleLoaded: "module.loaded"; + export let nodeModuleDecorator: "__webpack_require__.nmd"; + export let onChunksLoaded: "__webpack_require__.O"; export let prefetchChunk: "__webpack_require__.E"; export let prefetchChunkHandlers: "__webpack_require__.F"; export let preloadChunk: "__webpack_require__.G"; export let preloadChunkHandlers: "__webpack_require__.H"; - export let definePropertyGetters: "__webpack_require__.d"; - export let makeNamespaceObject: "__webpack_require__.r"; - export let makeDeferredNamespaceObject: "__webpack_require__.z"; - export let makeDeferredNamespaceObjectSymbol: "__webpack_require__.zS"; - export let createFakeNamespaceObject: "__webpack_require__.t"; - export let compatGetDefaultExport: "__webpack_require__.n"; - export let harmonyModuleDecorator: "__webpack_require__.hmd"; - export let nodeModuleDecorator: "__webpack_require__.nmd"; - export let getFullHash: "__webpack_require__.h"; - export let wasmInstances: "__webpack_require__.w"; - export let instantiateWasm: "__webpack_require__.v"; - export let uncaughtErrorHandler: "__webpack_require__.oe"; - export let scriptNonce: "__webpack_require__.nc"; - export let loadScript: "__webpack_require__.l"; - export let createScript: "__webpack_require__.ts"; - export let createScriptUrl: "__webpack_require__.tu"; - export let getTrustedTypesPolicy: "__webpack_require__.tt"; - export let hasFetchPriority: "has fetch priority"; - export let chunkName: "__webpack_require__.cn"; + export let publicPath: "__webpack_require__.p"; + export let relativeUrl: "__webpack_require__.U"; + export let require: "__webpack_require__"; + export let requireScope: "__webpack_require__.*"; + export let returnExportsFromRuntime: "return-exports-from-runtime"; export let runtimeId: "__webpack_require__.j"; - export let getChunkScriptFilename: "__webpack_require__.u"; - export let getChunkCssFilename: "__webpack_require__.k"; - export let hasCssModules: "has css modules"; - export let getChunkUpdateScriptFilename: "__webpack_require__.hu"; - export let getChunkUpdateCssFilename: "__webpack_require__.hk"; + export let scriptNonce: "__webpack_require__.nc"; + export let shareScopeMap: "__webpack_require__.S"; export let startup: "__webpack_require__.x"; + export let startupEntrypoint: "__webpack_require__.X"; export let startupNoDefault: "__webpack_require__.x (no default handler)"; export let startupOnlyAfter: "__webpack_require__.x (only after)"; export let startupOnlyBefore: "__webpack_require__.x (only before)"; - export let chunkCallback: "webpackChunk"; - export let startupEntrypoint: "__webpack_require__.X"; - export let onChunksLoaded: "__webpack_require__.O"; - export let externalInstallChunk: "__webpack_require__.C"; - export let interceptModuleExecution: "__webpack_require__.i"; - export let global: "__webpack_require__.g"; - export let shareScopeMap: "__webpack_require__.S"; - export let initializeSharing: "__webpack_require__.I"; - export let currentRemoteGetScope: "__webpack_require__.R"; - export let getUpdateManifestFilename: "__webpack_require__.hmrF"; - export let hmrDownloadManifest: "__webpack_require__.hmrM"; - export let hmrDownloadUpdateHandlers: "__webpack_require__.hmrC"; - export let hmrModuleData: "__webpack_require__.hmrD"; - export let hmrInvalidateModuleHandlers: "__webpack_require__.hmrI"; - export let hmrRuntimeStatePrefix: "__webpack_require__.hmrS"; - export let amdDefine: "__webpack_require__.amdD"; - export let amdOptions: "__webpack_require__.amdO"; export let system: "__webpack_require__.System"; - export let hasOwnProperty: "__webpack_require__.o"; export let systemContext: "__webpack_require__.y"; - export let baseURI: "__webpack_require__.b"; - export let relativeUrl: "__webpack_require__.U"; - export let asyncModule: "__webpack_require__.a"; - export let asyncModuleExportSymbol: "__webpack_require__.aE"; - export let asyncModuleDoneSymbol: "__webpack_require__.aD"; + export let thisAsExports: "top-level-this-exports"; + export let uncaughtErrorHandler: "__webpack_require__.oe"; + export let wasmInstances: "__webpack_require__.w"; } export const UsageState: Readonly<{ Unused: 0; @@ -17586,9 +17586,6 @@ declare namespace exports { } export namespace optimize { export namespace InnerGraph { - export let bailout: (parserState: ParserState) => void; - export let enable: (parserState: ParserState) => void; - export let isEnabled: (parserState: ParserState) => boolean; export let addUsage: ( state: ParserState, symbol: null | TopLevelSymbol, @@ -17599,7 +17596,30 @@ declare namespace exports { name: string, usage: string | true | TopLevelSymbol ) => void; + export let bailout: (parserState: ParserState) => void; + export let enable: (parserState: ParserState) => void; + export let getDependencyUsedByExportsCondition: ( + dependency: Dependency, + usedByExports: undefined | boolean | Set, + moduleGraph: ModuleGraph + ) => + | null + | false + | (( + moduleGraphConnection: ModuleGraphConnection, + runtime: RuntimeSpec + ) => ConnectionState); + export let getTopLevelSymbol: ( + state: ParserState + ) => void | TopLevelSymbol; export let inferDependencyUsage: (state: ParserState) => void; + export let isDependencyUsedByExports: ( + dependency: Dependency, + usedByExports: boolean | Set, + moduleGraph: ModuleGraph, + runtime: RuntimeSpec + ) => boolean; + export let isEnabled: (parserState: ParserState) => boolean; export let onUsage: ( state: ParserState, onUsageCallback: (value?: boolean | Set) => void @@ -17608,30 +17628,10 @@ declare namespace exports { state: ParserState, symbol?: TopLevelSymbol ) => void; - export let getTopLevelSymbol: ( - state: ParserState - ) => void | TopLevelSymbol; export let tagTopLevelSymbol: ( parser: JavascriptParser, name: string ) => undefined | TopLevelSymbol; - export let isDependencyUsedByExports: ( - dependency: Dependency, - usedByExports: boolean | Set, - moduleGraph: ModuleGraph, - runtime: RuntimeSpec - ) => boolean; - export let getDependencyUsedByExportsCondition: ( - dependency: Dependency, - usedByExports: undefined | boolean | Set, - moduleGraph: ModuleGraph - ) => - | null - | false - | (( - moduleGraphConnection: ModuleGraphConnection, - runtime: RuntimeSpec - ) => ConnectionState); export { TopLevelSymbol, topLevelSymbolTag }; } export { @@ -17714,17 +17714,38 @@ declare namespace exports { export namespace util { export const createHash: (algorithm: HashFunction) => Hash; export namespace comparators { + export let compareChunkGroupsByIndex: ( + a: ChunkGroup, + b: ChunkGroup + ) => 0 | 1 | -1; + export let compareChunks: ParameterizedComparator; export let compareChunksById: (a: Chunk, b: Chunk) => 0 | 1 | -1; - export let compareModulesByIdentifier: ( - a: Module, - b: Module + export let compareChunksNatural: ( + chunkGraph: ChunkGraph + ) => Comparator; + export let compareIds: ( + a: string | number, + b: string | number + ) => 0 | 1 | -1; + export let compareIterables: ( + elementComparator: Comparator + ) => Comparator>; + export let compareLocations: ( + a: DependencyLocation, + b: DependencyLocation ) => 0 | 1 | -1; export let compareModulesById: ParameterizedComparator< ChunkGraph, Module >; - export let compareNumbers: (a: number, b: number) => 0 | 1 | -1; - export let compareStringsNumeric: (a: string, b: string) => 0 | 1 | -1; + export let compareModulesByIdOrIdentifier: ParameterizedComparator< + ChunkGraph, + Module + >; + export let compareModulesByIdentifier: ( + a: Module, + b: Module + ) => 0 | 1 | -1; export let compareModulesByPostOrderIndexOrIdentifier: ParameterizedComparator< ModuleGraph, Module @@ -17733,60 +17754,42 @@ declare namespace exports { ModuleGraph, Module >; - export let compareModulesByIdOrIdentifier: ParameterizedComparator< - ChunkGraph, - Module - >; - export let compareChunks: ParameterizedComparator; - export let compareIds: ( - a: string | number, - b: string | number - ) => 0 | 1 | -1; + export let compareNumbers: (a: number, b: number) => 0 | 1 | -1; + export let compareSelect: ( + getter: Selector, + comparator: Comparator + ) => Comparator; export let compareStrings: (a: string, b: string) => 0 | 1 | -1; - export let compareChunkGroupsByIndex: ( - a: ChunkGroup, - b: ChunkGroup - ) => 0 | 1 | -1; + export let compareStringsNumeric: (a: string, b: string) => 0 | 1 | -1; export let concatComparators: ( c1: Comparator, c2: Comparator, ...cRest: Comparator[] ) => Comparator; - export let compareSelect: ( - getter: Selector, - comparator: Comparator - ) => Comparator; - export let compareIterables: ( - elementComparator: Comparator - ) => Comparator>; export let keepOriginalOrder: (iterable: Iterable) => Comparator; - export let compareChunksNatural: ( - chunkGraph: ChunkGraph - ) => Comparator; - export let compareLocations: ( - a: DependencyLocation, - b: DependencyLocation - ) => 0 | 1 | -1; } export namespace runtime { - export let getEntryRuntime: ( - compilation: Compilation, - name: string, - options?: EntryOptions - ) => RuntimeSpec; + export let compareRuntime: (a: RuntimeSpec, b: RuntimeSpec) => 0 | 1 | -1; + export let filterRuntime: ( + runtime: RuntimeSpec, + filter: (runtime?: RuntimeSpec) => boolean + ) => undefined | string | boolean | SortableSet; export let forEachRuntime: ( runtime: RuntimeSpec, fn: (runtime?: string) => void, deterministicOrder?: boolean ) => void; + export let getEntryRuntime: ( + compilation: Compilation, + name: string, + options?: EntryOptions + ) => RuntimeSpec; export let getRuntimeKey: (runtime: RuntimeSpec) => string; + export let intersectRuntime: ( + a: RuntimeSpec, + b: RuntimeSpec + ) => RuntimeSpec; export let keyToRuntime: (key: string) => RuntimeSpec; - export let runtimeToString: (runtime: RuntimeSpec) => string; - export let runtimeConditionToString: ( - runtimeCondition: RuntimeCondition - ) => string; - export let runtimeEqual: (a: RuntimeSpec, b: RuntimeSpec) => boolean; - export let compareRuntime: (a: RuntimeSpec, b: RuntimeSpec) => 0 | 1 | -1; export let mergeRuntime: (a: RuntimeSpec, b: RuntimeSpec) => RuntimeSpec; export let mergeRuntimeCondition: ( a: RuntimeCondition, @@ -17802,10 +17805,11 @@ declare namespace exports { a: RuntimeSpec, b: RuntimeSpec ) => RuntimeSpec; - export let intersectRuntime: ( - a: RuntimeSpec, - b: RuntimeSpec - ) => RuntimeSpec; + export let runtimeConditionToString: ( + runtimeCondition: RuntimeCondition + ) => string; + export let runtimeEqual: (a: RuntimeSpec, b: RuntimeSpec) => boolean; + export let runtimeToString: (runtime: RuntimeSpec) => string; export let subtractRuntime: ( a: RuntimeSpec, b: RuntimeSpec @@ -17815,10 +17819,6 @@ declare namespace exports { b: RuntimeCondition, runtime: RuntimeSpec ) => RuntimeCondition; - export let filterRuntime: ( - runtime: RuntimeSpec, - filter: (runtime?: RuntimeSpec) => boolean - ) => undefined | string | boolean | SortableSet; export { RuntimeSpecMap, RuntimeSpecSet }; } export namespace serialization { From 0b51fad980bfa14d60bac0b285b4e7af8780f6dd Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 3 Jul 2025 13:49:34 +0300 Subject: [PATCH 40/56] test: enable --- test/cases/mjs/namespace-object-lazy/test.filter.js | 1 - .../mjs/non-mjs-namespace-object-lazy/test.filter.js | 1 - test/cases/parsing/es2022/test.filter.js | 3 --- test/cases/parsing/optional-catch-binding/test.filter.js | 8 +------- test/cases/parsing/optional-chaining/test.filter.js | 2 +- .../scope-hoisting/renaming-shorthand-5027/test.filter.js | 3 +-- 6 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 test/cases/mjs/namespace-object-lazy/test.filter.js delete mode 100644 test/cases/mjs/non-mjs-namespace-object-lazy/test.filter.js diff --git a/test/cases/mjs/namespace-object-lazy/test.filter.js b/test/cases/mjs/namespace-object-lazy/test.filter.js deleted file mode 100644 index 43a2afb97bf..00000000000 --- a/test/cases/mjs/namespace-object-lazy/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = config => !config.minimize; diff --git a/test/cases/mjs/non-mjs-namespace-object-lazy/test.filter.js b/test/cases/mjs/non-mjs-namespace-object-lazy/test.filter.js deleted file mode 100644 index 43a2afb97bf..00000000000 --- a/test/cases/mjs/non-mjs-namespace-object-lazy/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = config => !config.minimize; diff --git a/test/cases/parsing/es2022/test.filter.js b/test/cases/parsing/es2022/test.filter.js index 38c3136db5a..ec8c61db6f9 100644 --- a/test/cases/parsing/es2022/test.filter.js +++ b/test/cases/parsing/es2022/test.filter.js @@ -1,7 +1,4 @@ module.exports = function (config) { - // terser doesn't support static {} - if (config.mode === "production") return false; - try { eval("class A { static {} }"); return true; diff --git a/test/cases/parsing/optional-catch-binding/test.filter.js b/test/cases/parsing/optional-catch-binding/test.filter.js index 2ece0f3a34c..0a2d97c9405 100644 --- a/test/cases/parsing/optional-catch-binding/test.filter.js +++ b/test/cases/parsing/optional-catch-binding/test.filter.js @@ -1,9 +1,3 @@ const supportsOptionalCatchBinding = require("../../../helpers/supportsOptionalCatchBinding"); -module.exports = config => { - // XXX: Disable this test if Terser is used because it does not support ES 2019 - if (config.mode === "production") { - return false; - } - return 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 dc7c6d6b814..e54f5d848b4 100644 --- a/test/cases/parsing/optional-chaining/test.filter.js +++ b/test/cases/parsing/optional-chaining/test.filter.js @@ -1,3 +1,3 @@ const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); -module.exports = config => !config.minimize && supportsOptionalChaining(); +module.exports = config => supportsOptionalChaining(); 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 0bf5d06ceec..eeaa66291aa 100644 --- a/test/cases/scope-hoisting/renaming-shorthand-5027/test.filter.js +++ b/test/cases/scope-hoisting/renaming-shorthand-5027/test.filter.js @@ -3,8 +3,7 @@ const supportsES6 = require("../../../helpers/supportsES6"); const supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); const supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); -module.exports = config => - !config.minimize && +module.exports = () => supportsES6() && supportDefaultAssignment() && supportsObjectDestructuring() && From 3b3d4c5528d5a2199724cdded362e887e1ed6646 Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Thu, 3 Jul 2025 19:16:40 +0800 Subject: [PATCH 41/56] feat: improve support for destructing in `DefinePlugin` (#19638) --- lib/DefinePlugin.js | 106 +++++++++++++++++ .../plugins/define-plugin/index.js | 109 ++++++++++-------- .../plugins/define-plugin/webpack.config.js | 5 +- 3 files changed, 169 insertions(+), 51 deletions(-) diff --git a/lib/DefinePlugin.js b/lib/DefinePlugin.js index 0bc4a6847fa..f60d68f00c9 100644 --- a/lib/DefinePlugin.js +++ b/lib/DefinePlugin.js @@ -356,6 +356,16 @@ class DefinePlugin { */ apply(compiler) { const definitions = this.definitions; + + /** + * @type {Map>} + */ + const finalByNestedKey = new Map(); + /** + * @type {Map>} + */ + const nestedByFinalKey = new Map(); + compiler.hooks.compilation.tap( PLUGIN_NAME, (compilation, { normalModuleFactory }) => { @@ -381,6 +391,7 @@ class DefinePlugin { * @returns {void} */ const handler = parser => { + const hooked = new Set(); const mainValue = /** @type {ValueCacheVersion} */ (compilation.valueCacheVersions.get(VALUE_DEP_MAIN)); @@ -470,6 +481,61 @@ class DefinePlugin { return true; }); } + if (prefix === "") { + const final = splittedKey[splittedKey.length - 1]; + const nestedSet = nestedByFinalKey.get(final); + if (!nestedSet || nestedSet.size <= 0) return; + for (const nested of /** @type {Set} */ (nestedSet)) { + if (nested && !hooked.has(nested)) { + // only detect the same nested key once + hooked.add(nested); + parser.hooks.expression.for(nested).tap( + { + name: PLUGIN_NAME, + // why 100? Ensures it runs after object define + stage: 100 + }, + expr => { + const destructed = + parser.destructuringAssignmentPropertiesFor(expr); + if (destructed === undefined) { + return; + } + /** @type {Record} */ + const obj = {}; + const finalSet = finalByNestedKey.get(nested); + for (const { id } of destructed) { + const fullKey = `${nested}.${id}`; + if ( + !finalSet || + !finalSet.has(id) || + !definitions[fullKey] + ) { + return; + } + obj[id] = definitions[fullKey]; + } + let strCode = stringifyObj( + obj, + parser, + compilation.valueCacheVersions, + key, + runtimeTemplate, + logger, + !parser.isAsiPosition( + /** @type {Range} */ (expr.range)[0] + ), + getObjKeys(destructed) + ); + if (parser.scope.inShorthand) { + strCode = `${parser.scope.inShorthand}:${strCode}`; + } + return toConstantDependency(parser, strCode)(expr); + } + ); + } + } + } }; /** @@ -708,6 +774,46 @@ class DefinePlugin { } }; + /** + * @param {Record} definitions Definitions map + * @returns {void} + */ + const walkDefinitionsForKeys = definitions => { + /** + * @param {Map>} map Map + * @param {string} key key + * @param {string} value v + * @returns {void} + */ + const addToMap = (map, key, value) => { + if (map.has(key)) { + /** @type {Set} */ + (map.get(key)).add(value); + } else { + map.set(key, new Set([value])); + } + }; + for (const key of Object.keys(definitions)) { + const code = definitions[key]; + if ( + !code || + typeof code === "object" || + TYPEOF_OPERATOR_REGEXP.test(key) + ) { + continue; + } + const idx = key.lastIndexOf("."); + if (idx <= 0 || idx >= key.length - 1) { + continue; + } + const nested = key.slice(0, idx); + const final = key.slice(idx + 1); + addToMap(finalByNestedKey, nested, final); + addToMap(nestedByFinalKey, final, nested); + } + }; + + walkDefinitionsForKeys(definitions); walkDefinitionsForValues(definitions, ""); compilation.valueCacheVersions.set( diff --git a/test/configCases/plugins/define-plugin/index.js b/test/configCases/plugins/define-plugin/index.js index 8c6d684a743..7f1d60af97f 100644 --- a/test/configCases/plugins/define-plugin/index.js +++ b/test/configCases/plugins/define-plugin/index.js @@ -2,67 +2,67 @@ function donotcallme() { expect("asi unsafe call happened").toBe(false); } -it("should define FALSE", function() { +it("should define FALSE", function () { expect(FALSE).toBe(false); expect(typeof FALSE).toBe("boolean"); var x = require(FALSE ? "fail" : "./dir/a"); var y = FALSE ? require("fail") : require("./dir/a"); }); -it("should define TRUE", function() { +it("should define TRUE", function () { expect(TRUE).toBe(true); expect(typeof TRUE).toBe("boolean"); var x = require(TRUE ? "./dir/a" : "fail"); var y = TRUE ? require("./dir/a") : require("fail"); }); -it("should define CODE", function() { +it("should define CODE", function () { expect(CODE).toBe(3); expect(typeof CODE).toBe("number"); if (CODE !== 3) require("fail"); if (typeof CODE !== "number") require("fail"); }); -it("should define FUNCTION", function() { +it("should define FUNCTION", function () { expect(FUNCTION(5)).toBe(6); expect(typeof FUNCTION).toBe("function"); if (typeof FUNCTION !== "function") require("fail"); }); -it("should define NULL", function() { +it("should define NULL", function () { expect(NULL).toBeNull(); if (NULL) require("fail"); if (NULL !== null) require("fail"); if (typeof NULL !== "object") require("fail"); }); -it("should define UNDEFINED", function() { +it("should define UNDEFINED", function () { expect(typeof UNDEFINED).toBe("undefined"); if (typeof UNDEFINED !== "undefined") require("fail"); }); -it("should define NUMBER", function() { +it("should define NUMBER", function () { expect(NUMBER).toBe(100.05); expect(typeof NUMBER).toBe("number"); if (NUMBER !== 100.05) require("fail"); if (typeof NUMBER !== "number") require("fail"); }); -it("should define ZERO", function() { +it("should define ZERO", function () { expect(ZERO).toBe(0); expect(typeof ZERO).toBe("number"); if (ZERO !== 0) require("fail"); if (typeof ZERO !== "number") require("fail"); }); -it("should define ONE", function() { +it("should define ONE", function () { expect(ONE).toBe(1); expect(typeof ONE).toBe("number"); expect(42 / ONE).toBe(42); if (ONE !== 1) require("fail"); if (typeof ONE !== "number") require("fail"); }); -it("should define BIGINT", function() { +it("should define BIGINT", function () { expect(BIGINT).toBe(9007199254740993n); expect(typeof BIGINT).toBe("bigint"); }); -it("should define ZERO_BIGINT", function() { +it("should define ZERO_BIGINT", function () { expect(ZERO_BIGINT).toBe(0n); expect(typeof BIGINT).toBe("bigint"); }); -it("should define POSITIVE_ZERO", function() { +it("should define POSITIVE_ZERO", function () { expect(POSITIVE_ZERO).toBe(+0); expect(POSITIVE_ZERO).toBe(0); expect(typeof POSITIVE_ZERO).toBe("number"); @@ -76,7 +76,7 @@ it("should define POSITIVE_ZERO", function() { if (POSITIVE_ZERO !== 0) require("fail"); if (POSITIVE_ZERO != 0) require("fail"); }); -it("should define NEGATIVE_ZER0", function() { +it("should define NEGATIVE_ZER0", function () { expect(NEGATIVE_ZER0).toBe(-0); expect(typeof NEGATIVE_ZER0).toBe("number"); expect(Object.is(NEGATIVE_ZER0, 0)).toBe(false); @@ -89,21 +89,21 @@ it("should define NEGATIVE_ZER0", function() { if (NEGATIVE_ZER0 !== 0) require("fail"); if (NEGATIVE_ZER0 != 0) require("fail"); }); -it("should define NEGATIVE_NUMBER", function() { +it("should define NEGATIVE_NUMBER", function () { expect(NEGATIVE_NUMBER).toBe(-100.25); expect(typeof NEGATIVE_NUMBER).toBe("number"); expect(100.25 / NEGATIVE_NUMBER).toBe(-1); if (!NEGATIVE_NUMBER) require("fail"); if (typeof NEGATIVE_NUMBER !== "number") require("fail"); }); -it("should define POSITIVE_NUMBER", function() { +it("should define POSITIVE_NUMBER", function () { expect(POSITIVE_NUMBER).toBe(+100.25); expect(typeof POSITIVE_NUMBER).toBe("number"); expect(POSITIVE_NUMBER / 100.25).toBe(1); if (!POSITIVE_NUMBER) require("fail"); if (typeof POSITIVE_NUMBER !== "number") require("fail"); }); -it("should define STRING", function() { +it("should define STRING", function () { expect(STRING).toBe("string"); expect(typeof STRING).toBe("string"); if (!STRING) require("fail"); @@ -111,7 +111,7 @@ it("should define STRING", function() { if (STRING === "") require("fail"); if (STRING == "") require("fail"); }); -it("should define EMPTY_STRING", function() { +it("should define EMPTY_STRING", function () { expect(EMPTY_STRING).toBe(""); expect(typeof EMPTY_STRING).toBe("string"); if (EMPTY_STRING) require("fail"); @@ -119,16 +119,16 @@ it("should define EMPTY_STRING", function() { if (EMPTY_STRING !== "") require("fail"); if (EMPTY_STRING != "") require("fail"); }); -it("should define REGEXP", function() { +it("should define REGEXP", function () { expect(REGEXP.toString()).toBe("/abc/i"); expect(typeof REGEXP).toBe("object"); if (typeof REGEXP !== "object") require("fail"); }); -it("should define OBJECT", function() { +it("should define OBJECT", function () { var o = OBJECT; expect(o.SUB.FUNCTION(10)).toBe(11); }); -it("should define OBJECT.SUB.CODE", function() { +it("should define OBJECT.SUB.CODE", function () { (donotcallme) OBJECT; (donotcallme) @@ -138,37 +138,37 @@ it("should define OBJECT.SUB.CODE", function() { if (OBJECT.SUB.CODE !== 3) require("fail"); if (typeof OBJECT.SUB.CODE !== "number") require("fail"); - (function(sub) { + (function (sub) { // should not crash expect(sub.CODE).toBe(3); })(OBJECT.SUB); }); -it("should define OBJECT.SUB.STRING", function() { +it("should define OBJECT.SUB.STRING", function () { expect(typeof OBJECT.SUB.STRING).toBe("string"); expect(OBJECT.SUB.STRING).toBe("string"); if (OBJECT.SUB.STRING !== "string") require("fail"); if (typeof OBJECT.SUB.STRING !== "string") require("fail"); - (function(sub) { + (function (sub) { // should not crash expect(sub.STRING).toBe("string"); })(OBJECT.SUB); }); -it("should define ARRAY", function() { +it("should define ARRAY", function () { (donotcallme) ARRAY; expect(Array.isArray(ARRAY)).toBeTruthy(); expect(ARRAY).toHaveLength(2); }); -it("should define ARRAY[0]", function() { +it("should define ARRAY[0]", function () { expect(ARRAY[0]).toBe(2); }); -it("should define ARRAY[1][0]", function() { +it("should define ARRAY[1][0]", function () { expect(Array.isArray(ARRAY[1])).toBeTruthy(); expect(ARRAY[1]).toHaveLength(1); expect(ARRAY[1][0]).toBe("six"); }); -it("should define process.env.DEFINED_NESTED_KEY", function() { +it("should define process.env.DEFINED_NESTED_KEY", function () { expect(process.env.DEFINED_NESTED_KEY).toBe(5); expect(typeof process.env.DEFINED_NESTED_KEY).toBe("number"); if (process.env.DEFINED_NESTED_KEY !== 5) require("fail"); @@ -180,7 +180,7 @@ it("should define process.env.DEFINED_NESTED_KEY", function() { var indirect = process.env; expect(indirect.DEFINED_NESTED_KEY).toBe(5); - (function(env) { + (function (env) { expect(env.DEFINED_NESTED_KEY).toBe(5); expect(typeof env.DEFINED_NESTED_KEY).toBe("number"); if (env.DEFINED_NESTED_KEY !== 5) require("fail"); @@ -231,7 +231,7 @@ it("should follow renamings in var (issue 5215)", function() { expect(DEFINED_NESTED_KEY).toBe(5); }); -it("should check that runtimeValue callback argument is a module", function() { +it("should check that runtimeValue callback argument is a module", function () { expect(RUNTIMEVALUE_CALLBACK_ARGUMENT_IS_A_MODULE).toEqual(true); }); @@ -250,48 +250,57 @@ it("should expand properly", function() { }); it("destructuring assignment", () => { - const {used} = OBJECT2; - const {['used']: used2, used: used3} = OBJECT2.sub; + const { used } = OBJECT2; + const { ["used"]: used2, used: used3 } = OBJECT2.sub; expect(used).toBe(used2); expect(used).toBe(used3); + + const { DEFINED_NESTED_KEY, DEFINED_NESTED_KEY_STRING } = process.env; + expect(DEFINED_NESTED_KEY).toBe(process.env.DEFINED_NESTED_KEY); + expect(DEFINED_NESTED_KEY_STRING).toBe(process.env.DEFINED_NESTED_KEY_STRING); + + const { BAZ, BAZZ } = FOO.BAR; + expect(BAZ).toBe(FOO.BAR.BAZ); + expect(BAZZ).toBe(FOO.BAR.BAZZ); + + const { BAZ: BAZ2 } = X.Y; + expect(BAZ2).toBe(X.Y.BAZ); }); -it('should allow shorthand property (issue #16764)', () => { +it("should allow shorthand property (issue #16764)", () => { const simple = { ONE, TRUE, NULL, STRING, BIGINT, NEGATIVE_NUMBER }; - expect(simple).toStrictEqual({ - ONE: 1, + expect(simple).toStrictEqual({ + ONE: 1, TRUE: true, - NULL: null, - STRING: "string", - BIGINT: BigInt("9007199254740993"), - NEGATIVE_NUMBER: -100.25 - }) + NULL: null, + STRING: "string", + BIGINT: BigInt("9007199254740993"), + NEGATIVE_NUMBER: -100.25 + }); const func = { FUNCTION }; expect(func.FUNCTION(3)).toBe(4); expect(typeof func.FUNCTION).toBe("function"); - + const code = { CODE }; expect(code.CODE).toBe(3); expect(typeof code.CODE).toBe("number"); - - + const regex = { REGEXP }; expect(regex.REGEXP.toString()).toBe("/abc/i"); expect(typeof regex.REGEXP).toBe("object"); - - const nested = { OBJECT } + + const nested = { OBJECT }; expect(nested.OBJECT.SUB.FUNCTION(7)).toBe(8); expect(nested.OBJECT.SUB.CODE).toBe(3); expect(nested.OBJECT.SUB.UNDEFINED).toBeUndefined(); expect(nested.OBJECT.SUB.REGEXP.toString()).toBe("/abc/i"); expect(nested.OBJECT.SUB.STRING).toBe("string"); - - const array = { ARRAY } - expect(array).toStrictEqual({ ARRAY: [2, ['six']] }) -}) + const array = { ARRAY }; + expect(array).toStrictEqual({ ARRAY: [2, ["six"]] }); +}); it("fails for unknown property", () => { - expect(() => ({ UNKNOWN })).toThrow("UNKNOWN is not defined") -}) \ No newline at end of file + expect(() => ({ UNKNOWN })).toThrow("UNKNOWN is not defined"); +}); diff --git a/test/configCases/plugins/define-plugin/webpack.config.js b/test/configCases/plugins/define-plugin/webpack.config.js index ae2f326a586..b73c8b9b110 100644 --- a/test/configCases/plugins/define-plugin/webpack.config.js +++ b/test/configCases/plugins/define-plugin/webpack.config.js @@ -64,7 +64,10 @@ module.exports = { used: 1, unused: "(() => throw new Error('unused property was rendered'))()" } - } + }, + "FOO.BAR.BAZ": 1, + "FOO.BAR.BAZZ": 2, + "X.Y.BAZ": 3 }) ] }; From 58aded34612fb648da9b8f60c49d8820c2a8163c Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 3 Jul 2025 14:26:23 +0300 Subject: [PATCH 42/56] test: resolve optional chaining test todo (#19651) --- .../defer-import/async-in-graph/webpack.config.js | 7 +------ .../defer-import/comment-error/webpack.config.js | 7 +------ .../defer-import/defer-but-sync-order/webpack.config.js | 8 +------- .../defer-runtime-concat-strict/webpack.config.js | 8 +------- .../defer-import/defer-runtime-concat/webpack.config.js | 8 +------- .../defer-runtime-native-syntax/webpack.config.js | 7 +------ .../defer-import/defer-runtime-strict/webpack.config.js | 7 +------ .../defer-import/defer-runtime/webpack.config.js | 7 +------ .../defer-import/defer-then-non-defer/webpack.config.js | 7 +------ .../defer-import/defer-used-in-async/webpack.config.js | 8 +------- .../webpack.config.js | 7 +------ 11 files changed, 11 insertions(+), 70 deletions(-) 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 3b7367c05b1..64d7b07d3e8 100644 --- a/test/configCases/defer-import/async-in-graph/webpack.config.js +++ b/test/configCases/defer-import/async-in-graph/webpack.config.js @@ -1,11 +1,6 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], mode: "none", experiments: { topLevelAwait: true, diff --git a/test/configCases/defer-import/comment-error/webpack.config.js b/test/configCases/defer-import/comment-error/webpack.config.js index 8911b899153..b1d898a6d0b 100644 --- a/test/configCases/defer-import/comment-error/webpack.config.js +++ b/test/configCases/defer-import/comment-error/webpack.config.js @@ -1,11 +1,6 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], experiments: { topLevelAwait: true, deferImport: true 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 bbfa4a8289d..e72757af771 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,12 +1,6 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, - optimization: {}, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], experiments: { deferImport: true } 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 2ca916d1c8c..4c47b61052b 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,13 +1,7 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], entry: ["../defer-runtime/all.js"], - optimization: {}, module: { rules: [ { 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 ecb8db57d72..9bc9efa7e8c 100644 --- a/test/configCases/defer-import/defer-runtime-concat/webpack.config.js +++ b/test/configCases/defer-import/defer-runtime-concat/webpack.config.js @@ -1,13 +1,7 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], entry: ["../defer-runtime/all.js"], - optimization: {}, experiments: { deferImport: true } 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 eae014e6d0f..86a95ddad7b 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,11 +1,6 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], entry: ["../defer-runtime/all-native-syntax.js"], optimization: { concatenateModules: false 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 8dd1133d3e4..cb106c8b37c 100644 --- a/test/configCases/defer-import/defer-runtime-strict/webpack.config.js +++ b/test/configCases/defer-import/defer-runtime-strict/webpack.config.js @@ -1,11 +1,6 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], entry: ["../defer-runtime/all.js"], optimization: { concatenateModules: false diff --git a/test/configCases/defer-import/defer-runtime/webpack.config.js b/test/configCases/defer-import/defer-runtime/webpack.config.js index 0c4162c9870..953151172ee 100644 --- a/test/configCases/defer-import/defer-runtime/webpack.config.js +++ b/test/configCases/defer-import/defer-runtime/webpack.config.js @@ -1,11 +1,6 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], entry: ["./all.js"], optimization: { concatenateModules: false 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 c0ef1403bc9..9915d3d5929 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,11 +1,6 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], optimization: { concatenateModules: true }, 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 2d32cf8ca25..b1d898a6d0b 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,12 +1,6 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - }, - optimization: {}, + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], experiments: { topLevelAwait: true, deferImport: true diff --git a/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/webpack.config.js b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/webpack.config.js index 5f126afb2ef..a928ee4500c 100644 --- a/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/webpack.config.js +++ b/test/configCases/defer-import/syntax-error-if-experiment-not-enabled/webpack.config.js @@ -1,9 +1,4 @@ /** @type {import("../../../../").Configuration} */ module.exports = { - output: { - // TODO: not sure why CI set optionalChaining to true on Node 10 and fails the test - environment: { - optionalChaining: false - } - } + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`] }; From 4fa1daa2c2ccd5ff969e30e9819b410f89a02039 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 3 Jul 2025 15:34:59 +0300 Subject: [PATCH 43/56] test: avoid extra logging in test (#19653) --- test/configCases/inner-graph/pr-18342/common/pure.js | 2 +- test/configCases/inner-graph/pr-18342/entry1/index.js | 3 +-- test/configCases/inner-graph/pr-18342/entry2/index.js | 3 +-- test/configCases/inner-graph/pr-18342/entry3/index.js | 5 +++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/test/configCases/inner-graph/pr-18342/common/pure.js b/test/configCases/inner-graph/pr-18342/common/pure.js index d70ac6f068b..a28916593c1 100644 --- a/test/configCases/inner-graph/pr-18342/common/pure.js +++ b/test/configCases/inner-graph/pr-18342/common/pure.js @@ -1,5 +1,5 @@ function pure() { - console.log('pureFn'); + 1; } export default pure diff --git a/test/configCases/inner-graph/pr-18342/entry1/index.js b/test/configCases/inner-graph/pr-18342/entry1/index.js index d5fb94c7209..d514bdea667 100644 --- a/test/configCases/inner-graph/pr-18342/entry1/index.js +++ b/test/configCases/inner-graph/pr-18342/entry1/index.js @@ -1,7 +1,6 @@ import common from "../common"; it("entry1 should compile and run", () => { - common() - console.log('entry1'); + common(); expect(true).toBe(true) }); diff --git a/test/configCases/inner-graph/pr-18342/entry2/index.js b/test/configCases/inner-graph/pr-18342/entry2/index.js index 7e6ccae0d4c..63df6e2511a 100644 --- a/test/configCases/inner-graph/pr-18342/entry2/index.js +++ b/test/configCases/inner-graph/pr-18342/entry2/index.js @@ -1,7 +1,6 @@ it("entry2 should compile and run", () => { import(/* webpackChunkName: "chunk-reason-webpackChunkName" */'../common').then(common => { - common.default() - console.log('entry2'); + common.default(); expect(true).toBe(true) }) }); diff --git a/test/configCases/inner-graph/pr-18342/entry3/index.js b/test/configCases/inner-graph/pr-18342/entry3/index.js index 1d863a1d7cb..8ee2345ccd8 100644 --- a/test/configCases/inner-graph/pr-18342/entry3/index.js +++ b/test/configCases/inner-graph/pr-18342/entry3/index.js @@ -1,7 +1,8 @@ +function nothing() {} + it("entry3 should compile and run", () => { import(/* webpackChunkName: "chunk-reason-webpackChunkName" */'./a.js').then(a => { - console.log(a.default); - console.log('entry3'); + nothing(a.default); expect(true).toBe(true) }) }); From cdf7ef54ea6b20ff03aebf0559bcde65dcbe684b Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 3 Jul 2025 16:11:10 +0300 Subject: [PATCH 44/56] test: issue-14800 --- .../define-plugin-process-env/index.js | 25 +++++++++++++++++++ .../webpack.config.js | 12 +++++++++ 2 files changed, 37 insertions(+) create mode 100644 test/configCases/plugins/define-plugin-process-env/index.js create mode 100644 test/configCases/plugins/define-plugin-process-env/webpack.config.js diff --git a/test/configCases/plugins/define-plugin-process-env/index.js b/test/configCases/plugins/define-plugin-process-env/index.js new file mode 100644 index 00000000000..c7c4ce1ef99 --- /dev/null +++ b/test/configCases/plugins/define-plugin-process-env/index.js @@ -0,0 +1,25 @@ +it("destructuring should work with 'process.env'", function () { + expect(process.env.NODE_ENV).toBe("production"); + + const { NODE_ENV } = process.env; + expect(NODE_ENV).toBe("production"); + + const { NODE_ENV: RENAME_NODE_ENV } = process.env; + expect(RENAME_NODE_ENV).toBe("production"); + + const { NODE_ENV: OTHER_RENAME_NODE_ENV, UNKNOWN } = process.env; + expect(OTHER_RENAME_NODE_ENV).not.toBe("production"); + expect(UNKNOWN).toBeUndefined(); + + expect(process.env.ENVIRONMENT).toBe("node"); + + const { ENVIRONMENT } = process.env; + expect(ENVIRONMENT).toBe("node"); + + const { ENVIRONMENT: RENAME_ENVIRONMENT } = process.env; + expect(RENAME_ENVIRONMENT).toBe("node"); + + const { ENVIRONMENT: OTHER_RENAME_ENVIRONMENT, OTHER_UNKNOWN } = process.env; + expect(OTHER_RENAME_ENVIRONMENT).toBeUndefined(); + expect(OTHER_UNKNOWN).toBeUndefined(); +}); diff --git a/test/configCases/plugins/define-plugin-process-env/webpack.config.js b/test/configCases/plugins/define-plugin-process-env/webpack.config.js new file mode 100644 index 00000000000..9b5277c52f1 --- /dev/null +++ b/test/configCases/plugins/define-plugin-process-env/webpack.config.js @@ -0,0 +1,12 @@ +const DefinePlugin = require("../../../../").DefinePlugin; + +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "node", + mode: "production", + plugins: [ + new DefinePlugin({ + "process.env.ENVIRONMENT": JSON.stringify("node") + }) + ] +}; From eaeea9c512acd6b79cc5a8d7ab9f1a7108d2b627 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 3 Jul 2025 16:28:36 +0300 Subject: [PATCH 45/56] test: issue 17014 --- .../check-defaults/errors.js | 0 .../check-defaults/index.js | 0 .../check-defaults/test.filter.js | 0 .../check-defaults/webpack.config.js | 0 .../chunk-format-fallback/dep.js | 0 .../chunk-format-fallback/index.js | 0 .../chunk-format-fallback/test.config.js | 0 .../chunk-format-fallback/webpack.config.js | 0 .../iife-entry-module-with-others/index.js | 0 .../iife-entry-module-with-others/module1.js | 0 .../iife-entry-module-with-others/module2.js | 0 .../iife-entry-module-with-others/module3.js | 0 .../iife-entry-module-with-others/module4.js | 0 .../test.config.js | 0 .../iife-entry-module-with-others/test.js | 0 .../webpack.config.js | 0 .../iife-innter-strict/foo.cjs | 0 .../iife-innter-strict/index.mjs | 0 .../iife-innter-strict/test.config.js | 0 .../iife-innter-strict/test.js | 0 .../iife-innter-strict/webpack.config.js | 0 .../iife-multiple-entry-modules/index1.js | 0 .../iife-multiple-entry-modules/index2.js | 0 .../test.config.js | 0 .../iife-multiple-entry-modules/test.js | 0 .../webpack.config.js | 0 .../issue-16040/bar.css | 0 .../issue-16040/bar.js | 0 .../issue-16040/foo.css | 0 .../issue-16040/foo.js | 0 .../issue-16040/index.js | 0 .../issue-16040/test.config.js | 0 .../issue-16040/test.filter.js | 0 .../issue-16040/webpack.config.js | 0 .../issue-17014-split-chunks/common.js} | 0 .../module/issue-17014-split-chunks/index.js | 5 +++++ .../issue-17014-split-chunks/test.config.js | 5 +++++ .../webpack.config.js | 22 +++++++++++++++++++ .../module/issue-17014-webworker/index.js | 13 +++++++++++ .../module/issue-17014-webworker/module.js | 3 +++ .../issue-17014-webworker/test.config.js | 5 +++++ .../issue-17014-webworker/test.filter.js | 3 +++ .../issue-17014-webworker/webpack.config.js | 16 ++++++++++++++ .../module/issue-17014-webworker/worker.js | 6 +++++ .../node-globals/cjs/file.js | 0 .../node-globals/cjs/package.json | 0 .../node-globals/index.js | 0 .../node-globals/test.config.js | 0 .../node-globals/webpack.config.js | 0 .../non-webpack-require/baz.js | 0 .../non-webpack-require/index.js | 0 .../non-webpack-require/mod.js | 0 .../non-webpack-require/test.filter.js | 0 .../non-webpack-require/webpack.config.js | 0 .../simple => module/public-path}/chunk.js | 0 .../public-path/chunk1.js | 0 .../public-path/index.js | 0 .../public-path/test.config.js | 0 .../public-path/webpack.config.js | 0 .../reuse-webpack-esm-library/index.js | 0 .../reuse-webpack-esm-library/lib.js | 0 .../reuse-webpack-esm-library/react.js | 0 .../webpack.config.js | 0 test/configCases/module/simple/chunk.js | 1 + .../{output-module => module}/simple/index.js | 0 .../simple/webpack.config.js | 0 66 files changed, 79 insertions(+) rename test/configCases/{output-module => module}/check-defaults/errors.js (100%) rename test/configCases/{output-module => module}/check-defaults/index.js (100%) rename test/configCases/{output-module => module}/check-defaults/test.filter.js (100%) rename test/configCases/{output-module => module}/check-defaults/webpack.config.js (100%) rename test/configCases/{output-module => module}/chunk-format-fallback/dep.js (100%) rename test/configCases/{output-module => module}/chunk-format-fallback/index.js (100%) rename test/configCases/{output-module => module}/chunk-format-fallback/test.config.js (100%) rename test/configCases/{output-module => module}/chunk-format-fallback/webpack.config.js (100%) rename test/configCases/{output-module => module}/iife-entry-module-with-others/index.js (100%) rename test/configCases/{output-module => module}/iife-entry-module-with-others/module1.js (100%) rename test/configCases/{output-module => module}/iife-entry-module-with-others/module2.js (100%) rename test/configCases/{output-module => module}/iife-entry-module-with-others/module3.js (100%) rename test/configCases/{output-module => module}/iife-entry-module-with-others/module4.js (100%) rename test/configCases/{output-module => module}/iife-entry-module-with-others/test.config.js (100%) rename test/configCases/{output-module => module}/iife-entry-module-with-others/test.js (100%) rename test/configCases/{output-module => module}/iife-entry-module-with-others/webpack.config.js (100%) rename test/configCases/{output-module => module}/iife-innter-strict/foo.cjs (100%) rename test/configCases/{output-module => module}/iife-innter-strict/index.mjs (100%) rename test/configCases/{output-module => module}/iife-innter-strict/test.config.js (100%) rename test/configCases/{output-module => module}/iife-innter-strict/test.js (100%) rename test/configCases/{output-module => module}/iife-innter-strict/webpack.config.js (100%) rename test/configCases/{output-module => module}/iife-multiple-entry-modules/index1.js (100%) rename test/configCases/{output-module => module}/iife-multiple-entry-modules/index2.js (100%) rename test/configCases/{output-module => module}/iife-multiple-entry-modules/test.config.js (100%) rename test/configCases/{output-module => module}/iife-multiple-entry-modules/test.js (100%) rename test/configCases/{output-module => module}/iife-multiple-entry-modules/webpack.config.js (100%) rename test/configCases/{output-module => module}/issue-16040/bar.css (100%) rename test/configCases/{output-module => module}/issue-16040/bar.js (100%) rename test/configCases/{output-module => module}/issue-16040/foo.css (100%) rename test/configCases/{output-module => module}/issue-16040/foo.js (100%) rename test/configCases/{output-module => module}/issue-16040/index.js (100%) rename test/configCases/{output-module => module}/issue-16040/test.config.js (100%) rename test/configCases/{output-module => module}/issue-16040/test.filter.js (100%) rename test/configCases/{output-module => module}/issue-16040/webpack.config.js (100%) rename test/configCases/{output-module/public-path/chunk.js => module/issue-17014-split-chunks/common.js} (100%) create mode 100644 test/configCases/module/issue-17014-split-chunks/index.js create mode 100644 test/configCases/module/issue-17014-split-chunks/test.config.js create mode 100644 test/configCases/module/issue-17014-split-chunks/webpack.config.js create mode 100644 test/configCases/module/issue-17014-webworker/index.js create mode 100644 test/configCases/module/issue-17014-webworker/module.js create mode 100644 test/configCases/module/issue-17014-webworker/test.config.js create mode 100644 test/configCases/module/issue-17014-webworker/test.filter.js create mode 100644 test/configCases/module/issue-17014-webworker/webpack.config.js create mode 100644 test/configCases/module/issue-17014-webworker/worker.js rename test/configCases/{output-module => module}/node-globals/cjs/file.js (100%) rename test/configCases/{output-module => module}/node-globals/cjs/package.json (100%) rename test/configCases/{output-module => module}/node-globals/index.js (100%) rename test/configCases/{output-module => module}/node-globals/test.config.js (100%) rename test/configCases/{output-module => module}/node-globals/webpack.config.js (100%) rename test/configCases/{output-module => module}/non-webpack-require/baz.js (100%) rename test/configCases/{output-module => module}/non-webpack-require/index.js (100%) rename test/configCases/{output-module => module}/non-webpack-require/mod.js (100%) rename test/configCases/{output-module => module}/non-webpack-require/test.filter.js (100%) rename test/configCases/{output-module => module}/non-webpack-require/webpack.config.js (100%) rename test/configCases/{output-module/simple => module/public-path}/chunk.js (100%) rename test/configCases/{output-module => module}/public-path/chunk1.js (100%) rename test/configCases/{output-module => module}/public-path/index.js (100%) rename test/configCases/{output-module => module}/public-path/test.config.js (100%) rename test/configCases/{output-module => module}/public-path/webpack.config.js (100%) rename test/configCases/{output-module => module}/reuse-webpack-esm-library/index.js (100%) rename test/configCases/{output-module => module}/reuse-webpack-esm-library/lib.js (100%) rename test/configCases/{output-module => module}/reuse-webpack-esm-library/react.js (100%) rename test/configCases/{output-module => module}/reuse-webpack-esm-library/webpack.config.js (100%) create mode 100644 test/configCases/module/simple/chunk.js rename test/configCases/{output-module => module}/simple/index.js (100%) rename test/configCases/{output-module => module}/simple/webpack.config.js (100%) diff --git a/test/configCases/output-module/check-defaults/errors.js b/test/configCases/module/check-defaults/errors.js similarity index 100% rename from test/configCases/output-module/check-defaults/errors.js rename to test/configCases/module/check-defaults/errors.js diff --git a/test/configCases/output-module/check-defaults/index.js b/test/configCases/module/check-defaults/index.js similarity index 100% rename from test/configCases/output-module/check-defaults/index.js rename to test/configCases/module/check-defaults/index.js diff --git a/test/configCases/output-module/check-defaults/test.filter.js b/test/configCases/module/check-defaults/test.filter.js similarity index 100% rename from test/configCases/output-module/check-defaults/test.filter.js rename to test/configCases/module/check-defaults/test.filter.js diff --git a/test/configCases/output-module/check-defaults/webpack.config.js b/test/configCases/module/check-defaults/webpack.config.js similarity index 100% rename from test/configCases/output-module/check-defaults/webpack.config.js rename to test/configCases/module/check-defaults/webpack.config.js diff --git a/test/configCases/output-module/chunk-format-fallback/dep.js b/test/configCases/module/chunk-format-fallback/dep.js similarity index 100% rename from test/configCases/output-module/chunk-format-fallback/dep.js rename to test/configCases/module/chunk-format-fallback/dep.js diff --git a/test/configCases/output-module/chunk-format-fallback/index.js b/test/configCases/module/chunk-format-fallback/index.js similarity index 100% rename from test/configCases/output-module/chunk-format-fallback/index.js rename to test/configCases/module/chunk-format-fallback/index.js diff --git a/test/configCases/output-module/chunk-format-fallback/test.config.js b/test/configCases/module/chunk-format-fallback/test.config.js similarity index 100% rename from test/configCases/output-module/chunk-format-fallback/test.config.js rename to test/configCases/module/chunk-format-fallback/test.config.js diff --git a/test/configCases/output-module/chunk-format-fallback/webpack.config.js b/test/configCases/module/chunk-format-fallback/webpack.config.js similarity index 100% rename from test/configCases/output-module/chunk-format-fallback/webpack.config.js rename to test/configCases/module/chunk-format-fallback/webpack.config.js diff --git a/test/configCases/output-module/iife-entry-module-with-others/index.js b/test/configCases/module/iife-entry-module-with-others/index.js similarity index 100% rename from test/configCases/output-module/iife-entry-module-with-others/index.js rename to test/configCases/module/iife-entry-module-with-others/index.js diff --git a/test/configCases/output-module/iife-entry-module-with-others/module1.js b/test/configCases/module/iife-entry-module-with-others/module1.js similarity index 100% rename from test/configCases/output-module/iife-entry-module-with-others/module1.js rename to test/configCases/module/iife-entry-module-with-others/module1.js diff --git a/test/configCases/output-module/iife-entry-module-with-others/module2.js b/test/configCases/module/iife-entry-module-with-others/module2.js similarity index 100% rename from test/configCases/output-module/iife-entry-module-with-others/module2.js rename to test/configCases/module/iife-entry-module-with-others/module2.js diff --git a/test/configCases/output-module/iife-entry-module-with-others/module3.js b/test/configCases/module/iife-entry-module-with-others/module3.js similarity index 100% rename from test/configCases/output-module/iife-entry-module-with-others/module3.js rename to test/configCases/module/iife-entry-module-with-others/module3.js diff --git a/test/configCases/output-module/iife-entry-module-with-others/module4.js b/test/configCases/module/iife-entry-module-with-others/module4.js similarity index 100% rename from test/configCases/output-module/iife-entry-module-with-others/module4.js rename to test/configCases/module/iife-entry-module-with-others/module4.js diff --git a/test/configCases/output-module/iife-entry-module-with-others/test.config.js b/test/configCases/module/iife-entry-module-with-others/test.config.js similarity index 100% rename from test/configCases/output-module/iife-entry-module-with-others/test.config.js rename to test/configCases/module/iife-entry-module-with-others/test.config.js diff --git a/test/configCases/output-module/iife-entry-module-with-others/test.js b/test/configCases/module/iife-entry-module-with-others/test.js similarity index 100% rename from test/configCases/output-module/iife-entry-module-with-others/test.js rename to test/configCases/module/iife-entry-module-with-others/test.js diff --git a/test/configCases/output-module/iife-entry-module-with-others/webpack.config.js b/test/configCases/module/iife-entry-module-with-others/webpack.config.js similarity index 100% rename from test/configCases/output-module/iife-entry-module-with-others/webpack.config.js rename to test/configCases/module/iife-entry-module-with-others/webpack.config.js diff --git a/test/configCases/output-module/iife-innter-strict/foo.cjs b/test/configCases/module/iife-innter-strict/foo.cjs similarity index 100% rename from test/configCases/output-module/iife-innter-strict/foo.cjs rename to test/configCases/module/iife-innter-strict/foo.cjs diff --git a/test/configCases/output-module/iife-innter-strict/index.mjs b/test/configCases/module/iife-innter-strict/index.mjs similarity index 100% rename from test/configCases/output-module/iife-innter-strict/index.mjs rename to test/configCases/module/iife-innter-strict/index.mjs diff --git a/test/configCases/output-module/iife-innter-strict/test.config.js b/test/configCases/module/iife-innter-strict/test.config.js similarity index 100% rename from test/configCases/output-module/iife-innter-strict/test.config.js rename to test/configCases/module/iife-innter-strict/test.config.js diff --git a/test/configCases/output-module/iife-innter-strict/test.js b/test/configCases/module/iife-innter-strict/test.js similarity index 100% rename from test/configCases/output-module/iife-innter-strict/test.js rename to test/configCases/module/iife-innter-strict/test.js diff --git a/test/configCases/output-module/iife-innter-strict/webpack.config.js b/test/configCases/module/iife-innter-strict/webpack.config.js similarity index 100% rename from test/configCases/output-module/iife-innter-strict/webpack.config.js rename to test/configCases/module/iife-innter-strict/webpack.config.js diff --git a/test/configCases/output-module/iife-multiple-entry-modules/index1.js b/test/configCases/module/iife-multiple-entry-modules/index1.js similarity index 100% rename from test/configCases/output-module/iife-multiple-entry-modules/index1.js rename to test/configCases/module/iife-multiple-entry-modules/index1.js diff --git a/test/configCases/output-module/iife-multiple-entry-modules/index2.js b/test/configCases/module/iife-multiple-entry-modules/index2.js similarity index 100% rename from test/configCases/output-module/iife-multiple-entry-modules/index2.js rename to test/configCases/module/iife-multiple-entry-modules/index2.js diff --git a/test/configCases/output-module/iife-multiple-entry-modules/test.config.js b/test/configCases/module/iife-multiple-entry-modules/test.config.js similarity index 100% rename from test/configCases/output-module/iife-multiple-entry-modules/test.config.js rename to test/configCases/module/iife-multiple-entry-modules/test.config.js diff --git a/test/configCases/output-module/iife-multiple-entry-modules/test.js b/test/configCases/module/iife-multiple-entry-modules/test.js similarity index 100% rename from test/configCases/output-module/iife-multiple-entry-modules/test.js rename to test/configCases/module/iife-multiple-entry-modules/test.js diff --git a/test/configCases/output-module/iife-multiple-entry-modules/webpack.config.js b/test/configCases/module/iife-multiple-entry-modules/webpack.config.js similarity index 100% rename from test/configCases/output-module/iife-multiple-entry-modules/webpack.config.js rename to test/configCases/module/iife-multiple-entry-modules/webpack.config.js diff --git a/test/configCases/output-module/issue-16040/bar.css b/test/configCases/module/issue-16040/bar.css similarity index 100% rename from test/configCases/output-module/issue-16040/bar.css rename to test/configCases/module/issue-16040/bar.css diff --git a/test/configCases/output-module/issue-16040/bar.js b/test/configCases/module/issue-16040/bar.js similarity index 100% rename from test/configCases/output-module/issue-16040/bar.js rename to test/configCases/module/issue-16040/bar.js diff --git a/test/configCases/output-module/issue-16040/foo.css b/test/configCases/module/issue-16040/foo.css similarity index 100% rename from test/configCases/output-module/issue-16040/foo.css rename to test/configCases/module/issue-16040/foo.css diff --git a/test/configCases/output-module/issue-16040/foo.js b/test/configCases/module/issue-16040/foo.js similarity index 100% rename from test/configCases/output-module/issue-16040/foo.js rename to test/configCases/module/issue-16040/foo.js diff --git a/test/configCases/output-module/issue-16040/index.js b/test/configCases/module/issue-16040/index.js similarity index 100% rename from test/configCases/output-module/issue-16040/index.js rename to test/configCases/module/issue-16040/index.js diff --git a/test/configCases/output-module/issue-16040/test.config.js b/test/configCases/module/issue-16040/test.config.js similarity index 100% rename from test/configCases/output-module/issue-16040/test.config.js rename to test/configCases/module/issue-16040/test.config.js diff --git a/test/configCases/output-module/issue-16040/test.filter.js b/test/configCases/module/issue-16040/test.filter.js similarity index 100% rename from test/configCases/output-module/issue-16040/test.filter.js rename to test/configCases/module/issue-16040/test.filter.js diff --git a/test/configCases/output-module/issue-16040/webpack.config.js b/test/configCases/module/issue-16040/webpack.config.js similarity index 100% rename from test/configCases/output-module/issue-16040/webpack.config.js rename to test/configCases/module/issue-16040/webpack.config.js diff --git a/test/configCases/output-module/public-path/chunk.js b/test/configCases/module/issue-17014-split-chunks/common.js similarity index 100% rename from test/configCases/output-module/public-path/chunk.js rename to test/configCases/module/issue-17014-split-chunks/common.js diff --git a/test/configCases/module/issue-17014-split-chunks/index.js b/test/configCases/module/issue-17014-split-chunks/index.js new file mode 100644 index 00000000000..5bf957bfc00 --- /dev/null +++ b/test/configCases/module/issue-17014-split-chunks/index.js @@ -0,0 +1,5 @@ +import common from './common.js' + +it("should work", () => { + expect(common).toBe(42); +}); diff --git a/test/configCases/module/issue-17014-split-chunks/test.config.js b/test/configCases/module/issue-17014-split-chunks/test.config.js new file mode 100644 index 00000000000..573e3dabc47 --- /dev/null +++ b/test/configCases/module/issue-17014-split-chunks/test.config.js @@ -0,0 +1,5 @@ +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 new file mode 100644 index 00000000000..4a5d18e5483 --- /dev/null +++ b/test/configCases/module/issue-17014-split-chunks/webpack.config.js @@ -0,0 +1,22 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + module: true + }, + experiments: { + outputModule: true + }, + target: "es2020", + optimization: { + splitChunks: { + cacheGroups: { + common: { + test: /common\.js/, + minSize: 0, + chunks: "all", + filename: "common.mjs" + } + } + } + } +}; diff --git a/test/configCases/module/issue-17014-webworker/index.js b/test/configCases/module/issue-17014-webworker/index.js new file mode 100644 index 00000000000..0f53a08e561 --- /dev/null +++ b/test/configCases/module/issue-17014-webworker/index.js @@ -0,0 +1,13 @@ +it("should work", async () => { + const worker = new Worker(new URL("./worker.js", import.meta.url), { + type: "module" + }); + worker.postMessage("ok"); + const result = await new Promise(resolve => { + worker.onmessage = event => { + resolve(event.data); + }; + }); + expect(result).toBe("data: OK, thanks"); + await worker.terminate(); +}); diff --git a/test/configCases/module/issue-17014-webworker/module.js b/test/configCases/module/issue-17014-webworker/module.js new file mode 100644 index 00000000000..bbba56c3885 --- /dev/null +++ b/test/configCases/module/issue-17014-webworker/module.js @@ -0,0 +1,3 @@ +export default function upper(str) { + return str.toUpperCase(); +} diff --git a/test/configCases/module/issue-17014-webworker/test.config.js b/test/configCases/module/issue-17014-webworker/test.config.js new file mode 100644 index 00000000000..7c59f2b5e80 --- /dev/null +++ b/test/configCases/module/issue-17014-webworker/test.config.js @@ -0,0 +1,5 @@ +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 new file mode 100644 index 00000000000..d456e8870d2 --- /dev/null +++ b/test/configCases/module/issue-17014-webworker/test.filter.js @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000000..b56e3a37c55 --- /dev/null +++ b/test/configCases/module/issue-17014-webworker/webpack.config.js @@ -0,0 +1,16 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + module: true + }, + experiments: { + outputModule: true + }, + target: ["web", "es2020"], + optimization: { + splitChunks: { + minSize: 1, + maxSize: 1 + } + } +}; diff --git a/test/configCases/module/issue-17014-webworker/worker.js b/test/configCases/module/issue-17014-webworker/worker.js new file mode 100644 index 00000000000..4af5b2b1b54 --- /dev/null +++ b/test/configCases/module/issue-17014-webworker/worker.js @@ -0,0 +1,6 @@ +import upper from "./module.js"; + +self.onmessage = async event => { + + postMessage(`data: ${upper(event.data)}, thanks`); +}; diff --git a/test/configCases/output-module/node-globals/cjs/file.js b/test/configCases/module/node-globals/cjs/file.js similarity index 100% rename from test/configCases/output-module/node-globals/cjs/file.js rename to test/configCases/module/node-globals/cjs/file.js diff --git a/test/configCases/output-module/node-globals/cjs/package.json b/test/configCases/module/node-globals/cjs/package.json similarity index 100% rename from test/configCases/output-module/node-globals/cjs/package.json rename to test/configCases/module/node-globals/cjs/package.json diff --git a/test/configCases/output-module/node-globals/index.js b/test/configCases/module/node-globals/index.js similarity index 100% rename from test/configCases/output-module/node-globals/index.js rename to test/configCases/module/node-globals/index.js diff --git a/test/configCases/output-module/node-globals/test.config.js b/test/configCases/module/node-globals/test.config.js similarity index 100% rename from test/configCases/output-module/node-globals/test.config.js rename to test/configCases/module/node-globals/test.config.js diff --git a/test/configCases/output-module/node-globals/webpack.config.js b/test/configCases/module/node-globals/webpack.config.js similarity index 100% rename from test/configCases/output-module/node-globals/webpack.config.js rename to test/configCases/module/node-globals/webpack.config.js diff --git a/test/configCases/output-module/non-webpack-require/baz.js b/test/configCases/module/non-webpack-require/baz.js similarity index 100% rename from test/configCases/output-module/non-webpack-require/baz.js rename to test/configCases/module/non-webpack-require/baz.js diff --git a/test/configCases/output-module/non-webpack-require/index.js b/test/configCases/module/non-webpack-require/index.js similarity index 100% rename from test/configCases/output-module/non-webpack-require/index.js rename to test/configCases/module/non-webpack-require/index.js diff --git a/test/configCases/output-module/non-webpack-require/mod.js b/test/configCases/module/non-webpack-require/mod.js similarity index 100% rename from test/configCases/output-module/non-webpack-require/mod.js rename to test/configCases/module/non-webpack-require/mod.js diff --git a/test/configCases/output-module/non-webpack-require/test.filter.js b/test/configCases/module/non-webpack-require/test.filter.js similarity index 100% rename from test/configCases/output-module/non-webpack-require/test.filter.js rename to test/configCases/module/non-webpack-require/test.filter.js diff --git a/test/configCases/output-module/non-webpack-require/webpack.config.js b/test/configCases/module/non-webpack-require/webpack.config.js similarity index 100% rename from test/configCases/output-module/non-webpack-require/webpack.config.js rename to test/configCases/module/non-webpack-require/webpack.config.js diff --git a/test/configCases/output-module/simple/chunk.js b/test/configCases/module/public-path/chunk.js similarity index 100% rename from test/configCases/output-module/simple/chunk.js rename to test/configCases/module/public-path/chunk.js diff --git a/test/configCases/output-module/public-path/chunk1.js b/test/configCases/module/public-path/chunk1.js similarity index 100% rename from test/configCases/output-module/public-path/chunk1.js rename to test/configCases/module/public-path/chunk1.js diff --git a/test/configCases/output-module/public-path/index.js b/test/configCases/module/public-path/index.js similarity index 100% rename from test/configCases/output-module/public-path/index.js rename to test/configCases/module/public-path/index.js diff --git a/test/configCases/output-module/public-path/test.config.js b/test/configCases/module/public-path/test.config.js similarity index 100% rename from test/configCases/output-module/public-path/test.config.js rename to test/configCases/module/public-path/test.config.js diff --git a/test/configCases/output-module/public-path/webpack.config.js b/test/configCases/module/public-path/webpack.config.js similarity index 100% rename from test/configCases/output-module/public-path/webpack.config.js rename to test/configCases/module/public-path/webpack.config.js diff --git a/test/configCases/output-module/reuse-webpack-esm-library/index.js b/test/configCases/module/reuse-webpack-esm-library/index.js similarity index 100% rename from test/configCases/output-module/reuse-webpack-esm-library/index.js rename to test/configCases/module/reuse-webpack-esm-library/index.js diff --git a/test/configCases/output-module/reuse-webpack-esm-library/lib.js b/test/configCases/module/reuse-webpack-esm-library/lib.js similarity index 100% rename from test/configCases/output-module/reuse-webpack-esm-library/lib.js rename to test/configCases/module/reuse-webpack-esm-library/lib.js diff --git a/test/configCases/output-module/reuse-webpack-esm-library/react.js b/test/configCases/module/reuse-webpack-esm-library/react.js similarity index 100% rename from test/configCases/output-module/reuse-webpack-esm-library/react.js rename to test/configCases/module/reuse-webpack-esm-library/react.js diff --git a/test/configCases/output-module/reuse-webpack-esm-library/webpack.config.js b/test/configCases/module/reuse-webpack-esm-library/webpack.config.js similarity index 100% rename from test/configCases/output-module/reuse-webpack-esm-library/webpack.config.js rename to test/configCases/module/reuse-webpack-esm-library/webpack.config.js diff --git a/test/configCases/module/simple/chunk.js b/test/configCases/module/simple/chunk.js new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/configCases/module/simple/chunk.js @@ -0,0 +1 @@ +export default 42; diff --git a/test/configCases/output-module/simple/index.js b/test/configCases/module/simple/index.js similarity index 100% rename from test/configCases/output-module/simple/index.js rename to test/configCases/module/simple/index.js diff --git a/test/configCases/output-module/simple/webpack.config.js b/test/configCases/module/simple/webpack.config.js similarity index 100% rename from test/configCases/output-module/simple/webpack.config.js rename to test/configCases/module/simple/webpack.config.js From a11302288d2a8851ff89405a122c1d04709574ea Mon Sep 17 00:00:00 2001 From: Ryuya Date: Thu, 3 Jul 2025 08:09:39 -0700 Subject: [PATCH 46/56] feat: enable ESM worker chunk loading for Node.js targets (#19640) --- lib/config/defaults.js | 2 +- lib/config/target.js | 6 +- test/Defaults.unittest.js | 183 ++++++++++++++++++ .../worker/node-worker-async-node/chunk.js | 3 + .../worker/node-worker-async-node/index.js | 22 +++ .../node-worker-async-node/test.config.js | 20 ++ .../node-worker-async-node/test.filter.js | 3 + .../node-worker-async-node/webpack.config.js | 11 ++ .../worker/node-worker-async-node/worker.js | 8 + .../worker/node-worker-esm/chunk.js | 3 + .../worker/node-worker-esm/index.js | 22 +++ .../worker/node-worker-esm/test.config.js | 24 +++ .../worker/node-worker-esm/test.filter.js | 3 + .../worker/node-worker-esm/webpack.config.js | 15 ++ .../worker/node-worker-esm/worker.js | 8 + 15 files changed, 329 insertions(+), 4 deletions(-) create mode 100644 test/configCases/worker/node-worker-async-node/chunk.js create mode 100644 test/configCases/worker/node-worker-async-node/index.js create mode 100644 test/configCases/worker/node-worker-async-node/test.config.js create mode 100644 test/configCases/worker/node-worker-async-node/test.filter.js create mode 100644 test/configCases/worker/node-worker-async-node/webpack.config.js create mode 100644 test/configCases/worker/node-worker-async-node/worker.js create mode 100644 test/configCases/worker/node-worker-esm/chunk.js create mode 100644 test/configCases/worker/node-worker-esm/index.js create mode 100644 test/configCases/worker/node-worker-esm/test.config.js create mode 100644 test/configCases/worker/node-worker-esm/test.filter.js create mode 100644 test/configCases/worker/node-worker-esm/webpack.config.js create mode 100644 test/configCases/worker/node-worker-esm/worker.js diff --git a/lib/config/defaults.js b/lib/config/defaults.js index cbeb5ad74ea..3f4c4618a74 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -1242,7 +1242,7 @@ const applyOutputDefaults = ( tp.nodeBuiltins === null || tp.importScriptsInWorker === null) && output.module && - environment.dynamicImport + environment.dynamicImportInWorker ) { return "universal"; } diff --git a/lib/config/target.js b/lib/config/target.js index 2ddb5456a31..235019d665c 100644 --- a/lib/config/target.js +++ b/lib/config/target.js @@ -194,7 +194,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis destructuring: v(6), bigIntLiteral: v(10, 4), dynamicImport: v(12, 17), - dynamicImportInWorker: major ? false : undefined, + dynamicImportInWorker: v(12, 17), module: v(12, 17) }; } @@ -240,7 +240,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis destructuring: v(1, 1), bigIntLiteral: v(4), dynamicImport: v(11), - dynamicImportInWorker: major ? false : undefined, + dynamicImportInWorker: v(11), module: v(11) }; } @@ -278,7 +278,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis destructuring: v(0, 15), bigIntLiteral: v(0, 32), dynamicImport: v(0, 43), - dynamicImportInWorker: major ? false : undefined, + dynamicImportInWorker: v(0, 44), module: v(0, 43) }; } diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js index 61b758e9fcd..a51333d2065 100644 --- a/test/Defaults.unittest.js +++ b/test/Defaults.unittest.js @@ -2688,6 +2688,183 @@ describe("snapshots", () => { + /^(.+?[\\\\/]node_modules[\\\\/])/, `) ); + + test( + "target node with ESM output", + { target: "node14", experiments: { outputModule: true } }, + e => + e.toMatchInlineSnapshot(` + - Expected + + Received + + @@ ... @@ + - "outputModule": false, + + "outputModule": true, + @@ ... @@ + - "node": false, + + "node": true, + @@ ... @@ + - "web": true, + + "web": false, + @@ ... @@ + - "externalsType": "var", + + "externalsType": "module-import", + @@ ... @@ + - "document": true, + - "dynamicImport": undefined, + - "dynamicImportInWorker": undefined, + + "document": false, + + "dynamicImport": true, + + "dynamicImportInWorker": true, + @@ ... @@ + - "globalThis": undefined, + - "module": undefined, + - "nodePrefixForCoreModules": true, + + "globalThis": true, + + "module": true, + + "nodePrefixForCoreModules": false, + @@ ... @@ + - "target": "web", + + "target": "node", + @@ ... @@ + - "createRequire": false, + + "createRequire": true, + @@ ... @@ + - "__dirname": "mock", + - "__filename": "mock", + - "global": true, + + "__dirname": "node-module", + + "__filename": "node-module", + + "global": false, + @@ ... @@ + - "chunkFilename": "[name].js", + - "chunkFormat": "array-push", + + "chunkFilename": "[name].mjs", + + "chunkFormat": "module", + @@ ... @@ + - "chunkLoading": "jsonp", + + "chunkLoading": "import", + @@ ... @@ + - "jsonp", + - "import-scripts", + + "import", + @@ ... @@ + - "fetch", + + "async-node", + @@ ... @@ + - "document": true, + - "dynamicImport": undefined, + - "dynamicImportInWorker": undefined, + + "document": false, + + "dynamicImport": true, + + "dynamicImportInWorker": true, + @@ ... @@ + - "globalThis": undefined, + - "module": undefined, + - "nodePrefixForCoreModules": true, + + "globalThis": true, + + "module": true, + + "nodePrefixForCoreModules": false, + @@ ... @@ + - "filename": "[name].js", + - "globalObject": "self", + + "filename": "[name].mjs", + + "globalObject": "global", + @@ ... @@ + - "hotUpdateChunkFilename": "[id].[fullhash].hot-update.js", + + "hotUpdateChunkFilename": "[id].[fullhash].hot-update.mjs", + @@ ... @@ + - "hotUpdateMainFilename": "[runtime].[fullhash].hot-update.json", + + "hotUpdateMainFilename": "[runtime].[fullhash].hot-update.json.mjs", + @@ ... @@ + - "iife": true, + + "iife": false, + @@ ... @@ + - "module": false, + + "module": true, + @@ ... @@ + - "scriptType": false, + + "scriptType": "module", + @@ ... @@ + - "wasmLoading": "fetch", + + "wasmLoading": "async-node", + @@ ... @@ + - "workerChunkLoading": "import-scripts", + + "workerChunkLoading": "import", + @@ ... @@ + - "workerWasmLoading": "fetch", + + "workerWasmLoading": "async-node", + @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + - "browser", + + "node", + @@ ... @@ + - "target": "web", + + "target": "node14", + `) + ); }); describe("Targets", () => { @@ -2709,6 +2886,12 @@ describe("Targets", () => { - Expected + Received + @@ ... @@ + - "dynamicImportInWorker": true, + + "dynamicImportInWorker": false, + @@ ... @@ + - "dynamicImportInWorker": true, + + "dynamicImportInWorker": false, @@ ... @@ - "target": "node12.17", + "target": "browserslist: node 12.17", diff --git a/test/configCases/worker/node-worker-async-node/chunk.js b/test/configCases/worker/node-worker-async-node/chunk.js new file mode 100644 index 00000000000..2c52aca6628 --- /dev/null +++ b/test/configCases/worker/node-worker-async-node/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-async-node/index.js b/test/configCases/worker/node-worker-async-node/index.js new file mode 100644 index 00000000000..55035f56b64 --- /dev/null +++ b/test/configCases/worker/node-worker-async-node/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-async-node/test.config.js b/test/configCases/worker/node-worker-async-node/test.config.js new file mode 100644 index 00000000000..9656284e0b7 --- /dev/null +++ b/test/configCases/worker/node-worker-async-node/test.config.js @@ -0,0 +1,20 @@ +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 (!/ReadFile \+ VM\.run chunk loading for javascript/.test(workerCode)) { + throw new Error( + "require('fs').readFile(...) and require('vm').runInThisContext were not found in the worker code for loading async chunks" + ); + } + } +}; diff --git a/test/configCases/worker/node-worker-async-node/test.filter.js b/test/configCases/worker/node-worker-async-node/test.filter.js new file mode 100644 index 00000000000..d456e8870d2 --- /dev/null +++ b/test/configCases/worker/node-worker-async-node/test.filter.js @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000000..e12e3859b22 --- /dev/null +++ b/test/configCases/worker/node-worker-async-node/webpack.config.js @@ -0,0 +1,11 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "async-node14", + entry: "./index.js", + optimization: { + chunkIds: "named" + }, + output: { + filename: "bundle.js" + } +}; diff --git a/test/configCases/worker/node-worker-async-node/worker.js b/test/configCases/worker/node-worker-async-node/worker.js new file mode 100644 index 00000000000..7db06d04718 --- /dev/null +++ b/test/configCases/worker/node-worker-async-node/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-esm/chunk.js b/test/configCases/worker/node-worker-esm/chunk.js new file mode 100644 index 00000000000..2c52aca6628 --- /dev/null +++ b/test/configCases/worker/node-worker-esm/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/index.js b/test/configCases/worker/node-worker-esm/index.js new file mode 100644 index 00000000000..55035f56b64 --- /dev/null +++ b/test/configCases/worker/node-worker-esm/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-esm/test.config.js b/test/configCases/worker/node-worker-esm/test.config.js new file mode 100644 index 00000000000..aac7fff6c82 --- /dev/null +++ b/test/configCases/worker/node-worker-esm/test.config.js @@ -0,0 +1,24 @@ +const fs = require("fs"); +const path = require("path"); +const { URL } = require("url"); + +module.exports = { + findBundle() { + return "./bundle.mjs"; + }, + moduleScope(scope) { + scope.URL = URL; + }, + afterExecute(options) { + const workerCode = fs.readFileSync( + path.resolve(options.output.path, "./worker_js.bundle.mjs"), + "utf8" + ); + + if (!/import\(\) chunk loading for javascript/.test(workerCode)) { + throw new Error( + "import() was not found in the worker code for loading async chunks" + ); + } + } +}; diff --git a/test/configCases/worker/node-worker-esm/test.filter.js b/test/configCases/worker/node-worker-esm/test.filter.js new file mode 100644 index 00000000000..d456e8870d2 --- /dev/null +++ b/test/configCases/worker/node-worker-esm/test.filter.js @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000000..7186e0febf4 --- /dev/null +++ b/test/configCases/worker/node-worker-esm/webpack.config.js @@ -0,0 +1,15 @@ +/** @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/worker.js b/test/configCases/worker/node-worker-esm/worker.js new file mode 100644 index 00000000000..7db06d04718 --- /dev/null +++ b/test/configCases/worker/node-worker-esm/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)); +}); From b4dfee432d65972239dc549e474fc839c9a919c4 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Tue, 8 Jul 2025 15:46:25 +0300 Subject: [PATCH 47/56] docs: update examples (#19663) --- examples/aggressive-merging/README.md | 2 ++ examples/asset-advanced/README.md | 2 ++ examples/asset-simple/README.md | 2 ++ examples/build-http/README.md | 2 ++ examples/chunkhash/README.md | 2 ++ .../README.md | 2 ++ .../code-splitting-depend-on-simple/README.md | 2 ++ .../common-chunk-and-vendor-chunk/README.md | 2 ++ examples/common-chunk-grandchildren/README.md | 1 + examples/custom-json-modules/README.md | 4 ++- examples/dll-entry-only/README.md | 2 ++ examples/dll-user/README.md | 34 ++++++++++--------- examples/dll/README.md | 16 +++++---- examples/explicit-vendor-chunk/README.md | 2 ++ examples/externals/README.md | 2 ++ examples/extra-async-chunk-advanced/README.md | 2 ++ examples/harmony-library/README.md | 2 ++ examples/http2-aggressive-splitting/README.md | 2 ++ examples/hybrid-routing/README.md | 2 ++ examples/lazy-compilation/README.md | 2 ++ examples/many-pages/README.md | 2 ++ examples/module-federation/README.md | 4 +++ examples/multi-compiler/README.md | 2 ++ examples/multi-part-library/README.md | 2 ++ examples/multiple-entry-points/README.md | 2 ++ examples/nodejs-addons/README.md | 2 ++ examples/persistent-caching/README.md | 3 ++ examples/scope-hoisting/README.md | 2 ++ examples/source-map/README.md | 2 ++ examples/stats-detailed/README.md | 2 ++ examples/stats-minimal/README.md | 2 ++ examples/stats-none/README.md | 2 ++ examples/stats-normal/README.md | 2 ++ examples/stats-summary/README.md | 2 ++ examples/top-level-await/README.md | 30 ++++++++++------ examples/two-explicit-vendor-chunks/README.md | 2 ++ examples/typescript/README.md | 2 ++ examples/wasm-bindgen-esm/README.md | 30 ++++++++++------ examples/wasm-complex/README.md | 30 ++++++++++------ examples/wasm-simple/README.md | 30 ++++++++++------ 40 files changed, 174 insertions(+), 68 deletions(-) diff --git a/examples/aggressive-merging/README.md b/examples/aggressive-merging/README.md index c0bc4af2f51..b9aeaeda38a 100644 --- a/examples/aggressive-merging/README.md +++ b/examples/aggressive-merging/README.md @@ -29,6 +29,8 @@ a big file... # webpack.config.js ```javascript +"use strict"; + const path = require("path"); const { AggressiveMergingPlugin } = require("../..").optimize; diff --git a/examples/asset-advanced/README.md b/examples/asset-advanced/README.md index 97adf3553d7..b86fde490b2 100644 --- a/examples/asset-advanced/README.md +++ b/examples/asset-advanced/README.md @@ -38,6 +38,8 @@ function createImageElement(title, src) { # webpack.config.js ```javascript +"use strict"; + const svgToMiniDataURI = require("mini-svg-data-uri"); module.exports = { diff --git a/examples/asset-simple/README.md b/examples/asset-simple/README.md index 527218ad84d..d6938aa4875 100644 --- a/examples/asset-simple/README.md +++ b/examples/asset-simple/README.md @@ -40,6 +40,8 @@ function createImageElement(title, src) { # webpack.config.js ```javascript +"use strict"; + module.exports = { output: { assetModuleFilename: "images/[hash][ext]" diff --git a/examples/build-http/README.md b/examples/build-http/README.md index c3c27026d94..edb0bfc3d7a 100644 --- a/examples/build-http/README.md +++ b/examples/build-http/README.md @@ -14,6 +14,8 @@ console.log(pMap4); # webpack.config.js ```javascript +"use strict"; + module.exports = { // enable debug logging to see network requests! // stats: { diff --git a/examples/chunkhash/README.md b/examples/chunkhash/README.md index e4ac3316ec8..576efa241e3 100644 --- a/examples/chunkhash/README.md +++ b/examples/chunkhash/README.md @@ -18,6 +18,8 @@ import("./async2"); # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/code-splitting-depend-on-advanced/README.md b/examples/code-splitting-depend-on-advanced/README.md index 02b267a07fe..a3c2c1e05d5 100644 --- a/examples/code-splitting-depend-on-advanced/README.md +++ b/examples/code-splitting-depend-on-advanced/README.md @@ -3,6 +3,8 @@ This example shows how to use Code Splitting with entrypoint dependOn # webpack.config.js ```javascript +"use strict"; + module.exports = { entry: { app: { import: "./app.js", dependOn: ["other-vendors"] }, diff --git a/examples/code-splitting-depend-on-simple/README.md b/examples/code-splitting-depend-on-simple/README.md index f1e53d3e8cc..d990b929071 100644 --- a/examples/code-splitting-depend-on-simple/README.md +++ b/examples/code-splitting-depend-on-simple/README.md @@ -3,6 +3,8 @@ This example shows how to use Code Splitting with entrypoint dependOn # webpack.config.js ```javascript +"use strict"; + module.exports = { entry: { app: { import: "./app.js", dependOn: ["react-vendors"] }, diff --git a/examples/common-chunk-and-vendor-chunk/README.md b/examples/common-chunk-and-vendor-chunk/README.md index 546405907d3..1601bb51c85 100644 --- a/examples/common-chunk-and-vendor-chunk/README.md +++ b/examples/common-chunk-and-vendor-chunk/README.md @@ -34,6 +34,8 @@ With this bundle configuration, you would load your third party libraries, then # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/common-chunk-grandchildren/README.md b/examples/common-chunk-grandchildren/README.md index 4e26fc1d676..0f1ab21193f 100644 --- a/examples/common-chunk-grandchildren/README.md +++ b/examples/common-chunk-grandchildren/README.md @@ -83,6 +83,7 @@ module.exports = function() { ```javascript "use strict"; + const path = require("path"); module.exports = { diff --git a/examples/custom-json-modules/README.md b/examples/custom-json-modules/README.md index 98eddf55da7..a1d27c469be 100644 --- a/examples/custom-json-modules/README.md +++ b/examples/custom-json-modules/README.md @@ -62,8 +62,10 @@ document.querySelector('#app').innerHTML = [toml, yaml, json].map(data => ` # webpack.config.js ```javascript -const toml = require("toml"); +"use strict"; + const json5 = require("json5"); +const toml = require("toml"); const yaml = require("yamljs"); module.exports = { diff --git a/examples/dll-entry-only/README.md b/examples/dll-entry-only/README.md index 90d1499f19b..7b73d0cf1a0 100644 --- a/examples/dll-entry-only/README.md +++ b/examples/dll-entry-only/README.md @@ -34,6 +34,8 @@ export { c } from "./cjs"; # webpack.config.js ```javascript +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/dll-user/README.md b/examples/dll-user/README.md index e0007dd0677..bcb37afce9e 100644 --- a/examples/dll-user/README.md +++ b/examples/dll-user/README.md @@ -7,6 +7,8 @@ This is the _user_ bundle, which uses the manifest from [dll-reference example]( # webpack.config.js ```javascript +"use strict"; + const path = require("path"); const webpack = require("../../"); @@ -47,18 +49,18 @@ console.log(require("module")); /* 0 */, /* 1 */ /*!**************************************************************************!*\ - !*** delegated ./alpha.js from dll-reference alpha_2239422b902ff2ef1cc1 ***! + !*** delegated ./alpha.js from dll-reference alpha_a1d5c7116e082d77ec3e ***! \**************************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module, __webpack_require__ */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = (__webpack_require__(/*! dll-reference alpha_2239422b902ff2ef1cc1 */ 2))(1); +module.exports = (__webpack_require__(/*! dll-reference alpha_a1d5c7116e082d77ec3e */ 2))(1); /***/ }), /* 2 */ /*!*********************************************!*\ - !*** external "alpha_2239422b902ff2ef1cc1" ***! + !*** external "alpha_a1d5c7116e082d77ec3e" ***! \*********************************************/ /*! dynamic exports */ /*! exports [maybe provided (runtime-defined)] [no usage info] */ @@ -66,34 +68,34 @@ module.exports = (__webpack_require__(/*! dll-reference alpha_2239422b902ff2ef1c /***/ ((module) => { "use strict"; -module.exports = alpha_2239422b902ff2ef1cc1; +module.exports = alpha_a1d5c7116e082d77ec3e; /***/ }), /* 3 */ /*!**********************************************************************!*\ - !*** delegated ./a.js from dll-reference alpha_2239422b902ff2ef1cc1 ***! + !*** delegated ./a.js from dll-reference alpha_a1d5c7116e082d77ec3e ***! \**********************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module, __webpack_require__ */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = (__webpack_require__(/*! dll-reference alpha_2239422b902ff2ef1cc1 */ 2))(2); +module.exports = (__webpack_require__(/*! dll-reference alpha_a1d5c7116e082d77ec3e */ 2))(2); /***/ }), /* 4 */ /*!************************************************************************!*\ - !*** delegated ./beta.js from dll-reference beta_2239422b902ff2ef1cc1 ***! + !*** delegated ./beta.js from dll-reference beta_a1d5c7116e082d77ec3e ***! \************************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module, __webpack_require__ */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = (__webpack_require__(/*! dll-reference beta_2239422b902ff2ef1cc1 */ 5))(5); +module.exports = (__webpack_require__(/*! dll-reference beta_a1d5c7116e082d77ec3e */ 5))(5); /***/ }), /* 5 */ /*!********************************************!*\ - !*** external "beta_2239422b902ff2ef1cc1" ***! + !*** external "beta_a1d5c7116e082d77ec3e" ***! \********************************************/ /*! dynamic exports */ /*! exports [maybe provided (runtime-defined)] [no usage info] */ @@ -101,40 +103,40 @@ module.exports = (__webpack_require__(/*! dll-reference beta_2239422b902ff2ef1cc /***/ ((module) => { "use strict"; -module.exports = beta_2239422b902ff2ef1cc1; +module.exports = beta_a1d5c7116e082d77ec3e; /***/ }), /* 6 */ /*!*********************************************************************!*\ - !*** delegated ./b.js from dll-reference beta_2239422b902ff2ef1cc1 ***! + !*** delegated ./b.js from dll-reference beta_a1d5c7116e082d77ec3e ***! \*********************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module, __webpack_require__ */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = (__webpack_require__(/*! dll-reference beta_2239422b902ff2ef1cc1 */ 5))(6); +module.exports = (__webpack_require__(/*! dll-reference beta_a1d5c7116e082d77ec3e */ 5))(6); /***/ }), /* 7 */ /*!**********************************************************************!*\ - !*** delegated ./c.jsx from dll-reference beta_2239422b902ff2ef1cc1 ***! + !*** delegated ./c.jsx from dll-reference beta_a1d5c7116e082d77ec3e ***! \**********************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module, __webpack_require__ */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = (__webpack_require__(/*! dll-reference beta_2239422b902ff2ef1cc1 */ 5))(7); +module.exports = (__webpack_require__(/*! dll-reference beta_a1d5c7116e082d77ec3e */ 5))(7); /***/ }), /* 8 */ /*!*****************************************************************************************!*\ - !*** delegated ../node_modules/module.js from dll-reference alpha_2239422b902ff2ef1cc1 ***! + !*** delegated ../node_modules/module.js from dll-reference alpha_a1d5c7116e082d77ec3e ***! \*****************************************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module, __webpack_require__ */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = (__webpack_require__(/*! dll-reference alpha_2239422b902ff2ef1cc1 */ 2))(3); +module.exports = (__webpack_require__(/*! dll-reference alpha_a1d5c7116e082d77ec3e */ 2))(3); /***/ }) /******/ ]); diff --git a/examples/dll/README.md b/examples/dll/README.md index cc6a9f40ba0..267f3d1c0a7 100644 --- a/examples/dll/README.md +++ b/examples/dll/README.md @@ -7,6 +7,8 @@ This is the _reference_ bundle (with the manifests) for [dll user example](https # webpack.config.js ```javascript +"use strict"; + const path = require("path"); const webpack = require("../../"); @@ -36,7 +38,7 @@ module.exports = { # dist/MyDll.alpha.js ```javascript -var alpha_2239422b902ff2ef1cc1; +var alpha_a1d5c7116e082d77ec3e; /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ([ /* 0 */ @@ -129,7 +131,7 @@ module.exports = "module"; /******/ // Load entry module and return exports /******/ // This entry module doesn't tell about it's top-level declarations so it can't be inlined /******/ var __webpack_exports__ = __webpack_require__(0); -/******/ alpha_2239422b902ff2ef1cc1 = __webpack_exports__; +/******/ alpha_a1d5c7116e082d77ec3e = __webpack_exports__; /******/ /******/ })() ; @@ -138,7 +140,7 @@ module.exports = "module"; # dist/alpha-manifest.json ```javascript -{"name":"alpha_2239422b902ff2ef1cc1","content":{"./alpha.js":{"id":1,"buildMeta":{}},"./a.js":{"id":2,"buildMeta":{}},"../node_modules/module.js":{"id":3,"buildMeta":{}}}} +{"name":"alpha_a1d5c7116e082d77ec3e","content":{"./alpha.js":{"id":1,"buildMeta":{}},"./a.js":{"id":2,"buildMeta":{}},"../node_modules/module.js":{"id":3,"buildMeta":{}}}} ``` # Info @@ -155,9 +157,9 @@ chunk (runtime: alpha) MyDll.alpha.js (alpha) 85 bytes [entry] [rendered] [used exports unknown] dll entry used as library export -chunk (runtime: beta) MyDll.beta.js (beta) 80 bytes [entry] [rendered] +chunk (runtime: beta) MyDll.beta.js (beta) 81 bytes [entry] [rendered] > beta - dependent modules 68 bytes [dependent] 3 modules + dependent modules 69 bytes [dependent] 3 modules dll beta 12 bytes [built] [code generated] [used exports unknown] dll entry @@ -170,9 +172,9 @@ webpack X.X.X compiled successfully ``` asset MyDll.alpha.js 313 bytes [emitted] [minimized] (name: alpha) asset MyDll.beta.js 307 bytes [emitted] [minimized] (name: beta) -chunk (runtime: beta) MyDll.beta.js (beta) 80 bytes [entry] [rendered] +chunk (runtime: beta) MyDll.beta.js (beta) 81 bytes [entry] [rendered] > beta - dependent modules 68 bytes [dependent] 3 modules + dependent modules 69 bytes [dependent] 3 modules dll beta 12 bytes [built] [code generated] dll entry used as library export diff --git a/examples/explicit-vendor-chunk/README.md b/examples/explicit-vendor-chunk/README.md index 03c8fa9fc68..0d08945de26 100644 --- a/examples/explicit-vendor-chunk/README.md +++ b/examples/explicit-vendor-chunk/README.md @@ -1,6 +1,8 @@ # webpack.config.js ```javascript +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/externals/README.md b/examples/externals/README.md index 569df4f238c..2a5be588b60 100644 --- a/examples/externals/README.md +++ b/examples/externals/README.md @@ -27,6 +27,8 @@ exports.exampleValue = subtract(add(42, 2), 2); # webpack.config.js ```javascript +"use strict"; + module.exports = { // mode: "development" || "production", output: { diff --git a/examples/extra-async-chunk-advanced/README.md b/examples/extra-async-chunk-advanced/README.md index ee9287596af..56e4732f6d8 100644 --- a/examples/extra-async-chunk-advanced/README.md +++ b/examples/extra-async-chunk-advanced/README.md @@ -22,6 +22,8 @@ require.ensure(["./a", "./e"], function(require) { # webpack.config.js ```javascript +"use strict"; + module.exports = { // mode: "development" || "production", optimization: { diff --git a/examples/harmony-library/README.md b/examples/harmony-library/README.md index a41425e863d..36fd3307a83 100644 --- a/examples/harmony-library/README.md +++ b/examples/harmony-library/README.md @@ -1,6 +1,8 @@ # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/http2-aggressive-splitting/README.md b/examples/http2-aggressive-splitting/README.md index 6fed1ed226b..14cc702eac2 100644 --- a/examples/http2-aggressive-splitting/README.md +++ b/examples/http2-aggressive-splitting/README.md @@ -17,6 +17,8 @@ The compression improves with bigger `maxSize`, as gzip works better for bigger The backward compatibility (non-HTTP2 client) improves with bigger `maxSize`, as the number of requests decreases. ```js +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/hybrid-routing/README.md b/examples/hybrid-routing/README.md index 03716192585..dd9df38182a 100644 --- a/examples/hybrid-routing/README.md +++ b/examples/hybrid-routing/README.md @@ -1,6 +1,8 @@ # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/lazy-compilation/README.md b/examples/lazy-compilation/README.md index dc8ccb3c7b2..9cc712d5b2b 100644 --- a/examples/lazy-compilation/README.md +++ b/examples/lazy-compilation/README.md @@ -42,6 +42,8 @@ document.body.appendChild(pre); # webpack.config.js ```javascript +"use strict"; + const { HotModuleReplacementPlugin } = require("../../"); module.exports = { diff --git a/examples/many-pages/README.md b/examples/many-pages/README.md index 13bc49b5a33..fcf683b3dc7 100644 --- a/examples/many-pages/README.md +++ b/examples/many-pages/README.md @@ -25,6 +25,8 @@ Note: decreasing `maxInitial/AsyncRequest` will increase duplication further to ## webpack.config.js ``` +"use strict"; + module.exports = { // mode: "development" || "production", entry: { diff --git a/examples/module-federation/README.md b/examples/module-federation/README.md index 2226be34e5a..9b9f6d404ee 100644 --- a/examples/module-federation/README.md +++ b/examples/module-federation/README.md @@ -1,8 +1,11 @@ # webpack.config.js ```javascript +"use strict"; + const path = require("path"); const { ModuleFederationPlugin } = require("../../").container; + const rules = [ { test: /\.js$/, @@ -25,6 +28,7 @@ const stats = { chunkModules: true, chunkOrigins: true }; + module.exports = (env = "development") => [ // For this example we have 3 configs in a single file // In practice you probably would have separate config diff --git a/examples/multi-compiler/README.md b/examples/multi-compiler/README.md index d6a27c8d571..86b20f94630 100644 --- a/examples/multi-compiler/README.md +++ b/examples/multi-compiler/README.md @@ -10,6 +10,8 @@ console.log("Running " + ENV + " build"); # webpack.config.js ```javascript +"use strict"; + const path = require("path"); const webpack = require("../../"); diff --git a/examples/multi-part-library/README.md b/examples/multi-part-library/README.md index 465c6bf5bb9..f2dfd7742f4 100644 --- a/examples/multi-part-library/README.md +++ b/examples/multi-part-library/README.md @@ -15,6 +15,8 @@ Note: When your library has dependencies that should not be included in the comp # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/multiple-entry-points/README.md b/examples/multiple-entry-points/README.md index 33bba7c01b8..151e2a702f0 100644 --- a/examples/multiple-entry-points/README.md +++ b/examples/multiple-entry-points/README.md @@ -50,6 +50,8 @@ require.ensure(["./shared"], function(require) { # webpack.config.js ```javascript +"use strict"; + module.exports = { // mode: "development" || "production", entry: { diff --git a/examples/nodejs-addons/README.md b/examples/nodejs-addons/README.md index e117c9c66f1..12792394eba 100644 --- a/examples/nodejs-addons/README.md +++ b/examples/nodejs-addons/README.md @@ -23,6 +23,8 @@ console.log(myModule.exports.hello()); # webpack.config.js ```javascript +"use strict"; + module.exports = { // mode: "development" || "production", target: "node", diff --git a/examples/persistent-caching/README.md b/examples/persistent-caching/README.md index 84ef2840489..40621534468 100644 --- a/examples/persistent-caching/README.md +++ b/examples/persistent-caching/README.md @@ -17,7 +17,10 @@ console.log(_); # webpack.config.js ```javascript +"use strict"; + const path = require("path"); + module.exports = (env = "development") => ({ mode: env, infrastructureLogging: { diff --git a/examples/scope-hoisting/README.md b/examples/scope-hoisting/README.md index 9f111ad36ae..4498a9fd39b 100644 --- a/examples/scope-hoisting/README.md +++ b/examples/scope-hoisting/README.md @@ -99,6 +99,8 @@ export var y = "y"; # webpack.config.js ```javascript +"use strict"; + module.exports = { // mode: "development" || "production", optimization: { diff --git a/examples/source-map/README.md b/examples/source-map/README.md index db4b008e8c4..87ac473e90e 100644 --- a/examples/source-map/README.md +++ b/examples/source-map/README.md @@ -19,6 +19,8 @@ race = (winner, runners...) -> # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = [ diff --git a/examples/stats-detailed/README.md b/examples/stats-detailed/README.md index 042e47d7a59..54fd2862398 100644 --- a/examples/stats-detailed/README.md +++ b/examples/stats-detailed/README.md @@ -11,6 +11,8 @@ console.log("Hello World!"); # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/stats-minimal/README.md b/examples/stats-minimal/README.md index 79d8f475a77..fd12fec106b 100644 --- a/examples/stats-minimal/README.md +++ b/examples/stats-minimal/README.md @@ -11,6 +11,8 @@ console.log("Hello World!"); # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/stats-none/README.md b/examples/stats-none/README.md index d9fb8490193..9c20e6b3b8c 100644 --- a/examples/stats-none/README.md +++ b/examples/stats-none/README.md @@ -11,6 +11,8 @@ console.log("Hello World!"); # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/stats-normal/README.md b/examples/stats-normal/README.md index b4481ca8a27..b2269e85c35 100644 --- a/examples/stats-normal/README.md +++ b/examples/stats-normal/README.md @@ -11,6 +11,8 @@ console.log("Hello World!"); # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/stats-summary/README.md b/examples/stats-summary/README.md index 0518d541bfb..08be1b192de 100644 --- a/examples/stats-summary/README.md +++ b/examples/stats-summary/README.md @@ -11,6 +11,8 @@ console.log("Hello World!"); # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/top-level-await/README.md b/examples/top-level-await/README.md index f74492e242a..825c8a714bb 100644 --- a/examples/top-level-await/README.md +++ b/examples/top-level-await/README.md @@ -203,9 +203,12 @@ const AlternativeCreateUserAction = async name => { /************************************************************************/ /******/ /* webpack/runtime/async module */ /******/ (() => { -/******/ var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__"; -/******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__"; -/******/ var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__"; +/******/ var hasSymbol = typeof Symbol === "function"; +/******/ var webpackQueues = hasSymbol ? Symbol("webpack queues") : "__webpack_queues__"; +/******/ var webpackExports = hasSymbol ? Symbol("webpack exports") : "__webpack_exports__"; +/******/ var webpackError = hasSymbol ? Symbol("webpack error") : "__webpack_error__"; +/******/ +/******/ /******/ var resolveQueue = (queue) => { /******/ if(queue && queue.d < 1) { /******/ queue.d = 1; @@ -215,6 +218,7 @@ const AlternativeCreateUserAction = async name => { /******/ } /******/ var wrapDeps = (deps) => (deps.map((dep) => { /******/ if(dep !== null && typeof dep === "object") { +/******/ /******/ if(dep[webpackQueues]) return dep; /******/ if(dep.then) { /******/ var queue = []; @@ -227,6 +231,7 @@ const AlternativeCreateUserAction = async name => { /******/ resolveQueue(queue); /******/ }); /******/ var obj = {}; +/******/ /******/ obj[webpackQueues] = (fn) => (fn(queue)); /******/ return obj; /******/ } @@ -251,10 +256,11 @@ const AlternativeCreateUserAction = async name => { /******/ promise[webpackExports] = exports; /******/ promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {})); /******/ module.exports = promise; -/******/ body((deps) => { +/******/ var handle = (deps) => { /******/ currentDeps = wrapDeps(deps); /******/ var fn; /******/ var getResult = () => (currentDeps.map((d) => { +/******/ /******/ if(d[webpackError]) throw d[webpackError]; /******/ return d[webpackExports]; /******/ })) @@ -265,7 +271,9 @@ const AlternativeCreateUserAction = async name => { /******/ currentDeps.map((dep) => (dep[webpackQueues](fnQueue))); /******/ }); /******/ return fn.r ? promise : getResult(); -/******/ }, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue))); +/******/ } +/******/ var done = (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)) +/******/ body(handle, done); /******/ queue && queue.d < 0 && (queue.d = 0); /******/ }; /******/ })(); @@ -579,7 +587,7 @@ __webpack_async_result__(); ## Unoptimized ``` -asset output.js 15 KiB [emitted] (name: main) +asset output.js 15.1 KiB [emitted] (name: main) asset UserApi_js.output.js 2.97 KiB [emitted] chunk (runtime: main) UserApi_js.output.js 617 bytes [rendered] > ./UserApi.js ./Actions.js 22:30-52 @@ -590,9 +598,9 @@ chunk (runtime: main) UserApi_js.output.js 617 bytes [rendered] [used exports unknown] import() ./UserApi.js ./Actions.js 2:16-38 import() ./UserApi.js ./Actions.js 22:30-52 -chunk (runtime: main) output.js (main) 1.19 KiB (javascript) 7.56 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 1.19 KiB (javascript) 7.59 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 7.56 KiB 9 modules + runtime modules 7.59 KiB 9 modules dependent modules 1.09 KiB [dependent] 1 module ./example.js 103 bytes [built] [code generated] [no exports] @@ -604,7 +612,7 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.93 KiB [emitted] [minimized] (name: main) +asset output.js 2.89 KiB [emitted] [minimized] (name: main) asset UserApi_js.output.js 532 bytes [emitted] [minimized] chunk (runtime: main) UserApi_js.output.js 617 bytes [rendered] > ./UserApi.js ./Actions.js 22:30-52 @@ -614,9 +622,9 @@ chunk (runtime: main) UserApi_js.output.js 617 bytes [rendered] [exports: createUser] import() ./UserApi.js ./example.js + 1 modules ./Actions.js 2:16-38 import() ./UserApi.js ./example.js + 1 modules ./Actions.js 22:30-52 -chunk (runtime: main) output.js (main) 1.19 KiB (javascript) 7.56 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 1.19 KiB (javascript) 7.59 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 7.56 KiB 9 modules + runtime modules 7.59 KiB 9 modules ./example.js + 1 modules 1.19 KiB [built] [code generated] [no exports] [no exports used] diff --git a/examples/two-explicit-vendor-chunks/README.md b/examples/two-explicit-vendor-chunks/README.md index 0654abeba0f..ea683484067 100644 --- a/examples/two-explicit-vendor-chunks/README.md +++ b/examples/two-explicit-vendor-chunks/README.md @@ -1,6 +1,8 @@ # webpack.config.js ```javascript +"use strict"; + const path = require("path"); module.exports = { diff --git a/examples/typescript/README.md b/examples/typescript/README.md index 1161b7a8e8c..218b0031f12 100644 --- a/examples/typescript/README.md +++ b/examples/typescript/README.md @@ -21,6 +21,8 @@ console.log(getArray(1, 2, 3)); # webpack.config.js ```javascript +"use strict"; + const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); module.exports = (env = "development") => ({ diff --git a/examples/wasm-bindgen-esm/README.md b/examples/wasm-bindgen-esm/README.md index 1852cab0ca9..86d82e811ba 100644 --- a/examples/wasm-bindgen-esm/README.md +++ b/examples/wasm-bindgen-esm/README.md @@ -218,9 +218,12 @@ module.exports = __webpack_require__.v(exports, module.id, "ffe21e855d11d22ab54f /************************************************************************/ /******/ /* webpack/runtime/async module */ /******/ (() => { -/******/ var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__"; -/******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__"; -/******/ var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__"; +/******/ var hasSymbol = typeof Symbol === "function"; +/******/ var webpackQueues = hasSymbol ? Symbol("webpack queues") : "__webpack_queues__"; +/******/ var webpackExports = hasSymbol ? Symbol("webpack exports") : "__webpack_exports__"; +/******/ var webpackError = hasSymbol ? Symbol("webpack error") : "__webpack_error__"; +/******/ +/******/ /******/ var resolveQueue = (queue) => { /******/ if(queue && queue.d < 1) { /******/ queue.d = 1; @@ -230,6 +233,7 @@ module.exports = __webpack_require__.v(exports, module.id, "ffe21e855d11d22ab54f /******/ } /******/ var wrapDeps = (deps) => (deps.map((dep) => { /******/ if(dep !== null && typeof dep === "object") { +/******/ /******/ if(dep[webpackQueues]) return dep; /******/ if(dep.then) { /******/ var queue = []; @@ -242,6 +246,7 @@ module.exports = __webpack_require__.v(exports, module.id, "ffe21e855d11d22ab54f /******/ resolveQueue(queue); /******/ }); /******/ var obj = {}; +/******/ /******/ obj[webpackQueues] = (fn) => (fn(queue)); /******/ return obj; /******/ } @@ -266,10 +271,11 @@ module.exports = __webpack_require__.v(exports, module.id, "ffe21e855d11d22ab54f /******/ promise[webpackExports] = exports; /******/ promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {})); /******/ module.exports = promise; -/******/ body((deps) => { +/******/ var handle = (deps) => { /******/ currentDeps = wrapDeps(deps); /******/ var fn; /******/ var getResult = () => (currentDeps.map((d) => { +/******/ /******/ if(d[webpackError]) throw d[webpackError]; /******/ return d[webpackExports]; /******/ })) @@ -280,7 +286,9 @@ module.exports = __webpack_require__.v(exports, module.id, "ffe21e855d11d22ab54f /******/ currentDeps.map((dep) => (dep[webpackQueues](fnQueue))); /******/ }); /******/ return fn.r ? promise : getResult(); -/******/ }, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue))); +/******/ } +/******/ var done = (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)) +/******/ body(handle, done); /******/ queue && queue.d < 0 && (queue.d = 0); /******/ }; /******/ })(); @@ -369,10 +377,10 @@ module.exports = __webpack_require__.v(exports, module.id, "ffe21e855d11d22ab54f ``` asset ffe21e855d11d22ab54f.wasm 14.8 KiB [emitted] [immutable] (auxiliary name: main) -asset output.js 13.4 KiB [emitted] (name: main) -chunk (runtime: main) output.js (main) 3.03 KiB (javascript) 14.8 KiB (webassembly) 3.68 KiB (runtime) [entry] [rendered] +asset output.js 13.6 KiB [emitted] (name: main) +chunk (runtime: main) output.js (main) 3.03 KiB (javascript) 14.8 KiB (webassembly) 3.72 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.68 KiB 6 modules + runtime modules 3.72 KiB 6 modules dependent modules 2.97 KiB (javascript) 14.8 KiB (webassembly) [dependent] 2 modules ./example.js 69 bytes [built] [code generated] [no exports] @@ -385,10 +393,10 @@ webpack X.X.X compiled successfully ``` asset 78eeb14b9b5e2c77fb0a.wasm 14.8 KiB [emitted] [immutable] (auxiliary name: main) -asset output.js 3.37 KiB [emitted] [minimized] (name: main) -chunk (runtime: main) output.js (main) 3.03 KiB (javascript) 14.8 KiB (webassembly) 3.42 KiB (runtime) [entry] [rendered] +asset output.js 3.33 KiB [emitted] [minimized] (name: main) +chunk (runtime: main) output.js (main) 3.03 KiB (javascript) 14.8 KiB (webassembly) 3.45 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.42 KiB 5 modules + runtime modules 3.45 KiB 5 modules dependent modules 2.97 KiB (javascript) 14.8 KiB (webassembly) [dependent] 2 modules ./example.js 69 bytes [built] [code generated] [no exports] diff --git a/examples/wasm-complex/README.md b/examples/wasm-complex/README.md index b358aeb18c0..03de92299d3 100644 --- a/examples/wasm-complex/README.md +++ b/examples/wasm-complex/README.md @@ -262,9 +262,12 @@ function getRandomNumber() { /************************************************************************/ /******/ /* webpack/runtime/async module */ /******/ (() => { -/******/ var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__"; -/******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__"; -/******/ var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__"; +/******/ var hasSymbol = typeof Symbol === "function"; +/******/ var webpackQueues = hasSymbol ? Symbol("webpack queues") : "__webpack_queues__"; +/******/ var webpackExports = hasSymbol ? Symbol("webpack exports") : "__webpack_exports__"; +/******/ var webpackError = hasSymbol ? Symbol("webpack error") : "__webpack_error__"; +/******/ +/******/ /******/ var resolveQueue = (queue) => { /******/ if(queue && queue.d < 1) { /******/ queue.d = 1; @@ -274,6 +277,7 @@ function getRandomNumber() { /******/ } /******/ var wrapDeps = (deps) => (deps.map((dep) => { /******/ if(dep !== null && typeof dep === "object") { +/******/ /******/ if(dep[webpackQueues]) return dep; /******/ if(dep.then) { /******/ var queue = []; @@ -286,6 +290,7 @@ function getRandomNumber() { /******/ resolveQueue(queue); /******/ }); /******/ var obj = {}; +/******/ /******/ obj[webpackQueues] = (fn) => (fn(queue)); /******/ return obj; /******/ } @@ -310,10 +315,11 @@ function getRandomNumber() { /******/ promise[webpackExports] = exports; /******/ promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {})); /******/ module.exports = promise; -/******/ body((deps) => { +/******/ var handle = (deps) => { /******/ currentDeps = wrapDeps(deps); /******/ var fn; /******/ var getResult = () => (currentDeps.map((d) => { +/******/ /******/ if(d[webpackError]) throw d[webpackError]; /******/ return d[webpackExports]; /******/ })) @@ -324,7 +330,9 @@ function getRandomNumber() { /******/ currentDeps.map((dep) => (dep[webpackQueues](fnQueue))); /******/ }); /******/ return fn.r ? promise : getResult(); -/******/ }, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue))); +/******/ } +/******/ var done = (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)) +/******/ body(handle, done); /******/ queue && queue.d < 0 && (queue.d = 0); /******/ }; /******/ })(); @@ -412,11 +420,11 @@ function getRandomNumber() { ## Unoptimized ``` -asset output.js 13.8 KiB [emitted] (name: main) +asset output.js 14 KiB [emitted] (name: main) asset daa529a2a650ee3943a9.module.wasm 139 bytes [emitted] [immutable] (auxiliary name: main) -chunk (runtime: main) output.js (main) 696 bytes (javascript) 139 bytes (webassembly) 3.69 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 696 bytes (javascript) 139 bytes (webassembly) 3.72 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.69 KiB 6 modules + runtime modules 3.72 KiB 6 modules dependent modules 449 bytes (javascript) 139 bytes (webassembly) [dependent] 4 modules ./example.js 247 bytes [built] [code generated] [no exports] @@ -428,11 +436,11 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.76 KiB [emitted] [minimized] (name: main) +asset output.js 2.72 KiB [emitted] [minimized] (name: main) asset 03b5e050bc920dbbb73e.module.wasm 139 bytes [emitted] [immutable] (auxiliary name: main) -chunk (runtime: main) output.js (main) 696 bytes (javascript) 139 bytes (webassembly) 3.42 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 696 bytes (javascript) 139 bytes (webassembly) 3.46 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.42 KiB 5 modules + runtime modules 3.46 KiB 5 modules dependent modules 449 bytes (javascript) 139 bytes (webassembly) [dependent] 4 modules ./example.js 247 bytes [built] [code generated] [no exports] diff --git a/examples/wasm-simple/README.md b/examples/wasm-simple/README.md index fbbe3813d21..e6d52ac8fb3 100644 --- a/examples/wasm-simple/README.md +++ b/examples/wasm-simple/README.md @@ -225,9 +225,12 @@ module.exports = __webpack_require__.v(exports, module.id, "5a6637e8d63cdf9c72da /************************************************************************/ /******/ /* webpack/runtime/async module */ /******/ (() => { -/******/ var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__"; -/******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__"; -/******/ var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__"; +/******/ var hasSymbol = typeof Symbol === "function"; +/******/ var webpackQueues = hasSymbol ? Symbol("webpack queues") : "__webpack_queues__"; +/******/ var webpackExports = hasSymbol ? Symbol("webpack exports") : "__webpack_exports__"; +/******/ var webpackError = hasSymbol ? Symbol("webpack error") : "__webpack_error__"; +/******/ +/******/ /******/ var resolveQueue = (queue) => { /******/ if(queue && queue.d < 1) { /******/ queue.d = 1; @@ -237,6 +240,7 @@ module.exports = __webpack_require__.v(exports, module.id, "5a6637e8d63cdf9c72da /******/ } /******/ var wrapDeps = (deps) => (deps.map((dep) => { /******/ if(dep !== null && typeof dep === "object") { +/******/ /******/ if(dep[webpackQueues]) return dep; /******/ if(dep.then) { /******/ var queue = []; @@ -249,6 +253,7 @@ module.exports = __webpack_require__.v(exports, module.id, "5a6637e8d63cdf9c72da /******/ resolveQueue(queue); /******/ }); /******/ var obj = {}; +/******/ /******/ obj[webpackQueues] = (fn) => (fn(queue)); /******/ return obj; /******/ } @@ -273,10 +278,11 @@ module.exports = __webpack_require__.v(exports, module.id, "5a6637e8d63cdf9c72da /******/ promise[webpackExports] = exports; /******/ promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {})); /******/ module.exports = promise; -/******/ body((deps) => { +/******/ var handle = (deps) => { /******/ currentDeps = wrapDeps(deps); /******/ var fn; /******/ var getResult = () => (currentDeps.map((d) => { +/******/ /******/ if(d[webpackError]) throw d[webpackError]; /******/ return d[webpackExports]; /******/ })) @@ -287,7 +293,9 @@ module.exports = __webpack_require__.v(exports, module.id, "5a6637e8d63cdf9c72da /******/ currentDeps.map((dep) => (dep[webpackQueues](fnQueue))); /******/ }); /******/ return fn.r ? promise : getResult(); -/******/ }, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue))); +/******/ } +/******/ var done = (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)) +/******/ body(handle, done); /******/ queue && queue.d < 0 && (queue.d = 0); /******/ }; /******/ })(); @@ -375,13 +383,13 @@ module.exports = __webpack_require__.v(exports, module.id, "5a6637e8d63cdf9c72da ## Unoptimized ``` -asset output.js 13.2 KiB [emitted] (name: main) +asset output.js 13.3 KiB [emitted] (name: main) asset 5a6637e8d63cdf9c72da.wasm 67 bytes [emitted] [immutable] (auxiliary name: main) asset 35a58b7c95860d720a3c.wasm 62 bytes [emitted] [immutable] (auxiliary name: main) asset 0eaeab8b9fa3cef100d1.wasm 41 bytes [emitted] [immutable] (auxiliary name: main) -chunk (runtime: main) output.js (main) 1.27 KiB (javascript) 170 bytes (webassembly) 3.68 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 1.27 KiB (javascript) 170 bytes (webassembly) 3.72 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.68 KiB 6 modules + runtime modules 3.72 KiB 6 modules dependent modules 552 bytes (javascript) 170 bytes (webassembly) [dependent] 4 modules ./example.js 753 bytes [built] [code generated] [no exports] @@ -393,13 +401,13 @@ webpack X.X.X compiled successfully ## Production mode ``` -asset output.js 2.85 KiB [emitted] [minimized] (name: main) +asset output.js 2.8 KiB [emitted] [minimized] (name: main) asset 93de874acf2fa7def7d9.wasm 67 bytes [emitted] [immutable] (auxiliary name: main) asset 5055869d769f484de216.wasm 62 bytes [emitted] [immutable] (auxiliary name: main) asset db91ebd6538fd6985888.wasm 41 bytes [emitted] [immutable] (auxiliary name: main) -chunk (runtime: main) output.js (main) 1.27 KiB (javascript) 170 bytes (webassembly) 3.42 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 1.27 KiB (javascript) 170 bytes (webassembly) 3.45 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 3.42 KiB 5 modules + runtime modules 3.45 KiB 5 modules dependent modules 552 bytes (javascript) 170 bytes (webassembly) [dependent] 4 modules ./example.js 753 bytes [built] [code generated] [no exports] From a1f619a4686a3a8ac8d49aab3c78a59616eefd25 Mon Sep 17 00:00:00 2001 From: Natsu Xiao <784487301@qq.com> Date: Tue, 8 Jul 2025 20:48:52 +0800 Subject: [PATCH 48/56] fix: handle the case where a chunk is imported both as defer and non-defer (#19665) --- lib/dependencies/HarmonyImportDependency.js | 12 ++++++++---- .../defer-import/harmony-import-mixed/index.js | 16 ++++++++++++++++ .../defer-import/harmony-import-mixed/shared.js | 2 ++ .../harmony-import-mixed/webpack.config.js | 10 ++++++++++ 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 test/configCases/defer-import/harmony-import-mixed/index.js create mode 100644 test/configCases/defer-import/harmony-import-mixed/shared.js create mode 100644 test/configCases/defer-import/harmony-import-mixed/webpack.config.js diff --git a/lib/dependencies/HarmonyImportDependency.js b/lib/dependencies/HarmonyImportDependency.js index 170a2be42d3..4ac805c8031 100644 --- a/lib/dependencies/HarmonyImportDependency.js +++ b/lib/dependencies/HarmonyImportDependency.js @@ -92,15 +92,19 @@ class HarmonyImportDependency extends ModuleDependency { getImportVar(moduleGraph) { const module = /** @type {Module} */ (moduleGraph.getParentModule(this)); const meta = moduleGraph.getMeta(module); - let importVarMap = meta.importVarMap; - if (!importVarMap) meta.importVarMap = importVarMap = new Map(); + const defer = this.defer; + + const metaKey = defer ? "deferredImportVarMap" : "importVarMap"; + let importVarMap = meta[metaKey]; + if (!importVarMap) meta[metaKey] = importVarMap = new Map(); + let importVar = importVarMap.get( /** @type {Module} */ (moduleGraph.getModule(this)) ); if (importVar) return importVar; importVar = `${Template.toIdentifier( `${this.userRequest}` - )}__WEBPACK_IMPORTED_MODULE_${importVarMap.size}__`; + )}__WEBPACK_${this.defer ? "DEFERRED_" : ""}IMPORTED_MODULE_${importVarMap.size}__`; importVarMap.set( /** @type {Module} */ (moduleGraph.getModule(this)), importVar @@ -301,7 +305,7 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends const moduleKey = referencedModule ? referencedModule.identifier() : dep.request; - const key = `harmony import ${moduleKey}`; + const key = `${dep.defer ? "deferred " : ""}harmony import ${moduleKey}`; const runtimeCondition = dep.weak ? false diff --git a/test/configCases/defer-import/harmony-import-mixed/index.js b/test/configCases/defer-import/harmony-import-mixed/index.js new file mode 100644 index 00000000000..3a9fa7f4512 --- /dev/null +++ b/test/configCases/defer-import/harmony-import-mixed/index.js @@ -0,0 +1,16 @@ +import { value as directValue } from "./shared.js"; // non-defer import +import * as deferredShared from /* webpackDefer: true */ "./shared.js"; // defer import + +it("should handle mixed defer/non-defer targets correctly", () => { + // Test direct non-defer access + expect(typeof directValue).toBe("string"); + expect(directValue).toBe("shared-value"); + + // Test deferred access + expect(typeof deferredShared).toBe("object"); + expect(deferredShared).not.toBe(null); + expect(deferredShared.value).toBe("shared-value"); + + // Both should access the same underlying value + expect(directValue).toBe(deferredShared.value); +}); \ No newline at end of file diff --git a/test/configCases/defer-import/harmony-import-mixed/shared.js b/test/configCases/defer-import/harmony-import-mixed/shared.js new file mode 100644 index 00000000000..fa1f624691f --- /dev/null +++ b/test/configCases/defer-import/harmony-import-mixed/shared.js @@ -0,0 +1,2 @@ +// This module will be imported both as defer and non-defer +export const value = "shared-value"; \ No newline at end of file diff --git a/test/configCases/defer-import/harmony-import-mixed/webpack.config.js b/test/configCases/defer-import/harmony-import-mixed/webpack.config.js new file mode 100644 index 00000000000..b9ffe036a9b --- /dev/null +++ b/test/configCases/defer-import/harmony-import-mixed/webpack.config.js @@ -0,0 +1,10 @@ +/** @type {import("../../../../types").Configuration} */ +module.exports = { + target: [`async-node${process.versions.node.split(".").map(Number)[0]}`], + optimization: { + concatenateModules: true + }, + experiments: { + deferImport: true + } +}; From 1c82f9889e16a990ca0e1e1cba6b72a92f6393ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 8 Jul 2025 14:49:46 +0200 Subject: [PATCH 49/56] feat: use `acorn-import-phases` plugin (#19659) --- lib/javascript/JavascriptParser.js | 145 +---------------------------- package.json | 1 + yarn.lock | 5 + 3 files changed, 11 insertions(+), 140 deletions(-) diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index ede5fcf0558..eb504e0a024 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -7,6 +7,7 @@ const vm = require("vm"); const { Parser: AcornParser, tokTypes } = require("acorn"); +const acornImportPhases = require("acorn-import-phases"); const { HookMap, SyncBailHook } = require("tapable"); const Parser = require("../Parser"); const StackedMap = require("../util/StackedMap"); @@ -180,147 +181,11 @@ const importAssertions = Parser => } }; -// follow https://www.npmjs.com/acorn-import-defer if possible -/** @type {(BaseParser: typeof AcornParser) => typeof AcornParser} */ -const importDefer = Parser => - class extends Parser { - /** - * @this {InstanceType} - * @param {ImportDeclaration} node import declaration - * @returns {ImportDeclaration} import declaration - */ - parseImport(node) { - this._defer = false; - // eslint-disable-next-line no-warning-comments - // @ts-ignore - const result = super.parseImport(node); - if (this._defer) { - node.phase = "defer"; - } - return result; - } - - /** - * @this {InstanceType} - * @returns {ImportSpecifier[]} import specifiers - */ - parseImportSpecifiers() { - // eslint-disable-next-line no-warning-comments - // @ts-ignore - if (!this.isContextual("defer")) return super.parseImportSpecifiers(); - - const deferId = this.parseIdent(); - if (this.isContextual("from") || this.type === tokTypes.comma) { - const defaultSpecifier = this.startNodeAt( - deferId.start, - deferId.loc.start - ); - defaultSpecifier.local = deferId; - this.checkLValSimple(deferId, /* BIND_LEXICAL */ 2); - - const nodes = [ - this.finishNode(defaultSpecifier, "ImportDefaultSpecifier") - ]; - if (this.eat(tokTypes.comma)) { - if (this.type !== tokTypes.star && this.type !== tokTypes.braceL) { - this.unexpected(); - } - // eslint-disable-next-line no-warning-comments - // @ts-ignore - nodes.push(...super.parseImportSpecifiers()); - } - return nodes; - } - - this._defer = true; - - if (this.type !== tokTypes.star) { - this.raiseRecoverable( - deferId.start, - "'import defer' can only be used with namespace imports." - ); - } - - // eslint-disable-next-line no-warning-comments - // @ts-ignore - return super.parseImportSpecifiers(); - } - - /** - * @this {InstanceType} - * @param {boolean} forNew forNew - * @returns {ImportExpression} import expression - */ - parseExprImport(forNew) { - // eslint-disable-next-line no-warning-comments - // @ts-ignore - const node = super.parseExprImport(forNew); - - if (node.type === "MetaProperty" && node.property.name === "defer") { - if (this.type === tokTypes.parenL) { - const dynImport = this.parseDynamicImport( - this.startNodeAt(node.start, node.loc.start) - ); - dynImport.phase = "defer"; - return dynImport; - } - this.raiseRecoverable( - node.start, - "'import.defer' can only be used in a dynamic import." - ); - } - - return node; - } - - /** - * @this {InstanceType} - * @param {MetaProperty} node node - * @returns {MetaProperty} import.meta - */ - parseImportMeta(node) { - this.next(); - - const containsEsc = this.containsEsc; - node.property = this.parseIdent(true); - - const { name } = node.property; - - if (name !== "meta" && name !== "defer") { - this.raiseRecoverable( - // eslint-disable-next-line no-warning-comments - // @ts-ignore - node.property.start, - "The only valid meta property for import is 'import.meta'" - ); - } - if (containsEsc) { - this.raiseRecoverable( - // eslint-disable-next-line no-warning-comments - // @ts-ignore - node.start, - `'import.${name}' must not contain escaped characters` - ); - } - if ( - name === "meta" && - this.options.sourceType !== "module" && - !this.options.allowImportExportEverywhere - ) { - this.raiseRecoverable( - // eslint-disable-next-line no-warning-comments - // @ts-ignore - node.start, - "Cannot use 'import.meta' outside a module" - ); - } - - return this.finishNode(node, "MetaProperty"); - } - }; - // Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API -const parser = AcornParser.extend(importAssertions, importDefer); +const parser = AcornParser.extend( + importAssertions, + acornImportPhases({ source: false }) +); /** @typedef {Record & { _isLegacyAssert?: boolean }} ImportAttributes */ diff --git a/package.json b/package.json index 3471f673175..7289918c9f6 100644 --- a/package.json +++ b/package.json @@ -88,6 +88,7 @@ "@webassemblyjs/wasm-edit": "^1.14.1", "@webassemblyjs/wasm-parser": "^1.14.1", "acorn": "^8.15.0", + "acorn-import-phases": "^1.0.3", "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.17.2", diff --git a/yarn.lock b/yarn.lock index e138b0d2aa9..899d6902e5c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1851,6 +1851,11 @@ abort-controller@^3.0.0: dependencies: event-target-shim "^5.0.0" +acorn-import-phases@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/acorn-import-phases/-/acorn-import-phases-1.0.3.tgz#30394a1dccee5f380aecb8205b8c69b4f7ae688e" + integrity sha512-jtKLnfoOzm28PazuQ4dVBcE9Jeo6ha1GAJvq3N0LlNOszmTfx+wSycBehn+FN0RnyeR77IBxN/qVYMw0Rlj0Xw== + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" From 8ccc7da94df62d79cbe48f6b3c9f4c9c8e5a4259 Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Tue, 8 Jul 2025 20:49:59 +0800 Subject: [PATCH 50/56] refactor: constant conditional logic (#19655) --- lib/ExportsInfo.js | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/lib/ExportsInfo.js b/lib/ExportsInfo.js index a7d7e9ce682..e8fb81d01d0 100644 --- a/lib/ExportsInfo.js +++ b/lib/ExportsInfo.js @@ -508,17 +508,15 @@ class ExportsInfo { * @returns {SortableSet | boolean | null} set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown) */ getUsedExports(runtime) { - // eslint-disable-next-line no-constant-binary-expression - if (!this._redirectTo !== undefined) { - switch (this._otherExportsInfo.getUsed(runtime)) { - case UsageState.NoInfo: - return null; - case UsageState.Unknown: - case UsageState.OnlyPropertiesUsed: - case UsageState.Used: - return true; - } + switch (this._otherExportsInfo.getUsed(runtime)) { + case UsageState.NoInfo: + return null; + case UsageState.Unknown: + case UsageState.OnlyPropertiesUsed: + case UsageState.Used: + return true; } + const array = []; if (!this._exportsAreOrdered) this._sortExports(); for (const exportInfo of this._exports.values()) { @@ -557,17 +555,15 @@ class ExportsInfo { * @returns {null | true | string[]} list of exports when known */ getProvidedExports() { - // eslint-disable-next-line no-constant-binary-expression - if (!this._redirectTo !== undefined) { - switch (this._otherExportsInfo.provided) { - case undefined: - return null; - case null: - return true; - case true: - return true; - } + switch (this._otherExportsInfo.provided) { + case undefined: + return null; + case null: + return true; + case true: + return true; } + /** @type {string[]} */ const array = []; if (!this._exportsAreOrdered) this._sortExports(); From 68ce2a7240eb3d4cc9f039b8a98956c68e9fff23 Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Tue, 8 Jul 2025 20:52:43 +0800 Subject: [PATCH 51/56] refactor: TestCases template (#19662) --- eslint.config.mjs | 1 + test/TestCases.template.js | 130 ++++++--------------------- test/runner/index.js | 180 ++++++++++++++++++++++++------------- 3 files changed, 145 insertions(+), 166 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 6c7f9329f40..418e3e854c2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -21,6 +21,7 @@ export default defineConfig([ "!test/helpers/*.*", "!test/benchmarkCases/**/*.mjs", "!test/_helpers/**/*.mjs", + "!test/runner/*.js", "test/js/**/*.*", // TODO fix me diff --git a/test/TestCases.template.js b/test/TestCases.template.js index dcb7d3ac9e2..e4b52f7f43e 100644 --- a/test/TestCases.template.js +++ b/test/TestCases.template.js @@ -3,16 +3,14 @@ require("./helpers/warmup-webpack"); const path = require("path"); -const { URL, pathToFileURL } = require("url"); -const vm = require("vm"); const fs = require("graceful-fs"); const rimraf = require("rimraf"); const checkArrayExpectation = require("./checkArrayExpectation"); -const asModule = require("./helpers/asModule"); const captureStdio = require("./helpers/captureStdio"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const deprecationTracking = require("./helpers/deprecationTracking"); const filterInfraStructureErrors = require("./helpers/infrastructureLogErrors"); +const { TestRunner } = require("./runner"); const casesPath = path.join(__dirname, "cases"); let categories = fs.readdirSync(casesPath); @@ -434,109 +432,33 @@ const describeCases = config => { ); it(`${testName} should load the compiled tests`, done => { - const esmContext = vm.createContext({ - it: _it, - expect, - process, - global, - URL, - Buffer, - setTimeout, - setImmediate, - nsObj(m) { - Object.defineProperty(m, Symbol.toStringTag, { - value: "Module" - }); - return m; - } + const runner = new TestRunner({ + target: options.target, + outputDirectory, + testMeta: { + category: category.name, + name: testName + }, + testConfig, + webpackOptions: options }); - cleanups.push(() => (esmContext.it = undefined)); - - /** - * @param {string} module a module - * @param {"evaluated" | "unlinked"=} esmMode esm mode - * @returns {EXPECTED_ANY} required module - * @private - */ - function _require(module, esmMode) { - if (module.startsWith("./")) { - const p = path.join(outputDirectory, module); - const content = fs.readFileSync(p, "utf8"); - if (p.endsWith(".mjs")) { - let esm; - try { - esm = new vm.SourceTextModule(content, { - identifier: p, - context: esmContext, - initializeImportMeta: (meta, module) => { - meta.url = pathToFileURL(p).href; - }, - importModuleDynamically: async (specifier, module) => { - const result = await _require(specifier, "evaluated"); - return await asModule(result, module.context); - } - }); - cleanups.push(() => (esmContext.it = undefined)); - } catch (err) { - console.log(err); - err.message += `\nwhile parsing ${p}`; - throw err; - } - if (esmMode === "unlinked") return esm; - return (async () => { - await esm.link( - async (specifier, module) => - await asModule( - await _require(specifier, "unlinked"), - module.context, - true - ) - ); - // node.js 10 needs instantiate - if (esm.instantiate) esm.instantiate(); - await esm.evaluate(); - if (esmMode === "evaluated") return esm; - const ns = esm.namespace; - return ns.default && ns.default instanceof Promise - ? ns.default - : ns; - })(); - } - const fn = vm.runInThisContext( - "(function(require, module, exports, __dirname, __filename, it, expect) {" + - "global.expect = expect;" + - `function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }${ - content - }\n})`, - p - ); - const m = { - exports: {}, - webpackTestSuiteModule: true - }; - fn.call( - m.exports, - _require, - m, - m.exports, - outputDirectory, - p, - _it, - expect - ); - return m.exports; - } - return require(module); + runner.mergeModuleScope({ + it: _it + }); + if (testConfig.moduleScope) { + testConfig.moduleScope(runner._moduleScope, options); } - _require.webpackTestSuiteRequire = true; - Promise.resolve() - .then(() => _require(`./${options.output.filename}`)) - .then(() => { - if (getNumberOfTests() === 0) { - return done(new Error("No tests exported by test case")); - } - done(); - }, done); + runner.require.webpackTestSuiteRequire = true; + const results = []; + results.push( + runner.require(outputDirectory, `./${options.output.filename}`) + ); + Promise.all(results).then(() => { + if (getNumberOfTests() === 0) { + return done(new Error("No tests exported by test case")); + } + done(); + }, done); }, 10000); const { it: _it, getNumberOfTests } = createLazyTestEnv( diff --git a/test/runner/index.js b/test/runner/index.js index e6bc9f73973..c298d649c8a 100644 --- a/test/runner/index.js +++ b/test/runner/index.js @@ -1,11 +1,11 @@ const fs = require("fs"); const path = require("path"); +const { fileURLToPath, pathToFileURL } = require("url"); const vm = require("vm"); -const { pathToFileURL, fileURLToPath } = require("url"); /** - * @param {string} path - * @returns {string} + * @param {string} path path + * @returns {string} subPath */ const getSubPath = path => { let subPath = ""; @@ -28,15 +28,15 @@ const getSubPath = path => { }; /** - * @param {string} path - * @returns {boolean} + * @param {string} path path + * @returns {boolean} whether path is a relative path */ const isRelativePath = path => /^\.\.?\//.test(path); /** - * @param {string} url - * @param {string} outputDirectory - * @returns {string} + * @param {string} url url + * @param {string} outputDirectory outputDirectory + * @returns {string} absolute path */ const urlToPath = (url, outputDirectory) => { if (url.startsWith("https://test.cases/path/")) url = url.slice(24); @@ -45,8 +45,8 @@ const urlToPath = (url, outputDirectory) => { }; /** - * @param {string} url - * @returns {string} + * @param {string} url url + * @returns {string} relative path */ const urlToRelativePath = url => { if (url.startsWith("https://test.cases/path/")) url = url.slice(24); @@ -55,23 +55,23 @@ const urlToRelativePath = url => { }; /** - * @typedef {Object} TestMeta + * @typedef {object} TestMeta * @property {string} category * @property {string} name - * @property {"jsdom"} [env] - * @property {number} [round] + * @property {"jsdom"=} env + * @property {number=} round */ /** - * @typedef {Object} TestConfig - * @property {Function} [resolveModule] - * @property {Function} [moduleScope] - * @property {Function} [nonEsmThis] - * @property {boolean} [evaluateScriptOnAttached] + * @typedef {object} TestConfig + * @property {EXPECTED_FUNCTION=} resolveModule + * @property {EXPECTED_FUNCTION=} moduleScope + * @property {EXPECTED_FUNCTION=} nonEsmThis + * @property {boolean=} evaluateScriptOnAttached */ /** - * @typedef {Object} TestRunnerOptions + * @typedef {object} TestRunnerOptions * @property {string|string[]} target * @property {string} outputDirectory * @property {TestMeta} testMeta @@ -80,19 +80,19 @@ const urlToRelativePath = url => { */ /** - * @typedef {Object} ModuleInfo + * @typedef {object} ModuleInfo * @property {string} subPath * @property {string} modulePath * @property {string} content */ /** - * @typedef {Object} RequireContext + * @typedef {object} RequireContext * @property {"unlinked"|"evaluated"} esmMode */ /** - * @typedef {Object} ModuleRunner + * @typedef {object} ModuleRunner * @property {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} cjs * @property {(moduleInfo: ModuleInfo, context: RequireContext) => Promise} esm * @property {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} json @@ -101,7 +101,7 @@ const urlToRelativePath = url => { class TestRunner { /** - * @param {TestRunnerOptions} options + * @param {TestRunnerOptions} options test runner options */ constructor({ target, @@ -119,10 +119,11 @@ class TestRunner { this._globalContext = this.createBaseGlobalContext(); this._moduleScope = this.createBaseModuleScope(); this._moduleRunners = this.createModuleRunners(); + this._esmContext = this.createBaseEsmContext(); } /** - * @returns {ModuleRunner} + * @returns {ModuleRunner} module runners */ createModuleRunners() { return { @@ -132,16 +133,26 @@ class TestRunner { raw: this.createRawRunner() }; } + /** * @returns {EXPECTED_ANY} globalContext */ createBaseGlobalContext() { - let base = { console, expect, setTimeout, clearTimeout }; + const base = { console, expect, setTimeout, clearTimeout }; Object.assign(base, this.setupEnv()); return base; } + + /** + * @param {EXPECTED_ANY} esmContext esm context + * @returns {EXPECTED_ANY} esm context + */ + mergeEsmContext(esmContext) { + return Object.assign(this._esmContext, esmContext); + } + /** - * @returns {boolean} + * @returns {boolean} whether target is web */ isTargetWeb() { return ( @@ -151,17 +162,19 @@ class TestRunner { (this.target.includes("web") || this.target.includes("webworker"))) ); } + /** - * @returns {boolean} + * @returns {boolean} whether env is jsdom */ jsDom() { return this.testMeta.env === "jsdom" || this.isTargetWeb(); } + /** * @returns {EXPECTED_ANY} moduleScope */ createBaseModuleScope() { - let base = { + const base = { console, expect, jest, @@ -179,24 +192,42 @@ class TestRunner { } return base; } + + /** + * @returns {EXPECTED_ANY} esm context + */ + createBaseEsmContext() { + const base = { + global, + process, + setTimeout, + setImmediate, + URL, + Buffer + }; + return base; + } + /** - * @param {EXPECTED_ANY} globalContext - * @returns {EXPECTED_ANY} + * @param {EXPECTED_ANY} globalContext global context + * @returns {EXPECTED_ANY} global context */ mergeGlobalContext(globalContext) { return Object.assign(this._globalContext, globalContext); } + /** - * @param {EXPECTED_ANY} moduleScope - * @returns {EXPECTED_ANY} + * @param {EXPECTED_ANY} moduleScope module scope + * @returns {EXPECTED_ANY} module scope */ mergeModuleScope(moduleScope) { return Object.assign(this._moduleScope, moduleScope); } + /** - * @param {string} currentDirectory - * @param {string|string[]} module - * @returns {ModuleInfo} + * @param {string} currentDirectory current directory + * @param {string|string[]} module module + * @returns {ModuleInfo} module info */ _resolveModule(currentDirectory, module) { if (Array.isArray(module)) { @@ -212,14 +243,14 @@ class TestRunner { return { subPath: getSubPath(module), modulePath: path.join(currentDirectory, module), - content: fs.readFileSync(path.join(currentDirectory, module), "utf-8") + content: fs.readFileSync(path.join(currentDirectory, module), "utf8") }; } if (path.isAbsolute(module)) { return { subPath: "", modulePath: module, - content: fs.readFileSync(module, "utf-8") + content: fs.readFileSync(module, "utf8") }; } if (module.startsWith("https://test.")) { @@ -227,16 +258,16 @@ class TestRunner { return { subPath: "", modulePath: realPath, - content: fs.readFileSync(realPath, "utf-8") + content: fs.readFileSync(realPath, "utf8") }; } } /** - * @param {string} currentDirectory - * @param {string|string[]} module - * @param {RequireContext} [context={}] - * @returns {EXPECTED_ANY} + * @param {string} currentDirectory current directory + * @param {string|string[]} module module + * @param {RequireContext=} context context + * @returns {EXPECTED_ANY} require result */ require(currentDirectory, module, context = {}) { if (this.testConfig.modules && module in this.testConfig.modules) { @@ -249,7 +280,7 @@ class TestRunner { this.webpackOptions ); } - let moduleInfo = this._resolveModule(currentDirectory, module); + const moduleInfo = this._resolveModule(currentDirectory, module); if (!moduleInfo) { return require(module.startsWith("node:") ? module.slice(5) : module); } @@ -269,24 +300,29 @@ class TestRunner { } return this._moduleRunners.cjs(moduleInfo, context); } + /** - * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} + * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} cjs runner */ createCjsRunner() { const requireCache = Object.create(null); - return (moduleInfo, context) => { + return (moduleInfo, _context) => { const { modulePath, subPath, content } = moduleInfo; let _content = content; if (modulePath in requireCache) { return requireCache[modulePath].exports; } const mod = { - exports: {} + exports: {}, + webpackTestSuiteModule: true }; requireCache[modulePath] = mod; const moduleScope = { ...this._moduleScope, - require: this.require.bind(this, path.dirname(modulePath)), + require: Object.assign( + this.require.bind(this, path.dirname(modulePath)), + this.require + ), importScripts: url => { expect(url).toMatch(/^https:\/\/test\.cases\/path\//); this.require(this.outputDirectory, urlToRelativePath(url)); @@ -301,8 +337,9 @@ class TestRunner { if (this.testConfig.moduleScope) { this.testConfig.moduleScope(moduleScope, this.webpackOptions); } - if (!this._runInNewContext) + if (!this._runInNewContext) { _content = `Object.assign(global, _globalAssign); ${content}`; + } const args = Object.keys(moduleScope); const argValues = args.map(arg => moduleScope[arg]); const code = `(function(${args.join(", ")}) {${_content}\n})`; @@ -320,6 +357,7 @@ class TestRunner { }; if (document) { const CurrentScript = require("../helpers/CurrentScript"); + const oldCurrentScript = document.currentScript; document.currentScript = new CurrentScript(subPath); try { @@ -333,28 +371,36 @@ class TestRunner { return mod.exports; }; } + /** - * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => Promise} + * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => Promise} esm runner */ createEsmRunner() { + const createEsmContext = () => + vm.createContext( + { ...this._moduleScope, ...this._esmContext }, + { + name: "context for esm" + } + ); const esmCache = new Map(); const { category, name, round } = this.testMeta; const esmIdentifier = `${category.name}-${name}-${round || 0}`; let esmContext = null; return (moduleInfo, context) => { const asModule = require("../helpers/asModule"); + // lazy bind esm context if (!esmContext) { - esmContext = vm.createContext(this._moduleScope, { - name: "context for esm" - }); + esmContext = createEsmContext(); } - const { modulePath, subPath, content } = moduleInfo; + const { modulePath, content } = moduleInfo; const { esmMode } = context; - if (!vm.SourceTextModule) + if (!vm.SourceTextModule) { throw new Error( "Running this test requires '--experimental-vm-modules'.\nRun with 'node --experimental-vm-modules node_modules/jest-cli/bin/jest'." ); + } let esm = esmCache.get(modulePath); if (!esm) { esm = new vm.SourceTextModule(content, { @@ -416,22 +462,32 @@ class TestRunner { })(); }; } + + /** + * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} json runner + */ createJSONRunner() { - return moduleInfo => { - return JSON.parse(moduleInfo.content); - }; + return moduleInfo => JSON.parse(moduleInfo.content); } + + /** + * @returns {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} raw runner + */ createRawRunner() { - return moduleInfo => { - return moduleInfo.content; - }; + return moduleInfo => moduleInfo.content; } + + /** + * @returns {EXPECTED_ANY} env + */ setupEnv() { if (this.jsDom()) { const outputDirectory = this.outputDirectory; + const FakeDocument = require("../helpers/FakeDocument"); const createFakeWorker = require("../helpers/createFakeWorker"); const EventSource = require("../helpers/EventSourceForNode"); + const document = new FakeDocument(outputDirectory); if (this.testConfig.evaluateScriptOnAttached) { document.onScript = src => { @@ -448,7 +504,7 @@ class TestRunner { return { status: 200, ok: true, - json: async () => JSON.parse(buffer.toString("utf-8")) + json: async () => JSON.parse(buffer.toString("utf8")) }; } catch (err) { if (err.code === "ENOENT") { @@ -460,7 +516,7 @@ class TestRunner { throw err; } }; - let env = { + const env = { setTimeout, document, location: { From 260f85e466d6ee84e60c68f777082a1f575a671e Mon Sep 17 00:00:00 2001 From: Natsu Xiao <784487301@qq.com> Date: Tue, 8 Jul 2025 20:54:12 +0800 Subject: [PATCH 52/56] fix(esm): ensure dependent chunks are imported before startup & fix duplicate export of 'default' --- lib/esm/ModuleChunkFormatPlugin.js | 43 +++++++++++-------- lib/esm/ModuleChunkLoadingPlugin.js | 5 ++- .../module/duplicate-export/index.js | 7 +++ .../module/duplicate-export/separate.js | 1 + .../module/duplicate-export/test.config.js | 5 +++ .../module/duplicate-export/webpack.config.js | 28 ++++++++++++ .../module/split-chunks-issue-19657/index.js | 8 ++++ .../split-chunks-issue-19657/test.config.js | 5 +++ .../split-chunks-issue-19657/testModule1.js | 1 + .../split-chunks-issue-19657/testModule2.js | 5 +++ .../webpack.config.js | 34 +++++++++++++++ 11 files changed, 124 insertions(+), 18 deletions(-) create mode 100644 test/configCases/module/duplicate-export/index.js create mode 100644 test/configCases/module/duplicate-export/separate.js create mode 100644 test/configCases/module/duplicate-export/test.config.js create mode 100644 test/configCases/module/duplicate-export/webpack.config.js create mode 100644 test/configCases/module/split-chunks-issue-19657/index.js create mode 100644 test/configCases/module/split-chunks-issue-19657/test.config.js create mode 100644 test/configCases/module/split-chunks-issue-19657/testModule1.js create mode 100644 test/configCases/module/split-chunks-issue-19657/testModule2.js create mode 100644 test/configCases/module/split-chunks-issue-19657/webpack.config.js diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index 5915f20e281..5aea546d6e9 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -164,24 +164,33 @@ class ModuleChunkFormatPlugin { return source; } }; - hooks.renderMain.tap(PLUGIN_NAME, (modules, renderContext) => { - const { chunk, chunkGraph } = renderContext; - const entryDependentChunks = - chunkGraph.getChunkEntryDependentChunksIterable(chunk); - const sourceWithDependentChunks = withDependentChunks( - /** @type {Set} */ (entryDependentChunks), - chunkGraph, - chunk - ); - if (!sourceWithDependentChunks) { - return modules; + hooks.renderStartup.tap( + PLUGIN_NAME, + (modules, _lastModule, renderContext) => { + const { chunk, chunkGraph } = renderContext; + if (!chunk.hasRuntime()) { + return modules; + } + const entryDependentChunks = + chunkGraph.getChunkEntryDependentChunksIterable(chunk); + const sourceWithDependentChunks = withDependentChunks( + /** @type {Set} */ (entryDependentChunks), + chunkGraph, + chunk + ); + if (!sourceWithDependentChunks) { + return modules; + } + if (modules.size() === 0) { + return sourceWithDependentChunks; + } + const source = new ConcatSource(); + source.add(sourceWithDependentChunks); + source.add("\n"); + source.add(modules); + return source; } - const source = new ConcatSource(); - source.add(modules); - source.add("\n"); - source.add(sourceWithDependentChunks); - return source; - }); + ); hooks.renderChunk.tap(PLUGIN_NAME, (modules, renderContext) => { const { chunk, chunkGraph, runtimeTemplate } = renderContext; const hotUpdateChunk = chunk instanceof HotUpdateChunk ? chunk : null; diff --git a/lib/esm/ModuleChunkLoadingPlugin.js b/lib/esm/ModuleChunkLoadingPlugin.js index 3f86bc221cb..a34f990a290 100644 --- a/lib/esm/ModuleChunkLoadingPlugin.js +++ b/lib/esm/ModuleChunkLoadingPlugin.js @@ -71,8 +71,11 @@ class ModuleChunkLoadingPlugin { .tap(PLUGIN_NAME, handler); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.externalInstallChunk) - .tap(PLUGIN_NAME, (chunk, set) => { + .tap(PLUGIN_NAME, (chunk, set, { chunkGraph }) => { if (!isEnabledForChunk(chunk)) return; + // If a chunk contains an entryModule, all exports are determined by the entryModule. + // The ExportWebpackRequireRuntimeModule is for internal use only and not exposed to users. + if (chunkGraph.getNumberOfEntryModules(chunk) > 0) return; compilation.addRuntimeModule( chunk, new ExportWebpackRequireRuntimeModule() diff --git a/test/configCases/module/duplicate-export/index.js b/test/configCases/module/duplicate-export/index.js new file mode 100644 index 00000000000..6c4b0d2e15d --- /dev/null +++ b/test/configCases/module/duplicate-export/index.js @@ -0,0 +1,7 @@ +import value from "./separate"; + +it("should compile", () => { + expect(value).toBeDefined(); +}); + +export default "main"; diff --git a/test/configCases/module/duplicate-export/separate.js b/test/configCases/module/duplicate-export/separate.js new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/configCases/module/duplicate-export/separate.js @@ -0,0 +1 @@ +export default 42; diff --git a/test/configCases/module/duplicate-export/test.config.js b/test/configCases/module/duplicate-export/test.config.js new file mode 100644 index 00000000000..9d2aabb1e9b --- /dev/null +++ b/test/configCases/module/duplicate-export/test.config.js @@ -0,0 +1,5 @@ +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 new file mode 100644 index 00000000000..576a99ee237 --- /dev/null +++ b/test/configCases/module/duplicate-export/webpack.config.js @@ -0,0 +1,28 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + mode: "development", + output: { + filename: "[name].mjs", + library: { + type: "module" + } + }, + target: ["web", "es2020"], + experiments: { + outputModule: true + }, + optimization: { + minimize: false, + runtimeChunk: true, + splitChunks: { + cacheGroups: { + separate: { + test: /separate/, + chunks: "all", + filename: "separate.mjs", + enforce: true + } + } + } + } +}; diff --git a/test/configCases/module/split-chunks-issue-19657/index.js b/test/configCases/module/split-chunks-issue-19657/index.js new file mode 100644 index 00000000000..ad1acea94ec --- /dev/null +++ b/test/configCases/module/split-chunks-issue-19657/index.js @@ -0,0 +1,8 @@ +import m2 from "./testModule2.js" + +it("should compile and evaluate fine", (done) => { + expect(m2()).toBe("m11111111"); + done() +}); + +export default "index"; \ No newline at end of file diff --git a/test/configCases/module/split-chunks-issue-19657/test.config.js b/test/configCases/module/split-chunks-issue-19657/test.config.js new file mode 100644 index 00000000000..ab693054953 --- /dev/null +++ b/test/configCases/module/split-chunks-issue-19657/test.config.js @@ -0,0 +1,5 @@ +module.exports = { + findBundle(i, options) { + return ["main.mjs"]; + } +}; diff --git a/test/configCases/module/split-chunks-issue-19657/testModule1.js b/test/configCases/module/split-chunks-issue-19657/testModule1.js new file mode 100644 index 00000000000..78fbf447153 --- /dev/null +++ b/test/configCases/module/split-chunks-issue-19657/testModule1.js @@ -0,0 +1 @@ +export const m1 = "m11111111"; diff --git a/test/configCases/module/split-chunks-issue-19657/testModule2.js b/test/configCases/module/split-chunks-issue-19657/testModule2.js new file mode 100644 index 00000000000..e6091bba12b --- /dev/null +++ b/test/configCases/module/split-chunks-issue-19657/testModule2.js @@ -0,0 +1,5 @@ +import { m1 } from "./testModule1"; + +export default function m2() { + return m1; +} \ No newline at end of file diff --git a/test/configCases/module/split-chunks-issue-19657/webpack.config.js b/test/configCases/module/split-chunks-issue-19657/webpack.config.js new file mode 100644 index 00000000000..56d61cdf6c1 --- /dev/null +++ b/test/configCases/module/split-chunks-issue-19657/webpack.config.js @@ -0,0 +1,34 @@ +/** @type {import("../../../../types").Configuration} */ +module.exports = { + mode: "development", + experiments: { + outputModule: true + }, + output: { + module: true, + chunkFormat: "module", + filename: "[name].mjs", + chunkFilename: "[name].chunk.mjs" + }, + devtool: false, + optimization: { + minimize: false, + splitChunks: { + chunks: "all", + minSize: 0, + cacheGroups: { + testModule1: { + test: /testModule1/, + name: "testModule1", + priority: 10, + enforce: true + }, + testModule2: { + test: /testModule2/, + name: "testModule2", + priority: 20 + } + } + } + } +}; From 5a204dc8cd52f50de2ccd5f2b99b53e58605f20a Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Tue, 8 Jul 2025 17:46:17 +0300 Subject: [PATCH 53/56] chore: more eslint rules (#19667) --- eslint.config.mjs | 9 +-- lib/APIPlugin.js | 2 +- lib/Compilation.js | 8 +-- lib/Compiler.js | 2 +- lib/ConstPlugin.js | 2 +- lib/ContextModuleFactory.js | 4 +- lib/DynamicEntryPlugin.js | 2 +- lib/EvalDevToolModulePlugin.js | 2 +- lib/ExternalModule.js | 2 +- lib/FileSystemInfo.js | 6 +- lib/MultiCompiler.js | 2 +- lib/ProgressPlugin.js | 2 +- lib/RuntimePlugin.js | 8 +-- lib/cache/PackFileCacheStrategy.js | 4 +- .../HoistContainerReferencesPlugin.js | 2 +- lib/container/RemoteModule.js | 2 +- lib/css/walkCssTokens.js | 5 +- lib/debug/ProfilingPlugin.js | 4 +- lib/dependencies/AMDPlugin.js | 4 +- lib/dependencies/CachedConstDependency.js | 6 +- .../CommonJsFullRequireDependency.js | 10 +-- lib/dependencies/CommonJsPlugin.js | 4 +- lib/dependencies/ImportParserPlugin.js | 10 +-- lib/dependencies/SystemPlugin.js | 2 +- lib/dependencies/WorkerPlugin.js | 16 +++-- lib/esm/ModuleChunkFormatPlugin.js | 27 ++++---- lib/ids/NaturalModuleIdsPlugin.js | 2 +- lib/javascript/JavascriptModulesPlugin.js | 4 +- lib/javascript/JavascriptParser.js | 8 +-- lib/optimize/InnerGraphPlugin.js | 4 +- lib/optimize/SplitChunksPlugin.js | 4 +- lib/rules/BasicEffectRulePlugin.js | 2 +- lib/schemes/FileUriPlugin.js | 2 +- lib/schemes/HttpUriPlugin.js | 3 +- lib/serialization/FileMiddleware.js | 2 +- lib/sharing/ConsumeSharedModule.js | 2 +- lib/sharing/ProvideSharedModule.js | 2 +- lib/stats/DefaultStatsFactoryPlugin.js | 12 ++-- lib/stats/DefaultStatsPresetPlugin.js | 2 +- lib/stats/DefaultStatsPrinterPlugin.js | 8 +-- package.json | 2 +- setup/setup.js | 2 +- test/Compiler-caching.test.js | 24 +++---- test/Compiler.test.js | 64 +++++++++---------- test/JavascriptParser.unittest.js | 12 ++-- test/MultiCompiler.test.js | 40 ++++++------ test/TestCases.template.js | 2 +- test/WatchTestCases.template.js | 2 +- test/WatcherEvents.test.js | 4 +- test/WebpackError.unittest.js | 2 +- .../parsing/optional-chaining/test.filter.js | 2 +- .../asset-modules/only-entry/test.config.js | 2 +- .../webpack.config.js | 2 +- .../chunk-graph/issue-17989/test.config.js | 2 +- .../chunk-graph/issue-9634/test.config.js | 2 +- .../chunk-graph/rewalk-chunk/test.config.js | 2 +- .../chunk-index/issue-18008/test.config.js | 2 +- .../order-multiple-entries/test.config.js | 2 +- .../load-chunk-function/test.config.js | 2 +- .../split-chunk-entry-module/test.config.js | 2 +- .../container/0-container-full/test.config.js | 2 +- .../container/1-container-full/test.config.js | 2 +- .../test.config.js | 2 +- .../reference-hoisting/test.config.js | 2 +- .../track-initial-chunks/test.config.js | 2 +- .../context-options/dir/module-a.js | 1 + .../context-options/dir/module-b.js | 1 + .../context-options/dir/module-c.js | 1 + .../context-modules/context-options/index.js | 39 +++++++++++ .../context-options/webpack.config.js | 2 + .../exclusion}/index.js | 0 .../some-dir/check-here/check-here/file.js | 0 .../check-here/dont-check-here/file.js | 0 .../exclusion}/some-dir/check-here/file.js | 0 .../some-dir/dont-check-here/file.js | 0 .../exclusion}/some-dir/dont.js | 0 .../exclusion}/some-dir/file.js | 0 .../exclusion}/webpack.config.js | 0 .../replacement-System.import}/index.js | 0 .../modules/module-b.js | 0 .../webpack.config.js | 2 +- .../replacement-a}/index.js | 0 .../new-context/node_modules/error.js | 0 .../new-context/node_modules/replaced.js | 0 .../replacement-a}/webpack.config.js | 2 +- .../replacement-b}/error.js | 0 .../replacement-b}/index.js | 0 .../replacement-b}/only-this.js | 0 .../replacement-b}/webpack.config.js | 4 +- .../replacement-c}/index.js | 0 .../replacement-c}/modules/a.js | 0 .../replacement-c}/modules/module-b.js | 0 .../replacement-c}/node_modules/d.js | 0 .../replacement-c}/webpack.config.js | 2 +- .../replacement-d}/index.js | 0 .../replacement-d}/modules/a.js | 0 .../replacement-d}/queryloader.js | 0 .../replacement-d}/webpack.config.js | 2 +- .../replacement-e}/index.js | 0 .../new-context/modules/error.js | 0 .../new-context/modules/replaced.js | 0 .../replacement-e}/webpack.config.js | 2 +- .../replacement-f}/folder/a.js | 0 .../replacement-f}/folder/nested/error.js | 0 .../replacement-f}/index.js | 0 .../replacement-f}/webpack.config.js | 0 .../css/basic-dynamic-only/test.config.js | 2 +- .../css/basic-web-async/test.config.js | 2 +- test/configCases/css/basic/test.config.js | 2 +- .../css/conflicting-order/test.config.js | 2 +- .../css-modules-no-space/webpack.config.js | 4 +- .../css/css-modules/test.config.js | 2 +- .../css/escape-unescape/test.config.js | 2 +- .../css/exports-convention/test.config.js | 2 +- .../test.config.js | 2 +- test/configCases/css/external/test.config.js | 2 +- .../css/local-ident-name/test.config.js | 2 +- .../css/pseudo-import/test.config.js | 2 +- .../css/runtime-issue/test.config.js | 2 +- .../test.config.js | 2 +- .../chunk-and-module/webpack.config.js | 2 +- .../entry/no-chunking/test.config.js | 2 +- .../generator-generate-error/test.config.js | 2 +- .../externals-in-commons-chunk/test.config.js | 2 +- .../externals/module-import/test.config.js | 2 +- .../externals/module-import/webpack.config.js | 5 +- .../filename-function/test.config.js | 2 +- .../graph/issue-11770/test.config.js | 2 +- .../graph/issue-11856/test.config.js | 2 +- .../graph/issue-11863/test.config.js | 2 +- .../issues/issue-3596/webpack.config.js | 2 +- .../library/issue-18951/test.config.js | 2 +- .../test.config.js | 2 +- .../module/iife-innter-strict/test.config.js | 2 +- .../test.config.js | 2 +- .../module/issue-16040/test.config.js | 2 +- .../test.config.js | 2 +- .../configCases/output/charset/test.config.js | 2 +- .../banner-plugin-hashing/test.config.js | 2 +- .../limit-chunk-count-plugin/test.config.js | 2 +- .../mini-css-extract-plugin/test.config.js | 2 +- .../webpack.config.js | 2 +- .../virtual-url-plugin/webpack.config.js | 2 +- .../prefer-absolute/webpack.config.js | 2 +- .../resolving/prefer-root/webpack.config.js | 2 +- .../test.config.js | 2 +- .../test.config.js | 2 +- .../test.config.js | 2 +- .../correct-order/test.config.js | 2 +- .../extract-async-from-entry/test.config.js | 2 +- .../hot-multi/test.config.js | 2 +- .../split-chunks-common/hot/test.config.js | 2 +- .../inverted-order/test.config.js | 2 +- .../issue-12128/test.config.js | 2 +- .../library/test.config.js | 2 +- .../move-entry/test.config.js | 2 +- .../move-to-grandparent/test.config.js | 2 +- .../split-chunks-common/simple/test.config.js | 2 +- .../split-chunks/asnyc-entries/test.config.js | 2 +- .../test.config.js | 2 +- .../chunk-filename-delimiter/test.config.js | 2 +- .../custom-filename-function/test.config.js | 2 +- .../test.config.js | 2 +- .../custom-filename/test.config.js | 2 +- .../entry-point-error/test.config.js | 2 +- .../split-chunks/issue-11513/test.config.js | 2 +- .../split-chunks/issue-17332/test.config.js | 2 +- .../split-chunks/issue-8908/test.config.js | 2 +- .../split-chunks/issue-9491/test.config.js | 2 +- .../max-size-casing/test.config.js | 2 +- .../module-type-filter/test.config.js | 2 +- .../move-to-entrypoint/test.config.js | 2 +- .../split-chunks/no-name/test.config.js | 2 +- .../split-chunks/no-options/test.config.js | 2 +- .../reuse-chunk-name/test.config.js | 2 +- .../runtime-chunk-async-node/test.config.js | 2 +- .../runtime-chunk-node-13130/test.config.js | 2 +- .../runtime-chunk-node/test.config.js | 2 +- .../split-chunks/runtime-chunk/test.config.js | 2 +- .../vendor-only-entrypoint/test.config.js | 2 +- .../chunk-loading-per-entry/test.config.js | 2 +- .../trusted-types/web-worker/test.config.js | 2 +- .../umd/issue-15545/test.config.js | 2 +- test/configCases/wasm/fetch/test.config.js | 2 +- .../test.config.js | 2 +- .../non-js-chunks-entrypoint/test.config.js | 2 +- .../web/preexecuted-chunk/test.config.js | 2 +- .../web/prefetch-split-chunks/test.config.js | 2 +- .../web/unique-jsonp/test.config.js | 2 +- .../worker/custom-worker/test.config.js | 2 +- .../worker/node-worker-esm/test.config.js | 1 - .../worker/node-worker-hmr/test.config.js | 2 +- .../worker/node-worker-named/test.config.js | 2 +- .../worker/node-worker/test.config.js | 2 +- .../worker/self-import/test.config.js | 2 +- .../worker/universal/test.config.js | 2 +- .../worker/web-worker/test.config.js | 2 +- .../worker/worker-contenthash/test.config.js | 2 +- test/helpers/FakeDocument.js | 2 +- test/helpers/deprecationTracking.js | 5 +- .../css/single-css-entry/webpack.config.js | 2 +- .../move-between-runtime/test.filter.js | 2 +- .../unsafe-cache-duplicates/webpack.config.js | 2 +- .../webpack.config.js | 4 +- tooling/print-cache-file.js | 2 +- tsconfig.types.test.json | 3 +- yarn.lock | 11 ++-- 207 files changed, 346 insertions(+), 321 deletions(-) create mode 100644 test/configCases/context-modules/context-options/dir/module-a.js create mode 100644 test/configCases/context-modules/context-options/dir/module-b.js create mode 100644 test/configCases/context-modules/context-options/dir/module-c.js create mode 100644 test/configCases/context-modules/context-options/index.js create mode 100644 test/configCases/context-modules/context-options/webpack.config.js rename test/configCases/{context-exclusion/simple => context-modules/exclusion}/index.js (100%) rename test/configCases/{context-exclusion/simple => context-modules/exclusion}/some-dir/check-here/check-here/file.js (100%) rename test/configCases/{context-exclusion/simple => context-modules/exclusion}/some-dir/check-here/dont-check-here/file.js (100%) rename test/configCases/{context-exclusion/simple => context-modules/exclusion}/some-dir/check-here/file.js (100%) rename test/configCases/{context-exclusion/simple => context-modules/exclusion}/some-dir/dont-check-here/file.js (100%) rename test/configCases/{context-exclusion/simple => context-modules/exclusion}/some-dir/dont.js (100%) rename test/configCases/{context-exclusion/simple => context-modules/exclusion}/some-dir/file.js (100%) rename test/configCases/{context-exclusion/simple => context-modules/exclusion}/webpack.config.js (100%) rename test/configCases/{context-replacement/System.import => context-modules/replacement-System.import}/index.js (100%) rename test/configCases/{context-replacement/System.import => context-modules/replacement-System.import}/modules/module-b.js (100%) rename test/configCases/{context-replacement/System.import => context-modules/replacement-System.import}/webpack.config.js (91%) rename test/configCases/{context-replacement/a => context-modules/replacement-a}/index.js (100%) rename test/configCases/{context-replacement/a => context-modules/replacement-a}/new-context/node_modules/error.js (100%) rename test/configCases/{context-replacement/a => context-modules/replacement-a}/new-context/node_modules/replaced.js (100%) rename test/configCases/{context-replacement/a => context-modules/replacement-a}/webpack.config.js (88%) rename test/configCases/{context-replacement/b => context-modules/replacement-b}/error.js (100%) rename test/configCases/{context-replacement/b => context-modules/replacement-b}/index.js (100%) rename test/configCases/{context-replacement/b => context-modules/replacement-b}/only-this.js (100%) rename test/configCases/{context-replacement/b => context-modules/replacement-b}/webpack.config.js (55%) rename test/configCases/{context-replacement/c => context-modules/replacement-c}/index.js (100%) rename test/configCases/{context-replacement/c => context-modules/replacement-c}/modules/a.js (100%) rename test/configCases/{context-replacement/c => context-modules/replacement-c}/modules/module-b.js (100%) rename test/configCases/{context-replacement/c => context-modules/replacement-c}/node_modules/d.js (100%) rename test/configCases/{context-replacement/c => context-modules/replacement-c}/webpack.config.js (92%) rename test/configCases/{context-replacement/d => context-modules/replacement-d}/index.js (100%) rename test/configCases/{context-replacement/d => context-modules/replacement-d}/modules/a.js (100%) rename test/configCases/{context-replacement/d => context-modules/replacement-d}/queryloader.js (100%) rename test/configCases/{context-replacement/d => context-modules/replacement-d}/webpack.config.js (92%) rename test/configCases/{context-replacement/e => context-modules/replacement-e}/index.js (100%) rename test/configCases/{context-replacement/e => context-modules/replacement-e}/new-context/modules/error.js (100%) rename test/configCases/{context-replacement/e => context-modules/replacement-e}/new-context/modules/replaced.js (100%) rename test/configCases/{context-replacement/e => context-modules/replacement-e}/webpack.config.js (92%) rename test/configCases/{context-replacement/f => context-modules/replacement-f}/folder/a.js (100%) rename test/configCases/{context-replacement/f => context-modules/replacement-f}/folder/nested/error.js (100%) rename test/configCases/{context-replacement/f => context-modules/replacement-f}/index.js (100%) rename test/configCases/{context-replacement/f => context-modules/replacement-f}/webpack.config.js (100%) diff --git a/eslint.config.mjs b/eslint.config.mjs index 418e3e854c2..b8d0a370c1c 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -84,12 +84,6 @@ export default defineConfig([ } ], // TODO enable me in future - "unicorn/prefer-regexp-test": "off", - "unicorn/prefer-string-slice": "off", - // TODO false positive, need to fix in upstream - "n/prefer-node-protocol": "off", - "n/prefer-global/url": "off", - // TODO enable me in future "prefer-destructuring": "off" } }, @@ -160,6 +154,9 @@ export default defineConfig([ // 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", + // No need here, we have custom test logic, so except can be placed in different places "jest/no-standalone-expect": "off", diff --git a/lib/APIPlugin.js b/lib/APIPlugin.js index d51fb7a1ef3..b8978e337e8 100644 --- a/lib/APIPlugin.js +++ b/lib/APIPlugin.js @@ -179,7 +179,7 @@ class APIPlugin { compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.getFullHash) - .tap(PLUGIN_NAME, (chunk, set) => { + .tap(PLUGIN_NAME, (chunk, _set) => { compilation.addRuntimeModule(chunk, new GetFullHashRuntimeModule()); return true; }); diff --git a/lib/Compilation.js b/lib/Compilation.js index b8f83d59e94..20dca8e7184 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -683,7 +683,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si { name, /** @type {AsyncSeriesHook["intercept"]} */ - intercept(interceptor) { + intercept(_interceptor) { throw new Error(errorMessage("it's using 'intercept'")); }, /** @type {AsyncSeriesHook["tap"]} */ @@ -5279,7 +5279,7 @@ This prevents using hashes of each other and should be avoided.`); runtimeTemplate, errors, codeGenerationResults, - (err, codeGenerated) => { + (err, _codeGenerated) => { callback(err); } ); @@ -5654,9 +5654,9 @@ Object.defineProperty(compilationPrototype, "cache", { ), set: util.deprecate( /** - * @param {EXPECTED_ANY} v value + * @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 24a72571cd2..fb509a8dc61 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -1391,7 +1391,7 @@ ${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; diff --git a/lib/ConstPlugin.js b/lib/ConstPlugin.js index d79fa0215eb..04cca9430a3 100644 --- a/lib/ConstPlugin.js +++ b/lib/ConstPlugin.js @@ -160,7 +160,7 @@ class ConstPlugin { * @param {JavascriptParser} parser the parser */ const handler = parser => { - parser.hooks.terminate.tap(PLUGIN_NAME, statement => true); + 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); diff --git a/lib/ContextModuleFactory.js b/lib/ContextModuleFactory.js index 00359846771..77a7bf5919c 100644 --- a/lib/ContextModuleFactory.js +++ b/lib/ContextModuleFactory.js @@ -352,7 +352,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory { (segment, callback) => { const subResource = join(fs, directory, segment); - if (!exclude || !subResource.match(exclude)) { + if (!exclude || !exclude.test(subResource)) { fs.stat(subResource, (err, _stat) => { if (err) { if (err.code === "ENOENT") { @@ -370,7 +370,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory { addSubDirectory(ctx, subResource, callback); } else if ( stat.isFile() && - (!include || subResource.match(include)) + (!include || include.test(subResource)) ) { /** @type {{ context: string, request: string }} */ const obj = { diff --git a/lib/DynamicEntryPlugin.js b/lib/DynamicEntryPlugin.js index eb2386dd2bd..79600542090 100644 --- a/lib/DynamicEntryPlugin.js +++ b/lib/DynamicEntryPlugin.js @@ -80,7 +80,7 @@ class DynamicEntryPlugin { } return Promise.all(promises); }) - .then(x => {}) + .then(() => {}) ); } } diff --git a/lib/EvalDevToolModulePlugin.js b/lib/EvalDevToolModulePlugin.js index b9b402a1f6f..bde4bb6466d 100644 --- a/lib/EvalDevToolModulePlugin.js +++ b/lib/EvalDevToolModulePlugin.js @@ -119,7 +119,7 @@ class EvalDevToolModulePlugin { if (compilation.outputOptions.trustedTypes) { compilation.hooks.additionalModuleRuntimeRequirements.tap( PLUGIN_NAME, - (module, set, context) => { + (module, set, _context) => { set.add(RuntimeGlobals.createScript); } ); diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index 488fe187678..64f60eb7363 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -669,7 +669,7 @@ class ExternalModule extends Module { * @param {ConcatenationBailoutReasonContext} context context * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated */ - getConcatenationBailoutReason({ moduleGraph }) { + getConcatenationBailoutReason(context) { switch (this.externalType) { case "amd": case "amd-require": diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index 3cb447e316f..f295078b67b 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -1950,11 +1950,11 @@ class FileSystemInfo { if (imp.d === -1) { // import ... from "..." dependency = parseString( - source.substring(imp.s - 1, imp.e + 1) + source.slice(imp.s - 1, imp.e + 1) ); } else if (imp.d > -1) { // import() - const expr = source.substring(imp.s, imp.e).trim(); + const expr = source.slice(imp.s, imp.e).trim(); dependency = parseString(expr); } else { // e.g. import.meta @@ -1974,7 +1974,7 @@ class FileSystemInfo { }); } catch (err1) { logger.warn( - `Parsing of ${path} for build dependencies failed at 'import(${source.substring( + `Parsing of ${path} for build dependencies failed at 'import(${source.slice( imp.s, imp.e )})'.\n` + diff --git a/lib/MultiCompiler.js b/lib/MultiCompiler.js index 5b8a6597d84..effd4df6311 100644 --- a/lib/MultiCompiler.js +++ b/lib/MultiCompiler.js @@ -598,7 +598,7 @@ module.exports = class MultiCompiler { } return watching; }, - (compiler, watching, callback) => { + (compiler, watching, _callback) => { if (compiler.watching !== watching) return; if (!watching.running) watching.invalidate(); }, diff --git a/lib/ProgressPlugin.js b/lib/ProgressPlugin.js index 4b82f61a232..b5add53ebc1 100644 --- a/lib/ProgressPlugin.js +++ b/lib/ProgressPlugin.js @@ -415,7 +415,7 @@ class ProgressPlugin { } return data; }, - err => { + _err => { // Ignore error } ); diff --git a/lib/RuntimePlugin.js b/lib/RuntimePlugin.js index 462df520dd3..d4eeb5b86da 100644 --- a/lib/RuntimePlugin.js +++ b/lib/RuntimePlugin.js @@ -363,7 +363,7 @@ class RuntimePlugin { "javascript", "javascript update", RuntimeGlobals.getChunkUpdateScriptFilename, - c => + _chunk => /** @type {NonNullable} */ (compilation.outputOptions.hotUpdateChunkFilename), true @@ -465,13 +465,13 @@ class RuntimePlugin { }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.relativeUrl) - .tap(PLUGIN_NAME, (chunk, set) => { + .tap(PLUGIN_NAME, (chunk, _set) => { compilation.addRuntimeModule(chunk, new RelativeUrlRuntimeModule()); return true; }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.onChunksLoaded) - .tap(PLUGIN_NAME, (chunk, set) => { + .tap(PLUGIN_NAME, (chunk, _set) => { compilation.addRuntimeModule( chunk, new OnChunksLoadedRuntimeModule() @@ -495,7 +495,7 @@ class RuntimePlugin { // TODO webpack 6: remove CompatRuntimeModule compilation.hooks.additionalTreeRuntimeRequirements.tap( PLUGIN_NAME, - (chunk, set) => { + (chunk, _set) => { const { mainTemplate } = compilation; if ( mainTemplate.hooks.bootstrap.isUsed() || diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index 57f1375e0ef..29bcf18e55a 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -1209,7 +1209,7 @@ class PackFileCacheStrategy { } logger.time("check build dependencies"); return Promise.all([ - new Promise((resolve, reject) => { + new Promise((resolve, _reject) => { this.fileSystemInfo.checkSnapshotValid( packContainer.buildSnapshot, (err, valid) => { @@ -1231,7 +1231,7 @@ class PackFileCacheStrategy { } ); }), - new Promise((resolve, reject) => { + new Promise((resolve, _reject) => { this.fileSystemInfo.checkSnapshotValid( packContainer.resolveBuildDependenciesSnapshot, (err, valid) => { diff --git a/lib/container/HoistContainerReferencesPlugin.js b/lib/container/HoistContainerReferencesPlugin.js index 3435c98ef2f..669dcccddca 100644 --- a/lib/container/HoistContainerReferencesPlugin.js +++ b/lib/container/HoistContainerReferencesPlugin.js @@ -56,7 +56,7 @@ class HoistContainerReferences { // advanced stage is where SplitChunksPlugin runs. stage: STAGE_ADVANCED + 1 }, - chunks => { + _chunks => { this.hoistModulesInChunks( compilation, depsToTrace, diff --git a/lib/container/RemoteModule.js b/lib/container/RemoteModule.js index 9ff13fcfc0f..41b77701e6b 100644 --- a/lib/container/RemoteModule.js +++ b/lib/container/RemoteModule.js @@ -141,7 +141,7 @@ class RemoteModule extends Module { * @param {CodeGenerationContext} context context for code generation * @returns {CodeGenerationResult} result */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + codeGeneration({ moduleGraph, chunkGraph }) { const module = moduleGraph.getModule(this.dependencies[0]); const id = module && chunkGraph.getModuleId(module); const sources = new Map(); diff --git a/lib/css/walkCssTokens.js b/lib/css/walkCssTokens.js index 4fb7808c349..f6b8b042bda 100644 --- a/lib/css/walkCssTokens.js +++ b/lib/css/walkCssTokens.js @@ -320,6 +320,7 @@ const consumeAStringToken = (input, pos, callbacks) => { const isNonASCIICodePoint = (cc, q) => // Simplify cc > 0x80; + /** * @param {number} cc char code * @returns {boolean} is letter @@ -716,12 +717,12 @@ const consumeRightParenthesis = (input, pos, callbacks) => { }; /** @type {CharHandler} */ -const consumeLeftSquareBracket = (input, pos, callbacks) => +const consumeLeftSquareBracket = (input, pos, _callbacks) => // Return a <]-token>. pos; /** @type {CharHandler} */ -const consumeRightSquareBracket = (input, pos, callbacks) => +const consumeRightSquareBracket = (input, pos, _callbacks) => // Return a <]-token>. pos; diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js index c28d3bc1c80..7a0f648217b 100644 --- a/lib/debug/ProfilingPlugin.js +++ b/lib/debug/ProfilingPlugin.js @@ -378,7 +378,7 @@ const interceptAllParserHooks = (moduleFactory, tracer) => { for (const moduleType of moduleTypes) { moduleFactory.hooks.parser .for(moduleType) - .tap(PLUGIN_NAME, (parser, parserOpts) => { + .tap(PLUGIN_NAME, (parser, _parserOpts) => { interceptAllHooksFor(parser, tracer, "Parser"); }); } @@ -399,7 +399,7 @@ const interceptAllGeneratorHooks = (moduleFactory, tracer) => { for (const moduleType of moduleTypes) { moduleFactory.hooks.generator .for(moduleType) - .tap(PLUGIN_NAME, (parser, parserOpts) => { + .tap(PLUGIN_NAME, (parser, _parserOpts) => { interceptAllHooksFor(parser, tracer, "Generator"); }); } diff --git a/lib/dependencies/AMDPlugin.js b/lib/dependencies/AMDPlugin.js index 29ebc30edda..9c8a12f6a0a 100644 --- a/lib/dependencies/AMDPlugin.js +++ b/lib/dependencies/AMDPlugin.js @@ -119,13 +119,13 @@ class AMDPlugin { compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.amdDefine) - .tap(PLUGIN_NAME, (chunk, set) => { + .tap(PLUGIN_NAME, (chunk, _set) => { compilation.addRuntimeModule(chunk, new AMDDefineRuntimeModule()); }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.amdOptions) - .tap(PLUGIN_NAME, (chunk, set) => { + .tap(PLUGIN_NAME, (chunk, _set) => { compilation.addRuntimeModule( chunk, new AMDOptionsRuntimeModule(amdOptions) diff --git a/lib/dependencies/CachedConstDependency.js b/lib/dependencies/CachedConstDependency.js index 913904abc94..01c0371ed36 100644 --- a/lib/dependencies/CachedConstDependency.js +++ b/lib/dependencies/CachedConstDependency.js @@ -99,11 +99,7 @@ CachedConstDependency.Template = class CachedConstDependencyTemplate extends ( * @param {DependencyTemplateContext} templateContext the context object * @returns {void} */ - apply( - dependency, - source, - { runtimeTemplate, dependencyTemplates, initFragments } - ) { + apply(dependency, source, { initFragments }) { const dep = /** @type {CachedConstDependency} */ (dependency); initFragments.push( diff --git a/lib/dependencies/CommonJsFullRequireDependency.js b/lib/dependencies/CommonJsFullRequireDependency.js index 1164eee150e..98b3b4cb1fa 100644 --- a/lib/dependencies/CommonJsFullRequireDependency.js +++ b/lib/dependencies/CommonJsFullRequireDependency.js @@ -107,15 +107,7 @@ CommonJsFullRequireDependency.Template = class CommonJsFullRequireDependencyTemp apply( dependency, source, - { - module, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtimeRequirements, - runtime, - initFragments - } + { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements, runtime } ) { const dep = /** @type {CommonJsFullRequireDependency} */ (dependency); if (!dep.range) return; diff --git a/lib/dependencies/CommonJsPlugin.js b/lib/dependencies/CommonJsPlugin.js index 1f5e2848411..97b8695872a 100644 --- a/lib/dependencies/CommonJsPlugin.js +++ b/lib/dependencies/CommonJsPlugin.js @@ -156,7 +156,7 @@ class CommonJsPlugin { compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.harmonyModuleDecorator) - .tap(PLUGIN_NAME, (chunk, set) => { + .tap(PLUGIN_NAME, (chunk, _set) => { compilation.addRuntimeModule( chunk, new HarmonyModuleDecoratorRuntimeModule() @@ -165,7 +165,7 @@ class CommonJsPlugin { compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.nodeModuleDecorator) - .tap(PLUGIN_NAME, (chunk, set) => { + .tap(PLUGIN_NAME, (chunk, _set) => { compilation.addRuntimeModule( chunk, new NodeModuleDecoratorRuntimeModule() diff --git a/lib/dependencies/ImportParserPlugin.js b/lib/dependencies/ImportParserPlugin.js index 7c28451edd1..b41e43dd683 100644 --- a/lib/dependencies/ImportParserPlugin.js +++ b/lib/dependencies/ImportParserPlugin.js @@ -346,11 +346,11 @@ class ImportParserPlugin { include, exclude, mode, - namespaceObject: /** @type {BuildMeta} */ ( - parser.state.module.buildMeta - ).strictHarmonyModule - ? "strict" - : true, + namespaceObject: + /** @type {BuildMeta} */ + (parser.state.module.buildMeta).strictHarmonyModule + ? "strict" + : true, typePrefix: "import()", category: "esm", referencedExports: exports, diff --git a/lib/dependencies/SystemPlugin.js b/lib/dependencies/SystemPlugin.js index 367020d64a9..b0e09fd1bc0 100644 --- a/lib/dependencies/SystemPlugin.js +++ b/lib/dependencies/SystemPlugin.js @@ -46,7 +46,7 @@ class SystemPlugin { compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.system) - .tap(PLUGIN_NAME, (chunk, set) => { + .tap(PLUGIN_NAME, (chunk, _set) => { compilation.addRuntimeModule(chunk, new SystemRuntimeModule()); }); diff --git a/lib/dependencies/WorkerPlugin.js b/lib/dependencies/WorkerPlugin.js index cd033354842..8aea2db264d 100644 --- a/lib/dependencies/WorkerPlugin.js +++ b/lib/dependencies/WorkerPlugin.js @@ -493,12 +493,18 @@ class WorkerPlugin { const pattern = item.slice(1, firstDot); const itemMembers = item.slice(firstDot + 1, -2); - parser.hooks.preDeclarator.tap(PLUGIN_NAME, (decl, statement) => { - if (decl.id.type === "Identifier" && decl.id.name === pattern) { - parser.tagVariable(decl.id.name, WorkerSpecifierTag); - return true; + parser.hooks.preDeclarator.tap( + PLUGIN_NAME, + (decl, _statement) => { + if ( + decl.id.type === "Identifier" && + decl.id.name === pattern + ) { + parser.tagVariable(decl.id.name, WorkerSpecifierTag); + return true; + } } - }); + ); parser.hooks.pattern.for(pattern).tap(PLUGIN_NAME, pattern => { parser.tagVariable(pattern.name, WorkerSpecifierTag); return true; diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js index 5aea546d6e9..61c18ed15eb 100644 --- a/lib/esm/ModuleChunkFormatPlugin.js +++ b/lib/esm/ModuleChunkFormatPlugin.js @@ -287,22 +287,19 @@ class ModuleChunkFormatPlugin { } return source; }); - hooks.chunkHash.tap( - PLUGIN_NAME, - (chunk, hash, { chunkGraph, runtimeTemplate }) => { - if (chunk.hasRuntime()) return; - const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); - hash.update(PLUGIN_NAME); - hash.update("1"); - if (runtimeChunk && runtimeChunk.hash) { - // Any change to runtimeChunk should trigger a hash update, - // we shouldn't depend on or inspect its internal implementation. - // import __webpack_require__ from "./runtime-main.e9400aee33633a3973bd.js"; - hash.update(runtimeChunk.hash); - } - updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash, { chunkGraph }) => { + if (chunk.hasRuntime()) return; + const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph); + hash.update(PLUGIN_NAME); + hash.update("1"); + if (runtimeChunk && runtimeChunk.hash) { + // Any change to runtimeChunk should trigger a hash update, + // we shouldn't depend on or inspect its internal implementation. + // import __webpack_require__ from "./runtime-main.e9400aee33633a3973bd.js"; + hash.update(runtimeChunk.hash); } - ); + updateHashForEntryStartup(hash, chunkGraph, entries, chunk); + }); }); } } diff --git a/lib/ids/NaturalModuleIdsPlugin.js b/lib/ids/NaturalModuleIdsPlugin.js index e12b69b61d6..8dc9ae473b7 100644 --- a/lib/ids/NaturalModuleIdsPlugin.js +++ b/lib/ids/NaturalModuleIdsPlugin.js @@ -26,7 +26,7 @@ class NaturalModuleIdsPlugin { */ apply(compiler) { compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => { - compilation.hooks.moduleIds.tap(PLUGIN_NAME, modules => { + compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => { const [usedIds, modulesInNaturalOrder] = getUsedModuleIdsAndModules(compilation); modulesInNaturalOrder.sort( diff --git a/lib/javascript/JavascriptModulesPlugin.js b/lib/javascript/JavascriptModulesPlugin.js index d58f7003d09..81ce7b8cf4b 100644 --- a/lib/javascript/JavascriptModulesPlugin.js +++ b/lib/javascript/JavascriptModulesPlugin.js @@ -117,10 +117,10 @@ const printGeneratedCodeForStack = (module, code) => { /** * @param {string} line the line * @param {number} i the index - * @param {string[]} lines the lines + * @param {string[]} _lines the lines * @returns {string} the line with line number */ - (line, i, lines) => { + (line, i, _lines) => { const iStr = `${i + 1}`; return `${" ".repeat(n - iStr.length)}${iStr} | ${line}`; } diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index eb504e0a024..98c00d34dcd 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -1386,7 +1386,7 @@ class JavascriptParser extends Parser { return this.callHooksForInfoWithFallback( this.hooks.evaluateIdentifier, info.name, - name => { + _name => { cachedExpression = expression; cachedInfo = info; return undefined; @@ -1441,7 +1441,7 @@ class JavascriptParser extends Parser { }; } }); - tapEvaluateWithVariableInfo("ThisExpression", expr => { + tapEvaluateWithVariableInfo("ThisExpression", _expr => { const info = this.getVariableInfo("this"); if ( typeof info === "string" || @@ -3481,7 +3481,7 @@ class JavascriptParser extends Parser { return; } this.walkExpression(expression.right); - this.enterPattern(expression.left, (name, decl) => { + this.enterPattern(expression.left, (name, _decl) => { if (!this.callHooksForName(this.hooks.assign, name, expression)) { this.walkExpression( /** @type {MemberExpression} */ @@ -3491,7 +3491,7 @@ class JavascriptParser extends Parser { }); } else if (expression.left.type.endsWith("Pattern")) { this.walkExpression(expression.right); - this.enterPattern(expression.left, (name, decl) => { + this.enterPattern(expression.left, (name, _decl) => { if (!this.callHooksForName(this.hooks.assign, name, expression)) { this.defineVariable(name); } diff --git a/lib/optimize/InnerGraphPlugin.js b/lib/optimize/InnerGraphPlugin.js index 168f5bf4d64..0b70503d9b6 100644 --- a/lib/optimize/InnerGraphPlugin.js +++ b/lib/optimize/InnerGraphPlugin.js @@ -195,7 +195,7 @@ class InnerGraphPlugin { } }); - parser.hooks.preDeclarator.tap(PLUGIN_NAME, (decl, statement) => { + parser.hooks.preDeclarator.tap(PLUGIN_NAME, (decl, _statement) => { if (!InnerGraph.isEnabled(parser.state)) return; if ( parser.scope.topLevelScope === true && @@ -363,7 +363,7 @@ class InnerGraphPlugin { } ); - parser.hooks.declarator.tap(PLUGIN_NAME, (decl, statement) => { + parser.hooks.declarator.tap(PLUGIN_NAME, (decl, _statement) => { if (!InnerGraph.isEnabled(parser.state)) return; const fn = declWithTopLevelSymbol.get(decl); diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index 321cb423df9..08512518c45 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -279,10 +279,10 @@ const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial(); */ const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial(); /** - * @param {Chunk} chunk the chunk + * @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 diff --git a/lib/rules/BasicEffectRulePlugin.js b/lib/rules/BasicEffectRulePlugin.js index 3e7ca5f87b2..c7ab48b578d 100644 --- a/lib/rules/BasicEffectRulePlugin.js +++ b/lib/rules/BasicEffectRulePlugin.js @@ -35,7 +35,7 @@ class BasicEffectRulePlugin { apply(ruleSetCompiler) { ruleSetCompiler.hooks.rule.tap( PLUGIN_NAME, - (path, rule, unhandledProperties, result, references) => { + (path, rule, unhandledProperties, result) => { if (unhandledProperties.has(this.ruleProperty)) { unhandledProperties.delete(this.ruleProperty); diff --git a/lib/schemes/FileUriPlugin.js b/lib/schemes/FileUriPlugin.js index 26758ac6e2b..e870e1b6b60 100644 --- a/lib/schemes/FileUriPlugin.js +++ b/lib/schemes/FileUriPlugin.js @@ -5,7 +5,7 @@ "use strict"; -const { URL, fileURLToPath } = require("url"); +const { fileURLToPath } = require("url"); const { NormalModule } = require(".."); /** @typedef {import("../Compiler")} Compiler */ diff --git a/lib/schemes/HttpUriPlugin.js b/lib/schemes/HttpUriPlugin.js index 01b0ed3373e..0dad3db3d0f 100644 --- a/lib/schemes/HttpUriPlugin.js +++ b/lib/schemes/HttpUriPlugin.js @@ -7,7 +7,6 @@ const EventEmitter = require("events"); const { basename, extname } = require("path"); -const { URL } = require("url"); const { // eslint-disable-next-line n/no-unsupported-features/node-builtins createBrotliDecompress, @@ -37,7 +36,7 @@ const getHttps = memoize(() => require("https")); /** * @param {typeof import("http") | typeof import("https")} request request - * @param {string | { toString: () => string } | undefined} proxy proxy + * @param {string | URL | undefined} proxy proxy * @returns {(url: URL, requestOptions: RequestOptions, callback: (incomingMessage: IncomingMessage) => void) => EventEmitter} fn */ const proxyFetch = (request, proxy) => (url, options, callback) => { diff --git a/lib/serialization/FileMiddleware.js b/lib/serialization/FileMiddleware.js index 1b24bc99275..41b7da48391 100644 --- a/lib/serialization/FileMiddleware.js +++ b/lib/serialization/FileMiddleware.js @@ -554,7 +554,7 @@ class FileMiddleware extends SerializerMiddleware { * @param {(value?: undefined) => void} resolve resolve */ resolve => { - this.fs.rename(filename, `${filename}.old`, err => { + this.fs.rename(filename, `${filename}.old`, _err => { resolve(); }); } diff --git a/lib/sharing/ConsumeSharedModule.js b/lib/sharing/ConsumeSharedModule.js index 20f8fda1ed3..7e14b716bc9 100644 --- a/lib/sharing/ConsumeSharedModule.js +++ b/lib/sharing/ConsumeSharedModule.js @@ -177,7 +177,7 @@ class ConsumeSharedModule extends Module { * @param {CodeGenerationContext} context context for code generation * @returns {CodeGenerationResult} result */ - codeGeneration({ chunkGraph, moduleGraph, runtimeTemplate }) { + codeGeneration({ chunkGraph, runtimeTemplate }) { const runtimeRequirements = new Set([RuntimeGlobals.shareScopeMap]); const { shareScope, diff --git a/lib/sharing/ProvideSharedModule.js b/lib/sharing/ProvideSharedModule.js index 1e67f79f4e0..e4c83e6c99a 100644 --- a/lib/sharing/ProvideSharedModule.js +++ b/lib/sharing/ProvideSharedModule.js @@ -132,7 +132,7 @@ class ProvideSharedModule extends Module { * @param {CodeGenerationContext} context context for code generation * @returns {CodeGenerationResult} result */ - codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { + codeGeneration({ runtimeTemplate, chunkGraph }) { const runtimeRequirements = new Set([RuntimeGlobals.initializeSharing]); const code = `register(${JSON.stringify(this._name)}, ${JSON.stringify( this._version || "0" diff --git a/lib/stats/DefaultStatsFactoryPlugin.js b/lib/stats/DefaultStatsFactoryPlugin.js index e51a1248fa9..dce67f1dae4 100644 --- a/lib/stats/DefaultStatsFactoryPlugin.js +++ b/lib/stats/DefaultStatsFactoryPlugin.js @@ -495,7 +495,7 @@ const EXTRACT_ERROR = { errorDetails: ( object, error, - { type, compilation, cachedGetErrors, cachedGetWarnings }, + { type, compilation, cachedGetErrors }, { errorDetails } ) => { if ( @@ -1037,7 +1037,7 @@ const SIMPLE_EXTRACTORS = { _: ( object, asset, - { compilation, compilationFileToChunks, compilationAuxiliaryFileToChunks } + { compilationFileToChunks, compilationAuxiliaryFileToChunks } ) => { const chunks = compilationFileToChunks.get(asset.name) || []; const auxiliaryChunks = @@ -1522,7 +1522,7 @@ const SIMPLE_EXTRACTORS = { ids: (object, chunk) => { object.id = /** @type {ChunkId} */ (chunk.id); }, - chunkRelations: (object, chunk, { compilation: { chunkGraph } }) => { + chunkRelations: (object, chunk, _context) => { /** @type {Set} */ const parents = new Set(); /** @type {Set} */ @@ -1703,7 +1703,7 @@ const SORTERS = { "chunk.modules": MODULES_SORTER, "module.modules": MODULES_SORTER, "module.reasons": { - _: (comparators, { compilation: { chunkGraph } }) => { + _: (comparators, _context) => { comparators.push( compareSelect(x => x.originModule, compareModulesByIdentifier) ); @@ -2147,7 +2147,7 @@ const ASSETS_GROUPERS = { }); } }, - groupAssetsByInfo: (groupConfigs, context, options) => { + groupAssetsByInfo: (groupConfigs, _context, _options) => { /** * @param {string} name name */ @@ -2168,7 +2168,7 @@ const ASSETS_GROUPERS = { groupByAssetInfoFlag("development"); groupByAssetInfoFlag("hotModuleReplacement"); }, - groupAssetsByChunk: (groupConfigs, context, options) => { + groupAssetsByChunk: (groupConfigs, _context, _options) => { /** * @param {keyof KnownStatsAsset} name name */ diff --git a/lib/stats/DefaultStatsPresetPlugin.js b/lib/stats/DefaultStatsPresetPlugin.js index 96b26d74ded..02e4c3dad66 100644 --- a/lib/stats/DefaultStatsPresetPlugin.js +++ b/lib/stats/DefaultStatsPresetPlugin.js @@ -384,7 +384,7 @@ class DefaultStatsPresetPlugin { const defaults = NAMED_PRESETS[/** @type {keyof NamedPresets} */ (key)]; compilation.hooks.statsPreset .for(key) - .tap(PLUGIN_NAME, (options, context) => { + .tap(PLUGIN_NAME, (options, _context) => { applyDefaults(options, defaults); }); } diff --git a/lib/stats/DefaultStatsPrinterPlugin.js b/lib/stats/DefaultStatsPrinterPlugin.js index 9ffbd6a1b20..accddc5d287 100644 --- a/lib/stats/DefaultStatsPrinterPlugin.js +++ b/lib/stats/DefaultStatsPrinterPlugin.js @@ -494,7 +494,7 @@ const MODULE_SIMPLE_PRINTERS = { 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( @@ -831,7 +831,7 @@ const ERROR_PRINTERS = { " " ) : undefined, - "error.moduleTrace": moduleTrace => undefined, + "error.moduleTrace": _moduleTrace => undefined, "error.separator!": () => "\n" }; @@ -1856,7 +1856,7 @@ class DefaultStatsPrinterPlugin { const preferredOrder = PREFERRED_ORDERS[key]; stats.hooks.sortElements .for(key) - .tap(PLUGIN_NAME, (elements, context) => { + .tap(PLUGIN_NAME, (elements, _context) => { createOrder(elements, preferredOrder); }); } diff --git a/package.json b/package.json index 7289918c9f6..1c11d9bffe4 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "eslint-plugin-import": "^2.32.0", "eslint-plugin-jest": "^29.0.1", "eslint-plugin-jsdoc": "^51.2.3", - "eslint-plugin-n": "^17.20.0", + "eslint-plugin-n": "^17.21.0", "eslint-plugin-prettier": "^5.5.0", "eslint-plugin-unicorn": "^59.0.1", "file-loader": "^6.0.0", diff --git a/setup/setup.js b/setup/setup.js index d109aaf779b..83373e617d6 100644 --- a/setup/setup.js +++ b/setup/setup.js @@ -43,7 +43,7 @@ async function runSetupSymlinkAsync() { * @returns {Promise} result */ function checkSymlinkExistsAsync() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { if ( fs.existsSync(nodeModulesFolder) && fs.existsSync(webpackDependencyFolder) && diff --git a/test/Compiler-caching.test.js b/test/Compiler-caching.test.js index e30346d8cee..69f0a99861f 100644 --- a/test/Compiler-caching.test.js +++ b/test/Compiler-caching.test.js @@ -133,12 +133,12 @@ describe("Compiler (caching)", () => { const options = {}; const tempFixture = createTempFixture(); - const helper = compile(tempFixture.cFilepath, options, (stats, files) => { + const helper = compile(tempFixture.cFilepath, options, (stats, _files) => { // Not cached the first time expect(stats.assets[0].name).toBe("bundle.js"); expect(stats.assets[0].emitted).toBe(true); - helper.runAgain((stats, files, iteration) => { + helper.runAgain((stats, _files, _iteration) => { // Cached the second run expect(stats.assets[0].name).toBe("bundle.js"); expect(stats.assets[0].emitted).toBe(false); @@ -151,7 +151,7 @@ describe("Compiler (caching)", () => { setTimeout(() => { fs.writeFileSync(tempFixture.aFilepath, aContent); - helper.runAgain((stats, files, iteration) => { + helper.runAgain((stats, _files, _iteration) => { // Cached the third run expect(stats.assets[0].name).toBe("bundle.js"); expect(stats.assets[0].emitted).toBe(true); @@ -167,12 +167,12 @@ describe("Compiler (caching)", () => { const options = {}; const tempFixture = createTempFixture(); - const helper = compile(tempFixture.cFilepath, options, (stats, files) => { + const helper = compile(tempFixture.cFilepath, options, (stats, _files) => { // Not cached the first time expect(stats.assets[0].name).toBe("bundle.js"); expect(stats.assets[0].emitted).toBe(true); - helper.runAgain((stats, files, iteration) => { + helper.runAgain((stats, files, _iteration) => { // Cached the second run expect(stats.assets[0].name).toBe("bundle.js"); expect(stats.assets[0].emitted).toBe(false); @@ -186,7 +186,7 @@ describe("Compiler (caching)", () => { fs.writeFileSync(tempFixture.aFilepath, aContent); - helper.runAgain((stats, files, iteration) => { + helper.runAgain((stats, files, _iteration) => { // Cached the third run expect(stats.assets[0].name).toBe("bundle.js"); expect(stats.assets[0].emitted).toBe(true); @@ -203,7 +203,7 @@ describe("Compiler (caching)", () => { const options = {}; const tempFixture = createTempFixture(); - const helper = compile(tempFixture.cFilepath, options, (stats, files) => { + const helper = compile(tempFixture.cFilepath, options, (stats, _files) => { // Built the first time expect(stats.modules[0].name).toMatch("c.js"); expect(stats.modules[0].built).toBe(true); @@ -212,7 +212,7 @@ describe("Compiler (caching)", () => { expect(stats.modules[1].built).toBe(true); setTimeout(() => { - helper.runAgain((stats, files, iteration) => { + helper.runAgain((stats, _files, _iteration) => { // Not built when cached the second run expect(stats.modules[0].name).toMatch("c.js"); // expect(stats.modules[0].built).toBe(false); @@ -228,7 +228,7 @@ describe("Compiler (caching)", () => { setTimeout(() => { fs.writeFileSync(tempFixture.aFilepath, aContent); - helper.runAgain((stats, files, iteration) => { + helper.runAgain((stats, _files, _iteration) => { // And only a.js built after it was modified expect(stats.modules[0].name).toMatch("c.js"); expect(stats.modules[0].built).toBe(false); @@ -248,7 +248,7 @@ describe("Compiler (caching)", () => { const options = {}; const tempFixture = createTempFixture(); - const helper = compile(tempFixture.cFilepath, options, (stats, files) => { + const helper = compile(tempFixture.cFilepath, options, (stats, _files) => { // Built the first time expect(stats.modules[0].name).toMatch("c.js"); expect(stats.modules[0].built).toBe(true); @@ -256,7 +256,7 @@ describe("Compiler (caching)", () => { expect(stats.modules[1].name).toMatch("a.js"); expect(stats.modules[1].built).toBe(true); - helper.runAgain((stats, files, iteration) => { + helper.runAgain((stats, _files, _iteration) => { // Not built when cached the second run expect(stats.modules[0].name).toMatch("c.js"); // expect(stats.modules[0].built).toBe(false); @@ -271,7 +271,7 @@ describe("Compiler (caching)", () => { fs.writeFileSync(tempFixture.aFilepath, aContent); - helper.runAgain((stats, files, iteration) => { + helper.runAgain((stats, _files, _iteration) => { // And only a.js built after it was modified expect(stats.modules[0].name).toMatch("c.js"); // expect(stats.modules[0].built).toBe(false); diff --git a/test/Compiler.test.js b/test/Compiler.test.js index 161879602f5..7eabfa723b4 100644 --- a/test/Compiler.test.js +++ b/test/Compiler.test.js @@ -94,7 +94,7 @@ describe("Compiler", () => { filename: "the/hell.js" } }, - (stats, files) => { + (stats, _files) => { expect(stats.logs.mkdir).toEqual(["/what", "/what/the"]); done(); } @@ -340,7 +340,7 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); if (compiler.outputFileSystem.existsSync("/bundle.js")) { return done(new Error("Bundle should not be created on error")); @@ -430,7 +430,7 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - const watching = compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, _stats) => { watching.close(); if (err) return done(err); if (compiler.outputFileSystem.existsSync("/bundle.js")) { @@ -453,10 +453,10 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); }); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(); }); }); @@ -474,10 +474,10 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(err); }); - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(); }); }); @@ -495,10 +495,10 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); }); - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(); }); }); @@ -516,10 +516,10 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(err); }); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(); }); }); @@ -540,7 +540,7 @@ describe("Compiler", () => { () => {} ); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(); }); }); @@ -561,7 +561,7 @@ describe("Compiler", () => { compiler.run((err, stats1) => { if (err) return done(err); - compiler.run((err, stats2) => { + compiler.run((err, _stats2) => { if (err) return done(err); expect(stats1.toString({ all: true })).toBeTypeOf("string"); done(); @@ -582,10 +582,10 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); - const watching = compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, _stats) => { if (err) return done(err); watching.close(done); }); @@ -605,11 +605,11 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - const watching = compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, _stats) => { if (err) return done(err); }); watching.close(() => { - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); done(); }); @@ -629,7 +629,7 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - const watching = compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, _stats) => { if (err) return done(err); watching.close(done); }); @@ -649,11 +649,11 @@ describe("Compiler", () => { } }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - const watching = compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, _stats) => { if (err) return done(err); }); watching.close(() => { - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(err); done(); }); @@ -677,12 +677,12 @@ describe("Compiler", () => { compiler.hooks.afterDone.tap("RunAgainTest", () => { if (!once) return; once = false; - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); done(); }); }); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); }); }); @@ -708,7 +708,7 @@ describe("Compiler", () => { expect(doneHookCb).toHaveBeenCalled(); done(); }); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); runCb(); }); @@ -729,7 +729,7 @@ describe("Compiler", () => { filename: "bundle.js" } }, - (err, stats) => { + (err, _stats) => { if (err) return done(err); instanceCb(); } @@ -770,7 +770,7 @@ describe("Compiler", () => { expect(invalidateCb).toHaveBeenCalled(); watching.close(done); }); - const watching = compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, _stats) => { if (err) return done(err); watchCb(); }); @@ -805,7 +805,7 @@ describe("Compiler", () => { expect(invalidateCb).toHaveBeenCalled(); done(); }); - const watch = compiler.watch({}, (err, stats) => { + const watch = compiler.watch({}, (err, _stats) => { if (err) return done(err); watch.close(watchCloseCb); }); @@ -881,7 +881,7 @@ describe("Compiler", () => { }); compiler.hooks.failed.tap("CompilerTest", failedSpy); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { expect(err).toBeTruthy(); expect(failedSpy).toHaveBeenCalledTimes(1); expect(failedSpy).toHaveBeenCalledWith(err); @@ -956,7 +956,7 @@ describe("Compiler", () => { plugins: [new MyPlugin()] }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((_err, _stats) => { expect(capture.toString().replace(/[\d.]+ ms/, "X ms")) .toMatchInlineSnapshot(` "<-> [MyPlugin] Group @@ -990,7 +990,7 @@ describe("Compiler", () => { plugins: [new MyPlugin()] }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((_err, _stats) => { expect(capture.toString().replace(/[\d.]+ ms/, "X ms")) .toMatchInlineSnapshot(` "<-> [MyPlugin] Group @@ -1024,7 +1024,7 @@ describe("Compiler", () => { plugins: [new MyPlugin()] }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((_err, _stats) => { expect(capture.toString()).toMatchInlineSnapshot('""'); done(); }); @@ -1047,7 +1047,7 @@ describe("Compiler", () => { plugins: [new MyPlugin()] }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((_err, _stats) => { expect(escapeAnsi(capture.toStringRaw()).replace(/[\d.]+ ms/, "X ms")) .toMatchInlineSnapshot(` "<-> [MyPlugin] Group @@ -1082,7 +1082,7 @@ describe("Compiler", () => { plugins: [new MyPlugin()] }); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((_err, _stats) => { expect(escapeAnsi(capture.toStringRaw()).replace(/[\d.]+ ms/, "X ms")) .toMatchInlineSnapshot(` "<-> [MyPlugin] Group diff --git a/test/JavascriptParser.unittest.js b/test/JavascriptParser.unittest.js index 09d19918c27..c34c545cd17 100644 --- a/test/JavascriptParser.unittest.js +++ b/test/JavascriptParser.unittest.js @@ -270,10 +270,10 @@ 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); + .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])); @@ -295,7 +295,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 +304,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,7 +313,7 @@ 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; @@ -710,7 +710,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/MultiCompiler.test.js b/test/MultiCompiler.test.js index 403d0dfc89d..3571d6cea80 100644 --- a/test/MultiCompiler.test.js +++ b/test/MultiCompiler.test.js @@ -26,7 +26,7 @@ const createMultiCompiler = options => { ); compiler.outputFileSystem = createFsFromVolume(new Volume()); compiler.watchFileSystem = { - watch(a, b, c, d, e, f, g) {} + watch(_a, _b, _c, _d, _e, _f, _g) {} }; return compiler; }; @@ -64,10 +64,10 @@ describe("MultiCompiler", () => { it("should not be running twice at a time (run)", done => { const compiler = createMultiCompiler(); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); }); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) { compiler.close(done); } @@ -76,10 +76,10 @@ describe("MultiCompiler", () => { it("should not be running twice at a time (watch)", done => { const compiler = createMultiCompiler(); - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(err); }); - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) { compiler.close(done); } @@ -88,10 +88,10 @@ describe("MultiCompiler", () => { it("should not be running twice at a time (run - watch)", done => { const compiler = createMultiCompiler(); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); }); - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) { compiler.close(done); } @@ -100,10 +100,10 @@ describe("MultiCompiler", () => { it("should not be running twice at a time (watch - run)", done => { const compiler = createMultiCompiler(); - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(err); }); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) { compiler.close(done); } @@ -124,7 +124,7 @@ describe("MultiCompiler", () => { () => {} ); compiler.outputFileSystem = createFsFromVolume(new Volume()); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) { compiler.close(done); } @@ -133,10 +133,10 @@ describe("MultiCompiler", () => { it("should run again correctly after first compilation", done => { const compiler = createMultiCompiler(); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); compiler.close(done); }); @@ -145,10 +145,10 @@ describe("MultiCompiler", () => { it("should watch again correctly after first compilation", done => { const compiler = createMultiCompiler(); - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(err); compiler.close(done); }); @@ -157,11 +157,11 @@ describe("MultiCompiler", () => { it("should run again correctly after first closed watch", done => { const compiler = createMultiCompiler(); - const watching = compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, _stats) => { if (err) return done(err); }); watching.close(() => { - compiler.run((err, stats) => { + compiler.run((err, _stats) => { if (err) return done(err); compiler.close(done); }); @@ -170,11 +170,11 @@ describe("MultiCompiler", () => { it("should watch again correctly after first closed watch", done => { const compiler = createMultiCompiler(); - const watching = compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, _stats) => { if (err) return done(err); }); watching.close(() => { - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(err); compiler.close(done); }); @@ -210,7 +210,7 @@ describe("MultiCompiler", () => { events.push(`${c.name} done`); }); } - compiler.run((err, stats) => { + compiler.run((_err, _stats) => { expect(events.join(" ")).toBe( "a run a done b run b done d run d done e run e done c run c done" ); @@ -628,7 +628,7 @@ describe("MultiCompiler", () => { } } }; - compiler.watch({}, (err, stats) => { + compiler.watch({}, (err, _stats) => { if (err) return done(err); compiler.close(done); }); diff --git a/test/TestCases.template.js b/test/TestCases.template.js index e4b52f7f43e..f035711c55f 100644 --- a/test/TestCases.template.js +++ b/test/TestCases.template.js @@ -10,7 +10,7 @@ const captureStdio = require("./helpers/captureStdio"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const deprecationTracking = require("./helpers/deprecationTracking"); const filterInfraStructureErrors = require("./helpers/infrastructureLogErrors"); -const { TestRunner } = require("./runner"); +const { TestRunner } = require("./runner/index"); const casesPath = path.join(__dirname, "cases"); let categories = fs.readdirSync(casesPath); diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js index 16736a9e454..e48843c6056 100644 --- a/test/WatchTestCases.template.js +++ b/test/WatchTestCases.template.js @@ -212,7 +212,7 @@ const describeCases = config => { const compiler = webpack(options); compiler.hooks.invalid.tap( "WatchTestCasesTest", - (filename, mtime) => { + (filename, _mtime) => { triggeringFilename = filename; } ); diff --git a/test/WatcherEvents.test.js b/test/WatcherEvents.test.js index 3d0230743ef..2db8e930bee 100644 --- a/test/WatcherEvents.test.js +++ b/test/WatcherEvents.test.js @@ -38,7 +38,7 @@ describe("WatcherEvents", () => { let called = false; const compiler = createSingleCompiler(); - const watcher = compiler.watch({}, (err, stats) => { + const watcher = compiler.watch({}, (err, _stats) => { expect(called).toBe(true); done(err); }); @@ -56,7 +56,7 @@ describe("WatcherEvents", () => { let called = false; const compiler = createMultiCompiler(); - const watcher = compiler.watch({}, (err, stats) => { + const watcher = compiler.watch({}, (err, _stats) => { expect(called).toBe(true); done(err); }); diff --git a/test/WebpackError.unittest.js b/test/WebpackError.unittest.js index 19e59b59378..7c38588f076 100644 --- a/test/WebpackError.unittest.js +++ b/test/WebpackError.unittest.js @@ -4,7 +4,7 @@ const WebpackError = require("../lib/WebpackError"); describe("WebpackError", () => { class CustomError extends WebpackError { - constructor(message) { + constructor() { super(); this.name = "CustomError"; diff --git a/test/cases/parsing/optional-chaining/test.filter.js b/test/cases/parsing/optional-chaining/test.filter.js index e54f5d848b4..9486c09cf37 100644 --- a/test/cases/parsing/optional-chaining/test.filter.js +++ b/test/cases/parsing/optional-chaining/test.filter.js @@ -1,3 +1,3 @@ const supportsOptionalChaining = require("../../../helpers/supportsOptionalChaining"); -module.exports = config => supportsOptionalChaining(); +module.exports = () => supportsOptionalChaining(); diff --git a/test/configCases/asset-modules/only-entry/test.config.js b/test/configCases/asset-modules/only-entry/test.config.js index 32f4be1d473..f48f8b79def 100644 --- a/test/configCases/asset-modules/only-entry/test.config.js +++ b/test/configCases/asset-modules/only-entry/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["test.js"]; } }; 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 a9a1dbbfb6b..96dfc3ba940 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 @@ -10,7 +10,7 @@ module.exports = { type: "asset", /** @type {ParserOptionsByModuleTypeKnown['asset']} */ parser: { - dataUrlCondition: (source, { filename, module }) => + dataUrlCondition: (source, { filename }) => filename.includes("?foo=bar") } } diff --git a/test/configCases/chunk-graph/issue-17989/test.config.js b/test/configCases/chunk-graph/issue-17989/test.config.js index fa813148fb8..e03ba4e8401 100644 --- a/test/configCases/chunk-graph/issue-17989/test.config.js +++ b/test/configCases/chunk-graph/issue-17989/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["a.js", "b.js"]; } }; diff --git a/test/configCases/chunk-graph/issue-9634/test.config.js b/test/configCases/chunk-graph/issue-9634/test.config.js index fa813148fb8..e03ba4e8401 100644 --- a/test/configCases/chunk-graph/issue-9634/test.config.js +++ b/test/configCases/chunk-graph/issue-9634/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["a.js", "b.js"]; } }; diff --git a/test/configCases/chunk-graph/rewalk-chunk/test.config.js b/test/configCases/chunk-graph/rewalk-chunk/test.config.js index 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/chunk-graph/rewalk-chunk/test.config.js +++ b/test/configCases/chunk-graph/rewalk-chunk/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; diff --git a/test/configCases/chunk-index/issue-18008/test.config.js b/test/configCases/chunk-index/issue-18008/test.config.js index 52779458946..4e1620b1056 100644 --- a/test/configCases/chunk-index/issue-18008/test.config.js +++ b/test/configCases/chunk-index/issue-18008/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js", "A.js", "shared.js", "B.js", "B-2.js"]; } }; 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 76c7ddf80f5..e4c2d7d4b4a 100644 --- a/test/configCases/chunk-index/order-multiple-entries/test.config.js +++ b/test/configCases/chunk-index/order-multiple-entries/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["entry1.js", "entry2.js"]; } }; 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 76c7ddf80f5..e4c2d7d4b4a 100644 --- a/test/configCases/concatenate-modules/load-chunk-function/test.config.js +++ b/test/configCases/concatenate-modules/load-chunk-function/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["entry1.js", "entry2.js"]; } }; 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 6f8ffeaa317..ed54956ea13 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["runtime.js", "common-index_js.js", "main.js"]; } }; diff --git a/test/configCases/container/0-container-full/test.config.js b/test/configCases/container/0-container-full/test.config.js index 0755f427ddc..acc7d2091c8 100644 --- a/test/configCases/container/0-container-full/test.config.js +++ b/test/configCases/container/0-container-full/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; } }; diff --git a/test/configCases/container/1-container-full/test.config.js b/test/configCases/container/1-container-full/test.config.js index 0755f427ddc..acc7d2091c8 100644 --- a/test/configCases/container/1-container-full/test.config.js +++ b/test/configCases/container/1-container-full/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; } }; 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 0755f427ddc..acc7d2091c8 100644 --- a/test/configCases/container/module-federation-with-shareScope/test.config.js +++ b/test/configCases/container/module-federation-with-shareScope/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; } }; diff --git a/test/configCases/container/reference-hoisting/test.config.js b/test/configCases/container/reference-hoisting/test.config.js index 0755f427ddc..acc7d2091c8 100644 --- a/test/configCases/container/reference-hoisting/test.config.js +++ b/test/configCases/container/reference-hoisting/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; } }; diff --git a/test/configCases/container/track-initial-chunks/test.config.js b/test/configCases/container/track-initial-chunks/test.config.js index 0755f427ddc..acc7d2091c8 100644 --- a/test/configCases/container/track-initial-chunks/test.config.js +++ b/test/configCases/container/track-initial-chunks/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return i === 0 ? "./main.js" : "./module/main.mjs"; } }; diff --git a/test/configCases/context-modules/context-options/dir/module-a.js b/test/configCases/context-modules/context-options/dir/module-a.js new file mode 100644 index 00000000000..e94fef18587 --- /dev/null +++ b/test/configCases/context-modules/context-options/dir/module-a.js @@ -0,0 +1 @@ +export default "a"; diff --git a/test/configCases/context-modules/context-options/dir/module-b.js b/test/configCases/context-modules/context-options/dir/module-b.js new file mode 100644 index 00000000000..eff703ff465 --- /dev/null +++ b/test/configCases/context-modules/context-options/dir/module-b.js @@ -0,0 +1 @@ +export default "b"; diff --git a/test/configCases/context-modules/context-options/dir/module-c.js b/test/configCases/context-modules/context-options/dir/module-c.js new file mode 100644 index 00000000000..5d50db5bc15 --- /dev/null +++ b/test/configCases/context-modules/context-options/dir/module-c.js @@ -0,0 +1 @@ +export default "c"; diff --git a/test/configCases/context-modules/context-options/index.js b/test/configCases/context-modules/context-options/index.js new file mode 100644 index 00000000000..699ea3632ed --- /dev/null +++ b/test/configCases/context-modules/context-options/index.js @@ -0,0 +1,39 @@ +async function loadModule(name) { + return import("./dir/" + name); +} + +async function loadModuleWithExclude(name) { + return import(/* webpackExclude: /module-b\.js$/ */ "./dir/" + name); +} + +async function loadModuleWithInclude(name) { + return import(/* webpackInclude: /module-b\.js$/ */ "./dir/" + name); +} + +async function loadModuleWithMode(name) { + return import(/* webpackMode: "eager" */ "./dir/" + name); +} + +it("should work when no options", async () => { + expect((await loadModule("module-a.js")).default).toBe("a"); + expect((await loadModule("module-b.js")).default).toBe("b"); + expect((await loadModule("module-c.js")).default).toBe("c"); +}); + +it("should work with exclude", async () => { + expect((await loadModuleWithExclude("module-a.js")).default).toBe("a"); + await expect(loadModuleWithExclude("module-b.js")).rejects.toThrow("Cannot find module './module-b.js'"); + expect((await loadModuleWithExclude("module-c.js")).default).toBe("c"); +}); + +it("should work with include", async () => { + await expect(loadModuleWithInclude("module-a.js")).rejects.toThrow("Cannot find module './module-a.js'"); + expect((await loadModuleWithInclude("module-b.js")).default).toBe("b"); + await expect(loadModuleWithInclude("module-c.js")).rejects.toThrow("Cannot find module './module-c.js'"); +}); + +it("should work with mode", async () => { + expect((await loadModuleWithMode("module-a.js")).default).toBe("a"); + expect((await loadModuleWithMode("module-b.js")).default).toBe("b"); + expect((await loadModuleWithMode("module-c.js")).default).toBe("c"); +}); diff --git a/test/configCases/context-modules/context-options/webpack.config.js b/test/configCases/context-modules/context-options/webpack.config.js new file mode 100644 index 00000000000..3583b70a321 --- /dev/null +++ b/test/configCases/context-modules/context-options/webpack.config.js @@ -0,0 +1,2 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = {}; diff --git a/test/configCases/context-exclusion/simple/index.js b/test/configCases/context-modules/exclusion/index.js similarity index 100% rename from test/configCases/context-exclusion/simple/index.js rename to test/configCases/context-modules/exclusion/index.js diff --git a/test/configCases/context-exclusion/simple/some-dir/check-here/check-here/file.js b/test/configCases/context-modules/exclusion/some-dir/check-here/check-here/file.js similarity index 100% rename from test/configCases/context-exclusion/simple/some-dir/check-here/check-here/file.js rename to test/configCases/context-modules/exclusion/some-dir/check-here/check-here/file.js diff --git a/test/configCases/context-exclusion/simple/some-dir/check-here/dont-check-here/file.js b/test/configCases/context-modules/exclusion/some-dir/check-here/dont-check-here/file.js similarity index 100% rename from test/configCases/context-exclusion/simple/some-dir/check-here/dont-check-here/file.js rename to test/configCases/context-modules/exclusion/some-dir/check-here/dont-check-here/file.js diff --git a/test/configCases/context-exclusion/simple/some-dir/check-here/file.js b/test/configCases/context-modules/exclusion/some-dir/check-here/file.js similarity index 100% rename from test/configCases/context-exclusion/simple/some-dir/check-here/file.js rename to test/configCases/context-modules/exclusion/some-dir/check-here/file.js diff --git a/test/configCases/context-exclusion/simple/some-dir/dont-check-here/file.js b/test/configCases/context-modules/exclusion/some-dir/dont-check-here/file.js similarity index 100% rename from test/configCases/context-exclusion/simple/some-dir/dont-check-here/file.js rename to test/configCases/context-modules/exclusion/some-dir/dont-check-here/file.js diff --git a/test/configCases/context-exclusion/simple/some-dir/dont.js b/test/configCases/context-modules/exclusion/some-dir/dont.js similarity index 100% rename from test/configCases/context-exclusion/simple/some-dir/dont.js rename to test/configCases/context-modules/exclusion/some-dir/dont.js diff --git a/test/configCases/context-exclusion/simple/some-dir/file.js b/test/configCases/context-modules/exclusion/some-dir/file.js similarity index 100% rename from test/configCases/context-exclusion/simple/some-dir/file.js rename to test/configCases/context-modules/exclusion/some-dir/file.js diff --git a/test/configCases/context-exclusion/simple/webpack.config.js b/test/configCases/context-modules/exclusion/webpack.config.js similarity index 100% rename from test/configCases/context-exclusion/simple/webpack.config.js rename to test/configCases/context-modules/exclusion/webpack.config.js diff --git a/test/configCases/context-replacement/System.import/index.js b/test/configCases/context-modules/replacement-System.import/index.js similarity index 100% rename from test/configCases/context-replacement/System.import/index.js rename to test/configCases/context-modules/replacement-System.import/index.js diff --git a/test/configCases/context-replacement/System.import/modules/module-b.js b/test/configCases/context-modules/replacement-System.import/modules/module-b.js similarity index 100% rename from test/configCases/context-replacement/System.import/modules/module-b.js rename to test/configCases/context-modules/replacement-System.import/modules/module-b.js diff --git a/test/configCases/context-replacement/System.import/webpack.config.js b/test/configCases/context-modules/replacement-System.import/webpack.config.js similarity index 91% rename from test/configCases/context-replacement/System.import/webpack.config.js rename to test/configCases/context-modules/replacement-System.import/webpack.config.js index 3b5569bcc74..102b3879caa 100644 --- a/test/configCases/context-replacement/System.import/webpack.config.js +++ b/test/configCases/context-modules/replacement-System.import/webpack.config.js @@ -5,7 +5,7 @@ var webpack = require("../../../../"); module.exports = { plugins: [ new webpack.ContextReplacementPlugin( - /context-replacement/, + /replacement/, path.resolve(__dirname, "modules"), { a: "./module-b" diff --git a/test/configCases/context-replacement/a/index.js b/test/configCases/context-modules/replacement-a/index.js similarity index 100% rename from test/configCases/context-replacement/a/index.js rename to test/configCases/context-modules/replacement-a/index.js diff --git a/test/configCases/context-replacement/a/new-context/node_modules/error.js b/test/configCases/context-modules/replacement-a/new-context/node_modules/error.js similarity index 100% rename from test/configCases/context-replacement/a/new-context/node_modules/error.js rename to test/configCases/context-modules/replacement-a/new-context/node_modules/error.js diff --git a/test/configCases/context-replacement/a/new-context/node_modules/replaced.js b/test/configCases/context-modules/replacement-a/new-context/node_modules/replaced.js similarity index 100% rename from test/configCases/context-replacement/a/new-context/node_modules/replaced.js rename to test/configCases/context-modules/replacement-a/new-context/node_modules/replaced.js diff --git a/test/configCases/context-replacement/a/webpack.config.js b/test/configCases/context-modules/replacement-a/webpack.config.js similarity index 88% rename from test/configCases/context-replacement/a/webpack.config.js rename to test/configCases/context-modules/replacement-a/webpack.config.js index 2b44d0ceb8f..8d86fa0a012 100644 --- a/test/configCases/context-replacement/a/webpack.config.js +++ b/test/configCases/context-modules/replacement-a/webpack.config.js @@ -4,7 +4,7 @@ const webpack = require("../../../../"); module.exports = { plugins: [ new webpack.ContextReplacementPlugin( - /context-replacement.a$/, + /replacement.a$/, "new-context", true, /^replaced$/ diff --git a/test/configCases/context-replacement/b/error.js b/test/configCases/context-modules/replacement-b/error.js similarity index 100% rename from test/configCases/context-replacement/b/error.js rename to test/configCases/context-modules/replacement-b/error.js diff --git a/test/configCases/context-replacement/b/index.js b/test/configCases/context-modules/replacement-b/index.js similarity index 100% rename from test/configCases/context-replacement/b/index.js rename to test/configCases/context-modules/replacement-b/index.js diff --git a/test/configCases/context-replacement/b/only-this.js b/test/configCases/context-modules/replacement-b/only-this.js similarity index 100% rename from test/configCases/context-replacement/b/only-this.js rename to test/configCases/context-modules/replacement-b/only-this.js diff --git a/test/configCases/context-replacement/b/webpack.config.js b/test/configCases/context-modules/replacement-b/webpack.config.js similarity index 55% rename from test/configCases/context-replacement/b/webpack.config.js rename to test/configCases/context-modules/replacement-b/webpack.config.js index 3a5a33b4df7..9fa2c022ff1 100644 --- a/test/configCases/context-replacement/b/webpack.config.js +++ b/test/configCases/context-modules/replacement-b/webpack.config.js @@ -2,7 +2,5 @@ const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { - plugins: [ - new webpack.ContextReplacementPlugin(/context-replacement.b$/, /^\.\/only/) - ] + plugins: [new webpack.ContextReplacementPlugin(/replacement.b$/, /^\.\/only/)] }; diff --git a/test/configCases/context-replacement/c/index.js b/test/configCases/context-modules/replacement-c/index.js similarity index 100% rename from test/configCases/context-replacement/c/index.js rename to test/configCases/context-modules/replacement-c/index.js diff --git a/test/configCases/context-replacement/c/modules/a.js b/test/configCases/context-modules/replacement-c/modules/a.js similarity index 100% rename from test/configCases/context-replacement/c/modules/a.js rename to test/configCases/context-modules/replacement-c/modules/a.js diff --git a/test/configCases/context-replacement/c/modules/module-b.js b/test/configCases/context-modules/replacement-c/modules/module-b.js similarity index 100% rename from test/configCases/context-replacement/c/modules/module-b.js rename to test/configCases/context-modules/replacement-c/modules/module-b.js diff --git a/test/configCases/context-replacement/c/node_modules/d.js b/test/configCases/context-modules/replacement-c/node_modules/d.js similarity index 100% rename from test/configCases/context-replacement/c/node_modules/d.js rename to test/configCases/context-modules/replacement-c/node_modules/d.js diff --git a/test/configCases/context-replacement/c/webpack.config.js b/test/configCases/context-modules/replacement-c/webpack.config.js similarity index 92% rename from test/configCases/context-replacement/c/webpack.config.js rename to test/configCases/context-modules/replacement-c/webpack.config.js index 2602bce536a..6c00f0d0b04 100644 --- a/test/configCases/context-replacement/c/webpack.config.js +++ b/test/configCases/context-modules/replacement-c/webpack.config.js @@ -5,7 +5,7 @@ const webpack = require("../../../../"); module.exports = { plugins: [ new webpack.ContextReplacementPlugin( - /context-replacement.c$/, + /replacement.c$/, path.resolve(__dirname, "modules"), { a: "./a", diff --git a/test/configCases/context-replacement/d/index.js b/test/configCases/context-modules/replacement-d/index.js similarity index 100% rename from test/configCases/context-replacement/d/index.js rename to test/configCases/context-modules/replacement-d/index.js diff --git a/test/configCases/context-replacement/d/modules/a.js b/test/configCases/context-modules/replacement-d/modules/a.js similarity index 100% rename from test/configCases/context-replacement/d/modules/a.js rename to test/configCases/context-modules/replacement-d/modules/a.js diff --git a/test/configCases/context-replacement/d/queryloader.js b/test/configCases/context-modules/replacement-d/queryloader.js similarity index 100% rename from test/configCases/context-replacement/d/queryloader.js rename to test/configCases/context-modules/replacement-d/queryloader.js diff --git a/test/configCases/context-replacement/d/webpack.config.js b/test/configCases/context-modules/replacement-d/webpack.config.js similarity index 92% rename from test/configCases/context-replacement/d/webpack.config.js rename to test/configCases/context-modules/replacement-d/webpack.config.js index fb0177ae566..fdc797fc227 100644 --- a/test/configCases/context-replacement/d/webpack.config.js +++ b/test/configCases/context-modules/replacement-d/webpack.config.js @@ -13,7 +13,7 @@ module.exports = { }, plugins: [ new webpack.ContextReplacementPlugin( - /context-replacement.d$/, + /replacement.d$/, path.resolve(__dirname, "modules?cats=meow"), { a: "./a" diff --git a/test/configCases/context-replacement/e/index.js b/test/configCases/context-modules/replacement-e/index.js similarity index 100% rename from test/configCases/context-replacement/e/index.js rename to test/configCases/context-modules/replacement-e/index.js diff --git a/test/configCases/context-replacement/e/new-context/modules/error.js b/test/configCases/context-modules/replacement-e/new-context/modules/error.js similarity index 100% rename from test/configCases/context-replacement/e/new-context/modules/error.js rename to test/configCases/context-modules/replacement-e/new-context/modules/error.js diff --git a/test/configCases/context-replacement/e/new-context/modules/replaced.js b/test/configCases/context-modules/replacement-e/new-context/modules/replaced.js similarity index 100% rename from test/configCases/context-replacement/e/new-context/modules/replaced.js rename to test/configCases/context-modules/replacement-e/new-context/modules/replaced.js diff --git a/test/configCases/context-replacement/e/webpack.config.js b/test/configCases/context-modules/replacement-e/webpack.config.js similarity index 92% rename from test/configCases/context-replacement/e/webpack.config.js rename to test/configCases/context-modules/replacement-e/webpack.config.js index 302cc942356..291621800d8 100644 --- a/test/configCases/context-replacement/e/webpack.config.js +++ b/test/configCases/context-modules/replacement-e/webpack.config.js @@ -8,7 +8,7 @@ module.exports = { }, plugins: [ new webpack.ContextReplacementPlugin( - /context-replacement.e$/, + /replacement.e$/, "new-context", true, /^replaced$|^\.\/modules\/rep/ diff --git a/test/configCases/context-replacement/f/folder/a.js b/test/configCases/context-modules/replacement-f/folder/a.js similarity index 100% rename from test/configCases/context-replacement/f/folder/a.js rename to test/configCases/context-modules/replacement-f/folder/a.js diff --git a/test/configCases/context-replacement/f/folder/nested/error.js b/test/configCases/context-modules/replacement-f/folder/nested/error.js similarity index 100% rename from test/configCases/context-replacement/f/folder/nested/error.js rename to test/configCases/context-modules/replacement-f/folder/nested/error.js diff --git a/test/configCases/context-replacement/f/index.js b/test/configCases/context-modules/replacement-f/index.js similarity index 100% rename from test/configCases/context-replacement/f/index.js rename to test/configCases/context-modules/replacement-f/index.js diff --git a/test/configCases/context-replacement/f/webpack.config.js b/test/configCases/context-modules/replacement-f/webpack.config.js similarity index 100% rename from test/configCases/context-replacement/f/webpack.config.js rename to test/configCases/context-modules/replacement-f/webpack.config.js diff --git a/test/configCases/css/basic-dynamic-only/test.config.js b/test/configCases/css/basic-dynamic-only/test.config.js index c141c9959a1..5e4602a59e2 100644 --- a/test/configCases/css/basic-dynamic-only/test.config.js +++ b/test/configCases/css/basic-dynamic-only/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["style_css.bundle0.js", "bundle0.js"]; } }; diff --git a/test/configCases/css/basic-web-async/test.config.js b/test/configCases/css/basic-web-async/test.config.js index 2462953a0f2..41c0f0a0c7f 100644 --- a/test/configCases/css/basic-web-async/test.config.js +++ b/test/configCases/css/basic-web-async/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["style2_css.bundle0.js", "bundle0.js"]; }, moduleScope(scope) { diff --git a/test/configCases/css/basic/test.config.js b/test/configCases/css/basic/test.config.js index 2462953a0f2..41c0f0a0c7f 100644 --- a/test/configCases/css/basic/test.config.js +++ b/test/configCases/css/basic/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["style2_css.bundle0.js", "bundle0.js"]; }, moduleScope(scope) { diff --git a/test/configCases/css/conflicting-order/test.config.js b/test/configCases/css/conflicting-order/test.config.js index c53f3453533..457af618640 100644 --- a/test/configCases/css/conflicting-order/test.config.js +++ b/test/configCases/css/conflicting-order/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["css.bundle0.js", "lazy4_js.bundle0.js", "bundle0.js"]; } }; 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 b8e2164d1ba..31bf688dada 100644 --- a/test/configCases/css/css-modules-no-space/webpack.config.js +++ b/test/configCases/css/css-modules-no-space/webpack.config.js @@ -1,5 +1,5 @@ -/** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration} */ -module.exports = (env, { testPath }) => ({ +/** @type {() => import("../../../../").Configuration} */ +module.exports = () => ({ target: "web", mode: "development", experiments: { diff --git a/test/configCases/css/css-modules/test.config.js b/test/configCases/css/css-modules/test.config.js index f8d4d18b3fe..002bd6add7f 100644 --- a/test/configCases/css/css-modules/test.config.js +++ b/test/configCases/css/css-modules/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return i === 0 ? ["./use-style_js.bundle0.js", "./bundle0.js"] : ["./142.bundle1.js", "./bundle1.js"]; diff --git a/test/configCases/css/escape-unescape/test.config.js b/test/configCases/css/escape-unescape/test.config.js index 523bd009639..937cd273f4b 100644 --- a/test/configCases/css/escape-unescape/test.config.js +++ b/test/configCases/css/escape-unescape/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["bundle0.js"]; }, moduleScope(scope) { diff --git a/test/configCases/css/exports-convention/test.config.js b/test/configCases/css/exports-convention/test.config.js index 1fcdcbd62d5..05db19fcc48 100644 --- a/test/configCases/css/exports-convention/test.config.js +++ b/test/configCases/css/exports-convention/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return [ `style_module_css_as-is.bundle${i}.js`, `style_module_css_camel-case.bundle${i}.js`, 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 ee33a038662..ce962330ea5 100644 --- a/test/configCases/css/exports-only-generator-options/test.config.js +++ b/test/configCases/css/exports-only-generator-options/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return [ "pseudo-export_style_module_css.bundle0.js", "pseudo-export_style_module_css_module.bundle0.js", diff --git a/test/configCases/css/external/test.config.js b/test/configCases/css/external/test.config.js index f543ee110ce..35c79b0662e 100644 --- a/test/configCases/css/external/test.config.js +++ b/test/configCases/css/external/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["125.bundle0.js", "bundle0.js"]; } }; diff --git a/test/configCases/css/local-ident-name/test.config.js b/test/configCases/css/local-ident-name/test.config.js index 621df3274ac..207224f512d 100644 --- a/test/configCases/css/local-ident-name/test.config.js +++ b/test/configCases/css/local-ident-name/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return [ `style_module_css.bundle${i}.js`, `style_module_css_hash.bundle${i}.js`, diff --git a/test/configCases/css/pseudo-import/test.config.js b/test/configCases/css/pseudo-import/test.config.js index 1d05d5addff..25a8b9f4dff 100644 --- a/test/configCases/css/pseudo-import/test.config.js +++ b/test/configCases/css/pseudo-import/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["reexport_modules_css.bundle0.js", "bundle0.js"]; }, moduleScope(scope) { diff --git a/test/configCases/css/runtime-issue/test.config.js b/test/configCases/css/runtime-issue/test.config.js index 6362048d5f5..b4dce758416 100644 --- a/test/configCases/css/runtime-issue/test.config.js +++ b/test/configCases/css/runtime-issue/test.config.js @@ -9,7 +9,7 @@ module.exports = { link2.href = "asyncChunk2_js.css"; scope.window.document.head.appendChild(link2); }, - findBundle(i, options) { + findBundle() { return [ "./common-share_js-img_png.js", "./asyncChunk_js.js", 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 d34e2224b44..f3049c55ad1 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return [`index_css.bundle${i}.js`, `bundle${i}.js`]; } }; diff --git a/test/configCases/deprecations/chunk-and-module/webpack.config.js b/test/configCases/deprecations/chunk-and-module/webpack.config.js index c54ee01fe4c..f0519bd26a6 100644 --- a/test/configCases/deprecations/chunk-and-module/webpack.config.js +++ b/test/configCases/deprecations/chunk-and-module/webpack.config.js @@ -30,7 +30,7 @@ module.exports = { expect(chunk.isEmpty()).toBe(false); expect(chunk.modulesSize()).toBeTypeOf("number"); expect(chunk.size()).toBe(chunk.modulesSize() * 10 + 10000); - expect(chunk.getChunkModuleMaps(m => true)).toEqual({ + expect(chunk.getChunkModuleMaps(() => true)).toEqual({ id: {}, hash: {} }); diff --git a/test/configCases/entry/no-chunking/test.config.js b/test/configCases/entry/no-chunking/test.config.js index c8bd29f48c3..81a03d4c348 100644 --- a/test/configCases/entry/no-chunking/test.config.js +++ b/test/configCases/entry/no-chunking/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./a.js", "./b.js", "./c.js", "./runtime.js", "./d.js"]; } }; diff --git a/test/configCases/errors/generator-generate-error/test.config.js b/test/configCases/errors/generator-generate-error/test.config.js index 13e7530a887..ac2a9c3a4c3 100644 --- a/test/configCases/errors/generator-generate-error/test.config.js +++ b/test/configCases/errors/generator-generate-error/test.config.js @@ -4,6 +4,6 @@ module.exports = { findBundle(i, options) { const files = findOutputFiles(options, new RegExp(/\.js$/)); - return files.sort((a, b) => (a.startsWith("main") ? 1 : 0)); + return files.sort((a, _b) => (a.startsWith("main") ? 1 : 0)); } }; 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 07adc696f51..33095374f40 100644 --- a/test/configCases/externals/externals-in-commons-chunk/test.config.js +++ b/test/configCases/externals/externals-in-commons-chunk/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./common.js", "./main.js"]; } }; diff --git a/test/configCases/externals/module-import/test.config.js b/test/configCases/externals/module-import/test.config.js index 93fd44fb16b..8280b4d308c 100644 --- a/test/configCases/externals/module-import/test.config.js +++ b/test/configCases/externals/module-import/test.config.js @@ -1,3 +1,3 @@ module.exports = { - findBundle: (i, options) => ["main.js"] + findBundle: () => ["main.js"] }; diff --git a/test/configCases/externals/module-import/webpack.config.js b/test/configCases/externals/module-import/webpack.config.js index 66c1a65ad6e..eee267f8904 100644 --- a/test/configCases/externals/module-import/webpack.config.js +++ b/test/configCases/externals/module-import/webpack.config.js @@ -21,10 +21,7 @@ module.exports = { }, externalsType: "module-import", externals: [ - function externals( - { context, request, contextInfo, getResolve, dependencyType }, - callback - ) { + function externals({ request }, callback) { if (request === "external2") { return callback(null, "node-commonjs external2"); } diff --git a/test/configCases/filename-template/filename-function/test.config.js b/test/configCases/filename-template/filename-function/test.config.js index 298cbe6d5d4..57cc4f4b284 100644 --- a/test/configCases/filename-template/filename-function/test.config.js +++ b/test/configCases/filename-template/filename-function/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["11.js", "22.js", "aa.js", "bbb.js"]; } }; diff --git a/test/configCases/graph/issue-11770/test.config.js b/test/configCases/graph/issue-11770/test.config.js index d6424e6f060..ee8eace4eef 100644 --- a/test/configCases/graph/issue-11770/test.config.js +++ b/test/configCases/graph/issue-11770/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return [ "shared.js", "a.js", diff --git a/test/configCases/graph/issue-11856/test.config.js b/test/configCases/graph/issue-11856/test.config.js index 4ff816dc9ab..5162706afa5 100644 --- a/test/configCases/graph/issue-11856/test.config.js +++ b/test/configCases/graph/issue-11856/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["shared.js", "a.js", "b.js"]; } }; diff --git a/test/configCases/graph/issue-11863/test.config.js b/test/configCases/graph/issue-11863/test.config.js index 3a3565765c5..5f56a3e6c5e 100644 --- a/test/configCases/graph/issue-11863/test.config.js +++ b/test/configCases/graph/issue-11863/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return [ "shared.js", "a.js", diff --git a/test/configCases/issues/issue-3596/webpack.config.js b/test/configCases/issues/issue-3596/webpack.config.js index 614835822ad..cd23171cf55 100644 --- a/test/configCases/issues/issue-3596/webpack.config.js +++ b/test/configCases/issues/issue-3596/webpack.config.js @@ -10,7 +10,7 @@ module.exports = { plugins: [ function apply() { this.hooks.compilation.tap("TestPlugin", compilation => { - compilation.hooks.processAssets.tap("TestPlugin", assets => { + compilation.hooks.processAssets.tap("TestPlugin", () => { delete compilation.assets["b.js"]; }); }); diff --git a/test/configCases/library/issue-18951/test.config.js b/test/configCases/library/issue-18951/test.config.js index ab693054953..bc434b87b0c 100644 --- a/test/configCases/library/issue-18951/test.config.js +++ b/test/configCases/library/issue-18951/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.mjs"]; } }; 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 b0ea3b44c52..53042d86fab 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return [ "module-avoidEntryIife-false.mjs", "module-avoidEntryIife-true.mjs", diff --git a/test/configCases/module/iife-innter-strict/test.config.js b/test/configCases/module/iife-innter-strict/test.config.js index 32f4be1d473..f48f8b79def 100644 --- a/test/configCases/module/iife-innter-strict/test.config.js +++ b/test/configCases/module/iife-innter-strict/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["test.js"]; } }; 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 5e7f742d6f5..bb3de309b02 100644 --- a/test/configCases/module/iife-multiple-entry-modules/test.config.js +++ b/test/configCases/module/iife-multiple-entry-modules/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["bundle0.mjs", "test.js"]; } }; diff --git a/test/configCases/module/issue-16040/test.config.js b/test/configCases/module/issue-16040/test.config.js index 15fd839d728..194e0522015 100644 --- a/test/configCases/module/issue-16040/test.config.js +++ b/test/configCases/module/issue-16040/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.mjs", "vendor.mjs", "runtime.mjs"]; } }; 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 1dd2dfc6303..6dfa448614e 100644 --- a/test/configCases/module/split-chunks-without-externals/test.config.js +++ b/test/configCases/module/split-chunks-without-externals/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.mjs", "testModule1.mjs", "testModule2.mjs"]; } }; diff --git a/test/configCases/output/charset/test.config.js b/test/configCases/output/charset/test.config.js index ea656968b0e..d338a4c0200 100644 --- a/test/configCases/output/charset/test.config.js +++ b/test/configCases/output/charset/test.config.js @@ -1,5 +1,5 @@ module.exports = { - moduleScope(scope, options) { + moduleScope(scope) { const link = scope.window.document.createElement("link"); link.rel = "stylesheet"; link.href = "chunk1.css"; diff --git a/test/configCases/plugins/banner-plugin-hashing/test.config.js b/test/configCases/plugins/banner-plugin-hashing/test.config.js index 5d626611bc5..72f2bf28c22 100644 --- a/test/configCases/plugins/banner-plugin-hashing/test.config.js +++ b/test/configCases/plugins/banner-plugin-hashing/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return "./dist/banner.js"; } }; 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 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/plugins/limit-chunk-count-plugin/test.config.js +++ b/test/configCases/plugins/limit-chunk-count-plugin/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; 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 393afd969c7..41eeb395b80 100644 --- a/test/configCases/plugins/mini-css-extract-plugin/test.config.js +++ b/test/configCases/plugins/mini-css-extract-plugin/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return [`${i}_a.js`, `${i}_b.js`, `${i}_c.js`]; } }; 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 8abc9602236..316da3e8874 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 @@ -20,7 +20,7 @@ module.exports = { plugins: [ new webpack.SourceMapDevToolPlugin({ filename: "sourcemaps/[file].map", - append: data => "\n//# sourceMappingURL=http://localhost:50505/[file].map" + append: () => "\n//# sourceMappingURL=http://localhost:50505/[file].map" }) ] }; diff --git a/test/configCases/plugins/virtual-url-plugin/webpack.config.js b/test/configCases/plugins/virtual-url-plugin/webpack.config.js index c14c93fee40..a5081e27532 100644 --- a/test/configCases/plugins/virtual-url-plugin/webpack.config.js +++ b/test/configCases/plugins/virtual-url-plugin/webpack.config.js @@ -10,7 +10,7 @@ const watchDir = path.join(__dirname, "./routes"); const config = { plugins: [ new VirtualUrlPlugin({ - routes(loaderContext) { + routes() { const files = fs.readdirSync(watchDir); return ` export const routes = { diff --git a/test/configCases/resolving/prefer-absolute/webpack.config.js b/test/configCases/resolving/prefer-absolute/webpack.config.js index 9d5b634248a..21adc6f0fdc 100644 --- a/test/configCases/resolving/prefer-absolute/webpack.config.js +++ b/test/configCases/resolving/prefer-absolute/webpack.config.js @@ -18,7 +18,7 @@ module.exports = { * @param {Resolver & { hooks: { file: SyncBailHook<[ResolveRequest, ResolveContext], void> } }} resolver resolver */ apply(resolver) { - resolver.hooks.file.tap("Test", (request, resolverContext) => { + 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 36a2fd09e35..9aecc535c92 100644 --- a/test/configCases/resolving/prefer-root/webpack.config.js +++ b/test/configCases/resolving/prefer-root/webpack.config.js @@ -16,7 +16,7 @@ module.exports = { * @param {Resolver & { hooks: { file: SyncBailHook<[ResolveRequest, ResolveContext], void> } }} resolver resolver */ apply(resolver) { - resolver.hooks.file.tap("Test", (request, resolverContext) => { + 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/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 a773bb4ebed..be2150cc603 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["entry-a-bundle.js", "entry-b-bundle.js"]; } }; 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 a773bb4ebed..be2150cc603 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["entry-a-bundle.js", "entry-b-bundle.js"]; } }; 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 a773bb4ebed..be2150cc603 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["entry-a-bundle.js", "entry-b-bundle.js"]; } }; 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 f8bc4b8473c..ac3afebfca3 100644 --- a/test/configCases/split-chunks-common/correct-order/test.config.js +++ b/test/configCases/split-chunks-common/correct-order/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./vendor.js", "./main.js"]; } }; 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 74e4d94cce7..0e721ca1433 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./main.js"]; } }; 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 c5249179a7c..64952711508 100644 --- a/test/configCases/split-chunks-common/hot-multi/test.config.js +++ b/test/configCases/split-chunks-common/hot-multi/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./vendor.js", "./first.js", "./second.js"]; } }; diff --git a/test/configCases/split-chunks-common/hot/test.config.js b/test/configCases/split-chunks-common/hot/test.config.js index f8bc4b8473c..ac3afebfca3 100644 --- a/test/configCases/split-chunks-common/hot/test.config.js +++ b/test/configCases/split-chunks-common/hot/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./vendor.js", "./main.js"]; } }; 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 fc22d3b5770..eed5873a9bf 100644 --- a/test/configCases/split-chunks-common/inverted-order/test.config.js +++ b/test/configCases/split-chunks-common/inverted-order/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./main.js", "./vendor.js"]; } }; 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 8e220227b7b..69f19523ba2 100644 --- a/test/configCases/split-chunks-common/issue-12128/test.config.js +++ b/test/configCases/split-chunks-common/issue-12128/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./common.js", "./main.js", "./main2.js"]; } }; diff --git a/test/configCases/split-chunks-common/library/test.config.js b/test/configCases/split-chunks-common/library/test.config.js index 8ede468fd67..06e8b92c02a 100644 --- a/test/configCases/split-chunks-common/library/test.config.js +++ b/test/configCases/split-chunks-common/library/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./vendor.js", "./main.js"]; }, modules: { 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 1aceaa7c1ba..40bcfbb6380 100644 --- a/test/configCases/split-chunks-common/move-entry/test.config.js +++ b/test/configCases/split-chunks-common/move-entry/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./commons.js", "./main.js"]; } }; 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 c29a7929db6..20f79312e29 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./main.js", "./misc.js"]; } }; diff --git a/test/configCases/split-chunks-common/simple/test.config.js b/test/configCases/split-chunks-common/simple/test.config.js index f8bc4b8473c..ac3afebfca3 100644 --- a/test/configCases/split-chunks-common/simple/test.config.js +++ b/test/configCases/split-chunks-common/simple/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["./vendor.js", "./main.js"]; } }; diff --git a/test/configCases/split-chunks/asnyc-entries/test.config.js b/test/configCases/split-chunks/asnyc-entries/test.config.js index 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/split-chunks/asnyc-entries/test.config.js +++ b/test/configCases/split-chunks/asnyc-entries/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; 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 0c4cdb95323..78a59a58887 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; 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 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/split-chunks/chunk-filename-delimiter/test.config.js +++ b/test/configCases/split-chunks/chunk-filename-delimiter/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; 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 af4691d7848..4ca1669700f 100644 --- a/test/configCases/split-chunks/custom-filename-function/test.config.js +++ b/test/configCases/split-chunks/custom-filename-function/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["a.js"]; } }; 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 af4691d7848..4ca1669700f 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["a.js"]; } }; diff --git a/test/configCases/split-chunks/custom-filename/test.config.js b/test/configCases/split-chunks/custom-filename/test.config.js index af4691d7848..4ca1669700f 100644 --- a/test/configCases/split-chunks/custom-filename/test.config.js +++ b/test/configCases/split-chunks/custom-filename/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["a.js"]; } }; 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 024c0caeda3..fa1cdb2fcb2 100644 --- a/test/configCases/split-chunks/entry-point-error/test.config.js +++ b/test/configCases/split-chunks/entry-point-error/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["vendors.js", "main.js"]; } }; diff --git a/test/configCases/split-chunks/issue-11513/test.config.js b/test/configCases/split-chunks/issue-11513/test.config.js index 24317dca740..aab02d48ec4 100644 --- a/test/configCases/split-chunks/issue-11513/test.config.js +++ b/test/configCases/split-chunks/issue-11513/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["test.js", "main.js"]; } }; diff --git a/test/configCases/split-chunks/issue-17332/test.config.js b/test/configCases/split-chunks/issue-17332/test.config.js index 33308d294a8..1a6234f5e0f 100644 --- a/test/configCases/split-chunks/issue-17332/test.config.js +++ b/test/configCases/split-chunks/issue-17332/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["split-foo.js", "foo.js", "main.js"]; } }; diff --git a/test/configCases/split-chunks/issue-8908/test.config.js b/test/configCases/split-chunks/issue-8908/test.config.js index 51e90d128bf..7948c3fe722 100644 --- a/test/configCases/split-chunks/issue-8908/test.config.js +++ b/test/configCases/split-chunks/issue-8908/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["runtime.js", "vendor-a.js", "a.js"]; } }; diff --git a/test/configCases/split-chunks/issue-9491/test.config.js b/test/configCases/split-chunks/issue-9491/test.config.js index 69c3d55b612..823968a3f38 100644 --- a/test/configCases/split-chunks/issue-9491/test.config.js +++ b/test/configCases/split-chunks/issue-9491/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["runtime.js", "constructor.js"]; } }; 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 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/split-chunks/max-size-casing/test.config.js +++ b/test/configCases/split-chunks/max-size-casing/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; 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 23e1b263675..5e6f0eb36c3 100644 --- a/test/configCases/split-chunks/module-type-filter/test.config.js +++ b/test/configCases/split-chunks/module-type-filter/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["json.js", "main.js"]; } }; 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 60ac768dc48..97e8d085f4d 100644 --- a/test/configCases/split-chunks/move-to-entrypoint/test.config.js +++ b/test/configCases/split-chunks/move-to-entrypoint/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["runtime.js", "a.js", "b.js"]; } }; diff --git a/test/configCases/split-chunks/no-name/test.config.js b/test/configCases/split-chunks/no-name/test.config.js index b29ba477372..859a3d0a5fe 100644 --- a/test/configCases/split-chunks/no-name/test.config.js +++ b/test/configCases/split-chunks/no-name/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["common-a_js.js", "main.js"]; } }; diff --git a/test/configCases/split-chunks/no-options/test.config.js b/test/configCases/split-chunks/no-options/test.config.js index 39c2883c718..5875983aa91 100644 --- a/test/configCases/split-chunks/no-options/test.config.js +++ b/test/configCases/split-chunks/no-options/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["vendor.js", "main.js"]; } }; 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 ad7cd7e18d1..dc9c0aae56c 100644 --- a/test/configCases/split-chunks/reuse-chunk-name/test.config.js +++ b/test/configCases/split-chunks/reuse-chunk-name/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["common.js", "main.js"]; } }; 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 fafd4ba626a..1b0256ddd2a 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["b.js", "deep/path/a.js", "somewhere/c.js"]; } }; 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 fafd4ba626a..1b0256ddd2a 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["b.js", "deep/path/a.js", "somewhere/c.js"]; } }; 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 fafd4ba626a..1b0256ddd2a 100644 --- a/test/configCases/split-chunks/runtime-chunk-node/test.config.js +++ b/test/configCases/split-chunks/runtime-chunk-node/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["b.js", "deep/path/a.js", "somewhere/c.js"]; } }; diff --git a/test/configCases/split-chunks/runtime-chunk/test.config.js b/test/configCases/split-chunks/runtime-chunk/test.config.js index b00df088b2b..cdc9dd1d401 100644 --- a/test/configCases/split-chunks/runtime-chunk/test.config.js +++ b/test/configCases/split-chunks/runtime-chunk/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["runtime.js", "a.js"]; } }; 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 d0803add753..f80a9c6f527 100644 --- a/test/configCases/split-chunks/vendor-only-entrypoint/test.config.js +++ b/test/configCases/split-chunks/vendor-only-entrypoint/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["runtime~vendor.js", "vendor.js"]; } }; 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 cb1a34c3347..643395505ab 100644 --- a/test/configCases/target/chunk-loading-per-entry/test.config.js +++ b/test/configCases/target/chunk-loading-per-entry/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { return i === 0 ? "./web-0.js" : "./webworker-1.js"; } }; diff --git a/test/configCases/trusted-types/web-worker/test.config.js b/test/configCases/trusted-types/web-worker/test.config.js index 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/trusted-types/web-worker/test.config.js +++ b/test/configCases/trusted-types/web-worker/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; diff --git a/test/configCases/umd/issue-15545/test.config.js b/test/configCases/umd/issue-15545/test.config.js index 2b00586a46d..67874807764 100644 --- a/test/configCases/umd/issue-15545/test.config.js +++ b/test/configCases/umd/issue-15545/test.config.js @@ -1,7 +1,7 @@ const CONTEXT = {}; module.exports = { - nonEsmThis(module) { + nonEsmThis() { return CONTEXT; }, findBundle() { diff --git a/test/configCases/wasm/fetch/test.config.js b/test/configCases/wasm/fetch/test.config.js index 3e6e0925a33..68d0c25fcf0 100644 --- a/test/configCases/wasm/fetch/test.config.js +++ b/test/configCases/wasm/fetch/test.config.js @@ -3,7 +3,7 @@ const path = require("path"); const url = require("url"); module.exports = { - findBundle(i, options) { + findBundle(i) { switch (i) { case 0: return ["bundle0.mjs"]; 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 7de30aabdd2..09896fb508d 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,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return [ "runtime.js", "main.js", 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 096ce4cd918..229a4f1a0da 100644 --- a/test/configCases/web/non-js-chunks-entrypoint/test.config.js +++ b/test/configCases/web/non-js-chunks-entrypoint/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return [ "main.js", "vendors-node_modules_other-package_index_js-node_modules_package_index_js.js" diff --git a/test/configCases/web/preexecuted-chunk/test.config.js b/test/configCases/web/preexecuted-chunk/test.config.js index 6ad8df89ee3..7aafb486102 100644 --- a/test/configCases/web/preexecuted-chunk/test.config.js +++ b/test/configCases/web/preexecuted-chunk/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["the-chunk.js", "bundle0.js"]; } }; diff --git a/test/configCases/web/prefetch-split-chunks/test.config.js b/test/configCases/web/prefetch-split-chunks/test.config.js index b9ed0f575c1..086baa60bb9 100644 --- a/test/configCases/web/prefetch-split-chunks/test.config.js +++ b/test/configCases/web/prefetch-split-chunks/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js", "runtime~main.js", "separate-public-path_js.js"]; } }; diff --git a/test/configCases/web/unique-jsonp/test.config.js b/test/configCases/web/unique-jsonp/test.config.js index 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/web/unique-jsonp/test.config.js +++ b/test/configCases/web/unique-jsonp/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; diff --git a/test/configCases/worker/custom-worker/test.config.js b/test/configCases/worker/custom-worker/test.config.js index 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/worker/custom-worker/test.config.js +++ b/test/configCases/worker/custom-worker/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; diff --git a/test/configCases/worker/node-worker-esm/test.config.js b/test/configCases/worker/node-worker-esm/test.config.js index aac7fff6c82..b048fb04eba 100644 --- a/test/configCases/worker/node-worker-esm/test.config.js +++ b/test/configCases/worker/node-worker-esm/test.config.js @@ -1,6 +1,5 @@ const fs = require("fs"); const path = require("path"); -const { URL } = require("url"); module.exports = { findBundle() { diff --git a/test/configCases/worker/node-worker-hmr/test.config.js b/test/configCases/worker/node-worker-hmr/test.config.js index 28532b86979..d0b177310f8 100644 --- a/test/configCases/worker/node-worker-hmr/test.config.js +++ b/test/configCases/worker/node-worker-hmr/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["a.js", "b.js", "c.js", "d.js"]; } }; diff --git a/test/configCases/worker/node-worker-named/test.config.js b/test/configCases/worker/node-worker-named/test.config.js index 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/worker/node-worker-named/test.config.js +++ b/test/configCases/worker/node-worker-named/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; diff --git a/test/configCases/worker/node-worker/test.config.js b/test/configCases/worker/node-worker/test.config.js index 28532b86979..d0b177310f8 100644 --- a/test/configCases/worker/node-worker/test.config.js +++ b/test/configCases/worker/node-worker/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["a.js", "b.js", "c.js", "d.js"]; } }; diff --git a/test/configCases/worker/self-import/test.config.js b/test/configCases/worker/self-import/test.config.js index 86bc794f174..792e0848ff5 100644 --- a/test/configCases/worker/self-import/test.config.js +++ b/test/configCases/worker/self-import/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle(i) { switch (i) { case 0: return [`bundle${i}.js`]; diff --git a/test/configCases/worker/universal/test.config.js b/test/configCases/worker/universal/test.config.js index 4b0564c5df1..61de36bb639 100644 --- a/test/configCases/worker/universal/test.config.js +++ b/test/configCases/worker/universal/test.config.js @@ -4,7 +4,7 @@ module.exports = { delete scope.Worker; } }, - findBundle(i, options) { + findBundle() { return ["web-main.mjs"]; } }; diff --git a/test/configCases/worker/web-worker/test.config.js b/test/configCases/worker/web-worker/test.config.js index 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/worker/web-worker/test.config.js +++ b/test/configCases/worker/web-worker/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; diff --git a/test/configCases/worker/worker-contenthash/test.config.js b/test/configCases/worker/worker-contenthash/test.config.js index 0c4cdb95323..78a59a58887 100644 --- a/test/configCases/worker/worker-contenthash/test.config.js +++ b/test/configCases/worker/worker-contenthash/test.config.js @@ -1,5 +1,5 @@ module.exports = { - findBundle(i, options) { + findBundle() { return ["main.js"]; } }; diff --git a/test/helpers/FakeDocument.js b/test/helpers/FakeDocument.js index c0e869d1c12..a50bd6187a4 100644 --- a/test/helpers/FakeDocument.js +++ b/test/helpers/FakeDocument.js @@ -91,7 +91,7 @@ class FakeElement { } } - insertBefore(node, before) { + insertBefore(node) { this._attach(node); this._load(node); } diff --git a/test/helpers/deprecationTracking.js b/test/helpers/deprecationTracking.js index 17c1c68d6ad..24bce22da88 100644 --- a/test/helpers/deprecationTracking.js +++ b/test/helpers/deprecationTracking.js @@ -40,10 +40,9 @@ util.deprecate = (fn, message, _code) => { }; /** - * @param {EXPECTED_ANY} handler handler * @returns {() => EXPECTED_ANY} result */ -module.exports.start = handler => { +module.exports.start = () => { interception = new Map(); return () => { @@ -55,6 +54,6 @@ module.exports.start = handler => { if (a > b) return 1; return 0; }) - .map(([key, data]) => data); + .map(([_key, data]) => data); }; }; diff --git a/test/hotCases/css/single-css-entry/webpack.config.js b/test/hotCases/css/single-css-entry/webpack.config.js index 26f2eae1e82..62cd01bf74c 100644 --- a/test/hotCases/css/single-css-entry/webpack.config.js +++ b/test/hotCases/css/single-css-entry/webpack.config.js @@ -14,7 +14,7 @@ module.exports = { compiler.hooks.compilation.tap("Test", compilation => { compilation.hooks.additionalTreeRuntimeRequirements.tap( "Test", - (module, set, context) => { + (module, set, _context) => { // To prevent the runtime error `ReferenceError: __webpack_exports__ is not defined`, // which occurs because the default `output.library` setting is `commonjs2`, // resulting in adding `module.exports = __webpack_exports__;`. diff --git a/test/hotCases/worker/move-between-runtime/test.filter.js b/test/hotCases/worker/move-between-runtime/test.filter.js index 23936757a41..d456e8870d2 100644 --- a/test/hotCases/worker/move-between-runtime/test.filter.js +++ b/test/hotCases/worker/move-between-runtime/test.filter.js @@ -1,3 +1,3 @@ const supportsWorker = require("../../../helpers/supportsWorker"); -module.exports = config => supportsWorker(); +module.exports = () => supportsWorker(); diff --git a/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js b/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js index 790b968d827..a6974524b0b 100644 --- a/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js +++ b/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js @@ -21,7 +21,7 @@ module.exports = (env, { srcPath }) => ({ name: "webpack.config.js", stage: -1000 }, - (identifier, etag) => { + 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 510ec2e86d4..231f2371a9b 100644 --- a/test/watchCases/cache/unsafe-cache-managed-paths/webpack.config.js +++ b/test/watchCases/cache/unsafe-cache-managed-paths/webpack.config.js @@ -1,5 +1,5 @@ -/** @type {(env: Env, options: TestOptions) => import("../../../../").Configuration} */ -module.exports = (env, { srcPath }) => ({ +/** @type {() => import("../../../../").Configuration} */ +module.exports = () => ({ mode: "development", cache: { type: "memory" diff --git a/tooling/print-cache-file.js b/tooling/print-cache-file.js index df9b4386660..e0c6bbd38ce 100644 --- a/tooling/print-cache-file.js +++ b/tooling/print-cache-file.js @@ -152,7 +152,7 @@ const printData = async (data, indent) => { } } const refCounters = [...referencedValuesCounters]; - refCounters.sort(([a, A], [b, B]) => B - A); + refCounters.sort(([_a, A], [_b, B]) => B - A); printLine("SUMMARY: top references:"); for (const [ref, count] of refCounters.slice(10)) { const value = referencedValues.get(ref); diff --git a/tsconfig.types.test.json b/tsconfig.types.test.json index 52ab5c90461..b6f832bd086 100644 --- a/tsconfig.types.test.json +++ b/tsconfig.types.test.json @@ -12,5 +12,6 @@ "test/configCases/**/*loader*.js", "test/hotCases/**/*loader*.js", "declarations.test.d.ts" - ] + ], + "exclude": ["test/js/**/*"] } diff --git a/yarn.lock b/yarn.lock index 899d6902e5c..92e3ee242a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1568,7 +1568,7 @@ semver "^7.6.0" ts-api-utils "^2.1.0" -"@typescript-eslint/utils@^8.0.0", "@typescript-eslint/utils@^8.26.1": +"@typescript-eslint/utils@^8.0.0": version "8.34.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.34.1.tgz#f98c9b0c5cae407e34f5131cac0f3a74347a398e" integrity sha512-mqOwUdZ3KjtGk7xJJnLbHxTuWVn3GO2WZZuM+Slhkun4+qthLdXx32C8xIXbO1kfCECb3jIs3eoxK3eryk7aoQ== @@ -3380,13 +3380,12 @@ eslint-plugin-jsdoc@^51.2.3: semver "^7.7.2" spdx-expression-parse "^4.0.0" -eslint-plugin-n@^17.20.0: - version "17.20.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-17.20.0.tgz#000a7a39675d737824d704ae77b626c257b318ef" - integrity sha512-IRSoatgB/NQJZG5EeTbv/iAx1byOGdbbyhQrNvWdCfTnmPxUT0ao9/eGOeG7ljD8wJBsxwE8f6tES5Db0FRKEw== +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== dependencies: "@eslint-community/eslint-utils" "^4.5.0" - "@typescript-eslint/utils" "^8.26.1" enhanced-resolve "^5.17.1" eslint-plugin-es-x "^7.8.0" get-tsconfig "^4.8.1" From 6801022b7bb653b21a8786f060b8110e93613c1c Mon Sep 17 00:00:00 2001 From: hai-x <98948357+hai-x@users.noreply.github.com> Date: Wed, 9 Jul 2025 01:23:18 +0800 Subject: [PATCH 54/56] fix: lose closing brace when exports are unprovided (#19669) --- lib/library/AssignLibraryPlugin.js | 9 +++++++-- test/configCases/library/issue-19664/index.js | 10 ++++++++++ test/configCases/library/issue-19664/webpack.config.js | 8 ++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 test/configCases/library/issue-19664/index.js create mode 100644 test/configCases/library/issue-19664/webpack.config.js diff --git a/lib/library/AssignLibraryPlugin.js b/lib/library/AssignLibraryPlugin.js index f8c8856f620..80f75fa28f4 100644 --- a/lib/library/AssignLibraryPlugin.js +++ b/lib/library/AssignLibraryPlugin.js @@ -344,9 +344,14 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin { ); } result.add( - ` ${hasProvided ? " " : ""}${webpackExportTarget}[__webpack_i__] = ${exports}[__webpack_i__];\n` + ` ${ + hasProvided ? " " : "" + }${webpackExportTarget}[__webpack_i__] = ${exports}[__webpack_i__];\n` ); - result.add(hasProvided ? " }\n}\n" : "\n"); + if (hasProvided) { + result.add(" }\n"); + } + result.add("}\n"); result.add( `Object.defineProperty(${exportTarget}, "__esModule", { value: true });\n` ); diff --git a/test/configCases/library/issue-19664/index.js b/test/configCases/library/issue-19664/index.js new file mode 100644 index 00000000000..b80e597cb32 --- /dev/null +++ b/test/configCases/library/issue-19664/index.js @@ -0,0 +1,10 @@ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.main = main; +function main() {} + +// commonjs bailout +if(this){} + +it("Should work when exports are unprovided", function() { + expect(true).toBe(true); +}); diff --git a/test/configCases/library/issue-19664/webpack.config.js b/test/configCases/library/issue-19664/webpack.config.js new file mode 100644 index 00000000000..9150aa1751b --- /dev/null +++ b/test/configCases/library/issue-19664/webpack.config.js @@ -0,0 +1,8 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + library: { + type: "commonjs-static" + } + } +}; From 0ed4a64d334cc5832d0bc852209e753312444b4a Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Wed, 9 Jul 2025 13:59:21 +0300 Subject: [PATCH 55/56] fix: types --- declarations.d.ts | 18 ++-- lib/DllEntryPlugin.js | 4 +- lib/DllPlugin.js | 5 +- lib/ExternalModule.js | 8 +- lib/Generator.js | 12 ++- lib/JavascriptMetaInfoPlugin.js | 1 - lib/LoaderOptionsPlugin.js | 8 +- lib/Module.js | 8 +- lib/MultiCompiler.js | 6 +- lib/NormalModule.js | 37 ++++----- lib/NormalModuleFactory.js | 2 +- lib/ProgressPlugin.js | 7 +- lib/asset/AssetGenerator.js | 8 +- lib/asset/AssetModulesPlugin.js | 3 +- lib/cache/IdleFileCachePlugin.js | 9 +- lib/cli.js | 19 +++-- lib/css/CssModulesPlugin.js | 36 +++++--- lib/index.js | 6 +- lib/util/create-schema-validation.js | 3 +- test/Validation.test.js | 56 +++++++++++++ .../ConfigCacheTestCases.longtest.js.snap | 2 +- .../loader-source-map-string/index.js | 5 ++ .../loader-source-map-string/loader.js | 38 +++++++++ .../loader-source-map-string/module.js | 1 + .../webpack.config.js | 18 ++++ .../source-map/loader-source-map/index.js | 5 ++ .../source-map/loader-source-map/loader.js | 40 +++++++++ .../source-map/loader-source-map/module.js | 1 + .../loader-source-map/webpack.config.js | 18 ++++ types.d.ts | 82 ++++++++++++++++--- 30 files changed, 379 insertions(+), 87 deletions(-) create mode 100644 test/configCases/source-map/loader-source-map-string/index.js create mode 100644 test/configCases/source-map/loader-source-map-string/loader.js create mode 100644 test/configCases/source-map/loader-source-map-string/module.js create mode 100644 test/configCases/source-map/loader-source-map-string/webpack.config.js create mode 100644 test/configCases/source-map/loader-source-map/index.js create mode 100644 test/configCases/source-map/loader-source-map/loader.js create mode 100644 test/configCases/source-map/loader-source-map/module.js create mode 100644 test/configCases/source-map/loader-source-map/webpack.config.js diff --git a/declarations.d.ts b/declarations.d.ts index f184b2a56b2..901615f8118 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -147,14 +147,17 @@ declare module "neo-async" { // There are no typings for @webassemblyjs/ast declare module "@webassemblyjs/ast" { - export type AST = TODO; + export class AST extends Node { + type: "Program"; + body: [Module]; + } export interface Visitor { ModuleImport?: (p: NodePath) => void; ModuleExport?: (p: NodePath) => void; Start?: (p: NodePath) => void; Global?: (p: NodePath) => void; } - export function traverse(ast: AST, visitor: Visitor): void; + export function traverse(node: Node, visitor: Visitor): void; export class NodePath { node: T; remove(): void; @@ -169,9 +172,9 @@ declare module "@webassemblyjs/ast" { index: Identifier; } export class Module extends Node { - id: TODO; + id: string; fields: Node[]; - metadata: TODO; + metadata?: Record; } export class ModuleImportDescription { type: string; @@ -189,7 +192,7 @@ declare module "@webassemblyjs/ast" { name: string; descr: ModuleExportDescr; } - type Index = Identifier | NumberLiteral; + type Index = NumberLiteral; export class ModuleExportDescr extends Node { type: string; exportType: string; @@ -273,7 +276,10 @@ declare module "@webassemblyjs/ast" { args: string[]; result: string[]; } - export function moduleContextFromModuleAST(module: Module): TODO; + export function moduleContextFromModuleAST(module: Module): { + getFunction(i: number): FuncSignature; + getStart(): Index; + }; // Node matcher export function isGlobalType(n: Node): boolean; diff --git a/lib/DllEntryPlugin.js b/lib/DllEntryPlugin.js index cd00373f230..3bbafb0c645 100644 --- a/lib/DllEntryPlugin.js +++ b/lib/DllEntryPlugin.js @@ -10,8 +10,10 @@ const DllEntryDependency = require("./dependencies/DllEntryDependency"); const EntryDependency = require("./dependencies/EntryDependency"); /** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ + /** @typedef {string[]} Entries */ -/** @typedef {{ name: string, filename: TODO }} Options */ +/** @typedef {EntryOptions & { name: string }} Options */ const PLUGIN_NAME = "DllEntryPlugin"; diff --git a/lib/DllPlugin.js b/lib/DllPlugin.js index d23c2acba57..1dc009f24bc 100644 --- a/lib/DllPlugin.js +++ b/lib/DllPlugin.js @@ -48,10 +48,11 @@ class DllPlugin { if (typeof entry !== "function") { for (const name of Object.keys(entry)) { /** @type {Options} */ - const options = { name, filename: entry.filename }; + const options = { name }; new DllEntryPlugin( context, - /** @type {Entries} */ (entry[name].import), + /** @type {Entries} */ + (entry[name].import), options ).apply(compiler); } diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index 64f60eb7363..66edc91de99 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -588,7 +588,7 @@ class ExternalModule extends Module { this.buildInfo = { strict: true, topLevelDeclarations: new Set(), - module: compilation.outputOptions.module + javascriptModule: compilation.outputOptions.module }; const { request, externalType } = this._getRequestAndExternalType(); this.buildMeta.exportsType = "dynamic"; @@ -605,7 +605,7 @@ class ExternalModule extends Module { } break; case "module": - if (this.buildInfo.module) { + if (this.buildInfo.javascriptModule) { if (!Array.isArray(request) || request.length === 1) { this.buildMeta.exportsType = "namespace"; canMangle = true; @@ -760,7 +760,7 @@ class ExternalModule extends Module { case "commonjs-static": return getSourceForCommonJsExternal(request); case "node-commonjs": - return /** @type {BuildInfo} */ (this.buildInfo).module + return /** @type {BuildInfo} */ (this.buildInfo).javascriptModule ? getSourceForCommonJsExternalInNodeModule( request, /** @type {string} */ @@ -792,7 +792,7 @@ class ExternalModule extends Module { case "script": return getSourceForScriptExternal(request, runtimeTemplate); case "module": { - if (!(/** @type {BuildInfo} */ (this.buildInfo).module)) { + if (!(/** @type {BuildInfo} */ (this.buildInfo).javascriptModule)) { if (!runtimeTemplate.supportsDynamicImport()) { throw new Error( `The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script${ diff --git a/lib/Generator.js b/lib/Generator.js index 36652c96fd1..10d7cb08468 100644 --- a/lib/Generator.js +++ b/lib/Generator.js @@ -9,6 +9,7 @@ /** @typedef {import("./ChunkGraph")} ChunkGraph */ /** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */ /** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Compilation").AssetInfo} AssetInfo */ /** @typedef {import("./ConcatenationScope")} ConcatenationScope */ /** @typedef {import("./DependencyTemplate")} DependencyTemplate */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ @@ -21,6 +22,15 @@ /** @typedef {import("./util/Hash")} Hash */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ +/** + * @template T + * @typedef {import("./InitFragment")} InitFragment + */ + +/** @typedef {Map<"url", { [key: string]: string }> & Map<"fullContentHash", string> & Map<"contentHash", string> & Map<"filename", string> & Map<"assetInfo", AssetInfo> & Map<"chunkInitFragments", InitFragment[]>} KnownGenerateContextData */ + +/** @typedef {KnownGenerateContextData & Record} GenerateContextData */ + /** * @typedef {object} GenerateContext * @property {DependencyTemplates} dependencyTemplates mapping from dependencies to templates @@ -32,7 +42,7 @@ * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules * @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) * @property {string} type which kind of code should be generated - * @property {() => Map=} getData get access to the code generation data + * @property {() => GenerateContextData=} getData get access to the code generation data */ /** diff --git a/lib/JavascriptMetaInfoPlugin.js b/lib/JavascriptMetaInfoPlugin.js index b8f77bea369..35fcb68c14a 100644 --- a/lib/JavascriptMetaInfoPlugin.js +++ b/lib/JavascriptMetaInfoPlugin.js @@ -38,7 +38,6 @@ class JavascriptMetaInfoPlugin { /** @type {BuildInfo} */ (parser.state.module.buildInfo); buildInfo.moduleConcatenationBailout = "eval()"; - buildInfo.usingEval = true; const currentSymbol = InnerGraph.getTopLevelSymbol(parser.state); if (currentSymbol) { InnerGraph.addUsage(parser.state, null, currentSymbol); diff --git a/lib/LoaderOptionsPlugin.js b/lib/LoaderOptionsPlugin.js index c493bc27704..2d5ae88479a 100644 --- a/lib/LoaderOptionsPlugin.js +++ b/lib/LoaderOptionsPlugin.js @@ -39,13 +39,15 @@ class LoaderOptionsPlugin { // If no options are set then generate empty options object if (typeof options !== "object") options = {}; if (!options.test) { - /** @type {TODO} */ + /** @type {Partial} */ const defaultTrueMockRegExp = { test: () => true }; /** @type {RegExp} */ - options.test = defaultTrueMockRegExp; + options.test = + /** @type {RegExp} */ + (defaultTrueMockRegExp); } this.options = options; } @@ -75,7 +77,7 @@ class LoaderOptionsPlugin { continue; } - /** @type {TODO} */ + /** @type {LoaderContext & Record} */ (context)[key] = options[key]; } } diff --git a/lib/Module.js b/lib/Module.js index f8b967212d9..9e325a2507e 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -40,6 +40,7 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ /** @typedef {import("./WebpackError")} WebpackError */ +/** @typedef {import("./json/JsonData")} JsonData */ /** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ /** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ /** @typedef {import("./util/Hash")} Hash */ @@ -116,6 +117,7 @@ const makeSerializable = require("./util/makeSerializable"); * @property {boolean=} sideEffectFree * @property {Record=} exportsFinalName * @property {boolean=} isCSSModule + * @property {Record=} jsIncompatibleExports */ /** @@ -134,13 +136,17 @@ const makeSerializable = require("./util/makeSerializable"); * @property {LazySet=} buildDependencies using in NormalModule * @property {ValueCacheVersions=} valueDependencies using in NormalModule * @property {Record=} assets using in NormalModule + * @property {Map=} assetsInfo using in NormalModule * @property {string=} hash using in NormalModule * @property {(Snapshot | null)=} snapshot using in ContextModule * @property {string=} fullContentHash for assets modules * @property {string=} filename for assets modules - * @property {Map=} assetsInfo for assets modules * @property {boolean=} dataUrl for assets modules + * @property {AssetInfo=} assetInfo for assets modules + * @property {boolean=} javascriptModule for external modules + * @property {boolean=} active for lazy compilation modules * @property {CssData=} cssData for css modules + * @property {JsonData=} jsonData for json modules * @property {Set=} topLevelDeclarations top level declaration names */ diff --git a/lib/MultiCompiler.js b/lib/MultiCompiler.js index effd4df6311..6e0c4e9f0e0 100644 --- a/lib/MultiCompiler.js +++ b/lib/MultiCompiler.js @@ -324,7 +324,7 @@ module.exports = class MultiCompiler { * @deprecated This method should have been private * @param {Compiler[]} compilers the child compilers * @param {RunWithDependenciesHandler} fn a handler to run for each compiler - * @param {Callback} callback the compiler's handler + * @param {Callback} callback the compiler's handler * @returns {void} */ runWithDependencies(compilers, fn, callback) { @@ -355,7 +355,7 @@ module.exports = class MultiCompiler { return readyCompilers; }; /** - * @param {Callback} callback callback + * @param {Callback} callback callback * @returns {void} */ const runCompilers = callback => { @@ -370,7 +370,7 @@ module.exports = class MultiCompiler { }); }, (err, results) => { - callback(err, /** @type {TODO} */ (results)); + callback(err, results); } ); }; diff --git a/lib/NormalModule.js b/lib/NormalModule.js index 0e2d41ef25b..4dfc6b42daf 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -65,6 +65,7 @@ const memoize = require("./util/memoize"); /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ /** @typedef {import("./Generator")} Generator */ /** @typedef {import("./Generator").GenerateErrorFn} GenerateErrorFn */ +/** @typedef {import("./Generator").GenerateContextData} GenerateContextData */ /** @typedef {import("./Module").BuildInfo} BuildInfo */ /** @typedef {import("./Module").BuildMeta} BuildMeta */ /** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ @@ -79,7 +80,7 @@ const memoize = require("./util/memoize"); /** @typedef {import("./Module").UnsafeCacheData} UnsafeCacheData */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ /** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ -/** @typedef {import("./ModuleTypeConstants").JavaScriptModuleTypes} JavaScriptModuleTypes */ +/** @typedef {import("./ModuleTypeConstants").ModuleTypes} ModuleTypes */ /** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */ /** @typedef {import("./NormalModuleFactory").ResourceDataWithData} ResourceDataWithData */ /** @typedef {import("./NormalModuleFactory").ResourceSchemeData} ResourceSchemeData */ @@ -148,12 +149,14 @@ const contextifySourceUrl = (context, source, associatedObjectForCache) => { /** * @param {string} context absolute context path - * @param {RawSourceMap} sourceMap a source map + * @param {string | RawSourceMap} sourceMap a source map * @param {AssociatedObjectForCache=} associatedObjectForCache an object to which the cache will be attached - * @returns {RawSourceMap} new source map + * @returns {string | RawSourceMap} new source map */ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { - if (!Array.isArray(sourceMap.sources)) return sourceMap; + if (typeof sourceMap === "string" || !Array.isArray(sourceMap.sources)) { + return sourceMap; + } const { sourceRoot } = sourceMap; /** @type {(source: string) => string} */ const mapper = !sourceRoot @@ -218,7 +221,7 @@ makeSerializable( "NonErrorEmittedError" ); -/** @typedef {[string | Buffer, string | SourceMapSource, PreparsedAst]} Result */ +/** @typedef {[string | Buffer, string | RawSourceMap | undefined, PreparsedAst | undefined]} Result */ /** * @typedef {object} NormalModuleCompilationHooks @@ -235,7 +238,7 @@ makeSerializable( /** * @typedef {object} NormalModuleCreateData * @property {string=} layer an optional layer in which the module is - * @property {JavaScriptModuleTypes | ""} type module type. When deserializing, this is set to an empty string "". + * @property {ModuleTypes | ""} type module type. When deserializing, this is set to an empty string "". * @property {string} request request string * @property {string} userRequest request intended by user (without loaders from config) * @property {string} rawRequest request without resolving @@ -254,8 +257,6 @@ makeSerializable( /** @type {WeakMap} */ const compilationHooksMap = new WeakMap(); -/** @typedef {Map} CodeGeneratorData */ - class NormalModule extends Module { /** * @param {Compilation} compilation the compilation @@ -396,7 +397,7 @@ class NormalModule extends Module { this._isEvaluatingSideEffects = false; /** @type {WeakSet | undefined} */ this._addedSideEffectsBailout = undefined; - /** @type {CodeGeneratorData} */ + /** @type {GenerateContextData} */ this._codeGeneratorData = new Map(); } @@ -855,7 +856,7 @@ class NormalModule extends Module { /** * @param {string} context the compilation context * @param {string | Buffer} content the content - * @param {(string | SourceMapSource | null)=} sourceMap an optional source map + * @param {(string | RawSourceMap | null)=} sourceMap an optional source map * @param {AssociatedObjectForCache=} associatedObjectForCache object for caching * @returns {Source} the created source */ @@ -876,11 +877,7 @@ class NormalModule extends Module { return new SourceMapSource( content, contextifySourceUrl(context, identifier, associatedObjectForCache), - contextifySourceMap( - context, - /** @type {TODO} */ (sourceMap), - associatedObjectForCache - ) + contextifySourceMap(context, sourceMap, associatedObjectForCache) ); } @@ -914,10 +911,10 @@ class NormalModule extends Module { /** * @param {Error | null} err err - * @param {(Result | null)=} _result result + * @param {(Result | null)=} result_ result * @returns {void} */ - const processResult = (err, _result) => { + const processResult = (err, result_) => { if (err) { if (!(err instanceof Error)) { err = new NonErrorEmittedError(err); @@ -933,7 +930,8 @@ class NormalModule extends Module { return callback(error); } const result = hooks.processResult.call( - /** @type {Result} */ (_result), + /** @type {Result} */ + (result_), this ); const source = result[0]; @@ -1455,9 +1453,6 @@ class NormalModule extends Module { runtimeRequirements.add(RuntimeGlobals.thisAsExports); } - /** - * @type {() => CodeGeneratorData} - */ const getData = () => this._codeGeneratorData; const sources = new Map(); diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js index 09cb4f594af..c1c079c3a4b 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -304,7 +304,7 @@ class NormalModuleFactory extends ModuleFactory { generator: new HookMap( () => new SyncHook(["generator", "generatorOptions"]) ), - /** @type {HookMap>} */ + /** @type {HookMap>} */ createModuleClass: new HookMap( () => new SyncBailHook(["createData", "resolveData"]) ) diff --git a/lib/ProgressPlugin.js b/lib/ProgressPlugin.js index b5add53ebc1..65d6dacd173 100644 --- a/lib/ProgressPlugin.js +++ b/lib/ProgressPlugin.js @@ -12,6 +12,10 @@ const createSchemaValidation = require("./util/create-schema-validation"); const { contextify } = require("./util/identifier"); /** @typedef {import("tapable").Tap} Tap */ +/** + * @template T, R, AdditionalOptions + * @typedef {import("tapable").Hook} Hook + */ /** @typedef {import("../declarations/plugins/ProgressPlugin").HandlerFunction} HandlerFunction */ /** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginArgument} ProgressPluginArgument */ /** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginOptions} ProgressPluginOptions */ @@ -584,7 +588,8 @@ class ProgressPlugin { } }); /** - * @param {TODO} hook hook + * @template {Hook} T + * @param {T} hook hook * @param {number} progress progress from 0 to 1 * @param {string} category category * @param {string} name name diff --git a/lib/asset/AssetGenerator.js b/lib/asset/AssetGenerator.js index 5b97130691f..f4c2fae54f6 100644 --- a/lib/asset/AssetGenerator.js +++ b/lib/asset/AssetGenerator.js @@ -588,8 +588,12 @@ class AssetGenerator extends Generator { data.set("url", { [type]: assetPath, ...data.get("url") }); } - if (data && data.get("assetInfo")) { - newAssetInfo = mergeAssetInfo(data.get("assetInfo"), newAssetInfo); + if (data) { + const oldAssetInfo = data.get("assetInfo"); + + if (oldAssetInfo) { + newAssetInfo = mergeAssetInfo(oldAssetInfo, newAssetInfo); + } } if (data) { diff --git a/lib/asset/AssetModulesPlugin.js b/lib/asset/AssetModulesPlugin.js index bc43355cc86..7ee4370e0f5 100644 --- a/lib/asset/AssetModulesPlugin.js +++ b/lib/asset/AssetModulesPlugin.js @@ -18,6 +18,7 @@ const memoize = require("../util/memoize"); /** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("../../declarations/WebpackOptions").AssetParserOptions} AssetParserOptions */ +/** @typedef {import("schema-utils").Schema} Schema */ /** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Compilation").AssetInfo} AssetInfo */ /** @typedef {import("../Compiler")} Compiler */ @@ -28,7 +29,7 @@ const memoize = require("../util/memoize"); /** * @param {string} name name of definitions - * @returns {TODO} definition + * @returns {Schema} definition */ const getSchema = name => { const { definitions } = require("../../schemas/WebpackOptions.json"); diff --git a/lib/cache/IdleFileCachePlugin.js b/lib/cache/IdleFileCachePlugin.js index 555a587b71c..90708076574 100644 --- a/lib/cache/IdleFileCachePlugin.js +++ b/lib/cache/IdleFileCachePlugin.js @@ -52,7 +52,7 @@ class IdleFileCachePlugin { let timeSpendInStore = 0; let avgTimeSpendInStore = 0; - /** @type {Map Promise>} */ + /** @type {Map Promise>} */ const pendingIdleTasks = new Map(); compiler.cache.hooks.store.tap( @@ -130,7 +130,7 @@ class IdleFileCachePlugin { } ); - /** @type {Promise} */ + /** @type {Promise} */ let currentIdlePromise = resolvedPromise; let isIdle = false; let isInitialStore = true; @@ -146,7 +146,10 @@ class IdleFileCachePlugin { promises.push(factory()); if (maxCount-- <= 0 || Date.now() > maxTime) break; } - currentIdlePromise = Promise.all(promises); + currentIdlePromise = Promise.all( + /** @type {Promise[]} */ + (promises) + ); currentIdlePromise.then(() => { timeSpendInStore += Date.now() - startTime; // Allow to exit the process between diff --git a/lib/cli.js b/lib/cli.js index c7efa90ce1c..642bde742c3 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -68,6 +68,8 @@ const webpackSchema = require("../schemas/WebpackOptions.json"); /** @typedef {Record} Flags */ +/** @typedef {Record} ObjectConfiguration */ + /** * @param {Schema=} schema a json schema to create arguments for (by default webpack schema is used) * @returns {Flags} object of arguments @@ -429,10 +431,10 @@ const cliAddedItems = new WeakMap(); /** @typedef {string | number} Property */ /** - * @param {Configuration} config configuration + * @param {ObjectConfiguration} config configuration * @param {string} schemaPath path in the config * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined - * @returns {{ problem?: LocalProblem, object?: TODO, property?: Property, value?: EXPECTED_OBJECT | EXPECTED_ANY[] }} problem or object with property and value + * @returns {{ problem?: LocalProblem, object?: ObjectConfiguration, property?: Property, value?: EXPECTED_OBJECT | EXPECTED_ANY[] }} problem or object with property and value */ const getObjectAndProperty = (config, schemaPath, index = 0) => { if (!schemaPath) return { value: config }; @@ -529,7 +531,7 @@ const getObjectAndProperty = (config, schemaPath, index = 0) => { }; /** - * @param {Configuration} config configuration + * @param {ObjectConfiguration} config configuration * @param {string} schemaPath path in the config * @param {ParsedValue} value parsed value * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined @@ -542,13 +544,14 @@ const setValue = (config, schemaPath, value, index) => { index ); if (problem) return problem; - object[/** @type {Property} */ (property)] = value; + /** @type {ObjectConfiguration} */ + (object)[/** @type {Property} */ (property)] = value; return null; }; /** * @param {ArgumentConfig} argConfig processing instructions - * @param {Configuration} config configuration + * @param {ObjectConfiguration} config configuration * @param {Value} value the value * @param {number | undefined} index the index if multiple values provided * @returns {LocalProblem | null} a problem if any @@ -655,12 +658,12 @@ const parseValueForArgumentConfig = (argConfig, value) => { } }; -/** @typedef {TODO} Configuration */ +/** @typedef {Record} Values */ /** * @param {Flags} args object of arguments - * @param {Configuration} config configuration - * @param {Record} values object with values + * @param {ObjectConfiguration} config configuration + * @param {Values} values object with values * @returns {Problem[] | null} problems or null for success */ const processArguments = (args, config, values) => { diff --git a/lib/css/CssModulesPlugin.js b/lib/css/CssModulesPlugin.js index 11a5fec56cd..9dfc70d897b 100644 --- a/lib/css/CssModulesPlugin.js +++ b/lib/css/CssModulesPlugin.js @@ -56,6 +56,7 @@ const CssParser = require("./CssParser"); /** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ /** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../CssModule").Inheritance} Inheritance */ +/** @typedef {import("../CssModule").CSSModuleCreateData} CSSModuleCreateData */ /** @typedef {import("../Module")} Module */ /** @typedef {import("../Module").BuildInfo} BuildInfo */ /** @typedef {import("../Template").RuntimeTemplate} RuntimeTemplate */ @@ -347,25 +348,34 @@ class CssModulesPlugin { inheritance.push(...parent.inheritance); } - return new CssModule({ + return new CssModule( + /** @type {CSSModuleCreateData} */ + ({ + ...createData, + cssLayer: dependency.layer, + supports: dependency.supports, + media: dependency.media, + inheritance + }) + ); + } + + return new CssModule( + /** @type {CSSModuleCreateData} */ + ({ ...createData, cssLayer: dependency.layer, supports: dependency.supports, - media: dependency.media, - inheritance - }); - } - - return new CssModule({ - ...createData, - cssLayer: dependency.layer, - supports: dependency.supports, - media: dependency.media - }); + media: dependency.media + }) + ); } } - return new CssModule(createData); + return new CssModule( + /** @type {CSSModuleCreateData} */ + (createData) + ); }); NormalModule.getCompilationHooks(compilation).processResult.tap( diff --git a/lib/index.js b/lib/index.js index 50a1bd15106..8caa003198d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -135,7 +135,9 @@ module.exports = mergeExports(fn, { * @returns {(configuration: Configuration | Configuration[]) => void} validate fn */ get validate() { - const webpackOptionsSchemaCheck = require("../schemas/WebpackOptions.check"); + const webpackOptionsSchemaCheck = + /** @type {(configuration: Configuration | Configuration[]) => boolean} */ + (require("../schemas/WebpackOptions.check")); const getRealValidate = memoize( /** @@ -149,7 +151,7 @@ module.exports = mergeExports(fn, { } ); return options => { - if (!webpackOptionsSchemaCheck(/** @type {TODO} */ (options))) { + if (!webpackOptionsSchemaCheck(options)) { getRealValidate()(options); } }; diff --git a/lib/util/create-schema-validation.js b/lib/util/create-schema-validation.js index 27a0ab0be5e..be9f38ca3d1 100644 --- a/lib/util/create-schema-validation.js +++ b/lib/util/create-schema-validation.js @@ -7,6 +7,7 @@ const memoize = require("./memoize"); +/** @typedef {import("schema-utils").Schema} Schema */ /** @typedef {import("schema-utils/declarations/validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ /** @typedef {import("./fs").JsonObject} JsonObject */ @@ -15,7 +16,7 @@ const getValidate = memoize(() => require("schema-utils").validate); /** * @template {object | object[]} T * @param {((value: T) => boolean) | undefined} check check - * @param {() => JsonObject} getSchema get schema fn + * @param {() => Schema} getSchema get schema fn * @param {ValidationErrorConfiguration} options options * @returns {(value?: T) => void} validate */ diff --git a/test/Validation.test.js b/test/Validation.test.js index 502fc1b6f7b..22bc34fa6ba 100644 --- a/test/Validation.test.js +++ b/test/Validation.test.js @@ -27,6 +27,30 @@ describe("Validation", () => { }); }; + const createTestCaseOnlyValidate = (name, config, fn) => { + it(`should fail validation for ${name}`, () => { + let errored; + + try { + const webpack = require(".."); + + webpack.validate(config); + } catch (err) { + if (err.name !== "ValidationError") throw err; + errored = err; + fn(err.message); + + return; + } + + if (!errored) { + throw new Error("Validation didn't fail"); + } + + expect(errored.message).toMatch(/^Invalid configuration object./); + }); + }; + 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. @@ -570,6 +594,38 @@ describe("Validation", () => { `) ); + createTestCaseOnlyValidate( + "devtool", + { + devtool: "cheap-eval-nosource-source-map" + }, + 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)?$\\". + BREAKING CHANGE since webpack 5: The devtool option is more strict. + Please strictly follow the order of the keywords in the pattern." + `) + ); + + createTestCaseOnlyValidate( + "devtool", + [ + { + devtool: "cheap-eval-nosource-source-map" + }, + { + devtool: "unknown" + } + ], + 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)?$\\". + - configuration[1].devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\"." + `) + ); + describe("did you mean", () => { createTestCase( "module.rules", diff --git a/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap b/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap index 621780614b7..cebc50b6108 100644 --- a/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap +++ b/test/__snapshots__/ConfigCacheTestCases.longtest.js.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`ConfigCacheTestCases css build-http exported tests should work with URLs in CSS 1`] = ` Array [ diff --git a/test/configCases/source-map/loader-source-map-string/index.js b/test/configCases/source-map/loader-source-map-string/index.js new file mode 100644 index 00000000000..3e02e7ff661 --- /dev/null +++ b/test/configCases/source-map/loader-source-map-string/index.js @@ -0,0 +1,5 @@ +import mod from "./module.js"; + +it("should correctly work with source maps", () => { + expect(mod).toBe(42); +}); diff --git a/test/configCases/source-map/loader-source-map-string/loader.js b/test/configCases/source-map/loader-source-map-string/loader.js new file mode 100644 index 00000000000..e240b47712f --- /dev/null +++ b/test/configCases/source-map/loader-source-map-string/loader.js @@ -0,0 +1,38 @@ +const babel = require("@babel/core"); + +/** @typedef {import("@babel/core").BabelFileResult} BabelFileResult */ +/** @typedef {import("@babel/core").TransformOptions} TransformOptions */ + +/** @type {import("../../../../").LoaderDefinition} */ +module.exports = function(source, inputSourceMap) { + const callback = this.async(); + + babel.transform(source, { + filename: this.resourcePath, + sourceFileName: this.resourcePath, + inputSourceMap: /** @type {NonNullable} */ + (inputSourceMap), + sourceMaps: this.sourceMap, + plugins: [function() { + return { + visitor: { + /** + * @param {EXPECTED_ANY} path path + */ + NumericLiteral(path) { + path.node.value = 43; + }, + }, + }; + }] + }, (err, result) => { + if (err) { + callback(err); + return; + } + + const { code, map } = /** @type {BabelFileResult} */ (result); + + callback(null, /** @type {string} */ (code), JSON.stringify(map)); + }); +}; diff --git a/test/configCases/source-map/loader-source-map-string/module.js b/test/configCases/source-map/loader-source-map-string/module.js new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/configCases/source-map/loader-source-map-string/module.js @@ -0,0 +1 @@ +export default 42; 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 new file mode 100644 index 00000000000..83788c09a14 --- /dev/null +++ b/test/configCases/source-map/loader-source-map-string/webpack.config.js @@ -0,0 +1,18 @@ +/** @type {import('webpack').Configuration} */ +const config = { + devtool: "source-map", + module: { + rules: [ + { + test: /\.js$/, + use: [ + { + loader: require.resolve("./loader.js") + } + ] + } + ] + } +}; + +module.exports = config; diff --git a/test/configCases/source-map/loader-source-map/index.js b/test/configCases/source-map/loader-source-map/index.js new file mode 100644 index 00000000000..3e02e7ff661 --- /dev/null +++ b/test/configCases/source-map/loader-source-map/index.js @@ -0,0 +1,5 @@ +import mod from "./module.js"; + +it("should correctly work with source maps", () => { + expect(mod).toBe(42); +}); diff --git a/test/configCases/source-map/loader-source-map/loader.js b/test/configCases/source-map/loader-source-map/loader.js new file mode 100644 index 00000000000..ec2b6529ba0 --- /dev/null +++ b/test/configCases/source-map/loader-source-map/loader.js @@ -0,0 +1,40 @@ +const babel = require("@babel/core"); + +/** @typedef {import("@babel/core").BabelFileResult} BabelFileResult */ +/** @typedef {import("@babel/core").TransformOptions} TransformOptions */ + +/** @typedef {import("estree").SimpleLiteral} SimpleLiteral */ + +/** @type {import("../../../../").LoaderDefinition} */ +module.exports = function(source, inputSourceMap) { + const callback = this.async(); + + babel.transform(source, { + filename: this.resourcePath, + sourceFileName: this.resourcePath, + inputSourceMap: /** @type {NonNullable} */ + (inputSourceMap), + sourceMaps: this.sourceMap, + plugins: [function() { + return { + visitor: { + /** + * @param {EXPECTED_ANY} path path + */ + NumericLiteral(path) { + path.node.value = 43; + }, + }, + }; + }] + }, (err, result) => { + if (err) { + callback(err); + return; + } + + const { code, map } = /** @type {BabelFileResult} */ (result); + + callback(null, /** @type {string} */ (code), map); + }); +}; diff --git a/test/configCases/source-map/loader-source-map/module.js b/test/configCases/source-map/loader-source-map/module.js new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/configCases/source-map/loader-source-map/module.js @@ -0,0 +1 @@ +export default 42; diff --git a/test/configCases/source-map/loader-source-map/webpack.config.js b/test/configCases/source-map/loader-source-map/webpack.config.js new file mode 100644 index 00000000000..83788c09a14 --- /dev/null +++ b/test/configCases/source-map/loader-source-map/webpack.config.js @@ -0,0 +1,18 @@ +/** @type {import('webpack').Configuration} */ +const config = { + devtool: "source-map", + module: { + rules: [ + { + test: /\.js$/, + use: [ + { + loader: require.resolve("./loader.js") + } + ] + } + ] + } +}; + +module.exports = config; diff --git a/types.d.ts b/types.d.ts index 66cb71930d8..e87c3a256fe 100644 --- a/types.d.ts +++ b/types.d.ts @@ -5674,8 +5674,15 @@ declare interface GenerateContext { /** * get access to the code generation data */ - getData?: () => Map; -} + getData?: () => GenerateContextData; +} +type GenerateContextData = Map<"url", { [index: string]: string }> & + Map<"fullContentHash", string> & + Map<"contentHash", string> & + Map<"filename", string> & + Map<"assetInfo", AssetInfo> & + Map<"chunkInitFragments", InitFragment[]> & + Record; declare interface GeneratedSourceInfo { /** * generated line @@ -7971,6 +7978,17 @@ declare interface JavascriptParserOptions { */ wrappedContextRegExp?: RegExp; } +declare abstract class JsonData { + get(): + | undefined + | null + | string + | number + | boolean + | JsonObjectFs + | JsonValueFs[]; + updateHash(hash: Hash): void; +} /** * Generator options for json modules. @@ -8194,6 +8212,11 @@ declare interface KnownBuildInfo { */ assets?: Record; + /** + * using in NormalModule + */ + assetsInfo?: Map; + /** * using in NormalModule */ @@ -8217,18 +8240,33 @@ declare interface KnownBuildInfo { /** * for assets modules */ - assetsInfo?: Map; + dataUrl?: boolean; /** * for assets modules */ - dataUrl?: boolean; + assetInfo?: AssetInfo; + + /** + * for external modules + */ + javascriptModule?: boolean; + + /** + * for lazy compilation modules + */ + active?: boolean; /** * for css modules */ cssData?: CssData; + /** + * for json modules + */ + jsonData?: JsonData; + /** * top level declaration names */ @@ -8242,6 +8280,7 @@ declare interface KnownBuildMeta { sideEffectFree?: boolean; exportsFinalName?: Record; isCSSModule?: boolean; + jsIncompatibleExports?: Record; } declare interface KnownCreateStatsOptionsContext { forToString?: boolean; @@ -10346,7 +10385,7 @@ declare class MultiCompiler { runWithDependencies( compilers: Compiler[], fn: (compiler: Compiler, callback: CallbackFunction_1) => any, - callback: CallbackFunction_1 + callback: CallbackFunction_1 ): void; watch( watchOptions: WatchOptions | WatchOptions[], @@ -10546,7 +10585,7 @@ declare class NormalModule extends Module { createSource( context: string, content: string | Buffer, - sourceMap?: null | string | SourceMapSource, + sourceMap?: null | string | RawSourceMap, associatedObjectForCache?: object ): Source; markModuleAsErrored(error: WebpackError): void; @@ -10581,7 +10620,14 @@ declare interface NormalModuleCompilationHooks { AsyncSeriesBailHook<[LoaderContextObject], null | string | Buffer> >; processResult: SyncWaterfallHook< - [[string | Buffer, string | SourceMapSource, PreparsedAst], NormalModule] + [ + [ + string | Buffer, + undefined | string | RawSourceMap, + undefined | PreparsedAst + ], + NormalModule + ] >; needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>; } @@ -10594,7 +10640,7 @@ declare interface NormalModuleCreateData { /** * module type. When deserializing, this is set to an empty string "". */ - type: "" | "javascript/auto" | "javascript/dynamic" | "javascript/esm"; + type: string; /** * request string @@ -10693,7 +10739,15 @@ declare abstract class NormalModuleFactory extends ModuleFactory { SyncBailHook<[GeneratorOptions], void | Generator> >; generator: HookMap>; - createModuleClass: HookMap>; + createModuleClass: HookMap< + SyncBailHook< + [ + Partial, + ResolveData + ], + void | Module + > + >; }>; resolverFactory: ResolverFactory; ruleSet: RuleSet; @@ -10857,6 +10911,9 @@ declare class NullDependency extends Dependency { declare class NullDependencyTemplate extends DependencyTemplate { constructor(); } +declare interface ObjectConfiguration { + [index: string]: any; +} declare interface ObjectDeserializerContext { read: () => any; setCircularReference: (value: ReferenceableItem) => void; @@ -16681,6 +16738,9 @@ type UsageStateType = 0 | 1 | 2 | 3 | 4; type UsedName = string | false | string[]; type Value = string | number | boolean | RegExp; type ValueCacheVersion = string | Set; +declare interface Values { + [index: string]: Value[]; +} declare class VariableInfo { constructor( declaredScope: ScopeInfo, @@ -17405,8 +17465,8 @@ declare namespace exports { ) => Flags; export let processArguments: ( args: Flags, - config: any, - values: Record + config: ObjectConfiguration, + values: Values ) => null | Problem[]; } export namespace ModuleFilenameHelpers { From 83c534ca3a6385ee7037220c7ba510ba5a8d944c Mon Sep 17 00:00:00 2001 From: alexander-akait Date: Wed, 9 Jul 2025 14:10:48 +0300 Subject: [PATCH 56/56] chore(release): 5.100.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c11d9bffe4..cc882210acb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack", - "version": "5.99.9", + "version": "5.100.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",