@wp-playground/cli 3.1.2 → 3.1.3
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/cli.cjs +1 -1
- package/cli.js +1 -1
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/package.json +14 -14
- package/{run-cli-C8e0UxH1.js → run-cli-Cv4FHhj_.js} +644 -602
- package/run-cli-Cv4FHhj_.js.map +1 -0
- package/run-cli-NCnYfPz7.cjs +66 -0
- package/run-cli-NCnYfPz7.cjs.map +1 -0
- package/run-cli.d.ts +2 -3
- package/sqlite-database-integration.zip +0 -0
- package/start-server.d.ts +1 -0
- package/worker-thread-v1.cjs +1 -1
- package/worker-thread-v1.js +1 -1
- package/worker-thread-v2.cjs +1 -1
- package/worker-thread-v2.js +1 -1
- package/process-id-allocator.d.ts +0 -9
- package/run-cli-C8e0UxH1.js.map +0 -1
- package/run-cli-DoRePwjp.cjs +0 -66
- package/run-cli-DoRePwjp.cjs.map +0 -1
|
@@ -1,88 +1,69 @@
|
|
|
1
|
-
import { logger as
|
|
2
|
-
import { consumeAPI as
|
|
3
|
-
import { resolveRemoteBlueprint as
|
|
4
|
-
import { zipDirectory as
|
|
5
|
-
import c, { existsSync as
|
|
6
|
-
import { MessageChannel as
|
|
7
|
-
import { createNodeFsMountHandler as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
constructor(t = 1, r = rt) {
|
|
30
|
-
this.claimed = /* @__PURE__ */ new Set(), this.initialId = t, this.maxId = r, this.nextId = t;
|
|
31
|
-
}
|
|
32
|
-
claim() {
|
|
33
|
-
const t = this.maxId - this.initialId + 1;
|
|
34
|
-
for (let r = 0; r < t; r++)
|
|
35
|
-
if (this.claimed.has(this.nextId))
|
|
36
|
-
this.nextId++, this.nextId > this.maxId && (this.nextId = this.initialId);
|
|
37
|
-
else
|
|
38
|
-
return this.claimed.add(this.nextId), this.nextId;
|
|
39
|
-
throw new Error(
|
|
40
|
-
`Unable to find free process ID after ${t} tries.`
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
release(t) {
|
|
44
|
-
return this.claimed.has(t) ? (this.claimed.delete(t), !0) : !1;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function U(e) {
|
|
1
|
+
import { logger as P, LogSeverity as F, errorLogPath as Z } from "@php-wasm/logger";
|
|
2
|
+
import { consumeAPI as ue, ProcessIdAllocator as xe, SupportedPHPVersions as R, printDebugDetails as $e, HttpCookieStore as Ee, FileLockManagerInMemory as Te, StreamedPHPResponse as J, createObjectPoolProxy as Ie, exposeAPI as ke, PHPResponse as Me, exposeSyncAPI as Be } from "@php-wasm/universal";
|
|
3
|
+
import { resolveRemoteBlueprint as Ae, resolveRuntimeConfiguration as K, compileBlueprintV1 as de, isBlueprintBundle as Ce, runBlueprintV1Steps as ee } from "@wp-playground/blueprints";
|
|
4
|
+
import { zipDirectory as De, RecommendedPHPVersion as M } from "@wp-playground/common";
|
|
5
|
+
import c, { existsSync as Y, rmdirSync as Re, mkdirSync as j, readdirSync as We } from "fs";
|
|
6
|
+
import { MessageChannel as pe, Worker as te } from "worker_threads";
|
|
7
|
+
import { createNodeFsMountHandler as Le } from "@php-wasm/node";
|
|
8
|
+
import d, { basename as D, join as ce } from "path";
|
|
9
|
+
import { exec as me } from "child_process";
|
|
10
|
+
import { promisify as Ue } from "util";
|
|
11
|
+
import fe from "express";
|
|
12
|
+
import { Readable as He } from "stream";
|
|
13
|
+
import { pipeline as Fe } from "stream/promises";
|
|
14
|
+
import Ne from "yargs";
|
|
15
|
+
import { NodeJsFilesystem as Oe, OverlayFilesystem as _e, InMemoryFilesystem as je, ZipFilesystem as Ve } from "@wp-playground/storage";
|
|
16
|
+
import { EmscriptenDownloadMonitor as Ye, ProgressTracker as qe } from "@php-wasm/progress";
|
|
17
|
+
import { resolveWordPressRelease as ze } from "@wp-playground/wordpress";
|
|
18
|
+
import $ from "fs-extra";
|
|
19
|
+
import { createRequire as Ge } from "module";
|
|
20
|
+
import q from "os";
|
|
21
|
+
import { startBridge as Qe } from "@php-wasm/xdebug-bridge";
|
|
22
|
+
import { dir as Xe, setGracefulCleanup as Ze } from "tmp-promise";
|
|
23
|
+
import Je from "ps-man";
|
|
24
|
+
import { removeTempDirSymlink as Ke, createTempDirSymlink as oe, makeXdebugConfig as et, clearXdebugIDEConfig as tt, addXdebugIDEConfig as ot } from "@php-wasm/cli-util";
|
|
25
|
+
import { createHash as rt } from "crypto";
|
|
26
|
+
import { PHPMYADMIN_INSTALL_PATH as re, getPhpMyAdminInstallSteps as st, PHPMYADMIN_ENTRY_PATH as it } from "@wp-playground/tools";
|
|
27
|
+
import { jspi as se } from "wasm-feature-detect";
|
|
28
|
+
function N(e) {
|
|
48
29
|
const t = [];
|
|
49
|
-
for (const
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
throw new Error(`Invalid mount format: ${
|
|
30
|
+
for (const o of e) {
|
|
31
|
+
const r = o.split(":");
|
|
32
|
+
if (r.length !== 2)
|
|
33
|
+
throw new Error(`Invalid mount format: ${o}.
|
|
53
34
|
Expected format: /host/path:/vfs/path.
|
|
54
35
|
If your path contains a colon, e.g. C:\\myplugin, use the --mount-dir option instead.
|
|
55
36
|
Example: --mount-dir C:\\my-plugin /wordpress/wp-content/plugins/my-plugin`);
|
|
56
|
-
const [
|
|
57
|
-
if (!
|
|
58
|
-
throw new Error(`Host path does not exist: ${
|
|
59
|
-
t.push({ hostPath:
|
|
37
|
+
const [s, i] = r;
|
|
38
|
+
if (!Y(s))
|
|
39
|
+
throw new Error(`Host path does not exist: ${s}`);
|
|
40
|
+
t.push({ hostPath: s, vfsPath: i });
|
|
60
41
|
}
|
|
61
42
|
return t;
|
|
62
43
|
}
|
|
63
|
-
function
|
|
44
|
+
function ie(e) {
|
|
64
45
|
if (e.length % 2 !== 0)
|
|
65
46
|
throw new Error("Invalid mount format. Expected: /host/path /vfs/path");
|
|
66
47
|
const t = [];
|
|
67
|
-
for (let
|
|
68
|
-
const
|
|
69
|
-
if (!
|
|
70
|
-
throw new Error(`Host path does not exist: ${
|
|
48
|
+
for (let o = 0; o < e.length; o += 2) {
|
|
49
|
+
const r = e[o], s = e[o + 1];
|
|
50
|
+
if (!Y(r))
|
|
51
|
+
throw new Error(`Host path does not exist: ${r}`);
|
|
71
52
|
t.push({
|
|
72
|
-
hostPath:
|
|
73
|
-
vfsPath:
|
|
53
|
+
hostPath: d.resolve(process.cwd(), r),
|
|
54
|
+
vfsPath: s
|
|
74
55
|
});
|
|
75
56
|
}
|
|
76
57
|
return t;
|
|
77
58
|
}
|
|
78
|
-
async function
|
|
79
|
-
for (const
|
|
59
|
+
async function yo(e, t) {
|
|
60
|
+
for (const o of t)
|
|
80
61
|
await e.mount(
|
|
81
|
-
|
|
82
|
-
|
|
62
|
+
o.vfsPath,
|
|
63
|
+
Le(o.hostPath)
|
|
83
64
|
);
|
|
84
65
|
}
|
|
85
|
-
const
|
|
66
|
+
const ne = {
|
|
86
67
|
step: "runPHP",
|
|
87
68
|
code: {
|
|
88
69
|
filename: "activate-theme.php",
|
|
@@ -101,284 +82,307 @@ const oe = {
|
|
|
101
82
|
`
|
|
102
83
|
}
|
|
103
84
|
};
|
|
104
|
-
function
|
|
105
|
-
const t = e.autoMount,
|
|
85
|
+
function he(e) {
|
|
86
|
+
const t = e.autoMount, o = [...e.mount || []], r = [...e["mount-before-install"] || []], s = {
|
|
106
87
|
...e,
|
|
107
|
-
mount:
|
|
108
|
-
"mount-before-install":
|
|
88
|
+
mount: o,
|
|
89
|
+
"mount-before-install": r,
|
|
109
90
|
"additional-blueprint-steps": [
|
|
110
91
|
...e["additional-blueprint-steps"] || []
|
|
111
92
|
]
|
|
112
93
|
};
|
|
113
|
-
if (
|
|
114
|
-
const n = `/wordpress/wp-content/plugins/${
|
|
115
|
-
|
|
94
|
+
if (ut(t)) {
|
|
95
|
+
const n = `/wordpress/wp-content/plugins/${D(t)}`;
|
|
96
|
+
o.push({
|
|
116
97
|
hostPath: t,
|
|
117
98
|
vfsPath: n,
|
|
118
99
|
autoMounted: !0
|
|
119
|
-
}),
|
|
100
|
+
}), s["additional-blueprint-steps"].push({
|
|
120
101
|
step: "activatePlugin",
|
|
121
|
-
pluginPath: `/wordpress/wp-content/plugins/${
|
|
102
|
+
pluginPath: `/wordpress/wp-content/plugins/${D(t)}`
|
|
122
103
|
});
|
|
123
|
-
} else if (
|
|
124
|
-
const
|
|
125
|
-
|
|
104
|
+
} else if (lt(t)) {
|
|
105
|
+
const i = D(t), n = `/wordpress/wp-content/themes/${i}`;
|
|
106
|
+
o.push({
|
|
126
107
|
hostPath: t,
|
|
127
108
|
vfsPath: n,
|
|
128
109
|
autoMounted: !0
|
|
129
|
-
}),
|
|
110
|
+
}), s["additional-blueprint-steps"].push(
|
|
130
111
|
e["experimental-blueprints-v2-runner"] ? {
|
|
131
112
|
step: "activateTheme",
|
|
132
|
-
themeDirectoryName:
|
|
113
|
+
themeDirectoryName: i
|
|
133
114
|
} : {
|
|
134
115
|
step: "activateTheme",
|
|
135
|
-
themeFolderName:
|
|
116
|
+
themeFolderName: i
|
|
136
117
|
}
|
|
137
118
|
);
|
|
138
|
-
} else if (
|
|
139
|
-
const
|
|
140
|
-
for (const n of
|
|
141
|
-
n !== "index.php" &&
|
|
119
|
+
} else if (at(t)) {
|
|
120
|
+
const i = c.readdirSync(t);
|
|
121
|
+
for (const n of i)
|
|
122
|
+
n !== "index.php" && o.push({
|
|
142
123
|
hostPath: `${t}/${n}`,
|
|
143
124
|
vfsPath: `/wordpress/wp-content/${n}`,
|
|
144
125
|
autoMounted: !0
|
|
145
126
|
});
|
|
146
|
-
|
|
147
|
-
} else
|
|
127
|
+
s["additional-blueprint-steps"].push(ne);
|
|
128
|
+
} else nt(t) && (r.push({
|
|
148
129
|
hostPath: t,
|
|
149
130
|
vfsPath: "/wordpress",
|
|
150
131
|
autoMounted: !0
|
|
151
|
-
}),
|
|
152
|
-
return
|
|
132
|
+
}), s.mode = "apply-to-existing-site", s["additional-blueprint-steps"].push(ne), s.wordpressInstallMode || (s.wordpressInstallMode = "install-from-existing-files-if-needed"));
|
|
133
|
+
return s;
|
|
153
134
|
}
|
|
154
|
-
function
|
|
135
|
+
function nt(e) {
|
|
155
136
|
const t = c.readdirSync(e);
|
|
156
137
|
return t.includes("wp-admin") && t.includes("wp-includes") && t.includes("wp-content");
|
|
157
138
|
}
|
|
158
|
-
function
|
|
139
|
+
function at(e) {
|
|
159
140
|
const t = c.readdirSync(e);
|
|
160
141
|
return t.includes("themes") || t.includes("plugins") || t.includes("mu-plugins") || t.includes("uploads");
|
|
161
142
|
}
|
|
162
|
-
function
|
|
143
|
+
function lt(e) {
|
|
163
144
|
if (!c.readdirSync(e).includes("style.css"))
|
|
164
145
|
return !1;
|
|
165
|
-
const
|
|
166
|
-
return !!/^(?:[ \t]*<\?php)?[ \t/*#@]*Theme Name:(.*)$/im.exec(
|
|
146
|
+
const o = c.readFileSync(ce(e, "style.css"), "utf8");
|
|
147
|
+
return !!/^(?:[ \t]*<\?php)?[ \t/*#@]*Theme Name:(.*)$/im.exec(o);
|
|
167
148
|
}
|
|
168
|
-
function
|
|
169
|
-
const t = c.readdirSync(e),
|
|
170
|
-
return !!t.filter((
|
|
171
|
-
const
|
|
172
|
-
return !!
|
|
149
|
+
function ut(e) {
|
|
150
|
+
const t = c.readdirSync(e), o = /^(?:[ \t]*<\?php)?[ \t/*#@]*Plugin Name:(.*)$/im;
|
|
151
|
+
return !!t.filter((s) => s.endsWith(".php")).find((s) => {
|
|
152
|
+
const i = c.readFileSync(ce(e, s), "utf8");
|
|
153
|
+
return !!o.exec(i);
|
|
173
154
|
});
|
|
174
155
|
}
|
|
175
|
-
function
|
|
156
|
+
function dt(e) {
|
|
176
157
|
if (e.length % 2 !== 0)
|
|
177
158
|
throw new Error(
|
|
178
159
|
"Invalid constant definition format. Expected pairs of NAME value"
|
|
179
160
|
);
|
|
180
161
|
const t = {};
|
|
181
|
-
for (let
|
|
182
|
-
const
|
|
183
|
-
if (!
|
|
162
|
+
for (let o = 0; o < e.length; o += 2) {
|
|
163
|
+
const r = e[o], s = e[o + 1];
|
|
164
|
+
if (!r || !r.trim())
|
|
184
165
|
throw new Error("Constant name cannot be empty");
|
|
185
|
-
t[
|
|
166
|
+
t[r.trim()] = s;
|
|
186
167
|
}
|
|
187
168
|
return t;
|
|
188
169
|
}
|
|
189
|
-
function
|
|
170
|
+
function pt(e) {
|
|
190
171
|
if (e.length % 2 !== 0)
|
|
191
172
|
throw new Error(
|
|
192
173
|
"Invalid boolean constant definition format. Expected pairs of NAME value"
|
|
193
174
|
);
|
|
194
175
|
const t = {};
|
|
195
|
-
for (let
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
176
|
+
for (let o = 0; o < e.length; o += 2) {
|
|
177
|
+
const r = e[o], s = e[o + 1].trim().toLowerCase();
|
|
178
|
+
if (!r || !r.trim())
|
|
198
179
|
throw new Error("Constant name cannot be empty");
|
|
199
|
-
if (
|
|
200
|
-
t[
|
|
201
|
-
else if (
|
|
202
|
-
t[
|
|
180
|
+
if (s === "true" || s === "1")
|
|
181
|
+
t[r.trim()] = !0;
|
|
182
|
+
else if (s === "false" || s === "0")
|
|
183
|
+
t[r.trim()] = !1;
|
|
203
184
|
else
|
|
204
185
|
throw new Error(
|
|
205
|
-
`Invalid boolean value for constant "${
|
|
186
|
+
`Invalid boolean value for constant "${r}": "${s}". Must be "true", "false", "1", or "0".`
|
|
206
187
|
);
|
|
207
188
|
}
|
|
208
189
|
return t;
|
|
209
190
|
}
|
|
210
|
-
function
|
|
191
|
+
function ct(e) {
|
|
211
192
|
if (e.length % 2 !== 0)
|
|
212
193
|
throw new Error(
|
|
213
194
|
"Invalid number constant definition format. Expected pairs of NAME value"
|
|
214
195
|
);
|
|
215
196
|
const t = {};
|
|
216
|
-
for (let
|
|
217
|
-
const
|
|
218
|
-
if (!
|
|
197
|
+
for (let o = 0; o < e.length; o += 2) {
|
|
198
|
+
const r = e[o], s = e[o + 1].trim();
|
|
199
|
+
if (!r || !r.trim())
|
|
219
200
|
throw new Error("Constant name cannot be empty");
|
|
220
|
-
const
|
|
221
|
-
if (isNaN(
|
|
201
|
+
const i = Number(s);
|
|
202
|
+
if (isNaN(i))
|
|
222
203
|
throw new Error(
|
|
223
|
-
`Invalid number value for constant "${
|
|
204
|
+
`Invalid number value for constant "${r}": "${s}". Must be a valid number.`
|
|
224
205
|
);
|
|
225
|
-
t[
|
|
206
|
+
t[r.trim()] = i;
|
|
226
207
|
}
|
|
227
208
|
return t;
|
|
228
209
|
}
|
|
229
|
-
function
|
|
230
|
-
const
|
|
231
|
-
for (const
|
|
232
|
-
if (
|
|
210
|
+
function mt(e = {}, t = {}, o = {}) {
|
|
211
|
+
const r = {}, s = /* @__PURE__ */ new Set(), i = (n, l) => {
|
|
212
|
+
for (const u in n) {
|
|
213
|
+
if (s.has(u))
|
|
233
214
|
throw new Error(
|
|
234
|
-
`Constant "${
|
|
215
|
+
`Constant "${u}" is defined multiple times across different --define-${l} flags`
|
|
235
216
|
);
|
|
236
|
-
|
|
217
|
+
s.add(u), r[u] = n[u];
|
|
237
218
|
}
|
|
238
219
|
};
|
|
239
|
-
return
|
|
220
|
+
return i(e, "string"), i(t, "bool"), i(o, "number"), r;
|
|
240
221
|
}
|
|
241
|
-
function
|
|
242
|
-
return
|
|
222
|
+
function we(e) {
|
|
223
|
+
return mt(
|
|
243
224
|
e.define,
|
|
244
225
|
e["define-bool"],
|
|
245
226
|
e["define-number"]
|
|
246
227
|
);
|
|
247
228
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
229
|
+
const ft = Ue(me);
|
|
230
|
+
function ht(e) {
|
|
231
|
+
return new Promise((t) => {
|
|
232
|
+
if (e === 0) return t(!1);
|
|
233
|
+
const o = fe().listen(e);
|
|
234
|
+
o.once("listening", () => o.close(() => t(!1))), o.once(
|
|
235
|
+
"error",
|
|
236
|
+
(r) => t(r.code === "EADDRINUSE")
|
|
237
|
+
);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
async function wt(e) {
|
|
241
|
+
const t = fe(), o = await new Promise((n, l) => {
|
|
242
|
+
const u = t.listen(e.port, () => {
|
|
243
|
+
const w = u.address();
|
|
244
|
+
w === null || typeof w == "string" ? l(new Error("Server address is not available")) : n(u);
|
|
245
|
+
}).once("error", l);
|
|
254
246
|
});
|
|
255
|
-
t.use("/", async (
|
|
247
|
+
t.use("/", async (n, l) => {
|
|
256
248
|
try {
|
|
257
|
-
const
|
|
258
|
-
url:
|
|
259
|
-
headers:
|
|
260
|
-
method:
|
|
261
|
-
body: await
|
|
262
|
-
},
|
|
263
|
-
await
|
|
264
|
-
} catch (
|
|
265
|
-
|
|
249
|
+
const u = {
|
|
250
|
+
url: n.url,
|
|
251
|
+
headers: Pt(n),
|
|
252
|
+
method: n.method,
|
|
253
|
+
body: await bt(n)
|
|
254
|
+
}, w = await e.handleRequest(u);
|
|
255
|
+
await yt(w, l);
|
|
256
|
+
} catch (u) {
|
|
257
|
+
P.error(u), l.headersSent || (l.statusCode = 500, l.end("Internal Server Error"));
|
|
266
258
|
}
|
|
267
259
|
});
|
|
268
|
-
const
|
|
269
|
-
return await e.onBind(
|
|
260
|
+
const s = o.address().port, i = process.env.CODESPACE_NAME;
|
|
261
|
+
return i && gt(s, i), await e.onBind(o, s);
|
|
270
262
|
}
|
|
271
|
-
async function
|
|
272
|
-
const [
|
|
263
|
+
async function yt(e, t) {
|
|
264
|
+
const [o, r] = await Promise.all([
|
|
273
265
|
e.headers,
|
|
274
266
|
e.httpStatusCode
|
|
275
267
|
]);
|
|
276
|
-
t.statusCode =
|
|
277
|
-
for (const
|
|
278
|
-
t.setHeader(
|
|
279
|
-
const
|
|
280
|
-
await
|
|
268
|
+
t.statusCode = r;
|
|
269
|
+
for (const i in o)
|
|
270
|
+
t.setHeader(i, o[i]);
|
|
271
|
+
const s = He.fromWeb(e.stdout);
|
|
272
|
+
await Fe(s, t);
|
|
281
273
|
}
|
|
282
|
-
const
|
|
283
|
-
const
|
|
284
|
-
e.on("data", (
|
|
285
|
-
|
|
274
|
+
const bt = async (e) => await new Promise((t) => {
|
|
275
|
+
const o = [];
|
|
276
|
+
e.on("data", (r) => {
|
|
277
|
+
o.push(r);
|
|
286
278
|
}), e.on("end", () => {
|
|
287
|
-
t(new Uint8Array(Buffer.concat(
|
|
279
|
+
t(new Uint8Array(Buffer.concat(o)));
|
|
288
280
|
});
|
|
289
|
-
})
|
|
281
|
+
});
|
|
282
|
+
async function gt(e, t) {
|
|
283
|
+
P.log(`Publishing port ${e}...`);
|
|
284
|
+
const o = `gh codespace ports visibility ${e}:public -c ${t}`;
|
|
285
|
+
for (let r = 0; r < 10; r++)
|
|
286
|
+
try {
|
|
287
|
+
await ft(o);
|
|
288
|
+
return;
|
|
289
|
+
} catch {
|
|
290
|
+
await new Promise((s) => setTimeout(s, 2e3));
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const Pt = (e) => {
|
|
290
294
|
const t = {};
|
|
291
295
|
if (e.rawHeaders && e.rawHeaders.length)
|
|
292
|
-
for (let
|
|
293
|
-
t[e.rawHeaders[
|
|
296
|
+
for (let o = 0; o < e.rawHeaders.length; o += 2)
|
|
297
|
+
t[e.rawHeaders[o].toLowerCase()] = e.rawHeaders[o + 1];
|
|
294
298
|
return t;
|
|
295
299
|
};
|
|
296
|
-
function
|
|
300
|
+
function vt(e) {
|
|
297
301
|
return /^latest$|^trunk$|^nightly$|^(?:(\d+)\.(\d+)(?:\.(\d+))?)((?:-beta(?:\d+)?)|(?:-RC(?:\d+)?))?$/.test(e);
|
|
298
302
|
}
|
|
299
|
-
async function
|
|
303
|
+
async function St({
|
|
300
304
|
sourceString: e,
|
|
301
305
|
blueprintMayReadAdjacentFiles: t
|
|
302
306
|
}) {
|
|
303
307
|
if (!e)
|
|
304
308
|
return;
|
|
305
309
|
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
306
|
-
return await
|
|
307
|
-
let
|
|
308
|
-
if (!c.existsSync(
|
|
309
|
-
throw new Error(`Blueprint file does not exist: ${
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
310
|
+
return await Ae(e);
|
|
311
|
+
let o = d.resolve(process.cwd(), e);
|
|
312
|
+
if (!c.existsSync(o))
|
|
313
|
+
throw new Error(`Blueprint file does not exist: ${o}`);
|
|
314
|
+
const r = c.statSync(o);
|
|
315
|
+
if (r.isDirectory() && (o = d.join(o, "blueprint.json")), !r.isFile() && r.isSymbolicLink())
|
|
312
316
|
throw new Error(
|
|
313
|
-
`Blueprint path is neither a file nor a directory: ${
|
|
317
|
+
`Blueprint path is neither a file nor a directory: ${o}`
|
|
314
318
|
);
|
|
315
|
-
const
|
|
316
|
-
switch (
|
|
319
|
+
const s = d.extname(o);
|
|
320
|
+
switch (s) {
|
|
317
321
|
case ".zip":
|
|
318
|
-
return
|
|
319
|
-
c.readFileSync(
|
|
322
|
+
return Ve.fromArrayBuffer(
|
|
323
|
+
c.readFileSync(o).buffer
|
|
320
324
|
);
|
|
321
325
|
case ".json": {
|
|
322
|
-
const
|
|
326
|
+
const i = c.readFileSync(o, "utf-8");
|
|
323
327
|
try {
|
|
324
|
-
JSON.parse(
|
|
328
|
+
JSON.parse(i);
|
|
325
329
|
} catch {
|
|
326
330
|
throw new Error(
|
|
327
|
-
`Blueprint file at ${
|
|
331
|
+
`Blueprint file at ${o} is not a valid JSON file`
|
|
328
332
|
);
|
|
329
333
|
}
|
|
330
|
-
const n =
|
|
331
|
-
return new
|
|
332
|
-
new
|
|
333
|
-
"blueprint.json":
|
|
334
|
+
const n = d.dirname(o), l = new Oe(n);
|
|
335
|
+
return new _e([
|
|
336
|
+
new je({
|
|
337
|
+
"blueprint.json": i
|
|
334
338
|
}),
|
|
335
339
|
/**
|
|
336
340
|
* Wrap the NodeJS filesystem to prevent access to local files
|
|
337
341
|
* unless the user explicitly allowed it.
|
|
338
342
|
*/
|
|
339
343
|
{
|
|
340
|
-
read(
|
|
344
|
+
read(u) {
|
|
341
345
|
if (!t)
|
|
342
346
|
throw new Error(
|
|
343
|
-
`Error: Blueprint contained tried to read a local file at path "${
|
|
347
|
+
`Error: Blueprint contained tried to read a local file at path "${u}" (via a resource of type "bundled"). Playground restricts access to local resources by default as a security measure.
|
|
344
348
|
|
|
345
349
|
You can allow this Blueprint to read files from the same parent directory by explicitly adding the --blueprint-may-read-adjacent-files option to your command.`
|
|
346
350
|
);
|
|
347
|
-
return l.read(
|
|
351
|
+
return l.read(u);
|
|
348
352
|
}
|
|
349
353
|
}
|
|
350
354
|
]);
|
|
351
355
|
}
|
|
352
356
|
default:
|
|
353
357
|
throw new Error(
|
|
354
|
-
`Unsupported blueprint file extension: ${
|
|
358
|
+
`Unsupported blueprint file extension: ${s}. Only .zip and .json files are supported.`
|
|
355
359
|
);
|
|
356
360
|
}
|
|
357
361
|
}
|
|
358
|
-
class
|
|
359
|
-
constructor(t,
|
|
360
|
-
this.args = t, this.siteUrl =
|
|
362
|
+
class xt {
|
|
363
|
+
constructor(t, o) {
|
|
364
|
+
this.args = t, this.siteUrl = o.siteUrl, this.phpVersion = t.php, this.cliOutput = o.cliOutput;
|
|
361
365
|
}
|
|
362
366
|
getWorkerType() {
|
|
363
367
|
return "v2";
|
|
364
368
|
}
|
|
365
|
-
async bootWordPress(t,
|
|
366
|
-
const
|
|
369
|
+
async bootWordPress(t, o) {
|
|
370
|
+
const r = {
|
|
367
371
|
command: this.args.command,
|
|
368
372
|
siteUrl: this.siteUrl,
|
|
369
373
|
blueprint: this.args.blueprint,
|
|
370
|
-
workerPostInstallMountsPort:
|
|
374
|
+
workerPostInstallMountsPort: o
|
|
371
375
|
};
|
|
372
|
-
return await t.bootWordPress(
|
|
376
|
+
return await t.bootWordPress(r, o), t;
|
|
373
377
|
}
|
|
374
378
|
async bootRequestHandler({
|
|
375
379
|
worker: t,
|
|
376
|
-
fileLockManagerPort:
|
|
377
|
-
nativeInternalDirPath:
|
|
380
|
+
fileLockManagerPort: o,
|
|
381
|
+
nativeInternalDirPath: r
|
|
378
382
|
}) {
|
|
379
|
-
const
|
|
380
|
-
await
|
|
381
|
-
const
|
|
383
|
+
const s = ue(t.phpPort);
|
|
384
|
+
await s.useFileLockManager(o);
|
|
385
|
+
const i = {
|
|
382
386
|
...this.args,
|
|
383
387
|
phpVersion: this.phpVersion,
|
|
384
388
|
siteUrl: this.siteUrl,
|
|
@@ -388,106 +392,106 @@ class bt {
|
|
|
388
392
|
withRedis: this.args.redis,
|
|
389
393
|
withMemcached: this.args.memcached,
|
|
390
394
|
withXdebug: !!this.args.xdebug,
|
|
391
|
-
nativeInternalDirPath:
|
|
395
|
+
nativeInternalDirPath: r,
|
|
392
396
|
mountsBeforeWpInstall: this.args["mount-before-install"] || [],
|
|
393
397
|
mountsAfterWpInstall: this.args.mount || [],
|
|
394
|
-
constants:
|
|
398
|
+
constants: we(this.args)
|
|
395
399
|
};
|
|
396
|
-
return await
|
|
400
|
+
return await s.bootWorker(i), s;
|
|
397
401
|
}
|
|
398
402
|
}
|
|
399
|
-
const
|
|
400
|
-
async function
|
|
403
|
+
const V = d.join(q.homedir(), ".wordpress-playground");
|
|
404
|
+
async function $t() {
|
|
401
405
|
const e = typeof __dirname < "u" ? __dirname : import.meta.dirname;
|
|
402
|
-
let t =
|
|
403
|
-
if (
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
+
let t = d.join(e, "sqlite-database-integration.zip");
|
|
407
|
+
if (!$.existsSync(t)) {
|
|
408
|
+
const o = Ge(import.meta.url), r = d.dirname(
|
|
409
|
+
o.resolve("@wp-playground/wordpress-builds/package.json")
|
|
406
410
|
);
|
|
407
|
-
t =
|
|
408
|
-
|
|
411
|
+
t = d.join(
|
|
412
|
+
r,
|
|
409
413
|
"src",
|
|
410
414
|
"sqlite-database-integration",
|
|
411
415
|
"sqlite-database-integration-trunk.zip"
|
|
412
416
|
);
|
|
413
417
|
}
|
|
414
|
-
return new File([await
|
|
418
|
+
return new File([await $.readFile(t)], d.basename(t));
|
|
415
419
|
}
|
|
416
|
-
async function
|
|
417
|
-
const
|
|
418
|
-
return
|
|
420
|
+
async function Et(e, t, o) {
|
|
421
|
+
const r = d.join(V, t);
|
|
422
|
+
return $.existsSync(r) || ($.ensureDirSync(V), await Tt(e, r, o)), ye(r);
|
|
419
423
|
}
|
|
420
|
-
async function
|
|
421
|
-
const
|
|
424
|
+
async function Tt(e, t, o) {
|
|
425
|
+
const s = (await o.monitorFetch(fetch(e))).body.getReader(), i = `${t}.partial`, n = $.createWriteStream(i);
|
|
422
426
|
for (; ; ) {
|
|
423
|
-
const { done: l, value:
|
|
424
|
-
if (
|
|
427
|
+
const { done: l, value: u } = await s.read();
|
|
428
|
+
if (u && n.write(u), l)
|
|
425
429
|
break;
|
|
426
430
|
}
|
|
427
|
-
n.close(), n.closed || await new Promise((l,
|
|
431
|
+
n.close(), n.closed || await new Promise((l, u) => {
|
|
428
432
|
n.on("finish", () => {
|
|
429
|
-
|
|
430
|
-
}), n.on("error", (
|
|
431
|
-
|
|
433
|
+
$.renameSync(i, t), l(null);
|
|
434
|
+
}), n.on("error", (w) => {
|
|
435
|
+
$.removeSync(i), u(w);
|
|
432
436
|
});
|
|
433
437
|
});
|
|
434
438
|
}
|
|
435
|
-
function
|
|
436
|
-
return new File([
|
|
439
|
+
function ye(e, t) {
|
|
440
|
+
return new File([$.readFileSync(e)], D(e));
|
|
437
441
|
}
|
|
438
|
-
class
|
|
439
|
-
constructor(t,
|
|
440
|
-
this.args = t, this.siteUrl =
|
|
442
|
+
class It {
|
|
443
|
+
constructor(t, o) {
|
|
444
|
+
this.args = t, this.siteUrl = o.siteUrl, this.cliOutput = o.cliOutput;
|
|
441
445
|
}
|
|
442
446
|
getWorkerType() {
|
|
443
447
|
return "v1";
|
|
444
448
|
}
|
|
445
|
-
async bootWordPress(t,
|
|
446
|
-
let
|
|
447
|
-
const n = new
|
|
449
|
+
async bootWordPress(t, o) {
|
|
450
|
+
let r, s, i;
|
|
451
|
+
const n = new Ye();
|
|
448
452
|
if (this.args.wordpressInstallMode === "download-and-install") {
|
|
449
|
-
let
|
|
453
|
+
let w = !1;
|
|
450
454
|
n.addEventListener("progress", (S) => {
|
|
451
|
-
if (
|
|
455
|
+
if (w)
|
|
452
456
|
return;
|
|
453
457
|
const { loaded: p, total: a } = S.detail, m = Math.floor(
|
|
454
458
|
Math.min(100, 100 * p / a)
|
|
455
459
|
);
|
|
456
|
-
|
|
460
|
+
w = m === 100, this.cliOutput.updateProgress(
|
|
457
461
|
"Downloading WordPress",
|
|
458
462
|
m
|
|
459
463
|
);
|
|
460
|
-
}),
|
|
461
|
-
|
|
462
|
-
`prebuilt-wp-content-for-wp-${
|
|
463
|
-
),
|
|
464
|
-
|
|
465
|
-
`${
|
|
464
|
+
}), r = await ze(this.args.wp), i = d.join(
|
|
465
|
+
V,
|
|
466
|
+
`prebuilt-wp-content-for-wp-${r.version}.zip`
|
|
467
|
+
), s = c.existsSync(i) ? ye(i) : await Et(
|
|
468
|
+
r.releaseUrl,
|
|
469
|
+
`${r.version}.zip`,
|
|
466
470
|
n
|
|
467
|
-
),
|
|
468
|
-
`Resolved WordPress release URL: ${
|
|
471
|
+
), P.debug(
|
|
472
|
+
`Resolved WordPress release URL: ${r?.releaseUrl}`
|
|
469
473
|
);
|
|
470
474
|
}
|
|
471
475
|
let l;
|
|
472
|
-
this.args.skipSqliteSetup ? (
|
|
473
|
-
const
|
|
476
|
+
this.args.skipSqliteSetup ? (P.debug("Skipping SQLite integration plugin setup..."), l = void 0) : (this.cliOutput.updateProgress("Preparing SQLite database"), l = await $t()), this.cliOutput.updateProgress("Booting WordPress");
|
|
477
|
+
const u = await K(
|
|
474
478
|
this.getEffectiveBlueprint()
|
|
475
479
|
);
|
|
476
480
|
return await t.bootWordPress(
|
|
477
481
|
{
|
|
478
|
-
wpVersion:
|
|
482
|
+
wpVersion: u.wpVersion,
|
|
479
483
|
siteUrl: this.siteUrl,
|
|
480
484
|
wordpressInstallMode: this.args.wordpressInstallMode || "download-and-install",
|
|
481
|
-
wordPressZip:
|
|
485
|
+
wordPressZip: s && await s.arrayBuffer(),
|
|
482
486
|
sqliteIntegrationPluginZip: await l?.arrayBuffer(),
|
|
483
|
-
constants:
|
|
487
|
+
constants: we(this.args)
|
|
484
488
|
},
|
|
485
|
-
|
|
486
|
-
),
|
|
487
|
-
|
|
489
|
+
o
|
|
490
|
+
), i && !this.args["mount-before-install"] && !c.existsSync(i) && (this.cliOutput.updateProgress("Caching WordPress for next boot"), c.writeFileSync(
|
|
491
|
+
i,
|
|
488
492
|
// Comlink proxy is not assignable to UniversalPHP but
|
|
489
493
|
// proxies all method calls transparently at runtime.
|
|
490
|
-
await
|
|
494
|
+
await De(
|
|
491
495
|
t,
|
|
492
496
|
"/wordpress"
|
|
493
497
|
)
|
|
@@ -495,18 +499,18 @@ class St {
|
|
|
495
499
|
}
|
|
496
500
|
async bootRequestHandler({
|
|
497
501
|
worker: t,
|
|
498
|
-
fileLockManagerPort:
|
|
499
|
-
nativeInternalDirPath:
|
|
502
|
+
fileLockManagerPort: o,
|
|
503
|
+
nativeInternalDirPath: r
|
|
500
504
|
}) {
|
|
501
|
-
const
|
|
505
|
+
const s = ue(
|
|
502
506
|
t.phpPort
|
|
503
507
|
);
|
|
504
|
-
await
|
|
505
|
-
const
|
|
508
|
+
await s.isConnected();
|
|
509
|
+
const i = await K(
|
|
506
510
|
this.getEffectiveBlueprint()
|
|
507
511
|
);
|
|
508
|
-
return await
|
|
509
|
-
phpVersion:
|
|
512
|
+
return await s.useFileLockManager(o), await s.bootRequestHandler({
|
|
513
|
+
phpVersion: i.phpVersion,
|
|
510
514
|
siteUrl: this.siteUrl,
|
|
511
515
|
mountsBeforeWpInstall: this.args["mount-before-install"] || [],
|
|
512
516
|
mountsAfterWpInstall: this.args.mount || [],
|
|
@@ -517,40 +521,40 @@ class St {
|
|
|
517
521
|
withRedis: this.args.redis,
|
|
518
522
|
withMemcached: this.args.memcached,
|
|
519
523
|
withXdebug: !!this.args.xdebug,
|
|
520
|
-
nativeInternalDirPath:
|
|
524
|
+
nativeInternalDirPath: r,
|
|
521
525
|
pathAliases: this.args.pathAliases
|
|
522
|
-
}), await
|
|
526
|
+
}), await s.isReady(), s;
|
|
523
527
|
}
|
|
524
528
|
async compileInputBlueprint(t) {
|
|
525
|
-
const
|
|
526
|
-
let
|
|
527
|
-
return
|
|
528
|
-
if (
|
|
529
|
+
const o = this.getEffectiveBlueprint(), r = new qe();
|
|
530
|
+
let s = "", i = !1;
|
|
531
|
+
return r.addEventListener("progress", (n) => {
|
|
532
|
+
if (i)
|
|
529
533
|
return;
|
|
530
|
-
|
|
534
|
+
i = n.detail.progress === 100;
|
|
531
535
|
const l = Math.floor(n.detail.progress);
|
|
532
|
-
|
|
533
|
-
}), await
|
|
534
|
-
progress:
|
|
536
|
+
s = n.detail.caption || s || "Running Blueprint", this.cliOutput.updateProgress(s.trim(), l);
|
|
537
|
+
}), await de(o, {
|
|
538
|
+
progress: r,
|
|
535
539
|
additionalSteps: t
|
|
536
540
|
});
|
|
537
541
|
}
|
|
538
542
|
getEffectiveBlueprint() {
|
|
539
543
|
const t = this.args.blueprint;
|
|
540
|
-
return
|
|
544
|
+
return Ce(t) ? t : {
|
|
541
545
|
login: this.args.login,
|
|
542
546
|
...t || {},
|
|
543
547
|
preferredVersions: {
|
|
544
|
-
php: this.args.php ?? t?.preferredVersions?.php ??
|
|
548
|
+
php: this.args.php ?? t?.preferredVersions?.php ?? M,
|
|
545
549
|
wp: this.args.wp ?? t?.preferredVersions?.wp ?? "latest",
|
|
546
550
|
...t?.preferredVersions || {}
|
|
547
551
|
}
|
|
548
552
|
};
|
|
549
553
|
}
|
|
550
554
|
}
|
|
551
|
-
async function
|
|
552
|
-
const
|
|
553
|
-
prefix:
|
|
555
|
+
async function kt(e, t = !0) {
|
|
556
|
+
const r = `${d.basename(process.argv0)}${e}${process.pid}-`, s = await Xe({
|
|
557
|
+
prefix: r,
|
|
554
558
|
/*
|
|
555
559
|
* Allow recursive cleanup on process exit.
|
|
556
560
|
*
|
|
@@ -561,83 +565,83 @@ async function xt(e, t = !0) {
|
|
|
561
565
|
*/
|
|
562
566
|
unsafeCleanup: !0
|
|
563
567
|
});
|
|
564
|
-
return t &&
|
|
568
|
+
return t && Ze(), s;
|
|
565
569
|
}
|
|
566
|
-
async function
|
|
567
|
-
const
|
|
570
|
+
async function Mt(e, t, o) {
|
|
571
|
+
const s = (await Bt(
|
|
568
572
|
e,
|
|
569
573
|
t,
|
|
570
|
-
|
|
574
|
+
o
|
|
571
575
|
)).map(
|
|
572
|
-
(
|
|
573
|
-
c.rm(
|
|
574
|
-
l ?
|
|
575
|
-
`Failed to delete stale Playground temp dir: ${
|
|
576
|
+
(i) => new Promise((n) => {
|
|
577
|
+
c.rm(i, { recursive: !0 }, (l) => {
|
|
578
|
+
l ? P.warn(
|
|
579
|
+
`Failed to delete stale Playground temp dir: ${i}`,
|
|
576
580
|
l
|
|
577
|
-
) :
|
|
578
|
-
`Deleted stale Playground temp dir: ${
|
|
581
|
+
) : P.info(
|
|
582
|
+
`Deleted stale Playground temp dir: ${i}`
|
|
579
583
|
), n();
|
|
580
584
|
});
|
|
581
585
|
})
|
|
582
586
|
);
|
|
583
|
-
await Promise.all(
|
|
587
|
+
await Promise.all(s);
|
|
584
588
|
}
|
|
585
|
-
async function
|
|
589
|
+
async function Bt(e, t, o) {
|
|
586
590
|
try {
|
|
587
|
-
const
|
|
588
|
-
for (const
|
|
589
|
-
await
|
|
591
|
+
const r = c.readdirSync(o).map((i) => d.join(o, i)), s = [];
|
|
592
|
+
for (const i of r)
|
|
593
|
+
await At(
|
|
590
594
|
e,
|
|
591
595
|
t,
|
|
592
|
-
|
|
593
|
-
) &&
|
|
594
|
-
return
|
|
595
|
-
} catch (
|
|
596
|
-
return
|
|
596
|
+
i
|
|
597
|
+
) && s.push(i);
|
|
598
|
+
return s;
|
|
599
|
+
} catch (r) {
|
|
600
|
+
return P.warn(`Failed to find stale Playground temp dirs: ${r}`), [];
|
|
597
601
|
}
|
|
598
602
|
}
|
|
599
|
-
async function
|
|
600
|
-
if (!c.lstatSync(
|
|
603
|
+
async function At(e, t, o) {
|
|
604
|
+
if (!c.lstatSync(o).isDirectory())
|
|
601
605
|
return !1;
|
|
602
|
-
const
|
|
603
|
-
if (!
|
|
606
|
+
const s = d.basename(o);
|
|
607
|
+
if (!s.includes(e))
|
|
604
608
|
return !1;
|
|
605
|
-
const
|
|
609
|
+
const i = s.match(
|
|
606
610
|
new RegExp(`^(.+)${e}(\\d+)-`)
|
|
607
611
|
);
|
|
608
|
-
if (!
|
|
612
|
+
if (!i)
|
|
609
613
|
return !1;
|
|
610
614
|
const n = {
|
|
611
|
-
executableName:
|
|
612
|
-
pid:
|
|
615
|
+
executableName: i[1],
|
|
616
|
+
pid: i[2]
|
|
613
617
|
};
|
|
614
|
-
if (await
|
|
618
|
+
if (await Ct(n.pid, n.executableName))
|
|
615
619
|
return !1;
|
|
616
620
|
const l = Date.now() - t;
|
|
617
|
-
return c.statSync(
|
|
621
|
+
return c.statSync(o).mtime.getTime() < l;
|
|
618
622
|
}
|
|
619
|
-
async function
|
|
620
|
-
const [
|
|
621
|
-
(
|
|
622
|
-
|
|
623
|
+
async function Ct(e, t) {
|
|
624
|
+
const [o] = await new Promise(
|
|
625
|
+
(r, s) => {
|
|
626
|
+
Je.list(
|
|
623
627
|
{
|
|
624
628
|
pid: e,
|
|
625
629
|
name: t,
|
|
626
630
|
// Remove path from executable name in the results.
|
|
627
631
|
clean: !0
|
|
628
632
|
},
|
|
629
|
-
(
|
|
630
|
-
|
|
633
|
+
(i, n) => {
|
|
634
|
+
i ? s(i) : r(n);
|
|
631
635
|
}
|
|
632
636
|
);
|
|
633
637
|
}
|
|
634
638
|
);
|
|
635
|
-
return !!
|
|
639
|
+
return !!o && o.pid === e && o.command === t;
|
|
636
640
|
}
|
|
637
|
-
function
|
|
641
|
+
function Dt(e) {
|
|
638
642
|
return process.env.CI === "true" || process.env.CI === "1" || process.env.GITHUB_ACTIONS === "true" || process.env.GITHUB_ACTIONS === "1" || (process.env.TERM || "").toLowerCase() === "dumb" ? !1 : e ? !!e.isTTY : process.stdout.isTTY;
|
|
639
643
|
}
|
|
640
|
-
class
|
|
644
|
+
class Rt {
|
|
641
645
|
constructor(t) {
|
|
642
646
|
this.lastProgressLine = "", this.progressActive = !1, this.verbosity = t.verbosity, this.writeStream = t.writeStream || process.stdout;
|
|
643
647
|
}
|
|
@@ -651,7 +655,7 @@ class Mt {
|
|
|
651
655
|
* This prevents progress spam in logs - users only see the final outcome.
|
|
652
656
|
*/
|
|
653
657
|
get shouldRender() {
|
|
654
|
-
return
|
|
658
|
+
return Dt(this.writeStream);
|
|
655
659
|
}
|
|
656
660
|
get isQuiet() {
|
|
657
661
|
return this.verbosity === "quiet";
|
|
@@ -698,19 +702,19 @@ ${t}
|
|
|
698
702
|
*/
|
|
699
703
|
printConfig(t) {
|
|
700
704
|
if (this.isQuiet) return;
|
|
701
|
-
const
|
|
702
|
-
|
|
705
|
+
const o = [];
|
|
706
|
+
o.push(
|
|
703
707
|
`${this.dim("PHP")} ${this.cyan(t.phpVersion)} ${this.dim("WordPress")} ${this.cyan(t.wpVersion)}`
|
|
704
708
|
);
|
|
705
|
-
const
|
|
706
|
-
if (t.intl &&
|
|
707
|
-
for (const
|
|
708
|
-
const
|
|
709
|
-
|
|
710
|
-
`${this.dim("Mount")} ${
|
|
709
|
+
const r = [];
|
|
710
|
+
if (t.intl && r.push("intl"), t.redis && r.push("redis"), t.memcached && r.push("memcached"), t.xdebug && r.push(this.yellow("xdebug")), r.length > 0 && o.push(`${this.dim("Extensions")} ${r.join(", ")}`), t.mounts.length > 0)
|
|
711
|
+
for (const s of t.mounts) {
|
|
712
|
+
const i = s.autoMounted ? ` ${this.dim("(auto-mount)")}` : "";
|
|
713
|
+
o.push(
|
|
714
|
+
`${this.dim("Mount")} ${s.hostPath} ${this.dim("→")} ${s.vfsPath}${i}`
|
|
711
715
|
);
|
|
712
716
|
}
|
|
713
|
-
t.blueprint &&
|
|
717
|
+
t.blueprint && o.push(`${this.dim("Blueprint")} ${t.blueprint}`), this.writeStream.write(o.join(`
|
|
714
718
|
`) + `
|
|
715
719
|
|
|
716
720
|
`);
|
|
@@ -731,11 +735,11 @@ ${t}
|
|
|
731
735
|
* Identical messages are skipped to prevent flickering. When piped,
|
|
732
736
|
* this method does nothing (early return via shouldRender check).
|
|
733
737
|
*/
|
|
734
|
-
updateProgress(t,
|
|
738
|
+
updateProgress(t, o) {
|
|
735
739
|
if (this.isQuiet || !this.shouldRender) return;
|
|
736
740
|
this.progressActive || (this.progressActive = !0);
|
|
737
|
-
let
|
|
738
|
-
|
|
741
|
+
let r = `${t}`;
|
|
742
|
+
o !== void 0 && (r = `${t} ${this.dim(`${o}%`)}`), r !== this.lastProgressLine && (this.lastProgressLine = r, this.isTTY ? (this.writeStream.cursorTo(0), this.writeStream.write(r), this.writeStream.clearLine(1)) : this.writeStream.write(`${r}
|
|
739
743
|
`));
|
|
740
744
|
}
|
|
741
745
|
/**
|
|
@@ -775,12 +779,12 @@ ${t}
|
|
|
775
779
|
* Note: The exact wording "WordPress is running on" is checked by
|
|
776
780
|
* CI tests, so changes to this string will break test assertions.
|
|
777
781
|
*/
|
|
778
|
-
printReady(t,
|
|
782
|
+
printReady(t, o) {
|
|
779
783
|
if (this.isQuiet) return;
|
|
780
|
-
const
|
|
784
|
+
const r = o === 1 ? "worker" : "workers";
|
|
781
785
|
this.writeStream.write(
|
|
782
786
|
`
|
|
783
|
-
${this.green("Ready!")} WordPress is running on ${this.bold(t)} ${this.dim(`(${
|
|
787
|
+
${this.green("Ready!")} WordPress is running on ${this.bold(t)} ${this.dim(`(${o} ${r})`)}
|
|
784
788
|
|
|
785
789
|
`
|
|
786
790
|
);
|
|
@@ -800,12 +804,12 @@ ${this.green("Ready!")} WordPress is running on ${this.bold(t)} ${this.dim(`(${r
|
|
|
800
804
|
);
|
|
801
805
|
}
|
|
802
806
|
}
|
|
803
|
-
const
|
|
804
|
-
Quiet: { name: "quiet", severity:
|
|
805
|
-
Normal: { name: "normal", severity:
|
|
806
|
-
Debug: { name: "debug", severity:
|
|
807
|
-
}
|
|
808
|
-
async function
|
|
807
|
+
const be = {
|
|
808
|
+
Quiet: { name: "quiet", severity: F.Fatal },
|
|
809
|
+
Normal: { name: "normal", severity: F.Info },
|
|
810
|
+
Debug: { name: "debug", severity: F.Debug }
|
|
811
|
+
};
|
|
812
|
+
async function bo(e) {
|
|
809
813
|
try {
|
|
810
814
|
const t = {
|
|
811
815
|
"site-url": {
|
|
@@ -815,8 +819,8 @@ async function mr(e) {
|
|
|
815
819
|
php: {
|
|
816
820
|
describe: "PHP version to use.",
|
|
817
821
|
type: "string",
|
|
818
|
-
default:
|
|
819
|
-
choices:
|
|
822
|
+
default: M,
|
|
823
|
+
choices: R
|
|
820
824
|
},
|
|
821
825
|
wp: {
|
|
822
826
|
describe: "WordPress version to use.",
|
|
@@ -828,21 +832,21 @@ async function mr(e) {
|
|
|
828
832
|
type: "string",
|
|
829
833
|
nargs: 2,
|
|
830
834
|
array: !0,
|
|
831
|
-
coerce:
|
|
835
|
+
coerce: dt
|
|
832
836
|
},
|
|
833
837
|
"define-bool": {
|
|
834
838
|
describe: 'Define PHP boolean constants (can be used multiple times). Format: NAME value. Value must be "true", "false", "1", or "0". Examples: --define-bool WP_DEBUG true --define-bool MY_FEATURE false',
|
|
835
839
|
type: "string",
|
|
836
840
|
nargs: 2,
|
|
837
841
|
array: !0,
|
|
838
|
-
coerce:
|
|
842
|
+
coerce: pt
|
|
839
843
|
},
|
|
840
844
|
"define-number": {
|
|
841
845
|
describe: "Define PHP number constants (can be used multiple times). Format: NAME value. Examples: --define-number LIMIT 100 --define-number RATE 45.67",
|
|
842
846
|
type: "string",
|
|
843
847
|
nargs: 2,
|
|
844
848
|
array: !0,
|
|
845
|
-
coerce:
|
|
849
|
+
coerce: ct
|
|
846
850
|
},
|
|
847
851
|
// @TODO: Support read-only mounts, e.g. via WORKERFS, a custom
|
|
848
852
|
// ReadOnlyNODEFS, or by copying the files into MEMFS
|
|
@@ -850,27 +854,27 @@ async function mr(e) {
|
|
|
850
854
|
describe: "Mount a directory to the PHP runtime (can be used multiple times). Format: /host/path:/vfs/path",
|
|
851
855
|
type: "array",
|
|
852
856
|
string: !0,
|
|
853
|
-
coerce:
|
|
857
|
+
coerce: N
|
|
854
858
|
},
|
|
855
859
|
"mount-before-install": {
|
|
856
860
|
describe: "Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format: /host/path:/vfs/path",
|
|
857
861
|
type: "array",
|
|
858
862
|
string: !0,
|
|
859
|
-
coerce:
|
|
863
|
+
coerce: N
|
|
860
864
|
},
|
|
861
865
|
"mount-dir": {
|
|
862
866
|
describe: 'Mount a directory to the PHP runtime (can be used multiple times). Format: "/host/path" "/vfs/path"',
|
|
863
867
|
type: "array",
|
|
864
868
|
nargs: 2,
|
|
865
869
|
array: !0,
|
|
866
|
-
coerce:
|
|
870
|
+
coerce: ie
|
|
867
871
|
},
|
|
868
872
|
"mount-dir-before-install": {
|
|
869
873
|
describe: 'Mount a directory before WordPress installation (can be used multiple times). Format: "/host/path" "/vfs/path"',
|
|
870
874
|
type: "string",
|
|
871
875
|
nargs: 2,
|
|
872
876
|
array: !0,
|
|
873
|
-
coerce:
|
|
877
|
+
coerce: ie
|
|
874
878
|
},
|
|
875
879
|
login: {
|
|
876
880
|
describe: "Should log the user in",
|
|
@@ -917,7 +921,7 @@ async function mr(e) {
|
|
|
917
921
|
verbosity: {
|
|
918
922
|
describe: "Output logs and progress messages.",
|
|
919
923
|
type: "string",
|
|
920
|
-
choices: Object.values(
|
|
924
|
+
choices: Object.values(be).map(
|
|
921
925
|
(a) => a.name
|
|
922
926
|
),
|
|
923
927
|
default: "normal"
|
|
@@ -999,11 +1003,10 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
999
1003
|
type: "string",
|
|
1000
1004
|
coerce: (a) => a === "" ? "/phpmyadmin" : a
|
|
1001
1005
|
}
|
|
1002
|
-
},
|
|
1006
|
+
}, o = {
|
|
1003
1007
|
port: {
|
|
1004
|
-
describe: "Port to listen on when serving.",
|
|
1005
|
-
type: "number"
|
|
1006
|
-
default: 9400
|
|
1008
|
+
describe: "Port to listen on when serving. Defaults to 9400 when available.",
|
|
1009
|
+
type: "number"
|
|
1007
1010
|
},
|
|
1008
1011
|
"experimental-multi-worker": {
|
|
1009
1012
|
deprecated: "This option is not needed. Multiple workers are always used.",
|
|
@@ -1014,7 +1017,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
1014
1017
|
describe: "Enable experimental browser development tools.",
|
|
1015
1018
|
type: "boolean"
|
|
1016
1019
|
}
|
|
1017
|
-
},
|
|
1020
|
+
}, r = {
|
|
1018
1021
|
path: {
|
|
1019
1022
|
describe: "Path to the project directory. Playground will auto-detect if this is a plugin, theme, wp-content, or WordPress directory.",
|
|
1020
1023
|
type: "string",
|
|
@@ -1023,8 +1026,8 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
1023
1026
|
php: {
|
|
1024
1027
|
describe: "PHP version to use.",
|
|
1025
1028
|
type: "string",
|
|
1026
|
-
default:
|
|
1027
|
-
choices:
|
|
1029
|
+
default: M,
|
|
1030
|
+
choices: R
|
|
1028
1031
|
},
|
|
1029
1032
|
wp: {
|
|
1030
1033
|
describe: "WordPress version to use.",
|
|
@@ -1032,9 +1035,8 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
1032
1035
|
default: "latest"
|
|
1033
1036
|
},
|
|
1034
1037
|
port: {
|
|
1035
|
-
describe: "Port to listen on.",
|
|
1036
|
-
type: "number"
|
|
1037
|
-
default: 9400
|
|
1038
|
+
describe: "Port to listen on. Defaults to 9400 when available.",
|
|
1039
|
+
type: "number"
|
|
1038
1040
|
},
|
|
1039
1041
|
blueprint: {
|
|
1040
1042
|
describe: "Path to a Blueprint JSON file to execute on startup.",
|
|
@@ -1070,7 +1072,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
1070
1072
|
describe: "Mount a directory to the PHP runtime (can be used multiple times). Format: /host/path:/vfs/path. Use this for additional mounts beyond auto-detection.",
|
|
1071
1073
|
type: "array",
|
|
1072
1074
|
string: !0,
|
|
1073
|
-
coerce:
|
|
1075
|
+
coerce: N
|
|
1074
1076
|
},
|
|
1075
1077
|
reset: {
|
|
1076
1078
|
describe: "Deletes the stored site directory and starts a new site from scratch.",
|
|
@@ -1088,13 +1090,13 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
1088
1090
|
"define-number": t["define-number"],
|
|
1089
1091
|
// Tools
|
|
1090
1092
|
phpmyadmin: t.phpmyadmin
|
|
1091
|
-
},
|
|
1093
|
+
}, s = {
|
|
1092
1094
|
outfile: {
|
|
1093
1095
|
describe: "When building, write to this output file.",
|
|
1094
1096
|
type: "string",
|
|
1095
1097
|
default: "wordpress.zip"
|
|
1096
1098
|
}
|
|
1097
|
-
},
|
|
1099
|
+
}, i = Ne(e).usage("Usage: wp-playground <command> [options]").command(
|
|
1098
1100
|
"start",
|
|
1099
1101
|
"Start a local WordPress server with automatic project detection (recommended)",
|
|
1100
1102
|
(a) => a.usage(
|
|
@@ -1110,13 +1112,13 @@ Examples:
|
|
|
1110
1112
|
wp-playground start --wp=6.7 --php=8.3 # Use specific versions
|
|
1111
1113
|
wp-playground start --skip-browser # Skip opening browser
|
|
1112
1114
|
wp-playground start --no-auto-mount # Disable auto-detection`
|
|
1113
|
-
).options(
|
|
1115
|
+
).options(r)
|
|
1114
1116
|
).command(
|
|
1115
1117
|
"server",
|
|
1116
1118
|
"Start a local WordPress server (advanced, low-level)",
|
|
1117
1119
|
(a) => a.options({
|
|
1118
1120
|
...t,
|
|
1119
|
-
...
|
|
1121
|
+
...o
|
|
1120
1122
|
})
|
|
1121
1123
|
).command(
|
|
1122
1124
|
"run-blueprint",
|
|
@@ -1127,7 +1129,7 @@ Examples:
|
|
|
1127
1129
|
"Build a ZIP snapshot of a WordPress site based on a Blueprint",
|
|
1128
1130
|
(a) => a.options({
|
|
1129
1131
|
...t,
|
|
1130
|
-
...
|
|
1132
|
+
...s
|
|
1131
1133
|
})
|
|
1132
1134
|
).demandCommand(1, "Please specify a command").strictCommands().conflicts(
|
|
1133
1135
|
"experimental-unsafe-ide-integration",
|
|
@@ -1138,7 +1140,7 @@ Examples:
|
|
|
1138
1140
|
a && a.includes("Please specify a command") && (y.showHelp(), console.error(`
|
|
1139
1141
|
` + a), process.exit(1)), console.error(a), process.exit(1);
|
|
1140
1142
|
}).strictOptions().check(async (a) => {
|
|
1141
|
-
if (a["skip-wordpress-install"] === !0 && (a["wordpress-install-mode"] = "do-not-attempt-installing", a.wordpressInstallMode = "do-not-attempt-installing"), a.wp !== void 0 && typeof a.wp == "string" && !
|
|
1143
|
+
if (a["skip-wordpress-install"] === !0 && (a["wordpress-install-mode"] = "do-not-attempt-installing", a.wordpressInstallMode = "do-not-attempt-installing"), a.wp !== void 0 && typeof a.wp == "string" && !vt(a.wp))
|
|
1142
1144
|
try {
|
|
1143
1145
|
new URL(a.wp);
|
|
1144
1146
|
} catch {
|
|
@@ -1179,16 +1181,16 @@ Examples:
|
|
|
1179
1181
|
);
|
|
1180
1182
|
return !0;
|
|
1181
1183
|
});
|
|
1182
|
-
|
|
1183
|
-
const n = await
|
|
1184
|
+
i.wrap(i.terminalWidth());
|
|
1185
|
+
const n = await i.argv, l = n._[0];
|
|
1184
1186
|
["start", "run-blueprint", "server", "build-snapshot"].includes(
|
|
1185
1187
|
l
|
|
1186
|
-
) || (
|
|
1187
|
-
const
|
|
1188
|
-
!("WP_DEBUG" in
|
|
1189
|
-
const
|
|
1188
|
+
) || (i.showHelp(), process.exit(1));
|
|
1189
|
+
const u = n.define || {};
|
|
1190
|
+
!("WP_DEBUG" in u) && !("WP_DEBUG_LOG" in u) && !("WP_DEBUG_DISPLAY" in u) && (u.WP_DEBUG = "true", u.WP_DEBUG_LOG = "true", u.WP_DEBUG_DISPLAY = "true");
|
|
1191
|
+
const w = {
|
|
1190
1192
|
...n,
|
|
1191
|
-
define:
|
|
1193
|
+
define: u,
|
|
1192
1194
|
command: l,
|
|
1193
1195
|
mount: [
|
|
1194
1196
|
...n.mount || [],
|
|
@@ -1198,7 +1200,7 @@ Examples:
|
|
|
1198
1200
|
...n["mount-before-install"] || [],
|
|
1199
1201
|
...n["mount-dir-before-install"] || []
|
|
1200
1202
|
]
|
|
1201
|
-
}, S = await
|
|
1203
|
+
}, S = await Lt(w);
|
|
1202
1204
|
S === void 0 && process.exit(0);
|
|
1203
1205
|
const p = /* @__PURE__ */ (() => {
|
|
1204
1206
|
let a;
|
|
@@ -1210,42 +1212,42 @@ Examples:
|
|
|
1210
1212
|
[Symbol.asyncDispose]: async () => {
|
|
1211
1213
|
process.off("SIGINT", p), process.off("SIGTERM", p), await S[Symbol.asyncDispose]();
|
|
1212
1214
|
},
|
|
1213
|
-
[
|
|
1215
|
+
[ge]: { cliServer: S }
|
|
1214
1216
|
};
|
|
1215
1217
|
} catch (t) {
|
|
1216
1218
|
if (console.error(t), !(t instanceof Error))
|
|
1217
1219
|
throw t;
|
|
1218
1220
|
if (process.argv.includes("--debug"))
|
|
1219
|
-
|
|
1221
|
+
$e(t);
|
|
1220
1222
|
else {
|
|
1221
|
-
const
|
|
1222
|
-
let
|
|
1223
|
+
const r = [];
|
|
1224
|
+
let s = t;
|
|
1223
1225
|
do
|
|
1224
|
-
|
|
1225
|
-
while (
|
|
1226
|
+
r.push(s.message), s = s.cause;
|
|
1227
|
+
while (s instanceof Error);
|
|
1226
1228
|
console.error(
|
|
1227
|
-
"\x1B[1m" +
|
|
1229
|
+
"\x1B[1m" + r.join(" caused by: ") + "\x1B[0m"
|
|
1228
1230
|
);
|
|
1229
1231
|
}
|
|
1230
1232
|
process.exit(1);
|
|
1231
1233
|
}
|
|
1232
1234
|
}
|
|
1233
|
-
function
|
|
1235
|
+
function ae(e, t) {
|
|
1234
1236
|
return e.find(
|
|
1235
|
-
(
|
|
1237
|
+
(o) => o.vfsPath.replace(/\/$/, "") === t.replace(/\/$/, "")
|
|
1236
1238
|
);
|
|
1237
1239
|
}
|
|
1238
|
-
const
|
|
1239
|
-
async function
|
|
1240
|
+
const ge = Symbol("playground-cli-testing"), I = (e) => process.stdout.isTTY ? "\x1B[1m" + e + "\x1B[0m" : e, Wt = (e) => process.stdout.isTTY ? "\x1B[31m" + e + "\x1B[0m" : e, le = (e) => process.stdout.isTTY ? `\x1B[2m${e}\x1B[0m` : e, C = (e) => process.stdout.isTTY ? `\x1B[3m${e}\x1B[0m` : e, O = (e) => process.stdout.isTTY ? `\x1B[33m${e}\x1B[0m` : e;
|
|
1241
|
+
async function Lt(e) {
|
|
1240
1242
|
let t;
|
|
1241
|
-
const
|
|
1242
|
-
if (e.command === "start" && (e =
|
|
1243
|
-
const p = Object.values(
|
|
1243
|
+
const o = e.internalCookieStore ? new Ee() : void 0, r = [], s = /* @__PURE__ */ new Map();
|
|
1244
|
+
if (e.command === "start" && (e = Ut(e)), e.autoMount !== void 0 && (e.autoMount === "" && (e = { ...e, autoMount: process.cwd() }), e = he(e)), e.wordpressInstallMode === void 0 && (e.wordpressInstallMode = "download-and-install"), e.quiet && (e.verbosity = "quiet", delete e.quiet), e.debug && (e.verbosity = "debug", delete e.debug), e.verbosity) {
|
|
1245
|
+
const p = Object.values(be).find(
|
|
1244
1246
|
(a) => a.name === e.verbosity
|
|
1245
1247
|
).severity;
|
|
1246
|
-
|
|
1248
|
+
P.setSeverityFilterLevel(p);
|
|
1247
1249
|
}
|
|
1248
|
-
if (e.intl || (e.intl = !0), e.redis === void 0 && (e.redis = await
|
|
1250
|
+
if (e.intl || (e.intl = !0), e.redis === void 0 && (e.redis = await se()), e.memcached === void 0 && (e.memcached = await se()), e.phpmyadmin) {
|
|
1249
1251
|
if (e.phpmyadmin === !0 && (e.phpmyadmin = "/phpmyadmin"), e.skipSqliteSetup)
|
|
1250
1252
|
throw new Error(
|
|
1251
1253
|
"--phpmyadmin requires SQLite. Cannot be used with --skip-sqlite-setup."
|
|
@@ -1253,17 +1255,17 @@ async function Dt(e) {
|
|
|
1253
1255
|
e.pathAliases = [
|
|
1254
1256
|
{
|
|
1255
1257
|
urlPrefix: e.phpmyadmin,
|
|
1256
|
-
fsPath:
|
|
1258
|
+
fsPath: re
|
|
1257
1259
|
}
|
|
1258
1260
|
];
|
|
1259
1261
|
}
|
|
1260
|
-
const
|
|
1262
|
+
const i = new Rt({
|
|
1261
1263
|
verbosity: e.verbosity || "normal"
|
|
1262
1264
|
});
|
|
1263
|
-
e.command === "server" && (
|
|
1264
|
-
phpVersion: e.php ||
|
|
1265
|
+
e.command === "server" && (i.printBanner(), i.printConfig({
|
|
1266
|
+
phpVersion: e.php || M,
|
|
1265
1267
|
wpVersion: e.wp || "latest",
|
|
1266
|
-
port: e.port
|
|
1268
|
+
port: e.port ?? 9400,
|
|
1267
1269
|
xdebug: !!e.xdebug,
|
|
1268
1270
|
intl: !!e.intl,
|
|
1269
1271
|
redis: !!e.redis,
|
|
@@ -1274,92 +1276,130 @@ async function Dt(e) {
|
|
|
1274
1276
|
],
|
|
1275
1277
|
blueprint: typeof e.blueprint == "string" ? e.blueprint : void 0
|
|
1276
1278
|
}));
|
|
1277
|
-
const n = e.command === "server" ? e.port ?? 9400 : 0, l = new
|
|
1278
|
-
let
|
|
1279
|
-
const S = await
|
|
1280
|
-
port: n,
|
|
1279
|
+
const n = e.command === "server" ? e.port ?? 9400 : 0, l = new Te();
|
|
1280
|
+
let u = !1, w = !0;
|
|
1281
|
+
const S = await wt({
|
|
1282
|
+
port: e.port ? e.port : await ht(n) ? 0 : n,
|
|
1281
1283
|
onBind: async (p, a) => {
|
|
1282
|
-
const m = "127.0.0.1", y = `http://${m}:${a}`,
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
if (await Qe(q), e.xdebug && e.experimentalUnsafeIdeIntegration) {
|
|
1289
|
-
await Xe(
|
|
1290
|
-
T.path,
|
|
1291
|
-
q,
|
|
1292
|
-
process.platform
|
|
1293
|
-
);
|
|
1294
|
-
const h = {
|
|
1295
|
-
hostPath: u.join(".", u.sep, Y),
|
|
1284
|
+
const m = "127.0.0.1", y = `http://${m}:${a}`, W = e["site-url"] || y, L = 6, z = "-playground-cli-site-", E = await kt(z);
|
|
1285
|
+
P.debug(`Native temp dir for VFS root: ${E.path}`);
|
|
1286
|
+
const B = "WP Playground CLI - Listen for Xdebug", G = ".playground-xdebug-root", U = d.join(process.cwd(), G);
|
|
1287
|
+
if (await Ke(U), e.xdebug) {
|
|
1288
|
+
const f = {
|
|
1289
|
+
hostPath: d.join(".", d.sep, G),
|
|
1296
1290
|
vfsPath: "/"
|
|
1297
1291
|
};
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1292
|
+
if (R.indexOf(
|
|
1293
|
+
e.php || M
|
|
1294
|
+
) <= R.indexOf("8.5"))
|
|
1295
|
+
await oe(
|
|
1296
|
+
E.path,
|
|
1297
|
+
U,
|
|
1298
|
+
process.platform
|
|
1299
|
+
), e.xdebug = et({
|
|
1305
1300
|
cwd: process.cwd(),
|
|
1306
1301
|
mounts: [
|
|
1307
|
-
|
|
1302
|
+
f,
|
|
1308
1303
|
...e["mount-before-install"] || [],
|
|
1309
1304
|
...e.mount || []
|
|
1310
1305
|
],
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1306
|
+
pathSkippings: [
|
|
1307
|
+
"/dev/",
|
|
1308
|
+
"/home/",
|
|
1309
|
+
"/internal/",
|
|
1310
|
+
"/request/",
|
|
1311
|
+
"/proc/"
|
|
1312
|
+
]
|
|
1313
|
+
}), console.log(I("Xdebug configured successfully")), console.log(
|
|
1314
|
+
O("Playground source root: ") + ".playground-xdebug-root" + C(
|
|
1315
|
+
le(
|
|
1318
1316
|
" – you can set breakpoints and preview Playground's VFS structure in there."
|
|
1319
1317
|
)
|
|
1320
1318
|
)
|
|
1321
|
-
)
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
"
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1319
|
+
);
|
|
1320
|
+
else if (e.experimentalUnsafeIdeIntegration) {
|
|
1321
|
+
await oe(
|
|
1322
|
+
E.path,
|
|
1323
|
+
U,
|
|
1324
|
+
process.platform
|
|
1325
|
+
);
|
|
1326
|
+
try {
|
|
1327
|
+
await tt(
|
|
1328
|
+
B,
|
|
1329
|
+
process.cwd()
|
|
1330
|
+
);
|
|
1331
|
+
const h = typeof e.xdebug == "object" ? e.xdebug : {}, b = await ot({
|
|
1332
|
+
name: B,
|
|
1333
|
+
host: m,
|
|
1334
|
+
port: a,
|
|
1335
|
+
ides: e.experimentalUnsafeIdeIntegration,
|
|
1336
|
+
cwd: process.cwd(),
|
|
1337
|
+
mounts: [
|
|
1338
|
+
f,
|
|
1339
|
+
...e["mount-before-install"] || [],
|
|
1340
|
+
...e.mount || []
|
|
1341
|
+
],
|
|
1342
|
+
ideKey: h.ideKey || "WPPLAYGROUNDCLI"
|
|
1343
|
+
}), v = e.experimentalUnsafeIdeIntegration, x = v.includes("vscode"), T = v.includes("phpstorm"), X = Object.values(b);
|
|
1344
|
+
console.log(""), X.length > 0 ? (console.log(
|
|
1345
|
+
I("Xdebug configured successfully")
|
|
1346
|
+
), console.log(
|
|
1347
|
+
O("Updated IDE config: ") + X.join(" ")
|
|
1348
|
+
), console.log(
|
|
1349
|
+
O("Playground source root: ") + ".playground-xdebug-root" + C(
|
|
1350
|
+
le(
|
|
1351
|
+
" – you can set breakpoints and preview Playground's VFS structure in there."
|
|
1352
|
+
)
|
|
1353
|
+
)
|
|
1354
|
+
)) : (console.log(
|
|
1355
|
+
I("Xdebug configuration failed.")
|
|
1356
|
+
), console.log(
|
|
1357
|
+
"No IDE-specific project settings directory was found in the current working directory."
|
|
1358
|
+
)), console.log(""), x && b.vscode && (console.log(
|
|
1359
|
+
I("VS Code / Cursor instructions:")
|
|
1360
|
+
), console.log(
|
|
1361
|
+
" 1. Ensure you have installed an IDE extension for PHP Debugging"
|
|
1362
|
+
), console.log(
|
|
1363
|
+
` (The ${I("PHP Debug")} extension by ${I(
|
|
1364
|
+
"Xdebug"
|
|
1365
|
+
)} has been a solid option)`
|
|
1366
|
+
), console.log(
|
|
1367
|
+
" 2. Open the Run and Debug panel on the left sidebar"
|
|
1368
|
+
), console.log(
|
|
1369
|
+
` 3. Select "${C(
|
|
1370
|
+
B
|
|
1371
|
+
)}" from the dropdown`
|
|
1372
|
+
), console.log(' 3. Click "start debugging"'), console.log(
|
|
1373
|
+
" 5. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"
|
|
1374
|
+
), console.log(
|
|
1375
|
+
" 6. Visit Playground in your browser to hit the breakpoint"
|
|
1376
|
+
), T && console.log("")), T && b.phpstorm && (console.log(I("PhpStorm instructions:")), console.log(
|
|
1377
|
+
` 1. Choose "${C(
|
|
1378
|
+
B
|
|
1379
|
+
)}" debug configuration in the toolbar`
|
|
1380
|
+
), console.log(
|
|
1381
|
+
" 2. Click the debug button (bug icon)`"
|
|
1382
|
+
), console.log(
|
|
1383
|
+
" 3. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"
|
|
1384
|
+
), console.log(
|
|
1385
|
+
" 4. Visit Playground in your browser to hit the breakpoint"
|
|
1386
|
+
)), console.log("");
|
|
1387
|
+
} catch (h) {
|
|
1388
|
+
throw new Error("Could not configure Xdebug", {
|
|
1389
|
+
cause: h
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1352
1392
|
}
|
|
1353
1393
|
}
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1394
|
+
const Pe = d.dirname(E.path), ve = 2 * 24 * 60 * 60 * 1e3;
|
|
1395
|
+
Mt(
|
|
1396
|
+
z,
|
|
1397
|
+
ve,
|
|
1398
|
+
Pe
|
|
1359
1399
|
);
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1362
|
-
const
|
|
1400
|
+
const Q = d.join(E.path, "internal");
|
|
1401
|
+
j(Q);
|
|
1402
|
+
const Se = [
|
|
1363
1403
|
"wordpress",
|
|
1364
1404
|
"tools",
|
|
1365
1405
|
// Note: These dirs are from Emscripten's "default dirs" list:
|
|
@@ -1371,91 +1411,91 @@ async function Dt(e) {
|
|
|
1371
1411
|
"tmp",
|
|
1372
1412
|
"home"
|
|
1373
1413
|
];
|
|
1374
|
-
for (const
|
|
1375
|
-
const
|
|
1376
|
-
if (!(e["mount-before-install"]?.some(
|
|
1377
|
-
const b =
|
|
1378
|
-
|
|
1379
|
-
|
|
1414
|
+
for (const f of Se) {
|
|
1415
|
+
const g = (b) => b.vfsPath === `/${f}`;
|
|
1416
|
+
if (!(e["mount-before-install"]?.some(g) || e.mount?.some(g))) {
|
|
1417
|
+
const b = d.join(
|
|
1418
|
+
E.path,
|
|
1419
|
+
f
|
|
1380
1420
|
);
|
|
1381
|
-
|
|
1382
|
-
vfsPath: `/${
|
|
1421
|
+
j(b), e["mount-before-install"] === void 0 && (e["mount-before-install"] = []), e["mount-before-install"].unshift({
|
|
1422
|
+
vfsPath: `/${f}`,
|
|
1383
1423
|
hostPath: b
|
|
1384
1424
|
});
|
|
1385
1425
|
}
|
|
1386
1426
|
}
|
|
1387
1427
|
if (e["mount-before-install"])
|
|
1388
|
-
for (const
|
|
1389
|
-
|
|
1390
|
-
`Mount before WP install: ${
|
|
1428
|
+
for (const f of e["mount-before-install"])
|
|
1429
|
+
P.debug(
|
|
1430
|
+
`Mount before WP install: ${f.vfsPath} -> ${f.hostPath}`
|
|
1391
1431
|
);
|
|
1392
1432
|
if (e.mount)
|
|
1393
|
-
for (const
|
|
1394
|
-
|
|
1395
|
-
`Mount after WP install: ${
|
|
1433
|
+
for (const f of e.mount)
|
|
1434
|
+
P.debug(
|
|
1435
|
+
`Mount after WP install: ${f.vfsPath} -> ${f.hostPath}`
|
|
1396
1436
|
);
|
|
1397
|
-
let
|
|
1398
|
-
e["experimental-blueprints-v2-runner"] ?
|
|
1399
|
-
siteUrl:
|
|
1400
|
-
cliOutput:
|
|
1401
|
-
}) : (
|
|
1402
|
-
siteUrl:
|
|
1403
|
-
cliOutput:
|
|
1404
|
-
}), typeof e.blueprint == "string" && (e.blueprint = await
|
|
1437
|
+
let k;
|
|
1438
|
+
e["experimental-blueprints-v2-runner"] ? k = new xt(e, {
|
|
1439
|
+
siteUrl: W,
|
|
1440
|
+
cliOutput: i
|
|
1441
|
+
}) : (k = new It(e, {
|
|
1442
|
+
siteUrl: W,
|
|
1443
|
+
cliOutput: i
|
|
1444
|
+
}), typeof e.blueprint == "string" && (e.blueprint = await St({
|
|
1405
1445
|
sourceString: e.blueprint,
|
|
1406
1446
|
blueprintMayReadAdjacentFiles: e["blueprint-may-read-adjacent-files"] === !0
|
|
1407
1447
|
})));
|
|
1408
|
-
let
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
await
|
|
1448
|
+
let H = !1;
|
|
1449
|
+
const A = async function() {
|
|
1450
|
+
H || (H = !0, await Promise.all(
|
|
1451
|
+
r.map(async (g) => {
|
|
1452
|
+
await s.get(g)?.dispose(), await g.worker.terminate();
|
|
1413
1453
|
})
|
|
1414
|
-
), p && await new Promise((
|
|
1415
|
-
p.close(
|
|
1416
|
-
}), await
|
|
1454
|
+
), p && await new Promise((g) => {
|
|
1455
|
+
p.close(g), p.closeAllConnections();
|
|
1456
|
+
}), await E.cleanup());
|
|
1417
1457
|
};
|
|
1418
1458
|
try {
|
|
1419
|
-
const
|
|
1420
|
-
for (let
|
|
1421
|
-
const b =
|
|
1422
|
-
onExit: (
|
|
1423
|
-
|
|
1424
|
-
`Worker ${
|
|
1459
|
+
const f = [], g = k.getWorkerType();
|
|
1460
|
+
for (let h = 0; h < L; h++) {
|
|
1461
|
+
const b = Ht(g, {
|
|
1462
|
+
onExit: (v) => {
|
|
1463
|
+
H || v === 0 && P.error(
|
|
1464
|
+
`Worker ${h} exited with code ${v}
|
|
1425
1465
|
`
|
|
1426
1466
|
);
|
|
1427
1467
|
}
|
|
1428
1468
|
}).then(
|
|
1429
|
-
async (
|
|
1430
|
-
|
|
1431
|
-
const
|
|
1432
|
-
worker:
|
|
1433
|
-
fileLockManagerPort:
|
|
1434
|
-
nativeInternalDirPath:
|
|
1469
|
+
async (v) => {
|
|
1470
|
+
r.push(v);
|
|
1471
|
+
const x = await Ft(l), T = await k.bootRequestHandler({
|
|
1472
|
+
worker: v,
|
|
1473
|
+
fileLockManagerPort: x,
|
|
1474
|
+
nativeInternalDirPath: Q
|
|
1435
1475
|
});
|
|
1436
|
-
return
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
), [
|
|
1476
|
+
return s.set(
|
|
1477
|
+
v,
|
|
1478
|
+
T
|
|
1479
|
+
), [v, T];
|
|
1440
1480
|
}
|
|
1441
1481
|
);
|
|
1442
|
-
|
|
1482
|
+
f.push(b), h === 0 && await b;
|
|
1443
1483
|
}
|
|
1444
|
-
await Promise.all(
|
|
1445
|
-
|
|
1446
|
-
(
|
|
1484
|
+
await Promise.all(f), t = Ie(
|
|
1485
|
+
r.map(
|
|
1486
|
+
(h) => s.get(h)
|
|
1447
1487
|
)
|
|
1448
1488
|
);
|
|
1449
1489
|
{
|
|
1450
|
-
const
|
|
1451
|
-
if (await
|
|
1490
|
+
const h = new pe(), b = h.port1, v = h.port2;
|
|
1491
|
+
if (await ke(
|
|
1452
1492
|
{
|
|
1453
1493
|
applyPostInstallMountsToAllWorkers: async () => {
|
|
1454
1494
|
await Promise.all(
|
|
1455
1495
|
Array.from(
|
|
1456
|
-
|
|
1496
|
+
s.values()
|
|
1457
1497
|
).map(
|
|
1458
|
-
(
|
|
1498
|
+
(x) => x.mountAfterWordPressInstall(
|
|
1459
1499
|
e.mount || []
|
|
1460
1500
|
)
|
|
1461
1501
|
)
|
|
@@ -1464,68 +1504,68 @@ async function Dt(e) {
|
|
|
1464
1504
|
},
|
|
1465
1505
|
void 0,
|
|
1466
1506
|
b
|
|
1467
|
-
), await
|
|
1507
|
+
), await k.bootWordPress(
|
|
1468
1508
|
t,
|
|
1469
|
-
|
|
1470
|
-
), b.close(),
|
|
1471
|
-
const
|
|
1509
|
+
v
|
|
1510
|
+
), b.close(), u = !0, !e["experimental-blueprints-v2-runner"]) {
|
|
1511
|
+
const x = await k.compileInputBlueprint(
|
|
1472
1512
|
e["additional-blueprint-steps"] || []
|
|
1473
1513
|
);
|
|
1474
|
-
|
|
1475
|
-
|
|
1514
|
+
x && await ee(
|
|
1515
|
+
x,
|
|
1476
1516
|
t
|
|
1477
1517
|
);
|
|
1478
1518
|
}
|
|
1479
1519
|
if (e.phpmyadmin && !await t.fileExists(
|
|
1480
|
-
`${
|
|
1520
|
+
`${re}/index.php`
|
|
1481
1521
|
)) {
|
|
1482
|
-
const
|
|
1483
|
-
await
|
|
1522
|
+
const x = await st(), T = await de({ steps: x });
|
|
1523
|
+
await ee(T, t);
|
|
1484
1524
|
}
|
|
1485
1525
|
if (e.command === "build-snapshot") {
|
|
1486
|
-
await
|
|
1526
|
+
await Ot(t, e.outfile), i.printStatus(`Exported to ${e.outfile}`), await A();
|
|
1487
1527
|
return;
|
|
1488
1528
|
} else if (e.command === "run-blueprint") {
|
|
1489
|
-
|
|
1529
|
+
i.finishProgress("Done"), await A();
|
|
1490
1530
|
return;
|
|
1491
1531
|
}
|
|
1492
1532
|
}
|
|
1493
|
-
if (
|
|
1494
|
-
const
|
|
1533
|
+
if (i.finishProgress(), i.printReady(y, L), e.phpmyadmin) {
|
|
1534
|
+
const h = d.join(
|
|
1495
1535
|
e.phpmyadmin,
|
|
1496
|
-
|
|
1536
|
+
it
|
|
1497
1537
|
);
|
|
1498
|
-
|
|
1499
|
-
new URL(
|
|
1538
|
+
i.printPhpMyAdminUrl(
|
|
1539
|
+
new URL(h, y).toString()
|
|
1500
1540
|
);
|
|
1501
1541
|
}
|
|
1502
|
-
return e.xdebug && e.experimentalDevtools && (await
|
|
1542
|
+
return e.xdebug && e.experimentalDevtools && (await Qe({
|
|
1503
1543
|
phpInstance: t,
|
|
1504
1544
|
phpRoot: "/wordpress"
|
|
1505
1545
|
})).start(), {
|
|
1506
1546
|
playground: t,
|
|
1507
1547
|
server: p,
|
|
1508
1548
|
serverUrl: y,
|
|
1509
|
-
[Symbol.asyncDispose]:
|
|
1510
|
-
[
|
|
1511
|
-
workerThreadCount:
|
|
1549
|
+
[Symbol.asyncDispose]: A,
|
|
1550
|
+
[ge]: {
|
|
1551
|
+
workerThreadCount: L
|
|
1512
1552
|
}
|
|
1513
1553
|
};
|
|
1514
|
-
} catch (
|
|
1554
|
+
} catch (f) {
|
|
1515
1555
|
if (e.verbosity !== "debug")
|
|
1516
|
-
throw
|
|
1517
|
-
let
|
|
1518
|
-
throw await t?.fileExists(
|
|
1556
|
+
throw f;
|
|
1557
|
+
let g = "";
|
|
1558
|
+
throw await t?.fileExists(Z) && (g = await t.readFileAsText(Z)), await A(), new Error(g, { cause: f });
|
|
1519
1559
|
}
|
|
1520
1560
|
},
|
|
1521
1561
|
async handleRequest(p) {
|
|
1522
|
-
if (!
|
|
1523
|
-
return
|
|
1562
|
+
if (!u)
|
|
1563
|
+
return J.forHttpCode(
|
|
1524
1564
|
502,
|
|
1525
1565
|
"WordPress is not ready yet"
|
|
1526
1566
|
);
|
|
1527
|
-
if (
|
|
1528
|
-
|
|
1567
|
+
if (w) {
|
|
1568
|
+
w = !1;
|
|
1529
1569
|
const m = {
|
|
1530
1570
|
"Content-Type": ["text/plain"],
|
|
1531
1571
|
"Content-Length": ["0"],
|
|
@@ -1535,11 +1575,11 @@ async function Dt(e) {
|
|
|
1535
1575
|
"playground_auto_login_already_happened"
|
|
1536
1576
|
) && (m["Set-Cookie"] = [
|
|
1537
1577
|
"playground_auto_login_already_happened=1; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/"
|
|
1538
|
-
]),
|
|
1539
|
-
new
|
|
1578
|
+
]), J.fromPHPResponse(
|
|
1579
|
+
new Me(302, m, new Uint8Array())
|
|
1540
1580
|
);
|
|
1541
1581
|
}
|
|
1542
|
-
|
|
1582
|
+
o && (p = {
|
|
1543
1583
|
...p,
|
|
1544
1584
|
headers: {
|
|
1545
1585
|
...p.headers,
|
|
@@ -1548,29 +1588,31 @@ async function Dt(e) {
|
|
|
1548
1588
|
// header with the cookies from our store. This avoids
|
|
1549
1589
|
// getting into a strange state where both browser and
|
|
1550
1590
|
// server are managing cookies.
|
|
1551
|
-
cookie:
|
|
1591
|
+
cookie: o.getCookieRequestHeader()
|
|
1552
1592
|
}
|
|
1553
1593
|
});
|
|
1554
1594
|
const a = await t.requestStreamed(p);
|
|
1555
|
-
if (
|
|
1595
|
+
if (o) {
|
|
1556
1596
|
const m = await a.headers;
|
|
1557
|
-
|
|
1597
|
+
o.rememberCookiesFromResponseHeaders(m), delete m["set-cookie"];
|
|
1558
1598
|
}
|
|
1559
1599
|
return a;
|
|
1560
1600
|
}
|
|
1601
|
+
}).catch((p) => {
|
|
1602
|
+
i.printError(p.message), process.exit(1);
|
|
1561
1603
|
});
|
|
1562
|
-
return S && e.command === "start" && !e.skipBrowser &&
|
|
1604
|
+
return S && e.command === "start" && !e.skipBrowser && Nt(S.serverUrl), S;
|
|
1563
1605
|
}
|
|
1564
|
-
function
|
|
1606
|
+
function Ut(e) {
|
|
1565
1607
|
let t = { ...e, command: "server" };
|
|
1566
|
-
e.noAutoMount || (t.autoMount =
|
|
1567
|
-
const
|
|
1608
|
+
e.noAutoMount || (t.autoMount = d.resolve(process.cwd(), t.path ?? ""), t = he(t), delete t.autoMount);
|
|
1609
|
+
const o = ae(
|
|
1568
1610
|
t["mount-before-install"] || [],
|
|
1569
1611
|
"/wordpress"
|
|
1570
|
-
) ||
|
|
1571
|
-
if (
|
|
1572
|
-
console.log("Site files stored at:",
|
|
1573
|
-
|
|
1612
|
+
) || ae(t.mount || [], "/wordpress");
|
|
1613
|
+
if (o)
|
|
1614
|
+
console.log("Site files stored at:", o?.hostPath), e.reset && (console.log(""), console.log(
|
|
1615
|
+
Wt(
|
|
1574
1616
|
"This site is not managed by Playground CLI and cannot be reset."
|
|
1575
1617
|
)
|
|
1576
1618
|
), console.log(
|
|
@@ -1579,15 +1621,15 @@ function Rt(e) {
|
|
|
1579
1621
|
"You may still remove the site's directory manually if you wish."
|
|
1580
1622
|
), process.exit(1));
|
|
1581
1623
|
else {
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1624
|
+
const r = t.autoMount || process.cwd(), s = rt("sha256").update(r).digest("hex"), i = q.homedir(), n = d.join(
|
|
1625
|
+
i,
|
|
1584
1626
|
".wordpress-playground/sites",
|
|
1585
|
-
|
|
1627
|
+
s
|
|
1586
1628
|
);
|
|
1587
|
-
console.log("Site files stored at:", n),
|
|
1629
|
+
console.log("Site files stored at:", n), Y(n) && e.reset && (console.log("Resetting site..."), Re(n, { recursive: !0 })), j(n, { recursive: !0 }), t["mount-before-install"] = [
|
|
1588
1630
|
...t["mount-before-install"] || [],
|
|
1589
1631
|
{ vfsPath: "/wordpress", hostPath: n }
|
|
1590
|
-
], t.wordpressInstallMode =
|
|
1632
|
+
], t.wordpressInstallMode = We(n).length === 0 ? (
|
|
1591
1633
|
// Only download WordPress on the first run when the site directory is still
|
|
1592
1634
|
// empty.
|
|
1593
1635
|
"download-and-install"
|
|
@@ -1598,55 +1640,55 @@ function Rt(e) {
|
|
|
1598
1640
|
}
|
|
1599
1641
|
return t;
|
|
1600
1642
|
}
|
|
1601
|
-
const
|
|
1602
|
-
function
|
|
1603
|
-
let
|
|
1604
|
-
return e === "v1" ?
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1607
|
-
l.command === "worker-script-initialized" &&
|
|
1608
|
-
processId:
|
|
1609
|
-
worker:
|
|
1643
|
+
const _ = new xe();
|
|
1644
|
+
function Ht(e, { onExit: t } = {}) {
|
|
1645
|
+
let o;
|
|
1646
|
+
return e === "v1" ? o = new te(new URL("./worker-thread-v1.js", import.meta.url)) : o = new te(new URL("./worker-thread-v2.js", import.meta.url)), new Promise((r, s) => {
|
|
1647
|
+
const i = _.claim();
|
|
1648
|
+
o.once("message", function(l) {
|
|
1649
|
+
l.command === "worker-script-initialized" && r({
|
|
1650
|
+
processId: i,
|
|
1651
|
+
worker: o,
|
|
1610
1652
|
phpPort: l.phpPort
|
|
1611
1653
|
});
|
|
1612
|
-
}),
|
|
1613
|
-
|
|
1614
|
-
const
|
|
1654
|
+
}), o.once("error", function(l) {
|
|
1655
|
+
_.release(i), console.error(l);
|
|
1656
|
+
const u = new Error(
|
|
1615
1657
|
`Worker failed to load worker. ${l.message ? `Original error: ${l.message}` : ""}`
|
|
1616
1658
|
);
|
|
1617
|
-
|
|
1659
|
+
s(u);
|
|
1618
1660
|
});
|
|
1619
1661
|
let n = !1;
|
|
1620
|
-
|
|
1662
|
+
o.once("spawn", () => {
|
|
1621
1663
|
n = !0;
|
|
1622
|
-
}),
|
|
1623
|
-
|
|
1664
|
+
}), o.once("exit", (l) => {
|
|
1665
|
+
_.release(i), n || s(new Error(`Worker exited before spawning: ${l}`)), t?.(l);
|
|
1624
1666
|
});
|
|
1625
1667
|
});
|
|
1626
1668
|
}
|
|
1627
|
-
async function
|
|
1628
|
-
const { port1: t, port2:
|
|
1629
|
-
return await
|
|
1669
|
+
async function Ft(e) {
|
|
1670
|
+
const { port1: t, port2: o } = new pe();
|
|
1671
|
+
return await Be(e, t), o;
|
|
1630
1672
|
}
|
|
1631
|
-
function
|
|
1632
|
-
const t =
|
|
1633
|
-
let
|
|
1673
|
+
function Nt(e) {
|
|
1674
|
+
const t = q.platform();
|
|
1675
|
+
let o;
|
|
1634
1676
|
switch (t) {
|
|
1635
1677
|
case "darwin":
|
|
1636
|
-
|
|
1678
|
+
o = `open "${e}"`;
|
|
1637
1679
|
break;
|
|
1638
1680
|
case "win32":
|
|
1639
|
-
|
|
1681
|
+
o = `start "" "${e}"`;
|
|
1640
1682
|
break;
|
|
1641
1683
|
default:
|
|
1642
|
-
|
|
1684
|
+
o = `xdg-open "${e}"`;
|
|
1643
1685
|
break;
|
|
1644
1686
|
}
|
|
1645
|
-
|
|
1646
|
-
|
|
1687
|
+
me(o, (r) => {
|
|
1688
|
+
r && P.debug(`Could not open browser: ${r.message}`);
|
|
1647
1689
|
});
|
|
1648
1690
|
}
|
|
1649
|
-
async function
|
|
1691
|
+
async function Ot(e, t) {
|
|
1650
1692
|
await e.run({
|
|
1651
1693
|
code: `<?php
|
|
1652
1694
|
$zip = new ZipArchive();
|
|
@@ -1667,17 +1709,17 @@ async function Ft(e, t) {
|
|
|
1667
1709
|
|
|
1668
1710
|
`
|
|
1669
1711
|
});
|
|
1670
|
-
const
|
|
1671
|
-
c.writeFileSync(t,
|
|
1712
|
+
const o = await e.readFileAsBuffer("/tmp/build.zip");
|
|
1713
|
+
c.writeFileSync(t, o);
|
|
1672
1714
|
}
|
|
1673
1715
|
export {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1716
|
+
be as L,
|
|
1717
|
+
yo as a,
|
|
1718
|
+
Dt as b,
|
|
1719
|
+
ge as i,
|
|
1720
|
+
we as m,
|
|
1721
|
+
bo as p,
|
|
1722
|
+
Lt as r,
|
|
1723
|
+
Ht as s
|
|
1682
1724
|
};
|
|
1683
|
-
//# sourceMappingURL=run-cli-
|
|
1725
|
+
//# sourceMappingURL=run-cli-Cv4FHhj_.js.map
|