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

Function emitDelta

packages/vite/hmr/server/websocket.ts:2287–2317  ·  view source on GitHub ↗
(changed: GraphModule[], removed: string[])

Source from the content-addressed store, hash-verified

2285 } catch {}
2286 }
2287 function emitDelta(changed: GraphModule[], removed: string[]) {
2288 if (!wss) return;
2289 // Record this version's txn batch order
2290 try {
2291 const changedIds = changed.map((m) => m.id);
2292 if (changedIds.length) {
2293 const ordered = computeTxnOrderForChanged(changedIds);
2294 txnBatches.set(graphVersion, ordered);
2295 // Keep only the last ~20 versions
2296 if (txnBatches.size > 20) {
2297 const drop = Array.from(txnBatches.keys())
2298 .sort((a, b) => a - b)
2299 .slice(0, txnBatches.size - 20);
2300 for (const k of drop) txnBatches.delete(k);
2301 }
2302 }
2303 } catch {}
2304 const payload = {
2305 type: 'ns:hmr-delta',
2306 baseVersion: graphVersion - 1,
2307 newVersion: graphVersion,
2308 changed: changed.map((m) => ({ id: m.id, deps: m.deps, hash: m.hash })),
2309 removed,
2310 };
2311 const json = JSON.stringify(payload);
2312 wss.clients.forEach((c) => {
2313 try {
2314 c.send(json);
2315 } catch {}
2316 });
2317 }
2318 function upsertGraphModule(rawId: string, code: string, deps: string[]) {
2319 const id = normalizeGraphId(rawId);
2320 const normDeps = deps

Callers 3

upsertGraphModuleFunction · 0.85
removeGraphModuleFunction · 0.85
handleHotUpdateFunction · 0.85

Calls 9

sortMethod · 0.80
forEachMethod · 0.80
sendMethod · 0.80
mapMethod · 0.65
keysMethod · 0.65
deleteMethod · 0.65
setMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected