MCPcopy Create free account
hub / github.com/FIND-Lab/AgentWard / rewriteRelativeImports

Function rewriteRelativeImports

scripts/build.mjs:10–15  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

8const sourceFiles = ["config.ts", "index.ts"];
9
10function rewriteRelativeImports(code) {
11 return code.replace(
12 /((?:import|export)\s+(?:type\s+)?(?:[\s\S]*?\s+from\s+)?|import\s*\()(["'])(\.{1,2}\/[^"']+)\.ts\2/g,
13 (_, prefix, quote, specifier) => `${prefix}${quote}${specifier}.js${quote}`,
14 );
15}
16
17function transpileTsFile(srcPath, destPath) {
18 const source = readFileSync(srcPath, "utf8");

Callers 1

transpileTsFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected