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

Function resolveVueKey

packages/vite/hmr/server/websocket.ts:1882–1905  ·  view source on GitHub ↗
(spec: string)

Source from the content-addressed store, hash-verified

1880
1881 // Helper to resolve .vue file imports to absolute project paths
1882 const resolveVueKey = (spec: string): string | null => {
1883 if (!spec || typeof spec !== 'string') {
1884 return null;
1885 }
1886
1887 // Only process .vue files
1888 if (!PAT.VUE_FILE_PATTERN.test(spec)) {
1889 return null;
1890 }
1891
1892 let key: string;
1893 if (spec.startsWith('/')) {
1894 key = spec;
1895 } else if (spec.startsWith('./') || spec.startsWith('../')) {
1896 key = path.posix.normalize(path.posix.join(importerDir, spec));
1897 if (!key.startsWith('/')) key = '/' + key;
1898 } else {
1899 return null;
1900 }
1901
1902 // Strip query params
1903 key = key.replace(PAT.QUERY_PATTERN, '');
1904 return key;
1905 };
1906
1907 // Replacement function for all imports
1908 const replaceVueImport = (_match: string, prefix: string, spec: string, suffix: string): string => {

Callers 2

replaceVueImportFunction · 0.85
rewriteImportsFunction · 0.85

Calls 3

joinMethod · 0.80
replaceMethod · 0.80
testMethod · 0.45

Tested by

no test coverage detected