(serialized: (string | number)[])
| 20 | }; |
| 21 | |
| 22 | export 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 | |
| 47 | export const getBundle = (name: string) => { |
| 48 | let bundle = bundles.get(name); |
no test coverage detected
searching dependent graphs…