* Finish entry module. * @param {Module} module the exporting entry module * @param {string} entryName the name of the entrypoint * @param {LibraryContext<T>} libraryContext context * @returns {void}
(
module,
entryName,
{ options, compilation, compilation: { moduleGraph } }
)
| 198 | * @returns {void} |
| 199 | */ |
| 200 | finishEntryModule( |
| 201 | module, |
| 202 | entryName, |
| 203 | { options, compilation, compilation: { moduleGraph } } |
| 204 | ) { |
| 205 | const runtime = getEntryRuntime(compilation, entryName); |
| 206 | if (options.export) { |
| 207 | const exportsInfo = moduleGraph.getExportInfo( |
| 208 | module, |
| 209 | Array.isArray(options.export) ? options.export[0] : options.export |
| 210 | ); |
| 211 | exportsInfo.setUsed(UsageState.Used, runtime); |
| 212 | exportsInfo.canMangleUse = false; |
| 213 | exportsInfo.canInlineUse = false; |
| 214 | } else { |
| 215 | const exportsInfo = moduleGraph.getExportsInfo(module); |
| 216 | |
| 217 | if ( |
| 218 | // If the entry module is commonjs, its exports cannot be mangled |
| 219 | (module.buildMeta && |
| 220 | /** @type {JavascriptModuleBuildMeta} */ (module.buildMeta) |
| 221 | .treatAsCommonJs) || |
| 222 | // The entry module provides unknown exports |
| 223 | exportsInfo._otherExportsInfo.provided === null |
| 224 | ) { |
| 225 | exportsInfo.setUsedInUnknownWay(runtime); |
| 226 | } else { |
| 227 | exportsInfo.setAllKnownExportsUsed(runtime); |
| 228 | for (const exportInfo of exportsInfo.ownedExports) { |
| 229 | exportInfo.canInlineUse = false; |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | moduleGraph.addExtraReason(module, "used as library export"); |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Returns preprocess as needed by overriding. |
nothing calls this directly
no test coverage detected