diff --git a/.eslintignore b/.eslintignore index f3afa1defd0..f595813309c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -25,5 +25,6 @@ schemas/**/*.check.js # Ignore some examples files examples/**/*.js +examples/**/*.mjs !examples/*/webpack.config.js diff --git a/.eslintrc.js b/.eslintrc.js index a8e25bd729e..fb78a264ea8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,15 +1,19 @@ module.exports = { root: true, - plugins: ["prettier", "node", "jest", "jsdoc"], + reportUnusedDisableDirectives: true, + plugins: ["prettier", "n", "jest", "jsdoc"], extends: [ "eslint:recommended", - "plugin:node/recommended", + "plugin:n/recommended", "plugin:prettier/recommended" ], env: { node: true, es6: true }, + globals: { + WebAssembly: true + }, parserOptions: { ecmaVersion: 2018 }, @@ -26,7 +30,7 @@ module.exports = { "no-use-before-define": "off", "no-unused-vars": ["error", { args: "none", ignoreRestSiblings: true }], "no-loop-func": "off", - "node/no-missing-require": ["error", { allowModules: ["webpack"] }], + "n/no-missing-require": ["error", { allowModules: ["webpack"] }], "jsdoc/check-indentation": "error", "jsdoc/check-param-names": "error", "jsdoc/check-property-names": "error", @@ -116,6 +120,14 @@ module.exports = { nsObj: false, jasmine: false } + }, + { + files: ["examples/**/*.js"], + rules: { + "n/no-missing-require": "off", + "n/no-unpublished-require": "off", + "n/no-extraneous-require": "off" + } } ] }; diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c6b24d47388..89efe54b7d5 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,17 +1,22 @@ - - -## Summary + + +**What kind of change does this PR introduce?** + + + +**Did you add tests for your changes?** - + -copilot:summary +**Does this PR introduce a breaking change?** -## Details + - +**What needs to be documented once your changes are merged?** -copilot:walkthrough + + diff --git a/.github/PULL_REQUEST_TEMPLATE_ORIGINAL.md b/.github/PULL_REQUEST_TEMPLATE_ORIGINAL.md deleted file mode 100644 index 89efe54b7d5..00000000000 --- a/.github/PULL_REQUEST_TEMPLATE_ORIGINAL.md +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - -**What kind of change does this PR introduce?** - - - -**Did you add tests for your changes?** - - - -**Does this PR introduce a breaking change?** - - - -**What needs to be documented once your changes are merged?** - - - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebd98cfae21..1a22fcd8a8a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,14 +19,14 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 16.x + node-version: lts/* cache: "yarn" - run: yarn --frozen-lockfile - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: .eslintcache key: lint-${{ env.GITHUB_SHA }} @@ -35,9 +35,9 @@ jobs: basic: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 16.x cache: "yarn" @@ -52,9 +52,9 @@ jobs: validate-legacy-node: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 10.x cache: "yarn" @@ -64,16 +64,16 @@ jobs: unit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 16.x cache: "yarn" - run: yarn --frozen-lockfile - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: .jest-cache key: jest-unit-${{ env.GITHUB_SHA }} @@ -115,9 +115,9 @@ jobs: use_main_branches: 1 runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: "yarn" @@ -134,7 +134,7 @@ jobs: if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: .jest-cache key: jest-integration-${{ env.GITHUB_SHA }} diff --git a/.prettierignore b/.prettierignore index e1bc031979d..eeb72ea7218 100644 --- a/.prettierignore +++ b/.prettierignore @@ -29,3 +29,5 @@ schemas/**/*.check.js # Ignore example fixtures examples/ !examples/**/webpack.config.js + +.vscode/**/*.* diff --git a/README.md b/README.md index bde462e6739..ccc4c80b123 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,9 @@ + + +

webpack

Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset. diff --git a/bin/webpack.js b/bin/webpack.js index 615c86ac845..1ee7e0dd2d0 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -76,11 +76,10 @@ const isInstalled = packageName => { const runCli = cli => { const path = require("path"); const pkgPath = require.resolve(`${cli.package}/package.json`); - // eslint-disable-next-line node/no-missing-require const pkg = require(pkgPath); if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) { - // eslint-disable-next-line node/no-unsupported-features/es-syntax + // eslint-disable-next-line n/no-unsupported-features/es-syntax import(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName])).catch( error => { console.error(error); @@ -88,7 +87,6 @@ const runCli = cli => { } ); } else { - // eslint-disable-next-line node/no-missing-require require(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName])); } }; diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index 8ff9aa91ec4..45cf35995a2 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -35,6 +35,14 @@ export type Context = string; * References to other configurations to depend on. */ export type Dependencies = string[]; +/** + * Options for the webpack-dev-server. + */ +export type DevServer = + | false + | { + [k: string]: any; + }; /** * A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). */ @@ -728,6 +736,14 @@ export type AssetParserDataUrlFunction = ( source: string | Buffer, context: {filename: string; module: import("../lib/Module")} ) => boolean; +/** + * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files. + */ +export type CssGeneratorExportsOnly = boolean; +/** + * Use ES modules named export for css exports. + */ +export type CssParserNamedExports = boolean; /** * A Function returning a Promise resolving to a normalized entry. */ @@ -1047,12 +1063,6 @@ export interface FileCacheOptions { */ version?: string; } -/** - * Options for the webpack-dev-server. - */ -export interface DevServer { - [k: string]: any; -} /** * Multiple entry bundles are created. The key is the entry name. The value can be a string, an array or an entry description object. */ @@ -1636,11 +1646,17 @@ export interface NodeOptions { /** * Include a polyfill for the '__dirname' variable. */ - __dirname?: false | true | "warn-mock" | "mock" | "eval-only"; + __dirname?: false | true | "warn-mock" | "mock" | "node-module" | "eval-only"; /** * Include a polyfill for the '__filename' variable. */ - __filename?: false | true | "warn-mock" | "mock" | "eval-only"; + __filename?: + | false + | true + | "warn-mock" + | "mock" + | "node-module" + | "eval-only"; /** * Include a polyfill for the 'global' variable. */ @@ -2237,6 +2253,10 @@ export interface Environment { * The environment supports arrow functions ('() => { ... }'). */ arrowFunction?: boolean; + /** + * The environment supports async function and await ('async function () { await ... }'). + */ + asyncFunction?: boolean; /** * The environment supports BigInt as literal (123n). */ @@ -2376,6 +2396,10 @@ export interface SnapshotOptions { */ timestamp?: boolean; }; + /** + * List of paths that are not managed by a package manager and the contents are subject to change. + */ + unmanagedPaths?: (RegExp | string)[]; } /** * Stats options object. @@ -2804,22 +2828,77 @@ export interface AssetResourceGeneratorOptions { publicPath?: RawPublicPath; } /** - * Options for css handling. + * Generator options for css/auto modules. */ -export interface CssExperimentOptions { +export interface CssAutoGeneratorOptions { /** * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files. */ - exportsOnly?: boolean; + exportsOnly?: CssGeneratorExportsOnly; +} +/** + * Parser options for css/auto modules. + */ +export interface CssAutoParserOptions { + /** + * Use ES modules named export for css exports. + */ + namedExports?: CssParserNamedExports; } /** * Generator options for css modules. */ -export interface CssGeneratorOptions {} +export interface CssGeneratorOptions { + /** + * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files. + */ + exportsOnly?: CssGeneratorExportsOnly; +} +/** + * Generator options for css/global modules. + */ +export interface CssGlobalGeneratorOptions { + /** + * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files. + */ + exportsOnly?: CssGeneratorExportsOnly; +} +/** + * Parser options for css/global modules. + */ +export interface CssGlobalParserOptions { + /** + * Use ES modules named export for css exports. + */ + namedExports?: CssParserNamedExports; +} +/** + * Generator options for css/module modules. + */ +export interface CssModuleGeneratorOptions { + /** + * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files. + */ + exportsOnly?: CssGeneratorExportsOnly; +} +/** + * Parser options for css/module modules. + */ +export interface CssModuleParserOptions { + /** + * Use ES modules named export for css exports. + */ + namedExports?: CssParserNamedExports; +} /** * Parser options for css modules. */ -export interface CssParserOptions {} +export interface CssParserOptions { + /** + * Use ES modules named export for css exports. + */ + namedExports?: CssParserNamedExports; +} /** * No generator options are supported for this module type. */ @@ -3585,7 +3664,7 @@ export interface ExperimentsExtra { /** * Enable css support. */ - css?: boolean | CssExperimentOptions; + css?: boolean; /** * Compile entrypoints and import()s only when they are accessed. */ @@ -3602,7 +3681,7 @@ export interface ExperimentsNormalizedExtra { /** * Enable css support. */ - css?: false | CssExperimentOptions; + css?: boolean; /** * Compile entrypoints and import()s only when they are accessed. */ @@ -3643,6 +3722,22 @@ export interface GeneratorOptionsByModuleTypeKnown { * Generator options for asset/resource modules. */ "asset/resource"?: AssetResourceGeneratorOptions; + /** + * Generator options for css modules. + */ + css?: CssGeneratorOptions; + /** + * Generator options for css/auto modules. + */ + "css/auto"?: CssAutoGeneratorOptions; + /** + * Generator options for css/global modules. + */ + "css/global"?: CssGlobalGeneratorOptions; + /** + * Generator options for css/module modules. + */ + "css/module"?: CssModuleGeneratorOptions; /** * No generator options are supported for this module type. */ @@ -3691,6 +3786,22 @@ export interface ParserOptionsByModuleTypeKnown { * No parser options are supported for this module type. */ "asset/source"?: EmptyParserOptions; + /** + * Parser options for css modules. + */ + css?: CssParserOptions; + /** + * Parser options for css/auto modules. + */ + "css/auto"?: CssAutoParserOptions; + /** + * Parser options for css/global modules. + */ + "css/global"?: CssGlobalParserOptions; + /** + * Parser options for css/module modules. + */ + "css/module"?: CssModuleParserOptions; /** * Parser options for javascript modules. */ diff --git a/examples/aggressive-merging/webpack.config.js b/examples/aggressive-merging/webpack.config.js index 2887ce355e8..8bc21bfad40 100644 --- a/examples/aggressive-merging/webpack.config.js +++ b/examples/aggressive-merging/webpack.config.js @@ -1,5 +1,5 @@ var path = require("path"); -var { AggressiveMergingPlugin } = require("../../").optimize; +var { AggressiveMergingPlugin } = require("../..").optimize; module.exports = { // mode: "development" || "production", diff --git a/examples/build-common.js b/examples/build-common.js index 3b7d512d393..7293b32d604 100644 --- a/examples/build-common.js +++ b/examples/build-common.js @@ -51,7 +51,30 @@ const doCompileAndReplace = (args, prefix, callback) => { throw new Error("Please install webpack-cli at root."); } - cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${args} ${displayReasons} ${commonArgs}`, (error, stdout, stderr) => { + const connectIO = (subprocess) => { + const { stdin, stdout, stderr } = process; + const { stdin: _stdin, stdout: _stdout, stderr: _stderr } = subprocess; + const inputPair = [[stdin, _stdin]]; + const outputPair = [[stdout, _stdout], [stderr, _stderr]]; + inputPair.forEach(pair => { + pair[0].pipe(pair[1]) + }) + outputPair.forEach(pair => { + pair[1].pipe(pair[0]) + }) + disconnectIO = () => { + inputPair.forEach(pair => { + pair[0].unpipe(pair[1]) + }) + outputPair.forEach(pair => { + pair[1].unpipe(pair[0]) + }) + } + } + let disconnectIO = null; + + const subprocess = cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${args} ${displayReasons} ${commonArgs}`, (error, stdout, stderr) => { + disconnectIO && disconnectIO(); if (stderr) console.log(stderr); if (error !== null) @@ -64,6 +87,7 @@ const doCompileAndReplace = (args, prefix, callback) => { } callback(); }); + connectIO(subprocess); }; async.series([ diff --git a/examples/dll-user/webpack.config.js b/examples/dll-user/webpack.config.js index c8d0d5210ad..7aae24a69ab 100644 --- a/examples/dll-user/webpack.config.js +++ b/examples/dll-user/webpack.config.js @@ -5,11 +5,11 @@ module.exports = { plugins: [ new webpack.DllReferencePlugin({ context: path.join(__dirname, "..", "dll"), - manifest: require("../dll/dist/alpha-manifest.json") // eslint-disable-line + manifest: require("../dll/dist/alpha-manifest.json") }), new webpack.DllReferencePlugin({ scope: "beta", - manifest: require("../dll/dist/beta-manifest.json"), // eslint-disable-line + manifest: require("../dll/dist/beta-manifest.json"), extensions: [".js", ".jsx"] }) ] diff --git a/examples/stats-none/README.md b/examples/stats-none/README.md new file mode 100644 index 00000000000..b1fe4195d04 --- /dev/null +++ b/examples/stats-none/README.md @@ -0,0 +1,47 @@ +This configuration will enable the none output for the stats report. + +You see that everything is working nicely together. + +# example.js + +```javascript +console.log("Hello World!"); +``` + +# webpack.config.js + +```javascript +const path = require("path"); + +module.exports = { + output: { + path: path.join(__dirname, "dist"), + filename: "output.js" + }, + stats: "none" +}; +``` + +# dist/output.js + +```javascript +/******/ (() => { // webpackBootstrap +var __webpack_exports__ = {}; +/*!********************!*\ + !*** ./example.js ***! + \********************/ +/*! unknown exports (runtime-defined) */ +/*! runtime requirements: */ +console.log("Hello World!"); + +/******/ })() +; +``` + +# Info + +## Production mode + +``` + +``` diff --git a/examples/stats-none/build.js b/examples/stats-none/build.js new file mode 100644 index 00000000000..6da1216015d --- /dev/null +++ b/examples/stats-none/build.js @@ -0,0 +1,4 @@ +global.NO_REASONS = true; +global.NO_STATS_OPTIONS = true; +global.STATS_COLORS = true; +require("../build-common"); diff --git a/examples/stats-none/example.js b/examples/stats-none/example.js new file mode 100644 index 00000000000..019c0f4bc8e --- /dev/null +++ b/examples/stats-none/example.js @@ -0,0 +1 @@ +console.log("Hello World!"); diff --git a/examples/stats-none/template.md b/examples/stats-none/template.md new file mode 100644 index 00000000000..b60135662a4 --- /dev/null +++ b/examples/stats-none/template.md @@ -0,0 +1,29 @@ +This configuration will enable the none output for the stats report. + +You see that everything is working nicely together. + +# example.js + +```javascript +_{{example.js}}_ +``` + +# webpack.config.js + +```javascript +_{{webpack.config.js}}_ +``` + +# dist/output.js + +```javascript +_{{dist/output.js}}_ +``` + +# Info + +## Production mode + +``` +_{{production:stdout}}_ +``` diff --git a/examples/stats-none/webpack.config.js b/examples/stats-none/webpack.config.js new file mode 100644 index 00000000000..8a687239693 --- /dev/null +++ b/examples/stats-none/webpack.config.js @@ -0,0 +1,9 @@ +const path = require("path"); + +module.exports = { + output: { + path: path.join(__dirname, "dist"), + filename: "output.js" + }, + stats: "none" +}; diff --git a/examples/stats-summary/README.md b/examples/stats-summary/README.md new file mode 100644 index 00000000000..7ebee7c56d0 --- /dev/null +++ b/examples/stats-summary/README.md @@ -0,0 +1,47 @@ +This configuration will enable the summary output for the stats report. + +You see that everything is working nicely together. + +# example.js + +```javascript +console.log("Hello World!"); +``` + +# webpack.config.js + +```javascript +const path = require("path"); + +module.exports = { + output: { + path: path.join(__dirname, "dist"), + filename: "output.js" + }, + stats: "summary" +}; +``` + +# dist/output.js + +```javascript +/******/ (() => { // webpackBootstrap +var __webpack_exports__ = {}; +/*!********************!*\ + !*** ./example.js ***! + \********************/ +/*! unknown exports (runtime-defined) */ +/*! runtime requirements: */ +console.log("Hello World!"); + +/******/ })() +; +``` + +# Info + +## Production mode + +``` +webpack 5.88.0 compiled successfully +``` diff --git a/examples/stats-summary/build.js b/examples/stats-summary/build.js new file mode 100644 index 00000000000..6da1216015d --- /dev/null +++ b/examples/stats-summary/build.js @@ -0,0 +1,4 @@ +global.NO_REASONS = true; +global.NO_STATS_OPTIONS = true; +global.STATS_COLORS = true; +require("../build-common"); diff --git a/examples/stats-summary/example.js b/examples/stats-summary/example.js new file mode 100644 index 00000000000..019c0f4bc8e --- /dev/null +++ b/examples/stats-summary/example.js @@ -0,0 +1 @@ +console.log("Hello World!"); diff --git a/examples/stats-summary/template.md b/examples/stats-summary/template.md new file mode 100644 index 00000000000..087cfc32b5f --- /dev/null +++ b/examples/stats-summary/template.md @@ -0,0 +1,29 @@ +This configuration will enable the summary output for the stats report. + +You see that everything is working nicely together. + +# example.js + +```javascript +_{{example.js}}_ +``` + +# webpack.config.js + +```javascript +_{{webpack.config.js}}_ +``` + +# dist/output.js + +```javascript +_{{dist/output.js}}_ +``` + +# Info + +## Production mode + +``` +_{{production:stdout}}_ +``` diff --git a/examples/stats-summary/webpack.config.js b/examples/stats-summary/webpack.config.js new file mode 100644 index 00000000000..94e9a0f0b2d --- /dev/null +++ b/examples/stats-summary/webpack.config.js @@ -0,0 +1,9 @@ +const path = require("path"); + +module.exports = { + output: { + path: path.join(__dirname, "dist"), + filename: "output.js" + }, + stats: "summary" +}; diff --git a/hot/log.js b/hot/log.js index 81bc8524b45..281771d11ec 100644 --- a/hot/log.js +++ b/hot/log.js @@ -45,11 +45,9 @@ module.exports = function (level, msg) { } }; -/* eslint-disable node/no-unsupported-features/node-builtins */ var group = console.group || dummy; var groupCollapsed = console.groupCollapsed || dummy; var groupEnd = console.groupEnd || dummy; -/* eslint-enable node/no-unsupported-features/node-builtins */ module.exports.group = logGroup(group); diff --git a/lib/APIPlugin.js b/lib/APIPlugin.js index cd4dd872199..94b617df620 100644 --- a/lib/APIPlugin.js +++ b/lib/APIPlugin.js @@ -247,7 +247,7 @@ class APIPlugin { ? new BasicEvaluatedExpression().setNull() : new BasicEvaluatedExpression().setString( parser.state.module.layer - ) + ) ).setRange(expr.range) ); parser.hooks.evaluateTypeof diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js index a191435197b..0b27a2f6751 100644 --- a/lib/ChunkGraph.js +++ b/lib/ChunkGraph.js @@ -1539,7 +1539,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza return withConnections ? BigInt( `0x${this._getModuleGraphHashWithConnections(cgm, module, runtime)}` - ) + ) : this._getModuleGraphHashBigInt(cgm, module, runtime); } diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js index 6e5c3b0f7d5..534af201a61 100644 --- a/lib/CleanPlugin.js +++ b/lib/CleanPlugin.js @@ -328,18 +328,18 @@ class CleanPlugin { typeof keep === "function" ? keep : typeof keep === "string" - ? /** - * @param {string} path path - * @returns {boolean} true, if the path should be kept - */ - path => path.startsWith(keep) - : typeof keep === "object" && keep.test - ? /** - * @param {string} path path - * @returns {boolean} true, if the path should be kept - */ - path => keep.test(path) - : () => false; + ? /** + * @param {string} path path + * @returns {boolean} true, if the path should be kept + */ + path => path.startsWith(keep) + : typeof keep === "object" && keep.test + ? /** + * @param {string} path path + * @returns {boolean} true, if the path should be kept + */ + path => keep.test(path) + : () => false; // We assume that no external modification happens while the compiler is active // So we can store the old assets and only diff to them to avoid fs access on diff --git a/lib/Compilation.js b/lib/Compilation.js index a880195717b..c17748d5cc8 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -885,6 +885,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.resolverFactory = compiler.resolverFactory; this.inputFileSystem = compiler.inputFileSystem; this.fileSystemInfo = new FileSystemInfo(this.inputFileSystem, { + unmanagedPaths: compiler.unmanagedPaths, managedPaths: compiler.managedPaths, immutablePaths: compiler.immutablePaths, logger: this.getLogger("webpack.FileSystemInfo"), @@ -1177,9 +1178,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si }; if (this.hooks.log.call(name, logEntry) === undefined) { if (logEntry.type === LogType.profileEnd) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins if (typeof console.profileEnd === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.profileEnd(`[${name}] ${logEntry.args[0]}`); } } @@ -1192,9 +1191,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } logEntries.push(logEntry); if (logEntry.type === LogType.profile) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins if (typeof console.profile === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.profile(`[${name}] ${logEntry.args[0]}`); } } @@ -1725,6 +1722,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si originModule, module, true, + false, callback ); } @@ -1744,6 +1742,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @property {string=} context * @property {boolean=} recursive recurse into dependencies of the created module * @property {boolean=} connectOrigin connect the resolved module with the origin module + * @property {boolean=} checkCycle check the cycle dependencies of the created module */ /** @@ -1759,7 +1758,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si contextInfo, context, recursive = true, - connectOrigin = recursive + connectOrigin = recursive, + checkCycle = !recursive }, callback ) { @@ -1880,6 +1880,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si originModule, module, recursive, + checkCycle, callback ); }); @@ -1887,10 +1888,16 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si ); } - _handleModuleBuildAndDependencies(originModule, module, recursive, callback) { + _handleModuleBuildAndDependencies( + originModule, + module, + recursive, + checkCycle, + callback + ) { // Check for cycles when build is trigger inside another build let creatingModuleDuringBuildSet = undefined; - if (!recursive && this.buildQueue.isProcessing(originModule)) { + if (checkCycle && this.buildQueue.isProcessing(originModule)) { // Track build dependency creatingModuleDuringBuildSet = this.creatingModuleDuringBuild.get(originModule); @@ -1988,8 +1995,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si context: context ? context : originModule - ? originModule.context - : this.compiler.context, + ? originModule.context + : this.compiler.context, dependencies: dependencies }, (err, result) => { @@ -2668,9 +2675,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si loaders ? `${ modules.length - } x ${moduleType} with ${this.requestShortener.shorten( + } x ${moduleType} with ${this.requestShortener.shorten( loaders - )}` + )}` : `${modules.length} x ${moduleType}` }` ); @@ -3078,7 +3085,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o `BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation. Do changes to assets earlier, e. g. in Compilation.hooks.processAssets. Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.` - ) + ) : Object.freeze(this.assets); this.summarizeDependencies(); @@ -3341,6 +3348,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o dependencyTemplates, runtimeTemplate, runtime, + runtimes, codeGenerationResults: results, compilation: this }); @@ -4584,8 +4592,8 @@ This prevents using hashes of each other and should be avoided.`); (typeof file === "string" ? file : typeof filenameTemplate === "string" - ? filenameTemplate - : ""); + ? filenameTemplate + : ""); this.errors.push(new ChunkRenderError(chunk, filename, err)); inTry = false; @@ -4607,7 +4615,7 @@ This prevents using hashes of each other and should be avoided.`); ? { ...pathAndInfo.info, ...fileManifest.info - } + } : pathAndInfo.info; } @@ -4927,7 +4935,8 @@ This prevents using hashes of each other and should be avoided.`); hashFunction, runtimeTemplate, hashDigest, - hashDigestLength + hashDigestLength, + errors ); } diff --git a/lib/Compiler.js b/lib/Compiler.js index 7cc074860b9..685a93c72d4 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -228,6 +228,8 @@ class Compiler { /** @type {Set} */ this.managedPaths = new Set(); /** @type {Set} */ + this.unmanagedPaths = new Set(); + /** @type {Set} */ this.immutablePaths = new Set(); /** @type {ReadonlySet | undefined} */ @@ -381,6 +383,17 @@ class Compiler { // e.g. move compilation specific info from Modules into ModuleGraph _cleanupLastCompilation() { if (this._lastCompilation !== undefined) { + for (const childCompilation of this._lastCompilation.children) { + for (const module of childCompilation.modules) { + ChunkGraph.clearChunkGraphForModule(module); + ModuleGraph.clearModuleGraphForModule(module); + module.cleanupForCache(); + } + for (const chunk of childCompilation.chunks) { + ChunkGraph.clearChunkGraphForChunk(chunk); + } + } + for (const module of this._lastCompilation.modules) { ChunkGraph.clearChunkGraphForModule(module); ModuleGraph.clearModuleGraphForModule(module); diff --git a/lib/ConcatenationScope.js b/lib/ConcatenationScope.js index 8c26166b153..aa8a0ed7189 100644 --- a/lib/ConcatenationScope.js +++ b/lib/ConcatenationScope.js @@ -114,8 +114,8 @@ class ConcatenationScope { const asiSafeFlag = asiSafe ? "_asiSafe1" : asiSafe === false - ? "_asiSafe0" - : ""; + ? "_asiSafe0" + : ""; const exportData = ids ? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex") : "ns"; diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 2100481f2ac..d39f8f88098 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -509,8 +509,8 @@ class ContextModule extends Module { this.context ? [this.context] : typeof this.options.resource === "string" - ? [this.options.resource] - : /** @type {string[]} */ (this.options.resource), + ? [this.options.resource] + : /** @type {string[]} */ (this.options.resource), null, SNAPSHOT_OPTIONS, (err, snapshot) => { @@ -947,8 +947,8 @@ module.exports = webpackAsyncContext;`; const requestPrefix = hasNoChunk ? "Promise.resolve()" : hasMultipleOrNoChunks - ? `Promise.all(ids.slice(${chunksStartPosition}).map(${RuntimeGlobals.ensureChunk}))` - : `${RuntimeGlobals.ensureChunk}(ids[${chunksStartPosition}])`; + ? `Promise.all(ids.slice(${chunksStartPosition}).map(${RuntimeGlobals.ensureChunk}))` + : `${RuntimeGlobals.ensureChunk}(ids[${chunksStartPosition}])`; const returnModuleObject = this.getReturnModuleObjectSource( fakeMap, true, diff --git a/lib/ContextModuleFactory.js b/lib/ContextModuleFactory.js index b30447b8788..65a2131bc69 100644 --- a/lib/ContextModuleFactory.js +++ b/lib/ContextModuleFactory.js @@ -160,7 +160,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory { resolveOptions || EMPTY_RESOLVE_OPTIONS, "dependencyType", dependencies[0].category - ) + ) : resolveOptions ); const loaderResolver = this.resolverFactory.get("loader"); diff --git a/lib/DependencyTemplate.js b/lib/DependencyTemplate.js index 67a4d7b8305..b568d0c0ebe 100644 --- a/lib/DependencyTemplate.js +++ b/lib/DependencyTemplate.js @@ -26,10 +26,12 @@ * @property {ChunkGraph} chunkGraph the chunk graph * @property {Set} runtimeRequirements the requirements for runtime * @property {Module} module current module - * @property {RuntimeSpec} runtime current runtimes, for which code is generated + * @property {RuntimeSpec} runtime current runtime, for which code is generated + * @property {RuntimeSpec[]} [runtimes] current runtimes, for which code is generated * @property {InitFragment[]} initFragments mutable array of init fragments for the current module * @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules * @property {CodeGenerationResults} codeGenerationResults the code generation results + * @property {InitFragment[]} chunkInitFragments chunkInitFragments */ /** diff --git a/lib/EnvironmentNotSupportAsyncWarning.js b/lib/EnvironmentNotSupportAsyncWarning.js new file mode 100644 index 00000000000..1a1ea9ece66 --- /dev/null +++ b/lib/EnvironmentNotSupportAsyncWarning.js @@ -0,0 +1,52 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Gengkun He @ahabhgk +*/ + +"use strict"; + +const WebpackError = require("./WebpackError"); +const makeSerializable = require("./util/makeSerializable"); + +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ +/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ +/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ +/** @typedef {"asyncWebAssembly" | "topLevelAwait" | "external promise" | "external script" | "external import" | "external module"} Feature */ + +class EnvironmentNotSupportAsyncWarning extends WebpackError { + /** + * Creates an instance of EnvironmentNotSupportAsyncWarning. + * @param {Module} module module + * @param {Feature} feature feature + */ + constructor(module, feature) { + const message = `The generated code contains 'async/await' because this module is using "${feature}". +However, your target environment does not appear to support 'async/await'. +As a result, the code may not run as expected or may cause runtime errors.`; + super(message); + + this.name = "EnvironmentNotSupportAsyncWarning"; + this.module = module; + } + + /** + * Creates an instance of EnvironmentNotSupportAsyncWarning. + * @param {Module} module module + * @param {RuntimeTemplate} runtimeTemplate compilation + * @param {Feature} feature feature + */ + static check(module, runtimeTemplate, feature) { + if (!runtimeTemplate.supportsAsyncFunction()) { + module.addWarning(new EnvironmentNotSupportAsyncWarning(module, feature)); + } + } +} + +makeSerializable( + EnvironmentNotSupportAsyncWarning, + "webpack/lib/EnvironmentNotSupportAsyncWarning" +); + +module.exports = EnvironmentNotSupportAsyncWarning; diff --git a/lib/EvalDevToolModulePlugin.js b/lib/EvalDevToolModulePlugin.js index b0a47db88f7..003080806d5 100644 --- a/lib/EvalDevToolModulePlugin.js +++ b/lib/EvalDevToolModulePlugin.js @@ -82,7 +82,7 @@ class EvalDevToolModulePlugin { compilation.outputOptions.trustedTypes ? `${RuntimeGlobals.createScript}(${JSON.stringify( content + footer - )})` + )})` : JSON.stringify(content + footer) });` ); diff --git a/lib/EvalSourceMapDevToolPlugin.js b/lib/EvalSourceMapDevToolPlugin.js index b3803b11ddb..6cbd7035b79 100644 --- a/lib/EvalSourceMapDevToolPlugin.js +++ b/lib/EvalSourceMapDevToolPlugin.js @@ -182,7 +182,7 @@ class EvalSourceMapDevToolPlugin { compilation.outputOptions.trustedTypes ? `${RuntimeGlobals.createScript}(${JSON.stringify( content + footer - )})` + )})` : JSON.stringify(content + footer) });` ) diff --git a/lib/ExportsInfoApiPlugin.js b/lib/ExportsInfoApiPlugin.js index 5d469f6bfe9..faf4594bbd0 100644 --- a/lib/ExportsInfoApiPlugin.js +++ b/lib/ExportsInfoApiPlugin.js @@ -48,12 +48,12 @@ class ExportsInfoApiPlugin { /** @type {Range} */ (expr.range), members.slice(0, -1), members[members.length - 1] - ) + ) : new ExportsInfoDependency( /** @type {Range} */ (expr.range), null, members[0] - ); + ); dep.loc = /** @type {DependencyLocation} */ (expr.loc); parser.state.module.addDependency(dep); return true; diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index 7f00a20a975..a8fb263bf0c 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -7,6 +7,7 @@ const { OriginalSource, RawSource } = require("webpack-sources"); const ConcatenationScope = require("./ConcatenationScope"); +const EnvironmentNotSupportAsyncWarning = require("./EnvironmentNotSupportAsyncWarning"); const { UsageState } = require("./ExportsInfo"); const InitFragment = require("./InitFragment"); const Module = require("./Module"); @@ -217,7 +218,12 @@ register( } ); -const generateModuleRemapping = (input, exportsInfo, runtime) => { +const generateModuleRemapping = ( + input, + exportsInfo, + runtime, + runtimeTemplate +) => { if (exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused) { const properties = []; for (const exportInfo of exportsInfo.orderedExports) { @@ -235,9 +241,9 @@ const generateModuleRemapping = (input, exportsInfo, runtime) => { } } properties.push( - `[${JSON.stringify(used)}]: () => ${input}${propertyAccess([ - exportInfo.name - ])}` + `[${JSON.stringify(used)}]: ${runtimeTemplate.returningFunction( + `${input}${propertyAccess([exportInfo.name])}` + )}` ); } return `x({ ${properties.join(", ")} })`; @@ -248,21 +254,21 @@ const generateModuleRemapping = (input, exportsInfo, runtime) => { * @param {string|string[]} moduleAndSpecifiers the module request * @param {ExportsInfo} exportsInfo exports info of this module * @param {RuntimeSpec} runtime the runtime - * @param {string | HashConstructor=} hashFunction the hash function to use + * @param {RuntimeTemplate} runtimeTemplate the runtime template * @returns {SourceData} the generated source */ const getSourceForModuleExternal = ( moduleAndSpecifiers, exportsInfo, runtime, - hashFunction + runtimeTemplate ) => { if (!Array.isArray(moduleAndSpecifiers)) moduleAndSpecifiers = [moduleAndSpecifiers]; const initFragment = new ModuleExternalInitFragment( moduleAndSpecifiers[0], undefined, - hashFunction + runtimeTemplate.outputOptions.hashFunction ); const baseAccess = `${initFragment.getNamespaceIdentifier()}${propertyAccess( moduleAndSpecifiers, @@ -271,12 +277,19 @@ const getSourceForModuleExternal = ( const moduleRemapping = generateModuleRemapping( baseAccess, exportsInfo, - runtime + runtime, + runtimeTemplate ); let expression = moduleRemapping || baseAccess; return { expression, - init: `var x = y => { var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x; }\nvar y = x => () => x`, + init: `var x = ${runtimeTemplate.basicFunction( + "y", + `var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x` + )} \nvar y = ${runtimeTemplate.returningFunction( + runtimeTemplate.returningFunction("x"), + "x" + )}`, runtimeRequirements: moduleRemapping ? RUNTIME_REQUIREMENTS_FOR_MODULE : undefined, @@ -355,7 +368,7 @@ const getSourceForAmdOrUmdExternal = ( externalVariable, Array.isArray(request) ? request.join(".") : request, runtimeTemplate - ) + ) : undefined, expression: externalVariable }; @@ -491,6 +504,11 @@ class ExternalModule extends Module { } } else { this.buildMeta.async = true; + EnvironmentNotSupportAsyncWarning.check( + this, + compilation.runtimeTemplate, + "external module" + ); if (!Array.isArray(request) || request.length === 1) { this.buildMeta.exportsType = "namespace"; canMangle = false; @@ -498,11 +516,28 @@ class ExternalModule extends Module { } break; case "script": + this.buildMeta.async = true; + EnvironmentNotSupportAsyncWarning.check( + this, + compilation.runtimeTemplate, + "external script" + ); + break; case "promise": this.buildMeta.async = true; + EnvironmentNotSupportAsyncWarning.check( + this, + compilation.runtimeTemplate, + "external promise" + ); break; case "import": this.buildMeta.async = true; + EnvironmentNotSupportAsyncWarning.check( + this, + compilation.runtimeTemplate, + "external import" + ); if (!Array.isArray(request) || request.length === 1) { this.buildMeta.exportsType = "namespace"; canMangle = false; @@ -569,7 +604,7 @@ class ExternalModule extends Module { ? getSourceForCommonJsExternalInNodeModule( request, runtimeTemplate.outputOptions.importMetaName - ) + ) : getSourceForCommonJsExternal(request); case "amd": case "amd-require": @@ -610,7 +645,7 @@ class ExternalModule extends Module { request, moduleGraph.getExportsInfo(this), runtime, - runtimeTemplate.outputOptions.hashFunction + runtimeTemplate ); } case "var": diff --git a/lib/ExternalModuleFactoryPlugin.js b/lib/ExternalModuleFactoryPlugin.js index 5dae85c7184..bd917ba49b4 100644 --- a/lib/ExternalModuleFactoryPlugin.js +++ b/lib/ExternalModuleFactoryPlugin.js @@ -192,7 +192,7 @@ class ExternalModuleFactoryPlugin { data.resolveOptions || EMPTY_RESOLVE_OPTIONS, "dependencyType", dependencyType - ) + ) : data.resolveOptions ); if (options) resolver = resolver.withOptions(options); diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index df01c158c12..59bf473368c 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -729,7 +729,8 @@ class SnapshotOptimization { } const parseString = str => { - if (str[0] === "'") str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`; + if (str[0] === "'" || str[0] === "`") + str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`; return JSON.parse(str); }; @@ -898,6 +899,7 @@ class FileSystemInfo { /** * @param {InputFileSystem} fs file system * @param {Object} options options + * @param {Iterable=} options.unmanagedPaths paths that are not managed by a package manager and the contents are subject to change * @param {Iterable=} options.managedPaths paths that are only managed by a package manager * @param {Iterable=} options.immutablePaths paths that are immutable * @param {Logger=} options.logger logger used to log invalid snapshots @@ -906,6 +908,7 @@ class FileSystemInfo { constructor( fs, { + unmanagedPaths = [], managedPaths = [], immutablePaths = [], logger, @@ -1040,6 +1043,14 @@ class FileSystemInfo { parallelism: 10, processor: this._getManagedItemDirectoryInfo.bind(this) }); + const _unmanagedPaths = Array.from(unmanagedPaths); + this.unmanagedPathsWithSlash = /** @type {string[]} */ ( + _unmanagedPaths.filter(p => typeof p === "string") + ).map(p => join(fs, p, "_").slice(0, -1)); + this.unmanagedPathsRegExps = /** @type {RegExp[]} */ ( + _unmanagedPaths.filter(p => typeof p !== "string") + ); + this.managedPaths = Array.from(managedPaths); this.managedPathsWithSlash = /** @type {string[]} */ ( this.managedPaths.filter(p => typeof p === "string") @@ -1733,7 +1744,7 @@ class FileSystemInfo { type: RBDT_RESOLVE_ESM_FILE, context, path: dependency, - expected: undefined, + expected: imp.d > -1 ? false : undefined, issuer: job }); } catch (e) { @@ -2028,6 +2039,12 @@ class FileSystemInfo { } }; const checkManaged = (path, managedSet) => { + for (const unmanagedPath of this.unmanagedPathsRegExps) { + if (unmanagedPath.test(path)) return false; + } + for (const unmanagedPath of this.unmanagedPathsWithSlash) { + if (path.startsWith(unmanagedPath)) return false; + } for (const immutablePath of this.immutablePathsRegExps) { if (immutablePath.test(path)) { managedSet.add(path); @@ -3346,7 +3363,7 @@ class FileSystemInfo { : { ...timestamp, ...hash - }; + }; this._contextTshs.set(path, result); callback(null, result); }; diff --git a/lib/FlagDependencyExportsPlugin.js b/lib/FlagDependencyExportsPlugin.js index defbf3781a8..9befc25447a 100644 --- a/lib/FlagDependencyExportsPlugin.js +++ b/lib/FlagDependencyExportsPlugin.js @@ -246,7 +246,7 @@ class FlagDependencyExportsPlugin { from, fromExport === undefined ? [name] : fromExport, priority - )) + )) ) { changed = true; } diff --git a/lib/Generator.js b/lib/Generator.js index ffa93230ac4..76099c44e77 100644 --- a/lib/Generator.js +++ b/lib/Generator.js @@ -27,6 +27,7 @@ * @property {ChunkGraph} chunkGraph the chunk graph * @property {Set} runtimeRequirements the requirements for runtime * @property {RuntimeSpec} runtime the runtime + * @property {RuntimeSpec[]} [runtimes] the runtimes * @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 diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 9e117403c68..6a8eb98e10d 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -447,7 +447,7 @@ class HotModuleReplacementPlugin { : compilation.codeGenerationResults.getHash( module, chunk.runtime - ); + ); if (records.chunkModuleHashes[key] !== hash) { updatedModules.add(module, chunk); } @@ -571,7 +571,7 @@ class HotModuleReplacementPlugin { : compilation.codeGenerationResults.getHash( module, newRuntime - ); + ); if (hash !== oldHash) { if (module.type === WEBPACK_MODULE_TYPE_RUNTIME) { newRuntimeModules = newRuntimeModules || []; @@ -735,7 +735,7 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename Array.from(removedModules, m => chunkGraph.getModuleId(m) ) - ) + ) }; const source = new RawSource(JSON.stringify(hotUpdateMainJson)); diff --git a/lib/LibManifestPlugin.js b/lib/LibManifestPlugin.js index 32939ed46d6..e3d5c3ec3f5 100644 --- a/lib/LibManifestPlugin.js +++ b/lib/LibManifestPlugin.js @@ -46,7 +46,10 @@ class LibManifestPlugin { */ apply(compiler) { compiler.hooks.emit.tapAsync( - "LibManifestPlugin", + { + name: "LibManifestPlugin", + stage: 110 + }, (compilation, callback) => { const moduleGraph = compilation.moduleGraph; asyncLib.forEach( diff --git a/lib/Module.js b/lib/Module.js index 7d8ebf4dcd3..5f05a848545 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -59,7 +59,8 @@ const makeSerializable = require("./util/makeSerializable"); * @property {RuntimeTemplate} runtimeTemplate the runtime template * @property {ModuleGraph} moduleGraph the module graph * @property {ChunkGraph} chunkGraph the chunk graph - * @property {RuntimeSpec} runtime the runtimes code should be generated for + * @property {RuntimeSpec} runtime the runtime code should be generated for + * @property {RuntimeSpec[]} [runtimes] the runtimes code should be generated for * @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 {Compilation=} compilation the compilation diff --git a/lib/ModuleFilenameHelpers.js b/lib/ModuleFilenameHelpers.js index 236c7ec8df8..949a011ee21 100644 --- a/lib/ModuleFilenameHelpers.js +++ b/lib/ModuleFilenameHelpers.js @@ -162,7 +162,7 @@ ModuleFilenameHelpers.createFilename = ( ? options : { moduleFilenameTemplate: options - }) + }) }; let absoluteResourcePath; diff --git a/lib/ModuleInfoHeaderPlugin.js b/lib/ModuleInfoHeaderPlugin.js index 2ee0b2a8122..0ed0f2527aa 100644 --- a/lib/ModuleInfoHeaderPlugin.js +++ b/lib/ModuleInfoHeaderPlugin.js @@ -96,7 +96,7 @@ const printExportsInfoToSource = ( .map(e => JSON.stringify(e).slice(1, -1)) .join(".")}` : "" - }` + }` : "" }` ) + "\n" diff --git a/lib/MultiStats.js b/lib/MultiStats.js index d236aef43f4..4f443bdb42b 100644 --- a/lib/MultiStats.js +++ b/lib/MultiStats.js @@ -59,8 +59,8 @@ class MultiStats { ...(typeof childOptions === "string" ? { preset: childOptions } : childOptions && typeof childOptions === "object" - ? childOptions - : undefined) + ? childOptions + : undefined) }, context ); diff --git a/lib/NodeStuffPlugin.js b/lib/NodeStuffPlugin.js index 4f288068666..16becbfbf42 100644 --- a/lib/NodeStuffPlugin.js +++ b/lib/NodeStuffPlugin.js @@ -13,6 +13,7 @@ const NodeStuffInWebError = require("./NodeStuffInWebError"); const RuntimeGlobals = require("./RuntimeGlobals"); const CachedConstDependency = require("./dependencies/CachedConstDependency"); const ConstDependency = require("./dependencies/ConstDependency"); +const ExternalModuleDependency = require("./dependencies/ExternalModuleDependency"); const { evaluateToString, expressionIsUnsupported @@ -52,6 +53,11 @@ class NodeStuffPlugin { compiler.hooks.compilation.tap( PLUGIN_NAME, (compilation, { normalModuleFactory }) => { + compilation.dependencyTemplates.set( + ExternalModuleDependency, + new ExternalModuleDependency.Template() + ); + /** * @param {JavascriptParser} parser the parser * @param {JavascriptParserOptions} parserOptions options @@ -128,6 +134,35 @@ class NodeStuffPlugin { }); }; + /** + * @param {string} expressionName expression name + * @param {(value: string) => void} fn function + * @returns {void} + */ + const setUrlModuleConstant = (expressionName, fn) => { + parser.hooks.expression + .for(expressionName) + .tap(PLUGIN_NAME, expr => { + const dep = new ExternalModuleDependency( + "url", + [ + { + name: "fileURLToPath", + value: "__webpack_fileURLToPath__" + } + ], + undefined, + fn("__webpack_fileURLToPath__"), + expr.range, + expressionName + ); + dep.loc = expr.loc; + parser.state.module.addPresentationalDependency(dep); + + return true; + }); + }; + /** * @param {string} expressionName expression name * @param {string} value value @@ -150,6 +185,12 @@ class NodeStuffPlugin { "__filename is a Node.js feature and isn't available in browsers." ); break; + case "node-module": + setUrlModuleConstant( + "__filename", + functionName => `${functionName}(import.meta.url)` + ); + break; case true: setModuleConstant("__filename", module => relative(compiler.inputFileSystem, context, module.resource) @@ -177,6 +218,13 @@ class NodeStuffPlugin { "__dirname is a Node.js feature and isn't available in browsers." ); break; + case "node-module": + setUrlModuleConstant( + "__dirname", + functionName => + `${functionName}(import.meta.url + "/..").slice(0, -1)` + ); + break; case true: setModuleConstant("__dirname", module => relative(compiler.inputFileSystem, context, module.context) diff --git a/lib/NormalModule.js b/lib/NormalModule.js index 87b78f30f06..fa0cc1fac1f 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -132,14 +132,14 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { const mapper = !sourceRoot ? source => source : sourceRoot.endsWith("/") - ? source => - source.startsWith("/") - ? `${sourceRoot.slice(0, -1)}${source}` - : `${sourceRoot}${source}` - : source => - source.startsWith("/") - ? `${sourceRoot}${source}` - : `${sourceRoot}/${source}`; + ? source => + source.startsWith("/") + ? `${sourceRoot.slice(0, -1)}${source}` + : `${sourceRoot}${source}` + : source => + source.startsWith("/") + ? `${sourceRoot}${source}` + : `${sourceRoot}/${source}`; const newSources = sourceMap.sources.map(source => contextifySourceUrl(context, mapper(source), associatedObjectForCache) ); @@ -782,7 +782,7 @@ class NormalModule extends Module { currentLoader ? compilation.runtimeTemplate.requestShortener.shorten( currentLoader.loader - ) + ) : "unknown" }) didn't return a Buffer or String` ); @@ -1181,6 +1181,7 @@ class NormalModule extends Module { moduleGraph, chunkGraph, runtime, + runtimes, concatenationScope, codeGenerationResults, sourceTypes @@ -1204,7 +1205,7 @@ class NormalModule extends Module { const source = this.error ? new RawSource( "throw new Error(" + JSON.stringify(this.error.message) + ");" - ) + ) : this.generator.generate(this, { dependencyTemplates, runtimeTemplate, @@ -1212,11 +1213,12 @@ class NormalModule extends Module { chunkGraph, runtimeRequirements, runtime, + runtimes, concatenationScope, codeGenerationResults, getData, type - }); + }); if (source) { sources.set(type, new CachedSource(source)); diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js index a0d8b767f2f..9b28c778c38 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -411,8 +411,8 @@ class NormalModuleFactory extends ModuleFactory { noPreAutoLoaders || noPrePostAutoLoaders ? 2 : noAutoLoaders - ? 1 - : 0 + ? 1 + : 0 ) .split(/!+/); unresolvedResource = rawElements.pop(); @@ -676,7 +676,7 @@ class NormalModuleFactory extends ModuleFactory { resolveOptions || EMPTY_RESOLVE_OPTIONS, "dependencyType", dependencyType - ) + ) : resolveOptions ); this.resolveResource( @@ -1063,10 +1063,10 @@ If changing the source code is not an option there is also a resolve options cal const type = /\.mjs$/i.test(parsedResult.path) ? "module" : /\.cjs$/i.test(parsedResult.path) - ? "commonjs" - : resolveRequest.descriptionFileData === undefined - ? undefined - : resolveRequest.descriptionFileData.type; + ? "commonjs" + : resolveRequest.descriptionFileData === undefined + ? undefined + : resolveRequest.descriptionFileData.type; const resolved = { loader: parsedResult.path, diff --git a/lib/RuntimeTemplate.js b/lib/RuntimeTemplate.js index e4b6a141c7b..692ded112c5 100644 --- a/lib/RuntimeTemplate.js +++ b/lib/RuntimeTemplate.js @@ -102,6 +102,10 @@ class RuntimeTemplate { return this.outputOptions.environment.arrowFunction; } + supportsAsyncFunction() { + return this.outputOptions.environment.asyncFunction; + } + supportsOptionalChaining() { return this.outputOptions.environment.optionalChaining; } @@ -222,7 +226,7 @@ class RuntimeTemplate { ? `var [${items.join(", ")}] = ${value};` : Template.asString( items.map((item, i) => `var ${item} = ${value}[${i}];`) - ); + ); } destructureObject(items, value) { @@ -230,7 +234,7 @@ class RuntimeTemplate { ? `var {${items.join(", ")}} = ${value};` : Template.asString( items.map(item => `var ${item} = ${value}${propertyAccess([item])};`) - ); + ); } iife(args, body) { @@ -242,7 +246,7 @@ class RuntimeTemplate { ? `for(const ${variable} of ${array}) {\n${Template.indent(body)}\n}` : `${array}.forEach(function(${variable}) {\n${Template.indent( body - )}\n});`; + )}\n});`; } /** @@ -343,10 +347,10 @@ class RuntimeTemplate { moduleId === null ? JSON.stringify("Module is not available (weak dependency)") : idExpr - ? `"Module '" + ${idExpr} + "' is not available (weak dependency)"` - : JSON.stringify( - `Module '${moduleId}' is not available (weak dependency)` - ); + ? `"Module '" + ${idExpr} + "' is not available (weak dependency)"` + : JSON.stringify( + `Module '${moduleId}' is not available (weak dependency)` + ); const comment = request ? Template.toNormalComment(request) + " " : ""; const errorStatements = `var e = new Error(${errorMessage}); ` + @@ -840,8 +844,8 @@ class RuntimeTemplate { return asiSafe ? `(${importVar}_default()${propertyAccess(exportName, 1)})` : asiSafe === false - ? `;(${importVar}_default()${propertyAccess(exportName, 1)})` - : `${importVar}_default.a${propertyAccess(exportName, 1)}`; + ? `;(${importVar}_default()${propertyAccess(exportName, 1)})` + : `${importVar}_default.a${propertyAccess(exportName, 1)}`; } case "default-only": case "default-with-named": @@ -898,8 +902,8 @@ class RuntimeTemplate { return asiSafe ? `(0,${access})` : asiSafe === false - ? `;(0,${access})` - : `/*#__PURE__*/Object(${access})`; + ? `;(0,${access})` + : `/*#__PURE__*/Object(${access})`; } return access; } else { diff --git a/lib/SourceMapDevToolPlugin.js b/lib/SourceMapDevToolPlugin.js index 2bbad9ca88e..608fe302463 100644 --- a/lib/SourceMapDevToolPlugin.js +++ b/lib/SourceMapDevToolPlugin.js @@ -486,7 +486,7 @@ class SourceMapDevToolPlugin { outputFs, `/${options.fileContext}`, `/${filename}` - ) + ) : filename, contentHash: sourceMapContentHash }; @@ -501,7 +501,7 @@ class SourceMapDevToolPlugin { outputFs, dirname(outputFs, `/${file}`), `/${sourceMapFile}` - ); + ); /** @type {Source} */ let asset = new RawSource(source); if (currentSourceMappingURLComment !== false) { diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index b5a4867de96..4ba16055767 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -307,7 +307,7 @@ class WebpackOptionsApply extends OptionsApply { if (options.experiments.css) { const CssModulesPlugin = require("./css/CssModulesPlugin"); - new CssModulesPlugin(options.experiments.css).apply(compiler); + new CssModulesPlugin().apply(compiler); } if (options.experiments.lazyCompilation) { @@ -329,7 +329,7 @@ class WebpackOptionsApply extends OptionsApply { options.externalsPresets.node ? "node" : "web" }.js` ) - }), + }), entries: !lazyOptions || lazyOptions.entries !== false, imports: !lazyOptions || lazyOptions.imports !== false, test: (lazyOptions && lazyOptions.test) || undefined @@ -588,7 +588,8 @@ class WebpackOptionsApply extends OptionsApply { const AddManagedPathsPlugin = require("./cache/AddManagedPathsPlugin"); new AddManagedPathsPlugin( options.snapshot.managedPaths, - options.snapshot.immutablePaths + options.snapshot.immutablePaths, + options.snapshot.unmanagedPaths ).apply(compiler); if (options.cache && typeof options.cache === "object") { diff --git a/lib/asset/AssetModulesPlugin.js b/lib/asset/AssetModulesPlugin.js index 9ab0157b6c9..f77fc82885b 100644 --- a/lib/asset/AssetModulesPlugin.js +++ b/lib/asset/AssetModulesPlugin.js @@ -208,9 +208,8 @@ class AssetModulesPlugin { codeGenResult.data.get("fullContentHash") }); } catch (e) { - /** @type {Error} */ ( - e - ).message += `\nduring rendering of asset ${module.identifier()}`; + /** @type {Error} */ (e).message += + `\nduring rendering of asset ${module.identifier()}`; throw e; } } diff --git a/lib/cache/AddManagedPathsPlugin.js b/lib/cache/AddManagedPathsPlugin.js index 702aa6c6b0b..d8e860f5272 100644 --- a/lib/cache/AddManagedPathsPlugin.js +++ b/lib/cache/AddManagedPathsPlugin.js @@ -11,10 +11,12 @@ class AddManagedPathsPlugin { /** * @param {Iterable} managedPaths list of managed paths * @param {Iterable} immutablePaths list of immutable paths + * @param {Iterable} unmanagedPaths list of unmanaged paths */ - constructor(managedPaths, immutablePaths) { + constructor(managedPaths, immutablePaths, unmanagedPaths) { this.managedPaths = new Set(managedPaths); this.immutablePaths = new Set(immutablePaths); + this.unmanagedPaths = new Set(unmanagedPaths); } /** @@ -29,6 +31,9 @@ class AddManagedPathsPlugin { for (const immutablePath of this.immutablePaths) { compiler.immutablePaths.add(immutablePath); } + for (const unmanagedPath of this.unmanagedPaths) { + compiler.unmanagedPaths.add(unmanagedPath); + } } } diff --git a/lib/cache/IdleFileCachePlugin.js b/lib/cache/IdleFileCachePlugin.js index 8a82644fe29..2f913331c61 100644 --- a/lib/cache/IdleFileCachePlugin.js +++ b/lib/cache/IdleFileCachePlugin.js @@ -199,11 +199,18 @@ class IdleFileCachePlugin { }s.` ); } - idleTimer = setTimeout(() => { - idleTimer = undefined; - isIdle = true; - resolvedPromise.then(processIdleTasks); - }, Math.min(isInitialStore ? idleTimeoutForInitialStore : Infinity, isLargeChange ? idleTimeoutAfterLargeChanges : Infinity, idleTimeout)); + idleTimer = setTimeout( + () => { + idleTimer = undefined; + isIdle = true; + resolvedPromise.then(processIdleTasks); + }, + Math.min( + isInitialStore ? idleTimeoutForInitialStore : Infinity, + isLargeChange ? idleTimeoutAfterLargeChanges : Infinity, + idleTimeout + ) + ); idleTimer.unref(); } ); diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index 3462e914c40..be0a6a56cb9 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -539,7 +539,7 @@ class Pack { map.set(identifier, content.content.get(identifier)); } return new PackContentItems(map); - }) + }) : undefined; } } @@ -1046,8 +1046,8 @@ class PackFileCacheStrategy { compression === "brotli" ? ".pack.br" : compression === "gzip" - ? ".pack.gz" - : ".pack"; + ? ".pack.gz" + : ".pack"; this.snapshot = snapshot; /** @type {Set} */ this.buildDependencies = new Set(); diff --git a/lib/cache/ResolverCachePlugin.js b/lib/cache/ResolverCachePlugin.js index 4659d617a3c..b402731d26c 100644 --- a/lib/cache/ResolverCachePlugin.js +++ b/lib/cache/ResolverCachePlugin.js @@ -264,7 +264,7 @@ class ResolverCachePlugin { yields = undefined; callbacks = false; } - } + } : (err, result) => { if (callbacks === undefined) { callback(err, result); @@ -276,7 +276,7 @@ class ResolverCachePlugin { activeRequests.delete(identifier); callbacks = false; } - }; + }; /** * @param {Error=} err error if any * @param {CacheEntry=} cacheEntry cache entry diff --git a/lib/config/browserslistTargetHandler.js b/lib/config/browserslistTargetHandler.js index 6a0e8a739cb..77f0d4aab73 100644 --- a/lib/config/browserslistTargetHandler.js +++ b/lib/config/browserslistTargetHandler.js @@ -60,11 +60,11 @@ const load = (input, context) => { const config = query ? query : configPath - ? browserslist.loadConfig({ - config: configPath, - env - }) - : browserslist.loadConfig({ path: context, env }); + ? browserslist.loadConfig({ + config: configPath, + env + }) + : browserslist.loadConfig({ path: context, env }); if (!config) return; return browserslist(config); @@ -310,6 +310,25 @@ const resolve = browsers => { kaios: [2, 5], node: 4 }), + asyncFunction: rawChecker({ + chrome: 55, + and_chr: 55, + edge: 15, + firefox: 52, + and_ff: 52, + // ie: Not supported, + opera: 42, + op_mob: 42, + safari: [10, 1], + ios_saf: [10, 3], + samsung: 6, + android: 55, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support + node: [7, 6] + }), browser: browserProperty, electron: false, node: nodeProperty, diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 097e62ea0e0..6ad22ad0a11 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -29,7 +29,8 @@ const { /** @typedef {import("../../declarations/WebpackOptions").CacheOptionsNormalized} CacheOptions */ /** @typedef {import("../../declarations/WebpackOptions").Context} Context */ -/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ +/** @typedef {import("../../declarations/WebpackOptions").CssGeneratorOptions} CssGeneratorOptions */ +/** @typedef {import("../../declarations/WebpackOptions").CssParserOptions} CssParserOptions */ /** @typedef {import("../../declarations/WebpackOptions").EntryDescription} EntryDescription */ /** @typedef {import("../../declarations/WebpackOptions").EntryNormalized} Entry */ /** @typedef {import("../../declarations/WebpackOptions").EntryStaticNormalized} EntryStaticNormalized */ @@ -39,6 +40,7 @@ const { /** @typedef {import("../../declarations/WebpackOptions").ExternalsPresets} ExternalsPresets */ /** @typedef {import("../../declarations/WebpackOptions").ExternalsType} ExternalsType */ /** @typedef {import("../../declarations/WebpackOptions").FileCacheOptions} FileCacheOptions */ +/** @typedef {import("../../declarations/WebpackOptions").GeneratorOptionsByModuleTypeKnown} GeneratorOptionsByModuleTypeKnown */ /** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */ /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ /** @typedef {import("../../declarations/WebpackOptions").Library} Library */ @@ -159,11 +161,11 @@ const applyWebpackOptionsDefaults = options => { target === false ? /** @type {false} */ (false) : typeof target === "string" - ? getTargetProperties(target, /** @type {Context} */ (options.context)) - : getTargetsProperties( - /** @type {string[]} */ (target), - /** @type {Context} */ (options.context) - ); + ? getTargetProperties(target, /** @type {Context} */ (options.context)) + : getTargetsProperties( + /** @type {string[]} */ (target), + /** @type {Context} */ (options.context) + ); const development = mode === "development"; const production = mode === "production" || !mode; @@ -223,7 +225,8 @@ const applyWebpackOptionsDefaults = options => { /** @type {NonNullable} */ (options.experiments.css), futureDefaults, - isNode: targetProperties && targetProperties.node === true + isNode: targetProperties && targetProperties.node === true, + targetProperties }); applyOutputDefaults(options.output, { @@ -260,14 +263,15 @@ const applyWebpackOptionsDefaults = options => { validExternalTypes.includes(options.output.library.type) ? /** @type {ExternalsType} */ (options.output.library.type) : options.output.module - ? "module" - : "var"; + ? "module" + : "var"; }); applyNodeDefaults(options.node, { futureDefaults: /** @type {NonNullable} */ (options.experiments.futureDefaults), + outputModule: options.output.module, targetProperties }); @@ -335,7 +339,7 @@ const applyExperimentsDefaults = ( D(experiments, "lazyCompilation", undefined); D(experiments, "buildHttp", undefined); D(experiments, "cacheUnaffected", experiments.futureDefaults); - F(experiments, "css", () => (experiments.futureDefaults ? {} : undefined)); + F(experiments, "css", () => (experiments.futureDefaults ? true : undefined)); // TODO webpack 6: remove this. topLevelAwait should be enabled by default let shouldEnableTopLevelAwait = true; @@ -348,14 +352,6 @@ const applyExperimentsDefaults = ( D(experiments.buildHttp, "frozen", production); D(experiments.buildHttp, "upgrade", false); } - - if (typeof experiments.css === "object") { - D( - experiments.css, - "exportsOnly", - !targetProperties || !targetProperties.document - ); - } }; /** @@ -448,7 +444,7 @@ const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => { process.versions.pnp === "3" ? [ /^(.+?(?:[\\/]\.yarn[\\/]unplugged[\\/][^\\/]+)?[\\/]node_modules[\\/])/ - ] + ] : [/^(.+?[\\/]node_modules[\\/])/] ); F(snapshot, "immutablePaths", () => @@ -468,7 +464,6 @@ const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => { } } else { const match = /^(.+?[\\/]node_modules[\\/])/.exec( - // eslint-disable-next-line node/no-extraneous-require require.resolve("watchpack") ); if (match) { @@ -543,20 +538,46 @@ const applyJavascriptParserOptionsDefaults = ( if (futureDefaults) D(parserOptions, "exportsPresence", "error"); }; +/** + * @param {CssGeneratorOptions} generatorOptions generator options + * @param {Object} options options + * @param {TargetProperties | false} options.targetProperties target properties + * @returns {void} + */ +const applyCssGeneratorOptionsDefaults = ( + generatorOptions, + { targetProperties } +) => { + D( + generatorOptions, + "exportsOnly", + !targetProperties || !targetProperties.document + ); +}; + /** * @param {ModuleOptions} module options * @param {Object} options options * @param {boolean} options.cache is caching enabled * @param {boolean} options.syncWebAssembly is syncWebAssembly enabled * @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled - * @param {CssExperimentOptions|false} options.css is css enabled + * @param {boolean} options.css is css enabled * @param {boolean} options.futureDefaults is future defaults enabled * @param {boolean} options.isNode is node target platform + * @param {TargetProperties | false} options.targetProperties target properties * @returns {void} */ const applyModuleDefaults = ( module, - { cache, syncWebAssembly, asyncWebAssembly, css, futureDefaults, isNode } + { + cache, + syncWebAssembly, + asyncWebAssembly, + css, + futureDefaults, + isNode, + targetProperties + } ) => { if (cache) { D( @@ -607,6 +628,20 @@ const applyModuleDefaults = ( } ); + if (css) { + F(module.parser, "css", () => ({})); + + D(module.parser.css, "namedExports", true); + + F(module.generator, "css", () => ({})); + + applyCssGeneratorOptionsDefaults( + /** @type {NonNullable} */ + (module.generator.css), + { targetProperties } + ); + } + A(module, "defaultRules", () => { const esm = { type: JAVASCRIPT_MODULE_TYPE_ESM, @@ -818,9 +853,8 @@ const applyOutputDefaults = ( } catch (e) { if (/** @type {Error & { code: string }} */ (e).code !== "ENOENT") { /** @type {Error & { code: string }} */ - ( - e - ).message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`; + (e).message += + `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`; throw e; } return ""; @@ -870,22 +904,11 @@ const applyOutputDefaults = ( D(output, "webassemblyModuleFilename", "[hash].module.wasm"); D(output, "compareBeforeEmit", true); D(output, "charset", true); - F(output, "hotUpdateGlobal", () => - Template.toIdentifier( - "webpackHotUpdate" + - Template.toIdentifier( - /** @type {NonNullable} */ (output.uniqueName) - ) - ) - ); - F(output, "chunkLoadingGlobal", () => - Template.toIdentifier( - "webpackChunk" + - Template.toIdentifier( - /** @type {NonNullable} */ (output.uniqueName) - ) - ) + const uniqueNameId = Template.toIdentifier( + /** @type {NonNullable} */ (output.uniqueName) ); + F(output, "hotUpdateGlobal", () => "webpackHotUpdate" + uniqueNameId); + F(output, "chunkLoadingGlobal", () => "webpackChunk" + uniqueNameId); F(output, "globalObject", () => { if (tp) { if (tp.global) return "global"; @@ -1014,6 +1037,7 @@ const applyOutputDefaults = ( D(output, "hashFunction", futureDefaults ? "xxhash64" : "md4"); D(output, "hashDigest", "hex"); D(output, "hashDigestLength", futureDefaults ? 16 : 20); + D(output, "strictModuleErrorHandling", false); D(output, "strictModuleExceptionHandling", false); const environment = /** @type {Environment} */ (output.environment); @@ -1050,6 +1074,12 @@ const applyOutputDefaults = ( () => tp && optimistic(/** @type {boolean | undefined} */ (tp.arrowFunction)) ); + F( + environment, + "asyncFunction", + () => + tp && optimistic(/** @type {boolean | undefined} */ (tp.asyncFunction)) + ); F( environment, "forOf", @@ -1256,9 +1286,13 @@ const applyLoaderDefaults = (loader, { targetProperties, environment }) => { * @param {Object} options options * @param {TargetProperties | false} options.targetProperties target properties * @param {boolean} options.futureDefaults is future defaults enabled + * @param {boolean} options.outputModule is output type is module * @returns {void} */ -const applyNodeDefaults = (node, { futureDefaults, targetProperties }) => { +const applyNodeDefaults = ( + node, + { futureDefaults, outputModule, targetProperties } +) => { if (node === false) return; F(node, "global", () => { @@ -1266,16 +1300,16 @@ const applyNodeDefaults = (node, { futureDefaults, targetProperties }) => { // TODO webpack 6 should always default to false return futureDefaults ? "warn" : true; }); - F(node, "__filename", () => { - if (targetProperties && targetProperties.node) return "eval-only"; - // TODO webpack 6 should always default to false - return futureDefaults ? "warn-mock" : "mock"; - }); - F(node, "__dirname", () => { - if (targetProperties && targetProperties.node) return "eval-only"; + + const handlerForNames = () => { + if (targetProperties && targetProperties.node) + return outputModule ? "node-module" : "eval-only"; // TODO webpack 6 should always default to false return futureDefaults ? "warn-mock" : "mock"; - }); + }; + + F(node, "__filename", handlerForNames); + F(node, "__dirname", handlerForNames); }; /** @@ -1296,7 +1330,7 @@ const applyPerformanceDefaults = (performance, { production }) => { * @param {Object} options options * @param {boolean} options.production is production * @param {boolean} options.development is development - * @param {CssExperimentOptions|false} options.css is css enabled + * @param {boolean} options.css is css enabled * @param {boolean} options.records using records * @returns {void} */ @@ -1390,7 +1424,7 @@ const applyOptimizationDefaults = ( * @param {string} options.context build context * @param {TargetProperties | false} options.targetProperties target properties * @param {Mode} options.mode mode - * @param {CssExperimentOptions|false} options.css is css enabled + * @param {boolean} options.css is css enabled * @returns {ResolveOptions} resolve options */ const getResolveDefaults = ({ @@ -1481,7 +1515,8 @@ const getResolveDefaults = ({ mainFiles: [], mainFields: ["style", "..."], conditionNames: styleConditions, - extensions: [".css"] + extensions: [".css"], + preferRelative: true }; } diff --git a/lib/config/normalization.js b/lib/config/normalization.js index 0c5aceccf63..a1acda77f74 100644 --- a/lib/config/normalization.js +++ b/lib/config/normalization.js @@ -109,7 +109,7 @@ const keyedNestedConfig = (value, fn, customKeys) => { obj ), /** @type {Record} */ ({}) - ); + ); if (customKeys) { for (const key of Object.keys(customKeys)) { if (!(key in result)) { @@ -175,19 +175,20 @@ const getNormalizedWebpackOptions = config => { ), context: config.context, dependencies: config.dependencies, - devServer: optionalNestedConfig(config.devServer, devServer => ({ - ...devServer - })), + devServer: optionalNestedConfig(config.devServer, devServer => { + if (devServer === false) return false; + return { ...devServer }; + }), devtool: config.devtool, entry: config.entry === undefined ? { main: {} } : typeof config.entry === "function" - ? ( - fn => () => - Promise.resolve().then(fn).then(getNormalizedEntryStatic) - )(config.entry) - : getNormalizedEntryStatic(config.entry), + ? ( + fn => () => + Promise.resolve().then(fn).then(getNormalizedEntryStatic) + )(config.entry) + : getNormalizedEntryStatic(config.entry), experiments: nestedConfig(config.experiments, experiments => ({ ...experiments, buildHttp: optionalNestedConfig(experiments.buildHttp, options => @@ -196,9 +197,6 @@ const getNormalizedWebpackOptions = config => { lazyCompilation: optionalNestedConfig( experiments.lazyCompilation, options => (options === true ? {} : options) - ), - css: optionalNestedConfig(experiments.css, options => - options === true ? {} : options ) })), externals: /** @type {NonNullable} */ (config.externals), @@ -227,7 +225,7 @@ const getNormalizedWebpackOptions = config => { } return true; }; - }) + }) : undefined, infrastructureLogging: cloneObject(config.infrastructureLogging), loader: cloneObject(config.loader), @@ -292,7 +290,7 @@ const getNormalizedWebpackOptions = config => { ? handledDeprecatedNoEmitOnErrors( optimization.noEmitOnErrors, optimization.emitOnErrors - ) + ) : optimization.emitOnErrors }; }), @@ -306,10 +304,10 @@ const getNormalizedWebpackOptions = config => { "type" in library ? library : libraryAsName || output.libraryTarget - ? /** @type {LibraryOptions} */ ({ - name: libraryAsName - }) - : undefined; + ? /** @type {LibraryOptions} */ ({ + name: libraryAsName + }) + : undefined; /** @type {OutputNormalized} */ const result = { assetModuleFilename: output.assetModuleFilename, @@ -382,6 +380,7 @@ const getNormalizedWebpackOptions = config => { publicPath: output.publicPath, sourceMapFilename: output.sourceMapFilename, sourcePrefix: output.sourcePrefix, + strictModuleErrorHandling: output.strictModuleErrorHandling, strictModuleExceptionHandling: output.strictModuleExceptionHandling, trustedTypes: optionalNestedConfig( output.trustedTypes, diff --git a/lib/config/target.js b/lib/config/target.js index da026c329e3..eade455603e 100644 --- a/lib/config/target.js +++ b/lib/config/target.js @@ -61,6 +61,7 @@ const getDefaultTarget = context => { * @property {boolean | null} module ESM syntax is available (when in module) * @property {boolean | null} optionalChaining optional chaining is available * @property {boolean | null} templateLiteral template literal is available + * @property {boolean | null} asyncFunction async functions and await are available */ ///** @typedef {PlatformTargetProperties | ApiTargetProperties | EcmaTargetProperties | PlatformTargetProperties & ApiTargetProperties | PlatformTargetProperties & EcmaTargetProperties | ApiTargetProperties & EcmaTargetProperties} TargetProperties */ @@ -192,6 +193,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis templateLiteral: v(4), optionalChaining: v(14), arrowFunction: v(6), + asyncFunction: v(7, 6), forOf: v(5), destructuring: v(6), bigIntLiteral: v(10, 4), @@ -233,6 +235,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis templateLiteral: v(1, 1), optionalChaining: v(8), arrowFunction: v(1, 1), + asyncFunction: v(1, 7), forOf: v(0, 36), destructuring: v(1, 1), bigIntLiteral: v(4), @@ -270,6 +273,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis templateLiteral: v(0, 13), optionalChaining: v(0, 44), arrowFunction: v(0, 15), + asyncFunction: v(0, 21), forOf: v(0, 13), destructuring: v(0, 15), bigIntLiteral: v(0, 32), @@ -294,6 +298,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis forOf: v >= 2015, destructuring: v >= 2015, module: v >= 2015, + asyncFunction: v >= 2017, globalThis: v >= 2020, bigIntLiteral: v >= 2020, dynamicImport: v >= 2020, diff --git a/lib/container/ContainerReferencePlugin.js b/lib/container/ContainerReferencePlugin.js index f860fbac32e..59657c1ffd7 100644 --- a/lib/container/ContainerReferencePlugin.js +++ b/lib/container/ContainerReferencePlugin.js @@ -113,7 +113,7 @@ class ContainerReferencePlugin { ? external.slice(9) : `webpack/container/reference/${key}${ i ? `/fallback-${i}` : "" - }` + }` ), `.${data.request.slice(key.length)}`, config.shareScope diff --git a/lib/css/CssExportsGenerator.js b/lib/css/CssExportsGenerator.js index 0fc400e0fdd..26baa1817f2 100644 --- a/lib/css/CssExportsGenerator.js +++ b/lib/css/CssExportsGenerator.js @@ -47,6 +47,7 @@ class CssExportsGenerator extends Generator { generateContext.runtimeRequirements.add(RuntimeGlobals.module); + let chunkInitFragments; const runtimeRequirements = new Set(); const templateContext = { @@ -60,7 +61,19 @@ class CssExportsGenerator extends Generator { concatenationScope: generateContext.concatenationScope, codeGenerationResults: generateContext.codeGenerationResults, initFragments, - cssExports + cssExports, + get chunkInitFragments() { + if (!chunkInitFragments) { + const data = generateContext.getData(); + chunkInitFragments = data.get("chunkInitFragments"); + if (!chunkInitFragments) { + chunkInitFragments = []; + data.set("chunkInitFragments", chunkInitFragments); + } + } + + return chunkInitFragments; + } }; /** diff --git a/lib/css/CssGenerator.js b/lib/css/CssGenerator.js index e18c70b0f27..0be867771d1 100644 --- a/lib/css/CssGenerator.js +++ b/lib/css/CssGenerator.js @@ -38,6 +38,7 @@ class CssGenerator extends Generator { generateContext.runtimeRequirements.add(RuntimeGlobals.hasCssModules); + let chunkInitFragments; const templateContext = { runtimeTemplate: generateContext.runtimeTemplate, dependencyTemplates: generateContext.dependencyTemplates, @@ -49,7 +50,19 @@ class CssGenerator extends Generator { concatenationScope: generateContext.concatenationScope, codeGenerationResults: generateContext.codeGenerationResults, initFragments, - cssExports + cssExports, + get chunkInitFragments() { + if (!chunkInitFragments) { + const data = generateContext.getData(); + chunkInitFragments = data.get("chunkInitFragments"); + if (!chunkInitFragments) { + chunkInitFragments = []; + data.set("chunkInitFragments", chunkInitFragments); + } + } + + return chunkInitFragments; + } }; /** diff --git a/lib/css/CssLoadingRuntimeModule.js b/lib/css/CssLoadingRuntimeModule.js index a0b164f326e..3c8226bc4bb 100644 --- a/lib/css/CssLoadingRuntimeModule.js +++ b/lib/css/CssLoadingRuntimeModule.js @@ -129,7 +129,7 @@ class CssLoadingRuntimeModule extends RuntimeModule { `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};` ), "}" - ]) + ]) : "" ]); @@ -141,7 +141,7 @@ class CssLoadingRuntimeModule extends RuntimeModule { { expr: "uniqueName" }, "-", { expr: "chunkId" } - ) + ) : runtimeTemplate.concatenation("--webpack-", { expr: "chunkId" }); return Template.asString([ @@ -158,7 +158,7 @@ class CssLoadingRuntimeModule extends RuntimeModule { uniqueName ? `var uniqueName = ${JSON.stringify( runtimeTemplate.outputOptions.uniqueName - )};` + )};` : "// data-webpack is not used as build has no uniqueName", `var loadCssChunkData = ${runtimeTemplate.basicFunction( "target, link, chunkId", @@ -210,10 +210,10 @@ class CssLoadingRuntimeModule extends RuntimeModule { { expr: "token" }, "-", { expr: "exports[x]" } - ) + ) : runtimeTemplate.concatenation({ expr: "token" }, "-", { expr: "exports[x]" - }) + }) }`, "x" )}); exportsWithDashes.forEach(${runtimeTemplate.expressionFunction( @@ -292,18 +292,18 @@ class CssLoadingRuntimeModule extends RuntimeModule { initialChunkIdsWithCss.size > 2 ? `${JSON.stringify( Array.from(initialChunkIdsWithCss) - )}.forEach(loadCssChunkData.bind(null, ${ + )}.forEach(loadCssChunkData.bind(null, ${ RuntimeGlobals.moduleFactories - }, 0));` + }, 0));` : initialChunkIdsWithCss.size > 0 - ? `${Array.from( - initialChunkIdsWithCss, - id => - `loadCssChunkData(${ - RuntimeGlobals.moduleFactories - }, 0, ${JSON.stringify(id)});` - ).join("")}` - : "// no initial css", + ? `${Array.from( + initialChunkIdsWithCss, + id => + `loadCssChunkData(${ + RuntimeGlobals.moduleFactories + }, 0, ${JSON.stringify(id)});` + ).join("")}` + : "// no initial css", "", withLoading ? Template.asString([ @@ -345,11 +345,11 @@ class CssLoadingRuntimeModule extends RuntimeModule { 'if(event.type !== "load") {', Template.indent([ "var errorType = event && event.type;", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading css chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "var realHref = event && event.target && event.target.href;", + "error.message = 'Loading css chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realHref + ')';", "error.name = 'ChunkLoadError';", "error.type = errorType;", - "error.request = realSrc;", + "error.request = realHref;", "installedChunkData[1](error);" ]), "} else {", @@ -372,7 +372,7 @@ class CssLoadingRuntimeModule extends RuntimeModule { ]), "}" ])};` - ]) + ]) : "// no chunk loading", "", withHmr @@ -435,11 +435,11 @@ class CssLoadingRuntimeModule extends RuntimeModule { 'if(event.type !== "load") {', Template.indent([ "var errorType = event && event.type;", - "var realSrc = event && event.target && event.target.src;", - "error.message = 'Loading css hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';", + "var realHref = event && event.target && event.target.href;", + "error.message = 'Loading css hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realHref + ')';", "error.name = 'ChunkLoadError';", "error.type = errorType;", - "error.request = realSrc;", + "error.request = realHref;", "reject(error);" ]), "} else {", @@ -464,7 +464,7 @@ class CssLoadingRuntimeModule extends RuntimeModule { ])});` ] )}` - ]) + ]) : "// no hmr" ]); } diff --git a/lib/css/CssModulesPlugin.js b/lib/css/CssModulesPlugin.js index 103ea670eab..c967ad542e1 100644 --- a/lib/css/CssModulesPlugin.js +++ b/lib/css/CssModulesPlugin.js @@ -33,7 +33,6 @@ const CssGenerator = require("./CssGenerator"); const CssParser = require("./CssParser"); /** @typedef {import("webpack-sources").Source} Source */ -/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */ /** @typedef {import("../../declarations/WebpackOptions").Output} OutputOptions */ /** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../ChunkGraph")} ChunkGraph */ @@ -59,22 +58,59 @@ const getSchema = name => { }; }; -const validateGeneratorOptions = createSchemaValidation( - require("../../schemas/plugins/css/CssGeneratorOptions.check.js"), - () => getSchema("CssGeneratorOptions"), - { - name: "Css Modules Plugin", - baseDataPath: "parser" - } -); -const validateParserOptions = createSchemaValidation( - require("../../schemas/plugins/css/CssParserOptions.check.js"), - () => getSchema("CssParserOptions"), - { - name: "Css Modules Plugin", - baseDataPath: "parser" - } -); +const generatorValidationOptions = { + name: "Css Modules Plugin", + baseDataPath: "generator" +}; +const validateGeneratorOptions = { + css: createSchemaValidation( + require("../../schemas/plugins/css/CssGeneratorOptions.check.js"), + () => getSchema("CssGeneratorOptions"), + generatorValidationOptions + ), + "css/auto": createSchemaValidation( + require("../../schemas/plugins/css/CssAutoGeneratorOptions.check.js"), + () => getSchema("CssAutoGeneratorOptions"), + generatorValidationOptions + ), + "css/module": createSchemaValidation( + require("../../schemas/plugins/css/CssModuleGeneratorOptions.check.js"), + () => getSchema("CssModuleGeneratorOptions"), + generatorValidationOptions + ), + "css/global": createSchemaValidation( + require("../../schemas/plugins/css/CssGlobalGeneratorOptions.check.js"), + () => getSchema("CssGlobalGeneratorOptions"), + generatorValidationOptions + ) +}; + +const parserValidationOptions = { + name: "Css Modules Plugin", + baseDataPath: "parser" +}; +const validateParserOptions = { + css: createSchemaValidation( + require("../../schemas/plugins/css/CssParserOptions.check.js"), + () => getSchema("CssParserOptions"), + parserValidationOptions + ), + "css/auto": createSchemaValidation( + require("../../schemas/plugins/css/CssAutoParserOptions.check.js"), + () => getSchema("CssAutoParserOptions"), + parserValidationOptions + ), + "css/module": createSchemaValidation( + require("../../schemas/plugins/css/CssModuleParserOptions.check.js"), + () => getSchema("CssModuleParserOptions"), + parserValidationOptions + ), + "css/global": createSchemaValidation( + require("../../schemas/plugins/css/CssGlobalParserOptions.check.js"), + () => getSchema("CssGlobalParserOptions"), + parserValidationOptions + ) +}; /** * @param {string} str string @@ -95,12 +131,6 @@ const escapeCss = (str, omitOptionalUnderscore) => { const plugin = "CssModulesPlugin"; class CssModulesPlugin { - /** - * @param {CssExperimentOptions} options options - */ - constructor({ exportsOnly = false }) { - this._exportsOnly = exportsOnly; - } /** * Apply the plugin * @param {Compiler} compiler the compiler instance @@ -156,27 +186,33 @@ class CssModulesPlugin { normalModuleFactory.hooks.createParser .for(type) .tap(plugin, parserOptions => { - validateParserOptions(parserOptions); + validateParserOptions[type](parserOptions); + const { namedExports } = parserOptions; switch (type) { case CSS_MODULE_TYPE: case CSS_MODULE_TYPE_AUTO: - return new CssParser(); + return new CssParser({ + namedExports + }); case CSS_MODULE_TYPE_GLOBAL: return new CssParser({ - allowModeSwitch: false + allowModeSwitch: false, + namedExports }); case CSS_MODULE_TYPE_MODULE: return new CssParser({ - defaultMode: "local" + defaultMode: "local", + namedExports }); } }); normalModuleFactory.hooks.createGenerator .for(type) .tap(plugin, generatorOptions => { - validateGeneratorOptions(generatorOptions); - return this._exportsOnly + validateGeneratorOptions[type](generatorOptions); + + return generatorOptions.exportsOnly ? new CssExportsGenerator() : new CssGenerator(); }); @@ -589,9 +625,9 @@ class CssModulesPlugin { return v === shortcutValue ? `${escapeCss(n)}/` : v === "--" + shortcutValue - ? `${escapeCss(n)}%` - : `${escapeCss(n)}(${escapeCss(v)})`; - }).join("") + ? `${escapeCss(n)}%` + : `${escapeCss(n)}(${escapeCss(v)})`; + }).join("") : "" }${escapeCss(moduleId)}` ); diff --git a/lib/css/CssParser.js b/lib/css/CssParser.js index 98a937d93a8..b4a92116b9c 100644 --- a/lib/css/CssParser.js +++ b/lib/css/CssParser.js @@ -131,10 +131,15 @@ const CSS_MODE_AT_IMPORT_INVALID = 3; const CSS_MODE_AT_NAMESPACE_INVALID = 4; class CssParser extends Parser { - constructor({ allowModeSwitch = true, defaultMode = "global" } = {}) { + constructor({ + allowModeSwitch = true, + defaultMode = "global", + namedExports = true + } = {}) { super(); this.allowModeSwitch = allowModeSwitch; this.defaultMode = defaultMode; + this.namedExports = namedExports; } /** @@ -911,7 +916,7 @@ class CssParser extends Parser { ) { modeData = balanced[balanced.length - 1] ? /** @type {"local" | "global"} */ - (balanced[balanced.length - 1][0]) + (balanced[balanced.length - 1][0]) : undefined; const dep = new ConstDependency("", [start, end]); module.addPresentationalDependency(dep); @@ -1024,7 +1029,7 @@ class CssParser extends Parser { } module.buildInfo.strict = true; - module.buildMeta.exportsType = "namespace"; + module.buildMeta.exportsType = this.namedExports ? "namespace" : "default"; module.addDependency(new StaticExportsDependency([], true)); return state; } diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js index cc896fe2c8b..40b17aef8fe 100644 --- a/lib/debug/ProfilingPlugin.js +++ b/lib/debug/ProfilingPlugin.js @@ -31,7 +31,7 @@ const validate = createSchemaValidation( let inspector = undefined; try { - // eslint-disable-next-line node/no-unsupported-features/node-builtins + // eslint-disable-next-line n/no-unsupported-features/node-builtins inspector = require("inspector"); } catch (e) { console.log("Unable to CPU profile in < node 8.0"); @@ -374,7 +374,7 @@ const makeInterceptorFor = (instance, tracer) => hookName => ({ name, type, fn - }); + }); return { ...tapInfo, fn: newFn diff --git a/lib/dependencies/CachedConstDependency.js b/lib/dependencies/CachedConstDependency.js index e02aa8af1ed..60826f5a859 100644 --- a/lib/dependencies/CachedConstDependency.js +++ b/lib/dependencies/CachedConstDependency.js @@ -38,6 +38,13 @@ class CachedConstDependency extends NullDependency { this._hashUpdate = undefined; } + /** + * @returns {string} hash update + */ + _createHashUpdate() { + return `${this.identifier}${this.range}${this.expression}`; + } + /** * Update the hash * @param {Hash} hash hash to be updated @@ -46,7 +53,7 @@ class CachedConstDependency extends NullDependency { */ updateHash(hash, context) { if (this._hashUpdate === undefined) - this._hashUpdate = "" + this.identifier + this.range + this.expression; + this._hashUpdate = this._createHashUpdate(); hash.update(this._hashUpdate); } diff --git a/lib/dependencies/CommonJsImportsParserPlugin.js b/lib/dependencies/CommonJsImportsParserPlugin.js index 0e64ef173a0..744405230c5 100644 --- a/lib/dependencies/CommonJsImportsParserPlugin.js +++ b/lib/dependencies/CommonJsImportsParserPlugin.js @@ -65,7 +65,7 @@ class CommonJsImportsParserPlugin { //#region metadata /** - * @param {TODO} expression expression + * @param {string} expression expression * @param {() => string[]} getMembers get members */ const tapRequireExpression = (expression, getMembers) => { diff --git a/lib/dependencies/ContextElementDependency.js b/lib/dependencies/ContextElementDependency.js index 1ceaadb0431..cfdcbdcda07 100644 --- a/lib/dependencies/ContextElementDependency.js +++ b/lib/dependencies/ContextElementDependency.js @@ -66,7 +66,7 @@ class ContextElementDependency extends ModuleDependency { ? this.referencedExports.map(e => ({ name: e, canMangle: false - })) + })) : Dependency.EXPORTS_OBJECT_REFERENCED; } diff --git a/lib/dependencies/ExternalModuleDependency.js b/lib/dependencies/ExternalModuleDependency.js new file mode 100644 index 00000000000..3620311136b --- /dev/null +++ b/lib/dependencies/ExternalModuleDependency.js @@ -0,0 +1,98 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ + +"use strict"; + +const makeSerializable = require("../util/makeSerializable"); +const CachedConstDependency = require("./CachedConstDependency"); +const ExternalModuleInitFragment = require("./ExternalModuleInitFragment"); + +/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ +/** @typedef {import("../Dependency")} Dependency */ +/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ +/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ +/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ +/** @typedef {import("../util/Hash")} Hash */ + +class ExternalModuleDependency extends CachedConstDependency { + constructor( + module, + importSpecifiers, + defaultImport, + expression, + range, + identifier + ) { + super(expression, range, identifier); + + this.importedModule = module; + this.specifiers = importSpecifiers; + this.default = defaultImport; + } + + /** + * @returns {string} hash update + */ + _createHashUpdate() { + return `${this.importedModule}${JSON.stringify(this.specifiers)}${ + this.default || "null" + }${super._createHashUpdate()}`; + } + + /** + * @param {ObjectSerializerContext} context context + */ + serialize(context) { + super.serialize(context); + const { write } = context; + write(this.importedModule); + write(this.specifiers); + write(this.default); + } + + /** + * @param {ObjectDeserializerContext} context context + */ + deserialize(context) { + super.deserialize(context); + const { read } = context; + this.importedModule = read(); + this.specifiers = read(); + this.default = read(); + } +} + +makeSerializable( + ExternalModuleDependency, + "webpack/lib/dependencies/ExternalModuleDependency" +); + +ExternalModuleDependency.Template = class ExternalModuleDependencyTemplate extends ( + CachedConstDependency.Template +) { + /** + * @param {Dependency} dependency the dependency for which the template should be applied + * @param {ReplaceSource} source the current replace source which can be modified + * @param {DependencyTemplateContext} templateContext the context object + * @returns {void} + */ + apply(dependency, source, templateContext) { + super.apply(dependency, source, templateContext); + const dep = /** @type {ExternalModuleDependency} */ (dependency); + const { chunkInitFragments } = templateContext; + + chunkInitFragments.push( + new ExternalModuleInitFragment( + dep.importedModule, + dep.specifiers, + dep.default + ) + ); + } +}; + +module.exports = ExternalModuleDependency; diff --git a/lib/dependencies/ExternalModuleInitFragment.js b/lib/dependencies/ExternalModuleInitFragment.js new file mode 100644 index 00000000000..724be427607 --- /dev/null +++ b/lib/dependencies/ExternalModuleInitFragment.js @@ -0,0 +1,124 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop +*/ + +"use strict"; + +const InitFragment = require("../InitFragment"); +const makeSerializable = require("../util/makeSerializable"); + +/** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Generator").GenerateContext} Context */ +/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ +/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ +/** @typedef {Map>} ImportSpecifiers */ + +class ExternalModuleInitFragment extends InitFragment { + /** + * @param {string} importedModule imported module + * @param {Array<{ name: string, value?: string }>|ImportSpecifiers} specifiers import specifiers + * @param {string=} defaultImport default import + */ + constructor(importedModule, specifiers, defaultImport) { + super( + undefined, + InitFragment.STAGE_CONSTANTS, + 0, + `external module imports|${importedModule}|${defaultImport || "null"}` + ); + this.importedModule = importedModule; + if (Array.isArray(specifiers)) { + /** @type {ImportSpecifiers} */ + this.specifiers = new Map(); + for (const { name, value } of specifiers) { + let specifiers = this.specifiers.get(name); + if (!specifiers) { + specifiers = new Set(); + this.specifiers.set(name, specifiers); + } + specifiers.add(value || name); + } + } else { + this.specifiers = specifiers; + } + this.defaultImport = defaultImport; + } + + merge(other) { + const newSpecifiersMap = new Map(this.specifiers); + for (const [name, specifiers] of other.specifiers) { + if (newSpecifiersMap.has(name)) { + const currentSpecifiers = newSpecifiersMap.get(name); + for (const spec of specifiers) currentSpecifiers.add(spec); + } else { + newSpecifiersMap.set(name, specifiers); + } + } + return new ExternalModuleInitFragment( + this.importedModule, + newSpecifiersMap, + this.defaultImport + ); + } + + /** + * @param {Context} context context + * @returns {string|Source} the source code that will be included as initialization code + */ + getContent({ runtimeRequirements }) { + const namedImports = []; + + for (const [name, specifiers] of this.specifiers) { + for (const spec of specifiers) { + if (spec === name) { + namedImports.push(name); + } else { + namedImports.push(`${name} as ${spec}`); + } + } + } + + let importsString = + namedImports.length > 0 ? `{${namedImports.join(",")}}` : ""; + + if (this.defaultImport) { + importsString = `${this.defaultImport}${ + importsString ? `, ${importsString}` : "" + }`; + } + + return `import ${importsString} from ${JSON.stringify( + this.importedModule + )};`; + } + + /** + * @param {ObjectSerializerContext} context context + */ + serialize(context) { + super.serialize(context); + const { write } = context; + write(this.importedModule); + write(this.specifiers); + write(this.defaultImport); + } + + /** + * @param {ObjectDeserializerContext} context context + */ + deserialize(context) { + super.deserialize(context); + const { read } = context; + this.importedModule = read(); + this.specifiers = read(); + this.defaultImport = read(); + } +} + +makeSerializable( + ExternalModuleInitFragment, + "webpack/lib/dependencies/ExternalModuleInitFragment" +); + +module.exports = ExternalModuleInitFragment; diff --git a/lib/dependencies/HarmonyAcceptDependency.js b/lib/dependencies/HarmonyAcceptDependency.js index 00a367d82c7..4817b722d7e 100644 --- a/lib/dependencies/HarmonyAcceptDependency.js +++ b/lib/dependencies/HarmonyAcceptDependency.js @@ -91,7 +91,7 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends ? HarmonyImportDependency.Template.getImportEmittedRuntime( module, referencedModule - ) + ) : false }; }) diff --git a/lib/dependencies/HarmonyDetectionParserPlugin.js b/lib/dependencies/HarmonyDetectionParserPlugin.js index 0fbc7a660f1..4cf84fc1ec5 100644 --- a/lib/dependencies/HarmonyDetectionParserPlugin.js +++ b/lib/dependencies/HarmonyDetectionParserPlugin.js @@ -5,6 +5,7 @@ "use strict"; +const EnvironmentNotSupportAsyncWarning = require("../EnvironmentNotSupportAsyncWarning"); const { JAVASCRIPT_MODULE_TYPE_ESM } = require("../ModuleTypeConstants"); const DynamicExports = require("./DynamicExports"); const HarmonyCompatibilityDependency = require("./HarmonyCompatibilityDependency"); @@ -65,7 +66,7 @@ module.exports = class HarmonyDetectionParserPlugin { const module = parser.state.module; if (!this.topLevelAwait) { throw new Error( - "The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)" + "The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enable it)" ); } if (!HarmonyExports.isEnabled(parser.state)) { @@ -75,6 +76,11 @@ module.exports = class HarmonyDetectionParserPlugin { } /** @type {BuildMeta} */ (module.buildMeta).async = true; + EnvironmentNotSupportAsyncWarning.check( + module, + parser.state.compilation.runtimeTemplate, + "topLevelAwait" + ); }); /** diff --git a/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/lib/dependencies/HarmonyExportDependencyParserPlugin.js index bec73a10452..e96af33a1fa 100644 --- a/lib/dependencies/HarmonyExportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyExportDependencyParserPlugin.js @@ -31,10 +31,10 @@ module.exports = class HarmonyExportDependencyParserPlugin { options.reexportExportsPresence !== undefined ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence) : options.exportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.exportsPresence) - : options.strictExportPresence - ? ExportPresenceModes.ERROR - : ExportPresenceModes.AUTO; + ? ExportPresenceModes.fromUserOption(options.exportsPresence) + : options.strictExportPresence + ? ExportPresenceModes.ERROR + : ExportPresenceModes.AUTO; } apply(parser) { @@ -97,20 +97,20 @@ module.exports = class HarmonyExportDependencyParserPlugin { expr.type.endsWith("Declaration") && expr.id ? expr.id.name : isFunctionDeclaration - ? { - id: expr.id ? expr.id.name : undefined, - range: [ - expr.range[0], - expr.params.length > 0 - ? expr.params[0].range[0] - : expr.body.range[0] - ], - prefix: `${expr.async ? "async " : ""}function${ - expr.generator ? "*" : "" - } `, - suffix: `(${expr.params.length > 0 ? "" : ") "}` - } - : undefined + ? { + id: expr.id ? expr.id.name : undefined, + range: [ + expr.range[0], + expr.params.length > 0 + ? expr.params[0].range[0] + : expr.body.range[0] + ], + prefix: `${expr.async ? "async " : ""}function${ + expr.generator ? "*" : "" + } `, + suffix: `(${expr.params.length > 0 ? "" : ") "}` + } + : undefined ); dep.loc = Object.create(statement.loc); dep.loc.index = -1; diff --git a/lib/dependencies/HarmonyExportInitFragment.js b/lib/dependencies/HarmonyExportInitFragment.js index d99137caabb..bddeabfb29e 100644 --- a/lib/dependencies/HarmonyExportInitFragment.js +++ b/lib/dependencies/HarmonyExportInitFragment.js @@ -141,10 +141,10 @@ class HarmonyExportInitFragment extends InitFragment { this.unusedExports.size > 1 ? `/* unused harmony exports ${joinIterableWithComma( this.unusedExports - )} */\n` + )} */\n` : this.unusedExports.size > 0 - ? `/* unused harmony export ${first(this.unusedExports)} */\n` - : ""; + ? `/* unused harmony export ${first(this.unusedExports)} */\n` + : ""; const definitions = []; const orderedExportMap = Array.from(this.exportMap).sort(([a], [b]) => a < b ? -1 : 1 @@ -160,7 +160,7 @@ class HarmonyExportInitFragment extends InitFragment { this.exportMap.size > 0 ? `/* harmony export */ ${RuntimeGlobals.definePropertyGetters}(${ this.exportsArgument - }, {${definitions.join(",")}\n/* harmony export */ });\n` + }, {${definitions.join(",")}\n/* harmony export */ });\n` : ""; return `${definePart}${unusedPart}`; } diff --git a/lib/dependencies/HarmonyImportDependency.js b/lib/dependencies/HarmonyImportDependency.js index b4a65530610..2f9c17640af 100644 --- a/lib/dependencies/HarmonyImportDependency.js +++ b/lib/dependencies/HarmonyImportDependency.js @@ -157,8 +157,8 @@ class HarmonyImportDependency extends ModuleDependency { const moreInfo = !Array.isArray(providedExports) ? " (possible exports unknown)" : providedExports.length === 0 - ? " (module has no exports)" - : ` (possible exports: ${providedExports.join(", ")})`; + ? " (module has no exports)" + : ` (possible exports: ${providedExports.join(", ")})`; return [ new HarmonyLinkingError( `export ${ids @@ -287,8 +287,8 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends const runtimeCondition = dep.weak ? false : connection - ? filterRuntime(runtime, r => connection.isTargetActive(r)) - : true; + ? filterRuntime(runtime, r => connection.isTargetActive(r)) + : true; if (module && referencedModule) { let emittedModules = importEmittedMap.get(module); diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index d0e195e0e94..f3b49d2436f 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -75,10 +75,10 @@ module.exports = class HarmonyImportDependencyParserPlugin { options.importExportsPresence !== undefined ? ExportPresenceModes.fromUserOption(options.importExportsPresence) : options.exportsPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.exportsPresence) - : options.strictExportPresence - ? ExportPresenceModes.ERROR - : ExportPresenceModes.AUTO; + ? ExportPresenceModes.fromUserOption(options.exportsPresence) + : options.strictExportPresence + ? ExportPresenceModes.ERROR + : ExportPresenceModes.AUTO; this.strictThisContextOnImports = options.strictThisContextOnImports; } @@ -240,7 +240,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { ? getNonOptionalMemberChain( expression, members.length - nonOptionalMembers.length - ) + ) : expression; const ids = settings.ids.concat(nonOptionalMembers); const dep = new HarmonyImportSpecifierDependency( @@ -286,7 +286,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { ? getNonOptionalMemberChain( callee, members.length - nonOptionalMembers.length - ) + ) : callee; const ids = settings.ids.concat(nonOptionalMembers); const dep = new HarmonyImportSpecifierDependency( diff --git a/lib/dependencies/ImportDependency.js b/lib/dependencies/ImportDependency.js index a0eaffec32f..2e1b029041b 100644 --- a/lib/dependencies/ImportDependency.js +++ b/lib/dependencies/ImportDependency.js @@ -48,12 +48,32 @@ class ImportDependency extends ModuleDependency { * @returns {(string[] | ReferencedExport)[]} referenced exports */ getReferencedExports(moduleGraph, runtime) { - return this.referencedExports - ? this.referencedExports.map(e => ({ - name: e, - canMangle: false - })) - : Dependency.EXPORTS_OBJECT_REFERENCED; + if (!this.referencedExports) return Dependency.EXPORTS_OBJECT_REFERENCED; + const refs = []; + for (const referencedExport of this.referencedExports) { + if (referencedExport[0] === "default") { + const selfModule = moduleGraph.getParentModule(this); + const importedModule = + /** @type {Module} */ + (moduleGraph.getModule(this)); + const exportsType = importedModule.getExportsType( + moduleGraph, + /** @type {BuildMeta} */ + (selfModule.buildMeta).strictHarmonyModule + ); + if ( + exportsType === "default-only" || + exportsType === "default-with-named" + ) { + return Dependency.EXPORTS_OBJECT_REFERENCED; + } + } + refs.push({ + name: referencedExport, + canMangle: false + }); + } + return refs; } /** diff --git a/lib/dependencies/JsonExportsDependency.js b/lib/dependencies/JsonExportsDependency.js index fb38cc4fe3d..c688e00e74d 100644 --- a/lib/dependencies/JsonExportsDependency.js +++ b/lib/dependencies/JsonExportsDependency.js @@ -28,7 +28,7 @@ const getExportsFromData = data => { canMangle: true, exports: getExportsFromData(item) }; - }) + }) : undefined; } else { const exports = []; diff --git a/lib/dependencies/LoaderPlugin.js b/lib/dependencies/LoaderPlugin.js index 3132cfdffc2..f30c90c149a 100644 --- a/lib/dependencies/LoaderPlugin.js +++ b/lib/dependencies/LoaderPlugin.js @@ -185,7 +185,8 @@ class LoaderPlugin { issuerLayer: options.layer }, context: loaderContext.context, - connectOrigin: false + connectOrigin: false, + checkCycle: true }, err => { compilation.buildQueue.decreaseParallelism(); diff --git a/lib/dependencies/PureExpressionDependency.js b/lib/dependencies/PureExpressionDependency.js index 0b7372fe7f7..d56427d69ef 100644 --- a/lib/dependencies/PureExpressionDependency.js +++ b/lib/dependencies/PureExpressionDependency.js @@ -7,7 +7,7 @@ const { UsageState } = require("../ExportsInfo"); const makeSerializable = require("../util/makeSerializable"); -const { filterRuntime } = require("../util/runtime"); +const { filterRuntime, deepMergeRuntime } = require("../util/runtime"); const NullDependency = require("./NullDependency"); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ @@ -93,7 +93,14 @@ PureExpressionDependency.Template = class PureExpressionDependencyTemplate exten apply( dependency, source, - { chunkGraph, moduleGraph, runtime, runtimeTemplate, runtimeRequirements } + { + chunkGraph, + moduleGraph, + runtime, + runtimes, + runtimeTemplate, + runtimeRequirements + } ) { const dep = /** @type {PureExpressionDependency} */ (dependency); @@ -101,7 +108,8 @@ PureExpressionDependency.Template = class PureExpressionDependencyTemplate exten if (usedByExports !== false) { const selfModule = moduleGraph.getParentModule(dep); const exportsInfo = moduleGraph.getExportsInfo(selfModule); - const runtimeCondition = filterRuntime(runtime, runtime => { + const merged = deepMergeRuntime(runtimes, runtime); + const runtimeCondition = filterRuntime(merged, runtime => { for (const exportName of usedByExports) { if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) { return true; @@ -113,7 +121,7 @@ PureExpressionDependency.Template = class PureExpressionDependencyTemplate exten if (runtimeCondition !== false) { const condition = runtimeTemplate.runtimeConditionExpression({ chunkGraph, - runtime, + runtime: merged, runtimeCondition, runtimeRequirements }); diff --git a/lib/dependencies/RequireIncludeDependency.js b/lib/dependencies/RequireIncludeDependency.js index f0ab47c1a20..3a25e84a8ff 100644 --- a/lib/dependencies/RequireIncludeDependency.js +++ b/lib/dependencies/RequireIncludeDependency.js @@ -69,7 +69,7 @@ RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate exten `require.include ${runtimeTemplate.requestShortener.shorten( dep.request )}` - ) + ) : ""; source.replace(dep.range[0], dep.range[1] - 1, `undefined${comment}`); diff --git a/lib/dependencies/WebpackIsIncludedDependency.js b/lib/dependencies/WebpackIsIncludedDependency.js index ba41e4e162e..0b308734ee7 100644 --- a/lib/dependencies/WebpackIsIncludedDependency.js +++ b/lib/dependencies/WebpackIsIncludedDependency.js @@ -71,7 +71,7 @@ WebpackIsIncludedDependency.Template = class WebpackIsIncludedDependencyTemplate `__webpack_is_included__ ${runtimeTemplate.requestShortener.shorten( dep.request )}` - ) + ) : ""; source.replace( diff --git a/lib/dependencies/WorkerPlugin.js b/lib/dependencies/WorkerPlugin.js index cdbea3e56b8..779956468de 100644 --- a/lib/dependencies/WorkerPlugin.js +++ b/lib/dependencies/WorkerPlugin.js @@ -240,7 +240,7 @@ class WorkerPlugin { insertLocation: arg2 ? /** @type {Range} */ (arg2.range) : /** @type {Range} */ (arg1.range)[1] - }; + }; const { options: importOptions, errors: commentErrors } = parser.parseCommentOptions(/** @type {Range} */ (expr.range)); @@ -429,6 +429,12 @@ 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.pattern.for(pattern).tap(PLUGIN_NAME, pattern => { parser.tagVariable(pattern.name, WorkerSpecifierTag); return true; diff --git a/lib/esm/ModuleChunkLoadingRuntimeModule.js b/lib/esm/ModuleChunkLoadingRuntimeModule.js index c29f0f50d26..5287e70f280 100644 --- a/lib/esm/ModuleChunkLoadingRuntimeModule.js +++ b/lib/esm/ModuleChunkLoadingRuntimeModule.js @@ -172,7 +172,7 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { ]), "}", withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" - ])}` + ])}` : "// no install chunk", "", withLoading @@ -222,25 +222,25 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule { "}" ]), "}" - ]) + ]) : Template.indent(["installedChunks[chunkId] = 0;"]) )};` - ]) + ]) : "// no chunk on demand loading", "", withExternalInstallChunk ? Template.asString([ `${RuntimeGlobals.externalInstallChunk} = installChunk;` - ]) + ]) : "// no external install chunk", "", withOnChunkLoad ? `${ RuntimeGlobals.onChunksLoaded - }.j = ${runtimeTemplate.returningFunction( + }.j = ${runtimeTemplate.returningFunction( "installedChunks[chunkId] === 0", "chunkId" - )};` + )};` : "// no on chunks loaded" ]); } diff --git a/lib/hmr/HotModuleReplacement.runtime.js b/lib/hmr/HotModuleReplacement.runtime.js index 0ac94cbc5a7..a54aa0e628c 100644 --- a/lib/hmr/HotModuleReplacement.runtime.js +++ b/lib/hmr/HotModuleReplacement.runtime.js @@ -35,7 +35,6 @@ module.exports = function () { var currentUpdateApplyHandlers; var queuedInvalidatedModules; - // eslint-disable-next-line no-unused-vars $hmrModuleData$ = currentModuleData; $interceptModuleExecution$.push(function (options) { @@ -96,8 +95,8 @@ module.exports = function () { Object.defineProperty(fn, name, createPropertyDescriptor(name)); } } - fn.e = function (chunkId) { - return trackBlockingPromise(require.e(chunkId)); + fn.e = function (chunkId, fetchPriority) { + return trackBlockingPromise(require.e(chunkId, fetchPriority)); }; return fn; } @@ -289,8 +288,7 @@ module.exports = function () { updatedModules ); return promises; - }, - []) + }, []) ).then(function () { return waitForBlockingPromises(function () { if (applyOnUpdate) { diff --git a/lib/hmr/lazyCompilationBackend.js b/lib/hmr/lazyCompilationBackend.js index 3f480555998..dcc0130d136 100644 --- a/lib/hmr/lazyCompilationBackend.js +++ b/lib/hmr/lazyCompilationBackend.js @@ -37,7 +37,7 @@ module.exports = options => (compiler, callback) => { : (() => { const http = isHttps ? require("https") : require("http"); return http.createServer.bind(http, options.server); - })(); + })(); const listen = typeof options.listen === "function" ? options.listen @@ -46,7 +46,7 @@ module.exports = options => (compiler, callback) => { if (typeof listen === "object" && !("port" in listen)) listen = { ...listen, port: undefined }; server.listen(listen); - }; + }; const protocol = options.protocol || (isHttps ? "https" : "http"); @@ -109,8 +109,8 @@ module.exports = options => (compiler, callback) => { addr.address === "::" || addr.address === "0.0.0.0" ? `${protocol}://localhost:${addr.port}` : addr.family === "IPv6" - ? `${protocol}://[${addr.address}]:${addr.port}` - : `${protocol}://${addr.address}:${addr.port}`; + ? `${protocol}://[${addr.address}]:${addr.port}` + : `${protocol}://${addr.address}:${addr.port}`; logger.log( `Server-Sent-Events server for lazy compilation open at ${urlBase}.` ); diff --git a/lib/ids/DeterministicModuleIdsPlugin.js b/lib/ids/DeterministicModuleIdsPlugin.js index 6f19f66f24c..0cfd973ae56 100644 --- a/lib/ids/DeterministicModuleIdsPlugin.js +++ b/lib/ids/DeterministicModuleIdsPlugin.js @@ -66,7 +66,7 @@ class DeterministicModuleIdsPlugin { ? () => 0 : compareModulesByPreOrderIndexOrIdentifier( compilation.moduleGraph - ), + ), (module, id) => { const size = usedIds.size; usedIds.add(`${id}`); diff --git a/lib/index.js b/lib/index.js index d9255fce66c..8b9e828ecf2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -37,6 +37,7 @@ const memoize = require("./util/memoize"); /** @typedef {import("./Compilation").EntryOptions} EntryOptions */ /** @typedef {import("./Compilation").PathData} PathData */ /** @typedef {import("./Compiler").AssetEmittedInfo} AssetEmittedInfo */ +/** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */ /** @typedef {import("./MultiStats")} MultiStats */ /** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */ /** @typedef {import("./Parser").ParserState} ParserState */ @@ -270,6 +271,9 @@ module.exports = mergeExports(fn, { get MultiCompiler() { return require("./MultiCompiler"); }, + get OptimizationStages() { + return require("./OptimizationStages"); + }, get Parser() { return require("./Parser"); }, diff --git a/lib/javascript/JavascriptGenerator.js b/lib/javascript/JavascriptGenerator.js index d13eb8a07f5..8b2242a13c5 100644 --- a/lib/javascript/JavascriptGenerator.js +++ b/lib/javascript/JavascriptGenerator.js @@ -190,6 +190,8 @@ class JavascriptGenerator extends Generator { ); } + let chunkInitFragments; + const templateContext = { runtimeTemplate: generateContext.runtimeTemplate, dependencyTemplates: generateContext.dependencyTemplates, @@ -197,10 +199,23 @@ class JavascriptGenerator extends Generator { chunkGraph: generateContext.chunkGraph, module, runtime: generateContext.runtime, + runtimes: generateContext.runtimes, runtimeRequirements: generateContext.runtimeRequirements, concatenationScope: generateContext.concatenationScope, codeGenerationResults: generateContext.codeGenerationResults, - initFragments + initFragments, + get chunkInitFragments() { + if (!chunkInitFragments) { + const data = generateContext.getData(); + chunkInitFragments = data.get("chunkInitFragments"); + if (!chunkInitFragments) { + chunkInitFragments = []; + data.set("chunkInitFragments", chunkInitFragments); + } + } + + return chunkInitFragments; + } }; template.apply(dependency, source, templateContext); diff --git a/lib/javascript/JavascriptModulesPlugin.js b/lib/javascript/JavascriptModulesPlugin.js index 6eb79e705eb..4249a2f5105 100644 --- a/lib/javascript/JavascriptModulesPlugin.js +++ b/lib/javascript/JavascriptModulesPlugin.js @@ -679,8 +679,8 @@ class JavascriptModulesPlugin { return strictHeader ? new ConcatSource(strictHeader, source, ";") : renderContext.runtimeTemplate.isModule() - ? source - : new ConcatSource(source, ";"); + ? source + : new ConcatSource(source, ";"); } /** @@ -751,7 +751,7 @@ class JavascriptModulesPlugin { inlinedModules ? allModules.filter( m => !(/** @type {Set} */ (inlinedModules).has(m)) - ) + ) : allModules, module => this.renderModule(module, chunkRenderContext, hooks, true), prefix @@ -837,14 +837,14 @@ class JavascriptModulesPlugin { let iife = innerStrict ? "it need to be in strict mode." : inlinedModules.size > 1 - ? // TODO check globals and top-level declarations of other entries and chunk modules - // to make a better decision - "it need to be isolated against other entry modules." - : chunkModules - ? "it need to be isolated against other modules in the chunk." - : exports && !webpackExports - ? `it uses a non-standard name for the exports (${m.exportsArgument}).` - : hooks.embedInRuntimeBailout.call(m, renderContext); + ? // TODO check globals and top-level declarations of other entries and chunk modules + // to make a better decision + "it need to be isolated against other entry modules." + : chunkModules + ? "it need to be isolated against other modules in the chunk." + : exports && !webpackExports + ? `it uses a non-standard name for the exports (${m.exportsArgument}).` + : hooks.embedInRuntimeBailout.call(m, renderContext); let footer; if (iife !== undefined) { startupSource.add( @@ -1310,14 +1310,14 @@ class JavascriptModulesPlugin { `${RuntimeGlobals.interceptModuleExecution}.forEach(function(handler) { handler(execOptions); });`, "module = execOptions.module;", "execOptions.factory.call(module.exports, module, module.exports, execOptions.require);" - ]) + ]) : runtimeRequirements.has(RuntimeGlobals.thisAsExports) - ? Template.asString([ - `__webpack_modules__[moduleId].call(module.exports, module, module.exports, ${RuntimeGlobals.require});` - ]) - : Template.asString([ - `__webpack_modules__[moduleId](module, module.exports, ${RuntimeGlobals.require});` - ]); + ? Template.asString([ + `__webpack_modules__[moduleId].call(module.exports, module, module.exports, ${RuntimeGlobals.require});` + ]) + : Template.asString([ + `__webpack_modules__[moduleId](module, module.exports, ${RuntimeGlobals.require});` + ]); const needModuleId = runtimeRequirements.has(RuntimeGlobals.moduleId); const needModuleLoaded = runtimeRequirements.has( RuntimeGlobals.moduleLoaded @@ -1330,7 +1330,7 @@ class JavascriptModulesPlugin { ? Template.indent([ "if (cachedModule.error !== undefined) throw cachedModule.error;", "return cachedModule.exports;" - ]) + ]) : Template.indent("return cachedModule.exports;"), "}", "// Create a new module (and put it into the cache)", @@ -1353,27 +1353,27 @@ class JavascriptModulesPlugin { "if(threw) delete __webpack_module_cache__[moduleId];" ]), "}" - ]) + ]) : outputOptions.strictModuleErrorHandling - ? Template.asString([ - "// Execute the module function", - "try {", - Template.indent(moduleExecution), - "} catch(e) {", - Template.indent(["module.error = e;", "throw e;"]), - "}" - ]) - : Template.asString([ - "// Execute the module function", - moduleExecution - ]), + ? Template.asString([ + "// Execute the module function", + "try {", + Template.indent(moduleExecution), + "} catch(e) {", + Template.indent(["module.error = e;", "throw e;"]), + "}" + ]) + : Template.asString([ + "// Execute the module function", + moduleExecution + ]), needModuleLoaded ? Template.asString([ "", "// Flag the module as loaded", `${RuntimeGlobals.moduleLoaded} = true;`, "" - ]) + ]) : "", "// Return the exports of the module", "return module.exports;" diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index 827e9bd4d97..ddbc810e2df 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -4071,6 +4071,14 @@ class JavascriptParser extends Parser { return false; } + if ( + expr.superClass && + item.type === "MethodDefinition" && + item.kind === "constructor" + ) { + return false; + } + return true; }); } diff --git a/lib/json/JsonGenerator.js b/lib/json/JsonGenerator.js index d7074fc0ca7..53af8d3a599 100644 --- a/lib/json/JsonGenerator.js +++ b/lib/json/JsonGenerator.js @@ -183,7 +183,7 @@ class JsonGenerator extends Generator { const jsonStr = /** @type {string} */ (stringifySafe(finalJson)); const jsonExpr = jsonStr.length > 20 && typeof finalJson === "object" - ? `JSON.parse('${jsonStr.replace(/[\\']/g, "\\$&")}')` + ? `/*#__PURE__*/JSON.parse('${jsonStr.replace(/[\\']/g, "\\$&")}')` : jsonStr; /** @type {string} */ let content; diff --git a/lib/library/AmdLibraryPlugin.js b/lib/library/AmdLibraryPlugin.js index e73c9bcd449..9cca2c9cb7f 100644 --- a/lib/library/AmdLibraryPlugin.js +++ b/lib/library/AmdLibraryPlugin.js @@ -87,7 +87,11 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin { const modern = runtimeTemplate.supportsArrowFunction(); const modules = chunkGraph .getChunkModules(chunk) - .filter(m => m instanceof ExternalModule); + .filter( + m => + m instanceof ExternalModule && + (m.externalType === "amd" || m.externalType === "amd-require") + ); const externals = /** @type {ExternalModule[]} */ (modules); const externalsDepsArray = JSON.stringify( externals.map(m => diff --git a/lib/library/AssignLibraryPlugin.js b/lib/library/AssignLibraryPlugin.js index e232bd37b1b..b1657686a05 100644 --- a/lib/library/AssignLibraryPlugin.js +++ b/lib/library/AssignLibraryPlugin.js @@ -295,7 +295,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin { const exportAccess = options.export ? propertyAccess( Array.isArray(options.export) ? options.export : [options.export] - ) + ) : ""; const result = new ConcatSource(source); if (staticExports) { diff --git a/lib/library/SystemLibraryPlugin.js b/lib/library/SystemLibraryPlugin.js index 3795985b5de..06fdabe34da 100644 --- a/lib/library/SystemLibraryPlugin.js +++ b/lib/library/SystemLibraryPlugin.js @@ -187,7 +187,7 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin { .join(",\n") ), "]," - ]); + ]); return new ConcatSource( Template.asString([ diff --git a/lib/library/UmdLibraryPlugin.js b/lib/library/UmdLibraryPlugin.js index fbcb0717c76..34a2af2855f 100644 --- a/lib/library/UmdLibraryPlugin.js +++ b/lib/library/UmdLibraryPlugin.js @@ -243,8 +243,8 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { const factoryArguments = requiredExternals.length > 0 ? externalsArguments(requiredExternals) + - ", " + - externalsRootArray(optionalExternals) + ", " + + externalsRootArray(optionalExternals) : externalsRootArray(optionalExternals); amdFactory = `function webpackLoadOptionalExternalModuleAmd(${wrapperArguments}) {\n` + @@ -283,55 +283,55 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin { (requiredExternals.length > 0 ? names.amd && namedDefine === true ? " define(" + - libraryName(names.amd) + - ", " + - externalsDepsArray(requiredExternals) + - ", " + - amdFactory + - ");\n" + libraryName(names.amd) + + ", " + + externalsDepsArray(requiredExternals) + + ", " + + amdFactory + + ");\n" : " define(" + - externalsDepsArray(requiredExternals) + - ", " + - amdFactory + - ");\n" + externalsDepsArray(requiredExternals) + + ", " + + amdFactory + + ");\n" : names.amd && namedDefine === true - ? " define(" + - libraryName(names.amd) + - ", [], " + - amdFactory + - ");\n" - : " define([], " + amdFactory + ");\n") + + ? " define(" + + libraryName(names.amd) + + ", [], " + + amdFactory + + ");\n" + : " define([], " + amdFactory + ");\n") + (names.root || names.commonjs ? getAuxiliaryComment("commonjs") + - " else if(typeof exports === 'object')\n" + - " exports[" + - libraryName(names.commonjs || names.root) + - "] = factory(" + - externalsRequireArray("commonjs") + - ");\n" + - getAuxiliaryComment("root") + - " else\n" + - " " + - replaceKeys( + " else if(typeof exports === 'object')\n" + + " exports[" + + libraryName(names.commonjs || names.root) + + "] = factory(" + + externalsRequireArray("commonjs") + + ");\n" + + getAuxiliaryComment("root") + + " else\n" + + " " + + replaceKeys( accessorAccess( "root", /** @type {string | string[]} */ (names.root) || /** @type {string} */ (names.commonjs) ) - ) + - " = factory(" + - externalsRootArray(externals) + - ");\n" + ) + + " = factory(" + + externalsRootArray(externals) + + ");\n" : " else {\n" + - (externals.length > 0 + (externals.length > 0 ? " var a = typeof exports === 'object' ? factory(" + - externalsRequireArray("commonjs") + - ") : factory(" + - externalsRootArray(externals) + - ");\n" + externalsRequireArray("commonjs") + + ") : factory(" + + externalsRootArray(externals) + + ");\n" : " var a = factory();\n") + - " for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" + - " }\n") + + " for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" + + " }\n") + `})(${runtimeTemplate.outputOptions.globalObject}, ${ runtimeTemplate.supportsArrowFunction() ? `(${externalsArguments(externals)}) =>` diff --git a/lib/logging/createConsoleLogger.js b/lib/logging/createConsoleLogger.js index 1ad0aa7144f..e6a65d98f70 100644 --- a/lib/logging/createConsoleLogger.js +++ b/lib/logging/createConsoleLogger.js @@ -45,11 +45,7 @@ const { LogType } = require("./Logger"); const filterToFunction = item => { if (typeof item === "string") { const regExp = new RegExp( - `[\\\\/]${item.replace( - // eslint-disable-next-line no-useless-escape - /[-[\]{}()*+?.\\^$|]/g, - "\\$&" - )}([\\\\/]|$|!|\\?)` + `[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)` ); return ident => regExp.test(ident); } @@ -114,9 +110,7 @@ module.exports = ({ level = "info", debug = false, console }) => { switch (type) { case LogType.debug: if (!debug) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins if (typeof console.debug === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.debug(...labeledArgs()); } else { console.log(...labeledArgs()); @@ -145,9 +139,7 @@ module.exports = ({ level = "info", debug = false, console }) => { case LogType.groupCollapsed: if (!debug && loglevel > LogLevel.log) return; if (!debug && loglevel > LogLevel.verbose) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins if (typeof console.groupCollapsed === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.groupCollapsed(...labeledArgs()); } else { console.log(...labeledArgs()); @@ -157,9 +149,7 @@ module.exports = ({ level = "info", debug = false, console }) => { // falls through case LogType.group: if (!debug && loglevel > LogLevel.log) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins if (typeof console.group === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.group(...labeledArgs()); } else { console.log(...labeledArgs()); @@ -167,9 +157,7 @@ module.exports = ({ level = "info", debug = false, console }) => { break; case LogType.groupEnd: if (!debug && loglevel > LogLevel.log) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins if (typeof console.groupEnd === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.groupEnd(); } break; @@ -185,24 +173,18 @@ module.exports = ({ level = "info", debug = false, console }) => { break; } case LogType.profile: - // eslint-disable-next-line node/no-unsupported-features/node-builtins if (typeof console.profile === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.profile(...labeledArgs()); } break; case LogType.profileEnd: - // eslint-disable-next-line node/no-unsupported-features/node-builtins if (typeof console.profileEnd === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.profileEnd(...labeledArgs()); } break; case LogType.clear: if (!debug && loglevel > LogLevel.log) return; - // eslint-disable-next-line node/no-unsupported-features/node-builtins if (typeof console.clear === "function") { - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.clear(); } break; diff --git a/lib/node/ReadFileChunkLoadingRuntimeModule.js b/lib/node/ReadFileChunkLoadingRuntimeModule.js index eac29d9c601..5a715c9b559 100644 --- a/lib/node/ReadFileChunkLoadingRuntimeModule.js +++ b/lib/node/ReadFileChunkLoadingRuntimeModule.js @@ -113,10 +113,10 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { withOnChunkLoad ? `${ RuntimeGlobals.onChunksLoaded - }.readFileVm = ${runtimeTemplate.returningFunction( + }.readFileVm = ${runtimeTemplate.returningFunction( "installedChunks[chunkId] === 0", "chunkId" - )};` + )};` : "// no on chunks loaded", "", withLoading || withExternalInstallChunk @@ -141,7 +141,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { ]), "}", withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" - ])};` + ])};` : "// no chunk install function needed", "", withLoading @@ -192,17 +192,17 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { "}" ]), "}" - ]) + ]) : Template.indent(["installedChunks[chunkId] = 0;"]), "};" - ]) + ]) : "// no chunk loading", "", withExternalInstallChunk ? Template.asString([ `module.exports = ${RuntimeGlobals.require};`, `${RuntimeGlobals.externalInstallChunk} = installChunk;` - ]) + ]) : "// no external install chunk", "", withHmr @@ -263,7 +263,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { /\$hmrInvalidateModuleHandlers\$/g, RuntimeGlobals.hmrInvalidateModuleHandlers ) - ]) + ]) : "// no HMR", "", withHmrManifest @@ -291,7 +291,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule { "});" ]), "}" - ]) + ]) : "// no HMR manifest" ]); } diff --git a/lib/node/RequireChunkLoadingRuntimeModule.js b/lib/node/RequireChunkLoadingRuntimeModule.js index f0b37b09939..b03575af447 100644 --- a/lib/node/RequireChunkLoadingRuntimeModule.js +++ b/lib/node/RequireChunkLoadingRuntimeModule.js @@ -113,10 +113,10 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule { withOnChunkLoad ? `${ RuntimeGlobals.onChunksLoaded - }.require = ${runtimeTemplate.returningFunction( + }.require = ${runtimeTemplate.returningFunction( "installedChunks[chunkId]", "chunkId" - )};` + )};` : "// no on chunks loaded", "", withLoading || withExternalInstallChunk @@ -135,7 +135,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule { "for(var i = 0; i < chunkIds.length; i++)", Template.indent("installedChunks[chunkIds[i]] = 1;"), withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : "" - ])};` + ])};` : "// no chunk install function needed", "", withLoading @@ -162,17 +162,17 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule { "" ]), "}" - ] + ] : "installedChunks[chunkId] = 1;" )};` - ]) + ]) : "// no chunk loading", "", withExternalInstallChunk ? Template.asString([ `module.exports = ${RuntimeGlobals.require};`, `${RuntimeGlobals.externalInstallChunk} = installChunk;` - ]) + ]) : "// no external install chunk", "", withHmr @@ -220,7 +220,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule { /\$hmrInvalidateModuleHandlers\$/g, RuntimeGlobals.hmrInvalidateModuleHandlers ) - ]) + ]) : "// no HMR", "", withHmrManifest @@ -236,7 +236,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule { "})['catch'](function(err) { if(err.code !== 'MODULE_NOT_FOUND') throw err; });" ]), "}" - ]) + ]) : "// no HMR manifest" ]); } diff --git a/lib/node/nodeConsole.js b/lib/node/nodeConsole.js index 3365f6bda20..24676d1188c 100644 --- a/lib/node/nodeConsole.js +++ b/lib/node/nodeConsole.js @@ -102,17 +102,13 @@ module.exports = ({ colors, appendOnly, stream }) => { else if (currentIndent.length >= 2) currentIndent = currentIndent.slice(0, currentIndent.length - 2); }, - // eslint-disable-next-line node/no-unsupported-features/node-builtins profile: console.profile && (name => console.profile(name)), - // eslint-disable-next-line node/no-unsupported-features/node-builtins profileEnd: console.profileEnd && (name => console.profileEnd(name)), clear: !appendOnly && - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.clear && (() => { clearStatusMessage(); - // eslint-disable-next-line node/no-unsupported-features/node-builtins console.clear(); writeStatusMessage(); }), @@ -136,6 +132,6 @@ module.exports = ({ colors, appendOnly, stream }) => { currentStatusMessage = [name, ...args]; writeStatusMessage(); } - } + } }; }; diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index f889b5e2042..87466ae9085 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -335,10 +335,10 @@ const getFinalBinding = ( const defaultExport = asCall ? `${info.interopDefaultAccessName}()` : asiSafe - ? `(${info.interopDefaultAccessName}())` - : asiSafe === false - ? `;(${info.interopDefaultAccessName}())` - : `${info.interopDefaultAccessName}.a`; + ? `(${info.interopDefaultAccessName}())` + : asiSafe === false + ? `;(${info.interopDefaultAccessName}())` + : `${info.interopDefaultAccessName}.a`; return { info, rawName: defaultExport, @@ -568,8 +568,8 @@ const getFinalName = ( return asiSafe ? `(0,${reference})` : asiSafe === false - ? `;(0,${reference})` - : `/*#__PURE__*/Object(${reference})`; + ? `;(0,${reference})` + : `/*#__PURE__*/Object(${reference})`; } return reference; } @@ -1541,7 +1541,7 @@ class ConcatenatedModule extends Module { nsObj.length > 0 ? `${RuntimeGlobals.definePropertyGetters}(${name}, {${nsObj.join( "," - )}\n});\n` + )}\n});\n` : ""; if (nsObj.length > 0) runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); diff --git a/lib/optimize/InnerGraphPlugin.js b/lib/optimize/InnerGraphPlugin.js index f541030afe0..071f31ab9ef 100644 --- a/lib/optimize/InnerGraphPlugin.js +++ b/lib/optimize/InnerGraphPlugin.js @@ -177,7 +177,6 @@ class InnerGraphPlugin { ) { pureDeclarators.add(decl); } - return true; } } }); @@ -336,6 +335,15 @@ class InnerGraphPlugin { parser.walkExpression(decl.init); InnerGraph.setTopLevelSymbol(parser.state, undefined); return true; + } else if ( + decl.id.type === "Identifier" && + decl.init && + decl.init.type === "ClassExpression" && + classWithTopLevelSymbol.has(decl.init) + ) { + parser.walkExpression(decl.init); + InnerGraph.setTopLevelSymbol(parser.state, undefined); + return true; } }); diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index 7b0adfa8139..944bfa09dd3 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -284,8 +284,8 @@ class ModuleConcatenationPlugin { filteredRuntime === true ? chunkRuntime : filteredRuntime === false - ? undefined - : filteredRuntime; + ? undefined + : filteredRuntime; // create a configuration with the root const currentConfiguration = new ConcatConfiguration( diff --git a/lib/optimize/RemoveParentModulesPlugin.js b/lib/optimize/RemoveParentModulesPlugin.js index d609ac004e7..de8f0e0b8ad 100644 --- a/lib/optimize/RemoveParentModulesPlugin.js +++ b/lib/optimize/RemoveParentModulesPlugin.js @@ -6,12 +6,58 @@ "use strict"; const { STAGE_BASIC } = require("../OptimizationStages"); -const Queue = require("../util/Queue"); -const { intersect } = require("../util/SetHelpers"); /** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../ChunkGroup")} ChunkGroup */ /** @typedef {import("../Compiler")} Compiler */ +/** @typedef {import("../Module")} Module */ + +/** + * Intersects multiple masks represented as bigints + * @param {bigint[]} masks The module masks to intersect + * @returns {bigint} The intersection of all masks + */ +function intersectMasks(masks) { + let result = masks[0]; + for (let i = masks.length - 1; i >= 1; i--) { + result &= masks[i]; + } + return result; +} + +const ZERO_BIGINT = BigInt(0); +const ONE_BIGINT = BigInt(1); +const THIRTY_TWO_BIGINT = BigInt(32); + +/** + * Parses the module mask and returns the modules represented by it + * @param {bigint} mask the module mask + * @param {Module[]} ordinalModules the modules in the order they were added to the mask (LSB is index 0) + * @returns {Generator} the modules represented by the mask + */ +function* getModulesFromMask(mask, ordinalModules) { + let offset = 31; + while (mask !== ZERO_BIGINT) { + // Consider the last 32 bits, since that's what Math.clz32 can handle + let last32 = Number(BigInt.asUintN(32, mask)); + while (last32 > 0) { + let last = Math.clz32(last32); + // The number of trailing zeros is the number trimmed off the input mask + 31 - the number of leading zeros + // The 32 is baked into the initial value of offset + const moduleIndex = offset - last; + // The number of trailing zeros is the index into the array generated by getOrCreateModuleMask + const module = ordinalModules[moduleIndex]; + yield module; + // Remove the matched module from the mask + // Since we can only count leading zeros, not trailing, we can't just downshift the mask + last32 &= ~(1 << (31 - last)); + } + + // Remove the processed chunk from the mask + mask >>= THIRTY_TWO_BIGINT; + offset += 32; + } +} class RemoveParentModulesPlugin { /** @@ -26,92 +72,122 @@ class RemoveParentModulesPlugin { */ const handler = (chunks, chunkGroups) => { const chunkGraph = compilation.chunkGraph; - const queue = new Queue(); + const queue = new Set(); const availableModulesMap = new WeakMap(); + let nextModuleMask = ONE_BIGINT; + const maskByModule = new WeakMap(); + const ordinalModules = []; + + /** + * Gets or creates a unique mask for a module + * @param {Module} mod the module to get the mask for + * @returns {bigint} the module mask to uniquely identify the module + */ + const getOrCreateModuleMask = mod => { + let id = maskByModule.get(mod); + if (id === undefined) { + id = nextModuleMask; + ordinalModules.push(mod); + maskByModule.set(mod, id); + nextModuleMask <<= ONE_BIGINT; + } + return id; + }; + + // Initialize masks by chunk and by chunk group for quicker comparisons + const chunkMasks = new WeakMap(); + for (const chunk of chunks) { + let mask = ZERO_BIGINT; + for (const m of chunkGraph.getChunkModulesIterable(chunk)) { + const id = getOrCreateModuleMask(m); + mask |= id; + } + chunkMasks.set(chunk, mask); + } + + const chunkGroupMasks = new WeakMap(); + for (const chunkGroup of chunkGroups) { + let mask = ZERO_BIGINT; + for (const chunk of chunkGroup.chunks) { + const chunkMask = chunkMasks.get(chunk); + if (chunkMask !== undefined) { + mask |= chunkMask; + } + } + chunkGroupMasks.set(chunkGroup, mask); + } + for (const chunkGroup of compilation.entrypoints.values()) { // initialize available modules for chunks without parents - availableModulesMap.set(chunkGroup, new Set()); + availableModulesMap.set(chunkGroup, ZERO_BIGINT); for (const child of chunkGroup.childrenIterable) { - queue.enqueue(child); + queue.add(child); } } for (const chunkGroup of compilation.asyncEntrypoints) { // initialize available modules for chunks without parents - availableModulesMap.set(chunkGroup, new Set()); + availableModulesMap.set(chunkGroup, ZERO_BIGINT); for (const child of chunkGroup.childrenIterable) { - queue.enqueue(child); + queue.add(child); } } - while (queue.length > 0) { - const chunkGroup = queue.dequeue(); - let availableModules = availableModulesMap.get(chunkGroup); + for (const chunkGroup of queue) { + let availableModulesMask = availableModulesMap.get(chunkGroup); let changed = false; for (const parent of chunkGroup.parentsIterable) { const availableModulesInParent = availableModulesMap.get(parent); if (availableModulesInParent !== undefined) { + const parentMask = + availableModulesInParent | chunkGroupMasks.get(parent); // If we know the available modules in parent: process these - if (availableModules === undefined) { + if (availableModulesMask === undefined) { // if we have not own info yet: create new entry - availableModules = new Set(availableModulesInParent); - for (const chunk of parent.chunks) { - for (const m of chunkGraph.getChunkModulesIterable(chunk)) { - availableModules.add(m); - } - } - availableModulesMap.set(chunkGroup, availableModules); + availableModulesMask = parentMask; changed = true; } else { - for (const m of availableModules) { - if ( - !chunkGraph.isModuleInChunkGroup(m, parent) && - !availableModulesInParent.has(m) - ) { - availableModules.delete(m); - changed = true; - } + let newMask = availableModulesMask & parentMask; + if (newMask !== availableModulesMask) { + changed = true; + availableModulesMask = newMask; } } } } + if (changed) { + availableModulesMap.set(chunkGroup, availableModulesMask); // if something changed: enqueue our children for (const child of chunkGroup.childrenIterable) { - queue.enqueue(child); + // Push the child to the end of the queue + queue.delete(child); + queue.add(child); } } } // now we have available modules for every chunk for (const chunk of chunks) { + const chunkMask = chunkMasks.get(chunk); + if (chunkMask === undefined) continue; // No info about this chunk + const availableModulesSets = Array.from( chunk.groupsIterable, chunkGroup => availableModulesMap.get(chunkGroup) ); if (availableModulesSets.some(s => s === undefined)) continue; // No info about this chunk group - const availableModules = - availableModulesSets.length === 1 - ? availableModulesSets[0] - : intersect(availableModulesSets); - const numberOfModules = chunkGraph.getNumberOfChunkModules(chunk); - const toRemove = new Set(); - if (numberOfModules < availableModules.size) { - for (const m of chunkGraph.getChunkModulesIterable(chunk)) { - if (availableModules.has(m)) { - toRemove.add(m); - } - } - } else { - for (const m of availableModules) { - if (chunkGraph.isModuleInChunk(m, chunk)) { - toRemove.add(m); - } + + const availableModulesMask = intersectMasks(availableModulesSets); + const toRemoveMask = chunkMask & availableModulesMask; + if (toRemoveMask !== ZERO_BIGINT) { + for (const module of getModulesFromMask( + toRemoveMask, + ordinalModules + )) { + chunkGraph.disconnectChunkAndModule(chunk, module); } } - for (const module of toRemove) { - chunkGraph.disconnectChunkAndModule(chunk, module); - } } }; compilation.hooks.optimizeChunks.tap( diff --git a/lib/optimize/SideEffectsFlagPlugin.js b/lib/optimize/SideEffectsFlagPlugin.js index 5628ed382c0..cd1e7fce0b5 100644 --- a/lib/optimize/SideEffectsFlagPlugin.js +++ b/lib/optimize/SideEffectsFlagPlugin.js @@ -159,8 +159,8 @@ class SideEffectsFlagPlugin { statement.test ? statement.test.range[1] : statement.init - ? statement.init.range[1] - : statement.range[0] + ? statement.init.range[1] + : statement.range[0] ) ) { sideEffectsStatement = statement; @@ -243,7 +243,12 @@ class SideEffectsFlagPlugin { ); logger.time("update dependencies"); - for (const module of modules) { + + const optimizedModules = new Set(); + + const optimizeIncomingConnections = module => { + if (optimizedModules.has(module)) return; + optimizedModules.add(module); if (module.getSideEffectsConnectionState(moduleGraph) === false) { const exportsInfo = moduleGraph.getExportsInfo(module); for (const connection of moduleGraph.getIncomingConnections( @@ -258,6 +263,9 @@ class SideEffectsFlagPlugin { (dep instanceof HarmonyImportSpecifierDependency && !dep.namespaceObjectAsContext) ) { + if (connection.originModule !== null) { + optimizeIncomingConnections(connection.originModule); + } // TODO improve for export * if (isReexport && dep.name) { const exportInfo = moduleGraph.getExportInfo( @@ -314,6 +322,10 @@ class SideEffectsFlagPlugin { } } } + }; + + for (const module of modules) { + optimizeIncomingConnections(module); } logger.timeEnd("update dependencies"); } diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index 2e79ab6a2a3..d430df4955f 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -749,20 +749,20 @@ module.exports = class SplitChunksPlugin { cacheGroupSource.minChunks !== undefined ? cacheGroupSource.minChunks : cacheGroupSource.enforce - ? 1 - : this.options.minChunks, + ? 1 + : this.options.minChunks, maxAsyncRequests: cacheGroupSource.maxAsyncRequests !== undefined ? cacheGroupSource.maxAsyncRequests : cacheGroupSource.enforce - ? Infinity - : this.options.maxAsyncRequests, + ? Infinity + : this.options.maxAsyncRequests, maxInitialRequests: cacheGroupSource.maxInitialRequests !== undefined ? cacheGroupSource.maxInitialRequests : cacheGroupSource.enforce - ? Infinity - : this.options.maxInitialRequests, + ? Infinity + : this.options.maxInitialRequests, getName: cacheGroupSource.getName !== undefined ? cacheGroupSource.getName @@ -1428,13 +1428,13 @@ module.exports = class SplitChunksPlugin { chunk.isOnlyInitial() ? item.cacheGroup.maxInitialRequests : chunk.canBeInitial() - ? Math.min( - /** @type {number} */ - (item.cacheGroup.maxInitialRequests), - /** @type {number} */ - (item.cacheGroup.maxAsyncRequests) - ) - : item.cacheGroup.maxAsyncRequests + ? Math.min( + /** @type {number} */ + (item.cacheGroup.maxInitialRequests), + /** @type {number} */ + (item.cacheGroup.maxAsyncRequests) + ) + : item.cacheGroup.maxAsyncRequests ); if ( isFinite(maxRequests) && @@ -1569,21 +1569,21 @@ module.exports = class SplitChunksPlugin { oldMaxSizeSettings.minSize, item.cacheGroup._minSizeForMaxSize, Math.max - ) + ) : item.cacheGroup.minSize, maxAsyncSize: oldMaxSizeSettings ? combineSizes( oldMaxSizeSettings.maxAsyncSize, item.cacheGroup.maxAsyncSize, Math.min - ) + ) : item.cacheGroup.maxAsyncSize, maxInitialSize: oldMaxSizeSettings ? combineSizes( oldMaxSizeSettings.maxInitialSize, item.cacheGroup.maxInitialSize, Math.min - ) + ) : item.cacheGroup.maxInitialSize, automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter, keys: oldMaxSizeSettings diff --git a/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js b/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js index 95f097113e2..740bbe8c3c1 100644 --- a/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +++ b/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js @@ -42,10 +42,10 @@ class ChunkPrefetchStartupRuntimeModule extends RuntimeModule { chunks, c => `${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)});` - ) + ) : `${JSON.stringify(Array.from(chunks, c => c.id))}.map(${ RuntimeGlobals.prefetchChunk - });` + });` )}, 5);` ) ); diff --git a/lib/rules/RuleSetCompiler.js b/lib/rules/RuleSetCompiler.js index 7f602764caa..3b07b3ad775 100644 --- a/lib/rules/RuleSetCompiler.js +++ b/lib/rules/RuleSetCompiler.js @@ -272,7 +272,7 @@ class RuleSetCompiler { if (!Array.isArray(value)) { throw this.error( `${path}.or`, - condition.and, + condition.or, "Expected array of conditions" ); } diff --git a/lib/runtime/AutoPublicPathRuntimeModule.js b/lib/runtime/AutoPublicPathRuntimeModule.js index 60cf1b29558..cc62fc8117c 100644 --- a/lib/runtime/AutoPublicPathRuntimeModule.js +++ b/lib/runtime/AutoPublicPathRuntimeModule.js @@ -63,7 +63,7 @@ class AutoPublicPathRuntimeModule extends RuntimeModule { "}" ]), "}" - ]), + ]), "// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration", '// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.', 'if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");', @@ -72,7 +72,7 @@ class AutoPublicPathRuntimeModule extends RuntimeModule { ? `${RuntimeGlobals.publicPath} = scriptUrl;` : `${RuntimeGlobals.publicPath} = scriptUrl + ${JSON.stringify( undoPath - )};` + )};` ]); } } diff --git a/lib/runtime/GetChunkFilenameRuntimeModule.js b/lib/runtime/GetChunkFilenameRuntimeModule.js index 1ca4cd8a3fc..6dab9cdfd35 100644 --- a/lib/runtime/GetChunkFilenameRuntimeModule.js +++ b/lib/runtime/GetChunkFilenameRuntimeModule.js @@ -152,7 +152,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { chunk: c, contentHashType: contentType }) - ) + ) : JSON.stringify(chunkFilename); const staticChunkFilename = compilation.getPath(chunkFilenameValue, { hash: `" + ${RuntimeGlobals.getFullHash}() + "`, @@ -219,7 +219,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { return useId ? `(chunkId === ${JSON.stringify(lastKey)} ? ${JSON.stringify( obj[/** @type {number | string} */ (lastKey)] - )} : chunkId)` + )} : chunkId)` : JSON.stringify(obj[/** @type {number | string} */ (lastKey)]); } return useId @@ -285,13 +285,13 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule { : `{${Array.from( ids, id => `${JSON.stringify(id)}:1` - ).join(",")}}[chunkId]`; + ).join(",")}}[chunkId]`; return `if (${condition}) return ${url};`; }) ), "// return url for filenames based on template", `return ${url};` - ] + ] : ["// return url for filenames based on template", `return ${url};`] )};` ]); diff --git a/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js b/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js index 9710561fa15..a61e1114be7 100644 --- a/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +++ b/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js @@ -46,7 +46,7 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule { "script", "script" )}` - ] + ] : []), ...(this.runtimeRequirements.has(RuntimeGlobals.createScriptUrl) ? [ @@ -54,7 +54,7 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule { "url", "url" )}` - ] + ] : []) ].join(",\n") ), @@ -80,11 +80,11 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule { )}');` ]), "}" - ] + ] : []) ]), "}" - ] + ] : []) ]), "}", diff --git a/lib/runtime/LoadScriptRuntimeModule.js b/lib/runtime/LoadScriptRuntimeModule.js index 2b0bb7bb537..9ed64dbd880 100644 --- a/lib/runtime/LoadScriptRuntimeModule.js +++ b/lib/runtime/LoadScriptRuntimeModule.js @@ -90,7 +90,7 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule { 'script.setAttribute("fetchpriority", fetchPriority);' ), "}" - ]) + ]) : "", `script.src = ${ this._withCreateScriptUrl @@ -106,7 +106,7 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule { `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};` ), "}" - ]) + ]) : "" ]); diff --git a/lib/runtime/StartupChunkDependenciesRuntimeModule.js b/lib/runtime/StartupChunkDependenciesRuntimeModule.js index 0a4aae68ee8..90f3d92f2de 100644 --- a/lib/runtime/StartupChunkDependenciesRuntimeModule.js +++ b/lib/runtime/StartupChunkDependenciesRuntimeModule.js @@ -46,28 +46,29 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule { ) .concat("return next();") : chunkIds.length === 1 - ? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify( - chunkIds[0] - )}).then(next);` - : chunkIds.length > 2 - ? [ - // using map is shorter for 3 or more chunks - `return Promise.all(${JSON.stringify(chunkIds)}.map(${ - RuntimeGlobals.ensureChunk - }, ${RuntimeGlobals.require})).then(next);` - ] - : [ - // calling ensureChunk directly is shorter for 0 - 2 chunks - "return Promise.all([", - Template.indent( - chunkIds - .map( - id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})` - ) - .join(",\n") - ), - "]).then(next);" - ] + ? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify( + chunkIds[0] + )}).then(next);` + : chunkIds.length > 2 + ? [ + // using map is shorter for 3 or more chunks + `return Promise.all(${JSON.stringify(chunkIds)}.map(${ + RuntimeGlobals.ensureChunk + }, ${RuntimeGlobals.require})).then(next);` + ] + : [ + // calling ensureChunk directly is shorter for 0 - 2 chunks + "return Promise.all([", + Template.indent( + chunkIds + .map( + id => + `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})` + ) + .join(",\n") + ), + "]).then(next);" + ] )};` ]); } diff --git a/lib/runtime/StartupEntrypointRuntimeModule.js b/lib/runtime/StartupEntrypointRuntimeModule.js index 6d8dc0e97c0..5133767dab3 100644 --- a/lib/runtime/StartupEntrypointRuntimeModule.js +++ b/lib/runtime/StartupEntrypointRuntimeModule.js @@ -41,12 +41,12 @@ class StartupEntrypointRuntimeModule extends RuntimeModule { "var r = fn();", "return r === undefined ? result : r;" ])})` - ] + ] : [ `chunkIds.map(${RuntimeGlobals.ensureChunk}, ${RuntimeGlobals.require})`, "var r = fn();", "return r === undefined ? result : r;" - ]) + ]) ])}`; } } diff --git a/lib/schemes/HttpUriPlugin.js b/lib/schemes/HttpUriPlugin.js index afc15f97da7..a7c7dae0958 100644 --- a/lib/schemes/HttpUriPlugin.js +++ b/lib/schemes/HttpUriPlugin.js @@ -200,7 +200,7 @@ class Lockfile { : { resolved: key, ...entry - } + } ); } return lockfile; diff --git a/lib/serialization/FileMiddleware.js b/lib/serialization/FileMiddleware.js index be4b36502db..f93543defe9 100644 --- a/lib/serialization/FileMiddleware.js +++ b/lib/serialization/FileMiddleware.js @@ -60,23 +60,23 @@ const DECOMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024; const writeUInt64LE = Buffer.prototype.writeBigUInt64LE ? (buf, value, offset) => { buf.writeBigUInt64LE(BigInt(value), offset); - } + } : (buf, value, offset) => { const low = value % 0x100000000; const high = (value - low) / 0x100000000; buf.writeUInt32LE(low, offset); buf.writeUInt32LE(high, offset + 4); - }; + }; const readUInt64LE = Buffer.prototype.readBigUInt64LE ? (buf, offset) => { return Number(buf.readBigUInt64LE(offset)); - } + } : (buf, offset) => { const low = buf.readUInt32LE(offset); const high = buf.readUInt32LE(offset + 4); return high * 0x100000000 + low; - }; + }; /** * @typedef {Object} SerializeResult diff --git a/lib/serialization/ObjectMiddleware.js b/lib/serialization/ObjectMiddleware.js index 31890dfe819..7c7f59c33b8 100644 --- a/lib/serialization/ObjectMiddleware.js +++ b/lib/serialization/ObjectMiddleware.js @@ -718,10 +718,10 @@ class ObjectMiddleware extends SerializerMiddleware { const name = !serializerEntry ? "unknown" : !serializerEntry[1].request - ? serializerEntry[0].name - : serializerEntry[1].name - ? `${serializerEntry[1].request} ${serializerEntry[1].name}` - : serializerEntry[1].request; + ? serializerEntry[0].name + : serializerEntry[1].name + ? `${serializerEntry[1].request} ${serializerEntry[1].name}` + : serializerEntry[1].request; err.message += `\n(during deserialization of ${name})`; throw err; } diff --git a/lib/sharing/ConsumeSharedPlugin.js b/lib/sharing/ConsumeSharedPlugin.js index 1d8eb3ebd55..3c892318545 100644 --- a/lib/sharing/ConsumeSharedPlugin.js +++ b/lib/sharing/ConsumeSharedPlugin.js @@ -60,7 +60,7 @@ class ConsumeSharedPlugin { let result = item === key || !isRequiredVersion(item) ? // item is a request/key - { + { import: key, shareScope: options.shareScope || "default", shareKey: key, @@ -69,10 +69,10 @@ class ConsumeSharedPlugin { strictVersion: false, singleton: false, eager: false - } + } : // key is a request/key - // item is a version - { + // item is a version + { import: key, shareScope: options.shareScope || "default", shareKey: key, @@ -81,7 +81,7 @@ class ConsumeSharedPlugin { packageName: undefined, singleton: false, eager: false - }; + }; return result; }, (item, key) => ({ diff --git a/lib/sharing/ConsumeSharedRuntimeModule.js b/lib/sharing/ConsumeSharedRuntimeModule.js index 355adcd701c..223facceead 100644 --- a/lib/sharing/ConsumeSharedRuntimeModule.js +++ b/lib/sharing/ConsumeSharedRuntimeModule.js @@ -179,7 +179,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule { ? runtimeTemplate.basicFunction("", "") : runtimeTemplate.basicFunction("msg", [ 'if (typeof console !== "undefined" && console.warn) console.warn(msg);' - ]) + ]) };`, `var warnInvalidVersion = ${runtimeTemplate.basicFunction( "scope, scopeName, key, requiredVersion", @@ -312,7 +312,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule { `module.exports = factory();` ])}` ])});` - ]) + ]) : "// no consumes in initial chunks", this._runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) ? Template.asString([ @@ -321,6 +321,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule { null, "\t" )};`, + "var startedInstallModules = {};", `${ RuntimeGlobals.ensureChunkHandlers }.consumes = ${runtimeTemplate.basicFunction("chunkId, promises", [ @@ -330,6 +331,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule { "id", [ `if(${RuntimeGlobals.hasOwnProperty}(installedModules, id)) return promises.push(installedModules[id]);`, + "if(!startedInstallModules[id]) {", `var onFactory = ${runtimeTemplate.basicFunction( "factory", [ @@ -342,6 +344,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule { ])}` ] )};`, + "startedInstallModules[id] = true;", `var onError = ${runtimeTemplate.basicFunction("error", [ "delete installedModules[id];", `${ @@ -360,13 +363,14 @@ class ConsumeSharedRuntimeModule extends RuntimeModule { ), "} else onFactory(promise);" ]), - "} catch(e) { onError(e); }" + "} catch(e) { onError(e); }", + "}" ] )});` ]), "}" ])}` - ]) + ]) : "// no chunk loading of consumes" ]); } diff --git a/lib/sharing/ProvideSharedModule.js b/lib/sharing/ProvideSharedModule.js index ae8e38dcefe..40796dd7bf7 100644 --- a/lib/sharing/ProvideSharedModule.js +++ b/lib/sharing/ProvideSharedModule.js @@ -141,13 +141,13 @@ class ProvideSharedModule extends Module { chunkGraph, request: this._request, runtimeRequirements - }) + }) : runtimeTemplate.asyncModuleFactory({ block: this.blocks[0], chunkGraph, request: this._request, runtimeRequirements - }) + }) }${this._eager ? ", 1" : ""});`; const sources = new Map(); const data = new Map(); diff --git a/lib/sharing/SharePlugin.js b/lib/sharing/SharePlugin.js index ccbd9bbdde5..65935b30b99 100644 --- a/lib/sharing/SharePlugin.js +++ b/lib/sharing/SharePlugin.js @@ -34,11 +34,11 @@ class SharePlugin { item === key || !isRequiredVersion(item) ? { import: item - } + } : { import: key, requiredVersion: item - }; + }; return config; }, item => item diff --git a/lib/sharing/ShareRuntimeModule.js b/lib/sharing/ShareRuntimeModule.js index a9c666850f9..0f63ef68d7d 100644 --- a/lib/sharing/ShareRuntimeModule.js +++ b/lib/sharing/ShareRuntimeModule.js @@ -89,7 +89,7 @@ class ShareRuntimeModule extends RuntimeModule { ? runtimeTemplate.basicFunction("", "") : runtimeTemplate.basicFunction("msg", [ 'if (typeof console !== "undefined" && console.warn) console.warn(msg);' - ]) + ]) };`, `var uniqueName = ${JSON.stringify(uniqueName || undefined)};`, `var register = ${runtimeTemplate.basicFunction( diff --git a/lib/sharing/utils.js b/lib/sharing/utils.js index b415df313d5..87ec3a0ffca 100644 --- a/lib/sharing/utils.js +++ b/lib/sharing/utils.js @@ -371,33 +371,29 @@ const getDescriptionFile = (fs, directory, descriptionFiles, callback) => { }; exports.getDescriptionFile = getDescriptionFile; -exports.getRequiredVersionFromDescriptionFile = (data, packageName) => { - if ( - data.optionalDependencies && - typeof data.optionalDependencies === "object" && - packageName in data.optionalDependencies - ) { - return normalizeVersion(data.optionalDependencies[packageName]); - } - if ( - data.dependencies && - typeof data.dependencies === "object" && - packageName in data.dependencies - ) { - return normalizeVersion(data.dependencies[packageName]); - } - if ( - data.peerDependencies && - typeof data.peerDependencies === "object" && - packageName in data.peerDependencies - ) { - return normalizeVersion(data.peerDependencies[packageName]); - } - if ( - data.devDependencies && - typeof data.devDependencies === "object" && - packageName in data.devDependencies - ) { - return normalizeVersion(data.devDependencies[packageName]); +/** + * + * @param {object} data description file data i.e.: package.json + * @param {string} packageName name of the dependency + * @returns {string} normalized version + */ +const getRequiredVersionFromDescriptionFile = (data, packageName) => { + const dependencyTypes = [ + "optionalDependencies", + "dependencies", + "peerDependencies", + "devDependencies" + ]; + + for (const dependencyType of dependencyTypes) { + if ( + data[dependencyType] && + typeof data[dependencyType] === "object" && + packageName in data[dependencyType] + ) { + return normalizeVersion(data[dependencyType][packageName]); + } } }; +exports.getRequiredVersionFromDescriptionFile = + getRequiredVersionFromDescriptionFile; diff --git a/lib/stats/DefaultStatsFactoryPlugin.js b/lib/stats/DefaultStatsFactoryPlugin.js index a18aa475c9d..70f0998be86 100644 --- a/lib/stats/DefaultStatsFactoryPlugin.js +++ b/lib/stats/DefaultStatsFactoryPlugin.js @@ -1068,7 +1068,7 @@ const SIMPLE_EXTRACTORS = { return childStatsChunkGroup; }) - ) + ) : undefined, childAssets: children ? mapObject(children, groups => { @@ -1082,7 +1082,7 @@ const SIMPLE_EXTRACTORS = { } } return Array.from(set); - }) + }) : undefined }; Object.assign(object, statsChunkGroup); @@ -1379,8 +1379,8 @@ const SIMPLE_EXTRACTORS = { chunk.runtime === undefined ? undefined : typeof chunk.runtime === "string" - ? [makePathsRelative(chunk.runtime)] - : Array.from(chunk.runtime.sort(), makePathsRelative), + ? [makePathsRelative(chunk.runtime)] + : Array.from(chunk.runtime.sort(), makePathsRelative), files: Array.from(chunk.files), auxiliaryFiles: Array.from(chunk.auxiliaryFiles).sort(compareIds), hash: chunk.renderedHash, @@ -1633,8 +1633,8 @@ const getItemSize = item => { return !item.children ? 1 : item.filteredChildren - ? 2 + getTotalSize(item.children) - : 1 + getTotalSize(item.children); + ? 2 + getTotalSize(item.children) + : 1 + getTotalSize(item.children); }; const getTotalSize = children => { @@ -1912,13 +1912,13 @@ const ASSETS_GROUPERS = { [name]: !!key, filteredChildren: assets.length, ...assetGroup(children, assets) - } + } : { type: "assets by status", [name]: !!key, children, ...assetGroup(children, assets) - }; + }; } }); }; @@ -2169,8 +2169,8 @@ const MODULES_GROUPERS = type => ({ type: isDataUrl ? "modules by mime type" : groupModulesByPath - ? "modules by path" - : "modules by extension", + ? "modules by path" + : "modules by extension", name: isDataUrl ? key.slice(/* 'data:'.length */ 5) : key, children, ...moduleGroup(children, modules) diff --git a/lib/stats/DefaultStatsPresetPlugin.js b/lib/stats/DefaultStatsPresetPlugin.js index 77795dcb905..983755904e2 100644 --- a/lib/stats/DefaultStatsPresetPlugin.js +++ b/lib/stats/DefaultStatsPresetPlugin.js @@ -197,8 +197,8 @@ const DEFAULTS = { runtime !== undefined ? runtime : forToString - ? all === true - : all !== false, + ? all === true + : all !== false, cachedModules: ({ all, cached }, { forToString }) => cached !== undefined ? cached : forToString ? all === true : all !== false, moduleAssets: OFF_FOR_TO_STRING, @@ -238,11 +238,7 @@ const DEFAULTS = { const normalizeFilter = item => { if (typeof item === "string") { const regExp = new RegExp( - `[\\\\/]${item.replace( - // eslint-disable-next-line no-useless-escape - /[-[\]{}()*+?.\\^$|]/g, - "\\$&" - )}([\\\\/]|$|!|\\?)` + `[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)` ); return ident => regExp.test(ident); } diff --git a/lib/stats/DefaultStatsPrinterPlugin.js b/lib/stats/DefaultStatsPrinterPlugin.js index 20b19adc8a3..7821075ae6f 100644 --- a/lib/stats/DefaultStatsPrinterPlugin.js +++ b/lib/stats/DefaultStatsPrinterPlugin.js @@ -128,7 +128,7 @@ const SIMPLE_PRINTERS = { warningsCount > 0 ? yellow( `${warningsCount} ${plural(warningsCount, "warning", "warnings")}` - ) + ) : ""; const errorsMessage = errorsCount > 0 @@ -143,10 +143,10 @@ const SIMPLE_PRINTERS = { root && name ? bold(name) : name - ? `Child ${bold(name)}` - : root - ? "" - : "Child"; + ? `Child ${bold(name)}` + : root + ? "" + : "Child"; const subjectMessage = nameMessage && versionMessage ? `${nameMessage} (${versionMessage})` @@ -180,7 +180,7 @@ const SIMPLE_PRINTERS = { count, "warning has", "warnings have" - )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` + )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` : undefined, "compilation.filteredErrorDetailsCount": (count, { yellow }) => count @@ -190,7 +190,7 @@ const SIMPLE_PRINTERS = { "error has", "errors have" )} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` - ) + ) : undefined, "compilation.env": (env, { bold }) => env @@ -204,7 +204,7 @@ const SIMPLE_PRINTERS = { : printer.print(context.type, Object.values(entrypoints), { ...context, chunkGroupKind: "Entrypoint" - }), + }), "compilation.namedChunkGroups": (namedChunkGroups, context, printer) => { if (!Array.isArray(namedChunkGroups)) { const { @@ -234,15 +234,18 @@ const SIMPLE_PRINTERS = { filteredModules, "module", "modules" - )}` + )}` : undefined, - "compilation.filteredAssets": (filteredAssets, { compilation: { assets } }) => + "compilation.filteredAssets": ( + filteredAssets, + { compilation: { assets } } + ) => filteredAssets > 0 ? `${moreCount(assets, filteredAssets)} ${plural( filteredAssets, "asset", "assets" - )}` + )}` : undefined, "compilation.logging": (logging, context, printer) => Array.isArray(logging) @@ -251,7 +254,7 @@ const SIMPLE_PRINTERS = { context.type, Object.entries(logging).map(([name, value]) => ({ ...value, name })), context - ), + ), "compilation.warningsInChildren!": (_, { yellow, compilation }) => { if ( !compilation.children && @@ -324,7 +327,7 @@ const SIMPLE_PRINTERS = { sourceFilename === true ? "from source file" : `from: ${sourceFilename}` - ) + ) : undefined, "asset.info.development": (development, { green, formatFlag }) => development ? green(formatFlag("dev")) : undefined, @@ -339,7 +342,7 @@ const SIMPLE_PRINTERS = { filteredRelated, "asset", "assets" - )}` + )}` : undefined, "asset.filteredChildren": (filteredChildren, { asset: { children } }) => filteredChildren > 0 @@ -347,7 +350,7 @@ const SIMPLE_PRINTERS = { filteredChildren, "asset", "assets" - )}` + )}` : undefined, assetChunk: (id, { formatChunkId }) => formatChunkId(id), @@ -393,22 +396,22 @@ const SIMPLE_PRINTERS = { formatFlag( `${assets.length} ${plural(assets.length, "asset", "assets")}` ) - ) + ) : undefined, "module.warnings": (warnings, { formatFlag, yellow }) => warnings === true ? yellow(formatFlag("warnings")) : warnings - ? yellow( - formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`) - ) - : undefined, + ? yellow( + formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`) + ) + : undefined, "module.errors": (errors, { formatFlag, red }) => errors === true ? red(formatFlag("errors")) : errors - ? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`)) - : undefined, + ? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`)) + : undefined, "module.providedExports": (providedExports, { formatFlag, cyan }) => { if (Array.isArray(providedExports)) { if (providedExports.length === 0) return cyan(formatFlag("no exports")); @@ -449,7 +452,7 @@ const SIMPLE_PRINTERS = { filteredModules, "module", "modules" - )}` + )}` : undefined, "module.filteredReasons": (filteredReasons, { module: { reasons } }) => filteredReasons > 0 @@ -457,7 +460,7 @@ const SIMPLE_PRINTERS = { filteredReasons, "reason", "reasons" - )}` + )}` : undefined, "module.filteredChildren": (filteredChildren, { module: { children } }) => filteredChildren > 0 @@ -465,7 +468,7 @@ const SIMPLE_PRINTERS = { filteredChildren, "module", "modules" - )}` + )}` : undefined, "module.separator!": () => "\n", @@ -492,7 +495,7 @@ const SIMPLE_PRINTERS = { filteredChildren, "reason", "reasons" - )}` + )}` : undefined, "module.profile.total": (value, { formatTime }) => formatTime(value), @@ -533,7 +536,7 @@ const SIMPLE_PRINTERS = { n, "asset", "assets" - )}` + )}` : undefined, "chunkGroup.is!": () => "=", "chunkGroupAsset.name": (asset, { green }) => green(asset), @@ -552,7 +555,7 @@ const SIMPLE_PRINTERS = { children: children[key] })), context - ), + ), "chunkGroupChildGroup.type": type => `${type}:`, "chunkGroupChild.assets[]": (file, { formatFilename }) => formatFilename(file), @@ -581,7 +584,7 @@ const SIMPLE_PRINTERS = { children: childrenByOrder[key] })), context - ), + ), "chunk.childrenByOrder[].type": type => `${type}:`, "chunk.childrenByOrder[].children[]": (id, { formatChunkId }) => isValidId(id) ? formatChunkId(id) : undefined, @@ -600,7 +603,7 @@ const SIMPLE_PRINTERS = { filteredModules, "module", "modules" - )}` + )}` : undefined, "chunk.separator!": () => "\n", @@ -1354,7 +1357,7 @@ class DefaultStatsPrinterPlugin { ? str.replace( /((\u001b\[39m|\u001b\[22m|\u001b\[0m)+)/g, `$1${start}` - ) + ) : str }\u001b[39m\u001b[22m`; } else { diff --git a/lib/util/cleverMerge.js b/lib/util/cleverMerge.js index f86934cc502..1621cc799c8 100644 --- a/lib/util/cleverMerge.js +++ b/lib/util/cleverMerge.js @@ -457,8 +457,8 @@ const mergeSingleValue = (a, b, internalCaching) => { return aType !== VALUE_TYPE_OBJECT ? b : internalCaching - ? cachedCleverMerge(a, b) - : cleverMerge(a, b); + ? cachedCleverMerge(a, b) + : cleverMerge(a, b); } case VALUE_TYPE_UNDEFINED: return a; @@ -467,8 +467,8 @@ const mergeSingleValue = (a, b, internalCaching) => { aType !== VALUE_TYPE_ATOM ? aType : Array.isArray(a) - ? VALUE_TYPE_ARRAY_EXTEND - : VALUE_TYPE_OBJECT + ? VALUE_TYPE_ARRAY_EXTEND + : VALUE_TYPE_OBJECT ) { case VALUE_TYPE_UNDEFINED: return b; diff --git a/lib/util/hash/xxhash64.js b/lib/util/hash/xxhash64.js index 98e9bd6be6a..0cc3fd48b7d 100644 --- a/lib/util/hash/xxhash64.js +++ b/lib/util/hash/xxhash64.js @@ -10,8 +10,8 @@ const create = require("./wasm-hash"); //#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1 const xxhash64 = new WebAssembly.Module( Buffer.from( - // 1170 bytes - "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAFBIGoiASAASQ0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL", + // 1168 bytes + "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrAIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAFBIGoiASAASQ0ACyACJAAgAyQBIAQkAiAFJAMLpgYCAn8EfiMEQgBSBH4jACIDQgGJIwEiBEIHiXwjAiIFQgyJfCMDIgZCEol8IANCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gBELP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAFQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAZCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQMDQCABQQhqIgIgAE0EQCADIAEpAwBCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCG4lCh5Wvr5i23puef35CnaO16oOxjYr6AH0hAyACIQEMAQsLIAFBBGoiAiAATQRAIAMgATUCAEKHla+vmLbem55/foVCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMgAiEBCwNAIAAgAUcEQCADIAExAABCxc/ZsvHluuonfoVCC4lCh5Wvr5i23puef34hAyABQQFqIQEMAQsLQQAgAyADQiGIhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFIgNCIIgiBEL//wODQiCGIARCgID8/w+DQhCIhCIEQv+BgIDwH4NCEIYgBEKA/oOAgOA/g0IIiIQiBEKPgLyA8IHAB4NCCIYgBELwgcCHgJ6A+ACDQgSIhCIEQoaMmLDgwIGDBnxCBIhCgYKEiJCgwIABg0InfiAEQrDgwIGDhoyYMIR8NwMAQQggA0L/////D4MiA0L//wODQiCGIANCgID8/w+DQhCIhCIDQv+BgIDwH4NCEIYgA0KA/oOAgOA/g0IIiIQiA0KPgLyA8IHAB4NCCIYgA0LwgcCHgJ6A+ACDQgSIhCIDQoaMmLDgwIGDBnxCBIhCgYKEiJCgwIABg0InfiADQrDgwIGDhoyYMIR8NwMACw==", "base64" ) ); diff --git a/lib/util/identifier.js b/lib/util/identifier.js index ea5ec2eaa39..659988163be 100644 --- a/lib/util/identifier.js +++ b/lib/util/identifier.js @@ -376,6 +376,6 @@ exports.getUndoPath = (filename, outputPath, enforceRelative) => { return depth > 0 ? `${"../".repeat(depth)}${append}` : enforceRelative - ? `./${append}` - : append; + ? `./${append}` + : append; }; diff --git a/lib/util/internalSerializables.js b/lib/util/internalSerializables.js index 9c4d80f0237..1cd63dbd5d5 100644 --- a/lib/util/internalSerializables.js +++ b/lib/util/internalSerializables.js @@ -45,6 +45,10 @@ module.exports = { require("../dependencies/AMDRequireItemDependency"), "dependencies/CachedConstDependency": () => require("../dependencies/CachedConstDependency"), + "dependencies/ExternalModuleDependency": () => + require("../dependencies/ExternalModuleDependency"), + "dependencies/ExternalModuleInitFragment": () => + require("../dependencies/ExternalModuleInitFragment"), "dependencies/CreateScriptUrlDependency": () => require("../dependencies/CreateScriptUrlDependency"), "dependencies/CommonJsRequireContextDependency": () => @@ -206,6 +210,8 @@ module.exports = { "util/LazySet": () => require("../util/LazySet"), UnhandledSchemeError: () => require("../UnhandledSchemeError"), NodeStuffInWebError: () => require("../NodeStuffInWebError"), + EnvironmentNotSupportAsyncWarning: () => + require("../EnvironmentNotSupportAsyncWarning"), WebpackError: () => require("../WebpackError"), "util/registerExternalSerializer": () => { diff --git a/lib/util/runtime.js b/lib/util/runtime.js index 59da3bfefb6..2903ec2a8d6 100644 --- a/lib/util/runtime.js +++ b/lib/util/runtime.js @@ -57,7 +57,7 @@ exports.getEntryRuntime = (compilation, name, options) => { * @param {boolean} deterministicOrder enforce a deterministic order * @returns {void} */ -exports.forEachRuntime = (runtime, fn, deterministicOrder = false) => { +const forEachRuntime = (runtime, fn, deterministicOrder = false) => { if (runtime === undefined) { fn(undefined); } else if (typeof runtime === "string") { @@ -69,6 +69,7 @@ exports.forEachRuntime = (runtime, fn, deterministicOrder = false) => { } } }; +exports.forEachRuntime = forEachRuntime; /** * @template T @@ -228,6 +229,22 @@ const mergeRuntime = (a, b) => { }; exports.mergeRuntime = mergeRuntime; +/** + * @param {RuntimeSpec[]} runtimes first + * @param {RuntimeSpec} runtime second + * @returns {RuntimeSpec} merged + */ +exports.deepMergeRuntime = (runtimes, runtime) => { + if (!Array.isArray(runtimes)) { + return runtime; + } + let merged = runtime; + for (const r of runtimes) { + merged = mergeRuntime(runtime, r); + } + return merged; +}; + /** * @param {RuntimeCondition} a first * @param {RuntimeCondition} b second diff --git a/lib/util/semver.js b/lib/util/semver.js index ba917dd4f89..b748007970c 100644 --- a/lib/util/semver.js +++ b/lib/util/semver.js @@ -232,16 +232,15 @@ const rangeToString = range => { fixCount == 0 ? ">=" : fixCount == -1 - ? "<" - : fixCount == 1 - ? "^" - : fixCount == 2 - ? "~" - : fixCount > 0 - ? "=" - : "!="; + ? "<" + : fixCount == 1 + ? "^" + : fixCount == 2 + ? "~" + : fixCount > 0 + ? "=" + : "!="; var needDot = 1; - // eslint-disable-next-line no-redeclare for (var i = 1; i < range.length; i++) { var item = range[i]; var t = (typeof item)[0]; @@ -249,9 +248,9 @@ const rangeToString = range => { str += t == "u" ? // undefined: prerelease marker, add an "-" - "-" + "-" : // number or string: add the item, set flag to add an "." between two of them - (needDot > 0 ? "." : "") + ((needDot = 2), item); + (needDot > 0 ? "." : "") + ((needDot = 2), item); } return str; } else { @@ -264,10 +263,10 @@ const rangeToString = range => { item === 0 ? "not(" + pop() + ")" : item === 1 - ? "(" + pop() + " || " + pop() + ")" - : item === 2 - ? stack.pop() + " " + stack.pop() - : rangeToString(item) + ? "(" + pop() + " || " + pop() + ")" + : item === 2 + ? stack.pop() + " " + stack.pop() + : rangeToString(item) ); } return pop(); @@ -416,10 +415,10 @@ const satisfy = (range, version) => { item == 1 ? p() | p() : item == 2 - ? p() & p() - : item - ? satisfy(item, version) - : !p() + ? p() & p() + : item + ? satisfy(item, version) + : !p() ); } return !!p(); @@ -452,11 +451,7 @@ 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/lib/util/smartGrouping.js b/lib/util/smartGrouping.js index ae4132a60f1..01d1d4bec8e 100644 --- a/lib/util/smartGrouping.js +++ b/lib/util/smartGrouping.js @@ -145,7 +145,7 @@ const smartGrouping = (items, groupConfigs) => { (totalSize * 2) / targetGroupCount + itemsWithGroups.size - items.size - ); + ); if ( sizeValue > bestGroupSize || (force && (!bestGroupOptions || !bestGroupOptions.force)) diff --git a/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js b/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js index 651758727b0..29b4b08d19c 100644 --- a/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +++ b/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js @@ -69,7 +69,7 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule { ]) ]), "}" - ]) + ]) : "// no support for streaming compilation", "return req", Template.indent([ diff --git a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js index baa713330b1..663504dd182 100644 --- a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +++ b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js @@ -156,7 +156,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator { "{", Template.indent(importObjRequestItems.join(",\n")), "}" - ]) + ]) : undefined; const instantiateCall = @@ -194,7 +194,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator { "} catch(e) { __webpack_async_result__(e); }" ] )}, 1);` - ]) + ]) : `${importsCode}${importsCompatCode}module.exports = ${instantiateCall};` ); diff --git a/lib/wasm-async/AsyncWebAssemblyParser.js b/lib/wasm-async/AsyncWebAssemblyParser.js index 4a9632cbd56..40f1c79eacc 100644 --- a/lib/wasm-async/AsyncWebAssemblyParser.js +++ b/lib/wasm-async/AsyncWebAssemblyParser.js @@ -7,6 +7,7 @@ const t = require("@webassemblyjs/ast"); const { decode } = require("@webassemblyjs/wasm-parser"); +const EnvironmentNotSupportAsyncWarning = require("../EnvironmentNotSupportAsyncWarning"); const Parser = require("../Parser"); const StaticExportsDependency = require("../dependencies/StaticExportsDependency"); const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency"); @@ -50,6 +51,11 @@ class WebAssemblyParser extends Parser { const BuildMeta = /** @type {BuildMeta} */ (state.module.buildMeta); BuildMeta.exportsType = "namespace"; BuildMeta.async = true; + EnvironmentNotSupportAsyncWarning.check( + state.module, + state.compilation.runtimeTemplate, + "asyncWebAssembly" + ); // parse it const program = decode(source, decoderOpts); diff --git a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js index d5265c9655b..ed01c4f1396 100644 --- a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +++ b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js @@ -354,7 +354,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule { "importObject" )});` ]) - ]) + ]) : Template.asString([ "if(importObject && typeof importObject.then === 'function') {", Template.indent([ @@ -372,7 +372,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule { ]), "});" ]) - ]), + ]), "} else {", Template.indent([ "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", diff --git a/lib/wasm-sync/WebAssemblyJavascriptGenerator.js b/lib/wasm-sync/WebAssemblyJavascriptGenerator.js index 448ae7b7a58..1b5ca88dfb4 100644 --- a/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +++ b/lib/wasm-sync/WebAssemblyJavascriptGenerator.js @@ -200,8 +200,8 @@ class WebAssemblyJavascriptGenerator extends Generator { copyAllExports ? `${module.moduleArgument}.exports = wasmExports;` : "for(var name in wasmExports) " + - `if(name) ` + - `${module.exportsArgument}[name] = wasmExports[name];`, + `if(name) ` + + `${module.exportsArgument}[name] = wasmExports[name];`, "// exec imports from WebAssembly module (for esm order)", importsCode, "", diff --git a/lib/web/JsonpChunkLoadingRuntimeModule.js b/lib/web/JsonpChunkLoadingRuntimeModule.js index 32e12f5e580..32d37577f5a 100644 --- a/lib/web/JsonpChunkLoadingRuntimeModule.js +++ b/lib/web/JsonpChunkLoadingRuntimeModule.js @@ -209,16 +209,16 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { "}" ]), "}" - ]) + ]) : Template.indent(["installedChunks[chunkId] = 0;"]) )};` - ]) + ]) : "// no chunk on demand loading", "", withPrefetch && hasJsMatcher !== false ? `${ RuntimeGlobals.prefetchChunkHandlers - }.j = ${runtimeTemplate.basicFunction("chunkId", [ + }.j = ${runtimeTemplate.basicFunction("chunkId", [ `if((!${ RuntimeGlobals.hasOwnProperty }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ @@ -232,7 +232,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { crossOriginLoading ? `link.crossOrigin = ${JSON.stringify( crossOriginLoading - )};` + )};` : "", `if (${RuntimeGlobals.scriptNonce}) {`, Template.indent( @@ -248,13 +248,13 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { "document.head.appendChild(link);" ]), "}" - ])};` + ])};` : "// no prefetching", "", withPreload && hasJsMatcher !== false ? `${ RuntimeGlobals.preloadChunkHandlers - }.j = ${runtimeTemplate.basicFunction("chunkId", [ + }.j = ${runtimeTemplate.basicFunction("chunkId", [ `if((!${ RuntimeGlobals.hasOwnProperty }(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${ @@ -290,7 +290,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { )};` ), "}" - ]) + ]) : "" ]), chunk @@ -298,7 +298,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { "document.head.appendChild(link);" ]), "}" - ])};` + ])};` : "// no preloaded", "", withHmr @@ -383,7 +383,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { /\$hmrInvalidateModuleHandlers\$/g, RuntimeGlobals.hmrInvalidateModuleHandlers ) - ]) + ]) : "// no HMR", "", withHmrManifest @@ -400,16 +400,16 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { "return response.json();" ])});` ])};` - ]) + ]) : "// no HMR manifest", "", withOnChunkLoad ? `${ RuntimeGlobals.onChunksLoaded - }.j = ${runtimeTemplate.returningFunction( + }.j = ${runtimeTemplate.returningFunction( "installedChunks[chunkId] === 0", "chunkId" - )};` + )};` : "// no on chunks loaded", "", withCallback || withLoading @@ -461,7 +461,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, "chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));", "chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));" - ]) + ]) : "// no jsonp function" ]); } diff --git a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js index 12219e1885d..a17b92bef22 100644 --- a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +++ b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js @@ -128,7 +128,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { Template.indent("installedChunks[chunkIds.pop()] = 1;"), "parentChunkLoadingFunction(data);" ])};` - ]) + ]) : "// no chunk install function needed", withLoading ? Template.asString([ @@ -152,14 +152,14 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { "}" ]), "}" - ] + ] : "installedChunks[chunkId] = 1;" )};`, "", `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`, "var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);", "chunkLoadingGlobal.push = installChunk;" - ]) + ]) : "// no chunk loading", "", withHmr @@ -196,7 +196,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { Template.getFunctionContent( require("../hmr/JavascriptHotModuleReplacement.runtime.js") ) - .replace(/\$key\$/g, "importScrips") + .replace(/\$key\$/g, "importScripts") .replace(/\$installedChunks\$/g, "installedChunks") .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk") .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache) @@ -215,7 +215,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { /\$hmrInvalidateModuleHandlers\$/g, RuntimeGlobals.hmrInvalidateModuleHandlers ) - ]) + ]) : "// no HMR", "", withHmrManifest @@ -232,7 +232,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule { "return response.json();" ])});` ])};` - ]) + ]) : "// no HMR manifest" ]); } diff --git a/package.json b/package.json index bd5adefeb99..b26628f3d82 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,18 @@ { "name": "webpack", - "version": "5.89.0", + "version": "5.90.0", "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.", "license": "MIT", "dependencies": { "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", + "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.11.5", "@webassemblyjs/wasm-edit": "^1.11.5", "@webassemblyjs/wasm-parser": "^1.11.5", "acorn": "^8.7.1", "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", + "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.15.0", "es-module-lexer": "^1.2.1", @@ -26,7 +26,7 @@ "neo-async": "^2.6.2", "schema-utils": "^3.2.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", + "terser-webpack-plugin": "^5.3.10", "watchpack": "^2.4.0", "webpack-sources": "^3.2.3" }, @@ -36,12 +36,12 @@ } }, "devDependencies": { - "@babel/core": "^7.21.4", - "@babel/preset-react": "^7.18.6", - "@types/jest": "^29.5.0", - "@types/mime-types": "^2.1.1", + "@babel/core": "^7.23.7", + "@babel/preset-react": "^7.23.3", + "@types/jest": "^29.5.11", + "@types/mime-types": "^2.1.4", "@types/node": "^20.1.7", - "assemblyscript": "^0.27.2", + "assemblyscript": "^0.27.22", "babel-loader": "^8.1.0", "benchmark": "^2.1.4", "bundle-loader": "^0.5.6", @@ -51,26 +51,26 @@ "coveralls": "^3.1.0", "cspell": "^6.31.1", "css-loader": "^5.0.1", - "date-fns": "^2.15.0", + "date-fns": "^3.2.0", "es5-ext": "^0.10.53", "es6-promise-polyfill": "^1.2.0", - "eslint": "^8.38.0", - "eslint-config-prettier": "^8.1.0", - "eslint-plugin-jest": "^27.2.1", + "eslint": "^8.48.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jest": "^27.6.3", "eslint-plugin-jsdoc": "^43.0.5", - "eslint-plugin-node": "^11.0.0", - "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-n": "^16.6.2", + "eslint-plugin-prettier": "^5.1.3", "file-loader": "^6.0.0", "fork-ts-checker-webpack-plugin": "^8.0.0", "hash-wasm": "^4.9.0", "husky": "^8.0.3", "is-ci": "^3.0.0", "istanbul": "^0.4.5", - "jest": "^29.5.0", - "jest-circus": "^29.5.0", - "jest-cli": "^29.5.0", - "jest-diff": "^29.5.0", - "jest-environment-node": "^29.5.0", + "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-junit": "^16.0.0", "json-loader": "^0.5.7", "json5": "^2.1.3", @@ -84,7 +84,7 @@ "mini-svg-data-uri": "^1.2.3", "nyc": "^15.1.0", "open-cli": "^7.2.0", - "prettier": "^2.7.1", + "prettier": "^3.2.1", "pretty-format": "^29.5.0", "pug": "^3.0.0", "pug-loader": "^2.4.0", @@ -96,9 +96,9 @@ "simple-git": "^3.17.0", "strip-ansi": "^6.0.0", "style-loader": "^2.0.0", - "terser": "^5.17.0", + "terser": "^5.26.0", "toml": "^3.0.0", - "tooling": "webpack/tooling#v1.23.0", + "tooling": "webpack/tooling#v1.23.1", "ts-loader": "^9.4.2", "typescript": "^5.0.4", "url-loader": "^4.1.0", diff --git a/schemas/WebpackOptions.check.js b/schemas/WebpackOptions.check.js index 081c5412e79..3ae89daa216 100644 --- a/schemas/WebpackOptions.check.js +++ b/schemas/WebpackOptions.check.js @@ -3,4 +3,4 @@ * DO NOT MODIFY BY HAND. * Run `yarn special-lint-fix` to update */ -const e=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;module.exports=we,module.exports.default=we;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:{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:{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:{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"]},CssChunkFilename:{oneOf:[{$ref:"#/definitions/FilenameTemplate"}]},CssExperimentOptions:{type:"object",additionalProperties:!1,properties:{exportsOnly:{type:"boolean"}}},CssFilename:{oneOf:[{$ref:"#/definitions/FilenameTemplate"}]},CssGeneratorOptions:{type:"object",additionalProperties:!1,properties:{}},CssParserOptions:{type:"object",additionalProperties:!1,properties:{}},Dependencies:{type:"array",items:{type:"string"}},DevServer:{type:"object"},DevTool:{anyOf:[{enum:[!1,"eval"]},{type:"string",pattern:"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$"}]},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"},bigIntLiteral:{type:"boolean"},const:{type:"boolean"},destructuring:{type:"boolean"},dynamicImport:{type:"boolean"},dynamicImportInWorker:{type:"boolean"},forOf:{type:"boolean"},globalThis:{type:"boolean"},module:{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:{anyOf:[{type:"boolean"},{$ref:"#/definitions/CssExperimentOptions"}]},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:{anyOf:[{enum:[!1]},{$ref:"#/definitions/CssExperimentOptions"}]},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"}]}}},{instanceof:"Function"}]},ExternalItemFunctionData:{type:"object",additionalProperties:!1,properties:{context:{type:"string"},contextInfo:{type:"object"},dependencyType:{type:"string"},getResolve:{instanceof:"Function"},request:{type:"string"}}},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","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"},javascript:{$ref:"#/definitions/EmptyGeneratorOptions"},"javascript/auto":{$ref:"#/definitions/EmptyGeneratorOptions"},"javascript/dynamic":{$ref:"#/definitions/EmptyGeneratorOptions"},"javascript/esm":{$ref:"#/definitions/EmptyGeneratorOptions"}}},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"},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"}}},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","eval-only"]},__filename:{enum:[!1,!0,"warn-mock","mock","eval-only"]},global:{enum:[!1,!0,"warn"]}}},Optimization:{type:"object",additionalProperties:!1,properties:{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"}]}}},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"},{instanceof:"Function"},{$ref:"#/definitions/OptimizationSplitChunksCacheGroup"}]},not:{type:"object",additionalProperties:!0,properties:{test:{anyOf:[{instanceof:"RegExp"},{type:"string"},{instanceof:"Function"}]}},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"}}},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"},javascript:{$ref:"#/definitions/JavascriptParserOptions"},"javascript/auto":{$ref:"#/definitions/JavascriptParserOptions"},"javascript/dynamic":{$ref:"#/definitions/JavascriptParserOptions"},"javascript/esm":{$ref:"#/definitions/JavascriptParserOptions"}}},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:{type:"object",additionalProperties:!0,properties:{apply:{instanceof:"Function"}},required:["apply"]},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"}]}}},RuleSetRules:{type:"array",items:{anyOf:[{enum:["..."]},{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/RuleSetRule"}]}},RuleSetUse:{anyOf:[{type:"array",items:{anyOf:[{$ref:"#/definitions/Falsy"},{$ref:"#/definitions/RuleSetUseItem"}]}},{instanceof:"Function"},{$ref:"#/definitions/RuleSetUseItem"}]},RuleSetUseItem:{anyOf:[{type:"object",additionalProperties:!1,properties:{ident:{type:"string"},loader:{oneOf:[{$ref:"#/definitions/RuleSetLoader"}]},options:{oneOf:[{$ref:"#/definitions/RuleSetLoaderOptions"}]}}},{instanceof:"Function"},{$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"}}}}},SourceMapFilename:{type:"string",absolutePath:!1},SourcePrefix:{type:"string"},StatsOptions:{type:"object",additionalProperties:!1,properties:{all:{type:"boolean"},assets:{type:"boolean"},assetsSort:{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:{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"},errorDetails:{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:{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-streaming","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/Optimization"},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 g=s===f;if(o=o||g,!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++}g=e===f,o=o||g}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 b=!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 g=!1;const b=i;if(i===b)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=b===i;if(g=g||l,!g){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,g=g||l}if(g)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 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;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++,g.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),g.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;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;g(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o})||(s=null===s?g.errors:s.concat(g.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}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:{anyOf:[{type:"boolean"},{$ref:"#/definitions/CssExperimentOptions"}]},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++,fe.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++,fe.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 fe.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++,fe.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 fe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return fe.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++,fe.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 fe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return fe.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++,fe.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++,fe.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 fe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return fe.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 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++,fe.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 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++,fe.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++,fe.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++,fe.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 fe.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 fe.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++,fe.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++,fe.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 fe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}}}}}return fe.errors=a,0===l}function ue(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 ue.errors=[{params:{type:"object"}}],!1;{const o=l;for(const e in t)if(!n.call(le.properties,e))return ue.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 ue.errors=[{params:{type:"string"}}],!1;if(e.length<1)return ue.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 ue.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 ue.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;fe(n,{instancePath:r+"/cacheGroups/"+t.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:t,rootData:i})||(a=null===a?fe.errors:a.concat(fe.errors),l=a.length),u=o===l,p=p||u}}}}if(!p){const e={params:{}};return null===a?a=[e]:a.push(e),l++,ue.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++,ue.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 ue.errors=[{params:{type:"array"}}],!1;if(e.length<1)return ue.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++,ue.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 ue.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 ue.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 ue.errors=[{params:{type:"string"}}],!1;if(t.length<1)return ue.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++,ue.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++,ue.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 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++,ue.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 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++,ue.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++,ue.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++,ue.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++,ue.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 ue.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 ue.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return ue.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++,ue.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 ue.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return ue.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 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++,ue.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 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++,ue.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 ue.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return ue.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=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++,ue.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 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++,ue.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 $=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++,ue.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 S=s===l;if(o=o||S,!o){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===a?a=[e]:a.push(e),l++}if(S=t===l,o=o||S,!o){const t=l;if(!(e instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),l++}S=t===l,o=o||S}}if(!o){const e={params:{}};return null===a?a=[e]:a.push(e),l++,ue.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 ue.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}}return ue.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(ae.properties,t))return ce.errors=[{params:{additionalProperty:t}}],!1;if(r===a){if(void 0!==e.checkWasmTypes){const t=a;if("boolean"!=typeof e.checkWasmTypes)return ce.errors=[{params:{type:"boolean"}}],!1;var 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++,Ae.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 Ae.errors=[{params:{type:"string"}}],!1;if(e.length<1)return Ae.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 Ae.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return Ae.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 Ae.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 Ae.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return Ae.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 Ae.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 Ae.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 Ae.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 Ae.errors=[{params:{type:"string"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.library){const e=f;xe(t.library,{instancePath:r+"/library",parentData:t,parentDataProperty:"library",rootData:i})||(l=null===l?xe.errors:l.concat(xe.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;Ce(r.performance,{instancePath:o+"/performance",parentData:r,parentDataProperty:"performance",rootData:l})||(p=null===p?Ce.errors:p.concat(Ce.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.plugins){const e=f;ke(r.plugins,{instancePath:o+"/plugins",parentData:r,parentDataProperty:"plugins",rootData:l})||(p=null===p?ke.errors:p.concat(ke.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 we.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 g=i===f;if(s=s||g,!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++}g=n===f,s=s||g}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,we.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 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++,we.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 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++,we.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;$e(r.resolve,{instancePath:o+"/resolve",parentData:r,parentDataProperty:"resolve",rootData:l})||(p=null===p?$e.errors:p.concat($e.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.resolveLoader){const e=f;Se(r.resolveLoader,{instancePath:o+"/resolveLoader",parentData:r,parentDataProperty:"resolveLoader",rootData:l})||(p=null===p?Se.errors:p.concat(Se.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 we.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)return we.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 we.errors=[{params:{type:"object"}}],!1;{const t=f;for(const t in e)if("hash"!==t&&"timestamp"!==t)return we.errors=[{params:{additionalProperty:t}}],!1;if(t===f){if(void 0!==e.hash){const t=f;if("boolean"!=typeof e.hash)return we.errors=[{params:{type:"boolean"}}],!1;var D=t===f}else D=!0;if(D)if(void 0!==e.timestamp){const t=f;if("boolean"!=typeof e.timestamp)return we.errors=[{params:{type:"boolean"}}],!1;D=t===f}else D=!0}}}var O=n===f}else O=!0;if(O){if(void 0!==t.immutablePaths){let n=t.immutablePaths;const r=f;if(f===r){if(!Array.isArray(n))return we.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 g=s===f;if(o=o||g,!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++}g=e===f,o=o||g}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 b=!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 g=!1;const b=i;if(i===b)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=b===i;if(g=g||l,!g){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,g=g||l}if(g)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 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;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++,g.errors=s,!1}return i=a,null!==s&&(a?s.length=a:s=null),g.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;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;g(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o})||(s=null===s?g.errors:s.concat(g.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}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++,Pe.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++,Pe.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 Pe.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++,Pe.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 Pe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return Pe.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++,Pe.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 Pe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return Pe.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++,Pe.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++,Pe.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 Pe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return Pe.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 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++,Pe.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 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++,Pe.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++,Pe.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++,Pe.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 Pe.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 Pe.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++,Pe.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++,Pe.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 Pe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}}}}}return Pe.errors=a,0===l}function De(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 De.errors=[{params:{type:"object"}}],!1;{const o=l;for(const e in t)if(!n.call(be.properties,e))return De.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 De.errors=[{params:{type:"string"}}],!1;if(e.length<1)return De.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 De.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 De.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;Pe(n,{instancePath:r+"/cacheGroups/"+t.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:t,rootData:i})||(a=null===a?Pe.errors:a.concat(Pe.errors),l=a.length),u=o===l,p=p||u}}}}if(!p){const e={params:{}};return null===a?a=[e]:a.push(e),l++,De.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++,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.defaultSizeTypes){let e=t.defaultSizeTypes;const n=l;if(l===n){if(!Array.isArray(e))return De.errors=[{params:{type:"array"}}],!1;if(e.length<1)return De.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++,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.fallbackCacheGroup){let e=t.fallbackCacheGroup;const n=l;if(l===n){if(!e||"object"!=typeof e||Array.isArray(e))return De.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 De.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 De.errors=[{params:{type:"string"}}],!1;if(t.length<1)return De.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++,De.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++,De.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 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++,De.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 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++,De.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++,De.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++,De.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++,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.hidePathInfo){const e=l;if("boolean"!=typeof t.hidePathInfo)return De.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 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 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++,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 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++,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 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++,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 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++,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 $=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++,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 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++,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 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++,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(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 Oe.errors=[{params:{type:"object"}}],!1;{const r=a;for(const t in e)if(!n.call(ge.properties,t))return Oe.errors=[{params:{additionalProperty:t}}],!1;if(r===a){if(void 0!==e.checkWasmTypes){const t=a;if("boolean"!=typeof e.checkWasmTypes)return Oe.errors=[{params:{type:"boolean"}}],!1;var 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 Oe.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 Oe.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 Oe.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 Oe.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 Oe.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++,Oe.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 Oe.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 Oe.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 Oe.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 Oe.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++,ze.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 ze.errors=[{params:{type:"string"}}],!1;if(e.length<1)return ze.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 ze.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return ze.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 ze.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 ze.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return ze.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 ze.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 ze.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 ze.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 ze.errors=[{params:{type:"string"}}],!1;u=e===f}else u=!0;if(u){if(void 0!==t.library){const e=f;Le(t.library,{instancePath:r+"/library",parentData:t,parentDataProperty:"library",rootData:i})||(l=null===l?Le.errors:l.concat(Le.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;Me(r.performance,{instancePath:o+"/performance",parentData:r,parentDataProperty:"performance",rootData:l})||(p=null===p?Me.errors:p.concat(Me.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.plugins){const e=f;we(r.plugins,{instancePath:o+"/plugins",parentData:r,parentDataProperty:"plugins",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.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 x=n===f}else x=!0;if(x){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 { ... }').", "type": "boolean" }, + "asyncFunction": { + "description": "The environment supports async function and await ('async function () { await ... }').", + "type": "boolean" + }, "bigIntLiteral": { "description": "The environment supports BigInt as literal (123n).", "type": "boolean" @@ -801,14 +879,7 @@ }, "css": { "description": "Enable css support.", - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/CssExperimentOptions" - } - ] + "type": "boolean" }, "futureDefaults": { "description": "Apply defaults of next major version.", @@ -910,14 +981,7 @@ }, "css": { "description": "Enable css support.", - "anyOf": [ - { - "enum": [false] - }, - { - "$ref": "#/definitions/CssExperimentOptions" - } - ] + "type": "boolean" }, "futureDefaults": { "description": "Apply defaults of next major version.", @@ -1375,6 +1439,18 @@ "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" }, @@ -2402,11 +2478,11 @@ "properties": { "__dirname": { "description": "Include a polyfill for the '__dirname' variable.", - "enum": [false, true, "warn-mock", "mock", "eval-only"] + "enum": [false, true, "warn-mock", "mock", "node-module", "eval-only"] }, "__filename": { "description": "Include a polyfill for the '__filename' variable.", - "enum": [false, true, "warn-mock", "mock", "eval-only"] + "enum": [false, true, "warn-mock", "mock", "node-module", "eval-only"] }, "global": { "description": "Include a polyfill for the 'global' variable.", @@ -3518,6 +3594,18 @@ "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" }, @@ -4614,6 +4702,26 @@ "type": "boolean" } } + }, + "unmanagedPaths": { + "description": "List of paths that are not managed by a package manager and the contents are subject to change.", + "type": "array", + "items": { + "description": "List of paths that are not managed by a package manager and the contents are subject to change.", + "anyOf": [ + { + "description": "A RegExp matching an unmanaged directory.", + "instanceof": "RegExp", + "tsType": "RegExp" + }, + { + "description": "A path to an unmanaged directory.", + "type": "string", + "absolutePath": true, + "minLength": 1 + } + ] + } } } }, diff --git a/schemas/plugins/css/CssAutoGeneratorOptions.check.d.ts b/schemas/plugins/css/CssAutoGeneratorOptions.check.d.ts new file mode 100644 index 00000000000..6b6174c3f9d --- /dev/null +++ b/schemas/plugins/css/CssAutoGeneratorOptions.check.d.ts @@ -0,0 +1,7 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +declare const check: (options: any) => boolean; +export = check; diff --git a/schemas/plugins/css/CssAutoGeneratorOptions.check.js b/schemas/plugins/css/CssAutoGeneratorOptions.check.js new file mode 100644 index 00000000000..79b79e2cbb2 --- /dev/null +++ b/schemas/plugins/css/CssAutoGeneratorOptions.check.js @@ -0,0 +1,6 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +"use strict";function r(t,{instancePath:a="",parentData:e,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const a=0;for(const a in t)if("exportsOnly"!==a)return r.errors=[{params:{additionalProperty:a}}],!1;if(0===a&&void 0!==t.exportsOnly&&"boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1}return r.errors=null,!0}function t(a,{instancePath:e="",parentData:o,parentDataProperty:n,rootData:s=a}={}){let p=null,l=0;return r(a,{instancePath:e,parentData:o,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),l=p.length),t.errors=p,0===l}module.exports=t,module.exports.default=t; \ No newline at end of file diff --git a/schemas/plugins/css/CssAutoGeneratorOptions.json b/schemas/plugins/css/CssAutoGeneratorOptions.json new file mode 100644 index 00000000000..99f9a565c31 --- /dev/null +++ b/schemas/plugins/css/CssAutoGeneratorOptions.json @@ -0,0 +1,3 @@ +{ + "$ref": "../../WebpackOptions.json#/definitions/CssAutoGeneratorOptions" +} diff --git a/schemas/plugins/css/CssAutoParserOptions.check.d.ts b/schemas/plugins/css/CssAutoParserOptions.check.d.ts new file mode 100644 index 00000000000..6b6174c3f9d --- /dev/null +++ b/schemas/plugins/css/CssAutoParserOptions.check.d.ts @@ -0,0 +1,7 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +declare const check: (options: any) => boolean; +export = check; diff --git a/schemas/plugins/css/CssAutoParserOptions.check.js b/schemas/plugins/css/CssAutoParserOptions.check.js new file mode 100644 index 00000000000..43b6d176df5 --- /dev/null +++ b/schemas/plugins/css/CssAutoParserOptions.check.js @@ -0,0 +1,6 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +"use strict";function r(t,{instancePath:a="",parentData:e,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const a=0;for(const a in t)if("namedExports"!==a)return r.errors=[{params:{additionalProperty:a}}],!1;if(0===a&&void 0!==t.namedExports&&"boolean"!=typeof t.namedExports)return r.errors=[{params:{type:"boolean"}}],!1}return r.errors=null,!0}function t(a,{instancePath:e="",parentData:o,parentDataProperty:n,rootData:s=a}={}){let p=null,i=0;return r(a,{instancePath:e,parentData:o,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),i=p.length),t.errors=p,0===i}module.exports=t,module.exports.default=t; \ No newline at end of file diff --git a/schemas/plugins/css/CssAutoParserOptions.json b/schemas/plugins/css/CssAutoParserOptions.json new file mode 100644 index 00000000000..0a406e58ff7 --- /dev/null +++ b/schemas/plugins/css/CssAutoParserOptions.json @@ -0,0 +1,3 @@ +{ + "$ref": "../../WebpackOptions.json#/definitions/CssAutoParserOptions" +} diff --git a/schemas/plugins/css/CssGeneratorOptions.check.js b/schemas/plugins/css/CssGeneratorOptions.check.js index c41b7d08aca..79b79e2cbb2 100644 --- a/schemas/plugins/css/CssGeneratorOptions.check.js +++ b/schemas/plugins/css/CssGeneratorOptions.check.js @@ -3,4 +3,4 @@ * DO NOT MODIFY BY HAND. * Run `yarn special-lint-fix` to update */ -"use strict";function r(t,{instancePath:e="",parentData:a,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;for(const e in t)return r.errors=[{params:{additionalProperty:e}}],!1;return r.errors=null,!0}module.exports=r,module.exports.default=r; \ No newline at end of file +"use strict";function r(t,{instancePath:a="",parentData:e,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const a=0;for(const a in t)if("exportsOnly"!==a)return r.errors=[{params:{additionalProperty:a}}],!1;if(0===a&&void 0!==t.exportsOnly&&"boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1}return r.errors=null,!0}function t(a,{instancePath:e="",parentData:o,parentDataProperty:n,rootData:s=a}={}){let p=null,l=0;return r(a,{instancePath:e,parentData:o,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),l=p.length),t.errors=p,0===l}module.exports=t,module.exports.default=t; \ No newline at end of file diff --git a/schemas/plugins/css/CssGlobalGeneratorOptions.check.d.ts b/schemas/plugins/css/CssGlobalGeneratorOptions.check.d.ts new file mode 100644 index 00000000000..6b6174c3f9d --- /dev/null +++ b/schemas/plugins/css/CssGlobalGeneratorOptions.check.d.ts @@ -0,0 +1,7 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +declare const check: (options: any) => boolean; +export = check; diff --git a/schemas/plugins/css/CssGlobalGeneratorOptions.check.js b/schemas/plugins/css/CssGlobalGeneratorOptions.check.js new file mode 100644 index 00000000000..79b79e2cbb2 --- /dev/null +++ b/schemas/plugins/css/CssGlobalGeneratorOptions.check.js @@ -0,0 +1,6 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +"use strict";function r(t,{instancePath:a="",parentData:e,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const a=0;for(const a in t)if("exportsOnly"!==a)return r.errors=[{params:{additionalProperty:a}}],!1;if(0===a&&void 0!==t.exportsOnly&&"boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1}return r.errors=null,!0}function t(a,{instancePath:e="",parentData:o,parentDataProperty:n,rootData:s=a}={}){let p=null,l=0;return r(a,{instancePath:e,parentData:o,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),l=p.length),t.errors=p,0===l}module.exports=t,module.exports.default=t; \ No newline at end of file diff --git a/schemas/plugins/css/CssGlobalGeneratorOptions.json b/schemas/plugins/css/CssGlobalGeneratorOptions.json new file mode 100644 index 00000000000..a4a1aaf56e8 --- /dev/null +++ b/schemas/plugins/css/CssGlobalGeneratorOptions.json @@ -0,0 +1,3 @@ +{ + "$ref": "../../WebpackOptions.json#/definitions/CssGlobalGeneratorOptions" +} diff --git a/schemas/plugins/css/CssGlobalParserOptions.check.d.ts b/schemas/plugins/css/CssGlobalParserOptions.check.d.ts new file mode 100644 index 00000000000..6b6174c3f9d --- /dev/null +++ b/schemas/plugins/css/CssGlobalParserOptions.check.d.ts @@ -0,0 +1,7 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +declare const check: (options: any) => boolean; +export = check; diff --git a/schemas/plugins/css/CssGlobalParserOptions.check.js b/schemas/plugins/css/CssGlobalParserOptions.check.js new file mode 100644 index 00000000000..43b6d176df5 --- /dev/null +++ b/schemas/plugins/css/CssGlobalParserOptions.check.js @@ -0,0 +1,6 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +"use strict";function r(t,{instancePath:a="",parentData:e,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const a=0;for(const a in t)if("namedExports"!==a)return r.errors=[{params:{additionalProperty:a}}],!1;if(0===a&&void 0!==t.namedExports&&"boolean"!=typeof t.namedExports)return r.errors=[{params:{type:"boolean"}}],!1}return r.errors=null,!0}function t(a,{instancePath:e="",parentData:o,parentDataProperty:n,rootData:s=a}={}){let p=null,i=0;return r(a,{instancePath:e,parentData:o,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),i=p.length),t.errors=p,0===i}module.exports=t,module.exports.default=t; \ No newline at end of file diff --git a/schemas/plugins/css/CssGlobalParserOptions.json b/schemas/plugins/css/CssGlobalParserOptions.json new file mode 100644 index 00000000000..75f9de6a2e7 --- /dev/null +++ b/schemas/plugins/css/CssGlobalParserOptions.json @@ -0,0 +1,3 @@ +{ + "$ref": "../../WebpackOptions.json#/definitions/CssGlobalParserOptions" +} diff --git a/schemas/plugins/css/CssModuleGeneratorOptions.check.d.ts b/schemas/plugins/css/CssModuleGeneratorOptions.check.d.ts new file mode 100644 index 00000000000..6b6174c3f9d --- /dev/null +++ b/schemas/plugins/css/CssModuleGeneratorOptions.check.d.ts @@ -0,0 +1,7 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +declare const check: (options: any) => boolean; +export = check; diff --git a/schemas/plugins/css/CssModuleGeneratorOptions.check.js b/schemas/plugins/css/CssModuleGeneratorOptions.check.js new file mode 100644 index 00000000000..79b79e2cbb2 --- /dev/null +++ b/schemas/plugins/css/CssModuleGeneratorOptions.check.js @@ -0,0 +1,6 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +"use strict";function r(t,{instancePath:a="",parentData:e,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const a=0;for(const a in t)if("exportsOnly"!==a)return r.errors=[{params:{additionalProperty:a}}],!1;if(0===a&&void 0!==t.exportsOnly&&"boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1}return r.errors=null,!0}function t(a,{instancePath:e="",parentData:o,parentDataProperty:n,rootData:s=a}={}){let p=null,l=0;return r(a,{instancePath:e,parentData:o,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),l=p.length),t.errors=p,0===l}module.exports=t,module.exports.default=t; \ No newline at end of file diff --git a/schemas/plugins/css/CssModuleGeneratorOptions.json b/schemas/plugins/css/CssModuleGeneratorOptions.json new file mode 100644 index 00000000000..5c95fb5541c --- /dev/null +++ b/schemas/plugins/css/CssModuleGeneratorOptions.json @@ -0,0 +1,3 @@ +{ + "$ref": "../../WebpackOptions.json#/definitions/CssModuleGeneratorOptions" +} diff --git a/schemas/plugins/css/CssModuleParserOptions.check.d.ts b/schemas/plugins/css/CssModuleParserOptions.check.d.ts new file mode 100644 index 00000000000..6b6174c3f9d --- /dev/null +++ b/schemas/plugins/css/CssModuleParserOptions.check.d.ts @@ -0,0 +1,7 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +declare const check: (options: any) => boolean; +export = check; diff --git a/schemas/plugins/css/CssModuleParserOptions.check.js b/schemas/plugins/css/CssModuleParserOptions.check.js new file mode 100644 index 00000000000..43b6d176df5 --- /dev/null +++ b/schemas/plugins/css/CssModuleParserOptions.check.js @@ -0,0 +1,6 @@ +/* + * This file was automatically generated. + * DO NOT MODIFY BY HAND. + * Run `yarn special-lint-fix` to update + */ +"use strict";function r(t,{instancePath:a="",parentData:e,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const a=0;for(const a in t)if("namedExports"!==a)return r.errors=[{params:{additionalProperty:a}}],!1;if(0===a&&void 0!==t.namedExports&&"boolean"!=typeof t.namedExports)return r.errors=[{params:{type:"boolean"}}],!1}return r.errors=null,!0}function t(a,{instancePath:e="",parentData:o,parentDataProperty:n,rootData:s=a}={}){let p=null,i=0;return r(a,{instancePath:e,parentData:o,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),i=p.length),t.errors=p,0===i}module.exports=t,module.exports.default=t; \ No newline at end of file diff --git a/schemas/plugins/css/CssModuleParserOptions.json b/schemas/plugins/css/CssModuleParserOptions.json new file mode 100644 index 00000000000..97168a04bed --- /dev/null +++ b/schemas/plugins/css/CssModuleParserOptions.json @@ -0,0 +1,3 @@ +{ + "$ref": "../../WebpackOptions.json#/definitions/CssModuleParserOptions" +} diff --git a/schemas/plugins/css/CssParserOptions.check.js b/schemas/plugins/css/CssParserOptions.check.js index c41b7d08aca..43b6d176df5 100644 --- a/schemas/plugins/css/CssParserOptions.check.js +++ b/schemas/plugins/css/CssParserOptions.check.js @@ -3,4 +3,4 @@ * DO NOT MODIFY BY HAND. * Run `yarn special-lint-fix` to update */ -"use strict";function r(t,{instancePath:e="",parentData:a,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;for(const e in t)return r.errors=[{params:{additionalProperty:e}}],!1;return r.errors=null,!0}module.exports=r,module.exports.default=r; \ No newline at end of file +"use strict";function r(t,{instancePath:a="",parentData:e,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const a=0;for(const a in t)if("namedExports"!==a)return r.errors=[{params:{additionalProperty:a}}],!1;if(0===a&&void 0!==t.namedExports&&"boolean"!=typeof t.namedExports)return r.errors=[{params:{type:"boolean"}}],!1}return r.errors=null,!0}function t(a,{instancePath:e="",parentData:o,parentDataProperty:n,rootData:s=a}={}){let p=null,i=0;return r(a,{instancePath:e,parentData:o,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),i=p.length),t.errors=p,0===i}module.exports=t,module.exports.default=t; \ No newline at end of file diff --git a/test/BuildDependencies.longtest.js b/test/BuildDependencies.longtest.js index 0624b1b0dd4..2127fc37c48 100644 --- a/test/BuildDependencies.longtest.js +++ b/test/BuildDependencies.longtest.js @@ -25,7 +25,7 @@ const exec = (n, options = {}) => { "--cache-dir", ".jest-cache/nyc", process.execPath - ] + ] : []), path.resolve(__dirname, "fixtures/buildDependencies/run.js"), n, @@ -133,7 +133,18 @@ describe("BuildDependencies", () => { ); fs.writeFileSync( path.resolve(inputDirectory, "esm-async-dependency.mjs"), - 'import path from "node:path"; import vm from "vm"; export default 0;' + `import path from "node:path"; +import vm from "vm"; + +async function preload() { + await import(\`markdown-wasm/dist/markdown-node.js\`); + await import("markdown-wasm/dist/markdown-node.js"); + await import('markdown-wasm/dist/markdown-node.js'); + await import('test-"/test'); + await import(\`test-"/test\`); +} + +export default 0;` ); await exec("0", { invalidBuildDependencies: true, diff --git a/test/ConfigTestCases.template.js b/test/ConfigTestCases.template.js index c0c00fb8785..c45b855ffe5 100644 --- a/test/ConfigTestCases.template.js +++ b/test/ConfigTestCases.template.js @@ -61,10 +61,8 @@ const describeCases = config => { jest.setTimeout(20000); for (const category of categories) { - // eslint-disable-next-line no-loop-func describe(category.name, () => { for (const testName of category.tests) { - // eslint-disable-next-line no-loop-func describe(testName, function () { const testDirectory = path.join(casesPath, category.name, testName); const filterPath = path.join(testDirectory, "test.filter.js"); @@ -257,7 +255,7 @@ const describeCases = config => { ? children.reduce( (all, { modules }) => all.concat(modules), modules || [] - ) + ) : modules; if ( allModules.some( @@ -458,7 +456,6 @@ const describeCases = config => { name: "context for esm" }); - // eslint-disable-next-line no-loop-func const _require = ( currentDirectory, options, @@ -551,7 +548,7 @@ const describeCases = config => { referencingModule.identifier ? referencingModule.identifier.slice( esmIdentifier.length + 1 - ) + ) : fileURLToPath(referencingModule.url) ), options, @@ -637,9 +634,9 @@ const describeCases = config => { ) { return testConfig.modules[module]; } else { - return require(module.startsWith("node:") - ? module.slice(5) - : module); + return require( + module.startsWith("node:") ? module.slice(5) : module + ); } }; diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js index ea1ac1546b0..ca6becb24ae 100644 --- a/test/Defaults.unittest.js +++ b/test/Defaults.unittest.js @@ -119,6 +119,7 @@ describe("snapshots", () => { "loader": Object { "environment": Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": undefined, "const": true, "destructuring": true, @@ -341,6 +342,7 @@ describe("snapshots", () => { ], "environment": Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": undefined, "const": true, "destructuring": true, @@ -373,6 +375,7 @@ describe("snapshots", () => { "scriptType": false, "sourceMapFilename": "[file].map[query]", "sourcePrefix": undefined, + "strictModuleErrorHandling": false, "strictModuleExceptionHandling": false, "trustedTypes": undefined, "uniqueName": "webpack", @@ -2020,6 +2023,7 @@ describe("snapshots", () => { + "context": "/test/fixtures/browserslist", @@ ... @@ - "arrowFunction": true, + - "asyncFunction": true, - "bigIntLiteral": undefined, - "const": true, - "destructuring": true, @@ -2031,6 +2035,7 @@ describe("snapshots", () => { - "optionalChaining": true, - "templateLiteral": true, + "arrowFunction": false, + + "asyncFunction": false, + "bigIntLiteral": false, + "const": false, + "destructuring": false, @@ -2049,6 +2054,7 @@ describe("snapshots", () => { + "devtoolNamespace": "browserslist-test", @@ ... @@ - "arrowFunction": true, + - "asyncFunction": true, - "bigIntLiteral": undefined, - "const": true, - "destructuring": true, @@ -2060,6 +2066,7 @@ describe("snapshots", () => { - "optionalChaining": true, - "templateLiteral": true, + "arrowFunction": false, + + "asyncFunction": false, + "bigIntLiteral": false, + "const": false, + "destructuring": false, @@ -2190,115 +2197,125 @@ describe("snapshots", () => { }, e => e.toMatchInlineSnapshot(` - - Expected - + Received +- Expected ++ Received - @@ ... @@ - - "asyncWebAssembly": false, - - "backCompat": true, - + "asyncWebAssembly": true, - + "backCompat": false, - @@ ... @@ - - "cacheUnaffected": false, - - "css": undefined, - - "futureDefaults": false, - + "cacheUnaffected": true, - + "css": Object { - + "exportsOnly": false, - + }, - + "futureDefaults": true, - @@ ... @@ - + }, - + Object { - + "rules": Array [ - + Object { - + "descriptionData": Object { - + "type": "module", - + }, - + "resolve": Object { - + "fullySpecified": true, - + }, - + }, - + ], - + "test": /\\.wasm$/i, - + "type": "webassembly/async", - + }, - + Object { - + "mimetype": "application/wasm", - + "rules": Array [ - + Object { - + "descriptionData": Object { - + "type": "module", - + }, - + "resolve": Object { - + "fullySpecified": true, - @@ ... @@ - + }, - + ], - + "type": "webassembly/async", - + }, - @@ ... @@ - + "resolve": Object { - + "fullySpecified": true, - + "preferRelative": true, - + }, - + "test": /\\.css$/i, - + "type": "css/auto", - + }, - + Object { - + "mimetype": "text/css+module", - + "resolve": Object { - + "fullySpecified": true, - + "preferRelative": true, - + }, - + "type": "css/module", - + }, - + Object { - + "mimetype": "text/css", - + "resolve": Object { - + "fullySpecified": true, - + "preferRelative": true, - + }, - + "type": "css", - + }, - + Object { - @@ ... @@ - + "exportsPresence": "error", - @@ ... @@ - - "__dirname": "mock", - - "__filename": "mock", - - "global": true, - + "__dirname": "warn-mock", - + "__filename": "warn-mock", - + "global": "warn", - @@ ... @@ - + "css", - @@ ... @@ - - "hashDigestLength": 20, - - "hashFunction": "md4", - + "hashDigestLength": 16, - + "hashFunction": "xxhash64", - @@ ... @@ - + "...", - + ], - + }, - + "css-import": Object { - + "conditionNames": Array [ - + "webpack", - + "production", - + "style", - + ], - + "extensions": Array [ - + ".css", - + ], - + "mainFields": Array [ - + "style", - @@ ... @@ - + "mainFiles": Array [], - @@ ... @@ - - "/node_modules/", - + /^(.+?[\\\\/]node_modules[\\\\/])/, - `) +@@ ... @@ +- "asyncWebAssembly": false, +- "backCompat": true, ++ "asyncWebAssembly": true, ++ "backCompat": false, +@@ ... @@ +- "cacheUnaffected": false, +- "css": undefined, +- "futureDefaults": false, ++ "cacheUnaffected": true, ++ "css": true, ++ "futureDefaults": true, +@@ ... @@ ++ }, ++ Object { ++ "rules": Array [ ++ Object { ++ "descriptionData": Object { ++ "type": "module", ++ }, ++ "resolve": Object { ++ "fullySpecified": true, ++ }, ++ }, ++ ], ++ "test": /\\.wasm$/i, ++ "type": "webassembly/async", ++ }, ++ Object { ++ "mimetype": "application/wasm", ++ "rules": Array [ ++ Object { ++ "descriptionData": Object { ++ "type": "module", ++ }, ++ "resolve": Object { ++ "fullySpecified": true, ++ }, ++ }, ++ ], ++ "type": "webassembly/async", ++ }, ++ Object { ++ "resolve": Object { ++ "fullySpecified": true, ++ "preferRelative": true, +@@ ... @@ ++ "test": /\\.css$/i, ++ "type": "css/auto", ++ }, +@@ ... @@ ++ "mimetype": "text/css+module", ++ "resolve": Object { ++ "fullySpecified": true, ++ "preferRelative": true, ++ }, ++ "type": "css/module", ++ }, ++ Object { ++ "mimetype": "text/css", ++ "resolve": Object { ++ "fullySpecified": true, ++ "preferRelative": true, ++ }, ++ "type": "css", ++ }, ++ Object { +@@ ... @@ +- "generator": Object {}, ++ "generator": Object { ++ "css": Object { ++ "exportsOnly": false, ++ }, ++ }, +@@ ... @@ ++ }, ++ "css": Object { ++ "namedExports": true, +@@ ... @@ ++ "exportsPresence": "error", +@@ ... @@ +- "__dirname": "mock", +- "__filename": "mock", +- "global": true, ++ "__dirname": "warn-mock", ++ "__filename": "warn-mock", ++ "global": "warn", +@@ ... @@ ++ "css", +@@ ... @@ +- "hashDigestLength": 20, +- "hashFunction": "md4", ++ "hashDigestLength": 16, ++ "hashFunction": "xxhash64", +@@ ... @@ ++ "...", ++ ], ++ }, ++ "css-import": Object { ++ "conditionNames": Array [ ++ "webpack", ++ "production", ++ "style", ++ ], ++ "extensions": Array [ ++ ".css", ++ ], ++ "mainFields": Array [ ++ "style", +@@ ... @@ ++ "mainFiles": Array [], ++ "preferRelative": true, +@@ ... @@ +- "/node_modules/", ++ /^(.+?[\\\\/]node_modules[\\\\/])/, +`) ); test( diff --git a/test/FileSystemInfo.unittest.js b/test/FileSystemInfo.unittest.js index fbca60f9cfe..217eca453bc 100644 --- a/test/FileSystemInfo.unittest.js +++ b/test/FileSystemInfo.unittest.js @@ -19,7 +19,10 @@ describe("FileSystemInfo", () => { "/path/nested/deep/symlink/file.txt", "/path/context+files/sub/symlink/file.txt", "/path/context/sub/symlink/file.txt", - "/path/missing.txt" + "/path/missing.txt", + "/path/node_modules/@foo/package1/index.js", + "/path/node_modules/@foo/package2/index.js", + "/path/node_modules/bar-package3/index.js" ]; const directories = [ "/path/context+files", @@ -27,6 +30,10 @@ describe("FileSystemInfo", () => { "/path/missing", "/path/node_modules/package", "/path/node_modules/missing", + "/path/node_modules/@foo", + "/path/node_modules/@foo/package1", + "/path/node_modules/@foo/package2", + "/path/node_modules/bar-package3", "/path/cache/package-1234", "/path/cache/package-missing" ]; @@ -48,6 +55,11 @@ describe("FileSystemInfo", () => { "/path/node_modules/package/ignored.txt", "/path/cache/package-1234/ignored.txt" ]; + const unmanagedPaths = [ + "/path/node_modules/@foo/package1", + "/path/node_modules/@foo/package2", + "/path/node_modules/bar-package3" + ]; const managedPaths = ["/path/node_modules"]; const immutablePaths = ["/path/cache"]; const createFs = () => { @@ -56,6 +68,10 @@ describe("FileSystemInfo", () => { fs.mkdirpSync("/path/context/sub"); fs.mkdirpSync("/path/nested/deep"); fs.mkdirpSync("/path/node_modules/package"); + fs.mkdirpSync("/path/node_modules/@foo"); + fs.mkdirpSync("/path/node_modules/@foo/package1"); + fs.mkdirpSync("/path/node_modules/@foo/package2"); + fs.mkdirpSync("/path/node_modules/bar-package3"); fs.mkdirpSync("/path/cache/package-1234"); fs.mkdirpSync("/path/folder/context"); fs.mkdirpSync("/path/folder/context+files"); @@ -92,6 +108,15 @@ describe("FileSystemInfo", () => { fs.writeFileSync("/path/folder/context/file.txt", "Hello World"); fs.writeFileSync("/path/folder/context+files/file.txt", "Hello World"); fs.writeFileSync("/path/folder/nested/file.txt", "Hello World"); + fs.writeFileSync( + "/path/node_modules/@foo/package1/index.js", + "Hello World" + ); + fs.writeFileSync( + "/path/node_modules/@foo/package2/index.js", + "Hello World" + ); + fs.writeFileSync("/path/node_modules/bar-package3/index.js", "Hello World"); fs.symlinkSync("/path/folder/context", "/path/context/sub/symlink", "dir"); fs.symlinkSync( "/path/folder/context+files", @@ -110,6 +135,7 @@ describe("FileSystemInfo", () => { }; const fsInfo = new FileSystemInfo(fs, { logger, + unmanagedPaths, managedPaths, immutablePaths, hashFunction: "sha256" @@ -287,6 +313,9 @@ ${details(snapshot)}`) "/path/folder/context/file.txt", "/path/folder/context+files/file.txt", "/path/folder/nested/file.txt", + "/path/node_modules/@foo/package1/index.js", + "/path/node_modules/@foo/package2/index.js", + "/path/node_modules/bar-package3/index.js", ...(name !== "timestamp" ? ignoredFileChanges : []), ...(name === "hash" ? ["/path/context/sub/ignored.txt"] : []) ]) { diff --git a/test/NodeTemplatePlugin.test.js b/test/NodeTemplatePlugin.test.js index 790b8c4100c..3ce706e3eb3 100644 --- a/test/NodeTemplatePlugin.test.js +++ b/test/NodeTemplatePlugin.test.js @@ -27,7 +27,7 @@ describe("NodeTemplatePlugin", () => { if (err) return err; expect(stats.hasErrors()).toBe(false); expect(stats.hasWarnings()).toBe(false); - // eslint-disable-next-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require const result = require("./js/NodeTemplatePlugin/result").abc; expect(result.nextTick).toBe(process.nextTick); expect(result.fs).toBe(require("fs")); @@ -69,7 +69,7 @@ describe("NodeTemplatePlugin", () => { (err, stats) => { if (err) return err; expect(stats.hasErrors()).toBe(false); - // eslint-disable-next-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require const result = require("./js/NodeTemplatePluginSingle/result2"); expect(result.nextTick).toBe(process.nextTick); expect(result.fs).toBe(require("fs")); diff --git a/test/TestCases.template.js b/test/TestCases.template.js index 43619be9b91..81452852eca 100644 --- a/test/TestCases.template.js +++ b/test/TestCases.template.js @@ -111,7 +111,7 @@ const describeCases = config => { emitOnErrors: true, minimizer: [terserForTesting], ...config.optimization - } + } : { removeAvailableModules: true, removeEmptyChunks: true, @@ -127,7 +127,7 @@ const describeCases = config => { chunkIds: "size", minimizer: [terserForTesting], ...config.optimization - }, + }, performance: { hints: false }, diff --git a/test/WatchSuspend.test.js b/test/WatchSuspend.test.js index dce53a7fc96..510057a8811 100644 --- a/test/WatchSuspend.test.js +++ b/test/WatchSuspend.test.js @@ -102,7 +102,6 @@ describe("WatchSuspend", () => { 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 () => { // aggregateTimeout must be long enough for this test // So set-up new watcher and wait when initial compilation is done diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js index 68dbce53a75..51aec382e8a 100644 --- a/test/WatchTestCases.template.js +++ b/test/WatchTestCases.template.js @@ -348,10 +348,9 @@ const describeCases = config => { let testConfig = {}; try { // try to load a test file - testConfig = require(path.join( - testDirectory, - "test.config.js" - )); + testConfig = require( + path.join(testDirectory, "test.config.js") + ); } catch (e) { // empty } diff --git a/test/__snapshots__/Cli.basictest.js.snap b/test/__snapshots__/Cli.basictest.js.snap index a29f26a737d..edd53faa0b2 100644 --- a/test/__snapshots__/Cli.basictest.js.snap +++ b/test/__snapshots__/Cli.basictest.js.snap @@ -426,6 +426,22 @@ Object { "multiple": false, "simpleType": "boolean", }, + "dev-server": Object { + "configs": Array [ + Object { + "description": "Disable dev server.", + "multiple": false, + "path": "devServer", + "type": "enum", + "values": Array [ + false, + ], + }, + ], + "description": "Disable dev server.", + "multiple": false, + "simpleType": "boolean", + }, "devtool": Object { "configs": Array [ Object { @@ -633,19 +649,6 @@ Object { "multiple": false, "simpleType": "boolean", }, - "experiments-css-exports-only": Object { - "configs": Array [ - Object { - "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", - "multiple": false, - "path": "experiments.css.exportsOnly", - "type": "boolean", - }, - ], - "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", - "multiple": false, - "simpleType": "boolean", - }, "experiments-future-defaults": Object { "configs": Array [ Object { @@ -1426,6 +1429,58 @@ Object { "multiple": false, "simpleType": "string", }, + "module-generator-css-auto-exports-only": Object { + "configs": Array [ + Object { + "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", + "multiple": false, + "path": "module.generator.css/auto.exportsOnly", + "type": "boolean", + }, + ], + "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", + "multiple": false, + "simpleType": "boolean", + }, + "module-generator-css-exports-only": Object { + "configs": Array [ + Object { + "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", + "multiple": false, + "path": "module.generator.css.exportsOnly", + "type": "boolean", + }, + ], + "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", + "multiple": false, + "simpleType": "boolean", + }, + "module-generator-css-global-exports-only": Object { + "configs": Array [ + Object { + "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", + "multiple": false, + "path": "module.generator.css/global.exportsOnly", + "type": "boolean", + }, + ], + "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", + "multiple": false, + "simpleType": "boolean", + }, + "module-generator-css-module-exports-only": Object { + "configs": Array [ + Object { + "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", + "multiple": false, + "path": "module.generator.css/module.exportsOnly", + "type": "boolean", + }, + ], + "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.", + "multiple": false, + "simpleType": "boolean", + }, "module-no-parse": Object { "configs": Array [ Object { @@ -1471,6 +1526,58 @@ Object { "multiple": false, "simpleType": "number", }, + "module-parser-css-auto-named-exports": Object { + "configs": Array [ + Object { + "description": "Use ES modules named export for css exports.", + "multiple": false, + "path": "module.parser.css/auto.namedExports", + "type": "boolean", + }, + ], + "description": "Use ES modules named export for css exports.", + "multiple": false, + "simpleType": "boolean", + }, + "module-parser-css-global-named-exports": Object { + "configs": Array [ + Object { + "description": "Use ES modules named export for css exports.", + "multiple": false, + "path": "module.parser.css/global.namedExports", + "type": "boolean", + }, + ], + "description": "Use ES modules named export for css exports.", + "multiple": false, + "simpleType": "boolean", + }, + "module-parser-css-module-named-exports": Object { + "configs": Array [ + Object { + "description": "Use ES modules named export for css exports.", + "multiple": false, + "path": "module.parser.css/module.namedExports", + "type": "boolean", + }, + ], + "description": "Use ES modules named export for css exports.", + "multiple": false, + "simpleType": "boolean", + }, + "module-parser-css-named-exports": Object { + "configs": Array [ + Object { + "description": "Use ES modules named export for css exports.", + "multiple": false, + "path": "module.parser.css.namedExports", + "type": "boolean", + }, + ], + "description": "Use ES modules named export for css exports.", + "multiple": false, + "simpleType": "boolean", + }, "module-parser-javascript-amd": Object { "configs": Array [ Object { @@ -1813,6 +1920,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -1833,6 +1941,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -2580,6 +2689,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -2600,6 +2710,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -3213,6 +3324,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -3233,6 +3345,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -3696,6 +3809,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -3716,6 +3830,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -4808,6 +4923,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -4828,6 +4944,7 @@ Object { true, "warn-mock", "mock", + "node-module", "eval-only", ], }, @@ -5982,6 +6099,19 @@ Object { "multiple": false, "simpleType": "boolean", }, + "output-environment-async-function": Object { + "configs": Array [ + Object { + "description": "The environment supports async function and await ('async function () { await ... }').", + "multiple": false, + "path": "output.environment.asyncFunction", + "type": "boolean", + }, + ], + "description": "The environment supports async function and await ('async function () { await ... }').", + "multiple": false, + "simpleType": "boolean", + }, "output-environment-big-int-literal": Object { "configs": Array [ Object { @@ -8307,6 +8437,38 @@ Object { "multiple": false, "simpleType": "boolean", }, + "snapshot-unmanaged-paths": Object { + "configs": Array [ + Object { + "description": "A RegExp matching an unmanaged directory.", + "multiple": true, + "path": "snapshot.unmanagedPaths[]", + "type": "RegExp", + }, + Object { + "description": "A path to an unmanaged directory.", + "multiple": true, + "path": "snapshot.unmanagedPaths[]", + "type": "path", + }, + ], + "description": "A RegExp matching an unmanaged directory. A path to an unmanaged directory.", + "multiple": true, + "simpleType": "string", + }, + "snapshot-unmanaged-paths-reset": Object { + "configs": Array [ + Object { + "description": "Clear all items provided in 'snapshot.unmanagedPaths' configuration. List of paths that are not managed by a package manager and the contents are subject to change.", + "multiple": false, + "path": "snapshot.unmanagedPaths", + "type": "reset", + }, + ], + "description": "Clear all items provided in 'snapshot.unmanagedPaths' configuration. List of paths that are not managed by a package manager and the contents are subject to change.", + "multiple": false, + "simpleType": "boolean", + }, "stats": Object { "configs": Array [ Object { diff --git a/test/__snapshots__/StatsTestCases.basictest.js.snap b/test/__snapshots__/StatsTestCases.basictest.js.snap index f40ca5f634b..75848e38fc8 100644 --- a/test/__snapshots__/StatsTestCases.basictest.js.snap +++ b/test/__snapshots__/StatsTestCases.basictest.js.snap @@ -1274,7 +1274,7 @@ chunk (runtime: main) trees.js (trees) 215 bytes [rendered] `; exports[`StatsTestCases should print correct stats for ignore-warnings 1`] = ` -"asset main.js 989 bytes [emitted] (name: main) +"asset main.js 1000 bytes [emitted] (name: main) orphan modules 617 bytes [orphan] 9 modules ./index.js + 9 modules 790 bytes [built] [code generated] @@ -2728,7 +2728,7 @@ LOG from webpack.FileSystemInfo exports[`StatsTestCases should print correct stats for real-content-hash 1`] = ` "a-normal: assets by path *.js 3.23 KiB - asset 48e1a25a11a7b9397e41-48e1a2.js 2.77 KiB [emitted] [immutable] [minimized] (name: runtime) + asset c145af2be45ae24fde2e-c145af.js 2.77 KiB [emitted] [immutable] [minimized] (name: runtime) asset f96e917feecf51c4fc5c-f96e91.js 232 bytes [emitted] [immutable] [minimized] (name: lazy) asset f17033ffbf027f2d71b7-f17033.js 212 bytes [emitted] [immutable] [minimized] (name: index) asset 666f2b8847021ccc7608-666f2b.js 21 bytes [emitted] [immutable] [minimized] (name: a, b) @@ -2736,7 +2736,7 @@ exports[`StatsTestCases should print correct stats for real-content-hash 1`] = ` asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index) - Entrypoint index 2.98 KiB (5.89 KiB) = 48e1a25a11a7b9397e41-48e1a2.js 2.77 KiB f17033ffbf027f2d71b7-f17033.js 212 bytes 1 auxiliary asset + Entrypoint index 2.98 KiB (5.89 KiB) = c145af2be45ae24fde2e-c145af.js 2.77 KiB f17033ffbf027f2d71b7-f17033.js 212 bytes 1 auxiliary asset Entrypoint a 21 bytes = 666f2b8847021ccc7608-666f2b.js Entrypoint b 21 bytes = 666f2b8847021ccc7608-666f2b.js runtime modules 7.34 KiB 9 modules @@ -2755,7 +2755,7 @@ exports[`StatsTestCases should print correct stats for real-content-hash 1`] = ` b-normal: assets by path *.js 3.23 KiB - asset f64fdaf8571eaf5e2680-f64fda.js 2.77 KiB [emitted] [immutable] [minimized] (name: runtime) + asset 48e1a25a11a7b9397e41-48e1a2.js 2.77 KiB [emitted] [immutable] [minimized] (name: runtime) asset f96e917feecf51c4fc5c-f96e91.js 232 bytes [emitted] [immutable] [minimized] (name: lazy) asset f17033ffbf027f2d71b7-f17033.js 212 bytes [emitted] [immutable] [minimized] (name: index) asset 666f2b8847021ccc7608-666f2b.js 21 bytes [emitted] [immutable] [minimized] (name: a, b) @@ -2763,7 +2763,7 @@ b-normal: asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index) - Entrypoint index 2.98 KiB (5.89 KiB) = f64fdaf8571eaf5e2680-f64fda.js 2.77 KiB f17033ffbf027f2d71b7-f17033.js 212 bytes 1 auxiliary asset + Entrypoint index 2.98 KiB (5.89 KiB) = 48e1a25a11a7b9397e41-48e1a2.js 2.77 KiB f17033ffbf027f2d71b7-f17033.js 212 bytes 1 auxiliary asset Entrypoint a 21 bytes = 666f2b8847021ccc7608-666f2b.js Entrypoint b 21 bytes = 666f2b8847021ccc7608-666f2b.js runtime modules 7.34 KiB 9 modules @@ -2813,8 +2813,8 @@ a-source-map: b-source-map: assets by path *.js 3.44 KiB - asset 487b2e232adae9b3ff8b-487b2e.js 2.83 KiB [emitted] [immutable] [minimized] (name: runtime) - sourceMap 487b2e232adae9b3ff8b-487b2e.js.map 14.7 KiB [emitted] [dev] (auxiliary name: runtime) + asset e1bac0f66c401917d379-e1bac0.js 2.83 KiB [emitted] [immutable] [minimized] (name: runtime) + sourceMap e1bac0f66c401917d379-e1bac0.js.map 14.7 KiB [emitted] [dev] (auxiliary name: runtime) asset 0a8aef384737d9f64f44-0a8aef.js 288 bytes [emitted] [immutable] [minimized] (name: lazy) sourceMap 0a8aef384737d9f64f44-0a8aef.js.map 405 bytes [emitted] [dev] (auxiliary name: lazy) asset da629d4acf5998c06668-da629d.js 268 bytes [emitted] [immutable] [minimized] (name: index) @@ -2825,7 +2825,7 @@ b-source-map: asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index) - Entrypoint index 3.09 KiB (20.9 KiB) = 487b2e232adae9b3ff8b-487b2e.js 2.83 KiB da629d4acf5998c06668-da629d.js 268 bytes 3 auxiliary assets + Entrypoint index 3.09 KiB (20.9 KiB) = e1bac0f66c401917d379-e1bac0.js 2.83 KiB da629d4acf5998c06668-da629d.js 268 bytes 3 auxiliary assets Entrypoint a 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset Entrypoint b 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset runtime modules 7.34 KiB 9 modules diff --git a/test/__snapshots__/target-browserslist.unittest.js.snap b/test/__snapshots__/target-browserslist.unittest.js.snap index 68a9428670f..c2e35cf68fd 100644 --- a/test/__snapshots__/target-browserslist.unittest.js.snap +++ b/test/__snapshots__/target-browserslist.unittest.js.snap @@ -3,6 +3,7 @@ exports[`browserslist target ["and_chr 80"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -32,6 +33,7 @@ Object { exports[`browserslist target ["and_ff 68"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -61,6 +63,7 @@ Object { exports[`browserslist target ["and_qq 10.4"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": true, @@ -90,6 +93,7 @@ Object { exports[`browserslist target ["and_uc 12.12"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": true, @@ -119,6 +123,7 @@ Object { exports[`browserslist target ["android 4"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -148,6 +153,7 @@ Object { exports[`browserslist target ["android 4.1"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -177,6 +183,7 @@ Object { exports[`browserslist target ["android 4.4.3-4.4.4"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -206,6 +213,7 @@ Object { exports[`browserslist target ["android 81"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -235,6 +243,7 @@ Object { exports[`browserslist target ["baidu 7.12"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -264,6 +273,7 @@ Object { exports[`browserslist target ["bb 10"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -293,6 +303,7 @@ Object { exports[`browserslist target ["chrome 80","node 12.19.0"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": null, "const": true, @@ -322,6 +333,7 @@ Object { exports[`browserslist target ["chrome 80"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -351,6 +363,7 @@ Object { exports[`browserslist target ["edge 79"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -380,6 +393,7 @@ Object { exports[`browserslist target ["firefox 68"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -409,6 +423,7 @@ Object { exports[`browserslist target ["firefox 80","chrome 80"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -438,6 +453,7 @@ Object { exports[`browserslist target ["ie 11"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -467,6 +483,7 @@ Object { exports[`browserslist target ["ie_mob 11"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -496,6 +513,7 @@ Object { exports[`browserslist target ["ios_saf 12.0-12.1"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": false, "browser": true, "const": true, @@ -525,6 +543,7 @@ Object { exports[`browserslist target ["kaios 2.5"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": true, @@ -554,6 +573,7 @@ Object { exports[`browserslist target ["node 0.10.0"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": false, "const": false, @@ -583,6 +603,7 @@ Object { exports[`browserslist target ["node 0.12.0"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": false, "const": false, @@ -612,6 +633,7 @@ Object { exports[`browserslist target ["node 10.0.0"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": false, "browser": false, "const": true, @@ -641,6 +663,7 @@ Object { exports[`browserslist target ["node 10.17.0"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": false, "const": true, @@ -670,6 +693,7 @@ Object { exports[`browserslist target ["node 12.19.0"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": false, "const": true, @@ -699,6 +723,7 @@ Object { exports[`browserslist target ["op_mini all"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -728,6 +753,7 @@ Object { exports[`browserslist target ["op_mob 54"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -757,6 +783,7 @@ Object { exports[`browserslist target ["opera 54"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -786,6 +813,7 @@ Object { exports[`browserslist target ["safari 10"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -815,6 +843,7 @@ Object { exports[`browserslist target ["safari 11"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": false, "browser": true, "const": true, @@ -844,6 +873,7 @@ Object { exports[`browserslist target ["safari 12.0"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": false, "browser": true, "const": true, @@ -873,6 +903,7 @@ Object { exports[`browserslist target ["safari 12.1"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": false, "browser": true, "const": true, @@ -902,6 +933,7 @@ Object { exports[`browserslist target ["safari 13"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": false, "browser": true, "const": true, @@ -931,6 +963,7 @@ Object { exports[`browserslist target ["safari TP"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -960,6 +993,7 @@ Object { exports[`browserslist target ["samsung 4"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, @@ -989,6 +1023,7 @@ Object { exports[`browserslist target ["samsung 9.2"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -1018,6 +1053,7 @@ Object { exports[`browserslist target ["samsung 11.1-11.2"] 1`] = ` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "browser": true, "const": true, @@ -1047,6 +1083,7 @@ Object { exports[`browserslist target ["unknown 50"] 1`] = ` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "browser": true, "const": false, diff --git a/test/cases/chunks/destructuring-assignment/dir2/a.js b/test/cases/chunks/destructuring-assignment/dir2/a.js new file mode 100644 index 00000000000..59aa6ffd125 --- /dev/null +++ b/test/cases/chunks/destructuring-assignment/dir2/a.js @@ -0,0 +1,2 @@ +exports.a = 1; +exports.b = 2; diff --git a/test/cases/chunks/destructuring-assignment/dir2/json/array.json b/test/cases/chunks/destructuring-assignment/dir2/json/array.json new file mode 100644 index 00000000000..eac5f7b46e0 --- /dev/null +++ b/test/cases/chunks/destructuring-assignment/dir2/json/array.json @@ -0,0 +1 @@ +["a"] \ No newline at end of file diff --git a/test/cases/chunks/destructuring-assignment/dir2/json/object.json b/test/cases/chunks/destructuring-assignment/dir2/json/object.json new file mode 100644 index 00000000000..cb5b2f69bab --- /dev/null +++ b/test/cases/chunks/destructuring-assignment/dir2/json/object.json @@ -0,0 +1 @@ +{"a": 1} diff --git a/test/cases/chunks/destructuring-assignment/dir2/json/primitive.json b/test/cases/chunks/destructuring-assignment/dir2/json/primitive.json new file mode 100644 index 00000000000..231f150c579 --- /dev/null +++ b/test/cases/chunks/destructuring-assignment/dir2/json/primitive.json @@ -0,0 +1 @@ +"a" diff --git a/test/cases/chunks/destructuring-assignment/index.js b/test/cases/chunks/destructuring-assignment/index.js index 626a65391e1..1725b877fdb 100644 --- a/test/cases/chunks/destructuring-assignment/index.js +++ b/test/cases/chunks/destructuring-assignment/index.js @@ -10,3 +10,14 @@ it("should get warning on using 'webpackExports' with destructuring assignment", expect(def).toBe(3); done(); }); + +it("should not tree-shake default export for exportsType=default module", async () => { + const { default: object } = await import("./dir2/json/object.json"); + const { default: array } = await import("./dir2/json/array.json"); + const { default: primitive } = await import("./dir2/json/primitive.json"); + expect(object).toEqual({ a: 1 }); + expect(array).toEqual(["a"]); + expect(primitive).toBe("a"); + const { default: a } = await import("./dir2/a"); + expect(a).toEqual({ a: 1, b: 2 }); +}); diff --git a/test/cases/chunks/inline-options/dir15/a.js b/test/cases/chunks/inline-options/dir15/a.js new file mode 100644 index 00000000000..59aa6ffd125 --- /dev/null +++ b/test/cases/chunks/inline-options/dir15/a.js @@ -0,0 +1,2 @@ +exports.a = 1; +exports.b = 2; diff --git a/test/cases/chunks/inline-options/dir15/json/array.json b/test/cases/chunks/inline-options/dir15/json/array.json new file mode 100644 index 00000000000..eac5f7b46e0 --- /dev/null +++ b/test/cases/chunks/inline-options/dir15/json/array.json @@ -0,0 +1 @@ +["a"] \ No newline at end of file diff --git a/test/cases/chunks/inline-options/dir15/json/object.json b/test/cases/chunks/inline-options/dir15/json/object.json new file mode 100644 index 00000000000..cb5b2f69bab --- /dev/null +++ b/test/cases/chunks/inline-options/dir15/json/object.json @@ -0,0 +1 @@ +{"a": 1} diff --git a/test/cases/chunks/inline-options/dir15/json/primitive.json b/test/cases/chunks/inline-options/dir15/json/primitive.json new file mode 100644 index 00000000000..231f150c579 --- /dev/null +++ b/test/cases/chunks/inline-options/dir15/json/primitive.json @@ -0,0 +1 @@ +"a" diff --git a/test/cases/chunks/inline-options/index.js b/test/cases/chunks/inline-options/index.js index b671187151b..61555301e20 100644 --- a/test/cases/chunks/inline-options/index.js +++ b/test/cases/chunks/inline-options/index.js @@ -180,6 +180,7 @@ if (process.env.NODE_ENV === "production") { } ); }); + it("should be able to load with webpackFetchPriorty high, low and auto", function () { return Promise.all([ import(/* webpackFetchPriority: "high"*/ "./dir14/a"), @@ -187,6 +188,21 @@ if (process.env.NODE_ENV === "production") { import(/* webpackFetchPriority: "auto"*/ "./dir14/c"), ]) }) + + it("should not tree-shake default export for exportsType=default module", async function () { + const jsonObject = await import(/* webpackExports: ["default"] */ "./dir15/json/object.json"); + const jsonArray = await import(/* webpackExports: ["default"] */ "./dir15/json/array.json"); + const jsonPrimitive = await import(/* webpackExports: ["default"] */ "./dir15/json/primitive.json"); + expect(jsonObject.default).toEqual({ a: 1 }); + expect(jsonObject.a).toEqual(1); + expect(jsonArray.default).toEqual(["a"]); + expect(jsonArray[0]).toBe("a"); + expect(jsonPrimitive.default).toBe("a"); + const a = await import(/* webpackExports: ["default"] */"./dir15/a"); + expect(a.default).toEqual({ a: 1, b: 2 }); + expect(a.a).toBe(1); + expect(a.b).toBe(2); + }) } function testChunkLoading(load, expectedSyncInitial, expectedSyncRequested) { diff --git a/test/cases/errors/import-module-cycle-multiple/1/a.json b/test/cases/errors/import-module-cycle-multiple/1/a.json new file mode 100644 index 00000000000..9a389c9696a --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/1/a.json @@ -0,0 +1 @@ +"./a.json" diff --git a/test/cases/errors/import-module-cycle-multiple/2/a.json b/test/cases/errors/import-module-cycle-multiple/2/a.json new file mode 100644 index 00000000000..75e02a30f04 --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/2/a.json @@ -0,0 +1 @@ +"./b.json" diff --git a/test/cases/errors/import-module-cycle-multiple/2/b.json b/test/cases/errors/import-module-cycle-multiple/2/b.json new file mode 100644 index 00000000000..9a389c9696a --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/2/b.json @@ -0,0 +1 @@ +"./a.json" diff --git a/test/cases/errors/import-module-cycle-multiple/3/a.json b/test/cases/errors/import-module-cycle-multiple/3/a.json new file mode 100644 index 00000000000..75e02a30f04 --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/3/a.json @@ -0,0 +1 @@ +"./b.json" diff --git a/test/cases/errors/import-module-cycle-multiple/3/b.json b/test/cases/errors/import-module-cycle-multiple/3/b.json new file mode 100644 index 00000000000..5a2d1989f77 --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/3/b.json @@ -0,0 +1 @@ +"./c.json" diff --git a/test/cases/errors/import-module-cycle-multiple/3/c.json b/test/cases/errors/import-module-cycle-multiple/3/c.json new file mode 100644 index 00000000000..9a389c9696a --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/3/c.json @@ -0,0 +1 @@ +"./a.json" diff --git a/test/cases/errors/import-module-cycle-multiple/4/a.json b/test/cases/errors/import-module-cycle-multiple/4/a.json new file mode 100644 index 00000000000..08a6371d338 --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/4/a.json @@ -0,0 +1 @@ +["./b.json", "./b.json"] diff --git a/test/cases/errors/import-module-cycle-multiple/4/b.json b/test/cases/errors/import-module-cycle-multiple/4/b.json new file mode 100644 index 00000000000..5a2d1989f77 --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/4/b.json @@ -0,0 +1 @@ +"./c.json" diff --git a/test/cases/errors/import-module-cycle-multiple/4/c.json b/test/cases/errors/import-module-cycle-multiple/4/c.json new file mode 100644 index 00000000000..fe51488c706 --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/4/c.json @@ -0,0 +1 @@ +[] diff --git a/test/cases/errors/import-module-cycle-multiple/index.js b/test/cases/errors/import-module-cycle-multiple/index.js new file mode 100644 index 00000000000..054ea2e1af6 --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/index.js @@ -0,0 +1,31 @@ +it("should error importModule when a cycle with 2 modules is requested", () => { + expect(require("./loader!./2/a")).toEqual([ + ["./b.json", [ + ["./a.json", "err: There is a circular build dependency, which makes it impossible to create this module"] + ]] + ]); +}); +it("should error importModule when a cycle with 3 modules is requested", () => { + expect(require("./loader!./3/a")).toEqual([ + ["./b.json", [ + ["./c.json", [ + ["./a.json", "err: There is a circular build dependency, which makes it impossible to create this module"] + ]] + ]] + ]); +}); +it("should error importModule when requesting itself", () => { + expect(require("./loader!./1/a")).toEqual([ + ["./a.json", "err: There is a circular build dependency, which makes it impossible to create this module"] + ]); +}); +it("should not report a cycle when importModule is used twice", () => { + expect(require("./loader!./4/a")).toEqual([ + ["./b.json", [ + ["./c.json", []] + ]], + ["./b.json", [ + ["./c.json", []] + ]] + ]); +}); diff --git a/test/cases/errors/import-module-cycle-multiple/loader.js b/test/cases/errors/import-module-cycle-multiple/loader.js new file mode 100644 index 00000000000..3d13b9953d3 --- /dev/null +++ b/test/cases/errors/import-module-cycle-multiple/loader.js @@ -0,0 +1,23 @@ +/** @type {import("../../../../").LoaderDefinitionFunction} */ +exports.default = function (source) { + const content = JSON.parse(source); + // content is one reference or an array of references + const refs = Array.isArray(content) ? content : [content]; + const callback = this.async(); + const importReferencedModules = async () => { + const loadedRefs = [] + for(const ref of refs) { + try { + const source = await this.importModule("../loader!" + ref); + loadedRefs.push([ref, source]); + } catch(err) { + loadedRefs.push([ref, `err: ${err && err.message}`]); + } + } + return loadedRefs; + } + + importReferencedModules().then((loadResults) => { + callback(null, JSON.stringify(loadResults)); + }); +}; diff --git a/test/cases/errors/import-module-cycle/1/a.json b/test/cases/errors/import-module-cycle/1/a.json new file mode 100644 index 00000000000..9a389c9696a --- /dev/null +++ b/test/cases/errors/import-module-cycle/1/a.json @@ -0,0 +1 @@ +"./a.json" diff --git a/test/cases/errors/import-module-cycle/2/a.json b/test/cases/errors/import-module-cycle/2/a.json new file mode 100644 index 00000000000..75e02a30f04 --- /dev/null +++ b/test/cases/errors/import-module-cycle/2/a.json @@ -0,0 +1 @@ +"./b.json" diff --git a/test/cases/errors/import-module-cycle/2/b.json b/test/cases/errors/import-module-cycle/2/b.json new file mode 100644 index 00000000000..9a389c9696a --- /dev/null +++ b/test/cases/errors/import-module-cycle/2/b.json @@ -0,0 +1 @@ +"./a.json" diff --git a/test/cases/errors/import-module-cycle/3/a.json b/test/cases/errors/import-module-cycle/3/a.json new file mode 100644 index 00000000000..75e02a30f04 --- /dev/null +++ b/test/cases/errors/import-module-cycle/3/a.json @@ -0,0 +1 @@ +"./b.json" diff --git a/test/cases/errors/import-module-cycle/3/b.json b/test/cases/errors/import-module-cycle/3/b.json new file mode 100644 index 00000000000..5a2d1989f77 --- /dev/null +++ b/test/cases/errors/import-module-cycle/3/b.json @@ -0,0 +1 @@ +"./c.json" diff --git a/test/cases/errors/import-module-cycle/3/c.json b/test/cases/errors/import-module-cycle/3/c.json new file mode 100644 index 00000000000..9a389c9696a --- /dev/null +++ b/test/cases/errors/import-module-cycle/3/c.json @@ -0,0 +1 @@ +"./a.json" diff --git a/test/cases/errors/import-module-cycle/index.js b/test/cases/errors/import-module-cycle/index.js new file mode 100644 index 00000000000..3d5f92f0087 --- /dev/null +++ b/test/cases/errors/import-module-cycle/index.js @@ -0,0 +1,15 @@ +it("should error importModule when a cycle with 2 modules is requested", () => { + expect(require("./loader!./2/a")).toMatch( + /^source: err: There is a circular build dependency/ + ); +}); +it("should error importModule when a cycle with 3 modules is requested", () => { + expect(require("./loader!./3/a")).toMatch( + /^source: source: err: There is a circular build dependency/ + ); +}); +it("should error importModule when requesting itself", () => { + expect(require("./loader!./1/a")).toMatch( + /^err: There is a circular build dependency/ + ); +}); diff --git a/test/cases/errors/import-module-cycle/loader.js b/test/cases/errors/import-module-cycle/loader.js new file mode 100644 index 00000000000..84022701942 --- /dev/null +++ b/test/cases/errors/import-module-cycle/loader.js @@ -0,0 +1,12 @@ +/** @type {import("../../../../").LoaderDefinitionFunction} */ +exports.default = function (source) { + const ref = JSON.parse(source); + const callback = this.async(); + this.importModule("../loader!" + ref, {}, (err, exports) => { + if (err) { + callback(null, JSON.stringify(`err: ${err && err.message}`)); + } else { + callback(null, JSON.stringify(`source: ${exports}`)); + } + }); +}; diff --git a/test/cases/inner-graph/extend-class/c.js b/test/cases/inner-graph/extend-class/c.js new file mode 100644 index 00000000000..9fbff09a7ca --- /dev/null +++ b/test/cases/inner-graph/extend-class/c.js @@ -0,0 +1,21 @@ +import { BaseError, BaseError1, BaseError2, BaseError3 } from "./dep2"; + +export class ExtendedError extends BaseError { + constructor(message) { + super(message); + } +} +export class ExtendedError1 extends BaseError1 { + constructor(message) { + super(message); + } +} +export class ExtendedError2 extends BaseError2 { + myMethod() {} +} +export class ExtendedError3 extends BaseError3 {} +export class ExtendedError4 extends Error { + constructor(message = 'ExtendedError') { + super(message); + } +} diff --git a/test/cases/inner-graph/extend-class/dep1.js b/test/cases/inner-graph/extend-class/dep1.js index 50b7759b648..cdbb374a8b4 100644 --- a/test/cases/inner-graph/extend-class/dep1.js +++ b/test/cases/inner-graph/extend-class/dep1.js @@ -1,4 +1,4 @@ -import {A, B, Z} from "./dep2"; +import { A, B, Z, W } from "./dep2"; export const A1 = class A1 extends A { render() {return new E();} @@ -20,3 +20,4 @@ class D { } export const isZ = (new Z1()) instanceof Z; +export { W }; diff --git a/test/cases/inner-graph/extend-class/dep2.js b/test/cases/inner-graph/extend-class/dep2.js index 29fd36dbb33..75343cd50cf 100644 --- a/test/cases/inner-graph/extend-class/dep2.js +++ b/test/cases/inner-graph/extend-class/dep2.js @@ -7,15 +7,34 @@ export function mixin1(_class) {return _class} export function mixin2(_class) {return _class} export function mixin3(_class) {return _class} export function mixin4(_class) {return _class} +export function mixin5(_class) {return _class} export function getField() { return "test" } +export class BaseError extends Error {} +export class BaseError1 extends Error {} +export class BaseError2 extends Error {} +export class BaseError3 extends Error {} +export class W {} +export class J {} +export class K {} +var SuperClass = class {}; +export { SuperClass }; export const exportsInfoForA = __webpack_exports_info__.A.used; export const exportsInfoForB = __webpack_exports_info__.B.used; export const exportsInfoForC = __webpack_exports_info__.C.used; export const exportsInfoForY = __webpack_exports_info__.Y.used; export const exportsInfoForZ = __webpack_exports_info__.Z.used; +export const exportsInfoForW = __webpack_exports_info__.W.used; +export const exportsInfoForJ = __webpack_exports_info__.J.used; +export const exportsInfoForK = __webpack_exports_info__.K.used; export const exportsInfoForMixin1 = __webpack_exports_info__.mixin1.used; export const exportsInfoForMixin2 = __webpack_exports_info__.mixin2.used; export const exportsInfoForMixin3 = __webpack_exports_info__.mixin3.used; export const exportsInfoForMixin4 = __webpack_exports_info__.mixin4.used; +export const exportsInfoForMixin5 = __webpack_exports_info__.mixin5.used; export const exportsInfoForgetField = __webpack_exports_info__.getField.used; +export const exportsInfoForBaseError = __webpack_exports_info__.BaseError.used; +export const exportsInfoForBaseError1 = __webpack_exports_info__.BaseError1.used; +export const exportsInfoForBaseError2 = __webpack_exports_info__.BaseError2.used; +export const exportsInfoForBaseError3 = __webpack_exports_info__.BaseError3.used; +export const exportsInfoForSuperClass = __webpack_exports_info__.SuperClass.used; diff --git a/test/cases/inner-graph/extend-class/index.js b/test/cases/inner-graph/extend-class/index.js index 20c6f6803b3..69f1c125ca2 100644 --- a/test/cases/inner-graph/extend-class/index.js +++ b/test/cases/inner-graph/extend-class/index.js @@ -4,21 +4,44 @@ import { exportsInfoForC, exportsInfoForY, exportsInfoForZ, + exportsInfoForW, + exportsInfoForJ, + exportsInfoForK, exportsInfoForMixin1, exportsInfoForMixin2, exportsInfoForMixin3, - exportsInfoForMixin4 + exportsInfoForMixin4, + exportsInfoForMixin5, + exportsInfoForBaseError, + exportsInfoForBaseError1, + exportsInfoForBaseError2, + exportsInfoForBaseError3, + exportsInfoForSuperClass } from "./dep2"; it("should load modules correctly", () => { require("./module1"); require("./module2"); require("./module3"); + require("./module4"); + require("./module5"); + require("./module6"); + require("./module7"); + require("./module8"); + require("./module9"); }); if (process.env.NODE_ENV === "production") { - it("B should not be used", () => { - expect(exportsInfoForB).toBe(false); + it("W and J should not be used", () => { + expect(exportsInfoForJ).toBe(false); + expect(exportsInfoForW).toBe(false); + }); + + it("Keep extends with constructor", () => { + expect(exportsInfoForBaseError).toBe(true); + expect(exportsInfoForBaseError1).toBe(true); + expect(exportsInfoForBaseError2).toBe(false); + expect(exportsInfoForBaseError3).toBe(false); }); } @@ -26,16 +49,29 @@ it("A should be used", () => { expect(exportsInfoForA).toBe(true); }); +it("B should be used", () => { + expect(exportsInfoForB).toBe(true); +}); + +it("K should be used", () => { + expect(exportsInfoForK).toBe(true); +}); + it("Z used, inner graph can not determine const usage", () => { expect(exportsInfoForZ).toBe(true); }); +it("SuperClass should be used", () => { + expect(exportsInfoForSuperClass).toBe(true); +}); + it("Pure super expression should be unused, another used", () => { if (process.env.NODE_ENV === "production") { - expect(exportsInfoForMixin1).toBe(false); expect(exportsInfoForMixin4).toBe(false); + expect(exportsInfoForMixin5).toBe(false); } + expect(exportsInfoForMixin1).toBe(true); expect(exportsInfoForMixin2).toBe(true); expect(exportsInfoForMixin3).toBe(true); expect(exportsInfoForC).toBe(true); diff --git a/test/cases/inner-graph/extend-class/module4.js b/test/cases/inner-graph/extend-class/module4.js new file mode 100644 index 00000000000..1e78b04f6c1 --- /dev/null +++ b/test/cases/inner-graph/extend-class/module4.js @@ -0,0 +1,3 @@ +import {ExtendedError4} from "./c.js"; + +export default new ExtendedError4() diff --git a/test/cases/inner-graph/extend-class/module5.js b/test/cases/inner-graph/extend-class/module5.js new file mode 100644 index 00000000000..c05aaf0def2 --- /dev/null +++ b/test/cases/inner-graph/extend-class/module5.js @@ -0,0 +1,3 @@ +import { W } from "./dep2"; + +class BaseW extends W {} diff --git a/test/cases/inner-graph/extend-class/module6.js b/test/cases/inner-graph/extend-class/module6.js new file mode 100644 index 00000000000..046e9df215d --- /dev/null +++ b/test/cases/inner-graph/extend-class/module6.js @@ -0,0 +1,4 @@ +import { J } from "./dep2"; + +class BaseJ extends J {} +class BaseBaseJ extends BaseJ {} diff --git a/test/cases/inner-graph/extend-class/module7.js b/test/cases/inner-graph/extend-class/module7.js new file mode 100644 index 00000000000..86c9beccffb --- /dev/null +++ b/test/cases/inner-graph/extend-class/module7.js @@ -0,0 +1,6 @@ +import { K } from "./dep2"; + +class BaseK extends K {} +class BaseBaseK extends BaseK {} + +export default new BaseBaseK(); diff --git a/test/cases/inner-graph/extend-class/module8.js b/test/cases/inner-graph/extend-class/module8.js new file mode 100644 index 00000000000..f2d076b0fe0 --- /dev/null +++ b/test/cases/inner-graph/extend-class/module8.js @@ -0,0 +1,9 @@ +import { mixin5 } from "./dep2"; + +class Bar extends /*#__PURE__*/ mixin5(null) { + static displayName = "Point"; +} + +function test() { + return Bar.displayName; +} diff --git a/test/cases/inner-graph/extend-class/module9.js b/test/cases/inner-graph/extend-class/module9.js new file mode 100644 index 00000000000..efc36d37579 --- /dev/null +++ b/test/cases/inner-graph/extend-class/module9.js @@ -0,0 +1,8 @@ +import { SuperClass } from "./dep2"; + +var UnusedClass = class extends SuperClass { + constructor() { + super(); + } + }, + unusedVariable = new UnusedClass(); diff --git a/test/configCases/async-module/environment-not-support-async-warning/index.js b/test/configCases/async-module/environment-not-support-async-warning/index.js new file mode 100644 index 00000000000..b80f6c769f1 --- /dev/null +++ b/test/configCases/async-module/environment-not-support-async-warning/index.js @@ -0,0 +1,9 @@ +it("should have warnings for environment not support async/await when using asyncModule", () => { + return import("./reexport").then(({ number, getNumber, importRequest, moduleRequest, promiseRequest }) => { + expect(number).toBe(1); + expect(getNumber()).toBe(42); + expect(importRequest).toBe("import.js"); + expect(moduleRequest).toBe("module.js"); + expect(promiseRequest).toBe("promise.js"); + }); +}); diff --git a/test/configCases/async-module/environment-not-support-async-warning/reexport.js b/test/configCases/async-module/environment-not-support-async-warning/reexport.js new file mode 100644 index 00000000000..e4c330e84fe --- /dev/null +++ b/test/configCases/async-module/environment-not-support-async-warning/reexport.js @@ -0,0 +1,5 @@ +export { default as number } from "./tla"; +export { getNumber } from "./wasm.wat" +export { default as moduleRequest } from "external-module" +export { default as importRequest } from "external-import" +export { default as promiseRequest } from "external-promise" 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 new file mode 100644 index 00000000000..bd7f4573a77 --- /dev/null +++ b/test/configCases/async-module/environment-not-support-async-warning/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function (config) { + return supportsWebAssembly(); +}; diff --git a/test/configCases/async-module/environment-not-support-async-warning/tla.js b/test/configCases/async-module/environment-not-support-async-warning/tla.js new file mode 100644 index 00000000000..7ff47b218ac --- /dev/null +++ b/test/configCases/async-module/environment-not-support-async-warning/tla.js @@ -0,0 +1 @@ +export default await Promise.resolve(1) diff --git a/test/configCases/async-module/environment-not-support-async-warning/warnings.js b/test/configCases/async-module/environment-not-support-async-warning/warnings.js new file mode 100644 index 00000000000..e0bb2da70fe --- /dev/null +++ b/test/configCases/async-module/environment-not-support-async-warning/warnings.js @@ -0,0 +1,27 @@ +module.exports = [ + [ + { moduleName: /tla\.js/ }, + /The generated code contains 'async\/await'/, + /"topLevelAwait"/ + ], + [ + { moduleName: /external \["import\.js","request"\]/ }, + /The generated code contains 'async\/await'/, + /"external import"/ + ], + [ + { moduleName: /external \["module\.js","request"\]/ }, + /The generated code contains 'async\/await'/, + /"external module"/ + ], + [ + { moduleName: /external "Promise\.resolve\('promise\.js'\)"/ }, + /The generated code contains 'async\/await'/, + /"external promise"/ + ], + [ + { moduleName: /wasm\.wat/ }, + /The generated code contains 'async\/await'/, + /"asyncWebAssembly"/ + ] +]; diff --git a/test/configCases/async-module/environment-not-support-async-warning/wasm.wat b/test/configCases/async-module/environment-not-support-async-warning/wasm.wat new file mode 100644 index 00000000000..d8081e18c3b --- /dev/null +++ b/test/configCases/async-module/environment-not-support-async-warning/wasm.wat @@ -0,0 +1,4 @@ +(module + (func $getNumber (export "getNumber") (result i32) + (i32.const 42))) + diff --git a/test/configCases/async-module/environment-not-support-async-warning/webpack.config.js b/test/configCases/async-module/environment-not-support-async-warning/webpack.config.js new file mode 100644 index 00000000000..81f034c466e --- /dev/null +++ b/test/configCases/async-module/environment-not-support-async-warning/webpack.config.js @@ -0,0 +1,27 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + module: { + rules: [ + { + test: /\.wat$/, + loader: "wast-loader", + type: "webassembly/async" + } + ] + }, + output: { + environment: { + dynamicImport: true, + asyncFunction: false + }, + importFunctionName: "((name) => Promise.resolve({ request: name }))" + }, + externals: { + "external-module": ["module module.js", "request"], + "external-import": ["import import.js", "request"], + "external-promise": "promise Promise.resolve('promise.js')" + }, + experiments: { + asyncWebAssembly: true + } +}; diff --git a/test/configCases/clean/lib-manifest-plugin/index.js b/test/configCases/clean/lib-manifest-plugin/index.js new file mode 100644 index 00000000000..bbd9de4153f --- /dev/null +++ b/test/configCases/clean/lib-manifest-plugin/index.js @@ -0,0 +1 @@ +it("should compile and run the test", function() {}); diff --git a/test/configCases/clean/lib-manifest-plugin/readdir.js b/test/configCases/clean/lib-manifest-plugin/readdir.js new file mode 100644 index 00000000000..b2f404e7f74 --- /dev/null +++ b/test/configCases/clean/lib-manifest-plugin/readdir.js @@ -0,0 +1,38 @@ +const fs = require('fs'); +const path = require('path'); + +function handlePath(path) { + return path.replace(/\\/g, "/"); +} + +module.exports = function readDir(from) { + const collectedFiles = []; + const collectedDirectories = []; + const stack = [from]; + let cursor; + + while ((cursor = stack.pop())) { + const stat = fs.statSync(cursor); + + if (stat.isDirectory()) { + const items = fs.readdirSync(cursor); + + if (from !== cursor) { + const relative = path.relative(from, cursor); + collectedDirectories.push(handlePath(relative)); + } + + for (let i = 0; i < items.length; i++) { + stack.push(path.join(cursor, items[i])); + } + } else { + const relative = path.relative(from, cursor); + collectedFiles.push(handlePath(relative)); + } + } + + return { + files: collectedFiles, + directories: collectedDirectories + }; +} diff --git a/test/configCases/clean/lib-manifest-plugin/webpack.config.js b/test/configCases/clean/lib-manifest-plugin/webpack.config.js new file mode 100644 index 00000000000..0efe44f4d54 --- /dev/null +++ b/test/configCases/clean/lib-manifest-plugin/webpack.config.js @@ -0,0 +1,33 @@ +const path = require("path"); +const readDir = require("./readdir"); +const webpack = require("../../../../"); + +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + clean: true + }, + plugins: [ + compiler => { + compiler.hooks.thisCompilation.tap("Test", compilation => { + const outputPath = compilation.getPath(compiler.outputPath, {}); + new webpack.DllPlugin({ + name: "[name]_dll", + path: path.resolve(outputPath, "manifest.json") + }).apply(compiler); + }); + compiler.hooks.afterEmit.tap("Test", compilation => { + const outputPath = compilation.getPath(compiler.outputPath, {}); + expect(readDir(outputPath)).toMatchInlineSnapshot(` + Object { + "directories": Array [], + "files": Array [ + "manifest.json", + "bundle0.js", + ], + } + `); + }); + } + ] +}; diff --git a/test/configCases/container/1-container-full/webpack.config.js b/test/configCases/container/1-container-full/webpack.config.js index 049f843e7eb..0c9d66c16d2 100644 --- a/test/configCases/container/1-container-full/webpack.config.js +++ b/test/configCases/container/1-container-full/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line node/no-unpublished-require const { ModuleFederationPlugin } = require("../../../../").container; const common = { diff --git a/test/configCases/container/2-container-full/webpack.config.js b/test/configCases/container/2-container-full/webpack.config.js index 72e7ba1eb5a..8f8dc9aac55 100644 --- a/test/configCases/container/2-container-full/webpack.config.js +++ b/test/configCases/container/2-container-full/webpack.config.js @@ -1,4 +1,4 @@ -// eslint-disable-next-line node/no-unpublished-require +// 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 ed46429112e..a20051ec9af 100644 --- a/test/configCases/container/3-container-full/webpack.config.js +++ b/test/configCases/container/3-container-full/webpack.config.js @@ -1,4 +1,4 @@ -// eslint-disable-next-line node/no-unpublished-require +// 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 2e5f55e1ee0..cc5aa51bb95 100644 --- a/test/configCases/container/exposed-overridables/webpack.config.js +++ b/test/configCases/container/exposed-overridables/webpack.config.js @@ -1,4 +1,4 @@ -// eslint-disable-next-line node/no-unpublished-require +// eslint-disable-next-line n/no-unpublished-require const { ModuleFederationPlugin } = require("../../../../").container; /** @type {import("../../../../").Configuration} */ diff --git a/test/configCases/container/module-federation-with-shareScope/webpack.config.js b/test/configCases/container/module-federation-with-shareScope/webpack.config.js index c7c7c547e5a..218ebc25ddb 100644 --- a/test/configCases/container/module-federation-with-shareScope/webpack.config.js +++ b/test/configCases/container/module-federation-with-shareScope/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line node/no-unpublished-require const { ModuleFederationPlugin } = require("../../../../").container; const common = { diff --git a/test/configCases/css/exports-only-generator-options/index.js b/test/configCases/css/exports-only-generator-options/index.js new file mode 100644 index 00000000000..1d827846c58 --- /dev/null +++ b/test/configCases/css/exports-only-generator-options/index.js @@ -0,0 +1,26 @@ +it("should not have .css file", (done) => { + __non_webpack_require__("./exports_style_module_css.bundle0.js"); + __non_webpack_require__("./exports_style_module_css_exportsOnly.bundle0.js"); + Promise.all([ + import("../exports/style.module.css"), + import("../exports/style.module.css?module"), + import("../exports/style.module.css?exportsOnly"), + ]).then(([style1, style2, style3]) => { + const ns = nsObj({ + a: "a", + abc: "a b c", + comments: "abc def", + "white space": "abc\n\tdef", + default: "default" + }); + expect(style1).toEqual(ns); + expect(style2).toEqual(ns); + expect(style3).toEqual(ns); + }).then(() => { + const fs = __non_webpack_require__("fs"); + const path = __non_webpack_require__("path"); + expect(fs.existsSync(path.resolve(__dirname, "exports_style_module_css.bundle0.css"))).toBe(false); + expect(fs.existsSync(path.resolve(__dirname, "exports_style_module_css_exportsOnly.bundle0.css"))).toBe(false); + done() + }).catch(e => done(e)) +}); diff --git a/test/configCases/css/exports-only-generator-options/webpack.config.js b/test/configCases/css/exports-only-generator-options/webpack.config.js new file mode 100644 index 00000000000..45c7608a848 --- /dev/null +++ b/test/configCases/css/exports-only-generator-options/webpack.config.js @@ -0,0 +1,36 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = [ + { + target: "web", + mode: "development", + module: { + generator: { + css: { + exportsOnly: true + }, + "css/module": { + exportsOnly: false + } + }, + rules: [ + { + resourceQuery: /\?module/, + type: "css/module" + }, + { + resourceQuery: /\?exportsOnly/, + generator: { + exportsOnly: true + }, + type: "css" + } + ] + }, + experiments: { + css: true + }, + node: { + __dirname: false + } + } +]; diff --git a/test/configCases/css/named-exports-parser-options/index.js b/test/configCases/css/named-exports-parser-options/index.js new file mode 100644 index 00000000000..987c5d8f358 --- /dev/null +++ b/test/configCases/css/named-exports-parser-options/index.js @@ -0,0 +1,22 @@ +import * as style1 from "./style.module.css" +import style2 from "./style.module.css?default" +import * as style3 from "./style.module.css?named" + +it("should able to import with different namedExports", () => { + expect(style1).toEqual(nsObj({ class: './style.module.css-class' })); + expect(style2).toEqual(nsObj({ class: './style.module.css?default-class' })); + expect(style3).toEqual(nsObj({ class: './style.module.css?named-class' })); +}); + +it("should able to import with different namedExports (async)", (done) => { + Promise.all([ + import("./style.module.css"), + import("./style.module.css?default"), + import("./style.module.css?named"), + ]).then(([style1, style2, style3]) => { + expect(style1).toEqual(nsObj({ class: './style.module.css-class' })); + expect(style2).toEqual(nsObj({ default: nsObj({ class: './style.module.css?default-class' }) })); + expect(style3).toEqual(nsObj({ class: './style.module.css?named-class' })); + done() + }, done) +}); diff --git a/test/configCases/css/named-exports-parser-options/style.module.css b/test/configCases/css/named-exports-parser-options/style.module.css new file mode 100644 index 00000000000..626e93720d0 --- /dev/null +++ b/test/configCases/css/named-exports-parser-options/style.module.css @@ -0,0 +1,3 @@ +.class { + color: red; +} diff --git a/test/configCases/css/named-exports-parser-options/webpack.config.js b/test/configCases/css/named-exports-parser-options/webpack.config.js new file mode 100644 index 00000000000..50b4c7745cf --- /dev/null +++ b/test/configCases/css/named-exports-parser-options/webpack.config.js @@ -0,0 +1,26 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "node", + mode: "development", + module: { + rules: [ + { + resourceQuery: /\?default/, + parser: { + namedExports: false + }, + type: "css/module" + }, + { + resourceQuery: /\?named/, + parser: { + namedExports: true + }, + type: "css/module" + } + ] + }, + experiments: { + css: true + } +}; diff --git a/test/configCases/css/prefer-relative-css-import/bar.modules.css b/test/configCases/css/prefer-relative-css-import/bar.modules.css new file mode 100644 index 00000000000..212af39cfba --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/bar.modules.css @@ -0,0 +1,7 @@ +body { + color: red; +} + +.bar { + color: red; +} diff --git a/test/configCases/css/prefer-relative-css-import/foo.css b/test/configCases/css/prefer-relative-css-import/foo.css new file mode 100644 index 00000000000..bb644f91459 --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/foo.css @@ -0,0 +1,7 @@ +body { + background: red; +} + +.foo { + color: red; +} diff --git a/test/configCases/css/prefer-relative-css-import/index.js b/test/configCases/css/prefer-relative-css-import/index.js new file mode 100644 index 00000000000..cb4c7ea1e9c --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/index.js @@ -0,0 +1,14 @@ +import * as styles1 from "./style.less"; +import * as styles2 from "./style.modules.less"; + +it("should prefer relative", () => { + expect(styles1).toEqual(nsObj({})); + expect(styles2).toEqual(nsObj({ + "style-module": "./style.modules.less-style-module", + })); + + const style = getComputedStyle(document.body); + + expect(style.getPropertyValue("background")).toBe(" red"); + expect(style.getPropertyValue("color")).toBe(" red"); +}); diff --git a/test/configCases/css/prefer-relative-css-import/node_modules/bar.modules.css/package.json b/test/configCases/css/prefer-relative-css-import/node_modules/bar.modules.css/package.json new file mode 100644 index 00000000000..bfdbb88698b --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/node_modules/bar.modules.css/package.json @@ -0,0 +1,4 @@ +{ + "name": "bar.modules.css", + "main": "style.css" +} diff --git a/test/configCases/css/prefer-relative-css-import/node_modules/bar.modules.css/style.css b/test/configCases/css/prefer-relative-css-import/node_modules/bar.modules.css/style.css new file mode 100644 index 00000000000..36505138bc9 --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/node_modules/bar.modules.css/style.css @@ -0,0 +1,3 @@ +body { + color: blue; +} diff --git a/test/configCases/css/prefer-relative-css-import/node_modules/foo.css/package.json b/test/configCases/css/prefer-relative-css-import/node_modules/foo.css/package.json new file mode 100644 index 00000000000..f273efd2294 --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/node_modules/foo.css/package.json @@ -0,0 +1,4 @@ +{ + "name": "foo.css", + "main": "style.css" +} diff --git a/test/configCases/css/prefer-relative-css-import/node_modules/foo.css/style.css b/test/configCases/css/prefer-relative-css-import/node_modules/foo.css/style.css new file mode 100644 index 00000000000..eedeb9d0ff9 --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/node_modules/foo.css/style.css @@ -0,0 +1,3 @@ +body { + background: blue; +} diff --git a/test/configCases/css/prefer-relative-css-import/style.less b/test/configCases/css/prefer-relative-css-import/style.less new file mode 100644 index 00000000000..7aed5ec6680 --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/style.less @@ -0,0 +1,5 @@ +@import 'foo.css'; + +.style { + color: red; +} diff --git a/test/configCases/css/prefer-relative-css-import/style.modules.less b/test/configCases/css/prefer-relative-css-import/style.modules.less new file mode 100644 index 00000000000..69dc14ca454 --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/style.modules.less @@ -0,0 +1,5 @@ +@import 'bar.modules.css'; + +.style-module { + color: red; +} diff --git a/test/configCases/css/prefer-relative-css-import/test.config.js b/test/configCases/css/prefer-relative-css-import/test.config.js new file mode 100644 index 00000000000..0590757288f --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/test.config.js @@ -0,0 +1,8 @@ +module.exports = { + moduleScope(scope) { + const link = scope.window.document.createElement("link"); + link.rel = "stylesheet"; + link.href = "bundle0.css"; + scope.window.document.head.appendChild(link); + } +}; diff --git a/test/configCases/css/prefer-relative-css-import/webpack.config.js b/test/configCases/css/prefer-relative-css-import/webpack.config.js new file mode 100644 index 00000000000..b4ebfb3d73f --- /dev/null +++ b/test/configCases/css/prefer-relative-css-import/webpack.config.js @@ -0,0 +1,17 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + target: "web", + mode: "development", + module: { + rules: [ + { + test: /\.less$/, + use: "less-loader", + type: "css/auto" + } + ] + }, + experiments: { + css: true + } +}; diff --git a/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js b/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js index 461b1dc69d6..4cb0ca0bb40 100644 --- a/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js +++ b/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js @@ -7,7 +7,8 @@ module.exports = { }, plugins: [ new webpack.DllReferencePlugin({ - manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"), // eslint-disable-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require + manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"), name: "../0-create-dll/dll.js", scope: "dll", sourceType: "commonjs2" diff --git a/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js b/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js index 461b1dc69d6..4cb0ca0bb40 100644 --- a/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js +++ b/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js @@ -7,7 +7,8 @@ module.exports = { }, plugins: [ new webpack.DllReferencePlugin({ - manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"), // eslint-disable-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require + manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"), name: "../0-create-dll/dll.js", scope: "dll", sourceType: "commonjs2" diff --git a/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js b/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js index 14b447481e5..62558963d36 100644 --- a/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js +++ b/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js @@ -4,7 +4,8 @@ var webpack = require("../../../../"); module.exports = { plugins: [ new webpack.DllReferencePlugin({ - manifest: require("../../../js/config/dll-plugin-side-effects/manifest0.json"), // eslint-disable-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require + manifest: require("../../../js/config/dll-plugin-side-effects/manifest0.json"), name: "../0-create-dll/dll.js", scope: "dll", sourceType: "commonjs2" diff --git a/test/configCases/dll-plugin/1-issue-10475/webpack.config.js b/test/configCases/dll-plugin/1-issue-10475/webpack.config.js index d1cf3a50e8b..38803383176 100644 --- a/test/configCases/dll-plugin/1-issue-10475/webpack.config.js +++ b/test/configCases/dll-plugin/1-issue-10475/webpack.config.js @@ -4,7 +4,8 @@ var webpack = require("../../../../"); module.exports = { plugins: [ new webpack.DllReferencePlugin({ - manifest: require("../../../js/config/dll-plugin/issue-10475.json"), // eslint-disable-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require + manifest: require("../../../js/config/dll-plugin/issue-10475.json"), name: "../0-issue-10475/dll.js", scope: "dll", sourceType: "commonjs2" diff --git a/test/configCases/dll-plugin/1-use-dll/webpack.config.js b/test/configCases/dll-plugin/1-use-dll/webpack.config.js index dc432da78a6..92f315cf121 100644 --- a/test/configCases/dll-plugin/1-use-dll/webpack.config.js +++ b/test/configCases/dll-plugin/1-use-dll/webpack.config.js @@ -7,7 +7,8 @@ module.exports = { }, plugins: [ new webpack.DllReferencePlugin({ - manifest: require("../../../js/config/dll-plugin/manifest0.json"), // eslint-disable-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require + manifest: require("../../../js/config/dll-plugin/manifest0.json"), name: "../0-create-dll/dll.js", scope: "dll", sourceType: "commonjs2", diff --git a/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js b/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js index 0f50727568e..b7d736bfd25 100644 --- a/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js +++ b/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js @@ -26,7 +26,8 @@ module.exports = { }, plugins: [ new webpack.DllReferencePlugin({ - manifest: require("../../../js/config/dll-plugin/manifest0.json"), // eslint-disable-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require + manifest: require("../../../js/config/dll-plugin/manifest0.json"), name: "../0-create-dll/dll.js", context: path.resolve(__dirname, "../0-create-dll"), sourceType: "commonjs2" diff --git a/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js b/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js index a065fa62528..4df22aed053 100644 --- a/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js +++ b/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js @@ -23,7 +23,8 @@ module.exports = { }, plugins: [ new webpack.DllReferencePlugin({ - manifest: require("../../../js/config/dll-plugin/manifest0.json"), // eslint-disable-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require + manifest: require("../../../js/config/dll-plugin/manifest0.json"), name: "../0-create-dll/dll.js", context: path.resolve(__dirname, "../0-create-dll"), sourceType: "commonjs2" diff --git a/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js b/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js index 6ea85deee54..370e97826f2 100644 --- a/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js +++ b/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js @@ -7,7 +7,8 @@ module.exports = { }, plugins: [ new webpack.DllReferencePlugin({ - manifest: require("../../../js/config/dll-plugin/manifest0.json"), // eslint-disable-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require + manifest: require("../../../js/config/dll-plugin/manifest0.json"), name: "../0-create-dll-with-contenthash/dll.js", scope: "dll", sourceType: "commonjs2", diff --git a/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js b/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js index 9f8e4ec3dcc..0d7cff2980a 100644 --- a/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js +++ b/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js @@ -9,6 +9,7 @@ module.exports = { expect(compilation.outputOptions.environment).toMatchInlineSnapshot(` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "const": false, "destructuring": false, diff --git a/test/configCases/ecmaVersion/browserslist-config/webpack.config.js b/test/configCases/ecmaVersion/browserslist-config/webpack.config.js index f92c521eff8..cf6c92ffc7a 100644 --- a/test/configCases/ecmaVersion/browserslist-config/webpack.config.js +++ b/test/configCases/ecmaVersion/browserslist-config/webpack.config.js @@ -9,6 +9,7 @@ module.exports = { expect(compilation.outputOptions.environment).toMatchInlineSnapshot(` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "const": false, "destructuring": false, diff --git a/test/configCases/ecmaVersion/browserslist-query/webpack.config.js b/test/configCases/ecmaVersion/browserslist-query/webpack.config.js index f0db5d3e844..cd12757bd1e 100644 --- a/test/configCases/ecmaVersion/browserslist-query/webpack.config.js +++ b/test/configCases/ecmaVersion/browserslist-query/webpack.config.js @@ -7,6 +7,7 @@ module.exports = { expect(compilation.outputOptions.environment).toMatchInlineSnapshot(` Object { "arrowFunction": false, + "asyncFunction": false, "bigIntLiteral": false, "const": false, "destructuring": false, diff --git a/test/configCases/ecmaVersion/browserslist/webpack.config.js b/test/configCases/ecmaVersion/browserslist/webpack.config.js index 801640dd208..b12963fb939 100644 --- a/test/configCases/ecmaVersion/browserslist/webpack.config.js +++ b/test/configCases/ecmaVersion/browserslist/webpack.config.js @@ -7,6 +7,7 @@ module.exports = { expect(compilation.outputOptions.environment).toMatchInlineSnapshot(` Object { "arrowFunction": true, + "asyncFunction": true, "bigIntLiteral": true, "const": true, "destructuring": true, diff --git a/test/configCases/externals/global/index.js b/test/configCases/externals/global/index.js index 821f2376eb2..b8a5d8b0009 100644 --- a/test/configCases/externals/global/index.js +++ b/test/configCases/externals/global/index.js @@ -5,7 +5,7 @@ afterEach(done => { it("should move externals in chunks into entry chunk", function() { global.EXTERNAL_TEST_GLOBAL = 42; - // eslint-disable-next-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require const result = require("external"); expect(result).toBe(42); }); diff --git a/test/configCases/externals/non-amd-externals-amd/index.js b/test/configCases/externals/non-amd-externals-amd/index.js new file mode 100644 index 00000000000..dda9ae39696 --- /dev/null +++ b/test/configCases/externals/non-amd-externals-amd/index.js @@ -0,0 +1,33 @@ +var fs = require("fs"); +var path = require("path"); + +var dependencyArrayRegex = /define\((\[[^\]]*\]), (function)?\(/; +var source = fs.readFileSync(path.join(__dirname, "bundle0.js"), "utf-8"); +var [, deps] = dependencyArrayRegex.exec(source); + +it("should correctly import a AMD external", function() { + var external = require("external0"); + expect(external).toBe("module 0"); +}); + +it("should contain the AMD external in the dependency array", function() { + expect(deps).toContain("\"external0\""); +}); + +it("should correctly import a non-AMD external", function() { + var external = require("external1"); + expect(external).toBe("abc"); +}); + +it("should not contain the non-AMD external in the dependency array", function() { + expect(deps).not.toContain("\"external1\""); +}); + +it("should correctly import a asset external", function() { + var asset = new URL("#hash", import.meta.url); + expect(asset.href).toBe(__webpack_base_uri__ + "#hash"); +}); + +it("should not contain asset external in the dependency array", function() { + expect(deps).not.toContain("\"#hash\""); +}); diff --git a/test/configCases/externals/non-amd-externals-amd/test.config.js b/test/configCases/externals/non-amd-externals-amd/test.config.js new file mode 100644 index 00000000000..680a119a5a8 --- /dev/null +++ b/test/configCases/externals/non-amd-externals-amd/test.config.js @@ -0,0 +1,5 @@ +module.exports = { + modules: { + external0: "module 0" + } +}; diff --git a/test/configCases/externals/non-amd-externals-amd/webpack.config.js b/test/configCases/externals/non-amd-externals-amd/webpack.config.js new file mode 100644 index 00000000000..119fba2ec7d --- /dev/null +++ b/test/configCases/externals/non-amd-externals-amd/webpack.config.js @@ -0,0 +1,26 @@ +const webpack = require("../../../../"); +/** @type {import("../../../../").Configuration} */ +module.exports = { + output: { + libraryTarget: "amd" + }, + externals: { + external0: "external0", + external1: "var 'abc'" + }, + node: { + __dirname: false, + __filename: false + }, + target: "web", + externalsPresets: { + node: true + }, + plugins: [ + new webpack.BannerPlugin({ + raw: true, + banner: + "function define(deps, fn) { fn(...deps.map(dep => require(dep))); }\n" + }) + ] +}; diff --git a/test/configCases/externals/this/index.js b/test/configCases/externals/this/index.js index ba8c1a9f804..f121aac4629 100644 --- a/test/configCases/externals/this/index.js +++ b/test/configCases/externals/this/index.js @@ -5,7 +5,7 @@ afterEach(done => { it("should import an external value assigned to global this", function() { (function() { this.EXTERNAL_TEST_GLOBAL = 42; })(); - // eslint-disable-next-line node/no-missing-require + // eslint-disable-next-line n/no-missing-require const result = require("external"); expect(result).toBe(42); }); diff --git a/test/configCases/inner-graph/issue-17565/module.js b/test/configCases/inner-graph/issue-17565/module.js new file mode 100644 index 00000000000..c98eb025b40 --- /dev/null +++ b/test/configCases/inner-graph/issue-17565/module.js @@ -0,0 +1,60 @@ +import { A, B, C1, C2, C3, Err } from "./test"; + +var arr1 = A, + cls = class extends Error {}, + cls1 = class { + constructor(t) { + if (!arr1.includes(t.version)) throw "invalid parquet version"; + } + async *[Symbol.asyncIterator]() { + yield ""; + } + }; + +var arr2 = B; +var cls2 = class extends Error {}, + cls3 = class { + constructor(t) { + if (!arr2.includes(t.version)) throw "invalid parquet version"; + } + async *[Symbol.asyncIterator]() { + yield ""; + } + }; + +var arr3 = C1; +var cls4 = class { + constructor() {} + }, + cls5 = class { + constructor(t) { + if (!arr3.includes(t.version)) throw "invalid parquet version"; + } + async *[Symbol.asyncIterator]() { + yield ""; + } + }; + +var arr4 = C2; +var cls6 = class { + foo = [1, 2]; + }, + cls7 = class { + constructor(t) { + if (!arr4.includes(t.version)) throw "invalid parquet version"; + } + async *[Symbol.asyncIterator]() { + yield ""; + } + }; + +var arr5 = C3; +var cls8 = class extends Err {}, + cls9 = class { + constructor(t) {} + async *[Symbol.asyncIterator]() { + yield ""; + } + }; + +export { cls1, cls3, cls5, cls7, cls9 } diff --git a/test/configCases/inner-graph/issue-17565/test.filter.js b/test/configCases/inner-graph/issue-17565/test.filter.js new file mode 100644 index 00000000000..25a2a20eb28 --- /dev/null +++ b/test/configCases/inner-graph/issue-17565/test.filter.js @@ -0,0 +1,5 @@ +var supportsClassFields = require("../../../helpers/supportsClassFields"); + +module.exports = function (config) { + return supportsClassFields(); +}; diff --git a/test/configCases/inner-graph/issue-17565/webpack.config.js b/test/configCases/inner-graph/issue-17565/webpack.config.js new file mode 100644 index 00000000000..8f29d9f872a --- /dev/null +++ b/test/configCases/inner-graph/issue-17565/webpack.config.js @@ -0,0 +1,16 @@ +const createTestCases = require("../_helpers/createTestCases"); + +module.exports = createTestCases({ + nothing: { + usedExports: [], + expect: { + "./test": ["A", "B", "C1", "C2"] + } + }, + all: { + usedExports: ["cls1", "cls3", "cls5", "cls7", "cls9"], + expect: { + "./test": ["A", "B", "C1", "C2"] + } + } +}); diff --git a/test/configCases/output-module/node-globals/cjs/file.js b/test/configCases/output-module/node-globals/cjs/file.js new file mode 100644 index 00000000000..be625d98678 --- /dev/null +++ b/test/configCases/output-module/node-globals/cjs/file.js @@ -0,0 +1,6 @@ +const fileURLToPath = ""; +const file = __filename; +const dir = __dirname; +const dir2 = `${__dirname}/`; + +module.exports = { file, dir, dir2 }; diff --git a/test/configCases/output-module/node-globals/cjs/package.json b/test/configCases/output-module/node-globals/cjs/package.json new file mode 100644 index 00000000000..ea5acf78f52 --- /dev/null +++ b/test/configCases/output-module/node-globals/cjs/package.json @@ -0,0 +1,4 @@ +{ + "name": "cjs", + "type": "commonjs" +} diff --git a/test/configCases/output-module/node-globals/index.js b/test/configCases/output-module/node-globals/index.js new file mode 100644 index 00000000000..350b3ba69bd --- /dev/null +++ b/test/configCases/output-module/node-globals/index.js @@ -0,0 +1,10 @@ +import { dir, dir2, file } from './cjs/file.js' + +it("should generate correct __dirname", () => { + expect(dir).toMatch(/[\\/]node-globals$/); + expect(dir2).toMatch(/[\\/]node-globals\/$/); +}); + +it("should generate correct __filename", () => { + expect(file).toMatch(/[\\/]main.mjs$/); +}); diff --git a/test/configCases/output-module/node-globals/test.config.js b/test/configCases/output-module/node-globals/test.config.js new file mode 100644 index 00000000000..1192a7afc60 --- /dev/null +++ b/test/configCases/output-module/node-globals/test.config.js @@ -0,0 +1,5 @@ +module.exports = { + findBundle() { + return "./main.mjs"; + } +}; diff --git a/test/configCases/output-module/node-globals/webpack.config.js b/test/configCases/output-module/node-globals/webpack.config.js new file mode 100644 index 00000000000..aac123421e6 --- /dev/null +++ b/test/configCases/output-module/node-globals/webpack.config.js @@ -0,0 +1,14 @@ +/** @type {import("../../../../").Configuration} */ +module.exports = { + entry: { + main: "./index.js" + }, + output: { + filename: "[name].mjs", + module: true + }, + experiments: { + outputModule: true + }, + target: "node14" +}; diff --git a/test/configCases/process-assets/html-plugin/webpack.config.js b/test/configCases/process-assets/html-plugin/webpack.config.js index f1b74d57ee8..98abbd4842e 100644 --- a/test/configCases/process-assets/html-plugin/webpack.config.js +++ b/test/configCases/process-assets/html-plugin/webpack.config.js @@ -65,8 +65,8 @@ class HtmlPlugin { contenthash: Array.isArray(assetInfo.contenthash) ? [...new Set([...assetInfo.contenthash, integrity])] : assetInfo.contenthash - ? [assetInfo.contenthash, integrity] - : integrity + ? [assetInfo.contenthash, integrity] + : integrity }) ); return `