(id)
| 40 | enforce: 'pre', |
| 41 | apply: 'build', |
| 42 | async load(id) { |
| 43 | const debug = process.env.VITE_DEBUG_LOGS === 'true' || process.env.VITE_DEBUG_LOGS === '1'; |
| 44 | const cleanId = id.split('?', 1)[0]; |
| 45 | if (!FILTER.test(cleanId)) return null; |
| 46 | try { |
| 47 | await ensureDeps(); |
| 48 | if (!babel || !createLinker) return null; |
| 49 | const fs = await import('node:fs/promises'); |
| 50 | const code = await fs.readFile(cleanId, 'utf8'); |
| 51 | const forceLink = cleanId.includes('/node_modules/@nativescript/angular/') && cleanId.includes('polyfills'); |
| 52 | if (!code) return null; |
| 53 | if (!forceLink && code.indexOf('\u0275\u0275ngDeclare') === -1 && code.indexOf('ɵɵngDeclare') === -1 && code.indexOf('ngDeclare') === -1) return null; |
| 54 | const plugin = createLinker({ sourceMapping: false }); |
| 55 | if (debug) { |
| 56 | try { |
| 57 | console.log('[ns-angular-linker][rollup-load] linking', cleanId); |
| 58 | } catch {} |
| 59 | } |
| 60 | const result = await (babel as any).transformAsync(code, { |
| 61 | filename: cleanId, |
| 62 | configFile: false, |
| 63 | babelrc: false, |
| 64 | sourceMaps: false, |
| 65 | compact: false, |
| 66 | plugins: [plugin], |
| 67 | }); |
| 68 | if (result?.code && result.code !== code) { |
| 69 | return { code: result.code, map: null } as any; |
| 70 | } |
| 71 | } catch {} |
| 72 | return null; |
| 73 | }, |
| 74 | async transform(code, id) { |
| 75 | const debug = process.env.VITE_DEBUG_LOGS === 'true' || process.env.VITE_DEBUG_LOGS === '1'; |
| 76 | const cleanId = id.split('?', 1)[0]; |
nothing calls this directly
no test coverage detected