(babel: any, createLinker: any, srcFile: string, cacheFile: string)
| 34 | } |
| 35 | |
| 36 | async function copyOrLinkInto(babel: any, createLinker: any, srcFile: string, cacheFile: string) { |
| 37 | const dir = path.dirname(cacheFile); |
| 38 | await ensureDir(dir); |
| 39 | const linked = await linkFile(babel, createLinker, srcFile); |
| 40 | if (linked) { |
| 41 | await fs.writeFile(cacheFile, linked, 'utf8'); |
| 42 | } else { |
| 43 | await fs.copyFile(srcFile, cacheFile); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | async function prelinkPackage(req: NodeRequire, pkgName: string, cacheRoot: string, debug: boolean) { |
| 48 | const pkgEntry = req.resolve(path.join(pkgName, 'package.json')); |
no test coverage detected