| | |
| | | /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(_deferredImport)?(?:_asiSafe(\d))?__$/; |
| | | |
| | | /** |
| | | * Encodes how a concatenated module reference should be interpreted when it is |
| | | * later reconstructed from its placeholder identifier. |
| | | * @typedef {object} ModuleReferenceOptions |
| | | * @property {Ids} ids the properties/exports of the module |
| | | * @property {Ids} ids the properties or exports selected from the referenced module |
| | | * @property {boolean} call true, when this referenced export is called |
| | | * @property {boolean} directImport true, when this referenced export is directly imported (not via property access) |
| | | * @property {boolean} deferredImport true, when this referenced export is deferred |
| | | * @property {boolean | undefined} asiSafe if the position is ASI safe or unknown |
| | | */ |
| | | |
| | | /** |
| | | * Tracks the symbols and cross-module references needed while rendering a |
| | | * concatenated module. |
| | | */ |
| | | class ConcatenationScope { |
| | | /** |
| | | * Creates the mutable scope object used while rendering a concatenated |
| | | * module and its cross-module references. |
| | | * @param {ModuleInfo[] | Map<Module, ModuleInfo>} modulesMap all module info by module |
| | | * @param {ConcatenatedModuleInfo} currentModule the current module info |
| | | * @param {Set<string>} usedNames all used names |
| | |
| | | constructor(modulesMap, currentModule, usedNames) { |
| | | this._currentModule = currentModule; |
| | | if (Array.isArray(modulesMap)) { |
| | | /** @type {Map<Module, ConcatenatedModuleInfo>} */ |
| | | const map = new Map(); |
| | | for (const info of modulesMap) { |
| | | map.set(info.module, info); |
| | | map.set(info.module, /** @type {ConcatenatedModuleInfo} */ (info)); |
| | | } |
| | | modulesMap = map; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * Checks whether a module participates in the current concatenation scope. |
| | | * @param {Module} module the referenced module |
| | | * @returns {boolean} true, when it's in the scope |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Records the symbol that should be used when the current module exports a |
| | | * named binding. |
| | | * @param {string} exportName name of the export |
| | | * @param {string} symbol identifier of the export in source code |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Records a raw expression that can be used to reference an export without |
| | | * going through the normal symbol map. |
| | | * @param {string} exportName name of the export |
| | | * @param {string} expression expression to be used |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the raw expression registered for an export, if one exists. |
| | | * @param {string} exportName name of the export |
| | | * @returns {string | undefined} the expression of the export |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Replaces the raw expression for an export only when that export already |
| | | * has an entry in the raw export map. |
| | | * @param {string} exportName name of the export |
| | | * @param {string} expression expression to be used |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Records the symbol that should be used for the synthetic namespace export. |
| | | * @param {string} symbol identifier of the export in source code |
| | | */ |
| | | registerNamespaceExport(symbol) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Encodes a reference to another concatenated module as a placeholder |
| | | * identifier that can be parsed later during code generation. |
| | | * @param {Module} module the referenced module |
| | | * @param {Partial<ModuleReferenceOptions>} options options |
| | | * @returns {string} the reference as identifier |
| | |
| | | } |
| | | |
| | | /** |
| | | * Checks whether an identifier is one of webpack's encoded concatenation |
| | | * module references. |
| | | * @param {string} name the identifier |
| | | * @returns {boolean} true, when it's an module reference |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Parses an encoded module reference back into its module index and |
| | | * reference flags. |
| | | * @param {string} name the identifier |
| | | * @returns {ModuleReferenceOptions & { index: number } | null} parsed options and index |
| | | */ |