(code)
| 8 | const sourceFiles = ["config.ts", "index.ts"]; |
| 9 | |
| 10 | function 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 | |
| 17 | function transpileTsFile(srcPath, destPath) { |
| 18 | const source = readFileSync(srcPath, "utf8"); |