Enhance refactor commands with controller-aware Route() updates and fix code quality violations
Add semantic token highlighting for 'that' variable and comment file references in VS Code extension Add Phone_Text_Input and Currency_Input components with formatting utilities Implement client widgets, form standardization, and soft delete functionality Add modal scroll lock and update documentation Implement comprehensive modal system with form integration and validation Fix modal component instantiation using jQuery plugin API Implement modal system with responsive sizing, queuing, and validation support Implement form submission with validation, error handling, and loading states Implement country/state selectors with dynamic data loading and Bootstrap styling Revert Rsx::Route() highlighting in Blade/PHP files Target specific PHP scopes for Rsx::Route() highlighting in Blade Expand injection selector for Rsx::Route() highlighting Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls Update jqhtml packages to v2.2.165 Add bundle path validation for common mistakes (development mode only) Create Ajax_Select_Input widget and Rsx_Reference_Data controller Create Country_Select_Input widget with default country support Initialize Tom Select on Select_Input widgets Add Tom Select bundle for enhanced select dropdowns Implement ISO 3166 geographic data system for country/region selection Implement widget-based form system with disabled state support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
29
node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js
generated
vendored
29
node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js
generated
vendored
@@ -24,12 +24,12 @@ const { addLocalModule, getLocalModule } = require("./LocalModulesHelpers");
|
||||
/** @typedef {import("estree").Literal} Literal */
|
||||
/** @typedef {import("estree").MemberExpression} MemberExpression */
|
||||
/** @typedef {import("estree").ObjectExpression} ObjectExpression */
|
||||
/** @typedef {import("estree").SimpleCallExpression} SimpleCallExpression */
|
||||
/** @typedef {import("estree").SpreadElement} SpreadElement */
|
||||
/** @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").ExportedVariableInfo} ExportedVariableInfo */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
|
||||
/**
|
||||
@@ -68,6 +68,8 @@ const isCallable = (expr) => {
|
||||
return false;
|
||||
};
|
||||
|
||||
/** @typedef {Record<number, string>} Identifiers */
|
||||
|
||||
const PLUGIN_NAME = "AMDDefineDependencyParserPlugin";
|
||||
|
||||
class AMDDefineDependencyParserPlugin {
|
||||
@@ -92,7 +94,7 @@ class AMDDefineDependencyParserPlugin {
|
||||
* @param {JavascriptParser} parser the parser
|
||||
* @param {CallExpression} expr call expression
|
||||
* @param {BasicEvaluatedExpression} param param
|
||||
* @param {Record<number, string>} identifiers identifiers
|
||||
* @param {Identifiers} identifiers identifiers
|
||||
* @param {string=} namedModule named module
|
||||
* @returns {boolean | undefined} result
|
||||
*/
|
||||
@@ -106,7 +108,7 @@ class AMDDefineDependencyParserPlugin {
|
||||
/** @type {string} */ (item.string)
|
||||
)
|
||||
) {
|
||||
identifiers[/** @type {number} */ (idx)] =
|
||||
identifiers[idx] =
|
||||
/** @type {string} */
|
||||
(item.string);
|
||||
}
|
||||
@@ -347,9 +349,10 @@ class AMDDefineDependencyParserPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
/** @type {Map<string, ExportedVariableInfo>} */
|
||||
const fnRenames = new Map();
|
||||
if (array) {
|
||||
/** @type {Record<number, string>} */
|
||||
/** @type {Identifiers} */
|
||||
const identifiers = {};
|
||||
const param = parser.evaluateExpression(array);
|
||||
const result = this.processArray(
|
||||
@@ -417,19 +420,11 @@ class AMDDefineDependencyParserPlugin {
|
||||
parser.setVariable(name, varInfo);
|
||||
}
|
||||
parser.scope.inTry = /** @type {boolean} */ (inTry);
|
||||
|
||||
if (object.body.type === "BlockStatement") {
|
||||
parser.detectMode(object.body.body);
|
||||
const prev = parser.prevStatement;
|
||||
parser.preWalkStatement(object.body);
|
||||
parser.prevStatement = prev;
|
||||
parser.walkStatement(object.body);
|
||||
} else {
|
||||
parser.walkExpression(
|
||||
/** @type {TODO} */
|
||||
(object.body)
|
||||
);
|
||||
}
|
||||
parser.detectMode(object.body.body);
|
||||
const prev = parser.prevStatement;
|
||||
parser.preWalkStatement(object.body);
|
||||
parser.prevStatement = prev;
|
||||
parser.walkStatement(object.body);
|
||||
}
|
||||
);
|
||||
if (fn.arguments) {
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/AMDPlugin.js
generated
vendored
4
node_modules/webpack/lib/dependencies/AMDPlugin.js
generated
vendored
@@ -34,11 +34,11 @@ const UnsupportedDependency = require("./UnsupportedDependency");
|
||||
|
||||
/** @typedef {import("../../declarations/WebpackOptions").Amd} Amd */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} Parser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../javascript/BasicEvaluatedExpression").GetMembers} GetMembers */
|
||||
|
||||
const PLUGIN_NAME = "AMDPlugin";
|
||||
|
||||
@@ -143,7 +143,7 @@ class AMDPlugin {
|
||||
/**
|
||||
* @param {string} optionExpr option expression
|
||||
* @param {string} rootName root name
|
||||
* @param {() => string[]} getMembers callback
|
||||
* @param {GetMembers} getMembers callback
|
||||
*/
|
||||
const tapOptionsHooks = (optionExpr, rootName, getMembers) => {
|
||||
parser.hooks.expression
|
||||
|
||||
3
node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
generated
vendored
3
node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
generated
vendored
@@ -26,7 +26,6 @@ const getFunctionExpression = require("./getFunctionExpression");
|
||||
/** @typedef {import("estree").SpreadElement} SpreadElement */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
/** @typedef {import("../Module").BuildInfo} BuildInfo */
|
||||
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
@@ -296,7 +295,7 @@ class AMDRequireDependenciesBlockParserPlugin {
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
depBlock.addDependency(dep);
|
||||
|
||||
parser.state.current = /** @type {TODO} */ (depBlock);
|
||||
parser.state.current = /** @type {EXPECTED_ANY} */ (depBlock);
|
||||
}
|
||||
|
||||
if (expr.arguments.length === 1) {
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/CachedConstDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/CachedConstDependency.js
generated
vendored
@@ -11,13 +11,9 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../DependencyTemplates")} DependencyTemplates */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
|
||||
34
node_modules/webpack/lib/dependencies/CommonJsExportRequireDependency.js
generated
vendored
34
node_modules/webpack/lib/dependencies/CommonJsExportRequireDependency.js
generated
vendored
@@ -17,11 +17,13 @@ const processExportInfo = require("./processExportInfo");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ExportsInfo")} ExportsInfo */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
@@ -34,14 +36,17 @@ const idsSymbol = Symbol("CommonJsExportRequireDependency.ids");
|
||||
|
||||
const EMPTY_OBJECT = {};
|
||||
|
||||
/** @typedef {Set<string>} Exports */
|
||||
/** @typedef {Set<string>} Checked */
|
||||
|
||||
class CommonJsExportRequireDependency extends ModuleDependency {
|
||||
/**
|
||||
* @param {Range} range range
|
||||
* @param {Range | null} valueRange value range
|
||||
* @param {CommonJSDependencyBaseKeywords} base base
|
||||
* @param {string[]} names names
|
||||
* @param {ExportInfoName[]} names names
|
||||
* @param {string} request request
|
||||
* @param {string[]} ids ids
|
||||
* @param {ExportInfoName[]} ids ids
|
||||
* @param {boolean} resultUsed true, when the result is used
|
||||
*/
|
||||
constructor(range, valueRange, base, names, request, ids, resultUsed) {
|
||||
@@ -68,7 +73,7 @@ class CommonJsExportRequireDependency extends ModuleDependency {
|
||||
|
||||
/**
|
||||
* @param {ModuleGraph} moduleGraph the module graph
|
||||
* @returns {string[]} the imported id
|
||||
* @returns {ExportInfoName[]} the imported id
|
||||
*/
|
||||
getIds(moduleGraph) {
|
||||
return moduleGraph.getMeta(this)[idsSymbol] || this.ids;
|
||||
@@ -76,7 +81,7 @@ class CommonJsExportRequireDependency extends ModuleDependency {
|
||||
|
||||
/**
|
||||
* @param {ModuleGraph} moduleGraph the module graph
|
||||
* @param {string[]} ids the imported ids
|
||||
* @param {ExportInfoName[]} ids the imported ids
|
||||
* @returns {void}
|
||||
*/
|
||||
setIds(moduleGraph, ids) {
|
||||
@@ -87,7 +92,7 @@ class CommonJsExportRequireDependency extends ModuleDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
const ids = this.getIds(moduleGraph);
|
||||
@@ -108,9 +113,9 @@ class CommonJsExportRequireDependency extends ModuleDependency {
|
||||
/** @type {Module} */ (moduleGraph.getParentModule(this))
|
||||
);
|
||||
for (const name of this.names) {
|
||||
const exportInfo = /** @type {ExportInfo} */ (
|
||||
exportsInfo.getReadOnlyExportInfo(name)
|
||||
);
|
||||
const exportInfo =
|
||||
/** @type {ExportInfo} */
|
||||
(exportsInfo.getReadOnlyExportInfo(name));
|
||||
const used = exportInfo.getUsed(runtime);
|
||||
if (used === UsageState.Unused) return Dependency.NO_EXPORTS_REFERENCED;
|
||||
if (used !== UsageState.OnlyPropertiesUsed) return getFullResult();
|
||||
@@ -120,7 +125,7 @@ class CommonJsExportRequireDependency extends ModuleDependency {
|
||||
if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) {
|
||||
return getFullResult();
|
||||
}
|
||||
/** @type {string[][]} */
|
||||
/** @type {RawReferencedExports} */
|
||||
const referencedExports = [];
|
||||
for (const exportInfo of exportsInfo.orderedExports) {
|
||||
processExportInfo(
|
||||
@@ -188,7 +193,7 @@ class CommonJsExportRequireDependency extends ModuleDependency {
|
||||
if (reexportInfo) {
|
||||
return {
|
||||
exports: Array.from(
|
||||
/** @type {Set<string>} */
|
||||
/** @type {Exports} */
|
||||
(reexportInfo.exports),
|
||||
(name) => ({
|
||||
name,
|
||||
@@ -213,7 +218,7 @@ class CommonJsExportRequireDependency extends ModuleDependency {
|
||||
* @param {ModuleGraph} moduleGraph the module graph
|
||||
* @param {RuntimeSpec} runtime the runtime
|
||||
* @param {Module} importedModule the imported module (optional)
|
||||
* @returns {{exports?: Set<string>, checked?: Set<string>} | undefined} information
|
||||
* @returns {{ exports?: Exports, checked?: Checked } | undefined} information
|
||||
*/
|
||||
getStarReexports(
|
||||
moduleGraph,
|
||||
@@ -248,9 +253,9 @@ class CommonJsExportRequireDependency extends ModuleDependency {
|
||||
const isNamespaceImport =
|
||||
importedModule.getExportsType(moduleGraph, false) === "namespace";
|
||||
|
||||
/** @type {Set<string>} */
|
||||
/** @type {Exports} */
|
||||
const exports = new Set();
|
||||
/** @type {Set<string>} */
|
||||
/** @type {Checked} */
|
||||
const checked = new Set();
|
||||
|
||||
if (noExtraImports) {
|
||||
@@ -403,3 +408,4 @@ CommonJsExportRequireDependency.Template = class CommonJsExportRequireDependency
|
||||
};
|
||||
|
||||
module.exports = CommonJsExportRequireDependency;
|
||||
module.exports.idsSymbol = idsSymbol;
|
||||
|
||||
3
node_modules/webpack/lib/dependencies/CommonJsExportsDependency.js
generated
vendored
3
node_modules/webpack/lib/dependencies/CommonJsExportsDependency.js
generated
vendored
@@ -16,6 +16,7 @@ const NullDependency = require("./NullDependency");
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
@@ -28,7 +29,7 @@ class CommonJsExportsDependency extends NullDependency {
|
||||
* @param {Range} range range
|
||||
* @param {Range | null} valueRange value range
|
||||
* @param {CommonJSDependencyBaseKeywords} base base
|
||||
* @param {string[]} names names
|
||||
* @param {ExportInfoName[]} names names
|
||||
*/
|
||||
constructor(range, valueRange, base, names) {
|
||||
super();
|
||||
|
||||
25
node_modules/webpack/lib/dependencies/CommonJsExportsParserPlugin.js
generated
vendored
25
node_modules/webpack/lib/dependencies/CommonJsExportsParserPlugin.js
generated
vendored
@@ -22,12 +22,14 @@ const ModuleDecoratorDependency = require("./ModuleDecoratorDependency");
|
||||
/** @typedef {import("estree").Super} Super */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../NormalModule")} NormalModule */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
||||
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Members} Members */
|
||||
/** @typedef {import("../javascript/JavascriptParser").StatementPath} StatementPath */
|
||||
/** @typedef {import("./CommonJsDependencyHelpers").CommonJSDependencyBaseKeywords} CommonJSDependencyBaseKeywords */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
|
||||
/**
|
||||
* This function takes a generic expression and detects whether it is an ObjectExpression.
|
||||
@@ -94,9 +96,10 @@ const isFalsyLiteral = (expr) => {
|
||||
/**
|
||||
* @param {JavascriptParser} parser the parser
|
||||
* @param {Expression} expr expression
|
||||
* @returns {{ argument: BasicEvaluatedExpression, ids: string[] } | undefined} parsed call
|
||||
* @returns {{ argument: BasicEvaluatedExpression, ids: ExportInfoName[] } | undefined} parsed call
|
||||
*/
|
||||
const parseRequireCall = (parser, expr) => {
|
||||
/** @type {ExportInfoName[]} */
|
||||
const ids = [];
|
||||
while (expr.type === "MemberExpression") {
|
||||
if (expr.object.type === "Super") return;
|
||||
@@ -146,7 +149,7 @@ class CommonJsExportsParserPlugin {
|
||||
|
||||
/**
|
||||
* @param {boolean} topLevel true, when the export is on top level
|
||||
* @param {string[]} members members of the export
|
||||
* @param {Members} members members of the export
|
||||
* @param {Expression | undefined} valueExpr expression for the value
|
||||
* @returns {void}
|
||||
*/
|
||||
@@ -189,7 +192,7 @@ class CommonJsExportsParserPlugin {
|
||||
/**
|
||||
* @param {AssignmentExpression} expr expression
|
||||
* @param {CommonJSDependencyBaseKeywords} base commonjs base keywords
|
||||
* @param {string[]} members members of the export
|
||||
* @param {Members} members members of the export
|
||||
* @returns {boolean | undefined} true, when the expression was handled
|
||||
*/
|
||||
const handleAssignExport = (expr, base, members) => {
|
||||
@@ -216,6 +219,10 @@ class CommonJsExportsParserPlugin {
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
dep.optional = Boolean(parser.scope.inTry);
|
||||
parser.state.module.addDependency(dep);
|
||||
/** @type {BuildMeta} */ (
|
||||
parser.state.module.buildMeta
|
||||
).treatAsCommonJs = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
if (members.length === 0) return;
|
||||
@@ -236,6 +243,8 @@ class CommonJsExportsParserPlugin {
|
||||
);
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
parser.state.module.addDependency(dep);
|
||||
/** @type {BuildMeta} */ (parser.state.module.buildMeta).treatAsCommonJs =
|
||||
true;
|
||||
parser.walkExpression(expr.right);
|
||||
return true;
|
||||
};
|
||||
@@ -293,6 +302,9 @@ class CommonJsExportsParserPlugin {
|
||||
);
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
parser.state.module.addDependency(dep);
|
||||
/** @type {BuildMeta} */ (
|
||||
parser.state.module.buildMeta
|
||||
).treatAsCommonJs = true;
|
||||
|
||||
parser.walkExpression(expr.arguments[2]);
|
||||
return true;
|
||||
@@ -303,7 +315,7 @@ class CommonJsExportsParserPlugin {
|
||||
/**
|
||||
* @param {Expression | Super} expr expression
|
||||
* @param {CommonJSDependencyBaseKeywords} base commonjs base keywords
|
||||
* @param {string[]} members members of the export
|
||||
* @param {Members} members members of the export
|
||||
* @param {CallExpression=} call call expression
|
||||
* @returns {boolean | void} true, when the expression was handled
|
||||
*/
|
||||
@@ -333,6 +345,9 @@ class CommonJsExportsParserPlugin {
|
||||
);
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
parser.state.module.addDependency(dep);
|
||||
/** @type {BuildMeta} */ (parser.state.module.buildMeta).treatAsCommonJs =
|
||||
true;
|
||||
|
||||
if (call) {
|
||||
parser.walkExpressions(call.arguments);
|
||||
}
|
||||
|
||||
10
node_modules/webpack/lib/dependencies/CommonJsFullRequireDependency.js
generated
vendored
10
node_modules/webpack/lib/dependencies/CommonJsFullRequireDependency.js
generated
vendored
@@ -14,20 +14,22 @@ const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
/** @typedef {import("../util/chainedImports").IdRanges} IdRanges */
|
||||
|
||||
class CommonJsFullRequireDependency extends ModuleDependency {
|
||||
/**
|
||||
* @param {string} request the request string
|
||||
* @param {Range} range location in source code
|
||||
* @param {string[]} names accessed properties on module
|
||||
* @param {Range[]=} idRanges ranges for members of ids; the two arrays are right-aligned
|
||||
* @param {ExportInfoName[]} names accessed properties on module
|
||||
* @param {IdRanges=} idRanges ranges for members of ids; the two arrays are right-aligned
|
||||
*/
|
||||
constructor(
|
||||
request,
|
||||
@@ -47,7 +49,7 @@ class CommonJsFullRequireDependency extends ModuleDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
if (this.call) {
|
||||
|
||||
23
node_modules/webpack/lib/dependencies/CommonJsImportsParserPlugin.js
generated
vendored
23
node_modules/webpack/lib/dependencies/CommonJsImportsParserPlugin.js
generated
vendored
@@ -38,6 +38,14 @@ const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportSource} ImportSource */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Members} Members */
|
||||
/** @typedef {import("../javascript/JavascriptParser").CalleeMembers} CalleeMembers */
|
||||
|
||||
/**
|
||||
* @typedef {object} CommonJsImportSettings
|
||||
* @property {string=} name
|
||||
* @property {string} context
|
||||
*/
|
||||
|
||||
const createRequireSpecifierTag = Symbol("createRequire");
|
||||
const createdRequireIdentifierTag = Symbol("createRequire()");
|
||||
@@ -58,10 +66,11 @@ class CommonJsImportsParserPlugin {
|
||||
*/
|
||||
apply(parser) {
|
||||
const options = this.options;
|
||||
|
||||
const getContext = () => {
|
||||
if (parser.currentTagData) {
|
||||
const { context } = parser.currentTagData;
|
||||
const { context } =
|
||||
/** @type {CommonJsImportSettings} */
|
||||
(parser.currentTagData);
|
||||
return context;
|
||||
}
|
||||
};
|
||||
@@ -69,7 +78,7 @@ class CommonJsImportsParserPlugin {
|
||||
// #region metadata
|
||||
/**
|
||||
* @param {string} expression expression
|
||||
* @param {() => string[]} getMembers get members
|
||||
* @param {() => Members} getMembers get members
|
||||
*/
|
||||
const tapRequireExpression = (expression, getMembers) => {
|
||||
parser.hooks.typeof
|
||||
@@ -366,9 +375,9 @@ class CommonJsImportsParserPlugin {
|
||||
// #region Require with property access
|
||||
/**
|
||||
* @param {Expression} expr expression
|
||||
* @param {string[]} calleeMembers callee members
|
||||
* @param {CalleeMembers} calleeMembers callee members
|
||||
* @param {CallExpression} callExpr call expression
|
||||
* @param {string[]} members members
|
||||
* @param {Members} members members
|
||||
* @param {Range[]} memberRanges member ranges
|
||||
* @returns {boolean | void} true when handled
|
||||
*/
|
||||
@@ -402,9 +411,9 @@ class CommonJsImportsParserPlugin {
|
||||
};
|
||||
/**
|
||||
* @param {CallExpression} expr expression
|
||||
* @param {string[]} calleeMembers callee members
|
||||
* @param {CalleeMembers} calleeMembers callee members
|
||||
* @param {CallExpression} callExpr call expression
|
||||
* @param {string[]} members members
|
||||
* @param {Members} members members
|
||||
* @param {Range[]} memberRanges member ranges
|
||||
* @returns {boolean | void} true when handled
|
||||
*/
|
||||
|
||||
2
node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js
generated
vendored
2
node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js
generated
vendored
@@ -20,7 +20,7 @@ class CommonJsRequireContextDependency extends ContextDependency {
|
||||
* @param {Range} range location in source code
|
||||
* @param {Range | undefined} valueRange location of the require call
|
||||
* @param {boolean | string } inShorthand true or name
|
||||
* @param {string} context context
|
||||
* @param {string=} context context
|
||||
*/
|
||||
constructor(options, range, valueRange, inShorthand, context) {
|
||||
super(options, context);
|
||||
|
||||
8
node_modules/webpack/lib/dependencies/CommonJsSelfReferenceDependency.js
generated
vendored
8
node_modules/webpack/lib/dependencies/CommonJsSelfReferenceDependency.js
generated
vendored
@@ -13,10 +13,10 @@ const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
@@ -27,7 +27,7 @@ class CommonJsSelfReferenceDependency extends NullDependency {
|
||||
/**
|
||||
* @param {Range} range range
|
||||
* @param {CommonJSDependencyBaseKeywords} base base
|
||||
* @param {string[]} names names
|
||||
* @param {ExportInfoName[]} names names
|
||||
* @param {boolean} call is a call
|
||||
*/
|
||||
constructor(range, base, names, call) {
|
||||
@@ -57,7 +57,7 @@ class CommonJsSelfReferenceDependency extends NullDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
return [this.call ? this.names.slice(0, -1) : this.names];
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/ConstDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/ConstDependency.js
generated
vendored
@@ -9,7 +9,7 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("./NullDependency").RawRuntimeRequirements} RawRuntimeRequirements */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
@@ -24,7 +24,7 @@ class ConstDependency extends NullDependency {
|
||||
/**
|
||||
* @param {string} expression the expression
|
||||
* @param {number | Range} range the source range
|
||||
* @param {(string[] | null)=} runtimeRequirements runtime requirements
|
||||
* @param {RawRuntimeRequirements | null=} runtimeRequirements runtime requirements
|
||||
*/
|
||||
constructor(expression, range, runtimeRequirements) {
|
||||
super();
|
||||
|
||||
13
node_modules/webpack/lib/dependencies/ContextDependency.js
generated
vendored
13
node_modules/webpack/lib/dependencies/ContextDependency.js
generated
vendored
@@ -10,6 +10,7 @@ const DependencyTemplate = require("../DependencyTemplate");
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const memoize = require("../util/memoize");
|
||||
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../ContextModule").ContextOptions} ContextOptions */
|
||||
/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
@@ -23,8 +24,10 @@ const getCriticalDependencyWarning = memoize(() =>
|
||||
|
||||
/** @typedef {ContextOptions & { request: string }} ContextDependencyOptions */
|
||||
|
||||
/** @typedef {{ value: string, range: Range }[]} Replaces */
|
||||
|
||||
/**
|
||||
* @param {RegExp | null | undefined} r regexp
|
||||
* @param {RegExp | false | null | undefined} r regexp
|
||||
* @returns {string} stringified regexp
|
||||
*/
|
||||
const regExpToString = (r) => (r ? String(r) : "");
|
||||
@@ -45,18 +48,22 @@ class ContextDependency extends Dependency {
|
||||
|
||||
if (
|
||||
this.options &&
|
||||
this.options.regExp &&
|
||||
(this.options.regExp.global || this.options.regExp.sticky)
|
||||
) {
|
||||
this.options = { ...this.options, regExp: null };
|
||||
this.hadGlobalOrStickyRegExp = true;
|
||||
}
|
||||
|
||||
/** @type {string | undefined} */
|
||||
this.request = undefined;
|
||||
/** @type {Range | undefined} */
|
||||
this.range = undefined;
|
||||
/** @type {Range | undefined} */
|
||||
this.valueRange = undefined;
|
||||
/** @type {boolean | string | undefined} */
|
||||
this.inShorthand = undefined;
|
||||
// TODO refactor this
|
||||
/** @type {Replaces | undefined} */
|
||||
this.replaces = undefined;
|
||||
this._requestContext = context;
|
||||
}
|
||||
@@ -141,7 +148,6 @@ class ContextDependency extends Dependency {
|
||||
write(this._requestContext);
|
||||
write(this.range);
|
||||
write(this.valueRange);
|
||||
write(this.prepend);
|
||||
write(this.replaces);
|
||||
|
||||
super.serialize(context);
|
||||
@@ -161,7 +167,6 @@ class ContextDependency extends Dependency {
|
||||
this._requestContext = read();
|
||||
this.range = read();
|
||||
this.valueRange = read();
|
||||
this.prepend = read();
|
||||
this.replaces = read();
|
||||
|
||||
super.deserialize(context);
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
generated
vendored
4
node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
generated
vendored
@@ -9,13 +9,13 @@ const { parseResource } = require("../util/identifier");
|
||||
|
||||
/** @typedef {import("estree").Expression} Expression */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("./ContextDependency")} ContextDependency */
|
||||
/** @typedef {import("./ContextDependency").ContextDependencyOptions} ContextDependencyOptions */
|
||||
/** @typedef {import("./ContextDependency").Replaces} Replaces */
|
||||
|
||||
/**
|
||||
* Escapes regular expression metacharacters
|
||||
@@ -119,7 +119,7 @@ module.exports.create = (
|
||||
);
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
|
||||
/** @type {{ value: string, range: Range }[]} */
|
||||
/** @type {Replaces} */
|
||||
const replaces = [];
|
||||
const parts = /** @type {BasicEvaluatedExpression[]} */ (param.parts);
|
||||
|
||||
|
||||
18
node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsId.js
generated
vendored
18
node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsId.js
generated
vendored
@@ -8,6 +8,7 @@
|
||||
const ContextDependency = require("./ContextDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
|
||||
@@ -28,11 +29,13 @@ class ContextDependencyTemplateAsId extends ContextDependency.Template {
|
||||
const moduleExports = runtimeTemplate.moduleExports({
|
||||
module,
|
||||
chunkGraph,
|
||||
request: dep.request,
|
||||
request: /** @type {string} */ (dep.request),
|
||||
weak: dep.weak,
|
||||
runtimeRequirements
|
||||
});
|
||||
|
||||
const range = /** @type {Range} */ (dep.range);
|
||||
|
||||
if (module) {
|
||||
if (dep.valueRange) {
|
||||
if (Array.isArray(dep.replaces)) {
|
||||
@@ -41,21 +44,18 @@ class ContextDependencyTemplateAsId extends ContextDependency.Template {
|
||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
||||
}
|
||||
}
|
||||
source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
|
||||
|
||||
source.replace(dep.valueRange[1], range[1] - 1, ")");
|
||||
source.replace(
|
||||
dep.range[0],
|
||||
range[0],
|
||||
dep.valueRange[0] - 1,
|
||||
`${moduleExports}.resolve(`
|
||||
);
|
||||
} else {
|
||||
source.replace(
|
||||
dep.range[0],
|
||||
dep.range[1] - 1,
|
||||
`${moduleExports}.resolve`
|
||||
);
|
||||
source.replace(range[0], range[1] - 1, `${moduleExports}.resolve`);
|
||||
}
|
||||
} else {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
|
||||
source.replace(range[0], range[1] - 1, moduleExports);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsRequireCall.js
generated
vendored
18
node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsRequireCall.js
generated
vendored
@@ -8,6 +8,7 @@
|
||||
const ContextDependency = require("./ContextDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
|
||||
@@ -27,13 +28,16 @@ class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template
|
||||
let moduleExports = runtimeTemplate.moduleExports({
|
||||
module: moduleGraph.getModule(dep),
|
||||
chunkGraph,
|
||||
request: dep.request,
|
||||
request: /** @type {string} */ (dep.request),
|
||||
runtimeRequirements
|
||||
});
|
||||
|
||||
if (dep.inShorthand) {
|
||||
moduleExports = `${dep.inShorthand}: ${moduleExports}`;
|
||||
}
|
||||
|
||||
const range = /** @type {Range} */ (dep.range);
|
||||
|
||||
if (moduleGraph.getModule(dep)) {
|
||||
if (dep.valueRange) {
|
||||
if (Array.isArray(dep.replaces)) {
|
||||
@@ -42,17 +46,13 @@ class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template
|
||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
||||
}
|
||||
}
|
||||
source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
|
||||
source.replace(
|
||||
dep.range[0],
|
||||
dep.valueRange[0] - 1,
|
||||
`${moduleExports}(`
|
||||
);
|
||||
source.replace(dep.valueRange[1], range[1] - 1, ")");
|
||||
source.replace(range[0], dep.valueRange[0] - 1, `${moduleExports}(`);
|
||||
} else {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
|
||||
source.replace(range[0], range[1] - 1, moduleExports);
|
||||
}
|
||||
} else {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
|
||||
source.replace(range[0], range[1] - 1, moduleExports);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
33
node_modules/webpack/lib/dependencies/ContextElementDependency.js
generated
vendored
33
node_modules/webpack/lib/dependencies/ContextElementDependency.js
generated
vendored
@@ -10,9 +10,9 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("../ContextModule")} ContextModule */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
@@ -25,7 +25,7 @@ class ContextElementDependency extends ModuleDependency {
|
||||
* @param {string | undefined} userRequest user request
|
||||
* @param {string | undefined} typePrefix type prefix
|
||||
* @param {string} category category
|
||||
* @param {(string[][] | null)=} referencedExports referenced exports
|
||||
* @param {RawReferencedExports | null=} referencedExports referenced exports
|
||||
* @param {string=} context context
|
||||
* @param {ImportAttributes=} attributes import assertions
|
||||
*/
|
||||
@@ -39,16 +39,16 @@ class ContextElementDependency extends ModuleDependency {
|
||||
attributes
|
||||
) {
|
||||
super(request);
|
||||
this.referencedExports = referencedExports;
|
||||
this._typePrefix = typePrefix;
|
||||
this._category = category;
|
||||
this._context = context || undefined;
|
||||
|
||||
if (userRequest) {
|
||||
this.userRequest = userRequest;
|
||||
}
|
||||
|
||||
this.assertions = attributes;
|
||||
this._typePrefix = typePrefix;
|
||||
this._category = category;
|
||||
this.referencedExports = referencedExports;
|
||||
this._context = context || undefined;
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
get type() {
|
||||
@@ -63,11 +63,22 @@ class ContextElementDependency extends ModuleDependency {
|
||||
return this._category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string | null} an identifier to merge equal requests
|
||||
*/
|
||||
getResourceIdentifier() {
|
||||
let str = super.getResourceIdentifier();
|
||||
if (this.attributes) {
|
||||
str += `|importAttributes${JSON.stringify(this.attributes)}`;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
if (!this.referencedExports) return Dependency.EXPORTS_OBJECT_REFERENCED;
|
||||
@@ -110,7 +121,7 @@ class ContextElementDependency extends ModuleDependency {
|
||||
write(this._typePrefix);
|
||||
write(this._category);
|
||||
write(this.referencedExports);
|
||||
write(this.assertions);
|
||||
write(this.attributes);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
@@ -122,7 +133,7 @@ class ContextElementDependency extends ModuleDependency {
|
||||
this._typePrefix = read();
|
||||
this._category = read();
|
||||
this.referencedExports = read();
|
||||
this.assertions = read();
|
||||
this.attributes = read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
||||
2
node_modules/webpack/lib/dependencies/CssIcssImportDependency.js
generated
vendored
2
node_modules/webpack/lib/dependencies/CssIcssImportDependency.js
generated
vendored
@@ -12,10 +12,8 @@ const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/CssIcssSymbolDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/CssIcssSymbolDependency.js
generated
vendored
@@ -11,7 +11,7 @@ const NullDependency = require("./NullDependency");
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
@@ -77,7 +77,7 @@ class CssIcssSymbolDependency extends NullDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
return [[this.name]];
|
||||
|
||||
8
node_modules/webpack/lib/dependencies/CssImportDependency.js
generated
vendored
8
node_modules/webpack/lib/dependencies/CssImportDependency.js
generated
vendored
@@ -9,19 +9,11 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
/** @typedef {import("../css/CssParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
class CssImportDependency extends ModuleDependency {
|
||||
/**
|
||||
|
||||
11
node_modules/webpack/lib/dependencies/CssLocalIdentifierDependency.js
generated
vendored
11
node_modules/webpack/lib/dependencies/CssLocalIdentifierDependency.js
generated
vendored
@@ -15,7 +15,6 @@ const NullDependency = require("./NullDependency");
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").CssGeneratorExportsConvention} CssGeneratorExportsConvention */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").CssGeneratorLocalIdentName} CssGeneratorLocalIdentName */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").HashFunction} HashFunction */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../CssModule")} CssModule */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
@@ -23,7 +22,6 @@ const NullDependency = require("./NullDependency");
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../NormalModuleFactory").ResourceDataWithData} ResourceDataWithData */
|
||||
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
||||
/** @typedef {import("../css/CssGenerator")} CssGenerator */
|
||||
/** @typedef {import("../css/CssParser").Range} Range */
|
||||
@@ -48,12 +46,13 @@ const getLocalIdent = (local, module, chunkGraph, runtimeTemplate) => {
|
||||
const relativeResourcePath = makePathsRelative(
|
||||
/** @type {string} */
|
||||
(module.context),
|
||||
module.matchResource || module.resource,
|
||||
/** @type {string} */
|
||||
(module.getResource()),
|
||||
runtimeTemplate.compilation.compiler.root
|
||||
);
|
||||
const { hashFunction, hashDigest, hashDigestLength, hashSalt, uniqueName } =
|
||||
runtimeTemplate.outputOptions;
|
||||
const hash = createHash(/** @type {HashFunction} */ (hashFunction));
|
||||
const hash = createHash(hashFunction);
|
||||
|
||||
if (hashSalt) {
|
||||
hash.update(hashSalt);
|
||||
@@ -65,9 +64,7 @@ const getLocalIdent = (local, module, chunkGraph, runtimeTemplate) => {
|
||||
hash.update(local);
|
||||
}
|
||||
|
||||
const localIdentHash =
|
||||
/** @type {string} */
|
||||
(hash.digest(hashDigest)).slice(0, hashDigestLength);
|
||||
const localIdentHash = hash.digest(hashDigest).slice(0, hashDigestLength);
|
||||
|
||||
return runtimeTemplate.compilation
|
||||
.getPath(localIdentName, {
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/CssSelfLocalIdentifierDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/CssSelfLocalIdentifierDependency.js
generated
vendored
@@ -11,7 +11,7 @@ const CssLocalIdentifierDependency = require("./CssLocalIdentifierDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../css/CssParser").Range} Range */
|
||||
@@ -60,7 +60,7 @@ class CssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
if (this.declaredSet && !this.declaredSet.has(this.name)) {
|
||||
|
||||
6
node_modules/webpack/lib/dependencies/CssUrlDependency.js
generated
vendored
6
node_modules/webpack/lib/dependencies/CssUrlDependency.js
generated
vendored
@@ -11,20 +11,14 @@ const memoize = require("../util/memoize");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
const getIgnoredRawDataUrlModule = memoize(
|
||||
|
||||
16
node_modules/webpack/lib/dependencies/ExportsInfoDependency.js
generated
vendored
16
node_modules/webpack/lib/dependencies/ExportsInfoDependency.js
generated
vendored
@@ -10,16 +10,14 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
/**
|
||||
@@ -30,13 +28,13 @@ const NullDependency = require("./NullDependency");
|
||||
/**
|
||||
* @param {ModuleGraph} moduleGraph the module graph
|
||||
* @param {Module} module the module
|
||||
* @param {string[] | null} _exportName name of the export if any
|
||||
* @param {ExportInfoName[] | null} exportName_ name of the export if any
|
||||
* @param {string | null} property name of the requested property
|
||||
* @param {RuntimeSpec} runtime for which runtime
|
||||
* @returns {undefined | null | number | boolean | string[] | SortableSet<string>} value of the property
|
||||
* @returns {undefined | null | boolean | ExportInfoName[]} value of the property
|
||||
*/
|
||||
const getProperty = (moduleGraph, module, _exportName, property, runtime) => {
|
||||
if (!_exportName) {
|
||||
const getProperty = (moduleGraph, module, exportName_, property, runtime) => {
|
||||
if (!exportName_) {
|
||||
switch (property) {
|
||||
case "usedExports": {
|
||||
const usedExports = moduleGraph
|
||||
@@ -53,7 +51,7 @@ const getProperty = (moduleGraph, module, _exportName, property, runtime) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
const exportName = /** @type {string[]} */ (_exportName);
|
||||
const exportName = /** @type {ExportInfoName[]} */ (exportName_);
|
||||
switch (property) {
|
||||
case "canMangle": {
|
||||
const exportsInfo = moduleGraph.getExportsInfo(module);
|
||||
@@ -92,7 +90,7 @@ const getProperty = (moduleGraph, module, _exportName, property, runtime) => {
|
||||
class ExportsInfoDependency extends NullDependency {
|
||||
/**
|
||||
* @param {Range} range range
|
||||
* @param {string[] | null} exportName export name
|
||||
* @param {ExportInfoName[] | null} exportName export name
|
||||
* @param {string | null} property property
|
||||
*/
|
||||
constructor(range, exportName, property) {
|
||||
|
||||
3
node_modules/webpack/lib/dependencies/ExternalModuleDependency.js
generated
vendored
3
node_modules/webpack/lib/dependencies/ExternalModuleDependency.js
generated
vendored
@@ -11,13 +11,10 @@ const ExternalModuleInitFragment = require("./ExternalModuleInitFragment");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
|
||||
class ExternalModuleDependency extends CachedConstDependency {
|
||||
/**
|
||||
|
||||
2
node_modules/webpack/lib/dependencies/ExternalModuleInitFragment.js
generated
vendored
2
node_modules/webpack/lib/dependencies/ExternalModuleInitFragment.js
generated
vendored
@@ -20,7 +20,7 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
class ExternalModuleInitFragment extends InitFragment {
|
||||
/**
|
||||
* @param {string} importedModule imported module
|
||||
* @param {Array<{ name: string, value?: string }> | ImportSpecifiers} specifiers import specifiers
|
||||
* @param {{ name: string, value?: string }[] | ImportSpecifiers} specifiers import specifiers
|
||||
* @param {string=} defaultImport default import
|
||||
*/
|
||||
constructor(importedModule, specifiers, defaultImport) {
|
||||
|
||||
2
node_modules/webpack/lib/dependencies/HarmonyAcceptDependency.js
generated
vendored
2
node_modules/webpack/lib/dependencies/HarmonyAcceptDependency.js
generated
vendored
@@ -120,7 +120,7 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends
|
||||
for (const d of module.dependencies) {
|
||||
if (deferDependency && noDeferredDependency) break;
|
||||
if (isRelatedHarmonyImportDependency(dependency, d)) {
|
||||
if (d.defer) {
|
||||
if (/** @type {HarmonyImportDependency} */ (d).defer) {
|
||||
deferDependency = /** @type {HarmonyImportDependency} */ (d);
|
||||
} else {
|
||||
noDeferredDependency = /** @type {HarmonyImportDependency} */ (d);
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/HarmonyAcceptImportDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/HarmonyAcceptImportDependency.js
generated
vendored
@@ -9,10 +9,6 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
|
||||
class HarmonyAcceptImportDependency extends HarmonyImportDependency {
|
||||
/**
|
||||
* @param {string} request the request string
|
||||
|
||||
1
node_modules/webpack/lib/dependencies/HarmonyCompatibilityDependency.js
generated
vendored
1
node_modules/webpack/lib/dependencies/HarmonyCompatibilityDependency.js
generated
vendored
@@ -14,7 +14,6 @@ const NullDependency = require("./NullDependency");
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
|
||||
class HarmonyCompatibilityDependency extends NullDependency {
|
||||
|
||||
14
node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js
generated
vendored
14
node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js
generated
vendored
@@ -13,19 +13,10 @@ const HarmonyExports = require("./HarmonyExports");
|
||||
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("./HarmonyModulesPlugin").HarmonyModulesPluginOptions} HarmonyModulesPluginOptions */
|
||||
|
||||
const PLUGIN_NAME = "HarmonyDetectionParserPlugin";
|
||||
|
||||
module.exports = class HarmonyDetectionParserPlugin {
|
||||
/**
|
||||
* @param {HarmonyModulesPluginOptions} options options
|
||||
*/
|
||||
constructor(options) {
|
||||
const { topLevelAwait = false } = options || {};
|
||||
this.topLevelAwait = topLevelAwait;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {JavascriptParser} parser the parser
|
||||
* @returns {void}
|
||||
@@ -66,11 +57,6 @@ module.exports = class HarmonyDetectionParserPlugin {
|
||||
|
||||
parser.hooks.topLevelAwait.tap(PLUGIN_NAME, () => {
|
||||
const module = parser.state.module;
|
||||
if (!this.topLevelAwait) {
|
||||
throw new Error(
|
||||
"The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enable it)"
|
||||
);
|
||||
}
|
||||
if (!HarmonyExports.isEnabled(parser.state)) {
|
||||
throw new Error(
|
||||
"Top-level-await is only supported in EcmaScript Modules"
|
||||
|
||||
6
node_modules/webpack/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js
generated
vendored
6
node_modules/webpack/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js
generated
vendored
@@ -9,7 +9,6 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
@@ -18,6 +17,7 @@ const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDepend
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("./HarmonyImportDependency").Ids} Ids */
|
||||
|
||||
/**
|
||||
* Dependency for static evaluating import specifier. e.g.
|
||||
@@ -30,10 +30,10 @@ class HarmonyEvaluatedImportSpecifierDependency extends HarmonyImportSpecifierDe
|
||||
/**
|
||||
* @param {string} request the request string
|
||||
* @param {number} sourceOrder source order
|
||||
* @param {string[]} ids ids
|
||||
* @param {Ids} ids ids
|
||||
* @param {string} name name
|
||||
* @param {Range} range location in source code
|
||||
* @param {ImportAttributes} attributes import assertions
|
||||
* @param {ImportAttributes | undefined} attributes import assertions
|
||||
* @param {string} operator operator
|
||||
*/
|
||||
constructor(request, sourceOrder, ids, name, range, attributes, operator) {
|
||||
|
||||
5
node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
generated
vendored
5
node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
generated
vendored
@@ -25,6 +25,7 @@ const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDepe
|
||||
/** @typedef {import("../javascript/JavascriptParser").ClassDeclaration} ClassDeclaration */
|
||||
/** @typedef {import("../javascript/JavascriptParser").FunctionDeclaration} FunctionDeclaration */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("./HarmonyImportDependencyParserPlugin").HarmonySettings} HarmonySettings */
|
||||
|
||||
const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency;
|
||||
|
||||
@@ -156,7 +157,9 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
||||
parser.hooks.exportSpecifier.tap(
|
||||
PLUGIN_NAME,
|
||||
(statement, id, name, idx) => {
|
||||
const settings = parser.getTagData(id, harmonySpecifierTag);
|
||||
const settings =
|
||||
/** @type {HarmonySettings} */
|
||||
(parser.getTagData(id, harmonySpecifierTag));
|
||||
const harmonyNamedExports = (parser.state.harmonyNamedExports =
|
||||
parser.state.harmonyNamedExports || new Set());
|
||||
harmonyNamedExports.add(name);
|
||||
|
||||
64
node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js
generated
vendored
64
node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js
generated
vendored
@@ -33,17 +33,19 @@ const processExportInfo = require("./processExportInfo");
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ExportsInfo")} ExportsInfo */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
||||
/** @typedef {import("../ExportsInfo").UsedName} UsedName */
|
||||
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
|
||||
/** @typedef {import("../Module").ExportsType} ExportsType */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
@@ -52,10 +54,9 @@ const processExportInfo = require("./processExportInfo");
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
/** @typedef {import("./HarmonyImportDependency").Ids} Ids */
|
||||
/** @typedef {import("./HarmonyImportDependency").ExportPresenceMode} ExportPresenceMode */
|
||||
/** @typedef {import("./processExportInfo").ReferencedExports} ReferencedExports */
|
||||
|
||||
/** @typedef {"missing"|"unused"|"empty-star"|"reexport-dynamic-default"|"reexport-named-default"|"reexport-namespace-object"|"reexport-fake-namespace-object"|"reexport-undefined"|"normal-reexport"|"dynamic-reexport"} ExportModeType */
|
||||
|
||||
@@ -66,7 +67,7 @@ const idsSymbol = Symbol("HarmonyExportImportedSpecifierDependency.ids");
|
||||
class NormalReexportItem {
|
||||
/**
|
||||
* @param {string} name export name
|
||||
* @param {string[]} ids reexported ids from other module
|
||||
* @param {Ids} ids reexported ids from other module
|
||||
* @param {ExportInfo} exportInfo export info from other module
|
||||
* @param {boolean} checked true, if it should be checked at runtime if this export exists
|
||||
* @param {boolean} hidden true, if it is hidden behind another active export in the same module
|
||||
@@ -119,23 +120,22 @@ class ExportMode {
|
||||
}
|
||||
}
|
||||
|
||||
/** @typedef {string[]} Names */
|
||||
/** @typedef {number[]} DependencyIndices */
|
||||
|
||||
/**
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {ReadonlyArray<HarmonyExportImportedSpecifierDependency>} dependencies dependencies
|
||||
* @param {TODO=} additionalDependency additional dependency
|
||||
* @returns {{ names: Names, dependencyIndices: DependencyIndices }} result
|
||||
* @param {HarmonyExportImportedSpecifierDependency[]} dependencies dependencies
|
||||
* @param {HarmonyExportImportedSpecifierDependency=} additionalDependency additional dependency
|
||||
* @returns {{ names: ExportInfoName[], dependencyIndices: DependencyIndices }} result
|
||||
*/
|
||||
const determineExportAssignments = (
|
||||
moduleGraph,
|
||||
dependencies,
|
||||
additionalDependency
|
||||
) => {
|
||||
/** @type {Set<string>} */
|
||||
/** @type {Set<ExportInfoName>} */
|
||||
const names = new Set();
|
||||
/** @type {number[]} */
|
||||
/** @type {DependencyIndices} */
|
||||
const dependencyIndices = [];
|
||||
|
||||
if (additionalDependency) {
|
||||
@@ -167,7 +167,7 @@ const determineExportAssignments = (
|
||||
|
||||
/**
|
||||
* @param {object} options options
|
||||
* @param {Names} options.names names
|
||||
* @param {ExportInfoName[]} options.names names
|
||||
* @param {DependencyIndices} options.dependencyIndices dependency indices
|
||||
* @param {string} name name
|
||||
* @param {ReadonlyArray<HarmonyExportImportedSpecifierDependency>} dependencies dependencies
|
||||
@@ -339,7 +339,7 @@ const getMode = (moduleGraph, dep, runtimeKey) => {
|
||||
exportName,
|
||||
[exportName],
|
||||
exportsInfo.getReadOnlyExportInfo(exportName),
|
||||
/** @type {Set<string>} */
|
||||
/** @type {Checked} */
|
||||
(checked).has(exportName),
|
||||
false
|
||||
)
|
||||
@@ -361,7 +361,6 @@ const getMode = (moduleGraph, dep, runtimeKey) => {
|
||||
return mode;
|
||||
};
|
||||
|
||||
/** @typedef {string[]} Ids */
|
||||
/** @typedef {Set<string>} Exports */
|
||||
/** @typedef {Set<string>} Checked */
|
||||
/** @typedef {Set<string>} Hidden */
|
||||
@@ -515,7 +514,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
||||
importedExportsInfo.getReadOnlyExportInfo(name);
|
||||
if (importedExportInfo.provided === false) continue;
|
||||
if (hiddenExports !== undefined && hiddenExports.has(name)) {
|
||||
/** @type {Set<string>} */
|
||||
/** @type {Hidden} */
|
||||
(hidden).add(name);
|
||||
continue;
|
||||
}
|
||||
@@ -567,7 +566,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
const mode = this.getMode(moduleGraph, runtime);
|
||||
@@ -586,7 +585,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
||||
if (!mode.partialNamespaceExportInfo) {
|
||||
return Dependency.EXPORTS_OBJECT_REFERENCED;
|
||||
}
|
||||
/** @type {ReferencedExports} */
|
||||
/** @type {RawReferencedExports} */
|
||||
const referencedExports = [];
|
||||
processExportInfo(
|
||||
runtime,
|
||||
@@ -602,7 +601,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
||||
if (!mode.partialNamespaceExportInfo) {
|
||||
return Dependency.EXPORTS_OBJECT_REFERENCED;
|
||||
}
|
||||
/** @type {ReferencedExports} */
|
||||
/** @type {RawReferencedExports} */
|
||||
const referencedExports = [];
|
||||
processExportInfo(
|
||||
runtime,
|
||||
@@ -618,7 +617,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
||||
return Dependency.EXPORTS_OBJECT_REFERENCED;
|
||||
|
||||
case "normal-reexport": {
|
||||
/** @type {ReferencedExports} */
|
||||
/** @type {RawReferencedExports} */
|
||||
const referencedExports = [];
|
||||
for (const {
|
||||
ids,
|
||||
@@ -638,7 +637,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
||||
|
||||
/**
|
||||
* @param {ModuleGraph} moduleGraph the module graph
|
||||
* @returns {{ names: Names, namesSlice: number, dependencyIndices: DependencyIndices, dependencyIndex: number } | undefined} exported names and their origin dependency
|
||||
* @returns {{ names: ExportInfoName[], namesSlice: number, dependencyIndices: DependencyIndices, dependencyIndex: number } | undefined} exported names and their origin dependency
|
||||
*/
|
||||
_discoverActiveExportsFromOtherStarExports(moduleGraph) {
|
||||
if (!this.otherStarExports) return;
|
||||
@@ -880,7 +879,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
||||
const importedModule = moduleGraph.getModule(this);
|
||||
if (importedModule) {
|
||||
const exportsInfo = moduleGraph.getExportsInfo(importedModule);
|
||||
/** @type {Map<string, string[]>} */
|
||||
/** @type {Map<string, ExportInfoName[]>} */
|
||||
const conflicts = new Map();
|
||||
for (const exportInfo of exportsInfo.orderedExports) {
|
||||
if (exportInfo.provided !== true) continue;
|
||||
@@ -980,8 +979,6 @@ makeSerializable(
|
||||
"webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency"
|
||||
);
|
||||
|
||||
module.exports = HarmonyExportImportedSpecifierDependency;
|
||||
|
||||
HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedSpecifierDependencyTemplate extends (
|
||||
HarmonyImportDependency.Template
|
||||
) {
|
||||
@@ -1233,14 +1230,9 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
||||
mode.hidden
|
||||
)
|
||||
: /** @type {ExportModeIgnored} */ (mode.ignored);
|
||||
const modern =
|
||||
runtimeTemplate.supportsConst() &&
|
||||
runtimeTemplate.supportsArrowFunction();
|
||||
let content =
|
||||
"/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n" +
|
||||
`/* harmony reexport (unknown) */ for(${
|
||||
modern ? "const" : "var"
|
||||
} __WEBPACK_IMPORT_KEY__ in ${importVar}) `;
|
||||
`/* harmony reexport (unknown) */ for(${runtimeTemplate.renderConst()} __WEBPACK_IMPORT_KEY__ in ${importVar}) `;
|
||||
|
||||
// Filter out exports which are defined by other exports
|
||||
// and filter out default export because it cannot be reexported with *
|
||||
@@ -1255,7 +1247,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
||||
}
|
||||
|
||||
content += "__WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = ";
|
||||
content += modern
|
||||
content += runtimeTemplate.supportsArrowFunction()
|
||||
? `() => ${importVar}[__WEBPACK_IMPORT_KEY__]`
|
||||
: `function(key) { return ${importVar}[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)`;
|
||||
|
||||
@@ -1285,7 +1277,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
||||
* @param {string} comment comment
|
||||
* @param {UsedName} key key
|
||||
* @param {string} name name
|
||||
* @param {string | string[] | null | false} valueKey value key
|
||||
* @param {UsedName | null} valueKey value key
|
||||
* @param {RuntimeRequirements} runtimeRequirements runtime requirements
|
||||
* @returns {HarmonyExportInitFragment} harmony export init fragment
|
||||
*/
|
||||
@@ -1310,7 +1302,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
||||
|
||||
/**
|
||||
* @param {Module} module module
|
||||
* @param {string | string[] | false} key key
|
||||
* @param {UsedName} key key
|
||||
* @param {string} name name
|
||||
* @param {number} fakeType fake type
|
||||
* @param {RuntimeRequirements} runtimeRequirements runtime requirements
|
||||
@@ -1349,10 +1341,10 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
||||
/**
|
||||
* @param {Module} module module
|
||||
* @param {ChunkGraph} chunkGraph chunkGraph
|
||||
* @param {string | false | string[]} key key
|
||||
* @param {UsedName} key key
|
||||
* @param {string} name name
|
||||
* @param {import("../Module").ExportsType} exportsType exportsType
|
||||
* @param {Set<string>} runtimeRequirements runtimeRequirements
|
||||
* @param {ExportsType} exportsType exportsType
|
||||
* @param {RuntimeRequirements} runtimeRequirements runtimeRequirements
|
||||
* @returns {InitFragment<GenerateContext>[]} fragments
|
||||
*/
|
||||
getReexportDeferredNamespaceObjectFragments(
|
||||
@@ -1484,4 +1476,6 @@ makeSerializable(
|
||||
"HarmonyStarExportsList"
|
||||
);
|
||||
|
||||
module.exports = HarmonyExportImportedSpecifierDependency;
|
||||
module.exports.HarmonyStarExportsList = HarmonyStarExportsList;
|
||||
module.exports.idsSymbol = idsSymbol;
|
||||
|
||||
47
node_modules/webpack/lib/dependencies/HarmonyImportDependency.js
generated
vendored
47
node_modules/webpack/lib/dependencies/HarmonyImportDependency.js
generated
vendored
@@ -15,21 +15,16 @@ const { filterRuntime, mergeRuntime } = require("../util/runtime");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ExportsInfo")} ExportsInfo */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
||||
/** @typedef {import("../WebpackError")} WebpackError */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
/** @typedef {0 | 1 | 2 | 3 | false} ExportPresenceMode */
|
||||
@@ -59,6 +54,8 @@ const ExportPresenceModes = {
|
||||
}
|
||||
};
|
||||
|
||||
/** @typedef {string[]} Ids */
|
||||
|
||||
class HarmonyImportDependency extends ModuleDependency {
|
||||
/**
|
||||
* @param {string} request request string
|
||||
@@ -69,7 +66,7 @@ class HarmonyImportDependency extends ModuleDependency {
|
||||
constructor(request, sourceOrder, attributes, defer) {
|
||||
super(request);
|
||||
this.sourceOrder = sourceOrder;
|
||||
this.assertions = attributes;
|
||||
this.attributes = attributes;
|
||||
this.defer = defer;
|
||||
}
|
||||
|
||||
@@ -77,11 +74,25 @@ class HarmonyImportDependency extends ModuleDependency {
|
||||
return "esm";
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string | null} an identifier to merge equal requests
|
||||
*/
|
||||
getResourceIdentifier() {
|
||||
let str = super.getResourceIdentifier();
|
||||
if (this.defer) {
|
||||
str += "|defer";
|
||||
}
|
||||
if (this.attributes) {
|
||||
str += `|importAttributes${JSON.stringify(this.attributes)}`;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
return Dependency.NO_EXPORTS_REFERENCED;
|
||||
@@ -98,17 +109,23 @@ class HarmonyImportDependency extends ModuleDependency {
|
||||
|
||||
const metaKey = defer ? "deferredImportVarMap" : "importVarMap";
|
||||
let importVarMap = meta[metaKey];
|
||||
if (!importVarMap) meta[metaKey] = importVarMap = new Map();
|
||||
if (!importVarMap) {
|
||||
meta[metaKey] = importVarMap =
|
||||
/** @type {Map<Module, string>} */
|
||||
(new Map());
|
||||
}
|
||||
|
||||
let importVar = importVarMap.get(
|
||||
/** @type {Module} */ (moduleGraph.getModule(this))
|
||||
/** @type {Module} */
|
||||
(moduleGraph.getModule(this))
|
||||
);
|
||||
if (importVar) return importVar;
|
||||
importVar = `${Template.toIdentifier(
|
||||
`${this.userRequest}`
|
||||
)}__WEBPACK_${this.defer ? "DEFERRED_" : ""}IMPORTED_MODULE_${importVarMap.size}__`;
|
||||
importVarMap.set(
|
||||
/** @type {Module} */ (moduleGraph.getModule(this)),
|
||||
/** @type {Module} */
|
||||
(moduleGraph.getModule(this)),
|
||||
importVar
|
||||
);
|
||||
return importVar;
|
||||
@@ -156,7 +173,7 @@ class HarmonyImportDependency extends ModuleDependency {
|
||||
|
||||
/**
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {string[]} ids imported ids
|
||||
* @param {Ids} ids imported ids
|
||||
* @param {string} additionalMessage extra info included in the error message
|
||||
* @returns {WebpackError[] | undefined} errors
|
||||
*/
|
||||
@@ -273,7 +290,8 @@ class HarmonyImportDependency extends ModuleDependency {
|
||||
serialize(context) {
|
||||
const { write } = context;
|
||||
write(this.sourceOrder);
|
||||
write(this.assertions);
|
||||
write(this.attributes);
|
||||
write(this.defer);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
@@ -283,7 +301,8 @@ class HarmonyImportDependency extends ModuleDependency {
|
||||
deserialize(context) {
|
||||
const { read } = context;
|
||||
this.sourceOrder = read();
|
||||
this.assertions = read();
|
||||
this.attributes = read();
|
||||
this.defer = read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
||||
43
node_modules/webpack/lib/dependencies/HarmonyImportDependencyParserPlugin.js
generated
vendored
43
node_modules/webpack/lib/dependencies/HarmonyImportDependencyParserPlugin.js
generated
vendored
@@ -24,31 +24,24 @@ const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDepend
|
||||
|
||||
/** @typedef {import("estree").Expression} Expression */
|
||||
/** @typedef {import("estree").Identifier} Identifier */
|
||||
/** @typedef {import("estree").Literal} Literal */
|
||||
/** @typedef {import("estree").MemberExpression} MemberExpression */
|
||||
/** @typedef {import("estree").ObjectExpression} ObjectExpression */
|
||||
/** @typedef {import("estree").Property} Property */
|
||||
/** @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").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ExportAllDeclaration} ExportAllDeclaration */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ExportNamedDeclaration} ExportNamedDeclaration */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportDeclaration} ImportDeclaration */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportExpression} ImportExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../javascript/JavascriptParser").TagData} TagData */
|
||||
/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */
|
||||
/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */
|
||||
/** @typedef {import("./HarmonyImportDependency")} HarmonyImportDependency */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Members} Members */
|
||||
/** @typedef {import("../javascript/JavascriptParser").MembersOptionals} MembersOptionals */
|
||||
/** @typedef {import("./HarmonyImportDependency").Ids} Ids */
|
||||
|
||||
const harmonySpecifierTag = Symbol("harmony import");
|
||||
|
||||
/**
|
||||
* @typedef {object} HarmonySettings
|
||||
* @property {string[]} ids
|
||||
* @property {Ids} ids
|
||||
* @property {string} source
|
||||
* @property {number} sourceOrder
|
||||
* @property {string} name
|
||||
@@ -84,9 +77,9 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
||||
const { exportPresenceMode } = this;
|
||||
|
||||
/**
|
||||
* @param {string[]} members members
|
||||
* @param {boolean[]} membersOptionals members Optionals
|
||||
* @returns {string[]} a non optional part
|
||||
* @param {Members} members members
|
||||
* @param {MembersOptionals} membersOptionals members Optionals
|
||||
* @returns {Ids} a non optional part
|
||||
*/
|
||||
function getNonOptionalPart(members, membersOptionals) {
|
||||
let i = 0;
|
||||
@@ -158,14 +151,18 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
||||
const defer = this.deferImport
|
||||
? getImportMode(parser, statement).defer
|
||||
: false;
|
||||
parser.tagVariable(name, harmonySpecifierTag, {
|
||||
parser.tagVariable(
|
||||
name,
|
||||
source,
|
||||
ids,
|
||||
sourceOrder: parser.state.lastHarmonyImportOrder,
|
||||
attributes: getImportAttributes(statement),
|
||||
defer
|
||||
});
|
||||
harmonySpecifierTag,
|
||||
/** @type {HarmonySettings} */ ({
|
||||
name,
|
||||
source,
|
||||
ids,
|
||||
sourceOrder: parser.state.lastHarmonyImportOrder,
|
||||
attributes: getImportAttributes(statement),
|
||||
defer
|
||||
})
|
||||
);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
@@ -191,10 +188,10 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
||||
return;
|
||||
}
|
||||
const settings =
|
||||
/** @type {TagData} */
|
||||
/** @type {HarmonySettings} */
|
||||
(rootInfo.tagInfo.data);
|
||||
const members =
|
||||
/** @type {(() => string[])} */
|
||||
/** @type {(() => Members)} */
|
||||
(rightPart.getMembers)();
|
||||
const dep = new HarmonyEvaluatedImportSpecifierDependency(
|
||||
settings.source,
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/HarmonyImportSideEffectDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/HarmonyImportSideEffectDependency.js
generated
vendored
@@ -14,12 +14,8 @@ const HarmonyImportDependency = require("./HarmonyImportDependency");
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
/** @typedef {import("../WebpackError")} WebpackError */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
|
||||
/**
|
||||
|
||||
77
node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js
generated
vendored
77
node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js
generated
vendored
@@ -13,29 +13,29 @@ const {
|
||||
const { getTrimmedIdsAndRange } = require("../util/chainedImports");
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const propertyAccess = require("../util/propertyAccess");
|
||||
const traverseDestructuringAssignmentProperties = require("../util/traverseDestructuringAssignmentProperties");
|
||||
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
/** @typedef {import("../WebpackError")} WebpackError */
|
||||
/** @typedef {import("../javascript/JavascriptParser").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
|
||||
/** @typedef {import("../javascript/JavascriptParser").DestructuringAssignmentProperties} DestructuringAssignmentProperties */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../optimize/InnerGraph").UsedByExports} UsedByExports */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
/** @typedef {import("../util/chainedImports").IdRanges} IdRanges */
|
||||
/** @typedef {import("./HarmonyImportDependency").ExportPresenceMode} ExportPresenceMode */
|
||||
/** @typedef {HarmonyImportDependency.Ids} Ids */
|
||||
|
||||
const idsSymbol = Symbol("HarmonyImportSpecifierDependency.ids");
|
||||
|
||||
@@ -45,12 +45,12 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
||||
/**
|
||||
* @param {string} request request
|
||||
* @param {number} sourceOrder source order
|
||||
* @param {string[]} ids ids
|
||||
* @param {Ids} ids ids
|
||||
* @param {string} name name
|
||||
* @param {Range} range range
|
||||
* @param {ExportPresenceMode} exportPresenceMode export presence mode
|
||||
* @param {ImportAttributes | undefined} attributes import attributes
|
||||
* @param {Range[] | undefined} idRanges ranges for members of ids; the two arrays are right-aligned
|
||||
* @param {IdRanges | undefined} idRanges ranges for members of ids; the two arrays are right-aligned
|
||||
* @param {boolean=} defer is defer phase
|
||||
*/
|
||||
constructor(
|
||||
@@ -75,9 +75,9 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
||||
this.directImport = undefined;
|
||||
this.shorthand = undefined;
|
||||
this.asiSafe = undefined;
|
||||
/** @type {Set<string> | boolean | undefined} */
|
||||
/** @type {UsedByExports | undefined} */
|
||||
this.usedByExports = undefined;
|
||||
/** @type {Set<DestructuringAssignmentProperty> | undefined} */
|
||||
/** @type {DestructuringAssignmentProperties | undefined} */
|
||||
this.referencedPropertiesInDestructuring = undefined;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
||||
|
||||
/**
|
||||
* @param {ModuleGraph} moduleGraph the module graph
|
||||
* @returns {string[]} the imported ids
|
||||
* @returns {Ids} the imported ids
|
||||
*/
|
||||
getIds(moduleGraph) {
|
||||
const meta = moduleGraph.getMetaIfExisting(this);
|
||||
@@ -113,7 +113,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
||||
|
||||
/**
|
||||
* @param {ModuleGraph} moduleGraph the module graph
|
||||
* @param {string[]} ids the imported ids
|
||||
* @param {Ids} ids the imported ids
|
||||
* @returns {void}
|
||||
*/
|
||||
setIds(moduleGraph, ids) {
|
||||
@@ -144,7 +144,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
let ids = this.getIds(moduleGraph);
|
||||
@@ -190,15 +190,21 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string[]=} ids ids
|
||||
* @returns {string[][]} referenced exports
|
||||
* @param {Ids=} ids ids
|
||||
* @returns {RawReferencedExports} referenced exports
|
||||
*/
|
||||
_getReferencedExportsInDestructuring(ids) {
|
||||
if (this.referencedPropertiesInDestructuring) {
|
||||
/** @type {string[][]} */
|
||||
/** @type {RawReferencedExports} */
|
||||
const refsInDestructuring = [];
|
||||
traverseDestructuringAssignmentProperties(
|
||||
this.referencedPropertiesInDestructuring,
|
||||
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
|
||||
);
|
||||
/** @type {RawReferencedExports} */
|
||||
const refs = [];
|
||||
for (const { id } of this.referencedPropertiesInDestructuring) {
|
||||
refs.push(ids ? [...ids, id] : [id]);
|
||||
for (const idsInDestructuring of refsInDestructuring) {
|
||||
refs.push(ids ? [...ids, ...idsInDestructuring] : idsInDestructuring);
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
@@ -375,13 +381,23 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
|
||||
}
|
||||
}
|
||||
|
||||
for (const {
|
||||
id,
|
||||
shorthand,
|
||||
range
|
||||
} of dep.referencedPropertiesInDestructuring) {
|
||||
/** @type {string[]} */
|
||||
const concatedIds = [...prefixedIds, id];
|
||||
/** @type {{ ids: Ids, range: Range, shorthand: boolean | string }[]} */
|
||||
const replacementsInDestructuring = [];
|
||||
traverseDestructuringAssignmentProperties(
|
||||
dep.referencedPropertiesInDestructuring,
|
||||
undefined,
|
||||
(stack) => {
|
||||
const property = stack[stack.length - 1];
|
||||
replacementsInDestructuring.push({
|
||||
ids: stack.map((p) => p.id),
|
||||
range: property.range,
|
||||
shorthand: property.shorthand
|
||||
});
|
||||
}
|
||||
);
|
||||
for (const { ids, shorthand, range } of replacementsInDestructuring) {
|
||||
/** @type {Ids} */
|
||||
const concatedIds = [...prefixedIds, ...ids];
|
||||
const module = /** @type {Module} */ (moduleGraph.getModule(dep));
|
||||
const used = moduleGraph
|
||||
.getExportsInfo(module)
|
||||
@@ -394,10 +410,8 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
|
||||
const comment = `${Template.toNormalComment(name)} `;
|
||||
const key = comment + JSON.stringify(newName);
|
||||
source.replace(
|
||||
/** @type {Range} */
|
||||
(range)[0],
|
||||
/** @type {Range} */
|
||||
(range)[1] - 1,
|
||||
range[0],
|
||||
range[1] - 1,
|
||||
shorthand ? `${key}: ${name}` : `${key}`
|
||||
);
|
||||
}
|
||||
@@ -408,7 +422,7 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
|
||||
* @param {HarmonyImportSpecifierDependency} dep dependency
|
||||
* @param {ReplaceSource} source source
|
||||
* @param {DependencyTemplateContext} templateContext context
|
||||
* @param {string[]} ids ids
|
||||
* @param {Ids} ids ids
|
||||
* @returns {string} generated code
|
||||
*/
|
||||
_getCodeForIds(dep, source, templateContext, ids) {
|
||||
@@ -476,3 +490,4 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
|
||||
};
|
||||
|
||||
module.exports = HarmonyImportSpecifierDependency;
|
||||
module.exports.idsSymbol = idsSymbol;
|
||||
|
||||
6
node_modules/webpack/lib/dependencies/HarmonyModulesPlugin.js
generated
vendored
6
node_modules/webpack/lib/dependencies/HarmonyModulesPlugin.js
generated
vendored
@@ -28,9 +28,9 @@ const HarmonyTopLevelThisParserPlugin = require("./HarmonyTopLevelThisParserPlug
|
||||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} Parser */
|
||||
|
||||
/**
|
||||
* @typedef HarmonyModulesPluginOptions
|
||||
* @property {boolean=} topLevelAwait
|
||||
* @typedef {object} HarmonyModulesPluginOptions
|
||||
* @property {boolean=} deferImport
|
||||
*/
|
||||
|
||||
@@ -134,7 +134,7 @@ class HarmonyModulesPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
new HarmonyDetectionParserPlugin(this.options).apply(parser);
|
||||
new HarmonyDetectionParserPlugin().apply(parser);
|
||||
new HarmonyImportDependencyParserPlugin(parserOptions).apply(parser);
|
||||
new HarmonyExportDependencyParserPlugin(parserOptions).apply(parser);
|
||||
new HarmonyTopLevelThisParserPlugin().apply(parser);
|
||||
|
||||
13
node_modules/webpack/lib/dependencies/ImportContextDependency.js
generated
vendored
13
node_modules/webpack/lib/dependencies/ImportContextDependency.js
generated
vendored
@@ -35,6 +35,19 @@ class ImportContextDependency extends ContextDependency {
|
||||
return "esm";
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string | null} an identifier to merge equal requests
|
||||
*/
|
||||
getResourceIdentifier() {
|
||||
let str = super.getResourceIdentifier();
|
||||
|
||||
if (this.options.attributes) {
|
||||
str += `|importAttributes${JSON.stringify(this.options.attributes)}`;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {ObjectSerializerContext} context context
|
||||
*/
|
||||
|
||||
24
node_modules/webpack/lib/dependencies/ImportDependency.js
generated
vendored
24
node_modules/webpack/lib/dependencies/ImportDependency.js
generated
vendored
@@ -11,7 +11,8 @@ const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
@@ -26,14 +27,14 @@ class ImportDependency extends ModuleDependency {
|
||||
/**
|
||||
* @param {string} request the request
|
||||
* @param {Range} range expression range
|
||||
* @param {(string[][] | null)=} referencedExports list of referenced exports
|
||||
* @param {RawReferencedExports | null=} referencedExports list of referenced exports
|
||||
* @param {ImportAttributes=} attributes import attributes
|
||||
*/
|
||||
constructor(request, range, referencedExports, attributes) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
this.referencedExports = referencedExports;
|
||||
this.assertions = attributes;
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
get type() {
|
||||
@@ -44,11 +45,22 @@ class ImportDependency extends ModuleDependency {
|
||||
return "esm";
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string | null} an identifier to merge equal requests
|
||||
*/
|
||||
getResourceIdentifier() {
|
||||
let str = super.getResourceIdentifier();
|
||||
if (this.attributes) {
|
||||
str += `|importAttributes${JSON.stringify(this.attributes)}`;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
if (!this.referencedExports) return Dependency.EXPORTS_OBJECT_REFERENCED;
|
||||
@@ -87,7 +99,7 @@ class ImportDependency extends ModuleDependency {
|
||||
serialize(context) {
|
||||
context.write(this.range);
|
||||
context.write(this.referencedExports);
|
||||
context.write(this.assertions);
|
||||
context.write(this.attributes);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
@@ -97,7 +109,7 @@ class ImportDependency extends ModuleDependency {
|
||||
deserialize(context) {
|
||||
this.range = context.read();
|
||||
this.referencedExports = context.read();
|
||||
this.assertions = context.read();
|
||||
this.attributes = context.read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
||||
5
node_modules/webpack/lib/dependencies/ImportEagerDependency.js
generated
vendored
5
node_modules/webpack/lib/dependencies/ImportEagerDependency.js
generated
vendored
@@ -10,19 +10,18 @@ const ImportDependency = require("./ImportDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {ImportDependency.RawReferencedExports} RawReferencedExports */
|
||||
|
||||
class ImportEagerDependency extends ImportDependency {
|
||||
/**
|
||||
* @param {string} request the request
|
||||
* @param {Range} range expression range
|
||||
* @param {(string[][] | null)=} referencedExports list of referenced exports
|
||||
* @param {RawReferencedExports | null=} referencedExports list of referenced exports
|
||||
* @param {ImportAttributes=} attributes import attributes
|
||||
*/
|
||||
constructor(request, range, referencedExports, attributes) {
|
||||
|
||||
13
node_modules/webpack/lib/dependencies/ImportMetaContextDependencyParserPlugin.js
generated
vendored
13
node_modules/webpack/lib/dependencies/ImportMetaContextDependencyParserPlugin.js
generated
vendored
@@ -15,14 +15,17 @@ const ImportMetaContextDependency = require("./ImportMetaContextDependency");
|
||||
/** @typedef {import("estree").ObjectExpression} ObjectExpression */
|
||||
/** @typedef {import("estree").Property} Property */
|
||||
/** @typedef {import("estree").Identifier} Identifier */
|
||||
/** @typedef {import("estree").SourceLocation} SourceLocation */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../ContextModule").ContextModuleOptions} ContextModuleOptions */
|
||||
/** @typedef {import("../ContextModule").ContextMode} ContextMode */
|
||||
/** @typedef {import("../Chunk").ChunkName} ChunkName */
|
||||
/** @typedef {import("../ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */
|
||||
/** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
|
||||
/** @typedef {Pick<ContextModuleOptions, 'mode'|'recursive'|'regExp'|'include'|'exclude'|'chunkName'>&{groupOptions: RawChunkGroupOptions, exports?: ContextModuleOptions["referencedExports"]}} ImportMetaContextOptions */
|
||||
|
||||
/** @typedef {Pick<ContextModuleOptions, 'mode' | 'recursive' | 'regExp' | 'include' | 'exclude' | 'chunkName'> & { groupOptions: RawChunkGroupOptions, exports?: RawReferencedExports }} ImportMetaContextOptions */
|
||||
|
||||
/**
|
||||
* @param {Property} prop property
|
||||
@@ -84,7 +87,7 @@ module.exports = class ImportMetaContextDependencyParserPlugin {
|
||||
const errors = [];
|
||||
let regExp = /^\.\/.*$/;
|
||||
let recursive = true;
|
||||
/** @type {ContextModuleOptions["mode"]} */
|
||||
/** @type {ContextMode} */
|
||||
let mode = "sync";
|
||||
/** @type {ContextModuleOptions["include"]} */
|
||||
let include;
|
||||
@@ -92,9 +95,9 @@ module.exports = class ImportMetaContextDependencyParserPlugin {
|
||||
let exclude;
|
||||
/** @type {RawChunkGroupOptions} */
|
||||
const groupOptions = {};
|
||||
/** @type {ContextModuleOptions["chunkName"]} */
|
||||
/** @type {ChunkName | undefined} */
|
||||
let chunkName;
|
||||
/** @type {ContextModuleOptions["referencedExports"]} */
|
||||
/** @type {RawReferencedExports | undefined} */
|
||||
let exports;
|
||||
if (optionsNode) {
|
||||
for (const prop of /** @type {ObjectExpression} */ (optionsNode)
|
||||
|
||||
1
node_modules/webpack/lib/dependencies/ImportMetaContextPlugin.js
generated
vendored
1
node_modules/webpack/lib/dependencies/ImportMetaContextPlugin.js
generated
vendored
@@ -14,7 +14,6 @@ const ImportMetaContextDependency = require("./ImportMetaContextDependency");
|
||||
const ImportMetaContextDependencyParserPlugin = require("./ImportMetaContextDependencyParserPlugin");
|
||||
|
||||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").ResolveOptions} ResolveOptions */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} Parser */
|
||||
|
||||
|
||||
5
node_modules/webpack/lib/dependencies/ImportMetaPlugin.js
generated
vendored
5
node_modules/webpack/lib/dependencies/ImportMetaPlugin.js
generated
vendored
@@ -30,6 +30,7 @@ const ConstDependency = require("./ConstDependency");
|
||||
/** @typedef {import("../NormalModule")} NormalModule */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} Parser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Members} Members */
|
||||
|
||||
const getCriticalDependencyWarning = memoize(() =>
|
||||
require("./CriticalDependencyWarning")
|
||||
@@ -83,7 +84,7 @@ class ImportMetaPlugin {
|
||||
JSON.stringify(getUrl(parser.state.module));
|
||||
const importMetaWebpackVersion = () => JSON.stringify(webpackVersion);
|
||||
/**
|
||||
* @param {string[]} members members
|
||||
* @param {Members} members members
|
||||
* @returns {string} error message
|
||||
*/
|
||||
const importMetaUnknownProperty = (members) =>
|
||||
@@ -114,7 +115,7 @@ class ImportMetaPlugin {
|
||||
new ModuleDependencyWarning(
|
||||
parser.state.module,
|
||||
new CriticalDependencyWarning(
|
||||
"Accessing import.meta directly is unsupported (only property access or destructuring is supported)"
|
||||
"'import.meta' cannot be used as a standalone expression. For static analysis, its properties must be accessed directly (e.g., 'import.meta.url') or through destructuring."
|
||||
),
|
||||
/** @type {DependencyLocation} */ (metaProperty.loc)
|
||||
)
|
||||
|
||||
333
node_modules/webpack/lib/dependencies/ImportParserPlugin.js
generated
vendored
333
node_modules/webpack/lib/dependencies/ImportParserPlugin.js
generated
vendored
@@ -8,7 +8,11 @@
|
||||
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
|
||||
const CommentCompilationWarning = require("../CommentCompilationWarning");
|
||||
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
|
||||
const { getImportAttributes } = require("../javascript/JavascriptParser");
|
||||
const {
|
||||
VariableInfo,
|
||||
getImportAttributes
|
||||
} = require("../javascript/JavascriptParser");
|
||||
const traverseDestructuringAssignmentProperties = require("../util/traverseDestructuringAssignmentProperties");
|
||||
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
|
||||
const ImportContextDependency = require("./ImportContextDependency");
|
||||
const ImportDependency = require("./ImportDependency");
|
||||
@@ -19,10 +23,144 @@ const ImportWeakDependency = require("./ImportWeakDependency");
|
||||
/** @typedef {import("../ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */
|
||||
/** @typedef {import("../ContextModule").ContextMode} ContextMode */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
/** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportExpression} ImportExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ParserState} ParserState */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Members} Members */
|
||||
/** @typedef {import("../javascript/JavascriptParser").MembersOptionals} MembersOptionals */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ArrowFunctionExpression} ArrowFunctionExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser").FunctionExpression} FunctionExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Identifier} Identifier */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ObjectPattern} ObjectPattern */
|
||||
/** @typedef {import("../javascript/JavascriptParser").CallExpression} CallExpression */
|
||||
|
||||
/** @typedef {{ references: RawReferencedExports, expression: ImportExpression }} ImportSettings */
|
||||
/** @typedef {WeakMap<ImportExpression, RawReferencedExports>} State */
|
||||
|
||||
/** @type {WeakMap<ParserState, State>} */
|
||||
const parserStateMap = new WeakMap();
|
||||
const dynamicImportTag = Symbol("import()");
|
||||
|
||||
/**
|
||||
* @param {JavascriptParser} parser javascript parser
|
||||
* @returns {State} import parser plugin state
|
||||
*/
|
||||
function getState(parser) {
|
||||
if (!parserStateMap.has(parser.state)) {
|
||||
parserStateMap.set(parser.state, new WeakMap());
|
||||
}
|
||||
return /** @type {State} */ (parserStateMap.get(parser.state));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {JavascriptParser} parser javascript parser
|
||||
* @param {ImportExpression} importCall import expression
|
||||
* @param {string} variableName variable name
|
||||
*/
|
||||
function tagDynamicImportReferenced(parser, importCall, variableName) {
|
||||
const state = getState(parser);
|
||||
/** @type {RawReferencedExports} */
|
||||
const references = state.get(importCall) || [];
|
||||
state.set(importCall, references);
|
||||
parser.tagVariable(
|
||||
variableName,
|
||||
dynamicImportTag,
|
||||
/** @type {ImportSettings} */ ({
|
||||
references,
|
||||
expression: importCall
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {CallExpression} importThen import().then() call
|
||||
* @returns {Identifier | ObjectPattern | undefined} the dynamic imported namespace obj
|
||||
*/
|
||||
function getFulfilledCallbackNamespaceObj(importThen) {
|
||||
const fulfilledCallback = importThen.arguments[0];
|
||||
if (
|
||||
fulfilledCallback &&
|
||||
(fulfilledCallback.type === "ArrowFunctionExpression" ||
|
||||
fulfilledCallback.type === "FunctionExpression") &&
|
||||
fulfilledCallback.params[0] &&
|
||||
(fulfilledCallback.params[0].type === "Identifier" ||
|
||||
fulfilledCallback.params[0].type === "ObjectPattern")
|
||||
) {
|
||||
return fulfilledCallback.params[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {JavascriptParser} parser javascript parser
|
||||
* @param {ImportExpression} importCall import expression
|
||||
* @param {ArrowFunctionExpression | FunctionExpression} fulfilledCallback the fulfilled callback
|
||||
* @param {Identifier | ObjectPattern} namespaceObjArg the argument of namespace object=
|
||||
*/
|
||||
function walkImportThenFulfilledCallback(
|
||||
parser,
|
||||
importCall,
|
||||
fulfilledCallback,
|
||||
namespaceObjArg
|
||||
) {
|
||||
const arrow = fulfilledCallback.type === "ArrowFunctionExpression";
|
||||
const wasTopLevel = parser.scope.topLevelScope;
|
||||
parser.scope.topLevelScope = arrow ? (wasTopLevel ? "arrow" : false) : false;
|
||||
const scopeParams = [...fulfilledCallback.params];
|
||||
|
||||
// Add function name in scope for recursive calls
|
||||
if (!arrow && fulfilledCallback.id) {
|
||||
scopeParams.push(fulfilledCallback.id);
|
||||
}
|
||||
|
||||
parser.inFunctionScope(!arrow, scopeParams, () => {
|
||||
if (namespaceObjArg.type === "Identifier") {
|
||||
tagDynamicImportReferenced(parser, importCall, namespaceObjArg.name);
|
||||
} else {
|
||||
parser.enterDestructuringAssignment(namespaceObjArg, importCall);
|
||||
const referencedPropertiesInDestructuring =
|
||||
parser.destructuringAssignmentPropertiesFor(importCall);
|
||||
if (referencedPropertiesInDestructuring) {
|
||||
const state = getState(parser);
|
||||
const references = /** @type {RawReferencedExports} */ (
|
||||
state.get(importCall)
|
||||
);
|
||||
/** @type {RawReferencedExports} */
|
||||
const refsInDestructuring = [];
|
||||
traverseDestructuringAssignmentProperties(
|
||||
referencedPropertiesInDestructuring,
|
||||
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
|
||||
);
|
||||
for (const ids of refsInDestructuring) {
|
||||
references.push(ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const param of fulfilledCallback.params) {
|
||||
parser.walkPattern(param);
|
||||
}
|
||||
if (fulfilledCallback.body.type === "BlockStatement") {
|
||||
parser.detectMode(fulfilledCallback.body.body);
|
||||
const prev = parser.prevStatement;
|
||||
parser.preWalkStatement(fulfilledCallback.body);
|
||||
parser.prevStatement = prev;
|
||||
parser.walkStatement(fulfilledCallback.body);
|
||||
} else {
|
||||
parser.walkExpression(fulfilledCallback.body);
|
||||
}
|
||||
});
|
||||
parser.scope.topLevelScope = wasTopLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {Iterable<T>} enumerable enumerable
|
||||
* @returns {T[][]} array of array
|
||||
*/
|
||||
const exportsFromEnumerable = (enumerable) =>
|
||||
Array.from(enumerable, (e) => [e]);
|
||||
|
||||
const PLUGIN_NAME = "ImportParserPlugin";
|
||||
|
||||
@@ -40,26 +178,94 @@ class ImportParserPlugin {
|
||||
*/
|
||||
apply(parser) {
|
||||
/**
|
||||
* @template T
|
||||
* @param {Iterable<T>} enumerable enumerable
|
||||
* @returns {T[][]} array of array
|
||||
* @param {Members} members members
|
||||
* @param {MembersOptionals} membersOptionals members Optionals
|
||||
* @returns {string[]} a non optional part
|
||||
*/
|
||||
const exportsFromEnumerable = (enumerable) =>
|
||||
Array.from(enumerable, (e) => [e]);
|
||||
function getNonOptionalPart(members, membersOptionals) {
|
||||
let i = 0;
|
||||
while (i < members.length && membersOptionals[i] === false) i++;
|
||||
return i !== members.length ? members.slice(0, i) : members;
|
||||
}
|
||||
|
||||
parser.hooks.collectDestructuringAssignmentProperties.tap(
|
||||
PLUGIN_NAME,
|
||||
(expr) => {
|
||||
if (expr.type === "ImportExpression") return true;
|
||||
const nameInfo = parser.getNameForExpression(expr);
|
||||
if (
|
||||
nameInfo &&
|
||||
nameInfo.rootInfo instanceof VariableInfo &&
|
||||
nameInfo.rootInfo.name &&
|
||||
parser.getTagData(nameInfo.rootInfo.name, dynamicImportTag)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
||||
parser.hooks.importCall.tap(PLUGIN_NAME, (expr) => {
|
||||
parser.hooks.preDeclarator.tap(PLUGIN_NAME, (decl) => {
|
||||
if (
|
||||
decl.init &&
|
||||
decl.init.type === "AwaitExpression" &&
|
||||
decl.init.argument.type === "ImportExpression" &&
|
||||
decl.id.type === "Identifier"
|
||||
) {
|
||||
parser.defineVariable(decl.id.name);
|
||||
tagDynamicImportReferenced(parser, decl.init.argument, decl.id.name);
|
||||
}
|
||||
});
|
||||
parser.hooks.expression.for(dynamicImportTag).tap(PLUGIN_NAME, (expr) => {
|
||||
const settings = /** @type {ImportSettings} */ (parser.currentTagData);
|
||||
const referencedPropertiesInDestructuring =
|
||||
parser.destructuringAssignmentPropertiesFor(expr);
|
||||
if (referencedPropertiesInDestructuring) {
|
||||
/** @type {RawReferencedExports} */
|
||||
const refsInDestructuring = [];
|
||||
traverseDestructuringAssignmentProperties(
|
||||
referencedPropertiesInDestructuring,
|
||||
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
|
||||
);
|
||||
for (const ids of refsInDestructuring) {
|
||||
settings.references.push(ids);
|
||||
}
|
||||
} else {
|
||||
settings.references.push([]);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
parser.hooks.expressionMemberChain
|
||||
.for(dynamicImportTag)
|
||||
.tap(PLUGIN_NAME, (_expression, members, membersOptionals) => {
|
||||
const settings = /** @type {ImportSettings} */ (parser.currentTagData);
|
||||
const ids = getNonOptionalPart(members, membersOptionals);
|
||||
settings.references.push(ids);
|
||||
return true;
|
||||
});
|
||||
parser.hooks.callMemberChain
|
||||
.for(dynamicImportTag)
|
||||
.tap(PLUGIN_NAME, (expression, members, membersOptionals) => {
|
||||
const { arguments: args } = expression;
|
||||
const settings = /** @type {ImportSettings} */ (parser.currentTagData);
|
||||
let ids = getNonOptionalPart(members, membersOptionals);
|
||||
const directImport = members.length === 0;
|
||||
if (
|
||||
!directImport &&
|
||||
(this.options.strictThisContextOnImports || ids.length > 1)
|
||||
) {
|
||||
ids = ids.slice(0, -1);
|
||||
}
|
||||
settings.references.push(ids);
|
||||
if (args) parser.walkExpressions(args);
|
||||
return true;
|
||||
});
|
||||
parser.hooks.importCall.tap(PLUGIN_NAME, (expr, importThen) => {
|
||||
const param = parser.evaluateExpression(expr.source);
|
||||
|
||||
let chunkName = null;
|
||||
let mode = /** @type {ContextMode} */ (this.options.dynamicImportMode);
|
||||
let include = null;
|
||||
let exclude = null;
|
||||
/** @type {string[][] | null} */
|
||||
/** @type {RawReferencedExports | null} */
|
||||
let exports = null;
|
||||
/** @type {RawChunkGroupOptions} */
|
||||
const groupOptions = {};
|
||||
@@ -245,7 +451,7 @@ class ImportParserPlugin {
|
||||
!(
|
||||
typeof importOptions.webpackExports === "string" ||
|
||||
(Array.isArray(importOptions.webpackExports) &&
|
||||
/** @type {string[]} */ (importOptions.webpackExports).every(
|
||||
importOptions.webpackExports.every(
|
||||
(item) => typeof item === "string"
|
||||
))
|
||||
)
|
||||
@@ -281,19 +487,42 @@ class ImportParserPlugin {
|
||||
|
||||
const referencedPropertiesInDestructuring =
|
||||
parser.destructuringAssignmentPropertiesFor(expr);
|
||||
if (referencedPropertiesInDestructuring) {
|
||||
const state = getState(parser);
|
||||
const referencedPropertiesInMember = state.get(expr);
|
||||
const fulfilledNamespaceObj =
|
||||
importThen && getFulfilledCallbackNamespaceObj(importThen);
|
||||
if (
|
||||
referencedPropertiesInDestructuring ||
|
||||
referencedPropertiesInMember ||
|
||||
fulfilledNamespaceObj
|
||||
) {
|
||||
if (exports) {
|
||||
parser.state.module.addWarning(
|
||||
new UnsupportedFeatureWarning(
|
||||
"`webpackExports` could not be used with destructuring assignment.",
|
||||
"You don't need `webpackExports` if the usage of dynamic import is statically analyse-able. You can safely remove the `webpackExports` magic comment.",
|
||||
/** @type {DependencyLocation} */ (expr.loc)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
exports = exportsFromEnumerable(
|
||||
[...referencedPropertiesInDestructuring].map(({ id }) => id)
|
||||
);
|
||||
if (referencedPropertiesInDestructuring) {
|
||||
/** @type {RawReferencedExports} */
|
||||
const refsInDestructuring = [];
|
||||
traverseDestructuringAssignmentProperties(
|
||||
referencedPropertiesInDestructuring,
|
||||
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
|
||||
);
|
||||
|
||||
exports = refsInDestructuring;
|
||||
} else if (referencedPropertiesInMember) {
|
||||
exports = referencedPropertiesInMember;
|
||||
} else {
|
||||
/** @type {RawReferencedExports} */
|
||||
const references = [];
|
||||
state.set(expr, references);
|
||||
|
||||
exports = references;
|
||||
}
|
||||
}
|
||||
|
||||
if (param.isString()) {
|
||||
@@ -335,39 +564,53 @@ class ImportParserPlugin {
|
||||
depBlock.addDependency(dep);
|
||||
parser.state.current.addBlock(depBlock);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (mode === "weak") {
|
||||
mode = "async-weak";
|
||||
}
|
||||
const dep = ContextDependencyHelpers.create(
|
||||
ImportContextDependency,
|
||||
/** @type {Range} */ (expr.range),
|
||||
param,
|
||||
expr,
|
||||
this.options,
|
||||
{
|
||||
chunkName,
|
||||
groupOptions,
|
||||
include,
|
||||
exclude,
|
||||
mode,
|
||||
namespaceObject:
|
||||
/** @type {BuildMeta} */
|
||||
(parser.state.module.buildMeta).strictHarmonyModule
|
||||
? "strict"
|
||||
: true,
|
||||
typePrefix: "import()",
|
||||
category: "esm",
|
||||
referencedExports: exports,
|
||||
attributes: getImportAttributes(expr)
|
||||
},
|
||||
parser
|
||||
);
|
||||
if (!dep) return;
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
dep.optional = Boolean(parser.scope.inTry);
|
||||
parser.state.current.addDependency(dep);
|
||||
}
|
||||
if (mode === "weak") {
|
||||
mode = "async-weak";
|
||||
|
||||
if (fulfilledNamespaceObj) {
|
||||
walkImportThenFulfilledCallback(
|
||||
parser,
|
||||
expr,
|
||||
/** @type {ArrowFunctionExpression | FunctionExpression} */
|
||||
(importThen.arguments[0]),
|
||||
fulfilledNamespaceObj
|
||||
);
|
||||
parser.walkExpressions(importThen.arguments.slice(1));
|
||||
} else if (importThen) {
|
||||
parser.walkExpressions(importThen.arguments);
|
||||
}
|
||||
const dep = ContextDependencyHelpers.create(
|
||||
ImportContextDependency,
|
||||
/** @type {Range} */ (expr.range),
|
||||
param,
|
||||
expr,
|
||||
this.options,
|
||||
{
|
||||
chunkName,
|
||||
groupOptions,
|
||||
include,
|
||||
exclude,
|
||||
mode,
|
||||
namespaceObject:
|
||||
/** @type {BuildMeta} */
|
||||
(parser.state.module.buildMeta).strictHarmonyModule
|
||||
? "strict"
|
||||
: true,
|
||||
typePrefix: "import()",
|
||||
category: "esm",
|
||||
referencedExports: exports,
|
||||
attributes: getImportAttributes(expr)
|
||||
},
|
||||
parser
|
||||
);
|
||||
if (!dep) return;
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
dep.optional = Boolean(parser.scope.inTry);
|
||||
parser.state.current.addDependency(dep);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
5
node_modules/webpack/lib/dependencies/ImportWeakDependency.js
generated
vendored
5
node_modules/webpack/lib/dependencies/ImportWeakDependency.js
generated
vendored
@@ -10,19 +10,18 @@ const ImportDependency = require("./ImportDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {ImportDependency.RawReferencedExports} RawReferencedExports */
|
||||
|
||||
class ImportWeakDependency extends ImportDependency {
|
||||
/**
|
||||
* @param {string} request the request
|
||||
* @param {Range} range expression range
|
||||
* @param {(string[][] | null)=} referencedExports list of referenced exports
|
||||
* @param {RawReferencedExports | null=} referencedExports list of referenced exports
|
||||
* @param {ImportAttributes=} attributes import attributes
|
||||
*/
|
||||
constructor(request, range, referencedExports, attributes) {
|
||||
|
||||
1
node_modules/webpack/lib/dependencies/JsonExportsDependency.js
generated
vendored
1
node_modules/webpack/lib/dependencies/JsonExportsDependency.js
generated
vendored
@@ -8,7 +8,6 @@
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency").ExportSpec} ExportSpec */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
|
||||
3
node_modules/webpack/lib/dependencies/LoaderDependency.js
generated
vendored
3
node_modules/webpack/lib/dependencies/LoaderDependency.js
generated
vendored
@@ -9,9 +9,6 @@ const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
class LoaderDependency extends ModuleDependency {
|
||||
/**
|
||||
|
||||
3
node_modules/webpack/lib/dependencies/LoaderImportDependency.js
generated
vendored
3
node_modules/webpack/lib/dependencies/LoaderImportDependency.js
generated
vendored
@@ -9,9 +9,6 @@ const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
class LoaderImportDependency extends ModuleDependency {
|
||||
/**
|
||||
|
||||
16
node_modules/webpack/lib/dependencies/LoaderPlugin.js
generated
vendored
16
node_modules/webpack/lib/dependencies/LoaderPlugin.js
generated
vendored
@@ -10,18 +10,18 @@ const LazySet = require("../util/LazySet");
|
||||
const LoaderDependency = require("./LoaderDependency");
|
||||
const LoaderImportDependency = require("./LoaderImportDependency");
|
||||
|
||||
/** @typedef {import("../../declarations/LoaderContext").LoaderPluginLoaderContext} LoaderPluginLoaderContext */
|
||||
/** @typedef {import("../Compilation").DepConstructor} DepConstructor */
|
||||
/** @typedef {import("../Compilation").DependencyConstructor} DependencyConstructor */
|
||||
/** @typedef {import("../Compilation").ExecuteModuleExports} ExecuteModuleExports */
|
||||
/** @typedef {import("../Compilation").ExecuteModuleResult} ExecuteModuleResult */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildInfo} BuildInfo */
|
||||
/** @typedef {import("../Module").FileSystemDependencies} FileSystemDependencies */
|
||||
|
||||
/**
|
||||
* @callback ImportModuleCallback
|
||||
* @param {(Error | null)=} err error object
|
||||
* @param {ExecuteModuleExports=} exports exports of the evaluated module
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,8 @@ class LoaderPlugin {
|
||||
name: request
|
||||
};
|
||||
const factory = compilation.dependencyFactories.get(
|
||||
/** @type {DepConstructor} */ (dep.constructor)
|
||||
/** @type {DependencyConstructor} */
|
||||
(dep.constructor)
|
||||
);
|
||||
if (factory === undefined) {
|
||||
return callback(
|
||||
@@ -125,9 +126,13 @@ class LoaderPlugin {
|
||||
map = moduleSource.map();
|
||||
source = moduleSource.source();
|
||||
}
|
||||
/** @type {FileSystemDependencies} */
|
||||
const fileDependencies = new LazySet();
|
||||
/** @type {FileSystemDependencies} */
|
||||
const contextDependencies = new LazySet();
|
||||
/** @type {FileSystemDependencies} */
|
||||
const missingDependencies = new LazySet();
|
||||
/** @type {FileSystemDependencies} */
|
||||
const buildDependencies = new LazySet();
|
||||
referencedModule.addCacheDependencies(
|
||||
fileDependencies,
|
||||
@@ -165,7 +170,8 @@ class LoaderPlugin {
|
||||
name: request
|
||||
};
|
||||
const factory = compilation.dependencyFactories.get(
|
||||
/** @type {DepConstructor} */ (dep.constructor)
|
||||
/** @type {DependencyConstructor} */
|
||||
(dep.constructor)
|
||||
);
|
||||
if (factory === undefined) {
|
||||
return callback(
|
||||
|
||||
6
node_modules/webpack/lib/dependencies/ModuleDecoratorDependency.js
generated
vendored
6
node_modules/webpack/lib/dependencies/ModuleDecoratorDependency.js
generated
vendored
@@ -12,11 +12,9 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../DependencyTemplates")} DependencyTemplates */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
@@ -57,7 +55,7 @@ class ModuleDecoratorDependency extends NullDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
return this.allowExportsAccess
|
||||
|
||||
12
node_modules/webpack/lib/dependencies/ModuleDependency.js
generated
vendored
12
node_modules/webpack/lib/dependencies/ModuleDependency.js
generated
vendored
@@ -11,6 +11,7 @@ const DependencyTemplate = require("../DependencyTemplate");
|
||||
/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
|
||||
@@ -22,11 +23,8 @@ class ModuleDependency extends Dependency {
|
||||
super();
|
||||
this.request = request;
|
||||
this.userRequest = request;
|
||||
/** @type {Range | undefined} */
|
||||
this.range = undefined;
|
||||
// TODO move it to subclasses and rename
|
||||
// assertions must be serialized by subclasses that use it
|
||||
/** @type {ImportAttributes | undefined} */
|
||||
this.assertions = undefined;
|
||||
this._context = undefined;
|
||||
}
|
||||
|
||||
@@ -41,11 +39,7 @@ class ModuleDependency extends Dependency {
|
||||
* @returns {string | null} an identifier to merge equal requests
|
||||
*/
|
||||
getResourceIdentifier() {
|
||||
let str = `context${this._context || ""}|module${this.request}`;
|
||||
if (this.assertions !== undefined) {
|
||||
str += JSON.stringify(this.assertions);
|
||||
}
|
||||
return str;
|
||||
return `context${this._context || ""}|module${this.request}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
2
node_modules/webpack/lib/dependencies/NullDependency.js
generated
vendored
2
node_modules/webpack/lib/dependencies/NullDependency.js
generated
vendored
@@ -12,6 +12,8 @@ const DependencyTemplate = require("../DependencyTemplate");
|
||||
/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
|
||||
/** @typedef {string[]} RawRuntimeRequirements */
|
||||
|
||||
class NullDependency extends Dependency {
|
||||
get type() {
|
||||
return "null";
|
||||
|
||||
14
node_modules/webpack/lib/dependencies/ProvidedDependency.js
generated
vendored
14
node_modules/webpack/lib/dependencies/ProvidedDependency.js
generated
vendored
@@ -11,14 +11,12 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../DependencyTemplates")} DependencyTemplates */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
@@ -26,7 +24,7 @@ const ModuleDependency = require("./ModuleDependency");
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
/**
|
||||
* @param {string[]|null} path the property path array
|
||||
* @param {string[] | null} path the property path array
|
||||
* @returns {string} the converted path
|
||||
*/
|
||||
const pathToString = (path) =>
|
||||
@@ -38,7 +36,7 @@ class ProvidedDependency extends ModuleDependency {
|
||||
/**
|
||||
* @param {string} request request
|
||||
* @param {string} identifier identifier
|
||||
* @param {string[]} ids ids
|
||||
* @param {ExportInfoName[]} ids ids
|
||||
* @param {Range} range range
|
||||
*/
|
||||
constructor(request, identifier, ids, range) {
|
||||
@@ -61,7 +59,7 @@ class ProvidedDependency extends ModuleDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
const ids = this.ids;
|
||||
@@ -142,7 +140,7 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template {
|
||||
chunkGraph,
|
||||
request: dep.request,
|
||||
runtimeRequirements
|
||||
})}${pathToString(/** @type {string[]} */ (usedName))};\n`,
|
||||
})}${pathToString(/** @type {string[] | null} */ (usedName))};\n`,
|
||||
InitFragment.STAGE_PROVIDES,
|
||||
1,
|
||||
`provided ${dep.identifier}`
|
||||
|
||||
1
node_modules/webpack/lib/dependencies/PureExpressionDependency.js
generated
vendored
1
node_modules/webpack/lib/dependencies/PureExpressionDependency.js
generated
vendored
@@ -11,7 +11,6 @@ const { filterRuntime, runtimeToString } = require("../util/runtime");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").RuntimeSpec} RuntimeSpec */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
|
||||
1
node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlock.js
generated
vendored
1
node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlock.js
generated
vendored
@@ -9,7 +9,6 @@ const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
|
||||
/** @typedef {import("../AsyncDependenciesBlock").GroupOptions} GroupOptions */
|
||||
/** @typedef {import("../ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
|
||||
class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock {
|
||||
|
||||
3
node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
generated
vendored
3
node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
generated
vendored
@@ -11,7 +11,6 @@ const RequireEnsureItemDependency = require("./RequireEnsureItemDependency");
|
||||
const getFunctionExpression = require("./getFunctionExpression");
|
||||
|
||||
/** @typedef {import("../AsyncDependenciesBlock").GroupOptions} GroupOptions */
|
||||
/** @typedef {import("../ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
@@ -86,7 +85,7 @@ module.exports = class RequireEnsureDependenciesBlockParserPlugin {
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
depBlock.addDependency(dep);
|
||||
const old = parser.state.current;
|
||||
parser.state.current = /** @type {TODO} */ (depBlock);
|
||||
parser.state.current = /** @type {EXPECTED_ANY} */ (depBlock);
|
||||
try {
|
||||
let failed = false;
|
||||
parser.inScope([], () => {
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/RequireIncludeDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/RequireIncludeDependency.js
generated
vendored
@@ -11,7 +11,7 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
@@ -32,7 +32,7 @@ class RequireIncludeDependency extends ModuleDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
// This doesn't use any export
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/RequireResolveDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/RequireResolveDependency.js
generated
vendored
@@ -10,7 +10,7 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const ModuleDependencyAsId = require("./ModuleDependencyTemplateAsId");
|
||||
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
@@ -40,7 +40,7 @@ class RequireResolveDependency extends ModuleDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
// This doesn't use any export
|
||||
|
||||
5
node_modules/webpack/lib/dependencies/RuntimeRequirementsDependency.js
generated
vendored
5
node_modules/webpack/lib/dependencies/RuntimeRequirementsDependency.js
generated
vendored
@@ -9,18 +9,17 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("./NullDependency").RawRuntimeRequirements} RawRuntimeRequirements */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
|
||||
class RuntimeRequirementsDependency extends NullDependency {
|
||||
/**
|
||||
* @param {string[]} runtimeRequirements runtime requirements
|
||||
* @param {RawRuntimeRequirements} runtimeRequirements runtime requirements
|
||||
*/
|
||||
constructor(runtimeRequirements) {
|
||||
super();
|
||||
|
||||
8
node_modules/webpack/lib/dependencies/StaticExportsDependency.js
generated
vendored
8
node_modules/webpack/lib/dependencies/StaticExportsDependency.js
generated
vendored
@@ -8,18 +8,16 @@
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency").ExportSpec} ExportSpec */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
|
||||
/** @typedef {string[] | true} Exports */
|
||||
|
||||
class StaticExportsDependency extends NullDependency {
|
||||
/**
|
||||
* @param {string[] | true} exports export names
|
||||
* @param {Exports} exports export names
|
||||
* @param {boolean} canMangle true, if mangling exports names is allowed
|
||||
*/
|
||||
constructor(exports, canMangle) {
|
||||
|
||||
9
node_modules/webpack/lib/dependencies/URLDependency.js
generated
vendored
9
node_modules/webpack/lib/dependencies/URLDependency.js
generated
vendored
@@ -15,20 +15,15 @@ const memoize = require("../util/memoize");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../optimize/InnerGraph").UsedByExports} UsedByExports */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
const getIgnoredRawDataUrlModule = memoize(
|
||||
() => new RawDataUrlModule("data:,", "ignored-asset", "(ignored asset)")
|
||||
@@ -46,7 +41,7 @@ class URLDependency extends ModuleDependency {
|
||||
this.range = range;
|
||||
this.outerRange = outerRange;
|
||||
this.relative = relative || false;
|
||||
/** @type {Set<string> | boolean | undefined} */
|
||||
/** @type {UsedByExports | undefined} */
|
||||
this.usedByExports = undefined;
|
||||
}
|
||||
|
||||
|
||||
3
node_modules/webpack/lib/dependencies/URLPlugin.js
generated
vendored
3
node_modules/webpack/lib/dependencies/URLPlugin.js
generated
vendored
@@ -17,7 +17,6 @@ const URLParserPlugin = require("../url/URLParserPlugin");
|
||||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} Parser */
|
||||
|
||||
const PLUGIN_NAME = "URLPlugin";
|
||||
|
||||
@@ -44,7 +43,7 @@ class URLPlugin {
|
||||
);
|
||||
|
||||
/**
|
||||
* @param {Parser} parser parser parser
|
||||
* @param {JavascriptParser} parser parser parser
|
||||
* @param {JavascriptParserOptions} parserOptions parserOptions
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/WebAssemblyExportImportedDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/WebAssemblyExportImportedDependency.js
generated
vendored
@@ -9,7 +9,7 @@ const Dependency = require("../Dependency");
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
@@ -44,7 +44,7 @@ class WebAssemblyExportImportedDependency extends ModuleDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
return [[this.name]];
|
||||
|
||||
4
node_modules/webpack/lib/dependencies/WebAssemblyImportDependency.js
generated
vendored
4
node_modules/webpack/lib/dependencies/WebAssemblyImportDependency.js
generated
vendored
@@ -10,7 +10,7 @@ const UnsupportedWebAssemblyFeatureError = require("../wasm-sync/UnsupportedWebA
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("@webassemblyjs/ast").ModuleImportDescription} ModuleImportDescription */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../WebpackError")} WebpackError */
|
||||
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
||||
@@ -46,7 +46,7 @@ class WebAssemblyImportDependency extends ModuleDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
return [[this.name]];
|
||||
|
||||
5
node_modules/webpack/lib/dependencies/WebpackIsIncludedDependency.js
generated
vendored
5
node_modules/webpack/lib/dependencies/WebpackIsIncludedDependency.js
generated
vendored
@@ -11,8 +11,7 @@ const makeSerializable = require("../util/makeSerializable");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Compilation")} Compilation */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
@@ -34,7 +33,7 @@ class WebpackIsIncludedDependency extends ModuleDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
// This doesn't use any export
|
||||
|
||||
5
node_modules/webpack/lib/dependencies/WorkerDependency.js
generated
vendored
5
node_modules/webpack/lib/dependencies/WorkerDependency.js
generated
vendored
@@ -12,8 +12,7 @@ const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../AsyncDependenciesBlock")} AsyncDependenciesBlock */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Entrypoint")} Entrypoint */
|
||||
@@ -45,7 +44,7 @@ class WorkerDependency extends ModuleDependency {
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
* @returns {ReferencedExports} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
return Dependency.NO_EXPORTS_REFERENCED;
|
||||
|
||||
16
node_modules/webpack/lib/dependencies/WorkerPlugin.js
generated
vendored
16
node_modules/webpack/lib/dependencies/WorkerPlugin.js
generated
vendored
@@ -27,14 +27,12 @@ const WorkerDependency = require("./WorkerDependency");
|
||||
|
||||
/** @typedef {import("estree").CallExpression} CallExpression */
|
||||
/** @typedef {import("estree").Expression} Expression */
|
||||
/** @typedef {import("estree").Identifier} Identifier */
|
||||
/** @typedef {import("estree").MemberExpression} MemberExpression */
|
||||
/** @typedef {import("estree").ObjectExpression} ObjectExpression */
|
||||
/** @typedef {import("estree").Pattern} Pattern */
|
||||
/** @typedef {import("estree").Property} Property */
|
||||
/** @typedef {import("estree").SpreadElement} SpreadElement */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").ChunkLoading} ChunkLoading */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").HashFunction} HashFunction */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").OutputModule} OutputModule */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").WasmLoading} WasmLoading */
|
||||
@@ -44,7 +42,6 @@ const WorkerDependency = require("./WorkerDependency");
|
||||
/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */
|
||||
/** @typedef {import("../NormalModule")} NormalModule */
|
||||
/** @typedef {import("../Parser").ParserState} ParserState */
|
||||
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} Parser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
@@ -291,8 +288,8 @@ class WorkerPlugin {
|
||||
} = arg2 && arg2.type === "ObjectExpression"
|
||||
? parseObjectExpression(parser, arg2)
|
||||
: {
|
||||
/** @type {Record<string, Expression | Pattern>} */
|
||||
expressions: {},
|
||||
expressions:
|
||||
/** @type {Record<string, Expression | Pattern>} */ ({}),
|
||||
otherElements: [],
|
||||
/** @type {Values} */
|
||||
values: {},
|
||||
@@ -379,14 +376,9 @@ class WorkerPlugin {
|
||||
const name = `${cachedContextify(
|
||||
parser.state.module.identifier()
|
||||
)}|${i}`;
|
||||
const hash = createHash(
|
||||
/** @type {HashFunction} */
|
||||
(compilation.outputOptions.hashFunction)
|
||||
);
|
||||
const hash = createHash(compilation.outputOptions.hashFunction);
|
||||
hash.update(name);
|
||||
const digest =
|
||||
/** @type {string} */
|
||||
(hash.digest(compilation.outputOptions.hashDigest));
|
||||
const digest = hash.digest(compilation.outputOptions.hashDigest);
|
||||
entryOptions.runtime = digest.slice(
|
||||
0,
|
||||
compilation.outputOptions.hashDigestLength
|
||||
|
||||
5
node_modules/webpack/lib/dependencies/processExportInfo.js
generated
vendored
5
node_modules/webpack/lib/dependencies/processExportInfo.js
generated
vendored
@@ -7,14 +7,13 @@
|
||||
|
||||
const { UsageState } = require("../ExportsInfo");
|
||||
|
||||
/** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
/** @typedef {string[][]} ReferencedExports */
|
||||
|
||||
/**
|
||||
* @param {RuntimeSpec} runtime the runtime
|
||||
* @param {ReferencedExports} referencedExports list of referenced exports, will be added to
|
||||
* @param {RawReferencedExports} referencedExports list of referenced exports, will be added to
|
||||
* @param {string[]} prefix export prefix
|
||||
* @param {ExportInfo=} exportInfo the export info
|
||||
* @param {boolean} defaultPointsToSelf when true, using default will reference itself
|
||||
|
||||
Reference in New Issue
Block a user