@php-wasm/universal 3.1.30 → 3.1.31

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