MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / replaceInSourceMap

Function replaceInSourceMap

src/transpilation/resolve.ts:424–439  ·  view source on GitHub ↗
(node: SourceNode, parent: SourceNode, require: string, resolvedRequire: string)

Source from the content-addressed store, hash-verified

422}
423
424function replaceInSourceMap(node: SourceNode, parent: SourceNode, require: string, resolvedRequire: string): boolean {
425 if ((!node.children || node.children.length === 0) && node.toString() === require) {
426 parent.children = [new SourceNode(node.line, node.column, node.source, [resolvedRequire])];
427 return true; // Stop after finding the first occurrence
428 }
429
430 if (node.children) {
431 for (const c of node.children) {
432 if (replaceInSourceMap(c, node, require, resolvedRequire)) {
433 return true; // Occurrence found in one of the children
434 }
435 }
436 }
437
438 return false; // Did not find the require
439}
440
441function isNodeModulesFile(filePath: string): boolean {
442 return path

Callers 1

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected