| | |
| | | const Template = require("../Template"); |
| | | const { equals } = require("../util/ArrayHelpers"); |
| | | const makeSerializable = require("../util/makeSerializable"); |
| | | const propertyAccess = require("../util/propertyAccess"); |
| | | const { propertyAccess } = require("../util/property"); |
| | | const { handleDependencyBase } = require("./CommonJsDependencyHelpers"); |
| | | const ModuleDependency = require("./ModuleDependency"); |
| | | const processExportInfo = require("./processExportInfo"); |
| | |
| | | /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ |
| | | /** @typedef {import("./CommonJsDependencyHelpers").CommonJSDependencyBaseKeywords} CommonJSDependencyBaseKeywords */ |
| | | |
| | | const idsSymbol = Symbol("CommonJsExportRequireDependency.ids"); |
| | | const idsSymbol = /** @type {symbol} */ ( |
| | | Symbol("CommonJsExportRequireDependency.ids") |
| | | ); |
| | | |
| | | const EMPTY_OBJECT = {}; |
| | | |
| | |
| | | |
| | | class CommonJsExportRequireDependency extends ModuleDependency { |
| | | /** |
| | | * Creates an instance of CommonJsExportRequireDependency. |
| | | * @param {Range} range range |
| | | * @param {Range | null} valueRange value range |
| | | * @param {CommonJSDependencyBaseKeywords} base base |
| | |
| | | this.names = names; |
| | | this.ids = ids; |
| | | this.resultUsed = resultUsed; |
| | | /** @type {undefined | boolean} */ |
| | | this.asiSafe = undefined; |
| | | } |
| | | |
| | |
| | | return "cjs export require"; |
| | | } |
| | | |
| | | get category() { |
| | | return "commonjs"; |
| | | } |
| | | |
| | | /** |
| | | * Could affect referencing module. |
| | | * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module |
| | | */ |
| | | couldAffectReferencingModule() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the imported id. |
| | | * @param {ModuleGraph} moduleGraph the module graph |
| | | * @returns {ExportInfoName[]} the imported id |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Updates ids using the provided module graph. |
| | | * @param {ModuleGraph} moduleGraph the module graph |
| | | * @param {ExportInfoName[]} ids the imported ids |
| | | * @returns {void} |
| | |
| | | } |
| | | |
| | | /** |
| | | * Gets star reexports. |
| | | * @param {ModuleGraph} moduleGraph the module graph |
| | | * @param {RuntimeSpec} runtime the runtime |
| | | * @param {Module} importedModule the imported module (optional) |
| | |
| | | } |
| | | |
| | | /** |
| | | * Serializes this instance into the provided serializer context. |
| | | * @param {ObjectSerializerContext} context context |
| | | */ |
| | | serialize(context) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Restores this instance from the provided deserializer context. |
| | | * @param {ObjectDeserializerContext} context context |
| | | */ |
| | | deserialize(context) { |
| | |
| | | ModuleDependency.Template |
| | | ) { |
| | | /** |
| | | * Applies the plugin by registering its hooks on the compiler. |
| | | * @param {Dependency} dependency the dependency for which the template should be applied |
| | | * @param {ReplaceSource} source the current replace source which can be modified |
| | | * @param {DependencyTemplateContext} templateContext the context object |