(babel: any, createLinker: any, src: string)
| 17 | } |
| 18 | |
| 19 | async function linkFile(babel: any, createLinker: any, src: string): Promise<string | null> { |
| 20 | const code = await fs.readFile(src, 'utf8'); |
| 21 | if (!code) return null; |
| 22 | // Quick check to skip non-partial files |
| 23 | if (code.indexOf('\u0275\u0275ngDeclare') === -1 && code.indexOf('ɵɵngDeclare') === -1 && code.indexOf('ngDeclare') === -1) return null; |
| 24 | const plugin = createLinker({ sourceMapping: false }); |
| 25 | const res = await babel.transformAsync(code, { |
| 26 | filename: src, |
| 27 | configFile: false, |
| 28 | babelrc: false, |
| 29 | sourceMaps: false, |
| 30 | compact: false, |
| 31 | plugins: [plugin], |
| 32 | }); |
| 33 | return res?.code && res.code !== code ? res.code : null; |
| 34 | } |
| 35 | |
| 36 | async function copyOrLinkInto(babel: any, createLinker: any, srcFile: string, cacheFile: string) { |
| 37 | const dir = path.dirname(cacheFile); |
no test coverage detected