@php-wasm/web 0.6.15 → 0.6.16

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
@@ -2,7 +2,7 @@ var K = (e, t, r) => {
2
2
  if (!t.has(e))
3
3
  throw TypeError("Cannot " + r);
4
4
  };
5
- var c = (e, t, r) => (K(e, t, "read from private field"), r ? r.call(e) : t.get(e)), d = (e, t, r) => {
5
+ var u = (e, t, r) => (K(e, t, "read from private field"), r ? r.call(e) : t.get(e)), d = (e, t, r) => {
6
6
  if (t.has(e))
7
7
  throw TypeError("Cannot add the same private member more than once");
8
8
  t instanceof WeakSet ? t.add(e) : t.set(e, r);
@@ -61,8 +61,8 @@ if (currentJsRuntime$1 === "NODE") {
61
61
  r + o.byteLength
62
62
  ).arrayBuffer(), l = new Uint8Array(a);
63
63
  new Uint8Array(o.buffer).set(l);
64
- const u = l.byteLength;
65
- n.byobRequest.respond(u), r += u, r >= s.size && n.close();
64
+ const c = l.byteLength;
65
+ n.byobRequest.respond(c), r += c, r >= s.size && n.close();
66
66
  }
67
67
  });
68
68
  });
@@ -459,7 +459,7 @@ class PHPBrowser {
459
459
  cookie: this.serializeCookies()
460
460
  }
461
461
  });
462
- if (s.headers["set-cookie"] && this.setCookies(s.headers["set-cookie"]), c(this, T).handleRedirects && s.headers.location && r < c(this, T).maxRedirects) {
462
+ if (s.headers["set-cookie"] && this.setCookies(s.headers["set-cookie"]), u(this, T).handleRedirects && s.headers.location && r < u(this, T).maxRedirects) {
463
463
  const n = new URL(
464
464
  s.headers.location[0],
465
465
  this.requestHandler.absoluteUrl
@@ -497,15 +497,15 @@ class PHPBrowser {
497
497
  if (!r.includes("="))
498
498
  continue;
499
499
  const s = r.indexOf("="), n = r.substring(0, s), o = r.substring(s + 1).split(";")[0];
500
- c(this, R)[n] = o;
500
+ u(this, R)[n] = o;
501
501
  } catch (s) {
502
502
  console.error(s);
503
503
  }
504
504
  }
505
505
  serializeCookies() {
506
506
  const t = [];
507
- for (const r in c(this, R))
508
- t.push(`${r}=${c(this, R)[r]}`);
507
+ for (const r in u(this, R))
508
+ t.push(`${r}=${u(this, R)[r]}`);
509
509
  return t.join("; ");
510
510
  }
511
511
  }
@@ -522,16 +522,16 @@ function ensurePathPrefix(e, t) {
522
522
  }
523
523
  async function encodeAsMultipart(e) {
524
524
  const t = `----${Math.random().toString(36).slice(2)}`, r = `multipart/form-data; boundary=${t}`, s = new TextEncoder(), n = [];
525
- for (const [l, u] of Object.entries(e))
525
+ for (const [l, c] of Object.entries(e))
526
526
  n.push(`--${t}\r
527
- `), n.push(`Content-Disposition: form-data; name="${l}"`), u instanceof File && n.push(`; filename="${u.name}"`), n.push(`\r
528
- `), u instanceof File && (n.push("Content-Type: application/octet-stream"), n.push(`\r
527
+ `), n.push(`Content-Disposition: form-data; name="${l}"`), c instanceof File && n.push(`; filename="${c.name}"`), n.push(`\r
528
+ `), c instanceof File && (n.push("Content-Type: application/octet-stream"), n.push(`\r
529
529
  `)), n.push(`\r
530
- `), u instanceof File ? n.push(await fileToUint8Array(u)) : n.push(u), n.push(`\r
530
+ `), c instanceof File ? n.push(await fileToUint8Array(c)) : n.push(c), n.push(`\r
531
531
  `);
532
532
  n.push(`--${t}--\r
533
533
  `);
534
- const o = n.reduce((l, u) => l + u.length, 0), i = new Uint8Array(o);
534
+ const o = n.reduce((l, c) => l + c.length, 0), i = new Uint8Array(o);
535
535
  let a = 0;
536
536
  for (const l of n)
537
537
  i.set(
@@ -597,14 +597,14 @@ class PHPRequestHandler {
597
597
  this.php = t, p(this, g, s);
598
598
  const i = new URL(n);
599
599
  p(this, N, i.hostname), p(this, b, i.port ? Number(i.port) : i.protocol === "https:" ? 443 : 80), p(this, H, (i.protocol || "").replace(":", ""));
600
- const a = c(this, b) !== 443 && c(this, b) !== 80;
600
+ const a = u(this, b) !== 443 && u(this, b) !== 80;
601
601
  p(this, k, [
602
- c(this, N),
603
- a ? `:${c(this, b)}` : ""
602
+ u(this, N),
603
+ a ? `:${u(this, b)}` : ""
604
604
  ].join("")), p(this, y, i.pathname.replace(/\/+$/, "")), p(this, C, [
605
- `${c(this, H)}://`,
606
- c(this, k),
607
- c(this, y)
605
+ `${u(this, H)}://`,
606
+ u(this, k),
607
+ u(this, y)
608
608
  ].join("")), this.rewriteRules = o;
609
609
  }
610
610
  /** @inheritDoc */
@@ -614,18 +614,18 @@ class PHPRequestHandler {
614
614
  /** @inheritDoc */
615
615
  internalUrlToPath(t) {
616
616
  const r = new URL(t);
617
- return r.pathname.startsWith(c(this, y)) && (r.pathname = r.pathname.slice(c(this, y).length)), toRelativeUrl(r);
617
+ return r.pathname.startsWith(u(this, y)) && (r.pathname = r.pathname.slice(u(this, y).length)), toRelativeUrl(r);
618
618
  }
619
619
  get isRequestRunning() {
620
- return c(this, S).running > 0;
620
+ return u(this, S).running > 0;
621
621
  }
622
622
  /** @inheritDoc */
623
623
  get absoluteUrl() {
624
- return c(this, C);
624
+ return u(this, C);
625
625
  }
626
626
  /** @inheritDoc */
627
627
  get documentRoot() {
628
- return c(this, g);
628
+ return u(this, g);
629
629
  }
630
630
  /** @inheritDoc */
631
631
  async request(t) {
@@ -636,10 +636,10 @@ class PHPRequestHandler {
636
636
  ), n = applyRewriteRules(
637
637
  removePathPrefix(
638
638
  decodeURIComponent(s.pathname),
639
- c(this, y)
639
+ u(this, y)
640
640
  ),
641
641
  this.rewriteRules
642
- ), o = joinPaths(c(this, g), n);
642
+ ), o = joinPaths(u(this, g), n);
643
643
  return seemsLikeAPHPRequestHandlerPath(o) ? await f(this, O, X).call(this, t, s) : f(this, L, Z).call(this, o);
644
644
  }
645
645
  }
@@ -670,7 +670,7 @@ g = new WeakMap(), H = new WeakMap(), N = new WeakMap(), b = new WeakMap(), k =
670
670
  );
671
671
  }, O = new WeakSet(), X = async function(t, r) {
672
672
  var n;
673
- if (c(this, S).running > 0 && ((n = t.headers) == null ? void 0 : n["x-request-issuer"]) === "php")
673
+ if (u(this, S).running > 0 && ((n = t.headers) == null ? void 0 : n["x-request-issuer"]) === "php")
674
674
  return console.warn(
675
675
  "Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."
676
676
  ), new PHPResponse(
@@ -678,22 +678,22 @@ g = new WeakMap(), H = new WeakMap(), N = new WeakMap(), b = new WeakMap(), k =
678
678
  {},
679
679
  new TextEncoder().encode("502 Bad Gateway")
680
680
  );
681
- const s = await c(this, S).acquire();
681
+ const s = await u(this, S).acquire();
682
682
  try {
683
- this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", c(this, g)), this.php.addServerGlobalEntry(
683
+ this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", u(this, g)), this.php.addServerGlobalEntry(
684
684
  "HTTPS",
685
- c(this, C).startsWith("https://") ? "on" : ""
685
+ u(this, C).startsWith("https://") ? "on" : ""
686
686
  );
687
687
  let o = "GET";
688
688
  const i = {
689
- host: c(this, k),
689
+ host: u(this, k),
690
690
  ...normalizeHeaders(t.headers || {})
691
691
  };
692
692
  let a = t.body;
693
693
  if (typeof a == "object" && !(a instanceof Uint8Array)) {
694
694
  o = "POST";
695
- const { bytes: u, contentType: h } = await encodeAsMultipart(a);
696
- a = u, i["content-type"] = h;
695
+ const { bytes: c, contentType: h } = await encodeAsMultipart(a);
696
+ a = c, i["content-type"] = h;
697
697
  }
698
698
  let l;
699
699
  try {
@@ -705,24 +705,31 @@ g = new WeakMap(), H = new WeakMap(), N = new WeakMap(), b = new WeakMap(), k =
705
705
  new TextEncoder().encode("404 File not found")
706
706
  );
707
707
  }
708
- return await this.php.run({
709
- relativeUri: ensurePathPrefix(
710
- toRelativeUrl(r),
711
- c(this, y)
712
- ),
713
- protocol: c(this, H),
714
- method: t.method || o,
715
- body: a,
716
- scriptPath: l,
717
- headers: i
718
- });
708
+ try {
709
+ return await this.php.run({
710
+ relativeUri: ensurePathPrefix(
711
+ toRelativeUrl(r),
712
+ u(this, y)
713
+ ),
714
+ protocol: u(this, H),
715
+ method: t.method || o,
716
+ body: a,
717
+ scriptPath: l,
718
+ headers: i
719
+ });
720
+ } catch (c) {
721
+ const h = c;
722
+ if (h != null && h.response)
723
+ return h.response;
724
+ throw c;
725
+ }
719
726
  } finally {
720
727
  s();
721
728
  }
722
729
  }, U = new WeakSet(), ee = function(t) {
723
- let r = removePathPrefix(t, c(this, y));
724
- r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${c(this, g)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
725
- const s = `${c(this, g)}${r}`;
730
+ let r = removePathPrefix(t, u(this, y));
731
+ r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${u(this, g)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
732
+ const s = `${u(this, g)}${r}`;
726
733
  if (this.php.fileExists(s))
727
734
  return s;
728
735
  throw new Error(`File not found: ${s}`);
@@ -875,8 +882,8 @@ function rethrowFileSystemError(e = "") {
875
882
  } catch (a) {
876
883
  const l = typeof a == "object" ? a == null ? void 0 : a.errno : null;
877
884
  if (l in FileErrorCodes) {
878
- const u = FileErrorCodes[l], h = typeof i[0] == "string" ? i[0] : null, _ = h !== null ? e.replaceAll("{path}", h) : e;
879
- throw new Error(`${_}: ${u}`, {
885
+ const c = FileErrorCodes[l], h = typeof i[0] == "string" ? i[0] : null, _ = h !== null ? e.replaceAll("{path}", h) : e;
886
+ throw new Error(`${_}: ${c}`, {
880
887
  cause: a
881
888
  });
882
889
  }
@@ -927,6 +934,11 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
927
934
  return s && n && __defProp(t, r, n), n;
928
935
  };
929
936
  const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
937
+ class PHPExecutionFailureError extends Error {
938
+ constructor(t, r, s) {
939
+ super(t), this.response = r, this.source = s;
940
+ }
941
+ }
930
942
  var x, F, A, w, E, v, P, M, W, te, q, re, B, se, D, ne, $, ie, z, oe, j, ae, G, le, V, ce, J, ue, Q, de, Y, he;
931
943
  class BasePHP {
932
944
  /**
@@ -962,21 +974,21 @@ class BasePHP {
962
974
  ));
963
975
  }
964
976
  addEventListener(e, t) {
965
- c(this, P).has(e) || c(this, P).set(e, /* @__PURE__ */ new Set()), c(this, P).get(e).add(t);
977
+ u(this, P).has(e) || u(this, P).set(e, /* @__PURE__ */ new Set()), u(this, P).get(e).add(t);
966
978
  }
967
979
  removeEventListener(e, t) {
968
980
  var r;
969
- (r = c(this, P).get(e)) == null || r.delete(t);
981
+ (r = u(this, P).get(e)) == null || r.delete(t);
970
982
  }
971
983
  dispatchEvent(e) {
972
- const t = c(this, P).get(e.type);
984
+ const t = u(this, P).get(e.type);
973
985
  if (t)
974
986
  for (const r of t)
975
987
  r(e);
976
988
  }
977
989
  /** @inheritDoc */
978
990
  async onMessage(e) {
979
- c(this, M).push(e);
991
+ u(this, M).push(e);
980
992
  }
981
993
  /** @inheritDoc */
982
994
  async setSpawnHandler(handler) {
@@ -1007,7 +1019,7 @@ class BasePHP {
1007
1019
  if (!t)
1008
1020
  throw new Error("Invalid PHP runtime id.");
1009
1021
  this[__private__dont__use] = t, t.onMessage = async (r) => {
1010
- for (const s of c(this, M)) {
1022
+ for (const s of u(this, M)) {
1011
1023
  const n = await s(r);
1012
1024
  if (n)
1013
1025
  return n;
@@ -1032,7 +1044,7 @@ class BasePHP {
1032
1044
  }
1033
1045
  /** @inheritDoc */
1034
1046
  setPhpIniPath(e) {
1035
- if (c(this, w))
1047
+ if (u(this, w))
1036
1048
  throw new Error("Cannot set PHP ini path after calling run().");
1037
1049
  p(this, F, e), this[__private__dont__use].ccall(
1038
1050
  "wasm_set_phpini_path",
@@ -1043,9 +1055,9 @@ class BasePHP {
1043
1055
  }
1044
1056
  /** @inheritDoc */
1045
1057
  setPhpIniEntry(e, t) {
1046
- if (c(this, w))
1058
+ if (u(this, w))
1047
1059
  throw new Error("Cannot set PHP ini entries after calling run().");
1048
- c(this, x).push([e, t]);
1060
+ u(this, x).push([e, t]);
1049
1061
  }
1050
1062
  /** @inheritDoc */
1051
1063
  chdir(e) {
@@ -1062,7 +1074,7 @@ class BasePHP {
1062
1074
  const t = await this.semaphore.acquire();
1063
1075
  let r;
1064
1076
  try {
1065
- if (c(this, w) || (f(this, W, te).call(this), p(this, w, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
1077
+ if (u(this, w) || (f(this, W, te).call(this), p(this, w, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
1066
1078
  throw new Error(
1067
1079
  `The script path "${e.scriptPath}" does not exist.`
1068
1080
  );
@@ -1075,10 +1087,12 @@ class BasePHP {
1075
1087
  const i = await f(this, Y, he).call(this);
1076
1088
  if (i.exitCode !== 0) {
1077
1089
  console.warn("PHP.run() output was:", i.text);
1078
- const a = new Error(
1079
- `PHP.run() failed with exit code ${i.exitCode} and the following output: ` + i.errors
1090
+ const a = new PHPExecutionFailureError(
1091
+ `PHP.run() failed with exit code ${i.exitCode} and the following output: ` + i.errors,
1092
+ i,
1093
+ "request"
1080
1094
  );
1081
- throw a.response = i, a.source = "request", console.error(a), a;
1095
+ throw console.error(a), a;
1082
1096
  }
1083
1097
  return i;
1084
1098
  } catch (s) {
@@ -1099,7 +1113,7 @@ class BasePHP {
1099
1113
  }
1100
1114
  }
1101
1115
  addServerGlobalEntry(e, t) {
1102
- c(this, v)[e] = t;
1116
+ u(this, v)[e] = t;
1103
1117
  }
1104
1118
  defineConstant(e, t) {
1105
1119
  let r = {};
@@ -1195,7 +1209,7 @@ class BasePHP {
1195
1209
  this.exit();
1196
1210
  } catch {
1197
1211
  }
1198
- if (this.initializeRuntime(e), c(this, F) && this.setPhpIniPath(c(this, F)), c(this, A) && this.setSapiName(c(this, A)), this.requestHandler) {
1212
+ if (this.initializeRuntime(e), u(this, F) && this.setPhpIniPath(u(this, F)), u(this, A) && this.setSapiName(u(this, A)), this.requestHandler) {
1199
1213
  const r = this.documentRoot;
1200
1214
  copyFS(t, this[__private__dont__use].FS, r);
1201
1215
  }
@@ -1223,8 +1237,8 @@ x = new WeakMap(), F = new WeakMap(), A = new WeakMap(), w = new WeakMap(), E =
1223
1237
  }
1224
1238
  }
1225
1239
  }`
1226
- ), c(this, x).length > 0) {
1227
- const e = c(this, x).map(([t, r]) => `${t}=${r}`).join(`
1240
+ ), u(this, x).length > 0) {
1241
+ const e = u(this, x).map(([t, r]) => `${t}=${r}`).join(`
1228
1242
  `) + `
1229
1243
 
1230
1244
  `;
@@ -1348,12 +1362,12 @@ x = new WeakMap(), F = new WeakMap(), A = new WeakMap(), w = new WeakMap(), E =
1348
1362
  [e]
1349
1363
  );
1350
1364
  }, V = new WeakSet(), ce = function() {
1351
- for (const e in c(this, v))
1365
+ for (const e in u(this, v))
1352
1366
  this[__private__dont__use].ccall(
1353
1367
  "wasm_add_SERVER_entry",
1354
1368
  null,
1355
1369
  [STRING, STRING],
1356
- [e, c(this, v)[e]]
1370
+ [e, u(this, v)[e]]
1357
1371
  );
1358
1372
  }, J = new WeakSet(), ue = function(e, t) {
1359
1373
  this[__private__dont__use].ccall(
@@ -1375,11 +1389,11 @@ x = new WeakMap(), F = new WeakMap(), A = new WeakMap(), w = new WeakMap(), E =
1375
1389
  try {
1376
1390
  e = await new Promise((o, i) => {
1377
1391
  var l;
1378
- t = (u) => {
1379
- console.error(u), console.error(u.error);
1392
+ t = (c) => {
1393
+ console.error(c), console.error(c.error);
1380
1394
  const h = new Error("Rethrown");
1381
- h.cause = u.error, h.betterMessage = u.message, i(h);
1382
- }, (l = c(this, E)) == null || l.addEventListener(
1395
+ h.cause = c.error, h.betterMessage = c.message, i(h);
1396
+ }, (l = u(this, E)) == null || l.addEventListener(
1383
1397
  "error",
1384
1398
  t
1385
1399
  );
@@ -1393,8 +1407,8 @@ x = new WeakMap(), F = new WeakMap(), A = new WeakMap(), w = new WeakMap(), E =
1393
1407
  return a instanceof Promise ? a.then(o, i) : o(a);
1394
1408
  });
1395
1409
  } catch (o) {
1396
- for (const u in this)
1397
- typeof this[u] == "function" && (this[u] = () => {
1410
+ for (const c in this)
1411
+ typeof this[c] == "function" && (this[c] = () => {
1398
1412
  throw new Error(
1399
1413
  "PHP runtime has crashed – see the earlier error for details."
1400
1414
  );
@@ -1403,11 +1417,11 @@ x = new WeakMap(), F = new WeakMap(), A = new WeakMap(), w = new WeakMap(), E =
1403
1417
  const i = o, a = "betterMessage" in i ? i.betterMessage : i.message, l = new Error(a);
1404
1418
  throw l.cause = i, console.error(l), l;
1405
1419
  } finally {
1406
- (n = c(this, E)) == null || n.removeEventListener("error", t), p(this, v, {});
1420
+ (n = u(this, E)) == null || n.removeEventListener("error", t), p(this, v, {});
1407
1421
  }
1408
1422
  const { headers: r, httpStatusCode: s } = f(this, q, re).call(this);
1409
1423
  return new PHPResponse(
1410
- s,
1424
+ e === 0 ? s : 500,
1411
1425
  r,
1412
1426
  this.readFileAsBuffer("/internal/stdout"),
1413
1427
  this.readFileAsText("/internal/stderr"),
@@ -1517,41 +1531,41 @@ function expose(e, t = globalThis, r = ["*"]) {
1517
1531
  return;
1518
1532
  }
1519
1533
  const { id: o, type: i, path: a } = Object.assign({ path: [] }, n.data), l = (n.data.argumentList || []).map(fromWireValue);
1520
- let u;
1534
+ let c;
1521
1535
  try {
1522
1536
  const h = a.slice(0, -1).reduce((m, I) => m[I], e), _ = a.reduce((m, I) => m[I], e);
1523
1537
  switch (i) {
1524
1538
  case "GET":
1525
- u = _;
1539
+ c = _;
1526
1540
  break;
1527
1541
  case "SET":
1528
- h[a.slice(-1)[0]] = fromWireValue(n.data.value), u = !0;
1542
+ h[a.slice(-1)[0]] = fromWireValue(n.data.value), c = !0;
1529
1543
  break;
1530
1544
  case "APPLY":
1531
- u = _.apply(h, l);
1545
+ c = _.apply(h, l);
1532
1546
  break;
1533
1547
  case "CONSTRUCT":
1534
1548
  {
1535
1549
  const m = new _(...l);
1536
- u = proxy(m);
1550
+ c = proxy(m);
1537
1551
  }
1538
1552
  break;
1539
1553
  case "ENDPOINT":
1540
1554
  {
1541
1555
  const { port1: m, port2: I } = new MessageChannel();
1542
- expose(e, I), u = transfer(m, [m]);
1556
+ expose(e, I), c = transfer(m, [m]);
1543
1557
  }
1544
1558
  break;
1545
1559
  case "RELEASE":
1546
- u = void 0;
1560
+ c = void 0;
1547
1561
  break;
1548
1562
  default:
1549
1563
  return;
1550
1564
  }
1551
1565
  } catch (h) {
1552
- u = { value: h, [throwMarker]: 0 };
1566
+ c = { value: h, [throwMarker]: 0 };
1553
1567
  }
1554
- Promise.resolve(u).catch((h) => ({ value: h, [throwMarker]: 0 })).then((h) => {
1568
+ Promise.resolve(c).catch((h) => ({ value: h, [throwMarker]: 0 })).then((h) => {
1555
1569
  const [_, m] = toWireValue(h);
1556
1570
  t.postMessage(Object.assign(Object.assign({}, _), { id: o }), m), i === "RELEASE" && (t.removeEventListener("message", s), closeEndPoint(t), finalizer in e && typeof e[finalizer] == "function" && e[finalizer]());
1557
1571
  }).catch((h) => {
@@ -1616,12 +1630,12 @@ function createProxy(e, t = [], r = function() {
1616
1630
  },
1617
1631
  set(o, i, a) {
1618
1632
  throwIfProxyReleased(s);
1619
- const [l, u] = toWireValue(a);
1633
+ const [l, c] = toWireValue(a);
1620
1634
  return requestResponseMessage(e, {
1621
1635
  type: "SET",
1622
1636
  path: [...t, i].map((h) => h.toString()),
1623
1637
  value: l
1624
- }, u).then(fromWireValue);
1638
+ }, c).then(fromWireValue);
1625
1639
  },
1626
1640
  apply(o, i, a) {
1627
1641
  throwIfProxyReleased(s);
@@ -1632,11 +1646,11 @@ function createProxy(e, t = [], r = function() {
1632
1646
  }).then(fromWireValue);
1633
1647
  if (l === "bind")
1634
1648
  return createProxy(e, t.slice(0, -1));
1635
- const [u, h] = processArguments(a);
1649
+ const [c, h] = processArguments(a);
1636
1650
  return requestResponseMessage(e, {
1637
1651
  type: "APPLY",
1638
1652
  path: t.map((_) => _.toString()),
1639
- argumentList: u
1653
+ argumentList: c
1640
1654
  }, h).then(fromWireValue);
1641
1655
  },
1642
1656
  construct(o, i) {
@@ -1644,7 +1658,7 @@ function createProxy(e, t = [], r = function() {
1644
1658
  const [a, l] = processArguments(i);
1645
1659
  return requestResponseMessage(e, {
1646
1660
  type: "CONSTRUCT",
1647
- path: t.map((u) => u.toString()),
1661
+ path: t.map((c) => c.toString()),
1648
1662
  argumentList: a
1649
1663
  }, l).then(fromWireValue);
1650
1664
  }
@@ -1735,10 +1749,10 @@ function exposeAPI(e, t) {
1735
1749
  setupTransferHandlers();
1736
1750
  const r = Promise.resolve();
1737
1751
  let s, n;
1738
- const o = new Promise((l, u) => {
1739
- s = l, n = u;
1752
+ const o = new Promise((l, c) => {
1753
+ s = l, n = c;
1740
1754
  }), i = proxyClone(e), a = new Proxy(i, {
1741
- get: (l, u) => u === "isConnected" ? () => r : u === "isReady" ? () => o : u in l ? l[u] : t == null ? void 0 : t[u]
1755
+ get: (l, c) => c === "isConnected" ? () => r : c === "isReady" ? () => o : c in l ? l[c] : t == null ? void 0 : t[c]
1742
1756
  });
1743
1757
  return expose(
1744
1758
  a,
@@ -2028,17 +2042,8 @@ async function registerServiceWorker(e, t, r) {
2028
2042
  async function(i) {
2029
2043
  if (t && i.data.scope !== t)
2030
2044
  return;
2031
- const a = i.data.args || [], l = i.data.method;
2032
- let u;
2033
- try {
2034
- u = await e[l](...a);
2035
- } catch (h) {
2036
- if (l === "request" && h && typeof h == "object" && "response" in h)
2037
- u = h.response;
2038
- else
2039
- throw h;
2040
- }
2041
- i.source.postMessage(responseTo(i.data.requestId, u));
2045
+ const a = i.data.args || [], l = i.data.method, c = await e[l](...a);
2046
+ i.source.postMessage(responseTo(i.data.requestId, c));
2042
2047
  }
2043
2048
  ), s.startMessages();
2044
2049
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_0_33/php_7_0.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 10638342;
3
+ export const dependenciesTotalSize = 10638709;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_1_30/php_7_1.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 11078540;
3
+ export const dependenciesTotalSize = 11078277;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_2_34/php_7_2.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 11712677;
3
+ export const dependenciesTotalSize = 11712687;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_3_33/php_7_3.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 11775223;
3
+ export const dependenciesTotalSize = 11775233;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_4_33/php_7_4.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 11945559;
3
+ export const dependenciesTotalSize = 11945564;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './8_0_30/php_8_0.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 11611332;
3
+ export const dependenciesTotalSize = 11611342;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './8_1_23/php_8_1.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 11541668;
3
+ export const dependenciesTotalSize = 11541678;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './8_2_10/php_8_2.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 11787163;
3
+ export const dependenciesTotalSize = 11787173;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './8_3_0/php_8_3.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 12043963;
3
+ export const dependenciesTotalSize = 12043974;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/light/php_7_0.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_0_33/php_7_0.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 5285560;
3
+ export const dependenciesTotalSize = 5285931;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/light/php_7_1.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_1_30/php_7_1.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 5429825;
3
+ export const dependenciesTotalSize = 5429562;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/light/php_7_2.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_2_34/php_7_2.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 5772770;
3
+ export const dependenciesTotalSize = 5772780;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/light/php_7_3.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_3_33/php_7_3.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 5700746;
3
+ export const dependenciesTotalSize = 5700756;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/light/php_7_4.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './7_4_33/php_7_4.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 5783238;
3
+ export const dependenciesTotalSize = 5783248;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/light/php_8_0.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './8_0_30/php_8_0.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 5579505;
3
+ export const dependenciesTotalSize = 5579515;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/light/php_8_1.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './8_1_23/php_8_1.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 5382805;
3
+ export const dependenciesTotalSize = 5382815;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/light/php_8_2.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './8_2_10/php_8_2.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 5496649;
3
+ export const dependenciesTotalSize = 5496659;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/light/php_8_3.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dependencyFilename from './8_3_0/php_8_3.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 5587869;
3
+ export const dependenciesTotalSize = 5587879;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/web",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "description": "PHP.wasm for the web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,16 +29,16 @@
29
29
  "type": "module",
30
30
  "main": "index.js",
31
31
  "types": "index.d.ts",
32
- "gitHead": "e05126da329a26535905b0ab65415d20118f0197",
32
+ "gitHead": "1981567e7eacecbc4a18c870267c20bf489afd8f",
33
33
  "engines": {
34
34
  "node": ">=16.15.1",
35
35
  "npm": ">=8.11.0"
36
36
  },
37
37
  "dependencies": {
38
38
  "comlink": "^4.4.1",
39
- "@php-wasm/universal": "0.6.15",
40
- "@php-wasm/util": "0.6.15",
41
- "@php-wasm/web-service-worker": "0.6.15",
42
- "@php-wasm/progress": "0.6.15"
39
+ "@php-wasm/universal": "0.6.16",
40
+ "@php-wasm/util": "0.6.16",
41
+ "@php-wasm/web-service-worker": "0.6.16",
42
+ "@php-wasm/progress": "0.6.16"
43
43
  }
44
44
  }