MCPcopy
hub / github.com/webpack/webpack / rewriteImports

Function rewriteImports

lib/wasm-sync/WebAssemblyGenerator.js:291–308  ·  view source on GitHub ↗
({ ast, usedDependencyMap })

Source from the content-addressed store, hash-verified

289 */
290const rewriteImports =
291 ({ ast, usedDependencyMap }) =>
292 (bin) =>
293 editWithAST(ast, bin, {
294 /**
295 * Processes the provided path.
296 * @param {NodePath<ModuleImport>} path path
297 */
298 ModuleImport(path) {
299 const result = usedDependencyMap.get(
300 `${path.node.module}:${path.node.name}`
301 );
302
303 if (result !== undefined) {
304 path.node.module = result.module;
305 path.node.name = result.name;
306 }
307 }
308 });
309
310/**
311 * Add an init function.

Callers 1

generateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected