@php-wasm/universal 3.1.30 → 3.1.31
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/README.md +7 -6
- package/index.cjs +10 -11
- package/index.cjs.map +1 -1
- package/index.js +1331 -1038
- package/index.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/load-extension.d.ts +20 -4
- package/package.json +6 -6
- package/php-extension-manifest-schema-validator.js +1362 -941
- package/php-extension-manifest-schema.json +38 -0
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ge = (r) => {
|
|
2
2
|
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var pe = (r, e, t) => e.has(r) || ge("Cannot " + t);
|
|
5
|
+
var p = (r, e, t) => (pe(r, e, "read from private field"), t ? t.call(r) : e.get(r)), E = (r, e, t) => e.has(r) ? ge("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), x = (r, e, t, s) => (pe(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), _ = (r, e, t) => (pe(r, e, "access private method"), t);
|
|
6
6
|
import { logger } from "@php-wasm/logger";
|
|
7
7
|
import { dirname, joinPaths, Semaphore, createSpawnHandler, basename, normalizePath, AcquireTimeoutError, splitShellCommand } from "@php-wasm/util";
|
|
8
8
|
import { parse, stringify } from "ini";
|
|
@@ -102,12 +102,12 @@ function rethrowFileSystemError(r = "") {
|
|
|
102
102
|
try {
|
|
103
103
|
return t.apply(this, s);
|
|
104
104
|
} catch (n) {
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
105
|
+
const o = typeof n == "object" ? n == null ? void 0 : n.errno : null;
|
|
106
|
+
if (o in FileErrorCodes) {
|
|
107
|
+
const i = FileErrorCodes[o], a = typeof s[1] == "string" ? s[1] : null, c = a !== null ? r.replaceAll("{path}", a) : r;
|
|
108
108
|
throw new ErrnoError(
|
|
109
|
-
|
|
110
|
-
`${c}: ${
|
|
109
|
+
o,
|
|
110
|
+
`${c}: ${i}`,
|
|
111
111
|
{
|
|
112
112
|
cause: n
|
|
113
113
|
}
|
|
@@ -172,12 +172,12 @@ class FSHelpers {
|
|
|
172
172
|
*/
|
|
173
173
|
static mv(e, t, s) {
|
|
174
174
|
try {
|
|
175
|
-
const n = e.lookupPath(t).node.mount,
|
|
176
|
-
n.mountpoint !==
|
|
175
|
+
const n = e.lookupPath(t).node.mount, o = FSHelpers.fileExists(e, s) ? e.lookupPath(s).node.mount : e.lookupPath(dirname(s)).node.mount;
|
|
176
|
+
n.mountpoint !== o.mountpoint ? (FSHelpers.copyRecursive(e, t, s), FSHelpers.isDir(e, t) ? FSHelpers.rmdir(e, t, { recursive: !0 }) : e.unlink(t)) : e.rename(t, s);
|
|
177
177
|
} catch (n) {
|
|
178
|
-
const
|
|
179
|
-
throw
|
|
180
|
-
`Could not move ${t} to ${s}: ${
|
|
178
|
+
const o = getEmscriptenFsError(n);
|
|
179
|
+
throw o ? new Error(
|
|
180
|
+
`Could not move ${t} to ${s}: ${o}`,
|
|
181
181
|
{
|
|
182
182
|
cause: n
|
|
183
183
|
}
|
|
@@ -195,9 +195,9 @@ class FSHelpers {
|
|
|
195
195
|
const n = e.lookupPath(t, { follow: !1 });
|
|
196
196
|
if ((n == null ? void 0 : n.node.mount.mountpoint) === t)
|
|
197
197
|
throw new ErrnoError(10);
|
|
198
|
-
s != null && s.recursive && FSHelpers.listFiles(e, t).forEach((
|
|
199
|
-
const
|
|
200
|
-
FSHelpers.isDir(e,
|
|
198
|
+
s != null && s.recursive && FSHelpers.listFiles(e, t).forEach((o) => {
|
|
199
|
+
const i = `${t}/${o}`;
|
|
200
|
+
FSHelpers.isDir(e, i) ? FSHelpers.rmdir(e, i, s) : FSHelpers.unlink(e, i);
|
|
201
201
|
}), e.getPath(e.lookupPath(t).node) === e.cwd() && e.chdir(joinPaths(e.cwd(), "..")), e.rmdir(t);
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
@@ -213,11 +213,11 @@ class FSHelpers {
|
|
|
213
213
|
return [];
|
|
214
214
|
try {
|
|
215
215
|
const n = e.readdir(t).filter(
|
|
216
|
-
(
|
|
216
|
+
(o) => o !== "." && o !== ".."
|
|
217
217
|
);
|
|
218
218
|
if (s.prependPath) {
|
|
219
|
-
const
|
|
220
|
-
return n.map((
|
|
219
|
+
const o = t.replace(/\/$/, "");
|
|
220
|
+
return n.map((i) => `${o}/${i}`);
|
|
221
221
|
}
|
|
222
222
|
return n;
|
|
223
223
|
} catch (n) {
|
|
@@ -316,20 +316,20 @@ class FSHelpers {
|
|
|
316
316
|
if (t === s || s.startsWith(`${t}/`))
|
|
317
317
|
throw new ErrnoError(28);
|
|
318
318
|
e.mkdirTree(s);
|
|
319
|
-
const
|
|
320
|
-
(
|
|
319
|
+
const o = e.readdir(t).filter(
|
|
320
|
+
(i) => i !== "." && i !== ".."
|
|
321
321
|
);
|
|
322
|
-
for (const
|
|
322
|
+
for (const i of o)
|
|
323
323
|
FSHelpers.copyRecursive(
|
|
324
324
|
e,
|
|
325
|
-
joinPaths(t,
|
|
326
|
-
joinPaths(s,
|
|
325
|
+
joinPaths(t, i),
|
|
326
|
+
joinPaths(s, i)
|
|
327
327
|
);
|
|
328
328
|
} else e.isLink(n.mode) ? e.symlink(e.readlink(t), s) : e.writeFile(s, e.readFile(t));
|
|
329
329
|
} catch (n) {
|
|
330
|
-
const
|
|
331
|
-
throw
|
|
332
|
-
`Could not copy ${t} to ${s}: ${
|
|
330
|
+
const o = getEmscriptenFsError(n);
|
|
331
|
+
throw o ? new Error(
|
|
332
|
+
`Could not copy ${t} to ${s}: ${o}`,
|
|
333
333
|
{
|
|
334
334
|
cause: n
|
|
335
335
|
}
|
|
@@ -371,12 +371,12 @@ FSHelpers.mkdir = rethrowFileSystemError('Could not create directory "{path}"')(
|
|
|
371
371
|
FSHelpers.mkdir
|
|
372
372
|
);
|
|
373
373
|
const _private = /* @__PURE__ */ new WeakMap();
|
|
374
|
-
var
|
|
374
|
+
var j;
|
|
375
375
|
class PHPWorker {
|
|
376
376
|
/** @inheritDoc */
|
|
377
377
|
constructor(e, t) {
|
|
378
|
-
|
|
379
|
-
this.absoluteUrl = "", this.documentRoot = "", this.chroot = null,
|
|
378
|
+
E(this, j);
|
|
379
|
+
this.absoluteUrl = "", this.documentRoot = "", this.chroot = null, x(this, j, /* @__PURE__ */ new Map()), this.onMessageListeners = [], _private.set(this, {
|
|
380
380
|
monitor: t
|
|
381
381
|
}), e && this.__internal_setRequestHandler(e);
|
|
382
382
|
}
|
|
@@ -457,11 +457,11 @@ class PHPWorker {
|
|
|
457
457
|
const t = _private.get(this), s = t.php;
|
|
458
458
|
if (!t.requestHandler && !(s != null && s.requestHandler) && s)
|
|
459
459
|
return await s.run(e);
|
|
460
|
-
const { php: n, reap:
|
|
460
|
+
const { php: n, reap: o } = await this.acquirePHPInstance();
|
|
461
461
|
try {
|
|
462
462
|
return await n.run(e);
|
|
463
463
|
} finally {
|
|
464
|
-
|
|
464
|
+
o();
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
/** @inheritDoc @php-wasm/universal!/PHP.cli */
|
|
@@ -469,14 +469,14 @@ class PHPWorker {
|
|
|
469
469
|
const s = _private.get(this), n = s.php;
|
|
470
470
|
if (!s.requestHandler && !(n != null && n.requestHandler) && n)
|
|
471
471
|
return await n.cli(e, t);
|
|
472
|
-
const { php:
|
|
472
|
+
const { php: o, reap: i } = await this.acquirePHPInstance();
|
|
473
473
|
let a;
|
|
474
474
|
try {
|
|
475
|
-
a = await
|
|
475
|
+
a = await o.cli(e, t);
|
|
476
476
|
} catch (c) {
|
|
477
|
-
throw
|
|
477
|
+
throw i(), c;
|
|
478
478
|
}
|
|
479
|
-
return a.finished.finally(
|
|
479
|
+
return a.finished.finally(i), a;
|
|
480
480
|
}
|
|
481
481
|
/** @inheritDoc @php-wasm/universal!/PHP.chdir */
|
|
482
482
|
chdir(e) {
|
|
@@ -551,7 +551,7 @@ class PHPWorker {
|
|
|
551
551
|
}
|
|
552
552
|
/** @inheritDoc @php-wasm/universal!/PHP.addEventListener */
|
|
553
553
|
addEventListener(e, t) {
|
|
554
|
-
|
|
554
|
+
p(this, j).has(e) || p(this, j).set(e, /* @__PURE__ */ new Set()), p(this, j).get(e).add(t);
|
|
555
555
|
}
|
|
556
556
|
/**
|
|
557
557
|
* Removes an event listener for a PHP event.
|
|
@@ -560,10 +560,10 @@ class PHPWorker {
|
|
|
560
560
|
*/
|
|
561
561
|
removeEventListener(e, t) {
|
|
562
562
|
var s;
|
|
563
|
-
(s =
|
|
563
|
+
(s = p(this, j).get(e)) == null || s.delete(t);
|
|
564
564
|
}
|
|
565
565
|
dispatchEvent(e) {
|
|
566
|
-
const t =
|
|
566
|
+
const t = p(this, j).get(e.type);
|
|
567
567
|
if (t)
|
|
568
568
|
for (const s of t)
|
|
569
569
|
s(e);
|
|
@@ -595,16 +595,16 @@ class PHPWorker {
|
|
|
595
595
|
throw new Error("PHPWorker is not connected to a request handler.");
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
|
-
|
|
598
|
+
j = new WeakMap();
|
|
599
599
|
function isExitCode(r) {
|
|
600
600
|
return r instanceof Error ? (r == null ? void 0 : r.name) === "ExitStatus" && "status" in r : !1;
|
|
601
601
|
}
|
|
602
602
|
const RuntimeId = Symbol("RuntimeId"), loadedRuntimes = /* @__PURE__ */ new Map();
|
|
603
603
|
let lastRuntimeId = 0;
|
|
604
604
|
async function loadPHPRuntime(r, ...e) {
|
|
605
|
-
const t = Object.assign({}, ...e), [s, n,
|
|
605
|
+
const t = Object.assign({}, ...e), [s, n, o] = makePromise(), i = r.init(currentJsRuntime, {
|
|
606
606
|
onAbort(l) {
|
|
607
|
-
|
|
607
|
+
o(l), logger.error(l);
|
|
608
608
|
},
|
|
609
609
|
ENV: {},
|
|
610
610
|
// Emscripten sometimes prepends a '/' to the path, which
|
|
@@ -614,16 +614,16 @@ async function loadPHPRuntime(r, ...e) {
|
|
|
614
614
|
...t,
|
|
615
615
|
noInitialRun: !0,
|
|
616
616
|
onRuntimeInitialized() {
|
|
617
|
-
t.onRuntimeInitialized && t.onRuntimeInitialized(
|
|
617
|
+
t.onRuntimeInitialized && t.onRuntimeInitialized(i), n();
|
|
618
618
|
}
|
|
619
619
|
});
|
|
620
620
|
await s;
|
|
621
621
|
const a = t.phpWasmAsyncMode ?? r.phpWasmAsyncMode;
|
|
622
|
-
a && (
|
|
622
|
+
a && (i.phpWasmAsyncMode = a);
|
|
623
623
|
const c = ++lastRuntimeId;
|
|
624
|
-
return
|
|
625
|
-
return
|
|
626
|
-
},
|
|
624
|
+
return i.FS, i.id = c, i.originalExit = i._exit, i._exit = function(l) {
|
|
625
|
+
return i.outboundNetworkProxyServer && (i.outboundNetworkProxyServer.close(), i.outboundNetworkProxyServer.closeAllConnections()), loadedRuntimes.delete(c), i.originalExit(l);
|
|
626
|
+
}, i[RuntimeId] = c, loadedRuntimes.set(c, i), c;
|
|
627
627
|
}
|
|
628
628
|
function popLoadedRuntime(r, {
|
|
629
629
|
dangerouslyKeepTheRuntimeInTheMap: e = !1
|
|
@@ -662,8 +662,8 @@ const currentJsRuntime = function() {
|
|
|
662
662
|
201: "Created",
|
|
663
663
|
200: "OK"
|
|
664
664
|
};
|
|
665
|
-
var
|
|
666
|
-
const
|
|
665
|
+
var ee, te;
|
|
666
|
+
const ae = class ae {
|
|
667
667
|
constructor(e, t, s, n) {
|
|
668
668
|
/**
|
|
669
669
|
* Headers stream that doesn't get locked when the consumer
|
|
@@ -672,14 +672,14 @@ const se = class se {
|
|
|
672
672
|
* Both streams must be readable when the StreamedPHPResponse is transferred
|
|
673
673
|
* from the worker thread into the service worker.
|
|
674
674
|
*/
|
|
675
|
-
|
|
675
|
+
E(this, ee);
|
|
676
676
|
/**
|
|
677
677
|
* Headers stream reserved for internal parsing.
|
|
678
678
|
*/
|
|
679
|
-
|
|
679
|
+
E(this, te);
|
|
680
680
|
this.cachedParsedHeaders = null, this.cachedStdoutBytes = null, this.cachedStderrText = null;
|
|
681
|
-
const [
|
|
682
|
-
|
|
681
|
+
const [o, i] = e.tee();
|
|
682
|
+
x(this, ee, o), x(this, te, i), this.stdout = t, this.stderr = s, this.exitCode = n;
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
685
685
|
* Creates a StreamedPHPResponse from a buffered PHPResponse.
|
|
@@ -697,21 +697,21 @@ const se = class se {
|
|
|
697
697
|
const n = JSON.stringify({
|
|
698
698
|
status: e.httpStatusCode,
|
|
699
699
|
headers: s
|
|
700
|
-
}),
|
|
700
|
+
}), o = new ReadableStream({
|
|
701
701
|
start(a) {
|
|
702
702
|
a.enqueue(new TextEncoder().encode(n)), a.close();
|
|
703
703
|
}
|
|
704
|
-
}),
|
|
704
|
+
}), i = new ReadableStream({
|
|
705
705
|
start(a) {
|
|
706
706
|
e.errors.length > 0 && a.enqueue(
|
|
707
707
|
new TextEncoder().encode(e.errors)
|
|
708
708
|
), a.close();
|
|
709
709
|
}
|
|
710
710
|
});
|
|
711
|
-
return new
|
|
712
|
-
i,
|
|
713
|
-
t,
|
|
711
|
+
return new ae(
|
|
714
712
|
o,
|
|
713
|
+
t,
|
|
714
|
+
i,
|
|
715
715
|
Promise.resolve(e.exitCode)
|
|
716
716
|
);
|
|
717
717
|
}
|
|
@@ -720,7 +720,7 @@ const se = class se {
|
|
|
720
720
|
* Shorthand for `StreamedPHPResponse.fromPHPResponse(PHPResponse.forHttpCode(...))`.
|
|
721
721
|
*/
|
|
722
722
|
static forHttpCode(e, t = "") {
|
|
723
|
-
return
|
|
723
|
+
return ae.fromPHPResponse(
|
|
724
724
|
PHPResponse.forHttpCode(e, t)
|
|
725
725
|
);
|
|
726
726
|
}
|
|
@@ -729,7 +729,7 @@ const se = class se {
|
|
|
729
729
|
* For parsed headers, use the `headers` property instead.
|
|
730
730
|
*/
|
|
731
731
|
getHeadersStream() {
|
|
732
|
-
return
|
|
732
|
+
return p(this, ee);
|
|
733
733
|
}
|
|
734
734
|
/**
|
|
735
735
|
* True if the response is successful (HTTP status code 200-399),
|
|
@@ -790,12 +790,12 @@ const se = class se {
|
|
|
790
790
|
}
|
|
791
791
|
async getParsedHeaders() {
|
|
792
792
|
return this.cachedParsedHeaders || (this.cachedParsedHeaders = parseHeadersStream(
|
|
793
|
-
|
|
793
|
+
p(this, te)
|
|
794
794
|
)), await this.cachedParsedHeaders;
|
|
795
795
|
}
|
|
796
796
|
};
|
|
797
|
-
|
|
798
|
-
let StreamedPHPResponse =
|
|
797
|
+
ee = new WeakMap(), te = new WeakMap();
|
|
798
|
+
let StreamedPHPResponse = ae;
|
|
799
799
|
async function parseHeadersStream(r) {
|
|
800
800
|
const e = await streamToText(r);
|
|
801
801
|
let t;
|
|
@@ -808,8 +808,8 @@ async function parseHeadersStream(r) {
|
|
|
808
808
|
for (const n of t.headers) {
|
|
809
809
|
if (!n.includes(": "))
|
|
810
810
|
continue;
|
|
811
|
-
const
|
|
812
|
-
|
|
811
|
+
const o = n.indexOf(": "), i = n.substring(0, o).toLowerCase(), a = n.substring(o + 2);
|
|
812
|
+
i in s || (s[i] = []), s[i].push(a);
|
|
813
813
|
}
|
|
814
814
|
return {
|
|
815
815
|
headers: s,
|
|
@@ -830,21 +830,21 @@ async function streamToBytes(r) {
|
|
|
830
830
|
for (; ; ) {
|
|
831
831
|
const { done: s, value: n } = await e.read();
|
|
832
832
|
if (s) {
|
|
833
|
-
const
|
|
833
|
+
const o = t.reduce(
|
|
834
834
|
(c, l) => c + l.byteLength,
|
|
835
835
|
0
|
|
836
|
-
),
|
|
836
|
+
), i = new Uint8Array(o);
|
|
837
837
|
let a = 0;
|
|
838
838
|
for (const c of t)
|
|
839
|
-
|
|
840
|
-
return
|
|
839
|
+
i.set(c, a), a += c.byteLength;
|
|
840
|
+
return i;
|
|
841
841
|
}
|
|
842
842
|
n && t.push(n);
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
845
|
class PHPResponse {
|
|
846
|
-
constructor(e, t, s, n = "",
|
|
847
|
-
this.httpStatusCode = e, this.headers = t, this.bytes = s, this.exitCode =
|
|
846
|
+
constructor(e, t, s, n = "", o = 0) {
|
|
847
|
+
this.httpStatusCode = e, this.headers = t, this.bytes = s, this.exitCode = o, this.errors = n;
|
|
848
848
|
}
|
|
849
849
|
static forHttpCode(e, t = "") {
|
|
850
850
|
return new PHPResponse(
|
|
@@ -953,23 +953,23 @@ function improveWASMErrorReporting(r) {
|
|
|
953
953
|
if (typeof r.wasmExports[t] == "function") {
|
|
954
954
|
const s = r.wasmExports[t];
|
|
955
955
|
r.wasmExports[t] = function(...n) {
|
|
956
|
-
var
|
|
956
|
+
var o;
|
|
957
957
|
try {
|
|
958
958
|
return s(...n);
|
|
959
|
-
} catch (
|
|
960
|
-
if (!(
|
|
961
|
-
throw
|
|
962
|
-
r.lastAsyncifyStackSource && (
|
|
959
|
+
} catch (i) {
|
|
960
|
+
if (!(i instanceof Error))
|
|
961
|
+
throw i;
|
|
962
|
+
r.lastAsyncifyStackSource && (i.cause = r.lastAsyncifyStackSource);
|
|
963
963
|
const a = clarifyErrorMessage(
|
|
964
|
-
|
|
965
|
-
(
|
|
964
|
+
i,
|
|
965
|
+
(o = r.lastAsyncifyStackSource) == null ? void 0 : o.stack
|
|
966
966
|
);
|
|
967
967
|
if (e.hasListeners()) {
|
|
968
|
-
|
|
969
|
-
const c = new ErrorEvent("error", { error:
|
|
970
|
-
throw e.dispatchEvent(c),
|
|
968
|
+
i.message = a;
|
|
969
|
+
const c = new ErrorEvent("error", { error: i });
|
|
970
|
+
throw e.dispatchEvent(c), i;
|
|
971
971
|
}
|
|
972
|
-
throw (!isExitCode(
|
|
972
|
+
throw (!isExitCode(i) || i.status !== 0) && showCriticalErrorBox(a), i;
|
|
973
973
|
}
|
|
974
974
|
};
|
|
975
975
|
}
|
|
@@ -993,15 +993,15 @@ the PHP runtime with debug: true, e.g. loadNodeRuntime('8.1', { emscriptenOption
|
|
|
993
993
|
);
|
|
994
994
|
let n = r;
|
|
995
995
|
do {
|
|
996
|
-
for (const
|
|
996
|
+
for (const o of extractPHPFunctionsFromStack(
|
|
997
997
|
n.stack || ""
|
|
998
998
|
))
|
|
999
|
-
s.add(
|
|
999
|
+
s.add(o);
|
|
1000
1000
|
n = n.cause;
|
|
1001
1001
|
} while (n);
|
|
1002
1002
|
functionsMaybeMissingFromAsyncify = Array.from(s);
|
|
1003
|
-
for (const
|
|
1004
|
-
t += ` * ${
|
|
1003
|
+
for (const o of s)
|
|
1004
|
+
t += ` * ${o}
|
|
1005
1005
|
`;
|
|
1006
1006
|
return t += `Original error message: ${r.message}
|
|
1007
1007
|
`, t;
|
|
@@ -1069,7 +1069,7 @@ class PHPExecutionFailureError extends Error {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
}
|
|
1071
1071
|
const PHP_INI_PATH = "/internal/shared/php.ini", AUTO_PREPEND_SCRIPT = "/internal/shared/auto_prepend_file.php", OPCACHE_FILE_FOLDER = "/internal/shared/opcache";
|
|
1072
|
-
var
|
|
1072
|
+
var J, V, z, D, G, X, F, g, Pe, we, _e, ve, Ee, xe, Se, Fe, fe, ke, he, me;
|
|
1073
1073
|
class PHP {
|
|
1074
1074
|
/**
|
|
1075
1075
|
* Initializes a PHP runtime.
|
|
@@ -1079,17 +1079,17 @@ class PHP {
|
|
|
1079
1079
|
* @param requestHandlerOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
1080
1080
|
*/
|
|
1081
1081
|
constructor(r) {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1082
|
+
E(this, g);
|
|
1083
|
+
E(this, J);
|
|
1084
|
+
E(this, V, !1);
|
|
1085
|
+
E(this, z, null);
|
|
1086
|
+
E(this, D, /* @__PURE__ */ new Map([
|
|
1087
1087
|
// Listen to all events
|
|
1088
1088
|
["*", /* @__PURE__ */ new Set()]
|
|
1089
1089
|
]));
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1090
|
+
E(this, G, []);
|
|
1091
|
+
E(this, X, {});
|
|
1092
|
+
E(this, F, {
|
|
1093
1093
|
enabled: !1,
|
|
1094
1094
|
recreateRuntime: () => 0,
|
|
1095
1095
|
needsRotating: !1,
|
|
@@ -1097,7 +1097,7 @@ class PHP {
|
|
|
1097
1097
|
requestsMade: 0
|
|
1098
1098
|
});
|
|
1099
1099
|
this.semaphore = new Semaphore({ concurrency: 1 }), r !== void 0 && this.initializeRuntime(r), this.addEventListener("request.error", (e) => {
|
|
1100
|
-
e.source === "php-wasm" && (
|
|
1100
|
+
e.source === "php-wasm" && (p(this, F).needsRotating = !0);
|
|
1101
1101
|
});
|
|
1102
1102
|
}
|
|
1103
1103
|
/**
|
|
@@ -1106,7 +1106,7 @@ class PHP {
|
|
|
1106
1106
|
* @param listener - The listener function to be called when the event is triggered.
|
|
1107
1107
|
*/
|
|
1108
1108
|
addEventListener(r, e) {
|
|
1109
|
-
|
|
1109
|
+
p(this, D).has(r) || p(this, D).set(r, /* @__PURE__ */ new Set()), p(this, D).get(r).add(e);
|
|
1110
1110
|
}
|
|
1111
1111
|
/**
|
|
1112
1112
|
* Removes an event listener for a PHP event.
|
|
@@ -1115,12 +1115,12 @@ class PHP {
|
|
|
1115
1115
|
*/
|
|
1116
1116
|
removeEventListener(r, e) {
|
|
1117
1117
|
var t;
|
|
1118
|
-
(t =
|
|
1118
|
+
(t = p(this, D).get(r)) == null || t.delete(e);
|
|
1119
1119
|
}
|
|
1120
1120
|
dispatchEvent(r) {
|
|
1121
1121
|
const e = [
|
|
1122
|
-
...
|
|
1123
|
-
...
|
|
1122
|
+
...p(this, D).get(r.type) || [],
|
|
1123
|
+
...p(this, D).get("*") || []
|
|
1124
1124
|
];
|
|
1125
1125
|
if (e)
|
|
1126
1126
|
for (const t of e)
|
|
@@ -1166,8 +1166,8 @@ class PHP {
|
|
|
1166
1166
|
* @param listener Callback function to handle the message.
|
|
1167
1167
|
*/
|
|
1168
1168
|
onMessage(r) {
|
|
1169
|
-
return
|
|
1170
|
-
|
|
1169
|
+
return p(this, G).push(r), async () => {
|
|
1170
|
+
x(this, G, p(this, G).filter(
|
|
1171
1171
|
(e) => e !== r
|
|
1172
1172
|
));
|
|
1173
1173
|
};
|
|
@@ -1261,13 +1261,13 @@ class PHP {
|
|
|
1261
1261
|
}
|
|
1262
1262
|
`
|
|
1263
1263
|
), e.onMessage = async (t) => {
|
|
1264
|
-
for (const s of
|
|
1264
|
+
for (const s of p(this, G)) {
|
|
1265
1265
|
const n = await s(t);
|
|
1266
1266
|
if (n)
|
|
1267
1267
|
return n;
|
|
1268
1268
|
}
|
|
1269
1269
|
return "";
|
|
1270
|
-
},
|
|
1270
|
+
}, x(this, z, improveWASMErrorReporting(e)), this.dispatchEvent({
|
|
1271
1271
|
type: "runtime.initialized"
|
|
1272
1272
|
});
|
|
1273
1273
|
}
|
|
@@ -1282,7 +1282,7 @@ class PHP {
|
|
|
1282
1282
|
throw new Error(
|
|
1283
1283
|
"Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?"
|
|
1284
1284
|
);
|
|
1285
|
-
|
|
1285
|
+
x(this, J, r);
|
|
1286
1286
|
}
|
|
1287
1287
|
/**
|
|
1288
1288
|
* Changes the current working directory in the PHP filesystem.
|
|
@@ -1504,8 +1504,8 @@ class PHP {
|
|
|
1504
1504
|
async runStream(r) {
|
|
1505
1505
|
const e = await this.semaphore.acquire();
|
|
1506
1506
|
let t;
|
|
1507
|
-
const s =
|
|
1508
|
-
if (
|
|
1507
|
+
const s = _(this, g, me).call(this, async () => {
|
|
1508
|
+
if (p(this, V) || (await this[__private__dont__use].ccall(
|
|
1509
1509
|
"php_wasm_init",
|
|
1510
1510
|
null,
|
|
1511
1511
|
[],
|
|
@@ -1513,26 +1513,26 @@ class PHP {
|
|
|
1513
1513
|
{
|
|
1514
1514
|
isAsync: !0
|
|
1515
1515
|
}
|
|
1516
|
-
),
|
|
1516
|
+
), x(this, V, !0)), r.scriptPath && !this.fileExists(r.scriptPath))
|
|
1517
1517
|
throw new Error(
|
|
1518
1518
|
`The script path "${r.scriptPath}" does not exist.`
|
|
1519
1519
|
);
|
|
1520
|
-
|
|
1521
|
-
const
|
|
1522
|
-
if (
|
|
1523
|
-
this.writeFile("/internal/eval.php", r.code),
|
|
1520
|
+
_(this, g, we).call(this, r.relativeUri || ""), _(this, g, xe).call(this, r.method || "GET");
|
|
1521
|
+
const o = normalizeHeaders(r.headers || {}), i = o.host || "example.com:443", a = _(this, g, Ee).call(this, i, r.protocol || "http");
|
|
1522
|
+
if (_(this, g, _e).call(this, i), _(this, g, ve).call(this, a), _(this, g, Se).call(this, o), r.body && (t = _(this, g, Fe).call(this, r.body)), typeof r.code == "string")
|
|
1523
|
+
this.writeFile("/internal/eval.php", r.code), _(this, g, fe).call(this, "/internal/eval.php");
|
|
1524
1524
|
else if (typeof r.scriptPath == "string")
|
|
1525
|
-
|
|
1525
|
+
_(this, g, fe).call(this, r.scriptPath || "");
|
|
1526
1526
|
else
|
|
1527
1527
|
throw new TypeError(
|
|
1528
1528
|
"The request object must have either a `code` or a `scriptPath` property."
|
|
1529
1529
|
);
|
|
1530
|
-
const c =
|
|
1530
|
+
const c = _(this, g, Pe).call(this, r.$_SERVER, o, a);
|
|
1531
1531
|
for (const d in c)
|
|
1532
|
-
|
|
1532
|
+
_(this, g, ke).call(this, d, c[d]);
|
|
1533
1533
|
const l = r.env || {};
|
|
1534
1534
|
for (const d in l)
|
|
1535
|
-
|
|
1535
|
+
_(this, g, he).call(this, d, l[d]);
|
|
1536
1536
|
return await this[__private__dont__use].ccall(
|
|
1537
1537
|
"wasm_sapi_handle_request",
|
|
1538
1538
|
NUMBER,
|
|
@@ -1544,21 +1544,21 @@ class PHP {
|
|
|
1544
1544
|
if (t)
|
|
1545
1545
|
try {
|
|
1546
1546
|
this[__private__dont__use].free(t);
|
|
1547
|
-
} catch (
|
|
1548
|
-
logger.error(
|
|
1547
|
+
} catch (o) {
|
|
1548
|
+
logger.error(o);
|
|
1549
1549
|
}
|
|
1550
1550
|
e(), this.dispatchEvent({
|
|
1551
1551
|
type: "request.end"
|
|
1552
1552
|
});
|
|
1553
1553
|
};
|
|
1554
1554
|
return s.then(
|
|
1555
|
-
(
|
|
1556
|
-
(
|
|
1555
|
+
(o) => (o.finished.finally(n), o),
|
|
1556
|
+
(o) => {
|
|
1557
1557
|
try {
|
|
1558
1558
|
n();
|
|
1559
1559
|
} catch {
|
|
1560
1560
|
} finally {
|
|
1561
|
-
throw
|
|
1561
|
+
throw o;
|
|
1562
1562
|
}
|
|
1563
1563
|
}
|
|
1564
1564
|
);
|
|
@@ -1770,21 +1770,21 @@ class PHP {
|
|
|
1770
1770
|
* or an internal crash.
|
|
1771
1771
|
*/
|
|
1772
1772
|
enableRuntimeRotation(r) {
|
|
1773
|
-
|
|
1774
|
-
...
|
|
1773
|
+
x(this, F, {
|
|
1774
|
+
...p(this, F),
|
|
1775
1775
|
enabled: !0,
|
|
1776
1776
|
recreateRuntime: r.recreateRuntime,
|
|
1777
1777
|
maxRequests: r.maxRequests ?? 400
|
|
1778
1778
|
});
|
|
1779
1779
|
}
|
|
1780
1780
|
async rotateRuntime() {
|
|
1781
|
-
if (!
|
|
1781
|
+
if (!p(this, F).enabled)
|
|
1782
1782
|
throw new Error(
|
|
1783
1783
|
"Runtime rotation is not enabled. Call enableRuntimeRotation() first."
|
|
1784
1784
|
);
|
|
1785
1785
|
await this.hotSwapPHPRuntime(
|
|
1786
|
-
await
|
|
1787
|
-
),
|
|
1786
|
+
await p(this, F).recreateRuntime()
|
|
1787
|
+
), p(this, F).requestsMade = 0, p(this, F).needsRotating = !1;
|
|
1788
1788
|
}
|
|
1789
1789
|
/**
|
|
1790
1790
|
* Hot-swaps the PHP runtime for a new one without
|
|
@@ -1795,25 +1795,25 @@ class PHP {
|
|
|
1795
1795
|
async hotSwapPHPRuntime(r) {
|
|
1796
1796
|
const e = this[__private__dont__use].FS, t = this.listFiles("/").map((c) => `/${c}`), s = this[__private__dont__use].spawnProcess, n = e.cwd();
|
|
1797
1797
|
e.chdir("/");
|
|
1798
|
-
const
|
|
1798
|
+
const o = Object.entries(p(this, X)).map(
|
|
1799
1799
|
([c, l]) => ({
|
|
1800
1800
|
mountHandler: l.mountHandler,
|
|
1801
1801
|
vfsPath: c
|
|
1802
1802
|
})
|
|
1803
|
-
),
|
|
1804
|
-
|
|
1803
|
+
), i = Object.values(
|
|
1804
|
+
p(this, X)
|
|
1805
1805
|
).reverse();
|
|
1806
|
-
for (const c of
|
|
1806
|
+
for (const c of i)
|
|
1807
1807
|
await c.unmount();
|
|
1808
1808
|
try {
|
|
1809
1809
|
this.exit();
|
|
1810
1810
|
} catch {
|
|
1811
1811
|
}
|
|
1812
|
-
this.initializeRuntime(r), s && (this[__private__dont__use].spawnProcess = s),
|
|
1812
|
+
this.initializeRuntime(r), s && (this[__private__dont__use].spawnProcess = s), p(this, J) && this.setSapiName(p(this, J));
|
|
1813
1813
|
const a = this[__private__dont__use].FS;
|
|
1814
1814
|
for (const c of t)
|
|
1815
1815
|
c && c !== "/request" && copyMEMFSNodes(e, a, c);
|
|
1816
|
-
for (const { mountHandler: c, vfsPath: l } of
|
|
1816
|
+
for (const { mountHandler: c, vfsPath: l } of o)
|
|
1817
1817
|
this.mkdir(l), await this.mount(l, c);
|
|
1818
1818
|
try {
|
|
1819
1819
|
a.chdir(n);
|
|
@@ -1844,11 +1844,11 @@ class PHP {
|
|
|
1844
1844
|
try {
|
|
1845
1845
|
await t();
|
|
1846
1846
|
} finally {
|
|
1847
|
-
delete
|
|
1847
|
+
delete p(this, X)[r];
|
|
1848
1848
|
}
|
|
1849
1849
|
}
|
|
1850
1850
|
};
|
|
1851
|
-
return
|
|
1851
|
+
return p(this, X)[r] = s, () => s.unmount();
|
|
1852
1852
|
}
|
|
1853
1853
|
/**
|
|
1854
1854
|
* Starts a PHP CLI session with given arguments.
|
|
@@ -1866,12 +1866,12 @@ class PHP {
|
|
|
1866
1866
|
async cli(r, e = {}) {
|
|
1867
1867
|
if (basename(r[0] ?? "") !== "php")
|
|
1868
1868
|
return this.subProcess(r, e);
|
|
1869
|
-
|
|
1869
|
+
p(this, V) && (p(this, F).needsRotating = !0);
|
|
1870
1870
|
const t = await this.semaphore.acquire();
|
|
1871
|
-
return await
|
|
1871
|
+
return await _(this, g, me).call(this, () => {
|
|
1872
1872
|
const s = e.env || {};
|
|
1873
|
-
for (const [n,
|
|
1874
|
-
|
|
1873
|
+
for (const [n, o] of Object.entries(s))
|
|
1874
|
+
_(this, g, he).call(this, n, o);
|
|
1875
1875
|
r = [r[0], "-c", PHP_INI_PATH, ...r.slice(1)];
|
|
1876
1876
|
for (const n of r)
|
|
1877
1877
|
this[__private__dont__use].ccall(
|
|
@@ -1884,7 +1884,7 @@ class PHP {
|
|
|
1884
1884
|
async: !0
|
|
1885
1885
|
});
|
|
1886
1886
|
}).then((s) => (s.exitCode.finally(t), s)).finally(() => {
|
|
1887
|
-
|
|
1887
|
+
p(this, F).needsRotating = !0;
|
|
1888
1888
|
});
|
|
1889
1889
|
}
|
|
1890
1890
|
/**
|
|
@@ -1915,21 +1915,21 @@ class PHP {
|
|
|
1915
1915
|
}
|
|
1916
1916
|
};
|
|
1917
1917
|
t.stderr.on("data", n);
|
|
1918
|
-
const
|
|
1918
|
+
const o = await createInvertedReadableStream(), i = (a) => {
|
|
1919
1919
|
try {
|
|
1920
|
-
|
|
1920
|
+
o.controller.enqueue(a);
|
|
1921
1921
|
} catch {
|
|
1922
|
-
t.stdout.off("data",
|
|
1922
|
+
t.stdout.off("data", i);
|
|
1923
1923
|
}
|
|
1924
1924
|
};
|
|
1925
|
-
return t.stdout.on("data",
|
|
1925
|
+
return t.stdout.on("data", i), t.on("exit", () => {
|
|
1926
1926
|
setTimeout(() => {
|
|
1927
1927
|
try {
|
|
1928
1928
|
s.controller.close();
|
|
1929
1929
|
} catch {
|
|
1930
1930
|
}
|
|
1931
1931
|
try {
|
|
1932
|
-
|
|
1932
|
+
o.controller.close();
|
|
1933
1933
|
} catch {
|
|
1934
1934
|
}
|
|
1935
1935
|
}, 0);
|
|
@@ -1940,7 +1940,7 @@ class PHP {
|
|
|
1940
1940
|
a.close();
|
|
1941
1941
|
}
|
|
1942
1942
|
}),
|
|
1943
|
-
|
|
1943
|
+
o.stream,
|
|
1944
1944
|
s.stream,
|
|
1945
1945
|
// Exit code
|
|
1946
1946
|
new Promise((a) => {
|
|
@@ -1966,13 +1966,13 @@ class PHP {
|
|
|
1966
1966
|
this[__private__dont__use]._exit(r);
|
|
1967
1967
|
} catch {
|
|
1968
1968
|
}
|
|
1969
|
-
|
|
1969
|
+
x(this, V, !1), x(this, z, null), this[__private__dont__use] && (delete this[__private__dont__use].onMessage, delete this[__private__dont__use]);
|
|
1970
1970
|
}
|
|
1971
1971
|
[Symbol.dispose]() {
|
|
1972
1972
|
this.exit(0);
|
|
1973
1973
|
}
|
|
1974
1974
|
}
|
|
1975
|
-
|
|
1975
|
+
J = new WeakMap(), V = new WeakMap(), z = new WeakMap(), D = new WeakMap(), G = new WeakMap(), X = new WeakMap(), F = new WeakMap(), g = new WeakSet(), /**
|
|
1976
1976
|
* Prepares the $_SERVER entries for the PHP runtime.
|
|
1977
1977
|
*
|
|
1978
1978
|
* @param defaults Default entries to include in $_SERVER.
|
|
@@ -1981,17 +1981,17 @@ G = new WeakMap(), B = new WeakMap(), q = new WeakMap(), U = new WeakMap(), W =
|
|
|
1981
1981
|
* was provided.
|
|
1982
1982
|
* @returns Computed $_SERVER entries.
|
|
1983
1983
|
*/
|
|
1984
|
-
|
|
1984
|
+
Pe = function(r, e, t) {
|
|
1985
1985
|
const s = {
|
|
1986
1986
|
...r || {}
|
|
1987
1987
|
};
|
|
1988
1988
|
s.HTTPS = s.HTTPS || t === 443 ? "on" : "off";
|
|
1989
1989
|
for (const n in e) {
|
|
1990
|
-
let
|
|
1991
|
-
["content-type", "content-length"].includes(n.toLowerCase()) && (
|
|
1990
|
+
let o = "HTTP_";
|
|
1991
|
+
["content-type", "content-length"].includes(n.toLowerCase()) && (o = ""), s[`${o}${n.toUpperCase().replace(/-/g, "_")}`] = e[n];
|
|
1992
1992
|
}
|
|
1993
1993
|
return s;
|
|
1994
|
-
},
|
|
1994
|
+
}, we = function(r) {
|
|
1995
1995
|
this[__private__dont__use].ccall(
|
|
1996
1996
|
"wasm_set_request_uri",
|
|
1997
1997
|
null,
|
|
@@ -2005,35 +2005,35 @@ pe = function(r, e, t) {
|
|
|
2005
2005
|
[STRING],
|
|
2006
2006
|
[e]
|
|
2007
2007
|
);
|
|
2008
|
-
},
|
|
2008
|
+
}, _e = function(r) {
|
|
2009
2009
|
this[__private__dont__use].ccall(
|
|
2010
2010
|
"wasm_set_request_host",
|
|
2011
2011
|
null,
|
|
2012
2012
|
[STRING],
|
|
2013
2013
|
[r]
|
|
2014
2014
|
);
|
|
2015
|
-
},
|
|
2015
|
+
}, ve = function(r) {
|
|
2016
2016
|
this[__private__dont__use].ccall(
|
|
2017
2017
|
"wasm_set_request_port",
|
|
2018
2018
|
null,
|
|
2019
2019
|
[NUMBER],
|
|
2020
2020
|
[r]
|
|
2021
2021
|
);
|
|
2022
|
-
},
|
|
2022
|
+
}, Ee = function(r, e) {
|
|
2023
2023
|
let t;
|
|
2024
2024
|
try {
|
|
2025
2025
|
t = parseInt(new URL(r).port, 10);
|
|
2026
2026
|
} catch {
|
|
2027
2027
|
}
|
|
2028
2028
|
return (!t || isNaN(t) || t === 80) && (t = e === "https" ? 443 : 80), t;
|
|
2029
|
-
},
|
|
2029
|
+
}, xe = function(r) {
|
|
2030
2030
|
this[__private__dont__use].ccall(
|
|
2031
2031
|
"wasm_set_request_method",
|
|
2032
2032
|
null,
|
|
2033
2033
|
[STRING],
|
|
2034
2034
|
[r]
|
|
2035
2035
|
);
|
|
2036
|
-
},
|
|
2036
|
+
}, Se = function(r) {
|
|
2037
2037
|
r.cookie && this[__private__dont__use].ccall(
|
|
2038
2038
|
"wasm_set_cookies",
|
|
2039
2039
|
null,
|
|
@@ -2050,7 +2050,7 @@ pe = function(r, e, t) {
|
|
|
2050
2050
|
[NUMBER],
|
|
2051
2051
|
[parseInt(r["content-length"], 10)]
|
|
2052
2052
|
);
|
|
2053
|
-
},
|
|
2053
|
+
}, Fe = function(r) {
|
|
2054
2054
|
let e, t;
|
|
2055
2055
|
typeof r == "string" ? (logger.warn(
|
|
2056
2056
|
"Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"
|
|
@@ -2073,55 +2073,55 @@ pe = function(r, e, t) {
|
|
|
2073
2073
|
[NUMBER],
|
|
2074
2074
|
[t]
|
|
2075
2075
|
), s;
|
|
2076
|
-
},
|
|
2076
|
+
}, fe = function(r) {
|
|
2077
2077
|
this[__private__dont__use].ccall(
|
|
2078
2078
|
"wasm_set_path_translated",
|
|
2079
2079
|
null,
|
|
2080
2080
|
[STRING],
|
|
2081
2081
|
[r]
|
|
2082
2082
|
);
|
|
2083
|
-
},
|
|
2083
|
+
}, ke = function(r, e) {
|
|
2084
2084
|
this[__private__dont__use].ccall(
|
|
2085
2085
|
"wasm_add_SERVER_entry",
|
|
2086
2086
|
null,
|
|
2087
2087
|
[STRING, STRING],
|
|
2088
2088
|
[r, e]
|
|
2089
2089
|
);
|
|
2090
|
-
},
|
|
2090
|
+
}, he = function(r, e) {
|
|
2091
2091
|
this[__private__dont__use].ccall(
|
|
2092
2092
|
"wasm_add_ENV_entry",
|
|
2093
2093
|
null,
|
|
2094
2094
|
[STRING, STRING],
|
|
2095
2095
|
[r, e]
|
|
2096
2096
|
);
|
|
2097
|
-
},
|
|
2098
|
-
|
|
2097
|
+
}, me = async function(r) {
|
|
2098
|
+
p(this, F).enabled && p(this, F).needsRotating && await this.rotateRuntime(), ++p(this, F).requestsMade, p(this, F).requestsMade >= p(this, F).maxRequests && (p(this, F).needsRotating = !0);
|
|
2099
2099
|
const e = this[__private__dont__use], t = await createInvertedReadableStream();
|
|
2100
|
-
e.onHeaders = (
|
|
2101
|
-
a || s || t.controller.enqueue(
|
|
2100
|
+
e.onHeaders = (u) => {
|
|
2101
|
+
a || s || t.controller.enqueue(u.slice());
|
|
2102
2102
|
};
|
|
2103
2103
|
let s = !1;
|
|
2104
2104
|
const n = () => {
|
|
2105
2105
|
s || (s = !0, t.controller.close());
|
|
2106
|
-
},
|
|
2107
|
-
e.onStdout = (
|
|
2108
|
-
n(), !a &&
|
|
2106
|
+
}, o = await createInvertedReadableStream();
|
|
2107
|
+
e.onStdout = (u) => {
|
|
2108
|
+
n(), !a && o.controller.enqueue(u.slice());
|
|
2109
2109
|
};
|
|
2110
|
-
const
|
|
2111
|
-
e.onStderr = (
|
|
2112
|
-
a ||
|
|
2110
|
+
const i = await createInvertedReadableStream();
|
|
2111
|
+
e.onStderr = (u) => {
|
|
2112
|
+
a || i.controller.enqueue(u.slice());
|
|
2113
2113
|
};
|
|
2114
2114
|
let a = !1, c;
|
|
2115
2115
|
const d = (async () => {
|
|
2116
|
-
var
|
|
2116
|
+
var u;
|
|
2117
2117
|
try {
|
|
2118
2118
|
return await Promise.race([
|
|
2119
2119
|
r(),
|
|
2120
|
-
new Promise((
|
|
2121
|
-
var
|
|
2122
|
-
c = (
|
|
2123
|
-
isExitCode(
|
|
2124
|
-
}, (
|
|
2120
|
+
new Promise((P, S) => {
|
|
2121
|
+
var N;
|
|
2122
|
+
c = (B) => {
|
|
2123
|
+
isExitCode(B.error) || S(B.error);
|
|
2124
|
+
}, (N = p(this, z)) == null || N.addEventListener(
|
|
2125
2125
|
"error",
|
|
2126
2126
|
c,
|
|
2127
2127
|
{ once: !0 }
|
|
@@ -2131,42 +2131,42 @@ pe = function(r, e, t) {
|
|
|
2131
2131
|
} catch (h) {
|
|
2132
2132
|
if (isExitCode(h))
|
|
2133
2133
|
return h.status;
|
|
2134
|
-
safeStreamError$1(
|
|
2135
|
-
for (const
|
|
2136
|
-
typeof this[
|
|
2134
|
+
safeStreamError$1(o.controller, h), safeStreamError$1(i.controller, h), safeStreamError$1(t.controller, h), a = !0;
|
|
2135
|
+
for (const P in this)
|
|
2136
|
+
typeof this[P] == "function" && (this[P] = () => {
|
|
2137
2137
|
throw new Error(
|
|
2138
2138
|
"PHP runtime has crashed – see the earlier error for details."
|
|
2139
2139
|
);
|
|
2140
2140
|
});
|
|
2141
2141
|
throw this.functionsMaybeMissingFromAsyncify = getFunctionsMaybeMissingFromAsyncify(), h;
|
|
2142
2142
|
} finally {
|
|
2143
|
-
a || (safeStreamClose$1(
|
|
2143
|
+
a || (safeStreamClose$1(o.controller), safeStreamClose$1(i.controller), n(), a = !0), (u = p(this, z)) == null || u.removeEventListener(
|
|
2144
2144
|
"error",
|
|
2145
2145
|
c
|
|
2146
2146
|
);
|
|
2147
2147
|
}
|
|
2148
2148
|
})().then(
|
|
2149
|
-
(
|
|
2149
|
+
(u) => (u !== 0 && this.dispatchEvent({
|
|
2150
2150
|
type: "request.error",
|
|
2151
2151
|
error: new Error(
|
|
2152
|
-
`PHP.run() failed with exit code ${
|
|
2152
|
+
`PHP.run() failed with exit code ${u}.`
|
|
2153
2153
|
),
|
|
2154
2154
|
// Distinguish between PHP request and PHP-wasm errors
|
|
2155
2155
|
source: "php-wasm"
|
|
2156
|
-
}),
|
|
2157
|
-
(
|
|
2158
|
-
const h =
|
|
2156
|
+
}), u),
|
|
2157
|
+
(u) => {
|
|
2158
|
+
const h = u.source ?? "php-wasm";
|
|
2159
2159
|
throw this.dispatchEvent({
|
|
2160
2160
|
type: "request.error",
|
|
2161
|
-
error:
|
|
2161
|
+
error: u,
|
|
2162
2162
|
source: h
|
|
2163
|
-
}),
|
|
2163
|
+
}), u;
|
|
2164
2164
|
}
|
|
2165
2165
|
);
|
|
2166
2166
|
return new StreamedPHPResponse(
|
|
2167
2167
|
t.stream,
|
|
2168
|
-
i.stream,
|
|
2169
2168
|
o.stream,
|
|
2169
|
+
i.stream,
|
|
2170
2170
|
d
|
|
2171
2171
|
);
|
|
2172
2172
|
};
|
|
@@ -2181,8 +2181,8 @@ function copyMEMFSNodes(r, e, t) {
|
|
|
2181
2181
|
return;
|
|
2182
2182
|
const s = r.lookupPath(t, { follow: !1 });
|
|
2183
2183
|
if (r.isLink(s.node.mode)) {
|
|
2184
|
-
const
|
|
2185
|
-
e.symlink(
|
|
2184
|
+
const o = r.readlink(t);
|
|
2185
|
+
e.symlink(o, t);
|
|
2186
2186
|
return;
|
|
2187
2187
|
}
|
|
2188
2188
|
if (!r.isDir(s.node.mode)) {
|
|
@@ -2190,21 +2190,21 @@ function copyMEMFSNodes(r, e, t) {
|
|
|
2190
2190
|
return;
|
|
2191
2191
|
}
|
|
2192
2192
|
e.mkdirTree(t);
|
|
2193
|
-
const n = r.readdir(t).filter((
|
|
2194
|
-
for (const
|
|
2195
|
-
copyMEMFSNodes(r, e, joinPaths(t,
|
|
2193
|
+
const n = r.readdir(t).filter((o) => o !== "." && o !== "..");
|
|
2194
|
+
for (const o of n)
|
|
2195
|
+
copyMEMFSNodes(r, e, joinPaths(t, o));
|
|
2196
2196
|
}
|
|
2197
2197
|
async function createInvertedReadableStream(r = {}) {
|
|
2198
2198
|
let e;
|
|
2199
2199
|
const t = new Promise(
|
|
2200
|
-
(
|
|
2201
|
-
e =
|
|
2200
|
+
(o) => {
|
|
2201
|
+
e = o;
|
|
2202
2202
|
}
|
|
2203
2203
|
), s = new ReadableStream({
|
|
2204
2204
|
...r,
|
|
2205
|
-
start(
|
|
2206
|
-
if (e(
|
|
2207
|
-
return r.start(
|
|
2205
|
+
start(o) {
|
|
2206
|
+
if (e(o), r.start)
|
|
2207
|
+
return r.start(o);
|
|
2208
2208
|
}
|
|
2209
2209
|
}), n = await t;
|
|
2210
2210
|
return {
|
|
@@ -2321,8 +2321,8 @@ class HttpCookieStore {
|
|
|
2321
2321
|
try {
|
|
2322
2322
|
if (!t.includes("="))
|
|
2323
2323
|
continue;
|
|
2324
|
-
const s = t.indexOf("="), n = t.substring(0, s),
|
|
2325
|
-
this.cookies[n] =
|
|
2324
|
+
const s = t.indexOf("="), n = t.substring(0, s), o = t.substring(s + 1).split(";")[0];
|
|
2325
|
+
this.cookies[n] = o;
|
|
2326
2326
|
} catch (s) {
|
|
2327
2327
|
logger.error(s);
|
|
2328
2328
|
}
|
|
@@ -2348,17 +2348,17 @@ async function* iteratePhpFiles(r, e, {
|
|
|
2348
2348
|
exceptPaths: n = []
|
|
2349
2349
|
} = {}) {
|
|
2350
2350
|
e = normalizePath(e);
|
|
2351
|
-
const
|
|
2352
|
-
for (;
|
|
2353
|
-
const
|
|
2354
|
-
if (!
|
|
2351
|
+
const o = [e];
|
|
2352
|
+
for (; o.length; ) {
|
|
2353
|
+
const i = o.pop();
|
|
2354
|
+
if (!i)
|
|
2355
2355
|
return;
|
|
2356
|
-
const a = await r.listFiles(
|
|
2356
|
+
const a = await r.listFiles(i);
|
|
2357
2357
|
for (const c of a) {
|
|
2358
|
-
const l = `${
|
|
2358
|
+
const l = `${i}/${c}`;
|
|
2359
2359
|
if (n.includes(l.substring(e.length + 1)))
|
|
2360
2360
|
continue;
|
|
2361
|
-
await r.isDir(l) ?
|
|
2361
|
+
await r.isDir(l) ? o.push(l) : yield new StreamedFile(
|
|
2362
2362
|
streamReadFileFromPHP(r, l),
|
|
2363
2363
|
t ? joinPaths(
|
|
2364
2364
|
s || "",
|
|
@@ -2548,14 +2548,14 @@ async function encodeAsMultipart(r) {
|
|
|
2548
2548
|
`);
|
|
2549
2549
|
n.push(`--${e}--\r
|
|
2550
2550
|
`);
|
|
2551
|
-
const
|
|
2551
|
+
const o = n.reduce((c, l) => c + l.length, 0), i = new Uint8Array(o);
|
|
2552
2552
|
let a = 0;
|
|
2553
2553
|
for (const c of n)
|
|
2554
|
-
|
|
2554
|
+
i.set(
|
|
2555
2555
|
typeof c == "string" ? s.encode(c) : c,
|
|
2556
2556
|
a
|
|
2557
2557
|
), a += c.length;
|
|
2558
|
-
return { bytes:
|
|
2558
|
+
return { bytes: i, contentType: t };
|
|
2559
2559
|
}
|
|
2560
2560
|
function fileToUint8Array(r) {
|
|
2561
2561
|
return r.arrayBuffer().then((e) => new Uint8Array(e));
|
|
@@ -2658,7 +2658,7 @@ const _default = "application/octet-stream", asx = "video/x-ms-asf", atom = "app
|
|
|
2658
2658
|
xspf,
|
|
2659
2659
|
zip
|
|
2660
2660
|
};
|
|
2661
|
-
var A,
|
|
2661
|
+
var A, Q, re, Y, K, M, Z, $, se, b, Re, oe, be, He, Te;
|
|
2662
2662
|
class PHPRequestHandler {
|
|
2663
2663
|
/**
|
|
2664
2664
|
* The request handler needs to decide whether to serve a static asset or
|
|
@@ -2672,22 +2672,22 @@ class PHPRequestHandler {
|
|
|
2672
2672
|
* @param config - Request Handler configuration.
|
|
2673
2673
|
*/
|
|
2674
2674
|
constructor(e) {
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2675
|
+
E(this, b);
|
|
2676
|
+
E(this, A);
|
|
2677
|
+
E(this, Q);
|
|
2678
|
+
E(this, re);
|
|
2679
|
+
E(this, Y);
|
|
2680
|
+
E(this, K);
|
|
2681
|
+
E(this, M);
|
|
2682
|
+
E(this, Z);
|
|
2683
|
+
E(this, $);
|
|
2684
|
+
E(this, se);
|
|
2685
2685
|
const {
|
|
2686
2686
|
documentRoot: t = "/www/",
|
|
2687
2687
|
absoluteUrl: s = typeof location == "object" ? location.href : DEFAULT_BASE_URL,
|
|
2688
2688
|
rewriteRules: n = [],
|
|
2689
|
-
pathAliases:
|
|
2690
|
-
getFileNotFoundAction:
|
|
2689
|
+
pathAliases: o = [],
|
|
2690
|
+
getFileNotFoundAction: i = () => ({ type: "404" })
|
|
2691
2691
|
} = e, a = (d) => {
|
|
2692
2692
|
d.isDir(t) || d.mkdir(t), d.chdir(t), d.requestHandler = this;
|
|
2693
2693
|
};
|
|
@@ -2698,11 +2698,11 @@ class PHPRequestHandler {
|
|
|
2698
2698
|
else if (e.phpFactory)
|
|
2699
2699
|
this.instanceManager = new PHPProcessManager({
|
|
2700
2700
|
phpFactory: async (d) => {
|
|
2701
|
-
const
|
|
2701
|
+
const u = await e.phpFactory({
|
|
2702
2702
|
...d,
|
|
2703
2703
|
requestHandler: this
|
|
2704
2704
|
});
|
|
2705
|
-
return a(
|
|
2705
|
+
return a(u), u;
|
|
2706
2706
|
},
|
|
2707
2707
|
maxPhpInstances: e.maxPhpInstances
|
|
2708
2708
|
});
|
|
@@ -2710,18 +2710,18 @@ class PHPRequestHandler {
|
|
|
2710
2710
|
throw new Error(
|
|
2711
2711
|
"Either php or phpFactory must be provided in the configuration."
|
|
2712
2712
|
);
|
|
2713
|
-
|
|
2713
|
+
x(this, $, e.cookieStore === void 0 ? new HttpCookieStore() : e.cookieStore), x(this, A, t);
|
|
2714
2714
|
const c = new URL(s);
|
|
2715
|
-
|
|
2716
|
-
const l =
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
l ? `:${
|
|
2720
|
-
].join("")),
|
|
2721
|
-
`${
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
].join("")), this.rewriteRules = n,
|
|
2715
|
+
x(this, re, c.hostname), x(this, Y, c.port ? Number(c.port) : c.protocol === "https:" ? 443 : 80), x(this, Q, (c.protocol || "").replace(":", ""));
|
|
2716
|
+
const l = p(this, Y) !== 443 && p(this, Y) !== 80;
|
|
2717
|
+
x(this, K, [
|
|
2718
|
+
p(this, re),
|
|
2719
|
+
l ? `:${p(this, Y)}` : ""
|
|
2720
|
+
].join("")), x(this, M, c.pathname.replace(/\/+$/, "")), x(this, Z, [
|
|
2721
|
+
`${p(this, Q)}://`,
|
|
2722
|
+
p(this, K),
|
|
2723
|
+
p(this, M)
|
|
2724
|
+
].join("")), this.rewriteRules = n, x(this, se, o), this.getFileNotFoundAction = i;
|
|
2725
2725
|
}
|
|
2726
2726
|
async getPrimaryPhp() {
|
|
2727
2727
|
return await this.instanceManager.getPrimaryPhp();
|
|
@@ -2745,20 +2745,20 @@ class PHPRequestHandler {
|
|
|
2745
2745
|
*/
|
|
2746
2746
|
internalUrlToPath(e) {
|
|
2747
2747
|
const t = new URL(e, "https://playground.internal");
|
|
2748
|
-
return t.pathname.startsWith(
|
|
2748
|
+
return t.pathname.startsWith(p(this, M)) && (t.pathname = t.pathname.slice(p(this, M).length)), toRelativeUrl(t);
|
|
2749
2749
|
}
|
|
2750
2750
|
/**
|
|
2751
2751
|
* The absolute URL of this PHPRequestHandler instance.
|
|
2752
2752
|
*/
|
|
2753
2753
|
get absoluteUrl() {
|
|
2754
|
-
return
|
|
2754
|
+
return p(this, Z);
|
|
2755
2755
|
}
|
|
2756
2756
|
/**
|
|
2757
2757
|
* The directory in the PHP filesystem where the server will look
|
|
2758
2758
|
* for the files to serve. Default: `/var/www`.
|
|
2759
2759
|
*/
|
|
2760
2760
|
get documentRoot() {
|
|
2761
|
-
return
|
|
2761
|
+
return p(this, A);
|
|
2762
2762
|
}
|
|
2763
2763
|
/**
|
|
2764
2764
|
* Serves the request – either by serving a static file, or by
|
|
@@ -2834,17 +2834,17 @@ class PHPRequestHandler {
|
|
|
2834
2834
|
// Remove the hash part of the URL as it's not meant for the server.
|
|
2835
2835
|
e.url.split("#")[0],
|
|
2836
2836
|
t ? void 0 : DEFAULT_BASE_URL
|
|
2837
|
-
), n =
|
|
2837
|
+
), n = _(this, b, Re).call(this, s), o = await this.getPrimaryPhp(), i = removePathPrefix(
|
|
2838
2838
|
/**
|
|
2839
2839
|
* URL.pathname returns a URL-encoded path. We need to decode it
|
|
2840
2840
|
* before using it as a filesystem path.
|
|
2841
2841
|
*/
|
|
2842
2842
|
decodeURIComponent(n.pathname),
|
|
2843
|
-
|
|
2843
|
+
p(this, M)
|
|
2844
2844
|
);
|
|
2845
|
-
let a =
|
|
2846
|
-
if (
|
|
2847
|
-
if (!
|
|
2845
|
+
let a = _(this, b, oe).call(this, i);
|
|
2846
|
+
if (o.isDir(a)) {
|
|
2847
|
+
if (!i.endsWith("/"))
|
|
2848
2848
|
return StreamedPHPResponse.fromPHPResponse(
|
|
2849
2849
|
new PHPResponse(
|
|
2850
2850
|
301,
|
|
@@ -2854,7 +2854,7 @@ class PHPRequestHandler {
|
|
|
2854
2854
|
);
|
|
2855
2855
|
for (const c of ["index.php", "index.html"]) {
|
|
2856
2856
|
const l = joinPaths(a, c);
|
|
2857
|
-
if (
|
|
2857
|
+
if (o.isFile(l)) {
|
|
2858
2858
|
a = l, n.pathname = joinPaths(
|
|
2859
2859
|
n.pathname,
|
|
2860
2860
|
c
|
|
@@ -2863,19 +2863,19 @@ class PHPRequestHandler {
|
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
2865
|
}
|
|
2866
|
-
if (!
|
|
2867
|
-
let c =
|
|
2866
|
+
if (!o.isFile(a)) {
|
|
2867
|
+
let c = i;
|
|
2868
2868
|
for (; c.startsWith("/") && c !== dirname(c); ) {
|
|
2869
2869
|
c = dirname(c);
|
|
2870
|
-
const l =
|
|
2871
|
-
if (
|
|
2870
|
+
const l = _(this, b, oe).call(this, c);
|
|
2871
|
+
if (o.isFile(l) && // Only run partial path resolution for PHP files.
|
|
2872
2872
|
l.endsWith(".php")) {
|
|
2873
|
-
a =
|
|
2873
|
+
a = _(this, b, oe).call(this, c);
|
|
2874
2874
|
break;
|
|
2875
2875
|
}
|
|
2876
2876
|
}
|
|
2877
2877
|
}
|
|
2878
|
-
if (!
|
|
2878
|
+
if (!o.isFile(a)) {
|
|
2879
2879
|
const c = this.getFileNotFoundAction(
|
|
2880
2880
|
n.pathname
|
|
2881
2881
|
);
|
|
@@ -2885,7 +2885,7 @@ class PHPRequestHandler {
|
|
|
2885
2885
|
c.response
|
|
2886
2886
|
);
|
|
2887
2887
|
case "internal-redirect":
|
|
2888
|
-
a = joinPaths(
|
|
2888
|
+
a = joinPaths(p(this, A), c.uri);
|
|
2889
2889
|
break;
|
|
2890
2890
|
case "404":
|
|
2891
2891
|
return StreamedPHPResponse.forHttpCode(404);
|
|
@@ -2895,8 +2895,8 @@ class PHPRequestHandler {
|
|
|
2895
2895
|
);
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
2898
|
-
return
|
|
2899
|
-
|
|
2898
|
+
return o.isFile(a) ? a.endsWith(".php") ? await _(this, b, He).call(this, e, s, n, a) : StreamedPHPResponse.fromPHPResponse(
|
|
2899
|
+
_(this, b, be).call(this, o, a)
|
|
2900
2900
|
) : StreamedPHPResponse.forHttpCode(404);
|
|
2901
2901
|
}
|
|
2902
2902
|
/**
|
|
@@ -2990,11 +2990,11 @@ class PHPRequestHandler {
|
|
|
2990
2990
|
prepare_$_SERVER_superglobal(e, t, s) {
|
|
2991
2991
|
const n = {
|
|
2992
2992
|
REMOTE_ADDR: "127.0.0.1",
|
|
2993
|
-
DOCUMENT_ROOT:
|
|
2994
|
-
HTTPS:
|
|
2993
|
+
DOCUMENT_ROOT: p(this, A),
|
|
2994
|
+
HTTPS: p(this, Z).startsWith("https://") ? "on" : ""
|
|
2995
2995
|
};
|
|
2996
|
-
return n.REQUEST_URI = e.pathname + e.search, s.startsWith(
|
|
2997
|
-
|
|
2996
|
+
return n.REQUEST_URI = e.pathname + e.search, s.startsWith(p(this, A)) && (n.SCRIPT_NAME = s.substring(
|
|
2997
|
+
p(this, A).length
|
|
2998
2998
|
), n.PHP_SELF = t.pathname, n.REQUEST_URI.startsWith(n.SCRIPT_NAME) && (n.PATH_INFO = n.REQUEST_URI.substring(
|
|
2999
2999
|
n.SCRIPT_NAME.length
|
|
3000
3000
|
), n.PATH_INFO.includes("?") && (n.PATH_INFO = n.PATH_INFO.substring(
|
|
@@ -3006,25 +3006,25 @@ class PHPRequestHandler {
|
|
|
3006
3006
|
await this.instanceManager[Symbol.asyncDispose]();
|
|
3007
3007
|
}
|
|
3008
3008
|
}
|
|
3009
|
-
A = new WeakMap(),
|
|
3009
|
+
A = new WeakMap(), Q = new WeakMap(), re = new WeakMap(), Y = new WeakMap(), K = new WeakMap(), M = new WeakMap(), Z = new WeakMap(), $ = new WeakMap(), se = new WeakMap(), b = new WeakSet(), /**
|
|
3010
3010
|
* Apply the rewrite rules to the original request URL.
|
|
3011
3011
|
*
|
|
3012
3012
|
* @param originalRequestUrl - The original request URL.
|
|
3013
3013
|
* @returns The rewritten request URL.
|
|
3014
3014
|
*/
|
|
3015
|
-
|
|
3015
|
+
Re = function(e) {
|
|
3016
3016
|
const t = removePathPrefix(
|
|
3017
3017
|
decodeURIComponent(e.pathname),
|
|
3018
|
-
|
|
3018
|
+
p(this, M)
|
|
3019
3019
|
), s = applyRewriteRules(
|
|
3020
3020
|
t,
|
|
3021
3021
|
this.rewriteRules
|
|
3022
3022
|
), n = new URL(
|
|
3023
|
-
joinPaths(
|
|
3023
|
+
joinPaths(p(this, M), s),
|
|
3024
3024
|
e.toString()
|
|
3025
3025
|
);
|
|
3026
|
-
for (const [
|
|
3027
|
-
n.searchParams.append(
|
|
3026
|
+
for (const [o, i] of e.searchParams.entries())
|
|
3027
|
+
n.searchParams.append(o, i);
|
|
3028
3028
|
return n;
|
|
3029
3029
|
}, /**
|
|
3030
3030
|
* Resolves a URL path to a filesystem path, checking path aliases first.
|
|
@@ -3035,20 +3035,20 @@ ve = function(e) {
|
|
|
3035
3035
|
* @param urlPath - The URL path to resolve (e.g., '/phpmyadmin/index.php')
|
|
3036
3036
|
* @returns The resolved filesystem path
|
|
3037
3037
|
*/
|
|
3038
|
-
|
|
3039
|
-
for (const t of
|
|
3038
|
+
oe = function(e) {
|
|
3039
|
+
for (const t of p(this, se))
|
|
3040
3040
|
if (e === t.urlPrefix || e.startsWith(t.urlPrefix + "/")) {
|
|
3041
3041
|
const s = e.slice(t.urlPrefix.length);
|
|
3042
3042
|
return joinPaths(t.fsPath, s);
|
|
3043
3043
|
}
|
|
3044
|
-
return joinPaths(
|
|
3044
|
+
return joinPaths(p(this, A), e);
|
|
3045
3045
|
}, /**
|
|
3046
3046
|
* Serves a static file from the PHP filesystem.
|
|
3047
3047
|
*
|
|
3048
3048
|
* @param fsPath - Absolute path of the static file to serve.
|
|
3049
3049
|
* @returns The response.
|
|
3050
3050
|
*/
|
|
3051
|
-
|
|
3051
|
+
be = function(e, t) {
|
|
3052
3052
|
const s = e.readFileAsBuffer(t);
|
|
3053
3053
|
return new PHPResponse(
|
|
3054
3054
|
200,
|
|
@@ -3063,54 +3063,54 @@ Ee = function(e, t) {
|
|
|
3063
3063
|
},
|
|
3064
3064
|
s
|
|
3065
3065
|
);
|
|
3066
|
-
},
|
|
3067
|
-
let
|
|
3066
|
+
}, He = async function(e, t, s, n) {
|
|
3067
|
+
let o;
|
|
3068
3068
|
try {
|
|
3069
|
-
|
|
3069
|
+
o = await this.instanceManager.acquirePHPInstance();
|
|
3070
3070
|
} catch (a) {
|
|
3071
3071
|
return a instanceof MaxPhpInstancesError ? StreamedPHPResponse.forHttpCode(502) : StreamedPHPResponse.forHttpCode(500);
|
|
3072
3072
|
}
|
|
3073
|
-
let
|
|
3073
|
+
let i;
|
|
3074
3074
|
try {
|
|
3075
|
-
|
|
3075
|
+
i = await _(this, b, Te).call(this, o.php, e, t, s, n);
|
|
3076
3076
|
} catch (a) {
|
|
3077
|
-
throw
|
|
3077
|
+
throw o.reap(), a;
|
|
3078
3078
|
}
|
|
3079
|
-
return
|
|
3080
|
-
|
|
3081
|
-
}),
|
|
3082
|
-
},
|
|
3083
|
-
let
|
|
3079
|
+
return i.finished.finally(() => {
|
|
3080
|
+
o == null || o.reap();
|
|
3081
|
+
}), i;
|
|
3082
|
+
}, Te = async function(e, t, s, n, o) {
|
|
3083
|
+
let i = "GET";
|
|
3084
3084
|
const a = {
|
|
3085
|
-
host:
|
|
3085
|
+
host: p(this, K),
|
|
3086
3086
|
...normalizeHeaders(t.headers || {})
|
|
3087
3087
|
};
|
|
3088
|
-
|
|
3088
|
+
p(this, $) && (a.cookie = p(this, $).getCookieRequestHeader());
|
|
3089
3089
|
let c = t.body;
|
|
3090
3090
|
if (typeof c == "object" && !(c instanceof Uint8Array)) {
|
|
3091
|
-
|
|
3092
|
-
const { bytes: d, contentType:
|
|
3093
|
-
c = d, a["content-type"] =
|
|
3091
|
+
i = "POST";
|
|
3092
|
+
const { bytes: d, contentType: u } = await encodeAsMultipart(c);
|
|
3093
|
+
c = d, a["content-type"] = u;
|
|
3094
3094
|
}
|
|
3095
3095
|
const l = await e.runStream({
|
|
3096
3096
|
relativeUri: ensurePathPrefix(
|
|
3097
3097
|
toRelativeUrl(new URL(n.toString())),
|
|
3098
|
-
|
|
3098
|
+
p(this, M)
|
|
3099
3099
|
),
|
|
3100
|
-
protocol:
|
|
3101
|
-
method: t.method ||
|
|
3100
|
+
protocol: p(this, Q),
|
|
3101
|
+
method: t.method || i,
|
|
3102
3102
|
$_SERVER: this.prepare_$_SERVER_superglobal(
|
|
3103
3103
|
s,
|
|
3104
3104
|
n,
|
|
3105
|
-
|
|
3105
|
+
o
|
|
3106
3106
|
),
|
|
3107
3107
|
body: c,
|
|
3108
|
-
scriptPath:
|
|
3108
|
+
scriptPath: o,
|
|
3109
3109
|
headers: a
|
|
3110
3110
|
});
|
|
3111
|
-
if (
|
|
3111
|
+
if (p(this, $)) {
|
|
3112
3112
|
const d = await l.headers;
|
|
3113
|
-
|
|
3113
|
+
p(this, $).rememberCookiesFromResponseHeaders(
|
|
3114
3114
|
d
|
|
3115
3115
|
);
|
|
3116
3116
|
}
|
|
@@ -3147,12 +3147,62 @@ function rotatePHPRuntime({
|
|
|
3147
3147
|
}
|
|
3148
3148
|
async function writeFiles(r, e, t, { rmRoot: s = !1 } = {}) {
|
|
3149
3149
|
s && await r.isDir(e) && await r.rmdir(e, { recursive: !0 });
|
|
3150
|
-
for (const [n,
|
|
3151
|
-
const
|
|
3152
|
-
await r.fileExists(dirname(
|
|
3150
|
+
for (const [n, o] of Object.entries(t)) {
|
|
3151
|
+
const i = joinPaths(e, n);
|
|
3152
|
+
await r.fileExists(dirname(i)) || await r.mkdir(dirname(i)), o instanceof Uint8Array || typeof o == "string" ? await r.writeFile(i, o) : await writeFiles(r, i, o);
|
|
3153
3153
|
}
|
|
3154
3154
|
}
|
|
3155
|
-
const
|
|
3155
|
+
const schema12 = {
|
|
3156
|
+
properties: {
|
|
3157
|
+
name: { type: "string" },
|
|
3158
|
+
version: { type: "string" },
|
|
3159
|
+
mode: { type: "string", const: "php-extension" },
|
|
3160
|
+
loadWithIniDirective: {
|
|
3161
|
+
$ref: "#/definitions/PHPExtensionLoadDirective",
|
|
3162
|
+
description: "The first directive of the generated startup `.ini` file. Defaults to `extension`; use `zend_extension` for Zend extensions like Xdebug. Use `false` to stage the `.so` without registering it in php.ini."
|
|
3163
|
+
},
|
|
3164
|
+
iniEntries: {
|
|
3165
|
+
type: "object",
|
|
3166
|
+
additionalProperties: { type: "string" },
|
|
3167
|
+
description: "Additional `key=value` lines for the generated startup `.ini` file."
|
|
3168
|
+
},
|
|
3169
|
+
env: {
|
|
3170
|
+
type: "object",
|
|
3171
|
+
additionalProperties: { type: "string" },
|
|
3172
|
+
description: "Environment variables added before the extension is loaded."
|
|
3173
|
+
},
|
|
3174
|
+
extensionDir: {
|
|
3175
|
+
type: "string",
|
|
3176
|
+
description: "VFS directory where PHP.wasm writes the extension `.so` file and its per-extension ini file. Defaults to `PHP_EXTENSIONS_DIR`."
|
|
3177
|
+
},
|
|
3178
|
+
artifacts: {
|
|
3179
|
+
type: "array",
|
|
3180
|
+
items: {
|
|
3181
|
+
type: "object",
|
|
3182
|
+
properties: {
|
|
3183
|
+
phpVersion: {
|
|
3184
|
+
type: "string",
|
|
3185
|
+
description: "PHP major/minor version, e.g. `8.4`."
|
|
3186
|
+
},
|
|
3187
|
+
sourcePath: {
|
|
3188
|
+
type: "string",
|
|
3189
|
+
description: "Relative to the manifest URL/base URL, or an absolute URL."
|
|
3190
|
+
},
|
|
3191
|
+
extraFiles: {
|
|
3192
|
+
$ref: "#/definitions/PHPExtensionManifestExtraFiles",
|
|
3193
|
+
description: "URL-backed files needed only by this artifact."
|
|
3194
|
+
}
|
|
3195
|
+
},
|
|
3196
|
+
required: ["phpVersion", "sourcePath"],
|
|
3197
|
+
additionalProperties: !1
|
|
3198
|
+
}
|
|
3199
|
+
},
|
|
3200
|
+
extraFiles: {
|
|
3201
|
+
$ref: "#/definitions/PHPExtensionManifestExtraFiles",
|
|
3202
|
+
description: "URL-backed files shared by every artifact in this manifest."
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
}, schema15 = {
|
|
3156
3206
|
properties: {
|
|
3157
3207
|
nodes: {
|
|
3158
3208
|
items: {
|
|
@@ -3164,138 +3214,275 @@ const schema13 = {
|
|
|
3164
3214
|
}
|
|
3165
3215
|
}
|
|
3166
3216
|
}
|
|
3217
|
+
}, func2 = Object.prototype.hasOwnProperty, schema14 = {
|
|
3218
|
+
enum: ["extension", "zend_extension"]
|
|
3167
3219
|
};
|
|
3220
|
+
function validate12(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
|
|
3221
|
+
let o = null, i = 0;
|
|
3222
|
+
const a = i;
|
|
3223
|
+
let c = !1;
|
|
3224
|
+
const l = i;
|
|
3225
|
+
if (typeof r != "string") {
|
|
3226
|
+
const u = {
|
|
3227
|
+
instancePath: e,
|
|
3228
|
+
schemaPath: "#/definitions/PHPExtensionIniDirective/type",
|
|
3229
|
+
keyword: "type",
|
|
3230
|
+
params: { type: "string" },
|
|
3231
|
+
message: "must be string"
|
|
3232
|
+
};
|
|
3233
|
+
o === null ? o = [u] : o.push(u), i++;
|
|
3234
|
+
}
|
|
3235
|
+
if (!(r === "extension" || r === "zend_extension")) {
|
|
3236
|
+
const u = {
|
|
3237
|
+
instancePath: e,
|
|
3238
|
+
schemaPath: "#/definitions/PHPExtensionIniDirective/enum",
|
|
3239
|
+
keyword: "enum",
|
|
3240
|
+
params: { allowedValues: schema14.enum },
|
|
3241
|
+
message: "must be equal to one of the allowed values"
|
|
3242
|
+
};
|
|
3243
|
+
o === null ? o = [u] : o.push(u), i++;
|
|
3244
|
+
}
|
|
3245
|
+
var d = l === i;
|
|
3246
|
+
if (c = c || d, !c) {
|
|
3247
|
+
const u = i;
|
|
3248
|
+
if (typeof r != "boolean") {
|
|
3249
|
+
const P = {
|
|
3250
|
+
instancePath: e,
|
|
3251
|
+
schemaPath: "#/anyOf/1/type",
|
|
3252
|
+
keyword: "type",
|
|
3253
|
+
params: { type: "boolean" },
|
|
3254
|
+
message: "must be boolean"
|
|
3255
|
+
};
|
|
3256
|
+
o === null ? o = [P] : o.push(P), i++;
|
|
3257
|
+
}
|
|
3258
|
+
if (r !== !1) {
|
|
3259
|
+
const P = {
|
|
3260
|
+
instancePath: e,
|
|
3261
|
+
schemaPath: "#/anyOf/1/const",
|
|
3262
|
+
keyword: "const",
|
|
3263
|
+
params: { allowedValue: !1 },
|
|
3264
|
+
message: "must be equal to constant"
|
|
3265
|
+
};
|
|
3266
|
+
o === null ? o = [P] : o.push(P), i++;
|
|
3267
|
+
}
|
|
3268
|
+
var d = u === i;
|
|
3269
|
+
c = c || d;
|
|
3270
|
+
}
|
|
3271
|
+
if (c)
|
|
3272
|
+
i = a, o !== null && (a ? o.length = a : o = null);
|
|
3273
|
+
else {
|
|
3274
|
+
const u = {
|
|
3275
|
+
instancePath: e,
|
|
3276
|
+
schemaPath: "#/anyOf",
|
|
3277
|
+
keyword: "anyOf",
|
|
3278
|
+
params: {},
|
|
3279
|
+
message: "must match a schema in anyOf"
|
|
3280
|
+
};
|
|
3281
|
+
return o === null ? o = [u] : o.push(u), i++, validate12.errors = o, !1;
|
|
3282
|
+
}
|
|
3283
|
+
return validate12.errors = o, i === 0;
|
|
3284
|
+
}
|
|
3168
3285
|
function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
|
|
3169
|
-
let
|
|
3170
|
-
if (
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
{
|
|
3175
|
-
instancePath: e,
|
|
3176
|
-
schemaPath: "#/required",
|
|
3177
|
-
keyword: "required",
|
|
3178
|
-
params: { missingProperty: N },
|
|
3179
|
-
message: "must have required property '" + N + "'"
|
|
3180
|
-
}
|
|
3181
|
-
], !1;
|
|
3182
|
-
for (const m in r)
|
|
3183
|
-
if (!(m === "name" || m === "version" || m === "mode" || m === "artifacts" || m === "extraFiles"))
|
|
3286
|
+
let o = null, i = 0;
|
|
3287
|
+
if (i === 0)
|
|
3288
|
+
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
3289
|
+
let L;
|
|
3290
|
+
if (r.name === void 0 && (L = "name") || r.artifacts === void 0 && (L = "artifacts"))
|
|
3184
3291
|
return validate11.errors = [
|
|
3185
3292
|
{
|
|
3186
3293
|
instancePath: e,
|
|
3187
|
-
schemaPath: "#/
|
|
3188
|
-
keyword: "
|
|
3189
|
-
params: {
|
|
3190
|
-
message: "must
|
|
3294
|
+
schemaPath: "#/required",
|
|
3295
|
+
keyword: "required",
|
|
3296
|
+
params: { missingProperty: L },
|
|
3297
|
+
message: "must have required property '" + L + "'"
|
|
3191
3298
|
}
|
|
3192
3299
|
], !1;
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
const
|
|
3196
|
-
|
|
3197
|
-
return validate11.errors = [
|
|
3198
|
-
{
|
|
3199
|
-
instancePath: e + "/name",
|
|
3200
|
-
schemaPath: "#/properties/name/type",
|
|
3201
|
-
keyword: "type",
|
|
3202
|
-
params: { type: "string" },
|
|
3203
|
-
message: "must be string"
|
|
3204
|
-
}
|
|
3205
|
-
], !1;
|
|
3206
|
-
var a = m === o;
|
|
3207
|
-
} else
|
|
3208
|
-
var a = !0;
|
|
3209
|
-
if (a) {
|
|
3210
|
-
if (r.version !== void 0) {
|
|
3211
|
-
const m = o;
|
|
3212
|
-
if (typeof r.version != "string")
|
|
3300
|
+
{
|
|
3301
|
+
const O = i;
|
|
3302
|
+
for (const f in r)
|
|
3303
|
+
if (!func2.call(schema12.properties, f))
|
|
3213
3304
|
return validate11.errors = [
|
|
3214
3305
|
{
|
|
3215
|
-
instancePath: e
|
|
3216
|
-
schemaPath: "#/
|
|
3217
|
-
keyword: "
|
|
3218
|
-
params: {
|
|
3219
|
-
message: "must
|
|
3306
|
+
instancePath: e,
|
|
3307
|
+
schemaPath: "#/additionalProperties",
|
|
3308
|
+
keyword: "additionalProperties",
|
|
3309
|
+
params: { additionalProperty: f },
|
|
3310
|
+
message: "must NOT have additional properties"
|
|
3220
3311
|
}
|
|
3221
3312
|
], !1;
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
if (r.mode !== void 0) {
|
|
3227
|
-
let m = r.mode;
|
|
3228
|
-
const D = o;
|
|
3229
|
-
if (typeof m != "string")
|
|
3313
|
+
if (O === i) {
|
|
3314
|
+
if (r.name !== void 0) {
|
|
3315
|
+
const f = i;
|
|
3316
|
+
if (typeof r.name != "string")
|
|
3230
3317
|
return validate11.errors = [
|
|
3231
3318
|
{
|
|
3232
|
-
instancePath: e + "/
|
|
3233
|
-
schemaPath: "#/properties/
|
|
3319
|
+
instancePath: e + "/name",
|
|
3320
|
+
schemaPath: "#/properties/name/type",
|
|
3234
3321
|
keyword: "type",
|
|
3235
3322
|
params: { type: "string" },
|
|
3236
3323
|
message: "must be string"
|
|
3237
3324
|
}
|
|
3238
3325
|
], !1;
|
|
3239
|
-
|
|
3240
|
-
return validate11.errors = [
|
|
3241
|
-
{
|
|
3242
|
-
instancePath: e + "/mode",
|
|
3243
|
-
schemaPath: "#/properties/mode/const",
|
|
3244
|
-
keyword: "const",
|
|
3245
|
-
params: {
|
|
3246
|
-
allowedValue: "php-extension"
|
|
3247
|
-
},
|
|
3248
|
-
message: "must be equal to constant"
|
|
3249
|
-
}
|
|
3250
|
-
], !1;
|
|
3251
|
-
var a = D === o;
|
|
3326
|
+
var a = f === i;
|
|
3252
3327
|
} else
|
|
3253
3328
|
var a = !0;
|
|
3254
3329
|
if (a) {
|
|
3255
|
-
if (r.
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3330
|
+
if (r.version !== void 0) {
|
|
3331
|
+
const f = i;
|
|
3332
|
+
if (typeof r.version != "string")
|
|
3333
|
+
return validate11.errors = [
|
|
3334
|
+
{
|
|
3335
|
+
instancePath: e + "/version",
|
|
3336
|
+
schemaPath: "#/properties/version/type",
|
|
3337
|
+
keyword: "type",
|
|
3338
|
+
params: { type: "string" },
|
|
3339
|
+
message: "must be string"
|
|
3340
|
+
}
|
|
3341
|
+
], !1;
|
|
3342
|
+
var a = f === i;
|
|
3343
|
+
} else
|
|
3344
|
+
var a = !0;
|
|
3345
|
+
if (a) {
|
|
3346
|
+
if (r.mode !== void 0) {
|
|
3347
|
+
let f = r.mode;
|
|
3348
|
+
const R = i;
|
|
3349
|
+
if (typeof f != "string")
|
|
3350
|
+
return validate11.errors = [
|
|
3351
|
+
{
|
|
3352
|
+
instancePath: e + "/mode",
|
|
3353
|
+
schemaPath: "#/properties/mode/type",
|
|
3354
|
+
keyword: "type",
|
|
3355
|
+
params: { type: "string" },
|
|
3356
|
+
message: "must be string"
|
|
3357
|
+
}
|
|
3358
|
+
], !1;
|
|
3359
|
+
if (f !== "php-extension")
|
|
3360
|
+
return validate11.errors = [
|
|
3361
|
+
{
|
|
3362
|
+
instancePath: e + "/mode",
|
|
3363
|
+
schemaPath: "#/properties/mode/const",
|
|
3364
|
+
keyword: "const",
|
|
3365
|
+
params: {
|
|
3366
|
+
allowedValue: "php-extension"
|
|
3367
|
+
},
|
|
3368
|
+
message: "must be equal to constant"
|
|
3369
|
+
}
|
|
3370
|
+
], !1;
|
|
3371
|
+
var a = R === i;
|
|
3372
|
+
} else
|
|
3373
|
+
var a = !0;
|
|
3374
|
+
if (a) {
|
|
3375
|
+
if (r.loadWithIniDirective !== void 0) {
|
|
3376
|
+
const f = i;
|
|
3377
|
+
validate12(r.loadWithIniDirective, {
|
|
3378
|
+
instancePath: e + "/loadWithIniDirective",
|
|
3379
|
+
parentData: r,
|
|
3380
|
+
parentDataProperty: "loadWithIniDirective",
|
|
3381
|
+
rootData: n
|
|
3382
|
+
}) || (o = o === null ? validate12.errors : o.concat(
|
|
3383
|
+
validate12.errors
|
|
3384
|
+
), i = o.length);
|
|
3385
|
+
var a = f === i;
|
|
3386
|
+
} else
|
|
3387
|
+
var a = !0;
|
|
3388
|
+
if (a) {
|
|
3389
|
+
if (r.iniEntries !== void 0) {
|
|
3390
|
+
let f = r.iniEntries;
|
|
3391
|
+
const R = i;
|
|
3392
|
+
if (i === R)
|
|
3393
|
+
if (f && typeof f == "object" && !Array.isArray(f))
|
|
3394
|
+
for (const U in f) {
|
|
3395
|
+
const m = i;
|
|
3396
|
+
if (typeof f[U] != "string")
|
|
3397
|
+
return validate11.errors = [
|
|
3398
|
+
{
|
|
3399
|
+
instancePath: e + "/iniEntries/" + U.replace(
|
|
3400
|
+
/~/g,
|
|
3401
|
+
"~0"
|
|
3402
|
+
).replace(
|
|
3403
|
+
/\//g,
|
|
3404
|
+
"~1"
|
|
3405
|
+
),
|
|
3406
|
+
schemaPath: "#/properties/iniEntries/additionalProperties/type",
|
|
3407
|
+
keyword: "type",
|
|
3408
|
+
params: {
|
|
3409
|
+
type: "string"
|
|
3410
|
+
},
|
|
3411
|
+
message: "must be string"
|
|
3412
|
+
}
|
|
3413
|
+
], !1;
|
|
3414
|
+
var c = m === i;
|
|
3415
|
+
if (!c)
|
|
3416
|
+
break;
|
|
3276
3417
|
}
|
|
3277
|
-
|
|
3278
|
-
for (const E in b)
|
|
3279
|
-
if (!(E === "phpVersion" || E === "sourcePath" || E === "extraFiles"))
|
|
3418
|
+
else
|
|
3280
3419
|
return validate11.errors = [
|
|
3281
3420
|
{
|
|
3282
|
-
instancePath: e + "/
|
|
3283
|
-
schemaPath: "#/properties/
|
|
3284
|
-
keyword: "
|
|
3421
|
+
instancePath: e + "/iniEntries",
|
|
3422
|
+
schemaPath: "#/properties/iniEntries/type",
|
|
3423
|
+
keyword: "type",
|
|
3285
3424
|
params: {
|
|
3286
|
-
|
|
3425
|
+
type: "object"
|
|
3287
3426
|
},
|
|
3288
|
-
message: "must
|
|
3427
|
+
message: "must be object"
|
|
3289
3428
|
}
|
|
3290
3429
|
], !1;
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3430
|
+
var a = R === i;
|
|
3431
|
+
} else
|
|
3432
|
+
var a = !0;
|
|
3433
|
+
if (a) {
|
|
3434
|
+
if (r.env !== void 0) {
|
|
3435
|
+
let f = r.env;
|
|
3436
|
+
const R = i;
|
|
3437
|
+
if (i === R)
|
|
3438
|
+
if (f && typeof f == "object" && !Array.isArray(f))
|
|
3439
|
+
for (const U in f) {
|
|
3440
|
+
const m = i;
|
|
3441
|
+
if (typeof f[U] != "string")
|
|
3442
|
+
return validate11.errors = [
|
|
3443
|
+
{
|
|
3444
|
+
instancePath: e + "/env/" + U.replace(
|
|
3445
|
+
/~/g,
|
|
3446
|
+
"~0"
|
|
3447
|
+
).replace(
|
|
3448
|
+
/\//g,
|
|
3449
|
+
"~1"
|
|
3450
|
+
),
|
|
3451
|
+
schemaPath: "#/properties/env/additionalProperties/type",
|
|
3452
|
+
keyword: "type",
|
|
3453
|
+
params: {
|
|
3454
|
+
type: "string"
|
|
3455
|
+
},
|
|
3456
|
+
message: "must be string"
|
|
3457
|
+
}
|
|
3458
|
+
], !1;
|
|
3459
|
+
var l = m === i;
|
|
3460
|
+
if (!l)
|
|
3461
|
+
break;
|
|
3462
|
+
}
|
|
3463
|
+
else
|
|
3464
|
+
return validate11.errors = [
|
|
3465
|
+
{
|
|
3466
|
+
instancePath: e + "/env",
|
|
3467
|
+
schemaPath: "#/properties/env/type",
|
|
3468
|
+
keyword: "type",
|
|
3469
|
+
params: {
|
|
3470
|
+
type: "object"
|
|
3471
|
+
},
|
|
3472
|
+
message: "must be object"
|
|
3473
|
+
}
|
|
3474
|
+
], !1;
|
|
3475
|
+
var a = R === i;
|
|
3476
|
+
} else
|
|
3477
|
+
var a = !0;
|
|
3478
|
+
if (a) {
|
|
3479
|
+
if (r.extensionDir !== void 0) {
|
|
3480
|
+
const f = i;
|
|
3481
|
+
if (typeof r.extensionDir != "string")
|
|
3295
3482
|
return validate11.errors = [
|
|
3296
3483
|
{
|
|
3297
|
-
instancePath: e + "/
|
|
3298
|
-
schemaPath: "#/properties/
|
|
3484
|
+
instancePath: e + "/extensionDir",
|
|
3485
|
+
schemaPath: "#/properties/extensionDir/type",
|
|
3299
3486
|
keyword: "type",
|
|
3300
3487
|
params: {
|
|
3301
3488
|
type: "string"
|
|
@@ -3303,357 +3490,354 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3303
3490
|
message: "must be string"
|
|
3304
3491
|
}
|
|
3305
3492
|
], !1;
|
|
3306
|
-
var
|
|
3493
|
+
var a = f === i;
|
|
3307
3494
|
} else
|
|
3308
|
-
var
|
|
3309
|
-
if (
|
|
3310
|
-
if (
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3495
|
+
var a = !0;
|
|
3496
|
+
if (a) {
|
|
3497
|
+
if (r.artifacts !== void 0) {
|
|
3498
|
+
let f = r.artifacts;
|
|
3499
|
+
const R = i;
|
|
3500
|
+
if (i === R)
|
|
3501
|
+
if (Array.isArray(f)) {
|
|
3502
|
+
var d = !0;
|
|
3503
|
+
const U = f.length;
|
|
3504
|
+
for (let m = 0; m < U; m++) {
|
|
3505
|
+
let w = f[m];
|
|
3506
|
+
const q = i;
|
|
3507
|
+
if (i === q)
|
|
3508
|
+
if (w && typeof w == "object" && !Array.isArray(
|
|
3509
|
+
w
|
|
3510
|
+
)) {
|
|
3511
|
+
let W;
|
|
3512
|
+
if (w.phpVersion === void 0 && (W = "phpVersion") || w.sourcePath === void 0 && (W = "sourcePath"))
|
|
3513
|
+
return validate11.errors = [
|
|
3514
|
+
{
|
|
3515
|
+
instancePath: e + "/artifacts/" + m,
|
|
3516
|
+
schemaPath: "#/properties/artifacts/items/required",
|
|
3517
|
+
keyword: "required",
|
|
3518
|
+
params: {
|
|
3519
|
+
missingProperty: W
|
|
3520
|
+
},
|
|
3521
|
+
message: "must have required property '" + W + "'"
|
|
3522
|
+
}
|
|
3523
|
+
], !1;
|
|
3337
3524
|
{
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
{
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
params: {
|
|
3357
|
-
type: "string"
|
|
3358
|
-
},
|
|
3359
|
-
message: "must be string"
|
|
3360
|
-
}
|
|
3361
|
-
], !1;
|
|
3362
|
-
var d = w === o;
|
|
3363
|
-
} else
|
|
3364
|
-
var d = !0;
|
|
3365
|
-
if (d)
|
|
3366
|
-
if (E.nodes !== void 0) {
|
|
3367
|
-
let w = E.nodes;
|
|
3368
|
-
const ie = o;
|
|
3369
|
-
if (Array.isArray(
|
|
3370
|
-
w
|
|
3371
|
-
)) {
|
|
3372
|
-
var p = !0;
|
|
3373
|
-
const ke = w.length;
|
|
3374
|
-
for (let C = 0; C < ke; C++) {
|
|
3375
|
-
let L = w[C];
|
|
3376
|
-
const Re = o;
|
|
3377
|
-
if (L && typeof L == "object" && !Array.isArray(
|
|
3378
|
-
L
|
|
3379
|
-
)) {
|
|
3380
|
-
let oe;
|
|
3381
|
-
if (L.vfsPath === void 0 && (oe = "vfsPath"))
|
|
3525
|
+
const H = i;
|
|
3526
|
+
for (const y in w)
|
|
3527
|
+
if (!(y === "phpVersion" || y === "sourcePath" || y === "extraFiles"))
|
|
3528
|
+
return validate11.errors = [
|
|
3529
|
+
{
|
|
3530
|
+
instancePath: e + "/artifacts/" + m,
|
|
3531
|
+
schemaPath: "#/properties/artifacts/items/additionalProperties",
|
|
3532
|
+
keyword: "additionalProperties",
|
|
3533
|
+
params: {
|
|
3534
|
+
additionalProperty: y
|
|
3535
|
+
},
|
|
3536
|
+
message: "must NOT have additional properties"
|
|
3537
|
+
}
|
|
3538
|
+
], !1;
|
|
3539
|
+
if (H === i) {
|
|
3540
|
+
if (w.phpVersion !== void 0) {
|
|
3541
|
+
const y = i;
|
|
3542
|
+
if (typeof w.phpVersion != "string")
|
|
3382
3543
|
return validate11.errors = [
|
|
3383
3544
|
{
|
|
3384
|
-
instancePath: e + "/artifacts/" +
|
|
3385
|
-
schemaPath: "#/
|
|
3386
|
-
keyword: "
|
|
3545
|
+
instancePath: e + "/artifacts/" + m + "/phpVersion",
|
|
3546
|
+
schemaPath: "#/properties/artifacts/items/properties/phpVersion/type",
|
|
3547
|
+
keyword: "type",
|
|
3387
3548
|
params: {
|
|
3388
|
-
|
|
3549
|
+
type: "string"
|
|
3389
3550
|
},
|
|
3390
|
-
message: "must
|
|
3551
|
+
message: "must be string"
|
|
3391
3552
|
}
|
|
3392
3553
|
], !1;
|
|
3393
|
-
|
|
3394
|
-
|
|
3554
|
+
var u = y === i;
|
|
3555
|
+
} else
|
|
3556
|
+
var u = !0;
|
|
3557
|
+
if (u) {
|
|
3558
|
+
if (w.sourcePath !== void 0) {
|
|
3559
|
+
const y = i;
|
|
3560
|
+
if (typeof w.sourcePath != "string")
|
|
3395
3561
|
return validate11.errors = [
|
|
3396
3562
|
{
|
|
3397
|
-
instancePath: e + "/artifacts/" +
|
|
3398
|
-
schemaPath: "#/
|
|
3399
|
-
keyword: "
|
|
3563
|
+
instancePath: e + "/artifacts/" + m + "/sourcePath",
|
|
3564
|
+
schemaPath: "#/properties/artifacts/items/properties/sourcePath/type",
|
|
3565
|
+
keyword: "type",
|
|
3400
3566
|
params: {
|
|
3401
|
-
|
|
3567
|
+
type: "string"
|
|
3402
3568
|
},
|
|
3403
|
-
message: "must
|
|
3569
|
+
message: "must be string"
|
|
3404
3570
|
}
|
|
3405
3571
|
], !1;
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3572
|
+
var u = y === i;
|
|
3573
|
+
} else
|
|
3574
|
+
var u = !0;
|
|
3575
|
+
if (u)
|
|
3576
|
+
if (w.extraFiles !== void 0) {
|
|
3577
|
+
let y = w.extraFiles;
|
|
3578
|
+
const ne = i;
|
|
3579
|
+
if (i === i)
|
|
3580
|
+
if (y && typeof y == "object" && !Array.isArray(
|
|
3581
|
+
y
|
|
3582
|
+
)) {
|
|
3583
|
+
const de = i;
|
|
3584
|
+
for (const v in y)
|
|
3585
|
+
if (!(v === "vfsRoot" || v === "nodes"))
|
|
3586
|
+
return validate11.errors = [
|
|
3587
|
+
{
|
|
3588
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles",
|
|
3589
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/additionalProperties",
|
|
3590
|
+
keyword: "additionalProperties",
|
|
3591
|
+
params: {
|
|
3592
|
+
additionalProperty: v
|
|
3593
|
+
},
|
|
3594
|
+
message: "must NOT have additional properties"
|
|
3595
|
+
}
|
|
3596
|
+
], !1;
|
|
3597
|
+
if (de === i) {
|
|
3598
|
+
if (y.vfsRoot !== void 0) {
|
|
3599
|
+
const v = i;
|
|
3600
|
+
if (typeof y.vfsRoot != "string")
|
|
3601
|
+
return validate11.errors = [
|
|
3602
|
+
{
|
|
3603
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles/vfsRoot",
|
|
3604
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/vfsRoot/type",
|
|
3605
|
+
keyword: "type",
|
|
3606
|
+
params: {
|
|
3607
|
+
type: "string"
|
|
3608
|
+
},
|
|
3609
|
+
message: "must be string"
|
|
3610
|
+
}
|
|
3611
|
+
], !1;
|
|
3612
|
+
var h = v === i;
|
|
3613
|
+
} else
|
|
3614
|
+
var h = !0;
|
|
3615
|
+
if (h)
|
|
3616
|
+
if (y.nodes !== void 0) {
|
|
3617
|
+
let v = y.nodes;
|
|
3618
|
+
const ie = i;
|
|
3619
|
+
if (i === ie)
|
|
3620
|
+
if (Array.isArray(
|
|
3621
|
+
v
|
|
3622
|
+
)) {
|
|
3623
|
+
var P = !0;
|
|
3624
|
+
const Ie = v.length;
|
|
3625
|
+
for (let C = 0; C < Ie; C++) {
|
|
3626
|
+
let I = v[C];
|
|
3627
|
+
const ye = i;
|
|
3628
|
+
if (i === ye)
|
|
3629
|
+
if (I && typeof I == "object" && !Array.isArray(
|
|
3630
|
+
I
|
|
3631
|
+
)) {
|
|
3632
|
+
let ue;
|
|
3633
|
+
if (I.vfsPath === void 0 && (ue = "vfsPath"))
|
|
3634
|
+
return validate11.errors = [
|
|
3635
|
+
{
|
|
3636
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C,
|
|
3637
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/required",
|
|
3638
|
+
keyword: "required",
|
|
3639
|
+
params: {
|
|
3640
|
+
missingProperty: ue
|
|
3641
|
+
},
|
|
3642
|
+
message: "must have required property '" + ue + "'"
|
|
3643
|
+
}
|
|
3644
|
+
], !1;
|
|
3645
|
+
{
|
|
3646
|
+
const Me = i;
|
|
3647
|
+
for (const T in I)
|
|
3648
|
+
if (!(T === "vfsPath" || T === "type" || T === "sourcePath"))
|
|
3649
|
+
return validate11.errors = [
|
|
3650
|
+
{
|
|
3651
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C,
|
|
3652
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/additionalProperties",
|
|
3653
|
+
keyword: "additionalProperties",
|
|
3654
|
+
params: {
|
|
3655
|
+
additionalProperty: T
|
|
3656
|
+
},
|
|
3657
|
+
message: "must NOT have additional properties"
|
|
3658
|
+
}
|
|
3659
|
+
], !1;
|
|
3660
|
+
if (Me === i) {
|
|
3661
|
+
if (I.vfsPath !== void 0) {
|
|
3662
|
+
const T = i;
|
|
3663
|
+
if (typeof I.vfsPath != "string")
|
|
3664
|
+
return validate11.errors = [
|
|
3665
|
+
{
|
|
3666
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C + "/vfsPath",
|
|
3667
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/vfsPath/type",
|
|
3668
|
+
keyword: "type",
|
|
3669
|
+
params: {
|
|
3670
|
+
type: "string"
|
|
3671
|
+
},
|
|
3672
|
+
message: "must be string"
|
|
3673
|
+
}
|
|
3674
|
+
], !1;
|
|
3675
|
+
var S = T === i;
|
|
3676
|
+
} else
|
|
3677
|
+
var S = !0;
|
|
3678
|
+
if (S) {
|
|
3679
|
+
if (I.type !== void 0) {
|
|
3680
|
+
let T = I.type;
|
|
3681
|
+
const Ce = i;
|
|
3682
|
+
if (typeof T != "string")
|
|
3683
|
+
return validate11.errors = [
|
|
3684
|
+
{
|
|
3685
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C + "/type",
|
|
3686
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/type/type",
|
|
3687
|
+
keyword: "type",
|
|
3688
|
+
params: {
|
|
3689
|
+
type: "string"
|
|
3690
|
+
},
|
|
3691
|
+
message: "must be string"
|
|
3692
|
+
}
|
|
3693
|
+
], !1;
|
|
3694
|
+
if (!(T === "file" || T === "directory"))
|
|
3695
|
+
return validate11.errors = [
|
|
3696
|
+
{
|
|
3697
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C + "/type",
|
|
3698
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/type/enum",
|
|
3699
|
+
keyword: "enum",
|
|
3700
|
+
params: {
|
|
3701
|
+
allowedValues: schema15.properties.nodes.items.properties.type.enum
|
|
3702
|
+
},
|
|
3703
|
+
message: "must be equal to one of the allowed values"
|
|
3704
|
+
}
|
|
3705
|
+
], !1;
|
|
3706
|
+
var S = Ce === i;
|
|
3707
|
+
} else
|
|
3708
|
+
var S = !0;
|
|
3709
|
+
if (S)
|
|
3710
|
+
if (I.sourcePath !== void 0) {
|
|
3711
|
+
const T = i;
|
|
3712
|
+
if (typeof I.sourcePath != "string")
|
|
3713
|
+
return validate11.errors = [
|
|
3714
|
+
{
|
|
3715
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C + "/sourcePath",
|
|
3716
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/sourcePath/type",
|
|
3717
|
+
keyword: "type",
|
|
3718
|
+
params: {
|
|
3719
|
+
type: "string"
|
|
3720
|
+
},
|
|
3721
|
+
message: "must be string"
|
|
3722
|
+
}
|
|
3723
|
+
], !1;
|
|
3724
|
+
var S = T === i;
|
|
3725
|
+
} else
|
|
3726
|
+
var S = !0;
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
}
|
|
3730
|
+
} else
|
|
3731
|
+
return validate11.errors = [
|
|
3732
|
+
{
|
|
3733
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C,
|
|
3734
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/type",
|
|
3735
|
+
keyword: "type",
|
|
3736
|
+
params: {
|
|
3737
|
+
type: "object"
|
|
3738
|
+
},
|
|
3739
|
+
message: "must be object"
|
|
3740
|
+
}
|
|
3741
|
+
], !1;
|
|
3742
|
+
var P = ye === i;
|
|
3743
|
+
if (!P)
|
|
3744
|
+
break;
|
|
3745
|
+
}
|
|
3746
|
+
} else
|
|
3747
|
+
return validate11.errors = [
|
|
3748
|
+
{
|
|
3749
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes",
|
|
3750
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/type",
|
|
3751
|
+
keyword: "type",
|
|
3752
|
+
params: {
|
|
3753
|
+
type: "array"
|
|
3754
|
+
},
|
|
3755
|
+
message: "must be array"
|
|
3756
|
+
}
|
|
3757
|
+
], !1;
|
|
3758
|
+
var h = ie === i;
|
|
3759
|
+
} else
|
|
3760
|
+
var h = !0;
|
|
3419
3761
|
}
|
|
3420
|
-
|
|
3421
|
-
var h = T === o;
|
|
3422
|
-
} else
|
|
3423
|
-
var h = !0;
|
|
3424
|
-
if (h) {
|
|
3425
|
-
if (L.type !== void 0) {
|
|
3426
|
-
let T = L.type;
|
|
3427
|
-
const be = o;
|
|
3428
|
-
if (typeof T != "string")
|
|
3762
|
+
} else
|
|
3429
3763
|
return validate11.errors = [
|
|
3430
3764
|
{
|
|
3431
|
-
instancePath: e + "/artifacts/" +
|
|
3432
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/
|
|
3765
|
+
instancePath: e + "/artifacts/" + m + "/extraFiles",
|
|
3766
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/type",
|
|
3433
3767
|
keyword: "type",
|
|
3434
3768
|
params: {
|
|
3435
|
-
type: "
|
|
3436
|
-
},
|
|
3437
|
-
message: "must be string"
|
|
3438
|
-
}
|
|
3439
|
-
], !1;
|
|
3440
|
-
if (!(T === "file" || T === "directory"))
|
|
3441
|
-
return validate11.errors = [
|
|
3442
|
-
{
|
|
3443
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles/nodes/" + C + "/type",
|
|
3444
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/type/enum",
|
|
3445
|
-
keyword: "enum",
|
|
3446
|
-
params: {
|
|
3447
|
-
allowedValues: schema13.properties.nodes.items.properties.type.enum
|
|
3769
|
+
type: "object"
|
|
3448
3770
|
},
|
|
3449
|
-
message: "must be
|
|
3771
|
+
message: "must be object"
|
|
3450
3772
|
}
|
|
3451
3773
|
], !1;
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
if (h)
|
|
3456
|
-
if (L.sourcePath !== void 0) {
|
|
3457
|
-
const T = o;
|
|
3458
|
-
if (typeof L.sourcePath != "string")
|
|
3459
|
-
return validate11.errors = [
|
|
3460
|
-
{
|
|
3461
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles/nodes/" + C + "/sourcePath",
|
|
3462
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/sourcePath/type",
|
|
3463
|
-
keyword: "type",
|
|
3464
|
-
params: {
|
|
3465
|
-
type: "string"
|
|
3466
|
-
},
|
|
3467
|
-
message: "must be string"
|
|
3468
|
-
}
|
|
3469
|
-
], !1;
|
|
3470
|
-
var h = T === o;
|
|
3471
|
-
} else
|
|
3472
|
-
var h = !0;
|
|
3473
|
-
}
|
|
3474
|
-
}
|
|
3475
|
-
} else
|
|
3476
|
-
return validate11.errors = [
|
|
3477
|
-
{
|
|
3478
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles/nodes/" + C,
|
|
3479
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/type",
|
|
3480
|
-
keyword: "type",
|
|
3481
|
-
params: {
|
|
3482
|
-
type: "object"
|
|
3483
|
-
},
|
|
3484
|
-
message: "must be object"
|
|
3485
|
-
}
|
|
3486
|
-
], !1;
|
|
3487
|
-
var p = Re === o;
|
|
3488
|
-
if (!p)
|
|
3489
|
-
break;
|
|
3490
|
-
}
|
|
3491
|
-
} else
|
|
3492
|
-
return validate11.errors = [
|
|
3493
|
-
{
|
|
3494
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles/nodes",
|
|
3495
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/type",
|
|
3496
|
-
keyword: "type",
|
|
3497
|
-
params: {
|
|
3498
|
-
type: "array"
|
|
3499
|
-
},
|
|
3500
|
-
message: "must be array"
|
|
3774
|
+
var u = ne === i;
|
|
3775
|
+
} else
|
|
3776
|
+
var u = !0;
|
|
3501
3777
|
}
|
|
3502
|
-
|
|
3503
|
-
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3504
3780
|
} else
|
|
3505
|
-
|
|
3781
|
+
return validate11.errors = [
|
|
3782
|
+
{
|
|
3783
|
+
instancePath: e + "/artifacts/" + m,
|
|
3784
|
+
schemaPath: "#/properties/artifacts/items/type",
|
|
3785
|
+
keyword: "type",
|
|
3786
|
+
params: {
|
|
3787
|
+
type: "object"
|
|
3788
|
+
},
|
|
3789
|
+
message: "must be object"
|
|
3790
|
+
}
|
|
3791
|
+
], !1;
|
|
3792
|
+
var d = q === i;
|
|
3793
|
+
if (!d)
|
|
3794
|
+
break;
|
|
3506
3795
|
}
|
|
3507
3796
|
} else
|
|
3508
3797
|
return validate11.errors = [
|
|
3509
3798
|
{
|
|
3510
|
-
instancePath: e + "/artifacts
|
|
3511
|
-
schemaPath: "#/
|
|
3799
|
+
instancePath: e + "/artifacts",
|
|
3800
|
+
schemaPath: "#/properties/artifacts/type",
|
|
3512
3801
|
keyword: "type",
|
|
3513
3802
|
params: {
|
|
3514
|
-
type: "
|
|
3803
|
+
type: "array"
|
|
3515
3804
|
},
|
|
3516
|
-
message: "must be
|
|
3805
|
+
message: "must be array"
|
|
3517
3806
|
}
|
|
3518
3807
|
], !1;
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
message: "must be object"
|
|
3534
|
-
}
|
|
3535
|
-
], !1;
|
|
3536
|
-
var c = Q === o;
|
|
3537
|
-
if (!c)
|
|
3538
|
-
break;
|
|
3539
|
-
}
|
|
3540
|
-
} else
|
|
3541
|
-
return validate11.errors = [
|
|
3542
|
-
{
|
|
3543
|
-
instancePath: e + "/artifacts",
|
|
3544
|
-
schemaPath: "#/properties/artifacts/type",
|
|
3545
|
-
keyword: "type",
|
|
3546
|
-
params: { type: "array" },
|
|
3547
|
-
message: "must be array"
|
|
3548
|
-
}
|
|
3549
|
-
], !1;
|
|
3550
|
-
var a = D === o;
|
|
3551
|
-
} else
|
|
3552
|
-
var a = !0;
|
|
3553
|
-
if (a)
|
|
3554
|
-
if (r.extraFiles !== void 0) {
|
|
3555
|
-
let m = r.extraFiles;
|
|
3556
|
-
const D = o;
|
|
3557
|
-
if (m && typeof m == "object" && !Array.isArray(m)) {
|
|
3558
|
-
for (const S in m)
|
|
3559
|
-
if (!(S === "vfsRoot" || S === "nodes"))
|
|
3560
|
-
return validate11.errors = [
|
|
3561
|
-
{
|
|
3562
|
-
instancePath: e + "/extraFiles",
|
|
3563
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/additionalProperties",
|
|
3564
|
-
keyword: "additionalProperties",
|
|
3565
|
-
params: {
|
|
3566
|
-
additionalProperty: S
|
|
3567
|
-
},
|
|
3568
|
-
message: "must NOT have additional properties"
|
|
3569
|
-
}
|
|
3570
|
-
], !1;
|
|
3571
|
-
{
|
|
3572
|
-
if (m.vfsRoot !== void 0) {
|
|
3573
|
-
const S = o;
|
|
3574
|
-
if (typeof m.vfsRoot != "string")
|
|
3575
|
-
return validate11.errors = [
|
|
3576
|
-
{
|
|
3577
|
-
instancePath: e + "/extraFiles/vfsRoot",
|
|
3578
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/vfsRoot/type",
|
|
3579
|
-
keyword: "type",
|
|
3580
|
-
params: {
|
|
3581
|
-
type: "string"
|
|
3582
|
-
},
|
|
3583
|
-
message: "must be string"
|
|
3584
|
-
}
|
|
3585
|
-
], !1;
|
|
3586
|
-
var f = S === o;
|
|
3587
|
-
} else
|
|
3588
|
-
var f = !0;
|
|
3589
|
-
if (f)
|
|
3590
|
-
if (m.nodes !== void 0) {
|
|
3591
|
-
let S = m.nodes;
|
|
3592
|
-
const g = o;
|
|
3593
|
-
if (Array.isArray(
|
|
3594
|
-
S
|
|
3595
|
-
)) {
|
|
3596
|
-
var k = !0;
|
|
3597
|
-
const Q = S.length;
|
|
3598
|
-
for (let I = 0; I < Q; I++) {
|
|
3599
|
-
let F = S[I];
|
|
3600
|
-
const E = o;
|
|
3601
|
-
if (F && typeof F == "object" && !Array.isArray(
|
|
3602
|
-
F
|
|
3603
|
-
)) {
|
|
3604
|
-
let ne;
|
|
3605
|
-
if (F.vfsPath === void 0 && (ne = "vfsPath"))
|
|
3606
|
-
return validate11.errors = [
|
|
3607
|
-
{
|
|
3608
|
-
instancePath: e + "/extraFiles/nodes/" + I,
|
|
3609
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/required",
|
|
3610
|
-
keyword: "required",
|
|
3611
|
-
params: {
|
|
3612
|
-
missingProperty: ne
|
|
3613
|
-
},
|
|
3614
|
-
message: "must have required property '" + ne + "'"
|
|
3615
|
-
}
|
|
3616
|
-
], !1;
|
|
3617
|
-
for (const w in F)
|
|
3618
|
-
if (!(w === "vfsPath" || w === "type" || w === "sourcePath"))
|
|
3619
|
-
return validate11.errors = [
|
|
3620
|
-
{
|
|
3621
|
-
instancePath: e + "/extraFiles/nodes/" + I,
|
|
3622
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/additionalProperties",
|
|
3623
|
-
keyword: "additionalProperties",
|
|
3624
|
-
params: {
|
|
3625
|
-
additionalProperty: w
|
|
3626
|
-
},
|
|
3627
|
-
message: "must NOT have additional properties"
|
|
3628
|
-
}
|
|
3629
|
-
], !1;
|
|
3630
|
-
{
|
|
3631
|
-
if (F.vfsPath !== void 0) {
|
|
3632
|
-
const w = o;
|
|
3633
|
-
if (typeof F.vfsPath != "string")
|
|
3808
|
+
var a = R === i;
|
|
3809
|
+
} else
|
|
3810
|
+
var a = !0;
|
|
3811
|
+
if (a)
|
|
3812
|
+
if (r.extraFiles !== void 0) {
|
|
3813
|
+
let f = r.extraFiles;
|
|
3814
|
+
const R = i;
|
|
3815
|
+
if (i === i)
|
|
3816
|
+
if (f && typeof f == "object" && !Array.isArray(
|
|
3817
|
+
f
|
|
3818
|
+
)) {
|
|
3819
|
+
const m = i;
|
|
3820
|
+
for (const w in f)
|
|
3821
|
+
if (!(w === "vfsRoot" || w === "nodes"))
|
|
3634
3822
|
return validate11.errors = [
|
|
3635
3823
|
{
|
|
3636
|
-
instancePath: e + "/extraFiles
|
|
3637
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/
|
|
3638
|
-
keyword: "
|
|
3824
|
+
instancePath: e + "/extraFiles",
|
|
3825
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/additionalProperties",
|
|
3826
|
+
keyword: "additionalProperties",
|
|
3639
3827
|
params: {
|
|
3640
|
-
|
|
3828
|
+
additionalProperty: w
|
|
3641
3829
|
},
|
|
3642
|
-
message: "must
|
|
3830
|
+
message: "must NOT have additional properties"
|
|
3643
3831
|
}
|
|
3644
3832
|
], !1;
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
if (F.type !== void 0) {
|
|
3650
|
-
let w = F.type;
|
|
3651
|
-
const ie = o;
|
|
3652
|
-
if (typeof w != "string")
|
|
3833
|
+
if (m === i) {
|
|
3834
|
+
if (f.vfsRoot !== void 0) {
|
|
3835
|
+
const w = i;
|
|
3836
|
+
if (typeof f.vfsRoot != "string")
|
|
3653
3837
|
return validate11.errors = [
|
|
3654
3838
|
{
|
|
3655
|
-
instancePath: e + "/extraFiles/
|
|
3656
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/
|
|
3839
|
+
instancePath: e + "/extraFiles/vfsRoot",
|
|
3840
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/vfsRoot/type",
|
|
3657
3841
|
keyword: "type",
|
|
3658
3842
|
params: {
|
|
3659
3843
|
type: "string"
|
|
@@ -3661,118 +3845,207 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3661
3845
|
message: "must be string"
|
|
3662
3846
|
}
|
|
3663
3847
|
], !1;
|
|
3664
|
-
|
|
3665
|
-
return validate11.errors = [
|
|
3666
|
-
{
|
|
3667
|
-
instancePath: e + "/extraFiles/nodes/" + I + "/type",
|
|
3668
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/type/enum",
|
|
3669
|
-
keyword: "enum",
|
|
3670
|
-
params: {
|
|
3671
|
-
allowedValues: schema13.properties.nodes.items.properties.type.enum
|
|
3672
|
-
},
|
|
3673
|
-
message: "must be equal to one of the allowed values"
|
|
3674
|
-
}
|
|
3675
|
-
], !1;
|
|
3676
|
-
var R = ie === o;
|
|
3848
|
+
var N = w === i;
|
|
3677
3849
|
} else
|
|
3678
|
-
var
|
|
3679
|
-
if (
|
|
3680
|
-
if (
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3850
|
+
var N = !0;
|
|
3851
|
+
if (N)
|
|
3852
|
+
if (f.nodes !== void 0) {
|
|
3853
|
+
let w = f.nodes;
|
|
3854
|
+
const q = i;
|
|
3855
|
+
if (i === q)
|
|
3856
|
+
if (Array.isArray(
|
|
3857
|
+
w
|
|
3858
|
+
)) {
|
|
3859
|
+
var B = !0;
|
|
3860
|
+
const W = w.length;
|
|
3861
|
+
for (let H = 0; H < W; H++) {
|
|
3862
|
+
let y = w[H];
|
|
3863
|
+
const ne = i;
|
|
3864
|
+
if (i === ne)
|
|
3865
|
+
if (y && typeof y == "object" && !Array.isArray(
|
|
3866
|
+
y
|
|
3867
|
+
)) {
|
|
3868
|
+
let le;
|
|
3869
|
+
if (y.vfsPath === void 0 && (le = "vfsPath"))
|
|
3870
|
+
return validate11.errors = [
|
|
3871
|
+
{
|
|
3872
|
+
instancePath: e + "/extraFiles/nodes/" + H,
|
|
3873
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/required",
|
|
3874
|
+
keyword: "required",
|
|
3875
|
+
params: {
|
|
3876
|
+
missingProperty: le
|
|
3877
|
+
},
|
|
3878
|
+
message: "must have required property '" + le + "'"
|
|
3879
|
+
}
|
|
3880
|
+
], !1;
|
|
3881
|
+
{
|
|
3882
|
+
const de = i;
|
|
3883
|
+
for (const v in y)
|
|
3884
|
+
if (!(v === "vfsPath" || v === "type" || v === "sourcePath"))
|
|
3885
|
+
return validate11.errors = [
|
|
3886
|
+
{
|
|
3887
|
+
instancePath: e + "/extraFiles/nodes/" + H,
|
|
3888
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/additionalProperties",
|
|
3889
|
+
keyword: "additionalProperties",
|
|
3890
|
+
params: {
|
|
3891
|
+
additionalProperty: v
|
|
3892
|
+
},
|
|
3893
|
+
message: "must NOT have additional properties"
|
|
3894
|
+
}
|
|
3895
|
+
], !1;
|
|
3896
|
+
if (de === i) {
|
|
3897
|
+
if (y.vfsPath !== void 0) {
|
|
3898
|
+
const v = i;
|
|
3899
|
+
if (typeof y.vfsPath != "string")
|
|
3900
|
+
return validate11.errors = [
|
|
3901
|
+
{
|
|
3902
|
+
instancePath: e + "/extraFiles/nodes/" + H + "/vfsPath",
|
|
3903
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/vfsPath/type",
|
|
3904
|
+
keyword: "type",
|
|
3905
|
+
params: {
|
|
3906
|
+
type: "string"
|
|
3907
|
+
},
|
|
3908
|
+
message: "must be string"
|
|
3909
|
+
}
|
|
3910
|
+
], !1;
|
|
3911
|
+
var k = v === i;
|
|
3912
|
+
} else
|
|
3913
|
+
var k = !0;
|
|
3914
|
+
if (k) {
|
|
3915
|
+
if (y.type !== void 0) {
|
|
3916
|
+
let v = y.type;
|
|
3917
|
+
const ie = i;
|
|
3918
|
+
if (typeof v != "string")
|
|
3919
|
+
return validate11.errors = [
|
|
3920
|
+
{
|
|
3921
|
+
instancePath: e + "/extraFiles/nodes/" + H + "/type",
|
|
3922
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/type/type",
|
|
3923
|
+
keyword: "type",
|
|
3924
|
+
params: {
|
|
3925
|
+
type: "string"
|
|
3926
|
+
},
|
|
3927
|
+
message: "must be string"
|
|
3928
|
+
}
|
|
3929
|
+
], !1;
|
|
3930
|
+
if (!(v === "file" || v === "directory"))
|
|
3931
|
+
return validate11.errors = [
|
|
3932
|
+
{
|
|
3933
|
+
instancePath: e + "/extraFiles/nodes/" + H + "/type",
|
|
3934
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/type/enum",
|
|
3935
|
+
keyword: "enum",
|
|
3936
|
+
params: {
|
|
3937
|
+
allowedValues: schema15.properties.nodes.items.properties.type.enum
|
|
3938
|
+
},
|
|
3939
|
+
message: "must be equal to one of the allowed values"
|
|
3940
|
+
}
|
|
3941
|
+
], !1;
|
|
3942
|
+
var k = ie === i;
|
|
3943
|
+
} else
|
|
3944
|
+
var k = !0;
|
|
3945
|
+
if (k)
|
|
3946
|
+
if (y.sourcePath !== void 0) {
|
|
3947
|
+
const v = i;
|
|
3948
|
+
if (typeof y.sourcePath != "string")
|
|
3949
|
+
return validate11.errors = [
|
|
3950
|
+
{
|
|
3951
|
+
instancePath: e + "/extraFiles/nodes/" + H + "/sourcePath",
|
|
3952
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/sourcePath/type",
|
|
3953
|
+
keyword: "type",
|
|
3954
|
+
params: {
|
|
3955
|
+
type: "string"
|
|
3956
|
+
},
|
|
3957
|
+
message: "must be string"
|
|
3958
|
+
}
|
|
3959
|
+
], !1;
|
|
3960
|
+
var k = v === i;
|
|
3961
|
+
} else
|
|
3962
|
+
var k = !0;
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
}
|
|
3966
|
+
} else
|
|
3967
|
+
return validate11.errors = [
|
|
3968
|
+
{
|
|
3969
|
+
instancePath: e + "/extraFiles/nodes/" + H,
|
|
3970
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/type",
|
|
3971
|
+
keyword: "type",
|
|
3972
|
+
params: {
|
|
3973
|
+
type: "object"
|
|
3974
|
+
},
|
|
3975
|
+
message: "must be object"
|
|
3976
|
+
}
|
|
3977
|
+
], !1;
|
|
3978
|
+
var B = ne === i;
|
|
3979
|
+
if (!B)
|
|
3980
|
+
break;
|
|
3692
3981
|
}
|
|
3693
|
-
|
|
3694
|
-
|
|
3982
|
+
} else
|
|
3983
|
+
return validate11.errors = [
|
|
3984
|
+
{
|
|
3985
|
+
instancePath: e + "/extraFiles/nodes",
|
|
3986
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/type",
|
|
3987
|
+
keyword: "type",
|
|
3988
|
+
params: {
|
|
3989
|
+
type: "array"
|
|
3990
|
+
},
|
|
3991
|
+
message: "must be array"
|
|
3992
|
+
}
|
|
3993
|
+
], !1;
|
|
3994
|
+
var N = q === i;
|
|
3695
3995
|
} else
|
|
3696
|
-
var
|
|
3996
|
+
var N = !0;
|
|
3697
3997
|
}
|
|
3698
|
-
}
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
}
|
|
3715
|
-
} else
|
|
3716
|
-
return validate11.errors = [
|
|
3717
|
-
{
|
|
3718
|
-
instancePath: e + "/extraFiles/nodes",
|
|
3719
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/type",
|
|
3720
|
-
keyword: "type",
|
|
3721
|
-
params: {
|
|
3722
|
-
type: "array"
|
|
3723
|
-
},
|
|
3724
|
-
message: "must be array"
|
|
3725
|
-
}
|
|
3726
|
-
], !1;
|
|
3727
|
-
var f = g === o;
|
|
3728
|
-
} else
|
|
3729
|
-
var f = !0;
|
|
3730
|
-
}
|
|
3731
|
-
} else
|
|
3732
|
-
return validate11.errors = [
|
|
3733
|
-
{
|
|
3734
|
-
instancePath: e + "/extraFiles",
|
|
3735
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/type",
|
|
3736
|
-
keyword: "type",
|
|
3737
|
-
params: {
|
|
3738
|
-
type: "object"
|
|
3739
|
-
},
|
|
3740
|
-
message: "must be object"
|
|
3998
|
+
} else
|
|
3999
|
+
return validate11.errors = [
|
|
4000
|
+
{
|
|
4001
|
+
instancePath: e + "/extraFiles",
|
|
4002
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/type",
|
|
4003
|
+
keyword: "type",
|
|
4004
|
+
params: {
|
|
4005
|
+
type: "object"
|
|
4006
|
+
},
|
|
4007
|
+
message: "must be object"
|
|
4008
|
+
}
|
|
4009
|
+
], !1;
|
|
4010
|
+
var a = R === i;
|
|
4011
|
+
} else
|
|
4012
|
+
var a = !0;
|
|
4013
|
+
}
|
|
3741
4014
|
}
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
}
|
|
3745
|
-
|
|
4015
|
+
}
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
3746
4019
|
}
|
|
3747
4020
|
}
|
|
3748
4021
|
}
|
|
3749
|
-
}
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
return validate11.errors = i, o === 0;
|
|
4022
|
+
} else
|
|
4023
|
+
return validate11.errors = [
|
|
4024
|
+
{
|
|
4025
|
+
instancePath: e,
|
|
4026
|
+
schemaPath: "#/type",
|
|
4027
|
+
keyword: "type",
|
|
4028
|
+
params: { type: "object" },
|
|
4029
|
+
message: "must be object"
|
|
4030
|
+
}
|
|
4031
|
+
], !1;
|
|
4032
|
+
return validate11.errors = o, i === 0;
|
|
3761
4033
|
}
|
|
3762
4034
|
function validate10(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
|
|
3763
|
-
let
|
|
4035
|
+
let o = null, i = 0;
|
|
3764
4036
|
return validate11(r, {
|
|
3765
4037
|
instancePath: e,
|
|
3766
4038
|
parentData: t,
|
|
3767
4039
|
parentDataProperty: s,
|
|
3768
4040
|
rootData: n
|
|
3769
|
-
}) || (
|
|
4041
|
+
}) || (o = o === null ? validate11.errors : o.concat(validate11.errors), i = o.length), validate10.errors = o, i === 0;
|
|
3770
4042
|
}
|
|
3771
4043
|
const PHP_EXTENSIONS_DIR = "/internal/shared/extensions", MAX_EXTENSION_SIDECAR_FILE_REQUESTS = 5;
|
|
3772
4044
|
async function resolvePHPExtension(r) {
|
|
3773
4045
|
const e = r.fetch ?? globalThis.fetch, t = r.source;
|
|
3774
4046
|
let s = r.name, n;
|
|
3775
|
-
const
|
|
4047
|
+
const o = {}, i = [];
|
|
4048
|
+
let a, c, l, d;
|
|
3776
4049
|
if (t.format === "so") {
|
|
3777
4050
|
if (s || (s = t.name), !s)
|
|
3778
4051
|
throw new Error(
|
|
@@ -3780,9 +4053,9 @@ async function resolvePHPExtension(r) {
|
|
|
3780
4053
|
);
|
|
3781
4054
|
n = toUint8Array(t.bytes);
|
|
3782
4055
|
} else if (t.format === "url") {
|
|
3783
|
-
let
|
|
4056
|
+
let k;
|
|
3784
4057
|
try {
|
|
3785
|
-
|
|
4058
|
+
k = new URL(String(t.url));
|
|
3786
4059
|
} catch {
|
|
3787
4060
|
throw new Error(
|
|
3788
4061
|
`source.url must be an absolute URL when loading a PHP extension from a direct URL. Received: ${String(
|
|
@@ -3790,78 +4063,83 @@ async function resolvePHPExtension(r) {
|
|
|
3790
4063
|
)}`
|
|
3791
4064
|
);
|
|
3792
4065
|
}
|
|
3793
|
-
if (s || (s = t.name), !s &&
|
|
4066
|
+
if (s || (s = t.name), !s && k.pathname.endsWith(".so") && (s = basename(k.pathname).slice(0, -3)), !s)
|
|
3794
4067
|
throw new Error(
|
|
3795
4068
|
"name is required when loading an extension from a direct URL."
|
|
3796
4069
|
);
|
|
3797
|
-
n = await fetchBytes(e,
|
|
4070
|
+
n = await fetchBytes(e, k);
|
|
3798
4071
|
} else {
|
|
3799
|
-
let
|
|
3800
|
-
if ("manifest" in t ? (
|
|
4072
|
+
let k, L;
|
|
4073
|
+
if ("manifest" in t ? (k = t.manifest, t.baseUrl && (L = new URL(String(t.baseUrl)))) : (L = new URL(String(t.manifestUrl)), k = await (await e(L)).json()), !validate10(k))
|
|
3801
4074
|
throw new Error(
|
|
3802
4075
|
`Invalid PHP extension manifest: ${JSON.stringify(
|
|
3803
4076
|
validate10.errors
|
|
3804
4077
|
)}`
|
|
3805
4078
|
);
|
|
3806
|
-
const
|
|
3807
|
-
if (!
|
|
4079
|
+
const O = k;
|
|
4080
|
+
if (!L)
|
|
3808
4081
|
throw new Error(
|
|
3809
4082
|
"Manifest artifacts require a manifest URL or baseUrl so relative files can be resolved."
|
|
3810
4083
|
);
|
|
3811
|
-
const
|
|
3812
|
-
(
|
|
4084
|
+
const f = O.artifacts.find(
|
|
4085
|
+
(m) => m.phpVersion === r.phpVersion
|
|
3813
4086
|
);
|
|
3814
|
-
if (!
|
|
4087
|
+
if (!f)
|
|
3815
4088
|
throw new Error(
|
|
3816
4089
|
`No extension artifact found for PHP ${r.phpVersion}.`
|
|
3817
4090
|
);
|
|
3818
|
-
s ?? (s =
|
|
3819
|
-
const
|
|
4091
|
+
s ?? (s = O.name), a = O.loadWithIniDirective, c = O.iniEntries, l = O.env, d = O.extensionDir;
|
|
4092
|
+
const R = new Semaphore({
|
|
3820
4093
|
concurrency: MAX_EXTENSION_SIDECAR_FILE_REQUESTS
|
|
3821
|
-
}),
|
|
3822
|
-
for (const
|
|
3823
|
-
for (const
|
|
3824
|
-
const
|
|
3825
|
-
if (
|
|
3826
|
-
|
|
4094
|
+
}), ce = [];
|
|
4095
|
+
for (const m of [O.extraFiles, f.extraFiles])
|
|
4096
|
+
for (const w of (m == null ? void 0 : m.nodes) ?? []) {
|
|
4097
|
+
const q = joinPaths(m.vfsRoot ?? "", w.vfsPath);
|
|
4098
|
+
if (w.type === "directory") {
|
|
4099
|
+
i.push(q);
|
|
3827
4100
|
continue;
|
|
3828
4101
|
}
|
|
3829
|
-
if (!
|
|
3830
|
-
const
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
4102
|
+
if (!w.sourcePath) continue;
|
|
4103
|
+
const Le = new URL(w.sourcePath, L);
|
|
4104
|
+
ce.push(
|
|
4105
|
+
R.run(() => fetchBytes(e, Le)).then((W) => {
|
|
4106
|
+
o[q] = W;
|
|
3834
4107
|
})
|
|
3835
4108
|
);
|
|
3836
4109
|
}
|
|
3837
|
-
const [
|
|
3838
|
-
fetchBytes(e, new URL(
|
|
3839
|
-
...
|
|
4110
|
+
const [U] = await Promise.all([
|
|
4111
|
+
fetchBytes(e, new URL(f.sourcePath, L)),
|
|
4112
|
+
...ce
|
|
3840
4113
|
]);
|
|
3841
|
-
n =
|
|
4114
|
+
n = U;
|
|
3842
4115
|
}
|
|
3843
|
-
const
|
|
3844
|
-
r.extensionDir ?? PHP_EXTENSIONS_DIR
|
|
4116
|
+
const u = normalizePath(
|
|
4117
|
+
r.extensionDir ?? d ?? PHP_EXTENSIONS_DIR
|
|
3845
4118
|
);
|
|
3846
|
-
r.extraFiles && (Object.assign(
|
|
3847
|
-
const
|
|
3848
|
-
|
|
3849
|
-
...
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
4119
|
+
r.extraFiles && (Object.assign(o, r.extraFiles.files), i.push(...r.extraFiles.directories ?? []));
|
|
4120
|
+
const h = r.loadWithIniDirective ?? a ?? "extension", P = {
|
|
4121
|
+
...c,
|
|
4122
|
+
...r.iniEntries
|
|
4123
|
+
}, S = joinPaths(u, `${s}.so`), N = createPHPExtensionIniFile({
|
|
4124
|
+
directive: h,
|
|
4125
|
+
extensionDir: u,
|
|
4126
|
+
name: s,
|
|
4127
|
+
soPath: S,
|
|
4128
|
+
iniEntries: P
|
|
4129
|
+
}), B = {
|
|
4130
|
+
...l,
|
|
4131
|
+
...r.env
|
|
4132
|
+
};
|
|
3854
4133
|
return {
|
|
3855
|
-
soPath:
|
|
4134
|
+
soPath: S,
|
|
3856
4135
|
soBytes: n,
|
|
3857
|
-
|
|
3858
|
-
iniContent: p,
|
|
4136
|
+
...N,
|
|
3859
4137
|
extraFiles: {
|
|
3860
|
-
files:
|
|
3861
|
-
directories:
|
|
4138
|
+
files: o,
|
|
4139
|
+
directories: i
|
|
3862
4140
|
},
|
|
3863
|
-
env:
|
|
3864
|
-
extensionDir:
|
|
4141
|
+
env: Object.keys(B).length ? B : void 0,
|
|
4142
|
+
extensionDir: u
|
|
3865
4143
|
};
|
|
3866
4144
|
}
|
|
3867
4145
|
function withResolvedPHPExtensions(r, e) {
|
|
@@ -3870,18 +4148,19 @@ function withResolvedPHPExtensions(r, e) {
|
|
|
3870
4148
|
return r;
|
|
3871
4149
|
const t = { ...r.ENV };
|
|
3872
4150
|
for (const n of e) {
|
|
3873
|
-
Object.assign(t, n.env)
|
|
3874
|
-
|
|
3875
|
-
|
|
4151
|
+
if (Object.assign(t, n.env), !n.iniPath)
|
|
4152
|
+
continue;
|
|
4153
|
+
const o = ((s = t.PHP_INI_SCAN_DIR) == null ? void 0 : s.split(":")) ?? [];
|
|
4154
|
+
o.includes(n.extensionDir) || (o.push(n.extensionDir), t.PHP_INI_SCAN_DIR = o.join(":"));
|
|
3876
4155
|
}
|
|
3877
4156
|
return {
|
|
3878
4157
|
...r,
|
|
3879
4158
|
ENV: t,
|
|
3880
4159
|
onRuntimeInitialized: (n) => {
|
|
3881
|
-
var
|
|
3882
|
-
(
|
|
3883
|
-
for (const
|
|
3884
|
-
installPHPExtensionFilesSync(n.FS,
|
|
4160
|
+
var o;
|
|
4161
|
+
(o = r.onRuntimeInitialized) == null || o.call(r, n);
|
|
4162
|
+
for (const i of e)
|
|
4163
|
+
installPHPExtensionFilesSync(n.FS, i);
|
|
3885
4164
|
}
|
|
3886
4165
|
};
|
|
3887
4166
|
}
|
|
@@ -3890,32 +4169,46 @@ function installPHPExtensionFilesSync(r, e) {
|
|
|
3890
4169
|
if ("soPath" in e)
|
|
3891
4170
|
t = e;
|
|
3892
4171
|
else {
|
|
3893
|
-
const s = e.extensionDir ?? PHP_EXTENSIONS_DIR, n = e.loadWithIniDirective ?? "extension",
|
|
4172
|
+
const s = e.extensionDir ?? PHP_EXTENSIONS_DIR, n = e.loadWithIniDirective ?? "extension", o = joinPaths(s, `${e.name}.so`), i = createPHPExtensionIniFile({
|
|
4173
|
+
directive: n,
|
|
4174
|
+
extensionDir: s,
|
|
4175
|
+
name: e.name,
|
|
4176
|
+
soPath: o,
|
|
4177
|
+
iniEntries: e.iniEntries
|
|
4178
|
+
});
|
|
3894
4179
|
t = {
|
|
3895
|
-
soPath:
|
|
4180
|
+
soPath: o,
|
|
3896
4181
|
soBytes: toUint8Array(e.soBytes),
|
|
3897
|
-
|
|
3898
|
-
iniContent: [
|
|
3899
|
-
`${n}=${i}`,
|
|
3900
|
-
...Object.entries(e.iniEntries ?? {}).map(
|
|
3901
|
-
([o, a]) => `${o}=${a}`
|
|
3902
|
-
)
|
|
3903
|
-
].join(`
|
|
3904
|
-
`),
|
|
4182
|
+
...i,
|
|
3905
4183
|
extraFiles: e.extraFiles,
|
|
3906
4184
|
env: e.env,
|
|
3907
4185
|
extensionDir: s
|
|
3908
4186
|
};
|
|
3909
4187
|
}
|
|
3910
|
-
if (mkdirIfMissing(r, t.extensionDir), r.writeFile(t.soPath, t.soBytes), r.writeFile(t.iniPath, t.iniContent), t.extraFiles) {
|
|
4188
|
+
if (mkdirIfMissing(r, t.extensionDir), r.writeFile(t.soPath, t.soBytes), t.iniPath && t.iniContent !== void 0 && r.writeFile(t.iniPath, t.iniContent), t.extraFiles) {
|
|
3911
4189
|
const { directories: s = [], files: n } = t.extraFiles;
|
|
3912
|
-
for (const
|
|
3913
|
-
mkdirIfMissing(r,
|
|
3914
|
-
for (const [
|
|
3915
|
-
mkdirIfMissing(r, dirname(
|
|
4190
|
+
for (const o of s)
|
|
4191
|
+
mkdirIfMissing(r, o);
|
|
4192
|
+
for (const [o, i] of Object.entries(n))
|
|
4193
|
+
mkdirIfMissing(r, dirname(o)), r.writeFile(o, i);
|
|
3916
4194
|
}
|
|
3917
4195
|
return t;
|
|
3918
4196
|
}
|
|
4197
|
+
function createPHPExtensionIniFile(r) {
|
|
4198
|
+
if (r.directive === !1)
|
|
4199
|
+
return {};
|
|
4200
|
+
const e = [
|
|
4201
|
+
`${r.directive}=${r.soPath}`,
|
|
4202
|
+
...Object.entries(r.iniEntries ?? {}).map(
|
|
4203
|
+
([t, s]) => `${t}=${s}`
|
|
4204
|
+
)
|
|
4205
|
+
];
|
|
4206
|
+
return {
|
|
4207
|
+
iniPath: joinPaths(r.extensionDir, `${r.name}.ini`),
|
|
4208
|
+
iniContent: e.join(`
|
|
4209
|
+
`)
|
|
4210
|
+
};
|
|
4211
|
+
}
|
|
3919
4212
|
function mkdirIfMissing(r, e) {
|
|
3920
4213
|
FSHelpers.fileExists(r, e) || r.mkdirTree(e);
|
|
3921
4214
|
}
|
|
@@ -3935,34 +4228,34 @@ function isLegacyPhpInstance(r) {
|
|
|
3935
4228
|
}
|
|
3936
4229
|
function ensureProxyFSHasMmapSupport(r) {
|
|
3937
4230
|
const e = Object.getOwnPropertySymbols(r)[0], t = r[e], s = t.PROXYFS, n = t.FS;
|
|
3938
|
-
s.stream_ops.mmap || (s.stream_ops.mmap = function(
|
|
3939
|
-
if (!n.isFile(
|
|
4231
|
+
s.stream_ops.mmap || (s.stream_ops.mmap = function(o, i, a, c, l) {
|
|
4232
|
+
if (!n.isFile(o.node.mode))
|
|
3940
4233
|
throw new n.ErrnoError(19);
|
|
3941
4234
|
if (a !== 0)
|
|
3942
4235
|
throw new n.ErrnoError(22);
|
|
3943
|
-
const d = t.malloc(
|
|
4236
|
+
const d = t.malloc(i);
|
|
3944
4237
|
if (!d)
|
|
3945
4238
|
throw new n.ErrnoError(48);
|
|
3946
|
-
const
|
|
4239
|
+
const u = t.HEAPU8.subarray(d, d + i);
|
|
3947
4240
|
let h = 0;
|
|
3948
|
-
for (; h <
|
|
3949
|
-
const
|
|
3950
|
-
|
|
3951
|
-
|
|
4241
|
+
for (; h < i; ) {
|
|
4242
|
+
const P = o.stream_ops.read(
|
|
4243
|
+
o,
|
|
4244
|
+
u,
|
|
3952
4245
|
h,
|
|
3953
|
-
|
|
4246
|
+
i - h,
|
|
3954
4247
|
h
|
|
3955
4248
|
);
|
|
3956
|
-
if (
|
|
3957
|
-
h +=
|
|
4249
|
+
if (P <= 0) break;
|
|
4250
|
+
h += P;
|
|
3958
4251
|
}
|
|
3959
|
-
if (h !==
|
|
4252
|
+
if (h !== i)
|
|
3960
4253
|
throw t.free(d), new n.ErrnoError(5);
|
|
3961
4254
|
return { ptr: d, allocated: !0 };
|
|
3962
|
-
}, s.stream_ops.msync = function(
|
|
3963
|
-
return l & 2 ||
|
|
3964
|
-
i,
|
|
4255
|
+
}, s.stream_ops.msync = function(o, i, a, c, l) {
|
|
4256
|
+
return l & 2 || o.stream_ops.write(
|
|
3965
4257
|
o,
|
|
4258
|
+
i,
|
|
3966
4259
|
a,
|
|
3967
4260
|
c,
|
|
3968
4261
|
a,
|
|
@@ -3972,31 +4265,31 @@ function ensureProxyFSHasMmapSupport(r) {
|
|
|
3972
4265
|
}
|
|
3973
4266
|
async function proxyFileSystem(r, e, t) {
|
|
3974
4267
|
const s = isLegacyPhpInstance(e), n = Object.getOwnPropertySymbols(r)[0];
|
|
3975
|
-
for (const
|
|
3976
|
-
r.fileExists(
|
|
3977
|
-
s || ensureProxyFSHasMmapSupport(
|
|
3978
|
-
const a = Object.getOwnPropertySymbols(
|
|
3979
|
-
return
|
|
4268
|
+
for (const o of t)
|
|
4269
|
+
r.fileExists(o) || r.mkdir(o), e.mkdir(o), await e.mount(o, (i) => {
|
|
4270
|
+
s || ensureProxyFSHasMmapSupport(i);
|
|
4271
|
+
const a = Object.getOwnPropertySymbols(i)[0];
|
|
4272
|
+
return i[a].FS.mount(
|
|
3980
4273
|
// @ts-ignore
|
|
3981
|
-
|
|
4274
|
+
i[a].PROXYFS,
|
|
3982
4275
|
{
|
|
3983
|
-
root:
|
|
4276
|
+
root: o,
|
|
3984
4277
|
// @ts-ignore
|
|
3985
4278
|
fs: r[n].FS
|
|
3986
4279
|
},
|
|
3987
|
-
|
|
4280
|
+
o
|
|
3988
4281
|
), () => {
|
|
3989
4282
|
try {
|
|
3990
|
-
|
|
4283
|
+
i[a].FS.unmount(o);
|
|
3991
4284
|
} catch {
|
|
3992
4285
|
}
|
|
3993
4286
|
};
|
|
3994
4287
|
});
|
|
3995
4288
|
}
|
|
3996
4289
|
function isPathToSharedFS(r, e) {
|
|
3997
|
-
var
|
|
4290
|
+
var o;
|
|
3998
4291
|
const t = Object.getOwnPropertySymbols(r)[0], n = r[t].FS.lookupPath(e, { noent_okay: !0 });
|
|
3999
|
-
return ((
|
|
4292
|
+
return ((o = n == null ? void 0 : n.node) == null ? void 0 : o.isSharedFS) ?? !1;
|
|
4000
4293
|
}
|
|
4001
4294
|
function sandboxedSpawnHandlerFactory(r) {
|
|
4002
4295
|
return createSpawnHandler(async function(e, t, s) {
|
|
@@ -4026,13 +4319,13 @@ function sandboxedSpawnHandlerFactory(r) {
|
|
|
4026
4319
|
), t.exit(127);
|
|
4027
4320
|
return;
|
|
4028
4321
|
}
|
|
4029
|
-
const { php:
|
|
4322
|
+
const { php: o, reap: i } = await r();
|
|
4030
4323
|
try {
|
|
4031
|
-
s.cwd && await
|
|
4032
|
-
const a = await
|
|
4324
|
+
s.cwd && await o.chdir(s.cwd);
|
|
4325
|
+
const a = await o.cwd();
|
|
4033
4326
|
switch (n) {
|
|
4034
4327
|
case "php": {
|
|
4035
|
-
const c = await
|
|
4328
|
+
const c = await o.cli(e, {
|
|
4036
4329
|
env: {
|
|
4037
4330
|
...s.env,
|
|
4038
4331
|
SCRIPT_PATH: e[1],
|
|
@@ -4058,7 +4351,7 @@ function sandboxedSpawnHandlerFactory(r) {
|
|
|
4058
4351
|
break;
|
|
4059
4352
|
}
|
|
4060
4353
|
case "ls": {
|
|
4061
|
-
const c = await
|
|
4354
|
+
const c = await o.listFiles(e[1] ?? a);
|
|
4062
4355
|
for (const l of c)
|
|
4063
4356
|
t.stdout(l + `
|
|
4064
4357
|
`);
|
|
@@ -4076,7 +4369,7 @@ function sandboxedSpawnHandlerFactory(r) {
|
|
|
4076
4369
|
` + a.stack : typeof a == "object" && a !== null ? JSON.stringify(a, Object.getOwnPropertyNames(a)) : String(a);
|
|
4077
4370
|
throw t.stderr(`[spawn error] ${c}`), t.exit(1), a;
|
|
4078
4371
|
} finally {
|
|
4079
|
-
|
|
4372
|
+
i();
|
|
4080
4373
|
}
|
|
4081
4374
|
});
|
|
4082
4375
|
}
|
|
@@ -4088,25 +4381,25 @@ function createSyncProxy(r, e = [], t) {
|
|
|
4088
4381
|
}, {
|
|
4089
4382
|
get(s, n) {
|
|
4090
4383
|
return n === "then" && !e.length ? {
|
|
4091
|
-
then: (
|
|
4384
|
+
then: (o, i) => i(createSyncProxy(r, [], t))
|
|
4092
4385
|
} : createSyncProxy(r, [...e, n], t);
|
|
4093
4386
|
},
|
|
4094
|
-
set(s, n,
|
|
4095
|
-
const [
|
|
4387
|
+
set(s, n, o) {
|
|
4388
|
+
const [i, a] = toWireValue(o);
|
|
4096
4389
|
return t.send(
|
|
4097
4390
|
r,
|
|
4098
4391
|
{
|
|
4099
4392
|
type: MessageType.SET,
|
|
4100
4393
|
path: [...e, n].map(String),
|
|
4101
|
-
value:
|
|
4394
|
+
value: i
|
|
4102
4395
|
},
|
|
4103
4396
|
a
|
|
4104
4397
|
), !0;
|
|
4105
4398
|
},
|
|
4106
|
-
apply(s, n,
|
|
4399
|
+
apply(s, n, o) {
|
|
4107
4400
|
if (e.at(-1) === "bind")
|
|
4108
4401
|
return createSyncProxy(r, e.slice(0, -1), t);
|
|
4109
|
-
const [a, c] = processArguments(
|
|
4402
|
+
const [a, c] = processArguments(o), l = t.send(
|
|
4110
4403
|
r,
|
|
4111
4404
|
{
|
|
4112
4405
|
type: MessageType.APPLY,
|
|
@@ -4118,14 +4411,14 @@ function createSyncProxy(r, e = [], t) {
|
|
|
4118
4411
|
return fromWireValue(l);
|
|
4119
4412
|
},
|
|
4120
4413
|
construct(s, n) {
|
|
4121
|
-
const [
|
|
4414
|
+
const [o, i] = processArguments(n), a = t.send(
|
|
4122
4415
|
r,
|
|
4123
4416
|
{
|
|
4124
4417
|
type: MessageType.CONSTRUCT,
|
|
4125
4418
|
path: e.map(String),
|
|
4126
|
-
argumentList:
|
|
4419
|
+
argumentList: o
|
|
4127
4420
|
},
|
|
4128
|
-
|
|
4421
|
+
i
|
|
4129
4422
|
);
|
|
4130
4423
|
return fromWireValue(a);
|
|
4131
4424
|
}
|
|
@@ -4157,17 +4450,17 @@ class NodeSABSyncReceiveMessageTransport {
|
|
|
4157
4450
|
}
|
|
4158
4451
|
send(e, t, s) {
|
|
4159
4452
|
var l;
|
|
4160
|
-
const n = new SharedArrayBuffer(4),
|
|
4161
|
-
|
|
4162
|
-
const
|
|
4453
|
+
const n = new SharedArrayBuffer(4), o = new Int32Array(n);
|
|
4454
|
+
o[0] = 0;
|
|
4455
|
+
const i = generateUUID();
|
|
4163
4456
|
if (e.postMessage(
|
|
4164
|
-
{ ...t, id:
|
|
4457
|
+
{ ...t, id: i, notifyBuffer: n },
|
|
4165
4458
|
s
|
|
4166
|
-
), Atomics.wait(
|
|
4459
|
+
), Atomics.wait(o, 0, 0, 5e3) === "timed-out")
|
|
4167
4460
|
throw new Error("Timeout waiting for response");
|
|
4168
4461
|
for (; ; ) {
|
|
4169
4462
|
const d = NodeSABSyncReceiveMessageTransport.receiveMessageOnPort(e);
|
|
4170
|
-
if (((l = d.message) == null ? void 0 : l.id) ===
|
|
4463
|
+
if (((l = d.message) == null ? void 0 : l.id) === i)
|
|
4171
4464
|
return d.message;
|
|
4172
4465
|
if (!d)
|
|
4173
4466
|
throw new Error("No response received");
|
|
@@ -4236,42 +4529,42 @@ function isAllowedOrigin(r, e) {
|
|
|
4236
4529
|
return !1;
|
|
4237
4530
|
}
|
|
4238
4531
|
function expose(r, e = globalThis, t = ["*"], s) {
|
|
4239
|
-
e.addEventListener("message", function n(
|
|
4240
|
-
if (!
|
|
4532
|
+
e.addEventListener("message", function n(o) {
|
|
4533
|
+
if (!o || !o.data)
|
|
4241
4534
|
return;
|
|
4242
|
-
if (!isAllowedOrigin(t,
|
|
4243
|
-
console.warn(`Invalid origin '${
|
|
4535
|
+
if (!isAllowedOrigin(t, o.origin)) {
|
|
4536
|
+
console.warn(`Invalid origin '${o.origin}' for comlink proxy`);
|
|
4244
4537
|
return;
|
|
4245
4538
|
}
|
|
4246
|
-
const { id:
|
|
4539
|
+
const { id: i, type: a, path: c } = {
|
|
4247
4540
|
path: [],
|
|
4248
|
-
...
|
|
4249
|
-
}, l = (
|
|
4541
|
+
...o.data
|
|
4542
|
+
}, l = (o.data.argumentList || []).map(fromWireValue);
|
|
4250
4543
|
let d;
|
|
4251
4544
|
try {
|
|
4252
|
-
const
|
|
4545
|
+
const u = c.slice(0, -1).reduce((P, S) => P[S], r), h = c.reduce((P, S) => P[S], r);
|
|
4253
4546
|
switch (a) {
|
|
4254
4547
|
case MessageType.GET:
|
|
4255
4548
|
d = h;
|
|
4256
4549
|
break;
|
|
4257
4550
|
case MessageType.SET:
|
|
4258
|
-
|
|
4259
|
-
|
|
4551
|
+
u[c.slice(-1)[0]] = fromWireValue(
|
|
4552
|
+
o.data.value
|
|
4260
4553
|
), d = !0;
|
|
4261
4554
|
break;
|
|
4262
4555
|
case MessageType.APPLY:
|
|
4263
|
-
d = h.apply(
|
|
4556
|
+
d = h.apply(u, l);
|
|
4264
4557
|
break;
|
|
4265
4558
|
case MessageType.CONSTRUCT:
|
|
4266
4559
|
{
|
|
4267
|
-
const
|
|
4268
|
-
d = proxy(
|
|
4560
|
+
const P = new h(...l);
|
|
4561
|
+
d = proxy(P);
|
|
4269
4562
|
}
|
|
4270
4563
|
break;
|
|
4271
4564
|
case MessageType.ENDPOINT:
|
|
4272
4565
|
{
|
|
4273
|
-
const { port1:
|
|
4274
|
-
expose(r,
|
|
4566
|
+
const { port1: P, port2: S } = new MessageChannel();
|
|
4567
|
+
expose(r, S), d = transfer(P, [P]);
|
|
4275
4568
|
}
|
|
4276
4569
|
break;
|
|
4277
4570
|
case MessageType.RELEASE:
|
|
@@ -4280,20 +4573,20 @@ function expose(r, e = globalThis, t = ["*"], s) {
|
|
|
4280
4573
|
default:
|
|
4281
4574
|
return;
|
|
4282
4575
|
}
|
|
4283
|
-
} catch (
|
|
4284
|
-
d = { value:
|
|
4576
|
+
} catch (u) {
|
|
4577
|
+
d = { value: u, [throwMarker]: 0 };
|
|
4285
4578
|
}
|
|
4286
|
-
Promise.resolve(d).catch((
|
|
4287
|
-
const [h,
|
|
4288
|
-
e.postMessage({ ...h, id:
|
|
4579
|
+
Promise.resolve(d).catch((u) => ({ value: u, [throwMarker]: 0 })).then((u) => {
|
|
4580
|
+
const [h, P] = toWireValue(u);
|
|
4581
|
+
e.postMessage({ ...h, id: i }, P), a === MessageType.RELEASE && (e.removeEventListener("message", n), closeEndPoint(e), finalizer in r && typeof r[finalizer] == "function" && r[finalizer]());
|
|
4289
4582
|
}).catch(() => {
|
|
4290
|
-
const [
|
|
4583
|
+
const [u, h] = toWireValue({
|
|
4291
4584
|
value: new TypeError("Unserializable return value"),
|
|
4292
4585
|
[throwMarker]: 0
|
|
4293
4586
|
});
|
|
4294
|
-
e.postMessage({ ...
|
|
4587
|
+
e.postMessage({ ...u, id: i }, h);
|
|
4295
4588
|
}).finally(() => {
|
|
4296
|
-
s == null || s(
|
|
4589
|
+
s == null || s(o);
|
|
4297
4590
|
});
|
|
4298
4591
|
}), e.start && e.start();
|
|
4299
4592
|
}
|
|
@@ -4306,15 +4599,15 @@ function closeEndPoint(r) {
|
|
|
4306
4599
|
function wrap(r, e) {
|
|
4307
4600
|
const t = /* @__PURE__ */ new Map();
|
|
4308
4601
|
return r.addEventListener("message", function(n) {
|
|
4309
|
-
const { data:
|
|
4310
|
-
if (!
|
|
4602
|
+
const { data: o } = n;
|
|
4603
|
+
if (!o || !o.id)
|
|
4311
4604
|
return;
|
|
4312
|
-
const
|
|
4313
|
-
if (
|
|
4605
|
+
const i = t.get(o.id);
|
|
4606
|
+
if (i)
|
|
4314
4607
|
try {
|
|
4315
|
-
o
|
|
4608
|
+
i(o);
|
|
4316
4609
|
} finally {
|
|
4317
|
-
t.delete(
|
|
4610
|
+
t.delete(o.id);
|
|
4318
4611
|
}
|
|
4319
4612
|
}), createProxy(r, t, [], e);
|
|
4320
4613
|
}
|
|
@@ -4343,15 +4636,15 @@ function unregisterProxy(r) {
|
|
|
4343
4636
|
function createProxy(r, e, t = [], s = function() {
|
|
4344
4637
|
}) {
|
|
4345
4638
|
let n = !1;
|
|
4346
|
-
const
|
|
4347
|
-
get(
|
|
4639
|
+
const o = new Proxy(s, {
|
|
4640
|
+
get(i, a) {
|
|
4348
4641
|
if (throwIfProxyReleased(n), a === releaseProxy)
|
|
4349
4642
|
return () => {
|
|
4350
|
-
unregisterProxy(
|
|
4643
|
+
unregisterProxy(o), releaseEndpoint(r), e.clear(), n = !0;
|
|
4351
4644
|
};
|
|
4352
4645
|
if (a === "then") {
|
|
4353
4646
|
if (t.length === 0)
|
|
4354
|
-
return { then: () =>
|
|
4647
|
+
return { then: () => o };
|
|
4355
4648
|
const c = requestResponseMessage(r, e, {
|
|
4356
4649
|
type: MessageType.GET,
|
|
4357
4650
|
path: t.map((l) => l.toString())
|
|
@@ -4360,7 +4653,7 @@ function createProxy(r, e, t = [], s = function() {
|
|
|
4360
4653
|
}
|
|
4361
4654
|
return createProxy(r, e, [...t, a]);
|
|
4362
4655
|
},
|
|
4363
|
-
set(
|
|
4656
|
+
set(i, a, c) {
|
|
4364
4657
|
throwIfProxyReleased(n);
|
|
4365
4658
|
const [l, d] = toWireValue(c);
|
|
4366
4659
|
return requestResponseMessage(
|
|
@@ -4368,13 +4661,13 @@ function createProxy(r, e, t = [], s = function() {
|
|
|
4368
4661
|
e,
|
|
4369
4662
|
{
|
|
4370
4663
|
type: MessageType.SET,
|
|
4371
|
-
path: [...t, a].map((
|
|
4664
|
+
path: [...t, a].map((u) => u.toString()),
|
|
4372
4665
|
value: l
|
|
4373
4666
|
},
|
|
4374
4667
|
d
|
|
4375
4668
|
).then(fromWireValue);
|
|
4376
4669
|
},
|
|
4377
|
-
apply(
|
|
4670
|
+
apply(i, a, c) {
|
|
4378
4671
|
throwIfProxyReleased(n);
|
|
4379
4672
|
const l = t[t.length - 1];
|
|
4380
4673
|
if (l === createEndpoint)
|
|
@@ -4383,7 +4676,7 @@ function createProxy(r, e, t = [], s = function() {
|
|
|
4383
4676
|
}).then(fromWireValue);
|
|
4384
4677
|
if (l === "bind")
|
|
4385
4678
|
return createProxy(r, e, t.slice(0, -1));
|
|
4386
|
-
const [d,
|
|
4679
|
+
const [d, u] = processArguments(c);
|
|
4387
4680
|
return requestResponseMessage(
|
|
4388
4681
|
r,
|
|
4389
4682
|
e,
|
|
@@ -4392,10 +4685,10 @@ function createProxy(r, e, t = [], s = function() {
|
|
|
4392
4685
|
path: t.map((h) => h.toString()),
|
|
4393
4686
|
argumentList: d
|
|
4394
4687
|
},
|
|
4395
|
-
|
|
4688
|
+
u
|
|
4396
4689
|
).then(fromWireValue);
|
|
4397
4690
|
},
|
|
4398
|
-
construct(
|
|
4691
|
+
construct(i, a) {
|
|
4399
4692
|
throwIfProxyReleased(n);
|
|
4400
4693
|
const [c, l] = processArguments(a);
|
|
4401
4694
|
return requestResponseMessage(
|
|
@@ -4410,7 +4703,7 @@ function createProxy(r, e, t = [], s = function() {
|
|
|
4410
4703
|
).then(fromWireValue);
|
|
4411
4704
|
}
|
|
4412
4705
|
});
|
|
4413
|
-
return registerProxy(
|
|
4706
|
+
return registerProxy(o, r), o;
|
|
4414
4707
|
}
|
|
4415
4708
|
function myFlat(r) {
|
|
4416
4709
|
return Array.prototype.concat.apply([], r);
|
|
@@ -4464,8 +4757,8 @@ function fromWireValue(r) {
|
|
|
4464
4757
|
}
|
|
4465
4758
|
function requestResponseMessage(r, e, t, s) {
|
|
4466
4759
|
return new Promise((n) => {
|
|
4467
|
-
const
|
|
4468
|
-
e.set(
|
|
4760
|
+
const o = generateUUID();
|
|
4761
|
+
e.set(o, n), r.start && r.start(), r.postMessage({ id: o, ...t }, s);
|
|
4469
4762
|
});
|
|
4470
4763
|
}
|
|
4471
4764
|
function generateUUID() {
|
|
@@ -4478,8 +4771,8 @@ function nodeEndpoint(r) {
|
|
|
4478
4771
|
return {
|
|
4479
4772
|
postMessage: r.postMessage.bind(r),
|
|
4480
4773
|
addEventListener: (t, s) => {
|
|
4481
|
-
const n = (
|
|
4482
|
-
"handleEvent" in s ? s.handleEvent({ data:
|
|
4774
|
+
const n = (o) => {
|
|
4775
|
+
"handleEvent" in s ? s.handleEvent({ data: o }) : s({ data: o });
|
|
4483
4776
|
};
|
|
4484
4777
|
r.on("message", n), e.set(s, n);
|
|
4485
4778
|
},
|
|
@@ -4500,20 +4793,20 @@ function nodeProcessEndpoint(r) {
|
|
|
4500
4793
|
const t = e;
|
|
4501
4794
|
return {
|
|
4502
4795
|
postMessage(s, n) {
|
|
4503
|
-
var
|
|
4796
|
+
var o;
|
|
4504
4797
|
if (n && n.length > 0)
|
|
4505
4798
|
throw new Error(
|
|
4506
4799
|
"Transferable objects are not supported for nodeProcessEndpoint"
|
|
4507
4800
|
);
|
|
4508
|
-
(
|
|
4801
|
+
(o = t.send) == null || o.call(t, s);
|
|
4509
4802
|
},
|
|
4510
4803
|
addEventListener(s, n) {
|
|
4511
|
-
const
|
|
4512
|
-
proxyByListener.set(n,
|
|
4804
|
+
const o = typeof n == "function" ? (i) => n({ data: i }) : (i) => n.handleEvent({ data: i });
|
|
4805
|
+
proxyByListener.set(n, o), t.addListener(s, o);
|
|
4513
4806
|
},
|
|
4514
4807
|
removeEventListener(s, n) {
|
|
4515
|
-
const
|
|
4516
|
-
|
|
4808
|
+
const o = proxyByListener.get(n);
|
|
4809
|
+
o && (proxyByListener.delete(n), t.removeListener(s, o));
|
|
4517
4810
|
},
|
|
4518
4811
|
start() {
|
|
4519
4812
|
}
|
|
@@ -4586,21 +4879,21 @@ const errorProperties = [
|
|
|
4586
4879
|
to: t,
|
|
4587
4880
|
forceEnumerable: s,
|
|
4588
4881
|
maxDepth: n,
|
|
4589
|
-
depth:
|
|
4590
|
-
useToJSON:
|
|
4882
|
+
depth: o,
|
|
4883
|
+
useToJSON: i,
|
|
4591
4884
|
serialize: a
|
|
4592
4885
|
}) => {
|
|
4593
|
-
if (t || (Array.isArray(r) ? t = [] : !a && isErrorLike(r) ? t = newError(r.name) : t = {}), e.push(r),
|
|
4886
|
+
if (t || (Array.isArray(r) ? t = [] : !a && isErrorLike(r) ? t = newError(r.name) : t = {}), e.push(r), o >= n)
|
|
4594
4887
|
return t;
|
|
4595
|
-
if (
|
|
4888
|
+
if (i && typeof r.toJSON == "function" && !toJsonWasCalled.has(r))
|
|
4596
4889
|
return toJSON(r);
|
|
4597
4890
|
const c = (l) => destroyCircular({
|
|
4598
4891
|
from: l,
|
|
4599
4892
|
seen: [...e],
|
|
4600
4893
|
forceEnumerable: s,
|
|
4601
4894
|
maxDepth: n,
|
|
4602
|
-
depth:
|
|
4603
|
-
useToJSON:
|
|
4895
|
+
depth: o,
|
|
4896
|
+
useToJSON: i,
|
|
4604
4897
|
serialize: a
|
|
4605
4898
|
});
|
|
4606
4899
|
for (const [l, d] of Object.entries(r)) {
|
|
@@ -4621,7 +4914,7 @@ const errorProperties = [
|
|
|
4621
4914
|
continue;
|
|
4622
4915
|
}
|
|
4623
4916
|
if (!e.includes(r[l])) {
|
|
4624
|
-
|
|
4917
|
+
o++, t[l] = c(r[l]);
|
|
4625
4918
|
continue;
|
|
4626
4919
|
}
|
|
4627
4920
|
t[l] = "[Circular]";
|
|
@@ -4686,9 +4979,9 @@ function consumeAPI(r, e = void 0) {
|
|
|
4686
4979
|
);
|
|
4687
4980
|
else
|
|
4688
4981
|
t = r instanceof Worker ? r : windowEndpoint(r, e);
|
|
4689
|
-
const n = wrap(t),
|
|
4690
|
-
return new Proxy(
|
|
4691
|
-
get: (
|
|
4982
|
+
const n = wrap(t), o = proxyClone(n);
|
|
4983
|
+
return new Proxy(o, {
|
|
4984
|
+
get: (i, a) => a === "isConnected" ? async () => {
|
|
4692
4985
|
for (; ; )
|
|
4693
4986
|
try {
|
|
4694
4987
|
await runWithTimeout(n.isConnected(), 200);
|
|
@@ -4704,38 +4997,38 @@ async function runWithTimeout(r, e) {
|
|
|
4704
4997
|
});
|
|
4705
4998
|
}
|
|
4706
4999
|
function exposeAPI(r, e, t) {
|
|
4707
|
-
const { setReady: s, setFailed: n, exposedApi:
|
|
5000
|
+
const { setReady: s, setFailed: n, exposedApi: o } = prepareForExpose(
|
|
4708
5001
|
r,
|
|
4709
5002
|
e
|
|
4710
5003
|
);
|
|
4711
|
-
let
|
|
5004
|
+
let i;
|
|
4712
5005
|
if (t)
|
|
4713
5006
|
if ("addEventListener" in t)
|
|
4714
|
-
|
|
5007
|
+
i = t;
|
|
4715
5008
|
else if ("postMessage" in t)
|
|
4716
|
-
|
|
5009
|
+
i = nodeEndpoint(t);
|
|
4717
5010
|
else if ("send" in t && "addListener" in t)
|
|
4718
|
-
|
|
5011
|
+
i = nodeProcessEndpoint(t);
|
|
4719
5012
|
else
|
|
4720
5013
|
throw new Error(
|
|
4721
5014
|
"exposeAPI: targetWorker does not look like a Worker, MessagePort, or Process"
|
|
4722
5015
|
);
|
|
4723
5016
|
else
|
|
4724
|
-
|
|
4725
|
-
return expose(
|
|
5017
|
+
i = typeof window < "u" ? windowEndpoint(self.parent) : void 0;
|
|
5018
|
+
return expose(o, i), [s, n, o];
|
|
4726
5019
|
}
|
|
4727
5020
|
async function exposeSyncAPI(r, e) {
|
|
4728
|
-
const { setReady: t, setFailed: s, exposedApi: n } = prepareForExpose(r),
|
|
4729
|
-
return exposeSync(n,
|
|
5021
|
+
const { setReady: t, setFailed: s, exposedApi: n } = prepareForExpose(r), o = await NodeSABSyncReceiveMessageTransport.create(), i = nodeEndpoint(e);
|
|
5022
|
+
return exposeSync(n, i, o), [t, s, n];
|
|
4730
5023
|
}
|
|
4731
5024
|
function prepareForExpose(r, e) {
|
|
4732
5025
|
setupTransferHandlers();
|
|
4733
5026
|
const t = Promise.resolve();
|
|
4734
5027
|
let s, n;
|
|
4735
|
-
const
|
|
5028
|
+
const o = new Promise((c, l) => {
|
|
4736
5029
|
s = c, n = l;
|
|
4737
|
-
}),
|
|
4738
|
-
get: (c, l) => l === "isConnected" ? () => t : l === "isReady" ? () =>
|
|
5030
|
+
}), i = proxyClone(r), a = new Proxy(i, {
|
|
5031
|
+
get: (c, l) => l === "isConnected" ? () => t : l === "isReady" ? () => o : l in c ? c[l] : e == null ? void 0 : e[l]
|
|
4739
5032
|
});
|
|
4740
5033
|
return { setReady: s, setFailed: n, exposedApi: a };
|
|
4741
5034
|
}
|
|
@@ -4788,33 +5081,33 @@ function setupTransferHandlers() {
|
|
|
4788
5081
|
}, transferHandlers.set("StreamedPHPResponse", {
|
|
4789
5082
|
canHandle: (t) => t instanceof StreamedPHPResponse,
|
|
4790
5083
|
serialize(t) {
|
|
4791
|
-
const s = supportsTransferableStreams(), n = promiseToPort(t.exitCode),
|
|
5084
|
+
const s = supportsTransferableStreams(), n = promiseToPort(t.exitCode), o = t.getHeadersStream();
|
|
4792
5085
|
if (s)
|
|
4793
5086
|
return [
|
|
4794
5087
|
{
|
|
4795
5088
|
__type: "StreamedPHPResponse",
|
|
4796
|
-
headers:
|
|
5089
|
+
headers: o,
|
|
4797
5090
|
stdout: t.stdout,
|
|
4798
5091
|
stderr: t.stderr,
|
|
4799
5092
|
exitCodePort: n
|
|
4800
5093
|
},
|
|
4801
5094
|
[
|
|
4802
|
-
|
|
5095
|
+
o,
|
|
4803
5096
|
t.stdout,
|
|
4804
5097
|
t.stderr,
|
|
4805
5098
|
n
|
|
4806
5099
|
]
|
|
4807
5100
|
];
|
|
4808
|
-
const
|
|
5101
|
+
const i = streamToPort(o), a = streamToPort(t.stdout), c = streamToPort(t.stderr);
|
|
4809
5102
|
return [
|
|
4810
5103
|
{
|
|
4811
5104
|
__type: "StreamedPHPResponse",
|
|
4812
|
-
headersPort:
|
|
5105
|
+
headersPort: i,
|
|
4813
5106
|
stdoutPort: a,
|
|
4814
5107
|
stderrPort: c,
|
|
4815
5108
|
exitCodePort: n
|
|
4816
5109
|
},
|
|
4817
|
-
[
|
|
5110
|
+
[i, a, c, n]
|
|
4818
5111
|
];
|
|
4819
5112
|
},
|
|
4820
5113
|
deserialize(t) {
|
|
@@ -4829,8 +5122,8 @@ function setupTransferHandlers() {
|
|
|
4829
5122
|
a
|
|
4830
5123
|
);
|
|
4831
5124
|
}
|
|
4832
|
-
const s = portToStream(t.headersPort), n = portToStream(t.stdoutPort),
|
|
4833
|
-
return new StreamedPHPResponse(s, n,
|
|
5125
|
+
const s = portToStream(t.headersPort), n = portToStream(t.stdoutPort), o = portToStream(t.stderrPort), i = portToPromise(t.exitCodePort);
|
|
5126
|
+
return new StreamedPHPResponse(s, n, o, i);
|
|
4834
5127
|
}
|
|
4835
5128
|
});
|
|
4836
5129
|
}
|
|
@@ -4856,7 +5149,7 @@ function streamToPort(r) {
|
|
|
4856
5149
|
const s = r.getReader();
|
|
4857
5150
|
try {
|
|
4858
5151
|
for (; ; ) {
|
|
4859
|
-
const { done: n, value:
|
|
5152
|
+
const { done: n, value: o } = await s.read();
|
|
4860
5153
|
if (n) {
|
|
4861
5154
|
try {
|
|
4862
5155
|
e.postMessage({ t: "close" });
|
|
@@ -4868,8 +5161,8 @@ function streamToPort(r) {
|
|
|
4868
5161
|
}
|
|
4869
5162
|
break;
|
|
4870
5163
|
}
|
|
4871
|
-
if (
|
|
4872
|
-
const
|
|
5164
|
+
if (o) {
|
|
5165
|
+
const i = o.byteOffset === 0 && o.byteLength === o.buffer.byteLength ? o : o.slice(), a = i.buffer;
|
|
4873
5166
|
try {
|
|
4874
5167
|
e.postMessage({ t: "chunk", b: a }, [
|
|
4875
5168
|
a
|
|
@@ -4877,7 +5170,7 @@ function streamToPort(r) {
|
|
|
4877
5170
|
} catch {
|
|
4878
5171
|
e.postMessage({
|
|
4879
5172
|
t: "chunk",
|
|
4880
|
-
b:
|
|
5173
|
+
b: i.buffer.slice(0)
|
|
4881
5174
|
});
|
|
4882
5175
|
}
|
|
4883
5176
|
}
|
|
@@ -4899,12 +5192,12 @@ function portToStream(r) {
|
|
|
4899
5192
|
return new ReadableStream({
|
|
4900
5193
|
start(e) {
|
|
4901
5194
|
const t = (n) => {
|
|
4902
|
-
const
|
|
4903
|
-
if (
|
|
4904
|
-
switch (
|
|
5195
|
+
const o = n.data;
|
|
5196
|
+
if (o)
|
|
5197
|
+
switch (o.t) {
|
|
4905
5198
|
case "chunk":
|
|
4906
5199
|
try {
|
|
4907
|
-
e.enqueue(new Uint8Array(
|
|
5200
|
+
e.enqueue(new Uint8Array(o.b));
|
|
4908
5201
|
} catch {
|
|
4909
5202
|
s();
|
|
4910
5203
|
}
|
|
@@ -4915,7 +5208,7 @@ function portToStream(r) {
|
|
|
4915
5208
|
case "error":
|
|
4916
5209
|
safeStreamError(
|
|
4917
5210
|
e,
|
|
4918
|
-
new Error(
|
|
5211
|
+
new Error(o.m || "Stream error")
|
|
4919
5212
|
), s();
|
|
4920
5213
|
break;
|
|
4921
5214
|
}
|
|
@@ -4971,13 +5264,13 @@ function promiseToPort(r) {
|
|
|
4971
5264
|
}
|
|
4972
5265
|
function portToPromise(r) {
|
|
4973
5266
|
return new Promise((e, t) => {
|
|
4974
|
-
const s = (
|
|
4975
|
-
const
|
|
4976
|
-
|
|
5267
|
+
const s = (o) => {
|
|
5268
|
+
const i = o.data;
|
|
5269
|
+
i && (i.t === "resolve" ? (n(), e(i.v)) : i.t === "reject" && (n(), t(new Error(i.m || ""))));
|
|
4977
5270
|
}, n = () => {
|
|
4978
|
-
var
|
|
5271
|
+
var o;
|
|
4979
5272
|
try {
|
|
4980
|
-
(
|
|
5273
|
+
(o = r.removeEventListener) == null || o.call(r, "message", s);
|
|
4981
5274
|
} catch {
|
|
4982
5275
|
}
|
|
4983
5276
|
try {
|
|
@@ -4991,7 +5284,7 @@ function portToPromise(r) {
|
|
|
4991
5284
|
};
|
|
4992
5285
|
r.addEventListener ? r.addEventListener("message", s) : r.on ? r.on(
|
|
4993
5286
|
"message",
|
|
4994
|
-
(
|
|
5287
|
+
(o) => s({ data: o })
|
|
4995
5288
|
) : r.onmessage = s, typeof r.start == "function" && r.start();
|
|
4996
5289
|
});
|
|
4997
5290
|
}
|
|
@@ -5276,8 +5569,8 @@ class FileLock {
|
|
|
5276
5569
|
...e,
|
|
5277
5570
|
end: MAX_ADDRESSABLE_FILE_OFFSET
|
|
5278
5571
|
}), e.type === "unlocked") {
|
|
5279
|
-
const
|
|
5280
|
-
for (const a of
|
|
5572
|
+
const i = this.rangeLocks.findOverlapping(e).filter((a) => a.pid === e.pid);
|
|
5573
|
+
for (const a of i)
|
|
5281
5574
|
this.rangeLocks.remove(a), a.start < e.start && this.rangeLocks.insert({
|
|
5282
5575
|
...a,
|
|
5283
5576
|
end: e.start
|
|
@@ -5289,16 +5582,16 @@ class FileLock {
|
|
|
5289
5582
|
}
|
|
5290
5583
|
if (this.isThereAConflictWithRequestedRangeLock(e))
|
|
5291
5584
|
return !1;
|
|
5292
|
-
const t = this.rangeLocks.findOverlapping(e).filter((
|
|
5585
|
+
const t = this.rangeLocks.findOverlapping(e).filter((i) => i.pid === e.pid);
|
|
5293
5586
|
let s = e.start, n = e.end;
|
|
5294
|
-
for (const
|
|
5295
|
-
this.rangeLocks.remove(
|
|
5296
|
-
const
|
|
5587
|
+
for (const i of t)
|
|
5588
|
+
this.rangeLocks.remove(i), i.start < s && (s = i.start), i.end > n && (n = i.end);
|
|
5589
|
+
const o = {
|
|
5297
5590
|
...e,
|
|
5298
5591
|
start: s,
|
|
5299
5592
|
end: n
|
|
5300
5593
|
};
|
|
5301
|
-
return this.rangeLocks.insert(
|
|
5594
|
+
return this.rangeLocks.insert(o), !0;
|
|
5302
5595
|
}
|
|
5303
5596
|
/**
|
|
5304
5597
|
* Find the first conflicting byte range lock.
|
|
@@ -5314,7 +5607,7 @@ class FileLock {
|
|
|
5314
5607
|
end: MAX_ADDRESSABLE_FILE_OFFSET
|
|
5315
5608
|
});
|
|
5316
5609
|
const s = this.rangeLocks.findOverlapping(e).find(
|
|
5317
|
-
(
|
|
5610
|
+
(o) => o.pid !== e.pid && (e.type === "exclusive" || o.type === "exclusive")
|
|
5318
5611
|
);
|
|
5319
5612
|
if (s)
|
|
5320
5613
|
return s;
|
|
@@ -5422,8 +5715,8 @@ class FileLockManagerComposite {
|
|
|
5422
5715
|
if (s = this.nativeLockManager.lockWholeFile(e, t), !s)
|
|
5423
5716
|
return !1;
|
|
5424
5717
|
n = this.wasmLockManager.lockWholeFile(e, t);
|
|
5425
|
-
} catch (
|
|
5426
|
-
logger.error("Unexpected error in lockWholeFile()",
|
|
5718
|
+
} catch (o) {
|
|
5719
|
+
logger.error("Unexpected error in lockWholeFile()", o);
|
|
5427
5720
|
} finally {
|
|
5428
5721
|
s && !n && this.nativeLockManager.lockWholeFile(e, {
|
|
5429
5722
|
...t,
|
|
@@ -5452,7 +5745,7 @@ class FileLockManagerComposite {
|
|
|
5452
5745
|
}
|
|
5453
5746
|
lockFileByteRange(e, t, s) {
|
|
5454
5747
|
if (t.type !== "unlocked") {
|
|
5455
|
-
let n,
|
|
5748
|
+
let n, o;
|
|
5456
5749
|
try {
|
|
5457
5750
|
if (n = this.nativeLockManager.lockFileByteRange(
|
|
5458
5751
|
e,
|
|
@@ -5460,15 +5753,15 @@ class FileLockManagerComposite {
|
|
|
5460
5753
|
s
|
|
5461
5754
|
), !n)
|
|
5462
5755
|
return !1;
|
|
5463
|
-
|
|
5756
|
+
o = this.wasmLockManager.lockFileByteRange(
|
|
5464
5757
|
e,
|
|
5465
5758
|
t,
|
|
5466
5759
|
s
|
|
5467
5760
|
);
|
|
5468
|
-
} catch (
|
|
5469
|
-
logger.error("Unexpected error in lockFileByteRange()",
|
|
5761
|
+
} catch (i) {
|
|
5762
|
+
logger.error("Unexpected error in lockFileByteRange()", i);
|
|
5470
5763
|
} finally {
|
|
5471
|
-
n && !
|
|
5764
|
+
n && !o && this.nativeLockManager.lockFileByteRange(
|
|
5472
5765
|
e,
|
|
5473
5766
|
{
|
|
5474
5767
|
...t,
|
|
@@ -5477,7 +5770,7 @@ class FileLockManagerComposite {
|
|
|
5477
5770
|
!1
|
|
5478
5771
|
);
|
|
5479
5772
|
}
|
|
5480
|
-
return !!n && !!
|
|
5773
|
+
return !!n && !!o;
|
|
5481
5774
|
}
|
|
5482
5775
|
try {
|
|
5483
5776
|
this.wasmLockManager.lockFileByteRange(
|
|
@@ -5565,27 +5858,27 @@ function createObjectPoolProxy(r) {
|
|
|
5565
5858
|
throw new Error("At least one instance is required");
|
|
5566
5859
|
const e = [...r], t = [];
|
|
5567
5860
|
function s() {
|
|
5568
|
-
const
|
|
5569
|
-
return
|
|
5861
|
+
const i = e.shift();
|
|
5862
|
+
return i !== void 0 ? Promise.resolve(i) : new Promise((a) => {
|
|
5570
5863
|
t.push(a);
|
|
5571
5864
|
});
|
|
5572
5865
|
}
|
|
5573
|
-
function n(
|
|
5866
|
+
function n(i) {
|
|
5574
5867
|
const a = t.shift();
|
|
5575
|
-
a ? a(
|
|
5868
|
+
a ? a(i) : e.push(i);
|
|
5576
5869
|
}
|
|
5577
|
-
function i
|
|
5870
|
+
function o(i) {
|
|
5578
5871
|
return s().then((a) => {
|
|
5579
5872
|
const c = (d) => {
|
|
5580
|
-
const
|
|
5581
|
-
return
|
|
5873
|
+
const u = d == null ? void 0 : d.finished;
|
|
5874
|
+
return u && typeof u.then == "function" ? Promise.resolve(u).then(
|
|
5582
5875
|
() => n(a),
|
|
5583
5876
|
() => n(a)
|
|
5584
5877
|
) : n(a), d;
|
|
5585
5878
|
};
|
|
5586
5879
|
let l;
|
|
5587
5880
|
try {
|
|
5588
|
-
l =
|
|
5881
|
+
l = i(a);
|
|
5589
5882
|
} catch (d) {
|
|
5590
5883
|
throw n(a), d;
|
|
5591
5884
|
}
|
|
@@ -5598,20 +5891,20 @@ function createObjectPoolProxy(r) {
|
|
|
5598
5891
|
});
|
|
5599
5892
|
}
|
|
5600
5893
|
return new Proxy({}, {
|
|
5601
|
-
get(
|
|
5602
|
-
if (a in
|
|
5603
|
-
return
|
|
5894
|
+
get(i, a) {
|
|
5895
|
+
if (a in i)
|
|
5896
|
+
return i[a];
|
|
5604
5897
|
if (a !== "then")
|
|
5605
5898
|
return new Proxy(function() {
|
|
5606
5899
|
}, {
|
|
5607
5900
|
apply(c, l, d) {
|
|
5608
|
-
return
|
|
5901
|
+
return o((u) => u[a](...d));
|
|
5609
5902
|
},
|
|
5610
5903
|
get(c, l) {
|
|
5611
5904
|
if (l === "then")
|
|
5612
|
-
return (d,
|
|
5905
|
+
return (d, u) => o((h) => h[a]).then(
|
|
5613
5906
|
d,
|
|
5614
|
-
|
|
5907
|
+
u
|
|
5615
5908
|
);
|
|
5616
5909
|
}
|
|
5617
5910
|
});
|