(id)
| 35 | return id === virtualId ? resolvedVirtualId : null; |
| 36 | }, |
| 37 | async load(id) { |
| 38 | if (id !== resolvedVirtualId) return null; |
| 39 | const artifact = await bundledWorkerBundler(); |
| 40 | const paths = artifactPaths(artifact); |
| 41 | const output = [ |
| 42 | `export const sourcePath = ${JSON.stringify(paths.sourcePath)};`, |
| 43 | `export const wasmPath = ${JSON.stringify(paths.wasmPath)};`, |
| 44 | ]; |
| 45 | |
| 46 | if (command === "serve") { |
| 47 | output.push( |
| 48 | `export const source = ${JSON.stringify(artifact.source)};`, |
| 49 | `export const wasmBase64 = ${JSON.stringify(Buffer.from(artifact.wasm).toString("base64"))};`, |
| 50 | "export default { sourcePath, wasmPath, source, wasmBase64 };", |
| 51 | ); |
| 52 | } else { |
| 53 | output.push( |
| 54 | "export const source = undefined;", |
| 55 | "export const wasmBase64 = undefined;", |
| 56 | "export default { sourcePath, wasmPath, source, wasmBase64 };", |
| 57 | ); |
| 58 | } |
| 59 | |
| 60 | return output.join("\n"); |
| 61 | }, |
| 62 | async closeBundle() { |
| 63 | if (command !== "build") return; |
| 64 | const artifact = await bundledWorkerBundler(); |
nothing calls this directly
no test coverage detected