diff --git a/lib/dependencies/ProvidedDependency.js b/lib/dependencies/ProvidedDependency.js index 83cd995c892..7f9c324ea63 100644 --- a/lib/dependencies/ProvidedDependency.js +++ b/lib/dependencies/ProvidedDependency.js @@ -21,8 +21,6 @@ const ModuleDependency = require("./ModuleDependency"); /** @typedef {import("../util/Hash")} Hash */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -const idsSymbol = Symbol("ProvidedDependency.ids"); - /** * @param {string[]|null} path the property path array * @returns {string} the converted path @@ -55,26 +53,6 @@ class ProvidedDependency extends ModuleDependency { return "esm"; } - /** - * @param {ModuleGraph} moduleGraph the module graph - * @returns {string[]} the imported ids - */ - getIds(moduleGraph) { - const meta = moduleGraph.getMetaIfExisting(this); - if (meta === undefined) return this.ids; - const ids = meta[idsSymbol]; - return ids !== undefined ? ids : this.ids; - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {string[]} ids the imported ids - * @returns {void} - */ - setIds(moduleGraph, ids) { - moduleGraph.getMeta(this)[idsSymbol] = ids; - } - /** * Returns list of exports referenced by this dependency * @param {ModuleGraph} moduleGraph module graph @@ -82,7 +60,7 @@ class ProvidedDependency extends ModuleDependency { * @returns {(string[] | ReferencedExport)[]} referenced exports */ getReferencedExports(moduleGraph, runtime) { - let ids = this.getIds(moduleGraph); + let ids = this.ids; if (ids.length === 0) return Dependency.EXPORTS_OBJECT_REFERENCED; return [ids]; } @@ -95,8 +73,7 @@ class ProvidedDependency extends ModuleDependency { */ updateHash(hash, context) { if (this._hashUpdate === undefined) { - this._hashUpdate = - this.identifier + (this.ids ? this.ids.join(",") : "null"); + this._hashUpdate = this.identifier + (this.ids ? this.ids.join(",") : ""); } hash.update(this._hashUpdate); } @@ -143,7 +120,7 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template { const dep = /** @type {ProvidedDependency} */ (dependency); const connection = moduleGraph.getConnection(dep); const exportsInfo = moduleGraph.getExportsInfo(connection.module); - const usedName = exportsInfo.getUsedName(dep.getIds(moduleGraph), runtime); + const usedName = exportsInfo.getUsedName(dep.ids, runtime); initFragments.push( new InitFragment( `/* provided dependency */ var ${