MCPcopy
hub / github.com/webpack/webpack / rewriteExportNames

Function rewriteExportNames

lib/wasm-sync/WebAssemblyGenerator.js:257–279  ·  view source on GitHub ↗
({ ast, moduleGraph, module, externalExports, runtime })

Source from the content-addressed store, hash-verified

255 */
256const rewriteExportNames =
257 ({ ast, moduleGraph, module, externalExports, runtime }) =>
258 (bin) =>
259 editWithAST(ast, bin, {
260 /**
261 * Processes the provided path.
262 * @param {NodePath<ModuleExport>} path path
263 */
264 ModuleExport(path) {
265 const isExternal = externalExports.has(path.node.name);
266 if (isExternal) {
267 path.remove();
268 return;
269 }
270 const usedName = moduleGraph
271 .getExportsInfo(module)
272 .getUsedName(path.node.name, runtime);
273 if (!usedName) {
274 path.remove();
275 return;
276 }
277 path.node.name = /** @type {string} */ (usedName);
278 }
279 });
280
281/** @typedef {Map<string, UsedWasmDependency>} Mapping */
282

Callers 1

generateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected