@php-wasm/universal 3.0.18 → 3.0.19
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/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/index.js +171 -164
- package/index.js.map +1 -1
- package/package.json +7 -7
package/index.js
CHANGED
|
@@ -105,10 +105,10 @@ function rethrowFileSystemError(t = "") {
|
|
|
105
105
|
} catch (n) {
|
|
106
106
|
const i = typeof n == "object" ? n == null ? void 0 : n.errno : null;
|
|
107
107
|
if (i in FileErrorCodes) {
|
|
108
|
-
const o = FileErrorCodes[i],
|
|
108
|
+
const o = FileErrorCodes[i], c = typeof s[1] == "string" ? s[1] : null, a = c !== null ? t.replaceAll("{path}", c) : t;
|
|
109
109
|
throw new ErrnoError(
|
|
110
110
|
i,
|
|
111
|
-
`${
|
|
111
|
+
`${a}: ${o}`,
|
|
112
112
|
{
|
|
113
113
|
cause: n
|
|
114
114
|
}
|
|
@@ -566,14 +566,14 @@ const RuntimeId = Symbol("RuntimeId"), loadedRuntimes = /* @__PURE__ */ new Map(
|
|
|
566
566
|
let lastRuntimeId = 0;
|
|
567
567
|
async function loadPHPRuntime(t, ...e) {
|
|
568
568
|
const r = Object.assign({}, ...e), [s, n, i] = makePromise(), o = t.init(currentJsRuntime, {
|
|
569
|
-
onAbort(
|
|
570
|
-
i(
|
|
569
|
+
onAbort(a) {
|
|
570
|
+
i(a), logger.error(a);
|
|
571
571
|
},
|
|
572
572
|
ENV: {},
|
|
573
573
|
// Emscripten sometimes prepends a '/' to the path, which
|
|
574
574
|
// breaks vite dev mode. An identity `locateFile` function
|
|
575
575
|
// fixes it.
|
|
576
|
-
locateFile: (
|
|
576
|
+
locateFile: (a) => a,
|
|
577
577
|
...r,
|
|
578
578
|
noInitialRun: !0,
|
|
579
579
|
onRuntimeInitialized() {
|
|
@@ -581,10 +581,10 @@ async function loadPHPRuntime(t, ...e) {
|
|
|
581
581
|
}
|
|
582
582
|
});
|
|
583
583
|
await s;
|
|
584
|
-
const
|
|
585
|
-
return o.FS, o.id =
|
|
586
|
-
return o.outboundNetworkProxyServer && (o.outboundNetworkProxyServer.close(), o.outboundNetworkProxyServer.closeAllConnections()), loadedRuntimes.delete(
|
|
587
|
-
}, o[RuntimeId] =
|
|
584
|
+
const c = ++lastRuntimeId;
|
|
585
|
+
return o.FS, o.id = c, o.originalExit = o._exit, o._exit = function(a) {
|
|
586
|
+
return o.outboundNetworkProxyServer && (o.outboundNetworkProxyServer.close(), o.outboundNetworkProxyServer.closeAllConnections()), loadedRuntimes.delete(c), o.originalExit(a);
|
|
587
|
+
}, o[RuntimeId] = c, loadedRuntimes.set(c, o), c;
|
|
588
588
|
}
|
|
589
589
|
function getLoadedRuntime(t) {
|
|
590
590
|
return loadedRuntimes.get(t);
|
|
@@ -689,8 +689,8 @@ async function parseHeadersStream(t) {
|
|
|
689
689
|
for (const n of r.headers) {
|
|
690
690
|
if (!n.includes(": "))
|
|
691
691
|
continue;
|
|
692
|
-
const i = n.indexOf(": "), o = n.substring(0, i).toLowerCase(),
|
|
693
|
-
o in s || (s[o] = []), s[o].push(
|
|
692
|
+
const i = n.indexOf(": "), o = n.substring(0, i).toLowerCase(), c = n.substring(i + 2);
|
|
693
|
+
o in s || (s[o] = []), s[o].push(c);
|
|
694
694
|
}
|
|
695
695
|
return {
|
|
696
696
|
headers: s,
|
|
@@ -712,12 +712,12 @@ async function streamToBytes(t) {
|
|
|
712
712
|
const { done: s, value: n } = await e.read();
|
|
713
713
|
if (s) {
|
|
714
714
|
const i = r.reduce(
|
|
715
|
-
(
|
|
715
|
+
(a, l) => a + l.byteLength,
|
|
716
716
|
0
|
|
717
717
|
), o = new Uint8Array(i);
|
|
718
|
-
let
|
|
719
|
-
for (const
|
|
720
|
-
o.set(
|
|
718
|
+
let c = 0;
|
|
719
|
+
for (const a of r)
|
|
720
|
+
o.set(a, c), c += a.byteLength;
|
|
721
721
|
return o;
|
|
722
722
|
}
|
|
723
723
|
n && r.push(n);
|
|
@@ -841,16 +841,16 @@ function improveWASMErrorReporting(t) {
|
|
|
841
841
|
if (!(o instanceof Error))
|
|
842
842
|
throw o;
|
|
843
843
|
t.lastAsyncifyStackSource && (o.cause = t.lastAsyncifyStackSource);
|
|
844
|
-
const
|
|
844
|
+
const c = clarifyErrorMessage(
|
|
845
845
|
o,
|
|
846
846
|
(i = t.lastAsyncifyStackSource) == null ? void 0 : i.stack
|
|
847
847
|
);
|
|
848
848
|
if (e.hasListeners()) {
|
|
849
|
-
o.message =
|
|
850
|
-
const
|
|
851
|
-
throw e.dispatchEvent(
|
|
849
|
+
o.message = c;
|
|
850
|
+
const a = new ErrorEvent("error", { error: o });
|
|
851
|
+
throw e.dispatchEvent(a), o;
|
|
852
852
|
}
|
|
853
|
-
throw (!isExitCode(o) || o.status !== 0) && showCriticalErrorBox(
|
|
853
|
+
throw (!isExitCode(o) || o.status !== 0) && showCriticalErrorBox(c), o;
|
|
854
854
|
}
|
|
855
855
|
};
|
|
856
856
|
}
|
|
@@ -950,7 +950,7 @@ class PHPExecutionFailureError extends Error {
|
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
952
|
const PHP_INI_PATH = "/internal/shared/php.ini", AUTO_PREPEND_SCRIPT = "/internal/shared/auto_prepend_file.php", OPCACHE_FILE_FOLDER = "/internal/shared/opcache";
|
|
953
|
-
var
|
|
953
|
+
var M, H, T, E, F, k, _, h, B, $, V, G, J, Y, K, X, U, Q, q, j;
|
|
954
954
|
class PHP {
|
|
955
955
|
/**
|
|
956
956
|
* Initializes a PHP runtime.
|
|
@@ -961,7 +961,7 @@ class PHP {
|
|
|
961
961
|
*/
|
|
962
962
|
constructor(t) {
|
|
963
963
|
m(this, h);
|
|
964
|
-
m(this,
|
|
964
|
+
m(this, M);
|
|
965
965
|
m(this, H, !1);
|
|
966
966
|
m(this, T, null);
|
|
967
967
|
m(this, E, /* @__PURE__ */ new Map([
|
|
@@ -969,7 +969,7 @@ class PHP {
|
|
|
969
969
|
["*", /* @__PURE__ */ new Set()]
|
|
970
970
|
]));
|
|
971
971
|
m(this, F, []);
|
|
972
|
-
m(this,
|
|
972
|
+
m(this, k, {});
|
|
973
973
|
m(this, _, {
|
|
974
974
|
enabled: !1,
|
|
975
975
|
recreateRuntime: () => 0,
|
|
@@ -1163,7 +1163,7 @@ class PHP {
|
|
|
1163
1163
|
throw new Error(
|
|
1164
1164
|
"Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?"
|
|
1165
1165
|
);
|
|
1166
|
-
w(this,
|
|
1166
|
+
w(this, M, t);
|
|
1167
1167
|
}
|
|
1168
1168
|
/**
|
|
1169
1169
|
* Changes the current working directory in the PHP filesystem.
|
|
@@ -1387,7 +1387,7 @@ class PHP {
|
|
|
1387
1387
|
async runStream(t) {
|
|
1388
1388
|
const e = await this.semaphore.acquire();
|
|
1389
1389
|
let r;
|
|
1390
|
-
const s = y(this, h,
|
|
1390
|
+
const s = y(this, h, j).call(this, async () => {
|
|
1391
1391
|
if (u(this, H) || (await this[__private__dont__use].ccall(
|
|
1392
1392
|
"php_wasm_init",
|
|
1393
1393
|
null,
|
|
@@ -1401,8 +1401,8 @@ class PHP {
|
|
|
1401
1401
|
`The script path "${t.scriptPath}" does not exist.`
|
|
1402
1402
|
);
|
|
1403
1403
|
y(this, h, $).call(this, t.relativeUri || ""), y(this, h, Y).call(this, t.method || "GET");
|
|
1404
|
-
const i = normalizeHeaders(t.headers || {}), o = i.host || "example.com:443",
|
|
1405
|
-
if (y(this, h, V).call(this, o), y(this, h, G).call(this,
|
|
1404
|
+
const i = normalizeHeaders(t.headers || {}), o = i.host || "example.com:443", c = y(this, h, J).call(this, o, t.protocol || "http");
|
|
1405
|
+
if (y(this, h, V).call(this, o), y(this, h, G).call(this, c), y(this, h, K).call(this, i), t.body && (r = y(this, h, X).call(this, t.body)), typeof t.code == "string")
|
|
1406
1406
|
this.writeFile("/internal/eval.php", t.code), y(this, h, U).call(this, "/internal/eval.php");
|
|
1407
1407
|
else if (typeof t.scriptPath == "string")
|
|
1408
1408
|
y(this, h, U).call(this, t.scriptPath || "");
|
|
@@ -1410,9 +1410,9 @@ class PHP {
|
|
|
1410
1410
|
throw new TypeError(
|
|
1411
1411
|
"The request object must have either a `code` or a `scriptPath` property."
|
|
1412
1412
|
);
|
|
1413
|
-
const
|
|
1414
|
-
for (const d in
|
|
1415
|
-
y(this, h, Q).call(this, d,
|
|
1413
|
+
const a = y(this, h, B).call(this, t.$_SERVER, i, c);
|
|
1414
|
+
for (const d in a)
|
|
1415
|
+
y(this, h, Q).call(this, d, a[d]);
|
|
1416
1416
|
const l = t.env || {};
|
|
1417
1417
|
for (const d in l)
|
|
1418
1418
|
y(this, h, q).call(this, d, l[d]);
|
|
@@ -1663,21 +1663,28 @@ class PHP {
|
|
|
1663
1663
|
async hotSwapPHPRuntime(t) {
|
|
1664
1664
|
const e = this[__private__dont__use].FS, r = this.listFiles("/").map((a) => `/${a}`), s = this[__private__dont__use].spawnProcess, n = e.cwd();
|
|
1665
1665
|
e.chdir("/");
|
|
1666
|
-
const i =
|
|
1667
|
-
|
|
1668
|
-
|
|
1666
|
+
const i = Object.entries(u(this, k)).map(
|
|
1667
|
+
([a, l]) => ({
|
|
1668
|
+
mountHandler: l.mountHandler,
|
|
1669
|
+
vfsPath: a
|
|
1670
|
+
})
|
|
1671
|
+
), o = Object.values(
|
|
1672
|
+
u(this, k)
|
|
1673
|
+
).reverse();
|
|
1674
|
+
for (const a of o)
|
|
1675
|
+
await a.unmount();
|
|
1669
1676
|
try {
|
|
1670
1677
|
this.exit();
|
|
1671
1678
|
} catch {
|
|
1672
1679
|
}
|
|
1673
|
-
this.initializeRuntime(t), s && (this[__private__dont__use].spawnProcess = s), u(this,
|
|
1674
|
-
const
|
|
1680
|
+
this.initializeRuntime(t), s && (this[__private__dont__use].spawnProcess = s), u(this, M) && this.setSapiName(u(this, M));
|
|
1681
|
+
const c = this[__private__dont__use].FS;
|
|
1675
1682
|
for (const a of r)
|
|
1676
|
-
a && a !== "/request" && copyMEMFSNodes(e,
|
|
1677
|
-
for (const { mountHandler: a, vfsPath:
|
|
1678
|
-
this.mkdir(
|
|
1683
|
+
a && a !== "/request" && copyMEMFSNodes(e, c, a);
|
|
1684
|
+
for (const { mountHandler: a, vfsPath: l } of i)
|
|
1685
|
+
this.mkdir(l), await this.mount(l, a);
|
|
1679
1686
|
try {
|
|
1680
|
-
|
|
1687
|
+
c.chdir(n);
|
|
1681
1688
|
} catch (a) {
|
|
1682
1689
|
throw new Error(
|
|
1683
1690
|
`Failed to restore CWD to ${n} after PHP runtime rotation.`,
|
|
@@ -1702,10 +1709,10 @@ class PHP {
|
|
|
1702
1709
|
), s = {
|
|
1703
1710
|
mountHandler: e,
|
|
1704
1711
|
unmount: async () => {
|
|
1705
|
-
await r(), delete u(this,
|
|
1712
|
+
await r(), delete u(this, k)[t];
|
|
1706
1713
|
}
|
|
1707
1714
|
};
|
|
1708
|
-
return u(this,
|
|
1715
|
+
return u(this, k)[t] = s, () => {
|
|
1709
1716
|
s.unmount();
|
|
1710
1717
|
};
|
|
1711
1718
|
}
|
|
@@ -1727,7 +1734,7 @@ class PHP {
|
|
|
1727
1734
|
return this.subProcess(t, e);
|
|
1728
1735
|
u(this, H) && (u(this, _).needsRotating = !0);
|
|
1729
1736
|
const r = await this.semaphore.acquire();
|
|
1730
|
-
return await y(this, h,
|
|
1737
|
+
return await y(this, h, j).call(this, () => {
|
|
1731
1738
|
const s = e.env || {};
|
|
1732
1739
|
for (const [n, i] of Object.entries(s))
|
|
1733
1740
|
y(this, h, q).call(this, n, i);
|
|
@@ -1821,7 +1828,7 @@ class PHP {
|
|
|
1821
1828
|
this.exit(0);
|
|
1822
1829
|
}
|
|
1823
1830
|
}
|
|
1824
|
-
|
|
1831
|
+
M = new WeakMap(), H = new WeakMap(), T = new WeakMap(), E = new WeakMap(), F = new WeakMap(), k = new WeakMap(), _ = new WeakMap(), h = new WeakSet(), /**
|
|
1825
1832
|
* Prepares the $_SERVER entries for the PHP runtime.
|
|
1826
1833
|
*
|
|
1827
1834
|
* @param defaults Default entries to include in $_SERVER.
|
|
@@ -1943,36 +1950,36 @@ B = function(t, e, r) {
|
|
|
1943
1950
|
[STRING, STRING],
|
|
1944
1951
|
[t, e]
|
|
1945
1952
|
);
|
|
1946
|
-
},
|
|
1953
|
+
}, j = async function(t) {
|
|
1947
1954
|
u(this, _).enabled && u(this, _).needsRotating && await this.rotateRuntime(), ++u(this, _).requestsMade, u(this, _).requestsMade >= u(this, _).maxRequests && (u(this, _).needsRotating = !0);
|
|
1948
1955
|
const e = this[__private__dont__use], r = await createInvertedReadableStream();
|
|
1949
1956
|
e.onHeaders = (p) => {
|
|
1950
|
-
|
|
1957
|
+
c || s || r.controller.enqueue(p.slice());
|
|
1951
1958
|
};
|
|
1952
1959
|
let s = !1;
|
|
1953
1960
|
const n = () => {
|
|
1954
1961
|
s || (s = !0, r.controller.close());
|
|
1955
1962
|
}, i = await createInvertedReadableStream();
|
|
1956
1963
|
e.onStdout = (p) => {
|
|
1957
|
-
n(), !
|
|
1964
|
+
n(), !c && i.controller.enqueue(p.slice());
|
|
1958
1965
|
};
|
|
1959
1966
|
const o = await createInvertedReadableStream();
|
|
1960
1967
|
e.onStderr = (p) => {
|
|
1961
|
-
|
|
1968
|
+
c || o.controller.enqueue(p.slice());
|
|
1962
1969
|
};
|
|
1963
|
-
let
|
|
1970
|
+
let c = !1, a;
|
|
1964
1971
|
const d = (async () => {
|
|
1965
1972
|
var p;
|
|
1966
1973
|
try {
|
|
1967
1974
|
return await Promise.race([
|
|
1968
1975
|
t(),
|
|
1969
1976
|
new Promise((g, b) => {
|
|
1970
|
-
var
|
|
1971
|
-
|
|
1977
|
+
var D;
|
|
1978
|
+
a = (W) => {
|
|
1972
1979
|
isExitCode(W.error) || b(W.error);
|
|
1973
|
-
}, (
|
|
1980
|
+
}, (D = u(this, T)) == null || D.addEventListener(
|
|
1974
1981
|
"error",
|
|
1975
|
-
|
|
1982
|
+
a,
|
|
1976
1983
|
{ once: !0 }
|
|
1977
1984
|
);
|
|
1978
1985
|
})
|
|
@@ -1980,7 +1987,7 @@ B = function(t, e, r) {
|
|
|
1980
1987
|
} catch (f) {
|
|
1981
1988
|
if (isExitCode(f))
|
|
1982
1989
|
return f.status;
|
|
1983
|
-
i.controller.error(f), o.controller.error(f), r.controller.error(f),
|
|
1990
|
+
i.controller.error(f), o.controller.error(f), r.controller.error(f), c = !0;
|
|
1984
1991
|
for (const g in this)
|
|
1985
1992
|
typeof this[g] == "function" && (this[g] = () => {
|
|
1986
1993
|
throw new Error(
|
|
@@ -1989,9 +1996,9 @@ B = function(t, e, r) {
|
|
|
1989
1996
|
});
|
|
1990
1997
|
throw this.functionsMaybeMissingFromAsyncify = getFunctionsMaybeMissingFromAsyncify(), f;
|
|
1991
1998
|
} finally {
|
|
1992
|
-
|
|
1999
|
+
c || (i.controller.close(), o.controller.close(), n(), c = !0), (p = u(this, T)) == null || p.removeEventListener(
|
|
1993
2000
|
"error",
|
|
1994
|
-
|
|
2001
|
+
a
|
|
1995
2002
|
);
|
|
1996
2003
|
}
|
|
1997
2004
|
})().then(
|
|
@@ -2185,9 +2192,9 @@ async function* iteratePhpFiles(t, e, {
|
|
|
2185
2192
|
const o = i.pop();
|
|
2186
2193
|
if (!o)
|
|
2187
2194
|
return;
|
|
2188
|
-
const
|
|
2189
|
-
for (const
|
|
2190
|
-
const l = `${o}/${
|
|
2195
|
+
const c = await t.listFiles(o);
|
|
2196
|
+
for (const a of c) {
|
|
2197
|
+
const l = `${o}/${a}`;
|
|
2191
2198
|
if (n.includes(l.substring(e.length + 1)))
|
|
2192
2199
|
continue;
|
|
2193
2200
|
await t.isDir(l) ? i.push(l) : yield new StreamedFile(
|
|
@@ -2356,22 +2363,22 @@ function ensurePathPrefix(t, e) {
|
|
|
2356
2363
|
}
|
|
2357
2364
|
async function encodeAsMultipart(t) {
|
|
2358
2365
|
const e = `----${Math.random().toString(36).slice(2)}`, r = `multipart/form-data; boundary=${e}`, s = new TextEncoder(), n = [];
|
|
2359
|
-
for (const [
|
|
2366
|
+
for (const [a, l] of Object.entries(t))
|
|
2360
2367
|
n.push(`--${e}\r
|
|
2361
|
-
`), n.push(`Content-Disposition: form-data; name="${
|
|
2368
|
+
`), n.push(`Content-Disposition: form-data; name="${a}"`), l instanceof File && n.push(`; filename="${l.name}"`), n.push(`\r
|
|
2362
2369
|
`), l instanceof File && (n.push("Content-Type: application/octet-stream"), n.push(`\r
|
|
2363
2370
|
`)), n.push(`\r
|
|
2364
2371
|
`), l instanceof File ? n.push(await fileToUint8Array(l)) : n.push(l), n.push(`\r
|
|
2365
2372
|
`);
|
|
2366
2373
|
n.push(`--${e}--\r
|
|
2367
2374
|
`);
|
|
2368
|
-
const i = n.reduce((
|
|
2369
|
-
let
|
|
2370
|
-
for (const
|
|
2375
|
+
const i = n.reduce((a, l) => a + l.length, 0), o = new Uint8Array(i);
|
|
2376
|
+
let c = 0;
|
|
2377
|
+
for (const a of n)
|
|
2371
2378
|
o.set(
|
|
2372
|
-
typeof
|
|
2373
|
-
|
|
2374
|
-
),
|
|
2379
|
+
typeof a == "string" ? s.encode(a) : a,
|
|
2380
|
+
c
|
|
2381
|
+
), c += a.length;
|
|
2375
2382
|
return { bytes: o, contentType: r };
|
|
2376
2383
|
}
|
|
2377
2384
|
function fileToUint8Array(t) {
|
|
@@ -2473,7 +2480,7 @@ const _default = "application/octet-stream", asx = "video/x-ms-asf", atom = "app
|
|
|
2473
2480
|
xspf,
|
|
2474
2481
|
zip
|
|
2475
2482
|
};
|
|
2476
|
-
var S, I, L,
|
|
2483
|
+
var S, I, L, C, A, x, N, v, R, Z, ee, te;
|
|
2477
2484
|
class PHPRequestHandler {
|
|
2478
2485
|
/**
|
|
2479
2486
|
* The request handler needs to decide whether to serve a static asset or
|
|
@@ -2491,7 +2498,7 @@ class PHPRequestHandler {
|
|
|
2491
2498
|
m(this, S);
|
|
2492
2499
|
m(this, I);
|
|
2493
2500
|
m(this, L);
|
|
2494
|
-
m(this,
|
|
2501
|
+
m(this, C);
|
|
2495
2502
|
m(this, A);
|
|
2496
2503
|
m(this, x);
|
|
2497
2504
|
m(this, N);
|
|
@@ -2503,9 +2510,9 @@ class PHPRequestHandler {
|
|
|
2503
2510
|
getFileNotFoundAction: i = () => ({ type: "404" })
|
|
2504
2511
|
} = e;
|
|
2505
2512
|
"processManager" in e ? this.processManager = e.processManager : this.processManager = new PHPProcessManager({
|
|
2506
|
-
phpFactory: async (
|
|
2513
|
+
phpFactory: async (a) => {
|
|
2507
2514
|
const l = await e.phpFactory({
|
|
2508
|
-
...
|
|
2515
|
+
...a,
|
|
2509
2516
|
requestHandler: this
|
|
2510
2517
|
});
|
|
2511
2518
|
return l.isDir(r) || l.mkdir(r), l.chdir(r), l.requestHandler = this, l;
|
|
@@ -2513,11 +2520,11 @@ class PHPRequestHandler {
|
|
|
2513
2520
|
maxPhpInstances: e.maxPhpInstances
|
|
2514
2521
|
}), w(this, v, e.cookieStore === void 0 ? new HttpCookieStore() : e.cookieStore), w(this, S, r);
|
|
2515
2522
|
const o = new URL(s);
|
|
2516
|
-
w(this, L, o.hostname), w(this,
|
|
2517
|
-
const
|
|
2523
|
+
w(this, L, o.hostname), w(this, C, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), w(this, I, (o.protocol || "").replace(":", ""));
|
|
2524
|
+
const c = u(this, C) !== 443 && u(this, C) !== 80;
|
|
2518
2525
|
w(this, A, [
|
|
2519
2526
|
u(this, L),
|
|
2520
|
-
|
|
2527
|
+
c ? `:${u(this, C)}` : ""
|
|
2521
2528
|
].join("")), w(this, x, o.pathname.replace(/\/+$/, "")), w(this, N, [
|
|
2522
2529
|
`${u(this, I)}://`,
|
|
2523
2530
|
u(this, A),
|
|
@@ -2629,46 +2636,46 @@ class PHPRequestHandler {
|
|
|
2629
2636
|
{ Location: [`${s.pathname}/`] },
|
|
2630
2637
|
new Uint8Array(0)
|
|
2631
2638
|
);
|
|
2632
|
-
for (const
|
|
2633
|
-
const
|
|
2634
|
-
if (i.isFile(
|
|
2635
|
-
o =
|
|
2639
|
+
for (const c of ["index.php", "index.html"]) {
|
|
2640
|
+
const a = joinPaths(o, c);
|
|
2641
|
+
if (i.isFile(a)) {
|
|
2642
|
+
o = a;
|
|
2636
2643
|
break;
|
|
2637
2644
|
}
|
|
2638
2645
|
}
|
|
2639
2646
|
}
|
|
2640
2647
|
if (!i.isFile(o)) {
|
|
2641
|
-
const
|
|
2648
|
+
const c = this.getFileNotFoundAction(
|
|
2642
2649
|
n
|
|
2643
2650
|
);
|
|
2644
|
-
switch (
|
|
2651
|
+
switch (c.type) {
|
|
2645
2652
|
case "response":
|
|
2646
|
-
return
|
|
2653
|
+
return c.response;
|
|
2647
2654
|
case "internal-redirect":
|
|
2648
|
-
o = joinPaths(u(this, S),
|
|
2655
|
+
o = joinPaths(u(this, S), c.uri);
|
|
2649
2656
|
break;
|
|
2650
2657
|
case "404":
|
|
2651
2658
|
return PHPResponse.forHttpCode(404);
|
|
2652
2659
|
default:
|
|
2653
2660
|
throw new Error(
|
|
2654
|
-
`Unsupported file-not-found action type: '${
|
|
2661
|
+
`Unsupported file-not-found action type: '${c.type}'`
|
|
2655
2662
|
);
|
|
2656
2663
|
}
|
|
2657
2664
|
}
|
|
2658
2665
|
if (i.isFile(o))
|
|
2659
2666
|
if (o.endsWith(".php")) {
|
|
2660
|
-
const
|
|
2667
|
+
const c = {
|
|
2661
2668
|
...e,
|
|
2662
2669
|
// Pass along URL with the #fragment filtered out
|
|
2663
2670
|
url: s.toString()
|
|
2664
|
-
},
|
|
2665
|
-
return
|
|
2671
|
+
}, a = await y(this, R, ee).call(this, c, o);
|
|
2672
|
+
return a.ok() && a.exitCode !== 0 ? new PHPResponse(
|
|
2666
2673
|
500,
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
) :
|
|
2674
|
+
a.headers,
|
|
2675
|
+
a.bytes,
|
|
2676
|
+
a.errors,
|
|
2677
|
+
a.exitCode
|
|
2678
|
+
) : a;
|
|
2672
2679
|
} else
|
|
2673
2680
|
return y(this, R, Z).call(this, i, o);
|
|
2674
2681
|
else
|
|
@@ -2678,7 +2685,7 @@ class PHPRequestHandler {
|
|
|
2678
2685
|
await this.processManager[Symbol.asyncDispose]();
|
|
2679
2686
|
}
|
|
2680
2687
|
}
|
|
2681
|
-
S = new WeakMap(), I = new WeakMap(), L = new WeakMap(),
|
|
2688
|
+
S = new WeakMap(), I = new WeakMap(), L = new WeakMap(), C = new WeakMap(), A = new WeakMap(), x = new WeakMap(), N = new WeakMap(), v = new WeakMap(), R = new WeakSet(), /**
|
|
2682
2689
|
* Serves a static file from the PHP filesystem.
|
|
2683
2690
|
*
|
|
2684
2691
|
* @param fsPath - Absolute path of the static file to serve.
|
|
@@ -2723,11 +2730,11 @@ Z = function(e, r) {
|
|
|
2723
2730
|
let o = r.body;
|
|
2724
2731
|
if (typeof o == "object" && !(o instanceof Uint8Array)) {
|
|
2725
2732
|
n = "POST";
|
|
2726
|
-
const { bytes:
|
|
2727
|
-
o =
|
|
2733
|
+
const { bytes: c, contentType: a } = await encodeAsMultipart(o);
|
|
2734
|
+
o = c, i["content-type"] = a;
|
|
2728
2735
|
}
|
|
2729
2736
|
try {
|
|
2730
|
-
const
|
|
2737
|
+
const c = await e.run({
|
|
2731
2738
|
relativeUri: ensurePathPrefix(
|
|
2732
2739
|
toRelativeUrl(new URL(r.url)),
|
|
2733
2740
|
u(this, x)
|
|
@@ -2744,13 +2751,13 @@ Z = function(e, r) {
|
|
|
2744
2751
|
headers: i
|
|
2745
2752
|
});
|
|
2746
2753
|
return u(this, v) && u(this, v).rememberCookiesFromResponseHeaders(
|
|
2747
|
-
|
|
2748
|
-
),
|
|
2749
|
-
} catch (
|
|
2750
|
-
const
|
|
2751
|
-
if (
|
|
2752
|
-
return
|
|
2753
|
-
throw
|
|
2754
|
+
c.headers
|
|
2755
|
+
), c;
|
|
2756
|
+
} catch (c) {
|
|
2757
|
+
const a = c;
|
|
2758
|
+
if (a != null && a.response)
|
|
2759
|
+
return a.response;
|
|
2760
|
+
throw c;
|
|
2754
2761
|
}
|
|
2755
2762
|
};
|
|
2756
2763
|
function inferMimeType(t) {
|
|
@@ -2808,11 +2815,11 @@ function sandboxedSpawnHandlerFactory(t) {
|
|
|
2808
2815
|
else if (n === "tput" && e[1] === "cols")
|
|
2809
2816
|
r.stdout("140"), r.exit(0);
|
|
2810
2817
|
else if (n === "less") {
|
|
2811
|
-
r.on("stdin", (
|
|
2812
|
-
r.stdout(
|
|
2813
|
-
}), await new Promise((
|
|
2818
|
+
r.on("stdin", (c) => {
|
|
2819
|
+
r.stdout(c);
|
|
2820
|
+
}), await new Promise((c) => {
|
|
2814
2821
|
r.childProcess.stdin.on("finish", () => {
|
|
2815
|
-
|
|
2822
|
+
c(!0);
|
|
2816
2823
|
});
|
|
2817
2824
|
}), r.exit(0);
|
|
2818
2825
|
return;
|
|
@@ -2826,10 +2833,10 @@ function sandboxedSpawnHandlerFactory(t) {
|
|
|
2826
2833
|
});
|
|
2827
2834
|
try {
|
|
2828
2835
|
s.cwd && i.chdir(s.cwd);
|
|
2829
|
-
const
|
|
2836
|
+
const c = i.cwd();
|
|
2830
2837
|
switch (n) {
|
|
2831
2838
|
case "php": {
|
|
2832
|
-
const
|
|
2839
|
+
const a = await i.cli(e, {
|
|
2833
2840
|
env: {
|
|
2834
2841
|
...s.env,
|
|
2835
2842
|
SCRIPT_PATH: e[1],
|
|
@@ -2839,37 +2846,37 @@ function sandboxedSpawnHandlerFactory(t) {
|
|
|
2839
2846
|
SHELL_PIPE: "0"
|
|
2840
2847
|
}
|
|
2841
2848
|
});
|
|
2842
|
-
|
|
2849
|
+
a.stdout.pipeTo(
|
|
2843
2850
|
new WritableStream({
|
|
2844
2851
|
write(l) {
|
|
2845
2852
|
r.stdout(l);
|
|
2846
2853
|
}
|
|
2847
2854
|
})
|
|
2848
|
-
),
|
|
2855
|
+
), a.stderr.pipeTo(
|
|
2849
2856
|
new WritableStream({
|
|
2850
2857
|
write(l) {
|
|
2851
2858
|
r.stderr(l);
|
|
2852
2859
|
}
|
|
2853
2860
|
})
|
|
2854
|
-
), r.exit(await
|
|
2861
|
+
), r.exit(await a.exitCode);
|
|
2855
2862
|
break;
|
|
2856
2863
|
}
|
|
2857
2864
|
case "ls": {
|
|
2858
|
-
const
|
|
2859
|
-
for (const l of
|
|
2865
|
+
const a = i.listFiles(e[1] ?? c);
|
|
2866
|
+
for (const l of a)
|
|
2860
2867
|
r.stdout(l + `
|
|
2861
2868
|
`);
|
|
2862
2869
|
await new Promise((l) => setTimeout(l, 10)), r.exit(0);
|
|
2863
2870
|
break;
|
|
2864
2871
|
}
|
|
2865
2872
|
case "pwd": {
|
|
2866
|
-
r.stdout(
|
|
2867
|
-
`), await new Promise((
|
|
2873
|
+
r.stdout(c + `
|
|
2874
|
+
`), await new Promise((a) => setTimeout(a, 10)), r.exit(0);
|
|
2868
2875
|
break;
|
|
2869
2876
|
}
|
|
2870
2877
|
}
|
|
2871
|
-
} catch (
|
|
2872
|
-
throw r.exit(1),
|
|
2878
|
+
} catch (c) {
|
|
2879
|
+
throw r.exit(1), c;
|
|
2873
2880
|
} finally {
|
|
2874
2881
|
o();
|
|
2875
2882
|
}
|
|
@@ -2887,7 +2894,7 @@ function createSyncProxy(t, e = [], r) {
|
|
|
2887
2894
|
} : createSyncProxy(t, [...e, n], r);
|
|
2888
2895
|
},
|
|
2889
2896
|
set(s, n, i) {
|
|
2890
|
-
const [o,
|
|
2897
|
+
const [o, c] = toWireValue(i);
|
|
2891
2898
|
return r.send(
|
|
2892
2899
|
t,
|
|
2893
2900
|
{
|
|
@@ -2895,25 +2902,25 @@ function createSyncProxy(t, e = [], r) {
|
|
|
2895
2902
|
path: [...e, n].map(String),
|
|
2896
2903
|
value: o
|
|
2897
2904
|
},
|
|
2898
|
-
|
|
2905
|
+
c
|
|
2899
2906
|
), !0;
|
|
2900
2907
|
},
|
|
2901
2908
|
apply(s, n, i) {
|
|
2902
2909
|
if (e.at(-1) === "bind")
|
|
2903
2910
|
return createSyncProxy(t, e.slice(0, -1), r);
|
|
2904
|
-
const [
|
|
2911
|
+
const [c, a] = processArguments(i), l = r.send(
|
|
2905
2912
|
t,
|
|
2906
2913
|
{
|
|
2907
2914
|
type: MessageType.APPLY,
|
|
2908
2915
|
path: e.map(String),
|
|
2909
|
-
argumentList:
|
|
2916
|
+
argumentList: c
|
|
2910
2917
|
},
|
|
2911
|
-
|
|
2918
|
+
a
|
|
2912
2919
|
);
|
|
2913
2920
|
return fromWireValue(l);
|
|
2914
2921
|
},
|
|
2915
2922
|
construct(s, n) {
|
|
2916
|
-
const [i, o] = processArguments(n),
|
|
2923
|
+
const [i, o] = processArguments(n), c = r.send(
|
|
2917
2924
|
t,
|
|
2918
2925
|
{
|
|
2919
2926
|
type: MessageType.CONSTRUCT,
|
|
@@ -2922,7 +2929,7 @@ function createSyncProxy(t, e = [], r) {
|
|
|
2922
2929
|
},
|
|
2923
2930
|
o
|
|
2924
2931
|
);
|
|
2925
|
-
return fromWireValue(
|
|
2932
|
+
return fromWireValue(c);
|
|
2926
2933
|
}
|
|
2927
2934
|
});
|
|
2928
2935
|
}
|
|
@@ -3038,19 +3045,19 @@ function expose(t, e = globalThis, r = ["*"], s) {
|
|
|
3038
3045
|
console.warn(`Invalid origin '${i.origin}' for comlink proxy`);
|
|
3039
3046
|
return;
|
|
3040
3047
|
}
|
|
3041
|
-
const { id: o, type:
|
|
3048
|
+
const { id: o, type: c, path: a } = {
|
|
3042
3049
|
path: [],
|
|
3043
3050
|
...i.data
|
|
3044
3051
|
}, l = (i.data.argumentList || []).map(fromWireValue);
|
|
3045
3052
|
let d;
|
|
3046
3053
|
try {
|
|
3047
|
-
const p =
|
|
3048
|
-
switch (
|
|
3054
|
+
const p = a.slice(0, -1).reduce((g, b) => g[b], t), f = a.reduce((g, b) => g[b], t);
|
|
3055
|
+
switch (c) {
|
|
3049
3056
|
case MessageType.GET:
|
|
3050
3057
|
d = f;
|
|
3051
3058
|
break;
|
|
3052
3059
|
case MessageType.SET:
|
|
3053
|
-
p[
|
|
3060
|
+
p[a.slice(-1)[0]] = fromWireValue(
|
|
3054
3061
|
i.data.value
|
|
3055
3062
|
), d = !0;
|
|
3056
3063
|
break;
|
|
@@ -3080,7 +3087,7 @@ function expose(t, e = globalThis, r = ["*"], s) {
|
|
|
3080
3087
|
}
|
|
3081
3088
|
Promise.resolve(d).catch((p) => ({ value: p, [throwMarker]: 0 })).then((p) => {
|
|
3082
3089
|
const [f, g] = toWireValue(p);
|
|
3083
|
-
e.postMessage({ ...f, id: o }, g),
|
|
3090
|
+
e.postMessage({ ...f, id: o }, g), c === MessageType.RELEASE && (e.removeEventListener("message", n), closeEndPoint(e), finalizer in t && typeof t[finalizer] == "function" && t[finalizer]());
|
|
3084
3091
|
}).catch(() => {
|
|
3085
3092
|
const [p, f] = toWireValue({
|
|
3086
3093
|
value: new TypeError("Unserializable return value"),
|
|
@@ -3139,37 +3146,37 @@ function createProxy(t, e, r = [], s = function() {
|
|
|
3139
3146
|
}) {
|
|
3140
3147
|
let n = !1;
|
|
3141
3148
|
const i = new Proxy(s, {
|
|
3142
|
-
get(o,
|
|
3143
|
-
if (throwIfProxyReleased(n),
|
|
3149
|
+
get(o, c) {
|
|
3150
|
+
if (throwIfProxyReleased(n), c === releaseProxy)
|
|
3144
3151
|
return () => {
|
|
3145
3152
|
unregisterProxy(i), releaseEndpoint(t), e.clear(), n = !0;
|
|
3146
3153
|
};
|
|
3147
|
-
if (
|
|
3154
|
+
if (c === "then") {
|
|
3148
3155
|
if (r.length === 0)
|
|
3149
3156
|
return { then: () => i };
|
|
3150
|
-
const
|
|
3157
|
+
const a = requestResponseMessage(t, e, {
|
|
3151
3158
|
type: MessageType.GET,
|
|
3152
3159
|
path: r.map((l) => l.toString())
|
|
3153
3160
|
}).then(fromWireValue);
|
|
3154
|
-
return
|
|
3161
|
+
return a.then.bind(a);
|
|
3155
3162
|
}
|
|
3156
|
-
return createProxy(t, e, [...r,
|
|
3163
|
+
return createProxy(t, e, [...r, c]);
|
|
3157
3164
|
},
|
|
3158
|
-
set(o,
|
|
3165
|
+
set(o, c, a) {
|
|
3159
3166
|
throwIfProxyReleased(n);
|
|
3160
|
-
const [l, d] = toWireValue(
|
|
3167
|
+
const [l, d] = toWireValue(a);
|
|
3161
3168
|
return requestResponseMessage(
|
|
3162
3169
|
t,
|
|
3163
3170
|
e,
|
|
3164
3171
|
{
|
|
3165
3172
|
type: MessageType.SET,
|
|
3166
|
-
path: [...r,
|
|
3173
|
+
path: [...r, c].map((p) => p.toString()),
|
|
3167
3174
|
value: l
|
|
3168
3175
|
},
|
|
3169
3176
|
d
|
|
3170
3177
|
).then(fromWireValue);
|
|
3171
3178
|
},
|
|
3172
|
-
apply(o,
|
|
3179
|
+
apply(o, c, a) {
|
|
3173
3180
|
throwIfProxyReleased(n);
|
|
3174
3181
|
const l = r[r.length - 1];
|
|
3175
3182
|
if (l === createEndpoint)
|
|
@@ -3178,7 +3185,7 @@ function createProxy(t, e, r = [], s = function() {
|
|
|
3178
3185
|
}).then(fromWireValue);
|
|
3179
3186
|
if (l === "bind")
|
|
3180
3187
|
return createProxy(t, e, r.slice(0, -1));
|
|
3181
|
-
const [d, p] = processArguments(
|
|
3188
|
+
const [d, p] = processArguments(a);
|
|
3182
3189
|
return requestResponseMessage(
|
|
3183
3190
|
t,
|
|
3184
3191
|
e,
|
|
@@ -3190,16 +3197,16 @@ function createProxy(t, e, r = [], s = function() {
|
|
|
3190
3197
|
p
|
|
3191
3198
|
).then(fromWireValue);
|
|
3192
3199
|
},
|
|
3193
|
-
construct(o,
|
|
3200
|
+
construct(o, c) {
|
|
3194
3201
|
throwIfProxyReleased(n);
|
|
3195
|
-
const [
|
|
3202
|
+
const [a, l] = processArguments(c);
|
|
3196
3203
|
return requestResponseMessage(
|
|
3197
3204
|
t,
|
|
3198
3205
|
e,
|
|
3199
3206
|
{
|
|
3200
3207
|
type: MessageType.CONSTRUCT,
|
|
3201
3208
|
path: r.map((d) => d.toString()),
|
|
3202
|
-
argumentList:
|
|
3209
|
+
argumentList: a
|
|
3203
3210
|
},
|
|
3204
3211
|
l
|
|
3205
3212
|
).then(fromWireValue);
|
|
@@ -3354,20 +3361,20 @@ const errorProperties = [
|
|
|
3354
3361
|
maxDepth: n,
|
|
3355
3362
|
depth: i,
|
|
3356
3363
|
useToJSON: o,
|
|
3357
|
-
serialize:
|
|
3364
|
+
serialize: c
|
|
3358
3365
|
}) => {
|
|
3359
|
-
if (r || (Array.isArray(t) ? r = [] : !
|
|
3366
|
+
if (r || (Array.isArray(t) ? r = [] : !c && isErrorLike(t) ? r = newError(t.name) : r = {}), e.push(t), i >= n)
|
|
3360
3367
|
return r;
|
|
3361
3368
|
if (o && typeof t.toJSON == "function" && !toJsonWasCalled.has(t))
|
|
3362
3369
|
return toJSON(t);
|
|
3363
|
-
const
|
|
3370
|
+
const a = (l) => destroyCircular({
|
|
3364
3371
|
from: l,
|
|
3365
3372
|
seen: [...e],
|
|
3366
3373
|
forceEnumerable: s,
|
|
3367
3374
|
maxDepth: n,
|
|
3368
3375
|
depth: i,
|
|
3369
3376
|
useToJSON: o,
|
|
3370
|
-
serialize:
|
|
3377
|
+
serialize: c
|
|
3371
3378
|
});
|
|
3372
3379
|
for (const [l, d] of Object.entries(t)) {
|
|
3373
3380
|
if (d && d instanceof Uint8Array && d.constructor.name === "Buffer") {
|
|
@@ -3387,16 +3394,16 @@ const errorProperties = [
|
|
|
3387
3394
|
continue;
|
|
3388
3395
|
}
|
|
3389
3396
|
if (!e.includes(t[l])) {
|
|
3390
|
-
i++, r[l] =
|
|
3397
|
+
i++, r[l] = a(t[l]);
|
|
3391
3398
|
continue;
|
|
3392
3399
|
}
|
|
3393
3400
|
r[l] = "[Circular]";
|
|
3394
3401
|
}
|
|
3395
3402
|
}
|
|
3396
|
-
if (
|
|
3403
|
+
if (c || r instanceof Error)
|
|
3397
3404
|
for (const { property: l, enumerable: d } of errorProperties)
|
|
3398
3405
|
t[l] !== void 0 && t[l] !== null && Object.defineProperty(r, l, {
|
|
3399
|
-
value: isErrorLike(t[l]) || Array.isArray(t[l]) ?
|
|
3406
|
+
value: isErrorLike(t[l]) || Array.isArray(t[l]) ? a(t[l]) : t[l],
|
|
3400
3407
|
enumerable: s ? !0 : d,
|
|
3401
3408
|
configurable: !0,
|
|
3402
3409
|
writable: !0
|
|
@@ -3443,14 +3450,14 @@ function consumeAPI(t, e = void 0) {
|
|
|
3443
3450
|
import.meta.url.startsWith("file://") ? r = nodeEndpoint(t) : r = t instanceof Worker ? t : windowEndpoint(t, e);
|
|
3444
3451
|
const n = wrap(r), i = proxyClone(n);
|
|
3445
3452
|
return new Proxy(i, {
|
|
3446
|
-
get: (o,
|
|
3453
|
+
get: (o, c) => c === "isConnected" ? async () => {
|
|
3447
3454
|
for (; ; )
|
|
3448
3455
|
try {
|
|
3449
3456
|
await runWithTimeout(n.isConnected(), 200);
|
|
3450
3457
|
break;
|
|
3451
3458
|
} catch {
|
|
3452
3459
|
}
|
|
3453
|
-
} : n[
|
|
3460
|
+
} : n[c]
|
|
3454
3461
|
});
|
|
3455
3462
|
}
|
|
3456
3463
|
async function runWithTimeout(t, e) {
|
|
@@ -3474,12 +3481,12 @@ function prepareForExpose(t, e) {
|
|
|
3474
3481
|
setupTransferHandlers();
|
|
3475
3482
|
const r = Promise.resolve();
|
|
3476
3483
|
let s, n;
|
|
3477
|
-
const i = new Promise((
|
|
3478
|
-
s =
|
|
3479
|
-
}), o = proxyClone(t),
|
|
3480
|
-
get: (
|
|
3484
|
+
const i = new Promise((a, l) => {
|
|
3485
|
+
s = a, n = l;
|
|
3486
|
+
}), o = proxyClone(t), c = new Proxy(o, {
|
|
3487
|
+
get: (a, l) => l === "isConnected" ? () => r : l === "isReady" ? () => i : l in a ? a[l] : e == null ? void 0 : e[l]
|
|
3481
3488
|
});
|
|
3482
|
-
return { setReady: s, setFailed: n, exposedApi:
|
|
3489
|
+
return { setReady: s, setFailed: n, exposedApi: c };
|
|
3483
3490
|
}
|
|
3484
3491
|
let isTransferHandlersSetup = !1;
|
|
3485
3492
|
function setupTransferHandlers() {
|
|
@@ -3538,28 +3545,28 @@ function setupTransferHandlers() {
|
|
|
3538
3545
|
stderr: r.stderr,
|
|
3539
3546
|
exitCodePort: n
|
|
3540
3547
|
}, [n]];
|
|
3541
|
-
const i = streamToPort(r.headersStream), o = streamToPort(r.stdout),
|
|
3548
|
+
const i = streamToPort(r.headersStream), o = streamToPort(r.stdout), c = streamToPort(r.stderr);
|
|
3542
3549
|
return [
|
|
3543
3550
|
{
|
|
3544
3551
|
__type: "StreamedPHPResponse",
|
|
3545
3552
|
headersPort: i,
|
|
3546
3553
|
stdoutPort: o,
|
|
3547
|
-
stderrPort:
|
|
3554
|
+
stderrPort: c,
|
|
3548
3555
|
exitCodePort: n
|
|
3549
3556
|
},
|
|
3550
|
-
[i, o,
|
|
3557
|
+
[i, o, c, n]
|
|
3551
3558
|
];
|
|
3552
3559
|
},
|
|
3553
3560
|
deserialize(r) {
|
|
3554
3561
|
if (r.headers && r.stdout && r.stderr) {
|
|
3555
|
-
const
|
|
3562
|
+
const c = portToPromise(
|
|
3556
3563
|
r.exitCodePort
|
|
3557
3564
|
);
|
|
3558
3565
|
return new StreamedPHPResponse(
|
|
3559
3566
|
r.headers,
|
|
3560
3567
|
r.stdout,
|
|
3561
3568
|
r.stderr,
|
|
3562
|
-
|
|
3569
|
+
c
|
|
3563
3570
|
);
|
|
3564
3571
|
}
|
|
3565
3572
|
const s = portToStream(r.headersPort), n = portToStream(r.stdoutPort), i = portToStream(r.stderrPort), o = portToPromise(r.exitCodePort);
|
|
@@ -3600,10 +3607,10 @@ function streamToPort(t) {
|
|
|
3600
3607
|
break;
|
|
3601
3608
|
}
|
|
3602
3609
|
if (i) {
|
|
3603
|
-
const o = i.byteOffset === 0 && i.byteLength === i.buffer.byteLength ? i : i.slice(),
|
|
3610
|
+
const o = i.byteOffset === 0 && i.byteLength === i.buffer.byteLength ? i : i.slice(), c = o.buffer;
|
|
3604
3611
|
try {
|
|
3605
|
-
e.postMessage({ t: "chunk", b:
|
|
3606
|
-
|
|
3612
|
+
e.postMessage({ t: "chunk", b: c }, [
|
|
3613
|
+
c
|
|
3607
3614
|
]);
|
|
3608
3615
|
} catch {
|
|
3609
3616
|
e.postMessage({
|