Decode a kernel bundle's buffers into the standard pre-filtered StoreBundle.
(bundle: KernelStoreBundle)
| 56 | |
| 57 | /** Decode a kernel bundle's buffers into the standard pre-filtered StoreBundle. */ |
| 58 | function decodeKernelBundle(bundle: KernelStoreBundle): StoreBundle { |
| 59 | const asBuf = (u: Uint8Array) => Buffer.from(u.buffer, u.byteOffset, u.byteLength); |
| 60 | const decoded = decodeExtractBuffers( |
| 61 | { |
| 62 | meta: asBuf(bundle.buffers.meta), |
| 63 | nodes: asBuf(bundle.buffers.nodes), |
| 64 | edges: asBuf(bundle.buffers.edges), |
| 65 | refs: asBuf(bundle.buffers.refs), |
| 66 | arena: asBuf(bundle.buffers.arena), |
| 67 | }, |
| 68 | bundle.filePath, |
| 69 | bundle.language |
| 70 | ); |
| 71 | if (bundle.extraRefs?.length) decoded.unresolvedReferences.push(...bundle.extraRefs); |
| 72 | return finalizeStoreBundle(decoded, bundle.filePath, bundle.language, bundle.file); |
| 73 | } |
| 74 | |
| 75 | port.on('message', (msg: InMessage) => { |
| 76 | try { |
no test coverage detected