MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / transform

Function transform

packages/vite/configuration/angular.ts:74–103  ·  view source on GitHub ↗
(code, id)

Source from the content-addressed store, hash-verified

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];
77 if (!FILTER.test(cleanId)) return null;
78 const forceLink = cleanId.includes('/node_modules/@nativescript/angular/') && cleanId.includes('polyfills');
79 if (!code) return null;
80 if (!forceLink && code.indexOf('\u0275\u0275ngDeclare') === -1 && code.indexOf('ɵɵngDeclare') === -1 && code.indexOf('ngDeclare') === -1) return null;
81 await ensureDeps();
82 if (!babel || !createLinker) return null;
83 try {
84 const plugin = createLinker({ sourceMapping: false });
85 if (debug) {
86 try {
87 console.log('[ns-angular-linker][rollup] linking', cleanId);
88 } catch {}
89 }
90 const result = await (babel as any).transformAsync(code, {
91 filename: cleanId,
92 configFile: false,
93 babelrc: false,
94 sourceMaps: false,
95 compact: false,
96 plugins: [plugin],
97 });
98 if (result?.code && result.code !== code) {
99 return { code: result.code, map: null };
100 }
101 } catch {}
102 return null;
103 },
104 };
105}
106

Callers

nothing calls this directly

Calls 7

includesMethod · 0.80
indexOfMethod · 0.80
resolveMethod · 0.80
ensureDepsFunction · 0.70
testMethod · 0.45
logMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected