Socket
Socket
Sign inDemoInstall

webpack

Package Overview
Dependencies
Maintainers
4
Versions
837
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack - npm Package Compare versions

Comparing version 5.91.0 to 5.92.0

lib/PlatformPlugin.js

3

bin/webpack.js

@@ -82,3 +82,2 @@ #!/usr/bin/env node

if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) {
// eslint-disable-next-line n/no-unsupported-features/es-syntax
import(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName])).catch(

@@ -96,3 +95,3 @@ error => {

/**
* @typedef {Object} CliOption
* @typedef {object} CliOption
* @property {string} name display name

@@ -99,0 +98,0 @@ * @property {string} package npm package name

@@ -136,3 +136,3 @@ /*

/**
* @typedef {Object} APIPluginOptions
* @typedef {object} APIPluginOptions
* @property {boolean} [module] the output filename

@@ -193,5 +193,9 @@ */

if (/** @type {BuildInfo} */ (module.buildInfo).needCreateRequire) {
const needPrefix =
renderContext.runtimeTemplate.supportNodePrefixForCoreModules();
const chunkInitFragments = [
new InitFragment(
'import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";\n',
`import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "${
needPrefix ? "node:" : ""
}module";\n`,
InitFragment.STAGE_HARMONY_IMPORTS,

@@ -198,0 +202,0 @@ 0,

@@ -15,2 +15,3 @@ /*

const RuntimeGlobals = require("../RuntimeGlobals");
const CssUrlDependency = require("../dependencies/CssUrlDependency");
const createHash = require("../util/createHash");

@@ -325,2 +326,3 @@ const { makePathsRelative } = require("../util/identifier");

let assetPath;
let assetPathForCss;
if (this.publicPath !== undefined) {

@@ -340,2 +342,3 @@ const { path, info } =

assetPath = JSON.stringify(path + filename);
assetPathForCss = path + filename;
} else {

@@ -347,2 +350,13 @@ runtimeRequirements.add(RuntimeGlobals.publicPath); // add __webpack_require__.p

);
const compilation = runtimeTemplate.compilation;
const path =
compilation.outputOptions.publicPath === "auto"
? CssUrlDependency.PUBLIC_PATH_AUTO
: compilation.getAssetPath(
compilation.outputOptions.publicPath,
{
hash: compilation.hash
}
);
assetPathForCss = path + filename;
}

@@ -378,2 +392,3 @@ assetInfo = {

data.set("assetInfo", assetInfo);
data.set("assetPathForCss", assetPathForCss);
}

@@ -380,0 +395,0 @@ content = assetPath;

@@ -28,3 +28,3 @@ /*

/**
* @typedef {Object} QueueItem
* @typedef {object} QueueItem
* @property {number} action

@@ -39,3 +39,3 @@ * @property {DependenciesBlock} block

/**
* @typedef {Object} ChunkGroupInfo
* @typedef {object} ChunkGroupInfo
* @property {ChunkGroup} chunkGroup the chunk group

@@ -58,3 +58,3 @@ * @property {RuntimeSpec} runtime the runtimes

/**
* @typedef {Object} BlockChunkGroupConnection
* @typedef {object} BlockChunkGroupConnection
* @property {ChunkGroupInfo} originChunkGroupInfo origin chunk group

@@ -61,0 +61,0 @@ * @property {ChunkGroup} chunkGroup referenced chunk group

@@ -17,3 +17,3 @@ /*

/**
* @typedef {Object} Etag
* @typedef {object} Etag
* @property {function(): string} toString

@@ -20,0 +20,0 @@ */

@@ -14,3 +14,3 @@ /*

/**
* @typedef {Object} HashableObject
* @typedef {object} HashableObject
* @property {function(Hash): void} updateHash

@@ -17,0 +17,0 @@ */

@@ -17,3 +17,3 @@ /*

/**
* @param {Object} options Options
* @param {object} options Options
* @param {number} options.maxGenerations max generations

@@ -20,0 +20,0 @@ */

@@ -37,3 +37,3 @@ /*

/**
* @param {Object} data stored data
* @param {object} data stored data
* @param {string} version version identifier

@@ -1031,3 +1031,3 @@ * @param {Snapshot} buildSnapshot snapshot of all build dependencies

/**
* @param {Object} options options
* @param {object} options options
* @param {Compiler} options.compiler the compiler

@@ -1034,0 +1034,0 @@ * @param {IntermediateFileSystem} options.fs the filesystem

@@ -53,3 +53,3 @@ /*

/**
* @param {Object} object an object
* @param {object} object an object
* @param {boolean} excludeContext if true, context is not included in string

@@ -108,5 +108,5 @@ * @returns {string} stringified version

* @param {Resolver} resolver the resolver
* @param {Object} resolveContext context for resolving meta info
* @param {Object} request the request info object
* @param {function((Error | null)=, Object=): void} callback callback function
* @param {object} resolveContext context for resolving meta info
* @param {object} request the request info object
* @param {function((Error | null)=, object=): void} callback callback function
* @returns {void}

@@ -193,5 +193,5 @@ */

factory(type, hook) {
/** @type {Map<string, (function(Error=, Object=): void)[]>} */
/** @type {Map<string, (function(Error=, object=): void)[]>} */
const activeRequests = new Map();
/** @type {Map<string, [function(Error=, Object=): void, function(Error=, Object=): void][]>} */
/** @type {Map<string, [function(Error=, object=): void, function(Error=, object=): void][]>} */
const activeRequestsWithYield = new Map();

@@ -202,4 +202,4 @@ hook.tap(

* @param {Resolver} resolver the resolver
* @param {Object} options resolve options
* @param {Object} userOptions resolve options passed by the user
* @param {object} options resolve options
* @param {object} userOptions resolve options passed by the user
* @returns {void}

@@ -206,0 +206,0 @@ */

@@ -41,3 +41,3 @@ /*

/**
* @typedef {Object} WithId an object who has an id property *
* @typedef {object} WithId an object who has an id property *
* @property {string | number} id the id of the object

@@ -48,3 +48,3 @@ */

* @deprecated
* @typedef {Object} ChunkMaps
* @typedef {object} ChunkMaps
* @property {Record<string|number, string>} hash

@@ -57,3 +57,3 @@ * @property {Record<string|number, Record<string, string>>} contentHash

* @deprecated
* @typedef {Object} ChunkModuleMaps
* @typedef {object} ChunkModuleMaps
* @property {Record<string|number, (string|number)[]>} id

@@ -91,3 +91,6 @@ * @property {Record<string|number, string>} hash

this.cssFilenameTemplate = undefined;
/** @private @type {SortableSet<ChunkGroup>} */
/**
* @private
* @type {SortableSet<ChunkGroup>}
*/
this._groups = new SortableSet(undefined, compareChunkGroupsByIndex);

@@ -94,0 +97,0 @@ /** @type {RuntimeSpec} */

@@ -53,3 +53,3 @@ /*

/**
* @typedef {Object} ChunkSizeOptions
* @typedef {object} ChunkSizeOptions
* @property {number=} chunkOverhead constant overhead for a chunk

@@ -191,2 +191,3 @@ * @property {number=} entryChunkMultiplicator multiplicator for initial chunks

/** @typedef {Set<Chunk>} RuntimeInChunks */
/** @typedef {string | number} ModuleId */

@@ -243,9 +244,21 @@ class ChunkGraphModule {

constructor(moduleGraph, hashFunction = "md4") {
/** @private @type {WeakMap<Module, ChunkGraphModule>} */
/**
* @private
* @type {WeakMap<Module, ChunkGraphModule>}
*/
this._modules = new WeakMap();
/** @private @type {WeakMap<Chunk, ChunkGraphChunk>} */
/**
* @private
* @type {WeakMap<Chunk, ChunkGraphChunk>}
*/
this._chunks = new WeakMap();
/** @private @type {WeakMap<AsyncDependenciesBlock, ChunkGroup>} */
/**
* @private
* @type {WeakMap<AsyncDependenciesBlock, ChunkGroup>}
*/
this._blockChunkGroups = new WeakMap();
/** @private @type {Map<string, string | number>} */
/**
* @private
* @type {Map<string, string | number>}
*/
this._runtimeIds = new Map();

@@ -1315,3 +1328,3 @@ /** @type {ModuleGraph} */

* @param {Module} module the module
* @returns {string | number} the id of the module
* @returns {ModuleId} the id of the module
*/

@@ -1325,3 +1338,3 @@ getModuleId(module) {

* @param {Module} module the module
* @param {string | number} id the id of the module
* @param {ModuleId} id the id of the module
* @returns {void}

@@ -1328,0 +1341,0 @@ */

@@ -28,3 +28,3 @@ /*

/**
* @typedef {Object} RawChunkGroupOptions
* @typedef {object} RawChunkGroupOptions
* @property {number=} preloadOrder

@@ -97,6 +97,12 @@ * @property {number=} prefetchOrder

/** Indices in top-down order */
/** @private @type {Map<Module, number>} */
/**
* @private
* @type {Map<Module, number>}
*/
this._modulePreOrderIndices = new Map();
/** Indices in bottom-up order */
/** @private @type {Map<Module, number>} */
/**
* @private
* @type {Map<Module, number>}
*/
this._modulePostOrderIndices = new Map();

@@ -103,0 +109,0 @@ /** @type {number | undefined} */

@@ -27,3 +27,3 @@ /*

/**
* @typedef {Object} CleanPluginCompilationHooks
* @typedef {object} CleanPluginCompilationHooks
* @property {SyncBailHook<[string], boolean>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config

@@ -30,0 +30,0 @@ */

@@ -13,3 +13,3 @@ /*

/**
* @typedef {Object} PathItem
* @typedef {object} PathItem
* @property {any} schema the part of the schema

@@ -22,3 +22,3 @@ * @property {string} path the path in the config

/**
* @typedef {Object} Problem
* @typedef {object} Problem
* @property {ProblemType} type

@@ -33,3 +33,3 @@ * @property {string} path

/**
* @typedef {Object} LocalProblem
* @typedef {object} LocalProblem
* @property {ProblemType} type

@@ -41,3 +41,3 @@ * @property {string} path

/**
* @typedef {Object} ArgumentConfig
* @typedef {object} ArgumentConfig
* @property {string} description

@@ -52,3 +52,3 @@ * @property {string} [negatedDescription]

/**
* @typedef {Object} Argument
* @typedef {object} Argument
* @property {string} description

@@ -55,0 +55,0 @@ * @property {"string"|"number"|"boolean"} simpleType

@@ -48,2 +48,3 @@ /*

/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./config/target").PlatformTargetProperties} PlatformTargetProperties */
/** @typedef {import("./logging/createConsoleLogger").LoggingFunction} LoggingFunction */

@@ -58,3 +59,3 @@ /** @typedef {import("./util/WeakTupleMap")} WeakTupleMap */

/**
* @typedef {Object} CompilationParams
* @typedef {object} CompilationParams
* @property {NormalModuleFactory} normalModuleFactory

@@ -86,3 +87,3 @@ * @property {ContextModuleFactory} contextModuleFactory

/**
* @typedef {Object} AssetEmittedInfo
* @typedef {object} AssetEmittedInfo
* @property {Buffer} content

@@ -110,8 +111,8 @@ * @property {Source} source

/**
* @param {Object<string, any>} obj an object
* @param {{[key: string]: any}} obj an object
* @param {string[]} keys the keys of the object
* @returns {Object<string, any>} the object with properties sorted by property name
* @returns {{[key: string]: any}} the object with properties sorted by property name
*/
const sortObject = (obj, keys) => {
/** @type {Object<string, any>} */
/** @type {{[key: string]: any}} */
const o = {};

@@ -272,2 +273,12 @@ for (const k of keys.sort()) {

/** @type {Readonly<PlatformTargetProperties>} */
this.platform = {
web: null,
browser: null,
webworker: null,
node: null,
nwjs: null,
electron: null
};
this.options = options;

@@ -302,7 +313,16 @@

/** @private @type {WeakMap<Source, CacheEntry>} */
/**
* @private
* @type {WeakMap<Source, CacheEntry>}
*/
this._assetEmittingSourceCache = new WeakMap();
/** @private @type {Map<string, number>} */
/**
* @private
* @type {Map<string, number>}
*/
this._assetEmittingWrittenFiles = new Map();
/** @private @type {Set<string>} */
/**
* @private
* @type {Set<string>}
*/
this._assetEmittingPreviousFiles = new Set();

@@ -309,0 +329,0 @@ }

@@ -17,3 +17,3 @@ /*

/**
* @typedef {Object} ExternalModuleInfo
* @typedef {object} ExternalModuleInfo
* @property {number} index

@@ -24,3 +24,3 @@ * @property {Module} module

/**
* @typedef {Object} ConcatenatedModuleInfo
* @typedef {object} ConcatenatedModuleInfo
* @property {number} index

@@ -36,3 +36,3 @@ * @property {Module} module

/**
* @typedef {Object} ModuleReferenceOptions
* @typedef {object} ModuleReferenceOptions
* @property {string[]} ids the properties/exports of the module

@@ -39,0 +39,0 @@ * @property {boolean} call true, when this referenced export is called

@@ -19,3 +19,3 @@ /*

/**
* @typedef {Object} BrowserslistHandlerConfig
* @typedef {object} BrowserslistHandlerConfig
* @property {string=} configPath

@@ -348,2 +348,8 @@ * @property {string=} env

nodeBuiltins: nodeProperty,
nodePrefixForCoreModules:
nodeProperty &&
!browsers.some(b => /^node 15/.test(b)) &&
rawChecker({
node: [14, 18]
}),
require: nodeProperty

@@ -350,0 +356,0 @@ };

@@ -30,3 +30,4 @@ /*

/** @typedef {import("../../declarations/WebpackOptions").CacheOptionsNormalized} CacheOptions */
/** @typedef {import("../../declarations/WebpackOptions").CacheOptions} CacheOptions */
/** @typedef {import("../../declarations/WebpackOptions").CacheOptionsNormalized} CacheOptionsNormalized */
/** @typedef {import("../../declarations/WebpackOptions").Context} Context */

@@ -64,8 +65,16 @@ /** @typedef {import("../../declarations/WebpackOptions").CssGeneratorOptions} CssGeneratorOptions */

/** @typedef {import("../../declarations/WebpackOptions").Target} Target */
/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
/** @typedef {import("../../declarations/WebpackOptions").WebpackOptions} WebpackOptions */
/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Module")} Module */
/** @typedef {import("./target").PlatformTargetProperties} PlatformTargetProperties */
/** @typedef {import("./target").TargetProperties} TargetProperties */
/**
* @typedef {object} ResolvedOptions
* @property {PlatformTargetProperties | false} platform - platform target properties
*/
const NODE_MODULES_REGEXP = /[\\/]node_modules[\\/]/i;
const DEFAULT_CACHE_NAME = "default";

@@ -142,3 +151,3 @@ /**

/**
* @param {WebpackOptions} options options to be modified
* @param {WebpackOptionsNormalized} options options to be modified
* @returns {void}

@@ -152,6 +161,7 @@ */

/**
* @param {WebpackOptions} options options to be modified
* @returns {void}
* @param {WebpackOptionsNormalized} options options to be modified
* @param {number} [compilerIndex] index of compiler
* @returns {ResolvedOptions} Resolved options after apply defaults
*/
const applyWebpackOptionsDefaults = options => {
const applyWebpackOptionsDefaults = (options, compilerIndex) => {
F(options, "context", () => process.cwd());

@@ -208,6 +218,7 @@ F(options, "target", () => {

applyCacheDefaults(options.cache, {
name: name || "default",
name: name || DEFAULT_CACHE_NAME,
mode: mode || "production",
development,
cacheUnaffected: options.experiments.cacheUnaffected
cacheUnaffected: options.experiments.cacheUnaffected,
compilerIndex
});

@@ -250,3 +261,2 @@ const cache = !!options.cache;

entry: options.entry,
module: options.module,
futureDefaults

@@ -261,3 +271,5 @@ });

applyLoaderDefaults(
/** @type {NonNullable<WebpackOptions["loader"]>} */ (options.loader),
/** @type {NonNullable<WebpackOptionsNormalized["loader"]>} */ (
options.loader
),
{ targetProperties, environment: options.output.environment }

@@ -279,3 +291,3 @@ );

futureDefaults:
/** @type {NonNullable<WebpackOptions["experiments"]["futureDefaults"]>} */
/** @type {NonNullable<WebpackOptionsNormalized["experiments"]["futureDefaults"]>} */
(options.experiments.futureDefaults),

@@ -294,3 +306,3 @@ outputModule: options.output.module,

applyPerformanceDefaults(
/** @type {NonNullable<WebpackOptions["performance"]>} */
/** @type {NonNullable<WebpackOptionsNormalized["performance"]>} */
(options.performance),

@@ -328,2 +340,16 @@ {

);
return {
platform:
targetProperties === false
? targetProperties
: {
web: targetProperties.web,
browser: targetProperties.browser,
webworker: targetProperties.webworker,
node: targetProperties.node,
nwjs: targetProperties.nwjs,
electron: targetProperties.electron
}
};
};

@@ -333,3 +359,3 @@

* @param {ExperimentsNormalized} experiments options
* @param {Object} options options
* @param {object} options options
* @param {boolean} options.production is production

@@ -369,7 +395,8 @@ * @param {boolean} options.development is development mode

/**
* @param {CacheOptions} cache options
* @param {Object} options options
* @param {CacheOptionsNormalized} cache options
* @param {object} options options
* @param {string} options.name name
* @param {Mode} options.mode mode
* @param {boolean} options.development is development mode
* @param {number} [options.compilerIndex] index of compiler
* @param {Experiments["cacheUnaffected"]} options.cacheUnaffected the cacheUnaffected experiment is enabled

@@ -380,3 +407,3 @@ * @returns {void}

cache,
{ name, mode, development, cacheUnaffected }
{ name, mode, development, cacheUnaffected, compilerIndex }
) => {

@@ -386,3 +413,7 @@ if (cache === false) return;

case "filesystem":
F(cache, "name", () => name + "-" + mode);
F(cache, "name", () =>
compilerIndex !== undefined
? `${name + "-" + mode}__compiler${compilerIndex + 1}__`
: name + "-" + mode
);
D(cache, "version", "");

@@ -450,3 +481,3 @@ F(cache, "cacheDirectory", () => {

* @param {SnapshotOptions} snapshot options
* @param {Object} options options
* @param {object} options options
* @param {boolean} options.production is production

@@ -527,3 +558,3 @@ * @param {boolean} options.futureDefaults is future defaults enabled

* @param {JavascriptParserOptions} parserOptions parser options
* @param {Object} options options
* @param {object} options options
* @param {boolean} options.futureDefaults is future defaults enabled

@@ -560,3 +591,3 @@ * @param {boolean} options.isNode is node target platform

* @param {CssGeneratorOptions} generatorOptions generator options
* @param {Object} options options
* @param {object} options options
* @param {TargetProperties | false} options.targetProperties target properties

@@ -574,3 +605,3 @@ * @returns {void}

);
D(generatorOptions, "exportsConvention", "as-is");
D(generatorOptions, "esModule", true);
};

@@ -580,3 +611,3 @@

* @param {ModuleOptions} module options
* @param {Object} options options
* @param {object} options options
* @param {boolean} options.cache is caching enabled

@@ -671,2 +702,3 @@ * @param {boolean} options.syncWebAssembly is syncWebAssembly enabled

);
D(module.generator["css/auto"], "exportsConvention", "as-is");

@@ -679,2 +711,3 @@ F(module.generator, "css/module", () => ({}));

);
D(module.generator["css/module"], "exportsConvention", "as-is");

@@ -687,2 +720,3 @@ F(module.generator, "css/global", () => ({}));

);
D(module.generator["css/global"], "exportsConvention", "as-is");
}

@@ -829,2 +863,6 @@

type: JSON_MODULE_TYPE
},
{
with: { type: "json" },
type: JSON_MODULE_TYPE
}

@@ -838,3 +876,3 @@ );

* @param {Output} output options
* @param {Object} options options
* @param {object} options options
* @param {string} options.context context

@@ -846,3 +884,2 @@ * @param {TargetProperties | false} options.targetProperties target properties

* @param {Entry} options.entry entry option
* @param {ModuleOptions} options.module module option
* @param {boolean} options.futureDefaults is future defaults enabled

@@ -860,3 +897,2 @@ * @returns {void}

entry,
module,
futureDefaults

@@ -1013,3 +1049,3 @@ }

case "module":
if (tp.dynamicImport) return "import";
if (tp.dynamicImport || output.module) return "import";
break;

@@ -1039,3 +1075,3 @@ }

case "module":
if (tp.dynamicImportInWorker) return "import";
if (tp.dynamicImportInWorker || output.module) return "import";
break;

@@ -1154,2 +1190,11 @@ }

environment,
"nodePrefixForCoreModules",
() =>
tp &&
optimistic(
/** @type {boolean | undefined} */ (tp.nodePrefixForCoreModules)
)
);
F(
environment,
"templateLiteral",

@@ -1177,2 +1222,7 @@ () =>

);
F(
environment,
"document",
() => tp && optimistic(/** @type {boolean | undefined} */ (tp.document))
);

@@ -1249,3 +1299,3 @@ const { trustedTypes } = output;

* @param {ExternalsPresets} externalsPresets options
* @param {Object} options options
* @param {object} options options
* @param {TargetProperties | false} options.targetProperties target properties

@@ -1317,3 +1367,3 @@ * @param {boolean} options.buildHttp buildHttp experiment enabled

* @param {Loader} loader options
* @param {Object} options options
* @param {object} options options
* @param {TargetProperties | false} options.targetProperties target properties

@@ -1342,3 +1392,3 @@ * @param {Environment} options.environment environment

* @param {WebpackNode} node options
* @param {Object} options options
* @param {object} options options
* @param {TargetProperties | false} options.targetProperties target properties

@@ -1374,3 +1424,3 @@ * @param {boolean} options.futureDefaults is future defaults enabled

* @param {Performance} performance options
* @param {Object} options options
* @param {object} options options
* @param {boolean} options.production is production

@@ -1388,3 +1438,3 @@ * @returns {void}

* @param {Optimization} optimization options
* @param {Object} options options
* @param {object} options options
* @param {boolean} options.production is production

@@ -1481,3 +1531,3 @@ * @param {boolean} options.development is development

/**
* @param {Object} options options
* @param {object} options options
* @param {boolean} options.cache is cache enable

@@ -1542,2 +1592,3 @@ * @param {string} options.context build context

mainFields: ["main"],
importsFields: ["imports"],
byDependency: {

@@ -1588,3 +1639,3 @@ wasm: esmDeps(),

/**
* @param {Object} options options
* @param {object} options options
* @param {boolean} options.cache is cache enable

@@ -1591,0 +1642,0 @@ * @returns {ResolveOptions} resolve options

@@ -24,3 +24,3 @@ /*

/**
* @typedef {Object} PlatformTargetProperties
* @typedef {object} PlatformTargetProperties
* @property {boolean | null} web web platform, importing of http(s) and std: is available

@@ -35,3 +35,3 @@ * @property {boolean | null} browser browser platform, running in a normal web browser

/**
* @typedef {Object} ElectronContextTargetProperties
* @typedef {object} ElectronContextTargetProperties
* @property {boolean | null} electronMain in main context

@@ -43,5 +43,6 @@ * @property {boolean | null} electronPreload in preload context

/**
* @typedef {Object} ApiTargetProperties
* @typedef {object} ApiTargetProperties
* @property {boolean | null} require has require function available
* @property {boolean | null} nodeBuiltins has node.js built-in modules available
* @property {boolean | null} nodePrefixForCoreModules node.js allows to use `node:` prefix for core modules
* @property {boolean | null} document has document available (allows script tags)

@@ -55,3 +56,3 @@ * @property {boolean | null} importScripts has importScripts available

/**
* @typedef {Object} EcmaTargetProperties
* @typedef {object} EcmaTargetProperties
* @property {boolean | null} globalThis has globalThis variable available

@@ -175,4 +176,4 @@ * @property {boolean | null} bigIntLiteral big int literal syntax is available

"Node.js in version X.Y. The 'async-' prefix will load chunks asynchronously via 'fs' and 'vm' instead of 'require()'. Examples: node14.5, async-node10.",
/^(async-)?node(\d+(?:\.(\d+))?)?$/,
(asyncFlag, major, minor) => {
/^(async-)?node((\d+)(?:\.(\d+))?)?$/,
(asyncFlag, _, major, minor) => {
const v = versionDependent(major, minor);

@@ -190,2 +191,4 @@ // see https://node.green/

nodeBuiltins: true,
// v16.0.0, v14.18.0
nodePrefixForCoreModules: +major < 15 ? v(14, 18) : v(16),
global: true,

@@ -215,4 +218,4 @@ document: false,

"Electron in version X.Y. Script is running in main, preload resp. renderer context.",
/^electron(\d+(?:\.(\d+))?)?-(main|preload|renderer)$/,
(major, minor, context) => {
/^electron((\d+)(?:\.(\d+))?)?-(main|preload|renderer)$/,
(_, major, minor, context) => {
const v = versionDependent(major, minor);

@@ -234,2 +237,6 @@ // see https://node.green/ + https://github.com/electron/releases

nodeBuiltins: true,
// 15.0.0 - Node.js v16.5
// 14.0.0 - Mode.js v14.17, but prefixes only since v14.18
nodePrefixForCoreModules: v(15),
require: true,

@@ -259,4 +266,4 @@ document: context === "renderer",

"NW.js in version X.Y.",
/^(?:nwjs|node-webkit)(\d+(?:\.(\d+))?)?$/,
(major, minor) => {
/^(?:nwjs|node-webkit)((\d+)(?:\.(\d+))?)?$/,
(_, major, minor) => {
const v = versionDependent(major, minor);

@@ -353,3 +360,3 @@ // see https://node.green/ + https://github.com/nwjs/nw.js/blob/nw48/CHANGELOG.md

}
/** @type {Object} */
/** @type {object} */
const result = {};

@@ -356,0 +363,0 @@ for (const key of keys) {

@@ -37,3 +37,3 @@ /*

/**
* @typedef {Object} ExposeOptions
* @typedef {object} ExposeOptions
* @property {string[]} import requests to exposed modules (last one is exported)

@@ -40,0 +40,0 @@ * @property {string} name custom chunk name for the exposed module

@@ -32,6 +32,10 @@ /*

/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
/** @typedef {import("./ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./Module").BuildMeta} BuildMeta */

@@ -48,3 +52,3 @@ /** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */

/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */
/** @typedef {import("./javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("./javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */

@@ -58,3 +62,3 @@ /** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

/**
* @typedef {Object} ContextOptions
* @typedef {object} ContextOptions
* @property {ContextMode} mode

@@ -73,7 +77,7 @@ * @property {boolean} recursive

* @property {string=} layer
* @property {Attributes=} attributes
* @property {ImportAttributes=} attributes
*/
/**
* @typedef {Object} ContextModuleOptionsExtras
* @typedef {object} ContextModuleOptionsExtras
* @property {false|string|string[]} resource

@@ -100,2 +104,6 @@ * @property {string=} resourceQuery

/** @typedef {1 | 3 | 7 | 9} FakeMapType */
/** @typedef {Map<string, string | number> | FakeMapType} FakeMap */
const SNAPSHOT_OPTIONS = { timestamp: true };

@@ -141,2 +149,3 @@

// Info from Factory
/** @type {ResolveDependencies | undefined} */
this.resolveDependencies = resolveDependencies;

@@ -183,2 +192,8 @@ if (options && options.resolveOptions !== undefined) {

/**
* @private
* @param {RegExp} regexString RegExp as a string
* @param {boolean=} stripSlash do we need to strip a slsh
* @returns {string} pretty RegExp
*/
_prettyRegExp(regexString, stripSlash = true) {

@@ -308,3 +323,5 @@ const str = (regexString + "").replace(/!/g, "%21").replace(/\|/g, "%7C");

for (const key of Object.keys(groupOptions)) {
identifier += ` ${key}: ${groupOptions[key]}`;
identifier += ` ${key}: ${
groupOptions[/** @type {keyof RawChunkGroupOptions} */ (key)]
}`;
}

@@ -398,7 +415,9 @@ }

const buildInfo = /** @type {BuildInfo} */ (this.buildInfo);
// always build when we have no snapshot and context
if (!this.buildInfo.snapshot)
if (!buildInfo.snapshot)
return callback(null, Boolean(this.context || this.options.resource));
fileSystemInfo.checkSnapshotValid(this.buildInfo.snapshot, (err, valid) => {
fileSystemInfo.checkSnapshotValid(buildInfo.snapshot, (err, valid) => {
callback(err, !valid);

@@ -429,3 +448,4 @@ });

const startTime = Date.now();
this.resolveDependencies(fs, this.options, (err, dependencies) => {
/** @type {ResolveDependencies} */
(this.resolveDependencies)(fs, this.options, (err, dependencies) => {
if (err) {

@@ -531,3 +551,4 @@ return callback(

if (err) return callback(err);
this.buildInfo.snapshot = snapshot;
/** @type {BuildInfo} */
(this.buildInfo).snapshot = snapshot;
callback();

@@ -563,5 +584,5 @@ }

/**
* @param {ContextElementDependency[]} dependencies all dependencies
* @param {Dependency[]} dependencies all dependencies
* @param {ChunkGraph} chunkGraph chunk graph
* @returns {TODO} TODO
* @returns {Map<string, string | number>} map with user requests
*/

@@ -573,13 +594,15 @@ getUserRequestMap(dependencies, chunkGraph) {

// therefore the order of this is !important!
const sortedDependencies = dependencies
.filter(dependency => moduleGraph.getModule(dependency))
.sort((a, b) => {
if (a.userRequest === b.userRequest) {
return 0;
}
return a.userRequest < b.userRequest ? -1 : 1;
});
const sortedDependencies =
/** @type {ContextElementDependency[]} */
(dependencies)
.filter(dependency => moduleGraph.getModule(dependency))
.sort((a, b) => {
if (a.userRequest === b.userRequest) {
return 0;
}
return a.userRequest < b.userRequest ? -1 : 1;
});
const map = Object.create(null);
for (const dep of sortedDependencies) {
const module = moduleGraph.getModule(dep);
const module = /** @type {Module} */ (moduleGraph.getModule(dep));
map[dep.userRequest] = chunkGraph.getModuleId(module);

@@ -591,5 +614,5 @@ }

/**
* @param {ContextElementDependency[]} dependencies all dependencies
* @param {Dependency[]} dependencies all dependencies
* @param {ChunkGraph} chunkGraph chunk graph
* @returns {TODO} TODO
* @returns {FakeMap} fake map
*/

@@ -608,3 +631,5 @@ getFakeMap(dependencies, chunkGraph) {

const sortedModules = dependencies
.map(dependency => moduleGraph.getModule(dependency))
.map(
dependency => /** @type {Module} */ (moduleGraph.getModule(dependency))
)
.filter(Boolean)

@@ -658,2 +683,6 @@ .sort(comparator);

/**
* @param {FakeMap} fakeMap fake map
* @returns {string} fake map init statement
*/
getFakeMapInitStatement(fakeMap) {

@@ -665,2 +694,7 @@ return typeof fakeMap === "object"

/**
* @param {FakeMapType} type type
* @param {boolean=} asyncModule is async module
* @returns {string} return result
*/
getReturn(type, asyncModule) {

@@ -675,2 +709,8 @@ if (type === 9) {

/**
* @param {FakeMap} fakeMap fake map
* @param {boolean=} asyncModule us async module
* @param {string=} fakeMapDataExpression fake map data expression
* @returns {string} module object source
*/
getReturnModuleObjectSource(

@@ -690,4 +730,4 @@ fakeMap,

/**
* @param {TODO} dependencies TODO
* @param {TODO} id TODO
* @param {Dependency[]} dependencies dependencies
* @param {ModuleId} id module id
* @param {ChunkGraph} chunkGraph the chunk graph

@@ -725,4 +765,4 @@ * @returns {string} source code

/**
* @param {TODO} dependencies TODO
* @param {TODO} id TODO
* @param {Dependency[]} dependencies dependencies
* @param {ModuleId} id module id
* @param {ChunkGraph} chunkGraph the chunk graph

@@ -765,5 +805,5 @@ * @returns {string} source code

/**
* @param {TODO} dependencies TODO
* @param {TODO} id TODO
* @param {Object} context context
* @param {Dependency[]} dependencies dependencies
* @param {ModuleId} id module id
* @param {object} context context
* @param {ChunkGraph} context.chunkGraph the chunk graph

@@ -815,5 +855,5 @@ * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph

/**
* @param {TODO} dependencies TODO
* @param {TODO} id TODO
* @param {Object} context context
* @param {Dependency[]} dependencies dependencies
* @param {ModuleId} id module id
* @param {object} context context
* @param {ChunkGraph} context.chunkGraph the chunk graph

@@ -830,3 +870,3 @@ * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph

? `${arrow ? "id =>" : "function(id)"} {
${this.getReturnModuleObjectSource(fakeMap)}
${this.getReturnModuleObjectSource(fakeMap, true)}
}`

@@ -861,6 +901,6 @@ : RuntimeGlobals.require;

/**
* @param {TODO} block TODO
* @param {TODO} dependencies TODO
* @param {TODO} id TODO
* @param {Object} options options object
* @param {AsyncDependenciesBlock} block block
* @param {Dependency[]} dependencies dependencies
* @param {ModuleId} id module id
* @param {object} options options object
* @param {RuntimeTemplate} options.runtimeTemplate the runtime template

@@ -912,5 +952,5 @@ * @param {ChunkGraph} options.chunkGraph the chunk graph

/**
* @param {TODO} blocks TODO
* @param {TODO} id TODO
* @param {Object} context context
* @param {AsyncDependenciesBlock[]} blocks blocks
* @param {ModuleId} id module id
* @param {object} context context
* @param {ChunkGraph} context.chunkGraph the chunk graph

@@ -932,6 +972,8 @@ * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph

.map(block => {
const dependency = block.dependencies[0];
const dependency =
/** @type {ContextElementDependency} */
(block.dependencies[0]);
return {
dependency: dependency,
module: moduleGraph.getModule(dependency),
module: /** @type {Module} */ (moduleGraph.getModule(dependency)),
block: block,

@@ -1026,2 +1068,7 @@ userRequest: dependency.userRequest,

/**
* @param {ModuleId} id module id
* @param {RuntimeTemplate} runtimeTemplate runtime template
* @returns {string} source for empty async context
*/
getSourceForEmptyContext(id, runtimeTemplate) {

@@ -1039,2 +1086,7 @@ return `function webpackEmptyContext(req) {

/**
* @param {ModuleId} id module id
* @param {RuntimeTemplate} runtimeTemplate runtime template
* @returns {string} source for empty async context
*/
getSourceForEmptyAsyncContext(id, runtimeTemplate) {

@@ -1041,0 +1093,0 @@ const arrow = runtimeTemplate.supportsArrowFunction();

@@ -19,2 +19,4 @@ /*

/** @typedef {import("../Dependency")} Dependency */
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
/** @typedef {import("../DependencyTemplate").CssExportsData} CssExportsData */
/** @typedef {import("../Generator").GenerateContext} GenerateContext */

@@ -35,15 +37,34 @@ /** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */

/**
* @param {CssGeneratorExportsConvention} convention the convention of the exports name
* @param {CssGeneratorExportsConvention | undefined} convention the convention of the exports name
* @param {CssGeneratorLocalIdentName | undefined} localIdentName css export local ident name
* @param {boolean} esModule whether to use ES modules syntax
*/
constructor(convention, localIdentName) {
constructor(convention, localIdentName, esModule) {
super();
/** @type {CssGeneratorExportsConvention} */
/** @type {CssGeneratorExportsConvention | undefined} */
this.convention = convention;
/** @type {CssGeneratorLocalIdentName | undefined} */
this.localIdentName = localIdentName;
/** @type {boolean} */
this.esModule = esModule;
}
// TODO add getConcatenationBailoutReason to allow concatenation
// but how to make it have a module id
/**
* @param {NormalModule} module module for which the bailout reason should be determined
* @param {ConcatenationBailoutReasonContext} context context
* @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated
*/
getConcatenationBailoutReason(module, context) {
if (!this.esModule) {
return "Module is not an ECMAScript module";
}
// TODO webpack 6: remove /\[moduleid\]/.test
if (
/\[id\]/.test(this.localIdentName) ||
/\[moduleid\]/.test(this.localIdentName)
) {
return "The localIdentName includes moduleId ([id] or [moduleid])";
}
return undefined;
}

@@ -59,4 +80,7 @@ /**

const initFragments = [];
/** @type {Map<string, string>} */
const cssExports = new Map();
/** @type {CssExportsData} */
const cssExportsData = {
esModule: this.esModule,
exports: new Map()
};

@@ -68,2 +92,3 @@ generateContext.runtimeRequirements.add(RuntimeGlobals.module);

/** @type {DependencyTemplateContext} */
const templateContext = {

@@ -80,3 +105,3 @@ runtimeTemplate: generateContext.runtimeTemplate,

initFragments,
cssExports,
cssExportsData,
get chunkInitFragments() {

@@ -117,3 +142,3 @@ if (!chunkInitFragments) {

const usedIdentifiers = new Set();
for (const [name, v] of cssExports) {
for (const [name, v] of cssExportsData.exports) {
for (let k of cssExportConvention(name, this.convention)) {

@@ -136,8 +161,9 @@ let identifier = Template.toIdentifier(k);

} else {
const otherUsed =
const needNsObj =
this.esModule &&
generateContext.moduleGraph
.getExportsInfo(module)
.otherExportsInfo.getUsed(generateContext.runtime) !==
UsageState.Unused;
if (otherUsed) {
UsageState.Unused;
if (needNsObj) {
generateContext.runtimeRequirements.add(

@@ -147,12 +173,12 @@ RuntimeGlobals.makeNamespaceObject

}
const newCssExports = [];
for (let [k, v] of cssExports) {
const newExports = [];
for (let [k, v] of cssExportsData.exports) {
for (let name of cssExportConvention(k, this.convention)) {
newCssExports.push(`\t${JSON.stringify(name)}: ${JSON.stringify(v)}`);
newExports.push(`\t${JSON.stringify(name)}: ${JSON.stringify(v)}`);
}
}
return new RawSource(
`${otherUsed ? `${RuntimeGlobals.makeNamespaceObject}(` : ""}${
`${needNsObj ? `${RuntimeGlobals.makeNamespaceObject}(` : ""}${
module.moduleArgument
}.exports = {\n${newCssExports.join(",\n")}\n}${otherUsed ? ")" : ""};`
}.exports = {\n${newExports.join(",\n")}\n}${needNsObj ? ")" : ""};`
);

@@ -159,0 +185,0 @@ }

@@ -18,2 +18,4 @@ /*

/** @typedef {import("../Dependency")} Dependency */
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
/** @typedef {import("../DependencyTemplate").CssExportsData} CssExportsData */
/** @typedef {import("../Generator").GenerateContext} GenerateContext */

@@ -28,11 +30,14 @@ /** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */

/**
* @param {CssGeneratorExportsConvention} convention the convention of the exports name
* @param {CssGeneratorExportsConvention | undefined} convention the convention of the exports name
* @param {CssGeneratorLocalIdentName | undefined} localIdentName css export local ident name
* @param {boolean} esModule whether to use ES modules syntax
*/
constructor(convention, localIdentName) {
constructor(convention, localIdentName, esModule) {
super();
/** @type {CssGeneratorExportsConvention} */
/** @type {CssGeneratorExportsConvention | undefined} */
this.convention = convention;
/** @type {CssGeneratorLocalIdentName | undefined} */
this.localIdentName = localIdentName;
/** @type {boolean} */
this.esModule = esModule;
}

@@ -50,4 +55,7 @@

const initFragments = [];
/** @type {Map<string, string>} */
const cssExports = new Map();
/** @type {CssExportsData} */
const cssExportsData = {
esModule: this.esModule,
exports: new Map()
};

@@ -57,2 +65,3 @@ generateContext.runtimeRequirements.add(RuntimeGlobals.hasCssModules);

let chunkInitFragments;
/** @type {DependencyTemplateContext} */
const templateContext = {

@@ -69,3 +78,3 @@ runtimeTemplate: generateContext.runtimeTemplate,

initFragments,
cssExports,
cssExportsData,
get chunkInitFragments() {

@@ -105,12 +114,13 @@ if (!chunkInitFragments) {

if (cssExports.size > 0) {
const newCssExports = new Map();
for (let [name, v] of cssExports) {
if (cssExportsData.exports.size > 0) {
const newExports = new Map();
for (let [name, v] of cssExportsData.exports) {
for (let newName of cssExportConvention(name, this.convention)) {
newCssExports.set(newName, v);
newExports.set(newName, v);
}
}
const data = generateContext.getData();
data.set("css-exports", newCssExports);
cssExportsData.exports = newExports;
}
const data = generateContext.getData();
data.set("css-exports", cssExportsData);

@@ -117,0 +127,0 @@ return InitFragment.addToSource(source, initFragments, generateContext);

@@ -22,3 +22,3 @@ /*

/**
* @typedef {Object} CssLoadingRuntimeModulePluginHooks
* @typedef {object} CssLoadingRuntimeModulePluginHooks
* @property {SyncWaterfallHook<[string, Chunk]>} createStylesheet

@@ -228,3 +228,5 @@ * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload

// LZW decode
`var map = {}, char = data[0], oldPhrase = char, decoded = char, code = 256, maxCode = "\uffff".charCodeAt(0), phrase;`,
`var map = {}, char = data[0], oldPhrase = char, decoded = char, code = 256, maxCode = ${"\uffff".charCodeAt(
0
)}, phrase;`,
"for (i = 1; i < data.length; i++) {",

@@ -251,7 +253,8 @@ Template.indent([

)}) { token = token.replace(/^_/, ""); token2 = token2.replace(/^_/, ""); exports[token2] = token; token = ""; token2 = ""; }`,
`else if(cc == ${cc("&")}) { ${
RuntimeGlobals.makeNamespaceObject
}(exports); }`,
`else if(!cc || cc == ${cc(
","
)}) { token = token.replace(/^_/, ""); ${
RuntimeGlobals.makeNamespaceObject
}(exports); target[token] = (${runtimeTemplate.basicFunction(
)}) { token = token.replace(/^_/, ""); target[token] = (${runtimeTemplate.basicFunction(
"exports, module",

@@ -258,0 +261,0 @@ `module.exports = exports;`

@@ -8,3 +8,8 @@ /*

const { ConcatSource, PrefixSource } = require("webpack-sources");
const {
ConcatSource,
PrefixSource,
ReplaceSource,
CachedSource
} = require("webpack-sources");
const CssModule = require("../CssModule");

@@ -30,2 +35,3 @@ const HotUpdateChunk = require("../HotUpdateChunk");

const createHash = require("../util/createHash");
const { getUndoPath } = require("../util/identifier");
const memoize = require("../util/memoize");

@@ -44,2 +50,4 @@ const nonNumericOnlyHash = require("../util/nonNumericOnlyHash");

/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../CssModule").Inheritance} Inheritance */
/** @typedef {import("../DependencyTemplate").CssExportsData} CssExportsData */
/** @typedef {import("../Module")} Module */

@@ -166,2 +174,7 @@ /** @typedef {import("../util/memoize")} Memoize */

class CssModulesPlugin {
constructor() {
/** @type {WeakMap<Source, { undoPath: string, inheritance: Inheritance, source: CachedSource }>} */
this._moduleCache = new WeakMap();
}
/**

@@ -226,3 +239,3 @@ * Apply the plugin

switch (type) {
case CSS_MODULE_TYPE:
case CSS_MODULE_TYPE_GLOBAL:
case CSS_MODULE_TYPE_AUTO:

@@ -232,3 +245,3 @@ return new CssParser({

});
case CSS_MODULE_TYPE_GLOBAL:
case CSS_MODULE_TYPE:
return new CssParser({

@@ -253,7 +266,9 @@ allowModeSwitch: false,

generatorOptions.exportsConvention,
generatorOptions.localIdentName
generatorOptions.localIdentName,
generatorOptions.esModule
)
: new CssGenerator(
generatorOptions.exportsConvention,
generatorOptions.localIdentName
generatorOptions.localIdentName,
generatorOptions.esModule
);

@@ -363,2 +378,19 @@ });

const modules = orderedCssModulesPerChunk.get(chunk);
const { path: filename, info } = compilation.getPathWithInfo(
CssModulesPlugin.getChunkFilenameTemplate(
chunk,
compilation.outputOptions
),
{
hash,
runtime: chunk.runtime,
chunk,
contentHashType: "css"
}
);
const undoPath = getUndoPath(
filename,
compilation.outputOptions.path,
false
);
if (modules !== undefined) {

@@ -374,14 +406,7 @@ result.push({

compilation.outputOptions.cssHeadDataCompression,
undoPath,
modules
}),
filenameTemplate: CssModulesPlugin.getChunkFilenameTemplate(
chunk,
compilation.outputOptions
),
pathOptions: {
hash,
runtime: chunk.runtime,
chunk,
contentHashType: "css"
},
filename,
info,
identifier: `css${chunk.id}`,

@@ -404,3 +429,3 @@ hash: chunk.contentHash.css

: globalChunkLoading;
return chunkLoading === "jsonp";
return chunkLoading === "jsonp" || chunkLoading === "import";
};

@@ -518,15 +543,13 @@ const onceForChunkSet = new WeakSet();

// There is a not resolve-able conflict with the selectedModule
if (compilation) {
// TODO print better warning
compilation.warnings.push(
new WebpackError(
`chunk ${chunk.name || chunk.id}\nConflicting order between ${
/** @type {Module} */
(hasFailed).readableIdentifier(compilation.requestShortener)
} and ${selectedModule.readableIdentifier(
compilation.requestShortener
)}`
)
);
}
// TODO print better warning
compilation.warnings.push(
new WebpackError(
`chunk ${chunk.name || chunk.id}\nConflicting order between ${
/** @type {Module} */
(hasFailed).readableIdentifier(compilation.requestShortener)
} and ${selectedModule.readableIdentifier(
compilation.requestShortener
)}`
)
);
selectedModule = /** @type {Module} */ (hasFailed);

@@ -586,5 +609,139 @@ }

/**
* @param {Object} options options
* @param {object} options options
* @param {string[]} options.metaData meta data
* @param {string} options.undoPath undo path for public path auto
* @param {Chunk} options.chunk chunk
* @param {ChunkGraph} options.chunkGraph chunk graph
* @param {CodeGenerationResults} options.codeGenerationResults code generation results
* @param {CssModule} options.module css module
* @returns {Source} css module source
*/
renderModule({
metaData,
undoPath,
chunk,
chunkGraph,
codeGenerationResults,
module
}) {
const codeGenResult = codeGenerationResults.get(module, chunk.runtime);
const moduleSourceContent =
/** @type {Source} */
(
codeGenResult.sources.get("css") ||
codeGenResult.sources.get("css-import")
);
const cacheEntry = this._moduleCache.get(moduleSourceContent);
/** @type {Inheritance} */
let inheritance = [[module.cssLayer, module.supports, module.media]];
if (module.inheritance) {
inheritance.push(...module.inheritance);
}
let source;
if (
cacheEntry &&
cacheEntry.undoPath === undoPath &&
cacheEntry.inheritance.every(([layer, supports, media], i) => {
const item = inheritance[i];
if (Array.isArray(item)) {
return layer === item[0] && supports === item[1] && media === item[2];
}
return false;
})
) {
source = cacheEntry.source;
} else {
const moduleSourceCode = /** @type {string} */ (
moduleSourceContent.source()
);
const publicPathAutoRegex = new RegExp(
CssUrlDependency.PUBLIC_PATH_AUTO,
"g"
);
/** @type {Source} */
let moduleSource = new ReplaceSource(moduleSourceContent);
let match;
while ((match = publicPathAutoRegex.exec(moduleSourceCode))) {
/** @type {ReplaceSource} */ (moduleSource).replace(
match.index,
(match.index += match[0].length - 1),
undoPath
);
}
for (let i = 0; i < inheritance.length; i++) {
const layer = inheritance[i][0];
const supports = inheritance[i][1];
const media = inheritance[i][2];
if (media) {
moduleSource = new ConcatSource(
`@media ${media} {\n`,
new PrefixSource("\t", moduleSource),
"}\n"
);
}
if (supports) {
moduleSource = new ConcatSource(
`@supports (${supports}) {\n`,
new PrefixSource("\t", moduleSource),
"}\n"
);
}
// Layer can be anonymous
if (layer !== undefined && layer !== null) {
moduleSource = new ConcatSource(
`@layer${layer ? ` ${layer}` : ""} {\n`,
new PrefixSource("\t", moduleSource),
"}\n"
);
}
}
if (moduleSource) {
moduleSource = new ConcatSource(moduleSource, "\n");
}
source = new CachedSource(moduleSource);
this._moduleCache.set(moduleSourceContent, {
inheritance,
undoPath,
source
});
}
/** @type {CssExportsData | undefined} */
const cssExportsData =
codeGenResult.data && codeGenResult.data.get("css-exports");
const exports = cssExportsData && cssExportsData.exports;
const esModule = cssExportsData && cssExportsData.esModule;
let moduleId = chunkGraph.getModuleId(module) + "";
// When `optimization.moduleIds` is `named` the module id is a path, so we need to normalize it between platforms
if (typeof moduleId === "string") {
moduleId = moduleId.replace(/\\/g, "/");
}
metaData.push(
`${
exports
? Array.from(
exports,
([n, v]) => `${escapeCss(n)}:${escapeCss(v)}/`
).join("")
: ""
}${esModule ? "&" : ""}${escapeCss(moduleId)}`
);
return source;
}
/**
* @param {object} options options
* @param {string | undefined} options.uniqueName unique name
* @param {boolean | undefined} options.cssHeadDataCompression compress css head data
* @param {string} options.undoPath undo path for public path auto
* @param {Chunk} options.chunk chunk

@@ -599,2 +756,3 @@ * @param {ChunkGraph} options.chunkGraph chunk graph

cssHeadDataCompression,
undoPath,
chunk,

@@ -610,72 +768,11 @@ chunkGraph,

try {
const codeGenResult = codeGenerationResults.get(module, chunk.runtime);
let moduleSource =
/** @type {Source} */
(
codeGenResult.sources.get("css") ||
codeGenResult.sources.get("css-import")
);
let inheritance = [[module.cssLayer, module.supports, module.media]];
if (module.inheritance) {
inheritance.push(...module.inheritance);
}
for (let i = 0; i < inheritance.length; i++) {
const layer = inheritance[i][0];
const supports = inheritance[i][1];
const media = inheritance[i][2];
if (media) {
moduleSource = new ConcatSource(
`@media ${media} {\n`,
new PrefixSource("\t", moduleSource),
"}\n"
);
}
if (supports) {
moduleSource = new ConcatSource(
`@supports (${supports}) {\n`,
new PrefixSource("\t", moduleSource),
"}\n"
);
}
// Layer can be anonymous
if (layer !== undefined && layer !== null) {
moduleSource = new ConcatSource(
`@layer${layer ? ` ${layer}` : ""} {\n`,
new PrefixSource("\t", moduleSource),
"}\n"
);
}
}
if (moduleSource) {
source.add(moduleSource);
source.add("\n");
}
/** @type {Map<string, string> | undefined} */
const exports =
codeGenResult.data && codeGenResult.data.get("css-exports");
let moduleId = chunkGraph.getModuleId(module) + "";
// When `optimization.moduleIds` is `named` the module id is a path, so we need to normalize it between platforms
if (typeof moduleId === "string") {
moduleId = moduleId.replace(/\\/g, "/");
}
metaData.push(
`${
exports
? Array.from(
exports,
([n, v]) => `${escapeCss(n)}:${escapeCss(v)}/`
).join("")
: ""
}${escapeCss(moduleId)}`
);
const moduleSource = this.renderModule({
metaData,
undoPath,
chunk,
chunkGraph,
codeGenerationResults,
module
});
source.add(moduleSource);
} catch (e) {

@@ -682,0 +779,0 @@ /** @type {Error} */

@@ -603,7 +603,9 @@ /*

}
const { line: sl, column: sc } = locConverter.get(pos);
const { line: el, column: ec } = locConverter.get(newPos);
const dep = new CssLocalIdentifierDependency(name, [pos, newPos]);
dep.setLoc(sl, sc, el, ec);
module.addDependency(dep);
if (isLocalMode()) {
const { line: sl, column: sc } = locConverter.get(pos);
const { line: el, column: ec } = locConverter.get(newPos);
const dep = new CssLocalIdentifierDependency(name, [pos, newPos]);
dep.setLoc(sl, sc, el, ec);
module.addDependency(dep);
}
pos = newPos;

@@ -634,13 +636,15 @@ return pos + 1;

}
const { line: sl, column: sc } = locConverter.get(pos);
const { line: el, column: ec } = locConverter.get(propertyNameEnd);
const name = propertyName.slice(2);
const dep = new CssLocalIdentifierDependency(
name,
[propertyNameStart, propertyNameEnd],
"--"
);
dep.setLoc(sl, sc, el, ec);
module.addDependency(dep);
declaredCssVariables.add(name);
if (isLocalMode()) {
const { line: sl, column: sc } = locConverter.get(pos);
const { line: el, column: ec } = locConverter.get(propertyNameEnd);
const dep = new CssLocalIdentifierDependency(
name,
[propertyNameStart, propertyNameEnd],
"--"
);
dep.setLoc(sl, sc, el, ec);
module.addDependency(dep);
}
pos = propertyNameEnd;

@@ -715,3 +719,3 @@ return pos + 1;

const semicolonPos = end;
end = walkCssTokens.eatWhiteLine(input, end + 1);
end = walkCssTokens.eatWhiteLine(input, end);
const { line: sl, column: sc } = locConverter.get(start);

@@ -1036,2 +1040,7 @@ const { line: el, column: ec } = locConverter.get(end);

module.buildMeta.exportsType = this.namedExports ? "namespace" : "default";
if (!this.namedExports) {
module.buildMeta.defaultObject = "redirect";
}
module.addDependency(new StaticExportsDependency([], true));

@@ -1038,0 +1047,0 @@ return state;

@@ -9,3 +9,3 @@ /*

/**
* @typedef {Object} CssTokenCallbacks
* @typedef {object} CssTokenCallbacks
* @property {function(string, number): boolean=} isSelector

@@ -12,0 +12,0 @@ * @property {function(string, number, number, number, number): number=} url

@@ -140,3 +140,3 @@ /*

* an object that wraps Tracer and Profiler with a counter
* @typedef {Object} Trace
* @typedef {object} Trace
* @property {Tracer} trace instance of Tracer

@@ -143,0 +143,0 @@ * @property {number} counter Counter

@@ -30,2 +30,3 @@ /*

/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */

@@ -38,3 +39,3 @@ /** @typedef {import("./logging/Logger").Logger} Logger */

/**
* @typedef {Object} RuntimeValueOptions
* @typedef {object} RuntimeValueOptions
* @property {string[]=} fileDependencies

@@ -120,2 +121,11 @@ * @property {string[]=} contextDependencies

/**
* @param {Set<DestructuringAssignmentProperty> | undefined} properties properties
* @returns {Set<string> | undefined} used keys
*/
function getObjKeys(properties) {
if (!properties) return undefined;
return new Set([...properties].map(p => p.id));
}
/**
* @param {any[]|{[k: string]: any}} obj obj

@@ -497,3 +507,3 @@ * @param {JavascriptParser} parser Parser

!parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]),
parser.destructuringAssignmentPropertiesFor(expr)
null
);

@@ -573,3 +583,3 @@

* @param {string} key Key
* @param {Object} obj Object
* @param {object} obj Object
* @returns {void}

@@ -605,3 +615,3 @@ */

!parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]),
parser.destructuringAssignmentPropertiesFor(expr)
getObjKeys(parser.destructuringAssignmentPropertiesFor(expr))
);

@@ -608,0 +618,0 @@

@@ -14,3 +14,3 @@ /*

/** @typedef {import("../ModuleGraph")} ModuleGraph */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */

@@ -28,3 +28,3 @@ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

* @param {string=} context context
* @param {Attributes=} attributes attributes
* @param {ImportAttributes=} attributes import assertions
*/

@@ -31,0 +31,0 @@ constructor(

@@ -82,5 +82,5 @@ /*

*/
apply(dependency, source, { cssExports }) {
apply(dependency, source, { cssExportsData }) {
const dep = /** @type {CssExportDependency} */ (dependency);
cssExports.set(dep.name, dep.value);
cssExportsData.exports.set(dep.name, dep.value);
}

@@ -87,0 +87,0 @@ };

@@ -160,3 +160,10 @@ /*

source,
{ module, moduleGraph, chunkGraph, runtime, runtimeTemplate, cssExports }
{
module,
moduleGraph,
chunkGraph,
runtime,
runtimeTemplate,
cssExportsData
}
) {

@@ -183,3 +190,3 @@ const dep = /** @type {CssLocalIdentifierDependency} */ (dependency);

);
if (used) cssExports.set(used, localIdent);
if (used) cssExportsData.exports.set(used, localIdent);
}

@@ -186,0 +193,0 @@ };

@@ -129,2 +129,3 @@ /*

const dep = /** @type {CssUrlDependency} */ (dependency);
const module = /** @type {Module} */ (moduleGraph.getModule(dep));

@@ -138,4 +139,3 @@ /** @type {string | undefined} */

runtimeTemplate.assetUrl({
publicPath: "",
module: /** @type {Module} */ (moduleGraph.getModule(dep)),
module,
codeGenerationResults

@@ -148,4 +148,3 @@ })

runtimeTemplate.assetUrl({
publicPath: "",
module: /** @type {Module} */ (moduleGraph.getModule(dep)),
module,
codeGenerationResults

@@ -167,2 +166,4 @@ })

CssUrlDependency.PUBLIC_PATH_AUTO = "__WEBPACK_CSS_PUBLIC_PATH_AUTO__";
module.exports = CssUrlDependency;

@@ -55,3 +55,3 @@ /*

const exportsInfo = moduleGraph.getExportsInfo(module);
const exportInfo = exportsInfo.getExportInfo(exportName[0]);
const exportInfo = exportsInfo.getReadOnlyExportInfoRecursive(exportName);
if (exportInfo) return exportInfo.canMangle;

@@ -58,0 +58,0 @@ return exportsInfo.otherExportsInfo.canMangle;

@@ -95,7 +95,9 @@ /*

const dep = /** @type {ExternalModuleDependency} */ (dependency);
const { chunkInitFragments } = templateContext;
const { chunkInitFragments, runtimeTemplate } = templateContext;
chunkInitFragments.push(
new ExternalModuleInitFragment(
dep.importedModule,
`${runtimeTemplate.supportNodePrefixForCoreModules() ? "node:" : ""}${
dep.importedModule
}`,
dep.specifiers,

@@ -102,0 +104,0 @@ dep.default

@@ -17,3 +17,3 @@ /*

/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -37,3 +37,3 @@ /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */

* @param {Range} range location in source code
* @param {Attributes} attributes assertions
* @param {ImportAttributes} attributes import assertions
* @param {string} operator operator

@@ -40,0 +40,0 @@ */

@@ -43,3 +43,3 @@ /*

/** @typedef {import("../WebpackError")} WebpackError */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */

@@ -341,3 +341,3 @@ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

* @param {HarmonyStarExportsList | null} allStarExports all star exports in the module
* @param {Attributes=} attributes import assertions
* @param {ImportAttributes=} attributes import attributes
*/

@@ -344,0 +344,0 @@ constructor(

@@ -29,3 +29,3 @@ /*

/** @typedef {import("../WebpackError")} WebpackError */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */

@@ -66,3 +66,3 @@ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

* @param {number} sourceOrder source order
* @param {Attributes=} attributes import assertions
* @param {ImportAttributes=} attributes import attributes
*/

@@ -69,0 +69,0 @@ constructor(request, sourceOrder, attributes) {

@@ -32,2 +32,4 @@ /*

/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -41,3 +43,3 @@ /** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */

/**
* @typedef {Object} HarmonySettings
* @typedef {object} HarmonySettings
* @property {string[]} ids

@@ -53,3 +55,3 @@ * @property {string} source

* @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | (ImportExpression & { arguments?: ObjectExpression[] })} node node with assertions
* @returns {Record<string, any> | undefined} assertions
* @returns {ImportAttributes} import attributes
*/

@@ -67,30 +69,51 @@ function getAttributes(node) {

) {
const properties = /** @type {Property[]} */ (
node.arguments[0].properties[0].value.properties
);
const result = {};
const properties =
/** @type {Property[]} */
(node.arguments[0].properties[0].value.properties);
const result = /** @type {ImportAttributes} */ ({});
for (const property of properties) {
const key =
property.key.type === "Identifier"
? property.key.name
: /** @type {Literal} */ (property.key).value;
result[key] = /** @type {Literal} */ (property.value).value;
/** @type {string} */
(
property.key.type === "Identifier"
? property.key.name
: /** @type {Literal} */ (property.key).value
);
result[key] =
/** @type {string} */
(/** @type {Literal} */ (property.value).value);
}
const key =
node.arguments[0].properties[0].key.type === "Identifier"
? node.arguments[0].properties[0].key.name
: /** @type {Literal} */ (node.arguments[0].properties[0].key).value;
if (key === "assert") {
result._isLegacyAssert = true;
}
return result;
}
// TODO remove cast when @types/estree has been updated to import assertions
const attributes =
/** @type {{ assertions?: ImportAttributeNode[] }} */
(node).assertions;
const isImportAssertion =
/** @type {{ assertions?: ImportAttributeNode[] }} */ (node).assertions !==
undefined;
const attributes = isImportAssertion
? /** @type {{ assertions?: ImportAttributeNode[] }} */ (node).assertions
: /** @type {{ attributes?: ImportAttributeNode[] }} */ (node).attributes;
if (attributes === undefined) {
return undefined;
}
const result = {};
const result = /** @type {ImportAttributes} */ ({});
for (const attribute of attributes) {
const key =
attribute.key.type === "Identifier"
? attribute.key.name
: attribute.key.value;
result[key] = attribute.value.value;
/** @type {string} */
(
attribute.key.type === "Identifier"
? attribute.key.name
: attribute.key.value
);
result[key] = /** @type {string} */ (attribute.value.value);
}
if (isImportAssertion) {
result._isLegacyAssert = true;
}
return result;

@@ -97,0 +120,0 @@ }

@@ -19,3 +19,3 @@ /*

/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../util/Hash")} Hash */

@@ -28,3 +28,3 @@ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */

* @param {number} sourceOrder source order
* @param {Attributes=} attributes assertions
* @param {ImportAttributes=} attributes import attributes
*/

@@ -31,0 +31,0 @@ constructor(request, sourceOrder, attributes) {

@@ -9,2 +9,3 @@ /*

const Dependency = require("../Dependency");
const Template = require("../Template");
const {

@@ -31,3 +32,4 @@ getDependencyUsedByExportsCondition

/** @typedef {import("../WebpackError")} WebpackError */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -51,4 +53,4 @@ /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */

* @param {TODO} exportPresenceMode export presence mode
* @param {Attributes=} attributes assertions
* @param {Range[]=} idRanges ranges for members of ids; the two arrays are right-aligned
* @param {ImportAttributes | undefined} attributes import attributes
* @param {Range[] | undefined} idRanges ranges for members of ids; the two arrays are right-aligned
*/

@@ -79,3 +81,3 @@ constructor(

this.usedByExports = undefined;
/** @type {Set<string> | undefined} */
/** @type {Set<DestructuringAssignmentProperty> | undefined} */
this.referencedPropertiesInDestructuring = undefined;

@@ -151,4 +153,3 @@ }

let ids = this.getIds(moduleGraph);
if (ids.length === 0)
return this._getReferencedExportsInDestructuring(moduleGraph);
if (ids.length === 0) return this._getReferencedExportsInDestructuring();
let namespaceObjectAsContext = this.namespaceObjectAsContext;

@@ -170,3 +171,3 @@ if (ids[0] === "default") {

if (ids.length === 1)
return this._getReferencedExportsInDestructuring(moduleGraph);
return this._getReferencedExportsInDestructuring();
ids = ids.slice(1);

@@ -189,27 +190,15 @@ namespaceObjectAsContext = true;

return this._getReferencedExportsInDestructuring(moduleGraph, ids);
return this._getReferencedExportsInDestructuring(ids);
}
/**
* @param {ModuleGraph} moduleGraph module graph
* @param {string[]=} ids ids
* @returns {(string[] | ReferencedExport)[]} referenced exports
* @returns {string[][]} referenced exports
*/
_getReferencedExportsInDestructuring(moduleGraph, ids) {
_getReferencedExportsInDestructuring(ids) {
if (this.referencedPropertiesInDestructuring) {
/** @type {ReferencedExport[]} */
/** @type {string[][]} */
const refs = [];
const importedModule = moduleGraph.getModule(this);
const canMangle =
Array.isArray(ids) &&
ids.length > 0 &&
!moduleGraph
.getExportsInfo(importedModule)
.getExportInfo(ids[0])
.isReexport();
for (const key of this.referencedPropertiesInDestructuring) {
refs.push({
name: ids ? ids.concat([key]) : [key],
canMangle
});
for (const { id } of this.referencedPropertiesInDestructuring) {
refs.push(ids ? ids.concat([id]) : [id]);
}

@@ -346,12 +335,7 @@ return refs;

const ids = dep.getIds(moduleGraph);
const {
trimmedRange: [trimmedRangeStart, trimmedRangeEnd],
trimmedIds
} = getTrimmedIdsAndRange(
dep.getIds(moduleGraph),
dep.range,
dep.idRanges,
moduleGraph,
dep
);
} = getTrimmedIdsAndRange(ids, dep.range, dep.idRanges, moduleGraph, dep);

@@ -369,2 +353,29 @@ const exportExpr = this._getCodeForIds(

}
if (dep.referencedPropertiesInDestructuring) {
for (let {
id,
shorthand,
range
} of dep.referencedPropertiesInDestructuring) {
const concatedIds = ids.concat([id]);
if (concatedIds[0] === "default") concatedIds.shift();
const module = moduleGraph.getModule(dep);
const used = moduleGraph
.getExportsInfo(module)
.getUsedName(concatedIds, runtime);
if (!used) return;
const newName = used[used.length - 1];
const name = concatedIds[concatedIds.length - 1];
if (newName === name) continue;
const comment = Template.toNormalComment(name) + " ";
const key = comment + JSON.stringify(newName);
source.replace(
range[0],
range[1] - 1,
shorthand ? `${key}: ${name}` : `${key}`
);
}
}
}

@@ -371,0 +382,0 @@

@@ -19,3 +19,3 @@ /*

/** @typedef {import("../ModuleGraph")} ModuleGraph */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -31,3 +31,3 @@ /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */

* @param {(string[][] | null)=} referencedExports list of referenced exports
* @param {Attributes=} attributes assertions
* @param {ImportAttributes=} attributes import attributes
*/

@@ -34,0 +34,0 @@ constructor(request, range, referencedExports, attributes) {

@@ -18,3 +18,3 @@ /*

/** @typedef {import("../ModuleGraph")} ModuleGraph */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -27,3 +27,3 @@

* @param {(string[][] | null)=} referencedExports list of referenced exports
* @param {Attributes=} attributes assertions
* @param {ImportAttributes=} attributes import attributes
*/

@@ -30,0 +30,0 @@ constructor(request, range, referencedExports, attributes) {

@@ -134,3 +134,3 @@ /*

let str = "";
for (const prop of referencedPropertiesInDestructuring) {
for (const { id: prop } of referencedPropertiesInDestructuring) {
switch (prop) {

@@ -137,0 +137,0 @@ case "url":

@@ -259,3 +259,5 @@ /*

}
exports = exportsFromEnumerable(referencedPropertiesInDestructuring);
exports = exportsFromEnumerable(
[...referencedPropertiesInDestructuring].map(({ id }) => id)
);
}

@@ -262,0 +264,0 @@

@@ -18,3 +18,3 @@ /*

/** @typedef {import("../ModuleGraph")} ModuleGraph */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -27,3 +27,3 @@

* @param {(string[][] | null)=} referencedExports list of referenced exports
* @param {Attributes=} attributes assertions
* @param {ImportAttributes=} attributes import attributes
*/

@@ -30,0 +30,0 @@ constructor(request, range, referencedExports, attributes) {

@@ -32,3 +32,3 @@ /*

/**
* @typedef {Object} ImportModuleOptions
* @typedef {object} ImportModuleOptions
* @property {string=} layer the target layer

@@ -41,3 +41,3 @@ * @property {string=} publicPath the target public path

/**
* @param {Object} options options
* @param {object} options options
*/

@@ -44,0 +44,0 @@ constructor(options = {}) {}

@@ -14,3 +14,3 @@ /*

/** @typedef {import("../Module")} Module */
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */

@@ -30,3 +30,3 @@ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

// assertions must be serialized by subclasses that use it
/** @type {Attributes | undefined} */
/** @type {ImportAttributes | undefined} */
this.assertions = undefined;

@@ -33,0 +33,0 @@ this._context = undefined;

@@ -10,3 +10,3 @@ /*

const makeSerializable = require("../util/makeSerializable");
const { filterRuntime, deepMergeRuntime } = require("../util/runtime");
const { filterRuntime, runtimeToString } = require("../util/runtime");
const NullDependency = require("./NullDependency");

@@ -17,2 +17,3 @@

/** @typedef {import("../Dependency")} Dependency */
/** @typedef {import("../Dependency").RuntimeSpec} RuntimeSpec */
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */

@@ -37,6 +38,30 @@ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */

this.usedByExports = false;
this._hashUpdate = undefined;
}
/**
* @param {ModuleGraph} moduleGraph module graph
* @param {RuntimeSpec} runtime current runtimes
* @returns {boolean | RuntimeSpec} runtime condition
*/
_getRuntimeCondition(moduleGraph, runtime) {
const usedByExports = this.usedByExports;
if (usedByExports !== false) {
const selfModule =
/** @type {Module} */
(moduleGraph.getParentModule(this));
const exportsInfo = moduleGraph.getExportsInfo(selfModule);
const runtimeCondition = filterRuntime(runtime, runtime => {
for (const exportName of usedByExports) {
if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) {
return true;
}
}
return false;
});
return runtimeCondition;
}
return false;
}
/**
* Update the hash

@@ -48,6 +73,18 @@ * @param {Hash} hash hash to be updated

updateHash(hash, context) {
if (this._hashUpdate === undefined) {
this._hashUpdate = this.range + "";
const runtimeCondition = this._getRuntimeCondition(
context.chunkGraph.moduleGraph,
context.runtime
);
if (runtimeCondition === true) {
return;
} else if (runtimeCondition === false) {
hash.update("null");
} else {
hash.update(
runtimeToString(runtimeCondition) +
"|" +
runtimeToString(context.runtime)
);
}
hash.update(this._hashUpdate);
hash.update(this.range + "");
}

@@ -101,50 +138,27 @@

source,
{
chunkGraph,
moduleGraph,
runtime,
runtimes,
runtimeTemplate,
runtimeRequirements
}
{ chunkGraph, moduleGraph, runtime, runtimeTemplate, runtimeRequirements }
) {
const dep = /** @type {PureExpressionDependency} */ (dependency);
const usedByExports = dep.usedByExports;
if (usedByExports !== false) {
const selfModule =
/** @type {Module} */
(moduleGraph.getParentModule(dep));
const exportsInfo = moduleGraph.getExportsInfo(selfModule);
const merged = deepMergeRuntime(runtimes, runtime);
const runtimeCondition = filterRuntime(merged, runtime => {
for (const exportName of usedByExports) {
if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) {
return true;
}
}
return false;
const runtimeCondition = dep._getRuntimeCondition(moduleGraph, runtime);
if (runtimeCondition === true) {
return;
} else if (runtimeCondition === false) {
source.insert(
dep.range[0],
`(/* unused pure expression or super */ null && (`
);
source.insert(dep.range[1], "))");
} else {
const condition = runtimeTemplate.runtimeConditionExpression({
chunkGraph,
runtime,
runtimeCondition,
runtimeRequirements
});
if (runtimeCondition === true) return;
if (runtimeCondition !== false) {
const condition = runtimeTemplate.runtimeConditionExpression({
chunkGraph,
runtime: merged,
runtimeCondition,
runtimeRequirements
});
source.insert(
dep.range[0],
`(/* runtime-dependent pure expression or super */ ${condition} ? (`
);
source.insert(dep.range[1], ") : null)");
return;
}
source.insert(
dep.range[0],
`(/* runtime-dependent pure expression or super */ ${condition} ? (`
);
source.insert(dep.range[1], ") : null)");
}
source.insert(
dep.range[0],
`(/* unused pure expression or super */ null && (`
);
source.insert(dep.range[1], "))");
}

@@ -151,0 +165,0 @@ };

@@ -31,3 +31,3 @@ /*

* @param {Range} range range
* @param {Object} workerDependencyOptions options
* @param {object} workerDependencyOptions options
* @param {string=} workerDependencyOptions.publicPath public path for the worker

@@ -34,0 +34,0 @@ */

@@ -27,3 +27,3 @@ /*

/**
* @typedef {Object} UpdateHashContext
* @typedef {object} UpdateHashContext
* @property {ChunkGraph} chunkGraph

@@ -35,3 +35,3 @@ * @property {RuntimeSpec} runtime

/**
* @typedef {Object} SourcePosition
* @typedef {object} SourcePosition
* @property {number} line

@@ -42,3 +42,3 @@ * @property {number=} column

/**
* @typedef {Object} RealDependencyLocation
* @typedef {object} RealDependencyLocation
* @property {SourcePosition} start

@@ -50,3 +50,3 @@ * @property {SourcePosition=} end

/**
* @typedef {Object} SyntheticDependencyLocation
* @typedef {object} SyntheticDependencyLocation
* @property {string} name

@@ -56,6 +56,6 @@ * @property {number=} index

/** @typedef {SyntheticDependencyLocation|RealDependencyLocation} DependencyLocation */
/** @typedef {SyntheticDependencyLocation | RealDependencyLocation} DependencyLocation */
/**
* @typedef {Object} ExportSpec
* @typedef {object} ExportSpec
* @property {string} name the name of the export

@@ -72,3 +72,3 @@ * @property {boolean=} canMangle can the export be renamed (defaults to true)

/**
* @typedef {Object} ExportsSpec
* @typedef {object} ExportsSpec
* @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports

@@ -85,3 +85,3 @@ * @property {Set<string>=} excludeExports when exports = true, list of unaffected exports

/**
* @typedef {Object} ReferencedExport
* @typedef {object} ReferencedExport
* @property {string[]} name name of the referenced export

@@ -88,0 +88,0 @@ * @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true

@@ -27,3 +27,3 @@ /*

/**
* @typedef {Object} DependencyTemplateContext
* @typedef {object} DependencyTemplateContext
* @property {RuntimeTemplate} runtimeTemplate the runtime template

@@ -35,4 +35,3 @@ * @property {DependencyTemplates} dependencyTemplates the dependency templates

* @property {Module} module current module
* @property {RuntimeSpec} runtime current runtime, for which code is generated
* @property {RuntimeSpec[]} [runtimes] current runtimes, for which code is generated
* @property {RuntimeSpec} runtime current runtimes, for which code is generated
* @property {InitFragment<GenerateContext>[]} initFragments mutable array of init fragments for the current module

@@ -45,6 +44,12 @@ * @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules

/**
* @typedef {Object} CssDependencyTemplateContextExtras
* @property {Map<string, string>} cssExports the css exports
* @typedef {object} CssDependencyTemplateContextExtras
* @property {CssExportsData} cssExportsData the css exports data
*/
/**
* @typedef {object} CssExportsData
* @property {boolean} esModule whether export __esModule
* @property {Map<string, string>} exports the css exports
*/
/** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */

@@ -51,0 +56,0 @@

@@ -38,3 +38,3 @@ /*

this.options = options;
/** @type {WeakMap<Object, {path: string, data: DllReferencePluginOptionsManifest?, error: Error?}>} */
/** @type {WeakMap<object, {path: string, data: DllReferencePluginOptionsManifest?, error: Error?}>} */
this._compilationData = new WeakMap();

@@ -41,0 +41,0 @@ }

@@ -25,3 +25,3 @@ /*

/**
* @typedef {Object} JsonpCompilationPluginHooks
* @typedef {object} JsonpCompilationPluginHooks
* @property {SyncWaterfallHook<[string, Chunk]>} linkPreload

@@ -93,3 +93,3 @@ * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch

runtimeTemplate,
outputOptions: { importFunctionName }
outputOptions: { environment, importFunctionName, crossOriginLoading }
} = compilation;

@@ -110,2 +110,10 @@ const fn = RuntimeGlobals.ensureChunkHandlers;

);
const { linkPreload, linkPrefetch } =
ModuleChunkLoadingRuntimeModule.getCompilationHooks(compilation);
const withPrefetch =
environment.document &&
this._runtimeRequirements.has(RuntimeGlobals.prefetchChunkHandlers);
const withPreload =
environment.document &&
this._runtimeRequirements.has(RuntimeGlobals.preloadChunkHandlers);
const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs);

@@ -235,2 +243,82 @@ const hasJsMatcher = compileBooleanMatcher(conditionMap);

"",
withPrefetch && hasJsMatcher !== false
? `${
RuntimeGlobals.prefetchChunkHandlers
}.j = ${runtimeTemplate.basicFunction("chunkId", [
`if((!${
RuntimeGlobals.hasOwnProperty
}(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${
hasJsMatcher === true ? "true" : hasJsMatcher("chunkId")
}) {`,
Template.indent([
"installedChunks[chunkId] = null;",
linkPrefetch.call(
Template.asString([
"var link = document.createElement('link');",
crossOriginLoading
? `link.crossOrigin = ${JSON.stringify(
crossOriginLoading
)};`
: "",
`if (${RuntimeGlobals.scriptNonce}) {`,
Template.indent(
`link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});`
),
"}",
'link.rel = "prefetch";',
'link.as = "script";',
`link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`
]),
chunk
),
"document.head.appendChild(link);"
]),
"}"
])};`
: "// no prefetching",
"",
withPreload && hasJsMatcher !== false
? `${
RuntimeGlobals.preloadChunkHandlers
}.j = ${runtimeTemplate.basicFunction("chunkId", [
`if((!${
RuntimeGlobals.hasOwnProperty
}(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${
hasJsMatcher === true ? "true" : hasJsMatcher("chunkId")
}) {`,
Template.indent([
"installedChunks[chunkId] = null;",
linkPreload.call(
Template.asString([
"var link = document.createElement('link');",
"link.charset = 'utf-8';",
`if (${RuntimeGlobals.scriptNonce}) {`,
Template.indent(
`link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});`
),
"}",
'link.rel = "modulepreload";',
`link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`,
crossOriginLoading
? crossOriginLoading === "use-credentials"
? 'link.crossOrigin = "use-credentials";'
: Template.asString([
"if (link.href.indexOf(window.location.origin + '/') !== 0) {",
Template.indent(
`link.crossOrigin = ${JSON.stringify(
crossOriginLoading
)};`
),
"}"
])
: ""
]),
chunk
),
"document.head.appendChild(link);"
]),
"}"
])};`
: "// no preloaded",
"",
withExternalInstallChunk

@@ -237,0 +325,0 @@ ? Template.asString([

@@ -15,2 +15,3 @@ /*

/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */
/** @typedef {import("./Compiler")} Compiler */

@@ -31,3 +32,13 @@

/**
* @typedef {object} EvalDevToolModulePluginOptions
* @property {OutputOptions["devtoolNamespace"]=} namespace namespace
* @property {string=} sourceUrlComment source url comment
* @property {OutputOptions["devtoolModuleFilenameTemplate"]=} moduleFilenameTemplate module filename template
*/
class EvalDevToolModulePlugin {
/**
* @param {EvalDevToolModulePluginOptions=} options options
*/
constructor(options) {

@@ -34,0 +45,0 @@ this.namespace = options.namespace || "";

@@ -174,2 +174,6 @@ /*

/**
* @param {ExportsInfo | undefined} exportsInfo exports info
* @returns {boolean} result
*/
setRedirectNamedTo(exportsInfo) {

@@ -480,2 +484,3 @@ if (this._redirectTo === exportsInfo) return false;

getUsedExports(runtime) {
// eslint-disable-next-line no-constant-binary-expression
if (!this._redirectTo !== undefined) {

@@ -529,2 +534,3 @@ switch (this._otherExportsInfo.getUsed(runtime)) {

getProvidedExports() {
// eslint-disable-next-line no-constant-binary-expression
if (!this._redirectTo !== undefined) {

@@ -810,7 +816,16 @@ switch (this._otherExportsInfo.provided) {

this.name = name;
/** @private @type {string | null} */
/**
* @private
* @type {string | null}
*/
this._usedName = initFrom ? initFrom._usedName : null;
/** @private @type {UsageStateType} */
/**
* @private
* @type {UsageStateType}
*/
this._globalUsed = initFrom ? initFrom._globalUsed : undefined;
/** @private @type {Map<string, RuntimeUsageStateType>} */
/**
* @private
* @type {Map<string, RuntimeUsageStateType>}
*/
this._usedInRuntime =

@@ -820,3 +835,6 @@ initFrom && initFrom._usedInRuntime

: undefined;
/** @private @type {boolean} */
/**
* @private
* @type {boolean}
*/
this._hasUseInRuntimeInfo = initFrom

@@ -823,0 +841,0 @@ ? initFrom._hasUseInRuntimeInfo

@@ -48,3 +48,3 @@ /*

/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
/** @typedef {import("./javascript/JavascriptParser").Attributes} Attributes */
/** @typedef {import("./javascript/JavascriptParser").ImportAttributes} ImportAttributes */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */

@@ -57,3 +57,3 @@ /** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

/** @typedef {{ attributes?: Attributes }} ImportDependencyMeta */
/** @typedef {{ attributes?: ImportAttributes }} ImportDependencyMeta */
/** @typedef {{ layer?: string, supports?: string, media?: string }} CssImportDependencyMeta */

@@ -64,3 +64,3 @@

/**
* @typedef {Object} SourceData
* @typedef {object} SourceData
* @property {boolean=} iife

@@ -123,2 +123,3 @@ * @property {string=} init

* @param {string} importMetaName import.meta name
* @param {boolean} needPrefix need to use `node:` prefix for `module` import
* @returns {SourceData} the generated source

@@ -128,7 +129,10 @@ */

moduleAndSpecifiers,
importMetaName
importMetaName,
needPrefix
) => {
const chunkInitFragments = [
new InitFragment(
'import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";\n',
`import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "${
needPrefix ? "node:" : ""
}module";\n`,
InitFragment.STAGE_HARMONY_IMPORTS,

@@ -175,3 +179,8 @@ 0,

dependencyMeta && dependencyMeta.attributes
? `, ${JSON.stringify(dependencyMeta.attributes)}`
? dependencyMeta.attributes._isLegacyAssert
? `, { assert: ${JSON.stringify(
dependencyMeta.attributes,
importAssertionReplacer
)} }`
: `, { with: ${JSON.stringify(dependencyMeta.attributes)} }`
: "";

@@ -204,2 +213,15 @@ if (!Array.isArray(moduleAndSpecifiers)) {

/**
* @param {string} key key
* @param {any | undefined} value value
* @returns {undefined | string} replaced value
*/
const importAssertionReplacer = (key, value) => {
if (key === "_isLegacyAssert") {
return undefined;
}
return value;
};
/**
* @extends {InitFragment<ChunkRenderContext>}

@@ -228,3 +250,8 @@ */

dependencyMeta && dependencyMeta.attributes
? ` assert ${JSON.stringify(dependencyMeta.attributes)}`
? dependencyMeta.attributes._isLegacyAssert
? ` assert ${JSON.stringify(
dependencyMeta.attributes,
importAssertionReplacer
)}`
: ` with ${JSON.stringify(dependencyMeta.attributes)}`
: ""

@@ -340,9 +367,11 @@ };\n`,

expression,
init: `var x = ${runtimeTemplate.basicFunction(
"y",
`var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x`
)} \nvar y = ${runtimeTemplate.returningFunction(
runtimeTemplate.returningFunction("x"),
"x"
)}`,
init: moduleRemapping
? `var x = ${runtimeTemplate.basicFunction(
"y",
`var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x`
)} \nvar y = ${runtimeTemplate.returningFunction(
runtimeTemplate.returningFunction("x"),
"x"
)}`
: undefined,
runtimeRequirements: moduleRemapping

@@ -454,5 +483,7 @@ ? RUNTIME_REQUIREMENTS_FOR_MODULE

/** @typedef {Record<string, string | string[]>} RequestRecord */
class ExternalModule extends Module {
/**
* @param {string | string[] | Record<string, string | string[]>} request request
* @param {string | string[] | RequestRecord} request request
* @param {string} type type

@@ -682,5 +713,5 @@ * @param {string} userRequest user request

request,
/** @type {string} */ (
runtimeTemplate.outputOptions.importMetaName
)
/** @type {string} */
(runtimeTemplate.outputOptions.importMetaName),
runtimeTemplate.supportNodePrefixForCoreModules()
)

@@ -687,0 +718,0 @@ : getSourceForCommonJsExternal(request);

@@ -18,2 +18,3 @@ /*

/** @typedef {import("./Module")} Module */
/** @typedef {import("./Module").BuildInfo} BuildInfo */

@@ -67,3 +68,6 @@ const PLUGIN_NAME = "FlagDependencyExportsPlugin";

// If the module has no hash, it's uncacheable
if (typeof module.buildInfo.hash !== "string") {
if (
typeof (/** @type {BuildInfo} */ (module.buildInfo).hash) !==
"string"
) {
statFlaggedUncached++;

@@ -84,3 +88,4 @@ // Enqueue uncacheable module for determining the exports

module.identifier(),
module.buildInfo.hash,
/** @type {BuildInfo} */
(module.buildInfo).hash,
(err, result) => {

@@ -240,3 +245,6 @@ if (err) return callback(err);

exportInfo.createNestedExportsInfo();
mergeExports(nestedExportsInfo, exports);
mergeExports(
/** @type {ExportsInfo} */ (nestedExportsInfo),
exports
);
}

@@ -279,3 +287,4 @@

if (
exportInfo.exportsInfo.setRedirectNamedTo(
/** @type {ExportsInfo} */
(exportInfo.exportsInfo).setRedirectNamedTo(
targetExportsInfo

@@ -320,3 +329,3 @@ )

while (queue.length > 0) {
module = queue.dequeue();
module = /** @type {Module} */ (queue.dequeue());

@@ -365,3 +374,7 @@ statQueueItemsProcessed++;

(module, callback) => {
if (typeof module.buildInfo.hash !== "string") {
if (
typeof (
/** @type {BuildInfo} */ (module.buildInfo).hash
) !== "string"
) {
// not cacheable

@@ -380,3 +393,4 @@ return callback();

module.identifier(),
module.buildInfo.hash,
/** @type {BuildInfo} */
(module.buildInfo).hash,
cachedData,

@@ -383,0 +397,0 @@ callback

@@ -24,3 +24,3 @@ /*

/**
* @typedef {Object} GenerateContext
* @typedef {object} GenerateContext
* @property {DependencyTemplates} dependencyTemplates mapping from dependencies to templates

@@ -32,3 +32,2 @@ * @property {RuntimeTemplate} runtimeTemplate the runtime template

* @property {RuntimeSpec} runtime the runtime
* @property {RuntimeSpec[]} [runtimes] the runtimes
* @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules

@@ -41,3 +40,3 @@ * @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that)

/**
* @typedef {Object} UpdateHashContext
* @typedef {object} UpdateHashContext
* @property {NormalModule} module the module

@@ -44,0 +43,0 @@ * @property {ChunkGraph} chunkGraph

@@ -41,3 +41,3 @@ /*

/**
* @typedef {Object} BackendApi
* @typedef {object} BackendApi
* @property {function(Error=): void} dispose

@@ -323,3 +323,3 @@ * @property {function(Module): { client: string, data: string, active: boolean }} module

/**
* @param {Object} options options
* @param {object} options options
* @param {(function(Compiler, function(Error?, BackendApi?): void): void) | function(Compiler): Promise<BackendApi>} options.backend the backend

@@ -326,0 +326,0 @@ * @param {boolean} options.entries true, when entries are lazy compiled

@@ -45,11 +45,18 @@ /*

/** @typedef {import("estree").CallExpression} CallExpression */
/** @typedef {import("estree").Expression} Expression */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Chunk").ChunkId} ChunkId */
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./RuntimeModule")} RuntimeModule */
/** @typedef {import("./javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
/** @typedef {import("./javascript/JavascriptParserHelpers").Range} Range */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/**
* @typedef {Object} HMRJavascriptParserHooks
* @typedef {object} HMRJavascriptParserHooks
* @property {SyncBailHook<[TODO, string[]], void>} hotAcceptCallback

@@ -59,2 +66,4 @@ * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptWithoutCallback

/** @typedef {Map<string, { updatedChunkIds: Set<ChunkId>, removedChunkIds: Set<ChunkId>, removedModules: Set<Module>, filename: string, assetInfo: AssetInfo }>} HotUpdateMainContentByRuntime */
/** @type {WeakMap<JavascriptParser, HMRJavascriptParserHooks>} */

@@ -87,2 +96,5 @@ const parserHooksMap = new WeakMap();

/**
* @param {object=} options options
*/
constructor(options) {

@@ -103,2 +115,7 @@ this.options = options || {};

/**
* @param {JavascriptParser} parser the parser
* @param {typeof ModuleHotAcceptDependency} ParamDependency dependency
* @returns {(expr: CallExpression) => boolean | undefined} callback
*/
const createAcceptHandler = (parser, ParamDependency) => {

@@ -112,23 +129,34 @@ const { hotAcceptCallback, hotAcceptWithoutCallback } =

`${module.moduleArgument}.hot.accept`,
expr.callee.range,
/** @type {Range} */ (expr.callee.range),
runtimeRequirements
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
module.addPresentationalDependency(dep);
module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement";
/** @type {BuildInfo} */
(module.buildInfo).moduleConcatenationBailout =
"Hot Module Replacement";
if (expr.arguments.length >= 1) {
const arg = parser.evaluateExpression(expr.arguments[0]);
/** @type {BasicEvaluatedExpression[]} */
let params = [];
let requests = [];
if (arg.isString()) {
params = [arg];
} else if (arg.isArray()) {
params = arg.items.filter(param => param.isString());
params =
/** @type {BasicEvaluatedExpression[]} */
(arg.items).filter(param => param.isString());
}
/** @type {string[]} */
let requests = [];
if (params.length > 0) {
params.forEach((param, idx) => {
const request = param.string;
const dep = new ParamDependency(request, param.range);
const request = /** @type {string} */ (param.string);
const dep = new ParamDependency(
request,
/** @type {Range} */ (param.range)
);
dep.optional = true;
dep.loc = Object.create(expr.loc);
dep.loc = Object.create(
/** @type {DependencyLocation} */ (expr.loc)
);
dep.loc.index = idx;

@@ -155,2 +183,7 @@ module.addDependency(dep);

/**
* @param {JavascriptParser} parser the parser
* @param {typeof ModuleHotDeclineDependency} ParamDependency dependency
* @returns {(expr: CallExpression) => boolean | undefined} callback
*/
const createDeclineHandler = (parser, ParamDependency) => expr => {

@@ -160,10 +193,12 @@ const module = parser.state.module;

`${module.moduleArgument}.hot.decline`,
expr.callee.range,
/** @type {Range} */ (expr.callee.range),
runtimeRequirements
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
module.addPresentationalDependency(dep);
module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement";
/** @type {BuildInfo} */
(module.buildInfo).moduleConcatenationBailout = "Hot Module Replacement";
if (expr.arguments.length === 1) {
const arg = parser.evaluateExpression(expr.arguments[0]);
/** @type {BasicEvaluatedExpression[]} */
let params = [];

@@ -173,8 +208,13 @@ if (arg.isString()) {

} else if (arg.isArray()) {
params = arg.items.filter(param => param.isString());
params =
/** @type {BasicEvaluatedExpression[]} */
(arg.items).filter(param => param.isString());
}
params.forEach((param, idx) => {
const dep = new ParamDependency(param.string, param.range);
const dep = new ParamDependency(
/** @type {string} */ (param.string),
/** @type {Range} */ (param.range)
);
dep.optional = true;
dep.loc = Object.create(expr.loc);
dep.loc = Object.create(/** @type {DependencyLocation} */ (expr.loc));
dep.loc.index = idx;

@@ -187,2 +227,6 @@ module.addDependency(dep);

/**
* @param {JavascriptParser} parser the parser
* @returns {(expr: Expression) => boolean | undefined} callback
*/
const createHMRExpressionHandler = parser => expr => {

@@ -192,8 +236,9 @@ const module = parser.state.module;

`${module.moduleArgument}.hot`,
expr.range,
/** @type {Range} */ (expr.range),
runtimeRequirements
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
module.addPresentationalDependency(dep);
module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement";
/** @type {BuildInfo} */
(module.buildInfo).moduleConcatenationBailout = "Hot Module Replacement";
return true;

@@ -316,3 +361,5 @@ };

let hotIndex = 0;
/** @type {Record<string, string>} */
const fullHashChunkModuleHashes = {};
/** @type {Record<string, string>} */
const chunkModuleHashes = {};

@@ -330,14 +377,16 @@

for (const chunk of compilation.chunks) {
records.chunkHashes[chunk.id] = chunk.hash;
records.chunkRuntime[chunk.id] = getRuntimeKey(chunk.runtime);
const chunkId = /** @type {ChunkId} */ (chunk.id);
records.chunkHashes[chunkId] = chunk.hash;
records.chunkRuntime[chunkId] = getRuntimeKey(chunk.runtime);
}
records.chunkModuleIds = {};
for (const chunk of compilation.chunks) {
records.chunkModuleIds[chunk.id] = Array.from(
chunkGraph.getOrderedChunkModulesIterable(
chunk,
compareModulesById(chunkGraph)
),
m => chunkGraph.getModuleId(m)
);
records.chunkModuleIds[/** @type {ChunkId} */ (chunk.id)] =
Array.from(
chunkGraph.getOrderedChunkModulesIterable(
chunk,
compareModulesById(chunkGraph)
),
m => chunkGraph.getModuleId(m)
);
}

@@ -355,2 +404,6 @@ });

for (const chunk of compilation.chunks) {
/**
* @param {Module} module module
* @returns {string} module hash
*/
const getModuleHash = module => {

@@ -470,3 +523,3 @@ if (

/** @type {Map<string, { updatedChunkIds: Set<string|number>, removedChunkIds: Set<string|number>, removedModules: Set<Module>, filename: string, assetInfo: AssetInfo }>} */
/** @type {HotUpdateMainContentByRuntime} */
const hotUpdateMainContentByRuntime = new Map();

@@ -487,9 +540,12 @@ let allOldRuntime;

);
hotUpdateMainContentByRuntime.set(runtime, {
updatedChunkIds: new Set(),
removedChunkIds: new Set(),
removedModules: new Set(),
filename,
assetInfo
});
hotUpdateMainContentByRuntime.set(
/** @type {string} */ (runtime),
{
updatedChunkIds: new Set(),
removedChunkIds: new Set(),
removedModules: new Set(),
filename,
assetInfo
}
);
});

@@ -524,2 +580,3 @@ if (hotUpdateMainContentByRuntime.size === 0) return;

/** @type {ChunkId | null} */
let chunkId;

@@ -573,5 +630,6 @@ let newModules;

forEachRuntime(removedFromRuntime, runtime => {
hotUpdateMainContentByRuntime
.get(runtime)
.removedChunkIds.add(chunkId);
const item = hotUpdateMainContentByRuntime.get(
/** @type {string} */ (runtime)
);
item.removedChunkIds.add(/** @type {ChunkId} */ (chunkId));
});

@@ -617,8 +675,12 @@ // dispose modules from the chunk in these runtimes

} else if (moduleRuntime !== undefined) {
if (moduleRuntime.has(runtime)) return;
if (
moduleRuntime.has(/** @type {string} */ (runtime))
)
return;
}
}
hotUpdateMainContentByRuntime
.get(runtime)
.removedModules.add(module);
const item = hotUpdateMainContentByRuntime.get(
/** @type {string} */ (runtime)
);
item.removedModules.add(module);
});

@@ -697,5 +759,6 @@ }

forEachRuntime(newRuntime, runtime => {
hotUpdateMainContentByRuntime
.get(runtime)
.updatedChunkIds.add(chunkId);
const item = hotUpdateMainContentByRuntime.get(
/** @type {string} */ (runtime)
);
item.updatedChunkIds.add(/** @type {ChunkId} */ (chunkId));
});

@@ -702,0 +765,0 @@ }

@@ -17,3 +17,3 @@ /*

/**
* @typedef {Object} ChunkModuleIdRangePluginOptions
* @typedef {object} ChunkModuleIdRangePluginOptions
* @property {string} name the chunk name

@@ -20,0 +20,0 @@ * @property {("index" | "index2" | "preOrderIndex" | "postOrderIndex")=} order order

@@ -19,3 +19,3 @@ /*

/**
* @typedef {Object} DeterministicChunkIdsPluginOptions
* @typedef {object} DeterministicChunkIdsPluginOptions
* @property {string=} context context for ids

@@ -22,0 +22,0 @@ * @property {number=} maxLength maximum length of ids

@@ -21,3 +21,3 @@ /*

/**
* @typedef {Object} DeterministicModuleIdsPluginOptions
* @typedef {object} DeterministicModuleIdsPluginOptions
* @property {string=} context context relative to which module identifiers are computed

@@ -24,0 +24,0 @@ * @property {function(Module): boolean=} test selector function for modules

@@ -81,3 +81,3 @@ /*

* @param {string} context context directory
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} short module name

@@ -102,3 +102,3 @@ */

* @param {string | Hash} hashFunction hash function to use
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} long module name

@@ -121,3 +121,3 @@ */

* @param {string} context context directory
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} full module name

@@ -140,3 +140,3 @@ */

* @param {string | Hash} hashFunction hash function to use
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} short chunk name

@@ -171,3 +171,3 @@ */

* @param {string | Hash} hashFunction hash function to use
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} short chunk name

@@ -205,3 +205,3 @@ */

* @param {string} context context directory
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} full chunk name

@@ -208,0 +208,0 @@ */

@@ -23,3 +23,3 @@ /*

/**
* @typedef {Object} NamedChunkIdsPluginOptions
* @typedef {object} NamedChunkIdsPluginOptions
* @property {string} [context] context

@@ -26,0 +26,0 @@ * @property {string} [delimiter] delimiter

@@ -22,3 +22,3 @@ /*

/**
* @typedef {Object} NamedModuleIdsPluginOptions
* @typedef {object} NamedModuleIdsPluginOptions
* @property {string} [context] context

@@ -25,0 +25,0 @@ */

@@ -18,3 +18,3 @@ /*

/**
* @param {Object} options options
* @param {object} options options
* @param {string} options.path path to file

@@ -67,3 +67,3 @@ * @param {string=} options.context context for module names

if (!data || !dataChanged) return callback();
/** @type {Object<string, string | number>} */
/** @type {{[key: string]: string | number}} */
const json = {};

@@ -70,0 +70,0 @@ const sorted = Array.from(data).sort(([a], [b]) => (a < b ? -1 : 1));

@@ -31,3 +31,6 @@ /*

/** @private @type {Function} */
/**
* @private
* @type {Function}
*/
this.checkIgnore = this.checkIgnore.bind(this);

@@ -34,0 +37,0 @@ }

@@ -63,2 +63,4 @@ /*

/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsProfile} StatsProfile */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */

@@ -225,2 +227,5 @@ /**

},
get InitFragment() {
return require("./InitFragment");
},
get IgnorePlugin() {

@@ -282,2 +287,5 @@ return require("./IgnorePlugin");

},
get PlatformPlugin() {
return require("./PlatformPlugin");
},
get PrefetchPlugin() {

@@ -582,2 +590,5 @@ return require("./PrefetchPlugin");

return require("./util/LazySet");
},
get compileBooleanMatcher() {
return require("./util/compileBooleanMatcher");
}

@@ -584,0 +595,0 @@ },

@@ -35,3 +35,3 @@ /*

compilation.hooks.additionalChunkRuntimeRequirements.tap(
"CommonJsChunkLoadingPlugin",
"CommonJsChunkFormatPlugin",
(chunk, set, { chunkGraph }) => {

@@ -38,0 +38,0 @@ if (chunk.hasRuntime()) return;

@@ -202,3 +202,2 @@ /*

runtime: generateContext.runtime,
runtimes: generateContext.runtimes,
runtimeRequirements: generateContext.runtimeRequirements,

@@ -205,0 +204,0 @@ concatenationScope: generateContext.concatenationScope,

@@ -8,2 +8,3 @@ /*

const eslintScope = require("eslint-scope");
const { SyncWaterfallHook, SyncHook, SyncBailHook } = require("tapable");

@@ -16,3 +17,4 @@ const vm = require("vm");

RawSource,
CachedSource
CachedSource,
ReplaceSource
} = require("webpack-sources");

@@ -35,2 +37,3 @@ const Compilation = require("../Compilation");

const createHash = require("../util/createHash");
const { getPathInAst, getAllReferences } = require("../util/mergeScope");
const nonNumericOnlyHash = require("../util/nonNumericOnlyHash");

@@ -41,2 +44,3 @@ const { intersectRuntime } = require("../util/runtime");

/** @typedef {import("eslint-scope").Variable} Variable */
/** @typedef {import("webpack-sources").Source} Source */

@@ -92,3 +96,3 @@ /** @typedef {import("../Chunk")} Chunk */

/**
* @typedef {Object} RenderContext
* @typedef {object} RenderContext
* @property {Chunk} chunk the chunk

@@ -104,3 +108,3 @@ * @property {DependencyTemplates} dependencyTemplates the dependency templates

/**
* @typedef {Object} MainRenderContext
* @typedef {object} MainRenderContext
* @property {Chunk} chunk the chunk

@@ -117,3 +121,3 @@ * @property {DependencyTemplates} dependencyTemplates the dependency templates

/**
* @typedef {Object} ChunkRenderContext
* @typedef {object} ChunkRenderContext
* @property {Chunk} chunk the chunk

@@ -130,3 +134,3 @@ * @property {DependencyTemplates} dependencyTemplates the dependency templates

/**
* @typedef {Object} RenderBootstrapContext
* @typedef {object} RenderBootstrapContext
* @property {Chunk} chunk the chunk

@@ -143,3 +147,3 @@ * @property {CodeGenerationResults} codeGenerationResults results of code generation

/**
* @typedef {Object} CompilationHooks
* @typedef {object} CompilationHooks
* @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContent

@@ -830,9 +834,15 @@ * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContainer

startupSource.add(`var ${RuntimeGlobals.exports} = {};\n`);
const renamedInlinedModule = this.renameInlineModule(
allModules,
renderContext,
inlinedModules,
chunkRenderContext,
hooks
);
for (const m of inlinedModules) {
const renderedModule = this.renderModule(
m,
chunkRenderContext,
hooks,
false
);
const renderedModule =
renamedInlinedModule.get(m) ||
this.renderModule(m, chunkRenderContext, hooks, false);
if (renderedModule) {

@@ -853,7 +863,5 @@ const innerStrict = !allStrict && m.buildInfo.strict;

"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);
: exports && !webpackExports
? `it uses a non-standard name for the exports (${m.exportsArgument}).`
: hooks.embedInRuntimeBailout.call(m, renderContext);
let footer;

@@ -1397,2 +1405,151 @@ if (iife !== undefined) {

}
/**
* @param {Module[]} allModules allModules
* @param {MainRenderContext} renderContext renderContext
* @param {Set<Module>} inlinedModules inlinedModules
* @param {ChunkRenderContext} chunkRenderContext chunkRenderContext
* @param {CompilationHooks} hooks hooks
* @returns {Map<Module, Source>} renamed inlined modules
*/
renameInlineModule(
allModules,
renderContext,
inlinedModules,
chunkRenderContext,
hooks
) {
const { runtimeTemplate } = renderContext;
/** @type {Map<Module, { source: Source, ast: any, variables: Set<Variable>, usedInNonInlined: Set<Variable>}>} */
const inlinedModulesToInfo = new Map();
/** @type {Set<string>} */
const nonInlinedModuleThroughIdentifiers = new Set();
/** @type {Map<Module, Source>} */
const renamedInlinedModules = new Map();
for (const m of allModules) {
const isInlinedModule = inlinedModules && inlinedModules.has(m);
const moduleSource = this.renderModule(
m,
chunkRenderContext,
hooks,
isInlinedModule ? false : true
);
if (!moduleSource) continue;
const code = /** @type {string} */ (moduleSource.source());
const ast = JavascriptParser._parse(code, {
sourceType: "auto"
});
const scopeManager = eslintScope.analyze(ast, {
ecmaVersion: 6,
sourceType: "module",
optimistic: true,
ignoreEval: true
});
const globalScope = scopeManager.acquire(ast);
if (inlinedModules && inlinedModules.has(m)) {
const moduleScope = globalScope.childScopes[0];
inlinedModulesToInfo.set(m, {
source: moduleSource,
ast,
variables: new Set(moduleScope.variables),
usedInNonInlined: new Set()
});
} else {
for (const ref of globalScope.through) {
nonInlinedModuleThroughIdentifiers.add(ref.identifier.name);
}
}
}
for (const [, { variables, usedInNonInlined }] of inlinedModulesToInfo) {
for (const variable of variables) {
if (nonInlinedModuleThroughIdentifiers.has(variable.name)) {
usedInNonInlined.add(variable);
}
}
}
for (const [m, moduleInfo] of inlinedModulesToInfo) {
const { ast, source: _source, usedInNonInlined } = moduleInfo;
const source = new ReplaceSource(_source);
if (usedInNonInlined.size === 0) {
renamedInlinedModules.set(m, source);
continue;
}
const usedNames = new Set(
Array.from(inlinedModulesToInfo.get(m).variables).map(v => v.name)
);
for (const variable of usedInNonInlined) {
const references = getAllReferences(variable);
const allIdentifiers = new Set(
references.map(r => r.identifier).concat(variable.identifiers)
);
const newName = this.findNewName(
variable.name,
usedNames,
m.readableIdentifier(runtimeTemplate.requestShortener)
);
usedNames.add(newName);
for (const identifier of allIdentifiers) {
const r = identifier.range;
const path = getPathInAst(ast, identifier);
if (path && path.length > 1) {
const maybeProperty =
path[1].type === "AssignmentPattern" && path[1].left === path[0]
? path[2]
: path[1];
if (maybeProperty.type === "Property" && maybeProperty.shorthand) {
source.insert(r[1], `: ${newName}`);
continue;
}
}
source.replace(r[0], r[1] - 1, newName);
}
}
renamedInlinedModules.set(m, source);
}
return renamedInlinedModules;
}
/**
* @param {string} oldName oldName
* @param {Set<string>} usedName usedName
* @param {string} extraInfo extraInfo
* @returns {string} extraInfo
*/
findNewName(oldName, usedName, extraInfo) {
let name = oldName;
// Remove uncool stuff
extraInfo = extraInfo.replace(
/\.+\/|(\/index)?\.([a-zA-Z0-9]{1,4})($|\s|\?)|\s*\+\s*\d+\s*modules/g,
""
);
const splittedInfo = extraInfo.split("/");
while (splittedInfo.length) {
name = splittedInfo.pop() + (name ? "_" + name : "");
const nameIdent = Template.toIdentifier(name);
if (!usedName.has(nameIdent)) {
return nameIdent;
}
}
let i = 0;
let nameWithNumber = Template.toIdentifier(`${name}_${i}`);
while (usedName.has(nameWithNumber)) {
i++;
nameWithNumber = Template.toIdentifier(`${name}_${i}`);
}
return nameWithNumber;
}
}

@@ -1399,0 +1556,0 @@

@@ -19,3 +19,3 @@ /*

/**
* @typedef {Object} ManifestModuleData
* @typedef {object} ManifestModuleData
* @property {string | number} id

@@ -27,3 +27,3 @@ * @property {BuildMeta} buildMeta

/**
* @typedef {Object} LibManifestPluginOptions
* @typedef {object} LibManifestPluginOptions
* @property {string=} context Context of requests in the manifest file (defaults to the webpack context).

@@ -30,0 +30,0 @@ * @property {boolean=} entryOnly If true, only entry points will be exposed (default: true).

@@ -29,3 +29,3 @@ /*

* @template T
* @typedef {Object} LibraryContext
* @typedef {object} LibraryContext
* @property {Compilation} compilation

@@ -41,3 +41,3 @@ * @property {ChunkGraph} chunkGraph

/**
* @param {Object} options options
* @param {object} options options
* @param {string} options.pluginName name of the plugin

@@ -44,0 +44,0 @@ * @param {LibraryType} options.type used library type

@@ -24,3 +24,3 @@ /*

/**
* @typedef {Object} AmdLibraryPluginOptions
* @typedef {object} AmdLibraryPluginOptions
* @property {LibraryType} type

@@ -31,3 +31,3 @@ * @property {boolean=} requireAsWrapper

/**
* @typedef {Object} AmdLibraryPluginParsed
* @typedef {object} AmdLibraryPluginParsed
* @property {string} name

@@ -34,0 +34,0 @@ * @property {string} amdContainer

@@ -94,3 +94,3 @@ /*

/**
* @typedef {Object} AssignLibraryPluginOptions
* @typedef {object} AssignLibraryPluginOptions
* @property {LibraryType} type

@@ -104,3 +104,3 @@ * @property {string[] | "global"} prefix name prefix

/**
* @typedef {Object} AssignLibraryPluginParsed
* @typedef {object} AssignLibraryPluginParsed
* @property {string | string[]} name

@@ -328,3 +328,3 @@ * @property {string | string[] | undefined} export

);
/** @type {String} */
/** @type {string} */
let exports = RuntimeGlobals.exports;

@@ -331,0 +331,0 @@ if (exportAccess) {

@@ -25,3 +25,3 @@ /*

/**
* @typedef {Object} ExportPropertyLibraryPluginParsed
* @typedef {object} ExportPropertyLibraryPluginParsed
* @property {string | string[]} export

@@ -31,3 +31,3 @@ */

/**
* @typedef {Object} ExportPropertyLibraryPluginOptions
* @typedef {object} ExportPropertyLibraryPluginOptions
* @property {LibraryType} type

@@ -34,0 +34,0 @@ * @property {boolean} nsObjectUsed the namespace object is used

@@ -22,3 +22,3 @@ /*

/**
* @typedef {Object} JsonpLibraryPluginOptions
* @typedef {object} JsonpLibraryPluginOptions
* @property {LibraryType} type

@@ -28,3 +28,3 @@ */

/**
* @typedef {Object} JsonpLibraryPluginParsed
* @typedef {object} JsonpLibraryPluginParsed
* @property {string} name

@@ -31,0 +31,0 @@ */

@@ -26,3 +26,3 @@ /*

/**
* @typedef {Object} ModuleLibraryPluginOptions
* @typedef {object} ModuleLibraryPluginOptions
* @property {LibraryType} type

@@ -32,3 +32,3 @@ */

/**
* @typedef {Object} ModuleLibraryPluginParsed
* @typedef {object} ModuleLibraryPluginParsed
* @property {string} name

@@ -35,0 +35,0 @@ */

@@ -26,3 +26,3 @@ /*

/**
* @typedef {Object} SystemLibraryPluginOptions
* @typedef {object} SystemLibraryPluginOptions
* @property {LibraryType} type

@@ -32,3 +32,3 @@ */

/**
* @typedef {Object} SystemLibraryPluginParsed
* @typedef {object} SystemLibraryPluginParsed
* @property {string} name

@@ -35,0 +35,0 @@ */

@@ -21,4 +21,9 @@ /*

/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
/** @typedef {import("../ExternalModule").RequestRecord} RequestRecord */
/** @typedef {import("../util/Hash")} Hash */
/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T> */
/**
* @template T
* @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>}
* LibraryContext<T>
*/

@@ -57,3 +62,3 @@ /**

/**
* @typedef {Object} UmdLibraryPluginOptions
* @typedef {object} UmdLibraryPluginOptions
* @property {LibraryType} type

@@ -64,3 +69,3 @@ * @property {boolean=} optionalAmdExternalAsGlobal

/**
* @typedef {Object} UmdLibraryPluginParsed
* @typedef {object} UmdLibraryPluginParsed
* @property {string | string[]} name

@@ -164,2 +169,6 @@ * @property {LibraryCustomUmdObject} names

/**
* @param {ExternalModule[]} modules external modules
* @returns {string} result
*/
const externalsDepsArray = modules => {

@@ -170,3 +179,6 @@ return `[${replaceKeys(

JSON.stringify(
typeof m.request === "object" ? m.request.amd : m.request
typeof m.request === "object"
? /** @type {RequestRecord} */
(m.request).amd
: m.request
)

@@ -178,2 +190,6 @@ )

/**
* @param {ExternalModule[]} modules external modules
* @returns {string} result
*/
const externalsRootArray = modules => {

@@ -184,3 +200,6 @@ return replaceKeys(

let request = m.request;
if (typeof request === "object") request = request.root;
if (typeof request === "object")
request =
/** @type {RequestRecord} */
(request).root;
return `root${accessorToObjectAccess([].concat(request))}`;

@@ -204,3 +223,3 @@ })

request =
/** @type {Record<string, string | string[]>} */
/** @type {RequestRecord} */
(request)[type];

@@ -244,4 +263,10 @@ }

/**
* @param {string| string[]} library library name
* @returns {string} stringified library name
*/
const libraryName = library => {
return JSON.stringify(replaceKeys([].concat(library).pop()));
return JSON.stringify(
replaceKeys(/** @type {string[]} */ ([]).concat(library).pop())
);
};

@@ -325,7 +350,3 @@

replaceKeys(
accessorAccess(
"root",
/** @type {string | string[]} */ (names.root) ||
/** @type {string} */ (names.commonjs)
)
accessorAccess("root", names.root || names.commonjs)
) +

@@ -332,0 +353,0 @@ " = factory(" +

@@ -18,3 +18,3 @@ /*

/**
* @typedef {Object} LoggerConsole
* @typedef {object} LoggerConsole
* @property {function(): void} clear

@@ -37,3 +37,3 @@ * @property {function(): void} trace

/**
* @typedef {Object} LoggerOptions
* @typedef {object} LoggerOptions
* @property {false|true|"none"|"error"|"warn"|"info"|"log"|"verbose"} level loglevel

@@ -40,0 +40,0 @@ * @property {FilterTypes|boolean} debug filter for debug logging

@@ -48,3 +48,3 @@ /*

/**
* @typedef {Object} SourceContext
* @typedef {object} SourceContext
* @property {DependencyTemplates} dependencyTemplates the dependency templates

@@ -60,3 +60,3 @@ * @property {RuntimeTemplate} runtimeTemplate the runtime template

/**
* @typedef {Object} CodeGenerationContext
* @typedef {object} CodeGenerationContext
* @property {DependencyTemplates} dependencyTemplates the dependency templates

@@ -66,4 +66,3 @@ * @property {RuntimeTemplate} runtimeTemplate the runtime template

* @property {ChunkGraph} chunkGraph the chunk graph
* @property {RuntimeSpec} runtime the runtime code should be generated for
* @property {RuntimeSpec[]} [runtimes] the runtimes code should be generated for
* @property {RuntimeSpec} runtime the runtimes code should be generated for
* @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules

@@ -76,3 +75,3 @@ * @property {CodeGenerationResults | undefined} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that)

/**
* @typedef {Object} ConcatenationBailoutReasonContext
* @typedef {object} ConcatenationBailoutReasonContext
* @property {ModuleGraph} moduleGraph the module graph

@@ -86,3 +85,3 @@ * @property {ChunkGraph} chunkGraph the chunk graph

/**
* @typedef {Object} CodeGenerationResult
* @typedef {object} CodeGenerationResult
* @property {Map<string, Source>} sources the resulting sources for all source types

@@ -95,9 +94,9 @@ * @property {Map<string, any>=} data the resulting data for all source types

/**
* @typedef {Object} LibIdentOptions
* @typedef {object} LibIdentOptions
* @property {string} context absolute context path to which lib ident is relative to
* @property {Object=} associatedObjectForCache object for caching
* @property {object=} associatedObjectForCache object for caching
*/
/**
* @typedef {Object} KnownBuildMeta
* @typedef {object} KnownBuildMeta
* @property {string=} moduleArgument

@@ -115,3 +114,3 @@ * @property {string=} exportsArgument

/**
* @typedef {Object} KnownBuildInfo
* @typedef {object} KnownBuildInfo
* @property {boolean=} cacheable

@@ -131,3 +130,3 @@ * @property {boolean=} parsed

/**
* @typedef {Object} NeedBuildContext
* @typedef {object} NeedBuildContext
* @property {Compilation} compilation

@@ -142,3 +141,3 @@ * @property {FileSystemInfo} fileSystemInfo

/**
* @typedef {Object} FactoryMeta
* @typedef {object} FactoryMeta
* @property {boolean=} sideEffectFree

@@ -145,0 +144,0 @@ */

@@ -13,3 +13,3 @@ /*

/**
* @typedef {Object} ModuleFactoryResult
* @typedef {object} ModuleFactoryResult
* @property {Module=} module the created module or unset if no module was created

@@ -23,3 +23,3 @@ * @property {Set<string>=} fileDependencies

/**
* @typedef {Object} ModuleFactoryCreateDataContextInfo
* @typedef {object} ModuleFactoryCreateDataContextInfo
* @property {string} issuer

@@ -31,3 +31,3 @@ * @property {string | null=} issuerLayer

/**
* @typedef {Object} ModuleFactoryCreateData
* @typedef {object} ModuleFactoryCreateData
* @property {ModuleFactoryCreateDataContextInfo} contextInfo

@@ -34,0 +34,0 @@ * @property {ResolveOptions=} resolveOptions

@@ -49,7 +49,9 @@ /*

/** @typedef {() => string} ReturnStringCallback */
/**
* Returns a function that returns the part of the string after the token
* @param {() => string} strFn the function to get the string
* @param {ReturnStringCallback} strFn the function to get the string
* @param {string} token the token to search for
* @returns {() => string} a function that returns the part of the string after the token
* @returns {ReturnStringCallback} a function that returns the part of the string after the token
*/

@@ -66,5 +68,5 @@ const getAfter = (strFn, token) => {

* Returns a function that returns the part of the string before the token
* @param {() => string} strFn the function to get the string
* @param {ReturnStringCallback} strFn the function to get the string
* @param {string} token the token to search for
* @returns {() => string} a function that returns the part of the string before the token
* @returns {ReturnStringCallback} a function that returns the part of the string before the token
*/

@@ -81,7 +83,7 @@ const getBefore = (strFn, token) => {

* Returns a function that returns a hash of the string
* @param {() => string} strFn the function to get the string
* @param {string | Hash} hashFunction the hash function to use
* @returns {() => string} a function that returns the hash of the string
* @param {ReturnStringCallback} strFn the function to get the string
* @param {string | Hash=} hashFunction the hash function to use
* @returns {ReturnStringCallback} a function that returns the hash of the string
*/
const getHash = (strFn, hashFunction) => {
const getHash = (strFn, hashFunction = "md4") => {
return () => {

@@ -122,3 +124,3 @@ const hash = createHash(hashFunction);

* @param {Record<string, () => T>} obj the object to convert to a lazy access object
* @returns {Object} the lazy access object
* @returns {object} the lazy access object
*/

@@ -151,6 +153,6 @@ const lazyObject = obj => {

* @param {TODO} options options
* @param {Object} contextInfo context info
* @param {object} contextInfo context info
* @param {RequestShortener} contextInfo.requestShortener requestShortener
* @param {ChunkGraph} contextInfo.chunkGraph chunk graph
* @param {string | Hash} contextInfo.hashFunction the hash function to use
* @param {string | Hash=} contextInfo.hashFunction the hash function to use
* @returns {string} the filename

@@ -175,7 +177,12 @@ */

let hash;
/** @type {ReturnStringCallback} */
let identifier;
/** @type {ReturnStringCallback} */
let moduleId;
/** @type {ReturnStringCallback} */
let shortIdentifier;
if (typeof module === "string") {
shortIdentifier = memoize(() => requestShortener.shorten(module));
shortIdentifier =
/** @type {ReturnStringCallback} */
(memoize(() => requestShortener.shorten(module)));
identifier = shortIdentifier;

@@ -189,4 +196,8 @@ moduleId = () => "";

);
identifier = memoize(() => requestShortener.shorten(module.identifier()));
moduleId = () => chunkGraph.getModuleId(module);
identifier =
/** @type {ReturnStringCallback} */
(memoize(() => requestShortener.shorten(module.identifier())));
moduleId =
/** @type {ReturnStringCallback} */
(() => chunkGraph.getModuleId(module));
absoluteResourcePath = () =>

@@ -198,3 +209,5 @@ module instanceof NormalModule

}
const resource = memoize(() => shortIdentifier().split("!").pop());
const resource =
/** @type {ReturnStringCallback} */
(memoize(() => shortIdentifier().split("!").pop()));

@@ -260,3 +273,3 @@ const loaders = getBefore(shortIdentifier, "!");

// TODO webpack 6: consider removing weird double placeholders
return opts.moduleFilenameTemplate
return /** @type {string} */ (opts.moduleFilenameTemplate)
.replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, "[identifier]")

@@ -263,0 +276,0 @@ .replace(

@@ -135,3 +135,3 @@ /*

/**
* @type {WeakMap<any, Object>}
* @type {WeakMap<any, object>}
* @private

@@ -761,3 +761,3 @@ */

* @param {any} thing any thing
* @returns {Object} metadata
* @returns {object} metadata
*/

@@ -768,5 +768,5 @@ getMeta(thing) {

meta = Object.create(null);
this._metaMap.set(thing, /** @type {Object} */ (meta));
this._metaMap.set(thing, /** @type {object} */ (meta));
}
return /** @type {Object} */ (meta);
return /** @type {object} */ (meta);
}

@@ -776,3 +776,3 @@

* @param {any} thing any thing
* @returns {Object | undefined} metadata
* @returns {object | undefined} metadata
*/

@@ -779,0 +779,0 @@ getMetaIfExisting(thing) {

@@ -14,2 +14,3 @@ /*

const MultiWatching = require("./MultiWatching");
const WebpackError = require("./WebpackError");
const ArrayQueue = require("./util/ArrayQueue");

@@ -43,3 +44,3 @@

/**
* @typedef {Object} MultiCompilerOptions
* @typedef {object} MultiCompilerOptions
* @property {number=} parallelism how many Compilers are allows to run at the same time in parallel

@@ -114,4 +115,38 @@ */

}
this._validateCompilersOptions();
}
_validateCompilersOptions() {
if (this.compilers.length < 2) return;
/**
* @param {Compiler} compiler compiler
* @param {WebpackError} warning warning
*/
const addWarning = (compiler, warning) => {
compiler.hooks.thisCompilation.tap("MultiCompiler", compilation => {
compilation.warnings.push(warning);
});
};
const cacheNames = new Set();
for (const compiler of this.compilers) {
if (compiler.options.cache && "name" in compiler.options.cache) {
const name = compiler.options.cache.name;
if (cacheNames.has(name)) {
addWarning(
compiler,
new WebpackError(
`${
compiler.name
? `Compiler with name "${compiler.name}" doesn't use unique cache name. `
: ""
}Please set unique "cache.name" option. Name "${name}" already used.`
)
);
} else {
cacheNames.add(name);
}
}
}
}
get options() {

@@ -118,0 +153,0 @@ return Object.assign(

@@ -14,3 +14,4 @@ /*

/** @typedef {Object} CommonJsChunkLoadingPluginOptions
/**
* @typedef {object} CommonJsChunkLoadingPluginOptions
* @property {boolean} [asyncChunkLoading] enable async chunk loading

@@ -17,0 +18,0 @@ */

@@ -14,3 +14,3 @@ /*

/**
* @param {Object} options options
* @param {object} options options
* @param {boolean=} options.colors colors

@@ -17,0 +17,0 @@ * @param {boolean=} options.appendOnly append only

@@ -20,3 +20,3 @@ /*

/**
* @param {Object} options options
* @param {object} options options
* @param {InfrastructureLogging} options.infrastructureLogging infrastructure logging options

@@ -23,0 +23,0 @@ */

@@ -14,3 +14,3 @@ /*

/**
* @typedef {Object} NodeTemplatePluginOptions
* @typedef {object} NodeTemplatePluginOptions
* @property {boolean} [asyncChunkLoading] enable async chunk loading

@@ -17,0 +17,0 @@ */

@@ -17,3 +17,3 @@ /*

/**
* @typedef {Object} ReadFileCompileWasmPluginOptions
* @typedef {object} ReadFileCompileWasmPluginOptions
* @property {boolean} [mangleImports] mangle imports

@@ -20,0 +20,0 @@ */

@@ -92,3 +92,3 @@ /*

/**
* @typedef {Object} SourceMap
* @typedef {object} SourceMap
* @property {number} version

@@ -111,3 +111,3 @@ * @property {string[]} sources

/**
* @typedef {Object} LoaderItem
* @typedef {object} LoaderItem
* @property {string} loader

@@ -122,3 +122,3 @@ * @property {any} options

* @param {string} source a source path
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} new source path

@@ -138,3 +138,3 @@ */

* @param {SourceMap} sourceMap a source map
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {SourceMap} new source map

@@ -206,3 +206,3 @@ */

/**
* @typedef {Object} NormalModuleCompilationHooks
* @typedef {object} NormalModuleCompilationHooks
* @property {SyncHook<[object, NormalModule]>} loader

@@ -218,3 +218,3 @@ * @property {SyncHook<[LoaderItem[], NormalModule, object]>} beforeLoaders

/**
* @typedef {Object} NormalModuleCreateData
* @typedef {object} NormalModuleCreateData
* @property {string=} layer an optional layer in which the module is

@@ -353,3 +353,3 @@ * @property {JavaScriptModuleTypes | ""} type module type. When deserializing, this is set to an empty string "".

* @type {Map<string, number> | undefined}
**/
*/
this._sourceSizes = undefined;

@@ -359,3 +359,3 @@ /**

* @type {undefined | SourceTypes}
**/
*/
this._sourceTypes = undefined;

@@ -510,3 +510,3 @@

* @param {(string | SourceMap)=} sourceMap an optional source map
* @param {Object=} associatedObjectForCache object for caching
* @param {object=} associatedObjectForCache object for caching
* @returns {Source} the created source

@@ -788,3 +788,3 @@ */

* @param {(string | SourceMapSource)=} sourceMap an optional source map
* @param {Object=} associatedObjectForCache object for caching
* @param {object=} associatedObjectForCache object for caching
* @returns {Source} the created source

@@ -1340,3 +1340,2 @@ */

runtime,
runtimes,
concatenationScope,

@@ -1375,3 +1374,2 @@ codeGenerationResults,

runtime,
runtimes,
concatenationScope,

@@ -1378,0 +1376,0 @@ codeGenerationResults,

@@ -59,3 +59,3 @@ /*

/**
* @typedef {Object} ResolveData
* @typedef {object} ResolveData
* @property {ModuleFactoryCreateData["contextInfo"]} contextInfo

@@ -76,3 +76,3 @@ * @property {ModuleFactoryCreateData["resolveOptions"]} resolveOptions

/**
* @typedef {Object} ResourceData
* @typedef {object} ResourceData
* @property {string} resource

@@ -88,3 +88,3 @@ * @property {string=} path

/**
* @typedef {Object} ParsedLoaderRequest
* @typedef {object} ParsedLoaderRequest
* @property {string} loader loader

@@ -233,3 +233,12 @@ * @property {string|undefined} options options

new BasicMatcherRulePlugin("issuerLayer"),
new ObjectMatcherRulePlugin("assert", "assertions"),
new ObjectMatcherRulePlugin(
"assert",
"assertions",
value => value && /** @type {any} */ (value)._isLegacyAssert !== undefined
),
new ObjectMatcherRulePlugin(
"with",
"assertions",
value => value && !(/** @type {any} */ (value)._isLegacyAssert)
),
new ObjectMatcherRulePlugin("descriptionData"),

@@ -247,3 +256,3 @@ new BasicEffectRulePlugin("type"),

/**
* @param {Object} param params
* @param {object} param params
* @param {string=} param.context context

@@ -253,3 +262,3 @@ * @param {InputFileSystem} param.fs file system

* @param {ModuleOptions} param.options options
* @param {Object=} param.associatedObjectForCache an object to which the cache will be attached
* @param {object=} param.associatedObjectForCache an object to which the cache will be attached
* @param {boolean=} param.layers enable layers

@@ -317,5 +326,5 @@ */

this._globalGeneratorOptions = options.generator;
/** @type {Map<string, WeakMap<Object, Parser>>} */
/** @type {Map<string, WeakMap<object, Parser>>} */
this.parserCache = new Map();
/** @type {Map<string, WeakMap<Object, Generator>>} */
/** @type {Map<string, WeakMap<object, Generator>>} */
this.generatorCache = new Map();

@@ -322,0 +331,0 @@ /** @type {Set<Module>} */

@@ -14,3 +14,3 @@ /*

/**
* @typedef {Object} AggressiveMergingPluginOptions
* @typedef {object} AggressiveMergingPluginOptions
* @property {number=} minSizeReduce minimal size reduction to trigger merging

@@ -17,0 +17,0 @@ */

@@ -29,2 +29,3 @@ /*

const makeSerializable = require("../util/makeSerializable");
const { getAllReferences, getPathInAst } = require("../util/mergeScope");
const propertyAccess = require("../util/propertyAccess");

@@ -96,3 +97,3 @@ const { propertyName } = require("../util/propertyName");

/**
* @typedef {Object} ReexportInfo
* @typedef {object} ReexportInfo
* @property {Module} module

@@ -105,3 +106,3 @@ * @property {string[]} export

/**
* @typedef {Object} RawBinding
* @typedef {object} RawBinding
* @property {ModuleInfo} info

@@ -115,3 +116,3 @@ * @property {string} rawName

/**
* @typedef {Object} SymbolBinding
* @typedef {object} SymbolBinding
* @property {ConcatenatedModuleInfo} info

@@ -128,3 +129,3 @@ * @property {string} name

/**
* @typedef {Object} ConcatenatedModuleInfo
* @typedef {object} ConcatenatedModuleInfo
* @property {"concatenated"} type

@@ -154,3 +155,3 @@ * @property {Module} module

/**
* @typedef {Object} ExternalModuleInfo
* @typedef {object} ExternalModuleInfo
* @property {"external"} type

@@ -170,3 +171,3 @@ * @property {Module} module

/**
* @typedef {Object} ReferenceToModuleInfo
* @typedef {object} ReferenceToModuleInfo
* @property {"reference"} type

@@ -264,3 +265,3 @@ * @property {RuntimeSpec | boolean} runtimeCondition

/**
* @typedef {Object} ConcatenationEntry
* @typedef {object} ConcatenationEntry
* @property {"concatenated" | "external"} type

@@ -636,68 +637,2 @@ * @property {Module} module

/**
* @param {Variable} variable variable
* @returns {Reference[]} references
*/
const getAllReferences = variable => {
let set = variable.references;
// Look for inner scope variables too (like in class Foo { t() { Foo } })
const identifiers = new Set(variable.identifiers);
for (const scope of variable.scope.childScopes) {
for (const innerVar of scope.variables) {
if (innerVar.identifiers.some(id => identifiers.has(id))) {
set = set.concat(innerVar.references);
break;
}
}
}
return set;
};
/**
* @param {TODO} ast ast
* @param {TODO} node node
* @returns {TODO} result
*/
const getPathInAst = (ast, node) => {
if (ast === node) {
return [];
}
const nr = node.range;
const enterNode = n => {
if (!n) return undefined;
const r = n.range;
if (r) {
if (r[0] <= nr[0] && r[1] >= nr[1]) {
const path = getPathInAst(n, node);
if (path) {
path.push(n);
return path;
}
}
}
return undefined;
};
if (Array.isArray(ast)) {
for (let i = 0; i < ast.length; i++) {
const enterResult = enterNode(ast[i]);
if (enterResult !== undefined) return enterResult;
}
} else if (ast && typeof ast === "object") {
const keys = Object.keys(ast);
for (let i = 0; i < keys.length; i++) {
const value = ast[keys[i]];
if (Array.isArray(value)) {
const pathResult = getPathInAst(value, node);
if (pathResult !== undefined) return pathResult;
} else if (value && typeof value === "object") {
const enterResult = enterNode(value);
if (enterResult !== undefined) return enterResult;
}
}
}
};
const TYPES = new Set(["javascript"]);

@@ -710,3 +645,3 @@

* @param {RuntimeSpec} runtime the runtime
* @param {Object=} associatedObjectForCache object for caching
* @param {object=} associatedObjectForCache object for caching
* @param {string | HashConstructor=} hashFunction hash function to use

@@ -737,3 +672,3 @@ * @returns {ConcatenatedModule} the module

/**
* @param {Object} options options
* @param {object} options options
* @param {string} options.identifier the identifier of the module

@@ -1112,3 +1047,3 @@ * @param {Module=} options.rootModule the root module of the concatenation

* @param {Set<Module>} modules all modules in the concatenation (including the root module)
* @param {Object=} associatedObjectForCache object for caching
* @param {object=} associatedObjectForCache object for caching
* @param {string | HashConstructor=} hashFunction hash function to use

@@ -1115,0 +1050,0 @@ * @returns {string} the identifier

@@ -24,3 +24,3 @@ /*

/**
* @typedef {Object} StateObject
* @typedef {object} StateObject
* @property {InnerGraph} innerGraph

@@ -27,0 +27,0 @@ * @property {TopLevelSymbol=} currentTopLevelSymbol

@@ -27,3 +27,3 @@ /*

/**
* @typedef {Object} ChunkCombination
* @typedef {object} ChunkCombination
* @property {boolean} deleted this is set to true when combination was removed

@@ -163,3 +163,2 @@ * @property {number} sizeDiff

let changed = false;
// eslint-disable-next-line no-constant-condition
loop: while (true) {

@@ -166,0 +165,0 @@ const combination = combinations.popFirst();

@@ -31,3 +31,3 @@ /*

/**
* @typedef {Object} Statistics
* @typedef {object} Statistics
* @property {number} cached

@@ -34,0 +34,0 @@ * @property {number} alreadyInConfig

@@ -90,3 +90,3 @@ /*

/**
* @typedef {Object} AssetInfoForRealContentHash
* @typedef {object} AssetInfoForRealContentHash
* @property {string} name

@@ -106,3 +106,3 @@ * @property {AssetInfo} info

/**
* @typedef {Object} CompilationHooks
* @typedef {object} CompilationHooks
* @property {SyncBailHook<[Buffer[], string], string>} updateHash

@@ -136,3 +136,3 @@ */

/**
* @param {Object} options options object
* @param {object} options options object
* @param {string | Hash} options.hashFunction the hash function to use

@@ -139,0 +139,0 @@ * @param {string} options.hashDigest the hash digest to use

@@ -30,3 +30,3 @@ /*

/**
* @typedef {Object} ExportInModule
* @typedef {object} ExportInModule
* @property {Module} module the module

@@ -38,3 +38,3 @@ * @property {string} exportName the name of the export

/**
* @typedef {Object} ReexportInfo
* @typedef {object} ReexportInfo
* @property {Map<string, ExportInModule[]>} static

@@ -41,0 +41,0 @@ * @property {Map<Module, Set<string>>} dynamic

@@ -55,3 +55,3 @@ /*

/**
* @typedef {Object} CacheGroupSource
* @typedef {object} CacheGroupSource
* @property {string=} key

@@ -79,3 +79,3 @@ * @property {number=} priority

/**
* @typedef {Object} CacheGroup
* @typedef {object} CacheGroup
* @property {string} key

@@ -106,3 +106,3 @@ * @property {number=} priority

/**
* @typedef {Object} FallbackCacheGroup
* @typedef {object} FallbackCacheGroup
* @property {ChunkFilterFunction} chunksFilter

@@ -116,3 +116,3 @@ * @property {SplitChunksSizes} minSize

/**
* @typedef {Object} CacheGroupsContext
* @typedef {object} CacheGroupsContext
* @property {ModuleGraph} moduleGraph

@@ -138,3 +138,3 @@ * @property {ChunkGraph} chunkGraph

/**
* @typedef {Object} SplitChunksOptions
* @typedef {object} SplitChunksOptions
* @property {ChunkFilterFunction} chunksFilter

@@ -161,3 +161,3 @@ * @property {string[]} defaultSizeTypes

/**
* @typedef {Object} ChunksInfoItem
* @typedef {object} ChunksInfoItem
* @property {SortableSet<Module>} modules

@@ -1032,3 +1032,3 @@ * @property {CacheGroup} cacheGroup

/**
* @typedef {Object} SelectedChunksResult
* @typedef {object} SelectedChunksResult
* @property {Chunk[]} chunks the list of chunks

@@ -1332,3 +1332,3 @@ * @property {bigint | Chunk} key a key of the list

/**
* @typedef {Object} MaxSizeQueueItem
* @typedef {object} MaxSizeQueueItem
* @property {SplitChunksSizes} minSize

@@ -1335,0 +1335,0 @@ * @property {SplitChunksSizes} maxAsyncSize

@@ -14,3 +14,3 @@ /*

/**
* @typedef {Object} ParserStateBase
* @typedef {object} ParserStateBase
* @property {string | Buffer} source

@@ -17,0 +17,0 @@ * @property {NormalModule} current

@@ -22,3 +22,3 @@ /*

/**
* @typedef {Object} AssetDetails
* @typedef {object} AssetDetails
* @property {string} name

@@ -29,3 +29,3 @@ * @property {number} size

/**
* @typedef {Object} EntrypointDetails
* @typedef {object} EntrypointDetails
* @property {string} name

@@ -32,0 +32,0 @@ * @property {number} size

@@ -24,3 +24,3 @@ /*

/**
* @typedef {Object} CountsData
* @typedef {object} CountsData
* @property {number} modulesCount modules count

@@ -27,0 +27,0 @@ * @property {number} dependenciesCount dependencies count

@@ -16,3 +16,3 @@ /*

/**
* @typedef {Object} RecordsChunks
* @typedef {object} RecordsChunks
* @property {Record<string, number>=} byName

@@ -24,3 +24,3 @@ * @property {Record<string, number>=} bySource

/**
* @typedef {Object} RecordsModules
* @typedef {object} RecordsModules
* @property {Record<string, number>=} byIdentifier

@@ -32,3 +32,3 @@ * @property {Record<string, number>=} bySource

/**
* @typedef {Object} Records
* @typedef {object} Records
* @property {RecordsChunks=} chunks

@@ -40,3 +40,3 @@ * @property {RecordsModules=} modules

/**
* @param {Object} options Options object
* @param {object} options Options object
* @param {boolean=} options.portableIds true, when ids need to be portable

@@ -43,0 +43,0 @@ */

@@ -25,3 +25,3 @@ /*

/**
* @typedef {Object} WithOptions
* @typedef {object} WithOptions
* @property {function(Partial<ResolveOptionsWithDependencyType>): ResolverWithOptions} withOptions create a resolver with additional/different options

@@ -72,4 +72,4 @@ */

/**
* @typedef {Object} ResolverCache
* @property {WeakMap<Object, ResolverWithOptions>} direct
* @typedef {object} ResolverCache
* @property {WeakMap<object, ResolverWithOptions>} direct
* @property {Map<string, ResolverWithOptions>} stringified

@@ -76,0 +76,0 @@ */

@@ -10,2 +10,3 @@ /*

/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */
/** @typedef {import("./RuleSetCompiler").RuleConditionFunction} RuleConditionFunction */

@@ -16,6 +17,8 @@ class ObjectMatcherRulePlugin {

* @param {string=} dataProperty the data property
* @param {RuleConditionFunction=} additionalConditionFunction need to check
*/
constructor(ruleProperty, dataProperty) {
constructor(ruleProperty, dataProperty, additionalConditionFunction) {
this.ruleProperty = ruleProperty;
this.dataProperty = dataProperty || ruleProperty;
this.additionalConditionFunction = additionalConditionFunction;
}

@@ -41,2 +44,9 @@

);
if (this.additionalConditionFunction) {
result.conditions.push({
property: [dataProperty],
matchWhenEmpty: condition.matchWhenEmpty,
fn: this.additionalConditionFunction
});
}
result.conditions.push({

@@ -43,0 +53,0 @@ property: [dataProperty, ...nestedDataProperties],

@@ -10,17 +10,19 @@ /*

/** @typedef {function(string): boolean} RuleConditionFunction */
/**
* @typedef {Object} RuleCondition
* @typedef {object} RuleCondition
* @property {string | string[]} property
* @property {boolean} matchWhenEmpty
* @property {function(string): boolean} fn
* @property {RuleConditionFunction} fn
*/
/**
* @typedef {Object} Condition
* @typedef {object} Condition
* @property {boolean} matchWhenEmpty
* @property {function(string): boolean} fn
* @property {RuleConditionFunction} fn
*/
/**
* @typedef {Object} CompiledRule
* @typedef {object} CompiledRule
* @property {RuleCondition[]} conditions

@@ -33,3 +35,3 @@ * @property {(Effect|function(object): Effect[])[]} effects

/**
* @typedef {Object} Effect
* @typedef {object} Effect
* @property {string} type

@@ -40,3 +42,3 @@ * @property {any} value

/**
* @typedef {Object} RuleSet
* @typedef {object} RuleSet
* @property {Map<string, any>} references map of references in the rule set (may grow over time)

@@ -43,0 +45,0 @@ * @property {function(object): Effect[]} exec execute the rule set

@@ -17,3 +17,3 @@ /*

/**
* @typedef {Object} LoadScriptCompilationHooks
* @typedef {object} LoadScriptCompilationHooks
* @property {SyncWaterfallHook<[string, Chunk]>} createScript

@@ -20,0 +20,0 @@ */

@@ -16,3 +16,3 @@ /*

/**
* @typedef {Object} Options
* @typedef {object} Options
* @property {ChunkLoadingType} chunkLoading

@@ -19,0 +19,0 @@ * @property {boolean=} asyncChunkLoading

@@ -154,2 +154,7 @@ /*

supportNodePrefixForCoreModules() {
return /** @type {Environment} */ (this.outputOptions.environment)
.nodePrefixForCoreModules;
}
/**

@@ -393,3 +398,3 @@ * @param {string} returnValue return value

/**
* @param {Object} options options object
* @param {object} options options object
* @param {ChunkGraph} options.chunkGraph the chunk graph

@@ -431,3 +436,3 @@ * @param {Module} options.module the module

/**
* @param {Object} options options object
* @param {object} options options object
* @param {Module} options.module the module

@@ -461,3 +466,3 @@ * @param {ChunkGraph} options.chunkGraph the chunk graph

/**
* @param {Object} options options object
* @param {object} options options object
* @param {Module | null} options.module the module

@@ -505,3 +510,3 @@ * @param {ChunkGraph} options.chunkGraph the chunk graph

/**
* @param {Object} options options object
* @param {object} options options object
* @param {Module | null} options.module the module

@@ -525,3 +530,3 @@ * @param {ChunkGraph} options.chunkGraph the chunk graph

/**
* @param {Object} options options object
* @param {object} options options object
* @param {Module} options.module the module

@@ -595,3 +600,3 @@ * @param {ChunkGraph} options.chunkGraph the chunk graph

/**
* @param {Object} options options object
* @param {object} options options object
* @param {ChunkGraph} options.chunkGraph the chunk graph

@@ -746,3 +751,3 @@ * @param {AsyncDependenciesBlock=} options.block the current dependencies block

/**
* @param {Object} options options object
* @param {object} options options object
* @param {ChunkGraph} options.chunkGraph the chunk graph

@@ -785,3 +790,3 @@ * @param {RuntimeSpec=} options.runtime runtime for which this code will be generated

*
* @param {Object} options options object
* @param {object} options options object
* @param {boolean=} options.update whether a new variable should be created or the existing one updated

@@ -863,3 +868,3 @@ * @param {Module} options.module the module

/**
* @param {Object} options options
* @param {object} options options
* @param {ModuleGraph} options.moduleGraph the module graph

@@ -987,3 +992,3 @@ * @param {Module} options.module the module

/**
* @param {Object} options options
* @param {object} options options
* @param {AsyncDependenciesBlock | undefined} options.block the async block

@@ -1055,3 +1060,3 @@ * @param {string} options.message the message

/**
* @param {Object} options options
* @param {object} options options
* @param {AsyncDependenciesBlock} options.block the async block

@@ -1088,3 +1093,3 @@ * @param {ChunkGraph} options.chunkGraph the chunk graph

/**
* @param {Object} options options
* @param {object} options options
* @param {Dependency} options.dependency the dependency

@@ -1110,3 +1115,3 @@ * @param {ChunkGraph} options.chunkGraph the chunk graph

/**
* @param {Object} options options
* @param {object} options options
* @param {string} options.exportsArgument the name of the exports object

@@ -1123,5 +1128,4 @@ * @param {RuntimeRequirements} options.runtimeRequirements if set, will be filled with runtime requirements

/**
* @param {Object} options options object
* @param {object} options options object
* @param {Module} options.module the module
* @param {string} options.publicPath the public path
* @param {RuntimeSpec=} options.runtime runtime

@@ -1131,3 +1135,3 @@ * @param {CodeGenerationResults} options.codeGenerationResults the code generation results

*/
assetUrl({ publicPath, runtime, module, codeGenerationResults }) {
assetUrl({ runtime, module, codeGenerationResults }) {
if (!module) {

@@ -1142,4 +1146,4 @@ return "data:,";

if (url) return url.toString();
const filename = data.get("filename");
return publicPath + filename;
const assetPath = data.get("assetPathForCss");
return assetPath;
}

@@ -1146,0 +1150,0 @@ }

@@ -154,3 +154,3 @@ /*

/**
* @typedef {Object} LockfileEntry
* @typedef {object} LockfileEntry
* @property {string} resolved

@@ -157,0 +157,0 @@ * @property {string} integrity

@@ -146,3 +146,3 @@ /*

* @param {DeserializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {SerializedType|Promise<SerializedType>} serialized data

@@ -162,3 +162,3 @@ */

* @param {DeserializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @param {{ leftOverBuffer: Buffer | null, allocationSize: number, increaseCounter: number }} allocationScope allocation scope

@@ -634,3 +634,3 @@ * @returns {SerializedType} serialized data

* @param {SerializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data

@@ -659,3 +659,3 @@ */

* @param {SerializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {DeserializedType} deserialized data

@@ -662,0 +662,0 @@ */

@@ -82,3 +82,3 @@ /*

/**
* @typedef {Object} SerializeResult
* @typedef {object} SerializeResult
* @property {string | false} name

@@ -431,3 +431,3 @@ * @property {number} size

* @param {DeserializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {SerializedType|Promise<SerializedType>} serialized data

@@ -560,3 +560,3 @@ */

* @param {SerializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data

@@ -563,0 +563,0 @@ */

@@ -12,3 +12,3 @@ /*

/**
* @template {Object} T
* @template {object} T
* @param {T} obj null object

@@ -29,3 +29,3 @@ * @param {ObjectSerializerContext} context context

/**
* @template {Object} T
* @template {object} T
* @param {ObjectDeserializerContext} context context

@@ -32,0 +32,0 @@ * @returns {T} null object

@@ -47,3 +47,3 @@ /*

/**
* @typedef {Object} ObjectSerializerContext
* @typedef {object} ObjectSerializerContext
* @property {function(any): void} write

@@ -56,3 +56,3 @@ * @property {(function(any): void)=} writeLazy

/**
* @typedef {Object} ObjectDeserializerContext
* @typedef {object} ObjectDeserializerContext
* @property {function(): any} read

@@ -63,3 +63,3 @@ * @property {function(any): void} setCircularReference

/**
* @typedef {Object} ObjectSerializer
* @typedef {object} ObjectSerializer
* @property {function(any, ObjectSerializerContext): void} serialize

@@ -144,2 +144,3 @@ * @property {function(ObjectDeserializerContext): any} deserialize

if (exports.constructor !== Object) {
// eslint-disable-next-line jsdoc/check-types
const Obj = /** @type {typeof Object} */ (exports.constructor);

@@ -296,3 +297,3 @@ const Fn = /** @type {typeof Function} */ (Obj.constructor);

* @param {DeserializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {SerializedType|Promise<SerializedType>} serialized data

@@ -601,3 +602,3 @@ */

* @param {SerializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data

@@ -604,0 +605,0 @@ */

@@ -48,3 +48,3 @@ /*

/**
* @param {Object} obj plain object
* @param {object} obj plain object
* @param {ObjectSerializerContext} context context

@@ -76,3 +76,3 @@ */

* @param {ObjectDeserializerContext} context context
* @returns {Object} plain object
* @returns {object} plain object
*/

@@ -79,0 +79,0 @@ deserialize(context) {

@@ -21,3 +21,3 @@ /*

* @param {DeserializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {SerializedType|Promise<SerializedType>} serialized data

@@ -34,3 +34,3 @@ */

* @param {SerializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data

@@ -37,0 +37,0 @@ */

@@ -17,3 +17,3 @@ /*

* @param {DeserializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {SerializedType|Promise<SerializedType>} serialized data

@@ -27,3 +27,3 @@ */

* @param {SerializedType} data data
* @param {Object} context context object
* @param {object} context context object
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data

@@ -30,0 +30,0 @@ */

@@ -7,3 +7,3 @@ /*

/** @typedef {undefined|null|number|string|boolean|Buffer|Object|(() => ComplexSerializableType[] | Promise<ComplexSerializableType[]>)} ComplexSerializableType */
/** @typedef {undefined | null | number | string | boolean | Buffer | object | (() => ComplexSerializableType[] | Promise<ComplexSerializableType[]>)} ComplexSerializableType */

@@ -10,0 +10,0 @@ /** @typedef {undefined|null|number|bigint|string|boolean|Buffer|(() => PrimitiveSerializableType[] | Promise<PrimitiveSerializableType[]>)} PrimitiveSerializableType */

@@ -39,3 +39,3 @@ /*

/**
* @typedef {Object} ConsumeOptions
* @typedef {object} ConsumeOptions
* @property {string=} import fallback request

@@ -42,0 +42,0 @@ * @property {string=} importResolved resolved fallback request

@@ -30,3 +30,3 @@ /*

/**
* @typedef {Object} ProvideOptions
* @typedef {object} ProvideOptions
* @property {string} shareKey

@@ -33,0 +33,0 @@ * @property {string} shareScope

@@ -16,3 +16,3 @@ /*

* @template T
* @typedef {Object} MatchedConfigs
* @typedef {object} MatchedConfigs
* @property {Map<string, T>} resolved

@@ -19,0 +19,0 @@ * @property {Map<string, T>} unresolved

@@ -38,3 +38,3 @@ /*

return (
this.compilation.warnings.length > 0 ||
this.compilation.getWarnings().length > 0 ||
this.compilation.children.some(child => child.getStats().hasWarnings())

@@ -41,0 +41,0 @@ );

@@ -25,3 +25,3 @@ /*

* @param {Record<string, number>} sizes sizes by source type
* @param {Object} options options
* @param {object} options options
* @param {(number) => string=} options.formatSize size formatter

@@ -28,0 +28,0 @@ * @returns {string} text

@@ -21,3 +21,3 @@ /*

/**
* @typedef {Object} KnownStatsFactoryContext
* @typedef {object} KnownStatsFactoryContext
* @property {string} type

@@ -39,3 +39,3 @@ * @property {function(string): string=} makePathsRelative

this.hooks = Object.freeze({
/** @type {HookMap<SyncBailHook<[Object, any, StatsFactoryContext]>>} */
/** @type {HookMap<SyncBailHook<[object, any, StatsFactoryContext]>>} */
extract: new HookMap(

@@ -42,0 +42,0 @@ () => new SyncBailHook(["object", "data", "context"])

@@ -20,3 +20,3 @@ /*

/**
* @typedef {Object} PrintedElement
* @typedef {object} PrintedElement
* @property {string} element

@@ -27,3 +27,3 @@ * @property {string} content

/**
* @typedef {Object} KnownStatsPrinterContext
* @typedef {object} KnownStatsPrinterContext
* @property {string=} type

@@ -152,4 +152,4 @@ * @property {StatsCompilation=} compilation

* @param {string} type The type
* @param {Object} object Object to print
* @param {Object=} baseContext The base context
* @param {object} object Object to print
* @param {object=} baseContext The base context
* @returns {string} printed result

@@ -174,4 +174,4 @@ */

* @param {string} type type
* @param {Object} object object
* @param {Object=} baseContext context
* @param {object} object object
* @param {object=} baseContext context
* @returns {string} printed result

@@ -178,0 +178,0 @@ */

@@ -44,3 +44,3 @@ /*

/**
* @typedef {Object} RenderManifestOptions
* @typedef {object} RenderManifestOptions
* @property {Chunk} chunk the chunk used to render

@@ -61,3 +61,3 @@ * @property {string} hash

/**
* @typedef {Object} RenderManifestEntryTemplated
* @typedef {object} RenderManifestEntryTemplated
* @property {function(): Source} render

@@ -73,3 +73,3 @@ * @property {string | function(PathData, AssetInfo=): string} filenameTemplate

/**
* @typedef {Object} RenderManifestEntryStatic
* @typedef {object} RenderManifestEntryStatic
* @property {function(): Source} render

@@ -84,3 +84,3 @@ * @property {string} filename

/**
* @typedef {Object} HasId
* @typedef {object} HasId
* @property {number | string} id

@@ -259,3 +259,3 @@ */

/**
* @typedef {Object} WithId
* @typedef {object} WithId
* @property {string|number} id

@@ -262,0 +262,0 @@ */

@@ -40,3 +40,18 @@ /*

/**
* @callback ReplacerFunction
* @param {string} match
* @param {string | undefined} arg
* @param {string} input
*/
/**
* @param {ReplacerFunction} replacer replacer
* @param {((arg0: number) => string) | undefined} handler handler
* @param {AssetInfo | undefined} assetInfo asset info
* @param {string} hashName hash name
* @returns {ReplacerFunction} hash replacer function
*/
const hashLength = (replacer, handler, assetInfo, hashName) => {
/** @type {ReplacerFunction} */
const fn = (match, arg, input) => {

@@ -121,3 +136,3 @@ let result;

* @param {PathData} data context data
* @param {AssetInfo} assetInfo extra info about the asset (will be written to)
* @param {AssetInfo | undefined} assetInfo extra info about the asset (will be written to)
* @returns {string} the interpolated path

@@ -124,0 +139,0 @@ */

@@ -16,5 +16,11 @@ /*

constructor(items) {
/** @private @type {T[]} */
/**
* @private
* @type {T[]}
*/
this._list = items ? Array.from(items) : [];
/** @private @type {T[]} */
/**
* @private
* @type {T[]}
*/
this._listReversed = [];

@@ -81,27 +87,14 @@ }

[Symbol.iterator]() {
let i = -1;
let reversed = false;
return {
next: () => {
if (!reversed) {
i++;
if (i < this._list.length) {
return {
done: false,
value: this._list[i]
};
}
reversed = true;
i = this._listReversed.length;
}
i--;
if (i < 0) {
const item = this.dequeue();
if (item) {
return {
done: true,
value: undefined
done: false,
value: item
};
}
return {
done: false,
value: this._listReversed[i]
done: true,
value: undefined
};

@@ -108,0 +101,0 @@ }

@@ -56,3 +56,3 @@ /*

/**
* @param {Object} options options object
* @param {object} options options object
* @param {string=} options.name name of the queue

@@ -59,0 +59,0 @@ * @param {number=} options.parallelism how many items should be processed at once

@@ -78,3 +78,3 @@ /*

* @param {boolean=} earlyOut Whether the search should return as soon as a match is found.
* @returns {function} The compiled binary search function.
* @returns {Function} The compiled binary search function.
*/

@@ -81,0 +81,0 @@ const compileBoundsSearch = (predicate, reversed, suffix, earlyOut) => {

@@ -84,3 +84,3 @@ /*

/**
* @typedef {Object} ObjectParsedPropertyEntry
* @typedef {object} ObjectParsedPropertyEntry
* @property {any | undefined} base base value

@@ -92,3 +92,3 @@ * @property {string | undefined} byProperty the name of the selector property

/**
* @typedef {Object} ParsedObject
* @typedef {object} ParsedObject
* @property {Map<string, ObjectParsedPropertyEntry>} static static properties (key is property name)

@@ -95,0 +95,0 @@ * @property {{ byProperty: string, fn: Function } | undefined} dynamic dynamic part

@@ -282,3 +282,6 @@ /*

constructor() {
/** @private @type {WeakMap<any, WeakMap<any, T | undefined>>} */
/**
* @private
* @type {WeakMap<any, WeakMap<any, T | undefined>>}
*/
this._map = new WeakMap();

@@ -412,3 +415,2 @@ }

const bI = b[Symbol.iterator]();
// eslint-disable-next-line no-constant-condition
while (true) {

@@ -415,0 +417,0 @@ const aItem = aI.next();

@@ -12,3 +12,3 @@ /*

* @param {string} input input
* @param {CssGeneratorExportsConvention} convention convention
* @param {CssGeneratorExportsConvention | undefined} convention convention
* @returns {Set<string>} results

@@ -15,0 +15,0 @@ */

@@ -14,3 +14,3 @@ /*

// so access to it can be optimized by v8
/** @type {Object<string, Map<string, string>>} */
/** @type {{[key: string]: Map<string, string>}} */
const digestCaches = {};

@@ -147,3 +147,3 @@

* Creates a hash by name or function
* @param {string | typeof Hash | undefined} algorithm the algorithm name or a constructor creating a hash
* @param {string | typeof Hash} algorithm the algorithm name or a constructor creating a hash
* @returns {Hash} the hash

@@ -189,5 +189,3 @@ */

() =>
/** @type {typeof import("crypto")} */ (crypto).createHash(
/** @type {string} */ (algorithm)
),
/** @type {typeof import("crypto")} */ (crypto).createHash(algorithm),
algorithm

@@ -194,0 +192,0 @@ );

@@ -14,3 +14,3 @@ /*

/**
* @typedef {Object} FakeHookMarker
* @typedef {object} FakeHookMarker
* @property {true} _fakeHook it's a fake hook

@@ -191,7 +191,7 @@ */

* @template T
* @param {Object} obj object
* @param {object} obj object
* @param {string} name property name
* @param {string} code deprecation code
* @param {string} note additional note
* @returns {Object} frozen object with deprecation when modifying
* @returns {object} frozen object with deprecation when modifying
*/

@@ -198,0 +198,0 @@ exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => {

@@ -275,3 +275,3 @@ /*

* @template T
* @typedef {Object} GroupedItems<T>
* @typedef {object} GroupedItems<T>
* @property {string} key

@@ -284,3 +284,3 @@ * @property {T[]} items

* @template T
* @typedef {Object} Options
* @typedef {object} Options
* @property {Record<string, number>} maxSize maximum size of a group

@@ -287,0 +287,0 @@ * @property {Record<string, number>} minSize minimum size of a group (preferred over maximum size)

@@ -44,3 +44,3 @@ /*

* @template T
* @typedef {Object} StackEntry
* @typedef {object} StackEntry
* @property {Node<T>} node

@@ -47,0 +47,0 @@ * @property {Node<T>[]} openEdges

@@ -15,3 +15,3 @@ /*

* @template T
* @typedef {Object} IStatsBase
* @typedef {object} IStatsBase
* @property {() => boolean} isFile

@@ -53,3 +53,3 @@ * @property {() => boolean} isDirectory

/**
* @typedef {Object} Dirent
* @typedef {object} Dirent
* @property {() => boolean} isFile

@@ -86,3 +86,3 @@ * @property {() => boolean} isDirectory

/**
* @typedef {Object} WatcherInfo
* @typedef {object} WatcherInfo
* @property {Set<string>} changes get current aggregated changes that have not yet send to callback

@@ -96,3 +96,3 @@ * @property {Set<string>} removals get current aggregated removals that have not yet send to callback

/**
* @typedef {Object} Watcher
* @typedef {object} Watcher
* @property {function(): void} close closes the watcher and all underlying file watchers

@@ -130,3 +130,3 @@ * @property {function(): void} pause closes the watcher, but keeps underlying file watchers alive until the next watch call

/**
* @typedef {Object} ObjectEncodingOptions
* @typedef {object} ObjectEncodingOptions
* @property {BufferEncoding | null | undefined} [encoding]

@@ -161,3 +161,3 @@ */

/**
* @typedef {Object} StatOptions
* @typedef {object} StatOptions
* @property {(boolean | undefined)=} bigint

@@ -167,3 +167,3 @@ */

/**
* @typedef {Object} StatSyncOptions
* @typedef {object} StatSyncOptions
* @property {(boolean | undefined)=} bigint

@@ -281,3 +281,3 @@ * @property {(boolean | undefined)=} throwIfNoEntry

/**
* @typedef {Object} InputFileSystem
* @typedef {object} InputFileSystem
* @property {ReadFile} readFile

@@ -347,3 +347,3 @@ * @property {ReadFileSync=} readFileSync

/**
* @typedef {Object} OutputFileSystem
* @typedef {object} OutputFileSystem
* @property {WriteFile} writeFile

@@ -363,3 +363,3 @@ * @property {Mkdir} mkdir

/**
* @typedef {Object} WatchFileSystem
* @typedef {object} WatchFileSystem
* @property {WatchMethod} watch

@@ -377,3 +377,3 @@ */

/**
* @typedef {Object} StreamOptions
* @typedef {object} StreamOptions
* @property {(string | undefined)=} flags

@@ -390,3 +390,3 @@ * @property {(BufferEncoding | undefined)} encoding

/**
* @typedef {Object} FSImplementation
* @typedef {object} FSImplementation
* @property {((...args: any[]) => any)=} open

@@ -425,3 +425,3 @@ * @property {((...args: any[]) => any)=} close

/**
* @typedef {Object} ReadSyncOptions
* @typedef {object} ReadSyncOptions
* @property {(number | undefined)=} offset

@@ -434,3 +434,3 @@ * @property {(number | undefined)=} length

* @template {NodeJS.ArrayBufferView} TBuffer
* @typedef {Object} ReadAsyncOptions
* @typedef {object} ReadAsyncOptions
* @property {(number | undefined)=} offset

@@ -456,3 +456,3 @@ * @property {(number | undefined)=} length

/**
* @typedef {Object} IntermediateFileSystemExtras
* @typedef {object} IntermediateFileSystemExtras
* @property {MkdirSync} mkdirSync

@@ -459,0 +459,0 @@ * @property {CreateWriteStream} createWriteStream

@@ -14,3 +14,3 @@ /*

/**
* @typedef {Object} MakeRelativePathsCache
* @typedef {object} MakeRelativePathsCache
* @property {Map<string, Map<string, string>>=} relativePaths

@@ -104,3 +104,3 @@ */

* @param {string} str the path with query and fragment
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {ParsedResource} parsed parts

@@ -139,3 +139,3 @@ */

* @param {string} identifier identifier used to create relative path
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} the returned relative path

@@ -170,3 +170,3 @@ */

/**
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {function(string, string): string} cached function

@@ -214,3 +214,3 @@ */

* @param {string} context context used to create relative path
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
* @param {object=} associatedObjectForCache an object to which the cache will be attached
* @returns {function(string): string} cached function

@@ -217,0 +217,0 @@ */

@@ -16,5 +16,11 @@ /*

constructor(items) {
/** @private @type {Set<T>} */
/**
* @private
* @type {Set<T>}
*/
this._set = new Set(items);
/** @private @type {Iterator<T>} */
/**
* @private
* @type {Iterator<T>}
*/
this._iterator = this._set[Symbol.iterator]();

@@ -21,0 +27,0 @@ }

@@ -233,18 +233,2 @@ /*

/**
* @param {RuntimeSpec[] | undefined} 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

@@ -394,2 +378,3 @@ * @param {RuntimeCondition} b second

set.delete(b);
return set;
} else {

@@ -450,3 +435,3 @@ const set = new SortableSet();

* @typedef {Map<string, T>} RuntimeSpecMapInnerMap
* */
*/

@@ -453,0 +438,0 @@ /**

@@ -156,2 +156,5 @@ /*

case "~":
if (remainder.length === 2 && remainder[0] === 0) {
return [1, ...remainder.slice(1)];
}
return [2, ...remainder.slice(1)];

@@ -158,0 +161,0 @@ case ">=":

@@ -9,3 +9,3 @@ /*

/**
* @typedef {Object} GroupOptions
* @typedef {object} GroupOptions
* @property {boolean=} groupChildren

@@ -19,3 +19,3 @@ * @property {boolean=} force

* @template R
* @typedef {Object} GroupConfig
* @typedef {object} GroupConfig
* @property {function(T): string[]} getKeys

@@ -29,3 +29,3 @@ * @property {function(string, (R | T)[], T[]): R} createGroup

* @template R
* @typedef {Object} ItemWithGroups
* @typedef {object} ItemWithGroups
* @property {T} item

@@ -32,0 +32,0 @@ * @property {Set<Group<T, R>>} groups

@@ -24,9 +24,21 @@ /*

super(initialIterable);
/** @private @type {undefined | function(T, T): number}} */
/**
* @private
* @type {undefined | function(T, T): number}}
*/
this._sortFn = defaultSort;
/** @private @type {typeof NONE | undefined | function(T, T): number}} */
/**
* @private
* @type {typeof NONE | undefined | function(T, T): number}}
*/
this._lastActiveSortFn = NONE;
/** @private @type {Map<Function, any> | undefined} */
/**
* @private
* @type {Map<Function, any> | undefined}
*/
this._cache = undefined;
/** @private @type {Map<Function, any> | undefined} */
/**
* @private
* @type {Map<Function, any> | undefined}
*/
this._cacheOrderIndependent = undefined;

@@ -33,0 +45,0 @@ }

@@ -18,5 +18,11 @@ /*

constructor(items) {
/** @private @type {TupleSet<T>} */
/**
* @private
* @type {TupleSet<T>}
*/
this._set = new TupleSet(items);
/** @private @type {Iterator<T>} */
/**
* @private
* @type {Iterator<T>}
*/
this._iterator = this._set[Symbol.iterator]();

@@ -23,0 +29,0 @@ }

@@ -36,3 +36,3 @@ /*

* @type {any}
**/
*/
this.v = undefined;

@@ -42,3 +42,3 @@ /**

* @type {M<T, V> | undefined}
**/
*/
this.m = undefined;

@@ -48,3 +48,3 @@ /**

* @type {W<T, V> | undefined}
**/
*/
this.w = undefined;

@@ -51,0 +51,0 @@ }

@@ -16,3 +16,3 @@ /*

/**
* @typedef {Object} AsyncWasmLoadingRuntimeModuleOptions
* @typedef {object} AsyncWasmLoadingRuntimeModuleOptions
* @property {function(string): string} generateLoadBinaryCode

@@ -73,3 +73,5 @@ * @property {boolean} supportsStreaming

`var req = ${loader};`,
`var fallback = ${runtimeTemplate.returningFunction(Template.asString(["req", Template.indent(fallback)]))};`,
`var fallback = ${runtimeTemplate.returningFunction(
Template.asString(["req", Template.indent(fallback)])
)};`,
concat(

@@ -76,0 +78,0 @@ "return req.then(",

@@ -17,3 +17,3 @@ /*

/**
* @typedef {Object} AsyncWebAssemblyGeneratorOptions
* @typedef {object} AsyncWebAssemblyGeneratorOptions
* @property {boolean} [mangleImports] mangle imports

@@ -20,0 +20,0 @@ */

@@ -42,3 +42,3 @@ /*

/**
* @typedef {Object} WebAssemblyRenderContext
* @typedef {object} WebAssemblyRenderContext
* @property {Chunk} chunk the chunk

@@ -53,3 +53,3 @@ * @property {DependencyTemplates} dependencyTemplates the dependency templates

/**
* @typedef {Object} CompilationHooks
* @typedef {object} CompilationHooks
* @property {SyncWaterfallHook<[Source, Module, WebAssemblyRenderContext]>} renderModuleContent

@@ -59,3 +59,3 @@ */

/**
* @typedef {Object} AsyncWebAssemblyModulesPluginOptions
* @typedef {object} AsyncWebAssemblyModulesPluginOptions
* @property {boolean} [mangleImports] mangle imports

@@ -62,0 +62,0 @@ */

@@ -213,3 +213,3 @@ /*

/**
* @typedef {Object} WasmChunkLoadingRuntimeModuleOptions
* @typedef {object} WasmChunkLoadingRuntimeModuleOptions
* @property {(path: string) => string} generateLoadBinaryCode

@@ -216,0 +216,0 @@ * @property {boolean} [supportsStreaming]

@@ -58,4 +58,4 @@ /*

*
* @param {Object} state state
* @param {Object} state.ast Module's ast
* @param {object} state state
* @param {object} state.ast Module's ast
* @returns {ArrayBufferTransform} transform

@@ -74,3 +74,3 @@ */

*
* @param {Object} ast Module's AST
* @param {object} ast Module's AST
* @returns {t.ModuleImport[]} - nodes

@@ -96,4 +96,4 @@ */

*
* @param {Object} ast Module's AST
* @returns {Number} - count
* @param {object} ast Module's AST
* @returns {number} - count
*/

@@ -117,3 +117,3 @@ const getCountImportedFunc = ast => {

*
* @param {Object} ast Module's AST
* @param {object} ast Module's AST
* @returns {t.Index} - index

@@ -138,4 +138,4 @@ */

*
* @param {Object} ast Module's AST
* @param {Number} countImportedFunc number of imported funcs
* @param {object} ast Module's AST
* @param {number} countImportedFunc number of imported funcs
* @returns {t.Index} - index

@@ -186,4 +186,4 @@ */

*
* @param {Object} state transformation state
* @param {Object} state.ast Module's ast
* @param {object} state transformation state
* @param {object} state.ast Module's ast
* @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function

@@ -257,4 +257,4 @@ * @returns {ArrayBufferTransform} transform

* Rewrite the export names
* @param {Object} state state
* @param {Object} state.ast Module's ast
* @param {object} state state
* @param {object} state.ast Module's ast
* @param {Module} state.module Module

@@ -293,4 +293,4 @@ * @param {ModuleGraph} state.moduleGraph module graph

* Mangle import names and modules
* @param {Object} state state
* @param {Object} state.ast Module's ast
* @param {object} state state
* @param {object} state.ast Module's ast
* @param {Map<string, UsedWasmDependency>} state.usedDependencyMap mappings to mangle names

@@ -324,4 +324,4 @@ * @returns {ArrayBufferTransform} transform

*
* @param {Object} state transformation state
* @param {Object} state.ast Module's ast
* @param {object} state transformation state
* @param {object} state.ast Module's ast
* @param {t.Identifier} state.initFuncId identifier of the init function

@@ -430,3 +430,3 @@ * @param {t.Index} state.startAtFuncOffset index of the start function

/**
* @typedef {Object} WebAssemblyGeneratorOptions
* @typedef {object} WebAssemblyGeneratorOptions
* @property {boolean} [mangleImports] mangle imports

@@ -433,0 +433,0 @@ */

@@ -34,3 +34,3 @@ /*

/**
* @typedef {Object} WebAssemblyModulesPluginOptions
* @typedef {object} WebAssemblyModulesPluginOptions
* @property {boolean} [mangleImports] mangle imports

@@ -37,0 +37,0 @@ */

@@ -14,3 +14,4 @@ /*

/** @typedef {Object} UsedWasmDependency
/**
* @typedef {object} UsedWasmDependency
* @property {WebAssemblyImportDependency} dependency the dependency

@@ -17,0 +18,0 @@ * @property {string} name the export name

@@ -20,3 +20,3 @@ /*

/**
* @typedef {Object} FetchCompileWasmPluginOptions
* @typedef {object} FetchCompileWasmPluginOptions
* @property {boolean} [mangleImports] mangle imports

@@ -23,0 +23,0 @@ */

@@ -21,3 +21,3 @@ /*

/**
* @typedef {Object} JsonpCompilationPluginHooks
* @typedef {object} JsonpCompilationPluginHooks
* @property {SyncWaterfallHook<[string, Chunk]>} linkPreload

@@ -24,0 +24,0 @@ * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch

@@ -45,3 +45,5 @@ /*

const createMultiCompiler = (childOptions, options) => {
const compilers = childOptions.map(options => createCompiler(options));
const compilers = childOptions.map((options, index) =>
createCompiler(options, index)
);
const compiler = new MultiCompiler(compilers, options);

@@ -61,5 +63,6 @@ for (const childCompiler of compilers) {

* @param {WebpackOptions} rawOptions options object
* @param {number} [compilerIndex] index of compiler
* @returns {Compiler} a compiler
*/
const createCompiler = rawOptions => {
const createCompiler = (rawOptions, compilerIndex) => {
const options = getNormalizedWebpackOptions(rawOptions);

@@ -84,3 +87,9 @@ applyWebpackOptionsBaseDefaults(options);

}
applyWebpackOptionsDefaults(options);
const resolvedDefaultOptions = applyWebpackOptionsDefaults(
options,
compilerIndex
);
if (resolvedDefaultOptions.platform) {
compiler.platform = resolvedDefaultOptions.platform;
}
compiler.hooks.environment.call();

@@ -87,0 +96,0 @@ compiler.hooks.afterEnvironment.call();

{
"name": "webpack",
"version": "5.91.0",
"version": "5.92.0",
"author": "Tobias Koppers @sokra",

@@ -14,6 +14,6 @@ "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.",

"acorn": "^8.7.1",
"acorn-import-assertions": "^1.9.0",
"acorn-import-attributes": "^1.9.5",
"browserslist": "^4.21.10",
"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.16.0",
"enhanced-resolve": "^5.17.0",
"es-module-lexer": "^1.2.1",

@@ -40,4 +40,5 @@ "eslint-scope": "5.1.1",

"devDependencies": {
"@babel/core": "^7.23.7",
"@babel/preset-react": "^7.23.3",
"@babel/core": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@eslint/js": "^9.4.0",
"@types/glob-to-regexp": "^0.4.4",

@@ -55,3 +56,3 @@ "@types/jest": "^29.5.11",

"coveralls": "^3.1.0",
"cspell": "^8.6.0",
"cspell": "^8.8.4",
"css-loader": "^5.0.1",

@@ -61,10 +62,11 @@ "date-fns": "^3.2.0",

"es6-promise-polyfill": "^1.2.0",
"eslint": "^8.48.0",
"eslint": "^9.4.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^27.6.3",
"eslint-plugin-jsdoc": "^48.1.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-jsdoc": "^48.2.9",
"eslint-plugin-n": "^17.8.1",
"eslint-plugin-prettier": "^5.1.3",
"file-loader": "^6.0.0",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"globals": "^15.4.0",
"hash-wasm": "^4.9.0",

@@ -84,9 +86,9 @@ "husky": "^9.0.11",

"less-loader": "^8.0.0",
"lint-staged": "^15.2.2",
"lint-staged": "^15.2.5",
"lodash": "^4.17.19",
"lodash-es": "^4.17.15",
"memfs": "^4.7.7",
"memfs": "^4.9.2",
"mini-css-extract-plugin": "^1.6.1",
"mini-svg-data-uri": "^1.2.3",
"nyc": "^15.1.0",
"nyc": "^17.0.0",
"open-cli": "^8.0.0",

@@ -96,13 +98,13 @@ "prettier": "^3.2.1",

"pretty-format": "^29.5.0",
"pug": "^3.0.0",
"pug": "^3.0.3",
"pug-loader": "^2.4.0",
"raw-loader": "^4.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "^3.0.2",
"script-loader": "^0.7.2",
"simple-git": "^3.17.0",
"simple-git": "^3.25.0",
"strip-ansi": "^6.0.0",
"style-loader": "^2.0.0",
"terser": "^5.26.0",
"terser": "^5.31.1",
"toml": "^3.0.0",

@@ -109,0 +111,0 @@ "tooling": "webpack/tooling#v1.23.3",

@@ -6,2 +6,2 @@ /*

*/
"use strict";function t(r,{instancePath:e="",parentData:n,parentDataProperty:o,rootData:a=r}={}){let s=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return t.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in r)if("exportsConvention"!==e&&"exportsOnly"!==e&&"localIdentName"!==e)return t.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==r.exportsConvention){let e=r.exportsConvention;const n=l,o=l;let a=!1;const c=l;if("as-is"!==e&&"camel-case"!==e&&"camel-case-only"!==e&&"dashes"!==e&&"dashes-only"!==e){const t={params:{}};null===s?s=[t]:s.push(t),l++}var i=c===l;if(a=a||i,!a){const t=l;if(!(e instanceof Function)){const t={params:{}};null===s?s=[t]:s.push(t),l++}i=t===l,a=a||i}if(!a){const r={params:{}};return null===s?s=[r]:s.push(r),l++,t.errors=s,!1}l=o,null!==s&&(o?s.length=o:s=null);var p=n===l}else p=!0;if(p){if(void 0!==r.exportsOnly){const e=l;if("boolean"!=typeof r.exportsOnly)return t.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p)if(void 0!==r.localIdentName){const e=l;if("string"!=typeof r.localIdentName)return t.errors=[{params:{type:"string"}}],!1;p=e===l}else p=!0}}}}return t.errors=s,0===l}function r(e,{instancePath:n="",parentData:o,parentDataProperty:a,rootData:s=e}={}){let l=null,i=0;return t(e,{instancePath:n,parentData:o,parentDataProperty:a,rootData:s})||(l=null===l?t.errors:l.concat(t.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;
"use strict";function e(r,{instancePath:t="",parentData:o,parentDataProperty:n,rootData:a=r}={}){let s=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return e.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in r)if("esModule"!==t&&"exportsConvention"!==t&&"exportsOnly"!==t&&"localIdentName"!==t)return e.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==r.esModule){const t=l;if("boolean"!=typeof r.esModule)return e.errors=[{params:{type:"boolean"}}],!1;var i=t===l}else i=!0;if(i){if(void 0!==r.exportsConvention){let t=r.exportsConvention;const o=l,n=l;let a=!1;const c=l;if("as-is"!==t&&"camel-case"!==t&&"camel-case-only"!==t&&"dashes"!==t&&"dashes-only"!==t){const e={params:{}};null===s?s=[e]:s.push(e),l++}var p=c===l;if(a=a||p,!a){const e=l;if(!(t instanceof Function)){const e={params:{}};null===s?s=[e]:s.push(e),l++}p=e===l,a=a||p}if(!a){const r={params:{}};return null===s?s=[r]:s.push(r),l++,e.errors=s,!1}l=n,null!==s&&(n?s.length=n:s=null),i=o===l}else i=!0;if(i){if(void 0!==r.exportsOnly){const t=l;if("boolean"!=typeof r.exportsOnly)return e.errors=[{params:{type:"boolean"}}],!1;i=t===l}else i=!0;if(i)if(void 0!==r.localIdentName){const t=l;if("string"!=typeof r.localIdentName)return e.errors=[{params:{type:"string"}}],!1;i=t===l}else i=!0}}}}}return e.errors=s,0===l}function r(t,{instancePath:o="",parentData:n,parentDataProperty:a,rootData:s=t}={}){let l=null,i=0;return e(t,{instancePath:o,parentData:n,parentDataProperty:a,rootData:s})||(l=null===l?e.errors:l.concat(e.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;

@@ -6,2 +6,2 @@ /*

*/
"use strict";function r(t,{instancePath:e="",parentData:n,parentDataProperty:o,rootData:a=t}={}){let s=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in t)if("exportsConvention"!==e&&"exportsOnly"!==e)return r.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==t.exportsConvention){let e=t.exportsConvention;const n=l,o=l;let a=!1;const c=l;if("as-is"!==e&&"camel-case"!==e&&"camel-case-only"!==e&&"dashes"!==e&&"dashes-only"!==e){const r={params:{}};null===s?s=[r]:s.push(r),l++}var p=c===l;if(a=a||p,!a){const r=l;if(!(e instanceof Function)){const r={params:{}};null===s?s=[r]:s.push(r),l++}p=r===l,a=a||p}if(!a){const t={params:{}};return null===s?s=[t]:s.push(t),l++,r.errors=s,!1}l=o,null!==s&&(o?s.length=o:s=null);var i=n===l}else i=!0;if(i)if(void 0!==t.exportsOnly){const e=l;if("boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;i=e===l}else i=!0}}}return r.errors=s,0===l}function t(e,{instancePath:n="",parentData:o,parentDataProperty:a,rootData:s=e}={}){let l=null,p=0;return r(e,{instancePath:n,parentData:o,parentDataProperty:a,rootData:s})||(l=null===l?r.errors:l.concat(r.errors),p=l.length),t.errors=l,0===p}module.exports=t,module.exports.default=t;
"use strict";function r(e,{instancePath:t="",parentData:o,parentDataProperty:a,rootData:n=e}={}){if(!e||"object"!=typeof e||Array.isArray(e))return r.errors=[{params:{type:"object"}}],!1;{const t=0;for(const t in e)if("esModule"!==t&&"exportsOnly"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(0===t){if(void 0!==e.esModule){const t=0;if("boolean"!=typeof e.esModule)return r.errors=[{params:{type:"boolean"}}],!1;var s=0===t}else s=!0;if(s)if(void 0!==e.exportsOnly){const t=0;if("boolean"!=typeof e.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;s=0===t}else s=!0}}return r.errors=null,!0}function e(t,{instancePath:o="",parentData:a,parentDataProperty:n,rootData:s=t}={}){let p=null,l=0;return r(t,{instancePath:o,parentData:a,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),l=p.length),e.errors=p,0===l}module.exports=e,module.exports.default=e;

@@ -6,2 +6,2 @@ /*

*/
"use strict";function t(r,{instancePath:e="",parentData:n,parentDataProperty:o,rootData:a=r}={}){let s=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return t.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in r)if("exportsConvention"!==e&&"exportsOnly"!==e&&"localIdentName"!==e)return t.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==r.exportsConvention){let e=r.exportsConvention;const n=l,o=l;let a=!1;const c=l;if("as-is"!==e&&"camel-case"!==e&&"camel-case-only"!==e&&"dashes"!==e&&"dashes-only"!==e){const t={params:{}};null===s?s=[t]:s.push(t),l++}var i=c===l;if(a=a||i,!a){const t=l;if(!(e instanceof Function)){const t={params:{}};null===s?s=[t]:s.push(t),l++}i=t===l,a=a||i}if(!a){const r={params:{}};return null===s?s=[r]:s.push(r),l++,t.errors=s,!1}l=o,null!==s&&(o?s.length=o:s=null);var p=n===l}else p=!0;if(p){if(void 0!==r.exportsOnly){const e=l;if("boolean"!=typeof r.exportsOnly)return t.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p)if(void 0!==r.localIdentName){const e=l;if("string"!=typeof r.localIdentName)return t.errors=[{params:{type:"string"}}],!1;p=e===l}else p=!0}}}}return t.errors=s,0===l}function r(e,{instancePath:n="",parentData:o,parentDataProperty:a,rootData:s=e}={}){let l=null,i=0;return t(e,{instancePath:n,parentData:o,parentDataProperty:a,rootData:s})||(l=null===l?t.errors:l.concat(t.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;
"use strict";function e(r,{instancePath:t="",parentData:o,parentDataProperty:n,rootData:a=r}={}){let s=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return e.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in r)if("esModule"!==t&&"exportsConvention"!==t&&"exportsOnly"!==t&&"localIdentName"!==t)return e.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==r.esModule){const t=l;if("boolean"!=typeof r.esModule)return e.errors=[{params:{type:"boolean"}}],!1;var i=t===l}else i=!0;if(i){if(void 0!==r.exportsConvention){let t=r.exportsConvention;const o=l,n=l;let a=!1;const c=l;if("as-is"!==t&&"camel-case"!==t&&"camel-case-only"!==t&&"dashes"!==t&&"dashes-only"!==t){const e={params:{}};null===s?s=[e]:s.push(e),l++}var p=c===l;if(a=a||p,!a){const e=l;if(!(t instanceof Function)){const e={params:{}};null===s?s=[e]:s.push(e),l++}p=e===l,a=a||p}if(!a){const r={params:{}};return null===s?s=[r]:s.push(r),l++,e.errors=s,!1}l=n,null!==s&&(n?s.length=n:s=null),i=o===l}else i=!0;if(i){if(void 0!==r.exportsOnly){const t=l;if("boolean"!=typeof r.exportsOnly)return e.errors=[{params:{type:"boolean"}}],!1;i=t===l}else i=!0;if(i)if(void 0!==r.localIdentName){const t=l;if("string"!=typeof r.localIdentName)return e.errors=[{params:{type:"string"}}],!1;i=t===l}else i=!0}}}}}return e.errors=s,0===l}function r(t,{instancePath:o="",parentData:n,parentDataProperty:a,rootData:s=t}={}){let l=null,i=0;return e(t,{instancePath:o,parentData:n,parentDataProperty:a,rootData:s})||(l=null===l?e.errors:l.concat(e.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;

@@ -6,2 +6,2 @@ /*

*/
"use strict";function t(r,{instancePath:e="",parentData:n,parentDataProperty:o,rootData:a=r}={}){let s=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return t.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in r)if("exportsConvention"!==e&&"exportsOnly"!==e&&"localIdentName"!==e)return t.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==r.exportsConvention){let e=r.exportsConvention;const n=l,o=l;let a=!1;const c=l;if("as-is"!==e&&"camel-case"!==e&&"camel-case-only"!==e&&"dashes"!==e&&"dashes-only"!==e){const t={params:{}};null===s?s=[t]:s.push(t),l++}var i=c===l;if(a=a||i,!a){const t=l;if(!(e instanceof Function)){const t={params:{}};null===s?s=[t]:s.push(t),l++}i=t===l,a=a||i}if(!a){const r={params:{}};return null===s?s=[r]:s.push(r),l++,t.errors=s,!1}l=o,null!==s&&(o?s.length=o:s=null);var p=n===l}else p=!0;if(p){if(void 0!==r.exportsOnly){const e=l;if("boolean"!=typeof r.exportsOnly)return t.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p)if(void 0!==r.localIdentName){const e=l;if("string"!=typeof r.localIdentName)return t.errors=[{params:{type:"string"}}],!1;p=e===l}else p=!0}}}}return t.errors=s,0===l}function r(e,{instancePath:n="",parentData:o,parentDataProperty:a,rootData:s=e}={}){let l=null,i=0;return t(e,{instancePath:n,parentData:o,parentDataProperty:a,rootData:s})||(l=null===l?t.errors:l.concat(t.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;
"use strict";function e(r,{instancePath:t="",parentData:o,parentDataProperty:n,rootData:a=r}={}){let s=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return e.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in r)if("esModule"!==t&&"exportsConvention"!==t&&"exportsOnly"!==t&&"localIdentName"!==t)return e.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==r.esModule){const t=l;if("boolean"!=typeof r.esModule)return e.errors=[{params:{type:"boolean"}}],!1;var i=t===l}else i=!0;if(i){if(void 0!==r.exportsConvention){let t=r.exportsConvention;const o=l,n=l;let a=!1;const c=l;if("as-is"!==t&&"camel-case"!==t&&"camel-case-only"!==t&&"dashes"!==t&&"dashes-only"!==t){const e={params:{}};null===s?s=[e]:s.push(e),l++}var p=c===l;if(a=a||p,!a){const e=l;if(!(t instanceof Function)){const e={params:{}};null===s?s=[e]:s.push(e),l++}p=e===l,a=a||p}if(!a){const r={params:{}};return null===s?s=[r]:s.push(r),l++,e.errors=s,!1}l=n,null!==s&&(n?s.length=n:s=null),i=o===l}else i=!0;if(i){if(void 0!==r.exportsOnly){const t=l;if("boolean"!=typeof r.exportsOnly)return e.errors=[{params:{type:"boolean"}}],!1;i=t===l}else i=!0;if(i)if(void 0!==r.localIdentName){const t=l;if("string"!=typeof r.localIdentName)return e.errors=[{params:{type:"string"}}],!1;i=t===l}else i=!0}}}}}return e.errors=s,0===l}function r(t,{instancePath:o="",parentData:n,parentDataProperty:a,rootData:s=t}={}){let l=null,i=0;return e(t,{instancePath:o,parentData:n,parentDataProperty:a,rootData:s})||(l=null===l?e.errors:l.concat(e.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc