MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / pushImport

Function pushImport

packages/vite/configuration/javascript.ts:86–93  ·  view source on GitHub ↗
(abs: string, raw: boolean)

Source from the content-addressed store, hash-verified

84 let moduleMapLines: string[] = [];
85 let index = 0;
86 function pushImport(abs: string, raw: boolean) {
87 const id = `__m${index++}`;
88 const spec = toImportSpecifier(abs) + (raw ? '?raw' : '');
89 importLines.push(`import ${raw ? id : `* as ${id}`} from '${spec}';`);
90 const ctxKey = toCtxKey(abs);
91 registryEntries.push(`registry.set('${ctxKey}', '${spec.replace(/\?raw$/, '')}');`);
92 moduleMapLines.push(`all['${spec.replace(/\?raw$/, '')}'] = ${id};`);
93 }
94 xmlFiles.forEach((f) => pushImport(f, true));
95 styleFiles.forEach((f) => pushImport(f, true));
96 jsFiles.forEach((f) => pushImport(f, false));

Callers 1

loadFunction · 0.70

Calls 4

replaceMethod · 0.80
toImportSpecifierFunction · 0.70
toCtxKeyFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected