@wp-playground/client 0.1.37 → 0.1.39
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/README.md +10 -23
- package/index.cjs +44 -10
- package/index.d.ts +5 -0
- package/index.js +613 -426
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
function
|
|
1
|
+
function x(t) {
|
|
2
2
|
return new DOMParser().parseFromString(t.text, "text/html");
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function O(t) {
|
|
5
5
|
const e = t.split(".").shift().replace("-", " ");
|
|
6
6
|
return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
7
7
|
}
|
|
8
|
-
async function
|
|
8
|
+
async function S(t, e, r) {
|
|
9
9
|
await t.writeFile(e, r(await t.readFileAsText(e)));
|
|
10
10
|
}
|
|
11
|
-
async function
|
|
11
|
+
async function Te(t) {
|
|
12
12
|
return new Uint8Array(await t.arrayBuffer());
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const Ce = async (t, { plugin: e }, r) => {
|
|
15
15
|
r?.tracker.setCaption(`Activating ${e}`);
|
|
16
|
-
const i =
|
|
16
|
+
const i = x(
|
|
17
17
|
await t.request({
|
|
18
18
|
url: "/wp-admin/plugins.php"
|
|
19
19
|
})
|
|
@@ -23,20 +23,20 @@ const _e = async (t, { plugin: e }, r) => {
|
|
|
23
23
|
await t.request({
|
|
24
24
|
url: "/wp-admin/" + i
|
|
25
25
|
});
|
|
26
|
-
},
|
|
27
|
-
const r = new
|
|
26
|
+
}, ke = async (t, e) => {
|
|
27
|
+
const r = new Fe(
|
|
28
28
|
t,
|
|
29
29
|
e.siteUrl,
|
|
30
30
|
e.wordpressPath || "/wordpress"
|
|
31
31
|
);
|
|
32
32
|
e.patchSqlitePlugin !== !1 && await r.patchSqlitePlugin(), e.addPhpInfo !== !1 && await r.addPhpInfo(), e.patchSiteUrl !== !1 && await r.patchSiteUrl(), e.disableSiteHealth !== !1 && await r.disableSiteHealth(), e.disableWpNewBlogNotification !== !1 && await r.disableWpNewBlogNotification();
|
|
33
33
|
};
|
|
34
|
-
class
|
|
34
|
+
class Fe {
|
|
35
35
|
constructor(e, r, s) {
|
|
36
36
|
this.php = e, this.scopedSiteUrl = r, this.wordpressPath = s;
|
|
37
37
|
}
|
|
38
38
|
async patchSqlitePlugin() {
|
|
39
|
-
await
|
|
39
|
+
await S(
|
|
40
40
|
this.php,
|
|
41
41
|
`${this.wordpressPath}/wp-content/plugins/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-translator.php`,
|
|
42
42
|
(e) => e.replace(
|
|
@@ -52,7 +52,7 @@ class Se {
|
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
async patchSiteUrl() {
|
|
55
|
-
await
|
|
55
|
+
await S(
|
|
56
56
|
this.php,
|
|
57
57
|
`${this.wordpressPath}/wp-config.php`,
|
|
58
58
|
(e) => `<?php
|
|
@@ -64,7 +64,7 @@ class Se {
|
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
async disableSiteHealth() {
|
|
67
|
-
await
|
|
67
|
+
await S(
|
|
68
68
|
this.php,
|
|
69
69
|
`${this.wordpressPath}/wp-includes/default-filters.php`,
|
|
70
70
|
(e) => e.replace(
|
|
@@ -74,7 +74,7 @@ class Se {
|
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
async disableWpNewBlogNotification() {
|
|
77
|
-
await
|
|
77
|
+
await S(
|
|
78
78
|
this.php,
|
|
79
79
|
`${this.wordpressPath}/wp-config.php`,
|
|
80
80
|
// The original version of this function crashes WASM PHP, let's define an empty one instead.
|
|
@@ -82,26 +82,26 @@ class Se {
|
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
const
|
|
85
|
+
const Le = async (t, { code: e }) => await t.run({ code: e }), Ae = async (t, { options: e }) => await t.run(e), Oe = async (t, { key: e, value: r }) => {
|
|
86
86
|
await t.setPhpIniEntry(e, r);
|
|
87
|
-
},
|
|
87
|
+
}, Ue = async (t, { request: e }) => await t.request(e), He = async (t, { fromPath: e, toPath: r }) => {
|
|
88
88
|
await t.writeFile(
|
|
89
89
|
r,
|
|
90
90
|
await t.readFileAsBuffer(e)
|
|
91
91
|
);
|
|
92
|
-
},
|
|
92
|
+
}, Ie = async (t, { fromPath: e, toPath: r }) => {
|
|
93
93
|
await t.mv(e, r);
|
|
94
|
-
},
|
|
94
|
+
}, Me = async (t, { path: e }) => {
|
|
95
95
|
await t.mkdir(e);
|
|
96
|
-
},
|
|
96
|
+
}, Ne = async (t, { path: e }) => {
|
|
97
97
|
await t.unlink(e);
|
|
98
|
-
},
|
|
98
|
+
}, We = async (t, { path: e }) => {
|
|
99
99
|
await t.rmdir(e);
|
|
100
|
-
},
|
|
101
|
-
r instanceof File && (r = await
|
|
102
|
-
},
|
|
100
|
+
}, De = async (t, { path: e, data: r }) => {
|
|
101
|
+
r instanceof File && (r = await Te(r)), await t.writeFile(e, r);
|
|
102
|
+
}, ze = async (t, { siteUrl: e }) => {
|
|
103
103
|
const r = await t.documentRoot;
|
|
104
|
-
await
|
|
104
|
+
await S(
|
|
105
105
|
t,
|
|
106
106
|
`${r}/wp-config.php`,
|
|
107
107
|
(s) => `<?php
|
|
@@ -114,7 +114,7 @@ const ve = async (t, { code: e }) => await t.run({ code: e }), Ee = async (t, {
|
|
|
114
114
|
?>${s}`
|
|
115
115
|
);
|
|
116
116
|
};
|
|
117
|
-
class
|
|
117
|
+
class he {
|
|
118
118
|
constructor({ concurrency: e }) {
|
|
119
119
|
this._running = 0, this.concurrency = e, this.queue = [];
|
|
120
120
|
}
|
|
@@ -139,29 +139,29 @@ class se {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
const
|
|
143
|
-
function
|
|
142
|
+
const qe = Symbol("literal");
|
|
143
|
+
function $(t) {
|
|
144
144
|
if (typeof t == "string")
|
|
145
145
|
return t.startsWith("$") ? t : JSON.stringify(t);
|
|
146
146
|
if (typeof t == "number")
|
|
147
147
|
return t.toString();
|
|
148
148
|
if (Array.isArray(t))
|
|
149
|
-
return `array(${t.map(
|
|
149
|
+
return `array(${t.map($).join(", ")})`;
|
|
150
150
|
if (t === null)
|
|
151
151
|
return "null";
|
|
152
152
|
if (typeof t == "object")
|
|
153
|
-
return
|
|
153
|
+
return qe in t ? t.toString() : `array(${Object.entries(t).map(([r, s]) => `${JSON.stringify(r)} => ${$(s)}`).join(", ")})`;
|
|
154
154
|
if (typeof t == "function")
|
|
155
155
|
return t();
|
|
156
156
|
throw new Error(`Unsupported value: ${t}`);
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function W(t) {
|
|
159
159
|
const e = {};
|
|
160
160
|
for (const r in t)
|
|
161
|
-
e[r] =
|
|
161
|
+
e[r] = $(t[r]);
|
|
162
162
|
return e;
|
|
163
163
|
}
|
|
164
|
-
const
|
|
164
|
+
const G = `<?php
|
|
165
165
|
|
|
166
166
|
function zipDir($dir, $output, $additionalFiles = array())
|
|
167
167
|
{
|
|
@@ -224,28 +224,28 @@ function delTree($dir)
|
|
|
224
224
|
return rmdir($dir);
|
|
225
225
|
}
|
|
226
226
|
`;
|
|
227
|
-
async function
|
|
228
|
-
const e = "wordpress-playground.zip", r = `/${e}`, s =
|
|
227
|
+
async function Be(t) {
|
|
228
|
+
const e = "wordpress-playground.zip", r = `/${e}`, s = W({
|
|
229
229
|
zipPath: r,
|
|
230
230
|
documentRoot: await t.documentRoot
|
|
231
231
|
});
|
|
232
|
-
await
|
|
232
|
+
await pe(
|
|
233
233
|
t,
|
|
234
234
|
`zipDir(${s.documentRoot}, ${s.zipPath});`
|
|
235
235
|
);
|
|
236
236
|
const n = await t.readFileAsBuffer(r);
|
|
237
237
|
return t.unlink(r), new File([n], e);
|
|
238
238
|
}
|
|
239
|
-
const
|
|
239
|
+
const je = async (t, { fullSiteZip: e }) => {
|
|
240
240
|
const r = "/import.zip";
|
|
241
241
|
await t.writeFile(
|
|
242
242
|
r,
|
|
243
243
|
new Uint8Array(await e.arrayBuffer())
|
|
244
244
|
);
|
|
245
245
|
const s = await t.absoluteUrl, n = await t.documentRoot;
|
|
246
|
-
await t.rmdir(n), await
|
|
247
|
-
const i =
|
|
248
|
-
await
|
|
246
|
+
await t.rmdir(n), await de(t, { zipPath: r, extractToPath: "/" });
|
|
247
|
+
const i = W({ absoluteUrl: s });
|
|
248
|
+
await Ye(
|
|
249
249
|
t,
|
|
250
250
|
`${n}/wp-config.php`,
|
|
251
251
|
(o) => `<?php
|
|
@@ -255,35 +255,35 @@ const Ie = async (t, { fullSiteZip: e }) => {
|
|
|
255
255
|
}
|
|
256
256
|
?>${o}`
|
|
257
257
|
);
|
|
258
|
-
},
|
|
259
|
-
const s =
|
|
258
|
+
}, de = async (t, { zipPath: e, extractToPath: r }) => {
|
|
259
|
+
const s = W({
|
|
260
260
|
zipPath: e,
|
|
261
261
|
extractToPath: r
|
|
262
262
|
});
|
|
263
|
-
await
|
|
263
|
+
await pe(
|
|
264
264
|
t,
|
|
265
265
|
`unzip(${s.zipPath}, ${s.extractToPath});`
|
|
266
266
|
);
|
|
267
|
-
},
|
|
267
|
+
}, Ve = async (t, { file: e }) => {
|
|
268
268
|
const r = await t.request({
|
|
269
269
|
url: "/wp-admin/admin.php?import=wordpress"
|
|
270
|
-
}), s =
|
|
270
|
+
}), s = Y(r).getElementById("import-upload-form")?.getAttribute("action"), n = await t.request({
|
|
271
271
|
url: `/wp-admin/${s}`,
|
|
272
272
|
method: "POST",
|
|
273
273
|
files: { import: e }
|
|
274
|
-
}), i =
|
|
274
|
+
}), i = Y(n).querySelector(
|
|
275
275
|
"#wpbody-content form"
|
|
276
276
|
);
|
|
277
277
|
if (!i)
|
|
278
278
|
throw console.log(n.text), new Error(
|
|
279
279
|
"Could not find an importer form in response. See the response text above for details."
|
|
280
280
|
);
|
|
281
|
-
const o =
|
|
281
|
+
const o = Ge(i);
|
|
282
282
|
o.fetch_attachments = "1";
|
|
283
283
|
for (const a in o)
|
|
284
284
|
if (a.startsWith("user_map[")) {
|
|
285
|
-
const
|
|
286
|
-
o[
|
|
285
|
+
const c = "user_new[" + a.slice(9, -1) + "]";
|
|
286
|
+
o[c] = "1";
|
|
287
287
|
}
|
|
288
288
|
await t.request({
|
|
289
289
|
url: i.action,
|
|
@@ -291,45 +291,45 @@ const Ie = async (t, { fullSiteZip: e }) => {
|
|
|
291
291
|
formData: o
|
|
292
292
|
});
|
|
293
293
|
};
|
|
294
|
-
function
|
|
294
|
+
function Y(t) {
|
|
295
295
|
return new DOMParser().parseFromString(t.text, "text/html");
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function Ge(t) {
|
|
298
298
|
return Object.fromEntries(new FormData(t).entries());
|
|
299
299
|
}
|
|
300
|
-
async function
|
|
300
|
+
async function Ye(t, e, r) {
|
|
301
301
|
await t.writeFile(
|
|
302
302
|
e,
|
|
303
303
|
r(await t.readFileAsText(e))
|
|
304
304
|
);
|
|
305
305
|
}
|
|
306
|
-
async function
|
|
306
|
+
async function pe(t, e) {
|
|
307
307
|
const r = await t.run({
|
|
308
|
-
code:
|
|
308
|
+
code: G + e
|
|
309
309
|
});
|
|
310
310
|
if (r.exitCode !== 0)
|
|
311
|
-
throw console.log(
|
|
311
|
+
throw console.log(G + e), console.log(e + ""), console.log(r.errors), r.errors;
|
|
312
312
|
return r;
|
|
313
313
|
}
|
|
314
|
-
const
|
|
314
|
+
const Je = async (t, { pluginZipFile: e, options: r = {} }, s) => {
|
|
315
315
|
s?.tracker.setCaption(
|
|
316
|
-
`Installing the ${
|
|
316
|
+
`Installing the ${O(e?.name)} plugin`
|
|
317
317
|
);
|
|
318
318
|
try {
|
|
319
319
|
const n = "activate" in r ? r.activate : !0, i = await t.request({
|
|
320
320
|
url: "/wp-admin/plugin-install.php?tab=upload"
|
|
321
|
-
}), o =
|
|
321
|
+
}), o = x(i), a = new FormData(
|
|
322
322
|
o.querySelector(".wp-upload-form")
|
|
323
|
-
), { pluginzip:
|
|
323
|
+
), { pluginzip: c, ...l } = Object.fromEntries(
|
|
324
324
|
a.entries()
|
|
325
325
|
), u = await t.request({
|
|
326
326
|
url: "/wp-admin/update.php?action=upload-plugin",
|
|
327
327
|
method: "POST",
|
|
328
|
-
formData:
|
|
328
|
+
formData: l,
|
|
329
329
|
files: { pluginzip: e }
|
|
330
330
|
});
|
|
331
331
|
if (n) {
|
|
332
|
-
const p =
|
|
332
|
+
const p = x(u).querySelector("#wpbody-content .button.button-primary").attributes.getNamedItem("href").value, y = new URL(
|
|
333
333
|
p,
|
|
334
334
|
await t.pathToInternalUrl("/wp-admin/")
|
|
335
335
|
).toString();
|
|
@@ -339,14 +339,14 @@ const qe = async (t, { pluginZipFile: e, options: r = {} }, s) => {
|
|
|
339
339
|
}
|
|
340
340
|
await t.isDir(
|
|
341
341
|
"/wordpress/wp-content/plugins/gutenberg"
|
|
342
|
-
) && !await t.fileExists("/wordpress/.gutenberg-patched") && (await t.writeFile("/wordpress/.gutenberg-patched", "1"), await
|
|
342
|
+
) && !await t.fileExists("/wordpress/.gutenberg-patched") && (await t.writeFile("/wordpress/.gutenberg-patched", "1"), await J(
|
|
343
343
|
t,
|
|
344
344
|
"/wordpress/wp-content/plugins/gutenberg/build/block-editor/index.js",
|
|
345
345
|
(d) => d.replace(
|
|
346
346
|
/srcDoc:("[^"]+"|[^,]+)/g,
|
|
347
347
|
'src:"/wp-includes/empty.html"'
|
|
348
348
|
)
|
|
349
|
-
), await
|
|
349
|
+
), await J(
|
|
350
350
|
t,
|
|
351
351
|
"/wordpress/wp-content/plugins/gutenberg/build/block-editor/index.min.js",
|
|
352
352
|
(d) => d.replace(
|
|
@@ -360,31 +360,31 @@ const qe = async (t, { pluginZipFile: e, options: r = {} }, s) => {
|
|
|
360
360
|
), console.error(n);
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
|
-
async function
|
|
363
|
+
async function J(t, e, r) {
|
|
364
364
|
return await t.writeFile(
|
|
365
365
|
e,
|
|
366
366
|
r(await t.readFileAsText(e))
|
|
367
367
|
);
|
|
368
368
|
}
|
|
369
|
-
const
|
|
369
|
+
const Ke = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
370
370
|
s?.tracker.setCaption(
|
|
371
|
-
`Installing the ${
|
|
371
|
+
`Installing the ${O(e.name)} theme`
|
|
372
372
|
);
|
|
373
373
|
try {
|
|
374
374
|
const n = "activate" in r ? r.activate : !0, i = await t.request({
|
|
375
375
|
url: "/wp-admin/theme-install.php"
|
|
376
|
-
}), o =
|
|
376
|
+
}), o = x(i), a = new FormData(
|
|
377
377
|
o.querySelector(".wp-upload-form")
|
|
378
|
-
), { themezip:
|
|
378
|
+
), { themezip: c, ...l } = Object.fromEntries(
|
|
379
379
|
a.entries()
|
|
380
380
|
), u = await t.request({
|
|
381
381
|
url: "/wp-admin/update.php?action=upload-theme",
|
|
382
382
|
method: "POST",
|
|
383
|
-
formData:
|
|
383
|
+
formData: l,
|
|
384
384
|
files: { themezip: e }
|
|
385
385
|
});
|
|
386
386
|
if (n) {
|
|
387
|
-
const d =
|
|
387
|
+
const d = x(u), p = d.querySelector(
|
|
388
388
|
"#wpbody-content > .wrap"
|
|
389
389
|
);
|
|
390
390
|
if (p?.textContent?.includes(
|
|
@@ -400,12 +400,12 @@ const We = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
400
400
|
console.error('The "activate" button was not found.');
|
|
401
401
|
return;
|
|
402
402
|
}
|
|
403
|
-
const
|
|
404
|
-
|
|
403
|
+
const Re = y.attributes.getNamedItem("href").value, xe = new URL(
|
|
404
|
+
Re,
|
|
405
405
|
await t.pathToInternalUrl("/wp-admin/")
|
|
406
406
|
).toString();
|
|
407
407
|
await t.request({
|
|
408
|
-
url:
|
|
408
|
+
url: xe
|
|
409
409
|
});
|
|
410
410
|
}
|
|
411
411
|
} catch (n) {
|
|
@@ -413,7 +413,7 @@ const We = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
413
413
|
`Proceeding without the ${e.name} theme. Could not install it in wp-admin. The original error was: ${n}`
|
|
414
414
|
), console.error(n);
|
|
415
415
|
}
|
|
416
|
-
},
|
|
416
|
+
}, Qe = async (t, { username: e = "admin", password: r = "password" } = {}, s) => {
|
|
417
417
|
s?.tracker.setCaption(s?.initialCaption || "Logging in"), await t.request({
|
|
418
418
|
url: "/wp-login.php"
|
|
419
419
|
}), await t.request({
|
|
@@ -425,7 +425,7 @@ const We = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
425
425
|
rememberme: "forever"
|
|
426
426
|
}
|
|
427
427
|
});
|
|
428
|
-
},
|
|
428
|
+
}, Xe = async (t, { options: e }) => {
|
|
429
429
|
await t.request({
|
|
430
430
|
url: "/wp-admin/install.php?step=2",
|
|
431
431
|
method: "POST",
|
|
@@ -442,10 +442,10 @@ const We = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
442
442
|
admin_email: "admin@localhost.com"
|
|
443
443
|
}
|
|
444
444
|
});
|
|
445
|
-
},
|
|
445
|
+
}, Ze = async (t, { options: e }) => {
|
|
446
446
|
const r = `<?php
|
|
447
447
|
include 'wordpress/wp-load.php';
|
|
448
|
-
$site_options = ${
|
|
448
|
+
$site_options = ${$(e)};
|
|
449
449
|
foreach($site_options as $name => $value) {
|
|
450
450
|
update_option($name, $value);
|
|
451
451
|
}
|
|
@@ -453,52 +453,52 @@ const We = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
453
453
|
`, s = await t.run({
|
|
454
454
|
code: r
|
|
455
455
|
});
|
|
456
|
-
return
|
|
457
|
-
},
|
|
456
|
+
return fe(s), { code: r, result: s };
|
|
457
|
+
}, et = async (t, { meta: e, userId: r }) => {
|
|
458
458
|
const s = `<?php
|
|
459
459
|
include 'wordpress/wp-load.php';
|
|
460
|
-
$meta = ${
|
|
460
|
+
$meta = ${$(e)};
|
|
461
461
|
foreach($meta as $name => $value) {
|
|
462
|
-
update_user_meta(${
|
|
462
|
+
update_user_meta(${$(r)}, $name, $value);
|
|
463
463
|
}
|
|
464
464
|
echo "Success";
|
|
465
465
|
`, n = await t.run({
|
|
466
466
|
code: s
|
|
467
467
|
});
|
|
468
|
-
return
|
|
468
|
+
return fe(n), { code: s, result: n };
|
|
469
469
|
};
|
|
470
|
-
async function
|
|
470
|
+
async function fe(t) {
|
|
471
471
|
if (t.text !== "Success")
|
|
472
472
|
throw console.log(t), new Error(`Failed to run code: ${t.text} ${t.errors}`);
|
|
473
473
|
}
|
|
474
|
-
const
|
|
474
|
+
const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
475
475
|
__proto__: null,
|
|
476
|
-
activatePlugin:
|
|
477
|
-
applyWordPressPatches:
|
|
478
|
-
cp:
|
|
479
|
-
defineSiteUrl:
|
|
480
|
-
importFile:
|
|
481
|
-
installPlugin:
|
|
482
|
-
installTheme:
|
|
483
|
-
login:
|
|
484
|
-
mkdir:
|
|
485
|
-
mv:
|
|
486
|
-
replaceSite:
|
|
487
|
-
request:
|
|
488
|
-
rm:
|
|
489
|
-
rmdir:
|
|
490
|
-
runPHP:
|
|
491
|
-
runPHPWithOptions:
|
|
492
|
-
runWpInstallationWizard:
|
|
493
|
-
setPhpIniEntry:
|
|
494
|
-
setSiteOptions:
|
|
495
|
-
unzip:
|
|
496
|
-
updateUserMeta:
|
|
497
|
-
writeFile:
|
|
498
|
-
zipEntireSite:
|
|
499
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
500
|
-
function
|
|
501
|
-
const r = t.headers.get("content-length") || "", s = parseInt(r, 10) ||
|
|
476
|
+
activatePlugin: Ce,
|
|
477
|
+
applyWordPressPatches: ke,
|
|
478
|
+
cp: He,
|
|
479
|
+
defineSiteUrl: ze,
|
|
480
|
+
importFile: Ve,
|
|
481
|
+
installPlugin: Je,
|
|
482
|
+
installTheme: Ke,
|
|
483
|
+
login: Qe,
|
|
484
|
+
mkdir: Me,
|
|
485
|
+
mv: Ie,
|
|
486
|
+
replaceSite: je,
|
|
487
|
+
request: Ue,
|
|
488
|
+
rm: Ne,
|
|
489
|
+
rmdir: We,
|
|
490
|
+
runPHP: Le,
|
|
491
|
+
runPHPWithOptions: Ae,
|
|
492
|
+
runWpInstallationWizard: Xe,
|
|
493
|
+
setPhpIniEntry: Oe,
|
|
494
|
+
setSiteOptions: Ze,
|
|
495
|
+
unzip: de,
|
|
496
|
+
updateUserMeta: et,
|
|
497
|
+
writeFile: De,
|
|
498
|
+
zipEntireSite: Be
|
|
499
|
+
}, Symbol.toStringTag, { value: "Module" })), rt = 5 * 1024 * 1024;
|
|
500
|
+
function st(t, e) {
|
|
501
|
+
const r = t.headers.get("content-length") || "", s = parseInt(r, 10) || rt;
|
|
502
502
|
function n(i, o) {
|
|
503
503
|
e(
|
|
504
504
|
new CustomEvent("progress", {
|
|
@@ -520,14 +520,14 @@ function Ke(t, e) {
|
|
|
520
520
|
let a = 0;
|
|
521
521
|
for (; ; )
|
|
522
522
|
try {
|
|
523
|
-
const { done:
|
|
524
|
-
if (
|
|
523
|
+
const { done: c, value: l } = await o.read();
|
|
524
|
+
if (l && (a += l.byteLength), c) {
|
|
525
525
|
n(a, a), i.close();
|
|
526
526
|
break;
|
|
527
527
|
} else
|
|
528
|
-
n(a, s), i.enqueue(
|
|
529
|
-
} catch (
|
|
530
|
-
console.error({ e:
|
|
528
|
+
n(a, s), i.enqueue(l);
|
|
529
|
+
} catch (c) {
|
|
530
|
+
console.error({ e: c }), i.error(c);
|
|
531
531
|
break;
|
|
532
532
|
}
|
|
533
533
|
}
|
|
@@ -540,7 +540,7 @@ function Ke(t, e) {
|
|
|
540
540
|
);
|
|
541
541
|
}
|
|
542
542
|
const H = 1e-5;
|
|
543
|
-
class
|
|
543
|
+
class U extends EventTarget {
|
|
544
544
|
constructor({
|
|
545
545
|
weight: e = 1,
|
|
546
546
|
caption: r = "",
|
|
@@ -589,7 +589,7 @@ class A extends EventTarget {
|
|
|
589
589
|
`Cannot add a stage with weight ${e} as the total weight of registered stages would exceed 1.`
|
|
590
590
|
);
|
|
591
591
|
this._selfWeight -= e;
|
|
592
|
-
const s = new
|
|
592
|
+
const s = new U({
|
|
593
593
|
caption: r,
|
|
594
594
|
weight: e,
|
|
595
595
|
fillTime: this._fillTime
|
|
@@ -741,7 +741,7 @@ class v {
|
|
|
741
741
|
return new TextDecoder().decode(this.bytes);
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
|
-
const
|
|
744
|
+
const D = [
|
|
745
745
|
"8.2",
|
|
746
746
|
"8.1",
|
|
747
747
|
"8.0",
|
|
@@ -751,8 +751,8 @@ const z = [
|
|
|
751
751
|
"7.1",
|
|
752
752
|
"7.0",
|
|
753
753
|
"5.6"
|
|
754
|
-
],
|
|
755
|
-
class
|
|
754
|
+
], nt = D[0], tr = D;
|
|
755
|
+
class it {
|
|
756
756
|
#e;
|
|
757
757
|
#t;
|
|
758
758
|
/**
|
|
@@ -785,10 +785,10 @@ class Qe {
|
|
|
785
785
|
...e,
|
|
786
786
|
headers: {
|
|
787
787
|
...e.headers,
|
|
788
|
-
cookie: this.#
|
|
788
|
+
cookie: this.#n()
|
|
789
789
|
}
|
|
790
790
|
});
|
|
791
|
-
if (s.headers["set-cookie"] && this.#
|
|
791
|
+
if (s.headers["set-cookie"] && this.#r(s.headers["set-cookie"]), this.#t.handleRedirects && s.headers.location && r < this.#t.maxRedirects) {
|
|
792
792
|
const n = new URL(
|
|
793
793
|
s.headers.location[0],
|
|
794
794
|
this.requestHandler.absoluteUrl
|
|
@@ -820,7 +820,7 @@ class Qe {
|
|
|
820
820
|
get documentRoot() {
|
|
821
821
|
return this.requestHandler.documentRoot;
|
|
822
822
|
}
|
|
823
|
-
#
|
|
823
|
+
#r(e) {
|
|
824
824
|
for (const r of e)
|
|
825
825
|
try {
|
|
826
826
|
if (!r.includes("="))
|
|
@@ -831,30 +831,30 @@ class Qe {
|
|
|
831
831
|
console.error(s);
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
|
-
#
|
|
834
|
+
#n() {
|
|
835
835
|
const e = [];
|
|
836
836
|
for (const r in this.#e)
|
|
837
837
|
e.push(`${r}=${this.#e[r]}`);
|
|
838
838
|
return e.join("; ");
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
|
-
const
|
|
842
|
-
function
|
|
841
|
+
const ot = "http://example.com";
|
|
842
|
+
function K(t) {
|
|
843
843
|
return t.toString().substring(t.origin.length);
|
|
844
844
|
}
|
|
845
|
-
function
|
|
845
|
+
function Q(t, e) {
|
|
846
846
|
return !e || !t.startsWith(e) ? t : t.substring(e.length);
|
|
847
847
|
}
|
|
848
|
-
function
|
|
848
|
+
function at(t, e) {
|
|
849
849
|
return !e || t.startsWith(e) ? t : e + t;
|
|
850
850
|
}
|
|
851
|
-
class
|
|
851
|
+
class ct {
|
|
852
852
|
#e;
|
|
853
853
|
#t;
|
|
854
|
+
#r;
|
|
854
855
|
#n;
|
|
855
|
-
#s;
|
|
856
856
|
#i;
|
|
857
|
-
#
|
|
857
|
+
#s;
|
|
858
858
|
#o;
|
|
859
859
|
#a;
|
|
860
860
|
#c;
|
|
@@ -863,7 +863,7 @@ class et {
|
|
|
863
863
|
* @param config - Request Handler configuration.
|
|
864
864
|
*/
|
|
865
865
|
constructor(e, r = {}) {
|
|
866
|
-
this.#a = new
|
|
866
|
+
this.#a = new he({ concurrency: 1 });
|
|
867
867
|
const {
|
|
868
868
|
documentRoot: s = "/www/",
|
|
869
869
|
absoluteUrl: n = typeof location == "object" ? location?.href : "",
|
|
@@ -871,15 +871,15 @@ class et {
|
|
|
871
871
|
} = r;
|
|
872
872
|
this.php = e, this.#e = s, this.#c = i;
|
|
873
873
|
const o = new URL(n);
|
|
874
|
-
this.#
|
|
875
|
-
const a = this.#
|
|
874
|
+
this.#r = o.hostname, this.#n = o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80, this.#t = (o.protocol || "").replace(":", "");
|
|
875
|
+
const a = this.#n !== 443 && this.#n !== 80;
|
|
876
876
|
this.#i = [
|
|
877
|
-
this.#
|
|
878
|
-
a ? `:${this.#
|
|
879
|
-
].join(""), this.#
|
|
877
|
+
this.#r,
|
|
878
|
+
a ? `:${this.#n}` : ""
|
|
879
|
+
].join(""), this.#s = o.pathname.replace(/\/+$/, ""), this.#o = [
|
|
880
880
|
`${this.#t}://`,
|
|
881
881
|
this.#i,
|
|
882
|
-
this.#
|
|
882
|
+
this.#s
|
|
883
883
|
].join("");
|
|
884
884
|
}
|
|
885
885
|
/** @inheritDoc */
|
|
@@ -889,7 +889,7 @@ class et {
|
|
|
889
889
|
/** @inheritDoc */
|
|
890
890
|
internalUrlToPath(e) {
|
|
891
891
|
const r = new URL(e);
|
|
892
|
-
return r.pathname.startsWith(this.#
|
|
892
|
+
return r.pathname.startsWith(this.#s) && (r.pathname = r.pathname.slice(this.#s.length)), K(r);
|
|
893
893
|
}
|
|
894
894
|
get isRequestRunning() {
|
|
895
895
|
return this.#a.running > 0;
|
|
@@ -906,10 +906,10 @@ class et {
|
|
|
906
906
|
async request(e) {
|
|
907
907
|
const r = e.url.startsWith("http://") || e.url.startsWith("https://"), s = new URL(
|
|
908
908
|
e.url,
|
|
909
|
-
r ? void 0 :
|
|
910
|
-
), n =
|
|
909
|
+
r ? void 0 : ot
|
|
910
|
+
), n = Q(
|
|
911
911
|
s.pathname,
|
|
912
|
-
this.#
|
|
912
|
+
this.#s
|
|
913
913
|
);
|
|
914
914
|
return this.#c(n) ? this.#l(n) : await this.#u(e, s);
|
|
915
915
|
}
|
|
@@ -935,7 +935,7 @@ class et {
|
|
|
935
935
|
// @TODO: Infer the content-type from the arrayBuffer instead of the file path.
|
|
936
936
|
// The code below won't return the correct mime-type if the extension
|
|
937
937
|
// was tampered with.
|
|
938
|
-
"content-type": [
|
|
938
|
+
"content-type": [ut(r)],
|
|
939
939
|
"accept-ranges": ["bytes"],
|
|
940
940
|
"cache-control": ["public, max-age=0"]
|
|
941
941
|
},
|
|
@@ -959,20 +959,20 @@ class et {
|
|
|
959
959
|
let n = "GET";
|
|
960
960
|
const i = {
|
|
961
961
|
host: this.#i,
|
|
962
|
-
...
|
|
962
|
+
...me(e.headers || {})
|
|
963
963
|
}, o = [];
|
|
964
964
|
if (e.files && Object.keys(e.files).length) {
|
|
965
965
|
n = "POST";
|
|
966
|
-
for (const
|
|
967
|
-
const
|
|
966
|
+
for (const c in e.files) {
|
|
967
|
+
const l = e.files[c];
|
|
968
968
|
o.push({
|
|
969
|
-
key:
|
|
970
|
-
name:
|
|
971
|
-
type:
|
|
972
|
-
data: new Uint8Array(await
|
|
969
|
+
key: c,
|
|
970
|
+
name: l.name,
|
|
971
|
+
type: l.type,
|
|
972
|
+
data: new Uint8Array(await l.arrayBuffer())
|
|
973
973
|
});
|
|
974
974
|
}
|
|
975
|
-
i["content-type"]?.startsWith("multipart/form-data") && (e.formData =
|
|
975
|
+
i["content-type"]?.startsWith("multipart/form-data") && (e.formData = lt(
|
|
976
976
|
e.body || ""
|
|
977
977
|
), i["content-type"] = "application/x-www-form-urlencoded", delete e.body);
|
|
978
978
|
}
|
|
@@ -980,9 +980,9 @@ class et {
|
|
|
980
980
|
return e.formData !== void 0 ? (n = "POST", i["content-type"] = i["content-type"] || "application/x-www-form-urlencoded", a = new URLSearchParams(
|
|
981
981
|
e.formData
|
|
982
982
|
).toString()) : a = e.body, await this.php.run({
|
|
983
|
-
relativeUri:
|
|
984
|
-
|
|
985
|
-
this.#
|
|
983
|
+
relativeUri: at(
|
|
984
|
+
K(r),
|
|
985
|
+
this.#s
|
|
986
986
|
),
|
|
987
987
|
protocol: this.#t,
|
|
988
988
|
method: e.method || n,
|
|
@@ -1004,13 +1004,13 @@ class et {
|
|
|
1004
1004
|
* @returns The resolved filesystem path.
|
|
1005
1005
|
*/
|
|
1006
1006
|
#h(e) {
|
|
1007
|
-
let r =
|
|
1007
|
+
let r = Q(e, this.#s);
|
|
1008
1008
|
r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r += "/"), r.endsWith("index.php") || (r += "index.php"));
|
|
1009
1009
|
const s = `${this.#e}${r}`;
|
|
1010
1010
|
return this.php.fileExists(s) ? s : `${this.#e}/index.php`;
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1013
|
+
function lt(t) {
|
|
1014
1014
|
const e = {}, r = t.match(/--(.*)\r\n/);
|
|
1015
1015
|
if (!r)
|
|
1016
1016
|
return e;
|
|
@@ -1018,14 +1018,14 @@ function tt(t) {
|
|
|
1018
1018
|
return n.shift(), n.pop(), n.forEach((i) => {
|
|
1019
1019
|
const o = i.indexOf(`\r
|
|
1020
1020
|
\r
|
|
1021
|
-
`), a = i.substring(0, o).trim(),
|
|
1022
|
-
if (
|
|
1023
|
-
const u =
|
|
1024
|
-
e[u] =
|
|
1021
|
+
`), a = i.substring(0, o).trim(), c = i.substring(o + 4).trim(), l = a.match(/name="([^"]+)"/);
|
|
1022
|
+
if (l) {
|
|
1023
|
+
const u = l[1];
|
|
1024
|
+
e[u] = c;
|
|
1025
1025
|
}
|
|
1026
1026
|
}), e;
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function ut(t) {
|
|
1029
1029
|
switch (t.split(".").pop()) {
|
|
1030
1030
|
case "css":
|
|
1031
1031
|
return "text/css";
|
|
@@ -1065,7 +1065,7 @@ function rt(t) {
|
|
|
1065
1065
|
return "application-octet-stream";
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
|
-
const
|
|
1068
|
+
const X = {
|
|
1069
1069
|
0: "No error occurred. System call completed successfully.",
|
|
1070
1070
|
1: "Argument list too long.",
|
|
1071
1071
|
2: "Permission denied.",
|
|
@@ -1151,10 +1151,10 @@ function m(t = "") {
|
|
|
1151
1151
|
try {
|
|
1152
1152
|
return i.apply(this, o);
|
|
1153
1153
|
} catch (a) {
|
|
1154
|
-
const
|
|
1155
|
-
if (
|
|
1156
|
-
const
|
|
1157
|
-
throw new Error(`${d}: ${
|
|
1154
|
+
const c = typeof a == "object" ? a?.errno : null;
|
|
1155
|
+
if (c in X) {
|
|
1156
|
+
const l = X[c], u = typeof o[0] == "string" ? o[0] : null, d = u !== null ? t.replaceAll("{path}", u) : t;
|
|
1157
|
+
throw new Error(`${d}: ${l}`, {
|
|
1158
1158
|
cause: a
|
|
1159
1159
|
});
|
|
1160
1160
|
}
|
|
@@ -1163,20 +1163,165 @@ function m(t = "") {
|
|
|
1163
1163
|
};
|
|
1164
1164
|
};
|
|
1165
1165
|
}
|
|
1166
|
-
const
|
|
1167
|
-
function
|
|
1168
|
-
return
|
|
1166
|
+
const ht = [];
|
|
1167
|
+
function dt(t) {
|
|
1168
|
+
return ht[t];
|
|
1169
1169
|
}
|
|
1170
1170
|
(function() {
|
|
1171
1171
|
return typeof window < "u" && !{}.TEST ? "WEB" : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? "WORKER" : "NODE";
|
|
1172
1172
|
})();
|
|
1173
|
-
|
|
1174
|
-
|
|
1173
|
+
const Z = Symbol("error"), ee = Symbol("message");
|
|
1174
|
+
class z extends Event {
|
|
1175
|
+
/**
|
|
1176
|
+
* Create a new `ErrorEvent`.
|
|
1177
|
+
*
|
|
1178
|
+
* @param type The name of the event
|
|
1179
|
+
* @param options A dictionary object that allows for setting
|
|
1180
|
+
* attributes via object members of the same name.
|
|
1181
|
+
*/
|
|
1182
|
+
constructor(e, r = {}) {
|
|
1183
|
+
super(e), this[Z] = r.error === void 0 ? null : r.error, this[ee] = r.message === void 0 ? "" : r.message;
|
|
1184
|
+
}
|
|
1185
|
+
get error() {
|
|
1186
|
+
return this[Z];
|
|
1187
|
+
}
|
|
1188
|
+
get message() {
|
|
1189
|
+
return this[ee];
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
Object.defineProperty(z.prototype, "error", { enumerable: !0 });
|
|
1193
|
+
Object.defineProperty(z.prototype, "message", { enumerable: !0 });
|
|
1194
|
+
const pt = typeof globalThis.ErrorEvent == "function" ? globalThis.ErrorEvent : z;
|
|
1195
|
+
class ft extends EventTarget {
|
|
1196
|
+
constructor() {
|
|
1197
|
+
super(...arguments), this.listenersCount = 0;
|
|
1198
|
+
}
|
|
1199
|
+
addEventListener(e, r) {
|
|
1200
|
+
++this.listenersCount, super.addEventListener(e, r);
|
|
1201
|
+
}
|
|
1202
|
+
removeEventListener(e, r) {
|
|
1203
|
+
--this.listenersCount, super.removeEventListener(e, r);
|
|
1204
|
+
}
|
|
1205
|
+
hasListeners() {
|
|
1206
|
+
return this.listenersCount > 0;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
function mt(t) {
|
|
1210
|
+
t.asm = {
|
|
1211
|
+
...t.asm
|
|
1212
|
+
};
|
|
1213
|
+
const e = new ft();
|
|
1214
|
+
for (const r in t.asm)
|
|
1215
|
+
if (typeof t.asm[r] == "function") {
|
|
1216
|
+
const s = t.asm[r];
|
|
1217
|
+
t.asm[r] = function(...n) {
|
|
1218
|
+
try {
|
|
1219
|
+
return s(...n);
|
|
1220
|
+
} catch (i) {
|
|
1221
|
+
if (!(i instanceof Error))
|
|
1222
|
+
throw i;
|
|
1223
|
+
if ("exitCode" in i && i?.exitCode === 0)
|
|
1224
|
+
return;
|
|
1225
|
+
const o = wt(
|
|
1226
|
+
i,
|
|
1227
|
+
t.lastAsyncifyStackSource?.stack
|
|
1228
|
+
);
|
|
1229
|
+
if (t.lastAsyncifyStackSource && (i.cause = t.lastAsyncifyStackSource), !e.hasListeners())
|
|
1230
|
+
throw bt(o), i;
|
|
1231
|
+
e.dispatchEvent(
|
|
1232
|
+
new pt("error", {
|
|
1233
|
+
error: i,
|
|
1234
|
+
message: o
|
|
1235
|
+
})
|
|
1236
|
+
);
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
return e;
|
|
1241
|
+
}
|
|
1242
|
+
let M = [];
|
|
1243
|
+
function gt() {
|
|
1244
|
+
return M;
|
|
1245
|
+
}
|
|
1246
|
+
function wt(t, e) {
|
|
1247
|
+
if (t.message === "unreachable") {
|
|
1248
|
+
let r = yt;
|
|
1249
|
+
e || (r += `
|
|
1250
|
+
|
|
1251
|
+
This stack trace is lacking. For a better one initialize
|
|
1252
|
+
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
1253
|
+
|
|
1254
|
+
`), M = _t(
|
|
1255
|
+
e || t.stack || ""
|
|
1256
|
+
);
|
|
1257
|
+
for (const s of M)
|
|
1258
|
+
r += ` * ${s}
|
|
1259
|
+
`;
|
|
1260
|
+
return r;
|
|
1261
|
+
}
|
|
1262
|
+
return t.message;
|
|
1263
|
+
}
|
|
1264
|
+
const yt = `
|
|
1265
|
+
"unreachable" WASM instruction executed.
|
|
1266
|
+
|
|
1267
|
+
The typical reason is a PHP function missing from the ASYNCIFY_ONLY
|
|
1268
|
+
list when building PHP.wasm.
|
|
1269
|
+
|
|
1270
|
+
You will need to file a new issue in the WordPress Playground repository
|
|
1271
|
+
and paste this error message there:
|
|
1272
|
+
|
|
1273
|
+
https://github.com/WordPress/wordpress-playground/issues/new
|
|
1274
|
+
|
|
1275
|
+
If you're a core developer, the typical fix is to:
|
|
1276
|
+
|
|
1277
|
+
* Isolate a minimal reproduction of the error
|
|
1278
|
+
* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository
|
|
1279
|
+
* Run 'npm run fix-asyncify'
|
|
1280
|
+
* Commit the changes, push to the repo, release updated NPM packages
|
|
1281
|
+
|
|
1282
|
+
Below is a list of all the PHP functions found in the stack trace to
|
|
1283
|
+
help with the minimal reproduction. If they're all already listed in
|
|
1284
|
+
the Dockerfile, you'll need to trigger this error again with long stack
|
|
1285
|
+
traces enabled. In node.js, you can do it using the --stack-trace-limit=100
|
|
1286
|
+
CLI option:
|
|
1287
|
+
|
|
1288
|
+
`, te = "\x1B[41m", Pt = "\x1B[1m", re = "\x1B[0m", se = "\x1B[K";
|
|
1289
|
+
let ne = !1;
|
|
1290
|
+
function bt(t) {
|
|
1291
|
+
if (!ne) {
|
|
1292
|
+
ne = !0, console.log(`${te}
|
|
1293
|
+
${se}
|
|
1294
|
+
${Pt} WASM ERROR${re}${te}`);
|
|
1295
|
+
for (const e of t.split(`
|
|
1296
|
+
`))
|
|
1297
|
+
console.log(`${se} ${e} `);
|
|
1298
|
+
console.log(`${re}`);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
function _t(t) {
|
|
1302
|
+
try {
|
|
1303
|
+
const e = t.split(`
|
|
1304
|
+
`).slice(1).map((r) => {
|
|
1305
|
+
const s = r.trim().substring(3).split(" ");
|
|
1306
|
+
return {
|
|
1307
|
+
fn: s.length >= 2 ? s[0] : "<unknown>",
|
|
1308
|
+
isWasm: r.includes("wasm://")
|
|
1309
|
+
};
|
|
1310
|
+
}).filter(
|
|
1311
|
+
({ fn: r, isWasm: s }) => s && !r.startsWith("dynCall_") && !r.startsWith("invoke_")
|
|
1312
|
+
).map(({ fn: r }) => r);
|
|
1313
|
+
return Array.from(new Set(e));
|
|
1314
|
+
} catch {
|
|
1315
|
+
return [];
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
var Et = Object.defineProperty, $t = Object.getOwnPropertyDescriptor, g = (t, e, r, s) => {
|
|
1319
|
+
for (var n = s > 1 ? void 0 : s ? $t(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1175
1320
|
(o = t[i]) && (n = (s ? o(e, r, n) : o(n)) || n);
|
|
1176
|
-
return s && n &&
|
|
1321
|
+
return s && n && Et(e, r, n), n;
|
|
1177
1322
|
};
|
|
1178
1323
|
const f = "string", _ = "number", h = Symbol("__private__dont__use");
|
|
1179
|
-
class
|
|
1324
|
+
class w {
|
|
1180
1325
|
/**
|
|
1181
1326
|
* Initializes a PHP runtime.
|
|
1182
1327
|
*
|
|
@@ -1185,12 +1330,13 @@ class g {
|
|
|
1185
1330
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
1186
1331
|
*/
|
|
1187
1332
|
constructor(e, r) {
|
|
1188
|
-
this.#e = [], this.#t = !1, e !== void 0 && this.initializeRuntime(e), r && (this.requestHandler = new
|
|
1189
|
-
new
|
|
1333
|
+
this.#e = [], this.#t = !1, this.#r = null, e !== void 0 && this.initializeRuntime(e), r && (this.requestHandler = new it(
|
|
1334
|
+
new ct(this, r)
|
|
1190
1335
|
));
|
|
1191
1336
|
}
|
|
1192
1337
|
#e;
|
|
1193
1338
|
#t;
|
|
1339
|
+
#r;
|
|
1194
1340
|
/** @inheritDoc */
|
|
1195
1341
|
get absoluteUrl() {
|
|
1196
1342
|
return this.requestHandler.requestHandler.absoluteUrl;
|
|
@@ -1212,10 +1358,10 @@ class g {
|
|
|
1212
1358
|
initializeRuntime(e) {
|
|
1213
1359
|
if (this[h])
|
|
1214
1360
|
throw new Error("PHP runtime already initialized.");
|
|
1215
|
-
const r =
|
|
1361
|
+
const r = dt(e);
|
|
1216
1362
|
if (!r)
|
|
1217
1363
|
throw new Error("Invalid PHP runtime id.");
|
|
1218
|
-
this[h] = r;
|
|
1364
|
+
this[h] = r, this.#r = mt(r);
|
|
1219
1365
|
}
|
|
1220
1366
|
/** @inheritDoc */
|
|
1221
1367
|
setPhpIniPath(e) {
|
|
@@ -1246,15 +1392,15 @@ class g {
|
|
|
1246
1392
|
}
|
|
1247
1393
|
/** @inheritDoc */
|
|
1248
1394
|
async run(e) {
|
|
1249
|
-
this.#t || (this.#n(), this.#t = !0), this.#
|
|
1395
|
+
this.#t || (this.#n(), this.#t = !0), this.#u(e.scriptPath || ""), this.#s(e.relativeUri || ""), this.#a(e.method || "GET");
|
|
1250
1396
|
const { host: r, ...s } = {
|
|
1251
1397
|
host: "example.com:443",
|
|
1252
|
-
...
|
|
1398
|
+
...me(e.headers || {})
|
|
1253
1399
|
};
|
|
1254
|
-
if (this.#
|
|
1400
|
+
if (this.#o(r, e.protocol || "http"), this.#c(s), e.body && this.#l(e.body), e.fileInfos)
|
|
1255
1401
|
for (const n of e.fileInfos)
|
|
1256
|
-
this.#
|
|
1257
|
-
return e.code && this.#
|
|
1402
|
+
this.#h(n);
|
|
1403
|
+
return e.code && this.#d(" ?>" + e.code), await this.#p();
|
|
1258
1404
|
}
|
|
1259
1405
|
#n() {
|
|
1260
1406
|
if (this.#e.length > 0) {
|
|
@@ -1271,7 +1417,7 @@ class g {
|
|
|
1271
1417
|
}
|
|
1272
1418
|
this[h].ccall("php_wasm_init", null, [], []);
|
|
1273
1419
|
}
|
|
1274
|
-
#
|
|
1420
|
+
#i() {
|
|
1275
1421
|
const e = "/tmp/headers.json";
|
|
1276
1422
|
if (!this.fileExists(e))
|
|
1277
1423
|
throw new Error(
|
|
@@ -1289,7 +1435,7 @@ class g {
|
|
|
1289
1435
|
httpStatusCode: r.status
|
|
1290
1436
|
};
|
|
1291
1437
|
}
|
|
1292
|
-
#
|
|
1438
|
+
#s(e) {
|
|
1293
1439
|
if (this[h].ccall(
|
|
1294
1440
|
"wasm_set_request_uri",
|
|
1295
1441
|
null,
|
|
@@ -1305,7 +1451,7 @@ class g {
|
|
|
1305
1451
|
);
|
|
1306
1452
|
}
|
|
1307
1453
|
}
|
|
1308
|
-
#
|
|
1454
|
+
#o(e, r) {
|
|
1309
1455
|
this[h].ccall(
|
|
1310
1456
|
"wasm_set_request_host",
|
|
1311
1457
|
null,
|
|
@@ -1324,7 +1470,7 @@ class g {
|
|
|
1324
1470
|
[s]
|
|
1325
1471
|
), (r === "https" || !r && s === 443) && this.addServerGlobalEntry("HTTPS", "on");
|
|
1326
1472
|
}
|
|
1327
|
-
#
|
|
1473
|
+
#a(e) {
|
|
1328
1474
|
this[h].ccall(
|
|
1329
1475
|
"wasm_set_request_method",
|
|
1330
1476
|
null,
|
|
@@ -1332,7 +1478,7 @@ class g {
|
|
|
1332
1478
|
[e]
|
|
1333
1479
|
);
|
|
1334
1480
|
}
|
|
1335
|
-
#
|
|
1481
|
+
#c(e) {
|
|
1336
1482
|
e.cookie && this[h].ccall(
|
|
1337
1483
|
"wasm_set_cookies",
|
|
1338
1484
|
null,
|
|
@@ -1355,7 +1501,7 @@ class g {
|
|
|
1355
1501
|
e[r]
|
|
1356
1502
|
);
|
|
1357
1503
|
}
|
|
1358
|
-
#
|
|
1504
|
+
#l(e) {
|
|
1359
1505
|
this[h].ccall(
|
|
1360
1506
|
"wasm_set_request_body",
|
|
1361
1507
|
null,
|
|
@@ -1365,10 +1511,10 @@ class g {
|
|
|
1365
1511
|
"wasm_set_content_length",
|
|
1366
1512
|
null,
|
|
1367
1513
|
[_],
|
|
1368
|
-
[e.length]
|
|
1514
|
+
[new TextEncoder().encode(e).length]
|
|
1369
1515
|
);
|
|
1370
1516
|
}
|
|
1371
|
-
#
|
|
1517
|
+
#u(e) {
|
|
1372
1518
|
this[h].ccall(
|
|
1373
1519
|
"wasm_set_path_translated",
|
|
1374
1520
|
null,
|
|
@@ -1393,7 +1539,7 @@ class g {
|
|
|
1393
1539
|
*
|
|
1394
1540
|
* @param fileInfo - File details
|
|
1395
1541
|
*/
|
|
1396
|
-
#
|
|
1542
|
+
#h(e) {
|
|
1397
1543
|
const { key: r, name: s, type: n, data: i } = e, o = `/tmp/${Math.random().toFixed(20)}`;
|
|
1398
1544
|
this.writeFile(o, i);
|
|
1399
1545
|
const a = 0;
|
|
@@ -1404,7 +1550,7 @@ class g {
|
|
|
1404
1550
|
[r, s, n, o, a, i.byteLength]
|
|
1405
1551
|
);
|
|
1406
1552
|
}
|
|
1407
|
-
#
|
|
1553
|
+
#d(e) {
|
|
1408
1554
|
this[h].ccall(
|
|
1409
1555
|
"wasm_set_php_code",
|
|
1410
1556
|
null,
|
|
@@ -1412,16 +1558,53 @@ class g {
|
|
|
1412
1558
|
[e]
|
|
1413
1559
|
);
|
|
1414
1560
|
}
|
|
1415
|
-
async #
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1561
|
+
async #p() {
|
|
1562
|
+
let e, r;
|
|
1563
|
+
try {
|
|
1564
|
+
e = await new Promise(async (i, o) => {
|
|
1565
|
+
r = (a) => {
|
|
1566
|
+
const c = new Error("Rethrown");
|
|
1567
|
+
c.cause = a.error, c.betterMessage = a.message, o(c);
|
|
1568
|
+
}, this.#r?.addEventListener(
|
|
1569
|
+
"error",
|
|
1570
|
+
r
|
|
1571
|
+
);
|
|
1572
|
+
try {
|
|
1573
|
+
i(
|
|
1574
|
+
/**
|
|
1575
|
+
* This is awkward, but Asyncify makes wasm_sapi_handle_request return
|
|
1576
|
+
* Promise<Promise<number>>.
|
|
1577
|
+
*
|
|
1578
|
+
* @TODO: Determine whether this is a bug in emscripten or in our code.
|
|
1579
|
+
*/
|
|
1580
|
+
await await this[h].ccall(
|
|
1581
|
+
"wasm_sapi_handle_request",
|
|
1582
|
+
_,
|
|
1583
|
+
[],
|
|
1584
|
+
[]
|
|
1585
|
+
)
|
|
1586
|
+
);
|
|
1587
|
+
} catch (a) {
|
|
1588
|
+
o(a);
|
|
1589
|
+
}
|
|
1590
|
+
});
|
|
1591
|
+
} catch (i) {
|
|
1592
|
+
for (const l in this)
|
|
1593
|
+
typeof this[l] == "function" && (this[l] = () => {
|
|
1594
|
+
throw new Error(
|
|
1595
|
+
"PHP runtime has crashed – see the earlier error for details."
|
|
1596
|
+
);
|
|
1597
|
+
});
|
|
1598
|
+
this.functionsMaybeMissingFromAsyncify = gt();
|
|
1599
|
+
const o = i, a = "betterMessage" in o ? o.betterMessage : o.message, c = new Error(a);
|
|
1600
|
+
throw c.cause = o, c;
|
|
1601
|
+
} finally {
|
|
1602
|
+
this.#r?.removeEventListener("error", r);
|
|
1603
|
+
}
|
|
1604
|
+
const { headers: s, httpStatusCode: n } = this.#i();
|
|
1422
1605
|
return new v(
|
|
1606
|
+
n,
|
|
1423
1607
|
s,
|
|
1424
|
-
r,
|
|
1425
1608
|
this.readFileAsBuffer("/tmp/stdout"),
|
|
1426
1609
|
this.readFileAsText("/tmp/stderr"),
|
|
1427
1610
|
e
|
|
@@ -1478,54 +1661,54 @@ class g {
|
|
|
1478
1661
|
}
|
|
1479
1662
|
}
|
|
1480
1663
|
}
|
|
1481
|
-
|
|
1664
|
+
g([
|
|
1482
1665
|
m('Could not create directory "{path}"')
|
|
1483
|
-
],
|
|
1484
|
-
|
|
1666
|
+
], w.prototype, "mkdir", 1);
|
|
1667
|
+
g([
|
|
1485
1668
|
m('Could not create directory "{path}"')
|
|
1486
|
-
],
|
|
1487
|
-
|
|
1669
|
+
], w.prototype, "mkdirTree", 1);
|
|
1670
|
+
g([
|
|
1488
1671
|
m('Could not read "{path}"')
|
|
1489
|
-
],
|
|
1490
|
-
|
|
1672
|
+
], w.prototype, "readFileAsText", 1);
|
|
1673
|
+
g([
|
|
1491
1674
|
m('Could not read "{path}"')
|
|
1492
|
-
],
|
|
1493
|
-
|
|
1675
|
+
], w.prototype, "readFileAsBuffer", 1);
|
|
1676
|
+
g([
|
|
1494
1677
|
m('Could not write to "{path}"')
|
|
1495
|
-
],
|
|
1496
|
-
|
|
1678
|
+
], w.prototype, "writeFile", 1);
|
|
1679
|
+
g([
|
|
1497
1680
|
m('Could not unlink "{path}"')
|
|
1498
|
-
],
|
|
1499
|
-
|
|
1681
|
+
], w.prototype, "unlink", 1);
|
|
1682
|
+
g([
|
|
1500
1683
|
m('Could not move "{path}"')
|
|
1501
|
-
],
|
|
1502
|
-
|
|
1684
|
+
], w.prototype, "mv", 1);
|
|
1685
|
+
g([
|
|
1503
1686
|
m('Could not remove directory "{path}"')
|
|
1504
|
-
],
|
|
1505
|
-
|
|
1687
|
+
], w.prototype, "rmdir", 1);
|
|
1688
|
+
g([
|
|
1506
1689
|
m('Could not list files in "{path}"')
|
|
1507
|
-
],
|
|
1508
|
-
|
|
1690
|
+
], w.prototype, "listFiles", 1);
|
|
1691
|
+
g([
|
|
1509
1692
|
m('Could not stat "{path}"')
|
|
1510
|
-
],
|
|
1511
|
-
|
|
1693
|
+
], w.prototype, "isDir", 1);
|
|
1694
|
+
g([
|
|
1512
1695
|
m('Could not stat "{path}"')
|
|
1513
|
-
],
|
|
1514
|
-
function
|
|
1696
|
+
], w.prototype, "fileExists", 1);
|
|
1697
|
+
function me(t) {
|
|
1515
1698
|
const e = {};
|
|
1516
1699
|
for (const r in t)
|
|
1517
1700
|
e[r.toLowerCase()] = t[r];
|
|
1518
1701
|
return e;
|
|
1519
1702
|
}
|
|
1520
|
-
const
|
|
1703
|
+
const vt = [
|
|
1521
1704
|
"vfs",
|
|
1522
1705
|
"literal",
|
|
1523
1706
|
"wordpress.org/themes",
|
|
1524
1707
|
"wordpress.org/plugins",
|
|
1525
1708
|
"url"
|
|
1526
1709
|
];
|
|
1527
|
-
function
|
|
1528
|
-
return t && typeof t == "object" && typeof t.resource == "string" &&
|
|
1710
|
+
function St(t) {
|
|
1711
|
+
return t && typeof t == "object" && typeof t.resource == "string" && vt.includes(t.resource);
|
|
1529
1712
|
}
|
|
1530
1713
|
class b {
|
|
1531
1714
|
/**
|
|
@@ -1539,24 +1722,24 @@ class b {
|
|
|
1539
1722
|
let n;
|
|
1540
1723
|
switch (e.resource) {
|
|
1541
1724
|
case "vfs":
|
|
1542
|
-
n = new
|
|
1725
|
+
n = new Rt(e, s);
|
|
1543
1726
|
break;
|
|
1544
1727
|
case "literal":
|
|
1545
|
-
n = new
|
|
1728
|
+
n = new xt(e, s);
|
|
1546
1729
|
break;
|
|
1547
1730
|
case "wordpress.org/themes":
|
|
1548
|
-
n = new
|
|
1731
|
+
n = new kt(e, s);
|
|
1549
1732
|
break;
|
|
1550
1733
|
case "wordpress.org/plugins":
|
|
1551
|
-
n = new
|
|
1734
|
+
n = new Ft(e, s);
|
|
1552
1735
|
break;
|
|
1553
1736
|
case "url":
|
|
1554
|
-
n = new
|
|
1737
|
+
n = new Ct(e, s);
|
|
1555
1738
|
break;
|
|
1556
1739
|
default:
|
|
1557
1740
|
throw new Error(`Invalid resource: ${e}`);
|
|
1558
1741
|
}
|
|
1559
|
-
return n = new
|
|
1742
|
+
return n = new Lt(n), r && (n = new At(n, r)), n;
|
|
1560
1743
|
}
|
|
1561
1744
|
setPlayground(e) {
|
|
1562
1745
|
this.playground = e;
|
|
@@ -1566,7 +1749,7 @@ class b {
|
|
|
1566
1749
|
return !1;
|
|
1567
1750
|
}
|
|
1568
1751
|
}
|
|
1569
|
-
class
|
|
1752
|
+
class Rt extends b {
|
|
1570
1753
|
/**
|
|
1571
1754
|
* Creates a new instance of `VFSResource`.
|
|
1572
1755
|
* @param playground The playground client.
|
|
@@ -1588,7 +1771,7 @@ class lt extends b {
|
|
|
1588
1771
|
return this.resource.path;
|
|
1589
1772
|
}
|
|
1590
1773
|
}
|
|
1591
|
-
class
|
|
1774
|
+
class xt extends b {
|
|
1592
1775
|
/**
|
|
1593
1776
|
* Creates a new instance of `LiteralResource`.
|
|
1594
1777
|
* @param resource The literal reference.
|
|
@@ -1619,9 +1802,9 @@ class q extends b {
|
|
|
1619
1802
|
this.progress?.setCaption(this.caption);
|
|
1620
1803
|
const e = this.getURL();
|
|
1621
1804
|
let r = await fetch(e);
|
|
1622
|
-
if (r = await
|
|
1805
|
+
if (r = await st(
|
|
1623
1806
|
r,
|
|
1624
|
-
this.progress?.loadingListener ??
|
|
1807
|
+
this.progress?.loadingListener ?? Tt
|
|
1625
1808
|
), r.status !== 200)
|
|
1626
1809
|
throw new Error(`Could not download "${e}"`);
|
|
1627
1810
|
return new File([await r.blob()], this.name);
|
|
@@ -1635,16 +1818,20 @@ class q extends b {
|
|
|
1635
1818
|
}
|
|
1636
1819
|
/** @inheritDoc */
|
|
1637
1820
|
get name() {
|
|
1638
|
-
|
|
1821
|
+
try {
|
|
1822
|
+
return new URL(this.getURL(), "http://example.com").pathname.split("/").pop();
|
|
1823
|
+
} catch {
|
|
1824
|
+
return this.getURL();
|
|
1825
|
+
}
|
|
1639
1826
|
}
|
|
1640
1827
|
/** @inheritDoc */
|
|
1641
1828
|
get isAsync() {
|
|
1642
1829
|
return !0;
|
|
1643
1830
|
}
|
|
1644
1831
|
}
|
|
1645
|
-
const
|
|
1832
|
+
const Tt = () => {
|
|
1646
1833
|
};
|
|
1647
|
-
class
|
|
1834
|
+
class Ct extends q {
|
|
1648
1835
|
/**
|
|
1649
1836
|
* Creates a new instance of `UrlResource`.
|
|
1650
1837
|
* @param resource The URL reference.
|
|
@@ -1662,40 +1849,40 @@ class dt extends q {
|
|
|
1662
1849
|
return this.resource.caption ?? super.caption;
|
|
1663
1850
|
}
|
|
1664
1851
|
}
|
|
1665
|
-
let
|
|
1666
|
-
function
|
|
1667
|
-
|
|
1852
|
+
let B = "https://playground.wordpress.net/plugin-proxy";
|
|
1853
|
+
function rr(t) {
|
|
1854
|
+
B = t;
|
|
1668
1855
|
}
|
|
1669
|
-
class
|
|
1856
|
+
class kt extends q {
|
|
1670
1857
|
constructor(e, r) {
|
|
1671
1858
|
super(r), this.resource = e;
|
|
1672
1859
|
}
|
|
1673
1860
|
get name() {
|
|
1674
|
-
return
|
|
1861
|
+
return O(this.resource.slug);
|
|
1675
1862
|
}
|
|
1676
1863
|
getURL() {
|
|
1677
|
-
const e =
|
|
1678
|
-
return `${
|
|
1864
|
+
const e = ge(this.resource.slug);
|
|
1865
|
+
return `${B}?theme=` + e;
|
|
1679
1866
|
}
|
|
1680
1867
|
}
|
|
1681
|
-
class
|
|
1868
|
+
class Ft extends q {
|
|
1682
1869
|
constructor(e, r) {
|
|
1683
1870
|
super(r), this.resource = e;
|
|
1684
1871
|
}
|
|
1685
1872
|
/** @inheritDoc */
|
|
1686
1873
|
get name() {
|
|
1687
|
-
return
|
|
1874
|
+
return O(this.resource.slug);
|
|
1688
1875
|
}
|
|
1689
1876
|
/** @inheritDoc */
|
|
1690
1877
|
getURL() {
|
|
1691
|
-
const e =
|
|
1692
|
-
return `${
|
|
1878
|
+
const e = ge(this.resource.slug);
|
|
1879
|
+
return `${B}?plugin=` + e;
|
|
1693
1880
|
}
|
|
1694
1881
|
}
|
|
1695
|
-
function
|
|
1882
|
+
function ge(t) {
|
|
1696
1883
|
return !t || t.endsWith(".zip") ? t : t + ".latest-stable.zip";
|
|
1697
1884
|
}
|
|
1698
|
-
class
|
|
1885
|
+
class we extends b {
|
|
1699
1886
|
constructor(e) {
|
|
1700
1887
|
super(), this.resource = e;
|
|
1701
1888
|
}
|
|
@@ -1724,13 +1911,13 @@ class le extends b {
|
|
|
1724
1911
|
return this.resource.isAsync;
|
|
1725
1912
|
}
|
|
1726
1913
|
}
|
|
1727
|
-
class
|
|
1914
|
+
class Lt extends we {
|
|
1728
1915
|
/** @inheritDoc */
|
|
1729
1916
|
async resolve() {
|
|
1730
1917
|
return this.promise || (this.promise = super.resolve()), this.promise;
|
|
1731
1918
|
}
|
|
1732
1919
|
}
|
|
1733
|
-
class
|
|
1920
|
+
class At extends we {
|
|
1734
1921
|
constructor(e, r) {
|
|
1735
1922
|
super(e), this.semaphore = r;
|
|
1736
1923
|
}
|
|
@@ -1739,18 +1926,18 @@ class wt extends le {
|
|
|
1739
1926
|
return this.isAsync ? this.semaphore.run(() => super.resolve()) : super.resolve();
|
|
1740
1927
|
}
|
|
1741
1928
|
}
|
|
1742
|
-
const
|
|
1743
|
-
function
|
|
1744
|
-
progress: e = new
|
|
1745
|
-
semaphore: r = new
|
|
1929
|
+
const Ot = ["6.2", "6.1", "6.0", "5.9"];
|
|
1930
|
+
function Ut(t, {
|
|
1931
|
+
progress: e = new U(),
|
|
1932
|
+
semaphore: r = new he({ concurrency: 3 }),
|
|
1746
1933
|
onStepCompleted: s = () => {
|
|
1747
1934
|
}
|
|
1748
1935
|
} = {}) {
|
|
1749
|
-
const n = (t.steps || []).filter(
|
|
1750
|
-
(a,
|
|
1936
|
+
const n = (t.steps || []).filter(Ht), i = n.reduce(
|
|
1937
|
+
(a, c) => a + (c.progress?.weight || 1),
|
|
1751
1938
|
0
|
|
1752
1939
|
), o = n.map(
|
|
1753
|
-
(a) =>
|
|
1940
|
+
(a) => It(a, {
|
|
1754
1941
|
semaphore: r,
|
|
1755
1942
|
rootProgressTracker: e,
|
|
1756
1943
|
totalProgressWeight: i
|
|
@@ -1758,25 +1945,25 @@ function yt(t, {
|
|
|
1758
1945
|
);
|
|
1759
1946
|
return {
|
|
1760
1947
|
versions: {
|
|
1761
|
-
php:
|
|
1948
|
+
php: ie(
|
|
1762
1949
|
t.preferredVersions?.php,
|
|
1763
|
-
|
|
1764
|
-
|
|
1950
|
+
D,
|
|
1951
|
+
nt
|
|
1765
1952
|
),
|
|
1766
|
-
wp:
|
|
1953
|
+
wp: ie(
|
|
1767
1954
|
t.preferredVersions?.wp,
|
|
1768
|
-
|
|
1955
|
+
Ot,
|
|
1769
1956
|
"6.2"
|
|
1770
1957
|
)
|
|
1771
1958
|
},
|
|
1772
1959
|
run: async (a) => {
|
|
1773
1960
|
try {
|
|
1774
|
-
for (const { resources:
|
|
1775
|
-
for (const
|
|
1776
|
-
|
|
1777
|
-
for (const { run:
|
|
1778
|
-
const u = await
|
|
1779
|
-
s(u,
|
|
1961
|
+
for (const { resources: c } of o)
|
|
1962
|
+
for (const l of c)
|
|
1963
|
+
l.setPlayground(a), l.isAsync && l.resolve();
|
|
1964
|
+
for (const { run: c, step: l } of o) {
|
|
1965
|
+
const u = await c(a);
|
|
1966
|
+
s(u, l);
|
|
1780
1967
|
}
|
|
1781
1968
|
try {
|
|
1782
1969
|
await a.goTo(
|
|
@@ -1790,13 +1977,13 @@ function yt(t, {
|
|
|
1790
1977
|
}
|
|
1791
1978
|
};
|
|
1792
1979
|
}
|
|
1793
|
-
function
|
|
1980
|
+
function ie(t, e, r) {
|
|
1794
1981
|
return t && e.includes(t) ? t : r;
|
|
1795
1982
|
}
|
|
1796
|
-
function
|
|
1983
|
+
function Ht(t) {
|
|
1797
1984
|
return !!(typeof t == "object" && t);
|
|
1798
1985
|
}
|
|
1799
|
-
function
|
|
1986
|
+
function It(t, {
|
|
1800
1987
|
semaphore: e,
|
|
1801
1988
|
rootProgressTracker: r,
|
|
1802
1989
|
totalProgressWeight: s
|
|
@@ -1806,15 +1993,15 @@ function bt(t, {
|
|
|
1806
1993
|
), i = {};
|
|
1807
1994
|
for (const u of Object.keys(t)) {
|
|
1808
1995
|
let d = t[u];
|
|
1809
|
-
|
|
1996
|
+
St(d) && (d = b.create(d, {
|
|
1810
1997
|
semaphore: e
|
|
1811
1998
|
})), i[u] = d;
|
|
1812
1999
|
}
|
|
1813
2000
|
const o = async (u) => {
|
|
1814
2001
|
try {
|
|
1815
|
-
return n.fillSlowly(), await
|
|
2002
|
+
return n.fillSlowly(), await tt[t.step](
|
|
1816
2003
|
u,
|
|
1817
|
-
await
|
|
2004
|
+
await Mt(i),
|
|
1818
2005
|
{
|
|
1819
2006
|
tracker: n,
|
|
1820
2007
|
initialCaption: t.progress?.caption
|
|
@@ -1823,14 +2010,14 @@ function bt(t, {
|
|
|
1823
2010
|
} finally {
|
|
1824
2011
|
n.finish();
|
|
1825
2012
|
}
|
|
1826
|
-
}, a =
|
|
2013
|
+
}, a = oe(i), c = oe(i).filter(
|
|
1827
2014
|
(u) => u.isAsync
|
|
1828
|
-
),
|
|
1829
|
-
for (const u of
|
|
1830
|
-
u.progress = n.stage(
|
|
2015
|
+
), l = 1 / (c.length + 1);
|
|
2016
|
+
for (const u of c)
|
|
2017
|
+
u.progress = n.stage(l);
|
|
1831
2018
|
return { run: o, step: t, resources: a };
|
|
1832
2019
|
}
|
|
1833
|
-
function
|
|
2020
|
+
function oe(t) {
|
|
1834
2021
|
const e = [];
|
|
1835
2022
|
for (const r in t) {
|
|
1836
2023
|
const s = t[r];
|
|
@@ -1838,7 +2025,7 @@ function X(t) {
|
|
|
1838
2025
|
}
|
|
1839
2026
|
return e;
|
|
1840
2027
|
}
|
|
1841
|
-
async function
|
|
2028
|
+
async function Mt(t) {
|
|
1842
2029
|
const e = {};
|
|
1843
2030
|
for (const r in t) {
|
|
1844
2031
|
const s = t[r];
|
|
@@ -1846,7 +2033,7 @@ async function _t(t) {
|
|
|
1846
2033
|
}
|
|
1847
2034
|
return e;
|
|
1848
2035
|
}
|
|
1849
|
-
async function
|
|
2036
|
+
async function Nt(t, e) {
|
|
1850
2037
|
await t.run(e);
|
|
1851
2038
|
}
|
|
1852
2039
|
/**
|
|
@@ -1854,17 +2041,17 @@ async function $t(t, e) {
|
|
|
1854
2041
|
* Copyright 2019 Google LLC
|
|
1855
2042
|
* SPDX-License-Identifier: Apache-2.0
|
|
1856
2043
|
*/
|
|
1857
|
-
const
|
|
1858
|
-
canHandle: (t) =>
|
|
2044
|
+
const ye = Symbol("Comlink.proxy"), Wt = Symbol("Comlink.endpoint"), Dt = Symbol("Comlink.releaseProxy"), I = Symbol("Comlink.finalizer"), C = Symbol("Comlink.thrown"), Pe = (t) => typeof t == "object" && t !== null || typeof t == "function", zt = {
|
|
2045
|
+
canHandle: (t) => Pe(t) && t[ye],
|
|
1859
2046
|
serialize(t) {
|
|
1860
2047
|
const { port1: e, port2: r } = new MessageChannel();
|
|
1861
|
-
return
|
|
2048
|
+
return j(t, e), [r, [r]];
|
|
1862
2049
|
},
|
|
1863
2050
|
deserialize(t) {
|
|
1864
|
-
return t.start(),
|
|
2051
|
+
return t.start(), V(t);
|
|
1865
2052
|
}
|
|
1866
|
-
},
|
|
1867
|
-
canHandle: (t) =>
|
|
2053
|
+
}, qt = {
|
|
2054
|
+
canHandle: (t) => Pe(t) && C in t,
|
|
1868
2055
|
serialize({ value: t }) {
|
|
1869
2056
|
let e;
|
|
1870
2057
|
return t instanceof Error ? e = {
|
|
@@ -1880,63 +2067,63 @@ const ue = Symbol("Comlink.proxy"), St = Symbol("Comlink.endpoint"), vt = Symbol
|
|
|
1880
2067
|
throw t.isError ? Object.assign(new Error(t.value.message), t.value) : t.value;
|
|
1881
2068
|
}
|
|
1882
2069
|
}, R = /* @__PURE__ */ new Map([
|
|
1883
|
-
["proxy",
|
|
1884
|
-
["throw",
|
|
2070
|
+
["proxy", zt],
|
|
2071
|
+
["throw", qt]
|
|
1885
2072
|
]);
|
|
1886
|
-
function
|
|
2073
|
+
function Bt(t, e) {
|
|
1887
2074
|
for (const r of t)
|
|
1888
2075
|
if (e === r || r === "*" || r instanceof RegExp && r.test(e))
|
|
1889
2076
|
return !0;
|
|
1890
2077
|
return !1;
|
|
1891
2078
|
}
|
|
1892
|
-
function
|
|
2079
|
+
function j(t, e = globalThis, r = ["*"]) {
|
|
1893
2080
|
e.addEventListener("message", function s(n) {
|
|
1894
2081
|
if (!n || !n.data)
|
|
1895
2082
|
return;
|
|
1896
|
-
if (!
|
|
2083
|
+
if (!Bt(r, n.origin)) {
|
|
1897
2084
|
console.warn(`Invalid origin '${n.origin}' for comlink proxy`);
|
|
1898
2085
|
return;
|
|
1899
2086
|
}
|
|
1900
|
-
const { id: i, type: o, path: a } = Object.assign({ path: [] }, n.data),
|
|
1901
|
-
let
|
|
2087
|
+
const { id: i, type: o, path: a } = Object.assign({ path: [] }, n.data), c = (n.data.argumentList || []).map(P);
|
|
2088
|
+
let l;
|
|
1902
2089
|
try {
|
|
1903
2090
|
const u = a.slice(0, -1).reduce((p, y) => p[y], t), d = a.reduce((p, y) => p[y], t);
|
|
1904
2091
|
switch (o) {
|
|
1905
2092
|
case "GET":
|
|
1906
|
-
|
|
2093
|
+
l = d;
|
|
1907
2094
|
break;
|
|
1908
2095
|
case "SET":
|
|
1909
|
-
u[a.slice(-1)[0]] = P(n.data.value),
|
|
2096
|
+
u[a.slice(-1)[0]] = P(n.data.value), l = !0;
|
|
1910
2097
|
break;
|
|
1911
2098
|
case "APPLY":
|
|
1912
|
-
|
|
2099
|
+
l = d.apply(u, c);
|
|
1913
2100
|
break;
|
|
1914
2101
|
case "CONSTRUCT":
|
|
1915
2102
|
{
|
|
1916
|
-
const p = new d(...
|
|
1917
|
-
|
|
2103
|
+
const p = new d(...c);
|
|
2104
|
+
l = $e(p);
|
|
1918
2105
|
}
|
|
1919
2106
|
break;
|
|
1920
2107
|
case "ENDPOINT":
|
|
1921
2108
|
{
|
|
1922
2109
|
const { port1: p, port2: y } = new MessageChannel();
|
|
1923
|
-
|
|
2110
|
+
j(t, y), l = Jt(p, [p]);
|
|
1924
2111
|
}
|
|
1925
2112
|
break;
|
|
1926
2113
|
case "RELEASE":
|
|
1927
|
-
|
|
2114
|
+
l = void 0;
|
|
1928
2115
|
break;
|
|
1929
2116
|
default:
|
|
1930
2117
|
return;
|
|
1931
2118
|
}
|
|
1932
2119
|
} catch (u) {
|
|
1933
|
-
|
|
2120
|
+
l = { value: u, [C]: 0 };
|
|
1934
2121
|
}
|
|
1935
|
-
Promise.resolve(
|
|
1936
|
-
const [d, p] =
|
|
1937
|
-
e.postMessage(Object.assign(Object.assign({}, d), { id: i }), p), o === "RELEASE" && (e.removeEventListener("message", s),
|
|
2122
|
+
Promise.resolve(l).catch((u) => ({ value: u, [C]: 0 })).then((u) => {
|
|
2123
|
+
const [d, p] = A(u);
|
|
2124
|
+
e.postMessage(Object.assign(Object.assign({}, d), { id: i }), p), o === "RELEASE" && (e.removeEventListener("message", s), be(e), I in t && typeof t[I] == "function" && t[I]());
|
|
1938
2125
|
}).catch((u) => {
|
|
1939
|
-
const [d, p] =
|
|
2126
|
+
const [d, p] = A({
|
|
1940
2127
|
value: new TypeError("Unserializable return value"),
|
|
1941
2128
|
[C]: 0
|
|
1942
2129
|
});
|
|
@@ -1944,116 +2131,116 @@ function M(t, e = globalThis, r = ["*"]) {
|
|
|
1944
2131
|
});
|
|
1945
2132
|
}), e.start && e.start();
|
|
1946
2133
|
}
|
|
1947
|
-
function
|
|
2134
|
+
function jt(t) {
|
|
1948
2135
|
return t.constructor.name === "MessagePort";
|
|
1949
2136
|
}
|
|
1950
|
-
function
|
|
1951
|
-
|
|
2137
|
+
function be(t) {
|
|
2138
|
+
jt(t) && t.close();
|
|
1952
2139
|
}
|
|
1953
|
-
function
|
|
2140
|
+
function V(t, e) {
|
|
1954
2141
|
return N(t, [], e);
|
|
1955
2142
|
}
|
|
1956
|
-
function
|
|
2143
|
+
function T(t) {
|
|
1957
2144
|
if (t)
|
|
1958
2145
|
throw new Error("Proxy has been released and is not useable");
|
|
1959
2146
|
}
|
|
1960
|
-
function
|
|
1961
|
-
return
|
|
2147
|
+
function _e(t) {
|
|
2148
|
+
return E(t, {
|
|
1962
2149
|
type: "RELEASE"
|
|
1963
2150
|
}).then(() => {
|
|
1964
|
-
|
|
2151
|
+
be(t);
|
|
1965
2152
|
});
|
|
1966
2153
|
}
|
|
1967
|
-
const
|
|
1968
|
-
const e = (
|
|
1969
|
-
|
|
2154
|
+
const F = /* @__PURE__ */ new WeakMap(), L = "FinalizationRegistry" in globalThis && new FinalizationRegistry((t) => {
|
|
2155
|
+
const e = (F.get(t) || 0) - 1;
|
|
2156
|
+
F.set(t, e), e === 0 && _e(t);
|
|
1970
2157
|
});
|
|
1971
|
-
function
|
|
1972
|
-
const r = (
|
|
1973
|
-
|
|
2158
|
+
function Vt(t, e) {
|
|
2159
|
+
const r = (F.get(e) || 0) + 1;
|
|
2160
|
+
F.set(e, r), L && L.register(t, e, t);
|
|
1974
2161
|
}
|
|
1975
|
-
function
|
|
1976
|
-
|
|
2162
|
+
function Gt(t) {
|
|
2163
|
+
L && L.unregister(t);
|
|
1977
2164
|
}
|
|
1978
2165
|
function N(t, e = [], r = function() {
|
|
1979
2166
|
}) {
|
|
1980
2167
|
let s = !1;
|
|
1981
2168
|
const n = new Proxy(r, {
|
|
1982
2169
|
get(i, o) {
|
|
1983
|
-
if (
|
|
2170
|
+
if (T(s), o === Dt)
|
|
1984
2171
|
return () => {
|
|
1985
|
-
|
|
2172
|
+
Gt(n), _e(t), s = !0;
|
|
1986
2173
|
};
|
|
1987
2174
|
if (o === "then") {
|
|
1988
2175
|
if (e.length === 0)
|
|
1989
2176
|
return { then: () => n };
|
|
1990
|
-
const a =
|
|
2177
|
+
const a = E(t, {
|
|
1991
2178
|
type: "GET",
|
|
1992
|
-
path: e.map((
|
|
2179
|
+
path: e.map((c) => c.toString())
|
|
1993
2180
|
}).then(P);
|
|
1994
2181
|
return a.then.bind(a);
|
|
1995
2182
|
}
|
|
1996
2183
|
return N(t, [...e, o]);
|
|
1997
2184
|
},
|
|
1998
2185
|
set(i, o, a) {
|
|
1999
|
-
|
|
2000
|
-
const [
|
|
2001
|
-
return
|
|
2186
|
+
T(s);
|
|
2187
|
+
const [c, l] = A(a);
|
|
2188
|
+
return E(t, {
|
|
2002
2189
|
type: "SET",
|
|
2003
2190
|
path: [...e, o].map((u) => u.toString()),
|
|
2004
|
-
value:
|
|
2005
|
-
},
|
|
2191
|
+
value: c
|
|
2192
|
+
}, l).then(P);
|
|
2006
2193
|
},
|
|
2007
2194
|
apply(i, o, a) {
|
|
2008
|
-
|
|
2009
|
-
const
|
|
2010
|
-
if (
|
|
2011
|
-
return
|
|
2195
|
+
T(s);
|
|
2196
|
+
const c = e[e.length - 1];
|
|
2197
|
+
if (c === Wt)
|
|
2198
|
+
return E(t, {
|
|
2012
2199
|
type: "ENDPOINT"
|
|
2013
2200
|
}).then(P);
|
|
2014
|
-
if (
|
|
2201
|
+
if (c === "bind")
|
|
2015
2202
|
return N(t, e.slice(0, -1));
|
|
2016
|
-
const [
|
|
2017
|
-
return
|
|
2203
|
+
const [l, u] = ae(a);
|
|
2204
|
+
return E(t, {
|
|
2018
2205
|
type: "APPLY",
|
|
2019
2206
|
path: e.map((d) => d.toString()),
|
|
2020
|
-
argumentList:
|
|
2207
|
+
argumentList: l
|
|
2021
2208
|
}, u).then(P);
|
|
2022
2209
|
},
|
|
2023
2210
|
construct(i, o) {
|
|
2024
|
-
|
|
2025
|
-
const [a,
|
|
2026
|
-
return
|
|
2211
|
+
T(s);
|
|
2212
|
+
const [a, c] = ae(o);
|
|
2213
|
+
return E(t, {
|
|
2027
2214
|
type: "CONSTRUCT",
|
|
2028
|
-
path: e.map((
|
|
2215
|
+
path: e.map((l) => l.toString()),
|
|
2029
2216
|
argumentList: a
|
|
2030
|
-
},
|
|
2217
|
+
}, c).then(P);
|
|
2031
2218
|
}
|
|
2032
2219
|
});
|
|
2033
|
-
return
|
|
2220
|
+
return Vt(n, t), n;
|
|
2034
2221
|
}
|
|
2035
|
-
function
|
|
2222
|
+
function Yt(t) {
|
|
2036
2223
|
return Array.prototype.concat.apply([], t);
|
|
2037
2224
|
}
|
|
2038
|
-
function
|
|
2039
|
-
const e = t.map(
|
|
2040
|
-
return [e.map((r) => r[0]),
|
|
2225
|
+
function ae(t) {
|
|
2226
|
+
const e = t.map(A);
|
|
2227
|
+
return [e.map((r) => r[0]), Yt(e.map((r) => r[1]))];
|
|
2041
2228
|
}
|
|
2042
|
-
const
|
|
2043
|
-
function
|
|
2044
|
-
return
|
|
2229
|
+
const Ee = /* @__PURE__ */ new WeakMap();
|
|
2230
|
+
function Jt(t, e) {
|
|
2231
|
+
return Ee.set(t, e), t;
|
|
2045
2232
|
}
|
|
2046
|
-
function
|
|
2047
|
-
return Object.assign(t, { [
|
|
2233
|
+
function $e(t) {
|
|
2234
|
+
return Object.assign(t, { [ye]: !0 });
|
|
2048
2235
|
}
|
|
2049
|
-
function
|
|
2236
|
+
function Kt(t, e = globalThis, r = "*") {
|
|
2050
2237
|
return {
|
|
2051
2238
|
postMessage: (s, n) => t.postMessage(s, r, n),
|
|
2052
2239
|
addEventListener: e.addEventListener.bind(e),
|
|
2053
2240
|
removeEventListener: e.removeEventListener.bind(e)
|
|
2054
2241
|
};
|
|
2055
2242
|
}
|
|
2056
|
-
function
|
|
2243
|
+
function A(t) {
|
|
2057
2244
|
for (const [e, r] of R)
|
|
2058
2245
|
if (r.canHandle(t)) {
|
|
2059
2246
|
const [s, n] = r.serialize(t);
|
|
@@ -2071,7 +2258,7 @@ function U(t) {
|
|
|
2071
2258
|
type: "RAW",
|
|
2072
2259
|
value: t
|
|
2073
2260
|
},
|
|
2074
|
-
|
|
2261
|
+
Ee.get(t) || []
|
|
2075
2262
|
];
|
|
2076
2263
|
}
|
|
2077
2264
|
function P(t) {
|
|
@@ -2082,27 +2269,27 @@ function P(t) {
|
|
|
2082
2269
|
return t.value;
|
|
2083
2270
|
}
|
|
2084
2271
|
}
|
|
2085
|
-
function
|
|
2272
|
+
function E(t, e, r) {
|
|
2086
2273
|
return new Promise((s) => {
|
|
2087
|
-
const n =
|
|
2274
|
+
const n = Qt();
|
|
2088
2275
|
t.addEventListener("message", function i(o) {
|
|
2089
2276
|
!o.data || !o.data.id || o.data.id !== n || (t.removeEventListener("message", i), s(o.data));
|
|
2090
2277
|
}), t.start && t.start(), t.postMessage(Object.assign({ id: n }, e), r);
|
|
2091
2278
|
});
|
|
2092
2279
|
}
|
|
2093
|
-
function
|
|
2280
|
+
function Qt() {
|
|
2094
2281
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
2095
2282
|
}
|
|
2096
|
-
function
|
|
2097
|
-
|
|
2098
|
-
const e = t instanceof Worker ? t :
|
|
2283
|
+
function ve(t) {
|
|
2284
|
+
Xt();
|
|
2285
|
+
const e = t instanceof Worker ? t : Kt(t), r = V(e), s = Se(r);
|
|
2099
2286
|
return new Proxy(s, {
|
|
2100
2287
|
get: (n, i) => i === "isConnected" ? () => r.isConnected() : r[i]
|
|
2101
2288
|
});
|
|
2102
2289
|
}
|
|
2103
|
-
let
|
|
2104
|
-
function
|
|
2105
|
-
|
|
2290
|
+
let ce = !1;
|
|
2291
|
+
function Xt() {
|
|
2292
|
+
ce || (ce = !0, R.set("EVENT", {
|
|
2106
2293
|
canHandle: (t) => t instanceof CustomEvent,
|
|
2107
2294
|
serialize: (t) => [
|
|
2108
2295
|
{
|
|
@@ -2116,10 +2303,10 @@ function At() {
|
|
|
2116
2303
|
serialize(t) {
|
|
2117
2304
|
console.debug("[Comlink][Performance] Proxying a function");
|
|
2118
2305
|
const { port1: e, port2: r } = new MessageChannel();
|
|
2119
|
-
return
|
|
2306
|
+
return j(t, e), [r, [r]];
|
|
2120
2307
|
},
|
|
2121
2308
|
deserialize(t) {
|
|
2122
|
-
return t.start(),
|
|
2309
|
+
return t.start(), V(t);
|
|
2123
2310
|
}
|
|
2124
2311
|
}), R.set("PHPResponse", {
|
|
2125
2312
|
canHandle: (t) => typeof t == "object" && t !== null && "headers" in t && "bytes" in t && "errors" in t && "exitCode" in t && "httpStatusCode" in t,
|
|
@@ -2131,20 +2318,20 @@ function At() {
|
|
|
2131
2318
|
}
|
|
2132
2319
|
}));
|
|
2133
2320
|
}
|
|
2134
|
-
function
|
|
2321
|
+
function Se(t) {
|
|
2135
2322
|
return new Proxy(t, {
|
|
2136
2323
|
get(e, r) {
|
|
2137
2324
|
switch (typeof e[r]) {
|
|
2138
2325
|
case "function":
|
|
2139
2326
|
return (...s) => e[r](...s);
|
|
2140
2327
|
case "object":
|
|
2141
|
-
return e[r] === null ? e[r] :
|
|
2328
|
+
return e[r] === null ? e[r] : Se(e[r]);
|
|
2142
2329
|
case "undefined":
|
|
2143
2330
|
case "number":
|
|
2144
2331
|
case "string":
|
|
2145
2332
|
return e[r];
|
|
2146
2333
|
default:
|
|
2147
|
-
return
|
|
2334
|
+
return $e(e[r]);
|
|
2148
2335
|
}
|
|
2149
2336
|
}
|
|
2150
2337
|
});
|
|
@@ -2152,101 +2339,101 @@ function ge(t) {
|
|
|
2152
2339
|
(function() {
|
|
2153
2340
|
return typeof navigator < "u" && navigator?.userAgent?.toLowerCase().indexOf("firefox") > -1 ? "iframe" : "webworker";
|
|
2154
2341
|
})();
|
|
2155
|
-
async function
|
|
2342
|
+
async function Zt({
|
|
2156
2343
|
iframe: t,
|
|
2157
2344
|
blueprint: e,
|
|
2158
2345
|
remoteUrl: r,
|
|
2159
|
-
progressTracker: s = new
|
|
2346
|
+
progressTracker: s = new U(),
|
|
2160
2347
|
disableProgressBar: n,
|
|
2161
2348
|
onBlueprintStepCompleted: i
|
|
2162
2349
|
}) {
|
|
2163
|
-
if (
|
|
2350
|
+
if (er(r), r = ue(r, {
|
|
2164
2351
|
progressbar: !n
|
|
2165
2352
|
}), s.setCaption("Preparing WordPress"), !e)
|
|
2166
|
-
return
|
|
2167
|
-
const o =
|
|
2353
|
+
return le(t, r, s);
|
|
2354
|
+
const o = Ut(e, {
|
|
2168
2355
|
progress: s.stage(0.5),
|
|
2169
2356
|
onStepCompleted: i
|
|
2170
|
-
}), a = await
|
|
2357
|
+
}), a = await le(
|
|
2171
2358
|
t,
|
|
2172
|
-
|
|
2359
|
+
ue(r, {
|
|
2173
2360
|
php: o.versions.php,
|
|
2174
2361
|
wp: o.versions.wp
|
|
2175
2362
|
}),
|
|
2176
2363
|
s
|
|
2177
2364
|
);
|
|
2178
|
-
return await
|
|
2365
|
+
return await Nt(o, a), s.finish(), a;
|
|
2179
2366
|
}
|
|
2180
|
-
async function
|
|
2367
|
+
async function le(t, e, r) {
|
|
2181
2368
|
await new Promise((i) => {
|
|
2182
2369
|
t.src = e, t.addEventListener("load", i, !1);
|
|
2183
2370
|
});
|
|
2184
|
-
const s =
|
|
2371
|
+
const s = ve(
|
|
2185
2372
|
t.contentWindow
|
|
2186
2373
|
);
|
|
2187
2374
|
await s.isConnected(), r.pipe(s);
|
|
2188
2375
|
const n = r.stage();
|
|
2189
2376
|
return await s.onDownloadProgress(n.loadingListener), await s.isReady(), n.finish(), s;
|
|
2190
2377
|
}
|
|
2191
|
-
const
|
|
2192
|
-
function
|
|
2193
|
-
const e = new URL(t,
|
|
2194
|
-
if ((e.origin ===
|
|
2378
|
+
const k = "https://playground.wordpress.net";
|
|
2379
|
+
function er(t) {
|
|
2380
|
+
const e = new URL(t, k);
|
|
2381
|
+
if ((e.origin === k || e.hostname === "localhost") && e.pathname !== "/remote.html")
|
|
2195
2382
|
throw new Error(
|
|
2196
|
-
`Invalid remote URL: ${e}. Expected origin to be ${
|
|
2383
|
+
`Invalid remote URL: ${e}. Expected origin to be ${k}/remote.html.`
|
|
2197
2384
|
);
|
|
2198
2385
|
}
|
|
2199
|
-
function
|
|
2200
|
-
const r = new URL(t,
|
|
2386
|
+
function ue(t, e) {
|
|
2387
|
+
const r = new URL(t, k), s = new URLSearchParams(r.search);
|
|
2201
2388
|
for (const [n, i] of Object.entries(e))
|
|
2202
2389
|
i != null && i !== !1 && s.set(n, i.toString());
|
|
2203
2390
|
return r.search = s.toString(), r.toString();
|
|
2204
2391
|
}
|
|
2205
|
-
async function
|
|
2392
|
+
async function sr(t, e) {
|
|
2206
2393
|
if (console.warn(
|
|
2207
2394
|
"`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."
|
|
2208
2395
|
), e?.loadRemote)
|
|
2209
|
-
return
|
|
2396
|
+
return Zt({
|
|
2210
2397
|
iframe: t,
|
|
2211
2398
|
remoteUrl: e.loadRemote
|
|
2212
2399
|
});
|
|
2213
|
-
const r =
|
|
2400
|
+
const r = ve(
|
|
2214
2401
|
t.contentWindow
|
|
2215
2402
|
);
|
|
2216
2403
|
return await r.isConnected(), r;
|
|
2217
2404
|
}
|
|
2218
2405
|
export {
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2406
|
+
nt as LatestSupportedPHPVersion,
|
|
2407
|
+
D as SupportedPHPVersions,
|
|
2408
|
+
tr as SupportedPHPVersionsList,
|
|
2409
|
+
Ce as activatePlugin,
|
|
2410
|
+
ke as applyWordPressPatches,
|
|
2411
|
+
Ut as compileBlueprint,
|
|
2412
|
+
sr as connectPlayground,
|
|
2413
|
+
He as cp,
|
|
2414
|
+
ze as defineSiteUrl,
|
|
2415
|
+
Ve as importFile,
|
|
2416
|
+
Je as installPlugin,
|
|
2417
|
+
Ke as installTheme,
|
|
2418
|
+
Qe as login,
|
|
2419
|
+
Me as mkdir,
|
|
2420
|
+
Ie as mv,
|
|
2421
|
+
$ as phpVar,
|
|
2422
|
+
W as phpVars,
|
|
2423
|
+
je as replaceSite,
|
|
2424
|
+
Ue as request,
|
|
2425
|
+
Ne as rm,
|
|
2426
|
+
We as rmdir,
|
|
2427
|
+
Nt as runBlueprintSteps,
|
|
2428
|
+
Le as runPHP,
|
|
2429
|
+
Ae as runPHPWithOptions,
|
|
2430
|
+
Xe as runWpInstallationWizard,
|
|
2431
|
+
Oe as setPhpIniEntry,
|
|
2432
|
+
rr as setPluginProxyURL,
|
|
2433
|
+
Ze as setSiteOptions,
|
|
2434
|
+
Zt as startPlaygroundWeb,
|
|
2435
|
+
de as unzip,
|
|
2436
|
+
et as updateUserMeta,
|
|
2437
|
+
De as writeFile,
|
|
2438
|
+
Be as zipEntireSite
|
|
2252
2439
|
};
|