| | |
| | | /** @typedef {import("./Dependency").ExportSpec} ExportSpec */ |
| | | /** @typedef {import("./Dependency").ExportsSpec} ExportsSpec */ |
| | | /** @typedef {import("./ExportsInfo")} ExportsInfo */ |
| | | /** @typedef {import("./ExportsInfo").ExportInfoName} ExportInfoName */ |
| | | /** @typedef {import("./ExportsInfo").RestoreProvidedData} RestoreProvidedData */ |
| | | /** @typedef {import("./Module")} Module */ |
| | | /** @typedef {import("./Module").BuildInfo} BuildInfo */ |
| | |
| | | |
| | | class FlagDependencyExportsPlugin { |
| | | /** |
| | | * Apply the plugin |
| | | * Applies the plugin by registering its hooks on the compiler. |
| | | * @param {Compiler} compiler the compiler instance |
| | | * @returns {void} |
| | | */ |
| | |
| | | // Step 1: Try to restore cached provided export info from cache |
| | | logger.time("restore cached provided exports"); |
| | | asyncLib.each( |
| | | modules, |
| | | /** @type {import("neo-async").IterableCollection<Module>} */ ( |
| | | /** @type {unknown} */ (modules) |
| | | ), |
| | | (module, callback) => { |
| | | const exportsInfo = moduleGraph.getExportsInfo(module); |
| | | // If the module doesn't have an exportsType, it's a module |
| | |
| | | let changed = false; |
| | | |
| | | /** |
| | | * Process dependencies block. |
| | | * @param {DependenciesBlock} depBlock the dependencies block |
| | | * @returns {void} |
| | | */ |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Process dependency. |
| | | * @param {Dependency} dep the dependency |
| | | * @returns {void} |
| | | */ |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Process exports spec. |
| | | * @param {Dependency} dep dependency |
| | | * @param {ExportsSpec} exportDesc info |
| | | * @returns {void} |
| | |
| | | */ |
| | | const mergeExports = (exportsInfo, exports) => { |
| | | for (const exportNameOrSpec of exports) { |
| | | /** @type {ExportInfoName} */ |
| | | let name; |
| | | let canMangle = globalCanMangle; |
| | | let terminalBinding = globalTerminalBinding; |
| | | /** @type {ExportSpec["exports"]} */ |
| | | let exports; |
| | | let from = globalFrom; |
| | | /** @type {ExportSpec["export"]} */ |
| | | let fromExport; |
| | | let priority = globalPriority; |
| | | let hidden = false; |
| | |
| | | |
| | | // Recalculate target exportsInfo |
| | | const target = exportInfo.getTarget(moduleGraph); |
| | | /** @type {undefined | ExportsInfo} */ |
| | | let targetExportsInfo; |
| | | if (target) { |
| | | const targetModuleExportsInfo = |