@php-wasm/web 0.1.40 → 0.1.45
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-c73527e6.js → index-57df7e41.js} +290 -284
- package/package.json +2 -2
- package/php.js.bak +3 -0
|
@@ -1,3 +1,148 @@
|
|
|
1
|
+
const W = Symbol("error"), D = Symbol("message");
|
|
2
|
+
class I extends Event {
|
|
3
|
+
/**
|
|
4
|
+
* Create a new `ErrorEvent`.
|
|
5
|
+
*
|
|
6
|
+
* @param type The name of the event
|
|
7
|
+
* @param options A dictionary object that allows for setting
|
|
8
|
+
* attributes via object members of the same name.
|
|
9
|
+
*/
|
|
10
|
+
constructor(e, r = {}) {
|
|
11
|
+
super(e), this[W] = r.error === void 0 ? null : r.error, this[D] = r.message === void 0 ? "" : r.message;
|
|
12
|
+
}
|
|
13
|
+
get error() {
|
|
14
|
+
return this[W];
|
|
15
|
+
}
|
|
16
|
+
get message() {
|
|
17
|
+
return this[D];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(I.prototype, "error", { enumerable: !0 });
|
|
21
|
+
Object.defineProperty(I.prototype, "message", { enumerable: !0 });
|
|
22
|
+
const ie = typeof globalThis.ErrorEvent == "function" ? globalThis.ErrorEvent : I;
|
|
23
|
+
class oe extends EventTarget {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments), this.listenersCount = 0;
|
|
26
|
+
}
|
|
27
|
+
addEventListener(e, r) {
|
|
28
|
+
++this.listenersCount, super.addEventListener(e, r);
|
|
29
|
+
}
|
|
30
|
+
removeEventListener(e, r) {
|
|
31
|
+
--this.listenersCount, super.removeEventListener(e, r);
|
|
32
|
+
}
|
|
33
|
+
hasListeners() {
|
|
34
|
+
return this.listenersCount > 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function ae(t) {
|
|
38
|
+
t.asm = {
|
|
39
|
+
...t.asm
|
|
40
|
+
};
|
|
41
|
+
const e = new oe();
|
|
42
|
+
for (const r in t.asm)
|
|
43
|
+
if (typeof t.asm[r] == "function") {
|
|
44
|
+
const n = t.asm[r];
|
|
45
|
+
t.asm[r] = function(...s) {
|
|
46
|
+
try {
|
|
47
|
+
return n(...s);
|
|
48
|
+
} catch (o) {
|
|
49
|
+
if (!(o instanceof Error))
|
|
50
|
+
throw o;
|
|
51
|
+
if ("exitCode" in o && o?.exitCode === 0)
|
|
52
|
+
return;
|
|
53
|
+
const i = ce(
|
|
54
|
+
o,
|
|
55
|
+
t.lastAsyncifyStackSource?.stack
|
|
56
|
+
);
|
|
57
|
+
if (t.lastAsyncifyStackSource && (o.cause = t.lastAsyncifyStackSource), !e.hasListeners())
|
|
58
|
+
throw de(i), o;
|
|
59
|
+
e.dispatchEvent(
|
|
60
|
+
new ie("error", {
|
|
61
|
+
error: o,
|
|
62
|
+
message: i
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return e;
|
|
69
|
+
}
|
|
70
|
+
let A = [];
|
|
71
|
+
function le() {
|
|
72
|
+
return A;
|
|
73
|
+
}
|
|
74
|
+
function ce(t, e) {
|
|
75
|
+
if (t.message === "unreachable") {
|
|
76
|
+
let r = ue;
|
|
77
|
+
e || (r += `
|
|
78
|
+
|
|
79
|
+
This stack trace is lacking. For a better one initialize
|
|
80
|
+
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
81
|
+
|
|
82
|
+
`), A = fe(
|
|
83
|
+
e || t.stack || ""
|
|
84
|
+
);
|
|
85
|
+
for (const n of A)
|
|
86
|
+
r += ` * ${n}
|
|
87
|
+
`;
|
|
88
|
+
return r;
|
|
89
|
+
}
|
|
90
|
+
return t.message;
|
|
91
|
+
}
|
|
92
|
+
const ue = `
|
|
93
|
+
"unreachable" WASM instruction executed.
|
|
94
|
+
|
|
95
|
+
The typical reason is a PHP function missing from the ASYNCIFY_ONLY
|
|
96
|
+
list when building PHP.wasm.
|
|
97
|
+
|
|
98
|
+
You will need to file a new issue in the WordPress Playground repository
|
|
99
|
+
and paste this error message there:
|
|
100
|
+
|
|
101
|
+
https://github.com/WordPress/wordpress-playground/issues/new
|
|
102
|
+
|
|
103
|
+
If you're a core developer, the typical fix is to:
|
|
104
|
+
|
|
105
|
+
* Isolate a minimal reproduction of the error
|
|
106
|
+
* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository
|
|
107
|
+
* Run 'npm run fix-asyncify'
|
|
108
|
+
* Commit the changes, push to the repo, release updated NPM packages
|
|
109
|
+
|
|
110
|
+
Below is a list of all the PHP functions found in the stack trace to
|
|
111
|
+
help with the minimal reproduction. If they're all already listed in
|
|
112
|
+
the Dockerfile, you'll need to trigger this error again with long stack
|
|
113
|
+
traces enabled. In node.js, you can do it using the --stack-trace-limit=100
|
|
114
|
+
CLI option:
|
|
115
|
+
|
|
116
|
+
`, $ = "\x1B[41m", he = "\x1B[1m", q = "\x1B[0m", z = "\x1B[K";
|
|
117
|
+
let B = !1;
|
|
118
|
+
function de(t) {
|
|
119
|
+
if (!B) {
|
|
120
|
+
B = !0, console.log(`${$}
|
|
121
|
+
${z}
|
|
122
|
+
${he} WASM ERROR${q}${$}`);
|
|
123
|
+
for (const e of t.split(`
|
|
124
|
+
`))
|
|
125
|
+
console.log(`${z} ${e} `);
|
|
126
|
+
console.log(`${q}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function fe(t) {
|
|
130
|
+
try {
|
|
131
|
+
const e = t.split(`
|
|
132
|
+
`).slice(1).map((r) => {
|
|
133
|
+
const n = r.trim().substring(3).split(" ");
|
|
134
|
+
return {
|
|
135
|
+
fn: n.length >= 2 ? n[0] : "<unknown>",
|
|
136
|
+
isWasm: r.includes("wasm://")
|
|
137
|
+
};
|
|
138
|
+
}).filter(
|
|
139
|
+
({ fn: r, isWasm: n }) => n && !r.startsWith("dynCall_") && !r.startsWith("invoke_")
|
|
140
|
+
).map(({ fn: r }) => r);
|
|
141
|
+
return Array.from(new Set(e));
|
|
142
|
+
} catch {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
1
146
|
class v {
|
|
2
147
|
constructor(e, r, n, s = "", o = 0) {
|
|
3
148
|
this.httpStatusCode = e, this.headers = r, this.bytes = n, this.exitCode = o, this.errors = s;
|
|
@@ -33,7 +178,7 @@ class v {
|
|
|
33
178
|
return new TextDecoder().decode(this.bytes);
|
|
34
179
|
}
|
|
35
180
|
}
|
|
36
|
-
const
|
|
181
|
+
const pe = [
|
|
37
182
|
"8.2",
|
|
38
183
|
"8.1",
|
|
39
184
|
"8.0",
|
|
@@ -43,8 +188,8 @@ const ie = [
|
|
|
43
188
|
"7.1",
|
|
44
189
|
"7.0",
|
|
45
190
|
"5.6"
|
|
46
|
-
],
|
|
47
|
-
class
|
|
191
|
+
], me = pe[0];
|
|
192
|
+
class ge {
|
|
48
193
|
#e;
|
|
49
194
|
#t;
|
|
50
195
|
/**
|
|
@@ -77,10 +222,10 @@ class ae {
|
|
|
77
222
|
...e,
|
|
78
223
|
headers: {
|
|
79
224
|
...e.headers,
|
|
80
|
-
cookie: this.#
|
|
225
|
+
cookie: this.#r()
|
|
81
226
|
}
|
|
82
227
|
});
|
|
83
|
-
if (n.headers["set-cookie"] && this.#
|
|
228
|
+
if (n.headers["set-cookie"] && this.#n(n.headers["set-cookie"]), this.#t.handleRedirects && n.headers.location && r < this.#t.maxRedirects) {
|
|
84
229
|
const s = new URL(
|
|
85
230
|
n.headers.location[0],
|
|
86
231
|
this.requestHandler.absoluteUrl
|
|
@@ -112,7 +257,7 @@ class ae {
|
|
|
112
257
|
get documentRoot() {
|
|
113
258
|
return this.requestHandler.documentRoot;
|
|
114
259
|
}
|
|
115
|
-
#
|
|
260
|
+
#n(e) {
|
|
116
261
|
for (const r of e)
|
|
117
262
|
try {
|
|
118
263
|
if (!r.includes("="))
|
|
@@ -123,14 +268,14 @@ class ae {
|
|
|
123
268
|
console.error(n);
|
|
124
269
|
}
|
|
125
270
|
}
|
|
126
|
-
#
|
|
271
|
+
#r() {
|
|
127
272
|
const e = [];
|
|
128
273
|
for (const r in this.#e)
|
|
129
274
|
e.push(`${r}=${this.#e[r]}`);
|
|
130
275
|
return e.join("; ");
|
|
131
276
|
}
|
|
132
277
|
}
|
|
133
|
-
class
|
|
278
|
+
class ye {
|
|
134
279
|
constructor({ concurrency: e }) {
|
|
135
280
|
this._running = 0, this.concurrency = e, this.queue = [];
|
|
136
281
|
}
|
|
@@ -155,48 +300,48 @@ class ce {
|
|
|
155
300
|
}
|
|
156
301
|
}
|
|
157
302
|
}
|
|
158
|
-
const
|
|
159
|
-
function
|
|
303
|
+
const we = "http://example.com";
|
|
304
|
+
function j(t) {
|
|
160
305
|
return t.toString().substring(t.origin.length);
|
|
161
306
|
}
|
|
162
|
-
function
|
|
307
|
+
function G(t, e) {
|
|
163
308
|
return !e || !t.startsWith(e) ? t : t.substring(e.length);
|
|
164
309
|
}
|
|
165
|
-
function
|
|
310
|
+
function Pe(t, e) {
|
|
166
311
|
return !e || t.startsWith(e) ? t : e + t;
|
|
167
312
|
}
|
|
168
|
-
class
|
|
313
|
+
class be {
|
|
169
314
|
#e;
|
|
170
315
|
#t;
|
|
316
|
+
#n;
|
|
171
317
|
#r;
|
|
172
|
-
#s;
|
|
173
318
|
#i;
|
|
174
|
-
#
|
|
319
|
+
#s;
|
|
175
320
|
#o;
|
|
176
321
|
#a;
|
|
177
|
-
#
|
|
322
|
+
#l;
|
|
178
323
|
/**
|
|
179
324
|
* @param php - The PHP instance.
|
|
180
325
|
* @param config - Request Handler configuration.
|
|
181
326
|
*/
|
|
182
327
|
constructor(e, r = {}) {
|
|
183
|
-
this.#a = new
|
|
328
|
+
this.#a = new ye({ concurrency: 1 });
|
|
184
329
|
const {
|
|
185
330
|
documentRoot: n = "/www/",
|
|
186
331
|
absoluteUrl: s = typeof location == "object" ? location?.href : "",
|
|
187
332
|
isStaticFilePath: o = () => !1
|
|
188
333
|
} = r;
|
|
189
|
-
this.php = e, this.#e = n, this.#
|
|
334
|
+
this.php = e, this.#e = n, this.#l = o;
|
|
190
335
|
const i = new URL(s);
|
|
191
|
-
this.#
|
|
192
|
-
const a = this.#
|
|
336
|
+
this.#n = i.hostname, this.#r = i.port ? Number(i.port) : i.protocol === "https:" ? 443 : 80, this.#t = (i.protocol || "").replace(":", "");
|
|
337
|
+
const a = this.#r !== 443 && this.#r !== 80;
|
|
193
338
|
this.#i = [
|
|
194
|
-
this.#
|
|
195
|
-
a ? `:${this.#
|
|
196
|
-
].join(""), this.#
|
|
339
|
+
this.#n,
|
|
340
|
+
a ? `:${this.#r}` : ""
|
|
341
|
+
].join(""), this.#s = i.pathname.replace(/\/+$/, ""), this.#o = [
|
|
197
342
|
`${this.#t}://`,
|
|
198
343
|
this.#i,
|
|
199
|
-
this.#
|
|
344
|
+
this.#s
|
|
200
345
|
].join("");
|
|
201
346
|
}
|
|
202
347
|
/** @inheritDoc */
|
|
@@ -206,7 +351,7 @@ class he {
|
|
|
206
351
|
/** @inheritDoc */
|
|
207
352
|
internalUrlToPath(e) {
|
|
208
353
|
const r = new URL(e);
|
|
209
|
-
return r.pathname.startsWith(this.#
|
|
354
|
+
return r.pathname.startsWith(this.#s) && (r.pathname = r.pathname.slice(this.#s.length)), j(r);
|
|
210
355
|
}
|
|
211
356
|
get isRequestRunning() {
|
|
212
357
|
return this.#a.running > 0;
|
|
@@ -223,12 +368,12 @@ class he {
|
|
|
223
368
|
async request(e) {
|
|
224
369
|
const r = e.url.startsWith("http://") || e.url.startsWith("https://"), n = new URL(
|
|
225
370
|
e.url,
|
|
226
|
-
r ? void 0 :
|
|
227
|
-
), s =
|
|
371
|
+
r ? void 0 : we
|
|
372
|
+
), s = G(
|
|
228
373
|
n.pathname,
|
|
229
|
-
this.#
|
|
374
|
+
this.#s
|
|
230
375
|
);
|
|
231
|
-
return this.#
|
|
376
|
+
return this.#l(s) ? this.#c(s) : await this.#u(e, n);
|
|
232
377
|
}
|
|
233
378
|
/**
|
|
234
379
|
* Serves a static file from the PHP filesystem.
|
|
@@ -236,7 +381,7 @@ class he {
|
|
|
236
381
|
* @param path - The requested static file path.
|
|
237
382
|
* @returns The response.
|
|
238
383
|
*/
|
|
239
|
-
#
|
|
384
|
+
#c(e) {
|
|
240
385
|
const r = `${this.#e}${e}`;
|
|
241
386
|
if (!this.php.fileExists(r))
|
|
242
387
|
return new v(
|
|
@@ -252,7 +397,7 @@ class he {
|
|
|
252
397
|
// @TODO: Infer the content-type from the arrayBuffer instead of the file path.
|
|
253
398
|
// The code below won't return the correct mime-type if the extension
|
|
254
399
|
// was tampered with.
|
|
255
|
-
"content-type": [
|
|
400
|
+
"content-type": [ve(r)],
|
|
256
401
|
"accept-ranges": ["bytes"],
|
|
257
402
|
"cache-control": ["public, max-age=0"]
|
|
258
403
|
},
|
|
@@ -280,16 +425,16 @@ class he {
|
|
|
280
425
|
}, i = [];
|
|
281
426
|
if (e.files && Object.keys(e.files).length) {
|
|
282
427
|
s = "POST";
|
|
283
|
-
for (const
|
|
284
|
-
const
|
|
428
|
+
for (const l in e.files) {
|
|
429
|
+
const c = e.files[l];
|
|
285
430
|
i.push({
|
|
286
|
-
key:
|
|
287
|
-
name:
|
|
288
|
-
type:
|
|
289
|
-
data: new Uint8Array(await
|
|
431
|
+
key: l,
|
|
432
|
+
name: c.name,
|
|
433
|
+
type: c.type,
|
|
434
|
+
data: new Uint8Array(await c.arrayBuffer())
|
|
290
435
|
});
|
|
291
436
|
}
|
|
292
|
-
o["content-type"]?.startsWith("multipart/form-data") && (e.formData =
|
|
437
|
+
o["content-type"]?.startsWith("multipart/form-data") && (e.formData = Ee(
|
|
293
438
|
e.body || ""
|
|
294
439
|
), o["content-type"] = "application/x-www-form-urlencoded", delete e.body);
|
|
295
440
|
}
|
|
@@ -297,9 +442,9 @@ class he {
|
|
|
297
442
|
return e.formData !== void 0 ? (s = "POST", o["content-type"] = o["content-type"] || "application/x-www-form-urlencoded", a = new URLSearchParams(
|
|
298
443
|
e.formData
|
|
299
444
|
).toString()) : a = e.body, await this.php.run({
|
|
300
|
-
relativeUri:
|
|
301
|
-
|
|
302
|
-
this.#
|
|
445
|
+
relativeUri: Pe(
|
|
446
|
+
j(r),
|
|
447
|
+
this.#s
|
|
303
448
|
),
|
|
304
449
|
protocol: this.#t,
|
|
305
450
|
method: e.method || s,
|
|
@@ -321,13 +466,13 @@ class he {
|
|
|
321
466
|
* @returns The resolved filesystem path.
|
|
322
467
|
*/
|
|
323
468
|
#h(e) {
|
|
324
|
-
let r =
|
|
469
|
+
let r = G(e, this.#s);
|
|
325
470
|
r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r += "/"), r.endsWith("index.php") || (r += "index.php"));
|
|
326
471
|
const n = `${this.#e}${r}`;
|
|
327
472
|
return this.php.fileExists(n) ? n : `${this.#e}/index.php`;
|
|
328
473
|
}
|
|
329
474
|
}
|
|
330
|
-
function
|
|
475
|
+
function Ee(t) {
|
|
331
476
|
const e = {}, r = t.match(/--(.*)\r\n/);
|
|
332
477
|
if (!r)
|
|
333
478
|
return e;
|
|
@@ -335,14 +480,14 @@ function de(t) {
|
|
|
335
480
|
return s.shift(), s.pop(), s.forEach((o) => {
|
|
336
481
|
const i = o.indexOf(`\r
|
|
337
482
|
\r
|
|
338
|
-
`), a = o.substring(0, i).trim(),
|
|
339
|
-
if (
|
|
340
|
-
const h =
|
|
341
|
-
e[h] =
|
|
483
|
+
`), a = o.substring(0, i).trim(), l = o.substring(i + 4).trim(), c = a.match(/name="([^"]+)"/);
|
|
484
|
+
if (c) {
|
|
485
|
+
const h = c[1];
|
|
486
|
+
e[h] = l;
|
|
342
487
|
}
|
|
343
488
|
}), e;
|
|
344
489
|
}
|
|
345
|
-
function
|
|
490
|
+
function ve(t) {
|
|
346
491
|
switch (t.split(".").pop()) {
|
|
347
492
|
case "css":
|
|
348
493
|
return "text/css";
|
|
@@ -382,7 +527,7 @@ function fe(t) {
|
|
|
382
527
|
return "application-octet-stream";
|
|
383
528
|
}
|
|
384
529
|
}
|
|
385
|
-
const
|
|
530
|
+
const V = {
|
|
386
531
|
0: "No error occurred. System call completed successfully.",
|
|
387
532
|
1: "Argument list too long.",
|
|
388
533
|
2: "Permission denied.",
|
|
@@ -468,10 +613,10 @@ function y(t = "") {
|
|
|
468
613
|
try {
|
|
469
614
|
return o.apply(this, i);
|
|
470
615
|
} catch (a) {
|
|
471
|
-
const
|
|
472
|
-
if (
|
|
473
|
-
const
|
|
474
|
-
throw new Error(`${g}: ${
|
|
616
|
+
const l = typeof a == "object" ? a?.errno : null;
|
|
617
|
+
if (l in V) {
|
|
618
|
+
const c = V[l], h = typeof i[0] == "string" ? i[0] : null, g = h !== null ? t.replaceAll("{path}", h) : t;
|
|
619
|
+
throw new Error(`${g}: ${c}`, {
|
|
475
620
|
cause: a
|
|
476
621
|
});
|
|
477
622
|
}
|
|
@@ -480,185 +625,41 @@ function y(t = "") {
|
|
|
480
625
|
};
|
|
481
626
|
};
|
|
482
627
|
}
|
|
483
|
-
async function
|
|
628
|
+
async function Re(t, e = {}, r = []) {
|
|
484
629
|
let n, s;
|
|
485
|
-
const o = new Promise((
|
|
486
|
-
s =
|
|
487
|
-
}), i = new Promise((
|
|
488
|
-
n =
|
|
489
|
-
}), a = t.init(
|
|
490
|
-
onAbort(
|
|
491
|
-
console.error("WASM aborted: "), console.error(
|
|
630
|
+
const o = new Promise((l) => {
|
|
631
|
+
s = l;
|
|
632
|
+
}), i = new Promise((l) => {
|
|
633
|
+
n = l;
|
|
634
|
+
}), a = t.init(ke, {
|
|
635
|
+
onAbort(l) {
|
|
636
|
+
console.error("WASM aborted: "), console.error(l);
|
|
492
637
|
},
|
|
493
638
|
ENV: {},
|
|
494
639
|
// Emscripten sometimes prepends a '/' to the path, which
|
|
495
640
|
// breaks vite dev mode. An identity `locateFile` function
|
|
496
641
|
// fixes it.
|
|
497
|
-
locateFile: (
|
|
642
|
+
locateFile: (l) => l,
|
|
498
643
|
...e,
|
|
499
644
|
noInitialRun: !0,
|
|
500
645
|
onRuntimeInitialized() {
|
|
501
646
|
e.onRuntimeInitialized && e.onRuntimeInitialized(), n();
|
|
502
647
|
},
|
|
503
|
-
monitorRunDependencies(
|
|
504
|
-
|
|
648
|
+
monitorRunDependencies(l) {
|
|
649
|
+
l === 0 && (delete a.monitorRunDependencies, s());
|
|
505
650
|
}
|
|
506
651
|
});
|
|
507
|
-
for (const { default:
|
|
508
|
-
|
|
509
|
-
return r.length || s(), await o, await i,
|
|
510
|
-
}
|
|
511
|
-
const A = [];
|
|
512
|
-
function me(t) {
|
|
513
|
-
return A[t];
|
|
514
|
-
}
|
|
515
|
-
const ge = function() {
|
|
516
|
-
return typeof process < "u" && process.release?.name === "node" ? "NODE" : typeof window < "u" ? "WEB" : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? "WORKER" : "NODE";
|
|
517
|
-
}(), q = Symbol("error"), z = Symbol("message");
|
|
518
|
-
class I extends Event {
|
|
519
|
-
/**
|
|
520
|
-
* Create a new `ErrorEvent`.
|
|
521
|
-
*
|
|
522
|
-
* @param type The name of the event
|
|
523
|
-
* @param options A dictionary object that allows for setting
|
|
524
|
-
* attributes via object members of the same name.
|
|
525
|
-
*/
|
|
526
|
-
constructor(e, r = {}) {
|
|
527
|
-
super(e), this[q] = r.error === void 0 ? null : r.error, this[z] = r.message === void 0 ? "" : r.message;
|
|
528
|
-
}
|
|
529
|
-
get error() {
|
|
530
|
-
return this[q];
|
|
531
|
-
}
|
|
532
|
-
get message() {
|
|
533
|
-
return this[z];
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
Object.defineProperty(I.prototype, "error", { enumerable: !0 });
|
|
537
|
-
Object.defineProperty(I.prototype, "message", { enumerable: !0 });
|
|
538
|
-
const ye = typeof globalThis.ErrorEvent == "function" ? globalThis.ErrorEvent : I;
|
|
539
|
-
class we extends EventTarget {
|
|
540
|
-
constructor() {
|
|
541
|
-
super(...arguments), this.listenersCount = 0;
|
|
542
|
-
}
|
|
543
|
-
addEventListener(e, r) {
|
|
544
|
-
++this.listenersCount, super.addEventListener(e, r);
|
|
545
|
-
}
|
|
546
|
-
removeEventListener(e, r) {
|
|
547
|
-
--this.listenersCount, super.removeEventListener(e, r);
|
|
548
|
-
}
|
|
549
|
-
hasListeners() {
|
|
550
|
-
return this.listenersCount > 0;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
function Pe(t) {
|
|
554
|
-
t.asm = {
|
|
555
|
-
...t.asm
|
|
556
|
-
};
|
|
557
|
-
const e = new we();
|
|
558
|
-
for (const r in t.asm)
|
|
559
|
-
if (typeof t.asm[r] == "function") {
|
|
560
|
-
const n = t.asm[r];
|
|
561
|
-
t.asm[r] = function(...s) {
|
|
562
|
-
try {
|
|
563
|
-
return n(...s);
|
|
564
|
-
} catch (o) {
|
|
565
|
-
if (!(o instanceof Error))
|
|
566
|
-
throw o;
|
|
567
|
-
if ("exitCode" in o && o?.exitCode === 0)
|
|
568
|
-
return;
|
|
569
|
-
const i = Ee(
|
|
570
|
-
o,
|
|
571
|
-
t.lastAsyncifyStackSource?.stack
|
|
572
|
-
);
|
|
573
|
-
if (t.lastAsyncifyStackSource && (o.cause = t.lastAsyncifyStackSource), !e.hasListeners())
|
|
574
|
-
throw Se(i), o;
|
|
575
|
-
e.dispatchEvent(
|
|
576
|
-
new ye("error", {
|
|
577
|
-
error: o,
|
|
578
|
-
message: i
|
|
579
|
-
})
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
return e;
|
|
585
|
-
}
|
|
586
|
-
let M = [];
|
|
587
|
-
function be() {
|
|
588
|
-
return M;
|
|
589
|
-
}
|
|
590
|
-
function Ee(t, e) {
|
|
591
|
-
if (t.message === "unreachable") {
|
|
592
|
-
let r = ve;
|
|
593
|
-
e || (r += `
|
|
594
|
-
|
|
595
|
-
This stack trace is lacking. For a better one initialize
|
|
596
|
-
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
597
|
-
|
|
598
|
-
`), M = ke(
|
|
599
|
-
e || t.stack || ""
|
|
600
|
-
);
|
|
601
|
-
for (const n of M)
|
|
602
|
-
r += ` * ${n}
|
|
603
|
-
`;
|
|
604
|
-
return r;
|
|
605
|
-
}
|
|
606
|
-
return t.message;
|
|
652
|
+
for (const { default: l } of r)
|
|
653
|
+
l(a);
|
|
654
|
+
return r.length || s(), await o, await i, M.push(a), M.length - 1;
|
|
607
655
|
}
|
|
608
|
-
const
|
|
609
|
-
"unreachable" WASM instruction executed.
|
|
610
|
-
|
|
611
|
-
The typical reason is a PHP function missing from the ASYNCIFY_ONLY
|
|
612
|
-
list when building PHP.wasm.
|
|
613
|
-
|
|
614
|
-
You will need to file a new issue in the WordPress Playground repository
|
|
615
|
-
and paste this error message there:
|
|
616
|
-
|
|
617
|
-
https://github.com/WordPress/wordpress-playground/issues/new
|
|
618
|
-
|
|
619
|
-
If you're a core developer, the typical fix is to:
|
|
620
|
-
|
|
621
|
-
* Isolate a minimal reproduction of the error
|
|
622
|
-
* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository
|
|
623
|
-
* Run 'npm run fix-asyncify'
|
|
624
|
-
* Commit the changes, push to the repo, release updated NPM packages
|
|
625
|
-
|
|
626
|
-
Below is a list of all the PHP functions found in the stack trace to
|
|
627
|
-
help with the minimal reproduction. If they're all already listed in
|
|
628
|
-
the Dockerfile, you'll need to trigger this error again with long stack
|
|
629
|
-
traces enabled. In node.js, you can do it using the --stack-trace-limit=100
|
|
630
|
-
CLI option:
|
|
631
|
-
|
|
632
|
-
`, B = "\x1B[41m", Re = "\x1B[1m", j = "\x1B[0m", G = "\x1B[K";
|
|
633
|
-
let V = !1;
|
|
656
|
+
const M = [];
|
|
634
657
|
function Se(t) {
|
|
635
|
-
|
|
636
|
-
V = !0, console.log(`${B}
|
|
637
|
-
${G}
|
|
638
|
-
${Re} WASM ERROR${j}${B}`);
|
|
639
|
-
for (const e of t.split(`
|
|
640
|
-
`))
|
|
641
|
-
console.log(`${G} ${e} `);
|
|
642
|
-
console.log(`${j}`);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
function ke(t) {
|
|
646
|
-
try {
|
|
647
|
-
const e = t.split(`
|
|
648
|
-
`).slice(1).map((r) => {
|
|
649
|
-
const n = r.trim().substring(3).split(" ");
|
|
650
|
-
return {
|
|
651
|
-
fn: n.length >= 2 ? n[0] : "<unknown>",
|
|
652
|
-
isWasm: r.includes("wasm://")
|
|
653
|
-
};
|
|
654
|
-
}).filter(
|
|
655
|
-
({ fn: r, isWasm: n }) => n && !r.startsWith("dynCall_") && !r.startsWith("invoke_")
|
|
656
|
-
).map(({ fn: r }) => r);
|
|
657
|
-
return Array.from(new Set(e));
|
|
658
|
-
} catch {
|
|
659
|
-
return [];
|
|
660
|
-
}
|
|
658
|
+
return M[t];
|
|
661
659
|
}
|
|
660
|
+
const ke = function() {
|
|
661
|
+
return typeof process < "u" && process.release?.name === "node" ? "NODE" : typeof window < "u" ? "WEB" : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? "WORKER" : "NODE";
|
|
662
|
+
}();
|
|
662
663
|
var xe = Object.defineProperty, Te = Object.getOwnPropertyDescriptor, w = (t, e, r, n) => {
|
|
663
664
|
for (var s = n > 1 ? void 0 : n ? Te(e, r) : e, o = t.length - 1, i; o >= 0; o--)
|
|
664
665
|
(i = t[o]) && (s = (n ? i(e, r, s) : i(s)) || s);
|
|
@@ -674,12 +675,13 @@ class m {
|
|
|
674
675
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
675
676
|
*/
|
|
676
677
|
constructor(e, r) {
|
|
677
|
-
this.#e = [], this.#t = !1, this.#
|
|
678
|
-
new
|
|
678
|
+
this.#e = [], this.#t = !1, this.#n = null, this.#r = {}, e !== void 0 && this.initializeRuntime(e), r && (this.requestHandler = new ge(
|
|
679
|
+
new be(this, r)
|
|
679
680
|
));
|
|
680
681
|
}
|
|
681
682
|
#e;
|
|
682
683
|
#t;
|
|
684
|
+
#n;
|
|
683
685
|
#r;
|
|
684
686
|
/** @inheritDoc */
|
|
685
687
|
get absoluteUrl() {
|
|
@@ -702,10 +704,10 @@ class m {
|
|
|
702
704
|
initializeRuntime(e) {
|
|
703
705
|
if (this[u])
|
|
704
706
|
throw new Error("PHP runtime already initialized.");
|
|
705
|
-
const r =
|
|
707
|
+
const r = Se(e);
|
|
706
708
|
if (!r)
|
|
707
709
|
throw new Error("Invalid PHP runtime id.");
|
|
708
|
-
this[u] = r, this.#
|
|
710
|
+
this[u] = r, this.#n = ae(r);
|
|
709
711
|
}
|
|
710
712
|
/** @inheritDoc */
|
|
711
713
|
setPhpIniPath(e) {
|
|
@@ -736,17 +738,17 @@ class m {
|
|
|
736
738
|
}
|
|
737
739
|
/** @inheritDoc */
|
|
738
740
|
async run(e) {
|
|
739
|
-
this.#t || (this.#
|
|
741
|
+
this.#t || (this.#i(), this.#t = !0), this.#h(e.scriptPath || ""), this.#o(e.relativeUri || ""), this.#l(e.method || "GET");
|
|
740
742
|
const { host: r, ...n } = {
|
|
741
743
|
host: "example.com:443",
|
|
742
744
|
...K(e.headers || {})
|
|
743
745
|
};
|
|
744
|
-
if (this.#
|
|
746
|
+
if (this.#a(r, e.protocol || "http"), this.#c(n), e.body && this.#u(e.body), e.fileInfos)
|
|
745
747
|
for (const s of e.fileInfos)
|
|
746
|
-
this.#
|
|
747
|
-
return e.code && this.#
|
|
748
|
+
this.#f(s);
|
|
749
|
+
return e.code && this.#p(" ?>" + e.code), this.#d(), await this.#m();
|
|
748
750
|
}
|
|
749
|
-
#
|
|
751
|
+
#i() {
|
|
750
752
|
if (this.#e.length > 0) {
|
|
751
753
|
const e = this.#e.map(([r, n]) => `${r}=${n}`).join(`
|
|
752
754
|
`) + `
|
|
@@ -761,7 +763,7 @@ class m {
|
|
|
761
763
|
}
|
|
762
764
|
this[u].ccall("php_wasm_init", null, [], []);
|
|
763
765
|
}
|
|
764
|
-
#
|
|
766
|
+
#s() {
|
|
765
767
|
const e = "/tmp/headers.json";
|
|
766
768
|
if (!this.fileExists(e))
|
|
767
769
|
throw new Error(
|
|
@@ -779,7 +781,7 @@ class m {
|
|
|
779
781
|
httpStatusCode: r.status
|
|
780
782
|
};
|
|
781
783
|
}
|
|
782
|
-
#
|
|
784
|
+
#o(e) {
|
|
783
785
|
if (this[u].ccall(
|
|
784
786
|
"wasm_set_request_uri",
|
|
785
787
|
null,
|
|
@@ -795,7 +797,7 @@ class m {
|
|
|
795
797
|
);
|
|
796
798
|
}
|
|
797
799
|
}
|
|
798
|
-
#
|
|
800
|
+
#a(e, r) {
|
|
799
801
|
this[u].ccall(
|
|
800
802
|
"wasm_set_request_host",
|
|
801
803
|
null,
|
|
@@ -814,7 +816,7 @@ class m {
|
|
|
814
816
|
[n]
|
|
815
817
|
), (r === "https" || !r && n === 443) && this.addServerGlobalEntry("HTTPS", "on");
|
|
816
818
|
}
|
|
817
|
-
#
|
|
819
|
+
#l(e) {
|
|
818
820
|
this[u].ccall(
|
|
819
821
|
"wasm_set_request_method",
|
|
820
822
|
null,
|
|
@@ -845,7 +847,7 @@ class m {
|
|
|
845
847
|
e[r]
|
|
846
848
|
);
|
|
847
849
|
}
|
|
848
|
-
#
|
|
850
|
+
#u(e) {
|
|
849
851
|
this[u].ccall(
|
|
850
852
|
"wasm_set_request_body",
|
|
851
853
|
null,
|
|
@@ -858,7 +860,7 @@ class m {
|
|
|
858
860
|
[new TextEncoder().encode(e).length]
|
|
859
861
|
);
|
|
860
862
|
}
|
|
861
|
-
#
|
|
863
|
+
#h(e) {
|
|
862
864
|
this[u].ccall(
|
|
863
865
|
"wasm_set_path_translated",
|
|
864
866
|
null,
|
|
@@ -867,12 +869,16 @@ class m {
|
|
|
867
869
|
);
|
|
868
870
|
}
|
|
869
871
|
addServerGlobalEntry(e, r) {
|
|
870
|
-
this[
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
[
|
|
875
|
-
|
|
872
|
+
this.#r[e] = r;
|
|
873
|
+
}
|
|
874
|
+
#d() {
|
|
875
|
+
for (const e in this.#r)
|
|
876
|
+
this[u].ccall(
|
|
877
|
+
"wasm_add_SERVER_entry",
|
|
878
|
+
null,
|
|
879
|
+
[f, f],
|
|
880
|
+
[e, this.#r[e]]
|
|
881
|
+
);
|
|
876
882
|
}
|
|
877
883
|
/**
|
|
878
884
|
* Adds file information to $_FILES superglobal in PHP.
|
|
@@ -883,7 +889,7 @@ class m {
|
|
|
883
889
|
*
|
|
884
890
|
* @param fileInfo - File details
|
|
885
891
|
*/
|
|
886
|
-
#
|
|
892
|
+
#f(e) {
|
|
887
893
|
const { key: r, name: n, type: s, data: o } = e, i = `/tmp/${Math.random().toFixed(20)}`;
|
|
888
894
|
this.writeFile(i, o);
|
|
889
895
|
const a = 0;
|
|
@@ -894,7 +900,7 @@ class m {
|
|
|
894
900
|
[r, n, s, i, a, o.byteLength]
|
|
895
901
|
);
|
|
896
902
|
}
|
|
897
|
-
#
|
|
903
|
+
#p(e) {
|
|
898
904
|
this[u].ccall(
|
|
899
905
|
"wasm_set_php_code",
|
|
900
906
|
null,
|
|
@@ -902,14 +908,14 @@ class m {
|
|
|
902
908
|
[e]
|
|
903
909
|
);
|
|
904
910
|
}
|
|
905
|
-
async #
|
|
911
|
+
async #m() {
|
|
906
912
|
let e, r;
|
|
907
913
|
try {
|
|
908
914
|
e = await new Promise(async (o, i) => {
|
|
909
915
|
r = (a) => {
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
-
}, this.#
|
|
916
|
+
const l = new Error("Rethrown");
|
|
917
|
+
l.cause = a.error, l.betterMessage = a.message, i(l);
|
|
918
|
+
}, this.#n?.addEventListener(
|
|
913
919
|
"error",
|
|
914
920
|
r
|
|
915
921
|
);
|
|
@@ -933,19 +939,19 @@ class m {
|
|
|
933
939
|
}
|
|
934
940
|
});
|
|
935
941
|
} catch (o) {
|
|
936
|
-
for (const
|
|
937
|
-
typeof this[
|
|
942
|
+
for (const c in this)
|
|
943
|
+
typeof this[c] == "function" && (this[c] = () => {
|
|
938
944
|
throw new Error(
|
|
939
945
|
"PHP runtime has crashed – see the earlier error for details."
|
|
940
946
|
);
|
|
941
947
|
});
|
|
942
|
-
this.functionsMaybeMissingFromAsyncify =
|
|
943
|
-
const i = o, a = "betterMessage" in i ? i.betterMessage : i.message,
|
|
944
|
-
throw
|
|
948
|
+
this.functionsMaybeMissingFromAsyncify = le();
|
|
949
|
+
const i = o, a = "betterMessage" in i ? i.betterMessage : i.message, l = new Error(a);
|
|
950
|
+
throw l.cause = i, l;
|
|
945
951
|
} finally {
|
|
946
|
-
this.#
|
|
952
|
+
this.#n?.removeEventListener("error", r), this.#r = {};
|
|
947
953
|
}
|
|
948
|
-
const { headers: n, httpStatusCode: s } = this.#
|
|
954
|
+
const { headers: n, httpStatusCode: s } = this.#s();
|
|
949
955
|
return new v(
|
|
950
956
|
s,
|
|
951
957
|
n,
|
|
@@ -1092,42 +1098,42 @@ function F(t, e = globalThis, r = ["*"]) {
|
|
|
1092
1098
|
console.warn(`Invalid origin '${s.origin}' for comlink proxy`);
|
|
1093
1099
|
return;
|
|
1094
1100
|
}
|
|
1095
|
-
const { id: o, type: i, path: a } = Object.assign({ path: [] }, s.data),
|
|
1096
|
-
let
|
|
1101
|
+
const { id: o, type: i, path: a } = Object.assign({ path: [] }, s.data), l = (s.data.argumentList || []).map(P);
|
|
1102
|
+
let c;
|
|
1097
1103
|
try {
|
|
1098
1104
|
const h = a.slice(0, -1).reduce((p, R) => p[R], t), g = a.reduce((p, R) => p[R], t);
|
|
1099
1105
|
switch (i) {
|
|
1100
1106
|
case "GET":
|
|
1101
|
-
|
|
1107
|
+
c = g;
|
|
1102
1108
|
break;
|
|
1103
1109
|
case "SET":
|
|
1104
|
-
h[a.slice(-1)[0]] = P(s.data.value),
|
|
1110
|
+
h[a.slice(-1)[0]] = P(s.data.value), c = !0;
|
|
1105
1111
|
break;
|
|
1106
1112
|
case "APPLY":
|
|
1107
|
-
|
|
1113
|
+
c = g.apply(h, l);
|
|
1108
1114
|
break;
|
|
1109
1115
|
case "CONSTRUCT":
|
|
1110
1116
|
{
|
|
1111
|
-
const p = new g(...
|
|
1112
|
-
|
|
1117
|
+
const p = new g(...l);
|
|
1118
|
+
c = re(p);
|
|
1113
1119
|
}
|
|
1114
1120
|
break;
|
|
1115
1121
|
case "ENDPOINT":
|
|
1116
1122
|
{
|
|
1117
1123
|
const { port1: p, port2: R } = new MessageChannel();
|
|
1118
|
-
F(t, R),
|
|
1124
|
+
F(t, R), c = Ue(p, [p]);
|
|
1119
1125
|
}
|
|
1120
1126
|
break;
|
|
1121
1127
|
case "RELEASE":
|
|
1122
|
-
|
|
1128
|
+
c = void 0;
|
|
1123
1129
|
break;
|
|
1124
1130
|
default:
|
|
1125
1131
|
return;
|
|
1126
1132
|
}
|
|
1127
1133
|
} catch (h) {
|
|
1128
|
-
|
|
1134
|
+
c = { value: h, [x]: 0 };
|
|
1129
1135
|
}
|
|
1130
|
-
Promise.resolve(
|
|
1136
|
+
Promise.resolve(c).catch((h) => ({ value: h, [x]: 0 })).then((h) => {
|
|
1131
1137
|
const [g, p] = C(h);
|
|
1132
1138
|
e.postMessage(Object.assign(Object.assign({}, g), { id: o }), p), i === "RELEASE" && (e.removeEventListener("message", n), Z(e), H in t && typeof t[H] == "function" && t[H]());
|
|
1133
1139
|
}).catch((h) => {
|
|
@@ -1184,7 +1190,7 @@ function O(t, e = [], r = function() {
|
|
|
1184
1190
|
return { then: () => s };
|
|
1185
1191
|
const a = E(t, {
|
|
1186
1192
|
type: "GET",
|
|
1187
|
-
path: e.map((
|
|
1193
|
+
path: e.map((l) => l.toString())
|
|
1188
1194
|
}).then(P);
|
|
1189
1195
|
return a.then.bind(a);
|
|
1190
1196
|
}
|
|
@@ -1192,37 +1198,37 @@ function O(t, e = [], r = function() {
|
|
|
1192
1198
|
},
|
|
1193
1199
|
set(o, i, a) {
|
|
1194
1200
|
k(n);
|
|
1195
|
-
const [
|
|
1201
|
+
const [l, c] = C(a);
|
|
1196
1202
|
return E(t, {
|
|
1197
1203
|
type: "SET",
|
|
1198
1204
|
path: [...e, i].map((h) => h.toString()),
|
|
1199
|
-
value:
|
|
1200
|
-
},
|
|
1205
|
+
value: l
|
|
1206
|
+
}, c).then(P);
|
|
1201
1207
|
},
|
|
1202
1208
|
apply(o, i, a) {
|
|
1203
1209
|
k(n);
|
|
1204
|
-
const
|
|
1205
|
-
if (
|
|
1210
|
+
const l = e[e.length - 1];
|
|
1211
|
+
if (l === _e)
|
|
1206
1212
|
return E(t, {
|
|
1207
1213
|
type: "ENDPOINT"
|
|
1208
1214
|
}).then(P);
|
|
1209
|
-
if (
|
|
1215
|
+
if (l === "bind")
|
|
1210
1216
|
return O(t, e.slice(0, -1));
|
|
1211
|
-
const [
|
|
1217
|
+
const [c, h] = Y(a);
|
|
1212
1218
|
return E(t, {
|
|
1213
1219
|
type: "APPLY",
|
|
1214
1220
|
path: e.map((g) => g.toString()),
|
|
1215
|
-
argumentList:
|
|
1221
|
+
argumentList: c
|
|
1216
1222
|
}, h).then(P);
|
|
1217
1223
|
},
|
|
1218
1224
|
construct(o, i) {
|
|
1219
1225
|
k(n);
|
|
1220
|
-
const [a,
|
|
1226
|
+
const [a, l] = Y(i);
|
|
1221
1227
|
return E(t, {
|
|
1222
1228
|
type: "CONSTRUCT",
|
|
1223
|
-
path: e.map((
|
|
1229
|
+
path: e.map((c) => c.toString()),
|
|
1224
1230
|
argumentList: a
|
|
1225
|
-
},
|
|
1231
|
+
}, l).then(P);
|
|
1226
1232
|
}
|
|
1227
1233
|
});
|
|
1228
1234
|
return Oe(s, t), s;
|
|
@@ -1302,7 +1308,7 @@ function je(t, e) {
|
|
|
1302
1308
|
const s = new Promise((a) => {
|
|
1303
1309
|
n = a;
|
|
1304
1310
|
}), o = N(t), i = new Proxy(o, {
|
|
1305
|
-
get: (a,
|
|
1311
|
+
get: (a, l) => l === "isConnected" ? () => r : l === "isReady" ? () => s : l in a ? a[l] : e?.[l]
|
|
1306
1312
|
});
|
|
1307
1313
|
return F(
|
|
1308
1314
|
i,
|
|
@@ -1358,7 +1364,7 @@ function N(t) {
|
|
|
1358
1364
|
}
|
|
1359
1365
|
});
|
|
1360
1366
|
}
|
|
1361
|
-
async function We(t =
|
|
1367
|
+
async function We(t = me) {
|
|
1362
1368
|
switch (t) {
|
|
1363
1369
|
case "8.2":
|
|
1364
1370
|
return await import("php_8_2.js");
|
|
@@ -1409,17 +1415,17 @@ class L extends m {
|
|
|
1409
1415
|
const i = await Promise.all([
|
|
1410
1416
|
We(e),
|
|
1411
1417
|
...r.dataModules || []
|
|
1412
|
-
]), [a, ...
|
|
1418
|
+
]), [a, ...l] = i;
|
|
1413
1419
|
r.downloadMonitor?.setModules(i);
|
|
1414
|
-
const
|
|
1420
|
+
const c = await Re(
|
|
1415
1421
|
a,
|
|
1416
1422
|
{
|
|
1417
1423
|
...r.emscriptenOptions || {},
|
|
1418
1424
|
...r.downloadMonitor?.getEmscriptenOptions() || {}
|
|
1419
1425
|
},
|
|
1420
|
-
|
|
1426
|
+
l
|
|
1421
1427
|
);
|
|
1422
|
-
return n.initializeRuntime(
|
|
1428
|
+
return n.initializeRuntime(c), { dataModules: l };
|
|
1423
1429
|
})();
|
|
1424
1430
|
return {
|
|
1425
1431
|
php: n,
|
|
@@ -1532,14 +1538,14 @@ async function Ve(t, e, r, n) {
|
|
|
1532
1538
|
`[window] Reloading the currently registered Service Worker (expected version: ${n}, registered version: ${i})`
|
|
1533
1539
|
);
|
|
1534
1540
|
for (const a of o) {
|
|
1535
|
-
let
|
|
1541
|
+
let l = !1;
|
|
1536
1542
|
try {
|
|
1537
1543
|
await a.update();
|
|
1538
1544
|
} catch {
|
|
1539
|
-
|
|
1545
|
+
l = !0;
|
|
1540
1546
|
}
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1547
|
+
const c = a.waiting || a.installing;
|
|
1548
|
+
c && !l && (i !== null ? c.postMessage("skip-waiting") : l = !0), l && (await a.unregister(), window.location.reload());
|
|
1543
1549
|
}
|
|
1544
1550
|
}
|
|
1545
1551
|
} else
|
|
@@ -1553,7 +1559,7 @@ async function Ve(t, e, r, n) {
|
|
|
1553
1559
|
async function(a) {
|
|
1554
1560
|
if (console.debug("Message from ServiceWorker", a), e && a.data.scope !== e)
|
|
1555
1561
|
return;
|
|
1556
|
-
const
|
|
1562
|
+
const l = a.data.args || [], c = a.data.method, h = await t[c](...l);
|
|
1557
1563
|
a.source.postMessage(De(a.data.requestId, h));
|
|
1558
1564
|
}
|
|
1559
1565
|
), s.startMessages();
|