@wp-playground/blueprints 0.1.60 → 0.1.61
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 +27 -23
- package/index.js +544 -523
- package/lib/steps/apply-wordpress-patches/index.d.ts +2 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const Z = async (r, { pluginPath: e, pluginName: t }, s) => {
|
|
2
|
+
s?.tracker.setCaption(`Activating ${t || e}`);
|
|
3
3
|
const i = [
|
|
4
|
-
`${await
|
|
5
|
-
`${await
|
|
4
|
+
`${await r.documentRoot}/wp-load.php`,
|
|
5
|
+
`${await r.documentRoot}/wp-admin/includes/plugin.php`
|
|
6
6
|
];
|
|
7
7
|
if (!i.every(
|
|
8
|
-
(a) =>
|
|
8
|
+
(a) => r.fileExists(a)
|
|
9
9
|
))
|
|
10
10
|
throw new Error(
|
|
11
11
|
`Required WordPress files do not exist: ${i.join(", ")}`
|
|
12
12
|
);
|
|
13
|
-
if ((await
|
|
13
|
+
if ((await r.run({
|
|
14
14
|
code: `<?php
|
|
15
15
|
define( 'WP_ADMIN', true );
|
|
16
16
|
${i.map((a) => `require_once( '${a}' );`).join(`
|
|
@@ -32,33 +32,33 @@ echo 'NO_ENTRY_FILE';
|
|
|
32
32
|
`
|
|
33
33
|
})).text.endsWith("NO_ENTRY_FILE"))
|
|
34
34
|
throw new Error("Could not find plugin entry file.");
|
|
35
|
-
},
|
|
35
|
+
}, Q = async (r, { themeFolderName: e }, t) => {
|
|
36
36
|
t?.tracker.setCaption(`Activating ${e}`);
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
37
|
+
const s = `${await r.documentRoot}/wp-load.php`;
|
|
38
|
+
if (!r.fileExists(s))
|
|
39
39
|
throw new Error(
|
|
40
|
-
`Required WordPress file does not exist: ${
|
|
40
|
+
`Required WordPress file does not exist: ${s}`
|
|
41
41
|
);
|
|
42
|
-
await
|
|
42
|
+
await r.run({
|
|
43
43
|
code: `<?php
|
|
44
44
|
define( 'WP_ADMIN', true );
|
|
45
|
-
require_once( '${
|
|
45
|
+
require_once( '${s}' );
|
|
46
46
|
switch_theme( '${e}' );
|
|
47
47
|
`
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
-
function
|
|
51
|
-
const e =
|
|
50
|
+
function v(r) {
|
|
51
|
+
const e = r.split(".").shift().replace(/-/g, " ");
|
|
52
52
|
return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
53
53
|
}
|
|
54
|
-
async function
|
|
55
|
-
let
|
|
56
|
-
await
|
|
54
|
+
async function b(r, e, t) {
|
|
55
|
+
let s = "";
|
|
56
|
+
await r.fileExists(e) && (s = await r.readFileAsText(e)), await r.writeFile(e, t(s));
|
|
57
57
|
}
|
|
58
|
-
async function
|
|
59
|
-
return new Uint8Array(await
|
|
58
|
+
async function ce(r) {
|
|
59
|
+
return new Uint8Array(await r.arrayBuffer());
|
|
60
60
|
}
|
|
61
|
-
class
|
|
61
|
+
class le extends File {
|
|
62
62
|
constructor(e, t) {
|
|
63
63
|
super(e, t), this.buffers = e;
|
|
64
64
|
}
|
|
@@ -66,27 +66,34 @@ class ce extends File {
|
|
|
66
66
|
return this.buffers[0];
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
const t =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
const T = File.prototype.arrayBuffer instanceof Function ? File : le, O = "/vfs-blueprints", x = async (r, { consts: e, virtualize: t = !1 }) => {
|
|
70
|
+
const s = await r.documentRoot, i = t ? O : s, n = `${i}/playground-consts.json`, o = `${i}/wp-config.php`;
|
|
71
|
+
return t && (r.mkdir(O), r.setPhpIniEntry("auto_prepend_file", o)), await b(
|
|
72
|
+
r,
|
|
73
|
+
n,
|
|
74
|
+
(a) => JSON.stringify({
|
|
75
|
+
...JSON.parse(a || "{}"),
|
|
76
|
+
...e
|
|
77
|
+
})
|
|
78
|
+
), await b(r, o, (a) => a.includes("playground-consts.json") ? a : `<?php
|
|
79
|
+
$consts = json_decode(file_get_contents('${n}'), true);
|
|
80
|
+
foreach ($consts as $const => $value) {
|
|
81
|
+
if (!defined($const)) {
|
|
82
|
+
define($const, $value);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
?>${a}`), o;
|
|
86
|
+
}, he = async (r, e) => {
|
|
87
|
+
const t = new ue(
|
|
88
|
+
r,
|
|
89
|
+
e.wordpressPath || "/wordpress",
|
|
90
|
+
e.siteUrl
|
|
74
91
|
);
|
|
75
|
-
e.
|
|
92
|
+
e.addPhpInfo === !0 && await t.addPhpInfo(), e.siteUrl && await t.patchSiteUrl(), e.patchSecrets === !0 && await t.patchSecrets(), e.disableSiteHealth === !0 && await t.disableSiteHealth(), e.disableWpNewBlogNotification === !0 && await t.disableWpNewBlogNotification();
|
|
76
93
|
};
|
|
77
|
-
class
|
|
78
|
-
constructor(e, t,
|
|
79
|
-
this.php = e, this.scopedSiteUrl =
|
|
80
|
-
}
|
|
81
|
-
async patchSqlitePlugin() {
|
|
82
|
-
await P(
|
|
83
|
-
this.php,
|
|
84
|
-
`${this.wordpressPath}/wp-content/plugins/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-translator.php`,
|
|
85
|
-
(e) => e.replace(
|
|
86
|
-
"if ( false === strtotime( $value ) )",
|
|
87
|
-
'if ( $value === "0000-00-00 00:00:00" || false === strtotime( $value ) )'
|
|
88
|
-
)
|
|
89
|
-
);
|
|
94
|
+
class ue {
|
|
95
|
+
constructor(e, t, s) {
|
|
96
|
+
this.php = e, this.scopedSiteUrl = s, this.wordpressPath = t;
|
|
90
97
|
}
|
|
91
98
|
async addPhpInfo() {
|
|
92
99
|
await this.php.writeFile(
|
|
@@ -95,19 +102,32 @@ class he {
|
|
|
95
102
|
);
|
|
96
103
|
}
|
|
97
104
|
async patchSiteUrl() {
|
|
98
|
-
await
|
|
105
|
+
await x(this.php, {
|
|
106
|
+
consts: {
|
|
107
|
+
WP_HOME: this.scopedSiteUrl,
|
|
108
|
+
WP_SITEURL: this.scopedSiteUrl
|
|
109
|
+
},
|
|
110
|
+
virtualize: !0
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async patchSecrets() {
|
|
114
|
+
await b(
|
|
99
115
|
this.php,
|
|
100
116
|
`${this.wordpressPath}/wp-config.php`,
|
|
101
117
|
(e) => `<?php
|
|
102
|
-
|
|
103
|
-
define('
|
|
104
|
-
define('
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
define('AUTH_KEY', '${g(40)}');
|
|
119
|
+
define('SECURE_AUTH_KEY', '${g(40)}');
|
|
120
|
+
define('LOGGED_IN_KEY', '${g(40)}');
|
|
121
|
+
define('NONCE_KEY', '${g(40)}');
|
|
122
|
+
define('AUTH_SALT', '${g(40)}');
|
|
123
|
+
define('SECURE_AUTH_SALT', '${g(40)}');
|
|
124
|
+
define('LOGGED_IN_SALT', '${g(40)}');
|
|
125
|
+
define('NONCE_SALT', '${g(40)}');
|
|
126
|
+
?>${e.replaceAll("', 'put your unique phrase here'", "__', ''")}`
|
|
107
127
|
);
|
|
108
128
|
}
|
|
109
129
|
async disableSiteHealth() {
|
|
110
|
-
await
|
|
130
|
+
await b(
|
|
111
131
|
this.php,
|
|
112
132
|
`${this.wordpressPath}/wp-includes/default-filters.php`,
|
|
113
133
|
(e) => e.replace(
|
|
@@ -117,7 +137,7 @@ class he {
|
|
|
117
137
|
);
|
|
118
138
|
}
|
|
119
139
|
async disableWpNewBlogNotification() {
|
|
120
|
-
await
|
|
140
|
+
await b(
|
|
121
141
|
this.php,
|
|
122
142
|
`${this.wordpressPath}/wp-config.php`,
|
|
123
143
|
// The original version of this function crashes WASM PHP, let's define an empty one instead.
|
|
@@ -125,47 +145,37 @@ class he {
|
|
|
125
145
|
);
|
|
126
146
|
}
|
|
127
147
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
148
|
+
function g(r) {
|
|
149
|
+
const e = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+=-[]/.,<>?";
|
|
150
|
+
let t = "";
|
|
151
|
+
for (let s = r; s > 0; --s)
|
|
152
|
+
t += e[Math.floor(Math.random() * e.length)];
|
|
153
|
+
return t;
|
|
154
|
+
}
|
|
155
|
+
const pe = async (r, { code: e }) => await r.run({ code: e }), de = async (r, { options: e }) => await r.run(e), fe = async (r, { key: e, value: t }) => {
|
|
156
|
+
await r.setPhpIniEntry(e, t);
|
|
157
|
+
}, me = async (r, { request: e }) => await r.request(e), we = async (r, { fromPath: e, toPath: t }) => {
|
|
158
|
+
await r.writeFile(
|
|
132
159
|
t,
|
|
133
|
-
await
|
|
160
|
+
await r.readFileAsBuffer(e)
|
|
134
161
|
);
|
|
135
|
-
},
|
|
136
|
-
await
|
|
137
|
-
},
|
|
138
|
-
await
|
|
139
|
-
},
|
|
140
|
-
await
|
|
141
|
-
}, Pe = async (
|
|
142
|
-
await
|
|
143
|
-
},
|
|
144
|
-
t instanceof File && (t = await
|
|
145
|
-
},
|
|
146
|
-
const r = await s.documentRoot, i = t ? N : r, n = `${i}/playground-consts.json`, o = `${i}/wp-config.php`;
|
|
147
|
-
return t && (s.mkdir(N), s.setPhpIniEntry("auto_prepend_file", o)), await P(
|
|
148
|
-
s,
|
|
149
|
-
n,
|
|
150
|
-
(a) => JSON.stringify({
|
|
151
|
-
...JSON.parse(a || "{}"),
|
|
152
|
-
...e
|
|
153
|
-
})
|
|
154
|
-
), await P(s, o, (a) => a.includes("playground-consts.json") ? a : `<?php
|
|
155
|
-
$consts = json_decode(file_get_contents('${n}'), true);
|
|
156
|
-
foreach ($consts as $const => $value) {
|
|
157
|
-
if (!defined($const)) {
|
|
158
|
-
define($const, $value);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
?>${a}`), o;
|
|
162
|
-
}, _e = async (s, { siteUrl: e }) => await Q(s, {
|
|
162
|
+
}, ge = async (r, { fromPath: e, toPath: t }) => {
|
|
163
|
+
await r.mv(e, t);
|
|
164
|
+
}, ye = async (r, { path: e }) => {
|
|
165
|
+
await r.mkdir(e);
|
|
166
|
+
}, _e = async (r, { path: e }) => {
|
|
167
|
+
await r.unlink(e);
|
|
168
|
+
}, Pe = async (r, { path: e }) => {
|
|
169
|
+
await r.rmdir(e);
|
|
170
|
+
}, X = async (r, { path: e, data: t }) => {
|
|
171
|
+
t instanceof File && (t = await ce(t)), await r.writeFile(e, t);
|
|
172
|
+
}, $e = async (r, { siteUrl: e }) => await x(r, {
|
|
163
173
|
consts: {
|
|
164
174
|
WP_HOME: e,
|
|
165
175
|
WP_SITEURL: e
|
|
166
176
|
}
|
|
167
177
|
});
|
|
168
|
-
class
|
|
178
|
+
class ee {
|
|
169
179
|
constructor({ concurrency: e }) {
|
|
170
180
|
this._running = 0, this.concurrency = e, this.queue = [];
|
|
171
181
|
}
|
|
@@ -176,10 +186,13 @@ class X {
|
|
|
176
186
|
for (; ; )
|
|
177
187
|
if (this._running >= this.concurrency)
|
|
178
188
|
await new Promise((e) => this.queue.push(e));
|
|
179
|
-
else
|
|
180
|
-
|
|
181
|
-
|
|
189
|
+
else {
|
|
190
|
+
this._running++;
|
|
191
|
+
let e = !1;
|
|
192
|
+
return () => {
|
|
193
|
+
e || (e = !0, this._running--, this.queue.length > 0 && this.queue.shift()());
|
|
182
194
|
};
|
|
195
|
+
}
|
|
183
196
|
}
|
|
184
197
|
async run(e) {
|
|
185
198
|
const t = await this.acquire();
|
|
@@ -190,29 +203,29 @@ class X {
|
|
|
190
203
|
}
|
|
191
204
|
}
|
|
192
205
|
}
|
|
193
|
-
const
|
|
194
|
-
function $(
|
|
195
|
-
if (typeof
|
|
196
|
-
return
|
|
197
|
-
if (typeof
|
|
198
|
-
return
|
|
199
|
-
if (Array.isArray(
|
|
200
|
-
return `array(${
|
|
201
|
-
if (
|
|
206
|
+
const be = Symbol("literal");
|
|
207
|
+
function $(r) {
|
|
208
|
+
if (typeof r == "string")
|
|
209
|
+
return r.startsWith("$") ? r : JSON.stringify(r);
|
|
210
|
+
if (typeof r == "number")
|
|
211
|
+
return r.toString();
|
|
212
|
+
if (Array.isArray(r))
|
|
213
|
+
return `array(${r.map($).join(", ")})`;
|
|
214
|
+
if (r === null)
|
|
202
215
|
return "null";
|
|
203
|
-
if (typeof
|
|
204
|
-
return
|
|
205
|
-
if (typeof
|
|
206
|
-
return
|
|
207
|
-
throw new Error(`Unsupported value: ${
|
|
216
|
+
if (typeof r == "object")
|
|
217
|
+
return be in r ? r.toString() : `array(${Object.entries(r).map(([t, s]) => `${JSON.stringify(t)} => ${$(s)}`).join(", ")})`;
|
|
218
|
+
if (typeof r == "function")
|
|
219
|
+
return r();
|
|
220
|
+
throw new Error(`Unsupported value: ${r}`);
|
|
208
221
|
}
|
|
209
|
-
function
|
|
222
|
+
function F(r) {
|
|
210
223
|
const e = {};
|
|
211
|
-
for (const t in
|
|
212
|
-
e[t] = $(
|
|
224
|
+
for (const t in r)
|
|
225
|
+
e[t] = $(r[t]);
|
|
213
226
|
return e;
|
|
214
227
|
}
|
|
215
|
-
const
|
|
228
|
+
const H = `<?php
|
|
216
229
|
|
|
217
230
|
function zipDir($dir, $output, $additionalFiles = array())
|
|
218
231
|
{
|
|
@@ -275,29 +288,29 @@ function delTree($dir)
|
|
|
275
288
|
return rmdir($dir);
|
|
276
289
|
}
|
|
277
290
|
`;
|
|
278
|
-
async function
|
|
279
|
-
const e = "wordpress-playground.zip", t = `/${e}`,
|
|
291
|
+
async function ve(r) {
|
|
292
|
+
const e = "wordpress-playground.zip", t = `/${e}`, s = F({
|
|
280
293
|
zipPath: t,
|
|
281
|
-
documentRoot: await
|
|
294
|
+
documentRoot: await r.documentRoot
|
|
282
295
|
});
|
|
283
|
-
await
|
|
284
|
-
|
|
285
|
-
`zipDir(${
|
|
296
|
+
await te(
|
|
297
|
+
r,
|
|
298
|
+
`zipDir(${s.documentRoot}, ${s.zipPath});`
|
|
286
299
|
);
|
|
287
|
-
const i = await
|
|
288
|
-
return
|
|
300
|
+
const i = await r.readFileAsBuffer(t);
|
|
301
|
+
return r.unlink(t), new File([i], e);
|
|
289
302
|
}
|
|
290
|
-
const
|
|
303
|
+
const Ee = async (r, { fullSiteZip: e }) => {
|
|
291
304
|
const t = "/import.zip";
|
|
292
|
-
await
|
|
305
|
+
await r.writeFile(
|
|
293
306
|
t,
|
|
294
307
|
new Uint8Array(await e.arrayBuffer())
|
|
295
308
|
);
|
|
296
|
-
const
|
|
297
|
-
await
|
|
298
|
-
const n =
|
|
299
|
-
await
|
|
300
|
-
|
|
309
|
+
const s = await r.absoluteUrl, i = await r.documentRoot;
|
|
310
|
+
await r.rmdir(i), await C(r, { zipPath: t, extractToPath: "/" });
|
|
311
|
+
const n = F({ absoluteUrl: s });
|
|
312
|
+
await Te(
|
|
313
|
+
r,
|
|
301
314
|
`${i}/wp-config.php`,
|
|
302
315
|
(o) => `<?php
|
|
303
316
|
if(!defined('WP_HOME')) {
|
|
@@ -306,122 +319,122 @@ const ve = async (s, { fullSiteZip: e }) => {
|
|
|
306
319
|
}
|
|
307
320
|
?>${o}`
|
|
308
321
|
);
|
|
309
|
-
},
|
|
310
|
-
const
|
|
322
|
+
}, C = async (r, { zipPath: e, extractToPath: t }) => {
|
|
323
|
+
const s = F({
|
|
311
324
|
zipPath: e,
|
|
312
325
|
extractToPath: t
|
|
313
326
|
});
|
|
314
|
-
await
|
|
315
|
-
|
|
316
|
-
`unzip(${
|
|
327
|
+
await te(
|
|
328
|
+
r,
|
|
329
|
+
`unzip(${s.zipPath}, ${s.extractToPath});`
|
|
317
330
|
);
|
|
318
|
-
},
|
|
319
|
-
const t = await
|
|
331
|
+
}, Se = async (r, { file: e }) => {
|
|
332
|
+
const t = await r.request({
|
|
320
333
|
url: "/wp-admin/admin.php?import=wordpress"
|
|
321
|
-
}),
|
|
322
|
-
url: `/wp-admin/${
|
|
334
|
+
}), s = I(t).getElementById("import-upload-form")?.getAttribute("action"), i = await r.request({
|
|
335
|
+
url: `/wp-admin/${s}`,
|
|
323
336
|
method: "POST",
|
|
324
337
|
files: { import: e }
|
|
325
|
-
}), n =
|
|
338
|
+
}), n = I(i).querySelector(
|
|
326
339
|
"#wpbody-content form"
|
|
327
340
|
);
|
|
328
341
|
if (!n)
|
|
329
342
|
throw console.log(i.text), new Error(
|
|
330
343
|
"Could not find an importer form in response. See the response text above for details."
|
|
331
344
|
);
|
|
332
|
-
const o =
|
|
345
|
+
const o = Re(n);
|
|
333
346
|
o.fetch_attachments = "1";
|
|
334
347
|
for (const a in o)
|
|
335
348
|
if (a.startsWith("user_map[")) {
|
|
336
349
|
const l = "user_new[" + a.slice(9, -1) + "]";
|
|
337
350
|
o[l] = "1";
|
|
338
351
|
}
|
|
339
|
-
await
|
|
352
|
+
await r.request({
|
|
340
353
|
url: n.action,
|
|
341
354
|
method: "POST",
|
|
342
355
|
formData: o
|
|
343
356
|
});
|
|
344
357
|
};
|
|
345
|
-
function
|
|
346
|
-
return new DOMParser().parseFromString(
|
|
358
|
+
function I(r) {
|
|
359
|
+
return new DOMParser().parseFromString(r.text, "text/html");
|
|
347
360
|
}
|
|
348
|
-
function
|
|
349
|
-
return Object.fromEntries(new FormData(
|
|
361
|
+
function Re(r) {
|
|
362
|
+
return Object.fromEntries(new FormData(r).entries());
|
|
350
363
|
}
|
|
351
|
-
async function
|
|
352
|
-
await
|
|
364
|
+
async function Te(r, e, t) {
|
|
365
|
+
await r.writeFile(
|
|
353
366
|
e,
|
|
354
|
-
t(await
|
|
367
|
+
t(await r.readFileAsText(e))
|
|
355
368
|
);
|
|
356
369
|
}
|
|
357
|
-
async function
|
|
358
|
-
const t = await
|
|
359
|
-
code:
|
|
370
|
+
async function te(r, e) {
|
|
371
|
+
const t = await r.run({
|
|
372
|
+
code: H + e
|
|
360
373
|
});
|
|
361
374
|
if (t.exitCode !== 0)
|
|
362
|
-
throw console.log(
|
|
375
|
+
throw console.log(H + e), console.log(e + ""), console.log(t.errors), t.errors;
|
|
363
376
|
return t;
|
|
364
377
|
}
|
|
365
|
-
async function
|
|
366
|
-
const
|
|
378
|
+
async function re(r, { targetPath: e, zipFile: t }) {
|
|
379
|
+
const s = t.name, i = s.replace(/\.zip$/, ""), n = `/tmp/assets/${i}`, o = `/tmp/${s}`, a = () => r.rmdir(n, {
|
|
367
380
|
recursive: !0
|
|
368
381
|
});
|
|
369
|
-
await
|
|
382
|
+
await r.fileExists(n) && await a(), await X(r, {
|
|
370
383
|
path: o,
|
|
371
384
|
data: t
|
|
372
385
|
});
|
|
373
|
-
const l = () => Promise.all([a, () =>
|
|
386
|
+
const l = () => Promise.all([a, () => r.unlink(o)]);
|
|
374
387
|
try {
|
|
375
|
-
await
|
|
388
|
+
await C(r, {
|
|
376
389
|
zipPath: o,
|
|
377
390
|
extractToPath: n
|
|
378
391
|
});
|
|
379
|
-
const c = await
|
|
392
|
+
const c = await r.listFiles(n, {
|
|
380
393
|
prependPath: !0
|
|
381
|
-
}), u = c.length === 1 && await
|
|
382
|
-
let d,
|
|
383
|
-
u ? (
|
|
384
|
-
const
|
|
385
|
-
return await
|
|
386
|
-
assetFolderPath:
|
|
394
|
+
}), u = c.length === 1 && await r.isDir(c[0]);
|
|
395
|
+
let d, E = "";
|
|
396
|
+
u ? (E = c[0], d = c[0].split("/").pop()) : (E = n, d = i);
|
|
397
|
+
const L = `${e}/${d}`;
|
|
398
|
+
return await r.mv(E, L), await l(), {
|
|
399
|
+
assetFolderPath: L,
|
|
387
400
|
assetFolderName: d
|
|
388
401
|
};
|
|
389
402
|
} catch (c) {
|
|
390
403
|
throw await l(), c;
|
|
391
404
|
}
|
|
392
405
|
}
|
|
393
|
-
const xe = async (
|
|
394
|
-
const i = e.name.split("/").pop() || "plugin.zip", n =
|
|
395
|
-
|
|
406
|
+
const xe = async (r, { pluginZipFile: e, options: t = {} }, s) => {
|
|
407
|
+
const i = e.name.split("/").pop() || "plugin.zip", n = v(i);
|
|
408
|
+
s?.tracker.setCaption(`Installing the ${n} plugin`);
|
|
396
409
|
try {
|
|
397
|
-
const { assetFolderPath: o } = await
|
|
410
|
+
const { assetFolderPath: o } = await re(r, {
|
|
398
411
|
zipFile: e,
|
|
399
|
-
targetPath: `${await
|
|
412
|
+
targetPath: `${await r.documentRoot}/wp-content/plugins`
|
|
400
413
|
});
|
|
401
|
-
("activate" in t ? t.activate : !0) && await
|
|
402
|
-
|
|
414
|
+
("activate" in t ? t.activate : !0) && await Z(
|
|
415
|
+
r,
|
|
403
416
|
{
|
|
404
417
|
pluginPath: o,
|
|
405
418
|
pluginName: n
|
|
406
419
|
},
|
|
407
|
-
|
|
408
|
-
), await Fe(
|
|
420
|
+
s
|
|
421
|
+
), await Fe(r);
|
|
409
422
|
} catch (o) {
|
|
410
423
|
console.error(
|
|
411
424
|
`Proceeding without the ${n} plugin. Could not install it in wp-admin. The original error was: ${o}`
|
|
412
425
|
), console.error(o);
|
|
413
426
|
}
|
|
414
427
|
};
|
|
415
|
-
async function Fe(
|
|
416
|
-
await
|
|
417
|
-
|
|
428
|
+
async function Fe(r) {
|
|
429
|
+
await r.isDir("/wordpress/wp-content/plugins/gutenberg") && !await r.fileExists("/wordpress/.gutenberg-patched") && (await r.writeFile("/wordpress/.gutenberg-patched", "1"), await W(
|
|
430
|
+
r,
|
|
418
431
|
"/wordpress/wp-content/plugins/gutenberg/build/block-editor/index.js",
|
|
419
432
|
(e) => e.replace(
|
|
420
433
|
/srcDoc:("[^"]+"|[^,]+)/g,
|
|
421
434
|
'src:"/wp-includes/empty.html"'
|
|
422
435
|
)
|
|
423
|
-
), await
|
|
424
|
-
|
|
436
|
+
), await W(
|
|
437
|
+
r,
|
|
425
438
|
"/wordpress/wp-content/plugins/gutenberg/build/block-editor/index.min.js",
|
|
426
439
|
(e) => e.replace(
|
|
427
440
|
/srcDoc:("[^"]+"|[^,]+)/g,
|
|
@@ -429,36 +442,36 @@ async function Fe(s) {
|
|
|
429
442
|
)
|
|
430
443
|
));
|
|
431
444
|
}
|
|
432
|
-
async function
|
|
433
|
-
return await
|
|
445
|
+
async function W(r, e, t) {
|
|
446
|
+
return await r.writeFile(
|
|
434
447
|
e,
|
|
435
|
-
t(await
|
|
448
|
+
t(await r.readFileAsText(e))
|
|
436
449
|
);
|
|
437
450
|
}
|
|
438
|
-
const
|
|
439
|
-
const i =
|
|
440
|
-
|
|
451
|
+
const Ce = async (r, { themeZipFile: e, options: t = {} }, s) => {
|
|
452
|
+
const i = v(e.name);
|
|
453
|
+
s?.tracker.setCaption(`Installing the ${i} theme`);
|
|
441
454
|
try {
|
|
442
|
-
const { assetFolderName: n } = await
|
|
455
|
+
const { assetFolderName: n } = await re(r, {
|
|
443
456
|
zipFile: e,
|
|
444
|
-
targetPath: `${await
|
|
457
|
+
targetPath: `${await r.documentRoot}/wp-content/themes`
|
|
445
458
|
});
|
|
446
|
-
("activate" in t ? t.activate : !0) && await
|
|
447
|
-
|
|
459
|
+
("activate" in t ? t.activate : !0) && await Q(
|
|
460
|
+
r,
|
|
448
461
|
{
|
|
449
462
|
themeFolderName: n
|
|
450
463
|
},
|
|
451
|
-
|
|
464
|
+
s
|
|
452
465
|
);
|
|
453
466
|
} catch (n) {
|
|
454
467
|
console.error(
|
|
455
468
|
`Proceeding without the ${i} theme. Could not install it in wp-admin. The original error was: ${n}`
|
|
456
469
|
), console.error(n);
|
|
457
470
|
}
|
|
458
|
-
}, ke = async (
|
|
459
|
-
|
|
471
|
+
}, ke = async (r, { username: e = "admin", password: t = "password" } = {}, s) => {
|
|
472
|
+
s?.tracker.setCaption(s?.initialCaption || "Logging in"), await r.request({
|
|
460
473
|
url: "/wp-login.php"
|
|
461
|
-
}), await
|
|
474
|
+
}), await r.request({
|
|
462
475
|
url: "/wp-login.php",
|
|
463
476
|
method: "POST",
|
|
464
477
|
formData: {
|
|
@@ -467,8 +480,8 @@ const Te = async (s, { themeZipFile: e, options: t = {} }, r) => {
|
|
|
467
480
|
rememberme: "forever"
|
|
468
481
|
}
|
|
469
482
|
});
|
|
470
|
-
},
|
|
471
|
-
await
|
|
483
|
+
}, Ae = async (r, { options: e }) => {
|
|
484
|
+
await r.request({
|
|
472
485
|
url: "/wp-admin/install.php?step=2",
|
|
473
486
|
method: "POST",
|
|
474
487
|
formData: {
|
|
@@ -484,7 +497,7 @@ const Te = async (s, { themeZipFile: e, options: t = {} }, r) => {
|
|
|
484
497
|
admin_email: "admin@localhost.com"
|
|
485
498
|
}
|
|
486
499
|
});
|
|
487
|
-
},
|
|
500
|
+
}, Ue = async (r, { options: e }) => {
|
|
488
501
|
const t = `<?php
|
|
489
502
|
include 'wordpress/wp-load.php';
|
|
490
503
|
$site_options = ${$(e)};
|
|
@@ -492,57 +505,57 @@ const Te = async (s, { themeZipFile: e, options: t = {} }, r) => {
|
|
|
492
505
|
update_option($name, $value);
|
|
493
506
|
}
|
|
494
507
|
echo "Success";
|
|
495
|
-
`,
|
|
508
|
+
`, s = await r.run({
|
|
496
509
|
code: t
|
|
497
510
|
});
|
|
498
|
-
return se(
|
|
499
|
-
},
|
|
500
|
-
const
|
|
511
|
+
return se(s), { code: t, result: s };
|
|
512
|
+
}, Ne = async (r, { meta: e, userId: t }) => {
|
|
513
|
+
const s = `<?php
|
|
501
514
|
include 'wordpress/wp-load.php';
|
|
502
515
|
$meta = ${$(e)};
|
|
503
516
|
foreach($meta as $name => $value) {
|
|
504
517
|
update_user_meta(${$(t)}, $name, $value);
|
|
505
518
|
}
|
|
506
519
|
echo "Success";
|
|
507
|
-
`, i = await
|
|
508
|
-
code:
|
|
520
|
+
`, i = await r.run({
|
|
521
|
+
code: s
|
|
509
522
|
});
|
|
510
|
-
return se(i), { code:
|
|
523
|
+
return se(i), { code: s, result: i };
|
|
511
524
|
};
|
|
512
|
-
async function se(
|
|
513
|
-
if (
|
|
514
|
-
throw console.log(
|
|
525
|
+
async function se(r) {
|
|
526
|
+
if (r.text !== "Success")
|
|
527
|
+
throw console.log(r), new Error(`Failed to run code: ${r.text} ${r.errors}`);
|
|
515
528
|
}
|
|
516
|
-
const
|
|
529
|
+
const Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
517
530
|
__proto__: null,
|
|
518
|
-
activatePlugin:
|
|
519
|
-
activateTheme:
|
|
520
|
-
applyWordPressPatches:
|
|
521
|
-
cp:
|
|
522
|
-
defineSiteUrl:
|
|
523
|
-
defineWpConfigConsts:
|
|
524
|
-
importFile:
|
|
531
|
+
activatePlugin: Z,
|
|
532
|
+
activateTheme: Q,
|
|
533
|
+
applyWordPressPatches: he,
|
|
534
|
+
cp: we,
|
|
535
|
+
defineSiteUrl: $e,
|
|
536
|
+
defineWpConfigConsts: x,
|
|
537
|
+
importFile: Se,
|
|
525
538
|
installPlugin: xe,
|
|
526
|
-
installTheme:
|
|
539
|
+
installTheme: Ce,
|
|
527
540
|
login: ke,
|
|
528
|
-
mkdir:
|
|
529
|
-
mv:
|
|
530
|
-
replaceSite:
|
|
531
|
-
request:
|
|
532
|
-
rm:
|
|
541
|
+
mkdir: ye,
|
|
542
|
+
mv: ge,
|
|
543
|
+
replaceSite: Ee,
|
|
544
|
+
request: me,
|
|
545
|
+
rm: _e,
|
|
533
546
|
rmdir: Pe,
|
|
534
|
-
runPHP:
|
|
535
|
-
runPHPWithOptions:
|
|
536
|
-
runWpInstallationWizard:
|
|
537
|
-
setPhpIniEntry:
|
|
538
|
-
setSiteOptions:
|
|
539
|
-
unzip:
|
|
540
|
-
updateUserMeta:
|
|
541
|
-
writeFile:
|
|
542
|
-
zipEntireSite:
|
|
547
|
+
runPHP: pe,
|
|
548
|
+
runPHPWithOptions: de,
|
|
549
|
+
runWpInstallationWizard: Ae,
|
|
550
|
+
setPhpIniEntry: fe,
|
|
551
|
+
setSiteOptions: Ue,
|
|
552
|
+
unzip: C,
|
|
553
|
+
updateUserMeta: Ne,
|
|
554
|
+
writeFile: X,
|
|
555
|
+
zipEntireSite: ve
|
|
543
556
|
}, Symbol.toStringTag, { value: "Module" })), Oe = 5 * 1024 * 1024;
|
|
544
|
-
function
|
|
545
|
-
const t =
|
|
557
|
+
function He(r, e) {
|
|
558
|
+
const t = r.headers.get("content-length") || "", s = parseInt(t, 10) || Oe;
|
|
546
559
|
function i(n, o) {
|
|
547
560
|
e(
|
|
548
561
|
new CustomEvent("progress", {
|
|
@@ -556,11 +569,11 @@ function Le(s, e) {
|
|
|
556
569
|
return new Response(
|
|
557
570
|
new ReadableStream({
|
|
558
571
|
async start(n) {
|
|
559
|
-
if (!
|
|
572
|
+
if (!r.body) {
|
|
560
573
|
n.close();
|
|
561
574
|
return;
|
|
562
575
|
}
|
|
563
|
-
const o =
|
|
576
|
+
const o = r.body.getReader();
|
|
564
577
|
let a = 0;
|
|
565
578
|
for (; ; )
|
|
566
579
|
try {
|
|
@@ -569,7 +582,7 @@ function Le(s, e) {
|
|
|
569
582
|
i(a, a), n.close();
|
|
570
583
|
break;
|
|
571
584
|
} else
|
|
572
|
-
i(a,
|
|
585
|
+
i(a, s), n.enqueue(c);
|
|
573
586
|
} catch (l) {
|
|
574
587
|
console.error({ e: l }), n.error(l);
|
|
575
588
|
break;
|
|
@@ -577,20 +590,20 @@ function Le(s, e) {
|
|
|
577
590
|
}
|
|
578
591
|
}),
|
|
579
592
|
{
|
|
580
|
-
status:
|
|
581
|
-
statusText:
|
|
582
|
-
headers:
|
|
593
|
+
status: r.status,
|
|
594
|
+
statusText: r.statusText,
|
|
595
|
+
headers: r.headers
|
|
583
596
|
}
|
|
584
597
|
);
|
|
585
598
|
}
|
|
586
|
-
const
|
|
587
|
-
class
|
|
599
|
+
const S = 1e-5;
|
|
600
|
+
class k extends EventTarget {
|
|
588
601
|
constructor({
|
|
589
602
|
weight: e = 1,
|
|
590
603
|
caption: t = "",
|
|
591
|
-
fillTime:
|
|
604
|
+
fillTime: s = 4
|
|
592
605
|
} = {}) {
|
|
593
|
-
super(), this._selfWeight = 1, this._selfDone = !1, this._selfProgress = 0, this._selfCaption = "", this._isFilling = !1, this._subTrackers = [], this._weight = e, this._selfCaption = t, this._fillTime =
|
|
606
|
+
super(), this._selfWeight = 1, this._selfDone = !1, this._selfProgress = 0, this._selfCaption = "", this._isFilling = !1, this._subTrackers = [], this._weight = e, this._selfCaption = t, this._fillTime = s;
|
|
594
607
|
}
|
|
595
608
|
/**
|
|
596
609
|
* Creates a new sub-tracker with a specific weight.
|
|
@@ -628,19 +641,19 @@ class T extends EventTarget {
|
|
|
628
641
|
* ```
|
|
629
642
|
*/
|
|
630
643
|
stage(e, t = "") {
|
|
631
|
-
if (e || (e = this._selfWeight), this._selfWeight - e < -
|
|
644
|
+
if (e || (e = this._selfWeight), this._selfWeight - e < -S)
|
|
632
645
|
throw new Error(
|
|
633
646
|
`Cannot add a stage with weight ${e} as the total weight of registered stages would exceed 1.`
|
|
634
647
|
);
|
|
635
648
|
this._selfWeight -= e;
|
|
636
|
-
const
|
|
649
|
+
const s = new k({
|
|
637
650
|
caption: t,
|
|
638
651
|
weight: e,
|
|
639
652
|
fillTime: this._fillTime
|
|
640
653
|
});
|
|
641
|
-
return this._subTrackers.push(
|
|
654
|
+
return this._subTrackers.push(s), s.addEventListener("progress", () => this.notifyProgress()), s.addEventListener("done", () => {
|
|
642
655
|
this.done && this.notifyDone();
|
|
643
|
-
}),
|
|
656
|
+
}), s;
|
|
644
657
|
}
|
|
645
658
|
/**
|
|
646
659
|
* Fills the progress bar slowly over time, simulating progress.
|
|
@@ -664,13 +677,13 @@ class T extends EventTarget {
|
|
|
664
677
|
if (this._isFilling)
|
|
665
678
|
return;
|
|
666
679
|
this._isFilling = !0;
|
|
667
|
-
const t = 100,
|
|
680
|
+
const t = 100, s = this._fillTime / t;
|
|
668
681
|
this._fillInterval = setInterval(() => {
|
|
669
682
|
this.set(this._selfProgress + 1), e && this._selfProgress >= 99 && clearInterval(this._fillInterval);
|
|
670
|
-
},
|
|
683
|
+
}, s);
|
|
671
684
|
}
|
|
672
685
|
set(e) {
|
|
673
|
-
this._selfProgress = Math.min(e, 100), this.notifyProgress(), this._selfProgress +
|
|
686
|
+
this._selfProgress = Math.min(e, 100), this.notifyProgress(), this._selfProgress + S >= 100 && this.finish();
|
|
674
687
|
}
|
|
675
688
|
finish() {
|
|
676
689
|
this._fillInterval && clearInterval(this._fillInterval), this._selfDone = !0, this._selfProgress = 100, this._isFilling = !1, this._fillInterval = void 0, this.notifyProgress(), this.notifyDone();
|
|
@@ -688,13 +701,13 @@ class T extends EventTarget {
|
|
|
688
701
|
this._selfCaption = e, this.notifyProgress();
|
|
689
702
|
}
|
|
690
703
|
get done() {
|
|
691
|
-
return this.progress +
|
|
704
|
+
return this.progress + S >= 100;
|
|
692
705
|
}
|
|
693
706
|
get progress() {
|
|
694
707
|
if (this._selfDone)
|
|
695
708
|
return 100;
|
|
696
709
|
const e = this._subTrackers.reduce(
|
|
697
|
-
(t,
|
|
710
|
+
(t, s) => t + s.progress * s.weight,
|
|
698
711
|
this._selfProgress * this._selfWeight
|
|
699
712
|
);
|
|
700
713
|
return Math.round(e * 1e4) / 1e4;
|
|
@@ -750,8 +763,8 @@ class T extends EventTarget {
|
|
|
750
763
|
this.dispatchEvent(new CustomEvent("done"));
|
|
751
764
|
}
|
|
752
765
|
}
|
|
753
|
-
const
|
|
754
|
-
class
|
|
766
|
+
const D = Symbol("error"), M = Symbol("message");
|
|
767
|
+
class A extends Event {
|
|
755
768
|
/**
|
|
756
769
|
* Create a new `ErrorEvent`.
|
|
757
770
|
*
|
|
@@ -760,19 +773,19 @@ class k extends Event {
|
|
|
760
773
|
* attributes via object members of the same name.
|
|
761
774
|
*/
|
|
762
775
|
constructor(e, t = {}) {
|
|
763
|
-
super(e), this[
|
|
776
|
+
super(e), this[D] = t.error === void 0 ? null : t.error, this[M] = t.message === void 0 ? "" : t.message;
|
|
764
777
|
}
|
|
765
778
|
get error() {
|
|
766
|
-
return this[
|
|
779
|
+
return this[D];
|
|
767
780
|
}
|
|
768
781
|
get message() {
|
|
769
|
-
return this[
|
|
782
|
+
return this[M];
|
|
770
783
|
}
|
|
771
784
|
}
|
|
772
|
-
Object.defineProperty(
|
|
773
|
-
Object.defineProperty(
|
|
774
|
-
const
|
|
775
|
-
class
|
|
785
|
+
Object.defineProperty(A.prototype, "error", { enumerable: !0 });
|
|
786
|
+
Object.defineProperty(A.prototype, "message", { enumerable: !0 });
|
|
787
|
+
const Ie = typeof globalThis.ErrorEvent == "function" ? globalThis.ErrorEvent : A;
|
|
788
|
+
class We extends EventTarget {
|
|
776
789
|
constructor() {
|
|
777
790
|
super(...arguments), this.listenersCount = 0;
|
|
778
791
|
}
|
|
@@ -786,30 +799,30 @@ class Ie extends EventTarget {
|
|
|
786
799
|
return this.listenersCount > 0;
|
|
787
800
|
}
|
|
788
801
|
}
|
|
789
|
-
function
|
|
790
|
-
|
|
791
|
-
...
|
|
802
|
+
function De(r) {
|
|
803
|
+
r.asm = {
|
|
804
|
+
...r.asm
|
|
792
805
|
};
|
|
793
|
-
const e = new
|
|
794
|
-
for (const t in
|
|
795
|
-
if (typeof
|
|
796
|
-
const
|
|
797
|
-
|
|
806
|
+
const e = new We();
|
|
807
|
+
for (const t in r.asm)
|
|
808
|
+
if (typeof r.asm[t] == "function") {
|
|
809
|
+
const s = r.asm[t];
|
|
810
|
+
r.asm[t] = function(...i) {
|
|
798
811
|
try {
|
|
799
|
-
return
|
|
812
|
+
return s(...i);
|
|
800
813
|
} catch (n) {
|
|
801
814
|
if (!(n instanceof Error))
|
|
802
815
|
throw n;
|
|
803
816
|
if ("exitCode" in n && n?.exitCode === 0)
|
|
804
817
|
return;
|
|
805
|
-
const o =
|
|
818
|
+
const o = ze(
|
|
806
819
|
n,
|
|
807
|
-
|
|
820
|
+
r.lastAsyncifyStackSource?.stack
|
|
808
821
|
);
|
|
809
|
-
if (
|
|
810
|
-
throw
|
|
822
|
+
if (r.lastAsyncifyStackSource && (n.cause = r.lastAsyncifyStackSource), !e.hasListeners())
|
|
823
|
+
throw je(o), n;
|
|
811
824
|
e.dispatchEvent(
|
|
812
|
-
new
|
|
825
|
+
new Ie("error", {
|
|
813
826
|
error: n,
|
|
814
827
|
message: o
|
|
815
828
|
})
|
|
@@ -819,29 +832,29 @@ function We(s) {
|
|
|
819
832
|
}
|
|
820
833
|
return e;
|
|
821
834
|
}
|
|
822
|
-
let
|
|
823
|
-
function
|
|
824
|
-
return
|
|
835
|
+
let R = [];
|
|
836
|
+
function Me() {
|
|
837
|
+
return R;
|
|
825
838
|
}
|
|
826
|
-
function
|
|
827
|
-
if (
|
|
828
|
-
let t =
|
|
839
|
+
function ze(r, e) {
|
|
840
|
+
if (r.message === "unreachable") {
|
|
841
|
+
let t = qe;
|
|
829
842
|
e || (t += `
|
|
830
843
|
|
|
831
844
|
This stack trace is lacking. For a better one initialize
|
|
832
845
|
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
833
846
|
|
|
834
|
-
`),
|
|
835
|
-
e ||
|
|
847
|
+
`), R = Ge(
|
|
848
|
+
e || r.stack || ""
|
|
836
849
|
);
|
|
837
|
-
for (const
|
|
838
|
-
t += ` * ${
|
|
850
|
+
for (const s of R)
|
|
851
|
+
t += ` * ${s}
|
|
839
852
|
`;
|
|
840
853
|
return t;
|
|
841
854
|
}
|
|
842
|
-
return
|
|
855
|
+
return r.message;
|
|
843
856
|
}
|
|
844
|
-
const
|
|
857
|
+
const qe = `
|
|
845
858
|
"unreachable" WASM instruction executed.
|
|
846
859
|
|
|
847
860
|
The typical reason is a PHP function missing from the ASYNCIFY_ONLY
|
|
@@ -865,42 +878,42 @@ the Dockerfile, you'll need to trigger this error again with long stack
|
|
|
865
878
|
traces enabled. In node.js, you can do it using the --stack-trace-limit=100
|
|
866
879
|
CLI option:
|
|
867
880
|
|
|
868
|
-
`,
|
|
869
|
-
let
|
|
870
|
-
function
|
|
871
|
-
if (!
|
|
872
|
-
|
|
873
|
-
${
|
|
874
|
-
${
|
|
875
|
-
for (const e of
|
|
881
|
+
`, z = "\x1B[41m", Be = "\x1B[1m", q = "\x1B[0m", B = "\x1B[K";
|
|
882
|
+
let j = !1;
|
|
883
|
+
function je(r) {
|
|
884
|
+
if (!j) {
|
|
885
|
+
j = !0, console.log(`${z}
|
|
886
|
+
${B}
|
|
887
|
+
${Be} WASM ERROR${q}${z}`);
|
|
888
|
+
for (const e of r.split(`
|
|
876
889
|
`))
|
|
877
|
-
console.log(`${
|
|
890
|
+
console.log(`${B} ${e} `);
|
|
878
891
|
console.log(`${q}`);
|
|
879
892
|
}
|
|
880
893
|
}
|
|
881
|
-
function
|
|
894
|
+
function Ge(r) {
|
|
882
895
|
try {
|
|
883
|
-
const e =
|
|
896
|
+
const e = r.split(`
|
|
884
897
|
`).slice(1).map((t) => {
|
|
885
|
-
const
|
|
898
|
+
const s = t.trim().substring(3).split(" ");
|
|
886
899
|
return {
|
|
887
|
-
fn:
|
|
900
|
+
fn: s.length >= 2 ? s[0] : "<unknown>",
|
|
888
901
|
isWasm: t.includes("wasm://")
|
|
889
902
|
};
|
|
890
903
|
}).filter(
|
|
891
|
-
({ fn: t, isWasm:
|
|
904
|
+
({ fn: t, isWasm: s }) => s && !t.startsWith("dynCall_") && !t.startsWith("invoke_")
|
|
892
905
|
).map(({ fn: t }) => t);
|
|
893
906
|
return Array.from(new Set(e));
|
|
894
907
|
} catch {
|
|
895
908
|
return [];
|
|
896
909
|
}
|
|
897
910
|
}
|
|
898
|
-
class
|
|
899
|
-
constructor(e, t,
|
|
900
|
-
this.httpStatusCode = e, this.headers = t, this.bytes =
|
|
911
|
+
class P {
|
|
912
|
+
constructor(e, t, s, i = "", n = 0) {
|
|
913
|
+
this.httpStatusCode = e, this.headers = t, this.bytes = s, this.exitCode = n, this.errors = i;
|
|
901
914
|
}
|
|
902
915
|
static fromRawData(e) {
|
|
903
|
-
return new
|
|
916
|
+
return new P(
|
|
904
917
|
e.httpStatusCode,
|
|
905
918
|
e.headers,
|
|
906
919
|
e.bytes,
|
|
@@ -930,7 +943,7 @@ class _ {
|
|
|
930
943
|
return new TextDecoder().decode(this.bytes);
|
|
931
944
|
}
|
|
932
945
|
}
|
|
933
|
-
const
|
|
946
|
+
const ie = [
|
|
934
947
|
"8.2",
|
|
935
948
|
"8.1",
|
|
936
949
|
"8.0",
|
|
@@ -940,8 +953,8 @@ const re = [
|
|
|
940
953
|
"7.1",
|
|
941
954
|
"7.0",
|
|
942
955
|
"5.6"
|
|
943
|
-
],
|
|
944
|
-
class
|
|
956
|
+
], Ve = ie[0];
|
|
957
|
+
class Ye {
|
|
945
958
|
#e;
|
|
946
959
|
#t;
|
|
947
960
|
/**
|
|
@@ -970,16 +983,16 @@ class Ve {
|
|
|
970
983
|
* @returns PHPRequestHandler response.
|
|
971
984
|
*/
|
|
972
985
|
async request(e, t = 0) {
|
|
973
|
-
const
|
|
986
|
+
const s = await this.requestHandler.request({
|
|
974
987
|
...e,
|
|
975
988
|
headers: {
|
|
976
989
|
...e.headers,
|
|
977
|
-
cookie: this.#
|
|
990
|
+
cookie: this.#r()
|
|
978
991
|
}
|
|
979
992
|
});
|
|
980
|
-
if (
|
|
993
|
+
if (s.headers["set-cookie"] && this.#s(s.headers["set-cookie"]), this.#t.handleRedirects && s.headers.location && t < this.#t.maxRedirects) {
|
|
981
994
|
const i = new URL(
|
|
982
|
-
|
|
995
|
+
s.headers.location[0],
|
|
983
996
|
this.requestHandler.absoluteUrl
|
|
984
997
|
);
|
|
985
998
|
return this.request(
|
|
@@ -991,7 +1004,7 @@ class Ve {
|
|
|
991
1004
|
t + 1
|
|
992
1005
|
);
|
|
993
1006
|
}
|
|
994
|
-
return
|
|
1007
|
+
return s;
|
|
995
1008
|
}
|
|
996
1009
|
/** @inheritDoc */
|
|
997
1010
|
pathToInternalUrl(e) {
|
|
@@ -1009,39 +1022,39 @@ class Ve {
|
|
|
1009
1022
|
get documentRoot() {
|
|
1010
1023
|
return this.requestHandler.documentRoot;
|
|
1011
1024
|
}
|
|
1012
|
-
#
|
|
1025
|
+
#s(e) {
|
|
1013
1026
|
for (const t of e)
|
|
1014
1027
|
try {
|
|
1015
1028
|
if (!t.includes("="))
|
|
1016
1029
|
continue;
|
|
1017
|
-
const
|
|
1030
|
+
const s = t.indexOf("="), i = t.substring(0, s), n = t.substring(s + 1).split(";")[0];
|
|
1018
1031
|
this.#e[i] = n;
|
|
1019
|
-
} catch (
|
|
1020
|
-
console.error(
|
|
1032
|
+
} catch (s) {
|
|
1033
|
+
console.error(s);
|
|
1021
1034
|
}
|
|
1022
1035
|
}
|
|
1023
|
-
#
|
|
1036
|
+
#r() {
|
|
1024
1037
|
const e = [];
|
|
1025
1038
|
for (const t in this.#e)
|
|
1026
1039
|
e.push(`${t}=${this.#e[t]}`);
|
|
1027
1040
|
return e.join("; ");
|
|
1028
1041
|
}
|
|
1029
1042
|
}
|
|
1030
|
-
const
|
|
1031
|
-
function
|
|
1032
|
-
return
|
|
1043
|
+
const Ke = "http://example.com";
|
|
1044
|
+
function G(r) {
|
|
1045
|
+
return r.toString().substring(r.origin.length);
|
|
1033
1046
|
}
|
|
1034
|
-
function
|
|
1035
|
-
return !e || !
|
|
1047
|
+
function V(r, e) {
|
|
1048
|
+
return !e || !r.startsWith(e) ? r : r.substring(e.length);
|
|
1036
1049
|
}
|
|
1037
|
-
function Je(
|
|
1038
|
-
return !e ||
|
|
1050
|
+
function Je(r, e) {
|
|
1051
|
+
return !e || r.startsWith(e) ? r : e + r;
|
|
1039
1052
|
}
|
|
1040
|
-
class
|
|
1053
|
+
class Ze {
|
|
1041
1054
|
#e;
|
|
1042
1055
|
#t;
|
|
1043
|
-
#r;
|
|
1044
1056
|
#s;
|
|
1057
|
+
#r;
|
|
1045
1058
|
#n;
|
|
1046
1059
|
#i;
|
|
1047
1060
|
#o;
|
|
@@ -1052,19 +1065,19 @@ class Ke {
|
|
|
1052
1065
|
* @param config - Request Handler configuration.
|
|
1053
1066
|
*/
|
|
1054
1067
|
constructor(e, t = {}) {
|
|
1055
|
-
this.#a = new
|
|
1068
|
+
this.#a = new ee({ concurrency: 1 });
|
|
1056
1069
|
const {
|
|
1057
|
-
documentRoot:
|
|
1070
|
+
documentRoot: s = "/www/",
|
|
1058
1071
|
absoluteUrl: i = typeof location == "object" ? location?.href : "",
|
|
1059
1072
|
isStaticFilePath: n = () => !1
|
|
1060
1073
|
} = t;
|
|
1061
|
-
this.php = e, this.#e =
|
|
1074
|
+
this.php = e, this.#e = s, this.#c = n;
|
|
1062
1075
|
const o = new URL(i);
|
|
1063
|
-
this.#
|
|
1064
|
-
const a = this.#
|
|
1076
|
+
this.#s = o.hostname, this.#r = o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80, this.#t = (o.protocol || "").replace(":", "");
|
|
1077
|
+
const a = this.#r !== 443 && this.#r !== 80;
|
|
1065
1078
|
this.#n = [
|
|
1066
|
-
this.#
|
|
1067
|
-
a ? `:${this.#
|
|
1079
|
+
this.#s,
|
|
1080
|
+
a ? `:${this.#r}` : ""
|
|
1068
1081
|
].join(""), this.#i = o.pathname.replace(/\/+$/, ""), this.#o = [
|
|
1069
1082
|
`${this.#t}://`,
|
|
1070
1083
|
this.#n,
|
|
@@ -1078,7 +1091,7 @@ class Ke {
|
|
|
1078
1091
|
/** @inheritDoc */
|
|
1079
1092
|
internalUrlToPath(e) {
|
|
1080
1093
|
const t = new URL(e);
|
|
1081
|
-
return t.pathname.startsWith(this.#i) && (t.pathname = t.pathname.slice(this.#i.length)),
|
|
1094
|
+
return t.pathname.startsWith(this.#i) && (t.pathname = t.pathname.slice(this.#i.length)), G(t);
|
|
1082
1095
|
}
|
|
1083
1096
|
get isRequestRunning() {
|
|
1084
1097
|
return this.#a.running > 0;
|
|
@@ -1093,14 +1106,14 @@ class Ke {
|
|
|
1093
1106
|
}
|
|
1094
1107
|
/** @inheritDoc */
|
|
1095
1108
|
async request(e) {
|
|
1096
|
-
const t = e.url.startsWith("http://") || e.url.startsWith("https://"),
|
|
1109
|
+
const t = e.url.startsWith("http://") || e.url.startsWith("https://"), s = new URL(
|
|
1097
1110
|
e.url,
|
|
1098
|
-
t ? void 0 :
|
|
1099
|
-
), i =
|
|
1100
|
-
|
|
1111
|
+
t ? void 0 : Ke
|
|
1112
|
+
), i = V(
|
|
1113
|
+
s.pathname,
|
|
1101
1114
|
this.#i
|
|
1102
1115
|
);
|
|
1103
|
-
return this.#c(i) ? this.#l(i) : await this.#h(e,
|
|
1116
|
+
return this.#c(i) ? this.#l(i) : await this.#h(e, s);
|
|
1104
1117
|
}
|
|
1105
1118
|
/**
|
|
1106
1119
|
* Serves a static file from the PHP filesystem.
|
|
@@ -1111,24 +1124,24 @@ class Ke {
|
|
|
1111
1124
|
#l(e) {
|
|
1112
1125
|
const t = `${this.#e}${e}`;
|
|
1113
1126
|
if (!this.php.fileExists(t))
|
|
1114
|
-
return new
|
|
1127
|
+
return new P(
|
|
1115
1128
|
404,
|
|
1116
1129
|
{},
|
|
1117
1130
|
new TextEncoder().encode("404 File not found")
|
|
1118
1131
|
);
|
|
1119
|
-
const
|
|
1120
|
-
return new
|
|
1132
|
+
const s = this.php.readFileAsBuffer(t);
|
|
1133
|
+
return new P(
|
|
1121
1134
|
200,
|
|
1122
1135
|
{
|
|
1123
|
-
"content-length": [`${
|
|
1136
|
+
"content-length": [`${s.byteLength}`],
|
|
1124
1137
|
// @TODO: Infer the content-type from the arrayBuffer instead of the file path.
|
|
1125
1138
|
// The code below won't return the correct mime-type if the extension
|
|
1126
1139
|
// was tampered with.
|
|
1127
|
-
"content-type": [
|
|
1140
|
+
"content-type": [Xe(t)],
|
|
1128
1141
|
"accept-ranges": ["bytes"],
|
|
1129
1142
|
"cache-control": ["public, max-age=0"]
|
|
1130
1143
|
},
|
|
1131
|
-
|
|
1144
|
+
s
|
|
1132
1145
|
);
|
|
1133
1146
|
}
|
|
1134
1147
|
/**
|
|
@@ -1139,7 +1152,7 @@ class Ke {
|
|
|
1139
1152
|
* @returns The response.
|
|
1140
1153
|
*/
|
|
1141
1154
|
async #h(e, t) {
|
|
1142
|
-
const
|
|
1155
|
+
const s = await this.#a.acquire();
|
|
1143
1156
|
try {
|
|
1144
1157
|
this.php.addServerGlobalEntry("DOCUMENT_ROOT", this.#e), this.php.addServerGlobalEntry(
|
|
1145
1158
|
"HTTPS",
|
|
@@ -1148,7 +1161,7 @@ class Ke {
|
|
|
1148
1161
|
let i = "GET";
|
|
1149
1162
|
const n = {
|
|
1150
1163
|
host: this.#n,
|
|
1151
|
-
...
|
|
1164
|
+
...ne(e.headers || {})
|
|
1152
1165
|
}, o = [];
|
|
1153
1166
|
if (e.files && Object.keys(e.files).length) {
|
|
1154
1167
|
i = "POST";
|
|
@@ -1161,7 +1174,7 @@ class Ke {
|
|
|
1161
1174
|
data: new Uint8Array(await u.arrayBuffer())
|
|
1162
1175
|
});
|
|
1163
1176
|
}
|
|
1164
|
-
n["content-type"]?.startsWith("multipart/form-data") && (e.formData =
|
|
1177
|
+
n["content-type"]?.startsWith("multipart/form-data") && (e.formData = Qe(
|
|
1165
1178
|
e.body || ""
|
|
1166
1179
|
), n["content-type"] = "application/x-www-form-urlencoded", delete e.body);
|
|
1167
1180
|
}
|
|
@@ -1173,7 +1186,7 @@ class Ke {
|
|
|
1173
1186
|
try {
|
|
1174
1187
|
l = this.#u(t.pathname);
|
|
1175
1188
|
} catch {
|
|
1176
|
-
return new
|
|
1189
|
+
return new P(
|
|
1177
1190
|
404,
|
|
1178
1191
|
{},
|
|
1179
1192
|
new TextEncoder().encode("404 File not found")
|
|
@@ -1181,7 +1194,7 @@ class Ke {
|
|
|
1181
1194
|
}
|
|
1182
1195
|
return await this.php.run({
|
|
1183
1196
|
relativeUri: Je(
|
|
1184
|
-
|
|
1197
|
+
G(t),
|
|
1185
1198
|
this.#i
|
|
1186
1199
|
),
|
|
1187
1200
|
protocol: this.#t,
|
|
@@ -1192,7 +1205,7 @@ class Ke {
|
|
|
1192
1205
|
headers: n
|
|
1193
1206
|
});
|
|
1194
1207
|
} finally {
|
|
1195
|
-
|
|
1208
|
+
s();
|
|
1196
1209
|
}
|
|
1197
1210
|
}
|
|
1198
1211
|
/**
|
|
@@ -1205,21 +1218,21 @@ class Ke {
|
|
|
1205
1218
|
* @returns The resolved filesystem path.
|
|
1206
1219
|
*/
|
|
1207
1220
|
#u(e) {
|
|
1208
|
-
let t =
|
|
1221
|
+
let t = V(e, this.#i);
|
|
1209
1222
|
t.includes(".php") ? t = t.split(".php")[0] + ".php" : (t.endsWith("/") || (t += "/"), t.endsWith("index.php") || (t += "index.php"));
|
|
1210
|
-
const
|
|
1211
|
-
if (this.php.fileExists(
|
|
1212
|
-
return
|
|
1223
|
+
const s = `${this.#e}${t}`;
|
|
1224
|
+
if (this.php.fileExists(s))
|
|
1225
|
+
return s;
|
|
1213
1226
|
if (!this.php.fileExists(`${this.#e}/index.php`))
|
|
1214
|
-
throw new Error(`File not found: ${
|
|
1227
|
+
throw new Error(`File not found: ${s}`);
|
|
1215
1228
|
return `${this.#e}/index.php`;
|
|
1216
1229
|
}
|
|
1217
1230
|
}
|
|
1218
|
-
function
|
|
1219
|
-
const e = {}, t =
|
|
1231
|
+
function Qe(r) {
|
|
1232
|
+
const e = {}, t = r.match(/--(.*)\r\n/);
|
|
1220
1233
|
if (!t)
|
|
1221
1234
|
return e;
|
|
1222
|
-
const
|
|
1235
|
+
const s = t[1], i = r.split(`--${s}`);
|
|
1223
1236
|
return i.shift(), i.pop(), i.forEach((n) => {
|
|
1224
1237
|
const o = n.indexOf(`\r
|
|
1225
1238
|
\r
|
|
@@ -1230,8 +1243,8 @@ function Ze(s) {
|
|
|
1230
1243
|
}
|
|
1231
1244
|
}), e;
|
|
1232
1245
|
}
|
|
1233
|
-
function
|
|
1234
|
-
switch (
|
|
1246
|
+
function Xe(r) {
|
|
1247
|
+
switch (r.split(".").pop()) {
|
|
1235
1248
|
case "css":
|
|
1236
1249
|
return "text/css";
|
|
1237
1250
|
case "js":
|
|
@@ -1270,7 +1283,7 @@ function Qe(s) {
|
|
|
1270
1283
|
return "application-octet-stream";
|
|
1271
1284
|
}
|
|
1272
1285
|
}
|
|
1273
|
-
const
|
|
1286
|
+
const Y = {
|
|
1274
1287
|
0: "No error occurred. System call completed successfully.",
|
|
1275
1288
|
1: "Argument list too long.",
|
|
1276
1289
|
2: "Permission denied.",
|
|
@@ -1349,16 +1362,16 @@ const G = {
|
|
|
1349
1362
|
75: "Cross-device link.",
|
|
1350
1363
|
76: "Extension: Capabilities insufficient."
|
|
1351
1364
|
};
|
|
1352
|
-
function f(
|
|
1353
|
-
return function(t,
|
|
1365
|
+
function f(r = "") {
|
|
1366
|
+
return function(t, s, i) {
|
|
1354
1367
|
const n = i.value;
|
|
1355
1368
|
i.value = function(...o) {
|
|
1356
1369
|
try {
|
|
1357
1370
|
return n.apply(this, o);
|
|
1358
1371
|
} catch (a) {
|
|
1359
1372
|
const l = typeof a == "object" ? a?.errno : null;
|
|
1360
|
-
if (l in
|
|
1361
|
-
const c =
|
|
1373
|
+
if (l in Y) {
|
|
1374
|
+
const c = Y[l], u = typeof o[0] == "string" ? o[0] : null, d = u !== null ? r.replaceAll("{path}", u) : r;
|
|
1362
1375
|
throw new Error(`${d}: ${c}`, {
|
|
1363
1376
|
cause: a
|
|
1364
1377
|
});
|
|
@@ -1368,19 +1381,19 @@ function f(s = "") {
|
|
|
1368
1381
|
};
|
|
1369
1382
|
};
|
|
1370
1383
|
}
|
|
1371
|
-
const
|
|
1372
|
-
function
|
|
1373
|
-
return
|
|
1384
|
+
const et = [];
|
|
1385
|
+
function tt(r) {
|
|
1386
|
+
return et[r];
|
|
1374
1387
|
}
|
|
1375
1388
|
(function() {
|
|
1376
1389
|
return typeof process < "u" && process.release?.name === "node" ? "NODE" : typeof window < "u" ? "WEB" : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? "WORKER" : "NODE";
|
|
1377
1390
|
})();
|
|
1378
|
-
var
|
|
1379
|
-
for (var i =
|
|
1380
|
-
(o =
|
|
1381
|
-
return
|
|
1391
|
+
var rt = Object.defineProperty, st = Object.getOwnPropertyDescriptor, m = (r, e, t, s) => {
|
|
1392
|
+
for (var i = s > 1 ? void 0 : s ? st(e, t) : e, n = r.length - 1, o; n >= 0; n--)
|
|
1393
|
+
(o = r[n]) && (i = (s ? o(e, t, i) : o(i)) || i);
|
|
1394
|
+
return s && i && rt(e, t, i), i;
|
|
1382
1395
|
};
|
|
1383
|
-
const p = "string",
|
|
1396
|
+
const p = "string", _ = "number", h = Symbol("__private__dont__use");
|
|
1384
1397
|
class w {
|
|
1385
1398
|
/**
|
|
1386
1399
|
* Initializes a PHP runtime.
|
|
@@ -1390,14 +1403,19 @@ class w {
|
|
|
1390
1403
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
1391
1404
|
*/
|
|
1392
1405
|
constructor(e, t) {
|
|
1393
|
-
this.#e = [], this.#t = !1, this.#
|
|
1394
|
-
new
|
|
1406
|
+
this.#e = [], this.#t = !1, this.#s = null, this.#r = {}, this.#n = [], e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new Ye(
|
|
1407
|
+
new Ze(this, t)
|
|
1395
1408
|
));
|
|
1396
1409
|
}
|
|
1397
1410
|
#e;
|
|
1398
1411
|
#t;
|
|
1399
|
-
#r;
|
|
1400
1412
|
#s;
|
|
1413
|
+
#r;
|
|
1414
|
+
#n;
|
|
1415
|
+
/** @inheritDoc */
|
|
1416
|
+
async onMessage(e) {
|
|
1417
|
+
this.#n.push(e);
|
|
1418
|
+
}
|
|
1401
1419
|
/** @inheritDoc */
|
|
1402
1420
|
get absoluteUrl() {
|
|
1403
1421
|
return this.requestHandler.requestHandler.absoluteUrl;
|
|
@@ -1419,10 +1437,13 @@ class w {
|
|
|
1419
1437
|
initializeRuntime(e) {
|
|
1420
1438
|
if (this[h])
|
|
1421
1439
|
throw new Error("PHP runtime already initialized.");
|
|
1422
|
-
const t =
|
|
1440
|
+
const t = tt(e);
|
|
1423
1441
|
if (!t)
|
|
1424
1442
|
throw new Error("Invalid PHP runtime id.");
|
|
1425
|
-
this[h] = t,
|
|
1443
|
+
this[h] = t, t.onMessage = (s) => {
|
|
1444
|
+
for (const i of this.#n)
|
|
1445
|
+
i(s);
|
|
1446
|
+
}, this.#s = De(t);
|
|
1426
1447
|
}
|
|
1427
1448
|
/** @inheritDoc */
|
|
1428
1449
|
setPhpIniPath(e) {
|
|
@@ -1453,19 +1474,19 @@ class w {
|
|
|
1453
1474
|
}
|
|
1454
1475
|
/** @inheritDoc */
|
|
1455
1476
|
async run(e) {
|
|
1456
|
-
this.#t || (this.#
|
|
1457
|
-
const { host: t, ...
|
|
1477
|
+
this.#t || (this.#i(), this.#t = !0), this.#p(e.scriptPath || ""), this.#a(e.relativeUri || ""), this.#l(e.method || "GET");
|
|
1478
|
+
const { host: t, ...s } = {
|
|
1458
1479
|
host: "example.com:443",
|
|
1459
|
-
...
|
|
1480
|
+
...ne(e.headers || {})
|
|
1460
1481
|
};
|
|
1461
|
-
if (this.#
|
|
1482
|
+
if (this.#c(t, e.protocol || "http"), this.#h(s), e.body && this.#u(e.body), e.fileInfos)
|
|
1462
1483
|
for (const i of e.fileInfos)
|
|
1463
|
-
this.#
|
|
1464
|
-
return e.code && this.#
|
|
1484
|
+
this.#f(i);
|
|
1485
|
+
return e.code && this.#m(" ?>" + e.code), this.#d(), await this.#w();
|
|
1465
1486
|
}
|
|
1466
|
-
#
|
|
1487
|
+
#i() {
|
|
1467
1488
|
if (this.#e.length > 0) {
|
|
1468
|
-
const e = this.#e.map(([t,
|
|
1489
|
+
const e = this.#e.map(([t, s]) => `${t}=${s}`).join(`
|
|
1469
1490
|
`) + `
|
|
1470
1491
|
|
|
1471
1492
|
`;
|
|
@@ -1478,25 +1499,25 @@ class w {
|
|
|
1478
1499
|
}
|
|
1479
1500
|
this[h].ccall("php_wasm_init", null, [], []);
|
|
1480
1501
|
}
|
|
1481
|
-
#
|
|
1502
|
+
#o() {
|
|
1482
1503
|
const e = "/tmp/headers.json";
|
|
1483
1504
|
if (!this.fileExists(e))
|
|
1484
1505
|
throw new Error(
|
|
1485
1506
|
"SAPI Error: Could not find response headers file."
|
|
1486
1507
|
);
|
|
1487
|
-
const t = JSON.parse(this.readFileAsText(e)),
|
|
1508
|
+
const t = JSON.parse(this.readFileAsText(e)), s = {};
|
|
1488
1509
|
for (const i of t.headers) {
|
|
1489
1510
|
if (!i.includes(": "))
|
|
1490
1511
|
continue;
|
|
1491
1512
|
const n = i.indexOf(": "), o = i.substring(0, n).toLowerCase(), a = i.substring(n + 2);
|
|
1492
|
-
o in
|
|
1513
|
+
o in s || (s[o] = []), s[o].push(a);
|
|
1493
1514
|
}
|
|
1494
1515
|
return {
|
|
1495
|
-
headers:
|
|
1516
|
+
headers: s,
|
|
1496
1517
|
httpStatusCode: t.status
|
|
1497
1518
|
};
|
|
1498
1519
|
}
|
|
1499
|
-
#
|
|
1520
|
+
#a(e) {
|
|
1500
1521
|
if (this[h].ccall(
|
|
1501
1522
|
"wasm_set_request_uri",
|
|
1502
1523
|
null,
|
|
@@ -1512,26 +1533,26 @@ class w {
|
|
|
1512
1533
|
);
|
|
1513
1534
|
}
|
|
1514
1535
|
}
|
|
1515
|
-
#
|
|
1536
|
+
#c(e, t) {
|
|
1516
1537
|
this[h].ccall(
|
|
1517
1538
|
"wasm_set_request_host",
|
|
1518
1539
|
null,
|
|
1519
1540
|
[p],
|
|
1520
1541
|
[e]
|
|
1521
1542
|
);
|
|
1522
|
-
let
|
|
1543
|
+
let s;
|
|
1523
1544
|
try {
|
|
1524
|
-
|
|
1545
|
+
s = parseInt(new URL(e).port, 10);
|
|
1525
1546
|
} catch {
|
|
1526
1547
|
}
|
|
1527
|
-
(!
|
|
1548
|
+
(!s || isNaN(s) || s === 80) && (s = t === "https" ? 443 : 80), this[h].ccall(
|
|
1528
1549
|
"wasm_set_request_port",
|
|
1529
1550
|
null,
|
|
1530
|
-
[
|
|
1531
|
-
[
|
|
1532
|
-
), (t === "https" || !t &&
|
|
1551
|
+
[_],
|
|
1552
|
+
[s]
|
|
1553
|
+
), (t === "https" || !t && s === 443) && this.addServerGlobalEntry("HTTPS", "on");
|
|
1533
1554
|
}
|
|
1534
|
-
#
|
|
1555
|
+
#l(e) {
|
|
1535
1556
|
this[h].ccall(
|
|
1536
1557
|
"wasm_set_request_method",
|
|
1537
1558
|
null,
|
|
@@ -1539,7 +1560,7 @@ class w {
|
|
|
1539
1560
|
[e]
|
|
1540
1561
|
);
|
|
1541
1562
|
}
|
|
1542
|
-
#
|
|
1563
|
+
#h(e) {
|
|
1543
1564
|
e.cookie && this[h].ccall(
|
|
1544
1565
|
"wasm_set_cookies",
|
|
1545
1566
|
null,
|
|
@@ -1553,18 +1574,18 @@ class w {
|
|
|
1553
1574
|
), e["content-length"] && this[h].ccall(
|
|
1554
1575
|
"wasm_set_content_length",
|
|
1555
1576
|
null,
|
|
1556
|
-
[
|
|
1577
|
+
[_],
|
|
1557
1578
|
[parseInt(e["content-length"], 10)]
|
|
1558
1579
|
);
|
|
1559
1580
|
for (const t in e) {
|
|
1560
|
-
let
|
|
1561
|
-
["content-type", "content-length"].includes(t.toLowerCase()) && (
|
|
1562
|
-
`${
|
|
1581
|
+
let s = "HTTP_";
|
|
1582
|
+
["content-type", "content-length"].includes(t.toLowerCase()) && (s = ""), this.addServerGlobalEntry(
|
|
1583
|
+
`${s}${t.toUpperCase().replace(/-/g, "_")}`,
|
|
1563
1584
|
e[t]
|
|
1564
1585
|
);
|
|
1565
1586
|
}
|
|
1566
1587
|
}
|
|
1567
|
-
#
|
|
1588
|
+
#u(e) {
|
|
1568
1589
|
this[h].ccall(
|
|
1569
1590
|
"wasm_set_request_body",
|
|
1570
1591
|
null,
|
|
@@ -1573,11 +1594,11 @@ class w {
|
|
|
1573
1594
|
), this[h].ccall(
|
|
1574
1595
|
"wasm_set_content_length",
|
|
1575
1596
|
null,
|
|
1576
|
-
[
|
|
1597
|
+
[_],
|
|
1577
1598
|
[new TextEncoder().encode(e).length]
|
|
1578
1599
|
);
|
|
1579
1600
|
}
|
|
1580
|
-
#
|
|
1601
|
+
#p(e) {
|
|
1581
1602
|
this[h].ccall(
|
|
1582
1603
|
"wasm_set_path_translated",
|
|
1583
1604
|
null,
|
|
@@ -1586,15 +1607,15 @@ class w {
|
|
|
1586
1607
|
);
|
|
1587
1608
|
}
|
|
1588
1609
|
addServerGlobalEntry(e, t) {
|
|
1589
|
-
this.#
|
|
1610
|
+
this.#r[e] = t;
|
|
1590
1611
|
}
|
|
1591
|
-
#
|
|
1592
|
-
for (const e in this.#
|
|
1612
|
+
#d() {
|
|
1613
|
+
for (const e in this.#r)
|
|
1593
1614
|
this[h].ccall(
|
|
1594
1615
|
"wasm_add_SERVER_entry",
|
|
1595
1616
|
null,
|
|
1596
1617
|
[p, p],
|
|
1597
|
-
[e, this.#
|
|
1618
|
+
[e, this.#r[e]]
|
|
1598
1619
|
);
|
|
1599
1620
|
}
|
|
1600
1621
|
/**
|
|
@@ -1606,18 +1627,18 @@ class w {
|
|
|
1606
1627
|
*
|
|
1607
1628
|
* @param fileInfo - File details
|
|
1608
1629
|
*/
|
|
1609
|
-
#
|
|
1610
|
-
const { key: t, name:
|
|
1630
|
+
#f(e) {
|
|
1631
|
+
const { key: t, name: s, type: i, data: n } = e, o = `/tmp/${Math.random().toFixed(20)}`;
|
|
1611
1632
|
this.writeFile(o, n);
|
|
1612
1633
|
const a = 0;
|
|
1613
1634
|
this[h].ccall(
|
|
1614
1635
|
"wasm_add_uploaded_file",
|
|
1615
1636
|
null,
|
|
1616
|
-
[p, p, p, p,
|
|
1617
|
-
[t,
|
|
1637
|
+
[p, p, p, p, _, _],
|
|
1638
|
+
[t, s, i, o, a, n.byteLength]
|
|
1618
1639
|
);
|
|
1619
1640
|
}
|
|
1620
|
-
#
|
|
1641
|
+
#m(e) {
|
|
1621
1642
|
this[h].ccall(
|
|
1622
1643
|
"wasm_set_php_code",
|
|
1623
1644
|
null,
|
|
@@ -1625,20 +1646,20 @@ class w {
|
|
|
1625
1646
|
[e]
|
|
1626
1647
|
);
|
|
1627
1648
|
}
|
|
1628
|
-
async #
|
|
1649
|
+
async #w() {
|
|
1629
1650
|
let e, t;
|
|
1630
1651
|
try {
|
|
1631
1652
|
e = await new Promise((n, o) => {
|
|
1632
1653
|
t = (l) => {
|
|
1633
1654
|
const c = new Error("Rethrown");
|
|
1634
1655
|
c.cause = l.error, c.betterMessage = l.message, o(c);
|
|
1635
|
-
}, this.#
|
|
1656
|
+
}, this.#s?.addEventListener(
|
|
1636
1657
|
"error",
|
|
1637
1658
|
t
|
|
1638
1659
|
);
|
|
1639
1660
|
const a = this[h].ccall(
|
|
1640
1661
|
"wasm_sapi_handle_request",
|
|
1641
|
-
|
|
1662
|
+
_,
|
|
1642
1663
|
[],
|
|
1643
1664
|
[]
|
|
1644
1665
|
);
|
|
@@ -1651,16 +1672,16 @@ class w {
|
|
|
1651
1672
|
"PHP runtime has crashed – see the earlier error for details."
|
|
1652
1673
|
);
|
|
1653
1674
|
});
|
|
1654
|
-
this.functionsMaybeMissingFromAsyncify =
|
|
1675
|
+
this.functionsMaybeMissingFromAsyncify = Me();
|
|
1655
1676
|
const o = n, a = "betterMessage" in o ? o.betterMessage : o.message, l = new Error(a);
|
|
1656
1677
|
throw l.cause = o, l;
|
|
1657
1678
|
} finally {
|
|
1658
|
-
this.#
|
|
1679
|
+
this.#s?.removeEventListener("error", t), this.#r = {};
|
|
1659
1680
|
}
|
|
1660
|
-
const { headers:
|
|
1661
|
-
return new
|
|
1681
|
+
const { headers: s, httpStatusCode: i } = this.#o();
|
|
1682
|
+
return new P(
|
|
1662
1683
|
i,
|
|
1663
|
-
|
|
1684
|
+
s,
|
|
1664
1685
|
this.readFileAsBuffer("/tmp/stdout"),
|
|
1665
1686
|
this.readFileAsText("/tmp/stderr"),
|
|
1666
1687
|
e
|
|
@@ -1688,8 +1709,8 @@ class w {
|
|
|
1688
1709
|
this[h].FS.rename(e, t);
|
|
1689
1710
|
}
|
|
1690
1711
|
rmdir(e, t = { recursive: !0 }) {
|
|
1691
|
-
t?.recursive && this.listFiles(e).forEach((
|
|
1692
|
-
const i = `${e}/${
|
|
1712
|
+
t?.recursive && this.listFiles(e).forEach((s) => {
|
|
1713
|
+
const i = `${e}/${s}`;
|
|
1693
1714
|
this.isDir(i) ? this.rmdir(i, t) : this.unlink(i);
|
|
1694
1715
|
}), this[h].FS.rmdir(e);
|
|
1695
1716
|
}
|
|
@@ -1697,16 +1718,16 @@ class w {
|
|
|
1697
1718
|
if (!this.fileExists(e))
|
|
1698
1719
|
return [];
|
|
1699
1720
|
try {
|
|
1700
|
-
const
|
|
1721
|
+
const s = this[h].FS.readdir(e).filter(
|
|
1701
1722
|
(i) => i !== "." && i !== ".."
|
|
1702
1723
|
);
|
|
1703
1724
|
if (t.prependPath) {
|
|
1704
1725
|
const i = e.replace(/\/$/, "");
|
|
1705
|
-
return
|
|
1726
|
+
return s.map((n) => `${i}/${n}`);
|
|
1706
1727
|
}
|
|
1707
|
-
return
|
|
1708
|
-
} catch (
|
|
1709
|
-
return console.error(
|
|
1728
|
+
return s;
|
|
1729
|
+
} catch (s) {
|
|
1730
|
+
return console.error(s, { path: e }), [];
|
|
1710
1731
|
}
|
|
1711
1732
|
}
|
|
1712
1733
|
isDir(e) {
|
|
@@ -1755,23 +1776,23 @@ m([
|
|
|
1755
1776
|
m([
|
|
1756
1777
|
f('Could not stat "{path}"')
|
|
1757
1778
|
], w.prototype, "fileExists", 1);
|
|
1758
|
-
function
|
|
1779
|
+
function ne(r) {
|
|
1759
1780
|
const e = {};
|
|
1760
|
-
for (const t in
|
|
1761
|
-
e[t.toLowerCase()] =
|
|
1781
|
+
for (const t in r)
|
|
1782
|
+
e[t.toLowerCase()] = r[t];
|
|
1762
1783
|
return e;
|
|
1763
1784
|
}
|
|
1764
|
-
const
|
|
1785
|
+
const it = [
|
|
1765
1786
|
"vfs",
|
|
1766
1787
|
"literal",
|
|
1767
1788
|
"wordpress.org/themes",
|
|
1768
1789
|
"wordpress.org/plugins",
|
|
1769
1790
|
"url"
|
|
1770
1791
|
];
|
|
1771
|
-
function
|
|
1772
|
-
return
|
|
1792
|
+
function nt(r) {
|
|
1793
|
+
return r && typeof r == "object" && typeof r.resource == "string" && it.includes(r.resource);
|
|
1773
1794
|
}
|
|
1774
|
-
class
|
|
1795
|
+
class y {
|
|
1775
1796
|
/**
|
|
1776
1797
|
* Creates a new Resource based on the given file reference
|
|
1777
1798
|
*
|
|
@@ -1779,28 +1800,28 @@ class g {
|
|
|
1779
1800
|
* @param options Additional options for the Resource
|
|
1780
1801
|
* @returns A new Resource instance
|
|
1781
1802
|
*/
|
|
1782
|
-
static create(e, { semaphore: t, progress:
|
|
1803
|
+
static create(e, { semaphore: t, progress: s }) {
|
|
1783
1804
|
let i;
|
|
1784
1805
|
switch (e.resource) {
|
|
1785
1806
|
case "vfs":
|
|
1786
|
-
i = new
|
|
1807
|
+
i = new ot(e, s);
|
|
1787
1808
|
break;
|
|
1788
1809
|
case "literal":
|
|
1789
|
-
i = new
|
|
1810
|
+
i = new at(e, s);
|
|
1790
1811
|
break;
|
|
1791
1812
|
case "wordpress.org/themes":
|
|
1792
|
-
i = new
|
|
1813
|
+
i = new ht(e, s);
|
|
1793
1814
|
break;
|
|
1794
1815
|
case "wordpress.org/plugins":
|
|
1795
|
-
i = new
|
|
1816
|
+
i = new ut(e, s);
|
|
1796
1817
|
break;
|
|
1797
1818
|
case "url":
|
|
1798
|
-
i = new
|
|
1819
|
+
i = new lt(e, s);
|
|
1799
1820
|
break;
|
|
1800
1821
|
default:
|
|
1801
1822
|
throw new Error(`Invalid resource: ${e}`);
|
|
1802
1823
|
}
|
|
1803
|
-
return i = new
|
|
1824
|
+
return i = new pt(i), t && (i = new dt(i, t)), i;
|
|
1804
1825
|
}
|
|
1805
1826
|
setPlayground(e) {
|
|
1806
1827
|
this.playground = e;
|
|
@@ -1810,7 +1831,7 @@ class g {
|
|
|
1810
1831
|
return !1;
|
|
1811
1832
|
}
|
|
1812
1833
|
}
|
|
1813
|
-
class
|
|
1834
|
+
class ot extends y {
|
|
1814
1835
|
/**
|
|
1815
1836
|
* Creates a new instance of `VFSResource`.
|
|
1816
1837
|
* @param playground The playground client.
|
|
@@ -1825,14 +1846,14 @@ class nt extends g {
|
|
|
1825
1846
|
const e = await this.playground.readFileAsBuffer(
|
|
1826
1847
|
this.resource.path
|
|
1827
1848
|
);
|
|
1828
|
-
return this.progress?.set(100), new
|
|
1849
|
+
return this.progress?.set(100), new T([e], this.name);
|
|
1829
1850
|
}
|
|
1830
1851
|
/** @inheritDoc */
|
|
1831
1852
|
get name() {
|
|
1832
1853
|
return this.resource.path.split("/").pop() || "";
|
|
1833
1854
|
}
|
|
1834
1855
|
}
|
|
1835
|
-
class
|
|
1856
|
+
class at extends y {
|
|
1836
1857
|
/**
|
|
1837
1858
|
* Creates a new instance of `LiteralResource`.
|
|
1838
1859
|
* @param resource The literal reference.
|
|
@@ -1843,14 +1864,14 @@ class ot extends g {
|
|
|
1843
1864
|
}
|
|
1844
1865
|
/** @inheritDoc */
|
|
1845
1866
|
async resolve() {
|
|
1846
|
-
return this.progress?.set(100), new
|
|
1867
|
+
return this.progress?.set(100), new T([this.resource.contents], this.resource.name);
|
|
1847
1868
|
}
|
|
1848
1869
|
/** @inheritDoc */
|
|
1849
1870
|
get name() {
|
|
1850
1871
|
return this.resource.name;
|
|
1851
1872
|
}
|
|
1852
1873
|
}
|
|
1853
|
-
class
|
|
1874
|
+
class U extends y {
|
|
1854
1875
|
/**
|
|
1855
1876
|
* Creates a new instance of `FetchResource`.
|
|
1856
1877
|
* @param progress The progress tracker.
|
|
@@ -1863,12 +1884,12 @@ class C extends g {
|
|
|
1863
1884
|
this.progress?.setCaption(this.caption);
|
|
1864
1885
|
const e = this.getURL();
|
|
1865
1886
|
let t = await fetch(e);
|
|
1866
|
-
if (t = await
|
|
1887
|
+
if (t = await He(
|
|
1867
1888
|
t,
|
|
1868
|
-
this.progress?.loadingListener ??
|
|
1889
|
+
this.progress?.loadingListener ?? ct
|
|
1869
1890
|
), t.status !== 200)
|
|
1870
1891
|
throw new Error(`Could not download "${e}"`);
|
|
1871
|
-
return new
|
|
1892
|
+
return new T([await t.blob()], this.name);
|
|
1872
1893
|
}
|
|
1873
1894
|
/**
|
|
1874
1895
|
* Gets the caption for the progress tracker.
|
|
@@ -1890,9 +1911,9 @@ class C extends g {
|
|
|
1890
1911
|
return !0;
|
|
1891
1912
|
}
|
|
1892
1913
|
}
|
|
1893
|
-
const
|
|
1914
|
+
const ct = () => {
|
|
1894
1915
|
};
|
|
1895
|
-
class
|
|
1916
|
+
class lt extends U {
|
|
1896
1917
|
/**
|
|
1897
1918
|
* Creates a new instance of `UrlResource`.
|
|
1898
1919
|
* @param resource The URL reference.
|
|
@@ -1910,40 +1931,40 @@ class ct extends C {
|
|
|
1910
1931
|
return this.resource.caption ?? super.caption;
|
|
1911
1932
|
}
|
|
1912
1933
|
}
|
|
1913
|
-
let
|
|
1914
|
-
function
|
|
1915
|
-
|
|
1934
|
+
let N = "https://playground.wordpress.net/plugin-proxy";
|
|
1935
|
+
function yt(r) {
|
|
1936
|
+
N = r;
|
|
1916
1937
|
}
|
|
1917
|
-
class
|
|
1938
|
+
class ht extends U {
|
|
1918
1939
|
constructor(e, t) {
|
|
1919
1940
|
super(t), this.resource = e;
|
|
1920
1941
|
}
|
|
1921
1942
|
get name() {
|
|
1922
|
-
return
|
|
1943
|
+
return v(this.resource.slug);
|
|
1923
1944
|
}
|
|
1924
1945
|
getURL() {
|
|
1925
|
-
const e =
|
|
1926
|
-
return `${
|
|
1946
|
+
const e = oe(this.resource.slug);
|
|
1947
|
+
return `${N}?theme=` + e;
|
|
1927
1948
|
}
|
|
1928
1949
|
}
|
|
1929
|
-
class
|
|
1950
|
+
class ut extends U {
|
|
1930
1951
|
constructor(e, t) {
|
|
1931
1952
|
super(t), this.resource = e;
|
|
1932
1953
|
}
|
|
1933
1954
|
/** @inheritDoc */
|
|
1934
1955
|
get name() {
|
|
1935
|
-
return
|
|
1956
|
+
return v(this.resource.slug);
|
|
1936
1957
|
}
|
|
1937
1958
|
/** @inheritDoc */
|
|
1938
1959
|
getURL() {
|
|
1939
|
-
const e =
|
|
1940
|
-
return `${
|
|
1960
|
+
const e = oe(this.resource.slug);
|
|
1961
|
+
return `${N}?plugin=` + e;
|
|
1941
1962
|
}
|
|
1942
1963
|
}
|
|
1943
|
-
function
|
|
1944
|
-
return !
|
|
1964
|
+
function oe(r) {
|
|
1965
|
+
return !r || r.endsWith(".zip") ? r : r + ".latest-stable.zip";
|
|
1945
1966
|
}
|
|
1946
|
-
class
|
|
1967
|
+
class ae extends y {
|
|
1947
1968
|
constructor(e) {
|
|
1948
1969
|
super(), this.resource = e;
|
|
1949
1970
|
}
|
|
@@ -1972,13 +1993,13 @@ class oe extends g {
|
|
|
1972
1993
|
return this.resource.isAsync;
|
|
1973
1994
|
}
|
|
1974
1995
|
}
|
|
1975
|
-
class
|
|
1996
|
+
class pt extends ae {
|
|
1976
1997
|
/** @inheritDoc */
|
|
1977
1998
|
async resolve() {
|
|
1978
1999
|
return this.promise || (this.promise = super.resolve()), this.promise;
|
|
1979
2000
|
}
|
|
1980
2001
|
}
|
|
1981
|
-
class
|
|
2002
|
+
class dt extends ae {
|
|
1982
2003
|
constructor(e, t) {
|
|
1983
2004
|
super(e), this.semaphore = t;
|
|
1984
2005
|
}
|
|
@@ -1987,18 +2008,18 @@ class pt extends oe {
|
|
|
1987
2008
|
return this.isAsync ? this.semaphore.run(() => super.resolve()) : super.resolve();
|
|
1988
2009
|
}
|
|
1989
2010
|
}
|
|
1990
|
-
const
|
|
1991
|
-
function
|
|
1992
|
-
progress: e = new
|
|
1993
|
-
semaphore: t = new
|
|
1994
|
-
onStepCompleted:
|
|
2011
|
+
const ft = ["6.2", "6.1", "6.0", "5.9"];
|
|
2012
|
+
function _t(r, {
|
|
2013
|
+
progress: e = new k(),
|
|
2014
|
+
semaphore: t = new ee({ concurrency: 3 }),
|
|
2015
|
+
onStepCompleted: s = () => {
|
|
1995
2016
|
}
|
|
1996
2017
|
} = {}) {
|
|
1997
|
-
const i = (
|
|
2018
|
+
const i = (r.steps || []).filter(mt), n = i.reduce(
|
|
1998
2019
|
(a, l) => a + (l.progress?.weight || 1),
|
|
1999
2020
|
0
|
|
2000
2021
|
), o = i.map(
|
|
2001
|
-
(a) =>
|
|
2022
|
+
(a) => wt(a, {
|
|
2002
2023
|
semaphore: t,
|
|
2003
2024
|
rootProgressTracker: e,
|
|
2004
2025
|
totalProgressWeight: n
|
|
@@ -2006,14 +2027,14 @@ function yt(s, {
|
|
|
2006
2027
|
);
|
|
2007
2028
|
return {
|
|
2008
2029
|
versions: {
|
|
2009
|
-
php:
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2030
|
+
php: K(
|
|
2031
|
+
r.preferredVersions?.php,
|
|
2032
|
+
ie,
|
|
2033
|
+
Ve
|
|
2013
2034
|
),
|
|
2014
|
-
wp:
|
|
2015
|
-
|
|
2016
|
-
|
|
2035
|
+
wp: K(
|
|
2036
|
+
r.preferredVersions?.wp,
|
|
2037
|
+
ft,
|
|
2017
2038
|
"6.2"
|
|
2018
2039
|
)
|
|
2019
2040
|
},
|
|
@@ -2024,11 +2045,11 @@ function yt(s, {
|
|
|
2024
2045
|
c.setPlayground(a), c.isAsync && c.resolve();
|
|
2025
2046
|
for (const { run: l, step: c } of o) {
|
|
2026
2047
|
const u = await l(a);
|
|
2027
|
-
|
|
2048
|
+
s(u, c);
|
|
2028
2049
|
}
|
|
2029
2050
|
try {
|
|
2030
2051
|
await a.goTo(
|
|
2031
|
-
|
|
2052
|
+
r.landingPage || "/"
|
|
2032
2053
|
);
|
|
2033
2054
|
} catch {
|
|
2034
2055
|
}
|
|
@@ -2038,92 +2059,92 @@ function yt(s, {
|
|
|
2038
2059
|
}
|
|
2039
2060
|
};
|
|
2040
2061
|
}
|
|
2041
|
-
function
|
|
2042
|
-
return
|
|
2062
|
+
function K(r, e, t) {
|
|
2063
|
+
return r && e.includes(r) ? r : t;
|
|
2043
2064
|
}
|
|
2044
|
-
function
|
|
2045
|
-
return !!(typeof
|
|
2065
|
+
function mt(r) {
|
|
2066
|
+
return !!(typeof r == "object" && r);
|
|
2046
2067
|
}
|
|
2047
|
-
function
|
|
2068
|
+
function wt(r, {
|
|
2048
2069
|
semaphore: e,
|
|
2049
2070
|
rootProgressTracker: t,
|
|
2050
|
-
totalProgressWeight:
|
|
2071
|
+
totalProgressWeight: s
|
|
2051
2072
|
}) {
|
|
2052
2073
|
const i = t.stage(
|
|
2053
|
-
(
|
|
2074
|
+
(r.progress?.weight || 1) / s
|
|
2054
2075
|
), n = {};
|
|
2055
|
-
for (const u of Object.keys(
|
|
2056
|
-
let d =
|
|
2057
|
-
|
|
2076
|
+
for (const u of Object.keys(r)) {
|
|
2077
|
+
let d = r[u];
|
|
2078
|
+
nt(d) && (d = y.create(d, {
|
|
2058
2079
|
semaphore: e
|
|
2059
2080
|
})), n[u] = d;
|
|
2060
2081
|
}
|
|
2061
2082
|
const o = async (u) => {
|
|
2062
2083
|
try {
|
|
2063
|
-
return i.fillSlowly(), await
|
|
2084
|
+
return i.fillSlowly(), await Le[r.step](
|
|
2064
2085
|
u,
|
|
2065
|
-
await
|
|
2086
|
+
await gt(n),
|
|
2066
2087
|
{
|
|
2067
2088
|
tracker: i,
|
|
2068
|
-
initialCaption:
|
|
2089
|
+
initialCaption: r.progress?.caption
|
|
2069
2090
|
}
|
|
2070
2091
|
);
|
|
2071
2092
|
} finally {
|
|
2072
2093
|
i.finish();
|
|
2073
2094
|
}
|
|
2074
|
-
}, a =
|
|
2095
|
+
}, a = J(n), l = J(n).filter(
|
|
2075
2096
|
(u) => u.isAsync
|
|
2076
2097
|
), c = 1 / (l.length + 1);
|
|
2077
2098
|
for (const u of l)
|
|
2078
2099
|
u.progress = i.stage(c);
|
|
2079
|
-
return { run: o, step:
|
|
2100
|
+
return { run: o, step: r, resources: a };
|
|
2080
2101
|
}
|
|
2081
|
-
function
|
|
2102
|
+
function J(r) {
|
|
2082
2103
|
const e = [];
|
|
2083
|
-
for (const t in
|
|
2084
|
-
const
|
|
2085
|
-
|
|
2104
|
+
for (const t in r) {
|
|
2105
|
+
const s = r[t];
|
|
2106
|
+
s instanceof y && e.push(s);
|
|
2086
2107
|
}
|
|
2087
2108
|
return e;
|
|
2088
2109
|
}
|
|
2089
|
-
async function
|
|
2110
|
+
async function gt(r) {
|
|
2090
2111
|
const e = {};
|
|
2091
|
-
for (const t in
|
|
2092
|
-
const
|
|
2093
|
-
|
|
2112
|
+
for (const t in r) {
|
|
2113
|
+
const s = r[t];
|
|
2114
|
+
s instanceof y ? e[t] = await s.resolve() : e[t] = s;
|
|
2094
2115
|
}
|
|
2095
2116
|
return e;
|
|
2096
2117
|
}
|
|
2097
|
-
async function Pt(
|
|
2098
|
-
await
|
|
2118
|
+
async function Pt(r, e) {
|
|
2119
|
+
await r.run(e);
|
|
2099
2120
|
}
|
|
2100
2121
|
export {
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2122
|
+
Z as activatePlugin,
|
|
2123
|
+
Q as activateTheme,
|
|
2124
|
+
he as applyWordPressPatches,
|
|
2125
|
+
_t as compileBlueprint,
|
|
2126
|
+
we as cp,
|
|
2127
|
+
$e as defineSiteUrl,
|
|
2128
|
+
x as defineWpConfigConsts,
|
|
2129
|
+
Se as importFile,
|
|
2109
2130
|
xe as installPlugin,
|
|
2110
|
-
|
|
2131
|
+
Ce as installTheme,
|
|
2111
2132
|
ke as login,
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2133
|
+
ye as mkdir,
|
|
2134
|
+
ge as mv,
|
|
2135
|
+
Ee as replaceSite,
|
|
2136
|
+
me as request,
|
|
2137
|
+
_e as rm,
|
|
2117
2138
|
Pe as rmdir,
|
|
2118
2139
|
Pt as runBlueprintSteps,
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2140
|
+
pe as runPHP,
|
|
2141
|
+
de as runPHPWithOptions,
|
|
2142
|
+
Ae as runWpInstallationWizard,
|
|
2143
|
+
fe as setPhpIniEntry,
|
|
2144
|
+
yt as setPluginProxyURL,
|
|
2145
|
+
Ue as setSiteOptions,
|
|
2146
|
+
C as unzip,
|
|
2147
|
+
Ne as updateUserMeta,
|
|
2148
|
+
X as writeFile,
|
|
2149
|
+
ve as zipEntireSite
|
|
2129
2150
|
};
|