@php-wasm/universal 3.1.39 → 3.1.40
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 +1 -1
- package/index.cjs.map +1 -1
- package/index.js +123 -81
- package/index.js.map +1 -1
- package/package.json +7 -7
package/index.js
CHANGED
|
@@ -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 J, V, z, D, G, X,
|
|
1072
|
+
var J, V, z, D, G, X, k, g, Pe, we, _e, ve, Ee, xe, Se, ke, fe, Fe, he, me;
|
|
1073
1073
|
class PHP {
|
|
1074
1074
|
/**
|
|
1075
1075
|
* Initializes a PHP runtime.
|
|
@@ -1089,7 +1089,7 @@ class PHP {
|
|
|
1089
1089
|
]));
|
|
1090
1090
|
E(this, G, []);
|
|
1091
1091
|
E(this, X, {});
|
|
1092
|
-
E(this,
|
|
1092
|
+
E(this, k, {
|
|
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" && (p(this,
|
|
1100
|
+
e.source === "php-wasm" && (p(this, k).needsRotating = !0);
|
|
1101
1101
|
});
|
|
1102
1102
|
}
|
|
1103
1103
|
/**
|
|
@@ -1519,7 +1519,7 @@ class PHP {
|
|
|
1519
1519
|
);
|
|
1520
1520
|
_(this, g, we).call(this, r.relativeUri || ""), _(this, g, xe).call(this, r.method || "GET");
|
|
1521
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,
|
|
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, ke).call(this, r.body)), typeof r.code == "string")
|
|
1523
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 || "");
|
|
@@ -1529,7 +1529,7 @@ class PHP {
|
|
|
1529
1529
|
);
|
|
1530
1530
|
const c = _(this, g, Pe).call(this, r.$_SERVER, o, a);
|
|
1531
1531
|
for (const d in c)
|
|
1532
|
-
_(this, g,
|
|
1532
|
+
_(this, g, Fe).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]);
|
|
@@ -1770,21 +1770,21 @@ class PHP {
|
|
|
1770
1770
|
* or an internal crash.
|
|
1771
1771
|
*/
|
|
1772
1772
|
enableRuntimeRotation(r) {
|
|
1773
|
-
x(this,
|
|
1774
|
-
...p(this,
|
|
1773
|
+
x(this, k, {
|
|
1774
|
+
...p(this, k),
|
|
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 (!p(this,
|
|
1781
|
+
if (!p(this, k).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 p(this,
|
|
1787
|
-
), p(this,
|
|
1786
|
+
await p(this, k).recreateRuntime()
|
|
1787
|
+
), p(this, k).requestsMade = 0, p(this, k).needsRotating = !1;
|
|
1788
1788
|
}
|
|
1789
1789
|
/**
|
|
1790
1790
|
* Hot-swaps the PHP runtime for a new one without
|
|
@@ -1798,6 +1798,7 @@ class PHP {
|
|
|
1798
1798
|
const o = Object.entries(p(this, X)).map(
|
|
1799
1799
|
([c, l]) => ({
|
|
1800
1800
|
mountHandler: l.mountHandler,
|
|
1801
|
+
mountPointSnapshot: snapshotMountPoint(e, c),
|
|
1801
1802
|
vfsPath: c
|
|
1802
1803
|
})
|
|
1803
1804
|
), i = Object.values(
|
|
@@ -1813,8 +1814,26 @@ class PHP {
|
|
|
1813
1814
|
const a = this[__private__dont__use].FS;
|
|
1814
1815
|
for (const c of t)
|
|
1815
1816
|
c && c !== "/request" && copyMEMFSNodes(e, a, c);
|
|
1816
|
-
for (const {
|
|
1817
|
-
|
|
1817
|
+
for (const {
|
|
1818
|
+
mountHandler: c,
|
|
1819
|
+
mountPointSnapshot: l,
|
|
1820
|
+
vfsPath: d
|
|
1821
|
+
} of o)
|
|
1822
|
+
try {
|
|
1823
|
+
await this.mount(d, c);
|
|
1824
|
+
} catch (u) {
|
|
1825
|
+
if (isMissingMountSourceError(u)) {
|
|
1826
|
+
restoreMountPointSnapshot(
|
|
1827
|
+
a,
|
|
1828
|
+
d,
|
|
1829
|
+
l
|
|
1830
|
+
);
|
|
1831
|
+
continue;
|
|
1832
|
+
}
|
|
1833
|
+
if (!isMissingMountTargetPathError(u))
|
|
1834
|
+
throw u;
|
|
1835
|
+
this.mkdir(d), await this.mount(d, c);
|
|
1836
|
+
}
|
|
1818
1837
|
try {
|
|
1819
1838
|
a.chdir(n);
|
|
1820
1839
|
} catch (c) {
|
|
@@ -1866,7 +1885,7 @@ class PHP {
|
|
|
1866
1885
|
async cli(r, e = {}) {
|
|
1867
1886
|
if (basename(r[0] ?? "") !== "php")
|
|
1868
1887
|
return this.subProcess(r, e);
|
|
1869
|
-
p(this, V) && (p(this,
|
|
1888
|
+
p(this, V) && (p(this, k).needsRotating = !0);
|
|
1870
1889
|
const t = await this.semaphore.acquire();
|
|
1871
1890
|
return await _(this, g, me).call(this, () => {
|
|
1872
1891
|
const s = e.env || {};
|
|
@@ -1884,7 +1903,7 @@ class PHP {
|
|
|
1884
1903
|
async: !0
|
|
1885
1904
|
});
|
|
1886
1905
|
}).then((s) => (s.exitCode.finally(t), s)).finally(() => {
|
|
1887
|
-
p(this,
|
|
1906
|
+
p(this, k).needsRotating = !0;
|
|
1888
1907
|
});
|
|
1889
1908
|
}
|
|
1890
1909
|
/**
|
|
@@ -1972,7 +1991,7 @@ class PHP {
|
|
|
1972
1991
|
this.exit(0);
|
|
1973
1992
|
}
|
|
1974
1993
|
}
|
|
1975
|
-
J = new WeakMap(), V = new WeakMap(), z = new WeakMap(), D = new WeakMap(), G = new WeakMap(), X = new WeakMap(),
|
|
1994
|
+
J = new WeakMap(), V = new WeakMap(), z = new WeakMap(), D = new WeakMap(), G = new WeakMap(), X = new WeakMap(), k = new WeakMap(), g = new WeakSet(), /**
|
|
1976
1995
|
* Prepares the $_SERVER entries for the PHP runtime.
|
|
1977
1996
|
*
|
|
1978
1997
|
* @param defaults Default entries to include in $_SERVER.
|
|
@@ -2050,7 +2069,7 @@ Pe = function(r, e, t) {
|
|
|
2050
2069
|
[NUMBER],
|
|
2051
2070
|
[parseInt(r["content-length"], 10)]
|
|
2052
2071
|
);
|
|
2053
|
-
},
|
|
2072
|
+
}, ke = function(r) {
|
|
2054
2073
|
let e, t;
|
|
2055
2074
|
typeof r == "string" ? (logger.warn(
|
|
2056
2075
|
"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"
|
|
@@ -2080,7 +2099,7 @@ Pe = function(r, e, t) {
|
|
|
2080
2099
|
[STRING],
|
|
2081
2100
|
[r]
|
|
2082
2101
|
);
|
|
2083
|
-
},
|
|
2102
|
+
}, Fe = function(r, e) {
|
|
2084
2103
|
this[__private__dont__use].ccall(
|
|
2085
2104
|
"wasm_add_SERVER_entry",
|
|
2086
2105
|
null,
|
|
@@ -2095,7 +2114,7 @@ Pe = function(r, e, t) {
|
|
|
2095
2114
|
[r, e]
|
|
2096
2115
|
);
|
|
2097
2116
|
}, me = async function(r) {
|
|
2098
|
-
p(this,
|
|
2117
|
+
p(this, k).enabled && p(this, k).needsRotating && await this.rotateRuntime(), ++p(this, k).requestsMade, p(this, k).requestsMade >= p(this, k).maxRequests && (p(this, k).needsRotating = !0);
|
|
2099
2118
|
const e = this[__private__dont__use], t = await createInvertedReadableStream();
|
|
2100
2119
|
e.onHeaders = (u) => {
|
|
2101
2120
|
a || s || t.controller.enqueue(u.slice());
|
|
@@ -2194,6 +2213,29 @@ function copyMEMFSNodes(r, e, t) {
|
|
|
2194
2213
|
for (const o of n)
|
|
2195
2214
|
copyMEMFSNodes(r, e, joinPaths(t, o));
|
|
2196
2215
|
}
|
|
2216
|
+
function snapshotMountPoint(r, e) {
|
|
2217
|
+
try {
|
|
2218
|
+
const t = r.lookupPath(e, { follow: !1 });
|
|
2219
|
+
return r.isLink(t.node.mode) ? { kind: "symlink", target: r.readlink(e) } : r.isDir(t.node.mode) ? { kind: "directory" } : { kind: "file" };
|
|
2220
|
+
} catch {
|
|
2221
|
+
return;
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
function restoreMountPointSnapshot(r, e, t) {
|
|
2225
|
+
if (!(!t || getNodeType(r, e) !== "missing")) {
|
|
2226
|
+
if (t.kind === "directory") {
|
|
2227
|
+
r.mkdirTree(e);
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2230
|
+
r.mkdirTree(dirname(e)), t.kind === "symlink" ? r.symlink(t.target, e) : r.writeFile(e, new Uint8Array());
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
function isMissingMountSourceError(r) {
|
|
2234
|
+
return r.phpWasmMountSourceMissing === !0;
|
|
2235
|
+
}
|
|
2236
|
+
function isMissingMountTargetPathError(r) {
|
|
2237
|
+
return r.errno === 44;
|
|
2238
|
+
}
|
|
2197
2239
|
async function createInvertedReadableStream(r = {}) {
|
|
2198
2240
|
let e;
|
|
2199
2241
|
const t = new Promise(
|
|
@@ -2662,7 +2704,7 @@ const _default = "application/octet-stream", asx = "video/x-ms-asf", atom = "app
|
|
|
2662
2704
|
xspf,
|
|
2663
2705
|
zip
|
|
2664
2706
|
};
|
|
2665
|
-
var A, Q, re, Y, K,
|
|
2707
|
+
var A, Q, re, Y, K, I, Z, $, se, b, Re, oe, be, He, Te;
|
|
2666
2708
|
class PHPRequestHandler {
|
|
2667
2709
|
/**
|
|
2668
2710
|
* The request handler needs to decide whether to serve a static asset or
|
|
@@ -2682,7 +2724,7 @@ class PHPRequestHandler {
|
|
|
2682
2724
|
E(this, re);
|
|
2683
2725
|
E(this, Y);
|
|
2684
2726
|
E(this, K);
|
|
2685
|
-
E(this,
|
|
2727
|
+
E(this, I);
|
|
2686
2728
|
E(this, Z);
|
|
2687
2729
|
E(this, $);
|
|
2688
2730
|
E(this, se);
|
|
@@ -2721,10 +2763,10 @@ class PHPRequestHandler {
|
|
|
2721
2763
|
x(this, K, [
|
|
2722
2764
|
p(this, re),
|
|
2723
2765
|
l ? `:${p(this, Y)}` : ""
|
|
2724
|
-
].join("")), x(this,
|
|
2766
|
+
].join("")), x(this, I, c.pathname.replace(/\/+$/, "")), x(this, Z, [
|
|
2725
2767
|
`${p(this, Q)}://`,
|
|
2726
2768
|
p(this, K),
|
|
2727
|
-
p(this,
|
|
2769
|
+
p(this, I)
|
|
2728
2770
|
].join("")), this.rewriteRules = n, x(this, se, o), this.getFileNotFoundAction = i;
|
|
2729
2771
|
}
|
|
2730
2772
|
async getPrimaryPhp() {
|
|
@@ -2749,7 +2791,7 @@ class PHPRequestHandler {
|
|
|
2749
2791
|
*/
|
|
2750
2792
|
internalUrlToPath(e) {
|
|
2751
2793
|
const t = new URL(e, "https://playground.internal");
|
|
2752
|
-
return t.pathname.startsWith(p(this,
|
|
2794
|
+
return t.pathname.startsWith(p(this, I)) && (t.pathname = t.pathname.slice(p(this, I).length)), toRelativeUrl(t);
|
|
2753
2795
|
}
|
|
2754
2796
|
/**
|
|
2755
2797
|
* The absolute URL of this PHPRequestHandler instance.
|
|
@@ -2844,7 +2886,7 @@ class PHPRequestHandler {
|
|
|
2844
2886
|
* before using it as a filesystem path.
|
|
2845
2887
|
*/
|
|
2846
2888
|
decodeURIComponent(n.pathname),
|
|
2847
|
-
p(this,
|
|
2889
|
+
p(this, I)
|
|
2848
2890
|
);
|
|
2849
2891
|
let a = _(this, b, oe).call(this, i);
|
|
2850
2892
|
if (o.isDir(a)) {
|
|
@@ -3010,7 +3052,7 @@ class PHPRequestHandler {
|
|
|
3010
3052
|
await this.instanceManager[Symbol.asyncDispose]();
|
|
3011
3053
|
}
|
|
3012
3054
|
}
|
|
3013
|
-
A = new WeakMap(), Q = new WeakMap(), re = new WeakMap(), Y = new WeakMap(), K = new WeakMap(),
|
|
3055
|
+
A = new WeakMap(), Q = new WeakMap(), re = new WeakMap(), Y = new WeakMap(), K = new WeakMap(), I = new WeakMap(), Z = new WeakMap(), $ = new WeakMap(), se = new WeakMap(), b = new WeakSet(), /**
|
|
3014
3056
|
* Apply the rewrite rules to the original request URL.
|
|
3015
3057
|
*
|
|
3016
3058
|
* @param originalRequestUrl - The original request URL.
|
|
@@ -3019,12 +3061,12 @@ A = new WeakMap(), Q = new WeakMap(), re = new WeakMap(), Y = new WeakMap(), K =
|
|
|
3019
3061
|
Re = function(e) {
|
|
3020
3062
|
const t = removePathPrefix(
|
|
3021
3063
|
decodeURIComponent(e.pathname),
|
|
3022
|
-
p(this,
|
|
3064
|
+
p(this, I)
|
|
3023
3065
|
), s = applyRewriteRules(
|
|
3024
3066
|
t,
|
|
3025
3067
|
this.rewriteRules
|
|
3026
3068
|
), n = new URL(
|
|
3027
|
-
joinPaths(p(this,
|
|
3069
|
+
joinPaths(p(this, I), s),
|
|
3028
3070
|
e.toString()
|
|
3029
3071
|
);
|
|
3030
3072
|
for (const [o, i] of e.searchParams.entries())
|
|
@@ -3099,7 +3141,7 @@ be = function(e, t) {
|
|
|
3099
3141
|
const l = await e.runStream({
|
|
3100
3142
|
relativeUri: ensurePathPrefix(
|
|
3101
3143
|
toRelativeUrl(new URL(n.toString())),
|
|
3102
|
-
p(this,
|
|
3144
|
+
p(this, I)
|
|
3103
3145
|
),
|
|
3104
3146
|
protocol: p(this, Q),
|
|
3105
3147
|
method: t.method || i,
|
|
@@ -3290,15 +3332,15 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3290
3332
|
let o = null, i = 0;
|
|
3291
3333
|
if (i === 0)
|
|
3292
3334
|
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
3293
|
-
let
|
|
3294
|
-
if (r.name === void 0 && (
|
|
3335
|
+
let M;
|
|
3336
|
+
if (r.name === void 0 && (M = "name") || r.artifacts === void 0 && (M = "artifacts"))
|
|
3295
3337
|
return validate11.errors = [
|
|
3296
3338
|
{
|
|
3297
3339
|
instancePath: e,
|
|
3298
3340
|
schemaPath: "#/required",
|
|
3299
3341
|
keyword: "required",
|
|
3300
|
-
params: { missingProperty:
|
|
3301
|
-
message: "must have required property '" +
|
|
3342
|
+
params: { missingProperty: M },
|
|
3343
|
+
message: "must have required property '" + M + "'"
|
|
3302
3344
|
}
|
|
3303
3345
|
], !1;
|
|
3304
3346
|
{
|
|
@@ -3507,22 +3549,22 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3507
3549
|
const U = f.length;
|
|
3508
3550
|
for (let m = 0; m < U; m++) {
|
|
3509
3551
|
let w = f[m];
|
|
3510
|
-
const
|
|
3511
|
-
if (i ===
|
|
3552
|
+
const W = i;
|
|
3553
|
+
if (i === W)
|
|
3512
3554
|
if (w && typeof w == "object" && !Array.isArray(
|
|
3513
3555
|
w
|
|
3514
3556
|
)) {
|
|
3515
|
-
let
|
|
3516
|
-
if (w.phpVersion === void 0 && (
|
|
3557
|
+
let q;
|
|
3558
|
+
if (w.phpVersion === void 0 && (q = "phpVersion") || w.sourcePath === void 0 && (q = "sourcePath"))
|
|
3517
3559
|
return validate11.errors = [
|
|
3518
3560
|
{
|
|
3519
3561
|
instancePath: e + "/artifacts/" + m,
|
|
3520
3562
|
schemaPath: "#/properties/artifacts/items/required",
|
|
3521
3563
|
keyword: "required",
|
|
3522
3564
|
params: {
|
|
3523
|
-
missingProperty:
|
|
3565
|
+
missingProperty: q
|
|
3524
3566
|
},
|
|
3525
|
-
message: "must have required property '" +
|
|
3567
|
+
message: "must have required property '" + q + "'"
|
|
3526
3568
|
}
|
|
3527
3569
|
], !1;
|
|
3528
3570
|
{
|
|
@@ -3625,16 +3667,16 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3625
3667
|
v
|
|
3626
3668
|
)) {
|
|
3627
3669
|
var P = !0;
|
|
3628
|
-
const
|
|
3629
|
-
for (let C = 0; C <
|
|
3630
|
-
let
|
|
3670
|
+
const Le = v.length;
|
|
3671
|
+
for (let C = 0; C < Le; C++) {
|
|
3672
|
+
let L = v[C];
|
|
3631
3673
|
const ye = i;
|
|
3632
3674
|
if (i === ye)
|
|
3633
|
-
if (
|
|
3634
|
-
|
|
3675
|
+
if (L && typeof L == "object" && !Array.isArray(
|
|
3676
|
+
L
|
|
3635
3677
|
)) {
|
|
3636
3678
|
let ue;
|
|
3637
|
-
if (
|
|
3679
|
+
if (L.vfsPath === void 0 && (ue = "vfsPath"))
|
|
3638
3680
|
return validate11.errors = [
|
|
3639
3681
|
{
|
|
3640
3682
|
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C,
|
|
@@ -3647,8 +3689,8 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3647
3689
|
}
|
|
3648
3690
|
], !1;
|
|
3649
3691
|
{
|
|
3650
|
-
const
|
|
3651
|
-
for (const T in
|
|
3692
|
+
const Ie = i;
|
|
3693
|
+
for (const T in L)
|
|
3652
3694
|
if (!(T === "vfsPath" || T === "type" || T === "sourcePath"))
|
|
3653
3695
|
return validate11.errors = [
|
|
3654
3696
|
{
|
|
@@ -3661,10 +3703,10 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3661
3703
|
message: "must NOT have additional properties"
|
|
3662
3704
|
}
|
|
3663
3705
|
], !1;
|
|
3664
|
-
if (
|
|
3665
|
-
if (
|
|
3706
|
+
if (Ie === i) {
|
|
3707
|
+
if (L.vfsPath !== void 0) {
|
|
3666
3708
|
const T = i;
|
|
3667
|
-
if (typeof
|
|
3709
|
+
if (typeof L.vfsPath != "string")
|
|
3668
3710
|
return validate11.errors = [
|
|
3669
3711
|
{
|
|
3670
3712
|
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C + "/vfsPath",
|
|
@@ -3680,8 +3722,8 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3680
3722
|
} else
|
|
3681
3723
|
var S = !0;
|
|
3682
3724
|
if (S) {
|
|
3683
|
-
if (
|
|
3684
|
-
let T =
|
|
3725
|
+
if (L.type !== void 0) {
|
|
3726
|
+
let T = L.type;
|
|
3685
3727
|
const Ce = i;
|
|
3686
3728
|
if (typeof T != "string")
|
|
3687
3729
|
return validate11.errors = [
|
|
@@ -3711,9 +3753,9 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3711
3753
|
} else
|
|
3712
3754
|
var S = !0;
|
|
3713
3755
|
if (S)
|
|
3714
|
-
if (
|
|
3756
|
+
if (L.sourcePath !== void 0) {
|
|
3715
3757
|
const T = i;
|
|
3716
|
-
if (typeof
|
|
3758
|
+
if (typeof L.sourcePath != "string")
|
|
3717
3759
|
return validate11.errors = [
|
|
3718
3760
|
{
|
|
3719
3761
|
instancePath: e + "/artifacts/" + m + "/extraFiles/nodes/" + C + "/sourcePath",
|
|
@@ -3793,7 +3835,7 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3793
3835
|
message: "must be object"
|
|
3794
3836
|
}
|
|
3795
3837
|
], !1;
|
|
3796
|
-
var d =
|
|
3838
|
+
var d = W === i;
|
|
3797
3839
|
if (!d)
|
|
3798
3840
|
break;
|
|
3799
3841
|
}
|
|
@@ -3855,14 +3897,14 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3855
3897
|
if (N)
|
|
3856
3898
|
if (f.nodes !== void 0) {
|
|
3857
3899
|
let w = f.nodes;
|
|
3858
|
-
const
|
|
3859
|
-
if (i ===
|
|
3900
|
+
const W = i;
|
|
3901
|
+
if (i === W)
|
|
3860
3902
|
if (Array.isArray(
|
|
3861
3903
|
w
|
|
3862
3904
|
)) {
|
|
3863
3905
|
var B = !0;
|
|
3864
|
-
const
|
|
3865
|
-
for (let H = 0; H <
|
|
3906
|
+
const q = w.length;
|
|
3907
|
+
for (let H = 0; H < q; H++) {
|
|
3866
3908
|
let y = w[H];
|
|
3867
3909
|
const ne = i;
|
|
3868
3910
|
if (i === ne)
|
|
@@ -3912,10 +3954,10 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3912
3954
|
message: "must be string"
|
|
3913
3955
|
}
|
|
3914
3956
|
], !1;
|
|
3915
|
-
var
|
|
3957
|
+
var F = v === i;
|
|
3916
3958
|
} else
|
|
3917
|
-
var
|
|
3918
|
-
if (
|
|
3959
|
+
var F = !0;
|
|
3960
|
+
if (F) {
|
|
3919
3961
|
if (y.type !== void 0) {
|
|
3920
3962
|
let v = y.type;
|
|
3921
3963
|
const ie = i;
|
|
@@ -3943,10 +3985,10 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3943
3985
|
message: "must be equal to one of the allowed values"
|
|
3944
3986
|
}
|
|
3945
3987
|
], !1;
|
|
3946
|
-
var
|
|
3988
|
+
var F = ie === i;
|
|
3947
3989
|
} else
|
|
3948
|
-
var
|
|
3949
|
-
if (
|
|
3990
|
+
var F = !0;
|
|
3991
|
+
if (F)
|
|
3950
3992
|
if (y.sourcePath !== void 0) {
|
|
3951
3993
|
const v = i;
|
|
3952
3994
|
if (typeof y.sourcePath != "string")
|
|
@@ -3961,9 +4003,9 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3961
4003
|
message: "must be string"
|
|
3962
4004
|
}
|
|
3963
4005
|
], !1;
|
|
3964
|
-
var
|
|
4006
|
+
var F = v === i;
|
|
3965
4007
|
} else
|
|
3966
|
-
var
|
|
4008
|
+
var F = !0;
|
|
3967
4009
|
}
|
|
3968
4010
|
}
|
|
3969
4011
|
}
|
|
@@ -3995,7 +4037,7 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
|
|
|
3995
4037
|
message: "must be array"
|
|
3996
4038
|
}
|
|
3997
4039
|
], !1;
|
|
3998
|
-
var N =
|
|
4040
|
+
var N = W === i;
|
|
3999
4041
|
} else
|
|
4000
4042
|
var N = !0;
|
|
4001
4043
|
}
|
|
@@ -4057,9 +4099,9 @@ async function resolvePHPExtension(r) {
|
|
|
4057
4099
|
);
|
|
4058
4100
|
n = toUint8Array(t.bytes);
|
|
4059
4101
|
} else if (t.format === "url") {
|
|
4060
|
-
let
|
|
4102
|
+
let F;
|
|
4061
4103
|
try {
|
|
4062
|
-
|
|
4104
|
+
F = new URL(String(t.url));
|
|
4063
4105
|
} catch {
|
|
4064
4106
|
throw new Error(
|
|
4065
4107
|
`source.url must be an absolute URL when loading a PHP extension from a direct URL. Received: ${String(
|
|
@@ -4067,21 +4109,21 @@ async function resolvePHPExtension(r) {
|
|
|
4067
4109
|
)}`
|
|
4068
4110
|
);
|
|
4069
4111
|
}
|
|
4070
|
-
if (s || (s = t.name), !s &&
|
|
4112
|
+
if (s || (s = t.name), !s && F.pathname.endsWith(".so") && (s = basename(F.pathname).slice(0, -3)), !s)
|
|
4071
4113
|
throw new Error(
|
|
4072
4114
|
"name is required when loading an extension from a direct URL."
|
|
4073
4115
|
);
|
|
4074
|
-
n = await fetchBytes(e,
|
|
4116
|
+
n = await fetchBytes(e, F);
|
|
4075
4117
|
} else {
|
|
4076
|
-
let
|
|
4077
|
-
if ("manifest" in t ? (
|
|
4118
|
+
let F, M;
|
|
4119
|
+
if ("manifest" in t ? (F = t.manifest, t.baseUrl && (M = new URL(String(t.baseUrl)))) : (M = new URL(String(t.manifestUrl)), F = await (await e(M)).json()), !validate10(F))
|
|
4078
4120
|
throw new Error(
|
|
4079
4121
|
`Invalid PHP extension manifest: ${JSON.stringify(
|
|
4080
4122
|
validate10.errors
|
|
4081
4123
|
)}`
|
|
4082
4124
|
);
|
|
4083
|
-
const O =
|
|
4084
|
-
if (!
|
|
4125
|
+
const O = F;
|
|
4126
|
+
if (!M)
|
|
4085
4127
|
throw new Error(
|
|
4086
4128
|
"Manifest artifacts require a manifest URL or baseUrl so relative files can be resolved."
|
|
4087
4129
|
);
|
|
@@ -4098,21 +4140,21 @@ async function resolvePHPExtension(r) {
|
|
|
4098
4140
|
}), ce = [];
|
|
4099
4141
|
for (const m of [O.extraFiles, f.extraFiles])
|
|
4100
4142
|
for (const w of (m == null ? void 0 : m.nodes) ?? []) {
|
|
4101
|
-
const
|
|
4143
|
+
const W = joinPaths(m.vfsRoot ?? "", w.vfsPath);
|
|
4102
4144
|
if (w.type === "directory") {
|
|
4103
|
-
i.push(
|
|
4145
|
+
i.push(W);
|
|
4104
4146
|
continue;
|
|
4105
4147
|
}
|
|
4106
4148
|
if (!w.sourcePath) continue;
|
|
4107
|
-
const
|
|
4149
|
+
const Me = new URL(w.sourcePath, M);
|
|
4108
4150
|
ce.push(
|
|
4109
|
-
R.run(() => fetchBytes(e,
|
|
4110
|
-
o[
|
|
4151
|
+
R.run(() => fetchBytes(e, Me)).then((q) => {
|
|
4152
|
+
o[W] = q;
|
|
4111
4153
|
})
|
|
4112
4154
|
);
|
|
4113
4155
|
}
|
|
4114
4156
|
const [U] = await Promise.all([
|
|
4115
|
-
fetchBytes(e, new URL(f.sourcePath,
|
|
4157
|
+
fetchBytes(e, new URL(f.sourcePath, M)),
|
|
4116
4158
|
...ce
|
|
4117
4159
|
]);
|
|
4118
4160
|
n = U;
|