Socket
Socket
Sign inDemoInstall

webpack

Package Overview
Dependencies
76
Maintainers
4
Versions
832
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.87.0 to 5.88.0

2

lib/APIPlugin.js

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

* @param {string} importMetaName `import.meta` name
* @returns {Record<string, {expr: string, req: string[], type?: string, assign: boolean}>} replacements
* @returns {Record<string, {expr: string, req: string[] | null, type?: string, assign: boolean}>} replacements
*/

@@ -35,0 +35,0 @@ function getReplacements(module, importMetaName) {

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

/** @type {string | boolean | undefined} */
let mimeType = this.dataUrlOptions.mimetype;

@@ -217,3 +218,3 @@ if (mimeType === undefined) {

return mimeType;
return /** @type {string} */ (mimeType);
}

@@ -220,0 +221,0 @@

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

/** @typedef {import("../../declarations/WebpackOptions").AssetParserOptions} AssetParserOptions */
/** @typedef {import("../Module").BuildInfo} BuildInfo */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../Parser").ParserState} ParserState */

@@ -34,8 +36,11 @@ /** @typedef {import("../Parser").PreparsedAst} PreparsedAst */

}
state.module.buildInfo.strict = true;
state.module.buildMeta.exportsType = "default";
state.module.buildMeta.defaultObject = false;
const buildInfo = /** @type {BuildInfo} */ (state.module.buildInfo);
buildInfo.strict = true;
const buildMeta = /** @type {BuildMeta} */ (state.module.buildMeta);
buildMeta.exportsType = "default";
buildMeta.defaultObject = false;
if (typeof this.dataUrlCondition === "function") {
state.module.buildInfo.dataUrl = this.dataUrlCondition(source, {
buildInfo.dataUrl = this.dataUrlCondition(source, {
filename: state.module.matchResource || state.module.resource,

@@ -45,3 +50,3 @@ module: state.module

} else if (typeof this.dataUrlCondition === "boolean") {
state.module.buildInfo.dataUrl = this.dataUrlCondition;
buildInfo.dataUrl = this.dataUrlCondition;
} else if (

@@ -51,3 +56,3 @@ this.dataUrlCondition &&

) {
state.module.buildInfo.dataUrl =
buildInfo.dataUrl =
Buffer.byteLength(source) <=

@@ -54,0 +59,0 @@ /** @type {NonNullable<AssetParserDataUrlOptions["maxSize"]>} */

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

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

@@ -25,5 +27,8 @@ /** @typedef {import("../Parser").PreparsedAst} PreparsedAst */

const { module } = state;
module.buildInfo.strict = true;
module.buildMeta.exportsType = "default";
state.module.buildMeta.defaultObject = false;
/** @type {BuildInfo} */
(module.buildInfo).strict = true;
/** @type {BuildMeta} */
(module.buildMeta).exportsType = "default";
/** @type {BuildMeta} */
(state.module.buildMeta).defaultObject = false;

@@ -30,0 +35,0 @@ return state;

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

/**
* @param {AwaitDependenciesInitFragment} other other AwaitDependenciesInitFragment
* @returns {AwaitDependenciesInitFragment} AwaitDependenciesInitFragment
*/
merge(other) {

@@ -34,0 +38,0 @@ const promises = new Set(other.promises);

@@ -24,5 +24,5 @@ /*

/**
* @param {ChunkGroupOptions & { entryOptions?: EntryOptions }} groupOptions options for the group
* @param {DependencyLocation=} loc the line of code
* @param {string=} request the request
* @param {(ChunkGroupOptions & { entryOptions?: EntryOptions }) | null} groupOptions options for the group
* @param {(DependencyLocation | null)=} loc the line of code
* @param {(string | null)=} request the request
*/

@@ -29,0 +29,0 @@ constructor(groupOptions, loc, request) {

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

/** @type {Map<string | typeof BUILD_DEPENDENCIES_KEY, () => Promise>} */
/** @type {Map<string | typeof BUILD_DEPENDENCIES_KEY, () => Promise<void>>} */
const pendingIdleTasks = new Map();

@@ -175,2 +175,3 @@

};
/** @type {ReturnType<typeof setTimeout> | undefined} */
let idleTimer = undefined;

@@ -177,0 +178,0 @@ compiler.cache.hooks.beginIdle.tap(

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

/** @typedef {import("../logging/Logger").Logger} Logger */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */

@@ -62,2 +64,5 @@

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize({ read }) {

@@ -104,3 +109,3 @@ this.version = read();

this.itemInfo = new Map();
/** @type {string[]} */
/** @type {(string | undefined)[]} */
this.requests = [];

@@ -117,2 +122,5 @@ this.requestsTimeout = undefined;

/**
* @param {string} identifier identifier
*/
_addRequest(identifier) {

@@ -156,3 +164,3 @@ this.requests.push(identifier);

}
return this.content[loc].get(identifier);
return /** @type {PackContent} */ (this.content[loc]).get(identifier);
}

@@ -183,3 +191,3 @@ }

this.freshContent.set(identifier, info);
const content = this.content[loc];
const content = /** @type {PackContent} */ (this.content[loc]);
content.delete(identifier);

@@ -360,2 +368,3 @@ if (content.items.size === 0) {

/** @type {PackContent[] } */
const mergedContent = [];

@@ -365,3 +374,3 @@

for (const i of mergedIndices) {
mergedContent.push(this.content[i]);
mergedContent.push(/** @type {PackContent} */ (this.content[i]));
this.content[i] = undefined;

@@ -375,3 +384,3 @@ }

const mergedUsedItems = new Set();
/** @type {(function(Map<string, any>): Promise)[]} */
/** @type {(function(Map<string, any>): Promise<void>)[]} */
const addToMergedMap = [];

@@ -510,3 +519,3 @@ for (const content of mergedContent) {

_gcOldestContent() {
/** @type {PackItemInfo} */
/** @type {PackItemInfo | undefined} */
let oldest = undefined;

@@ -518,6 +527,9 @@ for (const info of this.itemInfo.values()) {

}
if (Date.now() - oldest.lastAccess > this.maxAge) {
const loc = oldest.location;
if (
Date.now() - /** @type {PackItemInfo} */ (oldest).lastAccess >
this.maxAge
) {
const loc = /** @type {PackItemInfo} */ (oldest).location;
if (loc < 0) return;
const content = this.content[loc];
const content = /** @type {PackContent} */ (this.content[loc]);
const items = new Set(content.items);

@@ -785,2 +797,3 @@ const usedItems = new Set(content.used);

const { lazyName } = this;
/** @type {string | undefined} */
let timeMessage;

@@ -826,3 +839,3 @@ if (lazyName) {

* @param {string} reason explanation why unpack is necessary
* @returns {void | Promise} maybe a promise if lazy
* @returns {void | Promise<void>} maybe a promise if lazy
*/

@@ -835,2 +848,3 @@ unpack(reason) {

const { lazyName } = this;
/** @type {string | undefined} */
let timeMessage;

@@ -879,2 +893,5 @@ if (lazyName) {

/**
* @param {string} identifier identifier
*/
delete(identifier) {

@@ -924,2 +941,3 @@ this.items.delete(identifier);

const { lazyName } = this;
/** @type {string | undefined} */
let timeMessage;

@@ -1047,9 +1065,9 @@ if (lazyName) {

this.newBuildDependencies = new LazySet();
/** @type {Snapshot} */
/** @type {Snapshot | undefined} */
this.resolveBuildDependenciesSnapshot = undefined;
/** @type {Map<string, string | false>} */
/** @type {Map<string, string | false> | undefined} */
this.resolveResults = undefined;
/** @type {Snapshot} */
/** @type {Snapshot | undefined} */
this.buildSnapshot = undefined;
/** @type {Promise<Pack>} */
/** @type {Promise<Pack> | undefined} */
this.packPromise = this._openPack();

@@ -1059,2 +1077,5 @@ this.storePromise = Promise.resolve();

/**
* @returns {Promise<Pack>} pack
*/
_getPack() {

@@ -1061,0 +1082,0 @@ if (this.packPromise === undefined) {

@@ -191,3 +191,3 @@ /*

this.runtimeInChunks = undefined;
/** @type {RuntimeSpecMap<ModuleHashInfo>} */
/** @type {RuntimeSpecMap<ModuleHashInfo> | undefined} */
this.hashes = undefined;

@@ -1392,3 +1392,3 @@ /** @type {string | number} */

const cgm = this._getChunkGraphModule(module);
const hashes = cgm.hashes;
const hashes = /** @type {RuntimeSpecMap<ModuleHashInfo>} */ (cgm.hashes);
return hashes && hashes.has(runtime);

@@ -1404,3 +1404,3 @@ }

const cgm = this._getChunkGraphModule(module);
const hashes = cgm.hashes;
const hashes = /** @type {RuntimeSpecMap<ModuleHashInfo>} */ (cgm.hashes);
return this._getModuleHashInfo(module, hashes, runtime).hash;

@@ -1416,3 +1416,3 @@ }

const cgm = this._getChunkGraphModule(module);
const hashes = cgm.hashes;
const hashes = /** @type {RuntimeSpecMap<ModuleHashInfo>} */ (cgm.hashes);
return this._getModuleHashInfo(module, hashes, runtime).renderedHash;

@@ -1419,0 +1419,0 @@ }

@@ -112,5 +112,11 @@ /*

for (const key of Object.keys(options)) {
if (this.options[key] === undefined) {
this.options[key] = options[key];
} else if (this.options[key] !== options[key]) {
if (
this.options[/** @type {keyof ChunkGroupOptions} */ (key)] === undefined
) {
this.options[key] =
options[/** @type {keyof ChunkGroupOptions} */ (key)];
} else if (
this.options[/** @type {keyof ChunkGroupOptions} */ (key)] !==
options[/** @type {keyof ChunkGroupOptions} */ (key)]
) {
if (key.endsWith("Order")) {

@@ -117,0 +123,0 @@ this.options[key] = Math.max(this.options[key], options[key]);

@@ -16,4 +16,7 @@ /*

/** @typedef {import("estree").CallExpression} CallExpression */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */

@@ -47,27 +50,37 @@ const nestedWebpackIdentifierTag = Symbol("nested webpack identifier");

parser.hooks.call.for("require").tap(PLUGIN_NAME, expr => {
// support for browserify style require delegator: "require(o, !0)"
if (expr.arguments.length !== 2) return;
const second = parser.evaluateExpression(expr.arguments[1]);
if (!second.isBoolean()) return;
if (second.asBool() !== true) return;
const dep = new ConstDependency("require", expr.callee.range);
dep.loc = expr.loc;
if (parser.state.current.dependencies.length > 0) {
const last =
parser.state.current.dependencies[
parser.state.current.dependencies.length - 1
];
if (
last.critical &&
last.options &&
last.options.request === "." &&
last.userRequest === "." &&
last.options.recursive
)
parser.state.current.dependencies.pop();
parser.hooks.call.for("require").tap(
PLUGIN_NAME,
/**
* @param {CallExpression} expr call expression
* @returns {boolean | void} true when need to handle
*/
expr => {
// support for browserify style require delegator: "require(o, !0)"
if (expr.arguments.length !== 2) return;
const second = parser.evaluateExpression(expr.arguments[1]);
if (!second.isBoolean()) return;
if (second.asBool() !== true) return;
const dep = new ConstDependency(
"require",
/** @type {Range} */ (expr.callee.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
if (parser.state.current.dependencies.length > 0) {
const last =
parser.state.current.dependencies[
parser.state.current.dependencies.length - 1
];
if (
last.critical &&
last.options &&
last.options.request === "." &&
last.userRequest === "." &&
last.options.recursive
)
parser.state.current.dependencies.pop();
}
parser.state.module.addPresentationalDependency(dep);
return true;
}
parser.state.module.addPresentationalDependency(dep);
return true;
});
);
});

@@ -87,3 +100,5 @@

) {
const newName = `__nested_webpack_require_${statement.range[0]}__`;
const newName = `__nested_webpack_require_${
/** @type {Range} */ (statement.range)[0]
}__`;
parser.tagVariable(

@@ -107,3 +122,5 @@ statement.id.name,

.tap(PLUGIN_NAME, pattern => {
const newName = `__nested_webpack_require_${pattern.range[0]}__`;
const newName = `__nested_webpack_require_${
/** @type {Range} */ (pattern.range)[0]
}__`;
parser.tagVariable(pattern.name, nestedWebpackIdentifierTag, {

@@ -142,4 +159,7 @@ name: newName,

}
const dep = new ConstDependency(name, expr.range);
dep.loc = expr.loc;
const dep = new ConstDependency(
name,
/** @type {Range} */ (expr.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -153,7 +173,7 @@ return true;

const c = comments[0];
if (c.type === "Line" && c.range[0] === 0) {
if (c.type === "Line" && /** @type {Range} */ (c.range)[0] === 0) {
if (parser.state.source.slice(0, 2).toString() !== "#!") return;
// this is a hashbang comment
const dep = new ConstDependency("//", 0);
dep.loc = c.loc;
dep.loc = /** @type {DependencyLocation} */ (c.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -160,0 +180,0 @@ }

@@ -123,3 +123,3 @@ /*

// and_uc: Not supported
// kaios: Not supported
kaios: [3, 0],
node: [12, 17]

@@ -191,3 +191,3 @@ });

// and_uc: Unknown support
// kaios: Unknown support
kaios: [3, 0],
node: [0, 12]

@@ -211,3 +211,3 @@ }),

// and_uc: Unknown support
// kaios: Unknown support
kaios: [2, 5],
node: [6, 0]

@@ -231,3 +231,3 @@ }),

// and_uc: Not supported
// kaios: Not supported
kaios: [3, 0],
node: [10, 4]

@@ -253,3 +253,3 @@ }),

// and_uc: Not supported
// kaios: Not supported
kaios: [3, 0],
node: [12, 17]

@@ -277,3 +277,3 @@ }),

// and_uc: Unknown support
// kaios: Unknown support
kaios: [3, 0],
node: 12

@@ -297,3 +297,3 @@ }),

// and_uc: Not supported
// kaios: Not supported
kaios: [3, 0],
node: 14

@@ -300,0 +300,0 @@ }),

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

ASSET_MODULE_TYPE,
CSS_MODULE_TYPE
CSS_MODULE_TYPE_AUTO,
CSS_MODULE_TYPE,
CSS_MODULE_TYPE_MODULE
} = require("../ModuleTypeConstants");

@@ -712,34 +714,20 @@ const Template = require("../Template");

if (css) {
const cssRule = {
type: CSS_MODULE_TYPE,
resolve: {
fullySpecified: true,
preferRelative: true
}
const resolve = {
fullySpecified: true,
preferRelative: true
};
const cssModulesRule = {
type: "css/module",
resolve: {
fullySpecified: true
}
};
rules.push({
test: /\.css$/i,
oneOf: [
{
test: /\.module\.css$/i,
...cssModulesRule
},
{
...cssRule
}
]
type: CSS_MODULE_TYPE_AUTO,
resolve
});
rules.push({
mimetype: "text/css+module",
...cssModulesRule
type: CSS_MODULE_TYPE_MODULE,
resolve
});
rules.push({
mimetype: "text/css",
...cssRule
type: CSS_MODULE_TYPE,
resolve
});

@@ -746,0 +734,0 @@ }

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -24,0 +24,0 @@ generate() {

@@ -66,3 +66,3 @@ /*

* @property {string=} category
* @property {string[][]=} referencedExports exports referenced from modules (won't be mangled)
* @property {(string[][] | null)=} referencedExports exports referenced from modules (won't be mangled)
* @property {string=} layer

@@ -235,2 +235,5 @@ */

}
if (this.layer) {
identifier += `|layer: ${this.layer}`;
}

@@ -237,0 +240,0 @@ return identifier;

@@ -11,3 +11,11 @@ /*

/** @typedef {import("./Compiler")} Compiler */
class ContextReplacementPlugin {
/**
* @param {RegExp} resourceRegExp A regular expression that determines which files will be selected
* @param {TODO=} newContentResource A new resource to replace the match
* @param {TODO=} newContentRecursive If true, all subdirectories are searched for matches
* @param {TODO=} newContentRegExp A regular expression that determines which files will be selected
*/
constructor(

@@ -53,2 +61,7 @@ resourceRegExp,

/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {

@@ -55,0 +68,0 @@ const resourceRegExp = this.resourceRegExp;

@@ -59,3 +59,3 @@ /*

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -139,2 +139,10 @@ generate() {

const cc = str => str.charCodeAt(0);
const name = uniqueName
? runtimeTemplate.concatenation(
"--webpack-",
{ expr: "uniqueName" },
"-",
{ expr: "chunkId" }
)
: runtimeTemplate.concatenation("--webpack-", { expr: "chunkId" });

@@ -162,14 +170,23 @@ return Template.asString([

withHmr ? "moduleIds = [], " : ""
}i = 0, cc = 1;`,
"try { if(!link) link = loadStylesheet(chunkId); data = link.sheet.cssRules; data = data[data.length - 1].style; } catch(e) { data = getComputedStyle(document.head); }",
`data = data.getPropertyValue(${
uniqueName
? runtimeTemplate.concatenation(
"--webpack-",
{ expr: "uniqueName" },
"-",
{ expr: "chunkId" }
)
: runtimeTemplate.concatenation("--webpack-", { expr: "chunkId" })
});`,
}name = ${name}, i = 0, cc = 1;`,
"try {",
Template.indent([
"if(!link) link = loadStylesheet(chunkId);",
// `link.sheet.rules` for legacy browsers
"var cssRules = link.sheet.cssRules || link.sheet.rules;",
"var j = cssRules.length - 1;",
"while(j > -1 && !data) {",
Template.indent([
"var style = cssRules[j--].style;",
"if(!style) continue;",
`data = style.getPropertyValue(name);`
]),
"}"
]),
"}catch(e){}",
"if(!data) {",
Template.indent([
"data = getComputedStyle(document.head).getPropertyValue(name);"
]),
"}",
"if(!data) return [];",

@@ -176,0 +193,0 @@ "for(; cc; i++) {",

@@ -42,3 +42,3 @@ /*

/^(-\w+-)?animation(-name)?$/i;
const IS_MODULES = /\.module(s)?\.\w+$/i;
const IS_MODULES = /\.module(s)?\.[^.]+$/i;

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

const module = state.module;
/** @type {string | undefined} */
let oldDefaultMode;
if (

@@ -183,2 +187,4 @@ module.type === CSS_MODULE_TYPE_AUTO &&

) {
oldDefaultMode = this.defaultMode;
this.defaultMode = "local";

@@ -1019,2 +1025,6 @@ }

if (oldDefaultMode) {
this.defaultMode = oldDefaultMode;
}
module.buildInfo.strict = true;

@@ -1021,0 +1031,0 @@ module.buildMeta.exportsType = "namespace";

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

class DelegatedModule extends Module {
/**
* @param {string} sourceRequest source request
* @param {TODO} data data
* @param {"require" | "object"} type type
* @param {string} userRequest user request
* @param {string | Module} originalRequest original request
*/
constructor(sourceRequest, data, type, userRequest, originalRequest) {

@@ -55,3 +62,3 @@ super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);

this.originalRequest = originalRequest;
/** @type {ManifestModuleData} */
/** @type {ManifestModuleData | undefined} */
this.delegateData = data;

@@ -115,3 +122,4 @@

build(options, compilation, resolver, fs, callback) {
this.buildMeta = { ...this.delegateData.buildMeta };
const delegateData = /** @type {ManifestModuleData} */ (this.delegateData);
this.buildMeta = { ...delegateData.buildMeta };
this.buildInfo = {};

@@ -124,3 +132,3 @@ this.dependencies.length = 0;

this.addDependency(
new StaticExportsDependency(this.delegateData.exports || true, false)
new StaticExportsDependency(delegateData.exports || true, false)
);

@@ -209,2 +217,6 @@ callback();

/**
* @param {ObjectDeserializerContext} context context\
* @returns {DelegatedModule} DelegatedModule
*/
static deserialize(context) {

@@ -211,0 +223,0 @@ const { read } = context;

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

/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */
// options.source

@@ -24,2 +26,6 @@ // options.type

/**
* @param {NormalModuleFactory} normalModuleFactory the normal module factory
* @returns {void}
*/
apply(normalModuleFactory) {

@@ -26,0 +32,0 @@ const scope = this.options.scope;

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

/**
* @param {AMDDefineDependency} dependency dependency
* @returns {string} variable name
*/
localModuleVar(dependency) {

@@ -192,2 +196,6 @@ return (

/**
* @param {AMDDefineDependency} dependency dependency
* @returns {string} branch
*/
branch(dependency) {

@@ -201,2 +209,8 @@ const localModuleVar = this.localModuleVar(dependency) ? "l" : "";

/**
* @param {AMDDefineDependency} dependency dependency
* @param {ReplaceSource} source source
* @param {string} definition definition
* @param {string} text text
*/
replace(dependency, source, definition, text) {

@@ -222,3 +236,7 @@ const localModuleVar = this.localModuleVar(dependency);

if (dependency.arrayRange) {
source.replace(current, dependency.arrayRange[0] - 1, texts.shift());
source.replace(
current,
dependency.arrayRange[0] - 1,
/** @type {string} */ (texts.shift())
);
current = dependency.arrayRange[1];

@@ -228,9 +246,21 @@ }

if (dependency.objectRange) {
source.replace(current, dependency.objectRange[0] - 1, texts.shift());
source.replace(
current,
dependency.objectRange[0] - 1,
/** @type {string} */ (texts.shift())
);
current = dependency.objectRange[1];
} else if (dependency.functionRange) {
source.replace(current, dependency.functionRange[0] - 1, texts.shift());
source.replace(
current,
dependency.functionRange[0] - 1,
/** @type {string} */ (texts.shift())
);
current = dependency.functionRange[1];
}
source.replace(current, dependency.range[1] - 1, texts.shift());
source.replace(
current,
dependency.range[1] - 1,
/** @type {string} */ (texts.shift())
);
if (texts.length > 0) throw new Error("Implementation error");

@@ -237,0 +267,0 @@ }

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

/** @typedef {import("estree").CallExpression} CallExpression */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/**
* @param {CallExpression} expr expression
* @returns {boolean} true if it's a bound function expression
*/
const isBoundFunctionExpression = expr => {

@@ -23,0 +28,0 @@ if (expr.type !== "CallExpression") return false;

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -39,3 +39,3 @@ generate() {

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -42,0 +42,0 @@ generate() {

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

/** @typedef {import("../ModuleGraph")} ModuleGraph */
/** @typedef {import("../NormalModule")} NormalModule */

@@ -47,3 +48,3 @@ /** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */

* @param {TODO} expr expression
* @returns {Expression} returns the value of property descriptor
* @returns {Expression | undefined} returns the value of property descriptor
*/

@@ -132,2 +133,5 @@ const getValueOfPropertyDescription = expr => {

class CommonJsExportsParserPlugin {
/**
* @param {ModuleGraph} moduleGraph module graph
*/
constructor(moduleGraph) {

@@ -149,3 +153,3 @@ this.moduleGraph = moduleGraph;

* @param {string[]} members members of the export
* @param {Expression} valueExpr expression for the value
* @param {Expression | undefined} valueExpr expression for the value
* @returns {void}

@@ -163,2 +167,5 @@ */

};
/**
* @param {string=} reason reason
*/
const bailout = reason => {

@@ -168,2 +175,5 @@ DynamicExports.bailout(parser.state);

};
/**
* @param {string} reason reason
*/
const bailoutHint = reason => {

@@ -301,4 +311,4 @@ this.moduleGraph

* @param {string[]} members members of the export
* @param {CallExpression} call call expression
* @returns {boolean} true, when the expression was handled
* @param {CallExpression=} call call expression
* @returns {boolean | void} true, when the expression was handled
*/

@@ -305,0 +315,0 @@ const handleAccessExport = (expr, base, members, call = undefined) => {

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

/** @typedef {import("estree").CallExpression} CallExpressionNode */
/** @typedef {import("estree").CallExpression} CallExpression */
/** @typedef {import("estree").Expression} Expression */
/** @typedef {import("estree").NewExpression} NewExpression */
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").ImportSource} ImportSource */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -47,2 +53,6 @@ const createRequireSpecifierTag = Symbol("createRequire");

/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
apply(parser) {

@@ -59,2 +69,6 @@ const options = this.options;

//#region metadata
/**
* @param {TODO} expression expression
* @param {() => string[]} getMembers get members
*/
const tapRequireExpression = (expression, getMembers) => {

@@ -77,2 +91,5 @@ parser.hooks.typeof

};
/**
* @param {string | symbol} tag tag
*/
const tapRequireExpressionTag = tag => {

@@ -100,3 +117,3 @@ parser.hooks.typeof

const dep = new ConstDependency("var require;", 0);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -146,6 +163,13 @@ return true;

//#region Renaming
/**
* @param {Expression} expr expression
* @returns {boolean} true when set undefined
*/
const defineUndefined = expr => {
// To avoid "not defined" error, replace the value with undefined
const dep = new ConstDependency("undefined", expr.range);
dep.loc = expr.loc;
const dep = new ConstDependency(
"undefined",
/** @type {Range} */ (expr.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -179,2 +203,6 @@ return false;

//#region Require as expression
/**
* @param {Expression} expr expression
* @returns {boolean} true when handled
*/
const requireAsExpressionHandler = expr => {

@@ -188,3 +216,3 @@ const dep = new CommonJsRequireContextDependency(

},
expr.range,
/** @type {Range} */ (expr.range),
undefined,

@@ -197,3 +225,3 @@ parser.scope.inShorthand,

"require function is used in a way in which dependencies cannot be statically extracted";
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = !!parser.scope.inTry;

@@ -209,10 +237,15 @@ parser.state.current.addDependency(dep);

//#region Require
/**
* @param {CallExpression | NewExpression} expr expression
* @param {BasicEvaluatedExpression} param param
* @returns {boolean | void} true when handled
*/
const processRequireItem = (expr, param) => {
if (param.isString()) {
const dep = new CommonJsRequireDependency(
param.string,
param.range,
/** @type {string} */ (param.string),
/** @type {Range} */ (param.range),
getContext()
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = !!parser.scope.inTry;

@@ -223,6 +256,11 @@ parser.state.current.addDependency(dep);

};
/**
* @param {CallExpression | NewExpression} expr expression
* @param {BasicEvaluatedExpression} param param
* @returns {boolean | void} true when handled
*/
const processRequireContext = (expr, param) => {
const dep = ContextDependencyHelpers.create(
CommonJsRequireContextDependency,
expr.range,
/** @type {Range} */ (expr.range),
param,

@@ -239,3 +277,3 @@ expr,

if (!dep) return;
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = !!parser.scope.inTry;

@@ -245,6 +283,10 @@ parser.state.current.addDependency(dep);

};
/**
* @param {boolean} callNew true, when require is called with new
* @returns {(expr: CallExpression | NewExpression) => (boolean | void)} handler
*/
const createRequireHandler = callNew => expr => {
if (options.commonjsMagicComments) {
const { options: requireOptions, errors: commentErrors } =
parser.parseCommentOptions(expr.range);
parser.parseCommentOptions(/** @type {Range} */ (expr.range));

@@ -268,3 +310,3 @@ if (commentErrors) {

`\`webpackIgnore\` expected a boolean, but received: ${requireOptions.webpackIgnore}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -287,3 +329,5 @@ );

let isExpression = false;
for (const p of param.options) {
for (const p of /** @type {BasicEvaluatedExpression[]} */ (
param.options
)) {
const result = processRequireItem(expr, p);

@@ -295,4 +339,6 @@ if (result === undefined) {

if (!isExpression) {
const dep = new RequireHeaderDependency(expr.callee.range);
dep.loc = expr.loc;
const dep = new RequireHeaderDependency(
/** @type {Range} */ (expr.callee.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -304,7 +350,14 @@ return true;

param.isString() &&
(localModule = getLocalModule(parser.state, param.string))
(localModule = getLocalModule(
parser.state,
/** @type {string} */ (param.string)
))
) {
localModule.flagUsed();
const dep = new LocalModuleDependency(localModule, expr.range, callNew);
dep.loc = expr.loc;
const dep = new LocalModuleDependency(
localModule,
/** @type {Range} */ (expr.range),
callNew
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -317,4 +370,6 @@ return true;

} else {
const dep = new RequireHeaderDependency(expr.callee.range);
dep.loc = expr.loc;
const dep = new RequireHeaderDependency(
/** @type {Range} */ (expr.callee.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -340,14 +395,26 @@ }

//#region Require with property access
/**
* @param {Expression} expr expression
* @param {string[]} calleeMembers callee members
* @param {CallExpression} callExpr call expression
* @param {string[]} members members
* @returns {boolean | void} true when handled
*/
const chainHandler = (expr, calleeMembers, callExpr, members) => {
if (callExpr.arguments.length !== 1) return;
const param = parser.evaluateExpression(callExpr.arguments[0]);
if (param.isString() && !getLocalModule(parser.state, param.string)) {
if (
param.isString() &&
!getLocalModule(parser.state, /** @type {string} */ (param.string))
) {
const dep = new CommonJsFullRequireDependency(
param.string,
expr.range,
/** @type {string} */ (param.string),
/** @type {Range} */ (expr.range),
members
);
dep.asiSafe = !parser.isAsiPosition(expr.range[0]);
dep.asiSafe = !parser.isAsiPosition(
/** @type {Range} */ (expr.range)[0]
);
dep.optional = !!parser.scope.inTry;
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.current.addDependency(dep);

@@ -357,15 +424,27 @@ return true;

};
/**
* @param {CallExpression} expr expression
* @param {string[]} calleeMembers callee members
* @param {CallExpression} callExpr call expression
* @param {string[]} members members
* @returns {boolean | void} true when handled
*/
const callChainHandler = (expr, calleeMembers, callExpr, members) => {
if (callExpr.arguments.length !== 1) return;
const param = parser.evaluateExpression(callExpr.arguments[0]);
if (param.isString() && !getLocalModule(parser.state, param.string)) {
if (
param.isString() &&
!getLocalModule(parser.state, /** @type {string} */ (param.string))
) {
const dep = new CommonJsFullRequireDependency(
param.string,
expr.callee.range,
/** @type {string} */ (param.string),
/** @type {Range} */ (expr.callee.range),
members
);
dep.call = true;
dep.asiSafe = !parser.isAsiPosition(expr.range[0]);
dep.asiSafe = !parser.isAsiPosition(
/** @type {Range} */ (expr.range)[0]
);
dep.optional = !!parser.scope.inTry;
dep.loc = expr.callee.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.callee.loc);
parser.state.current.addDependency(dep);

@@ -391,2 +470,7 @@ parser.walkExpressions(expr.arguments);

//#region Require.resolve
/**
* @param {CallExpression} expr call expression
* @param {boolean} weak weak
* @returns {boolean | void} true when handled
*/
const processResolve = (expr, weak) => {

@@ -396,3 +480,5 @@ if (expr.arguments.length !== 1) return;

if (param.isConditional()) {
for (const option of param.options) {
for (const option of /** @type {BasicEvaluatedExpression[]} */ (
param.options
)) {
const result = processResolveItem(expr, option, weak);

@@ -403,4 +489,6 @@ if (result === undefined) {

}
const dep = new RequireResolveHeaderDependency(expr.callee.range);
dep.loc = expr.loc;
const dep = new RequireResolveHeaderDependency(
/** @type {Range} */ (expr.callee.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -413,4 +501,6 @@ return true;

}
const dep = new RequireResolveHeaderDependency(expr.callee.range);
dep.loc = expr.loc;
const dep = new RequireResolveHeaderDependency(
/** @type {Range} */ (expr.callee.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -420,10 +510,16 @@ return true;

};
/**
* @param {CallExpression} expr call expression
* @param {BasicEvaluatedExpression} param param
* @param {boolean} weak weak
* @returns {boolean | void} true when handled
*/
const processResolveItem = (expr, param, weak) => {
if (param.isString()) {
const dep = new RequireResolveDependency(
param.string,
param.range,
/** @type {string} */ (param.string),
/** @type {Range} */ (param.range),
getContext()
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = !!parser.scope.inTry;

@@ -435,6 +531,12 @@ dep.weak = weak;

};
/**
* @param {CallExpression} expr call expression
* @param {BasicEvaluatedExpression} param param
* @param {boolean} weak weak
* @returns {boolean | void} true when handled
*/
const processResolveContext = (expr, param, weak) => {
const dep = ContextDependencyHelpers.create(
RequireResolveContextDependency,
param.range,
/** @type {Range} */ (param.range),
param,

@@ -451,3 +553,3 @@ expr,

if (!dep) return;
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = !!parser.scope.inTry;

@@ -474,3 +576,5 @@ parser.state.current.addDependency(dep);

/** @type {ImportSource[]} */
let moduleName = [];
/** @type {string | undefined} */
let specifierName;

@@ -512,5 +616,9 @@

return new BasicEvaluatedExpression()
.setIdentifier(ident, ident, () => [])
.setIdentifier(
/** @type {TODO} */ (ident),
/** @type {TODO} */ (ident),
() => []
)
.setSideEffects(false)
.setRange(expr.range);
.setRange(/** @type {Range} */ (expr.range));
});

@@ -541,4 +649,4 @@ parser.hooks.unhandledExpressionMemberChain

/**
* @param {CallExpressionNode} expr call expression
* @returns {string} context
* @param {CallExpression} expr call expression
* @returns {string | void} context
*/

@@ -551,3 +659,3 @@ const parseCreateRequireArguments = expr => {

);
err.loc = expr.loc;
err.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addWarning(err);

@@ -562,9 +670,9 @@ return;

);
err.loc = arg.loc;
err.loc = /** @type {DependencyLocation} */ (arg.loc);
parser.state.module.addWarning(err);
return;
}
const ctx = evaluated.string.startsWith("file://")
? fileURLToPath(evaluated.string)
: evaluated.string;
const ctx = /** @type {string} */ (evaluated.string).startsWith("file://")
? fileURLToPath(/** @type {string} */ (evaluated.string))
: /** @type {string} */ (evaluated.string);
// argument always should be a filename

@@ -591,8 +699,10 @@ return ctx.slice(0, ctx.lastIndexOf(ctx.startsWith("/") ? "/" : "\\"));

const clearDep = new ConstDependency(
parser.isAsiPosition(statement.range[0]) ? ";" : "",
statement.range
parser.isAsiPosition(/** @type {Range} */ (statement.range)[0])
? ";"
: "",
/** @type {Range} */ (statement.range)
);
clearDep.loc = statement.loc;
clearDep.loc = /** @type {DependencyLocation} */ (statement.loc);
parser.state.module.addPresentationalDependency(clearDep);
parser.unsetAsiPosition(statement.range[1]);
parser.unsetAsiPosition(/** @type {Range} */ (statement.range)[1]);
return true;

@@ -622,5 +732,5 @@ }

return;
const variableInfo = parser.getVariableInfo(
declarator.init.callee.name
);
const variableInfo =
/** @type {TODO} */
(parser.getVariableInfo(declarator.init.callee.name));
if (

@@ -695,5 +805,5 @@ variableInfo &&

"/* createRequire() */ undefined",
expr.range
/** @type {Range} */ (expr.range)
);
clearDep.loc = expr.loc;
clearDep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(clearDep);

@@ -700,0 +810,0 @@ return true;

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

/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("../Compilation")} Compilation */
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../Module").BuildInfo} BuildInfo */
/** @typedef {import("../javascript/JavascriptParser")} Parser */

@@ -203,3 +206,4 @@

.tap(PLUGIN_NAME, expr => {
parser.state.module.buildInfo.moduleConcatenationBailout =
/** @type {BuildInfo} */
(parser.state.module.buildInfo).moduleConcatenationBailout =
RuntimeGlobals.moduleLoaded;

@@ -209,3 +213,3 @@ const dep = new RuntimeRequirementsDependency([

]);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -218,3 +222,4 @@ return true;

.tap(PLUGIN_NAME, expr => {
parser.state.module.buildInfo.moduleConcatenationBailout =
/** @type {BuildInfo} */
(parser.state.module.buildInfo).moduleConcatenationBailout =
RuntimeGlobals.moduleId;

@@ -224,3 +229,3 @@ const dep = new RuntimeRequirementsDependency([

]);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -258,6 +263,6 @@ return true;

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/
generate() {
const { runtimeTemplate } = this.compilation;
const { runtimeTemplate } = /** @type {Compilation} */ (this.compilation);
return Template.asString([

@@ -289,6 +294,6 @@ `${

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/
generate() {
const { runtimeTemplate } = this.compilation;
const { runtimeTemplate } = /** @type {Compilation} */ (this.compilation);
return Template.asString([

@@ -295,0 +300,0 @@ `${RuntimeGlobals.nodeModuleDecorator} = ${runtimeTemplate.basicFunction(

@@ -20,4 +20,4 @@ /*

* @param {Range} range location in source code
* @param {Range} valueRange location of the require call
* @param {boolean} inShorthand true, if the require call is in shorthand notation
* @param {Range | undefined} valueRange location of the require call
* @param {boolean | string } inShorthand true or name
* @param {string} context context

@@ -24,0 +24,0 @@ */

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

/**
* @param {RegExp | null | undefined} r regexp
* @returns {string} stringified regexp
*/
const regExpToString = r => (r ? r + "" : "");

@@ -39,3 +43,3 @@

this.userRequest = this.options && this.options.request;
/** @type {false | string} */
/** @type {false | undefined | string} */
this.critical = false;

@@ -55,2 +59,3 @@ this.hadGlobalOrStickyRegExp = false;

this.valueRange = undefined;
/** @type {boolean | string | undefined} */
this.inShorthand = undefined;

@@ -99,3 +104,3 @@ // TODO refactor this

* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[]} warnings
* @returns {WebpackError[] | null | undefined} warnings
*/

@@ -102,0 +107,0 @@ getWarnings(moduleGraph) {

@@ -77,3 +77,3 @@ /*

* @param {string} context context directory
* @returns {Module} a module
* @returns {Module | null} a module
*/

@@ -80,0 +80,0 @@ createIgnoredModule(context) {

@@ -78,2 +78,7 @@ /*

/**
* @param {string} str string
* @param {string | boolean} omitUnderscore true if you need to omit underscore
* @returns {string} escaped css identifier
*/
const escapeCssIdentifier = (str, omitUnderscore) => {

@@ -80,0 +85,0 @@ const escaped = `${str}`.replace(

@@ -51,3 +51,3 @@ /*

* @param {string} context context directory
* @returns {Module} a module
* @returns {Module | null} a module
*/

@@ -137,3 +137,3 @@ createIgnoredModule(context) {

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

@@ -147,3 +147,3 @@ })

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

@@ -150,0 +150,0 @@ })

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

/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./EntryDependency")} EntryDependency */
class DllEntryDependency extends Dependency {
/**
* @param {EntryDependency[]} dependencies dependencies
* @param {string} name name
*/
constructor(dependencies, name) {

@@ -17,0 +22,0 @@ super();

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

/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../Parser").ParserState} ParserState */

@@ -22,4 +23,5 @@

if (value === true) {
parserState.module.buildMeta.exportsType = undefined;
parserState.module.buildMeta.defaultObject = false;
const buildMeta = /** @type {BuildMeta} */ (parserState.module.buildMeta);
buildMeta.exportsType = undefined;
buildMeta.defaultObject = false;
}

@@ -37,4 +39,5 @@ };

if (value !== true) {
parserState.module.buildMeta.exportsType = "default";
parserState.module.buildMeta.defaultObject = "redirect";
const buildMeta = /** @type {BuildMeta} */ (parserState.module.buildMeta);
buildMeta.exportsType = "default";
buildMeta.defaultObject = "redirect";
}

@@ -50,3 +53,3 @@ };

if (value !== true) return;
const buildMeta = parserState.module.buildMeta;
const buildMeta = /** @type {BuildMeta} */ (parserState.module.buildMeta);
if (buildMeta.exportsType === "dynamic") return;

@@ -63,3 +66,4 @@ buildMeta.exportsType = "flagged";

if (value !== true) return;
parserState.module.buildMeta.exportsType = "dynamic";
/** @type {BuildMeta} */
(parserState.module.buildMeta).exportsType = "dynamic";
};

@@ -66,0 +70,0 @@

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

const exportsInfo = moduleGraph.getExportsInfo(module);
const exportInfo = exportsInfo.getExportInfo(exportName);
const exportInfo = exportsInfo.getExportInfo(
/** @type {string} */ (exportName)
);
if (exportInfo) return exportInfo.canMangle;

@@ -61,3 +63,5 @@ return exportsInfo.otherExportsInfo.canMangle;

return (
moduleGraph.getExportsInfo(module).getUsed(exportName, runtime) !==
moduleGraph
.getExportsInfo(module)
.getUsed(/** @type {string} */ (exportName), runtime) !==
UsageState.Unused

@@ -68,3 +72,3 @@ );

.getExportsInfo(module)
.getUsed(exportName, runtime);
.getUsed(/** @type {string} */ (exportName), runtime);
switch (state) {

@@ -85,3 +89,5 @@ case UsageState.Used:

case "provideInfo":
return moduleGraph.getExportsInfo(module).isExportProvided(exportName);
return moduleGraph
.getExportsInfo(module)
.isExportProvided(/** @type {string} */ (exportName));
}

@@ -115,2 +121,6 @@ return undefined;

/**
* @param {ObjectDeserializerContext} context context
* @returns {ExportsInfoDependency} ExportsInfoDependency
*/
static deserialize(context) {

@@ -117,0 +127,0 @@ const obj = new ExportsInfoDependency(

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

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

@@ -84,3 +85,3 @@ class HarmonyCompatibilityDependency extends NullDependency {

`\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }${
module.buildMeta.async ? ", 1" : ""
/** @type {BuildMeta} */ (module.buildMeta).async ? ", 1" : ""
});`

@@ -87,0 +88,0 @@ )

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

/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */

@@ -76,3 +77,4 @@ /** @typedef {import("./HarmonyModulesPlugin").HarmonyModulesPluginOptions} HarmonyModulesPluginOptions */

}
module.buildMeta.async = true;
/** @type {BuildMeta} */
(module.buildMeta).async = true;
});

@@ -79,0 +81,0 @@

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

/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
/** @typedef {import("../javascript/JavascriptParser").Assertions} Assertions */

@@ -89,3 +91,5 @@ /** @typedef {import("../javascript/JavascriptParser").Range} Range */

const exportsInfo = moduleGraph.getExportsInfo(connection.module);
const exportsInfo = moduleGraph.getExportsInfo(
/** @type {ModuleGraphConnection} */ (connection).module
);
const ids = dep.getIds(moduleGraph);

@@ -95,6 +99,9 @@

const exportsType = connection.module.getExportsType(
moduleGraph,
module.buildMeta.strictHarmonyModule
);
const exportsType =
/** @type {ModuleGraphConnection} */
(connection).module.getExportsType(
moduleGraph,
/** @type {BuildMeta} */
(module.buildMeta).strictHarmonyModule
);
switch (exportsType) {

@@ -101,0 +108,0 @@ case "default-with-named": {

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

/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency;

@@ -23,0 +25,0 @@

@@ -333,5 +333,5 @@ /*

* @param {Set<string>} activeExports other named exports in the module
* @param {ReadonlyArray<HarmonyExportImportedSpecifierDependency> | Iterable<HarmonyExportImportedSpecifierDependency>} otherStarExports other star exports in the module before this import
* @param {ReadonlyArray<HarmonyExportImportedSpecifierDependency> | Iterable<HarmonyExportImportedSpecifierDependency> | null} otherStarExports other star exports in the module before this import
* @param {number} exportPresenceMode mode of checking export names
* @param {HarmonyStarExportsList} allStarExports all star exports in the module
* @param {HarmonyStarExportsList | null} allStarExports all star exports in the module
* @param {Assertions=} assertions import assertions

@@ -760,3 +760,3 @@ */

* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[]} warnings
* @returns {WebpackError[] | null | undefined} warnings
*/

@@ -774,3 +774,3 @@ getWarnings(moduleGraph) {

* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[]} errors
* @returns {WebpackError[] | null | undefined} errors
*/

@@ -777,0 +777,0 @@ getErrors(moduleGraph) {

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

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

@@ -26,8 +28,10 @@

if (value !== true) {
parserState.module.buildMeta.exportsType = "namespace";
parserState.module.buildInfo.strict = true;
parserState.module.buildInfo.exportsArgument = RuntimeGlobals.exports;
const buildMeta = /** @type {BuildMeta} */ (parserState.module.buildMeta);
buildMeta.exportsType = "namespace";
const buildInfo = /** @type {BuildInfo} */ (parserState.module.buildInfo);
buildInfo.strict = true;
buildInfo.exportsArgument = RuntimeGlobals.exports;
if (isStrictHarmony) {
parserState.module.buildMeta.strictHarmonyModule = true;
parserState.module.buildInfo.moduleArgument = "__webpack_module__";
buildMeta.strictHarmonyModule = true;
buildInfo.moduleArgument = "__webpack_module__";
}

@@ -34,0 +38,0 @@ }

@@ -24,4 +24,8 @@ /*

/** @typedef {import("estree").ImportExpression} ImportExpression */
/** @typedef {import("estree").MemberExpression} MemberExpression */
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */

@@ -117,8 +121,10 @@ /** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */

const clearDep = new ConstDependency(
parser.isAsiPosition(statement.range[0]) ? ";" : "",
statement.range
parser.isAsiPosition(/** @type {Range} */ (statement.range)[0])
? ";"
: "",
/** @type {Range} */ (statement.range)
);
clearDep.loc = statement.loc;
clearDep.loc = /** @type {DependencyLocation} */ (statement.loc);
parser.state.module.addPresentationalDependency(clearDep);
parser.unsetAsiPosition(statement.range[1]);
parser.unsetAsiPosition(/** @type {Range} */ (statement.range)[1]);
const assertions = getAssertions(statement);

@@ -130,3 +136,3 @@ const sideEffectDep = new HarmonyImportSideEffectDependency(

);
sideEffectDep.loc = statement.loc;
sideEffectDep.loc = /** @type {DependencyLocation} */ (statement.loc);
parser.state.module.addDependency(sideEffectDep);

@@ -178,3 +184,3 @@ return true;

settings.name,
expression.range,
/** @type {Range} */ (expression.range),
settings.assertions,

@@ -184,4 +190,6 @@ "in"

dep.directImport = members.length === 0;
dep.asiSafe = !parser.isAsiPosition(expression.range[0]);
dep.loc = expression.loc;
dep.asiSafe = !parser.isAsiPosition(
/** @type {Range} */ (expression.range)[0]
);
dep.loc = /** @type {DependencyLocation} */ (expression.loc);
parser.state.module.addDependency(dep);

@@ -201,3 +209,3 @@ InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));

settings.name,
expr.range,
/** @type {Range} */ (expr.range),
exportPresenceMode,

@@ -211,4 +219,7 @@ settings.assertions,

dep.directImport = true;
dep.asiSafe = !parser.isAsiPosition(expr.range[0]);
dep.loc = expr.loc;
dep.asiSafe = !parser.isAsiPosition(
/** @type {Range} */ (expr.range)[0]
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.call = parser.scope.inTaggedTemplateTag;
parser.state.module.addDependency(dep);

@@ -247,3 +258,3 @@ InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));

settings.name,
expr.range,
/** @type {Range} */ (expr.range),
exportPresenceMode,

@@ -255,4 +266,6 @@ settings.assertions,

parser.destructuringAssignmentPropertiesFor(expr);
dep.asiSafe = !parser.isAsiPosition(expr.range[0]);
dep.loc = expr.loc;
dep.asiSafe = !parser.isAsiPosition(
/** @type {Range} */ (expr.range)[0]
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);

@@ -293,3 +306,3 @@ InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));

settings.name,
expr.range,
/** @type {Range} */ (expr.range),
exportPresenceMode,

@@ -301,7 +314,9 @@ settings.assertions,

dep.call = true;
dep.asiSafe = !parser.isAsiPosition(expr.range[0]);
dep.asiSafe = !parser.isAsiPosition(
/** @type {Range} */ (expr.range)[0]
);
// only in case when we strictly follow the spec we need a special case here
dep.namespaceObjectAsContext =
members.length > 0 && this.strictThisContextOnImports;
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);

@@ -308,0 +323,0 @@ if (args) parser.walkExpressions(args);

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

/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
/** @typedef {import("../InitFragment")} InitFragment */
/** @typedef {import("../Module")} Module */

@@ -78,3 +77,3 @@ /** @typedef {import("../ModuleGraph")} ModuleGraph */

if (concatenationScope) {
const module = moduleGraph.getModule(dependency);
const module = /** @type {Module} */ (moduleGraph.getModule(dependency));
if (concatenationScope.isModuleInScope(module)) {

@@ -81,0 +80,0 @@ return;

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

/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../ModuleGraph")} ModuleGraph */

@@ -65,2 +67,3 @@ /** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */

this.exportPresenceMode = exportPresenceMode;
/** @type {boolean | undefined} */
this.namespaceObjectAsContext = false;

@@ -71,5 +74,5 @@ this.call = undefined;

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

@@ -149,7 +152,10 @@ }

const selfModule = moduleGraph.getParentModule(this);
const importedModule = moduleGraph.getModule(this);
const importedModule =
/** @type {Module} */
(moduleGraph.getModule(this));
switch (
importedModule.getExportsType(
moduleGraph,
selfModule.buildMeta.strictHarmonyModule
/** @type {BuildMeta} */
(selfModule.buildMeta).strictHarmonyModule
)

@@ -208,3 +214,6 @@ ) {

return this.exportPresenceMode;
return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule
const buildMeta = /** @type {BuildMeta} */ (
moduleGraph.getParentModule(this).buildMeta
);
return buildMeta.strictHarmonyModule
? ExportPresenceModes.ERROR

@@ -217,3 +226,3 @@ : ExportPresenceModes.WARN;

* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[]} warnings
* @returns {WebpackError[] | null | undefined} warnings
*/

@@ -231,3 +240,3 @@ getWarnings(moduleGraph) {

* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[]} errors
* @returns {WebpackError[] | null | undefined} errors
*/

@@ -372,5 +381,6 @@ getErrors(moduleGraph) {

_trimIdsToThoseImported(ids, moduleGraph, dependency) {
/** @type {string[]} */
let trimmedIds = [];
const exportsInfo = moduleGraph.getExportsInfo(
moduleGraph.getModule(dependency)
/** @type {Module} */ (moduleGraph.getModule(dependency))
);

@@ -448,3 +458,3 @@ let currentExportsInfo = /** @type {ExportsInfo=} */ exportsInfo;

moduleGraph,
module: moduleGraph.getModule(dep),
module: /** @type {Module} */ (moduleGraph.getModule(dep)),
request: dep.request,

@@ -451,0 +461,0 @@ exportName: ids,

@@ -11,3 +11,11 @@ /*

/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
class HarmonyTopLevelThisParserPlugin {
/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
apply(parser) {

@@ -19,6 +27,10 @@ parser.hooks.expression

if (HarmonyExports.isEnabled(parser.state)) {
const dep = new ConstDependency("undefined", node.range, null);
dep.loc = node.loc;
const dep = new ConstDependency(
"undefined",
/** @type {Range} */ (node.range),
null
);
dep.loc = /** @type {DependencyLocation} */ (node.loc);
parser.state.module.addPresentationalDependency(dep);
return this;
return true;
}

@@ -25,0 +37,0 @@ });

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

/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../ModuleGraph")} ModuleGraph */

@@ -27,3 +29,3 @@ /** @typedef {import("../javascript/JavascriptParser").Range} Range */

* @param {Range} range expression range
* @param {string[][]=} referencedExports list of referenced exports
* @param {(string[][] | null)=} referencedExports list of referenced exports
*/

@@ -101,5 +103,5 @@ constructor(request, range, referencedExports) {

block: block,
module: moduleGraph.getModule(dep),
module: /** @type {Module} */ (moduleGraph.getModule(dep)),
request: dep.request,
strict: module.buildMeta.strictHarmonyModule,
strict: /** @type {BuildMeta} */ (module.buildMeta).strictHarmonyModule,
message: "import()",

@@ -106,0 +108,0 @@ runtimeRequirements

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

/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../ModuleGraph")} ModuleGraph */

@@ -23,3 +25,3 @@ /** @typedef {import("../javascript/JavascriptParser").Range} Range */

* @param {Range} range expression range
* @param {string[][]=} referencedExports list of referenced exports
* @param {(string[][] | null)=} referencedExports list of referenced exports
*/

@@ -61,5 +63,5 @@ constructor(request, range, referencedExports) {

chunkGraph,
module: moduleGraph.getModule(dep),
module: /** @type {Module} */ (moduleGraph.getModule(dep)),
request: dep.request,
strict: module.buildMeta.strictHarmonyModule,
strict: /** @type {BuildMeta} */ (module.buildMeta).strictHarmonyModule,
message: "import() eager",

@@ -66,0 +68,0 @@ runtimeRequirements

@@ -29,4 +29,6 @@ /*

/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../NormalModule")} NormalModule */
/** @typedef {import("../javascript/JavascriptParser")} Parser */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -68,6 +70,6 @@ const getCriticalDependencyWarning = memoize(() =>

const dep = new ConstDependency(
importMetaName,
metaProperty.range
/** @type {string} */ (importMetaName),
/** @type {Range} */ (metaProperty.range)
);
dep.loc = metaProperty.loc;
dep.loc = /** @type {DependencyLocation} */ (metaProperty.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -87,2 +89,6 @@ return true;

const importMetaWebpackVersion = () => JSON.stringify(webpackVersion);
/**
* @param {string[]} members members
* @returns {string} error message
*/
const importMetaUnknownProperty = members =>

@@ -112,3 +118,3 @@ `${Template.toNormalComment(

),
metaProperty.loc
/** @type {DependencyLocation} */ (metaProperty.loc)
)

@@ -118,7 +124,11 @@ );

`${
parser.isAsiPosition(metaProperty.range[0]) ? ";" : ""
parser.isAsiPosition(
/** @type {Range} */ (metaProperty.range)[0]
)
? ";"
: ""
}({})`,
metaProperty.range
/** @type {Range} */ (metaProperty.range)
);
dep.loc = metaProperty.loc;
dep.loc = /** @type {DependencyLocation} */ (metaProperty.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -144,4 +154,7 @@ return true;

}
const dep = new ConstDependency(`({${str}})`, metaProperty.range);
dep.loc = metaProperty.loc;
const dep = new ConstDependency(
`({${str}})`,
/** @type {Range} */ (metaProperty.range)
);
dep.loc = /** @type {DependencyLocation} */ (metaProperty.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -168,4 +181,7 @@ return true;

.tap(PLUGIN_NAME, expr => {
const dep = new ConstDependency(importMetaUrl(), expr.range);
dep.loc = expr.loc;
const dep = new ConstDependency(
importMetaUrl(),
/** @type {Range} */ (expr.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -182,3 +198,3 @@ return true;

.setString(getUrl(parser.state.module))
.setRange(expr.range);
.setRange(/** @type {Range} */ (expr.range));
});

@@ -212,5 +228,5 @@

importMetaUnknownProperty(members),
expr.range
/** @type {Range} */ (expr.range)
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -232,3 +248,3 @@ return true;

.setUndefined()
.setRange(expr.range);
.setRange(/** @type {Range} */ (expr.range));
}

@@ -235,0 +251,0 @@ });

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

/** @typedef {import("../ContextModule").ContextMode} ContextMode */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -36,2 +39,7 @@ class ImportParserPlugin {

apply(parser) {
/**
* @template T
* @param {Iterable<T>} enumerable enumerable
* @returns {T[][]} array of array
*/
const exportsFromEnumerable = enumerable =>

@@ -43,4 +51,3 @@ Array.from(enumerable, e => [e]);

let chunkName = null;
/** @type {ContextMode} */
let mode = this.options.dynamicImportMode;
let mode = /** @type {ContextMode} */ (this.options.dynamicImportMode);
let include = null;

@@ -74,3 +81,3 @@ let exclude = null;

const { options: importOptions, errors: commentErrors } =
parser.parseCommentOptions(expr.range);
parser.parseCommentOptions(/** @type {Range} */ (expr.range));

@@ -95,3 +102,3 @@ if (commentErrors) {

`\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -111,3 +118,3 @@ );

`\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -124,3 +131,3 @@ );

`\`webpackMode\` expected a string, but received: ${importOptions.webpackMode}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -141,3 +148,3 @@ );

`\`webpackPrefetch\` expected true or a number, but received: ${importOptions.webpackPrefetch}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -156,3 +163,3 @@ );

`\`webpackPreload\` expected true or a number, but received: ${importOptions.webpackPreload}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -172,3 +179,3 @@ );

`\`webpackFetchPriority\` expected true or "low", "high" or "auto", but received: ${importOptions.webpackFetchPriority}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -186,3 +193,3 @@ );

`\`webpackInclude\` expected a regular expression, but received: ${importOptions.webpackInclude}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -202,3 +209,3 @@ );

`\`webpackExclude\` expected a regular expression, but received: ${importOptions.webpackExclude}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -215,3 +222,3 @@ );

(Array.isArray(importOptions.webpackExports) &&
importOptions.webpackExports.every(
/** @type {string[]} */ (importOptions.webpackExports).every(
item => typeof item === "string"

@@ -224,3 +231,3 @@ ))

`\`webpackExports\` expected a string or an array of strings, but received: ${importOptions.webpackExports}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -247,3 +254,3 @@ );

`\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -261,3 +268,3 @@ );

`\`webpackExports\` could not be used with destructuring assignment.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -272,4 +279,4 @@ );

const dep = new ImportEagerDependency(
param.string,
expr.range,
/** @type {string} */ (param.string),
/** @type {Range} */ (expr.range),
exports

@@ -280,4 +287,4 @@ );

const dep = new ImportWeakDependency(
param.string,
expr.range,
/** @type {string} */ (param.string),
/** @type {Range} */ (expr.range),
exports

@@ -292,7 +299,11 @@ );

},
expr.loc,
/** @type {DependencyLocation} */ (expr.loc),
param.string
);
const dep = new ImportDependency(param.string, expr.range, exports);
dep.loc = expr.loc;
const dep = new ImportDependency(
/** @type {string} */ (param.string),
/** @type {Range} */ (expr.range),
exports
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
depBlock.addDependency(dep);

@@ -308,3 +319,3 @@ parser.state.current.addBlock(depBlock);

ImportContextDependency,
expr.range,
/** @type {Range} */ (expr.range),
param,

@@ -319,3 +330,5 @@ expr,

mode,
namespaceObject: parser.state.module.buildMeta.strictHarmonyModule
namespaceObject: /** @type {BuildMeta} */ (
parser.state.module.buildMeta
).strictHarmonyModule
? "strict"

@@ -330,3 +343,3 @@ : true,

if (!dep) return;
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = !!parser.scope.inTry;

@@ -333,0 +346,0 @@ parser.state.current.addDependency(dep);

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

/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../ModuleGraph")} ModuleGraph */

@@ -23,3 +25,3 @@ /** @typedef {import("../javascript/JavascriptParser").Range} Range */

* @param {Range} range expression range
* @param {string[][]=} referencedExports list of referenced exports
* @param {(string[][] | null)=} referencedExports list of referenced exports
*/

@@ -58,5 +60,5 @@ constructor(request, range, referencedExports) {

chunkGraph,
module: moduleGraph.getModule(dep),
module: /** @type {Module} */ (moduleGraph.getModule(dep)),
request: dep.request,
strict: module.buildMeta.strictHarmonyModule,
strict: /** @type {BuildMeta} */ (module.buildMeta).strictHarmonyModule,
message: "import() weak",

@@ -63,0 +65,0 @@ weak: true,

@@ -61,3 +61,3 @@ /*

* @param {string} context context directory
* @returns {Module} a module
* @returns {Module | null} a module
*/

@@ -64,0 +64,0 @@ createIgnoredModule(context) {

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

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

@@ -26,3 +27,3 @@ class ModuleDependencyTemplateAsId extends ModuleDependency.Template {

const content = runtimeTemplate.moduleId({
module: moduleGraph.getModule(dep),
module: /** @type {Module} */ (moduleGraph.getModule(dep)),
chunkGraph,

@@ -29,0 +30,0 @@ request: dep.request,

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

/** @typedef {import("../ModuleGraph")} ModuleGraph */
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */

@@ -131,3 +132,5 @@ /** @typedef {import("../javascript/JavascriptParser").Range} Range */

const dep = /** @type {ProvidedDependency} */ (dependency);
const connection = moduleGraph.getConnection(dep);
const connection =
/** @type {ModuleGraphConnection} */
(moduleGraph.getConnection(dep));
const exportsInfo = moduleGraph.getExportsInfo(connection.module);

@@ -134,0 +137,0 @@ const usedName = exportsInfo.getUsedName(dep.ids, runtime);

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

/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
module.exports = class RequireContextDependencyParserPlugin {
/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
apply(parser) {

@@ -23,3 +31,3 @@ parser.hooks.call

if (!modeExpr.isString()) return;
mode = modeExpr.string;
mode = /** @type {string} */ (modeExpr.string);
}

@@ -30,3 +38,3 @@ // falls through

if (!regExpExpr.isRegExp()) return;
regExp = regExpExpr.regExp;
regExp = /** @type {RegExp} */ (regExpExpr.regExp);
}

@@ -37,3 +45,3 @@ // falls through

if (!recursiveExpr.isBoolean()) return;
recursive = recursiveExpr.bool;
recursive = /** @type {boolean} */ (recursiveExpr.bool);
}

@@ -52,5 +60,5 @@ // falls through

},
expr.range
/** @type {Range} */ (expr.range)
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = !!parser.scope.inTry;

@@ -57,0 +65,0 @@ parser.state.current.addDependency(dep);

@@ -11,6 +11,9 @@ /*

/** @typedef {import("../ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock {
/**
* @param {TODO} chunkName chunk name
* @param {TODO} loc location info
* @param {ChunkGroupOptions & { entryOptions?: TODO }} chunkName chunk name
* @param {DependencyLocation} loc location info
*/

@@ -17,0 +20,0 @@ constructor(chunkName, loc) {

@@ -13,2 +13,5 @@ /*

/** @typedef {import("../ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
module.exports = class RequireEnsureDependenciesBlockParserPlugin {

@@ -61,3 +64,5 @@ apply(parser) {

const depBlock = new RequireEnsureDependenciesBlock(
chunkName,
/** @type {ChunkGroupOptions & { entryOptions?: TODO }} */ (
chunkName
),
expr.loc

@@ -64,0 +69,0 @@ );

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

/**
* @param {ObjectDeserializerContext} context context
* @returns {RequireHeaderDependency} RequireHeaderDependency
*/
static deserialize(context) {

@@ -40,0 +44,0 @@ const obj = new RequireHeaderDependency(context.read());

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

/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
module.exports = class RequireIncludeDependencyParserPlugin {

@@ -24,2 +28,7 @@ /**

}
/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
apply(parser) {

@@ -36,8 +45,13 @@ const { warn } = this;

parser.state.module.addWarning(
new RequireIncludeDeprecationWarning(expr.loc)
new RequireIncludeDeprecationWarning(
/** @type {DependencyLocation} */ (expr.loc)
)
);
}
const dep = new RequireIncludeDependency(param.string, expr.range);
dep.loc = expr.loc;
const dep = new RequireIncludeDependency(
/** @type {string} */ (param.string),
/** @type {Range} */ (expr.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.current.addDependency(dep);

@@ -51,3 +65,5 @@ return true;

parser.state.module.addWarning(
new RequireIncludeDeprecationWarning(expr.loc)
new RequireIncludeDeprecationWarning(
/** @type {DependencyLocation} */ (expr.loc)
)
);

@@ -62,3 +78,5 @@ }

parser.state.module.addWarning(
new RequireIncludeDeprecationWarning(expr.loc)
new RequireIncludeDeprecationWarning(
/** @type {DependencyLocation} */ (expr.loc)
)
);

@@ -72,2 +90,5 @@ }

class RequireIncludeDeprecationWarning extends WebpackError {
/**
* @param {DependencyLocation} loc location
*/
constructor(loc) {

@@ -74,0 +95,0 @@ super("require.include() is deprecated and will be removed soon.");

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

/**
* @param {ObjectDeserializerContext} context context
* @returns {RequireResolveHeaderDependency} RequireResolveHeaderDependency
*/
static deserialize(context) {

@@ -68,2 +72,7 @@ const obj = new RequireResolveHeaderDependency(context.read());

/**
* @param {string} name name
* @param {RequireResolveHeaderDependency} dep dependency
* @param {ReplaceSource} source source
*/
applyAsTemplateArgument(name, dep, source) {

@@ -70,0 +79,0 @@ source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");

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

/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../javascript/JavascriptParser")} Parser */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -62,2 +64,5 @@ const PLUGIN_NAME = "SystemPlugin";

/**
* @param {string} name name
*/
const setNotSupported = name => {

@@ -102,6 +107,8 @@ parser.hooks.evaluateTypeof

parser.hooks.expression.for("System").tap(PLUGIN_NAME, expr => {
const dep = new ConstDependency(RuntimeGlobals.system, expr.range, [
RuntimeGlobals.system
]);
dep.loc = expr.loc;
const dep = new ConstDependency(
RuntimeGlobals.system,
/** @type {Range} */ (expr.range),
[RuntimeGlobals.system]
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -113,3 +120,5 @@ return true;

parser.state.module.addWarning(
new SystemImportDeprecationWarning(expr.loc)
new SystemImportDeprecationWarning(
/** @type {DependencyLocation} */ (expr.loc)
)
);

@@ -140,2 +149,5 @@

class SystemImportDeprecationWarning extends WebpackError {
/**
* @param {DependencyLocation} loc location
*/
constructor(loc) {

@@ -142,0 +154,0 @@ super(

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -21,0 +21,0 @@ generate() {

@@ -45,3 +45,3 @@ /*

this.relative = relative || false;
/** @type {Set<string> | boolean} */
/** @type {Set<string> | boolean | undefined} */
this.usedByExports = undefined;

@@ -72,3 +72,3 @@ }

* @param {string} context context directory
* @returns {Module} a module
* @returns {Module | null} a module
*/

@@ -75,0 +75,0 @@ createIgnoredModule(context) {

@@ -21,5 +21,7 @@ /*

/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../NormalModule")} NormalModule */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser")} Parser */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */

@@ -98,3 +100,3 @@ const PLUGIN_NAME = "URLPlugin";

.setString(url.toString())
.setRange(expr.range);
.setRange(/** @type {Range} */ (expr.range));
});

@@ -111,7 +113,10 @@ parser.hooks.new.for("URL").tap(PLUGIN_NAME, _expr => {

request,
[arg1.range[0], arg2.range[1]],
expr.range,
[
/** @type {Range} */ (arg1.range)[0],
/** @type {Range} */ (arg2.range)[1]
],
/** @type {Range} */ (expr.range),
relative
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.current.addDependency(dep);

@@ -118,0 +123,0 @@ InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));

@@ -58,3 +58,3 @@ /*

* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[]} errors
* @returns {WebpackError[] | null | undefined} errors
*/

@@ -61,0 +61,0 @@ getErrors(moduleGraph) {

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

/** @typedef {import("estree").CallExpression} CallExpression */
/** @typedef {import("estree").Expression} Expression */

@@ -34,5 +35,11 @@ /** @typedef {import("estree").ObjectExpression} ObjectExpression */

/** @typedef {import("estree").SpreadElement} SpreadElement */
/** @typedef {import("../../declarations/WebpackOptions").ChunkLoading} ChunkLoading */
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("../../declarations/WebpackOptions").OutputModule} OutputModule */
/** @typedef {import("../../declarations/WebpackOptions").WasmLoading} WasmLoading */
/** @typedef {import("../../declarations/WebpackOptions").WorkerPublicPath} WorkerPublicPath */
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */
/** @typedef {import("../NormalModule")} NormalModule */
/** @typedef {import("../Parser").ParserState} ParserState */

@@ -42,4 +49,9 @@ /** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */

/** @typedef {import("../javascript/JavascriptParser")} Parser */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
/** @typedef {import("./HarmonyImportDependencyParserPlugin").HarmonySettings} HarmonySettings */
/**
* @param {NormalModule} module module
* @returns {string} url
*/
const getUrl = module => {

@@ -64,2 +76,8 @@ return pathToFileURL(module.resource).toString();

class WorkerPlugin {
/**
* @param {ChunkLoading} chunkLoading chunk loading
* @param {WasmLoading} wasmLoading wasm loading
* @param {OutputModule} module output module
* @param {WorkerPublicPath} workerPublicPath worker public path
*/
constructor(chunkLoading, wasmLoading, module, workerPublicPath) {

@@ -106,3 +124,3 @@ this._chunkLoading = chunkLoading;

* @param {Expression} expr expression
* @returns {[BasicEvaluatedExpression, [number, number]]} parsed
* @returns {[BasicEvaluatedExpression, [number, number]] | void} parsed
*/

@@ -124,3 +142,3 @@ const parseModuleUrl = (parser, expr) => {

!arg2Value.isString() ||
!arg2Value.string.startsWith("file://") ||
!(/** @type {string} */ (arg2Value.string).startsWith("file://")) ||
arg2Value.string !== getUrl(parser.state.module)

@@ -131,3 +149,9 @@ ) {

const arg1Value = parser.evaluateExpression(arg1);
return [arg1Value, [arg1.range[0], arg2.range[1]]];
return [
arg1Value,
[
/** @type {Range} */ (arg1.range)[0],
/** @type {Range} */ (arg2.range)[1]
]
];
};

@@ -192,2 +216,6 @@

: parserOptions.worker;
/**
* @param {CallExpression} expr expression
* @returns {boolean | void} true when handled
*/
const handleNewWorker = expr => {

@@ -220,6 +248,8 @@ if (expr.arguments.length === 0 || expr.arguments.length > 2)

insertType: arg2 ? "spread" : "argument",
insertLocation: arg2 ? arg2.range : arg1.range[1]
insertLocation: arg2
? /** @type {Range} */ (arg2.range)
: /** @type {Range} */ (arg1.range)[1]
};
const { options: importOptions, errors: commentErrors } =
parser.parseCommentOptions(expr.range);
parser.parseCommentOptions(/** @type {Range} */ (expr.range));

@@ -247,3 +277,3 @@ if (commentErrors) {

`\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -265,3 +295,3 @@ );

`\`webpackEntryOptions\` expected a object, but received: ${importOptions.webpackEntryOptions}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -281,3 +311,3 @@ );

`\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`,
expr.loc
/** @type {DependencyLocation} */ (expr.loc)
)

@@ -325,6 +355,10 @@ );

block.loc = expr.loc;
const dep = new WorkerDependency(url.string, range, {
publicPath: this._workerPublicPath
});
dep.loc = expr.loc;
const dep = new WorkerDependency(
/** @type {string} */ (url.string),
range,
{
publicPath: this._workerPublicPath
}
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
block.addDependency(dep);

@@ -335,5 +369,5 @@ parser.state.module.addBlock(block);

const dep = new CreateScriptUrlDependency(
expr.arguments[0].range
/** @type {Range} */ (expr.arguments[0].range)
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);

@@ -347,5 +381,5 @@ }

this._module ? '"module"' : "undefined",
expr.range
/** @type {Range} */ (expr.range)
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -360,3 +394,3 @@ expressions.type = undefined;

);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -367,10 +401,10 @@ }

"Object.assign({}, ",
insertLocation[0]
/** @type {Range} */ (insertLocation)[0]
);
const dep2 = new ConstDependency(
`, { type: ${this._module ? '"module"' : "undefined"} })`,
insertLocation[1]
/** @type {Range} */ (insertLocation)[1]
);
dep1.loc = expr.loc;
dep2.loc = expr.loc;
dep1.loc = /** @type {DependencyLocation} */ (expr.loc);
dep2.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep1);

@@ -384,3 +418,3 @@ parser.state.module.addPresentationalDependency(dep2);

);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -403,2 +437,5 @@ }

};
/**
* @param {string} item item
*/
const processItem = item => {

@@ -405,0 +442,0 @@ if (

@@ -92,5 +92,5 @@ /*

constructor() {
/** @type {Module} */
/** @type {Module | undefined} */
this._parentModule = undefined;
/** @type {DependenciesBlock} */
/** @type {DependenciesBlock | undefined} */
this._parentDependenciesBlock = undefined;

@@ -178,2 +178,8 @@ /** @type {number} */

/**
* @param {number} startLine start line
* @param {number} startColumn start column
* @param {number} endLine end line
* @param {number} endColumn end column
*/
setLoc(startLine, startColumn, endLine, endColumn) {

@@ -252,3 +258,3 @@ this._locSL = startLine;

* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[]} warnings
* @returns {WebpackError[] | null | undefined} warnings
*/

@@ -262,3 +268,3 @@ getWarnings(moduleGraph) {

* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[]} errors
* @returns {WebpackError[] | null | undefined} errors
*/

@@ -295,3 +301,3 @@ getErrors(moduleGraph) {

* @param {string} context context directory
* @returns {Module} a module
* @returns {Module | null} a module
*/

@@ -298,0 +304,0 @@ createIgnoredModule(context) {

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

/** @typedef {import("./Compiler")} Compiler */
class DllEntryPlugin {

@@ -25,2 +27,7 @@ /**

/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {

@@ -56,3 +63,6 @@ compiler.hooks.compilation.tap(

this.options,
callback
error => {
if (error) return callback(error);
callback();
}
);

@@ -59,0 +69,0 @@ });

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

/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */
/** @typedef {import("./Compiler")} Compiler */

@@ -41,2 +42,7 @@ const validate = createSchemaValidation(

/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {

@@ -145,3 +151,5 @@ compiler.hooks.compilation.tap(

if (data.error) {
compilation.errors.push(data.error);
compilation.errors.push(
/** @type {DllManifestError} */ (data.error)
);
}

@@ -157,2 +165,6 @@ compilation.fileDependencies.add(manifest);

class DllManifestError extends WebpackError {
/**
* @param {string} filename filename of the manifest
* @param {string} message error message
*/
constructor(filename, message) {

@@ -159,0 +171,0 @@ super();

@@ -86,3 +86,3 @@ /*

getEntrypointChunk() {
return this._entrypointChunk;
return /** @type {Chunk} */ (this._entrypointChunk);
}

@@ -89,0 +89,0 @@

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

/** @type {string[]} */
const result = [];

@@ -50,0 +51,0 @@

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -26,0 +26,0 @@ generate() {

@@ -83,3 +83,3 @@ /*

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -86,0 +86,0 @@ generate() {

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

/**
* @param {Source} r result
* @returns {Source} result
*/
const result = r => {

@@ -87,0 +91,0 @@ cache.set(source, r);

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

/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */

@@ -48,2 +50,5 @@

/**
* @param {ObjectSerializerContext} context context
*/
serialize({ write }) {

@@ -56,2 +61,6 @@ write(this.exports);

/**
* @param {ObjectDeserializerContext} context context
* @returns {RestoreProvidedData} RestoreProvidedData
*/
static deserialize({ read }) {

@@ -307,3 +316,8 @@ return new RestoreProvidedData(read(), read(), read(), read());

if (targetKey) {
exportInfo.setTarget(targetKey, targetModule, [exportInfo.name], -1);
exportInfo.setTarget(
targetKey,
/** @type {ModuleGraphConnection} */ (targetModule),
[exportInfo.name],
-1
);
}

@@ -338,3 +352,3 @@ }

targetKey,
targetModule,
/** @type {ModuleGraphConnection} */ (targetModule),
undefined,

@@ -1234,3 +1248,3 @@ priority

* @param {function(Module): boolean} validTargetModuleFilter a valid target module
* @param {Set<ExportInfo> | undefined} alreadyVisited set of already visited export info to avoid circular references
* @param {Set<ExportInfo>} alreadyVisited set of already visited export info to avoid circular references
* @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid

@@ -1237,0 +1251,0 @@ */

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

/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */

@@ -47,8 +49,12 @@ const PLUGIN_NAME = "ExportsInfoApiPlugin";

? new ExportsInfoDependency(
expr.range,
/** @type {Range} */ (expr.range),
members.slice(0, -1),
members[members.length - 1]
)
: new ExportsInfoDependency(expr.range, null, members[0]);
dep.loc = expr.loc;
: new ExportsInfoDependency(
/** @type {Range} */ (expr.range),
null,
members[0]
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);

@@ -60,4 +66,7 @@ return true;

.tap(PLUGIN_NAME, expr => {
const dep = new ConstDependency("true", expr.range);
dep.loc = expr.loc;
const dep = new ConstDependency(
"true",
/** @type {Range} */ (expr.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -64,0 +73,0 @@ return true;

@@ -387,2 +387,7 @@ /*

class ExternalModule extends Module {
/**
* @param {string | string[] | Record<string, string | string[]>} request request
* @param {TODO} type type
* @param {string} userRequest user request
*/
constructor(request, type, userRequest) {

@@ -389,0 +394,0 @@ super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);

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

/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Module").FactoryMeta} FactoryMeta */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */

@@ -16,2 +17,5 @@

class FlagAllModulesAsUsedPlugin {
/**
* @param {string} explanation explanation
*/
constructor(explanation) {

@@ -45,3 +49,4 @@ this.explanation = explanation;

}
module.factoryMeta.sideEffectFree = false;
/** @type {FactoryMeta} */
(module.factoryMeta).sideEffectFree = false;
}

@@ -48,0 +53,0 @@ });

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

while (queue.length) {
const [module, runtime] = queue.dequeue();
const [module, runtime] = /** @type {[Module, RuntimeSpec]} */ (
queue.dequeue()
);
processModule(module, runtime, false);

@@ -338,0 +340,0 @@ }

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -20,0 +20,0 @@ generate() {

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

/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
const applyModuleHot = parser => {

@@ -225,2 +229,6 @@ parser.hooks.evaluateIdentifier.for("module.hot").tap(

/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
const applyImportMetaHot = parser => {

@@ -227,0 +235,0 @@ parser.hooks.evaluateIdentifier

@@ -39,3 +39,3 @@ /*

this.options = {
context: null,
context: undefined,
hashFunction: "md4",

@@ -42,0 +42,0 @@ hashDigest: "base64",

@@ -13,7 +13,10 @@ /*

/** @typedef {import("./Generator").GenerateContext} GenerateContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/**
* @param {InitFragment} fragment the init fragment
* @template T
* @param {InitFragment<T>} fragment the init fragment
* @param {number} index index
* @returns {[InitFragment, number]} tuple with both
* @returns {[InitFragment<T>, number]} tuple with both
*/

@@ -23,4 +26,5 @@ const extractFragmentIndex = (fragment, index) => [fragment, index];

/**
* @param {[InitFragment, number]} a first pair
* @param {[InitFragment, number]} b second pair
* @template T
* @param {[InitFragment<T>, number]} a first pair
* @param {[InitFragment<T>, number]} b second pair
* @returns {number} sort value

@@ -71,2 +75,10 @@ */

/**
* @template Context
* @template T
* @param {Source} source sources
* @param {InitFragment<T>[]} initFragments init fragments
* @param {Context} context context
* @returns {Source} source
*/
static addToSource(source, initFragments, context) {

@@ -83,3 +95,8 @@ if (initFragments.length > 0) {

for (const [fragment] of sortedFragments) {
if (typeof fragment.mergeAll === "function") {
if (
typeof (
/** @type {InitFragment<T> & { mergeAll?: (fragments: InitFragment[]) => InitFragment[] }} */
(fragment).mergeAll
) === "function"
) {
if (!fragment.key) {

@@ -132,2 +149,5 @@ throw new Error(

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {

@@ -143,2 +163,5 @@ const { write } = context;

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {

@@ -145,0 +168,0 @@ const { read } = context;

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

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

@@ -37,4 +38,7 @@

parser.hooks.call.for("eval").tap(PLUGIN_NAME, () => {
parser.state.module.buildInfo.moduleConcatenationBailout = "eval()";
parser.state.module.buildInfo.usingEval = true;
const buildInfo =
/** @type {BuildInfo} */
(parser.state.module.buildInfo);
buildInfo.moduleConcatenationBailout = "eval()";
buildInfo.usingEval = true;
const currentSymbol = InnerGraph.getTopLevelSymbol(parser.state);

@@ -48,7 +52,8 @@ if (currentSymbol) {

parser.hooks.finish.tap(PLUGIN_NAME, () => {
let topLevelDeclarations =
parser.state.module.buildInfo.topLevelDeclarations;
const buildInfo =
/** @type {BuildInfo} */
(parser.state.module.buildInfo);
let topLevelDeclarations = buildInfo.topLevelDeclarations;
if (topLevelDeclarations === undefined) {
topLevelDeclarations =
parser.state.module.buildInfo.topLevelDeclarations = new Set();
topLevelDeclarations = buildInfo.topLevelDeclarations = new Set();
}

@@ -55,0 +60,0 @@ for (const name of parser.scope.definitions.asSet()) {

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

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

@@ -20,7 +21,20 @@ /**

* @property {string | number} id
* @property {Object} buildMeta
* @property {boolean | string[]} exports
* @property {BuildMeta} buildMeta
* @property {boolean | string[] | undefined} exports
*/
/**
* @typedef {Object} LibManifestPluginOptions
* @property {string=} context Context of requests in the manifest file (defaults to the webpack context).
* @property {boolean=} entryOnly If true, only entry points will be exposed (default: true).
* @property {boolean=} format If true, manifest json file (output) will be formatted.
* @property {string=} name Name of the exposed dll function (external name, use value of 'output.library').
* @property {string} path Absolute path to the manifest json file (output).
* @property {string=} type Type of the dll bundle (external type, use value of 'output.libraryTarget').
*/
class LibManifestPlugin {
/**
* @param {LibManifestPluginOptions} options the options
*/
constructor(options) {

@@ -72,3 +86,5 @@ this.options = options;

const ident = module.libIdent({
context: this.options.context || compiler.options.context,
context:
this.options.context ||
/** @type {string} */ (compiler.options.context),
associatedObjectForCache: compiler.root

@@ -82,3 +98,3 @@ });

id: chunkGraph.getModuleId(module),
buildMeta: module.buildMeta,
buildMeta: /** @type {BuildMeta} */ (module.buildMeta),
exports: Array.isArray(providedExports)

@@ -85,0 +101,0 @@ ? providedExports

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

const SyncBailHook = require("tapable/lib/SyncBailHook");
const { SyncBailHook } = require("tapable");
const { Logger } = require("./Logger");

@@ -11,0 +11,0 @@ const createConsoleLogger = require("./createConsoleLogger");

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

/**
* @param {Array<number>} array array of numbers
* @returns {number} sum of all numbers in array
*/
const arraySum = array => {

@@ -10,0 +14,0 @@ let sum = 0;

@@ -112,2 +112,7 @@ /*

/**
* @typedef {Object} FactoryMeta
* @property {boolean=} sideEffectFree
*/
const EMPTY_RESOLVE_OPTIONS = {};

@@ -163,3 +168,3 @@

this.resolveOptions = EMPTY_RESOLVE_OPTIONS;
/** @type {object | undefined} */
/** @type {FactoryMeta | undefined} */
this.factoryMeta = undefined;

@@ -444,3 +449,3 @@ // TODO refactor this -> options object filled from Factory

* @param {ModuleGraph} moduleGraph the module graph
* @param {boolean} strict the importing module is strict
* @param {boolean | undefined} strict the importing module is strict
* @returns {"namespace" | "default-only" | "default-with-named" | "dynamic"} export type

@@ -447,0 +452,0 @@ * "namespace": Exports is already a namespace object. namespace = exports.

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

/** @type {{ start: number, end: number }[] | undefined } */
this.additionalFactoryTimes = undefined;

@@ -39,0 +40,0 @@ this.additionalFactories = 0;

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

let message = "Module restore failed: ";
/** @type {string | undefined} */
let details = undefined;

@@ -37,2 +38,3 @@ if (err !== null && typeof err === "object") {

this.name = "ModuleRestoreError";
/** @type {string | undefined} */
this.details = details;

@@ -39,0 +41,0 @@ this.module = module;

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

/** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../ChunkGraph")} ChunkGraph */
/** @typedef {import("../Compilation")} Compilation */

@@ -50,7 +52,9 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/
generate() {
const { chunkGraph, chunk } = this;
const { runtimeTemplate } = this.compilation;
const compilation = /** @type {Compilation} */ (this.compilation);
const chunkGraph = /** @type {ChunkGraph} */ (this.chunkGraph);
const chunk = /** @type {Chunk} */ (this.chunk);
const { runtimeTemplate } = compilation;
const fn = RuntimeGlobals.ensureChunkHandlers;

@@ -77,4 +81,4 @@ const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI);

const outputName = this.compilation.getPath(
getChunkFilenameTemplate(chunk, this.compilation.outputOptions),
const outputName = compilation.getPath(
getChunkFilenameTemplate(chunk, compilation.outputOptions),
{

@@ -87,3 +91,3 @@ chunk,

outputName,
/** @type {string} */ (this.compilation.outputOptions.path),
/** @type {string} */ (compilation.outputOptions.path),
false

@@ -90,0 +94,0 @@ );

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

/** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../ChunkGraph")} ChunkGraph */
/** @typedef {import("../Compilation")} Compilation */

@@ -50,7 +52,9 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/
generate() {
const { chunkGraph, chunk } = this;
const { runtimeTemplate } = this.compilation;
const compilation = /** @type {Compilation} */ (this.compilation);
const chunkGraph = /** @type {ChunkGraph} */ (this.chunkGraph);
const chunk = /** @type {Chunk} */ (this.chunk);
const { runtimeTemplate } = compilation;
const fn = RuntimeGlobals.ensureChunkHandlers;

@@ -77,4 +81,4 @@ const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI);

const outputName = this.compilation.getPath(
getChunkFilenameTemplate(chunk, this.compilation.outputOptions),
const outputName = compilation.getPath(
getChunkFilenameTemplate(chunk, compilation.outputOptions),
{

@@ -87,3 +91,3 @@ chunk,

outputName,
/** @type {string} */ (this.compilation.outputOptions.path),
/** @type {string} */ (compilation.outputOptions.path),
true

@@ -90,0 +94,0 @@ );

@@ -24,6 +24,12 @@ /*

/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
/** @typedef {import("../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("../declarations/WebpackOptions").NodeOptions} NodeOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
/** @typedef {import("./NormalModule")} NormalModule */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */

@@ -33,2 +39,5 @@ const PLUGIN_NAME = "NodeStuffPlugin";

class NodeStuffPlugin {
/**
* @param {NodeOptions} options options
*/
constructor(options) {

@@ -48,2 +57,7 @@ this.options = options;

(compilation, { normalModuleFactory }) => {
/**
* @param {JavascriptParser} parser the parser
* @param {JavascriptParserOptions} parserOptions options
* @returns {void}
*/
const handler = (parser, parserOptions) => {

@@ -62,6 +76,6 @@ if (parserOptions.node === false) return;

RuntimeGlobals.global,
expr.range,
/** @type {Range} */ (expr.range),
[RuntimeGlobals.global]
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -83,6 +97,6 @@

RuntimeGlobals.global,
expr.range,
/** @type {Range} */ (expr.range),
[RuntimeGlobals.global]
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -93,2 +107,8 @@ return false;

/**
* @param {string} expressionName expression name
* @param {(module: NormalModule) => string} fn function
* @param {string=} warning warning
* @returns {void}
*/
const setModuleConstant = (expressionName, fn, warning) => {

@@ -100,6 +120,6 @@ parser.hooks.expression

JSON.stringify(fn(parser.state.module)),
expr.range,
/** @type {Range} */ (expr.range),
expressionName
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);

@@ -118,2 +138,8 @@

/**
* @param {string} expressionName expression name
* @param {string} value value
* @param {string=} warning warning
* @returns {void}
*/
const setConstant = (expressionName, value, warning) =>

@@ -120,0 +146,0 @@ setModuleConstant(expressionName, () => value, warning);

@@ -312,3 +312,3 @@ /*

* @param {Dependency} dependency the dependency
* @param {Set<string> | boolean} usedByExports usedByExports info
* @param {Set<string> | boolean | undefined} usedByExports usedByExports info
* @param {ModuleGraph} moduleGraph moduleGraph

@@ -315,0 +315,0 @@ * @returns {null | false | function(ModuleGraphConnection, RuntimeSpec): ConnectionState} function to determine if the connection is active

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

/** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("../Compiler")} Compiler */

@@ -50,3 +51,3 @@ /** @typedef {import("../Dependency")} Dependency */

* @param {JavascriptParser} parser the parser
* @param {Object} parserOptions options
* @param {JavascriptParserOptions} parserOptions options
* @returns {void}

@@ -53,0 +54,0 @@ */

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -30,0 +30,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -28,0 +28,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -27,0 +27,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -27,0 +27,0 @@ generate() {

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

/** @typedef {import("../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */

@@ -52,2 +56,7 @@ const PLUGIN_NAME = "ProvidePlugin";

);
/**
* @param {JavascriptParser} parser the parser
* @param {JavascriptParserOptions} parserOptions options
* @returns {void}
*/
const handler = (parser, parserOptions) => {

@@ -72,5 +81,5 @@ Object.keys(definitions).forEach(name => {

request.slice(1),
expr.range
/** @type {Range} */ (expr.range)
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);

@@ -88,5 +97,5 @@ return true;

request.slice(1),
expr.callee.range
/** @type {Range} */ (expr.callee.range)
);
dep.loc = expr.callee.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.callee.loc);
parser.state.module.addDependency(dep);

@@ -93,0 +102,0 @@ parser.walkExpressions(expr.arguments);

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

readableIdentifier(requestShortener) {
return requestShortener.shorten(this.readableIdentifierStr);
return /** @type {string} */ (
requestShortener.shorten(this.readableIdentifierStr)
);
}

@@ -78,0 +80,0 @@

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

/** @typedef {import("../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */

@@ -37,2 +39,7 @@ const PLUGIN_NAME = "RequireJsStuffPlugin";

);
/**
* @param {JavascriptParser} parser the parser
* @param {JavascriptParserOptions} parserOptions options
* @returns {void}
*/
const handler = (parser, parserOptions) => {

@@ -39,0 +46,0 @@ if (

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -31,3 +31,3 @@ generate() {

`var resolveQueue = ${runtimeTemplate.basicFunction("queue", [
"if(queue && !queue.d) {",
"if(queue && queue.d < 1) {",
Template.indent([

@@ -81,3 +81,3 @@ "queue.d = 1;",

"var queue;",
"hasAwait && ((queue = []).d = 1);",
"hasAwait && ((queue = []).d = -1);",
"var depQueues = new Set();",

@@ -130,3 +130,3 @@ "var exports = module.exports;",

)});`,
"queue && (queue.d = 0);"
"queue && queue.d < 0 && (queue.d = 0);"
])};`

@@ -133,0 +133,0 @@ ]);

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -24,0 +24,0 @@ generate() {

@@ -20,3 +20,3 @@ /*

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -23,0 +23,0 @@ generate() {

@@ -20,3 +20,3 @@ /*

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -23,0 +23,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -25,0 +25,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -26,0 +26,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -41,0 +41,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -30,0 +30,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -26,0 +26,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -20,0 +20,0 @@ generate() {

@@ -20,3 +20,3 @@ /*

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -23,0 +23,0 @@ generate() {

@@ -56,3 +56,3 @@ /*

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -59,0 +59,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -20,0 +20,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -26,0 +26,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -22,0 +22,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -29,0 +29,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -26,0 +26,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -21,0 +21,0 @@ generate() {

@@ -169,3 +169,3 @@ /*

* @abstract
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -178,7 +178,7 @@ generate() {

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/
getGeneratedCode() {
if (this._cachedGeneratedCode) {
return this._cachedGeneratedCode;
return /** @type {string | null} */ (this._cachedGeneratedCode);
}

@@ -185,0 +185,0 @@ return (this._cachedGeneratedCode = this.generate());

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

for (const req of Object.keys(TREE_DEPENDENCIES)) {
const deps = TREE_DEPENDENCIES[req];
const deps =
TREE_DEPENDENCIES[/** @type {keyof TREE_DEPENDENCIES} */ (req)];
compilation.hooks.runtimeRequirementInTree

@@ -140,3 +141,4 @@ .for(req)

for (const req of Object.keys(MODULE_DEPENDENCIES)) {
const deps = MODULE_DEPENDENCIES[req];
const deps =
MODULE_DEPENDENCIES[/** @type {keyof MODULE_DEPENDENCIES} */ (req)];
compilation.hooks.runtimeRequirementInModule

@@ -143,0 +145,0 @@ .for(req)

@@ -399,3 +399,3 @@ /*

* @param {Object} options options object
* @param {Module} options.module the module
* @param {Module | null} options.module the module
* @param {ChunkGraph} options.chunkGraph the chunk graph

@@ -443,3 +443,3 @@ * @param {string} options.request the request that should be printed as comment

* @param {Object} options options object
* @param {Module} options.module the module
* @param {Module | null} options.module the module
* @param {ChunkGraph} options.chunkGraph the chunk graph

@@ -446,0 +446,0 @@ * @param {string} options.request the request that should be printed as comment

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -38,0 +38,0 @@ generate() {

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -29,0 +29,0 @@ generate() {

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

/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
/** @typedef {import("./Compilation")} Compilation */
class SourceMapDevToolModuleOptionsPlugin {
/**
* @param {SourceMapDevToolPluginOptions} options options
*/
constructor(options) {

@@ -15,0 +19,0 @@ this.options = options;

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

/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Compilation").Asset} Asset */
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */

@@ -231,3 +232,5 @@ /** @typedef {import("./Compilation").PathData} PathData */

(file, callback) => {
const asset = compilation.getAsset(file);
const asset =
/** @type {Readonly<Asset>} */
(compilation.getAsset(file));
if (asset.info.related && asset.info.related.sourceMap) {

@@ -368,3 +371,5 @@ fileIndex++;

const module = allModules[idx];
let sourceName = moduleToSourceNameMapping.get(module);
let sourceName =
/** @type {string} */
(moduleToSourceNameMapping.get(module));
let hasName = conflictDetectionSet.has(sourceName);

@@ -371,0 +376,0 @@ if (!hasName) {

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

/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */

@@ -46,6 +49,10 @@ const PLUGIN_NAME = "UseStrictPlugin";

// @see https://github.com/webpack/webpack/issues/1970
const dep = new ConstDependency("", firstNode.range);
dep.loc = firstNode.loc;
const dep = new ConstDependency(
"",
/** @type {Range} */ (firstNode.range)
);
dep.loc = /** @type {DependencyLocation} */ (firstNode.loc);
parser.state.module.addPresentationalDependency(dep);
parser.state.module.buildInfo.strict = true;
/** @type {BuildInfo} */
(parser.state.module.buildInfo).strict = true;
}

@@ -52,0 +59,0 @@ });

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -35,0 +35,0 @@ generate() {

@@ -229,3 +229,3 @@ /*

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -232,0 +232,0 @@ generate() {

@@ -73,3 +73,3 @@ /*

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -76,0 +76,0 @@ generate() {

@@ -19,6 +19,8 @@ /*

/** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */
/** @typedef {import("enhanced-resolve").Resolver} Resolver */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */

@@ -65,6 +67,6 @@ const PLUGIN_NAME = "WebpackIsIncludedPlugin";

const dep = new WebpackIsIncludedDependency(
request.string,
expr.range
/** @type {string} */ (request.string),
/** @type {Range} */ (expr.range)
);
dep.loc = expr.loc;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);

@@ -71,0 +73,0 @@ return true;

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

/**
* @returns {string} runtime code
* @returns {string | null} runtime code
*/

@@ -65,0 +65,0 @@ generate() {

{
"name": "webpack",
"version": "5.87.0",
"version": "5.88.0",
"author": "Tobias Koppers @sokra",

@@ -42,2 +42,3 @@ "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.",

"@types/jest": "^29.5.0",
"@types/mime-types": "^2.1.1",
"@types/node": "^20.1.7",

@@ -44,0 +45,0 @@ "assemblyscript": "^0.27.2",

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc