@php-wasm/universal 3.1.29 → 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 Z = (r) => {
1
+ var ge = (r) => {
2
2
  throw TypeError(r);
3
3
  };
4
- var G = (r, e, t) => e.has(r) || Z("Cannot " + t);
5
- var p = (r, e, t) => (G(r, e, "read from private field"), t ? t.call(r) : e.get(r)), P = (r, e, t) => e.has(r) ? Z("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), _ = (r, e, t, s) => (G(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), w = (r, e, t) => (G(r, e, "access private method"), t);
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 F;
374
+ var j;
375
375
  class PHPWorker {
376
376
  /** @inheritDoc */
377
377
  constructor(e, t) {
378
- P(this, F);
379
- this.absoluteUrl = "", this.documentRoot = "", this.chroot = null, _(this, F, /* @__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
- p(this, F).has(e) || p(this, F).set(e, /* @__PURE__ */ new Set()), p(this, F).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 = p(this, F).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 = p(this, F).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
- F = 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 B, q;
666
- const V = class V {
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 V = class V {
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
- P(this, B);
675
+ E(this, ee);
676
676
  /**
677
677
  * Headers stream reserved for internal parsing.
678
678
  */
679
- P(this, q);
679
+ E(this, te);
680
680
  this.cachedParsedHeaders = null, this.cachedStdoutBytes = null, this.cachedStderrText = null;
681
- const [i, o] = e.tee();
682
- _(this, B, i), _(this, q, 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 V = class V {
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 V(
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 V = class V {
720
720
  * Shorthand for `StreamedPHPResponse.fromPHPResponse(PHPResponse.forHttpCode(...))`.
721
721
  */
722
722
  static forHttpCode(e, t = "") {
723
- return V.fromPHPResponse(
723
+ return ae.fromPHPResponse(
724
724
  PHPResponse.forHttpCode(e, t)
725
725
  );
726
726
  }
@@ -729,7 +729,7 @@ const V = class V {
729
729
  * For parsed headers, use the `headers` property instead.
730
730
  */
731
731
  getHeadersStream() {
732
- return p(this, B);
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 V = class V {
790
790
  }
791
791
  async getParsedHeaders() {
792
792
  return this.cachedParsedHeaders || (this.cachedParsedHeaders = parseHeadersStream(
793
- p(this, q)
793
+ p(this, te)
794
794
  )), await this.cachedParsedHeaders;
795
795
  }
796
796
  };
797
- B = new WeakMap(), q = new WeakMap();
798
- let StreamedPHPResponse = V;
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 N, T, L, R, I, C, E, f, ee, te, re, se, ne, ie, oe, ae, Y, ce, J, X;
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
- P(this, f);
1083
- P(this, N);
1084
- P(this, T, !1);
1085
- P(this, L, null);
1086
- P(this, R, /* @__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
- P(this, I, []);
1091
- P(this, C, {});
1092
- P(this, E, {
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" && (p(this, E).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
- p(this, R).has(r) || p(this, R).set(r, /* @__PURE__ */ new Set()), p(this, R).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 = p(this, R).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
- ...p(this, R).get(r.type) || [],
1123
- ...p(this, R).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 p(this, I).push(r), async () => {
1170
- _(this, I, p(this, I).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 p(this, I)) {
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
- }, _(this, L, 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
- _(this, N, 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 = w(this, f, X).call(this, async () => {
1508
- if (p(this, T) || (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
- ), _(this, T, !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
- w(this, f, te).call(this, r.relativeUri || ""), w(this, f, ie).call(this, r.method || "GET");
1521
- const i = normalizeHeaders(r.headers || {}), o = i.host || "example.com:443", a = w(this, f, ne).call(this, o, r.protocol || "http");
1522
- if (w(this, f, re).call(this, o), w(this, f, se).call(this, a), w(this, f, oe).call(this, i), r.body && (t = w(this, f, ae).call(this, r.body)), typeof r.code == "string")
1523
- this.writeFile("/internal/eval.php", r.code), w(this, f, Y).call(this, "/internal/eval.php");
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
- w(this, f, Y).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 = w(this, f, ee).call(this, r.$_SERVER, i, a);
1531
- for (const u in c)
1532
- w(this, f, ce).call(this, u, c[u]);
1530
+ const c = _(this, g, Pe).call(this, r.$_SERVER, o, a);
1531
+ for (const d in c)
1532
+ _(this, g, ke).call(this, d, c[d]);
1533
1533
  const l = r.env || {};
1534
- for (const u in l)
1535
- w(this, f, J).call(this, u, l[u]);
1534
+ for (const d in l)
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
- _(this, E, {
1774
- ...p(this, E),
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 (!p(this, E).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 p(this, E).recreateRuntime()
1787
- ), p(this, E).requestsMade = 0, p(this, E).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(p(this, C)).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
- p(this, C)
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), p(this, N) && this.setSapiName(p(this, N));
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 p(this, C)[r];
1847
+ delete p(this, X)[r];
1848
1848
  }
1849
1849
  }
1850
1850
  };
1851
- return p(this, C)[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
- p(this, T) && (p(this, E).needsRotating = !0);
1869
+ p(this, V) && (p(this, F).needsRotating = !0);
1870
1870
  const t = await this.semaphore.acquire();
1871
- return await w(this, f, X).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
- w(this, f, J).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
- p(this, E).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
- _(this, T, !1), _(this, L, 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
- N = new WeakMap(), T = new WeakMap(), L = new WeakMap(), R = new WeakMap(), I = new WeakMap(), C = new WeakMap(), E = new WeakMap(), f = 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 @@ N = new WeakMap(), T = new WeakMap(), L = new WeakMap(), R = new WeakMap(), I =
1981
1981
  * was provided.
1982
1982
  * @returns Computed $_SERVER entries.
1983
1983
  */
1984
- ee = 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
- }, te = 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 @@ ee = function(r, e, t) {
2005
2005
  [STRING],
2006
2006
  [e]
2007
2007
  );
2008
- }, re = 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
- }, se = 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
- }, ne = 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
- }, ie = 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
- }, oe = 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 @@ ee = function(r, e, t) {
2050
2050
  [NUMBER],
2051
2051
  [parseInt(r["content-length"], 10)]
2052
2052
  );
2053
- }, ae = 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 @@ ee = function(r, e, t) {
2073
2073
  [NUMBER],
2074
2074
  [t]
2075
2075
  ), s;
2076
- }, Y = 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
- }, ce = 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
- }, J = 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
- }, X = async function(r) {
2098
- p(this, E).enabled && p(this, E).needsRotating && await this.rotateRuntime(), ++p(this, E).requestsMade, p(this, E).requestsMade >= p(this, E).maxRequests && (p(this, E).needsRotating = !0);
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 = (d) => {
2101
- a || s || t.controller.enqueue(d.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 = (d) => {
2108
- n(), !a && i.controller.enqueue(d.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 = (d) => {
2112
- a || o.controller.enqueue(d.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
- const u = (async () => {
2116
- var d;
2115
+ const d = (async () => {
2116
+ var u;
2117
2117
  try {
2118
2118
  return await Promise.race([
2119
2119
  r(),
2120
- new Promise((m, y) => {
2121
- var g;
2122
- c = (b) => {
2123
- isExitCode(b.error) || y(b.error);
2124
- }, (g = p(this, L)) == null || g.addEventListener(
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,43 +2131,43 @@ ee = 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 m in this)
2136
- typeof this[m] == "function" && (this[m] = () => {
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), (d = p(this, L)) == null || d.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
- (d) => (d !== 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 ${d}.`
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
- }), d),
2157
- (d) => {
2158
- const h = d.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: d,
2161
+ error: u,
2162
2162
  source: h
2163
- }), d;
2163
+ }), u;
2164
2164
  }
2165
2165
  );
2166
2166
  return new StreamedPHPResponse(
2167
2167
  t.stream,
2168
- i.stream,
2169
2168
  o.stream,
2170
- u
2169
+ i.stream,
2170
+ d
2171
2171
  );
2172
2172
  };
2173
2173
  function normalizeHeaders(r) {
@@ -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 k, O, W, M, U, S, j, H, $, x, le, z, ue, de, pe;
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,24 +2672,24 @@ class PHPRequestHandler {
2672
2672
  * @param config - Request Handler configuration.
2673
2673
  */
2674
2674
  constructor(e) {
2675
- P(this, x);
2676
- P(this, k);
2677
- P(this, O);
2678
- P(this, W);
2679
- P(this, M);
2680
- P(this, U);
2681
- P(this, S);
2682
- P(this, j);
2683
- P(this, H);
2684
- P(this, $);
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" })
2691
- } = e, a = (u) => {
2692
- u.isDir(t) || u.mkdir(t), u.chdir(t), u.requestHandler = this;
2689
+ pathAliases: o = [],
2690
+ getFileNotFoundAction: i = () => ({ type: "404" })
2691
+ } = e, a = (d) => {
2692
+ d.isDir(t) || d.mkdir(t), d.chdir(t), d.requestHandler = this;
2693
2693
  };
2694
2694
  if (e.php)
2695
2695
  a(e.php), this.instanceManager = new SinglePHPInstanceManager({
@@ -2697,12 +2697,12 @@ class PHPRequestHandler {
2697
2697
  });
2698
2698
  else if (e.phpFactory)
2699
2699
  this.instanceManager = new PHPProcessManager({
2700
- phpFactory: async (u) => {
2701
- const d = await e.phpFactory({
2702
- ...u,
2700
+ phpFactory: async (d) => {
2701
+ const u = await e.phpFactory({
2702
+ ...d,
2703
2703
  requestHandler: this
2704
2704
  });
2705
- return a(d), d;
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
- _(this, H, e.cookieStore === void 0 ? new HttpCookieStore() : e.cookieStore), _(this, k, t);
2713
+ x(this, $, e.cookieStore === void 0 ? new HttpCookieStore() : e.cookieStore), x(this, A, t);
2714
2714
  const c = new URL(s);
2715
- _(this, W, c.hostname), _(this, M, c.port ? Number(c.port) : c.protocol === "https:" ? 443 : 80), _(this, O, (c.protocol || "").replace(":", ""));
2716
- const l = p(this, M) !== 443 && p(this, M) !== 80;
2717
- _(this, U, [
2718
- p(this, W),
2719
- l ? `:${p(this, M)}` : ""
2720
- ].join("")), _(this, S, c.pathname.replace(/\/+$/, "")), _(this, j, [
2721
- `${p(this, O)}://`,
2722
- p(this, U),
2723
- p(this, S)
2724
- ].join("")), this.rewriteRules = n, _(this, $, i), this.getFileNotFoundAction = o;
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(p(this, S)) && (t.pathname = t.pathname.slice(p(this, S).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 p(this, j);
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 p(this, k);
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 = w(this, x, le).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
- p(this, S)
2843
+ p(this, M)
2844
2844
  );
2845
- let a = w(this, x, z).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 = w(this, x, z).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 = w(this, x, z).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(p(this, k), 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 w(this, x, de).call(this, e, s, n, a) : StreamedPHPResponse.fromPHPResponse(
2899
- w(this, x, ue).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: p(this, k),
2994
- HTTPS: p(this, j).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(p(this, k)) && (n.SCRIPT_NAME = s.substring(
2997
- p(this, k).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
- k = new WeakMap(), O = new WeakMap(), W = new WeakMap(), M = new WeakMap(), U = new WeakMap(), S = new WeakMap(), j = new WeakMap(), H = new WeakMap(), $ = new WeakMap(), x = new WeakSet(), /**
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
- le = function(e) {
3015
+ Re = function(e) {
3016
3016
  const t = removePathPrefix(
3017
3017
  decodeURIComponent(e.pathname),
3018
- p(this, S)
3018
+ p(this, M)
3019
3019
  ), s = applyRewriteRules(
3020
3020
  t,
3021
3021
  this.rewriteRules
3022
3022
  ), n = new URL(
3023
- joinPaths(p(this, S), 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 @@ le = 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
- z = function(e) {
3039
- for (const t of p(this, $))
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(p(this, k), 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
- ue = function(e, t) {
3051
+ be = function(e, t) {
3052
3052
  const s = e.readFileAsBuffer(t);
3053
3053
  return new PHPResponse(
3054
3054
  200,
@@ -3063,55 +3063,55 @@ ue = function(e, t) {
3063
3063
  },
3064
3064
  s
3065
3065
  );
3066
- }, de = 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 w(this, x, pe).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
- }, pe = 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: p(this, U),
3085
+ host: p(this, K),
3086
3086
  ...normalizeHeaders(t.headers || {})
3087
3087
  };
3088
- p(this, H) && (a.cookie = p(this, H).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: u, contentType: d } = await encodeAsMultipart(c);
3093
- c = u, a["content-type"] = d;
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
- p(this, S)
3098
+ p(this, M)
3099
3099
  ),
3100
- protocol: p(this, O),
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 (p(this, H)) {
3112
- const u = await l.headers;
3113
- p(this, H).rememberCookiesFromResponseHeaders(
3114
- u
3111
+ if (p(this, $)) {
3112
+ const d = await l.headers;
3113
+ p(this, $).rememberCookiesFromResponseHeaders(
3114
+ d
3115
3115
  );
3116
3116
  }
3117
3117
  return l;
@@ -3147,312 +3147,172 @@ 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 schema15 = {
3155
+ const schema12 = {
3156
3156
  properties: {
3157
- type: {
3158
- enum: ["file", "directory"]
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."
3159
3203
  }
3160
3204
  }
3161
- };
3162
- function validate13(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
3163
- let i = null, o = 0;
3164
- if (r && typeof r == "object" && !Array.isArray(r)) {
3165
- for (const u in r)
3166
- if (!(u === "vfsRoot" || u === "nodes"))
3167
- return validate13.errors = [
3168
- {
3169
- instancePath: e,
3170
- schemaPath: "#/additionalProperties",
3171
- keyword: "additionalProperties",
3172
- params: { additionalProperty: u },
3173
- message: "must NOT have additional properties"
3205
+ }, schema15 = {
3206
+ properties: {
3207
+ nodes: {
3208
+ items: {
3209
+ properties: {
3210
+ type: {
3211
+ enum: ["file", "directory"]
3174
3212
  }
3175
- ], !1;
3176
- {
3177
- if (r.vfsRoot !== void 0) {
3178
- const u = o;
3179
- if (typeof r.vfsRoot != "string")
3180
- return validate13.errors = [
3181
- {
3182
- instancePath: e + "/vfsRoot",
3183
- schemaPath: "#/properties/vfsRoot/type",
3184
- keyword: "type",
3185
- params: { type: "string" },
3186
- message: "must be string"
3187
- }
3188
- ], !1;
3189
- var a = u === o;
3190
- } else
3191
- var a = !0;
3192
- if (a)
3193
- if (r.nodes !== void 0) {
3194
- let u = r.nodes;
3195
- const d = o;
3196
- if (Array.isArray(u)) {
3197
- var c = !0;
3198
- const m = u.length;
3199
- for (let y = 0; y < m; y++) {
3200
- let g = u[y];
3201
- const b = o;
3202
- if (g && typeof g == "object" && !Array.isArray(g)) {
3203
- let D;
3204
- if (g.vfsPath === void 0 && (D = "vfsPath"))
3205
- return validate13.errors = [
3206
- {
3207
- instancePath: e + "/nodes/" + y,
3208
- schemaPath: "#/definitions/PHPExtensionManifestExtraFile/required",
3209
- keyword: "required",
3210
- params: {
3211
- missingProperty: D
3212
- },
3213
- message: "must have required property '" + D + "'"
3214
- }
3215
- ], !1;
3216
- for (const v in g)
3217
- if (!(v === "vfsPath" || v === "type" || v === "sourcePath"))
3218
- return validate13.errors = [
3219
- {
3220
- instancePath: e + "/nodes/" + y,
3221
- schemaPath: "#/definitions/PHPExtensionManifestExtraFile/additionalProperties",
3222
- keyword: "additionalProperties",
3223
- params: {
3224
- additionalProperty: v
3225
- },
3226
- message: "must NOT have additional properties"
3227
- }
3228
- ], !1;
3229
- {
3230
- if (g.vfsPath !== void 0) {
3231
- const v = o;
3232
- if (typeof g.vfsPath != "string")
3233
- return validate13.errors = [
3234
- {
3235
- instancePath: e + "/nodes/" + y + "/vfsPath",
3236
- schemaPath: "#/definitions/PHPExtensionManifestExtraFile/properties/vfsPath/type",
3237
- keyword: "type",
3238
- params: {
3239
- type: "string"
3240
- },
3241
- message: "must be string"
3242
- }
3243
- ], !1;
3244
- var l = v === o;
3245
- } else
3246
- var l = !0;
3247
- if (l) {
3248
- if (g.type !== void 0) {
3249
- let v = g.type;
3250
- const A = o;
3251
- if (typeof v != "string")
3252
- return validate13.errors = [
3253
- {
3254
- instancePath: e + "/nodes/" + y + "/type",
3255
- schemaPath: "#/definitions/PHPExtensionManifestExtraFile/properties/type/type",
3256
- keyword: "type",
3257
- params: {
3258
- type: "string"
3259
- },
3260
- message: "must be string"
3261
- }
3262
- ], !1;
3263
- if (!(v === "file" || v === "directory"))
3264
- return validate13.errors = [
3265
- {
3266
- instancePath: e + "/nodes/" + y + "/type",
3267
- schemaPath: "#/definitions/PHPExtensionManifestExtraFile/properties/type/enum",
3268
- keyword: "enum",
3269
- params: {
3270
- allowedValues: schema15.properties.type.enum
3271
- },
3272
- message: "must be equal to one of the allowed values"
3273
- }
3274
- ], !1;
3275
- var l = A === o;
3276
- } else
3277
- var l = !0;
3278
- if (l)
3279
- if (g.sourcePath !== void 0) {
3280
- const v = o;
3281
- if (typeof g.sourcePath != "string")
3282
- return validate13.errors = [
3283
- {
3284
- instancePath: e + "/nodes/" + y + "/sourcePath",
3285
- schemaPath: "#/definitions/PHPExtensionManifestExtraFile/properties/sourcePath/type",
3286
- keyword: "type",
3287
- params: {
3288
- type: "string"
3289
- },
3290
- message: "must be string"
3291
- }
3292
- ], !1;
3293
- var l = v === o;
3294
- } else
3295
- var l = !0;
3296
- }
3297
- }
3298
- } else
3299
- return validate13.errors = [
3300
- {
3301
- instancePath: e + "/nodes/" + y,
3302
- schemaPath: "#/definitions/PHPExtensionManifestExtraFile/type",
3303
- keyword: "type",
3304
- params: { type: "object" },
3305
- message: "must be object"
3306
- }
3307
- ], !1;
3308
- var c = b === o;
3309
- if (!c)
3310
- break;
3311
- }
3312
- } else
3313
- return validate13.errors = [
3314
- {
3315
- instancePath: e + "/nodes",
3316
- schemaPath: "#/properties/nodes/type",
3317
- keyword: "type",
3318
- params: { type: "array" },
3319
- message: "must be array"
3320
- }
3321
- ], !1;
3322
- var a = d === o;
3323
- } else
3324
- var a = !0;
3213
+ }
3214
+ }
3325
3215
  }
3326
- } else
3327
- return validate13.errors = [
3328
- {
3216
+ }
3217
+ }, func2 = Object.prototype.hasOwnProperty, schema14 = {
3218
+ enum: ["extension", "zend_extension"]
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 = {
3329
3250
  instancePath: e,
3330
- schemaPath: "#/type",
3251
+ schemaPath: "#/anyOf/1/type",
3331
3252
  keyword: "type",
3332
- params: { type: "object" },
3333
- message: "must be object"
3334
- }
3335
- ], !1;
3336
- return validate13.errors = i, o === 0;
3337
- }
3338
- function validate12(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
3339
- let i = null, o = 0;
3340
- if (o === 0)
3341
- if (r && typeof r == "object" && !Array.isArray(r)) {
3342
- let c;
3343
- if (r.phpVersion === void 0 && (c = "phpVersion") || r.sourcePath === void 0 && (c = "sourcePath"))
3344
- return validate12.errors = [
3345
- {
3346
- instancePath: e,
3347
- schemaPath: "#/required",
3348
- keyword: "required",
3349
- params: { missingProperty: c },
3350
- message: "must have required property '" + c + "'"
3351
- }
3352
- ], !1;
3353
- {
3354
- const l = o;
3355
- for (const u in r)
3356
- if (!(u === "phpVersion" || u === "sourcePath" || u === "extraFiles"))
3357
- return validate12.errors = [
3358
- {
3359
- instancePath: e,
3360
- schemaPath: "#/additionalProperties",
3361
- keyword: "additionalProperties",
3362
- params: { additionalProperty: u },
3363
- message: "must NOT have additional properties"
3364
- }
3365
- ], !1;
3366
- if (l === o) {
3367
- if (r.phpVersion !== void 0) {
3368
- const u = o;
3369
- if (typeof r.phpVersion != "string")
3370
- return validate12.errors = [
3371
- {
3372
- instancePath: e + "/phpVersion",
3373
- schemaPath: "#/properties/phpVersion/type",
3374
- keyword: "type",
3375
- params: { type: "string" },
3376
- message: "must be string"
3377
- }
3378
- ], !1;
3379
- var a = u === o;
3380
- } else
3381
- var a = !0;
3382
- if (a) {
3383
- if (r.sourcePath !== void 0) {
3384
- const u = o;
3385
- if (typeof r.sourcePath != "string")
3386
- return validate12.errors = [
3387
- {
3388
- instancePath: e + "/sourcePath",
3389
- schemaPath: "#/properties/sourcePath/type",
3390
- keyword: "type",
3391
- params: { type: "string" },
3392
- message: "must be string"
3393
- }
3394
- ], !1;
3395
- var a = u === o;
3396
- } else
3397
- var a = !0;
3398
- if (a)
3399
- if (r.extraFiles !== void 0) {
3400
- const u = o;
3401
- validate13(r.extraFiles, {
3402
- instancePath: e + "/extraFiles",
3403
- parentData: r,
3404
- parentDataProperty: "extraFiles",
3405
- rootData: n
3406
- }) || (i = i === null ? validate13.errors : i.concat(validate13.errors), o = i.length);
3407
- var a = u === o;
3408
- } else
3409
- var a = !0;
3410
- }
3411
- }
3412
- }
3413
- } else
3414
- return validate12.errors = [
3415
- {
3416
- instancePath: e,
3417
- schemaPath: "#/type",
3418
- keyword: "type",
3419
- params: { type: "object" },
3420
- message: "must be object"
3421
- }
3422
- ], !1;
3423
- return validate12.errors = i, o === 0;
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;
3424
3284
  }
3425
3285
  function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
3426
- let i = null, o = 0;
3427
- if (o === 0)
3286
+ let o = null, i = 0;
3287
+ if (i === 0)
3428
3288
  if (r && typeof r == "object" && !Array.isArray(r)) {
3429
- let l;
3430
- if (r.name === void 0 && (l = "name") || r.artifacts === void 0 && (l = "artifacts"))
3289
+ let L;
3290
+ if (r.name === void 0 && (L = "name") || r.artifacts === void 0 && (L = "artifacts"))
3431
3291
  return validate11.errors = [
3432
3292
  {
3433
3293
  instancePath: e,
3434
3294
  schemaPath: "#/required",
3435
3295
  keyword: "required",
3436
- params: { missingProperty: l },
3437
- message: "must have required property '" + l + "'"
3296
+ params: { missingProperty: L },
3297
+ message: "must have required property '" + L + "'"
3438
3298
  }
3439
3299
  ], !1;
3440
3300
  {
3441
- const u = o;
3442
- for (const d in r)
3443
- if (!(d === "name" || d === "version" || d === "mode" || d === "artifacts" || d === "extraFiles"))
3301
+ const O = i;
3302
+ for (const f in r)
3303
+ if (!func2.call(schema12.properties, f))
3444
3304
  return validate11.errors = [
3445
3305
  {
3446
3306
  instancePath: e,
3447
3307
  schemaPath: "#/additionalProperties",
3448
3308
  keyword: "additionalProperties",
3449
- params: { additionalProperty: d },
3309
+ params: { additionalProperty: f },
3450
3310
  message: "must NOT have additional properties"
3451
3311
  }
3452
3312
  ], !1;
3453
- if (u === o) {
3313
+ if (O === i) {
3454
3314
  if (r.name !== void 0) {
3455
- const d = o;
3315
+ const f = i;
3456
3316
  if (typeof r.name != "string")
3457
3317
  return validate11.errors = [
3458
3318
  {
@@ -3463,12 +3323,12 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
3463
3323
  message: "must be string"
3464
3324
  }
3465
3325
  ], !1;
3466
- var a = d === o;
3326
+ var a = f === i;
3467
3327
  } else
3468
3328
  var a = !0;
3469
3329
  if (a) {
3470
3330
  if (r.version !== void 0) {
3471
- const d = o;
3331
+ const f = i;
3472
3332
  if (typeof r.version != "string")
3473
3333
  return validate11.errors = [
3474
3334
  {
@@ -3479,14 +3339,14 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
3479
3339
  message: "must be string"
3480
3340
  }
3481
3341
  ], !1;
3482
- var a = d === o;
3342
+ var a = f === i;
3483
3343
  } else
3484
3344
  var a = !0;
3485
3345
  if (a) {
3486
3346
  if (r.mode !== void 0) {
3487
- let d = r.mode;
3488
- const h = o;
3489
- if (typeof d != "string")
3347
+ let f = r.mode;
3348
+ const R = i;
3349
+ if (typeof f != "string")
3490
3350
  return validate11.errors = [
3491
3351
  {
3492
3352
  instancePath: e + "/mode",
@@ -3496,7 +3356,7 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
3496
3356
  message: "must be string"
3497
3357
  }
3498
3358
  ], !1;
3499
- if (d !== "php-extension")
3359
+ if (f !== "php-extension")
3500
3360
  return validate11.errors = [
3501
3361
  {
3502
3362
  instancePath: e + "/mode",
@@ -3508,58 +3368,652 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
3508
3368
  message: "must be equal to constant"
3509
3369
  }
3510
3370
  ], !1;
3511
- var a = h === o;
3371
+ var a = R === i;
3512
3372
  } else
3513
3373
  var a = !0;
3514
3374
  if (a) {
3515
- if (r.artifacts !== void 0) {
3516
- let d = r.artifacts;
3517
- const h = o;
3518
- if (o === h)
3519
- if (Array.isArray(d)) {
3520
- var c = !0;
3521
- const y = d.length;
3522
- for (let g = 0; g < y; g++) {
3523
- const b = o;
3524
- validate12(d[g], {
3525
- instancePath: e + "/artifacts/" + g,
3526
- parentData: d,
3527
- parentDataProperty: g,
3528
- rootData: n
3529
- }) || (i = i === null ? validate12.errors : i.concat(
3530
- validate12.errors
3531
- ), o = i.length);
3532
- var c = b === o;
3533
- if (!c)
3534
- break;
3535
- }
3536
- } else
3537
- return validate11.errors = [
3538
- {
3539
- instancePath: e + "/artifacts",
3540
- schemaPath: "#/properties/artifacts/type",
3541
- keyword: "type",
3542
- params: { type: "array" },
3543
- message: "must be array"
3544
- }
3545
- ], !1;
3546
- var a = h === o;
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;
3547
3386
  } else
3548
3387
  var a = !0;
3549
- if (a)
3550
- if (r.extraFiles !== void 0) {
3551
- const d = o;
3552
- validate13(r.extraFiles, {
3553
- instancePath: e + "/extraFiles",
3554
- parentData: r,
3555
- parentDataProperty: "extraFiles",
3556
- rootData: n
3557
- }) || (i = i === null ? validate13.errors : i.concat(
3558
- validate13.errors
3559
- ), o = i.length);
3560
- var a = d === o;
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;
3417
+ }
3418
+ else
3419
+ return validate11.errors = [
3420
+ {
3421
+ instancePath: e + "/iniEntries",
3422
+ schemaPath: "#/properties/iniEntries/type",
3423
+ keyword: "type",
3424
+ params: {
3425
+ type: "object"
3426
+ },
3427
+ message: "must be object"
3428
+ }
3429
+ ], !1;
3430
+ var a = R === i;
3561
3431
  } else
3562
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")
3482
+ return validate11.errors = [
3483
+ {
3484
+ instancePath: e + "/extensionDir",
3485
+ schemaPath: "#/properties/extensionDir/type",
3486
+ keyword: "type",
3487
+ params: {
3488
+ type: "string"
3489
+ },
3490
+ message: "must be string"
3491
+ }
3492
+ ], !1;
3493
+ var a = f === i;
3494
+ } else
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;
3524
+ {
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")
3543
+ return validate11.errors = [
3544
+ {
3545
+ instancePath: e + "/artifacts/" + m + "/phpVersion",
3546
+ schemaPath: "#/properties/artifacts/items/properties/phpVersion/type",
3547
+ keyword: "type",
3548
+ params: {
3549
+ type: "string"
3550
+ },
3551
+ message: "must be string"
3552
+ }
3553
+ ], !1;
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")
3561
+ return validate11.errors = [
3562
+ {
3563
+ instancePath: e + "/artifacts/" + m + "/sourcePath",
3564
+ schemaPath: "#/properties/artifacts/items/properties/sourcePath/type",
3565
+ keyword: "type",
3566
+ params: {
3567
+ type: "string"
3568
+ },
3569
+ message: "must be string"
3570
+ }
3571
+ ], !1;
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;
3761
+ }
3762
+ } else
3763
+ return validate11.errors = [
3764
+ {
3765
+ instancePath: e + "/artifacts/" + m + "/extraFiles",
3766
+ schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/type",
3767
+ keyword: "type",
3768
+ params: {
3769
+ type: "object"
3770
+ },
3771
+ message: "must be object"
3772
+ }
3773
+ ], !1;
3774
+ var u = ne === i;
3775
+ } else
3776
+ var u = !0;
3777
+ }
3778
+ }
3779
+ }
3780
+ } else
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;
3795
+ }
3796
+ } else
3797
+ return validate11.errors = [
3798
+ {
3799
+ instancePath: e + "/artifacts",
3800
+ schemaPath: "#/properties/artifacts/type",
3801
+ keyword: "type",
3802
+ params: {
3803
+ type: "array"
3804
+ },
3805
+ message: "must be array"
3806
+ }
3807
+ ], !1;
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"))
3822
+ return validate11.errors = [
3823
+ {
3824
+ instancePath: e + "/extraFiles",
3825
+ schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/additionalProperties",
3826
+ keyword: "additionalProperties",
3827
+ params: {
3828
+ additionalProperty: w
3829
+ },
3830
+ message: "must NOT have additional properties"
3831
+ }
3832
+ ], !1;
3833
+ if (m === i) {
3834
+ if (f.vfsRoot !== void 0) {
3835
+ const w = i;
3836
+ if (typeof f.vfsRoot != "string")
3837
+ return validate11.errors = [
3838
+ {
3839
+ instancePath: e + "/extraFiles/vfsRoot",
3840
+ schemaPath: "#/definitions/PHPExtensionManifestExtraFiles/properties/vfsRoot/type",
3841
+ keyword: "type",
3842
+ params: {
3843
+ type: "string"
3844
+ },
3845
+ message: "must be string"
3846
+ }
3847
+ ], !1;
3848
+ var N = w === i;
3849
+ } else
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;
3981
+ }
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;
3995
+ } else
3996
+ var N = !0;
3997
+ }
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
+ }
4014
+ }
4015
+ }
4016
+ }
3563
4017
  }
3564
4018
  }
3565
4019
  }
@@ -3575,22 +4029,23 @@ function validate11(r, { instancePath: e = "", parentData: t, parentDataProperty
3575
4029
  message: "must be object"
3576
4030
  }
3577
4031
  ], !1;
3578
- return validate11.errors = i, o === 0;
4032
+ return validate11.errors = o, i === 0;
3579
4033
  }
3580
4034
  function validate10(r, { instancePath: e = "", parentData: t, parentDataProperty: s, rootData: n = r } = {}) {
3581
- let i = null, o = 0;
4035
+ let o = null, i = 0;
3582
4036
  return validate11(r, {
3583
4037
  instancePath: e,
3584
4038
  parentData: t,
3585
4039
  parentDataProperty: s,
3586
4040
  rootData: n
3587
- }) || (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;
3588
4042
  }
3589
4043
  const PHP_EXTENSIONS_DIR = "/internal/shared/extensions", MAX_EXTENSION_SIDECAR_FILE_REQUESTS = 5;
3590
4044
  async function resolvePHPExtension(r) {
3591
4045
  const e = r.fetch ?? globalThis.fetch, t = r.source;
3592
4046
  let s = r.name, n;
3593
- const i = {}, o = [];
4047
+ const o = {}, i = [];
4048
+ let a, c, l, d;
3594
4049
  if (t.format === "so") {
3595
4050
  if (s || (s = t.name), !s)
3596
4051
  throw new Error(
@@ -3598,9 +4053,9 @@ async function resolvePHPExtension(r) {
3598
4053
  );
3599
4054
  n = toUint8Array(t.bytes);
3600
4055
  } else if (t.format === "url") {
3601
- let h;
4056
+ let k;
3602
4057
  try {
3603
- h = new URL(String(t.url));
4058
+ k = new URL(String(t.url));
3604
4059
  } catch {
3605
4060
  throw new Error(
3606
4061
  `source.url must be an absolute URL when loading a PHP extension from a direct URL. Received: ${String(
@@ -3608,78 +4063,83 @@ async function resolvePHPExtension(r) {
3608
4063
  )}`
3609
4064
  );
3610
4065
  }
3611
- 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)
3612
4067
  throw new Error(
3613
4068
  "name is required when loading an extension from a direct URL."
3614
4069
  );
3615
- n = await fetchBytes(e, h);
4070
+ n = await fetchBytes(e, k);
3616
4071
  } else {
3617
- let h, m;
3618
- if ("manifest" in t ? (h = t.manifest, t.baseUrl && (m = new URL(String(t.baseUrl)))) : (m = new URL(String(t.manifestUrl)), h = await (await e(m)).json()), !validate10(h))
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))
3619
4074
  throw new Error(
3620
4075
  `Invalid PHP extension manifest: ${JSON.stringify(
3621
4076
  validate10.errors
3622
4077
  )}`
3623
4078
  );
3624
- const y = h;
3625
- if (!m)
4079
+ const O = k;
4080
+ if (!L)
3626
4081
  throw new Error(
3627
4082
  "Manifest artifacts require a manifest URL or baseUrl so relative files can be resolved."
3628
4083
  );
3629
- const g = y.artifacts.find(
3630
- (v) => v.phpVersion === r.phpVersion
4084
+ const f = O.artifacts.find(
4085
+ (m) => m.phpVersion === r.phpVersion
3631
4086
  );
3632
- if (!g)
4087
+ if (!f)
3633
4088
  throw new Error(
3634
4089
  `No extension artifact found for PHP ${r.phpVersion}.`
3635
4090
  );
3636
- s ?? (s = y.name);
3637
- const b = new Semaphore({
4091
+ s ?? (s = O.name), a = O.loadWithIniDirective, c = O.iniEntries, l = O.env, d = O.extensionDir;
4092
+ const R = new Semaphore({
3638
4093
  concurrency: MAX_EXTENSION_SIDECAR_FILE_REQUESTS
3639
- }), Q = [];
3640
- for (const v of [y.extraFiles, g.extraFiles])
3641
- for (const A of (v == null ? void 0 : v.nodes) ?? []) {
3642
- const K = joinPaths(v.vfsRoot ?? "", A.vfsPath);
3643
- if (A.type === "directory") {
3644
- o.push(K);
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);
3645
4100
  continue;
3646
4101
  }
3647
- if (!A.sourcePath) continue;
3648
- const he = new URL(A.sourcePath, m);
3649
- Q.push(
3650
- b.run(() => fetchBytes(e, he)).then((fe) => {
3651
- i[K] = fe;
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;
3652
4107
  })
3653
4108
  );
3654
4109
  }
3655
- const [D] = await Promise.all([
3656
- fetchBytes(e, new URL(g.sourcePath, m)),
3657
- ...Q
4110
+ const [U] = await Promise.all([
4111
+ fetchBytes(e, new URL(f.sourcePath, L)),
4112
+ ...ce
3658
4113
  ]);
3659
- n = D;
4114
+ n = U;
3660
4115
  }
3661
- const a = normalizePath(
3662
- r.extensionDir ?? PHP_EXTENSIONS_DIR
4116
+ const u = normalizePath(
4117
+ r.extensionDir ?? d ?? PHP_EXTENSIONS_DIR
3663
4118
  );
3664
- r.extraFiles && (Object.assign(i, r.extraFiles.files), o.push(...r.extraFiles.directories ?? []));
3665
- const c = r.loadWithIniDirective ?? "extension", l = joinPaths(a, `${s}.so`), u = joinPaths(a, `${s}.ini`), d = [
3666
- `${c}=${l}`,
3667
- ...Object.entries(r.iniEntries ?? {}).map(
3668
- ([h, m]) => `${h}=${m}`
3669
- )
3670
- ].join(`
3671
- `);
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
+ };
3672
4133
  return {
3673
- soPath: l,
4134
+ soPath: S,
3674
4135
  soBytes: n,
3675
- iniPath: u,
3676
- iniContent: d,
4136
+ ...N,
3677
4137
  extraFiles: {
3678
- files: i,
3679
- directories: o
4138
+ files: o,
4139
+ directories: i
3680
4140
  },
3681
- env: r.env,
3682
- extensionDir: a
4141
+ env: Object.keys(B).length ? B : void 0,
4142
+ extensionDir: u
3683
4143
  };
3684
4144
  }
3685
4145
  function withResolvedPHPExtensions(r, e) {
@@ -3688,18 +4148,19 @@ function withResolvedPHPExtensions(r, e) {
3688
4148
  return r;
3689
4149
  const t = { ...r.ENV };
3690
4150
  for (const n of e) {
3691
- Object.assign(t, n.env);
3692
- const i = ((s = t.PHP_INI_SCAN_DIR) == null ? void 0 : s.split(":")) ?? [];
3693
- 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(":"));
3694
4155
  }
3695
4156
  return {
3696
4157
  ...r,
3697
4158
  ENV: t,
3698
4159
  onRuntimeInitialized: (n) => {
3699
- var i;
3700
- (i = r.onRuntimeInitialized) == null || i.call(r, n);
3701
- for (const o of e)
3702
- 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);
3703
4164
  }
3704
4165
  };
3705
4166
  }
@@ -3708,32 +4169,46 @@ function installPHPExtensionFilesSync(r, e) {
3708
4169
  if ("soPath" in e)
3709
4170
  t = e;
3710
4171
  else {
3711
- 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
+ });
3712
4179
  t = {
3713
- soPath: i,
4180
+ soPath: o,
3714
4181
  soBytes: toUint8Array(e.soBytes),
3715
- iniPath: joinPaths(s, `${e.name}.ini`),
3716
- iniContent: [
3717
- `${n}=${i}`,
3718
- ...Object.entries(e.iniEntries ?? {}).map(
3719
- ([o, a]) => `${o}=${a}`
3720
- )
3721
- ].join(`
3722
- `),
4182
+ ...i,
3723
4183
  extraFiles: e.extraFiles,
3724
4184
  env: e.env,
3725
4185
  extensionDir: s
3726
4186
  };
3727
4187
  }
3728
- 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) {
3729
4189
  const { directories: s = [], files: n } = t.extraFiles;
3730
- for (const i of s)
3731
- mkdirIfMissing(r, i);
3732
- for (const [i, o] of Object.entries(n))
3733
- 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);
3734
4194
  }
3735
4195
  return t;
3736
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
+ }
3737
4212
  function mkdirIfMissing(r, e) {
3738
4213
  FSHelpers.fileExists(r, e) || r.mkdirTree(e);
3739
4214
  }
@@ -3753,34 +4228,34 @@ function isLegacyPhpInstance(r) {
3753
4228
  }
3754
4229
  function ensureProxyFSHasMmapSupport(r) {
3755
4230
  const e = Object.getOwnPropertySymbols(r)[0], t = r[e], s = t.PROXYFS, n = t.FS;
3756
- s.stream_ops.mmap || (s.stream_ops.mmap = function(i, o, a, c, l) {
3757
- 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))
3758
4233
  throw new n.ErrnoError(19);
3759
4234
  if (a !== 0)
3760
4235
  throw new n.ErrnoError(22);
3761
- const u = t.malloc(o);
3762
- if (!u)
4236
+ const d = t.malloc(i);
4237
+ if (!d)
3763
4238
  throw new n.ErrnoError(48);
3764
- const d = t.HEAPU8.subarray(u, u + o);
4239
+ const u = t.HEAPU8.subarray(d, d + i);
3765
4240
  let h = 0;
3766
- for (; h < o; ) {
3767
- const m = i.stream_ops.read(
3768
- i,
3769
- d,
4241
+ for (; h < i; ) {
4242
+ const P = o.stream_ops.read(
4243
+ o,
4244
+ u,
3770
4245
  h,
3771
- o - h,
4246
+ i - h,
3772
4247
  h
3773
4248
  );
3774
- if (m <= 0) break;
3775
- h += m;
4249
+ if (P <= 0) break;
4250
+ h += P;
3776
4251
  }
3777
- if (h !== o)
3778
- throw t.free(u), new n.ErrnoError(5);
3779
- return { ptr: u, allocated: !0 };
3780
- }, s.stream_ops.msync = function(i, o, a, c, l) {
3781
- return l & 2 || i.stream_ops.write(
3782
- i,
4252
+ if (h !== i)
4253
+ throw t.free(d), new n.ErrnoError(5);
4254
+ return { ptr: d, allocated: !0 };
4255
+ }, s.stream_ops.msync = function(o, i, a, c, l) {
4256
+ return l & 2 || o.stream_ops.write(
3783
4257
  o,
4258
+ i,
3784
4259
  a,
3785
4260
  c,
3786
4261
  a,
@@ -3790,31 +4265,31 @@ function ensureProxyFSHasMmapSupport(r) {
3790
4265
  }
3791
4266
  async function proxyFileSystem(r, e, t) {
3792
4267
  const s = isLegacyPhpInstance(e), n = Object.getOwnPropertySymbols(r)[0];
3793
- for (const i of t)
3794
- r.fileExists(i) || r.mkdir(i), e.mkdir(i), await e.mount(i, (o) => {
3795
- s || ensureProxyFSHasMmapSupport(o);
3796
- const a = Object.getOwnPropertySymbols(o)[0];
3797
- 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(
3798
4273
  // @ts-ignore
3799
- o[a].PROXYFS,
4274
+ i[a].PROXYFS,
3800
4275
  {
3801
- root: i,
4276
+ root: o,
3802
4277
  // @ts-ignore
3803
4278
  fs: r[n].FS
3804
4279
  },
3805
- i
4280
+ o
3806
4281
  ), () => {
3807
4282
  try {
3808
- o[a].FS.unmount(i);
4283
+ i[a].FS.unmount(o);
3809
4284
  } catch {
3810
4285
  }
3811
4286
  };
3812
4287
  });
3813
4288
  }
3814
4289
  function isPathToSharedFS(r, e) {
3815
- var i;
4290
+ var o;
3816
4291
  const t = Object.getOwnPropertySymbols(r)[0], n = r[t].FS.lookupPath(e, { noent_okay: !0 });
3817
- 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;
3818
4293
  }
3819
4294
  function sandboxedSpawnHandlerFactory(r) {
3820
4295
  return createSpawnHandler(async function(e, t, s) {
@@ -3844,13 +4319,13 @@ function sandboxedSpawnHandlerFactory(r) {
3844
4319
  ), t.exit(127);
3845
4320
  return;
3846
4321
  }
3847
- const { php: i, reap: o } = await r();
4322
+ const { php: o, reap: i } = await r();
3848
4323
  try {
3849
- s.cwd && await i.chdir(s.cwd);
3850
- const a = await i.cwd();
4324
+ s.cwd && await o.chdir(s.cwd);
4325
+ const a = await o.cwd();
3851
4326
  switch (n) {
3852
4327
  case "php": {
3853
- const c = await i.cli(e, {
4328
+ const c = await o.cli(e, {
3854
4329
  env: {
3855
4330
  ...s.env,
3856
4331
  SCRIPT_PATH: e[1],
@@ -3876,7 +4351,7 @@ function sandboxedSpawnHandlerFactory(r) {
3876
4351
  break;
3877
4352
  }
3878
4353
  case "ls": {
3879
- const c = await i.listFiles(e[1] ?? a);
4354
+ const c = await o.listFiles(e[1] ?? a);
3880
4355
  for (const l of c)
3881
4356
  t.stdout(l + `
3882
4357
  `);
@@ -3894,7 +4369,7 @@ function sandboxedSpawnHandlerFactory(r) {
3894
4369
  ` + a.stack : typeof a == "object" && a !== null ? JSON.stringify(a, Object.getOwnPropertyNames(a)) : String(a);
3895
4370
  throw t.stderr(`[spawn error] ${c}`), t.exit(1), a;
3896
4371
  } finally {
3897
- o();
4372
+ i();
3898
4373
  }
3899
4374
  });
3900
4375
  }
@@ -3906,25 +4381,25 @@ function createSyncProxy(r, e = [], t) {
3906
4381
  }, {
3907
4382
  get(s, n) {
3908
4383
  return n === "then" && !e.length ? {
3909
- then: (i, o) => o(createSyncProxy(r, [], t))
4384
+ then: (o, i) => i(createSyncProxy(r, [], t))
3910
4385
  } : createSyncProxy(r, [...e, n], t);
3911
4386
  },
3912
- set(s, n, i) {
3913
- const [o, a] = toWireValue(i);
4387
+ set(s, n, o) {
4388
+ const [i, a] = toWireValue(o);
3914
4389
  return t.send(
3915
4390
  r,
3916
4391
  {
3917
4392
  type: MessageType.SET,
3918
4393
  path: [...e, n].map(String),
3919
- value: o
4394
+ value: i
3920
4395
  },
3921
4396
  a
3922
4397
  ), !0;
3923
4398
  },
3924
- apply(s, n, i) {
4399
+ apply(s, n, o) {
3925
4400
  if (e.at(-1) === "bind")
3926
4401
  return createSyncProxy(r, e.slice(0, -1), t);
3927
- const [a, c] = processArguments(i), l = t.send(
4402
+ const [a, c] = processArguments(o), l = t.send(
3928
4403
  r,
3929
4404
  {
3930
4405
  type: MessageType.APPLY,
@@ -3936,14 +4411,14 @@ function createSyncProxy(r, e = [], t) {
3936
4411
  return fromWireValue(l);
3937
4412
  },
3938
4413
  construct(s, n) {
3939
- const [i, o] = processArguments(n), a = t.send(
4414
+ const [o, i] = processArguments(n), a = t.send(
3940
4415
  r,
3941
4416
  {
3942
4417
  type: MessageType.CONSTRUCT,
3943
4418
  path: e.map(String),
3944
- argumentList: i
4419
+ argumentList: o
3945
4420
  },
3946
- o
4421
+ i
3947
4422
  );
3948
4423
  return fromWireValue(a);
3949
4424
  }
@@ -3975,19 +4450,19 @@ class NodeSABSyncReceiveMessageTransport {
3975
4450
  }
3976
4451
  send(e, t, s) {
3977
4452
  var l;
3978
- const n = new SharedArrayBuffer(4), i = new Int32Array(n);
3979
- i[0] = 0;
3980
- const o = generateUUID();
4453
+ const n = new SharedArrayBuffer(4), o = new Int32Array(n);
4454
+ o[0] = 0;
4455
+ const i = generateUUID();
3981
4456
  if (e.postMessage(
3982
- { ...t, id: o, notifyBuffer: n },
4457
+ { ...t, id: i, notifyBuffer: n },
3983
4458
  s
3984
- ), Atomics.wait(i, 0, 0, 5e3) === "timed-out")
4459
+ ), Atomics.wait(o, 0, 0, 5e3) === "timed-out")
3985
4460
  throw new Error("Timeout waiting for response");
3986
4461
  for (; ; ) {
3987
- const u = NodeSABSyncReceiveMessageTransport.receiveMessageOnPort(e);
3988
- if (((l = u.message) == null ? void 0 : l.id) === o)
3989
- return u.message;
3990
- if (!u)
4462
+ const d = NodeSABSyncReceiveMessageTransport.receiveMessageOnPort(e);
4463
+ if (((l = d.message) == null ? void 0 : l.id) === i)
4464
+ return d.message;
4465
+ if (!d)
3991
4466
  throw new Error("No response received");
3992
4467
  }
3993
4468
  }
@@ -4054,64 +4529,64 @@ function isAllowedOrigin(r, e) {
4054
4529
  return !1;
4055
4530
  }
4056
4531
  function expose(r, e = globalThis, t = ["*"], s) {
4057
- e.addEventListener("message", function n(i) {
4058
- if (!i || !i.data)
4532
+ e.addEventListener("message", function n(o) {
4533
+ if (!o || !o.data)
4059
4534
  return;
4060
- if (!isAllowedOrigin(t, i.origin)) {
4061
- 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`);
4062
4537
  return;
4063
4538
  }
4064
- const { id: o, type: a, path: c } = {
4539
+ const { id: i, type: a, path: c } = {
4065
4540
  path: [],
4066
- ...i.data
4067
- }, l = (i.data.argumentList || []).map(fromWireValue);
4068
- let u;
4541
+ ...o.data
4542
+ }, l = (o.data.argumentList || []).map(fromWireValue);
4543
+ let d;
4069
4544
  try {
4070
- const d = c.slice(0, -1).reduce((m, y) => m[y], r), h = c.reduce((m, y) => m[y], r);
4545
+ const u = c.slice(0, -1).reduce((P, S) => P[S], r), h = c.reduce((P, S) => P[S], r);
4071
4546
  switch (a) {
4072
4547
  case MessageType.GET:
4073
- u = h;
4548
+ d = h;
4074
4549
  break;
4075
4550
  case MessageType.SET:
4076
- d[c.slice(-1)[0]] = fromWireValue(
4077
- i.data.value
4078
- ), u = !0;
4551
+ u[c.slice(-1)[0]] = fromWireValue(
4552
+ o.data.value
4553
+ ), d = !0;
4079
4554
  break;
4080
4555
  case MessageType.APPLY:
4081
- u = h.apply(d, l);
4556
+ d = h.apply(u, l);
4082
4557
  break;
4083
4558
  case MessageType.CONSTRUCT:
4084
4559
  {
4085
- const m = new h(...l);
4086
- u = proxy(m);
4560
+ const P = new h(...l);
4561
+ d = proxy(P);
4087
4562
  }
4088
4563
  break;
4089
4564
  case MessageType.ENDPOINT:
4090
4565
  {
4091
- const { port1: m, port2: y } = new MessageChannel();
4092
- expose(r, y), u = transfer(m, [m]);
4566
+ const { port1: P, port2: S } = new MessageChannel();
4567
+ expose(r, S), d = transfer(P, [P]);
4093
4568
  }
4094
4569
  break;
4095
4570
  case MessageType.RELEASE:
4096
- u = void 0;
4571
+ d = void 0;
4097
4572
  break;
4098
4573
  default:
4099
4574
  return;
4100
4575
  }
4101
- } catch (d) {
4102
- u = { value: d, [throwMarker]: 0 };
4576
+ } catch (u) {
4577
+ d = { value: u, [throwMarker]: 0 };
4103
4578
  }
4104
- Promise.resolve(u).catch((d) => ({ value: d, [throwMarker]: 0 })).then((d) => {
4105
- const [h, m] = toWireValue(d);
4106
- e.postMessage({ ...h, id: o }, m), a === MessageType.RELEASE && (e.removeEventListener("message", n), closeEndPoint(e), finalizer in r && typeof r[finalizer] == "function" && r[finalizer]());
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]());
4107
4582
  }).catch(() => {
4108
- const [d, h] = toWireValue({
4583
+ const [u, h] = toWireValue({
4109
4584
  value: new TypeError("Unserializable return value"),
4110
4585
  [throwMarker]: 0
4111
4586
  });
4112
- e.postMessage({ ...d, id: o }, h);
4587
+ e.postMessage({ ...u, id: i }, h);
4113
4588
  }).finally(() => {
4114
- s == null || s(i);
4589
+ s == null || s(o);
4115
4590
  });
4116
4591
  }), e.start && e.start();
4117
4592
  }
@@ -4124,15 +4599,15 @@ function closeEndPoint(r) {
4124
4599
  function wrap(r, e) {
4125
4600
  const t = /* @__PURE__ */ new Map();
4126
4601
  return r.addEventListener("message", function(n) {
4127
- const { data: i } = n;
4128
- if (!i || !i.id)
4602
+ const { data: o } = n;
4603
+ if (!o || !o.id)
4129
4604
  return;
4130
- const o = t.get(i.id);
4131
- if (o)
4605
+ const i = t.get(o.id);
4606
+ if (i)
4132
4607
  try {
4133
- o(i);
4608
+ i(o);
4134
4609
  } finally {
4135
- t.delete(i.id);
4610
+ t.delete(o.id);
4136
4611
  }
4137
4612
  }), createProxy(r, t, [], e);
4138
4613
  }
@@ -4161,15 +4636,15 @@ function unregisterProxy(r) {
4161
4636
  function createProxy(r, e, t = [], s = function() {
4162
4637
  }) {
4163
4638
  let n = !1;
4164
- const i = new Proxy(s, {
4165
- get(o, a) {
4639
+ const o = new Proxy(s, {
4640
+ get(i, a) {
4166
4641
  if (throwIfProxyReleased(n), a === releaseProxy)
4167
4642
  return () => {
4168
- unregisterProxy(i), releaseEndpoint(r), e.clear(), n = !0;
4643
+ unregisterProxy(o), releaseEndpoint(r), e.clear(), n = !0;
4169
4644
  };
4170
4645
  if (a === "then") {
4171
4646
  if (t.length === 0)
4172
- return { then: () => i };
4647
+ return { then: () => o };
4173
4648
  const c = requestResponseMessage(r, e, {
4174
4649
  type: MessageType.GET,
4175
4650
  path: t.map((l) => l.toString())
@@ -4178,21 +4653,21 @@ function createProxy(r, e, t = [], s = function() {
4178
4653
  }
4179
4654
  return createProxy(r, e, [...t, a]);
4180
4655
  },
4181
- set(o, a, c) {
4656
+ set(i, a, c) {
4182
4657
  throwIfProxyReleased(n);
4183
- const [l, u] = toWireValue(c);
4658
+ const [l, d] = toWireValue(c);
4184
4659
  return requestResponseMessage(
4185
4660
  r,
4186
4661
  e,
4187
4662
  {
4188
4663
  type: MessageType.SET,
4189
- path: [...t, a].map((d) => d.toString()),
4664
+ path: [...t, a].map((u) => u.toString()),
4190
4665
  value: l
4191
4666
  },
4192
- u
4667
+ d
4193
4668
  ).then(fromWireValue);
4194
4669
  },
4195
- apply(o, a, c) {
4670
+ apply(i, a, c) {
4196
4671
  throwIfProxyReleased(n);
4197
4672
  const l = t[t.length - 1];
4198
4673
  if (l === createEndpoint)
@@ -4201,19 +4676,19 @@ function createProxy(r, e, t = [], s = function() {
4201
4676
  }).then(fromWireValue);
4202
4677
  if (l === "bind")
4203
4678
  return createProxy(r, e, t.slice(0, -1));
4204
- const [u, d] = processArguments(c);
4679
+ const [d, u] = processArguments(c);
4205
4680
  return requestResponseMessage(
4206
4681
  r,
4207
4682
  e,
4208
4683
  {
4209
4684
  type: MessageType.APPLY,
4210
4685
  path: t.map((h) => h.toString()),
4211
- argumentList: u
4686
+ argumentList: d
4212
4687
  },
4213
- d
4688
+ u
4214
4689
  ).then(fromWireValue);
4215
4690
  },
4216
- construct(o, a) {
4691
+ construct(i, a) {
4217
4692
  throwIfProxyReleased(n);
4218
4693
  const [c, l] = processArguments(a);
4219
4694
  return requestResponseMessage(
@@ -4221,14 +4696,14 @@ function createProxy(r, e, t = [], s = function() {
4221
4696
  e,
4222
4697
  {
4223
4698
  type: MessageType.CONSTRUCT,
4224
- path: t.map((u) => u.toString()),
4699
+ path: t.map((d) => d.toString()),
4225
4700
  argumentList: c
4226
4701
  },
4227
4702
  l
4228
4703
  ).then(fromWireValue);
4229
4704
  }
4230
4705
  });
4231
- return registerProxy(i, r), i;
4706
+ return registerProxy(o, r), o;
4232
4707
  }
4233
4708
  function myFlat(r) {
4234
4709
  return Array.prototype.concat.apply([], r);
@@ -4282,8 +4757,8 @@ function fromWireValue(r) {
4282
4757
  }
4283
4758
  function requestResponseMessage(r, e, t, s) {
4284
4759
  return new Promise((n) => {
4285
- const i = generateUUID();
4286
- 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);
4287
4762
  });
4288
4763
  }
4289
4764
  function generateUUID() {
@@ -4296,8 +4771,8 @@ function nodeEndpoint(r) {
4296
4771
  return {
4297
4772
  postMessage: r.postMessage.bind(r),
4298
4773
  addEventListener: (t, s) => {
4299
- const n = (i) => {
4300
- "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 });
4301
4776
  };
4302
4777
  r.on("message", n), e.set(s, n);
4303
4778
  },
@@ -4318,20 +4793,20 @@ function nodeProcessEndpoint(r) {
4318
4793
  const t = e;
4319
4794
  return {
4320
4795
  postMessage(s, n) {
4321
- var i;
4796
+ var o;
4322
4797
  if (n && n.length > 0)
4323
4798
  throw new Error(
4324
4799
  "Transferable objects are not supported for nodeProcessEndpoint"
4325
4800
  );
4326
- (i = t.send) == null || i.call(t, s);
4801
+ (o = t.send) == null || o.call(t, s);
4327
4802
  },
4328
4803
  addEventListener(s, n) {
4329
- const i = typeof n == "function" ? (o) => n({ data: o }) : (o) => n.handleEvent({ data: o });
4330
- 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);
4331
4806
  },
4332
4807
  removeEventListener(s, n) {
4333
- const i = proxyByListener.get(n);
4334
- i && (proxyByListener.delete(n), t.removeListener(s, i));
4808
+ const o = proxyByListener.get(n);
4809
+ o && (proxyByListener.delete(n), t.removeListener(s, o));
4335
4810
  },
4336
4811
  start() {
4337
4812
  }
@@ -4404,52 +4879,52 @@ const errorProperties = [
4404
4879
  to: t,
4405
4880
  forceEnumerable: s,
4406
4881
  maxDepth: n,
4407
- depth: i,
4408
- useToJSON: o,
4882
+ depth: o,
4883
+ useToJSON: i,
4409
4884
  serialize: a
4410
4885
  }) => {
4411
- 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)
4412
4887
  return t;
4413
- if (o && typeof r.toJSON == "function" && !toJsonWasCalled.has(r))
4888
+ if (i && typeof r.toJSON == "function" && !toJsonWasCalled.has(r))
4414
4889
  return toJSON(r);
4415
4890
  const c = (l) => destroyCircular({
4416
4891
  from: l,
4417
4892
  seen: [...e],
4418
4893
  forceEnumerable: s,
4419
4894
  maxDepth: n,
4420
- depth: i,
4421
- useToJSON: o,
4895
+ depth: o,
4896
+ useToJSON: i,
4422
4897
  serialize: a
4423
4898
  });
4424
- for (const [l, u] of Object.entries(r)) {
4425
- if (u && u instanceof Uint8Array && u.constructor.name === "Buffer") {
4899
+ for (const [l, d] of Object.entries(r)) {
4900
+ if (d && d instanceof Uint8Array && d.constructor.name === "Buffer") {
4426
4901
  t[l] = "[object Buffer]";
4427
4902
  continue;
4428
4903
  }
4429
- if (u !== null && typeof u == "object" && typeof u.pipe == "function") {
4904
+ if (d !== null && typeof d == "object" && typeof d.pipe == "function") {
4430
4905
  t[l] = "[object Stream]";
4431
4906
  continue;
4432
4907
  }
4433
- if (typeof u != "function") {
4434
- if (!u || typeof u != "object") {
4908
+ if (typeof d != "function") {
4909
+ if (!d || typeof d != "object") {
4435
4910
  try {
4436
- t[l] = u;
4911
+ t[l] = d;
4437
4912
  } catch {
4438
4913
  }
4439
4914
  continue;
4440
4915
  }
4441
4916
  if (!e.includes(r[l])) {
4442
- i++, t[l] = c(r[l]);
4917
+ o++, t[l] = c(r[l]);
4443
4918
  continue;
4444
4919
  }
4445
4920
  t[l] = "[Circular]";
4446
4921
  }
4447
4922
  }
4448
4923
  if (a || t instanceof Error)
4449
- for (const { property: l, enumerable: u } of errorProperties)
4924
+ for (const { property: l, enumerable: d } of errorProperties)
4450
4925
  r[l] !== void 0 && r[l] !== null && Object.defineProperty(t, l, {
4451
4926
  value: isErrorLike(r[l]) || Array.isArray(r[l]) ? c(r[l]) : r[l],
4452
- enumerable: s ? !0 : u,
4927
+ enumerable: s ? !0 : d,
4453
4928
  configurable: !0,
4454
4929
  writable: !0
4455
4930
  });
@@ -4504,9 +4979,9 @@ function consumeAPI(r, e = void 0) {
4504
4979
  );
4505
4980
  else
4506
4981
  t = r instanceof Worker ? r : windowEndpoint(r, e);
4507
- const n = wrap(t), i = proxyClone(n);
4508
- return new Proxy(i, {
4509
- 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 () => {
4510
4985
  for (; ; )
4511
4986
  try {
4512
4987
  await runWithTimeout(n.isConnected(), 200);
@@ -4522,38 +4997,38 @@ async function runWithTimeout(r, e) {
4522
4997
  });
4523
4998
  }
4524
4999
  function exposeAPI(r, e, t) {
4525
- const { setReady: s, setFailed: n, exposedApi: i } = prepareForExpose(
5000
+ const { setReady: s, setFailed: n, exposedApi: o } = prepareForExpose(
4526
5001
  r,
4527
5002
  e
4528
5003
  );
4529
- let o;
5004
+ let i;
4530
5005
  if (t)
4531
5006
  if ("addEventListener" in t)
4532
- o = t;
5007
+ i = t;
4533
5008
  else if ("postMessage" in t)
4534
- o = nodeEndpoint(t);
5009
+ i = nodeEndpoint(t);
4535
5010
  else if ("send" in t && "addListener" in t)
4536
- o = nodeProcessEndpoint(t);
5011
+ i = nodeProcessEndpoint(t);
4537
5012
  else
4538
5013
  throw new Error(
4539
5014
  "exposeAPI: targetWorker does not look like a Worker, MessagePort, or Process"
4540
5015
  );
4541
5016
  else
4542
- o = typeof window < "u" ? windowEndpoint(self.parent) : void 0;
4543
- 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];
4544
5019
  }
4545
5020
  async function exposeSyncAPI(r, e) {
4546
- const { setReady: t, setFailed: s, exposedApi: n } = prepareForExpose(r), i = await NodeSABSyncReceiveMessageTransport.create(), o = nodeEndpoint(e);
4547
- 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];
4548
5023
  }
4549
5024
  function prepareForExpose(r, e) {
4550
5025
  setupTransferHandlers();
4551
5026
  const t = Promise.resolve();
4552
5027
  let s, n;
4553
- const i = new Promise((c, l) => {
5028
+ const o = new Promise((c, l) => {
4554
5029
  s = c, n = l;
4555
- }), o = proxyClone(r), a = new Proxy(o, {
4556
- 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]
4557
5032
  });
4558
5033
  return { setReady: s, setFailed: n, exposedApi: a };
4559
5034
  }
@@ -4606,33 +5081,33 @@ function setupTransferHandlers() {
4606
5081
  }, transferHandlers.set("StreamedPHPResponse", {
4607
5082
  canHandle: (t) => t instanceof StreamedPHPResponse,
4608
5083
  serialize(t) {
4609
- const s = supportsTransferableStreams(), n = promiseToPort(t.exitCode), i = t.getHeadersStream();
5084
+ const s = supportsTransferableStreams(), n = promiseToPort(t.exitCode), o = t.getHeadersStream();
4610
5085
  if (s)
4611
5086
  return [
4612
5087
  {
4613
5088
  __type: "StreamedPHPResponse",
4614
- headers: i,
5089
+ headers: o,
4615
5090
  stdout: t.stdout,
4616
5091
  stderr: t.stderr,
4617
5092
  exitCodePort: n
4618
5093
  },
4619
5094
  [
4620
- i,
5095
+ o,
4621
5096
  t.stdout,
4622
5097
  t.stderr,
4623
5098
  n
4624
5099
  ]
4625
5100
  ];
4626
- 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);
4627
5102
  return [
4628
5103
  {
4629
5104
  __type: "StreamedPHPResponse",
4630
- headersPort: o,
5105
+ headersPort: i,
4631
5106
  stdoutPort: a,
4632
5107
  stderrPort: c,
4633
5108
  exitCodePort: n
4634
5109
  },
4635
- [o, a, c, n]
5110
+ [i, a, c, n]
4636
5111
  ];
4637
5112
  },
4638
5113
  deserialize(t) {
@@ -4647,8 +5122,8 @@ function setupTransferHandlers() {
4647
5122
  a
4648
5123
  );
4649
5124
  }
4650
- const s = portToStream(t.headersPort), n = portToStream(t.stdoutPort), i = portToStream(t.stderrPort), o = portToPromise(t.exitCodePort);
4651
- 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);
4652
5127
  }
4653
5128
  });
4654
5129
  }
@@ -4674,7 +5149,7 @@ function streamToPort(r) {
4674
5149
  const s = r.getReader();
4675
5150
  try {
4676
5151
  for (; ; ) {
4677
- const { done: n, value: i } = await s.read();
5152
+ const { done: n, value: o } = await s.read();
4678
5153
  if (n) {
4679
5154
  try {
4680
5155
  e.postMessage({ t: "close" });
@@ -4686,8 +5161,8 @@ function streamToPort(r) {
4686
5161
  }
4687
5162
  break;
4688
5163
  }
4689
- if (i) {
4690
- 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;
4691
5166
  try {
4692
5167
  e.postMessage({ t: "chunk", b: a }, [
4693
5168
  a
@@ -4695,7 +5170,7 @@ function streamToPort(r) {
4695
5170
  } catch {
4696
5171
  e.postMessage({
4697
5172
  t: "chunk",
4698
- b: o.buffer.slice(0)
5173
+ b: i.buffer.slice(0)
4699
5174
  });
4700
5175
  }
4701
5176
  }
@@ -4717,12 +5192,12 @@ function portToStream(r) {
4717
5192
  return new ReadableStream({
4718
5193
  start(e) {
4719
5194
  const t = (n) => {
4720
- const i = n.data;
4721
- if (i)
4722
- switch (i.t) {
5195
+ const o = n.data;
5196
+ if (o)
5197
+ switch (o.t) {
4723
5198
  case "chunk":
4724
5199
  try {
4725
- e.enqueue(new Uint8Array(i.b));
5200
+ e.enqueue(new Uint8Array(o.b));
4726
5201
  } catch {
4727
5202
  s();
4728
5203
  }
@@ -4733,7 +5208,7 @@ function portToStream(r) {
4733
5208
  case "error":
4734
5209
  safeStreamError(
4735
5210
  e,
4736
- new Error(i.m || "Stream error")
5211
+ new Error(o.m || "Stream error")
4737
5212
  ), s();
4738
5213
  break;
4739
5214
  }
@@ -4789,13 +5264,13 @@ function promiseToPort(r) {
4789
5264
  }
4790
5265
  function portToPromise(r) {
4791
5266
  return new Promise((e, t) => {
4792
- const s = (i) => {
4793
- const o = i.data;
4794
- 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 || ""))));
4795
5270
  }, n = () => {
4796
- var i;
5271
+ var o;
4797
5272
  try {
4798
- (i = r.removeEventListener) == null || i.call(r, "message", s);
5273
+ (o = r.removeEventListener) == null || o.call(r, "message", s);
4799
5274
  } catch {
4800
5275
  }
4801
5276
  try {
@@ -4809,7 +5284,7 @@ function portToPromise(r) {
4809
5284
  };
4810
5285
  r.addEventListener ? r.addEventListener("message", s) : r.on ? r.on(
4811
5286
  "message",
4812
- (i) => s({ data: i })
5287
+ (o) => s({ data: o })
4813
5288
  ) : r.onmessage = s, typeof r.start == "function" && r.start();
4814
5289
  });
4815
5290
  }
@@ -5094,8 +5569,8 @@ class FileLock {
5094
5569
  ...e,
5095
5570
  end: MAX_ADDRESSABLE_FILE_OFFSET
5096
5571
  }), e.type === "unlocked") {
5097
- const o = this.rangeLocks.findOverlapping(e).filter((a) => a.pid === e.pid);
5098
- for (const a of o)
5572
+ const i = this.rangeLocks.findOverlapping(e).filter((a) => a.pid === e.pid);
5573
+ for (const a of i)
5099
5574
  this.rangeLocks.remove(a), a.start < e.start && this.rangeLocks.insert({
5100
5575
  ...a,
5101
5576
  end: e.start
@@ -5107,16 +5582,16 @@ class FileLock {
5107
5582
  }
5108
5583
  if (this.isThereAConflictWithRequestedRangeLock(e))
5109
5584
  return !1;
5110
- 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);
5111
5586
  let s = e.start, n = e.end;
5112
- for (const o of t)
5113
- this.rangeLocks.remove(o), o.start < s && (s = o.start), o.end > n && (n = o.end);
5114
- 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 = {
5115
5590
  ...e,
5116
5591
  start: s,
5117
5592
  end: n
5118
5593
  };
5119
- return this.rangeLocks.insert(i), !0;
5594
+ return this.rangeLocks.insert(o), !0;
5120
5595
  }
5121
5596
  /**
5122
5597
  * Find the first conflicting byte range lock.
@@ -5132,7 +5607,7 @@ class FileLock {
5132
5607
  end: MAX_ADDRESSABLE_FILE_OFFSET
5133
5608
  });
5134
5609
  const s = this.rangeLocks.findOverlapping(e).find(
5135
- (i) => i.pid !== e.pid && (e.type === "exclusive" || i.type === "exclusive")
5610
+ (o) => o.pid !== e.pid && (e.type === "exclusive" || o.type === "exclusive")
5136
5611
  );
5137
5612
  if (s)
5138
5613
  return s;
@@ -5240,8 +5715,8 @@ class FileLockManagerComposite {
5240
5715
  if (s = this.nativeLockManager.lockWholeFile(e, t), !s)
5241
5716
  return !1;
5242
5717
  n = this.wasmLockManager.lockWholeFile(e, t);
5243
- } catch (i) {
5244
- logger.error("Unexpected error in lockWholeFile()", i);
5718
+ } catch (o) {
5719
+ logger.error("Unexpected error in lockWholeFile()", o);
5245
5720
  } finally {
5246
5721
  s && !n && this.nativeLockManager.lockWholeFile(e, {
5247
5722
  ...t,
@@ -5270,7 +5745,7 @@ class FileLockManagerComposite {
5270
5745
  }
5271
5746
  lockFileByteRange(e, t, s) {
5272
5747
  if (t.type !== "unlocked") {
5273
- let n, i;
5748
+ let n, o;
5274
5749
  try {
5275
5750
  if (n = this.nativeLockManager.lockFileByteRange(
5276
5751
  e,
@@ -5278,15 +5753,15 @@ class FileLockManagerComposite {
5278
5753
  s
5279
5754
  ), !n)
5280
5755
  return !1;
5281
- i = this.wasmLockManager.lockFileByteRange(
5756
+ o = this.wasmLockManager.lockFileByteRange(
5282
5757
  e,
5283
5758
  t,
5284
5759
  s
5285
5760
  );
5286
- } catch (o) {
5287
- logger.error("Unexpected error in lockFileByteRange()", o);
5761
+ } catch (i) {
5762
+ logger.error("Unexpected error in lockFileByteRange()", i);
5288
5763
  } finally {
5289
- n && !i && this.nativeLockManager.lockFileByteRange(
5764
+ n && !o && this.nativeLockManager.lockFileByteRange(
5290
5765
  e,
5291
5766
  {
5292
5767
  ...t,
@@ -5295,7 +5770,7 @@ class FileLockManagerComposite {
5295
5770
  !1
5296
5771
  );
5297
5772
  }
5298
- return !!n && !!i;
5773
+ return !!n && !!o;
5299
5774
  }
5300
5775
  try {
5301
5776
  this.wasmLockManager.lockFileByteRange(
@@ -5383,53 +5858,53 @@ function createObjectPoolProxy(r) {
5383
5858
  throw new Error("At least one instance is required");
5384
5859
  const e = [...r], t = [];
5385
5860
  function s() {
5386
- const o = e.shift();
5387
- 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) => {
5388
5863
  t.push(a);
5389
5864
  });
5390
5865
  }
5391
- function n(o) {
5866
+ function n(i) {
5392
5867
  const a = t.shift();
5393
- a ? a(o) : e.push(o);
5868
+ a ? a(i) : e.push(i);
5394
5869
  }
5395
- function i(o) {
5870
+ function o(i) {
5396
5871
  return s().then((a) => {
5397
- const c = (u) => {
5398
- const d = u == null ? void 0 : u.finished;
5399
- return d && typeof d.then == "function" ? Promise.resolve(d).then(
5872
+ const c = (d) => {
5873
+ const u = d == null ? void 0 : d.finished;
5874
+ return u && typeof u.then == "function" ? Promise.resolve(u).then(
5400
5875
  () => n(a),
5401
5876
  () => n(a)
5402
- ) : n(a), u;
5877
+ ) : n(a), d;
5403
5878
  };
5404
5879
  let l;
5405
5880
  try {
5406
- l = o(a);
5407
- } catch (u) {
5408
- throw n(a), u;
5881
+ l = i(a);
5882
+ } catch (d) {
5883
+ throw n(a), d;
5409
5884
  }
5410
5885
  return l != null && typeof l.then == "function" ? l.then(
5411
- (u) => c(u),
5412
- (u) => {
5413
- throw n(a), u;
5886
+ (d) => c(d),
5887
+ (d) => {
5888
+ throw n(a), d;
5414
5889
  }
5415
5890
  ) : c(l);
5416
5891
  });
5417
5892
  }
5418
5893
  return new Proxy({}, {
5419
- get(o, a) {
5420
- if (a in o)
5421
- return o[a];
5894
+ get(i, a) {
5895
+ if (a in i)
5896
+ return i[a];
5422
5897
  if (a !== "then")
5423
5898
  return new Proxy(function() {
5424
5899
  }, {
5425
- apply(c, l, u) {
5426
- return i((d) => d[a](...u));
5900
+ apply(c, l, d) {
5901
+ return o((u) => u[a](...d));
5427
5902
  },
5428
5903
  get(c, l) {
5429
5904
  if (l === "then")
5430
- return (u, d) => i((h) => h[a]).then(
5431
- u,
5432
- d
5905
+ return (d, u) => o((h) => h[a]).then(
5906
+ d,
5907
+ u
5433
5908
  );
5434
5909
  }
5435
5910
  });