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

Function upsertGraphModule

packages/vite/hmr/server/websocket.ts:2318–2338  ·  view source on GitHub ↗
(rawId: string, code: string, deps: string[])

Source from the content-addressed store, hash-verified

2316 });
2317 }
2318 function upsertGraphModule(rawId: string, code: string, deps: string[]) {
2319 const id = normalizeGraphId(rawId);
2320 const normDeps = deps
2321 .map((d) => normalizeGraphId(d))
2322 .filter(Boolean)
2323 .slice()
2324 .sort();
2325 const hash = computeHash(code);
2326 const existing = graph.get(id);
2327 if (existing && existing.hash === hash && existing.deps.length === normDeps.length && existing.deps.every((d, i) => d === normDeps[i])) return; // unchanged
2328 graphVersion++;
2329 const gm: GraphModule = { id, deps: normDeps, hash };
2330 graph.set(id, gm);
2331 if (verbose) {
2332 try {
2333 console.log('[hmr-ws][graph] upsert', { id, deps: normDeps, hash, graphVersion });
2334 console.log('[hmr-ws][graph] size', graph.size);
2335 } catch {}
2336 }
2337 emitDelta([gm], []);
2338 }
2339 function isTypescriptFlavor(): boolean {
2340 try {
2341 return ACTIVE_STRATEGY?.flavor === 'typescript';

Callers 3

walkFunction · 0.85
configureServerFunction · 0.85
handleHotUpdateFunction · 0.85

Calls 11

normalizeGraphIdFunction · 0.85
computeHashFunction · 0.85
emitDeltaFunction · 0.85
sortMethod · 0.80
everyMethod · 0.80
mapMethod · 0.65
getMethod · 0.65
sliceMethod · 0.45
filterMethod · 0.45
setMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected