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

Function addSfcMapping

packages/vite/hmr/frameworks/vue/client/index.ts:650–662  ·  view source on GitHub ↗
(originalPath: string, fileName: string)

Source from the content-addressed store, hash-verified

648
649// Map a graph id (possibly a .vue source path) to actual import spec
650export function addSfcMapping(originalPath: string, fileName: string) {
651 try {
652 if (!originalPath || !fileName) return;
653 const base = originalPath.split('?')[0];
654 const norm = normalizeSpec(base);
655 // Also derive a relative variant if under app root to handle lookups that slice to that portion
656 let rel = norm;
657 const srcIdx = norm.indexOf(APP_VIRTUAL_WITH_SLASH);
658 if (srcIdx !== -1) rel = norm.slice(srcIdx);
659 sfcArtifactMap.set(norm, fileName);
660 if (rel !== norm) sfcArtifactMap.set(rel, fileName);
661 } catch {}
662}
663
664// Build explicit SFC variant URL (script/template). Always preserves the variant query.
665function resolveSfcVariantSpec(id: string, type: 'script' | 'template', cacheBustTag?: string): string {

Callers 1

handleVueSfcRegistryFunction · 0.85

Calls 4

normalizeSpecFunction · 0.85
indexOfMethod · 0.80
sliceMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected