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

Function registerDependencyFile

packages/vite/hmr/server/websocket.ts:769–807  ·  view source on GitHub ↗
(depFileMap: Map<string, string>, candidate: string | null, fileName: string)

Source from the content-addressed store, hash-verified

767}
768
769function registerDependencyFile(depFileMap: Map<string, string>, candidate: string | null, fileName: string): void {
770 if (!candidate) return;
771
772 const cleaned = candidate.replace(PAT.QUERY_PATTERN, '');
773 const normalizedCandidate = normalizeNativeScriptCoreSpecifier(cleaned);
774 if (isCoreGlobalsReference(normalizedCandidate)) {
775 return;
776 }
777 if (isNativeScriptCoreModule(normalizedCandidate)) {
778 return;
779 }
780 if (isNativeScriptPluginModule(normalizedCandidate)) {
781 return;
782 }
783 if (resolveVendorFromCandidate(normalizedCandidate)) {
784 return;
785 }
786 if (!cleaned) return;
787
788 const variants = new Set<string>();
789 variants.add(normalizedCandidate);
790 variants.add(cleaned);
791
792 const normalized = path.posix.normalize(cleaned);
793 variants.add(normalized);
794
795 const withSlash = normalized.startsWith('/') ? normalized : `/${normalized}`;
796 variants.add(withSlash);
797
798 const withoutExt = withSlash.replace(/\.(ts|js|mjs|tsx|jsx)$/i, '');
799 variants.add(withoutExt);
800 variants.add(`${withoutExt}.js`);
801 variants.add(`${withoutExt}.mjs`);
802 variants.add(`${withoutExt}.ts`);
803
804 for (const variant of variants) {
805 depFileMap.set(variant, fileName);
806 }
807}
808
809function findDependencyFileName(depFileMap: Map<string, string>, key: string): string | undefined {
810 const variants = new Set<string>();

Callers

nothing calls this directly

Calls 8

isCoreGlobalsReferenceFunction · 0.85
isNativeScriptCoreModuleFunction · 0.85
replaceMethod · 0.80
addMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected