(root: string, path: string)
| 221 | } |
| 222 | |
| 223 | export function findModule(root: string, path: string): RouteResult | undefined { |
| 224 | const ext = extname(path); |
| 225 | if (!ext) throw new Error(`empty extension: ${path}`); |
| 226 | const exts = [ext]; |
| 227 | if (ext === ".js") exts.push(".ts", ".jsx", ".tsx"); |
| 228 | return route(root, path.slice(0, -ext.length), exts); |
| 229 | } |
| 230 | |
| 231 | export async function readJavaScript(sourcePath: string): Promise<string> { |
| 232 | const source = await readFile(sourcePath, "utf-8"); |
no test coverage detected