sandboxedjs 0.1.89 → 0.1.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +132 -30
- package/dist/index.js +132 -30
- package/package.json +3 -1
- package/dist/agent.cjs.map +0 -1
- package/dist/agent.js.map +0 -1
- package/dist/browser-host.cjs.map +0 -1
- package/dist/browser-host.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/python/wheels/MarkupSafe-3.0.2-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/MarkupSafe-3.0.3-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/PyYAML-6.0.2-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/PyYAML-6.0.3-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/aiohttp-3.14.3-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/cffi-2.1.1-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/httptools-0.8.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/index.json +0 -485
- package/dist/python/wheels/msgpack-1.1.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/numpy-2.2.6-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/pydantic_core-2.23.2-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/pydantic_core-2.46.5-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/pydantic_core-2.49.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/sbx_c_probe-1.0.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/sbx_cython_probe-1.0.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/sbx_meson_probe-1.0.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/sbx_native_probe-1.0.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/sbx_patched_probe-1.0.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/sbx_pep517_probe-1.0.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/sbx_rust_probe-1.0.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/sbx_setuptools_probe-1.0.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/sbx_yaml_probe-1.0.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/siphash24-1.9-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/xxhash-4.0.1-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python/wheels/zstandard-0.25.0-cp313-cp313-emscripten_5_0_6_wasm32.whl +0 -0
- package/dist/python-abi.cjs.map +0 -1
- package/dist/python-abi.js.map +0 -1
- package/dist/python-worker.js.map +0 -1
- package/dist/rolldown-wasi-worker.js.map +0 -1
- package/dist/service-worker.js.map +0 -1
- package/dist/worker-entry.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/python/host-abi.ts","../src/python/protocol.ts","../src/python/syscall-client.ts","../src/python/sync-transport.ts","../src/python/sbxfs.ts","../src/util/binary.ts","../src/python/worker-entry.ts","../src/python/worker.ts"],"names":[],"mappings":";AAGO,IAAM,oBAAA,GAAuB,CAAA;AAE7B,IAAM,wBAAA,GAA2B,EAAA;AACjC,IAAM,yBAAA,GAA4B,EAAA;AAGlC,IAAM,EAAA,GAAK;AAAA,EAChB,SA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E,KAAK,GAAG,CAAA;AACrD,EAAA,MAAM,EAAE,UAAA,EAAW,GAAK,MAAM;AAAA;AAAA;AAAA,IAAoD;AAAA,GAAA;AAGlF,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,UAAA;AAAA,IACN,SAAS,CAAC,OAAA,KACR,WAAW,EAAA,CAAG,SAAA,EAAW,CAAC,OAAA,KAAY;AACpC,MAAA,MAAM,IAAA,GAAO,OAAA;AACb,MAAA,IAAI,IAAA,EAAM,IAAA,KAAS,OAAA,EAAS,OAAA,CAAQ,IAAI,CAAA;AAAA,IAC1C,CAAC;AAAA,GACL;AACF;AAEA,KAAK,SAAQ,CAAE,IAAA,CAAK,CAAC,EAAE,IAAA,EAAM,SAAQ,KAAM;AACzC,EAAA,OAAA,CAAQ,CAAC,KAAA,KAAU;AACjB,IAAA,KAAK,gBAAA,CAAiB,KAAA,EAAO,IAAI,CAAA,CAAE,KAAA;AAAA,MAAM,CAAC,KAAA,KACxC,IAAA,CAAK,WAAA,CAAY,EAAE,IAAA,EAAM,QAAA,EAAU,OAAA,EAAS,MAAA,CAAO,KAAA,EAAO,OAAA,IAAW,KAAK,GAAG;AAAA,KAC/E;AAAA,EACF,CAAC,CAAA;AAGD,EAAA,IAAA,CAAK,WAAA,CAAY,EAAE,IAAA,EAAM,mBAAA,EAAqB,CAAA;AAChD,CAAC,CAAA","file":"python-worker.js","sourcesContent":["/* Generated by python-runtime/scripts/generate_abi.py from abi/host-v1.json. Do not edit. */\n\n/** Protocol version carried in every frame. */\nexport const SBX_HOST_ABI_VERSION = 1;\n\nexport const SBX_REQUEST_HEADER_BYTES = 16;\nexport const SBX_RESPONSE_HEADER_BYTES = 20;\n\n/** Operation codes. Families are 256 apart so a family stays contiguous. */\nexport const Op = {\n handshake: 0,\n openat: 1,\n close: 2,\n read: 3,\n write: 4,\n pread: 5,\n pwrite: 6,\n lseek: 7,\n fstat: 8,\n statat: 9,\n ftruncate: 10,\n renameat: 11,\n unlinkat: 12,\n mkdirat: 13,\n readlinkat: 14,\n symlinkat: 15,\n getdents: 16,\n fsync: 17,\n dup: 256,\n dup2: 257,\n get_flags: 258,\n set_flags: 259,\n pipe: 512,\n poll: 768,\n clock_gettime: 1024,\n sleep: 1025,\n getpid: 1280,\n getcwd: 1281,\n chdir: 1282,\n environ: 1283,\n getrandom: 1536,\n socket: 1792,\n bind: 1793,\n listen: 1794,\n accept: 1795,\n connect: 1796,\n send: 1797,\n recv: 1798,\n shutdown: 1799,\n getsockname: 1800,\n getpeername: 1801,\n setsockopt: 1802,\n getsockopt: 1803,\n socket_close: 1804,\n spawn: 2048,\n waitpid: 2049,\n kill: 2050,\n} as const;\n\nexport type OpCode = (typeof Op)[keyof typeof Op];\n\n/** Canonical (Linux/musl) errno values. A negative status is `-Errno.X`. */\nexport const Errno = {\n EPERM: 1,\n ENOENT: 2,\n ESRCH: 3,\n EINTR: 4,\n EIO: 5,\n ENXIO: 6,\n E2BIG: 7,\n EBADF: 9,\n ECHILD: 10,\n EAGAIN: 11,\n ENOMEM: 12,\n EACCES: 13,\n EFAULT: 14,\n EBUSY: 16,\n EEXIST: 17,\n EXDEV: 18,\n ENODEV: 19,\n ENOTDIR: 20,\n EISDIR: 21,\n EINVAL: 22,\n ENFILE: 23,\n EMFILE: 24,\n ENOTTY: 25,\n EFBIG: 27,\n ENOSPC: 28,\n ESPIPE: 29,\n EROFS: 30,\n EMLINK: 31,\n EPIPE: 32,\n ERANGE: 34,\n ENAMETOOLONG: 36,\n ENOSYS: 38,\n ENOTEMPTY: 39,\n ELOOP: 40,\n ENODATA: 61,\n ENOTSOCK: 88,\n EPROTONOSUPPORT: 93,\n EAFNOSUPPORT: 97,\n EADDRINUSE: 98,\n EADDRNOTAVAIL: 99,\n ENETUNREACH: 101,\n ECONNRESET: 104,\n EISCONN: 106,\n ENOTCONN: 107,\n ECONNREFUSED: 111,\n EPROTO: 71,\n EOVERFLOW: 75,\n ETIMEDOUT: 110,\n ECANCELED: 125,\n EDQUOT: 122,\n} as const;\n\nexport type ErrnoName = keyof typeof Errno;\n\n/** Capability names a host may advertise in its handshake. */\nexport const CAPABILITIES = [\"files\", \"descriptors\", \"pipes\", \"readiness\", \"time\", \"identity\", \"entropy\", \"sockets\", \"processes\", \"signals\", \"storage\", \"services\", \"threads\"] as const;\n\nexport type Capability = (typeof CAPABILITIES)[number];\n\n/** Names by code, for diagnostics. Never used for dispatch. */\nexport const OP_NAMES: Record<number, string> = Object.fromEntries(\n Object.entries(Op).map(([name, code]) => [code, name]),\n);\n\nexport const ERRNO_NAMES: Record<number, string> = Object.fromEntries(\n Object.entries(Errno).map(([name, code]) => [code, name]),\n);\n","/**\n * Framing for the host ABI.\n *\n * Every field is fixed-width and little-endian, because the two sides are\n * compiled by different toolchains and a shared struct layout is the one thing\n * they cannot negotiate at runtime. Text is UTF-8; file content and network\n * traffic are raw bytes and are never decoded in transit.\n *\n * `request_id` and `process_generation` exist so a late answer can be\n * recognised as late. A worker that exits and is replaced must not have its\n * successor accept a completion addressed to the process before it, and the\n * failure mode for a mismatched frame is an error — never an empty success.\n */\n\nimport {\n Errno, OP_NAMES, SBX_HOST_ABI_VERSION, SBX_REQUEST_HEADER_BYTES, SBX_RESPONSE_HEADER_BYTES,\n} from \"./host-abi.js\";\n\nexport interface RequestHeader {\n version: number;\n op: number;\n requestId: number;\n generation: number;\n}\n\nexport interface ResponseFrame {\n header: RequestHeader;\n status: number;\n payload: Uint8Array;\n}\n\nexport class ProtocolError extends Error {\n readonly code = \"ERR_SBX_ABI_PROTOCOL\";\n}\n\nexport function encodeRequest(header: RequestHeader, payload: Uint8Array): Uint8Array {\n const frame = new Uint8Array(SBX_REQUEST_HEADER_BYTES + payload.length);\n const view = new DataView(frame.buffer);\n view.setUint16(0, header.version, true);\n view.setUint16(2, header.op, true);\n view.setUint32(4, header.requestId, true);\n view.setUint32(8, header.generation, true);\n view.setUint32(12, payload.length, true);\n frame.set(payload, SBX_REQUEST_HEADER_BYTES);\n return frame;\n}\n\nexport function decodeRequest(frame: Uint8Array): { header: RequestHeader; payload: Uint8Array } {\n if (frame.length < SBX_REQUEST_HEADER_BYTES) throw new ProtocolError(\"short request frame\");\n const view = new DataView(frame.buffer, frame.byteOffset, frame.byteLength);\n const header: RequestHeader = {\n version: view.getUint16(0, true),\n op: view.getUint16(2, true),\n requestId: view.getUint32(4, true),\n generation: view.getUint32(8, true),\n };\n const length = view.getUint32(12, true);\n if (frame.length - SBX_REQUEST_HEADER_BYTES < length) {\n throw new ProtocolError(`truncated payload for ${OP_NAMES[header.op] ?? header.op}`);\n }\n return {\n header,\n payload: frame.subarray(SBX_REQUEST_HEADER_BYTES, SBX_REQUEST_HEADER_BYTES + length),\n };\n}\n\nexport function encodeResponse(header: RequestHeader, status: number, payload: Uint8Array): Uint8Array {\n const frame = new Uint8Array(SBX_RESPONSE_HEADER_BYTES + payload.length);\n const view = new DataView(frame.buffer);\n view.setUint16(0, header.version, true);\n view.setUint16(2, header.op, true);\n view.setUint32(4, header.requestId, true);\n view.setUint32(8, header.generation, true);\n view.setInt32(12, status, true);\n view.setUint32(16, payload.length, true);\n frame.set(payload, SBX_RESPONSE_HEADER_BYTES);\n return frame;\n}\n\nexport function decodeResponse(frame: Uint8Array, expected?: RequestHeader): ResponseFrame {\n if (frame.length < SBX_RESPONSE_HEADER_BYTES) {\n /* An empty or short frame means the transport failed. Reporting it as a\n * zero-byte success is how a dead host turns into silent data loss. */\n throw new ProtocolError(\"the host ABI transport returned an incomplete frame\");\n }\n const view = new DataView(frame.buffer, frame.byteOffset, frame.byteLength);\n const header: RequestHeader = {\n version: view.getUint16(0, true),\n op: view.getUint16(2, true),\n requestId: view.getUint32(4, true),\n generation: view.getUint32(8, true),\n };\n const status = view.getInt32(12, true);\n const length = view.getUint32(16, true);\n if (frame.length - SBX_RESPONSE_HEADER_BYTES < length) throw new ProtocolError(\"truncated response payload\");\n if (expected) {\n if (header.requestId !== expected.requestId) throw new ProtocolError(\"stale response: request id mismatch\");\n if (header.generation !== expected.generation) throw new ProtocolError(\"stale response: process generation mismatch\");\n if (header.op !== expected.op) throw new ProtocolError(\"response answers a different operation\");\n }\n if (header.version !== SBX_HOST_ABI_VERSION) {\n throw new ProtocolError(`host ABI version ${header.version}, expected ${SBX_HOST_ABI_VERSION}`);\n }\n return {\n header,\n status,\n payload: frame.subarray(SBX_RESPONSE_HEADER_BYTES, SBX_RESPONSE_HEADER_BYTES + length),\n };\n}\n\n/** Little-endian reader over a payload. Bounds-checked: the guest owns this memory. */\nexport class Reader {\n private at = 0;\n private readonly view: DataView;\n private readonly bytes: Uint8Array;\n\n constructor(bytes: Uint8Array) {\n this.bytes = bytes;\n this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n }\n\n private need(count: number): number {\n if (this.at + count > this.bytes.length) throw new ProtocolError(\"payload underrun\");\n const offset = this.at;\n this.at += count;\n return offset;\n }\n\n i32(): number { return this.view.getInt32(this.need(4), true); }\n u32(): number { return this.view.getUint32(this.need(4), true); }\n i64(): number { return Number(this.view.getBigInt64(this.need(8), true)); }\n u64(): number { return Number(this.view.getBigUint64(this.need(8), true)); }\n bytes32(): Uint8Array {\n const length = this.u32();\n const offset = this.need(length);\n return this.bytes.subarray(offset, offset + length);\n }\n string(): string { return new TextDecoder().decode(this.bytes32()); }\n get remaining(): number { return this.bytes.length - this.at; }\n}\n\n/** Little-endian writer. Grows as needed; payload sizes are bounded by the caller. */\nexport class Writer {\n private parts: Uint8Array[] = [];\n\n i32(value: number): this { const b = new Uint8Array(4); new DataView(b.buffer).setInt32(0, value, true); this.parts.push(b); return this; }\n u32(value: number): this { const b = new Uint8Array(4); new DataView(b.buffer).setUint32(0, value >>> 0, true); this.parts.push(b); return this; }\n i64(value: number): this { const b = new Uint8Array(8); new DataView(b.buffer).setBigInt64(0, BigInt(Math.trunc(value)), true); this.parts.push(b); return this; }\n u64(value: number): this { const b = new Uint8Array(8); new DataView(b.buffer).setBigUint64(0, BigInt(Math.trunc(value)), true); this.parts.push(b); return this; }\n bytes32(value: Uint8Array): this { this.u32(value.length); this.parts.push(value); return this; }\n string(value: string): this { return this.bytes32(new TextEncoder().encode(value)); }\n\n finish(): Uint8Array {\n const total = this.parts.reduce((sum, part) => sum + part.length, 0);\n const out = new Uint8Array(total);\n let at = 0;\n for (const part of this.parts) { out.set(part, at); at += part.length; }\n return out;\n }\n}\n\n/** A status the guest reads as `-errno`. */\nexport function failure(errno: number): number {\n return -Math.abs(errno);\n}\n\nexport const EOK = 0;\nexport { Errno };\n","/**\n * The guest side of the host ABI, as the compiled code sees it.\n *\n * Compiled programs reach this through `sbx_host_call` in\n * `python-runtime/native/js/library_sbx.js`, which copies a frame out of the\n * module's memory, calls {@link HostAbiClient.callRaw}, and copies the answer\n * back. The typed methods below are for the JavaScript side of the worker —\n * loaders, the probe harness, and tests — which need the same operations\n * without going through Wasm memory.\n */\n\nimport { Errno, ERRNO_NAMES, OP_NAMES, Op, SBX_HOST_ABI_VERSION } from \"./host-abi.js\";\nimport { Reader, Writer, decodeResponse, encodeRequest, type RequestHeader } from \"./protocol.js\";\nimport type { HostCallClient } from \"./sync-transport.js\";\n\nexport class HostAbiError extends Error {\n errno: number;\n code: string;\n constructor(errno: number, op: number) {\n const name = ERRNO_NAMES[errno] ?? String(errno);\n super(`${OP_NAMES[op] ?? `op ${op}`} failed: ${name}`);\n this.errno = errno;\n this.code = name;\n }\n}\n\nexport interface HostAbiResult {\n status: number;\n payload: Uint8Array;\n}\n\n/**\n * One process's connection to the kernel.\n *\n * `generation` is stamped into every frame and checked on the way back, so a\n * completion belonging to a previous incarnation of this PID is rejected rather\n * than applied to the wrong descriptor table.\n */\nexport class HostAbiClient {\n private transport: HostCallClient;\n private generation: number;\n private nextRequestId = 1;\n\n constructor(transport: HostCallClient, generation: number) {\n this.transport = transport;\n this.generation = generation;\n }\n\n /** Send one frame, blocking. Returns the status and payload verbatim. */\n callRaw(op: number, payload: Uint8Array): HostAbiResult {\n const header: RequestHeader = {\n version: SBX_HOST_ABI_VERSION,\n op,\n requestId: this.nextRequestId++,\n generation: this.generation,\n };\n const frame = this.transport.call(encodeRequest(header, payload));\n const response = decodeResponse(frame, header);\n return { status: response.status, payload: response.payload };\n }\n\n /** As {@link callRaw}, but a negative status becomes an exception. */\n private call(op: number, payload: Uint8Array): HostAbiResult {\n const result = this.callRaw(op, payload);\n if (result.status < 0) throw new HostAbiError(-result.status, op);\n return result;\n }\n\n handshake(): { version: number; capabilities: Record<string, boolean> } {\n const { payload } = this.call(Op.handshake, new Uint8Array());\n const r = new Reader(payload);\n const version = r.u32();\n const count = r.u32();\n const capabilities: Record<string, boolean> = {};\n for (let i = 0; i < count; i += 1) capabilities[r.string()] = r.u32() === 1;\n return { version, capabilities };\n }\n\n open(path: string, flags: number, mode = 0o666): number {\n return this.call(Op.openat, new Writer().string(path).u32(flags).u32(mode).finish()).status;\n }\n\n close(fd: number): void {\n this.call(Op.close, new Writer().i32(fd).finish());\n }\n\n read(fd: number, length: number): Uint8Array {\n return this.call(Op.read, new Writer().i32(fd).u32(length).finish()).payload;\n }\n\n write(fd: number, data: Uint8Array): number {\n return this.call(Op.write, new Writer().i32(fd).bytes32(data).finish()).status;\n }\n\n /** Write every byte, looping over short writes the way a guest's libc must. */\n writeAll(fd: number, data: Uint8Array): void {\n let at = 0;\n while (at < data.length) at += this.write(fd, data.subarray(at));\n }\n\n pread(fd: number, length: number, offset: number): Uint8Array {\n return this.call(Op.pread, new Writer().i32(fd).u32(length).u64(offset).finish()).payload;\n }\n\n pwrite(fd: number, data: Uint8Array, offset: number): number {\n return this.call(Op.pwrite, new Writer().i32(fd).bytes32(data).u64(offset).finish()).status;\n }\n\n seek(fd: number, offset: number, whence: number): number {\n const { payload } = this.call(Op.lseek, new Writer().i32(fd).i64(offset).u32(whence).finish());\n return new Reader(payload).i64();\n }\n\n fstat(fd: number): HostStat {\n return decodeStat(this.call(Op.fstat, new Writer().i32(fd).finish()).payload);\n }\n\n stat(path: string, followLinks = true): HostStat {\n return decodeStat(\n this.call(Op.statat, new Writer().string(path).u32(followLinks ? 1 : 0).finish()).payload,\n );\n }\n\n ftruncate(fd: number, length: number): void {\n this.call(Op.ftruncate, new Writer().i32(fd).u64(length).finish());\n }\n\n rename(from: string, to: string): void {\n this.call(Op.renameat, new Writer().string(from).string(to).finish());\n }\n\n unlink(path: string, removeDirectory = false): void {\n this.call(Op.unlinkat, new Writer().string(path).u32(removeDirectory ? 1 : 0).finish());\n }\n\n mkdir(path: string, mode = 0o777): void {\n this.call(Op.mkdirat, new Writer().string(path).u32(mode).finish());\n }\n\n readlink(path: string): string {\n return new Reader(this.call(Op.readlinkat, new Writer().string(path).finish()).payload).string();\n }\n\n symlink(target: string, path: string): void {\n this.call(Op.symlinkat, new Writer().string(target).string(path).finish());\n }\n\n readdir(fd: number, bufferSize = 4096): string[] {\n const { payload } = this.call(Op.getdents, new Writer().i32(fd).u32(bufferSize).finish());\n const text = new TextDecoder().decode(payload);\n return text.split(\"\\0\").filter((name) => name.length > 0);\n }\n\n dup(fd: number, from = 0): number {\n return this.call(Op.dup, new Writer().i32(fd).u32(from).finish()).status;\n }\n\n dup2(fd: number, target: number): number {\n return this.call(Op.dup2, new Writer().i32(fd).i32(target).finish()).status;\n }\n\n getFlags(fd: number): { flags: number; cloexec: boolean } {\n const r = new Reader(this.call(Op.get_flags, new Writer().i32(fd).finish()).payload);\n return { flags: r.u32(), cloexec: r.u32() === 1 };\n }\n\n setFlags(fd: number, flags: number, cloexec: boolean): void {\n this.call(Op.set_flags, new Writer().i32(fd).u32(flags).u32(cloexec ? 1 : 0).finish());\n }\n\n pipe(flags = 0): [number, number] {\n const r = new Reader(this.call(Op.pipe, new Writer().u32(flags).finish()).payload);\n return [r.i32(), r.i32()];\n }\n\n poll(entries: { fd: number; events: number }[], timeoutMs: number): { fd: number; revents: number }[] {\n const w = new Writer().u32(entries.length);\n for (const entry of entries) w.i32(entry.fd).u32(entry.events);\n w.i64(timeoutMs);\n const r = new Reader(this.call(Op.poll, w.finish()).payload);\n const count = r.u32();\n const out: { fd: number; revents: number }[] = [];\n for (let i = 0; i < count; i += 1) out.push({ fd: r.i32(), revents: r.u32() });\n return out;\n }\n\n clockGettime(monotonic: boolean): { seconds: number; nanos: number } {\n const r = new Reader(this.call(Op.clock_gettime, new Writer().u32(monotonic ? 1 : 0).finish()).payload);\n return { seconds: r.i64(), nanos: r.u32() };\n }\n\n sleep(nanos: number): void {\n this.call(Op.sleep, new Writer().u64(nanos).finish());\n }\n\n identity(): { pid: number; ppid: number; uid: number; gid: number; umask: number } {\n const r = new Reader(this.call(Op.getpid, new Uint8Array()).payload);\n return { pid: r.i32(), ppid: r.i32(), uid: r.u32(), gid: r.u32(), umask: r.u32() };\n }\n\n getcwd(): string {\n return new Reader(this.call(Op.getcwd, new Uint8Array()).payload).string();\n }\n\n chdir(path: string): void {\n this.call(Op.chdir, new Writer().string(path).finish());\n }\n\n environ(): Record<string, string> {\n const joined = new Reader(this.call(Op.environ, new Uint8Array()).payload).string();\n const out: Record<string, string> = {};\n for (const entry of joined.split(\"\\0\")) {\n if (!entry) continue;\n const split = entry.indexOf(\"=\");\n out[entry.slice(0, split)] = entry.slice(split + 1);\n }\n return out;\n }\n\n getrandom(length: number): Uint8Array {\n return this.call(Op.getrandom, new Writer().u32(length).finish()).payload;\n }\n\n socket(family: number, type: number, protocol = 0): number {\n return this.call(Op.socket, new Writer().u32(family).u32(type).i32(protocol).finish()).status;\n }\n\n bind(fd: number, address: string, port: number): void {\n this.call(Op.bind, new Writer().i32(fd).string(address).u32(port).finish());\n }\n\n listen(fd: number, backlog = 128): void {\n this.call(Op.listen, new Writer().i32(fd).u32(backlog).finish());\n }\n\n accept(fd: number): { fd: number; address: string; port: number } {\n const result = this.call(Op.accept, new Writer().i32(fd).finish());\n const r = new Reader(result.payload);\n return { fd: result.status, address: r.string(), port: r.u32() };\n }\n\n connect(fd: number, address: string, port: number): void {\n this.call(Op.connect, new Writer().i32(fd).string(address).u32(port).finish());\n }\n\n send(fd: number, data: Uint8Array): number {\n return this.call(Op.send, new Writer().i32(fd).bytes32(data).finish()).status;\n }\n\n recv(fd: number, length: number): Uint8Array {\n return this.call(Op.recv, new Writer().i32(fd).u32(length).finish()).payload;\n }\n\n shutdown(fd: number, how: number): void {\n this.call(Op.shutdown, new Writer().i32(fd).u32(how).finish());\n }\n\n socketName(fd: number, peer = false): { address: string; port: number } {\n const payload = this.call(peer ? Op.getpeername : Op.getsockname, new Writer().i32(fd).finish()).payload;\n const r = new Reader(payload);\n return { address: r.string(), port: r.u32() };\n }\n}\n\nexport interface HostStat {\n ino: number;\n mode: number;\n size: number;\n uid: number;\n gid: number;\n nlink: number;\n atimeNs: number;\n mtimeNs: number;\n ctimeNs: number;\n}\n\nfunction decodeStat(payload: Uint8Array): HostStat {\n const r = new Reader(payload);\n return {\n ino: r.u64(), mode: r.u32(), size: r.u64(),\n uid: r.u32(), gid: r.u32(), nlink: r.u32(),\n atimeNs: r.i64(), mtimeNs: r.i64(), ctimeNs: r.i64(),\n };\n}\n\nexport { Errno, Op };\n","/**\n * The transport under the host ABI: one blocking client, one non-blocking host.\n *\n * This is deliberately not `runtime/sync-channel.ts`. That channel predates the\n * ABI and carries no request identity, so a late or duplicated answer is\n * indistinguishable from the right one; worse, its server answers a failed\n * handler with a zero-length frame, which a caller can only read as a\n * successful empty result. Both are acceptable for `spawnSync`, where the\n * payload is self-describing JSON, and neither is acceptable for `read()`,\n * where an empty result means end of input.\n *\n * So the framing here always carries a full response header, a transport\n * failure is always an error, and the client verifies that the answer it got\n * belongs to the question it asked.\n *\n * Only the client blocks, and the client never owns shared state. The host\n * services requests from its ordinary event loop and may take as long as it\n * likes — which is what lets a guest's synchronous `read()` wait for a\n * keystroke that has not been typed yet.\n */\n\n/* Control-word slots over shared memory. */\nconst STATE = 0;\nconst LENGTH = 1;\nconst MORE = 2;\nconst CONTROL_WORDS = 4;\n\nconst STATE_IDLE = 0;\nconst STATE_REQUEST = 1;\nconst STATE_RESPONSE = 2;\nconst STATE_CONTINUE = 3;\nconst STATE_CLOSED = 4;\n\n/** How long a blocked client sleeps before re-checking for a closed transport. */\nconst WAIT_SLICE_MS = 200;\n\nexport interface HostTransportBuffers {\n control: SharedArrayBuffer;\n data: SharedArrayBuffer;\n}\n\nexport function createHostTransportBuffers(windowBytes = 1 << 20): HostTransportBuffers {\n return {\n control: new SharedArrayBuffer(CONTROL_WORDS * Int32Array.BYTES_PER_ELEMENT),\n data: new SharedArrayBuffer(windowBytes),\n };\n}\n\n/**\n * Can this host support a blocking guest at all?\n *\n * `SharedArrayBuffer` needs cross-origin isolation in a browser, and\n * `Atomics.wait` is forbidden on a browser's main thread — which is why the\n * blocking side is always the worker. Reporting the cause matters: without it\n * the failure surfaces as an interpreter that will not start, with nothing\n * naming the header the host is missing.\n */\nexport function syncTransportUnavailableReason(): string | null {\n if (typeof globalThis.crossOriginIsolated === \"boolean\" && !globalThis.crossOriginIsolated) {\n return \"the page is not cross-origin isolated. Serve it with Cross-Origin-Opener-Policy: same-origin and \" +\n \"Cross-Origin-Embedder-Policy: require-corp.\";\n }\n if (typeof SharedArrayBuffer !== \"function\") return \"SharedArrayBuffer is unavailable in this host.\";\n if (typeof Atomics !== \"object\" || typeof Atomics.wait !== \"function\") return \"Atomics.wait is unavailable in this host.\";\n return null;\n}\n\nexport class HostTransportError extends Error {\n code = \"ERR_SBX_HOST_TRANSPORT\";\n}\n\n/**\n * The guest side. Lives in the worker with the compiled program and blocks.\n *\n * `wake` nudges the host's event loop: the host cannot poll shared memory\n * without spinning, so each window is announced with an ordinary message.\n */\nexport class HostCallClient {\n private control: Int32Array;\n private data: Uint8Array;\n private capacity: number;\n private wake: () => void;\n private closed = false;\n\n constructor(buffers: HostTransportBuffers, wake: () => void) {\n this.control = new Int32Array(buffers.control);\n this.data = new Uint8Array(buffers.data);\n this.capacity = this.data.length;\n this.wake = wake;\n }\n\n /** Send a frame and block until the whole answer is back. Never returns empty. */\n call(request: Uint8Array): Uint8Array {\n /* A transport that has already gone away stays gone. Without this the next\n * call republishes a request over the closed marker and waits for an answer\n * from a host that is no longer listening — a killed process would hang on\n * its way out instead of exiting. */\n if (this.closed || Atomics.load(this.control, STATE) === STATE_CLOSED) {\n this.closed = true;\n throw new HostTransportError(\"the host transport is closed\");\n }\n this.send(request);\n const response = this.receive();\n if (response.length === 0) {\n throw new HostTransportError(\"the host answered with no frame; the kernel side failed or went away\");\n }\n return response;\n }\n\n private send(request: Uint8Array): void {\n let offset = 0;\n for (;;) {\n const size = Math.min(this.capacity, request.length - offset);\n this.data.set(request.subarray(offset, offset + size), 0);\n offset += size;\n Atomics.store(this.control, LENGTH, size);\n Atomics.store(this.control, MORE, offset < request.length ? 1 : 0);\n this.publish(STATE_REQUEST);\n const next = this.waitWhile(STATE_REQUEST);\n if (next === STATE_RESPONSE) return;\n if (next !== STATE_CONTINUE) {\n this.closed = true;\n throw new HostTransportError(\"the host went away mid-request\");\n }\n }\n }\n\n private receive(): Uint8Array {\n const parts: Uint8Array[] = [];\n let total = 0;\n for (;;) {\n const size = Atomics.load(this.control, LENGTH);\n parts.push(this.data.slice(0, size));\n total += size;\n if (Atomics.load(this.control, MORE) === 0) break;\n this.publish(STATE_CONTINUE);\n if (this.waitWhile(STATE_CONTINUE) !== STATE_RESPONSE) {\n this.closed = true;\n throw new HostTransportError(\"the host went away mid-response\");\n }\n }\n Atomics.store(this.control, STATE, STATE_IDLE);\n if (parts.length === 1) return parts[0];\n const joined = new Uint8Array(total);\n let at = 0;\n for (const part of parts) { joined.set(part, at); at += part.length; }\n return joined;\n }\n\n private publish(state: number): void {\n Atomics.store(this.control, STATE, state);\n Atomics.notify(this.control, STATE);\n this.wake();\n }\n\n private waitWhile(state: number): number {\n for (;;) {\n Atomics.wait(this.control, STATE, state, WAIT_SLICE_MS);\n const current = Atomics.load(this.control, STATE);\n if (current !== state) return current;\n }\n }\n}\n\n/**\n * The host side. Lives wherever the volume and the process table do, and never\n * blocks; `handle` is free to be asynchronous.\n */\nexport class HostCallServer {\n private control: Int32Array;\n private data: Uint8Array;\n private capacity: number;\n private handle: (request: Uint8Array) => Promise<Uint8Array> | Uint8Array;\n private onFault: (error: unknown) => void;\n\n private incoming: Uint8Array[] = [];\n private outgoing: Uint8Array | null = null;\n private sent = 0;\n private closed = false;\n\n constructor(\n buffers: HostTransportBuffers,\n handle: (request: Uint8Array) => Promise<Uint8Array> | Uint8Array,\n onFault: (error: unknown) => void = () => {},\n ) {\n this.control = new Int32Array(buffers.control);\n this.data = new Uint8Array(buffers.data);\n this.capacity = this.data.length;\n this.handle = handle;\n this.onFault = onFault;\n }\n\n /** Call on each wake message from the client. */\n async pump(): Promise<void> {\n if (this.closed) return;\n const state = Atomics.load(this.control, STATE);\n if (state === STATE_REQUEST) {\n const size = Atomics.load(this.control, LENGTH);\n this.incoming.push(this.data.slice(0, size));\n if (Atomics.load(this.control, MORE) === 1) {\n this.publish(STATE_CONTINUE);\n return;\n }\n const request = concat(this.incoming);\n this.incoming = [];\n let response: Uint8Array;\n try {\n response = await this.handle(request);\n } catch (error) {\n /* Anything escaping the handler is a bug in the dispatcher. Closing the\n * transport is the honest answer: the client raises, rather than\n * reading a zero-length frame as a successful empty result. */\n this.onFault(error);\n this.close();\n return;\n }\n if (this.closed) return;\n this.outgoing = response;\n this.sent = 0;\n this.sendWindow();\n return;\n }\n if (state === STATE_CONTINUE) this.sendWindow();\n }\n\n /** Release a blocked client — container teardown, or the worker being killed. */\n close(): void {\n if (this.closed) return;\n this.closed = true;\n Atomics.store(this.control, STATE, STATE_CLOSED);\n Atomics.notify(this.control, STATE);\n }\n\n private sendWindow(): void {\n const payload = this.outgoing ?? new Uint8Array();\n const size = Math.min(this.capacity, payload.length - this.sent);\n this.data.set(payload.subarray(this.sent, this.sent + size), 0);\n this.sent += size;\n Atomics.store(this.control, LENGTH, size);\n Atomics.store(this.control, MORE, this.sent < payload.length ? 1 : 0);\n this.publish(STATE_RESPONSE);\n }\n\n private publish(state: number): void {\n Atomics.store(this.control, STATE, state);\n Atomics.notify(this.control, STATE);\n }\n}\n\nfunction concat(parts: Uint8Array[]): Uint8Array {\n if (parts.length === 1) return parts[0];\n const total = parts.reduce((sum, part) => sum + part.length, 0);\n const joined = new Uint8Array(total);\n let at = 0;\n for (const part of parts) { joined.set(part, at); at += part.length; }\n return joined;\n}\n","/**\n * An Emscripten filesystem backed by the SandboxedJs kernel.\n *\n * The interpreter is compiled expecting a POSIX filesystem, and Emscripten\n * supplies one — in the guest's own memory. That is exactly the arrangement\n * this whole design exists to avoid: a second copy of the container's state,\n * private to one process, diverging from the moment anything writes.\n *\n * So the container's directories are mounted on a filesystem whose every\n * operation is a blocking call to the kernel over `sbx_host_v1`. There is one\n * authority for files, and the interpreter is not it.\n *\n * The shape below is Emscripten's `FS` backend contract, the same one NODEFS\n * implements. It has to be synchronous, which is precisely what the host ABI's\n * blocking transport provides.\n */\n\nimport { ERRNO_NAMES, Errno } from \"./host-abi.js\";\nimport { HostAbiError, type HostAbiClient } from \"./syscall-client.js\";\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nconst S_IFDIR = 0o040000;\nconst S_IFREG = 0o100000;\nconst S_IFLNK = 0o120000;\n\n/**\n * Build the filesystem backend for one process.\n *\n * `FS` is the interpreter module's own filesystem object, `errnoCodes` is that\n * build's `ERRNO_CODES` table, and `client` is the process's connection to the\n * kernel — one per process, never shared, so a file opened here belongs to a\n * descriptor table the kernel can clean up when the process goes.\n */\nexport function createSbxFs(FS: any, client: HostAbiClient, errnoCodes: Record<string, number>): any {\n /**\n * Translate a kernel errno into the number *this libc* uses.\n *\n * Not a formality. Emscripten's musl numbering is not Linux's: `ENOENT` is\n * 44 there and 2 here, and 2 is `EACCES`. Passing our number through\n * unchanged turns \"no such file\" into \"permission denied\" — which is exactly\n * how a perfectly good `open(path, \"w\")` came back as a PermissionError\n * carrying the errno of a different failure. The ABI's canonical values are\n * Linux's; every adapter translates at its own edge.\n */\n const translate = (canonical: number): number => {\n const name = ERRNO_NAMES[canonical];\n const mapped = name ? errnoCodes[name] : undefined;\n return mapped ?? errnoCodes.EIO ?? canonical;\n };\n\n const raise = (canonical: number): never => {\n throw new FS.ErrnoError(translate(canonical));\n };\n\n const fail = (error: unknown): never => {\n if (error instanceof HostAbiError) return raise(error.errno);\n return raise(Errno.EIO);\n };\n\n const SBXFS = {\n /** Where this mount sits in the guest's namespace, and where in the container. */\n mount(mount: any): any {\n return SBXFS.createNode(null, \"/\", S_IFDIR | 0o777, 0);\n },\n\n createNode(parent: any, name: string, mode: number, dev: number): any {\n if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) raise(Errno.EINVAL);\n const node = FS.createNode(parent, name, mode, dev);\n node.node_ops = SBXFS.node_ops;\n node.stream_ops = SBXFS.stream_ops;\n return node;\n },\n\n /** The container path a guest node stands for. */\n realPath(node: any): string {\n const parts: string[] = [];\n let current = node;\n while (current.parent !== current) {\n parts.push(current.name);\n current = current.parent;\n }\n parts.push(current.mount.opts.root);\n parts.reverse();\n return parts.join(\"/\").replace(/\\/+/g, \"/\");\n },\n\n node_ops: {\n getattr(node: any): any {\n const path = SBXFS.realPath(node);\n let stat;\n try {\n stat = client.stat(path, false);\n } catch (error) {\n return fail(error);\n }\n return {\n dev: 1,\n ino: stat.ino,\n mode: stat.mode,\n nlink: stat.nlink,\n uid: stat.uid,\n gid: stat.gid,\n rdev: 0,\n size: stat.size,\n atime: new Date(stat.atimeNs / 1e6),\n mtime: new Date(stat.mtimeNs / 1e6),\n ctime: new Date(stat.ctimeNs / 1e6),\n /* Emscripten sizes its own reads from this; a wrong block size shows\n * up as short reads on large files rather than as an error. */\n blksize: 4096,\n blocks: Math.ceil(stat.size / 4096),\n };\n },\n\n setattr(node: any, attr: any): void {\n const path = SBXFS.realPath(node);\n try {\n if (attr.size !== undefined) {\n const fd = client.open(path, 1 /* O_WRONLY */);\n try {\n client.ftruncate(fd, attr.size);\n } finally {\n client.close(fd);\n }\n }\n /* Mode and times are accepted and dropped for now: the volume has no\n * per-descriptor chmod through the ABI yet, and refusing here would\n * break `pip`, which sets a mode on everything it installs. */\n } catch (error) {\n fail(error);\n }\n },\n\n lookup(parent: any, name: string): any {\n const path = `${SBXFS.realPath(parent)}/${name}`.replace(/\\/+/g, \"/\");\n let stat;\n try {\n stat = client.stat(path, false);\n } catch (error) {\n /* A missing entry is not an error here — it is how `lookup` says\n * \"no\". Anything else is, and must not be flattened into ENOENT. */\n if (error instanceof HostAbiError && error.errno === Errno.ENOENT) raise(Errno.ENOENT);\n return fail(error);\n }\n const node = SBXFS.createNode(parent, name, stat.mode, 0);\n node.node_ops = SBXFS.node_ops;\n node.stream_ops = SBXFS.stream_ops;\n return node;\n },\n\n mknod(parent: any, name: string, mode: number, dev: number): any {\n const path = `${SBXFS.realPath(parent)}/${name}`.replace(/\\/+/g, \"/\");\n try {\n if ((mode & S_IFDIR) === S_IFDIR) client.mkdir(path, mode & 0o777);\n else {\n const fd = client.open(path, 0o1 | 0o100 /* O_WRONLY|O_CREAT */, mode & 0o777);\n client.close(fd);\n }\n } catch (error) {\n fail(error);\n }\n return SBXFS.createNode(parent, name, mode, dev);\n },\n\n rename(node: any, newParent: any, newName: string): void {\n const from = SBXFS.realPath(node);\n const to = `${SBXFS.realPath(newParent)}/${newName}`.replace(/\\/+/g, \"/\");\n try {\n client.rename(from, to);\n } catch (error) {\n fail(error);\n }\n /* Emscripten keeps its own name tree, so it has to be told too, or the\n * next lookup finds the file under the name it no longer has. */\n node.name = newName;\n node.parent = newParent;\n },\n\n unlink(parent: any, name: string): void {\n const path = `${SBXFS.realPath(parent)}/${name}`.replace(/\\/+/g, \"/\");\n try {\n client.unlink(path, false);\n } catch (error) {\n fail(error);\n }\n },\n\n rmdir(parent: any, name: string): void {\n const path = `${SBXFS.realPath(parent)}/${name}`.replace(/\\/+/g, \"/\");\n try {\n client.unlink(path, true);\n } catch (error) {\n fail(error);\n }\n },\n\n readdir(node: any): string[] {\n const path = SBXFS.realPath(node);\n try {\n const fd = client.open(path, 0 /* O_RDONLY */);\n try {\n const names: string[] = [];\n for (;;) {\n const batch = client.readdir(fd, 8192);\n if (batch.length === 0) break;\n names.push(...batch);\n }\n return names;\n } finally {\n client.close(fd);\n }\n } catch (error) {\n return fail(error);\n }\n },\n\n symlink(parent: any, name: string, target: string): void {\n const path = `${SBXFS.realPath(parent)}/${name}`.replace(/\\/+/g, \"/\");\n try {\n client.symlink(target, path);\n } catch (error) {\n fail(error);\n }\n },\n\n readlink(node: any): string {\n try {\n return client.readlink(SBXFS.realPath(node));\n } catch (error) {\n return fail(error);\n }\n },\n },\n\n stream_ops: {\n open(stream: any): void {\n const path = SBXFS.realPath(stream.node);\n if (FS.isDir(stream.node.mode)) return;\n try {\n /* The guest's flags are already POSIX numbers, and the kernel's ABI\n * uses the same ones — no translation, and none invented. */\n stream.sbxFd = client.open(path, stream.flags & ~0o2000000 /* drop O_CLOEXEC */);\n } catch (error) {\n fail(error);\n }\n },\n\n close(stream: any): void {\n if (stream.sbxFd === undefined) return;\n try {\n client.close(stream.sbxFd);\n } catch {\n /* A close that fails has still released the descriptor here; raising\n * would leak the guest's stream instead. */\n }\n stream.sbxFd = undefined;\n },\n\n read(stream: any, buffer: Uint8Array, offset: number, length: number, position: number): number {\n if (length === 0) return 0;\n try {\n const data = client.pread(stream.sbxFd, length, position);\n buffer.set(data, offset);\n return data.length;\n } catch (error) {\n return fail(error);\n }\n },\n\n write(stream: any, buffer: Uint8Array, offset: number, length: number, position: number): number {\n if (length === 0) return 0;\n try {\n return client.pwrite(stream.sbxFd, buffer.subarray(offset, offset + length), position);\n } catch (error) {\n return fail(error);\n }\n },\n\n llseek(stream: any, offset: number, whence: number): number {\n let position = offset;\n if (whence === 1) position += stream.position;\n else if (whence === 2 && FS.isFile(stream.node.mode)) {\n position += SBXFS.node_ops.getattr(stream.node).size;\n }\n if (position < 0) raise(Errno.EINVAL);\n return position;\n },\n },\n };\n\n return SBXFS;\n}\n","/**\n * Compression and hashing, resolved at runtime rather than at import time.\n *\n * On Node these delegate to `node:zlib` and `node:crypto`. In a browser they\n * fall back to `CompressionStream` and `crypto.subtle`, with a small MD5 in\n * JavaScript because Web Crypto does not offer it. Loading this module never\n * imports a `node:` builtin, so the package can be bundled for the browser;\n * the platform is only decided when a byte actually needs compressing.\n */\n\nexport type HashAlgorithm = \"md5\" | \"sha1\" | \"sha224\" | \"sha256\" | \"sha384\" | \"sha512\";\n\nconst isNode =\n typeof process !== \"undefined\" && process.versions != null && process.versions.node != null;\n\n/**\n * Import a Node builtin without a bundler noticing.\n *\n * The specifier is assembled at runtime so esbuild/Vite/webpack cannot analyse\n * it: a browser bundle then contains no reference to `zlib` or `crypto` to\n * resolve, while Node still loads them normally. (A literal `import(\"node:zlib\")`\n * gets rewritten to a bare `import(\"zlib\")` by esbuild's node platform, which a\n * browser bundler would then try — and fail — to resolve from node_modules.)\n */\nexport async function nodeBuiltin<T>(name: string): Promise<T> {\n const specifier = `node:${name}`;\n return (await import(/* @vite-ignore */ /* webpackIgnore: true */ specifier)) as T;\n}\n\n/**\n * Import a Node-only package the same way, and for the same reason.\n *\n * A dynamic `import()` of a *literal* specifier is still resolved and bundled\n * — it only becomes a separate chunk. So `import(\"esbuild-wasm\")`\n * still drags `node:worker_threads` into a browser build even though a browser\n * host never calls it. Assembling the specifier at runtime is what actually\n * keeps it out of the graph.\n */\nexport async function nodeOnlyModule<T>(specifier: string): Promise<T> {\n const parts = specifier.split(\"/\");\n const runtimeSpecifier = parts.join(\"/\");\n return (await import(/* @vite-ignore */ /* webpackIgnore: true */ runtimeSpecifier)) as T;\n}\n\n// ── zlib ────────────────────────────────────────────────────────────────────\n\ntype ZlibModule = typeof import(\"node:zlib\");\nlet zlibPromise: Promise<ZlibModule> | null = null;\n\nfunction nodeZlib(): Promise<ZlibModule> {\n zlibPromise ??= nodeBuiltin<ZlibModule>(\"zlib\");\n return zlibPromise;\n}\n\n/** Run bytes through a `CompressionStream`/`DecompressionStream`. */\nasync function throughStream(data: Uint8Array, stream: unknown): Promise<Uint8Array> {\n const source = new Blob([data as BlobPart]).stream();\n const piped = (source as unknown as { pipeThrough(s: unknown): ReadableStream }).pipeThrough(stream);\n return new Uint8Array(await new Response(piped).arrayBuffer());\n}\n\nexport async function gzip(data: Uint8Array): Promise<Uint8Array> {\n if (isNode) return new Uint8Array((await nodeZlib()).gzipSync(data));\n return throughStream(data, new CompressionStream(\"gzip\"));\n}\n\nexport async function gunzip(data: Uint8Array): Promise<Uint8Array> {\n if (isNode) return new Uint8Array((await nodeZlib()).gunzipSync(data));\n return throughStream(data, new DecompressionStream(\"gzip\"));\n}\n\nexport async function deflate(data: Uint8Array): Promise<Uint8Array> {\n if (isNode) return new Uint8Array((await nodeZlib()).deflateSync(data));\n return throughStream(data, new CompressionStream(\"deflate\"));\n}\n\nexport async function inflate(data: Uint8Array): Promise<Uint8Array> {\n if (isNode) return new Uint8Array((await nodeZlib()).inflateSync(data));\n return throughStream(data, new DecompressionStream(\"deflate\"));\n}\n\n/** Raw deflate, with no zlib header — what zip entries use. */\nexport async function inflateRaw(data: Uint8Array): Promise<Uint8Array> {\n if (isNode) return new Uint8Array((await nodeZlib()).inflateRawSync(data));\n return throughStream(data, new DecompressionStream(\"deflate-raw\"));\n}\n\n// ── hashing ─────────────────────────────────────────────────────────────────\n\ntype CryptoModule = typeof import(\"node:crypto\");\nlet cryptoPromise: Promise<CryptoModule> | null = null;\n\nfunction nodeCrypto(): Promise<CryptoModule> {\n cryptoPromise ??= nodeBuiltin<CryptoModule>(\"crypto\");\n return cryptoPromise;\n}\n\nconst SUBTLE_NAMES: Partial<Record<HashAlgorithm, string>> = {\n sha1: \"SHA-1\",\n sha256: \"SHA-256\",\n sha384: \"SHA-384\",\n sha512: \"SHA-512\",\n};\n\nexport class UnsupportedAlgorithmError extends Error {\n constructor(algorithm: string) {\n super(`${algorithm} is not available in this environment`);\n this.name = \"UnsupportedAlgorithmError\";\n }\n}\n\n/** Hex digest of `data`. */\nexport async function digestHex(algorithm: HashAlgorithm, data: Uint8Array): Promise<string> {\n if (isNode) {\n const { createHash } = await nodeCrypto();\n return createHash(algorithm).update(data).digest(\"hex\");\n }\n if (algorithm === \"md5\") return md5Hex(data);\n const name = SUBTLE_NAMES[algorithm];\n if (!name) throw new UnsupportedAlgorithmError(algorithm);\n const buffer = await crypto.subtle.digest(name, data as BufferSource);\n return toHex(new Uint8Array(buffer));\n}\n\nexport async function randomUuid(): Promise<string> {\n if (typeof crypto !== \"undefined\" && typeof crypto.randomUUID === \"function\") return crypto.randomUUID();\n const { randomUUID } = await nodeCrypto();\n return randomUUID();\n}\n\nfunction toHex(bytes: Uint8Array): string {\n let out = \"\";\n for (const byte of bytes) out += byte.toString(16).padStart(2, \"0\");\n return out;\n}\n\n// ── MD5 ─────────────────────────────────────────────────────────────────────\n\n/**\n * RFC 1321 MD5. Only reached in browsers, where Web Crypto deliberately omits\n * it; Node uses its own implementation above. Exported so the test suite can\n * exercise the browser path while running on Node.\n */\nexport function md5Hex(input: Uint8Array): string {\n const S = [\n 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,\n 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,\n 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,\n 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21,\n ];\n const K = new Uint32Array(64);\n for (let i = 0; i < 64; i++) K[i] = Math.floor(Math.abs(Math.sin(i + 1)) * 2 ** 32);\n\n const bitLength = input.length * 8;\n const padded = new Uint8Array((((input.length + 8) >> 6) + 1) * 64);\n padded.set(input);\n padded[input.length] = 0x80;\n const view = new DataView(padded.buffer);\n view.setUint32(padded.length - 8, bitLength >>> 0, true);\n view.setUint32(padded.length - 4, Math.floor(bitLength / 2 ** 32), true);\n\n let a0 = 0x67452301;\n let b0 = 0xefcdab89;\n let c0 = 0x98badcfe;\n let d0 = 0x10325476;\n\n for (let chunk = 0; chunk < padded.length; chunk += 64) {\n const M = new Uint32Array(16);\n for (let i = 0; i < 16; i++) M[i] = view.getUint32(chunk + i * 4, true);\n\n let [a, b, c, d] = [a0, b0, c0, d0];\n for (let i = 0; i < 64; i++) {\n let f: number;\n let g: number;\n if (i < 16) {\n f = (b & c) | (~b & d);\n g = i;\n } else if (i < 32) {\n f = (d & b) | (~d & c);\n g = (5 * i + 1) % 16;\n } else if (i < 48) {\n f = b ^ c ^ d;\n g = (3 * i + 5) % 16;\n } else {\n f = c ^ (b | ~d);\n g = (7 * i) % 16;\n }\n const tmp = d;\n d = c;\n c = b;\n const sum = (a + f + K[i]! + M[g]!) >>> 0;\n b = (b + ((sum << S[i]!) | (sum >>> (32 - S[i]!)))) >>> 0;\n a = tmp;\n }\n a0 = (a0 + a) >>> 0;\n b0 = (b0 + b) >>> 0;\n c0 = (c0 + c) >>> 0;\n d0 = (d0 + d) >>> 0;\n }\n\n const out = new Uint8Array(16);\n new DataView(out.buffer).setUint32(0, a0, true);\n new DataView(out.buffer).setUint32(4, b0, true);\n new DataView(out.buffer).setUint32(8, c0, true);\n new DataView(out.buffer).setUint32(12, d0, true);\n return toHex(out);\n}\n","/**\n * One Python process, in its own worker.\n *\n * This is the rule the old integration could not keep: **one active Python\n * process owns one interpreter instance.** A worker starts, instantiates the\n * interpreter from the release artifact, runs one command line, and exits.\n * Nothing survives it — not `sys.modules`, not logging handlers, not a native\n * extension's static state — because there is nothing for it to survive in.\n *\n * Everything the interpreter would ask an operating system for goes to the\n * kernel over `sbx_host_v1`, synchronously, while this worker blocks. The\n * kernel is on another thread and stays awake, which is what makes a blocking\n * `read()` of a terminal nobody has typed into possible at all.\n */\n\nimport { HostAbiClient } from \"./syscall-client.js\";\nimport { HostCallClient, type HostTransportBuffers } from \"./sync-transport.js\";\nimport { createSbxFs } from \"./sbxfs.js\";\nimport { ERRNO_NAMES } from \"./host-abi.js\";\nimport { nodeBuiltin } from \"../util/binary.js\";\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport interface PythonWorkerStart {\n buffers: HostTransportBuffers;\n generation: number;\n moduleUrl: string;\n argv: string[];\n env: Record<string, string>;\n cwd: string;\n /** The identity the kernel gave this process; libc's own is a constant. */\n pid: number;\n ppid: number;\n /** Container directories to mount, and where. */\n mounts: { guest: string; container: string }[];\n /** True when stdout is a terminal, which Python checks before buffering. */\n isTty: boolean;\n /**\n * Descriptor numbers this process inherited, beyond the standard three.\n *\n * A child is *told* which number each inherited descriptor has — on its\n * command line, in `multiprocessing`'s case — so the numbers are not this\n * side's to choose. Each is installed at exactly the number the kernel put\n * it at, which is the number the parent named.\n */\n inheritFds?: number[];\n}\n\nexport interface PythonWorkerPort {\n postMessage(message: unknown): void;\n}\n\n/**\n * Directories the interpreter owns and the container must not cover.\n *\n * The standard library lives inside the module's own data image. Mounting the\n * container over it would replace Python with whatever the container happens\n * to have at that path — usually nothing.\n */\nconst INTERPRETER_OWNED = new Set([\"/lib\", \"/dev\", \"/proc\", \"/usr/local\"]);\n\nexport async function runPythonProcess(start: PythonWorkerStart, port: PythonWorkerPort): Promise<void> {\n const transport = new HostCallClient(start.buffers, () => port.postMessage({ type: \"wake\" }));\n\n /* The guest may not assert its own identity: the transport belongs to one\n * process, and the kernel stamps the generation it was created with. */\n const stampedCall = (request: Uint8Array): Uint8Array => {\n const stamped = request.slice();\n new DataView(stamped.buffer).setUint32(8, start.generation, true);\n return transport.call(stamped);\n };\n const client = new HostAbiClient(\n { call: stampedCall } as unknown as HostCallClient,\n start.generation,\n );\n\n const factory = (await import(/* @vite-ignore */ start.moduleUrl)).default;\n\n let exitCode = 0;\n\n /* The guest's linear memory, captured at instantiation.\n *\n * `_sbx_socket` is the one native module that reaches the host through the\n * raw Wasm `sbx_host_call` import rather than the JS filesystem bridge, so\n * this shim has to copy request and response bytes in and out of that\n * memory itself. The Emscripten loader does not put `HEAPU8` on the Module\n * object unless it is in `EXPORTED_RUNTIME_METHODS`, and this build's list\n * deliberately does not carry it — so the shim reads the buffer straight\n * from the imported `WebAssembly.Memory` instead, re-viewing it on every\n * call because memory growth detaches the old `ArrayBuffer`. */\n let guestMemory: WebAssembly.Memory | undefined;\n const guestHeap = (): Uint8Array | undefined => {\n const exported = config.HEAPU8 as Uint8Array | undefined;\n if (exported && exported.byteLength > 0) return exported;\n return guestMemory ? new Uint8Array(guestMemory.buffer) : undefined;\n };\n\n /**\n * Rewrite a failed response's errno into the number *this libc* uses.\n *\n * The ABI's errno values are Linux's; Emscripten's musl numbering is not.\n * `sbxfs.ts` translates at its own edge, and this is the other edge: native\n * modules that call `sbx_host_call` directly take the status straight into\n * `errno`, so an untranslated value does not merely mislabel the failure, it\n * *changes which failure it is*. `EAGAIN` (11 here) is `ECANCELED` there, so\n * \"this socket would block\" reached asyncio as a fatal error instead of the\n * BlockingIOError its accept and recv loops are built to expect — a server\n * that had already produced a correct response then hung, because the\n * event loop treated a routine retry as a broken connection.\n */\n const translateResponseErrno = (response: Uint8Array): void => {\n const view = new DataView(response.buffer, response.byteOffset, response.byteLength);\n const status = view.getInt32(12, true);\n if (status >= 0) return;\n const codes = (config.ERRNO_CODES ?? {}) as Record<string, number>;\n const name = ERRNO_NAMES[-status];\n const mapped = name ? codes[name] : undefined;\n view.setInt32(12, -(mapped ?? codes.EIO ?? -status), true);\n };\n\n /* Emscripten uses the object it is given *as* the module, so this one gains\n * `FS` and `ENV` before `preRun` fires. Reaching for them through `this`\n * instead depends on how the callback happens to be invoked, which has\n * changed between Emscripten releases and fails as \"cannot read FS of\n * undefined\" — a long way from the cause. */\n const config: any = {\n /* Emscripten resolves `python.wasm` and `python.data` beside its loader;\n * saying so explicitly survives a host that serves the loader from a\n * different path than it was built at.\n *\n * Under Node the loader reads them with `fs`, which wants a path and not a\n * `file://` URL — and reports the difference as a bare ENOENT naming the\n * URL, which reads like a missing file rather than a wrong kind of name. */\n locateFile: (file: string) => {\n const resolved = new URL(file, start.moduleUrl);\n if (resolved.protocol !== \"file:\") {\n const release = new URL(start.moduleUrl).searchParams.get(\"sbx-runtime\");\n if (release) resolved.searchParams.set(\"sbx-runtime\", release);\n return resolved.href;\n }\n return decodeURIComponent(resolved.pathname);\n },\n arguments: start.argv,\n /* Read by the `--wrap`ped `getpid`/`getppid` in library_sbx_posix.js. */\n sbxPid: start.pid,\n sbxPpid: start.ppid,\n /* Native CPython modules call the same ABI import as the filesystem\n * bridge. Stamp the process generation here so C callers cannot forge it.\n *\n * The JS library normally lowers this to `Module.sbxHostCall`; dynamic\n * Emscripten links may retain `env.sbx_host_call` as a direct Wasm import,\n * though. Supplying the exact import name keeps both link shapes working.\n */\n sbxHostCall: (request: Uint8Array) => stampedCall(request),\n sbx_host_call: (requestPtr: number, requestLength: number, responsePtr: number, responseCapacity: number) => {\n const heap = guestHeap();\n if (!heap) return -5; // EIO: the runtime called before memory was ready.\n try {\n const response = stampedCall(heap.slice(requestPtr, requestPtr + requestLength));\n if (response.length < 20 || response.length > responseCapacity) return -34; // ERANGE\n translateResponseErrno(response);\n guestHeap()!.set(response, responsePtr);\n return response.length;\n } catch (error) {\n config.sbxHostFault = error;\n return -5; // EIO\n }\n },\n /* `_sbx_socket` is a native module and therefore retains the ABI call as\n * an `env` import in dynamic builds. Emscripten's generated loader does\n * not copy arbitrary Module properties into that import object, so bind it\n * at the one supported extension point before instantiation. */\n instantiateWasm: (imports: { env: Record<string, unknown> }, receiveInstance: (instance: WebAssembly.Instance, module: WebAssembly.Module) => void) => {\n imports.env.sbx_host_call = config.sbx_host_call;\n if (imports.env.memory instanceof WebAssembly.Memory) guestMemory = imports.env.memory;\n void (async () => {\n try {\n const url = config.locateFile(\"python.wasm\");\n let bytes: Uint8Array;\n if (String(url).startsWith(\"file:\" ) || String(url).startsWith(\"/\")) {\n const [{ readFile }, { fileURLToPath }] = await Promise.all([\n nodeBuiltin<typeof import(\"node:fs/promises\")>(\"fs/promises\"),\n nodeBuiltin<typeof import(\"node:url\")>(\"url\"),\n ]);\n bytes = new Uint8Array(await readFile(String(url).startsWith(\"file:\") ? fileURLToPath(url) : url));\n } else {\n bytes = new Uint8Array(await (await fetch(url)).arrayBuffer());\n }\n const result = await WebAssembly.instantiate(\n bytes as BufferSource,\n imports as WebAssembly.Imports,\n ) as WebAssembly.WebAssemblyInstantiatedSource;\n if (!guestMemory && result.instance.exports.memory instanceof WebAssembly.Memory) {\n guestMemory = result.instance.exports.memory;\n }\n receiveInstance(result.instance, result.module);\n } catch (error) {\n config.onAbort?.(error);\n throw error;\n }\n })();\n return {};\n },\n quit: (status: number) => {\n exitCode = status;\n },\n };\n\n config.preRun = [\n () => {\n mountContainer(config.FS, client, start.mounts, config.ERRNO_CODES ?? {});\n bindStdio(config.FS, client, start.isTty);\n for (const [key, value] of Object.entries(start.env)) config.ENV[key] = value;\n try {\n config.FS.chdir(start.cwd);\n } catch {\n /* A cwd the container does not have is the caller's problem to report,\n * not a reason to fail before `main` runs. */\n }\n },\n ];\n\n const module = await factory(config);\n\n /* After the module exists, because the descriptor bridge is part of it — and\n * before `main`, because the program's first act may be to read one. */\n for (const fd of start.inheritFds ?? []) {\n const register = (module as { sbxRegisterFd?: (hostFd: number, atFd: number) => number }).sbxRegisterFd;\n if (typeof register !== \"function\") {\n port.postMessage({ type: \"failed\", message: \"this Python build cannot receive inherited descriptors\" });\n return;\n }\n register(fd, fd);\n }\n\n try {\n exitCode = module.callMain(start.argv) ?? exitCode;\n } catch (error) {\n const status = (error as { status?: number }).status;\n if (typeof status === \"number\") exitCode = status;\n else {\n port.postMessage({ type: \"failed\", message: String((error as Error)?.message ?? error) });\n return;\n }\n }\n port.postMessage({ type: \"exit\", code: exitCode });\n}\n\n/** Put the container's directories where a program expects to find them. */\nfunction mountContainer(\n FS: any,\n client: HostAbiClient,\n mounts: { guest: string; container: string }[],\n errnoCodes: Record<string, number>,\n): void {\n const SBXFS = createSbxFs(FS, client, errnoCodes);\n for (const mount of mounts) {\n if (INTERPRETER_OWNED.has(mount.guest)) continue;\n try {\n FS.mkdirTree(mount.guest);\n } catch {\n /* Already there. */\n }\n FS.mount(SBXFS, { root: mount.container }, mount.guest);\n }\n}\n\n/**\n * Wire the process's standard streams to the kernel's.\n *\n * Byte by byte, and never decoded: the terminal boundary is where a multi-byte\n * character gets cut in half, and a stream that decodes here turns that into a\n * replacement character the program can never recover.\n *\n * Whether these are *terminals* is the part that decides how the interpreter\n * behaves, not just how it looks. Handing Emscripten byte callbacks through\n * `FS.init(input, output, error)` makes plain character devices, so `isatty`\n * is false — and CPython with a non-terminal stdin does not start a REPL, it\n * reads stdin as a script file. `python` at an interactive prompt then sits\n * there forever with no banner, having decided it was given a program.\n *\n * So a terminal gets real TTY streams — `FS.init(null, null, null)` symlinks\n * `/dev/stdin` to `/dev/tty` — with this process's ops swapped in afterwards.\n * A pipe gets the character devices, which is what a pipe should be.\n */\nfunction bindStdio(FS: any, client: HostAbiClient, isTty: boolean): void {\n /** One byte from the kernel, or null at end of input. Blocks in between. */\n const readByte = (): number | null => {\n const data = client.read(0, 1);\n return data.length === 0 ? null : data[0]!;\n };\n\n if (!isTty) {\n FS.init(readByte, writeThrough(client, 1), writeThrough(client, 2));\n return;\n }\n\n FS.init(null, null, null);\n\n /* The stream's own ops are replaced rather than the TTY's.\n *\n * Emscripten's TTY writes a byte at a time and flushes on a newline, because\n * its sink is a `console.log`-shaped line printer. A prompt has no newline —\n * `>>> ` would sit in that buffer forever, and `fflush` does not reach it,\n * because C's `fflush` issues a `write`, not an `fsync`. Handling the whole\n * `write` here means one kernel write per guest write, which is both correct\n * and what a terminal actually looks like.\n *\n * `stream.tty` is left in place, so `isatty` still says yes.\n */\n for (const [fd, sink] of [[1, 1], [2, 2]] as [number, number][]) {\n const stream = FS.getStream(fd);\n if (!stream) continue;\n stream.stream_ops = {\n ...stream.stream_ops,\n write(_stream: any, buffer: Uint8Array, offset: number, length: number): number {\n if (length > 0) client.writeAll(sink, buffer.subarray(offset, offset + length));\n return length;\n },\n fsync(): number {\n return 0;\n },\n };\n }\n\n const stdin = FS.getStream(0);\n if (stdin) {\n stdin.stream_ops = {\n ...stdin.stream_ops,\n read(_stream: any, buffer: Uint8Array, offset: number, length: number): number {\n /* Blocks in the kernel until a key is pressed. Returning zero here\n * means end of input, so it must never be how \"nothing yet\" is\n * reported. */\n const data = client.read(0, length);\n buffer.set(data, offset);\n return data.length;\n },\n };\n }\n}\n\n/** A line-buffered writer for a non-terminal stream. */\nfunction writeThrough(client: HostAbiClient, fd: number): (charCode: number | null) => void {\n let pending: number[] = [];\n return (charCode) => {\n if (charCode === null) {\n if (pending.length > 0) {\n client.writeAll(fd, new Uint8Array(pending));\n pending = [];\n }\n return;\n }\n pending.push(charCode);\n /* Flush on a newline so output appears when it was written, and on size so\n * a long line is not held indefinitely. */\n if (charCode === 10 || pending.length >= 4096) {\n client.writeAll(fd, new Uint8Array(pending));\n pending = [];\n }\n };\n}\n","/**\n * The process worker's entry point.\n *\n * Built as its own bundle: a worker is fetched as its own module graph, so\n * anything left unresolved here has to resolve from wherever the loader\n * happens to be — the trap HANDOFF.md records for the guest worker.\n *\n * It waits for its buffers rather than reading them from `workerData`, so the\n * same file serves a browser `Worker` and a Node `worker_threads` one.\n */\n\nimport { runPythonProcess, type PythonWorkerStart } from \"./worker-entry.js\";\n\ninterface Port {\n postMessage(message: unknown): void;\n}\n\nasync function connect(): Promise<{ port: Port; onStart: (handler: (start: PythonWorkerStart) => void) => void }> {\n /* A browser worker posts and listens on its own global scope; Node's worker\n * has neither and reaches its parent through `worker_threads`. Feature\n * detection rather than a build flag, so one bundle serves both. */\n const scope = globalThis as unknown as {\n postMessage?: (message: unknown) => void;\n addEventListener?: (type: string, handler: (event: MessageEvent) => void) => void;\n };\n\n if (typeof scope.postMessage === \"function\" && typeof scope.addEventListener === \"function\") {\n const post = scope.postMessage.bind(globalThis);\n const listen = scope.addEventListener.bind(globalThis);\n return {\n port: { postMessage: post },\n onStart: (handler) =>\n listen(\"message\", (event: MessageEvent) => {\n const data = event.data as PythonWorkerStart & { type?: string };\n if (data?.type === \"start\") handler(data);\n }),\n };\n }\n\n const specifier = [\"node\", \"worker_threads\"].join(\":\");\n const { parentPort } = (await import(/* @vite-ignore */ /* webpackIgnore: true */ specifier)) as {\n parentPort: { postMessage(value: unknown): void; on(event: string, listener: (value: unknown) => void): void };\n };\n return {\n port: parentPort,\n onStart: (handler) =>\n parentPort.on(\"message\", (message) => {\n const data = message as PythonWorkerStart & { type?: string };\n if (data?.type === \"start\") handler(data);\n }),\n };\n}\n\nvoid connect().then(({ port, onStart }) => {\n onStart((start) => {\n void runPythonProcess(start, port).catch((error: Error) =>\n port.postMessage({ type: \"failed\", message: String(error?.message ?? error) }),\n );\n });\n /* The supervisor waits for this before sending the start message, so that a\n * worker whose script failed to load is reported rather than hung. */\n port.postMessage({ type: \"sandboxedjs:ready\" });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tools/rolldown-wasi-worker.ts"],"names":["require"],"mappings":";;;;;AAiCA,IAAM,OAAA,GAAW,cAAc,EAAC;AAChC,IAAMA,QAAAA,GAAU,aAAA,CAAc,OAAA,CAAQ,aAAA,IAAiB,YAAY,GAAG,CAAA;AAMtE,IAAM;AAAA,EACJ,yBAAA;AAAA,EACA,cAAA;AAAA,EACA,IAAA;AAAA,EACA,aAAA;AAAA,EACA,qBAAA;AAAA,EACA;AACF,CAAA,GAAI,MAAM;AAAA;AAAA;AAAA,EAAoD,OAAA,CAAQ;AAAA,CAAA;AAItE,IAAM,EAAE,aAAA,EAAc,GAAI,MAAM;AAAA;AAAA;AAAA,EAAoD,OAAA,CAAQ;AAAA,CAAA;AAU5F,MAAA,CAAO,OAAO,UAAA,EAAY;AAAA,EACxB,IAAA,EAAM,UAAA;AAAA,EACN,OAAA,EAAAA,QAAAA;AAAA,EACA,MAAA;AAAA,EACA,cAAc,IAAA,EAAc;AAC1B,IAAA,IAAI,MAAM,CAAA,EAAG,YAAA,CAAa,MAAM,MAAM,CAAC,CAAA,cAAA,EAAiB,IAAI,CAAA,CAAE,CAAA;AAAA,EAChE,CAAA;AAAA,EACA,YAAY,OAAA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EACA,QAAQ,KAAA,EAAgB;AACtB,IAAC,UAAA,CAAmB,WAAA,CAAY,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAO,YAAA,EAAc,CAAC,GAAG,YAAY,CAAA,EAAG,CAAA;AACzF,IAAA,YAAA,CAAa,MAAA,GAAS,CAAA;AAAA,EACxB;AACF,CAAC,CAAA;AAEA,UAAA,CAAmB,SAAA,GAAY,CAAC,KAAA,KAAmB,OAAA,CAAQ,OAAO,KAAK,CAAA","file":"rolldown-wasi-worker.js","sourcesContent":["/**\n * A Rolldown WASI worker thread whose filesystem is the container's.\n *\n * Rolldown's npm package ships two of these. The browser one builds its\n * filesystem from an in-memory volume proxied back to the main thread; the\n * Node one calls `node:wasi` with `preopens: { \"/\": \"/\" }` and reads the real\n * disk. Neither is usable as-is here: the browser file wants browser worker\n * globals, and the Node file wants the host's filesystem — which is precisely\n * the thing a container must not hand to the code running inside it.\n *\n * So this is the crossing of the two: Node's worker plumbing around the\n * browser's filesystem. Every path Rolldown opens on this thread is forwarded\n * to the main thread and served out of the memory volume the container mirrors\n * itself into, so the bundler and the rest of the container see one filesystem.\n *\n * Bundled as its own entry point, because a worker is fetched as its own\n * module graph rather than through the main bundle.\n */\n\nimport { createRequire } from \"node:module\";\nimport { readFileSync } from \"node:fs\";\nimport { parentPort, workerData, Worker } from \"node:worker_threads\";\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Resolved against the binding's own location, not this file's.\n *\n * `@napi-rs/wasm-runtime` arrives as a dependency of the Rolldown binding,\n * which an installer is free to place anywhere — nested, hoisted, in a store\n * behind a symlink. Anchoring the lookup to the package that actually depends\n * on it is what keeps this working under npm, pnpm and Yarn alike.\n */\nconst options = (workerData ?? {}) as { runtimeAnchor?: string; runtimeModuleUrl?: string; fsModuleUrl?: string };\nconst require = createRequire(options.runtimeAnchor ?? import.meta.url);\n\n/* Imported from the URL the main thread resolved, for the reason the main\n * thread imports it: `require` of the runtime reaches emnapi 2's ES module,\n * which a Node without require(esm) refuses. The same URL also keeps both\n * threads on one copy of the runtime. */\nconst {\n instantiateNapiModuleSync,\n MessageHandler,\n WASI,\n createFsProxy,\n emnapiAsyncWorkPlugin,\n emnapiTSFNPlugin,\n} = await import(/* @vite-ignore */ /* webpackIgnore: true */ options.runtimeModuleUrl!);\n/* Passed in as a resolved URL: the runtime publishes `./fs` to `import` only,\n * so it cannot be required, and resolving it from here would assume the\n * installer hoisted the package next to this worker. */\nconst { memfsExported } = await import(/* @vite-ignore */ /* webpackIgnore: true */ options.fsModuleUrl!);\n\n/**\n * The browser worker globals `MessageHandler` is written against.\n *\n * emnapi decides how to talk to a thread from the environment it finds, and\n * the handler itself is written for a browser worker: it is handed events and\n * replies with a bare `postMessage`. Node's port is bridged onto those names\n * rather than the handler being rewritten.\n */\nObject.assign(globalThis, {\n self: globalThis,\n require,\n Worker,\n importScripts(file: string) {\n (0, eval)(`${readFileSync(file, \"utf8\")}//# sourceURL=${file}`);\n },\n postMessage(message: unknown) {\n parentPort?.postMessage(message);\n },\n});\n\nif (parentPort) {\n parentPort.on(\"message\", (data) => {\n (globalThis as any).onmessage?.({ data });\n });\n}\n\nconst errorOutputs: unknown[][] = [];\n\nconst handler = new MessageHandler({\n onLoad({ wasmModule, wasmMemory }: { wasmModule: WebAssembly.Module; wasmMemory: WebAssembly.Memory }) {\n const wasi = new WASI({\n /* The proxy is the whole point: every syscall goes to the main thread,\n * which answers from the volume the container keeps in step. */\n fs: createFsProxy(memfsExported),\n preopens: { \"/\": \"/\" },\n print: (...args: unknown[]) => console.log(...args),\n printErr: (...args: unknown[]) => {\n console.error(...args);\n errorOutputs.push(args);\n },\n });\n\n return instantiateNapiModuleSync(wasmModule, {\n childThread: true,\n wasi,\n /* The wasm links a \"basic\" emnapi archive with no C implementations of\n * async work or threadsafe functions, so every thread has to bring the\n * JavaScript ones. */\n plugins: [emnapiAsyncWorkPlugin, emnapiTSFNPlugin],\n overwriteImports(importObject: any) {\n importObject.env = {\n ...importObject.env,\n ...importObject.napi,\n ...importObject.emnapi,\n memory: wasmMemory,\n };\n },\n });\n },\n onError(error: unknown) {\n (globalThis as any).postMessage({ type: \"error\", error, errorOutputs: [...errorOutputs] });\n errorOutputs.length = 0;\n },\n});\n\n(globalThis as any).onmessage = (event: unknown) => handler.handle(event);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/preview/ws-client.ts","../src/preview/router.ts","../src/preview/service-worker.ts"],"names":["host","event","options"],"mappings":";AAgDO,SAAS,sBAAsB,KAAA,EAAkB;AACtD,EAAA,MAAM,SAAS,KAAA,CAAM,SAAA;AACrB,EAAA,MAAM,WAAW,KAAA,CAAM,QAAA;AAGvB,EAAA,IAAI,CAAC,KAAA,CAAM,MAAA,IAAU,KAAA,CAAM,WAAW,KAAA,EAAO;AAC7C,EAAA,MAAMA,QAAO,KAAA,CAAM,MAAA;AAGnB,EAAA,MAAM,KAAA,GAAQ,gCAAA,CAAiC,IAAA,CAAK,QAAA,CAAS,QAAQ,CAAA;AACrE,EAAA,MAAM,cAAc,KAAA,GAAQ,MAAA,CAAO,KAAA,CAAM,CAAC,CAAC,CAAA,GAAI,IAAA;AAE/C,EAAA,MAAM,QAAA,GAAW,2DAAA;AAWjB,EAAA,SAAS,OAAO,GAAA,EAAoD;AAClE,IAAA,IAAI,GAAA;AACJ,IAAA,IAAI;AACF,MAAA,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,GAAG,CAAA,EAAG,SAAS,IAAI,CAAA;AAAA,IAC1C,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,IAAI,IAAI,QAAA,KAAa,KAAA,IAAS,GAAA,CAAI,QAAA,KAAa,QAAQ,OAAO,IAAA;AAE9D,IAAA,MAAM,WAAW,GAAA,CAAI,IAAA,GAAO,MAAA,CAAO,GAAA,CAAI,IAAI,CAAA,GAAI,IAAA;AAC/C,IAAA,MAAM,UAAA,GAAa,GAAA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AA,CAAM,UAAU,OAAO,CAAA;AAC9D,IAAA,KAAA,CAAM,WAAA,CAAY,MAAA,CAAO,KAAA,CAAM,OAAA,EAAS,GAAA,EAAK,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,iBAAA,IAAqB,KAAA,CAAM,QAAQ,CAAC,CAAA;AACtG,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,QAAQ,CAAA;AAC1C,EAAA,IAAI,SAAS,MAAA,EAAW;AAIxB,EAAA,KAAA,CAAM,WAAA;AAAA,IACJ,MAAA,CAAO,KAAA,CAAM,IAAA,EAAM,MAAA,CAAO,aAAA,CAAc,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,MAAM,CAAA,EAAG,KAAA,CAAM,OAAA,EAAS,MAAM,QAAQ;AAAA,GAClG;AACF,CAAC,CAAA","file":"service-worker.js","sourcesContent":["/**\n * The WebSocket a page inside a preview actually gets.\n *\n * A service worker can answer `fetch`. It cannot answer a WebSocket handshake\n * — that was proposed and never shipped, in any browser — so the one mechanism\n * that gives a preview its URLs is structurally unable to carry the one\n * protocol a dev server needs. `new WebSocket(...)` inside the frame leaves the\n * sandbox entirely and tries the real origin, where nothing is listening.\n *\n * For a static site that costs nothing. For Vite it costs the HMR channel, and\n * with it the `full-reload` message Vite sends after re-optimizing its\n * dependencies — which is the *only* way it can tell a page that the hashes it\n * is holding are stale. Without it every `?v=` URL answers `504 Outdated\n * Optimize Dep` forever and the app never mounts, while the terminal shows a\n * dev server that started perfectly.\n *\n * So the constructor is replaced instead. {@link previewSocketSource} renders\n * this to JavaScript that the router injects into HTML it serves, where it\n * swaps in a `WebSocket` that tunnels to the host page over `postMessage`\n * rather than out to the network. URLs that do not name the container keep the\n * native implementation.\n *\n * ## Why this speaks the real protocol\n *\n * It would be less code to tunnel messages — `send(x)` on one side, `onmessage`\n * on the other — and let the container hand Vite something WebSocket-shaped.\n * That would work for Vite and nothing else, because Vite does not implement\n * WebSocket: `ws` does, and so do `socket.io` and every other server a user\n * might run. Framing the bytes here means the container emits a genuine\n * `upgrade` with a genuine socket, and those libraries run unmodified over it.\n * The sandbox gains WebSocket support, not a Vite compatibility shim.\n */\n\n/** The message names shared by the injected shim and {@link createPreview}. */\nexport const WS_OPEN = \"sandboxedjs:ws-open\";\nexport const WS_DATA = \"sandboxedjs:ws-data\";\nexport const WS_CLOSE = \"sandboxedjs:ws-close\";\nexport const WS_ERROR = \"sandboxedjs:ws-error\";\n\n/**\n * Install the tunnelling `WebSocket` on `scope`.\n *\n * Written as one self-contained function on purpose: {@link previewSocketSource}\n * serialises it with `String()`, so it may not close over anything in this\n * module. Everything it needs is either passed in or a page global. Keeping it\n * a real function rather than a template literal is what lets it be\n * type-checked and, more usefully, driven directly from a test.\n */\nexport function installPreviewSockets(scope: any): void {\n const Native = scope.WebSocket;\n const location = scope.location;\n /* No parent means this is not framed, so there is no host to tunnel to and\n * the native implementation is the best available answer. */\n if (!scope.parent || scope.parent === scope) return;\n const host = scope.parent;\n\n /** The port this document is previewing, from the path it was claimed at. */\n const claim = /(?:^|\\/)__sbx__\\/(\\d+)(?:\\/|$)/.exec(location.pathname);\n const claimedPort = claim ? Number(claim[1]) : null;\n\n const LOOPBACK = /^(?:localhost|127(?:\\.\\d{1,3}){3}|0\\.0\\.0\\.0|\\[?::1\\]?)$/i;\n\n /**\n * The container port and path a URL names, or null to leave it to the\n * network.\n *\n * Two forms arrive here. A dev server's client usually builds its URL from\n * `location`, so it points at this origin and means \"the port I am already\n * previewing\". A program with a hardcoded address says `localhost:3000` and\n * means that port. Anything else is a real remote host and is not ours.\n */\n function target(raw: string): { port: number; path: string } | null {\n let url: any;\n try {\n url = new URL(String(raw), location.href);\n } catch {\n return null;\n }\n if (url.protocol !== \"ws:\" && url.protocol !== \"wss:\") return null;\n\n const explicit = url.port ? Number(url.port) : null;\n const sameOrigin = url.hostname === location.hostname;\n let port: number | null = null;\n if (LOOPBACK.test(url.hostname) && explicit) port = explicit;\n else if (sameOrigin) port = claimedPort;\n if (port === null) return null;\n\n /* A document served under `/…/__sbx__/5173/` resolves a relative socket\n * URL against that prefix, which the container has never heard of. */\n const match = /(?:^|\\/)__sbx__\\/\\d+(?:\\/|$)/.exec(url.pathname);\n const rest = match ? url.pathname.slice(match.index + match[0].length) : url.pathname;\n const path = (rest.startsWith(\"/\") ? rest : \"/\" + rest) + url.search;\n return { port, path };\n }\n\n /** How long to wait for the host page before reporting it absent. */\n const OPEN_TIMEOUT_MS = 10_000;\n\n /*\n * Reload when the worker says the server has invalidated what this page\n * holds.\n *\n * This is the job Vite's own client does when it is told to over HMR, and\n * the reason it is duplicated here is that Vite's message is routinely lost:\n * it is sent the instant the optimizer finishes, and the HMR socket in a\n * preview has an iframe, a `postMessage`, the host page and a container to\n * cross before it exists. A cold start with React loses that race reliably,\n * and the result is a page whose every dependency answers `504` while its\n * HMR connection sits there, connected and silent.\n *\n * Capped, and deliberately crudely. A reload that produces another stale\n * response is a loop, and a loop of reloads is worse than the blank frame it\n * is trying to fix — it burns CPU and makes the tab hard to even close. Three\n * within ten seconds is enough for the case this exists for (one\n * re-optimization, occasionally a second) and stops well short of a page\n * that cannot recover.\n */\n const RELOAD_KEY = \"sandboxedjs:reloads\";\n const RELOAD_LIMIT = 3;\n const RELOAD_WINDOW_MS = 10_000;\n\n function reloadForStaleServer(): void {\n let count = 0;\n try {\n const raw = sessionStorage.getItem(RELOAD_KEY);\n const state = raw ? JSON.parse(raw) as { at: number; count: number } : null;\n /* Outside the window means the last reload worked, so this is a fresh\n * problem rather than a repeat of the same one. */\n count = state && Date.now() - state.at < RELOAD_WINDOW_MS ? state.count : 0;\n if (count >= RELOAD_LIMIT) {\n console.warn(\"sandboxedjs: the dev server keeps invalidating this page; not reloading again\");\n return;\n }\n sessionStorage.setItem(RELOAD_KEY, JSON.stringify({ at: Date.now(), count: count + 1 }));\n } catch {\n /* No session storage — a reload is still better than a stranded page,\n * but without a counter it must happen only once per document. */\n if ((scope as { __sandboxedjsReloaded?: boolean }).__sandboxedjsReloaded) return;\n (scope as { __sandboxedjsReloaded?: boolean }).__sandboxedjsReloaded = true;\n }\n location.reload();\n }\n\n const workers = scope.navigator?.serviceWorker;\n if (workers?.addEventListener) {\n workers.addEventListener(\"message\", (event: any) => {\n if (event?.data?.type === \"sandboxedjs:reload\") reloadForStaleServer();\n });\n }\n\n const encoder = new TextEncoder();\n const decoder = new TextDecoder();\n\n function concat(a: Uint8Array, b: Uint8Array): Uint8Array {\n if (a.length === 0) return b;\n if (b.length === 0) return a;\n const out = new Uint8Array(a.length + b.length);\n out.set(a, 0);\n out.set(b, a.length);\n return out;\n }\n\n /**\n * One frame, masked.\n *\n * A client must mask; a server must not. `ws` closes the connection over\n * either mistake, so this is not a formality.\n */\n function frame(opcode: number, payload: Uint8Array): Uint8Array {\n const length = payload.length;\n const extended = length > 65535 ? 8 : length > 125 ? 2 : 0;\n const out = new Uint8Array(2 + extended + 4 + length);\n out[0] = 0x80 | opcode;\n let at = 2;\n if (extended === 0) {\n out[1] = 0x80 | length;\n } else if (extended === 2) {\n out[1] = 0x80 | 126;\n out[2] = (length >>> 8) & 0xff;\n out[3] = length & 0xff;\n at = 4;\n } else {\n out[1] = 0x80 | 127;\n /* The high four bytes stay zero: this payload came out of memory, so it\n * cannot reach 2^32. */\n out[6] = (length >>> 24) & 0xff;\n out[7] = (length >>> 16) & 0xff;\n out[8] = (length >>> 8) & 0xff;\n out[9] = length & 0xff;\n at = 10;\n }\n const mask = new Uint8Array(4);\n crypto.getRandomValues(mask);\n out.set(mask, at);\n at += 4;\n for (let i = 0; i < length; i++) out[at + i] = payload[i]! ^ mask[i & 3]!;\n return out;\n }\n\n /** An `Event` with extra properties, built without assuming `CloseEvent`. */\n function event(type: string, fields?: Record<string, unknown>): any {\n const value: any = new Event(type);\n if (fields) for (const key of Object.keys(fields)) {\n try {\n value[key] = fields[key];\n } catch {\n Object.defineProperty(value, key, { value: fields[key], enumerable: true });\n }\n }\n return value;\n }\n\n let nextId = 1;\n const live = new Map<number, any>();\n\n scope.addEventListener(\"message\", (message: any) => {\n /* Same-origin only. The preview and its host share an origin — that is the\n * documented trade-off of previewing this way — so anything from elsewhere\n * is not the host and has no business steering these sockets. */\n if (message.origin !== location.origin) return;\n const data = message.data;\n if (!data || typeof data !== \"object\") return;\n const socket = live.get(data.id);\n if (!socket) return;\n if (data.type === \"sandboxedjs:ws-data\") socket._receive(new Uint8Array(data.data));\n else if (data.type === \"sandboxedjs:ws-close\") socket._shutdown(1006, \"\", false);\n else if (data.type === \"sandboxedjs:ws-error\") socket._fail(String(data.message ?? \"connection failed\"));\n });\n\n class TunnelledWebSocket extends EventTarget {\n static readonly CONNECTING = 0;\n static readonly OPEN = 1;\n static readonly CLOSING = 2;\n static readonly CLOSED = 3;\n readonly CONNECTING = 0;\n readonly OPEN = 1;\n readonly CLOSING = 2;\n readonly CLOSED = 3;\n\n readonly url: string;\n readyState = 0;\n protocol = \"\";\n extensions = \"\";\n bufferedAmount = 0;\n binaryType: \"blob\" | \"arraybuffer\" = \"blob\";\n\n onopen: any = null;\n onmessage: any = null;\n onerror: any = null;\n onclose: any = null;\n\n private readonly id = nextId++;\n /** Handshake bytes first, frames after; the 101 arrives as bytes. */\n private handshaken = false;\n private buffer: Uint8Array<ArrayBufferLike> = new Uint8Array(0);\n /** A fragmented message in progress: its opcode and its pieces. */\n private fragmentOpcode = 0;\n private fragments: Uint8Array[] = [];\n\n constructor(url: string, protocols?: string | string[]) {\n super();\n const to = target(url);\n /* Only reachable when `create` chose this class, which it does only for\n * URLs `target` has already accepted. */\n if (!to) throw new SyntaxError(`Not a container address: ${url}`);\n this.url = String(new URL(String(url), location.href));\n\n const list = protocols === undefined ? [] : typeof protocols === \"string\" ? [protocols] : protocols;\n const key = (() => {\n const bytes = new Uint8Array(16);\n crypto.getRandomValues(bytes);\n let binary = \"\";\n for (const byte of bytes) binary += String.fromCharCode(byte);\n return btoa(binary);\n })();\n\n const headers: Record<string, string> = {\n /*\n * The address the server believes it is on, not the one the page is\n * loaded from. A dev server validates `Host` on the upgrade — Vite has\n * done so since it closed CVE-2025-24010 — against a list that always\n * contains loopback and never contains whatever origin happens to be\n * hosting this preview. Sending the page's host means a handshake\n * rejected for a reason that has nothing to do with the sandbox.\n */\n host: `localhost:${to.port}`,\n connection: \"Upgrade\",\n upgrade: \"websocket\",\n \"sec-websocket-version\": \"13\",\n \"sec-websocket-key\": key,\n origin: location.origin,\n };\n if (list.length) headers[\"sec-websocket-protocol\"] = list.join(\", \");\n\n live.set(this.id, this);\n host.postMessage(\n { type: \"sandboxedjs:ws-open\", id: this.id, port: to.port, path: to.path, headers },\n location.origin,\n );\n /*\n * Nobody answering is a real state, not a hypothetical: the page hosting\n * this preview may be running a build of `createPreview` older than the\n * one that injected this script, in which case the message lands\n * nowhere. Left alone that is an open socket that never opens and never\n * closes — the worst failure to diagnose, because nothing is reported at\n * all. Failing loudly turns it into a sentence in the console.\n */\n setTimeout(() => {\n if (this.readyState === 0) {\n this._fail(\"The page hosting this preview did not answer the WebSocket. It may be running an older version of sandboxedjs.\");\n }\n }, OPEN_TIMEOUT_MS);\n }\n\n send(data: any): void {\n if (this.readyState === 0) throw new DOMException(\"Still in CONNECTING state.\", \"InvalidStateError\");\n if (this.readyState !== 1) return;\n if (typeof data === \"string\") this._write(0x1, encoder.encode(data));\n else if (data instanceof ArrayBuffer) this._write(0x2, new Uint8Array(data));\n else if (ArrayBuffer.isView(data)) this._write(0x2, new Uint8Array(data.buffer, data.byteOffset, data.byteLength));\n else this._write(0x1, encoder.encode(String(data)));\n }\n\n close(code?: number, reason?: string): void {\n if (this.readyState === 2 || this.readyState === 3) return;\n const body = encoder.encode(reason ?? \"\");\n const payload = new Uint8Array(2 + body.length);\n payload[0] = ((code ?? 1000) >>> 8) & 0xff;\n payload[1] = (code ?? 1000) & 0xff;\n payload.set(body, 2);\n if (this.readyState === 1) this._write(0x8, payload);\n this.readyState = 2;\n host.postMessage({ type: \"sandboxedjs:ws-close\", id: this.id }, location.origin);\n }\n\n private _write(opcode: number, payload: Uint8Array): void {\n const bytes = frame(opcode, payload);\n /* Copied into a fresh buffer so it can be transferred without taking the\n * caller's memory with it. */\n const carrier = bytes.slice().buffer;\n host.postMessage({ type: \"sandboxedjs:ws-data\", id: this.id, data: carrier }, location.origin, [carrier]);\n }\n\n private _emit(value: any): void {\n const handler = (this as any)[\"on\" + value.type];\n if (typeof handler === \"function\") handler.call(this, value);\n this.dispatchEvent(value);\n }\n\n _fail(message: string): void {\n if (this.readyState === 3) return;\n this._emit(event(\"error\", { message }));\n this._shutdown(1006, \"\", false);\n }\n\n /** Bytes from the container: the 101, then frames. */\n _receive(bytes: Uint8Array): void {\n if (this.readyState === 3) return;\n this.buffer = concat(this.buffer, bytes);\n if (!this.handshaken && !this._handshake()) return;\n this._frames();\n }\n\n /**\n * Read the `101` the server wrote onto the socket.\n *\n * The container builds the request from structured fields, but the reply\n * comes back as the bytes `ws` wrote — a real status line and real headers\n * — so it is parsed as one.\n */\n private _handshake(): boolean {\n const text = decoder.decode(this.buffer);\n const end = text.indexOf(\"\\r\\n\\r\\n\");\n if (end === -1) return false;\n const head = text.slice(0, end).split(\"\\r\\n\");\n const status = Number(head[0]?.split(\" \")[1]);\n if (status !== 101) {\n this._fail(`Server refused the WebSocket upgrade (${status || \"no status\"})`);\n return false;\n }\n for (const line of head.slice(1)) {\n const at = line.indexOf(\":\");\n if (at === -1) continue;\n if (line.slice(0, at).trim().toLowerCase() === \"sec-websocket-protocol\") {\n this.protocol = line.slice(at + 1).trim();\n }\n }\n /* The header is ASCII, so its character count is its byte count. */\n this.buffer = this.buffer.subarray(end + 4);\n this.handshaken = true;\n this.readyState = 1;\n this._emit(event(\"open\"));\n return true;\n }\n\n private _frames(): void {\n for (;;) {\n const view = this.buffer;\n if (view.length < 2) return;\n const first = view[0]!;\n const second = view[1]!;\n const fin = (first & 0x80) !== 0;\n const opcode = first & 0x0f;\n const masked = (second & 0x80) !== 0;\n let length = second & 0x7f;\n let at = 2;\n if (length === 126) {\n if (view.length < 4) return;\n length = (view[2]! << 8) | view[3]!;\n at = 4;\n } else if (length === 127) {\n if (view.length < 10) return;\n /* Arithmetic rather than shifts: the top half of a 64-bit length\n * does not survive a 32-bit bitwise operator. */\n const high = view[2]! * 2 ** 24 + view[3]! * 2 ** 16 + view[4]! * 2 ** 8 + view[5]!;\n const low = view[6]! * 2 ** 24 + view[7]! * 2 ** 16 + view[8]! * 2 ** 8 + view[9]!;\n length = high * 2 ** 32 + low;\n at = 10;\n }\n let mask: Uint8Array | null = null;\n if (masked) {\n if (view.length < at + 4) return;\n mask = view.subarray(at, at + 4);\n at += 4;\n }\n if (view.length < at + length) return;\n const payload = view.slice(at, at + length);\n if (mask) for (let i = 0; i < length; i++) payload[i] = payload[i]! ^ mask[i & 3]!;\n this.buffer = view.subarray(at + length);\n this._frame(fin, opcode, payload);\n if (this.readyState === 3) return;\n }\n }\n\n private _frame(fin: boolean, opcode: number, payload: Uint8Array): void {\n if (opcode === 0x9) {\n /* A pong has to carry the ping's payload back verbatim. `ws` pings on\n * a timer, and a client that never answers is dropped. */\n if (this.readyState === 1) this._write(0xa, payload);\n return;\n }\n if (opcode === 0xa) return;\n if (opcode === 0x8) {\n const code = payload.length >= 2 ? (payload[0]! << 8) | payload[1]! : 1005;\n const reason = payload.length > 2 ? decoder.decode(payload.subarray(2)) : \"\";\n if (this.readyState === 1) this._write(0x8, payload);\n this.readyState = 2;\n host.postMessage({ type: \"sandboxedjs:ws-close\", id: this.id }, location.origin);\n this._shutdown(code, reason, true);\n return;\n }\n\n if (opcode !== 0x0) {\n this.fragmentOpcode = opcode;\n this.fragments = [];\n }\n this.fragments.push(payload);\n if (!fin) return;\n\n let total = 0;\n for (const piece of this.fragments) total += piece.length;\n const body = new Uint8Array(total);\n let offset = 0;\n for (const piece of this.fragments) {\n body.set(piece, offset);\n offset += piece.length;\n }\n this.fragments = [];\n\n const data = this.fragmentOpcode === 0x1\n ? decoder.decode(body)\n : this.binaryType === \"arraybuffer\"\n ? body.buffer.slice(body.byteOffset, body.byteOffset + body.byteLength)\n : new Blob([body as BlobPart]);\n this._emit(event(\"message\", { data, origin: location.origin, lastEventId: \"\", source: null, ports: [] }));\n }\n\n _shutdown(code: number, reason: string, wasClean: boolean): void {\n if (this.readyState === 3) return;\n this.readyState = 3;\n live.delete(this.id);\n this._emit(event(\"close\", { code, reason, wasClean }));\n }\n }\n\n /**\n * The replacement constructor.\n *\n * A plain function so `new WebSocket(url)` can pick an implementation per\n * URL — anything not naming the container has to keep working, and that\n * includes a page talking to a genuine remote server from inside a preview.\n */\n function create(this: any, url: string, protocols?: string | string[]): any {\n if (!target(url)) return protocols === undefined ? new Native(url) : new Native(url, protocols);\n return new TunnelledWebSocket(url, protocols);\n }\n\n create.prototype = TunnelledWebSocket.prototype;\n (create as any).CONNECTING = 0;\n (create as any).OPEN = 1;\n (create as any).CLOSING = 2;\n (create as any).CLOSED = 3;\n /* `instanceof` has to keep answering for native sockets too, since only some\n * of them are ours. */\n Object.defineProperty(create, Symbol.hasInstance, {\n value: (value: unknown) => value instanceof TunnelledWebSocket || value instanceof Native,\n });\n\n scope.WebSocket = create;\n /* A one-word answer to \"is this actually installed?\", which is otherwise\n * only observable by noticing that a WebSocket *failed* to appear in the\n * network panel. Reading a global in the frame's console is a far shorter\n * path to that answer than reasoning about it. */\n scope.__sandboxedjsPreviewSockets = true;\n}\n\n/**\n * The shim, as a `<script>` body.\n *\n * Serialising the function keeps one implementation: what a test drives is\n * character-for-character what a preview runs. The call is wrapped so a\n * failure to install cannot take the page's own scripts down with it — a\n * preview without hot reload is worth far more than a blank frame.\n */\nexport function previewSocketSource(): string {\n return `(function(){try{(${installPreviewSockets.toString()})(window);}catch(error){console.warn(\"sandboxedjs: preview WebSocket unavailable\",error);}})();`;\n}\n","/**\n * The routing a preview service worker does, separated from the worker itself.\n *\n * A service worker is awkward to test — it needs a browser, a registration and\n * a secure context — but almost none of what makes this correct is about being\n * a service worker. The interesting part is the bookkeeping: which client is\n * previewing which port, which requests belong to a preview at all, and how a\n * response is rebuilt on the way back. That lives here, where it can be\n * exercised directly.\n *\n * The rule this implements, and the reason it exists: requests are routed by\n * **who is asking**, not by what the path looks like. An iframe navigates once\n * to `/__sbx__/<port>/`; every later request from that client — however\n * absolute its path — is recognised by its client id. Nothing has to rewrite\n * `/src/main.js` or `/@vite/client`, which is what makes a real dev server\n * work rather than only a single page.\n */\n\nimport { previewSocketSource } from \"./ws-client.js\";\n\n/**\n * The one-time path an iframe navigates to in order to claim a port.\n *\n * Deliberately not anchored to the start of the path. A service worker's scope\n * is the directory its script was served from, so in a published package the\n * claim arrives under something like\n * `/node_modules/sandboxedjs/dist/__sbx__/5173/` — anchoring here would match\n * only when the worker happened to be served from the site root.\n */\nconst CLAIM = /(?:^|\\/)__sbx__\\/(\\d+)(?:\\/|$)/;\n\nexport interface ProxiedRequest {\n id: number;\n port: number;\n path: string;\n method: string;\n headers: Record<string, string>;\n body?: ArrayBuffer;\n}\n\nexport interface ProxiedResponse {\n status: number;\n statusText: string;\n headers: Record<string, string>;\n body: ArrayBuffer;\n}\n\nexport interface PreviewRouterOptions {\n /** Hand a request to whichever page owns the container. */\n send(request: ProxiedRequest, transfer: ArrayBuffer[]): void;\n /** How long to wait for that page before giving up. */\n timeoutMs?: number;\n /**\n * Ask the owning page to hand over a fresh channel, and resolve once it has.\n *\n * A service worker is not a process that stays running. The browser stops it\n * whenever it looks idle — seconds, in practice — and starts it again for\n * the next request, with every module-level value gone. The `MessagePort`\n * that reaches the container is one of those values, so a worker that has\n * been restarted has no way to answer anything, however healthy the\n * container behind it still is.\n *\n * Nothing about that is visible: the server is running, the port is open,\n * and the preview simply stops working — on reload, in a new tab, or after\n * a pause long enough for the browser to reclaim the worker. The page is\n * still there and can always supply another port, so the worker asks for one\n * rather than failing.\n */\n requestHost?(): Promise<void>;\n /**\n * The dev server has invalidated what the page is holding; reload it.\n *\n * Vite answers a request for a pre-bundled dependency with `504 Outdated\n * Optimize Dep` whenever the hash in the URL no longer matches — after the\n * optimizer re-runs, or after the server restarts. Its own client recovers\n * by reloading the whole page, and it learns to do that over the HMR\n * WebSocket.\n *\n * This bridge carries HTTP and nothing else, so that signal never arrives.\n * The page goes on requesting URLs stamped with a hash the server has\n * forgotten, every module 504s, and the app never mounts — while the\n * terminal reports a dev server that started perfectly. A plain static\n * server never does this, which is why vanilla pages worked and React did\n * not.\n */\n onStale?(clientId?: string): void;\n /**\n * Give previewed pages a `WebSocket` that reaches the container.\n *\n * A service worker cannot answer a WebSocket handshake — no browser ever\n * shipped that — so the only way a page inside a preview can open one is to\n * be handed a different constructor. Injecting it into the HTML is how that\n * gets there, and it is on by default because a dev server without its HMR\n * channel does not merely lose hot reload: it loses the only way it can tell\n * a page that its dependency hashes are stale, which strands the preview on\n * `504 Outdated Optimize Dep` with nothing to explain it.\n */\n injectSockets?: boolean;\n}\n\n/** Vite's answer when the page is holding a dependency hash it has dropped. */\nconst OUTDATED = /outdated optimize dep/i;\n\n/** The port to answer with when nothing has connected yet. */\nconst NOT_CONNECTED = 503;\n\nexport class PreviewRouter {\n private readonly clientPorts = new Map<string, number>();\n private readonly pending = new Map<number, (value: ProxiedResponse) => void>();\n private nextId = 1;\n private connected = false;\n\n constructor(private readonly options: PreviewRouterOptions) {}\n\n /** Whether a page has handed over a channel this worker can still use. */\n get ready(): boolean {\n return this.connected;\n }\n\n /** The page that answers requests has arrived. */\n connect(): void {\n this.connected = true;\n }\n\n /** The channel is gone; the next request has to ask for another. */\n disconnect(): void {\n this.connected = false;\n }\n\n /** Read a port out of a claim path, or null when this is not one. */\n /**\n * The path to ask the container for, given a request from a bound client.\n *\n * A document served at `/…/__sbx__/3000/` resolves its *relative* assets\n * against that prefix, so `./app.js` arrives as\n * `/…/__sbx__/3000/app.js`. Forwarding that verbatim asks the container for\n * a file inside a directory it has never heard of, and every relative asset\n * in the site 404s while the document itself loads perfectly — a page that\n * renders unstyled and inert, with nothing to explain why.\n *\n * Root-relative assets (`/main.js`) carry no prefix and pass through\n * unchanged, which is the case that always worked.\n */\n containerPath(pathname: string, search: string): string {\n const match = CLAIM.exec(pathname);\n const rest = match ? pathname.slice(match.index + match[0].length) : pathname;\n const normalised = rest.startsWith(\"/\") ? rest : `/${rest}`;\n return `${normalised}${search}`;\n }\n\n claimedPort(pathname: string): number | null {\n const match = CLAIM.exec(pathname);\n return match ? Number(match[1]) : null;\n }\n\n /** Remember that everything from `clientId` belongs to `port`. */\n bind(clientId: string, port: number): void {\n if (clientId) this.clientPorts.set(clientId, port);\n }\n\n /** Which port this client is previewing, or undefined for ordinary traffic. */\n portFor(clientId: string): number | undefined {\n return this.clientPorts.get(clientId);\n }\n\n /** A response has come back from the page. */\n settle(id: number, response: ProxiedResponse): void {\n const resolve = this.pending.get(id);\n if (!resolve) return;\n this.pending.delete(id);\n resolve(response);\n }\n\n /** Forget a client that has gone away. */\n release(clientId: string): void {\n this.clientPorts.delete(clientId);\n }\n\n /** Ask the page for one response and rebuild it as a `Response`. */\n async fetch(port: number, path: string, request: Request, clientId?: string): Promise<Response> {\n /* Restarted, most likely, rather than never started. Ask the page for a\n * channel before concluding there is nobody to ask. */\n if (!this.connected) await this.options.requestHost?.().catch(() => undefined);\n\n if (!this.connected) {\n return isolated(\n new Response(\n 'The sandbox preview is not connected yet. The page that owns this container has to be open.',\n { status: NOT_CONNECTED, statusText: 'Service Unavailable' },\n ),\n );\n }\n const sent = request.method === \"GET\" || request.method === \"HEAD\" ? undefined : await request.arrayBuffer();\n const id = this.nextId++;\n const answered = new Promise<ProxiedResponse>((resolve) => this.pending.set(id, resolve));\n\n this.options.send(\n { id, port, path, method: request.method, headers: headerRecord(request.headers), ...(sent ? { body: sent } : {}) },\n sent ? [sent] : [],\n );\n\n const timeoutMs = this.options.timeoutMs ?? 30_000;\n const result = await Promise.race([\n answered,\n new Promise<ProxiedResponse>((resolve) =>\n setTimeout(\n () => resolve({ status: 504, statusText: \"Gateway Timeout\", headers: {}, body: new ArrayBuffer(0) }),\n timeoutMs,\n ),\n ),\n ]);\n this.pending.delete(id);\n\n /*\n * Nothing here can rewrite the URL the page asked for — only the page can\n * ask again, and only after reloading. `clientId` names the frame that\n * asked, so the worker can tell that frame to do it.\n *\n * This has to be automatic rather than left to the host. Vite's own client\n * recovers by reloading when it is told to over HMR, and that message is\n * routinely *lost*: Vite sends `full-reload` the moment its optimizer\n * finishes, and the HMR socket here travels an iframe, a `postMessage`,\n * the host page and the container before it is connected. Lose that race —\n * which a cold start with React reliably does — and the reload is sent to\n * nobody, leaving a page holding hashes the server has already forgotten,\n * with a working HMR connection and nothing to say on it.\n */\n if (result.status === 504 && OUTDATED.test(result.statusText)) {\n this.options.onStale?.(clientId);\n }\n\n const headers = new Headers(result.headers);\n const body = this.options.injectSockets === false ? result.body : withSockets(result.body, headers);\n /*\n * Two headers, for two different refusals, both of which a cross-origin\n * isolated page makes — and pages that run Rolldown have to be isolated.\n *\n * `Cross-Origin-Resource-Policy` lets the response be loaded as a\n * subresource at all. `Cross-Origin-Embedder-Policy` lets it be *framed*:\n * without it the document is not isolation-compatible, so the iframe is\n * replaced by an error page and the parent sees an opaque, cross-origin\n * frame rather than the site it asked for. Everything served here carries\n * CORP, so the stricter policy is one this preview can satisfy.\n */\n headers.set(\"Cross-Origin-Resource-Policy\", \"cross-origin\");\n headers.set(\"Cross-Origin-Embedder-Policy\", \"require-corp\");\n return new Response(body, { status: result.status, statusText: result.statusText, headers });\n }\n}\n\n/**\n * The isolation headers, on a response this router made up itself.\n *\n * Every failure here is still framed by a cross-origin isolated page, and a\n * document without these is not merely shown as an error — it is refused\n * before it renders, so the reader gets the browser's \"refused to connect\"\n * instead of the sentence explaining what went wrong. An error nobody can read\n * is worse than the failure it describes.\n */\nfunction isolated(response: Response): Response {\n const headers = new Headers(response.headers);\n headers.set(\"Content-Type\", \"text/plain; charset=utf-8\");\n headers.set(\"Cross-Origin-Resource-Policy\", \"cross-origin\");\n headers.set(\"Cross-Origin-Embedder-Policy\", \"require-corp\");\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n}\n\n/**\n * Put the tunnelling `WebSocket` into an HTML document before anything runs.\n *\n * Only HTML, and only HTML this router can read: a compressed body would have\n * to be decoded and re-encoded to be edited, and getting that wrong corrupts\n * the page rather than merely failing to patch it. Anything skipped here keeps\n * the native `WebSocket`, which is exactly what it had before.\n *\n * The script goes directly after `<head>` so it is installed before the\n * document's own scripts — a dev server's client is one of the first of them,\n * and it opens its socket immediately.\n */\nfunction withSockets(body: ArrayBuffer, headers: Headers): ArrayBuffer {\n const type = headers.get(\"content-type\") ?? \"\";\n if (!/^\\s*text\\/html\\b/i.test(type)) return body;\n const encoding = headers.get(\"content-encoding\");\n if (encoding && encoding.toLowerCase() !== \"identity\") return body;\n\n const html = new TextDecoder().decode(body);\n const tag = `<script>${previewSocketSource()}</script>`;\n const head = /<head[^>]*>/i.exec(html);\n const at = head ? head.index + head[0].length : 0;\n const bytes = new TextEncoder().encode(html.slice(0, at) + tag + html.slice(at));\n /* The document just got longer. A stale `Content-Length` truncates it. */\n headers.set(\"content-length\", String(bytes.byteLength));\n return bytes.buffer as ArrayBuffer;\n}\n\n/** `Headers` is iterable at runtime; the DOM lib used here does not say so. */\nfunction headerRecord(headers: Headers): Record<string, string> {\n const out: Record<string, string> = {};\n (headers as unknown as { forEach(fn: (value: string, key: string) => void): void })\n .forEach((value, key) => { out[key] = value; });\n return out;\n}\n","/**\n * A service worker that gives a container's HTTP servers real URLs.\n *\n * Without one, a page can reach a server inside the container only through\n * `box.request(port, …)`, which hands back a single response. That is enough to\n * read an API or drop some HTML into an element, but not to *run* a site: a\n * dev server emits absolute URLs like `/src/main.js` and `/@vite/client`, and\n * nothing in the page resolves those to the sandbox.\n *\n * This file is deliberately only the glue. The routing lives in\n * {@link PreviewRouter}, where it can be tested without a browser — a service\n * worker otherwise needs a registration, a secure context and a real page\n * before any of its behaviour can be observed at all.\n */\n\nimport { PreviewRouter, type ProxiedResponse, type PreviewRouterOptions } from \"./router.js\";\n\n/*\n * Typed locally rather than through `lib.webworker`: this package compiles with\n * the DOM lib, and the two declare a conflicting `self`. Only the handful of\n * members actually used are described here.\n */\ninterface FetchLikeEvent extends Event {\n request: Request;\n clientId: string;\n resultingClientId: string;\n respondWith(response: Promise<Response> | Response): void;\n}\ninterface ExtendableLikeEvent extends Event {\n waitUntil(promise: Promise<unknown>): void;\n}\ninterface MessageLikeEvent extends Event {\n data: unknown;\n ports: readonly MessagePort[];\n}\ninterface WorkerClient {\n postMessage(message: unknown): void;\n}\ninterface WorkerScope {\n location: { origin: string };\n clients: {\n claim(): Promise<void>;\n get(id: string): Promise<WorkerClient | undefined>;\n matchAll(options?: { includeUncontrolled?: boolean; type?: string }): Promise<WorkerClient[]>;\n };\n skipWaiting(): Promise<void>;\n addEventListener(type: \"install\" | \"activate\", listener: (event: ExtendableLikeEvent) => void): void;\n addEventListener(type: \"fetch\", listener: (event: FetchLikeEvent) => void): void;\n addEventListener(type: \"message\", listener: (event: MessageLikeEvent) => void): void;\n}\n\nconst worker = globalThis as unknown as WorkerScope;\n\nlet host: MessagePort | null = null;\n\n/** Resolves when a page answers the call for a channel; see `requestHost`. */\nlet awaitingHost: { promise: Promise<void>; resolve: () => void } | null = null;\n\nconst HOST_WAIT_MS = 5_000;\n\nconst options: PreviewRouterOptions = {\n send: (request, transfer) => host?.postMessage(request, transfer),\n /*\n * The worker was stopped and started again, taking the channel with it.\n *\n * Every page that owns a container listens for this and hands over a fresh\n * port. Broadcasting rather than tracking an owner is deliberate: after a\n * restart the worker knows nothing about who registered it, and a page with\n * no container simply ignores the call.\n */\n requestHost: async () => {\n if (awaitingHost) return awaitingHost.promise;\n\n let resolve!: () => void;\n const promise = new Promise<void>((done) => {\n resolve = done;\n });\n awaitingHost = { promise, resolve };\n\n const clients = await worker.clients.matchAll({ includeUncontrolled: true, type: \"window\" });\n for (const client of clients) client.postMessage({ type: \"sandboxedjs:host-needed\" });\n\n /* Bounded: a page that cannot answer must not hold the request open until\n * the request timeout, which is six times longer. */\n const timer = setTimeout(() => {\n awaitingHost?.resolve();\n awaitingHost = null;\n }, HOST_WAIT_MS);\n\n await promise;\n clearTimeout(timer);\n awaitingHost = null;\n },\n /* Broadcast, for the same reason `requestHost` does: after a restart this\n * worker has no idea which page owns what. A page with no preview ignores\n * it. */\n onStale: (clientId) => {\n /* The frame that asked is the only thing that can ask again, and the\n * injected client in it knows how. Telling it directly is what makes\n * recovery independent of the host having wired anything up. */\n if (clientId) {\n void worker.clients.get(clientId).then((client) => client?.postMessage({ type: \"sandboxedjs:reload\" }));\n }\n /* Still announced to the pages that own containers, so a host that wants\n * to drive the reload itself — or count them — can. */\n void worker.clients\n .matchAll({ includeUncontrolled: true, type: \"window\" })\n .then((clients) => {\n for (const client of clients) client.postMessage({ type: \"sandboxedjs:stale\" });\n });\n },\n};\n\nconst router = new PreviewRouter(options);\n\nworker.addEventListener(\"install\", () => void worker.skipWaiting());\nworker.addEventListener(\"activate\", (event) => event.waitUntil(worker.clients.claim()));\n\nworker.addEventListener(\"message\", (event) => {\n const data = event.data as { type?: string } | null;\n if (data?.type !== \"sandboxedjs:connect\") return;\n host = event.ports[0] ?? null;\n if (!host) return;\n /* The page decides whether previewed documents get a tunnelling\n * `WebSocket`, and it can only say so once it has a channel — this worker\n * may have been started fresh for a request, with no memory of the last\n * answer. */\n options.injectSockets = (event.data as { injectSockets?: boolean }).injectSockets !== false;\n host.onmessage = (message) => {\n const reply = message.data as { id: number; response: ProxiedResponse };\n router.settle(reply.id, reply.response);\n };\n host.start();\n router.connect();\n /* Release anything that was waiting on this channel arriving. */\n awaitingHost?.resolve();\n});\n\nworker.addEventListener(\"fetch\", (event) => {\n const url = new URL(event.request.url);\n if (url.origin !== worker.location.origin) return;\n\n const claimed = router.claimedPort(url.pathname);\n if (claimed !== null && event.request.mode === \"navigate\") {\n /* A navigation's client does not exist yet, so it is named by\n * `resultingClientId`. Binding it here is what lets every later request\n * from that document be recognised without touching its URLs. */\n router.bind(event.resultingClientId || event.clientId, claimed);\n event.respondWith(router.fetch(claimed, \"/\", event.request, event.resultingClientId || event.clientId));\n return;\n }\n\n const port = router.portFor(event.clientId);\n if (port === undefined) return; // not a preview: the host page's own traffic\n /* Strip this worker's own claim prefix before asking the container: a\n * relative asset resolves against the document's URL, so it arrives carrying\n * the prefix the container knows nothing about. */\n event.respondWith(\n router.fetch(port, router.containerPath(url.pathname, url.search), event.request, event.clientId),\n );\n});\n"]}
|