MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / visitor

Function visitor

packages/tooling/src/vite.plugin.emit-dts.ts:59–87  ·  view source on GitHub ↗
(node: ts.Node)

Source from the content-addressed store, hash-verified

57 const sourceFilePath = ts.isSourceFile(source) ? source.fileName : source.sourceFiles[0].fileName;
58
59 const visitor = (node: ts.Node): ts.Node => {
60 if (ts.isExportDeclaration(node) && node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) {
61 const mapped = mapPath(sourceFilePath, node.moduleSpecifier.text);
62 if (mapped) {
63 return ts.factory.createExportDeclaration(
64 node.modifiers,
65 node.isTypeOnly,
66 node.exportClause,
67 ts.factory.createStringLiteral(mapped),
68 node.attributes
69 );
70 }
71 return node;
72 }
73 if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) {
74 const mapped = mapPath(sourceFilePath, node.moduleSpecifier.text);
75 if (mapped) {
76 return ts.factory.createImportDeclaration(
77 node.modifiers,
78 node.importClause,
79 ts.factory.createStringLiteral(mapped),
80 node.attributes
81 );
82 }
83 return node;
84 }
85
86 return ts.visitEachChild(node, visitor, context);
87 };
88
89 return ts.visitEachChild(source, visitor, context);
90 };

Callers

nothing calls this directly

Calls 1

mapPathFunction · 0.85

Tested by

no test coverage detected