@wp-playground/client 0.1.34 → 0.1.35
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.cjs +10 -10
- package/index.d.ts +3 -1
- package/index.js +251 -224
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -8,10 +8,10 @@ function A(t) {
|
|
|
8
8
|
async function E(t, e, r) {
|
|
9
9
|
await t.writeFile(e, r(await t.readFileAsText(e)));
|
|
10
10
|
}
|
|
11
|
-
async function
|
|
11
|
+
async function Pe(t) {
|
|
12
12
|
return new Uint8Array(await t.arrayBuffer());
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const be = async (t, { plugin: e }, r) => {
|
|
15
15
|
r?.tracker.setCaption(`Activating ${e}`);
|
|
16
16
|
const i = T(
|
|
17
17
|
await t.request({
|
|
@@ -23,15 +23,15 @@ const ge = async (t, { plugin: e }, r) => {
|
|
|
23
23
|
await t.request({
|
|
24
24
|
url: "/wp-admin/" + i
|
|
25
25
|
});
|
|
26
|
-
},
|
|
27
|
-
const r = new
|
|
26
|
+
}, _e = async (t, e) => {
|
|
27
|
+
const r = new $e(
|
|
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 $e {
|
|
35
35
|
constructor(e, r, s) {
|
|
36
36
|
this.php = e, this.scopedSiteUrl = r, this.wordpressPath = s;
|
|
37
37
|
}
|
|
@@ -82,38 +82,39 @@ class Pe {
|
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
const
|
|
85
|
+
const Se = async (t, { code: e }) => await t.run({ code: e }), ve = async (t, { options: e }) => await t.run(e), Ee = async (t, { key: e, value: r }) => {
|
|
86
86
|
await t.setPhpIniEntry(e, r);
|
|
87
|
-
},
|
|
87
|
+
}, Re = async (t, { request: e }) => await t.request(e), Te = async (t, { fromPath: e, toPath: r }) => {
|
|
88
88
|
await t.writeFile(
|
|
89
89
|
r,
|
|
90
90
|
await t.readFileAsBuffer(e)
|
|
91
91
|
);
|
|
92
|
-
},
|
|
92
|
+
}, xe = async (t, { fromPath: e, toPath: r }) => {
|
|
93
93
|
await t.mv(e, r);
|
|
94
|
-
},
|
|
94
|
+
}, Ce = async (t, { path: e }) => {
|
|
95
95
|
await t.mkdir(e);
|
|
96
|
-
},
|
|
96
|
+
}, Fe = async (t, { path: e }) => {
|
|
97
97
|
await t.unlink(e);
|
|
98
|
-
},
|
|
98
|
+
}, ke = async (t, { path: e }) => {
|
|
99
99
|
await t.rmdir(e);
|
|
100
|
-
},
|
|
101
|
-
r instanceof File && (r = await
|
|
102
|
-
},
|
|
100
|
+
}, Oe = async (t, { path: e, data: r }) => {
|
|
101
|
+
r instanceof File && (r = await Pe(r)), await t.writeFile(e, r);
|
|
102
|
+
}, Ue = async (t, { siteUrl: e }) => {
|
|
103
|
+
const r = await t.documentRoot;
|
|
103
104
|
await E(
|
|
104
105
|
t,
|
|
105
|
-
|
|
106
|
-
(
|
|
106
|
+
`${r}/wp-config.php`,
|
|
107
|
+
(s) => `<?php
|
|
107
108
|
if ( ! defined( 'WP_HOME' ) ) {
|
|
108
109
|
define('WP_HOME', "${e}");
|
|
109
110
|
}
|
|
110
111
|
if ( ! defined( 'WP_SITEURL' ) ) {
|
|
111
112
|
define('WP_SITEURL', "${e}");
|
|
112
113
|
}
|
|
113
|
-
?>${
|
|
114
|
+
?>${s}`
|
|
114
115
|
);
|
|
115
116
|
};
|
|
116
|
-
class
|
|
117
|
+
class re {
|
|
117
118
|
constructor({ concurrency: e }) {
|
|
118
119
|
this._running = 0, this.concurrency = e, this.queue = [];
|
|
119
120
|
}
|
|
@@ -138,7 +139,7 @@ class te {
|
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
|
-
const
|
|
142
|
+
const Ae = Symbol("literal");
|
|
142
143
|
function S(t) {
|
|
143
144
|
if (typeof t == "string")
|
|
144
145
|
return t.startsWith("$") ? t : JSON.stringify(t);
|
|
@@ -149,7 +150,7 @@ function S(t) {
|
|
|
149
150
|
if (t === null)
|
|
150
151
|
return "null";
|
|
151
152
|
if (typeof t == "object")
|
|
152
|
-
return
|
|
153
|
+
return Ae in t ? t.toString() : `array(${Object.entries(t).map(([r, s]) => `${JSON.stringify(r)} => ${S(s)}`).join(", ")})`;
|
|
153
154
|
if (typeof t == "function")
|
|
154
155
|
return t();
|
|
155
156
|
throw new Error(`Unsupported value: ${t}`);
|
|
@@ -223,28 +224,28 @@ function delTree($dir)
|
|
|
223
224
|
return rmdir($dir);
|
|
224
225
|
}
|
|
225
226
|
`;
|
|
226
|
-
async function
|
|
227
|
+
async function Le(t) {
|
|
227
228
|
const e = "wordpress-playground.zip", r = `/${e}`, s = z({
|
|
228
229
|
zipPath: r,
|
|
229
230
|
documentRoot: await t.documentRoot
|
|
230
231
|
});
|
|
231
|
-
await
|
|
232
|
+
await ne(
|
|
232
233
|
t,
|
|
233
234
|
`zipDir(${s.documentRoot}, ${s.zipPath});`
|
|
234
235
|
);
|
|
235
236
|
const n = await t.readFileAsBuffer(r);
|
|
236
237
|
return t.unlink(r), new File([n], e);
|
|
237
238
|
}
|
|
238
|
-
const
|
|
239
|
+
const He = async (t, { fullSiteZip: e }) => {
|
|
239
240
|
const r = "/import.zip";
|
|
240
241
|
await t.writeFile(
|
|
241
242
|
r,
|
|
242
243
|
new Uint8Array(await e.arrayBuffer())
|
|
243
244
|
);
|
|
244
245
|
const s = await t.absoluteUrl, n = await t.documentRoot;
|
|
245
|
-
await t.rmdir(n), await
|
|
246
|
+
await t.rmdir(n), await se(t, { zipPath: r, extractToPath: "/" });
|
|
246
247
|
const i = z({ absoluteUrl: s });
|
|
247
|
-
await
|
|
248
|
+
await ze(
|
|
248
249
|
t,
|
|
249
250
|
`${n}/wp-config.php`,
|
|
250
251
|
(o) => `<?php
|
|
@@ -254,16 +255,16 @@ const Ue = async (t, { fullSiteZip: e }) => {
|
|
|
254
255
|
}
|
|
255
256
|
?>${o}`
|
|
256
257
|
);
|
|
257
|
-
},
|
|
258
|
+
}, se = async (t, { zipPath: e, extractToPath: r }) => {
|
|
258
259
|
const s = z({
|
|
259
260
|
zipPath: e,
|
|
260
261
|
extractToPath: r
|
|
261
262
|
});
|
|
262
|
-
await
|
|
263
|
+
await ne(
|
|
263
264
|
t,
|
|
264
265
|
`unzip(${s.zipPath}, ${s.extractToPath});`
|
|
265
266
|
);
|
|
266
|
-
},
|
|
267
|
+
}, Ie = async (t, { file: e }) => {
|
|
267
268
|
const r = await t.request({
|
|
268
269
|
url: "/wp-admin/admin.php?import=wordpress"
|
|
269
270
|
}), s = B(r).getElementById("import-upload-form")?.getAttribute("action"), n = await t.request({
|
|
@@ -277,7 +278,7 @@ const Ue = async (t, { fullSiteZip: e }) => {
|
|
|
277
278
|
throw console.log(n.text), new Error(
|
|
278
279
|
"Could not find an importer form in response. See the response text above for details."
|
|
279
280
|
);
|
|
280
|
-
const o =
|
|
281
|
+
const o = Ne(i);
|
|
281
282
|
o.fetch_attachments = "1";
|
|
282
283
|
for (const a in o)
|
|
283
284
|
if (a.startsWith("user_map[")) {
|
|
@@ -293,16 +294,16 @@ const Ue = async (t, { fullSiteZip: e }) => {
|
|
|
293
294
|
function B(t) {
|
|
294
295
|
return new DOMParser().parseFromString(t.text, "text/html");
|
|
295
296
|
}
|
|
296
|
-
function
|
|
297
|
+
function Ne(t) {
|
|
297
298
|
return Object.fromEntries(new FormData(t).entries());
|
|
298
299
|
}
|
|
299
|
-
async function
|
|
300
|
+
async function ze(t, e, r) {
|
|
300
301
|
await t.writeFile(
|
|
301
302
|
e,
|
|
302
303
|
r(await t.readFileAsText(e))
|
|
303
304
|
);
|
|
304
305
|
}
|
|
305
|
-
async function
|
|
306
|
+
async function ne(t, e) {
|
|
306
307
|
const r = await t.run({
|
|
307
308
|
code: j + e
|
|
308
309
|
});
|
|
@@ -310,7 +311,7 @@ async function se(t, e) {
|
|
|
310
311
|
throw console.log(j + e), console.log(e + ""), console.log(r.errors), r.errors;
|
|
311
312
|
return r;
|
|
312
313
|
}
|
|
313
|
-
const
|
|
314
|
+
const De = async (t, { pluginZipFile: e, options: r = {} }, s) => {
|
|
314
315
|
s?.tracker.setCaption(
|
|
315
316
|
`Installing the ${A(e?.name)} plugin`
|
|
316
317
|
);
|
|
@@ -365,7 +366,7 @@ async function V(t, e, r) {
|
|
|
365
366
|
r(await t.readFileAsText(e))
|
|
366
367
|
);
|
|
367
368
|
}
|
|
368
|
-
const
|
|
369
|
+
const qe = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
369
370
|
s?.tracker.setCaption(
|
|
370
371
|
`Installing the ${A(e.name)} theme`
|
|
371
372
|
);
|
|
@@ -399,12 +400,12 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
399
400
|
console.error('The "activate" button was not found.');
|
|
400
401
|
return;
|
|
401
402
|
}
|
|
402
|
-
const
|
|
403
|
-
|
|
403
|
+
const ge = y.attributes.getNamedItem("href").value, ye = new URL(
|
|
404
|
+
ge,
|
|
404
405
|
await t.pathToInternalUrl("/wp-admin/")
|
|
405
406
|
).toString();
|
|
406
407
|
await t.request({
|
|
407
|
-
url:
|
|
408
|
+
url: ye
|
|
408
409
|
});
|
|
409
410
|
}
|
|
410
411
|
} catch (n) {
|
|
@@ -412,7 +413,7 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
412
413
|
`Proceeding without the ${e.name} theme. Could not install it in wp-admin. The original error was: ${n}`
|
|
413
414
|
), console.error(n);
|
|
414
415
|
}
|
|
415
|
-
},
|
|
416
|
+
}, We = async (t, { username: e = "admin", password: r = "password" } = {}, s) => {
|
|
416
417
|
s?.tracker.setCaption(s?.initialCaption || "Logging in"), await t.request({
|
|
417
418
|
url: "/wp-login.php"
|
|
418
419
|
}), await t.request({
|
|
@@ -424,7 +425,7 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
424
425
|
rememberme: "forever"
|
|
425
426
|
}
|
|
426
427
|
});
|
|
427
|
-
},
|
|
428
|
+
}, Me = async (t, { options: e }) => {
|
|
428
429
|
await t.request({
|
|
429
430
|
url: "/wp-admin/install.php?step=2",
|
|
430
431
|
method: "POST",
|
|
@@ -441,7 +442,7 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
441
442
|
admin_email: "admin@localhost.com"
|
|
442
443
|
}
|
|
443
444
|
});
|
|
444
|
-
},
|
|
445
|
+
}, je = async (t, { options: e }) => {
|
|
445
446
|
const r = `<?php
|
|
446
447
|
include 'wordpress/wp-load.php';
|
|
447
448
|
$site_options = ${S(e)};
|
|
@@ -452,8 +453,8 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
452
453
|
`, s = await t.run({
|
|
453
454
|
code: r
|
|
454
455
|
});
|
|
455
|
-
return
|
|
456
|
-
},
|
|
456
|
+
return ie(s), { code: r, result: s };
|
|
457
|
+
}, Be = async (t, { meta: e, userId: r }) => {
|
|
457
458
|
const s = `<?php
|
|
458
459
|
include 'wordpress/wp-load.php';
|
|
459
460
|
$meta = ${S(e)};
|
|
@@ -464,40 +465,40 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
|
|
|
464
465
|
`, n = await t.run({
|
|
465
466
|
code: s
|
|
466
467
|
});
|
|
467
|
-
return
|
|
468
|
+
return ie(n), { code: s, result: n };
|
|
468
469
|
};
|
|
469
|
-
async function
|
|
470
|
+
async function ie(t) {
|
|
470
471
|
if (t.text !== "Success")
|
|
471
472
|
throw console.log(t), new Error(`Failed to run code: ${t.text} ${t.errors}`);
|
|
472
473
|
}
|
|
473
|
-
const
|
|
474
|
+
const Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
474
475
|
__proto__: null,
|
|
475
|
-
activatePlugin:
|
|
476
|
-
applyWordPressPatches:
|
|
477
|
-
cp:
|
|
478
|
-
defineSiteUrl:
|
|
479
|
-
importFile:
|
|
480
|
-
installPlugin:
|
|
481
|
-
installTheme:
|
|
482
|
-
login:
|
|
483
|
-
mkdir:
|
|
484
|
-
mv:
|
|
485
|
-
replaceSite:
|
|
486
|
-
request:
|
|
487
|
-
rm:
|
|
488
|
-
rmdir:
|
|
489
|
-
runPHP:
|
|
490
|
-
runPHPWithOptions:
|
|
491
|
-
runWpInstallationWizard:
|
|
492
|
-
setPhpIniEntry:
|
|
493
|
-
setSiteOptions:
|
|
494
|
-
unzip:
|
|
495
|
-
updateUserMeta:
|
|
496
|
-
writeFile:
|
|
497
|
-
zipEntireSite:
|
|
498
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
499
|
-
function
|
|
500
|
-
const r = t.headers.get("content-length") || "", s = parseInt(r, 10) ||
|
|
476
|
+
activatePlugin: be,
|
|
477
|
+
applyWordPressPatches: _e,
|
|
478
|
+
cp: Te,
|
|
479
|
+
defineSiteUrl: Ue,
|
|
480
|
+
importFile: Ie,
|
|
481
|
+
installPlugin: De,
|
|
482
|
+
installTheme: qe,
|
|
483
|
+
login: We,
|
|
484
|
+
mkdir: Ce,
|
|
485
|
+
mv: xe,
|
|
486
|
+
replaceSite: He,
|
|
487
|
+
request: Re,
|
|
488
|
+
rm: Fe,
|
|
489
|
+
rmdir: ke,
|
|
490
|
+
runPHP: Se,
|
|
491
|
+
runPHPWithOptions: ve,
|
|
492
|
+
runWpInstallationWizard: Me,
|
|
493
|
+
setPhpIniEntry: Ee,
|
|
494
|
+
setSiteOptions: je,
|
|
495
|
+
unzip: se,
|
|
496
|
+
updateUserMeta: Be,
|
|
497
|
+
writeFile: Oe,
|
|
498
|
+
zipEntireSite: Le
|
|
499
|
+
}, Symbol.toStringTag, { value: "Module" })), Ge = 5 * 1024 * 1024;
|
|
500
|
+
function Je(t, e) {
|
|
501
|
+
const r = t.headers.get("content-length") || "", s = parseInt(r, 10) || Ge;
|
|
501
502
|
function n(i, o) {
|
|
502
503
|
e(
|
|
503
504
|
new CustomEvent("progress", {
|
|
@@ -545,7 +546,7 @@ class L extends EventTarget {
|
|
|
545
546
|
caption: r = "",
|
|
546
547
|
fillTime: s = 4
|
|
547
548
|
} = {}) {
|
|
548
|
-
super(), this._selfWeight = 1, this._selfProgress = 0, this._selfCaption = "", this._isFilling = !1, this._subTrackers = [], this._weight = e, this._selfCaption = r, this._fillTime = s;
|
|
549
|
+
super(), this._selfWeight = 1, this._selfDone = !1, this._selfProgress = 0, this._selfCaption = "", this._isFilling = !1, this._subTrackers = [], this._weight = e, this._selfCaption = r, this._fillTime = s;
|
|
549
550
|
}
|
|
550
551
|
/**
|
|
551
552
|
* Creates a new sub-tracker with a specific weight.
|
|
@@ -628,7 +629,7 @@ class L extends EventTarget {
|
|
|
628
629
|
this._selfProgress = Math.min(e, 100), this.notifyProgress(), this._selfProgress + H >= 100 && this.finish();
|
|
629
630
|
}
|
|
630
631
|
finish() {
|
|
631
|
-
this._fillInterval && clearInterval(this._fillInterval), this._selfProgress = 100, this._isFilling = !1, this._fillInterval = void 0, this.notifyProgress(), this.notifyDone();
|
|
632
|
+
this._fillInterval && clearInterval(this._fillInterval), this._selfDone = !0, this._selfProgress = 100, this._isFilling = !1, this._fillInterval = void 0, this.notifyProgress(), this.notifyDone();
|
|
632
633
|
}
|
|
633
634
|
get caption() {
|
|
634
635
|
for (let e = this._subTrackers.length - 1; e >= 0; e--)
|
|
@@ -646,6 +647,8 @@ class L extends EventTarget {
|
|
|
646
647
|
return this.progress + H >= 100;
|
|
647
648
|
}
|
|
648
649
|
get progress() {
|
|
650
|
+
if (this._selfDone)
|
|
651
|
+
return 100;
|
|
649
652
|
const e = this._subTrackers.reduce(
|
|
650
653
|
(r, s) => r + s.progress * s.weight,
|
|
651
654
|
this._selfProgress * this._selfWeight
|
|
@@ -666,7 +669,10 @@ class L extends EventTarget {
|
|
|
666
669
|
}), this._loadingListener;
|
|
667
670
|
}
|
|
668
671
|
pipe(e) {
|
|
669
|
-
|
|
672
|
+
e.setProgress({
|
|
673
|
+
progress: this.progress,
|
|
674
|
+
caption: this.caption
|
|
675
|
+
}), this.addEventListener("progress", (r) => {
|
|
670
676
|
e.setProgress({
|
|
671
677
|
progress: r.detail.progress,
|
|
672
678
|
caption: r.detail.caption
|
|
@@ -745,8 +751,8 @@ const D = [
|
|
|
745
751
|
"7.1",
|
|
746
752
|
"7.0",
|
|
747
753
|
"5.6"
|
|
748
|
-
],
|
|
749
|
-
class
|
|
754
|
+
], Ke = D[0], It = D;
|
|
755
|
+
class Ye {
|
|
750
756
|
#e;
|
|
751
757
|
#t;
|
|
752
758
|
/**
|
|
@@ -832,17 +838,17 @@ class Ge {
|
|
|
832
838
|
return e.join("; ");
|
|
833
839
|
}
|
|
834
840
|
}
|
|
835
|
-
const
|
|
841
|
+
const Qe = "http://example.com";
|
|
836
842
|
function G(t) {
|
|
837
843
|
return t.toString().substring(t.origin.length);
|
|
838
844
|
}
|
|
839
845
|
function J(t, e) {
|
|
840
846
|
return !e || !t.startsWith(e) ? t : t.substring(e.length);
|
|
841
847
|
}
|
|
842
|
-
function
|
|
848
|
+
function Xe(t, e) {
|
|
843
849
|
return !e || t.startsWith(e) ? t : e + t;
|
|
844
850
|
}
|
|
845
|
-
class
|
|
851
|
+
class Ze {
|
|
846
852
|
#e;
|
|
847
853
|
#t;
|
|
848
854
|
#n;
|
|
@@ -857,7 +863,7 @@ class Ye {
|
|
|
857
863
|
* @param config - Request Handler configuration.
|
|
858
864
|
*/
|
|
859
865
|
constructor(e, r = {}) {
|
|
860
|
-
this.#a = new
|
|
866
|
+
this.#a = new re({ concurrency: 1 });
|
|
861
867
|
const {
|
|
862
868
|
documentRoot: s = "/www/",
|
|
863
869
|
absoluteUrl: n = typeof location == "object" ? location?.href : "",
|
|
@@ -900,7 +906,7 @@ class Ye {
|
|
|
900
906
|
async request(e) {
|
|
901
907
|
const r = e.url.startsWith("http://") || e.url.startsWith("https://"), s = new URL(
|
|
902
908
|
e.url,
|
|
903
|
-
r ? void 0 :
|
|
909
|
+
r ? void 0 : Qe
|
|
904
910
|
), n = J(
|
|
905
911
|
s.pathname,
|
|
906
912
|
this.#r
|
|
@@ -929,7 +935,7 @@ class Ye {
|
|
|
929
935
|
// @TODO: Infer the content-type from the arrayBuffer instead of the file path.
|
|
930
936
|
// The code below won't return the correct mime-type if the extension
|
|
931
937
|
// was tampered with.
|
|
932
|
-
"content-type": [
|
|
938
|
+
"content-type": [tt(r)],
|
|
933
939
|
"accept-ranges": ["bytes"],
|
|
934
940
|
"cache-control": ["public, max-age=0"]
|
|
935
941
|
},
|
|
@@ -953,7 +959,7 @@ class Ye {
|
|
|
953
959
|
let n = "GET";
|
|
954
960
|
const i = {
|
|
955
961
|
host: this.#i,
|
|
956
|
-
...
|
|
962
|
+
...oe(e.headers || {})
|
|
957
963
|
}, o = [];
|
|
958
964
|
if (e.files && Object.keys(e.files).length) {
|
|
959
965
|
n = "POST";
|
|
@@ -966,7 +972,7 @@ class Ye {
|
|
|
966
972
|
data: new Uint8Array(await c.arrayBuffer())
|
|
967
973
|
});
|
|
968
974
|
}
|
|
969
|
-
i["content-type"]?.startsWith("multipart/form-data") && (e.formData =
|
|
975
|
+
i["content-type"]?.startsWith("multipart/form-data") && (e.formData = et(
|
|
970
976
|
e.body || ""
|
|
971
977
|
), i["content-type"] = "application/x-www-form-urlencoded", delete e.body);
|
|
972
978
|
}
|
|
@@ -974,7 +980,7 @@ class Ye {
|
|
|
974
980
|
return e.formData !== void 0 ? (n = "POST", i["content-type"] = i["content-type"] || "application/x-www-form-urlencoded", a = new URLSearchParams(
|
|
975
981
|
e.formData
|
|
976
982
|
).toString()) : a = e.body, await this.php.run({
|
|
977
|
-
relativeUri:
|
|
983
|
+
relativeUri: Xe(
|
|
978
984
|
G(r),
|
|
979
985
|
this.#r
|
|
980
986
|
),
|
|
@@ -1004,7 +1010,7 @@ class Ye {
|
|
|
1004
1010
|
return this.php.fileExists(s) ? s : `${this.#e}/index.php`;
|
|
1005
1011
|
}
|
|
1006
1012
|
}
|
|
1007
|
-
function
|
|
1013
|
+
function et(t) {
|
|
1008
1014
|
const e = {}, r = t.match(/--(.*)\r\n/);
|
|
1009
1015
|
if (!r)
|
|
1010
1016
|
return e;
|
|
@@ -1019,7 +1025,7 @@ function Qe(t) {
|
|
|
1019
1025
|
}
|
|
1020
1026
|
}), e;
|
|
1021
1027
|
}
|
|
1022
|
-
function
|
|
1028
|
+
function tt(t) {
|
|
1023
1029
|
switch (t.split(".").pop()) {
|
|
1024
1030
|
case "css":
|
|
1025
1031
|
return "text/css";
|
|
@@ -1157,17 +1163,17 @@ function m(t = "") {
|
|
|
1157
1163
|
};
|
|
1158
1164
|
};
|
|
1159
1165
|
}
|
|
1160
|
-
const
|
|
1161
|
-
function
|
|
1162
|
-
return
|
|
1166
|
+
const rt = [];
|
|
1167
|
+
function st(t) {
|
|
1168
|
+
return rt[t];
|
|
1163
1169
|
}
|
|
1164
1170
|
(function() {
|
|
1165
1171
|
return typeof window < "u" && !{}.TEST ? "WEB" : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? "WORKER" : "NODE";
|
|
1166
1172
|
})();
|
|
1167
|
-
var
|
|
1168
|
-
for (var n = s > 1 ? void 0 : s ?
|
|
1173
|
+
var nt = Object.defineProperty, it = Object.getOwnPropertyDescriptor, w = (t, e, r, s) => {
|
|
1174
|
+
for (var n = s > 1 ? void 0 : s ? it(e, r) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1169
1175
|
(o = t[i]) && (n = (s ? o(e, r, n) : o(n)) || n);
|
|
1170
|
-
return s && n &&
|
|
1176
|
+
return s && n && nt(e, r, n), n;
|
|
1171
1177
|
};
|
|
1172
1178
|
const f = "string", _ = "number", h = Symbol("__private__dont__use");
|
|
1173
1179
|
class g {
|
|
@@ -1179,8 +1185,8 @@ class g {
|
|
|
1179
1185
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
1180
1186
|
*/
|
|
1181
1187
|
constructor(e, r) {
|
|
1182
|
-
this.#e = [], this.#t = !1, e !== void 0 && this.initializeRuntime(e), r && (this.requestHandler = new
|
|
1183
|
-
new
|
|
1188
|
+
this.#e = [], this.#t = !1, e !== void 0 && this.initializeRuntime(e), r && (this.requestHandler = new Ye(
|
|
1189
|
+
new Ze(this, r)
|
|
1184
1190
|
));
|
|
1185
1191
|
}
|
|
1186
1192
|
#e;
|
|
@@ -1191,7 +1197,7 @@ class g {
|
|
|
1191
1197
|
}
|
|
1192
1198
|
/** @inheritDoc */
|
|
1193
1199
|
get documentRoot() {
|
|
1194
|
-
return this.requestHandler.requestHandler.
|
|
1200
|
+
return this.requestHandler.requestHandler.documentRoot;
|
|
1195
1201
|
}
|
|
1196
1202
|
/** @inheritDoc */
|
|
1197
1203
|
pathToInternalUrl(e) {
|
|
@@ -1206,7 +1212,7 @@ class g {
|
|
|
1206
1212
|
initializeRuntime(e) {
|
|
1207
1213
|
if (this[h])
|
|
1208
1214
|
throw new Error("PHP runtime already initialized.");
|
|
1209
|
-
const r =
|
|
1215
|
+
const r = st(e);
|
|
1210
1216
|
if (!r)
|
|
1211
1217
|
throw new Error("Invalid PHP runtime id.");
|
|
1212
1218
|
this[h] = r;
|
|
@@ -1243,7 +1249,7 @@ class g {
|
|
|
1243
1249
|
this.#t || (this.#n(), this.#t = !0), this.#l(e.scriptPath || ""), this.#i(e.relativeUri || ""), this.#o(e.method || "GET");
|
|
1244
1250
|
const { host: r, ...s } = {
|
|
1245
1251
|
host: "example.com:443",
|
|
1246
|
-
...
|
|
1252
|
+
...oe(e.headers || {})
|
|
1247
1253
|
};
|
|
1248
1254
|
if (this.#r(r, e.protocol || "http"), this.#a(s), e.body && this.#c(e.body), e.fileInfos)
|
|
1249
1255
|
for (const n of e.fileInfos)
|
|
@@ -1505,21 +1511,21 @@ w([
|
|
|
1505
1511
|
w([
|
|
1506
1512
|
m('Could not stat "{path}"')
|
|
1507
1513
|
], g.prototype, "fileExists", 1);
|
|
1508
|
-
function
|
|
1514
|
+
function oe(t) {
|
|
1509
1515
|
const e = {};
|
|
1510
1516
|
for (const r in t)
|
|
1511
1517
|
e[r.toLowerCase()] = t[r];
|
|
1512
1518
|
return e;
|
|
1513
1519
|
}
|
|
1514
|
-
const
|
|
1520
|
+
const ot = [
|
|
1515
1521
|
"vfs",
|
|
1516
1522
|
"literal",
|
|
1517
1523
|
"wordpress.org/themes",
|
|
1518
1524
|
"wordpress.org/plugins",
|
|
1519
1525
|
"url"
|
|
1520
1526
|
];
|
|
1521
|
-
function
|
|
1522
|
-
return t && typeof t == "object" && typeof t.resource == "string" &&
|
|
1527
|
+
function at(t) {
|
|
1528
|
+
return t && typeof t == "object" && typeof t.resource == "string" && ot.includes(t.resource);
|
|
1523
1529
|
}
|
|
1524
1530
|
class b {
|
|
1525
1531
|
/**
|
|
@@ -1533,24 +1539,24 @@ class b {
|
|
|
1533
1539
|
let n;
|
|
1534
1540
|
switch (e.resource) {
|
|
1535
1541
|
case "vfs":
|
|
1536
|
-
n = new
|
|
1542
|
+
n = new ct(e, s);
|
|
1537
1543
|
break;
|
|
1538
1544
|
case "literal":
|
|
1539
|
-
n = new
|
|
1545
|
+
n = new lt(e, s);
|
|
1540
1546
|
break;
|
|
1541
1547
|
case "wordpress.org/themes":
|
|
1542
|
-
n = new
|
|
1548
|
+
n = new dt(e, s);
|
|
1543
1549
|
break;
|
|
1544
1550
|
case "wordpress.org/plugins":
|
|
1545
|
-
n = new
|
|
1551
|
+
n = new pt(e, s);
|
|
1546
1552
|
break;
|
|
1547
1553
|
case "url":
|
|
1548
|
-
n = new
|
|
1554
|
+
n = new ht(e, s);
|
|
1549
1555
|
break;
|
|
1550
1556
|
default:
|
|
1551
1557
|
throw new Error(`Invalid resource: ${e}`);
|
|
1552
1558
|
}
|
|
1553
|
-
return n = new
|
|
1559
|
+
return n = new ft(n), r && (n = new mt(n, r)), n;
|
|
1554
1560
|
}
|
|
1555
1561
|
setPlayground(e) {
|
|
1556
1562
|
this.playground = e;
|
|
@@ -1560,7 +1566,7 @@ class b {
|
|
|
1560
1566
|
return !1;
|
|
1561
1567
|
}
|
|
1562
1568
|
}
|
|
1563
|
-
class
|
|
1569
|
+
class ct extends b {
|
|
1564
1570
|
/**
|
|
1565
1571
|
* Creates a new instance of `VFSResource`.
|
|
1566
1572
|
* @param playground The playground client.
|
|
@@ -1582,7 +1588,7 @@ class it extends b {
|
|
|
1582
1588
|
return this.resource.path;
|
|
1583
1589
|
}
|
|
1584
1590
|
}
|
|
1585
|
-
class
|
|
1591
|
+
class lt extends b {
|
|
1586
1592
|
/**
|
|
1587
1593
|
* Creates a new instance of `LiteralResource`.
|
|
1588
1594
|
* @param resource The literal reference.
|
|
@@ -1613,9 +1619,9 @@ class q extends b {
|
|
|
1613
1619
|
this.progress?.setCaption(this.caption);
|
|
1614
1620
|
const e = this.getURL();
|
|
1615
1621
|
let r = await fetch(e);
|
|
1616
|
-
if (r = await
|
|
1622
|
+
if (r = await Je(
|
|
1617
1623
|
r,
|
|
1618
|
-
this.progress?.loadingListener ??
|
|
1624
|
+
this.progress?.loadingListener ?? ut
|
|
1619
1625
|
), r.status !== 200)
|
|
1620
1626
|
throw new Error(`Could not download "${e}"`);
|
|
1621
1627
|
return new File([await r.blob()], this.name);
|
|
@@ -1636,9 +1642,9 @@ class q extends b {
|
|
|
1636
1642
|
return !0;
|
|
1637
1643
|
}
|
|
1638
1644
|
}
|
|
1639
|
-
const
|
|
1645
|
+
const ut = () => {
|
|
1640
1646
|
};
|
|
1641
|
-
class
|
|
1647
|
+
class ht extends q {
|
|
1642
1648
|
/**
|
|
1643
1649
|
* Creates a new instance of `UrlResource`.
|
|
1644
1650
|
* @param resource The URL reference.
|
|
@@ -1656,7 +1662,7 @@ class ct extends q {
|
|
|
1656
1662
|
return this.resource.caption ?? super.caption;
|
|
1657
1663
|
}
|
|
1658
1664
|
}
|
|
1659
|
-
class
|
|
1665
|
+
class dt extends q {
|
|
1660
1666
|
constructor(e, r) {
|
|
1661
1667
|
super(r), this.resource = e;
|
|
1662
1668
|
}
|
|
@@ -1664,10 +1670,10 @@ class lt extends q {
|
|
|
1664
1670
|
return A(this.resource.slug);
|
|
1665
1671
|
}
|
|
1666
1672
|
getURL() {
|
|
1667
|
-
return "/plugin-proxy?theme=" +
|
|
1673
|
+
return "/plugin-proxy?theme=" + ae(this.resource.slug);
|
|
1668
1674
|
}
|
|
1669
1675
|
}
|
|
1670
|
-
class
|
|
1676
|
+
class pt extends q {
|
|
1671
1677
|
constructor(e, r) {
|
|
1672
1678
|
super(r), this.resource = e;
|
|
1673
1679
|
}
|
|
@@ -1677,13 +1683,13 @@ class ut extends q {
|
|
|
1677
1683
|
}
|
|
1678
1684
|
/** @inheritDoc */
|
|
1679
1685
|
getURL() {
|
|
1680
|
-
return "/plugin-proxy?plugin=" +
|
|
1686
|
+
return "/plugin-proxy?plugin=" + ae(this.resource.slug);
|
|
1681
1687
|
}
|
|
1682
1688
|
}
|
|
1683
|
-
function
|
|
1689
|
+
function ae(t) {
|
|
1684
1690
|
return !t || t.endsWith(".zip") ? t : t + ".latest-stable.zip";
|
|
1685
1691
|
}
|
|
1686
|
-
class
|
|
1692
|
+
class ce extends b {
|
|
1687
1693
|
constructor(e) {
|
|
1688
1694
|
super(), this.resource = e;
|
|
1689
1695
|
}
|
|
@@ -1712,13 +1718,13 @@ class ae extends b {
|
|
|
1712
1718
|
return this.resource.isAsync;
|
|
1713
1719
|
}
|
|
1714
1720
|
}
|
|
1715
|
-
class
|
|
1721
|
+
class ft extends ce {
|
|
1716
1722
|
/** @inheritDoc */
|
|
1717
1723
|
async resolve() {
|
|
1718
1724
|
return this.promise || (this.promise = super.resolve()), this.promise;
|
|
1719
1725
|
}
|
|
1720
1726
|
}
|
|
1721
|
-
class
|
|
1727
|
+
class mt extends ce {
|
|
1722
1728
|
constructor(e, r) {
|
|
1723
1729
|
super(e), this.semaphore = r;
|
|
1724
1730
|
}
|
|
@@ -1727,18 +1733,18 @@ class dt extends ae {
|
|
|
1727
1733
|
return this.isAsync ? this.semaphore.run(() => super.resolve()) : super.resolve();
|
|
1728
1734
|
}
|
|
1729
1735
|
}
|
|
1730
|
-
const
|
|
1731
|
-
function
|
|
1736
|
+
const wt = ["6.2", "6.1", "6.0", "5.9"];
|
|
1737
|
+
function gt(t, {
|
|
1732
1738
|
progress: e = new L(),
|
|
1733
|
-
semaphore: r = new
|
|
1739
|
+
semaphore: r = new re({ concurrency: 3 }),
|
|
1734
1740
|
onStepCompleted: s = () => {
|
|
1735
1741
|
}
|
|
1736
1742
|
} = {}) {
|
|
1737
|
-
const n = (t.steps || []).filter(
|
|
1743
|
+
const n = (t.steps || []).filter(yt), i = n.reduce(
|
|
1738
1744
|
(a, l) => a + (l.progress?.weight || 1),
|
|
1739
1745
|
0
|
|
1740
1746
|
), o = n.map(
|
|
1741
|
-
(a) =>
|
|
1747
|
+
(a) => Pt(a, {
|
|
1742
1748
|
semaphore: r,
|
|
1743
1749
|
rootProgressTracker: e,
|
|
1744
1750
|
totalProgressWeight: i
|
|
@@ -1749,11 +1755,11 @@ function ft(t, {
|
|
|
1749
1755
|
php: Y(
|
|
1750
1756
|
t.preferredVersions?.php,
|
|
1751
1757
|
D,
|
|
1752
|
-
|
|
1758
|
+
Ke
|
|
1753
1759
|
),
|
|
1754
1760
|
wp: Y(
|
|
1755
1761
|
t.preferredVersions?.wp,
|
|
1756
|
-
|
|
1762
|
+
wt,
|
|
1757
1763
|
"6.2"
|
|
1758
1764
|
)
|
|
1759
1765
|
},
|
|
@@ -1781,10 +1787,10 @@ function ft(t, {
|
|
|
1781
1787
|
function Y(t, e, r) {
|
|
1782
1788
|
return t && e.includes(t) ? t : r;
|
|
1783
1789
|
}
|
|
1784
|
-
function
|
|
1790
|
+
function yt(t) {
|
|
1785
1791
|
return !!(typeof t == "object" && t);
|
|
1786
1792
|
}
|
|
1787
|
-
function
|
|
1793
|
+
function Pt(t, {
|
|
1788
1794
|
semaphore: e,
|
|
1789
1795
|
rootProgressTracker: r,
|
|
1790
1796
|
totalProgressWeight: s
|
|
@@ -1794,15 +1800,15 @@ function wt(t, {
|
|
|
1794
1800
|
), i = {};
|
|
1795
1801
|
for (const u of Object.keys(t)) {
|
|
1796
1802
|
let d = t[u];
|
|
1797
|
-
|
|
1803
|
+
at(d) && (d = b.create(d, {
|
|
1798
1804
|
semaphore: e
|
|
1799
1805
|
})), i[u] = d;
|
|
1800
1806
|
}
|
|
1801
1807
|
const o = async (u) => {
|
|
1802
1808
|
try {
|
|
1803
|
-
return n.fillSlowly(), await
|
|
1809
|
+
return n.fillSlowly(), await Ve[t.step](
|
|
1804
1810
|
u,
|
|
1805
|
-
await
|
|
1811
|
+
await bt(i),
|
|
1806
1812
|
{
|
|
1807
1813
|
tracker: n,
|
|
1808
1814
|
initialCaption: t.progress?.caption
|
|
@@ -1826,7 +1832,7 @@ function Q(t) {
|
|
|
1826
1832
|
}
|
|
1827
1833
|
return e;
|
|
1828
1834
|
}
|
|
1829
|
-
async function
|
|
1835
|
+
async function bt(t) {
|
|
1830
1836
|
const e = {};
|
|
1831
1837
|
for (const r in t) {
|
|
1832
1838
|
const s = t[r];
|
|
@@ -1834,7 +1840,7 @@ async function gt(t) {
|
|
|
1834
1840
|
}
|
|
1835
1841
|
return e;
|
|
1836
1842
|
}
|
|
1837
|
-
async function
|
|
1843
|
+
async function _t(t, e) {
|
|
1838
1844
|
await t.run(e);
|
|
1839
1845
|
}
|
|
1840
1846
|
/**
|
|
@@ -1842,8 +1848,8 @@ async function yt(t, e) {
|
|
|
1842
1848
|
* Copyright 2019 Google LLC
|
|
1843
1849
|
* SPDX-License-Identifier: Apache-2.0
|
|
1844
1850
|
*/
|
|
1845
|
-
const
|
|
1846
|
-
canHandle: (t) =>
|
|
1851
|
+
const le = Symbol("Comlink.proxy"), $t = Symbol("Comlink.endpoint"), St = Symbol("Comlink.releaseProxy"), I = Symbol("Comlink.finalizer"), C = Symbol("Comlink.thrown"), ue = (t) => typeof t == "object" && t !== null || typeof t == "function", vt = {
|
|
1852
|
+
canHandle: (t) => ue(t) && t[le],
|
|
1847
1853
|
serialize(t) {
|
|
1848
1854
|
const { port1: e, port2: r } = new MessageChannel();
|
|
1849
1855
|
return W(t, e), [r, [r]];
|
|
@@ -1851,8 +1857,8 @@ const ce = Symbol("Comlink.proxy"), Pt = Symbol("Comlink.endpoint"), bt = Symbol
|
|
|
1851
1857
|
deserialize(t) {
|
|
1852
1858
|
return t.start(), M(t);
|
|
1853
1859
|
}
|
|
1854
|
-
},
|
|
1855
|
-
canHandle: (t) =>
|
|
1860
|
+
}, Et = {
|
|
1861
|
+
canHandle: (t) => ue(t) && C in t,
|
|
1856
1862
|
serialize({ value: t }) {
|
|
1857
1863
|
let e;
|
|
1858
1864
|
return t instanceof Error ? e = {
|
|
@@ -1868,10 +1874,10 @@ const ce = Symbol("Comlink.proxy"), Pt = Symbol("Comlink.endpoint"), bt = Symbol
|
|
|
1868
1874
|
throw t.isError ? Object.assign(new Error(t.value.message), t.value) : t.value;
|
|
1869
1875
|
}
|
|
1870
1876
|
}, R = /* @__PURE__ */ new Map([
|
|
1871
|
-
["proxy",
|
|
1872
|
-
["throw",
|
|
1877
|
+
["proxy", vt],
|
|
1878
|
+
["throw", Et]
|
|
1873
1879
|
]);
|
|
1874
|
-
function
|
|
1880
|
+
function Rt(t, e) {
|
|
1875
1881
|
for (const r of t)
|
|
1876
1882
|
if (e === r || r === "*" || r instanceof RegExp && r.test(e))
|
|
1877
1883
|
return !0;
|
|
@@ -1881,7 +1887,7 @@ function W(t, e = globalThis, r = ["*"]) {
|
|
|
1881
1887
|
e.addEventListener("message", function s(n) {
|
|
1882
1888
|
if (!n || !n.data)
|
|
1883
1889
|
return;
|
|
1884
|
-
if (!
|
|
1890
|
+
if (!Rt(r, n.origin)) {
|
|
1885
1891
|
console.warn(`Invalid origin '${n.origin}' for comlink proxy`);
|
|
1886
1892
|
return;
|
|
1887
1893
|
}
|
|
@@ -1902,13 +1908,13 @@ function W(t, e = globalThis, r = ["*"]) {
|
|
|
1902
1908
|
case "CONSTRUCT":
|
|
1903
1909
|
{
|
|
1904
1910
|
const p = new d(...l);
|
|
1905
|
-
c =
|
|
1911
|
+
c = fe(p);
|
|
1906
1912
|
}
|
|
1907
1913
|
break;
|
|
1908
1914
|
case "ENDPOINT":
|
|
1909
1915
|
{
|
|
1910
1916
|
const { port1: p, port2: y } = new MessageChannel();
|
|
1911
|
-
W(t, y), c =
|
|
1917
|
+
W(t, y), c = kt(p, [p]);
|
|
1912
1918
|
}
|
|
1913
1919
|
break;
|
|
1914
1920
|
case "RELEASE":
|
|
@@ -1922,7 +1928,7 @@ function W(t, e = globalThis, r = ["*"]) {
|
|
|
1922
1928
|
}
|
|
1923
1929
|
Promise.resolve(c).catch((u) => ({ value: u, [C]: 0 })).then((u) => {
|
|
1924
1930
|
const [d, p] = U(u);
|
|
1925
|
-
e.postMessage(Object.assign(Object.assign({}, d), { id: i }), p), o === "RELEASE" && (e.removeEventListener("message", s),
|
|
1931
|
+
e.postMessage(Object.assign(Object.assign({}, d), { id: i }), p), o === "RELEASE" && (e.removeEventListener("message", s), he(e), I in t && typeof t[I] == "function" && t[I]());
|
|
1926
1932
|
}).catch((u) => {
|
|
1927
1933
|
const [d, p] = U({
|
|
1928
1934
|
value: new TypeError("Unserializable return value"),
|
|
@@ -1932,11 +1938,11 @@ function W(t, e = globalThis, r = ["*"]) {
|
|
|
1932
1938
|
});
|
|
1933
1939
|
}), e.start && e.start();
|
|
1934
1940
|
}
|
|
1935
|
-
function
|
|
1941
|
+
function Tt(t) {
|
|
1936
1942
|
return t.constructor.name === "MessagePort";
|
|
1937
1943
|
}
|
|
1938
|
-
function
|
|
1939
|
-
|
|
1944
|
+
function he(t) {
|
|
1945
|
+
Tt(t) && t.close();
|
|
1940
1946
|
}
|
|
1941
1947
|
function M(t, e) {
|
|
1942
1948
|
return N(t, [], e);
|
|
@@ -1945,22 +1951,22 @@ function x(t) {
|
|
|
1945
1951
|
if (t)
|
|
1946
1952
|
throw new Error("Proxy has been released and is not useable");
|
|
1947
1953
|
}
|
|
1948
|
-
function
|
|
1954
|
+
function de(t) {
|
|
1949
1955
|
return $(t, {
|
|
1950
1956
|
type: "RELEASE"
|
|
1951
1957
|
}).then(() => {
|
|
1952
|
-
|
|
1958
|
+
he(t);
|
|
1953
1959
|
});
|
|
1954
1960
|
}
|
|
1955
1961
|
const k = /* @__PURE__ */ new WeakMap(), O = "FinalizationRegistry" in globalThis && new FinalizationRegistry((t) => {
|
|
1956
1962
|
const e = (k.get(t) || 0) - 1;
|
|
1957
|
-
k.set(t, e), e === 0 &&
|
|
1963
|
+
k.set(t, e), e === 0 && de(t);
|
|
1958
1964
|
});
|
|
1959
|
-
function
|
|
1965
|
+
function xt(t, e) {
|
|
1960
1966
|
const r = (k.get(e) || 0) + 1;
|
|
1961
1967
|
k.set(e, r), O && O.register(t, e, t);
|
|
1962
1968
|
}
|
|
1963
|
-
function
|
|
1969
|
+
function Ct(t) {
|
|
1964
1970
|
O && O.unregister(t);
|
|
1965
1971
|
}
|
|
1966
1972
|
function N(t, e = [], r = function() {
|
|
@@ -1968,9 +1974,9 @@ function N(t, e = [], r = function() {
|
|
|
1968
1974
|
let s = !1;
|
|
1969
1975
|
const n = new Proxy(r, {
|
|
1970
1976
|
get(i, o) {
|
|
1971
|
-
if (x(s), o ===
|
|
1977
|
+
if (x(s), o === St)
|
|
1972
1978
|
return () => {
|
|
1973
|
-
|
|
1979
|
+
Ct(n), de(t), s = !0;
|
|
1974
1980
|
};
|
|
1975
1981
|
if (o === "then") {
|
|
1976
1982
|
if (e.length === 0)
|
|
@@ -1995,7 +2001,7 @@ function N(t, e = [], r = function() {
|
|
|
1995
2001
|
apply(i, o, a) {
|
|
1996
2002
|
x(s);
|
|
1997
2003
|
const l = e[e.length - 1];
|
|
1998
|
-
if (l ===
|
|
2004
|
+
if (l === $t)
|
|
1999
2005
|
return $(t, {
|
|
2000
2006
|
type: "ENDPOINT"
|
|
2001
2007
|
}).then(P);
|
|
@@ -2018,23 +2024,23 @@ function N(t, e = [], r = function() {
|
|
|
2018
2024
|
}, l).then(P);
|
|
2019
2025
|
}
|
|
2020
2026
|
});
|
|
2021
|
-
return
|
|
2027
|
+
return xt(n, t), n;
|
|
2022
2028
|
}
|
|
2023
|
-
function
|
|
2029
|
+
function Ft(t) {
|
|
2024
2030
|
return Array.prototype.concat.apply([], t);
|
|
2025
2031
|
}
|
|
2026
2032
|
function X(t) {
|
|
2027
2033
|
const e = t.map(U);
|
|
2028
|
-
return [e.map((r) => r[0]),
|
|
2034
|
+
return [e.map((r) => r[0]), Ft(e.map((r) => r[1]))];
|
|
2029
2035
|
}
|
|
2030
|
-
const
|
|
2031
|
-
function
|
|
2032
|
-
return
|
|
2036
|
+
const pe = /* @__PURE__ */ new WeakMap();
|
|
2037
|
+
function kt(t, e) {
|
|
2038
|
+
return pe.set(t, e), t;
|
|
2033
2039
|
}
|
|
2034
|
-
function
|
|
2035
|
-
return Object.assign(t, { [
|
|
2040
|
+
function fe(t) {
|
|
2041
|
+
return Object.assign(t, { [le]: !0 });
|
|
2036
2042
|
}
|
|
2037
|
-
function
|
|
2043
|
+
function Ot(t, e = globalThis, r = "*") {
|
|
2038
2044
|
return {
|
|
2039
2045
|
postMessage: (s, n) => t.postMessage(s, r, n),
|
|
2040
2046
|
addEventListener: e.addEventListener.bind(e),
|
|
@@ -2059,7 +2065,7 @@ function U(t) {
|
|
|
2059
2065
|
type: "RAW",
|
|
2060
2066
|
value: t
|
|
2061
2067
|
},
|
|
2062
|
-
|
|
2068
|
+
pe.get(t) || []
|
|
2063
2069
|
];
|
|
2064
2070
|
}
|
|
2065
2071
|
function P(t) {
|
|
@@ -2072,22 +2078,25 @@ function P(t) {
|
|
|
2072
2078
|
}
|
|
2073
2079
|
function $(t, e, r) {
|
|
2074
2080
|
return new Promise((s) => {
|
|
2075
|
-
const n =
|
|
2081
|
+
const n = Ut();
|
|
2076
2082
|
t.addEventListener("message", function i(o) {
|
|
2077
2083
|
!o.data || !o.data.id || o.data.id !== n || (t.removeEventListener("message", i), s(o.data));
|
|
2078
2084
|
}), t.start && t.start(), t.postMessage(Object.assign({ id: n }, e), r);
|
|
2079
2085
|
});
|
|
2080
2086
|
}
|
|
2081
|
-
function
|
|
2087
|
+
function Ut() {
|
|
2082
2088
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
2083
2089
|
}
|
|
2084
|
-
function
|
|
2085
|
-
|
|
2086
|
-
const e = t instanceof Worker ? t :
|
|
2087
|
-
return
|
|
2090
|
+
function me(t) {
|
|
2091
|
+
At();
|
|
2092
|
+
const e = t instanceof Worker ? t : Ot(t), r = M(e), s = we(r);
|
|
2093
|
+
return new Proxy(s, {
|
|
2094
|
+
get: (n, i) => i === "isConnected" ? () => r.isConnected() : r[i]
|
|
2095
|
+
});
|
|
2088
2096
|
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2097
|
+
let Z = !1;
|
|
2098
|
+
function At() {
|
|
2099
|
+
Z || (Z = !0, R.set("EVENT", {
|
|
2091
2100
|
canHandle: (t) => t instanceof CustomEvent,
|
|
2092
2101
|
serialize: (t) => [
|
|
2093
2102
|
{
|
|
@@ -2114,12 +2123,30 @@ function Ot() {
|
|
|
2114
2123
|
deserialize(t) {
|
|
2115
2124
|
return v.fromRawData(t);
|
|
2116
2125
|
}
|
|
2126
|
+
}));
|
|
2127
|
+
}
|
|
2128
|
+
function we(t) {
|
|
2129
|
+
return new Proxy(t, {
|
|
2130
|
+
get(e, r) {
|
|
2131
|
+
switch (typeof e[r]) {
|
|
2132
|
+
case "function":
|
|
2133
|
+
return (...s) => e[r](...s);
|
|
2134
|
+
case "object":
|
|
2135
|
+
return e[r] === null ? e[r] : we(e[r]);
|
|
2136
|
+
case "undefined":
|
|
2137
|
+
case "number":
|
|
2138
|
+
case "string":
|
|
2139
|
+
return e[r];
|
|
2140
|
+
default:
|
|
2141
|
+
return fe(e[r]);
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2117
2144
|
});
|
|
2118
2145
|
}
|
|
2119
2146
|
(function() {
|
|
2120
2147
|
return typeof navigator < "u" && navigator?.userAgent?.toLowerCase().indexOf("firefox") > -1 ? "iframe" : "webworker";
|
|
2121
2148
|
})();
|
|
2122
|
-
async function
|
|
2149
|
+
async function Lt({
|
|
2123
2150
|
iframe: t,
|
|
2124
2151
|
blueprint: e,
|
|
2125
2152
|
remoteUrl: r,
|
|
@@ -2127,92 +2154,92 @@ async function Ut({
|
|
|
2127
2154
|
disableProgressBar: n,
|
|
2128
2155
|
onBlueprintStepCompleted: i
|
|
2129
2156
|
}) {
|
|
2130
|
-
if (
|
|
2157
|
+
if (Ht(r), r = te(r, {
|
|
2131
2158
|
progressbar: !n
|
|
2132
2159
|
}), s.setCaption("Preparing WordPress"), !e)
|
|
2133
|
-
return
|
|
2134
|
-
const o =
|
|
2160
|
+
return ee(t, r, s);
|
|
2161
|
+
const o = gt(e, {
|
|
2135
2162
|
progress: s.stage(0.5),
|
|
2136
2163
|
onStepCompleted: i
|
|
2137
|
-
}), a = await
|
|
2164
|
+
}), a = await ee(
|
|
2138
2165
|
t,
|
|
2139
|
-
|
|
2166
|
+
te(r, {
|
|
2140
2167
|
php: o.versions.php,
|
|
2141
2168
|
wp: o.versions.wp
|
|
2142
2169
|
}),
|
|
2143
2170
|
s
|
|
2144
2171
|
);
|
|
2145
|
-
return await
|
|
2172
|
+
return await _t(o, a), s.finish(), a;
|
|
2146
2173
|
}
|
|
2147
|
-
async function
|
|
2148
|
-
await new Promise((
|
|
2149
|
-
t.src = e, t.addEventListener("load",
|
|
2174
|
+
async function ee(t, e, r) {
|
|
2175
|
+
await new Promise((i) => {
|
|
2176
|
+
t.src = e, t.addEventListener("load", i, !1);
|
|
2150
2177
|
});
|
|
2151
|
-
const s =
|
|
2178
|
+
const s = me(
|
|
2152
2179
|
t.contentWindow
|
|
2153
2180
|
);
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
), await s.isReady(), s;
|
|
2181
|
+
await s.isConnected(), r.pipe(s);
|
|
2182
|
+
const n = r.stage();
|
|
2183
|
+
return await s.onDownloadProgress(n.loadingListener), await s.isReady(), n.finish(), s;
|
|
2157
2184
|
}
|
|
2158
2185
|
const F = "https://playground.wordpress.net";
|
|
2159
|
-
function
|
|
2186
|
+
function Ht(t) {
|
|
2160
2187
|
const e = new URL(t, F);
|
|
2161
2188
|
if ((e.origin === F || e.hostname === "localhost") && e.pathname !== "/remote.html")
|
|
2162
2189
|
throw new Error(
|
|
2163
2190
|
`Invalid remote URL: ${e}. Expected origin to be ${F}/remote.html.`
|
|
2164
2191
|
);
|
|
2165
2192
|
}
|
|
2166
|
-
function
|
|
2193
|
+
function te(t, e) {
|
|
2167
2194
|
const r = new URL(t, F), s = new URLSearchParams(r.search);
|
|
2168
2195
|
for (const [n, i] of Object.entries(e))
|
|
2169
2196
|
i != null && i !== !1 && s.set(n, i.toString());
|
|
2170
2197
|
return r.search = s.toString(), r.toString();
|
|
2171
2198
|
}
|
|
2172
|
-
async function
|
|
2199
|
+
async function Nt(t, e) {
|
|
2173
2200
|
if (console.warn(
|
|
2174
2201
|
"`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."
|
|
2175
2202
|
), e?.loadRemote)
|
|
2176
|
-
return
|
|
2203
|
+
return Lt({
|
|
2177
2204
|
iframe: t,
|
|
2178
2205
|
remoteUrl: e.loadRemote
|
|
2179
2206
|
});
|
|
2180
|
-
const r =
|
|
2207
|
+
const r = me(
|
|
2181
2208
|
t.contentWindow
|
|
2182
2209
|
);
|
|
2183
2210
|
return await r.isConnected(), r;
|
|
2184
2211
|
}
|
|
2185
2212
|
export {
|
|
2186
|
-
|
|
2213
|
+
Ke as LatestSupportedPHPVersion,
|
|
2187
2214
|
D as SupportedPHPVersions,
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2215
|
+
It as SupportedPHPVersionsList,
|
|
2216
|
+
be as activatePlugin,
|
|
2217
|
+
_e as applyWordPressPatches,
|
|
2218
|
+
gt as compileBlueprint,
|
|
2219
|
+
Nt as connectPlayground,
|
|
2220
|
+
Te as cp,
|
|
2221
|
+
Ue as defineSiteUrl,
|
|
2222
|
+
Ie as importFile,
|
|
2223
|
+
De as installPlugin,
|
|
2224
|
+
qe as installTheme,
|
|
2225
|
+
We as login,
|
|
2226
|
+
Ce as mkdir,
|
|
2227
|
+
xe as mv,
|
|
2201
2228
|
S as phpVar,
|
|
2202
2229
|
z as phpVars,
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2230
|
+
He as replaceSite,
|
|
2231
|
+
Re as request,
|
|
2232
|
+
Fe as rm,
|
|
2233
|
+
ke as rmdir,
|
|
2234
|
+
_t as runBlueprintSteps,
|
|
2235
|
+
Se as runPHP,
|
|
2236
|
+
ve as runPHPWithOptions,
|
|
2237
|
+
Me as runWpInstallationWizard,
|
|
2238
|
+
Ee as setPhpIniEntry,
|
|
2239
|
+
je as setSiteOptions,
|
|
2240
|
+
Lt as startPlaygroundWeb,
|
|
2241
|
+
se as unzip,
|
|
2242
|
+
Be as updateUserMeta,
|
|
2243
|
+
Oe as writeFile,
|
|
2244
|
+
Le as zipEntireSite
|
|
2218
2245
|
};
|