MCPcopy
hub / github.com/QwikDev/qwik / parseBundleGraph

Function parseBundleGraph

packages/qwik/src/core/preloader/bundle-graph.ts:22–45  ·  view source on GitHub ↗
(serialized: (string | number)[])

Source from the content-addressed store, hash-verified

20};
21
22export const parseBundleGraph = (serialized: (string | number)[]) => {
23 const graph: BundleGraph = new Map();
24 let i = 0;
25 while (i < serialized.length) {
26 const name = serialized[i++] as string;
27 const deps: ImportProbability[] = [];
28 let idx: number | string;
29 let probability = 1;
30 while (((idx = serialized[i]), typeof idx === 'number')) {
31 if (idx < 0) {
32 probability = -idx / 10;
33 } else {
34 deps.push({
35 $name$: serialized[idx] as string,
36 $importProbability$: probability,
37 $factor$: 1,
38 });
39 }
40 i++;
41 }
42 graph.set(name, deps);
43 }
44 return graph;
45};
46
47export const getBundle = (name: string) => {
48 let bundle = bundles.get(name);

Callers 2

loadBundleGraphFunction · 0.85
initPreloaderFunction · 0.85

Calls 1

setMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…