@php-wasm/universal 3.1.27 → 3.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +8 -8
- package/index.cjs.map +1 -1
- package/index.js +612 -794
- package/index.js.map +1 -1
- package/package.json +6 -7
- package/php-extension-manifest-schema-validator.js +586 -1173
- package/php-extension-manifest-schema.json +41 -35
- package/LICENSE +0 -339
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Z = (r) => {
|
|
2
2
|
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var G = (r, e, t) => e.has(r) || Z("Cannot " + t);
|
|
5
|
+
var p = (r, e, t) => (G(r, e, "read from private field"), t ? t.call(r) : e.get(r)), P = (r, e, t) => e.has(r) ? Z("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), _ = (r, e, t, s) => (G(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), w = (r, e, t) => (G(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";
|
|
@@ -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 F;
|
|
375
375
|
class PHPWorker {
|
|
376
376
|
/** @inheritDoc */
|
|
377
377
|
constructor(e, t) {
|
|
378
|
-
|
|
379
|
-
this.absoluteUrl = "", this.documentRoot = "", this.chroot = null,
|
|
378
|
+
P(this, F);
|
|
379
|
+
this.absoluteUrl = "", this.documentRoot = "", this.chroot = null, _(this, F, /* @__PURE__ */ new Map()), this.onMessageListeners = [], _private.set(this, {
|
|
380
380
|
monitor: t
|
|
381
381
|
}), e && this.__internal_setRequestHandler(e);
|
|
382
382
|
}
|
|
@@ -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, F).has(e) || p(this, F).set(e, /* @__PURE__ */ new Set()), p(this, F).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, F).get(e)) == null || s.delete(t);
|
|
564
564
|
}
|
|
565
565
|
dispatchEvent(e) {
|
|
566
|
-
const t =
|
|
566
|
+
const t = p(this, F).get(e.type);
|
|
567
567
|
if (t)
|
|
568
568
|
for (const s of t)
|
|
569
569
|
s(e);
|
|
@@ -595,7 +595,7 @@ class PHPWorker {
|
|
|
595
595
|
throw new Error("PHPWorker is not connected to a request handler.");
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
|
-
|
|
598
|
+
F = 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
|
}
|
|
@@ -662,8 +662,8 @@ const currentJsRuntime = function() {
|
|
|
662
662
|
201: "Created",
|
|
663
663
|
200: "OK"
|
|
664
664
|
};
|
|
665
|
-
var
|
|
666
|
-
const
|
|
665
|
+
var B, q;
|
|
666
|
+
const V = class V {
|
|
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
|
+
P(this, B);
|
|
676
676
|
/**
|
|
677
677
|
* Headers stream reserved for internal parsing.
|
|
678
678
|
*/
|
|
679
|
-
|
|
679
|
+
P(this, q);
|
|
680
680
|
this.cachedParsedHeaders = null, this.cachedStdoutBytes = null, this.cachedStderrText = null;
|
|
681
681
|
const [i, o] = e.tee();
|
|
682
|
-
|
|
682
|
+
_(this, B, i), _(this, q, o), this.stdout = t, this.stderr = s, this.exitCode = n;
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
685
685
|
* Creates a StreamedPHPResponse from a buffered PHPResponse.
|
|
@@ -708,7 +708,7 @@ const se = class se {
|
|
|
708
708
|
), a.close();
|
|
709
709
|
}
|
|
710
710
|
});
|
|
711
|
-
return new
|
|
711
|
+
return new V(
|
|
712
712
|
i,
|
|
713
713
|
t,
|
|
714
714
|
o,
|
|
@@ -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 V.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, B);
|
|
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, q)
|
|
794
794
|
)), await this.cachedParsedHeaders;
|
|
795
795
|
}
|
|
796
796
|
};
|
|
797
|
-
|
|
798
|
-
let StreamedPHPResponse =
|
|
797
|
+
B = new WeakMap(), q = new WeakMap();
|
|
798
|
+
let StreamedPHPResponse = V;
|
|
799
799
|
async function parseHeadersStream(r) {
|
|
800
800
|
const e = await streamToText(r);
|
|
801
801
|
let 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 N, T, L, R, I, C, E, f, ee, te, re, se, ne, ie, oe, ae, Y, ce, J, X;
|
|
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
|
+
P(this, f);
|
|
1083
|
+
P(this, N);
|
|
1084
|
+
P(this, T, !1);
|
|
1085
|
+
P(this, L, null);
|
|
1086
|
+
P(this, R, /* @__PURE__ */ new Map([
|
|
1087
1087
|
// Listen to all events
|
|
1088
1088
|
["*", /* @__PURE__ */ new Set()]
|
|
1089
1089
|
]));
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1090
|
+
P(this, I, []);
|
|
1091
|
+
P(this, C, {});
|
|
1092
|
+
P(this, E, {
|
|
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, E).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, R).has(r) || p(this, R).set(r, /* @__PURE__ */ new Set()), p(this, R).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, R).get(r)) == null || t.delete(e);
|
|
1119
1119
|
}
|
|
1120
1120
|
dispatchEvent(r) {
|
|
1121
1121
|
const e = [
|
|
1122
|
-
...
|
|
1123
|
-
...
|
|
1122
|
+
...p(this, R).get(r.type) || [],
|
|
1123
|
+
...p(this, R).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, I).push(r), async () => {
|
|
1170
|
+
_(this, I, p(this, I).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, I)) {
|
|
1265
1265
|
const n = await s(t);
|
|
1266
1266
|
if (n)
|
|
1267
1267
|
return n;
|
|
1268
1268
|
}
|
|
1269
1269
|
return "";
|
|
1270
|
-
},
|
|
1270
|
+
}, _(this, L, 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
|
+
_(this, N, 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 = w(this, f, X).call(this, async () => {
|
|
1508
|
+
if (p(this, T) || (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
|
+
), _(this, T, !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 i = normalizeHeaders(r.headers || {}), o = i.host || "example.com:443", a =
|
|
1522
|
-
if (
|
|
1523
|
-
this.writeFile("/internal/eval.php", r.code),
|
|
1520
|
+
w(this, f, te).call(this, r.relativeUri || ""), w(this, f, ie).call(this, r.method || "GET");
|
|
1521
|
+
const i = normalizeHeaders(r.headers || {}), o = i.host || "example.com:443", a = w(this, f, ne).call(this, o, r.protocol || "http");
|
|
1522
|
+
if (w(this, f, re).call(this, o), w(this, f, se).call(this, a), w(this, f, oe).call(this, i), r.body && (t = w(this, f, ae).call(this, r.body)), typeof r.code == "string")
|
|
1523
|
+
this.writeFile("/internal/eval.php", r.code), w(this, f, Y).call(this, "/internal/eval.php");
|
|
1524
1524
|
else if (typeof r.scriptPath == "string")
|
|
1525
|
-
|
|
1525
|
+
w(this, f, Y).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 =
|
|
1531
|
-
for (const
|
|
1532
|
-
|
|
1530
|
+
const c = w(this, f, ee).call(this, r.$_SERVER, i, a);
|
|
1531
|
+
for (const u in c)
|
|
1532
|
+
w(this, f, ce).call(this, u, c[u]);
|
|
1533
1533
|
const l = r.env || {};
|
|
1534
|
-
for (const
|
|
1535
|
-
|
|
1534
|
+
for (const u in l)
|
|
1535
|
+
w(this, f, J).call(this, u, l[u]);
|
|
1536
1536
|
return await this[__private__dont__use].ccall(
|
|
1537
1537
|
"wasm_sapi_handle_request",
|
|
1538
1538
|
NUMBER,
|
|
@@ -1770,21 +1770,21 @@ class PHP {
|
|
|
1770
1770
|
* or an internal crash.
|
|
1771
1771
|
*/
|
|
1772
1772
|
enableRuntimeRotation(r) {
|
|
1773
|
-
|
|
1774
|
-
...
|
|
1773
|
+
_(this, E, {
|
|
1774
|
+
...p(this, E),
|
|
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, E).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, E).recreateRuntime()
|
|
1787
|
+
), p(this, E).requestsMade = 0, p(this, E).needsRotating = !1;
|
|
1788
1788
|
}
|
|
1789
1789
|
/**
|
|
1790
1790
|
* Hot-swaps the PHP runtime for a new one without
|
|
@@ -1795,13 +1795,13 @@ 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 i = Object.entries(
|
|
1798
|
+
const i = Object.entries(p(this, C)).map(
|
|
1799
1799
|
([c, l]) => ({
|
|
1800
1800
|
mountHandler: l.mountHandler,
|
|
1801
1801
|
vfsPath: c
|
|
1802
1802
|
})
|
|
1803
1803
|
), o = Object.values(
|
|
1804
|
-
|
|
1804
|
+
p(this, C)
|
|
1805
1805
|
).reverse();
|
|
1806
1806
|
for (const c of o)
|
|
1807
1807
|
await c.unmount();
|
|
@@ -1809,7 +1809,7 @@ class PHP {
|
|
|
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, N) && this.setSapiName(p(this, N));
|
|
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);
|
|
@@ -1844,11 +1844,11 @@ class PHP {
|
|
|
1844
1844
|
try {
|
|
1845
1845
|
await t();
|
|
1846
1846
|
} finally {
|
|
1847
|
-
delete
|
|
1847
|
+
delete p(this, C)[r];
|
|
1848
1848
|
}
|
|
1849
1849
|
}
|
|
1850
1850
|
};
|
|
1851
|
-
return
|
|
1851
|
+
return p(this, C)[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, T) && (p(this, E).needsRotating = !0);
|
|
1870
1870
|
const t = await this.semaphore.acquire();
|
|
1871
|
-
return await
|
|
1871
|
+
return await w(this, f, X).call(this, () => {
|
|
1872
1872
|
const s = e.env || {};
|
|
1873
1873
|
for (const [n, i] of Object.entries(s))
|
|
1874
|
-
|
|
1874
|
+
w(this, f, J).call(this, n, i);
|
|
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, E).needsRotating = !0;
|
|
1888
1888
|
});
|
|
1889
1889
|
}
|
|
1890
1890
|
/**
|
|
@@ -1966,13 +1966,13 @@ class PHP {
|
|
|
1966
1966
|
this[__private__dont__use]._exit(r);
|
|
1967
1967
|
} catch {
|
|
1968
1968
|
}
|
|
1969
|
-
|
|
1969
|
+
_(this, T, !1), _(this, L, 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
|
+
N = new WeakMap(), T = new WeakMap(), L = new WeakMap(), R = new WeakMap(), I = new WeakMap(), C = new WeakMap(), E = new WeakMap(), f = 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,7 +1981,7 @@ 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
|
+
ee = function(r, e, t) {
|
|
1985
1985
|
const s = {
|
|
1986
1986
|
...r || {}
|
|
1987
1987
|
};
|
|
@@ -1991,7 +1991,7 @@ pe = function(r, e, t) {
|
|
|
1991
1991
|
["content-type", "content-length"].includes(n.toLowerCase()) && (i = ""), s[`${i}${n.toUpperCase().replace(/-/g, "_")}`] = e[n];
|
|
1992
1992
|
}
|
|
1993
1993
|
return s;
|
|
1994
|
-
},
|
|
1994
|
+
}, te = 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
|
+
}, re = 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
|
+
}, se = 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
|
+
}, ne = 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
|
+
}, ie = 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
|
+
}, oe = 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
|
+
}, ae = 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
|
+
}, Y = 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
|
+
}, ce = 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
|
+
}, J = 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
|
+
}, X = async function(r) {
|
|
2098
|
+
p(this, E).enabled && p(this, E).needsRotating && await this.rotateRuntime(), ++p(this, E).requestsMade, p(this, E).requestsMade >= p(this, E).maxRequests && (p(this, E).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 = (d) => {
|
|
2101
|
+
a || s || t.controller.enqueue(d.slice());
|
|
2102
2102
|
};
|
|
2103
2103
|
let s = !1;
|
|
2104
2104
|
const n = () => {
|
|
2105
2105
|
s || (s = !0, t.controller.close());
|
|
2106
2106
|
}, i = await createInvertedReadableStream();
|
|
2107
|
-
e.onStdout = (
|
|
2108
|
-
n(), !a && i.controller.enqueue(
|
|
2107
|
+
e.onStdout = (d) => {
|
|
2108
|
+
n(), !a && i.controller.enqueue(d.slice());
|
|
2109
2109
|
};
|
|
2110
2110
|
const o = await createInvertedReadableStream();
|
|
2111
|
-
e.onStderr = (
|
|
2112
|
-
a || o.controller.enqueue(
|
|
2111
|
+
e.onStderr = (d) => {
|
|
2112
|
+
a || o.controller.enqueue(d.slice());
|
|
2113
2113
|
};
|
|
2114
2114
|
let a = !1, c;
|
|
2115
|
-
const
|
|
2116
|
-
var
|
|
2115
|
+
const u = (async () => {
|
|
2116
|
+
var d;
|
|
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((m, y) => {
|
|
2121
|
+
var g;
|
|
2122
|
+
c = (b) => {
|
|
2123
|
+
isExitCode(b.error) || y(b.error);
|
|
2124
|
+
}, (g = p(this, L)) == null || g.addEventListener(
|
|
2125
2125
|
"error",
|
|
2126
2126
|
c,
|
|
2127
2127
|
{ once: !0 }
|
|
@@ -2132,42 +2132,42 @@ pe = function(r, e, t) {
|
|
|
2132
2132
|
if (isExitCode(h))
|
|
2133
2133
|
return h.status;
|
|
2134
2134
|
safeStreamError$1(i.controller, h), safeStreamError$1(o.controller, h), safeStreamError$1(t.controller, h), a = !0;
|
|
2135
|
-
for (const
|
|
2136
|
-
typeof this[
|
|
2135
|
+
for (const m in this)
|
|
2136
|
+
typeof this[m] == "function" && (this[m] = () => {
|
|
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(i.controller), safeStreamClose$1(o.controller), n(), a = !0), (
|
|
2143
|
+
a || (safeStreamClose$1(i.controller), safeStreamClose$1(o.controller), n(), a = !0), (d = p(this, L)) == null || d.removeEventListener(
|
|
2144
2144
|
"error",
|
|
2145
2145
|
c
|
|
2146
2146
|
);
|
|
2147
2147
|
}
|
|
2148
2148
|
})().then(
|
|
2149
|
-
(
|
|
2149
|
+
(d) => (d !== 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 ${d}.`
|
|
2153
2153
|
),
|
|
2154
2154
|
// Distinguish between PHP request and PHP-wasm errors
|
|
2155
2155
|
source: "php-wasm"
|
|
2156
|
-
}),
|
|
2157
|
-
(
|
|
2158
|
-
const h =
|
|
2156
|
+
}), d),
|
|
2157
|
+
(d) => {
|
|
2158
|
+
const h = d.source ?? "php-wasm";
|
|
2159
2159
|
throw this.dispatchEvent({
|
|
2160
2160
|
type: "request.error",
|
|
2161
|
-
error:
|
|
2161
|
+
error: d,
|
|
2162
2162
|
source: h
|
|
2163
|
-
}),
|
|
2163
|
+
}), d;
|
|
2164
2164
|
}
|
|
2165
2165
|
);
|
|
2166
2166
|
return new StreamedPHPResponse(
|
|
2167
2167
|
t.stream,
|
|
2168
2168
|
i.stream,
|
|
2169
2169
|
o.stream,
|
|
2170
|
-
|
|
2170
|
+
u
|
|
2171
2171
|
);
|
|
2172
2172
|
};
|
|
2173
2173
|
function normalizeHeaders(r) {
|
|
@@ -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
|
|
2661
|
+
var k, O, W, M, U, S, j, H, $, x, le, z, ue, de, pe;
|
|
2662
2662
|
class PHPRequestHandler {
|
|
2663
2663
|
/**
|
|
2664
2664
|
* The request handler needs to decide whether to serve a static asset or
|
|
@@ -2672,24 +2672,24 @@ 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
|
+
P(this, x);
|
|
2676
|
+
P(this, k);
|
|
2677
|
+
P(this, O);
|
|
2678
|
+
P(this, W);
|
|
2679
|
+
P(this, M);
|
|
2680
|
+
P(this, U);
|
|
2681
|
+
P(this, S);
|
|
2682
|
+
P(this, j);
|
|
2683
|
+
P(this, H);
|
|
2684
|
+
P(this, $);
|
|
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
2689
|
pathAliases: i = [],
|
|
2690
2690
|
getFileNotFoundAction: o = () => ({ type: "404" })
|
|
2691
|
-
} = e, a = (
|
|
2692
|
-
|
|
2691
|
+
} = e, a = (u) => {
|
|
2692
|
+
u.isDir(t) || u.mkdir(t), u.chdir(t), u.requestHandler = this;
|
|
2693
2693
|
};
|
|
2694
2694
|
if (e.php)
|
|
2695
2695
|
a(e.php), this.instanceManager = new SinglePHPInstanceManager({
|
|
@@ -2697,12 +2697,12 @@ class PHPRequestHandler {
|
|
|
2697
2697
|
});
|
|
2698
2698
|
else if (e.phpFactory)
|
|
2699
2699
|
this.instanceManager = new PHPProcessManager({
|
|
2700
|
-
phpFactory: async (
|
|
2701
|
-
const
|
|
2702
|
-
...
|
|
2700
|
+
phpFactory: async (u) => {
|
|
2701
|
+
const d = await e.phpFactory({
|
|
2702
|
+
...u,
|
|
2703
2703
|
requestHandler: this
|
|
2704
2704
|
});
|
|
2705
|
-
return a(
|
|
2705
|
+
return a(d), d;
|
|
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
|
+
_(this, H, e.cookieStore === void 0 ? new HttpCookieStore() : e.cookieStore), _(this, k, 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
|
+
_(this, W, c.hostname), _(this, M, c.port ? Number(c.port) : c.protocol === "https:" ? 443 : 80), _(this, O, (c.protocol || "").replace(":", ""));
|
|
2716
|
+
const l = p(this, M) !== 443 && p(this, M) !== 80;
|
|
2717
|
+
_(this, U, [
|
|
2718
|
+
p(this, W),
|
|
2719
|
+
l ? `:${p(this, M)}` : ""
|
|
2720
|
+
].join("")), _(this, S, c.pathname.replace(/\/+$/, "")), _(this, j, [
|
|
2721
|
+
`${p(this, O)}://`,
|
|
2722
|
+
p(this, U),
|
|
2723
|
+
p(this, S)
|
|
2724
|
+
].join("")), this.rewriteRules = n, _(this, $, i), this.getFileNotFoundAction = o;
|
|
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, S)) && (t.pathname = t.pathname.slice(p(this, S).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, j);
|
|
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, k);
|
|
2762
2762
|
}
|
|
2763
2763
|
/**
|
|
2764
2764
|
* Serves the request – either by serving a static file, or by
|
|
@@ -2834,15 +2834,15 @@ 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 = w(this, x, le).call(this, s), i = await this.getPrimaryPhp(), o = 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, S)
|
|
2844
2844
|
);
|
|
2845
|
-
let a =
|
|
2845
|
+
let a = w(this, x, z).call(this, o);
|
|
2846
2846
|
if (i.isDir(a)) {
|
|
2847
2847
|
if (!o.endsWith("/"))
|
|
2848
2848
|
return StreamedPHPResponse.fromPHPResponse(
|
|
@@ -2867,10 +2867,10 @@ class PHPRequestHandler {
|
|
|
2867
2867
|
let c = o;
|
|
2868
2868
|
for (; c.startsWith("/") && c !== dirname(c); ) {
|
|
2869
2869
|
c = dirname(c);
|
|
2870
|
-
const l =
|
|
2870
|
+
const l = w(this, x, z).call(this, c);
|
|
2871
2871
|
if (i.isFile(l) && // Only run partial path resolution for PHP files.
|
|
2872
2872
|
l.endsWith(".php")) {
|
|
2873
|
-
a =
|
|
2873
|
+
a = w(this, x, z).call(this, c);
|
|
2874
2874
|
break;
|
|
2875
2875
|
}
|
|
2876
2876
|
}
|
|
@@ -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, k), 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 i.isFile(a) ? a.endsWith(".php") ? await
|
|
2899
|
-
|
|
2898
|
+
return i.isFile(a) ? a.endsWith(".php") ? await w(this, x, de).call(this, e, s, n, a) : StreamedPHPResponse.fromPHPResponse(
|
|
2899
|
+
w(this, x, ue).call(this, i, 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, k),
|
|
2994
|
+
HTTPS: p(this, j).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, k)) && (n.SCRIPT_NAME = s.substring(
|
|
2997
|
+
p(this, k).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,21 +3006,21 @@ class PHPRequestHandler {
|
|
|
3006
3006
|
await this.instanceManager[Symbol.asyncDispose]();
|
|
3007
3007
|
}
|
|
3008
3008
|
}
|
|
3009
|
-
|
|
3009
|
+
k = new WeakMap(), O = new WeakMap(), W = new WeakMap(), M = new WeakMap(), U = new WeakMap(), S = new WeakMap(), j = new WeakMap(), H = new WeakMap(), $ = new WeakMap(), x = 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
|
+
le = function(e) {
|
|
3016
3016
|
const t = removePathPrefix(
|
|
3017
3017
|
decodeURIComponent(e.pathname),
|
|
3018
|
-
|
|
3018
|
+
p(this, S)
|
|
3019
3019
|
), s = applyRewriteRules(
|
|
3020
3020
|
t,
|
|
3021
3021
|
this.rewriteRules
|
|
3022
3022
|
), n = new URL(
|
|
3023
|
-
joinPaths(
|
|
3023
|
+
joinPaths(p(this, S), s),
|
|
3024
3024
|
e.toString()
|
|
3025
3025
|
);
|
|
3026
3026
|
for (const [i, o] of e.searchParams.entries())
|
|
@@ -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
|
+
z = function(e) {
|
|
3039
|
+
for (const t of p(this, $))
|
|
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, k), 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
|
+
ue = function(e, t) {
|
|
3052
3052
|
const s = e.readFileAsBuffer(t);
|
|
3053
3053
|
return new PHPResponse(
|
|
3054
3054
|
200,
|
|
@@ -3063,7 +3063,7 @@ Ee = function(e, t) {
|
|
|
3063
3063
|
},
|
|
3064
3064
|
s
|
|
3065
3065
|
);
|
|
3066
|
-
},
|
|
3066
|
+
}, de = async function(e, t, s, n) {
|
|
3067
3067
|
let i;
|
|
3068
3068
|
try {
|
|
3069
3069
|
i = await this.instanceManager.acquirePHPInstance();
|
|
@@ -3072,32 +3072,32 @@ Ee = function(e, t) {
|
|
|
3072
3072
|
}
|
|
3073
3073
|
let o;
|
|
3074
3074
|
try {
|
|
3075
|
-
o = await
|
|
3075
|
+
o = await w(this, x, pe).call(this, i.php, e, t, s, n);
|
|
3076
3076
|
} catch (a) {
|
|
3077
3077
|
throw i.reap(), a;
|
|
3078
3078
|
}
|
|
3079
3079
|
return o.finished.finally(() => {
|
|
3080
3080
|
i == null || i.reap();
|
|
3081
3081
|
}), o;
|
|
3082
|
-
},
|
|
3082
|
+
}, pe = async function(e, t, s, n, i) {
|
|
3083
3083
|
let o = "GET";
|
|
3084
3084
|
const a = {
|
|
3085
|
-
host:
|
|
3085
|
+
host: p(this, U),
|
|
3086
3086
|
...normalizeHeaders(t.headers || {})
|
|
3087
3087
|
};
|
|
3088
|
-
|
|
3088
|
+
p(this, H) && (a.cookie = p(this, H).getCookieRequestHeader());
|
|
3089
3089
|
let c = t.body;
|
|
3090
3090
|
if (typeof c == "object" && !(c instanceof Uint8Array)) {
|
|
3091
3091
|
o = "POST";
|
|
3092
|
-
const { bytes:
|
|
3093
|
-
c =
|
|
3092
|
+
const { bytes: u, contentType: d } = await encodeAsMultipart(c);
|
|
3093
|
+
c = u, a["content-type"] = d;
|
|
3094
3094
|
}
|
|
3095
3095
|
const l = await e.runStream({
|
|
3096
3096
|
relativeUri: ensurePathPrefix(
|
|
3097
3097
|
toRelativeUrl(new URL(n.toString())),
|
|
3098
|
-
|
|
3098
|
+
p(this, S)
|
|
3099
3099
|
),
|
|
3100
|
-
protocol:
|
|
3100
|
+
protocol: p(this, O),
|
|
3101
3101
|
method: t.method || o,
|
|
3102
3102
|
$_SERVER: this.prepare_$_SERVER_superglobal(
|
|
3103
3103
|
s,
|
|
@@ -3108,10 +3108,10 @@ Ee = function(e, t) {
|
|
|
3108
3108
|
scriptPath: i,
|
|
3109
3109
|
headers: a
|
|
3110
3110
|
});
|
|
3111
|
-
if (
|
|
3112
|
-
const
|
|
3113
|
-
|
|
3114
|
-
|
|
3111
|
+
if (p(this, H)) {
|
|
3112
|
+
const u = await l.headers;
|
|
3113
|
+
p(this, H).rememberCookiesFromResponseHeaders(
|
|
3114
|
+
u
|
|
3115
3115
|
);
|
|
3116
3116
|
}
|
|
3117
3117
|
return l;
|
|
@@ -3152,150 +3152,137 @@ async function writeFiles(r, e, t, { rmRoot: s = !1 } = {}) {
|
|
|
3152
3152
|
await r.fileExists(dirname(o)) || await r.mkdir(dirname(o)), i instanceof Uint8Array || typeof i == "string" ? await r.writeFile(o, i) : await writeFiles(r, o, i);
|
|
3153
3153
|
}
|
|
3154
3154
|
}
|
|
3155
|
-
const
|
|
3155
|
+
const schema15 = {
|
|
3156
3156
|
properties: {
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
properties: {
|
|
3160
|
-
type: {
|
|
3161
|
-
enum: ["file", "directory"]
|
|
3162
|
-
}
|
|
3163
|
-
}
|
|
3164
|
-
}
|
|
3157
|
+
type: {
|
|
3158
|
+
enum: ["file", "directory"]
|
|
3165
3159
|
}
|
|
3166
3160
|
}
|
|
3167
3161
|
};
|
|
3168
|
-
function
|
|
3162
|
+
function validate13(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
|
|
3169
3163
|
let i = null, o = 0;
|
|
3170
3164
|
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
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"))
|
|
3184
|
-
return validate11.errors = [
|
|
3165
|
+
for (const u in r)
|
|
3166
|
+
if (!(u === "vfsRoot" || u === "nodes"))
|
|
3167
|
+
return validate13.errors = [
|
|
3185
3168
|
{
|
|
3186
3169
|
instancePath: e,
|
|
3187
3170
|
schemaPath: "#/additionalProperties",
|
|
3188
3171
|
keyword: "additionalProperties",
|
|
3189
|
-
params: { additionalProperty:
|
|
3172
|
+
params: { additionalProperty: u },
|
|
3190
3173
|
message: "must NOT have additional properties"
|
|
3191
3174
|
}
|
|
3192
3175
|
], !1;
|
|
3193
3176
|
{
|
|
3194
|
-
if (r.
|
|
3195
|
-
const
|
|
3196
|
-
if (typeof r.
|
|
3197
|
-
return
|
|
3177
|
+
if (r.vfsRoot !== void 0) {
|
|
3178
|
+
const u = o;
|
|
3179
|
+
if (typeof r.vfsRoot != "string")
|
|
3180
|
+
return validate13.errors = [
|
|
3198
3181
|
{
|
|
3199
|
-
instancePath: e + "/
|
|
3200
|
-
schemaPath: "#/properties/
|
|
3182
|
+
instancePath: e + "/vfsRoot",
|
|
3183
|
+
schemaPath: "#/properties/vfsRoot/type",
|
|
3201
3184
|
keyword: "type",
|
|
3202
3185
|
params: { type: "string" },
|
|
3203
3186
|
message: "must be string"
|
|
3204
3187
|
}
|
|
3205
3188
|
], !1;
|
|
3206
|
-
var a =
|
|
3189
|
+
var a = u === o;
|
|
3207
3190
|
} else
|
|
3208
3191
|
var a = !0;
|
|
3209
|
-
if (a)
|
|
3210
|
-
if (r.
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3192
|
+
if (a)
|
|
3193
|
+
if (r.nodes !== void 0) {
|
|
3194
|
+
let u = r.nodes;
|
|
3195
|
+
const d = o;
|
|
3196
|
+
if (Array.isArray(u)) {
|
|
3197
|
+
var c = !0;
|
|
3198
|
+
const m = u.length;
|
|
3199
|
+
for (let y = 0; y < m; y++) {
|
|
3200
|
+
let g = u[y];
|
|
3201
|
+
const b = o;
|
|
3202
|
+
if (g && typeof g == "object" && !Array.isArray(g)) {
|
|
3203
|
+
let D;
|
|
3204
|
+
if (g.vfsPath === void 0 && (D = "vfsPath"))
|
|
3205
|
+
return validate13.errors = [
|
|
3206
|
+
{
|
|
3207
|
+
instancePath: e + "/nodes/" + y,
|
|
3208
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFile/required",
|
|
3209
|
+
keyword: "required",
|
|
3210
|
+
params: {
|
|
3211
|
+
missingProperty: D
|
|
3212
|
+
},
|
|
3213
|
+
message: "must have required property '" + D + "'"
|
|
3214
|
+
}
|
|
3215
|
+
], !1;
|
|
3216
|
+
for (const v in g)
|
|
3217
|
+
if (!(v === "vfsPath" || v === "type" || v === "sourcePath"))
|
|
3218
|
+
return validate13.errors = [
|
|
3219
|
+
{
|
|
3220
|
+
instancePath: e + "/nodes/" + y,
|
|
3221
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFile/additionalProperties",
|
|
3222
|
+
keyword: "additionalProperties",
|
|
3223
|
+
params: {
|
|
3224
|
+
additionalProperty: v
|
|
3225
|
+
},
|
|
3226
|
+
message: "must NOT have additional properties"
|
|
3227
|
+
}
|
|
3228
|
+
], !1;
|
|
3241
3229
|
{
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
allowedValue: "php-extension"
|
|
3247
|
-
},
|
|
3248
|
-
message: "must be equal to constant"
|
|
3249
|
-
}
|
|
3250
|
-
], !1;
|
|
3251
|
-
var a = D === o;
|
|
3252
|
-
} else
|
|
3253
|
-
var a = !0;
|
|
3254
|
-
if (a) {
|
|
3255
|
-
if (r.artifacts !== void 0) {
|
|
3256
|
-
let m = r.artifacts;
|
|
3257
|
-
const D = o;
|
|
3258
|
-
if (Array.isArray(m)) {
|
|
3259
|
-
var c = !0;
|
|
3260
|
-
const S = m.length;
|
|
3261
|
-
for (let g = 0; g < S; g++) {
|
|
3262
|
-
let b = m[g];
|
|
3263
|
-
const Q = o;
|
|
3264
|
-
if (b && typeof b == "object" && !Array.isArray(b)) {
|
|
3265
|
-
let F;
|
|
3266
|
-
if (b.phpVersion === void 0 && (F = "phpVersion") || b.sourcePath === void 0 && (F = "sourcePath"))
|
|
3267
|
-
return validate11.errors = [
|
|
3230
|
+
if (g.vfsPath !== void 0) {
|
|
3231
|
+
const v = o;
|
|
3232
|
+
if (typeof g.vfsPath != "string")
|
|
3233
|
+
return validate13.errors = [
|
|
3268
3234
|
{
|
|
3269
|
-
instancePath: e + "/
|
|
3270
|
-
schemaPath: "#/properties/
|
|
3271
|
-
keyword: "
|
|
3235
|
+
instancePath: e + "/nodes/" + y + "/vfsPath",
|
|
3236
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFile/properties/vfsPath/type",
|
|
3237
|
+
keyword: "type",
|
|
3272
3238
|
params: {
|
|
3273
|
-
|
|
3239
|
+
type: "string"
|
|
3274
3240
|
},
|
|
3275
|
-
message: "must
|
|
3241
|
+
message: "must be string"
|
|
3276
3242
|
}
|
|
3277
3243
|
], !1;
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3244
|
+
var l = v === o;
|
|
3245
|
+
} else
|
|
3246
|
+
var l = !0;
|
|
3247
|
+
if (l) {
|
|
3248
|
+
if (g.type !== void 0) {
|
|
3249
|
+
let v = g.type;
|
|
3250
|
+
const A = o;
|
|
3251
|
+
if (typeof v != "string")
|
|
3252
|
+
return validate13.errors = [
|
|
3281
3253
|
{
|
|
3282
|
-
instancePath: e + "/
|
|
3283
|
-
schemaPath: "#/properties/
|
|
3284
|
-
keyword: "
|
|
3254
|
+
instancePath: e + "/nodes/" + y + "/type",
|
|
3255
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFile/properties/type/type",
|
|
3256
|
+
keyword: "type",
|
|
3285
3257
|
params: {
|
|
3286
|
-
|
|
3258
|
+
type: "string"
|
|
3287
3259
|
},
|
|
3288
|
-
message: "must
|
|
3260
|
+
message: "must be string"
|
|
3289
3261
|
}
|
|
3290
3262
|
], !1;
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3263
|
+
if (!(v === "file" || v === "directory"))
|
|
3264
|
+
return validate13.errors = [
|
|
3265
|
+
{
|
|
3266
|
+
instancePath: e + "/nodes/" + y + "/type",
|
|
3267
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFile/properties/type/enum",
|
|
3268
|
+
keyword: "enum",
|
|
3269
|
+
params: {
|
|
3270
|
+
allowedValues: schema15.properties.type.enum
|
|
3271
|
+
},
|
|
3272
|
+
message: "must be equal to one of the allowed values"
|
|
3273
|
+
}
|
|
3274
|
+
], !1;
|
|
3275
|
+
var l = A === o;
|
|
3276
|
+
} else
|
|
3277
|
+
var l = !0;
|
|
3278
|
+
if (l)
|
|
3279
|
+
if (g.sourcePath !== void 0) {
|
|
3280
|
+
const v = o;
|
|
3281
|
+
if (typeof g.sourcePath != "string")
|
|
3282
|
+
return validate13.errors = [
|
|
3296
3283
|
{
|
|
3297
|
-
instancePath: e + "/
|
|
3298
|
-
schemaPath: "#/
|
|
3284
|
+
instancePath: e + "/nodes/" + y + "/sourcePath",
|
|
3285
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFile/properties/sourcePath/type",
|
|
3299
3286
|
keyword: "type",
|
|
3300
3287
|
params: {
|
|
3301
3288
|
type: "string"
|
|
@@ -3303,460 +3290,291 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3303
3290
|
message: "must be string"
|
|
3304
3291
|
}
|
|
3305
3292
|
], !1;
|
|
3306
|
-
var l =
|
|
3293
|
+
var l = v === o;
|
|
3307
3294
|
} else
|
|
3308
3295
|
var l = !0;
|
|
3309
|
-
|
|
3310
|
-
if (b.sourcePath !== void 0) {
|
|
3311
|
-
const E = o;
|
|
3312
|
-
if (typeof b.sourcePath != "string")
|
|
3313
|
-
return validate11.errors = [
|
|
3314
|
-
{
|
|
3315
|
-
instancePath: e + "/artifacts/" + g + "/sourcePath",
|
|
3316
|
-
schemaPath: "#/properties/artifacts/items/properties/sourcePath/type",
|
|
3317
|
-
keyword: "type",
|
|
3318
|
-
params: {
|
|
3319
|
-
type: "string"
|
|
3320
|
-
},
|
|
3321
|
-
message: "must be string"
|
|
3322
|
-
}
|
|
3323
|
-
], !1;
|
|
3324
|
-
var l = E === o;
|
|
3325
|
-
} else
|
|
3326
|
-
var l = !0;
|
|
3327
|
-
if (l)
|
|
3328
|
-
if (b.extraFiles !== void 0) {
|
|
3329
|
-
let E = b.extraFiles;
|
|
3330
|
-
const Fe = o;
|
|
3331
|
-
if (E && typeof E == "object" && !Array.isArray(
|
|
3332
|
-
E
|
|
3333
|
-
)) {
|
|
3334
|
-
for (const w in E)
|
|
3335
|
-
if (!(w === "vfsRoot" || w === "nodes"))
|
|
3336
|
-
return validate11.errors = [
|
|
3337
|
-
{
|
|
3338
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles",
|
|
3339
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/additionalProperties",
|
|
3340
|
-
keyword: "additionalProperties",
|
|
3341
|
-
params: {
|
|
3342
|
-
additionalProperty: w
|
|
3343
|
-
},
|
|
3344
|
-
message: "must NOT have additional properties"
|
|
3345
|
-
}
|
|
3346
|
-
], !1;
|
|
3347
|
-
{
|
|
3348
|
-
if (E.vfsRoot !== void 0) {
|
|
3349
|
-
const w = o;
|
|
3350
|
-
if (typeof E.vfsRoot != "string")
|
|
3351
|
-
return validate11.errors = [
|
|
3352
|
-
{
|
|
3353
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles/vfsRoot",
|
|
3354
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/vfsRoot/type",
|
|
3355
|
-
keyword: "type",
|
|
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"))
|
|
3382
|
-
return validate11.errors = [
|
|
3383
|
-
{
|
|
3384
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles/nodes/" + C,
|
|
3385
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/required",
|
|
3386
|
-
keyword: "required",
|
|
3387
|
-
params: {
|
|
3388
|
-
missingProperty: oe
|
|
3389
|
-
},
|
|
3390
|
-
message: "must have required property '" + oe + "'"
|
|
3391
|
-
}
|
|
3392
|
-
], !1;
|
|
3393
|
-
for (const T in L)
|
|
3394
|
-
if (!(T === "vfsPath" || T === "type" || T === "sourcePath"))
|
|
3395
|
-
return validate11.errors = [
|
|
3396
|
-
{
|
|
3397
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles/nodes/" + C,
|
|
3398
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/additionalProperties",
|
|
3399
|
-
keyword: "additionalProperties",
|
|
3400
|
-
params: {
|
|
3401
|
-
additionalProperty: T
|
|
3402
|
-
},
|
|
3403
|
-
message: "must NOT have additional properties"
|
|
3404
|
-
}
|
|
3405
|
-
], !1;
|
|
3406
|
-
{
|
|
3407
|
-
if (L.vfsPath !== void 0) {
|
|
3408
|
-
const T = o;
|
|
3409
|
-
if (typeof L.vfsPath != "string")
|
|
3410
|
-
return validate11.errors = [
|
|
3411
|
-
{
|
|
3412
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles/nodes/" + C + "/vfsPath",
|
|
3413
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/vfsPath/type",
|
|
3414
|
-
keyword: "type",
|
|
3415
|
-
params: {
|
|
3416
|
-
type: "string"
|
|
3417
|
-
},
|
|
3418
|
-
message: "must be string"
|
|
3419
|
-
}
|
|
3420
|
-
], !1;
|
|
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")
|
|
3429
|
-
return validate11.errors = [
|
|
3430
|
-
{
|
|
3431
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles/nodes/" + C + "/type",
|
|
3432
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/type/type",
|
|
3433
|
-
keyword: "type",
|
|
3434
|
-
params: {
|
|
3435
|
-
type: "string"
|
|
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
|
|
3448
|
-
},
|
|
3449
|
-
message: "must be equal to one of the allowed values"
|
|
3450
|
-
}
|
|
3451
|
-
], !1;
|
|
3452
|
-
var h = be === o;
|
|
3453
|
-
} else
|
|
3454
|
-
var h = !0;
|
|
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"
|
|
3501
|
-
}
|
|
3502
|
-
], !1;
|
|
3503
|
-
var d = ie === o;
|
|
3504
|
-
} else
|
|
3505
|
-
var d = !0;
|
|
3506
|
-
}
|
|
3507
|
-
} else
|
|
3508
|
-
return validate11.errors = [
|
|
3509
|
-
{
|
|
3510
|
-
instancePath: e + "/artifacts/" + g + "/extraFiles",
|
|
3511
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/type",
|
|
3512
|
-
keyword: "type",
|
|
3513
|
-
params: {
|
|
3514
|
-
type: "object"
|
|
3515
|
-
},
|
|
3516
|
-
message: "must be object"
|
|
3517
|
-
}
|
|
3518
|
-
], !1;
|
|
3519
|
-
var l = Fe === o;
|
|
3520
|
-
} else
|
|
3521
|
-
var l = !0;
|
|
3522
|
-
}
|
|
3523
|
-
}
|
|
3524
|
-
} else
|
|
3525
|
-
return validate11.errors = [
|
|
3526
|
-
{
|
|
3527
|
-
instancePath: e + "/artifacts/" + g,
|
|
3528
|
-
schemaPath: "#/properties/artifacts/items/type",
|
|
3529
|
-
keyword: "type",
|
|
3530
|
-
params: {
|
|
3531
|
-
type: "object"
|
|
3532
|
-
},
|
|
3533
|
-
message: "must be object"
|
|
3534
|
-
}
|
|
3535
|
-
], !1;
|
|
3536
|
-
var c = Q === o;
|
|
3537
|
-
if (!c)
|
|
3538
|
-
break;
|
|
3296
|
+
}
|
|
3539
3297
|
}
|
|
3540
3298
|
} else
|
|
3541
|
-
return
|
|
3299
|
+
return validate13.errors = [
|
|
3300
|
+
{
|
|
3301
|
+
instancePath: e + "/nodes/" + y,
|
|
3302
|
+
schemaPath: "#/definitions/PHPExtensionManifestExtraFile/type",
|
|
3303
|
+
keyword: "type",
|
|
3304
|
+
params: { type: "object" },
|
|
3305
|
+
message: "must be object"
|
|
3306
|
+
}
|
|
3307
|
+
], !1;
|
|
3308
|
+
var c = b === o;
|
|
3309
|
+
if (!c)
|
|
3310
|
+
break;
|
|
3311
|
+
}
|
|
3312
|
+
} else
|
|
3313
|
+
return validate13.errors = [
|
|
3314
|
+
{
|
|
3315
|
+
instancePath: e + "/nodes",
|
|
3316
|
+
schemaPath: "#/properties/nodes/type",
|
|
3317
|
+
keyword: "type",
|
|
3318
|
+
params: { type: "array" },
|
|
3319
|
+
message: "must be array"
|
|
3320
|
+
}
|
|
3321
|
+
], !1;
|
|
3322
|
+
var a = d === o;
|
|
3323
|
+
} else
|
|
3324
|
+
var a = !0;
|
|
3325
|
+
}
|
|
3326
|
+
} else
|
|
3327
|
+
return validate13.errors = [
|
|
3328
|
+
{
|
|
3329
|
+
instancePath: e,
|
|
3330
|
+
schemaPath: "#/type",
|
|
3331
|
+
keyword: "type",
|
|
3332
|
+
params: { type: "object" },
|
|
3333
|
+
message: "must be object"
|
|
3334
|
+
}
|
|
3335
|
+
], !1;
|
|
3336
|
+
return validate13.errors = i, o === 0;
|
|
3337
|
+
}
|
|
3338
|
+
function validate12(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
|
|
3339
|
+
let i = null, o = 0;
|
|
3340
|
+
if (o === 0)
|
|
3341
|
+
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
3342
|
+
let c;
|
|
3343
|
+
if (r.phpVersion === void 0 && (c = "phpVersion") || r.sourcePath === void 0 && (c = "sourcePath"))
|
|
3344
|
+
return validate12.errors = [
|
|
3345
|
+
{
|
|
3346
|
+
instancePath: e,
|
|
3347
|
+
schemaPath: "#/required",
|
|
3348
|
+
keyword: "required",
|
|
3349
|
+
params: { missingProperty: c },
|
|
3350
|
+
message: "must have required property '" + c + "'"
|
|
3351
|
+
}
|
|
3352
|
+
], !1;
|
|
3353
|
+
{
|
|
3354
|
+
const l = o;
|
|
3355
|
+
for (const u in r)
|
|
3356
|
+
if (!(u === "phpVersion" || u === "sourcePath" || u === "extraFiles"))
|
|
3357
|
+
return validate12.errors = [
|
|
3358
|
+
{
|
|
3359
|
+
instancePath: e,
|
|
3360
|
+
schemaPath: "#/additionalProperties",
|
|
3361
|
+
keyword: "additionalProperties",
|
|
3362
|
+
params: { additionalProperty: u },
|
|
3363
|
+
message: "must NOT have additional properties"
|
|
3364
|
+
}
|
|
3365
|
+
], !1;
|
|
3366
|
+
if (l === o) {
|
|
3367
|
+
if (r.phpVersion !== void 0) {
|
|
3368
|
+
const u = o;
|
|
3369
|
+
if (typeof r.phpVersion != "string")
|
|
3370
|
+
return validate12.errors = [
|
|
3371
|
+
{
|
|
3372
|
+
instancePath: e + "/phpVersion",
|
|
3373
|
+
schemaPath: "#/properties/phpVersion/type",
|
|
3374
|
+
keyword: "type",
|
|
3375
|
+
params: { type: "string" },
|
|
3376
|
+
message: "must be string"
|
|
3377
|
+
}
|
|
3378
|
+
], !1;
|
|
3379
|
+
var a = u === o;
|
|
3380
|
+
} else
|
|
3381
|
+
var a = !0;
|
|
3382
|
+
if (a) {
|
|
3383
|
+
if (r.sourcePath !== void 0) {
|
|
3384
|
+
const u = o;
|
|
3385
|
+
if (typeof r.sourcePath != "string")
|
|
3386
|
+
return validate12.errors = [
|
|
3542
3387
|
{
|
|
3543
|
-
instancePath: e + "/
|
|
3544
|
-
schemaPath: "#/properties/
|
|
3388
|
+
instancePath: e + "/sourcePath",
|
|
3389
|
+
schemaPath: "#/properties/sourcePath/type",
|
|
3545
3390
|
keyword: "type",
|
|
3546
|
-
params: { type: "
|
|
3547
|
-
message: "must be
|
|
3391
|
+
params: { type: "string" },
|
|
3392
|
+
message: "must be string"
|
|
3548
3393
|
}
|
|
3549
3394
|
], !1;
|
|
3550
|
-
var a =
|
|
3395
|
+
var a = u === o;
|
|
3551
3396
|
} else
|
|
3552
3397
|
var a = !0;
|
|
3553
3398
|
if (a)
|
|
3554
3399
|
if (r.extraFiles !== void 0) {
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3400
|
+
const u = o;
|
|
3401
|
+
validate13(r.extraFiles, {
|
|
3402
|
+
instancePath: e + "/extraFiles",
|
|
3403
|
+
parentData: r,
|
|
3404
|
+
parentDataProperty: "extraFiles",
|
|
3405
|
+
rootData: n
|
|
3406
|
+
}) || (i = i === null ? validate13.errors : i.concat(validate13.errors), o = i.length);
|
|
3407
|
+
var a = u === o;
|
|
3408
|
+
} else
|
|
3409
|
+
var a = !0;
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
} else
|
|
3414
|
+
return validate12.errors = [
|
|
3415
|
+
{
|
|
3416
|
+
instancePath: e,
|
|
3417
|
+
schemaPath: "#/type",
|
|
3418
|
+
keyword: "type",
|
|
3419
|
+
params: { type: "object" },
|
|
3420
|
+
message: "must be object"
|
|
3421
|
+
}
|
|
3422
|
+
], !1;
|
|
3423
|
+
return validate12.errors = i, o === 0;
|
|
3424
|
+
}
|
|
3425
|
+
function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
|
|
3426
|
+
let i = null, o = 0;
|
|
3427
|
+
if (o === 0)
|
|
3428
|
+
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
3429
|
+
let l;
|
|
3430
|
+
if (r.name === void 0 && (l = "name") || r.artifacts === void 0 && (l = "artifacts"))
|
|
3431
|
+
return validate11.errors = [
|
|
3432
|
+
{
|
|
3433
|
+
instancePath: e,
|
|
3434
|
+
schemaPath: "#/required",
|
|
3435
|
+
keyword: "required",
|
|
3436
|
+
params: { missingProperty: l },
|
|
3437
|
+
message: "must have required property '" + l + "'"
|
|
3438
|
+
}
|
|
3439
|
+
], !1;
|
|
3440
|
+
{
|
|
3441
|
+
const u = o;
|
|
3442
|
+
for (const d in r)
|
|
3443
|
+
if (!(d === "name" || d === "version" || d === "mode" || d === "artifacts" || d === "extraFiles"))
|
|
3444
|
+
return validate11.errors = [
|
|
3445
|
+
{
|
|
3446
|
+
instancePath: e,
|
|
3447
|
+
schemaPath: "#/additionalProperties",
|
|
3448
|
+
keyword: "additionalProperties",
|
|
3449
|
+
params: { additionalProperty: d },
|
|
3450
|
+
message: "must NOT have additional properties"
|
|
3451
|
+
}
|
|
3452
|
+
], !1;
|
|
3453
|
+
if (u === o) {
|
|
3454
|
+
if (r.name !== void 0) {
|
|
3455
|
+
const d = o;
|
|
3456
|
+
if (typeof r.name != "string")
|
|
3457
|
+
return validate11.errors = [
|
|
3458
|
+
{
|
|
3459
|
+
instancePath: e + "/name",
|
|
3460
|
+
schemaPath: "#/properties/name/type",
|
|
3461
|
+
keyword: "type",
|
|
3462
|
+
params: { type: "string" },
|
|
3463
|
+
message: "must be string"
|
|
3464
|
+
}
|
|
3465
|
+
], !1;
|
|
3466
|
+
var a = d === o;
|
|
3467
|
+
} else
|
|
3468
|
+
var a = !0;
|
|
3469
|
+
if (a) {
|
|
3470
|
+
if (r.version !== void 0) {
|
|
3471
|
+
const d = o;
|
|
3472
|
+
if (typeof r.version != "string")
|
|
3473
|
+
return validate11.errors = [
|
|
3571
3474
|
{
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
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")
|
|
3634
|
-
return validate11.errors = [
|
|
3635
|
-
{
|
|
3636
|
-
instancePath: e + "/extraFiles/nodes/" + I + "/vfsPath",
|
|
3637
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/vfsPath/type",
|
|
3638
|
-
keyword: "type",
|
|
3639
|
-
params: {
|
|
3640
|
-
type: "string"
|
|
3641
|
-
},
|
|
3642
|
-
message: "must be string"
|
|
3643
|
-
}
|
|
3644
|
-
], !1;
|
|
3645
|
-
var R = w === o;
|
|
3646
|
-
} else
|
|
3647
|
-
var R = !0;
|
|
3648
|
-
if (R) {
|
|
3649
|
-
if (F.type !== void 0) {
|
|
3650
|
-
let w = F.type;
|
|
3651
|
-
const ie = o;
|
|
3652
|
-
if (typeof w != "string")
|
|
3653
|
-
return validate11.errors = [
|
|
3654
|
-
{
|
|
3655
|
-
instancePath: e + "/extraFiles/nodes/" + I + "/type",
|
|
3656
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/type/type",
|
|
3657
|
-
keyword: "type",
|
|
3658
|
-
params: {
|
|
3659
|
-
type: "string"
|
|
3660
|
-
},
|
|
3661
|
-
message: "must be string"
|
|
3662
|
-
}
|
|
3663
|
-
], !1;
|
|
3664
|
-
if (!(w === "file" || w === "directory"))
|
|
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;
|
|
3677
|
-
} else
|
|
3678
|
-
var R = !0;
|
|
3679
|
-
if (R)
|
|
3680
|
-
if (F.sourcePath !== void 0) {
|
|
3681
|
-
const w = o;
|
|
3682
|
-
if (typeof F.sourcePath != "string")
|
|
3683
|
-
return validate11.errors = [
|
|
3684
|
-
{
|
|
3685
|
-
instancePath: e + "/extraFiles/nodes/" + I + "/sourcePath",
|
|
3686
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/properties/sourcePath/type",
|
|
3687
|
-
keyword: "type",
|
|
3688
|
-
params: {
|
|
3689
|
-
type: "string"
|
|
3690
|
-
},
|
|
3691
|
-
message: "must be string"
|
|
3692
|
-
}
|
|
3693
|
-
], !1;
|
|
3694
|
-
var R = w === o;
|
|
3695
|
-
} else
|
|
3696
|
-
var R = !0;
|
|
3697
|
-
}
|
|
3698
|
-
}
|
|
3699
|
-
} else
|
|
3700
|
-
return validate11.errors = [
|
|
3701
|
-
{
|
|
3702
|
-
instancePath: e + "/extraFiles/nodes/" + I,
|
|
3703
|
-
schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/nodes/items/type",
|
|
3704
|
-
keyword: "type",
|
|
3705
|
-
params: {
|
|
3706
|
-
type: "object"
|
|
3707
|
-
},
|
|
3708
|
-
message: "must be object"
|
|
3709
|
-
}
|
|
3710
|
-
], !1;
|
|
3711
|
-
var k = E === o;
|
|
3712
|
-
if (!k)
|
|
3713
|
-
break;
|
|
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;
|
|
3475
|
+
instancePath: e + "/version",
|
|
3476
|
+
schemaPath: "#/properties/version/type",
|
|
3477
|
+
keyword: "type",
|
|
3478
|
+
params: { type: "string" },
|
|
3479
|
+
message: "must be string"
|
|
3730
3480
|
}
|
|
3731
|
-
|
|
3481
|
+
], !1;
|
|
3482
|
+
var a = d === o;
|
|
3483
|
+
} else
|
|
3484
|
+
var a = !0;
|
|
3485
|
+
if (a) {
|
|
3486
|
+
if (r.mode !== void 0) {
|
|
3487
|
+
let d = r.mode;
|
|
3488
|
+
const h = o;
|
|
3489
|
+
if (typeof d != "string")
|
|
3732
3490
|
return validate11.errors = [
|
|
3733
3491
|
{
|
|
3734
|
-
instancePath: e + "/
|
|
3735
|
-
schemaPath: "#/
|
|
3492
|
+
instancePath: e + "/mode",
|
|
3493
|
+
schemaPath: "#/properties/mode/type",
|
|
3736
3494
|
keyword: "type",
|
|
3495
|
+
params: { type: "string" },
|
|
3496
|
+
message: "must be string"
|
|
3497
|
+
}
|
|
3498
|
+
], !1;
|
|
3499
|
+
if (d !== "php-extension")
|
|
3500
|
+
return validate11.errors = [
|
|
3501
|
+
{
|
|
3502
|
+
instancePath: e + "/mode",
|
|
3503
|
+
schemaPath: "#/properties/mode/const",
|
|
3504
|
+
keyword: "const",
|
|
3737
3505
|
params: {
|
|
3738
|
-
|
|
3506
|
+
allowedValue: "php-extension"
|
|
3739
3507
|
},
|
|
3740
|
-
message: "must be
|
|
3508
|
+
message: "must be equal to constant"
|
|
3741
3509
|
}
|
|
3742
3510
|
], !1;
|
|
3743
|
-
var a =
|
|
3511
|
+
var a = h === o;
|
|
3744
3512
|
} else
|
|
3745
3513
|
var a = !0;
|
|
3514
|
+
if (a) {
|
|
3515
|
+
if (r.artifacts !== void 0) {
|
|
3516
|
+
let d = r.artifacts;
|
|
3517
|
+
const h = o;
|
|
3518
|
+
if (o === h)
|
|
3519
|
+
if (Array.isArray(d)) {
|
|
3520
|
+
var c = !0;
|
|
3521
|
+
const y = d.length;
|
|
3522
|
+
for (let g = 0; g < y; g++) {
|
|
3523
|
+
const b = o;
|
|
3524
|
+
validate12(d[g], {
|
|
3525
|
+
instancePath: e + "/artifacts/" + g,
|
|
3526
|
+
parentData: d,
|
|
3527
|
+
parentDataProperty: g,
|
|
3528
|
+
rootData: n
|
|
3529
|
+
}) || (i = i === null ? validate12.errors : i.concat(
|
|
3530
|
+
validate12.errors
|
|
3531
|
+
), o = i.length);
|
|
3532
|
+
var c = b === o;
|
|
3533
|
+
if (!c)
|
|
3534
|
+
break;
|
|
3535
|
+
}
|
|
3536
|
+
} else
|
|
3537
|
+
return validate11.errors = [
|
|
3538
|
+
{
|
|
3539
|
+
instancePath: e + "/artifacts",
|
|
3540
|
+
schemaPath: "#/properties/artifacts/type",
|
|
3541
|
+
keyword: "type",
|
|
3542
|
+
params: { type: "array" },
|
|
3543
|
+
message: "must be array"
|
|
3544
|
+
}
|
|
3545
|
+
], !1;
|
|
3546
|
+
var a = h === o;
|
|
3547
|
+
} else
|
|
3548
|
+
var a = !0;
|
|
3549
|
+
if (a)
|
|
3550
|
+
if (r.extraFiles !== void 0) {
|
|
3551
|
+
const d = o;
|
|
3552
|
+
validate13(r.extraFiles, {
|
|
3553
|
+
instancePath: e + "/extraFiles",
|
|
3554
|
+
parentData: r,
|
|
3555
|
+
parentDataProperty: "extraFiles",
|
|
3556
|
+
rootData: n
|
|
3557
|
+
}) || (i = i === null ? validate13.errors : i.concat(
|
|
3558
|
+
validate13.errors
|
|
3559
|
+
), o = i.length);
|
|
3560
|
+
var a = d === o;
|
|
3561
|
+
} else
|
|
3562
|
+
var a = !0;
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3746
3565
|
}
|
|
3747
3566
|
}
|
|
3748
3567
|
}
|
|
3749
|
-
}
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
], !1;
|
|
3568
|
+
} else
|
|
3569
|
+
return validate11.errors = [
|
|
3570
|
+
{
|
|
3571
|
+
instancePath: e,
|
|
3572
|
+
schemaPath: "#/type",
|
|
3573
|
+
keyword: "type",
|
|
3574
|
+
params: { type: "object" },
|
|
3575
|
+
message: "must be object"
|
|
3576
|
+
}
|
|
3577
|
+
], !1;
|
|
3760
3578
|
return validate11.errors = i, o === 0;
|
|
3761
3579
|
}
|
|
3762
3580
|
function validate10(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
|
|
@@ -3796,47 +3614,47 @@ async function resolvePHPExtension(r) {
|
|
|
3796
3614
|
);
|
|
3797
3615
|
n = await fetchBytes(e, h);
|
|
3798
3616
|
} else {
|
|
3799
|
-
let h,
|
|
3800
|
-
if ("manifest" in t ? (h = t.manifest, t.baseUrl && (
|
|
3617
|
+
let h, m;
|
|
3618
|
+
if ("manifest" in t ? (h = t.manifest, t.baseUrl && (m = new URL(String(t.baseUrl)))) : (m = new URL(String(t.manifestUrl)), h = await (await e(m)).json()), !validate10(h))
|
|
3801
3619
|
throw new Error(
|
|
3802
3620
|
`Invalid PHP extension manifest: ${JSON.stringify(
|
|
3803
3621
|
validate10.errors
|
|
3804
3622
|
)}`
|
|
3805
3623
|
);
|
|
3806
|
-
const
|
|
3807
|
-
if (!
|
|
3624
|
+
const y = h;
|
|
3625
|
+
if (!m)
|
|
3808
3626
|
throw new Error(
|
|
3809
3627
|
"Manifest artifacts require a manifest URL or baseUrl so relative files can be resolved."
|
|
3810
3628
|
);
|
|
3811
|
-
const
|
|
3812
|
-
(
|
|
3629
|
+
const g = y.artifacts.find(
|
|
3630
|
+
(v) => v.phpVersion === r.phpVersion
|
|
3813
3631
|
);
|
|
3814
|
-
if (!
|
|
3632
|
+
if (!g)
|
|
3815
3633
|
throw new Error(
|
|
3816
3634
|
`No extension artifact found for PHP ${r.phpVersion}.`
|
|
3817
3635
|
);
|
|
3818
|
-
s ?? (s =
|
|
3819
|
-
const
|
|
3636
|
+
s ?? (s = y.name);
|
|
3637
|
+
const b = new Semaphore({
|
|
3820
3638
|
concurrency: MAX_EXTENSION_SIDECAR_FILE_REQUESTS
|
|
3821
|
-
}),
|
|
3822
|
-
for (const
|
|
3823
|
-
for (const
|
|
3824
|
-
const
|
|
3825
|
-
if (
|
|
3826
|
-
o.push(
|
|
3639
|
+
}), Q = [];
|
|
3640
|
+
for (const v of [y.extraFiles, g.extraFiles])
|
|
3641
|
+
for (const A of (v == null ? void 0 : v.nodes) ?? []) {
|
|
3642
|
+
const K = joinPaths(v.vfsRoot ?? "", A.vfsPath);
|
|
3643
|
+
if (A.type === "directory") {
|
|
3644
|
+
o.push(K);
|
|
3827
3645
|
continue;
|
|
3828
3646
|
}
|
|
3829
|
-
if (!
|
|
3830
|
-
const
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
i[
|
|
3647
|
+
if (!A.sourcePath) continue;
|
|
3648
|
+
const he = new URL(A.sourcePath, m);
|
|
3649
|
+
Q.push(
|
|
3650
|
+
b.run(() => fetchBytes(e, he)).then((fe) => {
|
|
3651
|
+
i[K] = fe;
|
|
3834
3652
|
})
|
|
3835
3653
|
);
|
|
3836
3654
|
}
|
|
3837
3655
|
const [D] = await Promise.all([
|
|
3838
|
-
fetchBytes(e, new URL(
|
|
3839
|
-
...
|
|
3656
|
+
fetchBytes(e, new URL(g.sourcePath, m)),
|
|
3657
|
+
...Q
|
|
3840
3658
|
]);
|
|
3841
3659
|
n = D;
|
|
3842
3660
|
}
|
|
@@ -3844,18 +3662,18 @@ async function resolvePHPExtension(r) {
|
|
|
3844
3662
|
r.extensionDir ?? PHP_EXTENSIONS_DIR
|
|
3845
3663
|
);
|
|
3846
3664
|
r.extraFiles && (Object.assign(i, r.extraFiles.files), o.push(...r.extraFiles.directories ?? []));
|
|
3847
|
-
const c = r.loadWithIniDirective ?? "extension", l = joinPaths(a, `${s}.so`),
|
|
3665
|
+
const c = r.loadWithIniDirective ?? "extension", l = joinPaths(a, `${s}.so`), u = joinPaths(a, `${s}.ini`), d = [
|
|
3848
3666
|
`${c}=${l}`,
|
|
3849
3667
|
...Object.entries(r.iniEntries ?? {}).map(
|
|
3850
|
-
([h,
|
|
3668
|
+
([h, m]) => `${h}=${m}`
|
|
3851
3669
|
)
|
|
3852
3670
|
].join(`
|
|
3853
3671
|
`);
|
|
3854
3672
|
return {
|
|
3855
3673
|
soPath: l,
|
|
3856
3674
|
soBytes: n,
|
|
3857
|
-
iniPath:
|
|
3858
|
-
iniContent:
|
|
3675
|
+
iniPath: u,
|
|
3676
|
+
iniContent: d,
|
|
3859
3677
|
extraFiles: {
|
|
3860
3678
|
files: i,
|
|
3861
3679
|
directories: o
|
|
@@ -3940,25 +3758,25 @@ function ensureProxyFSHasMmapSupport(r) {
|
|
|
3940
3758
|
throw new n.ErrnoError(19);
|
|
3941
3759
|
if (a !== 0)
|
|
3942
3760
|
throw new n.ErrnoError(22);
|
|
3943
|
-
const
|
|
3944
|
-
if (!
|
|
3761
|
+
const u = t.malloc(o);
|
|
3762
|
+
if (!u)
|
|
3945
3763
|
throw new n.ErrnoError(48);
|
|
3946
|
-
const
|
|
3764
|
+
const d = t.HEAPU8.subarray(u, u + o);
|
|
3947
3765
|
let h = 0;
|
|
3948
3766
|
for (; h < o; ) {
|
|
3949
|
-
const
|
|
3767
|
+
const m = i.stream_ops.read(
|
|
3950
3768
|
i,
|
|
3951
|
-
|
|
3769
|
+
d,
|
|
3952
3770
|
h,
|
|
3953
3771
|
o - h,
|
|
3954
3772
|
h
|
|
3955
3773
|
);
|
|
3956
|
-
if (
|
|
3957
|
-
h +=
|
|
3774
|
+
if (m <= 0) break;
|
|
3775
|
+
h += m;
|
|
3958
3776
|
}
|
|
3959
3777
|
if (h !== o)
|
|
3960
|
-
throw t.free(
|
|
3961
|
-
return { ptr:
|
|
3778
|
+
throw t.free(u), new n.ErrnoError(5);
|
|
3779
|
+
return { ptr: u, allocated: !0 };
|
|
3962
3780
|
}, s.stream_ops.msync = function(i, o, a, c, l) {
|
|
3963
3781
|
return l & 2 || i.stream_ops.write(
|
|
3964
3782
|
i,
|
|
@@ -4166,10 +3984,10 @@ class NodeSABSyncReceiveMessageTransport {
|
|
|
4166
3984
|
), Atomics.wait(i, 0, 0, 5e3) === "timed-out")
|
|
4167
3985
|
throw new Error("Timeout waiting for response");
|
|
4168
3986
|
for (; ; ) {
|
|
4169
|
-
const
|
|
4170
|
-
if (((l =
|
|
4171
|
-
return
|
|
4172
|
-
if (!
|
|
3987
|
+
const u = NodeSABSyncReceiveMessageTransport.receiveMessageOnPort(e);
|
|
3988
|
+
if (((l = u.message) == null ? void 0 : l.id) === o)
|
|
3989
|
+
return u.message;
|
|
3990
|
+
if (!u)
|
|
4173
3991
|
throw new Error("No response received");
|
|
4174
3992
|
}
|
|
4175
3993
|
}
|
|
@@ -4247,51 +4065,51 @@ function expose(r, e = globalThis, t = ["*"], s) {
|
|
|
4247
4065
|
path: [],
|
|
4248
4066
|
...i.data
|
|
4249
4067
|
}, l = (i.data.argumentList || []).map(fromWireValue);
|
|
4250
|
-
let
|
|
4068
|
+
let u;
|
|
4251
4069
|
try {
|
|
4252
|
-
const
|
|
4070
|
+
const d = c.slice(0, -1).reduce((m, y) => m[y], r), h = c.reduce((m, y) => m[y], r);
|
|
4253
4071
|
switch (a) {
|
|
4254
4072
|
case MessageType.GET:
|
|
4255
|
-
|
|
4073
|
+
u = h;
|
|
4256
4074
|
break;
|
|
4257
4075
|
case MessageType.SET:
|
|
4258
|
-
|
|
4076
|
+
d[c.slice(-1)[0]] = fromWireValue(
|
|
4259
4077
|
i.data.value
|
|
4260
|
-
),
|
|
4078
|
+
), u = !0;
|
|
4261
4079
|
break;
|
|
4262
4080
|
case MessageType.APPLY:
|
|
4263
|
-
|
|
4081
|
+
u = h.apply(d, l);
|
|
4264
4082
|
break;
|
|
4265
4083
|
case MessageType.CONSTRUCT:
|
|
4266
4084
|
{
|
|
4267
|
-
const
|
|
4268
|
-
|
|
4085
|
+
const m = new h(...l);
|
|
4086
|
+
u = proxy(m);
|
|
4269
4087
|
}
|
|
4270
4088
|
break;
|
|
4271
4089
|
case MessageType.ENDPOINT:
|
|
4272
4090
|
{
|
|
4273
|
-
const { port1:
|
|
4274
|
-
expose(r,
|
|
4091
|
+
const { port1: m, port2: y } = new MessageChannel();
|
|
4092
|
+
expose(r, y), u = transfer(m, [m]);
|
|
4275
4093
|
}
|
|
4276
4094
|
break;
|
|
4277
4095
|
case MessageType.RELEASE:
|
|
4278
|
-
|
|
4096
|
+
u = void 0;
|
|
4279
4097
|
break;
|
|
4280
4098
|
default:
|
|
4281
4099
|
return;
|
|
4282
4100
|
}
|
|
4283
|
-
} catch (
|
|
4284
|
-
|
|
4101
|
+
} catch (d) {
|
|
4102
|
+
u = { value: d, [throwMarker]: 0 };
|
|
4285
4103
|
}
|
|
4286
|
-
Promise.resolve(
|
|
4287
|
-
const [h,
|
|
4288
|
-
e.postMessage({ ...h, id: o },
|
|
4104
|
+
Promise.resolve(u).catch((d) => ({ value: d, [throwMarker]: 0 })).then((d) => {
|
|
4105
|
+
const [h, m] = toWireValue(d);
|
|
4106
|
+
e.postMessage({ ...h, id: o }, m), a === MessageType.RELEASE && (e.removeEventListener("message", n), closeEndPoint(e), finalizer in r && typeof r[finalizer] == "function" && r[finalizer]());
|
|
4289
4107
|
}).catch(() => {
|
|
4290
|
-
const [
|
|
4108
|
+
const [d, h] = toWireValue({
|
|
4291
4109
|
value: new TypeError("Unserializable return value"),
|
|
4292
4110
|
[throwMarker]: 0
|
|
4293
4111
|
});
|
|
4294
|
-
e.postMessage({ ...
|
|
4112
|
+
e.postMessage({ ...d, id: o }, h);
|
|
4295
4113
|
}).finally(() => {
|
|
4296
4114
|
s == null || s(i);
|
|
4297
4115
|
});
|
|
@@ -4362,16 +4180,16 @@ function createProxy(r, e, t = [], s = function() {
|
|
|
4362
4180
|
},
|
|
4363
4181
|
set(o, a, c) {
|
|
4364
4182
|
throwIfProxyReleased(n);
|
|
4365
|
-
const [l,
|
|
4183
|
+
const [l, u] = toWireValue(c);
|
|
4366
4184
|
return requestResponseMessage(
|
|
4367
4185
|
r,
|
|
4368
4186
|
e,
|
|
4369
4187
|
{
|
|
4370
4188
|
type: MessageType.SET,
|
|
4371
|
-
path: [...t, a].map((
|
|
4189
|
+
path: [...t, a].map((d) => d.toString()),
|
|
4372
4190
|
value: l
|
|
4373
4191
|
},
|
|
4374
|
-
|
|
4192
|
+
u
|
|
4375
4193
|
).then(fromWireValue);
|
|
4376
4194
|
},
|
|
4377
4195
|
apply(o, a, c) {
|
|
@@ -4383,16 +4201,16 @@ function createProxy(r, e, t = [], s = function() {
|
|
|
4383
4201
|
}).then(fromWireValue);
|
|
4384
4202
|
if (l === "bind")
|
|
4385
4203
|
return createProxy(r, e, t.slice(0, -1));
|
|
4386
|
-
const [
|
|
4204
|
+
const [u, d] = processArguments(c);
|
|
4387
4205
|
return requestResponseMessage(
|
|
4388
4206
|
r,
|
|
4389
4207
|
e,
|
|
4390
4208
|
{
|
|
4391
4209
|
type: MessageType.APPLY,
|
|
4392
4210
|
path: t.map((h) => h.toString()),
|
|
4393
|
-
argumentList:
|
|
4211
|
+
argumentList: u
|
|
4394
4212
|
},
|
|
4395
|
-
|
|
4213
|
+
d
|
|
4396
4214
|
).then(fromWireValue);
|
|
4397
4215
|
},
|
|
4398
4216
|
construct(o, a) {
|
|
@@ -4403,7 +4221,7 @@ function createProxy(r, e, t = [], s = function() {
|
|
|
4403
4221
|
e,
|
|
4404
4222
|
{
|
|
4405
4223
|
type: MessageType.CONSTRUCT,
|
|
4406
|
-
path: t.map((
|
|
4224
|
+
path: t.map((u) => u.toString()),
|
|
4407
4225
|
argumentList: c
|
|
4408
4226
|
},
|
|
4409
4227
|
l
|
|
@@ -4603,19 +4421,19 @@ const errorProperties = [
|
|
|
4603
4421
|
useToJSON: o,
|
|
4604
4422
|
serialize: a
|
|
4605
4423
|
});
|
|
4606
|
-
for (const [l,
|
|
4607
|
-
if (
|
|
4424
|
+
for (const [l, u] of Object.entries(r)) {
|
|
4425
|
+
if (u && u instanceof Uint8Array && u.constructor.name === "Buffer") {
|
|
4608
4426
|
t[l] = "[object Buffer]";
|
|
4609
4427
|
continue;
|
|
4610
4428
|
}
|
|
4611
|
-
if (
|
|
4429
|
+
if (u !== null && typeof u == "object" && typeof u.pipe == "function") {
|
|
4612
4430
|
t[l] = "[object Stream]";
|
|
4613
4431
|
continue;
|
|
4614
4432
|
}
|
|
4615
|
-
if (typeof
|
|
4616
|
-
if (!
|
|
4433
|
+
if (typeof u != "function") {
|
|
4434
|
+
if (!u || typeof u != "object") {
|
|
4617
4435
|
try {
|
|
4618
|
-
t[l] =
|
|
4436
|
+
t[l] = u;
|
|
4619
4437
|
} catch {
|
|
4620
4438
|
}
|
|
4621
4439
|
continue;
|
|
@@ -4628,10 +4446,10 @@ const errorProperties = [
|
|
|
4628
4446
|
}
|
|
4629
4447
|
}
|
|
4630
4448
|
if (a || t instanceof Error)
|
|
4631
|
-
for (const { property: l, enumerable:
|
|
4449
|
+
for (const { property: l, enumerable: u } of errorProperties)
|
|
4632
4450
|
r[l] !== void 0 && r[l] !== null && Object.defineProperty(t, l, {
|
|
4633
4451
|
value: isErrorLike(r[l]) || Array.isArray(r[l]) ? c(r[l]) : r[l],
|
|
4634
|
-
enumerable: s ? !0 :
|
|
4452
|
+
enumerable: s ? !0 : u,
|
|
4635
4453
|
configurable: !0,
|
|
4636
4454
|
writable: !0
|
|
4637
4455
|
});
|
|
@@ -5576,23 +5394,23 @@ function createObjectPoolProxy(r) {
|
|
|
5576
5394
|
}
|
|
5577
5395
|
function i(o) {
|
|
5578
5396
|
return s().then((a) => {
|
|
5579
|
-
const c = (
|
|
5580
|
-
const
|
|
5581
|
-
return
|
|
5397
|
+
const c = (u) => {
|
|
5398
|
+
const d = u == null ? void 0 : u.finished;
|
|
5399
|
+
return d && typeof d.then == "function" ? Promise.resolve(d).then(
|
|
5582
5400
|
() => n(a),
|
|
5583
5401
|
() => n(a)
|
|
5584
|
-
) : n(a),
|
|
5402
|
+
) : n(a), u;
|
|
5585
5403
|
};
|
|
5586
5404
|
let l;
|
|
5587
5405
|
try {
|
|
5588
5406
|
l = o(a);
|
|
5589
|
-
} catch (
|
|
5590
|
-
throw n(a),
|
|
5407
|
+
} catch (u) {
|
|
5408
|
+
throw n(a), u;
|
|
5591
5409
|
}
|
|
5592
5410
|
return l != null && typeof l.then == "function" ? l.then(
|
|
5593
|
-
(
|
|
5594
|
-
(
|
|
5595
|
-
throw n(a),
|
|
5411
|
+
(u) => c(u),
|
|
5412
|
+
(u) => {
|
|
5413
|
+
throw n(a), u;
|
|
5596
5414
|
}
|
|
5597
5415
|
) : c(l);
|
|
5598
5416
|
});
|
|
@@ -5604,14 +5422,14 @@ function createObjectPoolProxy(r) {
|
|
|
5604
5422
|
if (a !== "then")
|
|
5605
5423
|
return new Proxy(function() {
|
|
5606
5424
|
}, {
|
|
5607
|
-
apply(c, l,
|
|
5608
|
-
return i((
|
|
5425
|
+
apply(c, l, u) {
|
|
5426
|
+
return i((d) => d[a](...u));
|
|
5609
5427
|
},
|
|
5610
5428
|
get(c, l) {
|
|
5611
5429
|
if (l === "then")
|
|
5612
|
-
return (
|
|
5613
|
-
|
|
5614
|
-
|
|
5430
|
+
return (u, d) => i((h) => h[a]).then(
|
|
5431
|
+
u,
|
|
5432
|
+
d
|
|
5615
5433
|
);
|
|
5616
5434
|
}
|
|
5617
5435
|
});
|