@wp-playground/cli 3.1.21 → 3.1.25

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.
@@ -1,68 +1,68 @@
1
- import { logger as f, LogSeverity as j, errorLogPath as ne } from "@php-wasm/logger";
2
- import { consumeAPI as be, isLegacyPHPVersion as Z, ProcessIdAllocator as Be, AllPHPVersions as ie, printDebugDetails as De, HttpCookieStore as Re, FileLockManagerInMemory as We, StreamedPHPResponse as se, SupportedPHPVersions as Y, createObjectPoolProxy as Le, exposeAPI as Ue, PHPResponse as _e, exposeSyncAPI as Ne } from "@php-wasm/universal";
3
- import { resolveRemoteBlueprint as He, resolveRuntimeConfiguration as ae, compileBlueprintV1 as ge, isBlueprintBundle as Oe, runBlueprintV1Steps as le } from "@wp-playground/blueprints";
4
- import { RecommendedPHPVersion as M, zipDirectory as Fe } from "@wp-playground/common";
5
- import p, { existsSync as J, rmdirSync as Ve, mkdirSync as Q, readdirSync as je } from "fs";
6
- import { MessageChannel as Pe, Worker as ue } from "worker_threads";
7
- import { createNodeFsMountHandler as Ye } from "@php-wasm/node";
8
- import d, { basename as H, join as K } from "path";
9
- import { exec as ve } from "child_process";
10
- import { promisify as qe } from "util";
11
- import Se from "express";
12
- import { Readable as ze } from "stream";
13
- import { pipeline as Ge } from "stream/promises";
14
- import Qe from "yargs";
15
- import { NodeJsFilesystem as Xe, OverlayFilesystem as Ze, InMemoryFilesystem as Je, ZipFilesystem as Ke } from "@wp-playground/storage";
16
- import { EmscriptenDownloadMonitor as et, ProgressTracker as tt } from "@php-wasm/progress";
17
- import { resolveWordPressRelease as ot } from "@wp-playground/wordpress";
1
+ import { logger as h, LogSeverity as O, errorLogPath as te } from "@php-wasm/logger";
2
+ import { consumeAPI as fe, isLegacyPHPVersion as Y, ProcessIdAllocator as Te, AllPHPVersions as re, printDebugDetails as Ce, HttpCookieStore as Ae, FileLockManagerInMemory as De, StreamedPHPResponse as oe, SupportedPHPVersions as j, createObjectPoolProxy as Re, exposeAPI as Le, PHPResponse as We, exposeSyncAPI as Be } from "@php-wasm/universal";
3
+ import { resolveRemoteBlueprint as Ue, resolveRuntimeConfiguration as ne, compileBlueprintV1 as he, isBlueprintBundle as _e, runBlueprintV1Steps as ie } from "@wp-playground/blueprints";
4
+ import { RecommendedPHPVersion as T, zipDirectory as Ne } from "@wp-playground/common";
5
+ import c, { existsSync as Q, rmdirSync as He, mkdirSync as z, readdirSync as Fe } from "fs";
6
+ import { MessageChannel as we, Worker as se } from "worker_threads";
7
+ import { createNodeFsMountHandler as Oe } from "@php-wasm/node";
8
+ import d, { basename as _, join as X } from "path";
9
+ import { exec as be } from "child_process";
10
+ import { promisify as je } from "util";
11
+ import ye from "express";
12
+ import { Readable as Ve } from "stream";
13
+ import { pipeline as qe } from "stream/promises";
14
+ import ze from "yargs";
15
+ import { NodeJsFilesystem as Ge, OverlayFilesystem as Ye, InMemoryFilesystem as Qe, ZipFilesystem as Xe } from "@wp-playground/storage";
16
+ import { EmscriptenDownloadMonitor as Ze, ProgressTracker as Je } from "@php-wasm/progress";
17
+ import { resolveWordPressRelease as Ke } from "@wp-playground/wordpress";
18
18
  import C from "fs-extra";
19
- import { createRequire as rt } from "module";
20
- import U from "os";
21
- import { startBridge as nt } from "@php-wasm/xdebug-bridge";
22
- import { dir as it, setGracefulCleanup as st } from "tmp-promise";
23
- import { removeTempDirSymlink as at, createTempDirSymlink as de, makeXdebugConfig as lt, DEFAULT_PATH_SKIPPINGS as ce, clearXdebugIDEConfig as ut, addXdebugIDEConfig as dt } from "@php-wasm/cli-util";
24
- import { createHash as ct } from "crypto";
25
- import { PHPMYADMIN_INSTALL_PATH as pe, getPhpMyAdminInstallSteps as pt, PHPMYADMIN_ENTRY_PATH as mt } from "@wp-playground/tools";
26
- import { jspi as me } from "wasm-feature-detect";
27
- function q(e) {
19
+ import { createRequire as et } from "module";
20
+ import B from "os";
21
+ import { startBridge as tt } from "@php-wasm/xdebug-bridge";
22
+ import { dir as rt, setGracefulCleanup as ot } from "tmp-promise";
23
+ import { CLIOutput as nt, removeTempDirSymlink as it, createTempDirSymlink as ae, makeXdebugConfig as st, DEFAULT_PATH_SKIPPINGS as le, clearXdebugIDEConfig as at, addXdebugIDEConfig as lt } from "@php-wasm/cli-util";
24
+ import { createHash as ut } from "crypto";
25
+ import { PHPMYADMIN_INSTALL_PATH as ue, getPhpMyAdminInstallSteps as dt, PHPMYADMIN_ENTRY_PATH as pt } from "@wp-playground/tools";
26
+ import { jspi as de } from "wasm-feature-detect";
27
+ function V(e) {
28
28
  const t = [];
29
- for (const o of e) {
30
- const r = o.split(":");
31
- if (r.length !== 2)
32
- throw new Error(`Invalid mount format: ${o}.
29
+ for (const r of e) {
30
+ const n = r.split(":");
31
+ if (n.length !== 2)
32
+ throw new Error(`Invalid mount format: ${r}.
33
33
  Expected format: /host/path:/vfs/path.
34
34
  If your path contains a colon, e.g. C:\\myplugin, use the --mount-dir option instead.
35
35
  Example: --mount-dir C:\\my-plugin /wordpress/wp-content/plugins/my-plugin`);
36
- const [n, i] = r;
37
- if (!J(n))
38
- throw new Error(`Host path does not exist: ${n}`);
39
- t.push({ hostPath: n, vfsPath: i });
36
+ const [i, o] = n;
37
+ if (!Q(i))
38
+ throw new Error(`Host path does not exist: ${i}`);
39
+ t.push({ hostPath: i, vfsPath: o });
40
40
  }
41
41
  return t;
42
42
  }
43
- function he(e) {
43
+ function pe(e) {
44
44
  if (e.length % 2 !== 0)
45
45
  throw new Error("Invalid mount format. Expected: /host/path /vfs/path");
46
46
  const t = [];
47
- for (let o = 0; o < e.length; o += 2) {
48
- const r = e[o], n = e[o + 1];
49
- if (!J(r))
50
- throw new Error(`Host path does not exist: ${r}`);
47
+ for (let r = 0; r < e.length; r += 2) {
48
+ const n = e[r], i = e[r + 1];
49
+ if (!Q(n))
50
+ throw new Error(`Host path does not exist: ${n}`);
51
51
  t.push({
52
- hostPath: d.resolve(process.cwd(), r),
53
- vfsPath: n
52
+ hostPath: d.resolve(process.cwd(), n),
53
+ vfsPath: i
54
54
  });
55
55
  }
56
56
  return t;
57
57
  }
58
- async function xo(e, t) {
59
- for (const o of t)
58
+ async function gr(e, t) {
59
+ for (const r of t)
60
60
  await e.mount(
61
- o.vfsPath,
62
- Ye(o.hostPath)
61
+ r.vfsPath,
62
+ Oe(r.hostPath)
63
63
  );
64
64
  }
65
- const fe = {
65
+ const ce = {
66
66
  step: "runPHP",
67
67
  code: {
68
68
  filename: "activate-theme.php",
@@ -81,267 +81,267 @@ const fe = {
81
81
  `
82
82
  }
83
83
  };
84
- function xe(e) {
84
+ function ge(e) {
85
85
  if (typeof e.autoMount != "string")
86
86
  return e;
87
- const t = e.autoMount, o = [...e.mount || []], r = [...e["mount-before-install"] || []], n = {
87
+ const t = e.autoMount, r = [...e.mount || []], n = [...e["mount-before-install"] || []], i = {
88
88
  ...e,
89
- mount: o,
90
- "mount-before-install": r,
89
+ mount: r,
90
+ "mount-before-install": n,
91
91
  "additional-blueprint-steps": [
92
92
  ...e["additional-blueprint-steps"] || []
93
93
  ]
94
94
  };
95
- if (yt(t)) {
96
- const a = `/wordpress/wp-content/plugins/${H(t)}`;
97
- o.push({
95
+ if (ht(t)) {
96
+ const a = `/wordpress/wp-content/plugins/${_(t)}`;
97
+ r.push({
98
98
  hostPath: t,
99
99
  vfsPath: a,
100
100
  autoMounted: !0
101
- }), n["additional-blueprint-steps"].push({
101
+ }), i["additional-blueprint-steps"].push({
102
102
  step: "activatePlugin",
103
- pluginPath: `/wordpress/wp-content/plugins/${H(t)}`
103
+ pluginPath: `/wordpress/wp-content/plugins/${_(t)}`
104
104
  });
105
- } else if (wt(t)) {
106
- const i = H(t), a = `/wordpress/wp-content/themes/${i}`;
107
- o.push({
105
+ } else if (ft(t)) {
106
+ const o = _(t), a = `/wordpress/wp-content/themes/${o}`;
107
+ r.push({
108
108
  hostPath: t,
109
109
  vfsPath: a,
110
110
  autoMounted: !0
111
- }), n["additional-blueprint-steps"].push(
111
+ }), i["additional-blueprint-steps"].push(
112
112
  e["experimental-blueprints-v2-runner"] ? {
113
113
  step: "activateTheme",
114
- themeDirectoryName: i
114
+ themeDirectoryName: o
115
115
  } : {
116
116
  step: "activateTheme",
117
- themeFolderName: i
117
+ themeFolderName: o
118
118
  }
119
119
  );
120
- } else if (ft(t)) {
121
- const i = p.readdirSync(t);
122
- for (const a of i)
123
- a !== "index.php" && o.push({
124
- hostPath: K(t, a),
120
+ } else if (mt(t)) {
121
+ const o = c.readdirSync(t);
122
+ for (const a of o)
123
+ a !== "index.php" && r.push({
124
+ hostPath: X(t, a),
125
125
  vfsPath: `/wordpress/wp-content/${a}`,
126
126
  autoMounted: !0
127
127
  });
128
- n["additional-blueprint-steps"].push(fe);
129
- } else ht(t) && (r.push({
128
+ i["additional-blueprint-steps"].push(ce);
129
+ } else ct(t) && (n.push({
130
130
  hostPath: t,
131
131
  vfsPath: "/wordpress",
132
132
  autoMounted: !0
133
- }), n.mode = "apply-to-existing-site", n["additional-blueprint-steps"].push(fe), n.wordpressInstallMode || (n.wordpressInstallMode = "install-from-existing-files-if-needed"));
134
- return n;
133
+ }), i.mode = "apply-to-existing-site", i["additional-blueprint-steps"].push(ce), i.wordpressInstallMode || (i.wordpressInstallMode = "install-from-existing-files-if-needed"));
134
+ return i;
135
135
  }
136
- function ht(e) {
137
- const t = p.readdirSync(e);
136
+ function ct(e) {
137
+ const t = c.readdirSync(e);
138
138
  return t.includes("wp-admin") && t.includes("wp-includes") && t.includes("wp-content");
139
139
  }
140
- function ft(e) {
141
- const t = p.readdirSync(e);
140
+ function mt(e) {
141
+ const t = c.readdirSync(e);
142
142
  return t.includes("themes") || t.includes("plugins") || t.includes("mu-plugins") || t.includes("uploads");
143
143
  }
144
- function wt(e) {
145
- if (!p.readdirSync(e).includes("style.css"))
144
+ function ft(e) {
145
+ if (!c.readdirSync(e).includes("style.css"))
146
146
  return !1;
147
- const o = p.readFileSync(K(e, "style.css"), "utf8");
148
- return !!/^(?:[ \t]*<\?php)?[ \t/*#@]*Theme Name:(.*)$/im.exec(o);
147
+ const r = c.readFileSync(X(e, "style.css"), "utf8");
148
+ return !!/^(?:[ \t]*<\?php)?[ \t/*#@]*Theme Name:(.*)$/im.exec(r);
149
149
  }
150
- function yt(e) {
151
- const t = p.readdirSync(e), o = /^(?:[ \t]*<\?php)?[ \t/*#@]*Plugin Name:(.*)$/im;
152
- return !!t.filter((n) => n.endsWith(".php")).find((n) => {
153
- const i = p.readFileSync(K(e, n), "utf8");
154
- return !!o.exec(i);
150
+ function ht(e) {
151
+ const t = c.readdirSync(e), r = /^(?:[ \t]*<\?php)?[ \t/*#@]*Plugin Name:(.*)$/im;
152
+ return !!t.filter((i) => i.endsWith(".php")).find((i) => {
153
+ const o = c.readFileSync(X(e, i), "utf8");
154
+ return !!r.exec(o);
155
155
  });
156
156
  }
157
- function bt(e) {
157
+ function wt(e) {
158
158
  if (e.length % 2 !== 0)
159
159
  throw new Error(
160
160
  "Invalid constant definition format. Expected pairs of NAME value"
161
161
  );
162
162
  const t = {};
163
- for (let o = 0; o < e.length; o += 2) {
164
- const r = e[o], n = e[o + 1];
165
- if (!r || !r.trim())
163
+ for (let r = 0; r < e.length; r += 2) {
164
+ const n = e[r], i = e[r + 1];
165
+ if (!n || !n.trim())
166
166
  throw new Error("Constant name cannot be empty");
167
- t[r.trim()] = n;
167
+ t[n.trim()] = i;
168
168
  }
169
169
  return t;
170
170
  }
171
- function gt(e) {
171
+ function bt(e) {
172
172
  if (e.length % 2 !== 0)
173
173
  throw new Error(
174
174
  "Invalid boolean constant definition format. Expected pairs of NAME value"
175
175
  );
176
176
  const t = {};
177
- for (let o = 0; o < e.length; o += 2) {
178
- const r = e[o], n = e[o + 1].trim().toLowerCase();
179
- if (!r || !r.trim())
177
+ for (let r = 0; r < e.length; r += 2) {
178
+ const n = e[r], i = e[r + 1].trim().toLowerCase();
179
+ if (!n || !n.trim())
180
180
  throw new Error("Constant name cannot be empty");
181
- if (n === "true" || n === "1")
182
- t[r.trim()] = !0;
183
- else if (n === "false" || n === "0")
184
- t[r.trim()] = !1;
181
+ if (i === "true" || i === "1")
182
+ t[n.trim()] = !0;
183
+ else if (i === "false" || i === "0")
184
+ t[n.trim()] = !1;
185
185
  else
186
186
  throw new Error(
187
- `Invalid boolean value for constant "${r}": "${n}". Must be "true", "false", "1", or "0".`
187
+ `Invalid boolean value for constant "${n}": "${i}". Must be "true", "false", "1", or "0".`
188
188
  );
189
189
  }
190
190
  return t;
191
191
  }
192
- function Pt(e) {
192
+ function yt(e) {
193
193
  if (e.length % 2 !== 0)
194
194
  throw new Error(
195
195
  "Invalid number constant definition format. Expected pairs of NAME value"
196
196
  );
197
197
  const t = {};
198
- for (let o = 0; o < e.length; o += 2) {
199
- const r = e[o], n = e[o + 1].trim();
200
- if (!r || !r.trim())
198
+ for (let r = 0; r < e.length; r += 2) {
199
+ const n = e[r], i = e[r + 1].trim();
200
+ if (!n || !n.trim())
201
201
  throw new Error("Constant name cannot be empty");
202
- const i = Number(n);
203
- if (isNaN(i))
202
+ const o = Number(i);
203
+ if (isNaN(o))
204
204
  throw new Error(
205
- `Invalid number value for constant "${r}": "${n}". Must be a valid number.`
205
+ `Invalid number value for constant "${n}": "${i}". Must be a valid number.`
206
206
  );
207
- t[r.trim()] = i;
207
+ t[n.trim()] = o;
208
208
  }
209
209
  return t;
210
210
  }
211
- function vt(e = {}, t = {}, o = {}) {
212
- const r = {}, n = /* @__PURE__ */ new Set(), i = (a, l) => {
211
+ function gt(e = {}, t = {}, r = {}) {
212
+ const n = {}, i = /* @__PURE__ */ new Set(), o = (a, l) => {
213
213
  for (const u in a) {
214
- if (n.has(u))
214
+ if (i.has(u))
215
215
  throw new Error(
216
216
  `Constant "${u}" is defined multiple times across different --define-${l} flags`
217
217
  );
218
- n.add(u), r[u] = a[u];
218
+ i.add(u), n[u] = a[u];
219
219
  }
220
220
  };
221
- return i(e, "string"), i(t, "bool"), i(o, "number"), r;
221
+ return o(e, "string"), o(t, "bool"), o(r, "number"), n;
222
222
  }
223
- function ee(e) {
224
- return vt(
223
+ function Z(e) {
224
+ return gt(
225
225
  e.define,
226
226
  e["define-bool"],
227
227
  e["define-number"]
228
228
  );
229
229
  }
230
- const St = qe(ve);
231
- function xt(e) {
230
+ const Pt = je(be);
231
+ function vt(e) {
232
232
  return new Promise((t) => {
233
233
  if (e === 0) return t(!1);
234
- const o = Se().listen(e);
235
- o.once("listening", () => o.close(() => t(!1))), o.once(
234
+ const r = ye().listen(e);
235
+ r.once("listening", () => r.close(() => t(!1))), r.once(
236
236
  "error",
237
- (r) => t(r.code === "EADDRINUSE")
237
+ (n) => t(n.code === "EADDRINUSE")
238
238
  );
239
239
  });
240
240
  }
241
- async function Et(e) {
242
- const t = Se(), o = await new Promise((a, l) => {
241
+ async function St(e) {
242
+ const t = ye(), r = await new Promise((a, l) => {
243
243
  const u = t.listen(e.port, () => {
244
- const h = u.address();
245
- h === null || typeof h == "string" ? l(new Error("Server address is not available")) : a(u);
244
+ const f = u.address();
245
+ f === null || typeof f == "string" ? l(new Error("Server address is not available")) : a(u);
246
246
  }).once("error", l);
247
247
  });
248
248
  t.use("/", async (a, l) => {
249
249
  try {
250
250
  const u = {
251
251
  url: a.url,
252
- headers: It(a),
252
+ headers: kt(a),
253
253
  method: a.method,
254
- body: await Tt(a)
255
- }, h = await e.handleRequest(u);
256
- await $t(h, l);
254
+ body: await Et(a)
255
+ }, f = await e.handleRequest(u);
256
+ await xt(f, l);
257
257
  } catch (u) {
258
- f.error(u), l.headersSent || (l.statusCode = 500, l.end("Internal Server Error"));
258
+ h.error(u), l.headersSent || (l.statusCode = 500, l.end("Internal Server Error"));
259
259
  }
260
260
  });
261
- const n = o.address().port, i = process.env.CODESPACE_NAME;
262
- return i && kt(n, i), await e.onBind(o, n);
261
+ const i = r.address().port, o = process.env.CODESPACE_NAME;
262
+ return o && $t(i, o), await e.onBind(r, i);
263
263
  }
264
- async function $t(e, t) {
265
- const [o, r] = await Promise.all([
264
+ async function xt(e, t) {
265
+ const [r, n] = await Promise.all([
266
266
  e.headers,
267
267
  e.httpStatusCode
268
268
  ]);
269
- t.statusCode = r;
270
- for (const i in o)
271
- t.setHeader(i, o[i]);
272
- const n = ze.fromWeb(e.stdout);
269
+ t.statusCode = n;
270
+ for (const o in r)
271
+ t.setHeader(o, r[o]);
272
+ const i = Ve.fromWeb(e.stdout);
273
273
  try {
274
- await Ge(n, t);
275
- } catch (i) {
276
- if (i instanceof Error && "code" in i && (i.code === "ERR_STREAM_PREMATURE_CLOSE" || i.code === "ERR_STREAM_UNABLE_TO_PIPE"))
274
+ await qe(i, t);
275
+ } catch (o) {
276
+ if (o instanceof Error && "code" in o && (o.code === "ERR_STREAM_PREMATURE_CLOSE" || o.code === "ERR_STREAM_UNABLE_TO_PIPE"))
277
277
  return;
278
- throw i;
278
+ throw o;
279
279
  }
280
280
  }
281
- const Tt = async (e) => await new Promise((t) => {
282
- const o = [];
283
- e.on("data", (r) => {
284
- o.push(r);
281
+ const Et = async (e) => await new Promise((t) => {
282
+ const r = [];
283
+ e.on("data", (n) => {
284
+ r.push(n);
285
285
  }), e.on("end", () => {
286
- t(new Uint8Array(Buffer.concat(o)));
286
+ t(new Uint8Array(Buffer.concat(r)));
287
287
  });
288
288
  });
289
- async function kt(e, t) {
290
- f.log(`Publishing port ${e}...`);
291
- const o = `gh codespace ports visibility ${e}:public -c ${t}`;
292
- for (let r = 0; r < 10; r++)
289
+ async function $t(e, t) {
290
+ h.log(`Publishing port ${e}...`);
291
+ const r = `gh codespace ports visibility ${e}:public -c ${t}`;
292
+ for (let n = 0; n < 10; n++)
293
293
  try {
294
- await St(o);
294
+ await Pt(r);
295
295
  return;
296
296
  } catch {
297
- await new Promise((n) => setTimeout(n, 2e3));
297
+ await new Promise((i) => setTimeout(i, 2e3));
298
298
  }
299
299
  }
300
- const It = (e) => {
300
+ const kt = (e) => {
301
301
  const t = {};
302
302
  if (e.rawHeaders && e.rawHeaders.length)
303
- for (let o = 0; o < e.rawHeaders.length; o += 2)
304
- t[e.rawHeaders[o].toLowerCase()] = e.rawHeaders[o + 1];
303
+ for (let r = 0; r < e.rawHeaders.length; r += 2)
304
+ t[e.rawHeaders[r].toLowerCase()] = e.rawHeaders[r + 1];
305
305
  return t;
306
306
  };
307
- function Mt(e) {
307
+ function It(e) {
308
308
  return /^latest$|^beta$|^trunk$|^nightly$|^(?:(\d+)\.(\d+)(?:\.(\d+))?)((?:-beta(?:\d+)?)|(?:-RC(?:\d+)?))?$/.test(e);
309
309
  }
310
- async function Ct({
310
+ async function Mt({
311
311
  sourceString: e,
312
312
  blueprintMayReadAdjacentFiles: t
313
313
  }) {
314
314
  if (!e)
315
315
  return;
316
316
  if (e.startsWith("http://") || e.startsWith("https://"))
317
- return await He(e);
318
- let o = d.resolve(process.cwd(), e);
319
- if (!p.existsSync(o))
320
- throw new Error(`Blueprint file does not exist: ${o}`);
321
- const r = p.statSync(o);
322
- if (r.isDirectory() && (o = d.join(o, "blueprint.json")), !r.isFile() && r.isSymbolicLink())
317
+ return await Ue(e);
318
+ let r = d.resolve(process.cwd(), e);
319
+ if (!c.existsSync(r))
320
+ throw new Error(`Blueprint file does not exist: ${r}`);
321
+ const n = c.statSync(r);
322
+ if (n.isDirectory() && (r = d.join(r, "blueprint.json")), !n.isFile() && n.isSymbolicLink())
323
323
  throw new Error(
324
- `Blueprint path is neither a file nor a directory: ${o}`
324
+ `Blueprint path is neither a file nor a directory: ${r}`
325
325
  );
326
- const n = d.extname(o);
327
- switch (n) {
326
+ const i = d.extname(r);
327
+ switch (i) {
328
328
  case ".zip":
329
- return Ke.fromArrayBuffer(
330
- p.readFileSync(o).buffer
329
+ return Xe.fromArrayBuffer(
330
+ c.readFileSync(r).buffer
331
331
  );
332
332
  case ".json": {
333
- const i = p.readFileSync(o, "utf-8");
333
+ const o = c.readFileSync(r, "utf-8");
334
334
  try {
335
- JSON.parse(i);
335
+ JSON.parse(o);
336
336
  } catch {
337
337
  throw new Error(
338
- `Blueprint file at ${o} is not a valid JSON file`
338
+ `Blueprint file at ${r} is not a valid JSON file`
339
339
  );
340
340
  }
341
- const a = d.dirname(o), l = new Xe(a);
342
- return new Ze([
343
- new Je({
344
- "blueprint.json": i
341
+ const a = d.dirname(r), l = new Ge(a);
342
+ return new Ye([
343
+ new Qe({
344
+ "blueprint.json": o
345
345
  }),
346
346
  /**
347
347
  * Wrap the NodeJS filesystem to prevent access to local files
@@ -362,133 +362,136 @@ You can allow this Blueprint to read files from the same parent directory by exp
362
362
  }
363
363
  default:
364
364
  throw new Error(
365
- `Unsupported blueprint file extension: ${n}. Only .zip and .json files are supported.`
365
+ `Unsupported blueprint file extension: ${i}. Only .zip and .json files are supported.`
366
366
  );
367
367
  }
368
368
  }
369
- class At {
370
- constructor(t, o) {
371
- this.args = t, this.siteUrl = o.siteUrl, this.phpVersion = t.php, this.cliOutput = o.cliOutput;
369
+ function Pe(e) {
370
+ const t = [];
371
+ return e.intl && t.push("intl"), e.redis && t.push("redis"), e.memcached && t.push("memcached"), e.xdebug && t.push(
372
+ typeof e.xdebug == "object" ? { name: "xdebug", options: e.xdebug } : "xdebug"
373
+ ), t;
374
+ }
375
+ class Tt {
376
+ constructor(t, r) {
377
+ this.args = t, this.siteUrl = r.siteUrl, this.phpVersion = t.php, this.cliOutput = r.cliOutput;
372
378
  }
373
379
  getWorkerType() {
374
380
  return "v2";
375
381
  }
376
- async bootWordPress(t, o) {
377
- const r = {
382
+ async bootWordPress(t, r) {
383
+ const n = {
378
384
  command: this.args.command,
379
385
  siteUrl: this.siteUrl,
380
386
  blueprint: this.args.blueprint,
381
- workerPostInstallMountsPort: o
387
+ workerPostInstallMountsPort: r
382
388
  };
383
- return await t.bootWordPress(r, o), t;
389
+ return await t.bootWordPress(n, r), t;
384
390
  }
385
391
  async bootRequestHandler({
386
392
  worker: t,
387
- fileLockManagerPort: o,
388
- nativeInternalDirPath: r
393
+ fileLockManagerPort: r,
394
+ nativeInternalDirPath: n
389
395
  }) {
390
- const n = be(t.phpPort);
391
- await n.useFileLockManager(o);
392
- const i = {
396
+ const i = fe(t.phpPort);
397
+ await i.useFileLockManager(r);
398
+ const o = {
393
399
  ...this.args,
394
400
  phpVersion: this.phpVersion,
395
401
  siteUrl: this.siteUrl,
396
402
  processId: t.processId,
397
403
  trace: this.args.verbosity === "debug",
398
- withIntl: this.args.intl,
399
- withRedis: this.args.redis,
400
- withMemcached: this.args.memcached,
401
- withXdebug: !!this.args.xdebug,
402
- nativeInternalDirPath: r,
404
+ extensions: Pe(this.args),
405
+ nativeInternalDirPath: n,
403
406
  mountsBeforeWpInstall: this.args["mount-before-install"] || [],
404
407
  mountsAfterWpInstall: this.args.mount || [],
405
- constants: ee(this.args)
408
+ constants: Z(this.args)
406
409
  };
407
- return await n.bootWorker(i), n;
410
+ return await i.bootWorker(o), i;
408
411
  }
409
412
  }
410
- const X = d.join(U.homedir(), ".wordpress-playground");
411
- async function Bt(e = "trunk") {
413
+ const G = d.join(B.homedir(), ".wordpress-playground");
414
+ async function Ct(e = "trunk") {
412
415
  const t = typeof __dirname < "u" ? __dirname : import.meta.dirname;
413
- let o = d.join(t, "sqlite-database-integration.zip");
414
- if (!C.existsSync(o)) {
415
- const r = rt(import.meta.url), n = d.dirname(
416
- r.resolve("@wp-playground/wordpress-builds/package.json")
416
+ let r = d.join(t, "sqlite-database-integration.zip");
417
+ if (!C.existsSync(r)) {
418
+ const n = et(import.meta.url), i = d.dirname(
419
+ n.resolve("@wp-playground/wordpress-builds/package.json")
417
420
  );
418
- o = d.join(
419
- n,
421
+ r = d.join(
422
+ i,
420
423
  "src",
421
424
  "sqlite-database-integration",
422
425
  `sqlite-database-integration-${e}.zip`
423
426
  );
424
427
  }
425
- return new File([await C.readFile(o)], d.basename(o));
428
+ return new File([await C.readFile(r)], d.basename(r));
426
429
  }
427
- async function Dt(e, t, o) {
428
- const r = d.join(X, t);
429
- return C.existsSync(r) || (C.ensureDirSync(X), await Rt(e, r, o)), Ee(r);
430
+ async function At(e, t, r) {
431
+ const n = d.join(G, t);
432
+ return C.existsSync(n) || (C.ensureDirSync(G), await Dt(e, n, r)), ve(n);
430
433
  }
431
- async function Rt(e, t, o) {
432
- const n = (await o.monitorFetch(fetch(e))).body.getReader(), i = `${t}.partial`, a = C.createWriteStream(i);
434
+ async function Dt(e, t, r) {
435
+ const i = (await r.monitorFetch(fetch(e))).body.getReader(), o = `${t}.partial`, a = C.createWriteStream(o);
433
436
  for (; ; ) {
434
- const { done: l, value: u } = await n.read();
437
+ const { done: l, value: u } = await i.read();
435
438
  if (u && a.write(u), l)
436
439
  break;
437
440
  }
438
441
  a.close(), a.closed || await new Promise((l, u) => {
439
442
  a.on("finish", () => {
440
- C.renameSync(i, t), l(null);
441
- }), a.on("error", (h) => {
442
- C.removeSync(i), u(h);
443
+ C.renameSync(o, t), l(null);
444
+ }), a.on("error", (f) => {
445
+ C.removeSync(o), u(f);
443
446
  });
444
447
  });
445
448
  }
446
- function Ee(e, t) {
447
- return new File([C.readFileSync(e)], H(e));
449
+ function ve(e, t) {
450
+ return new File([C.readFileSync(e)], _(e));
448
451
  }
449
- class Wt {
450
- constructor(t, o) {
451
- this.args = t, this.siteUrl = o.siteUrl, this.cliOutput = o.cliOutput;
452
+ class Rt {
453
+ constructor(t, r) {
454
+ this.args = t, this.siteUrl = r.siteUrl, this.cliOutput = r.cliOutput;
452
455
  }
453
456
  getWorkerType() {
454
457
  return "v1";
455
458
  }
456
- async bootWordPress(t, o) {
457
- let r, n, i;
458
- const a = new et();
459
+ async bootWordPress(t, r) {
460
+ let n, i, o;
461
+ const a = new Ze();
459
462
  if (this.args.wordpressInstallMode === "download-and-install") {
460
- let h = !1;
463
+ let f = !1;
461
464
  a.addEventListener("progress", (A) => {
462
- if (h)
465
+ if (f)
463
466
  return;
464
467
  const { loaded: E, total: m } = A.detail, $ = Math.floor(
465
468
  Math.min(100, 100 * E / m)
466
469
  );
467
- h = $ === 100, this.cliOutput.updateProgress(
470
+ f = $ === 100, this.cliOutput.updateProgress(
468
471
  "Downloading WordPress",
469
472
  $
470
473
  );
471
- }), r = await ot(this.args.wp), i = d.join(
472
- X,
473
- `prebuilt-wp-content-for-wp-${r.version}.zip`
474
- ), n = p.existsSync(i) ? Ee(i) : await Dt(
475
- r.releaseUrl,
476
- `${r.version}.zip`,
474
+ }), n = await Ke(this.args.wp), o = d.join(
475
+ G,
476
+ `prebuilt-wp-content-for-wp-${n.version}.zip`
477
+ ), i = c.existsSync(o) ? ve(o) : await At(
478
+ n.releaseUrl,
479
+ `${n.version}.zip`,
477
480
  a
478
- ), f.debug(
479
- `Resolved WordPress release URL: ${r?.releaseUrl}`
481
+ ), h.debug(
482
+ `Resolved WordPress release URL: ${n?.releaseUrl}`
480
483
  );
481
484
  }
482
485
  let l;
483
486
  if (this.args.skipSqliteSetup)
484
- f.debug("Skipping SQLite integration plugin setup..."), l = void 0;
487
+ h.debug("Skipping SQLite integration plugin setup..."), l = void 0;
485
488
  else {
486
489
  this.cliOutput.updateProgress("Preparing SQLite database");
487
- const h = this.args.php || M, E = Z(h) ? "v2.2.22-php52" : "trunk";
488
- l = await Bt(E);
490
+ const f = this.args.php || T, E = Y(f) ? "v3.0.0-rc.3-php52" : "trunk";
491
+ l = await Ct(E);
489
492
  }
490
493
  this.cliOutput.updateProgress("Booting WordPress");
491
- const u = await ae(
494
+ const u = await ne(
492
495
  this.getEffectiveBlueprint()
493
496
  );
494
497
  return await t.bootWordPress(
@@ -497,16 +500,16 @@ class Wt {
497
500
  wpVersion: u.wpVersion,
498
501
  siteUrl: this.siteUrl,
499
502
  wordpressInstallMode: this.args.wordpressInstallMode || "download-and-install",
500
- wordPressZip: n && await n.arrayBuffer(),
503
+ wordPressZip: i && await i.arrayBuffer(),
501
504
  sqliteIntegrationPluginZip: await l?.arrayBuffer(),
502
- constants: ee(this.args)
505
+ constants: Z(this.args)
503
506
  },
504
- o
505
- ), i && !this.args["mount-before-install"] && !p.existsSync(i) && (this.cliOutput.updateProgress("Caching WordPress for next boot"), p.writeFileSync(
506
- i,
507
+ r
508
+ ), o && !this.args["mount-before-install"] && !c.existsSync(o) && (this.cliOutput.updateProgress("Caching WordPress for next boot"), c.writeFileSync(
509
+ o,
507
510
  // Comlink proxy is not assignable to UniversalPHP but
508
511
  // proxies all method calls transparently at runtime.
509
- await Fe(
512
+ await Ne(
510
513
  t,
511
514
  "/wordpress"
512
515
  )
@@ -514,53 +517,50 @@ class Wt {
514
517
  }
515
518
  async bootRequestHandler({
516
519
  worker: t,
517
- fileLockManagerPort: o,
518
- nativeInternalDirPath: r
520
+ fileLockManagerPort: r,
521
+ nativeInternalDirPath: n
519
522
  }) {
520
- const n = be(
523
+ const i = fe(
521
524
  t.phpPort
522
525
  );
523
- await n.isConnected();
524
- const i = await ae(
526
+ await i.isConnected();
527
+ const o = await ne(
525
528
  this.getEffectiveBlueprint()
526
529
  );
527
- return await n.useFileLockManager(o), await n.bootRequestHandler({
528
- phpVersion: i.phpVersion,
530
+ return await i.useFileLockManager(r), await i.bootRequestHandler({
531
+ phpVersion: o.phpVersion,
529
532
  siteUrl: this.siteUrl,
530
533
  mountsBeforeWpInstall: this.args["mount-before-install"] || [],
531
534
  mountsAfterWpInstall: this.args.mount || [],
532
535
  processId: t.processId,
533
536
  followSymlinks: this.args.followSymlinks === !0,
534
537
  trace: this.args.experimentalTrace === !0,
535
- withIntl: this.args.intl,
536
- withRedis: this.args.redis,
537
- withMemcached: this.args.memcached,
538
- withXdebug: !!this.args.xdebug,
539
- nativeInternalDirPath: r,
538
+ extensions: Pe(this.args),
539
+ nativeInternalDirPath: n,
540
540
  pathAliases: this.args.pathAliases
541
- }), await n.isReady(), n;
541
+ }), await i.isReady(), i;
542
542
  }
543
543
  async compileInputBlueprint(t) {
544
- const o = this.getEffectiveBlueprint(), r = new tt();
545
- let n = "", i = !1;
546
- return r.addEventListener("progress", (a) => {
547
- if (i)
544
+ const r = this.getEffectiveBlueprint(), n = new Je();
545
+ let i = "", o = !1;
546
+ return n.addEventListener("progress", (a) => {
547
+ if (o)
548
548
  return;
549
- i = a.detail.progress === 100;
549
+ o = a.detail.progress === 100;
550
550
  const l = Math.floor(a.detail.progress);
551
- n = a.detail.caption || n || "Running Blueprint", this.cliOutput.updateProgress(n.trim(), l);
552
- }), await ge(o, {
553
- progress: r,
551
+ i = a.detail.caption || i || "Running Blueprint", this.cliOutput.updateProgress(i.trim(), l);
552
+ }), await he(r, {
553
+ progress: n,
554
554
  additionalSteps: t
555
555
  });
556
556
  }
557
557
  getEffectiveBlueprint() {
558
558
  const t = this.args.blueprint;
559
- return Oe(t) ? t : {
559
+ return _e(t) ? t : {
560
560
  login: this.args.login,
561
561
  ...t || {},
562
562
  preferredVersions: {
563
- php: this.args.php ?? t?.preferredVersions?.php ?? M,
563
+ php: this.args.php ?? t?.preferredVersions?.php ?? T,
564
564
  wp: this.args.wp ?? t?.preferredVersions?.wp ?? "latest",
565
565
  ...t?.preferredVersions || {}
566
566
  }
@@ -568,8 +568,8 @@ class Wt {
568
568
  }
569
569
  }
570
570
  async function Lt(e, t = !0) {
571
- const r = `${d.basename(process.argv0)}${e}${process.pid}-`, n = await it({
572
- prefix: r,
571
+ const n = `${d.basename(process.argv0)}${e}${process.pid}-`, i = await rt({
572
+ prefix: n,
573
573
  /*
574
574
  * Allow recursive cleanup on process exit.
575
575
  *
@@ -580,84 +580,81 @@ async function Lt(e, t = !0) {
580
580
  */
581
581
  unsafeCleanup: !0
582
582
  });
583
- return t && st(), n;
583
+ return t && ot(), i;
584
584
  }
585
- async function Ut(e, t, o) {
586
- const n = (await _t(
585
+ async function Wt(e, t, r) {
586
+ const i = (await Bt(
587
587
  e,
588
588
  t,
589
- o
589
+ r
590
590
  )).map(
591
- (i) => new Promise((a) => {
592
- p.rm(i, { recursive: !0 }, (l) => {
593
- l ? f.warn(
594
- `Failed to delete stale Playground temp dir: ${i}`,
591
+ (o) => new Promise((a) => {
592
+ c.rm(o, { recursive: !0 }, (l) => {
593
+ l ? h.warn(
594
+ `Failed to delete stale Playground temp dir: ${o}`,
595
595
  l
596
- ) : f.info(
597
- `Deleted stale Playground temp dir: ${i}`
596
+ ) : h.info(
597
+ `Deleted stale Playground temp dir: ${o}`
598
598
  ), a();
599
599
  });
600
600
  })
601
601
  );
602
- await Promise.all(n);
602
+ await Promise.all(i);
603
603
  }
604
- async function _t(e, t, o) {
604
+ async function Bt(e, t, r) {
605
605
  try {
606
- const r = p.readdirSync(o).map((i) => d.join(o, i)), n = [];
607
- for (const i of r)
608
- await Nt(
606
+ const n = c.readdirSync(r).map((o) => d.join(r, o)), i = [];
607
+ for (const o of n)
608
+ await Ut(
609
609
  e,
610
610
  t,
611
- i
612
- ) && n.push(i);
613
- return n;
614
- } catch (r) {
615
- return f.warn(`Failed to find stale Playground temp dirs: ${r}`), [];
611
+ o
612
+ ) && i.push(o);
613
+ return i;
614
+ } catch (n) {
615
+ return h.warn(`Failed to find stale Playground temp dirs: ${n}`), [];
616
616
  }
617
617
  }
618
- async function Nt(e, t, o) {
619
- if (!p.lstatSync(o).isDirectory())
618
+ async function Ut(e, t, r) {
619
+ if (!c.lstatSync(r).isDirectory())
620
620
  return !1;
621
- const n = d.basename(o);
622
- if (!n.includes(e))
621
+ const i = d.basename(r);
622
+ if (!i.includes(e))
623
623
  return !1;
624
- const i = n.match(
624
+ const o = i.match(
625
625
  new RegExp(`^(.+)${e}(\\d+)-`)
626
626
  );
627
- if (!i)
627
+ if (!o)
628
628
  return !1;
629
629
  const a = {
630
- executableName: i[1],
631
- pid: i[2]
630
+ executableName: o[1],
631
+ pid: o[2]
632
632
  };
633
- if (Ht(a.pid))
633
+ if (_t(a.pid))
634
634
  return !1;
635
635
  const l = Date.now() - t;
636
- return p.statSync(o).mtime.getTime() < l;
636
+ return c.statSync(r).mtime.getTime() < l;
637
637
  }
638
- function Ht(e, t) {
638
+ function _t(e, t) {
639
639
  try {
640
640
  return process.kill(Number(e), 0), !0;
641
- } catch (o) {
642
- const r = o, n = r && typeof r.code == "string" ? r.code : void 0;
643
- return n === "ESRCH" ? !1 : n === "EPERM" || n === "EACCES" ? (f.debug(
644
- `Permission denied while checking if process ${e} exists (code: ${n}).`,
645
- o
646
- ), !0) : (f.warn(
647
- `Could not determine if process ${e} exists due to unexpected error${n ? ` (code: ${n})` : ""}.`,
648
- o
641
+ } catch (r) {
642
+ const n = r, i = n && typeof n.code == "string" ? n.code : void 0;
643
+ return i === "ESRCH" ? !1 : i === "EPERM" || i === "EACCES" ? (h.debug(
644
+ `Permission denied while checking if process ${e} exists (code: ${i}).`,
645
+ r
646
+ ), !0) : (h.warn(
647
+ `Could not determine if process ${e} exists due to unexpected error${i ? ` (code: ${i})` : ""}.`,
648
+ r
649
649
  ), !0);
650
650
  }
651
651
  }
652
- function Ot(e) {
652
+ function Nt(e) {
653
653
  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;
654
654
  }
655
- class Ft {
656
- constructor(t) {
657
- this.lastProgressLine = "", this.progressActive = !1, this.verbosity = t.verbosity, this.writeStream = t.writeStream || process.stdout;
658
- }
659
- get isTTY() {
660
- return !!this.writeStream.isTTY;
655
+ class Ht extends nt {
656
+ constructor() {
657
+ super(...arguments), this.lastProgressLine = "", this.progressActive = !1;
661
658
  }
662
659
  /**
663
660
  * Determines if progress updates should be rendered.
@@ -666,35 +663,7 @@ class Ft {
666
663
  * This prevents progress spam in logs - users only see the final outcome.
667
664
  */
668
665
  get shouldRender() {
669
- return Ot(this.writeStream);
670
- }
671
- get isQuiet() {
672
- return this.verbosity === "quiet";
673
- }
674
- /**
675
- * ANSI formatting helpers.
676
- *
677
- * These only apply color codes when outputting to a terminal (TTY).
678
- * When piped to files or non-TTY streams, they return plain text to
679
- * avoid polluting logs with escape sequences.
680
- */
681
- bold(t) {
682
- return this.isTTY ? `\x1B[1m${t}\x1B[0m` : t;
683
- }
684
- dim(t) {
685
- return this.isTTY ? `\x1B[2m${t}\x1B[0m` : t;
686
- }
687
- green(t) {
688
- return this.isTTY ? `\x1B[32m${t}\x1B[0m` : t;
689
- }
690
- cyan(t) {
691
- return this.isTTY ? `\x1B[36m${t}\x1B[0m` : t;
692
- }
693
- yellow(t) {
694
- return this.isTTY ? `\x1B[33m${t}\x1B[0m` : t;
695
- }
696
- red(t) {
697
- return this.isTTY ? `\x1B[31m${t}\x1B[0m` : t;
666
+ return Nt(this.writeStream);
698
667
  }
699
668
  printBanner() {
700
669
  if (this.isQuiet) return;
@@ -713,19 +682,19 @@ ${t}
713
682
  */
714
683
  printConfig(t) {
715
684
  if (this.isQuiet) return;
716
- const o = [];
717
- o.push(
685
+ const r = [];
686
+ r.push(
718
687
  `${this.dim("PHP")} ${this.cyan(t.phpVersion)} ${this.dim("WordPress")} ${this.cyan(t.wpVersion)}`
719
688
  );
720
- const r = [];
721
- 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)
722
- for (const n of t.mounts) {
723
- const i = n.autoMounted ? ` ${this.dim("(auto-mount)")}` : "";
724
- o.push(
725
- `${this.dim("Mount")} ${n.hostPath} ${this.dim("→")} ${n.vfsPath}${i}`
689
+ const n = [];
690
+ if (t.intl && n.push("intl"), t.redis && n.push("redis"), t.memcached && n.push("memcached"), t.xdebug && n.push(this.yellow("xdebug")), n.length > 0 && r.push(`${this.dim("Extensions")} ${n.join(", ")}`), t.mounts.length > 0)
691
+ for (const i of t.mounts) {
692
+ const o = i.autoMounted ? ` ${this.dim("(auto-mount)")}` : "";
693
+ r.push(
694
+ `${this.dim("Mount")} ${i.hostPath} ${this.dim("→")} ${i.vfsPath}${o}`
726
695
  );
727
696
  }
728
- t.blueprint && o.push(`${this.dim("Blueprint")} ${t.blueprint}`), this.writeStream.write(o.join(`
697
+ t.blueprint && r.push(`${this.dim("Blueprint")} ${t.blueprint}`), this.writeStream.write(r.join(`
729
698
  `) + `
730
699
 
731
700
  `);
@@ -746,11 +715,11 @@ ${t}
746
715
  * Identical messages are skipped to prevent flickering. When piped,
747
716
  * this method does nothing (early return via shouldRender check).
748
717
  */
749
- updateProgress(t, o) {
718
+ updateProgress(t, r) {
750
719
  if (this.isQuiet || !this.shouldRender) return;
751
720
  this.progressActive || (this.progressActive = !0);
752
- let r = `${t}`;
753
- 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}
721
+ let n = `${t}`;
722
+ r !== void 0 && (n = `${t} ${this.dim(`${r}%`)}`), n !== this.lastProgressLine && (this.lastProgressLine = n, this.isTTY ? (this.writeStream.cursorTo(0), this.writeStream.write(n), this.writeStream.clearLine(1)) : this.writeStream.write(`${n}
754
723
  `));
755
724
  }
756
725
  /**
@@ -790,20 +759,16 @@ ${t}
790
759
  * Note: The exact wording "WordPress is running on" is checked by
791
760
  * CI tests, so changes to this string will break test assertions.
792
761
  */
793
- printReady(t, o) {
762
+ printReady(t, r) {
794
763
  if (this.isQuiet) return;
795
- const r = o === 1 ? "worker" : "workers";
764
+ const n = r === 1 ? "worker" : "workers";
796
765
  this.writeStream.write(
797
766
  `
798
- ${this.green("Ready!")} WordPress is running on ${this.bold(t)} ${this.dim(`(${o} ${r})`)}
767
+ ${this.green("Ready!")} WordPress is running on ${this.bold(t)} ${this.dim(`(${r} ${n})`)}
799
768
 
800
769
  `
801
770
  );
802
771
  }
803
- printWarning(t) {
804
- this.isQuiet || this.writeStream.write(`${this.yellow("Warning:")} ${t}
805
- `);
806
- }
807
772
  /**
808
773
  * Prints the phpMyAdmin URL when the --phpmyadmin flag is enabled.
809
774
  */
@@ -815,12 +780,12 @@ ${this.green("Ready!")} WordPress is running on ${this.bold(t)} ${this.dim(`(${o
815
780
  );
816
781
  }
817
782
  }
818
- const te = {
819
- Quiet: { name: "quiet", severity: j.Fatal },
820
- Normal: { name: "normal", severity: j.Info },
821
- Debug: { name: "debug", severity: j.Debug }
783
+ const J = {
784
+ Quiet: { name: "quiet", severity: O.Fatal },
785
+ Normal: { name: "normal", severity: O.Info },
786
+ Debug: { name: "debug", severity: O.Debug }
822
787
  };
823
- async function Vt(e) {
788
+ async function Ft(e) {
824
789
  try {
825
790
  const t = {
826
791
  "site-url": {
@@ -830,8 +795,8 @@ async function Vt(e) {
830
795
  php: {
831
796
  describe: "PHP version to use.",
832
797
  type: "string",
833
- default: M,
834
- choices: ie
798
+ default: T,
799
+ choices: re
835
800
  },
836
801
  wp: {
837
802
  describe: "WordPress version to use.",
@@ -843,21 +808,21 @@ async function Vt(e) {
843
808
  type: "string",
844
809
  nargs: 2,
845
810
  array: !0,
846
- coerce: bt
811
+ coerce: wt
847
812
  },
848
813
  "define-bool": {
849
814
  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',
850
815
  type: "string",
851
816
  nargs: 2,
852
817
  array: !0,
853
- coerce: gt
818
+ coerce: bt
854
819
  },
855
820
  "define-number": {
856
821
  describe: "Define PHP number constants (can be used multiple times). Format: NAME value. Examples: --define-number LIMIT 100 --define-number RATE 45.67",
857
822
  type: "string",
858
823
  nargs: 2,
859
824
  array: !0,
860
- coerce: Pt
825
+ coerce: yt
861
826
  },
862
827
  // @TODO: Support read-only mounts, e.g. via WORKERFS, a custom
863
828
  // ReadOnlyNODEFS, or by copying the files into MEMFS
@@ -866,28 +831,28 @@ async function Vt(e) {
866
831
  type: "array",
867
832
  string: !0,
868
833
  nargs: 1,
869
- coerce: q
834
+ coerce: V
870
835
  },
871
836
  "mount-before-install": {
872
837
  describe: "Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format: /host/path:/vfs/path",
873
838
  type: "array",
874
839
  string: !0,
875
840
  nargs: 1,
876
- coerce: q
841
+ coerce: V
877
842
  },
878
843
  "mount-dir": {
879
844
  describe: 'Mount a directory to the PHP runtime (can be used multiple times). Format: "/host/path" "/vfs/path"',
880
845
  type: "array",
881
846
  nargs: 2,
882
847
  array: !0,
883
- coerce: he
848
+ coerce: pe
884
849
  },
885
850
  "mount-dir-before-install": {
886
851
  describe: 'Mount a directory before WordPress installation (can be used multiple times). Format: "/host/path" "/vfs/path"',
887
852
  type: "string",
888
853
  nargs: 2,
889
854
  array: !0,
890
- coerce: he
855
+ coerce: pe
891
856
  },
892
857
  login: {
893
858
  describe: "Should log the user in",
@@ -934,7 +899,7 @@ async function Vt(e) {
934
899
  verbosity: {
935
900
  describe: "Output logs and progress messages.",
936
901
  type: "string",
937
- choices: Object.values(te).map(
902
+ choices: Object.values(J).map(
938
903
  (s) => s.name
939
904
  ),
940
905
  default: "normal"
@@ -1016,7 +981,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1016
981
  type: "string",
1017
982
  coerce: (s) => s === "" ? "/phpmyadmin" : s
1018
983
  }
1019
- }, o = {
984
+ }, r = {
1020
985
  port: {
1021
986
  describe: "Port to listen on when serving. Defaults to 9400 when available.",
1022
987
  type: "number"
@@ -1029,12 +994,12 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1029
994
  return;
1030
995
  if (s === "auto")
1031
996
  return "auto";
1032
- const y = Number(s);
1033
- if (!Number.isInteger(y) || y < 1)
997
+ const b = Number(s);
998
+ if (!Number.isInteger(b) || b < 1)
1034
999
  throw new Error(
1035
1000
  `Invalid --workers value "${s}": expected a positive integer or "auto".`
1036
1001
  );
1037
- return y;
1002
+ return b;
1038
1003
  }
1039
1004
  },
1040
1005
  "experimental-multi-worker": {
@@ -1046,7 +1011,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1046
1011
  describe: "Enable experimental browser development tools.",
1047
1012
  type: "boolean"
1048
1013
  }
1049
- }, r = {
1014
+ }, n = {
1050
1015
  path: {
1051
1016
  describe: "Path to the project directory. Playground will auto-detect if this is a plugin, theme, wp-content, or WordPress directory.",
1052
1017
  type: "string",
@@ -1055,8 +1020,8 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1055
1020
  php: {
1056
1021
  describe: "PHP version to use.",
1057
1022
  type: "string",
1058
- default: M,
1059
- choices: ie
1023
+ default: T,
1024
+ choices: re
1060
1025
  },
1061
1026
  wp: {
1062
1027
  describe: "WordPress version to use.",
@@ -1101,7 +1066,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1101
1066
  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.",
1102
1067
  type: "array",
1103
1068
  string: !0,
1104
- coerce: q
1069
+ coerce: V
1105
1070
  },
1106
1071
  reset: {
1107
1072
  describe: "Deletes the stored site directory and starts a new site from scratch.",
@@ -1119,13 +1084,13 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1119
1084
  "define-number": t["define-number"],
1120
1085
  // Tools
1121
1086
  phpmyadmin: t.phpmyadmin
1122
- }, n = {
1087
+ }, i = {
1123
1088
  outfile: {
1124
1089
  describe: "When building, write to this output file.",
1125
1090
  type: "string",
1126
1091
  default: "wordpress.zip"
1127
1092
  }
1128
- }, i = Qe(e).usage("Usage: wp-playground <command> [options]").command(
1093
+ }, o = ze(e).usage("Usage: wp-playground <command> [options]").command(
1129
1094
  "start",
1130
1095
  "Start a local WordPress server with automatic project detection (recommended)",
1131
1096
  (s) => s.usage(
@@ -1141,13 +1106,13 @@ Examples:
1141
1106
  wp-playground start --wp=6.7 --php=8.3 # Use specific versions
1142
1107
  wp-playground start --skip-browser # Skip opening browser
1143
1108
  wp-playground start --no-auto-mount # Disable auto-detection`
1144
- ).options(r)
1109
+ ).options(n)
1145
1110
  ).command(
1146
1111
  "server",
1147
1112
  "Start a local WordPress server (advanced, low-level)",
1148
1113
  (s) => s.options({
1149
1114
  ...t,
1150
- ...o
1115
+ ...r
1151
1116
  })
1152
1117
  ).command(
1153
1118
  "run-blueprint",
@@ -1158,7 +1123,7 @@ Examples:
1158
1123
  "Build a ZIP snapshot of a WordPress site based on a Blueprint",
1159
1124
  (s) => s.options({
1160
1125
  ...t,
1161
- ...n
1126
+ ...i
1162
1127
  })
1163
1128
  ).command(
1164
1129
  "php",
@@ -1167,13 +1132,17 @@ Examples:
1167
1132
  ).demandCommand(1, "Please specify a command").strictCommands().conflicts(
1168
1133
  "experimental-unsafe-ide-integration",
1169
1134
  "experimental-devtools"
1170
- ).showHelpOnFail(!1).fail((s, y, b) => {
1171
- if (y)
1172
- throw y;
1173
- s && s.includes("Please specify a command") && (b.showHelp(), console.error(`
1135
+ ).showHelpOnFail(!1).fail((s, b, y) => {
1136
+ if (b)
1137
+ throw b;
1138
+ s && s.includes("Please specify a command") && (y.showHelp(), console.error(`
1174
1139
  ` + s), process.exit(1)), console.error(s), process.exit(1);
1175
1140
  }).strictOptions().check(async (s) => {
1176
- if (s["skip-wordpress-install"] === !0 && (s["wordpress-install-mode"] = "do-not-attempt-installing", s.wordpressInstallMode = "do-not-attempt-installing"), s.wp !== void 0 && typeof s.wp == "string" && !Mt(s.wp))
1141
+ if (s["skip-wordpress-install"] === !0 && (s["wordpress-install-mode"] = "do-not-attempt-installing", s.wordpressInstallMode = "do-not-attempt-installing"), s.phpmyadmin && s["skip-sqlite-setup"])
1142
+ throw new Error(
1143
+ "The --phpmyadmin option requires SQLite setup. Remove --skip-sqlite-setup to use phpMyAdmin."
1144
+ );
1145
+ if (s.wp !== void 0 && typeof s.wp == "string" && !It(s.wp))
1177
1146
  try {
1178
1147
  new URL(s.wp);
1179
1148
  } catch {
@@ -1181,26 +1150,26 @@ Examples:
1181
1150
  'Unrecognized WordPress version. Please use "latest", "beta", "trunk", "nightly", a URL, or a numeric version such as "6.2", "6.0.1", "6.2-beta1", or "6.2-RC1" (see --help for details).'
1182
1151
  );
1183
1152
  }
1184
- const y = s["site-url"];
1185
- if (typeof y == "string" && y.trim() !== "")
1153
+ const b = s["site-url"];
1154
+ if (typeof b == "string" && b.trim() !== "")
1186
1155
  try {
1187
- new URL(y);
1156
+ new URL(b);
1188
1157
  } catch {
1189
1158
  throw new Error(
1190
- `Invalid site-url "${y}". Please provide a valid URL (e.g., http://localhost:8080 or https://example.com)`
1159
+ `Invalid site-url "${b}". Please provide a valid URL (e.g., http://localhost:8080 or https://example.com)`
1191
1160
  );
1192
1161
  }
1193
- const b = s.autoMount;
1194
- if (s._[0] !== "start" && typeof b == "string" && b) {
1162
+ const y = s.autoMount;
1163
+ if (s._[0] !== "start" && typeof y == "string" && y) {
1195
1164
  let x = !1;
1196
1165
  try {
1197
- x = p.statSync(b).isDirectory();
1166
+ x = c.statSync(y).isDirectory();
1198
1167
  } catch {
1199
1168
  x = !1;
1200
1169
  }
1201
1170
  if (!x)
1202
1171
  throw new Error(
1203
- `The specified --auto-mount path is not a directory: '${b}'.`
1172
+ `The specified --auto-mount path is not a directory: '${y}'.`
1204
1173
  );
1205
1174
  }
1206
1175
  if (s["experimental-blueprints-v2-runner"] === !0)
@@ -1213,18 +1182,18 @@ Examples:
1213
1182
  );
1214
1183
  return !0;
1215
1184
  });
1216
- i.wrap(i.terminalWidth());
1217
- const a = await i.argv, l = a._[0];
1185
+ o.wrap(o.terminalWidth());
1186
+ const a = await o.argv, l = a._[0];
1218
1187
  [
1219
1188
  "start",
1220
1189
  "run-blueprint",
1221
1190
  "server",
1222
1191
  "build-snapshot",
1223
1192
  "php"
1224
- ].includes(l) || (i.showHelp(), process.exit(1));
1225
- const u = a.define || {}, h = a["define-bool"] || {}, A = a["define-number"] || {}, E = (s) => s in u || s in h || s in A, m = a.php || M;
1226
- Z(m) || (E("WP_DEBUG") || (u.WP_DEBUG = "true"), E("WP_DEBUG_LOG") || (u.WP_DEBUG_LOG = "true"), E("WP_DEBUG_DISPLAY") || (u.WP_DEBUG_DISPLAY = "false"));
1227
- const T = {
1193
+ ].includes(l) || (o.showHelp(), process.exit(1));
1194
+ const u = a.define || {}, f = a["define-bool"] || {}, A = a["define-number"] || {}, E = (s) => s in u || s in f || s in A, m = a.php || T;
1195
+ Y(m) || (E("WP_DEBUG") || (u.WP_DEBUG = "true"), E("WP_DEBUG_LOG") || (u.WP_DEBUG_LOG = "true"), E("WP_DEBUG_DISPLAY") || (u.WP_DEBUG_DISPLAY = "false"));
1196
+ const k = {
1228
1197
  ...a,
1229
1198
  define: u,
1230
1199
  command: l,
@@ -1236,47 +1205,47 @@ Examples:
1236
1205
  ...a["mount-before-install"] || [],
1237
1206
  ...a["mount-dir-before-install"] || []
1238
1207
  ]
1239
- }, I = await ke(T);
1240
- I === void 0 && process.exit(0);
1241
- const B = /* @__PURE__ */ (() => {
1208
+ }, M = await Ee(k);
1209
+ M === void 0 && process.exit(0);
1210
+ const D = /* @__PURE__ */ (() => {
1242
1211
  let s;
1243
1212
  return async () => {
1244
- s === void 0 && (s = I[Symbol.asyncDispose]()), await s, process.exit(0);
1213
+ s === void 0 && (s = M[Symbol.asyncDispose]()), await s, process.exit(0);
1245
1214
  };
1246
1215
  })();
1247
- return process.on("SIGINT", B), process.on("SIGTERM", B), {
1216
+ return process.on("SIGINT", D), process.on("SIGTERM", D), {
1248
1217
  [Symbol.asyncDispose]: async () => {
1249
- process.off("SIGINT", B), process.off("SIGTERM", B), await I[Symbol.asyncDispose]();
1218
+ process.off("SIGINT", D), process.off("SIGTERM", D), await M[Symbol.asyncDispose]();
1250
1219
  },
1251
- [oe]: { cliServer: I }
1220
+ [K]: { cliServer: M }
1252
1221
  };
1253
1222
  } catch (t) {
1254
1223
  console.error(t);
1255
- const o = process.argv.includes("--debug");
1224
+ const r = process.argv.includes("--debug");
1256
1225
  if (t instanceof Error)
1257
- if (o)
1258
- De(t);
1226
+ if (r)
1227
+ Ce(t);
1259
1228
  else {
1260
- const r = [];
1261
- let n = t;
1229
+ const n = [];
1230
+ let i = t;
1262
1231
  do
1263
- r.push(n.message), n = n.cause;
1264
- while (n instanceof Error);
1232
+ n.push(i.message), i = i.cause;
1233
+ while (i instanceof Error);
1265
1234
  console.error(
1266
- "\x1B[1m" + r.join(" caused by: ") + "\x1B[0m"
1235
+ "\x1B[1m" + n.join(" caused by: ") + "\x1B[0m"
1267
1236
  );
1268
1237
  }
1269
1238
  else
1270
- console.error("\x1B[1m" + $e(t) + "\x1B[0m");
1239
+ console.error("\x1B[1m" + Se(t) + "\x1B[0m");
1271
1240
  process.exit(1);
1272
1241
  }
1273
1242
  }
1274
- function $e(e) {
1243
+ function Se(e) {
1275
1244
  if (e instanceof Error)
1276
1245
  return e.message;
1277
1246
  if (e && typeof e == "object") {
1278
- const t = [], o = e;
1279
- if (o.name && t.push(String(o.name)), o.message && t.push(String(o.message)), o.errno !== void 0 && t.push(`errno: ${o.errno}`), t.length > 0)
1247
+ const t = [], r = e;
1248
+ if (r.name && t.push(String(r.name)), r.message && t.push(String(r.message)), r.errno !== void 0 && t.push(`errno: ${r.errno}`), t.length > 0)
1280
1249
  return t.join(" — ");
1281
1250
  try {
1282
1251
  return JSON.stringify(e);
@@ -1286,36 +1255,34 @@ function $e(e) {
1286
1255
  }
1287
1256
  return String(e);
1288
1257
  }
1289
- function we(e, t) {
1258
+ function me(e, t) {
1290
1259
  return e.find(
1291
- (o) => o.vfsPath.replace(/\/$/, "") === t.replace(/\/$/, "")
1260
+ (r) => r.vfsPath.replace(/\/$/, "") === t.replace(/\/$/, "")
1292
1261
  );
1293
1262
  }
1294
- function Te(e) {
1295
- const t = Math.max(1, U.cpus().length - 1);
1263
+ function xe(e) {
1264
+ const t = Math.max(1, B.cpus().length - 1);
1296
1265
  return e === void 0 ? Math.min(6, t) : e === "auto" ? t : e;
1297
1266
  }
1298
- const oe = Symbol("playground-cli-testing"), D = (e) => process.stdout.isTTY ? "\x1B[1m" + e + "\x1B[0m" : e, jt = (e) => process.stdout.isTTY ? "\x1B[31m" + e + "\x1B[0m" : e, ye = (e) => process.stdout.isTTY ? `\x1B[2m${e}\x1B[0m` : e, N = (e) => process.stdout.isTTY ? `\x1B[3m${e}\x1B[0m` : e, z = (e) => process.stdout.isTTY ? `\x1B[33m${e}\x1B[0m` : e;
1299
- async function ke(e) {
1267
+ const K = Symbol("playground-cli-testing");
1268
+ async function Ee(e) {
1300
1269
  let t;
1301
- const o = e.internalCookieStore ? new Re() : void 0, r = [], n = /* @__PURE__ */ new Map();
1302
- if (e.command === "start" && (e = Yt(e)), e.autoMount !== void 0 && (e.autoMount === "" && (e = { ...e, autoMount: process.cwd() }), e = xe(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) {
1303
- const m = Object.values(te).find(
1270
+ const r = e.internalCookieStore ? new Ae() : void 0, n = [], i = /* @__PURE__ */ new Map(), o = new Ht({
1271
+ verbosity: e.verbosity || "normal"
1272
+ });
1273
+ if (e.command === "start" && (e = Ot(e, o)), e.autoMount !== void 0 && (e.autoMount === "" && (e = { ...e, autoMount: process.cwd() }), e = ge(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) {
1274
+ const m = Object.values(J).find(
1304
1275
  ($) => $.name === e.verbosity
1305
1276
  ).severity;
1306
- f.setSeverityFilterLevel(m);
1277
+ h.setSeverityFilterLevel(m);
1307
1278
  }
1308
- e.intl || (e.intl = !0), e.redis === void 0 && (e.redis = await me()), e.memcached === void 0 && (e.memcached = await me()), Z(e.php || M) && (e.intl = !1, e.redis = !1, e.memcached = !1, e.xdebug = !1), e.phpmyadmin && (e.phpmyadmin === !0 && (e.phpmyadmin = "/phpmyadmin"), e.pathAliases = [
1279
+ e.intl || (e.intl = !0), e.redis === void 0 && (e.redis = await de()), e.memcached === void 0 && (e.memcached = await de()), Y(e.php || T) && (e.intl = !1, e.redis = !1, e.memcached = !1, e.xdebug = !1), e.phpmyadmin && (e.phpmyadmin === !0 && (e.phpmyadmin = "/phpmyadmin"), e.pathAliases = [
1309
1280
  {
1310
1281
  urlPrefix: e.phpmyadmin,
1311
- fsPath: pe
1282
+ fsPath: ue
1312
1283
  }
1313
- ]);
1314
- const a = new Ft({
1315
- verbosity: e.verbosity || "normal"
1316
- });
1317
- e.command === "server" && (a.printBanner(), a.printConfig({
1318
- phpVersion: e.php || M,
1284
+ ]), e.command === "server" && (o.printBanner(), o.printConfig({
1285
+ phpVersion: e.php || T,
1319
1286
  wpVersion: e.wp || "latest",
1320
1287
  port: e.port ?? 9400,
1321
1288
  xdebug: !!e.xdebug,
@@ -1328,120 +1295,134 @@ async function ke(e) {
1328
1295
  ],
1329
1296
  blueprint: typeof e.blueprint == "string" ? e.blueprint : void 0
1330
1297
  }));
1331
- const l = e.command === "server" ? e.port ?? 9400 : 0, u = new We();
1332
- let h = !1, A = !0;
1333
- const E = await Et({
1334
- port: e.port ? e.port : await xt(l) ? 0 : l,
1298
+ const l = e.command === "server" ? e.port ?? 9400 : 0, u = new De();
1299
+ let f = !1, A = !0;
1300
+ const E = await St({
1301
+ port: e.port ? e.port : await vt(l) ? 0 : l,
1335
1302
  onBind: async (m, $) => {
1336
- const T = "127.0.0.1", I = `http://${T}:${$}`, B = e["site-url"] || I;
1337
- e["experimental-multi-worker"] !== void 0 && f.warn(
1303
+ const k = "127.0.0.1", M = `http://${k}:${$}`, D = e["site-url"] || M;
1304
+ e["experimental-multi-worker"] !== void 0 && h.warn(
1338
1305
  "--experimental-multi-worker is deprecated and its value is ignored. Use --workers=<n|auto> instead."
1339
1306
  );
1340
- const s = Te(e.workers);
1307
+ const s = xe(e.workers);
1341
1308
  if (s < 6) {
1342
- const c = "Running fewer than 6 workers may increase the likelihood of deadlock due to workers blocking on file locks.";
1343
- e.workers === void 0 ? f.warn(
1344
- `The default worker count has been reduced to ${s} because this machine has only ${U.cpus().length} CPU(s). ` + c
1345
- ) : f.warn(
1346
- `Worker count (${s}) is below the recommended threshold (6). ` + c
1309
+ const p = "Running fewer than 6 workers may increase the likelihood of deadlock due to workers blocking on file locks.";
1310
+ e.workers === void 0 ? h.warn(
1311
+ `The default worker count has been reduced to ${s} because this machine has only ${B.cpus().length} CPU(s). ` + p
1312
+ ) : h.warn(
1313
+ `Worker count (${s}) is below the recommended threshold (6). ` + p
1347
1314
  );
1348
1315
  }
1349
- const y = "-playground-cli-site-", b = await Lt(y);
1350
- f.debug(`Native temp dir for VFS root: ${b.path}`);
1351
- const x = "WP Playground CLI - Listen for Xdebug", O = ".playground-xdebug-root", F = d.join(process.cwd(), O);
1352
- if (await at(F), e.xdebug) {
1353
- const c = {
1354
- hostPath: d.join(".", d.sep, O),
1316
+ const b = "-playground-cli-site-", y = await Lt(b);
1317
+ h.debug(`Native temp dir for VFS root: ${y.path}`);
1318
+ const x = "WP Playground CLI - Listen for Xdebug", N = ".playground-xdebug-root", H = d.join(process.cwd(), N);
1319
+ if (await it(H), e.xdebug) {
1320
+ const p = {
1321
+ hostPath: d.join(".", d.sep, N),
1355
1322
  vfsPath: "/"
1356
- }, w = e.php || M;
1357
- if (Y.includes(w) && Y.indexOf(w) <= Y.indexOf("8.5"))
1358
- await de(
1359
- b.path,
1360
- F,
1323
+ }, w = e.php || T;
1324
+ if (j.includes(w) && j.indexOf(w) <= j.indexOf("8.5"))
1325
+ await ae(
1326
+ y.path,
1327
+ H,
1361
1328
  process.platform
1362
- ), e.xdebug = lt({
1329
+ ), e.xdebug = st({
1363
1330
  cwd: process.cwd(),
1364
1331
  mounts: [
1365
- c,
1332
+ p,
1366
1333
  ...e["mount-before-install"] || [],
1367
1334
  ...e.mount || []
1368
1335
  ],
1369
- pathSkippings: [...ce]
1370
- }), console.log(D("Xdebug configured successfully")), console.log(
1371
- z("Playground source root: ") + ".playground-xdebug-root" + N(
1372
- ye(
1336
+ pathSkippings: [...le]
1337
+ }), o.print(
1338
+ o.bold("Xdebug configured successfully")
1339
+ ), o.print(
1340
+ o.highlight("Playground source root: ") + ".playground-xdebug-root" + o.italic(
1341
+ o.dim(
1373
1342
  " – you can set breakpoints and preview Playground's VFS structure in there."
1374
1343
  )
1375
1344
  )
1376
1345
  );
1377
1346
  else if (e.experimentalUnsafeIdeIntegration) {
1378
- await de(
1379
- b.path,
1380
- F,
1347
+ await ae(
1348
+ y.path,
1349
+ H,
1381
1350
  process.platform
1382
1351
  );
1383
1352
  try {
1384
- await ut(
1353
+ await at(
1385
1354
  x,
1386
1355
  process.cwd()
1387
1356
  );
1388
- const P = typeof e.xdebug == "object" ? e.xdebug : {}, v = await dt({
1357
+ const P = typeof e.xdebug == "object" ? e.xdebug : {}, v = await lt({
1389
1358
  name: x,
1390
- host: T,
1359
+ host: k,
1391
1360
  port: $,
1392
1361
  ides: e.experimentalUnsafeIdeIntegration,
1393
1362
  cwd: process.cwd(),
1394
1363
  mounts: [
1395
- c,
1364
+ p,
1396
1365
  ...e["mount-before-install"] || [],
1397
1366
  ...e.mount || []
1398
1367
  ],
1399
- pathSkippings: [...ce],
1368
+ pathSkippings: [...le],
1400
1369
  ideKey: P.ideKey || "WPPLAYGROUNDCLI"
1401
- }), S = e.experimentalUnsafeIdeIntegration, k = S.includes("vscode"), _ = S.includes("phpstorm"), W = Object.values(v);
1402
- console.log(""), W.length > 0 ? (console.log(
1403
- D("Xdebug configured successfully")
1404
- ), console.log(
1405
- z("Updated IDE config: ") + W.join(" ")
1406
- ), console.log(
1407
- z("Playground source root: ") + ".playground-xdebug-root" + N(
1408
- ye(
1370
+ }), S = e.experimentalUnsafeIdeIntegration, I = S.includes("vscode"), U = S.includes("phpstorm"), L = Object.values(v);
1371
+ o.print(""), L.length > 0 ? (o.print(
1372
+ o.bold(
1373
+ "Xdebug configured successfully"
1374
+ )
1375
+ ), o.print(
1376
+ o.highlight(
1377
+ "Updated IDE config: "
1378
+ ) + L.join(" ")
1379
+ ), o.print(
1380
+ o.highlight(
1381
+ "Playground source root: "
1382
+ ) + ".playground-xdebug-root" + o.italic(
1383
+ o.dim(
1409
1384
  " – you can set breakpoints and preview Playground's VFS structure in there."
1410
1385
  )
1411
1386
  )
1412
- )) : (console.log(
1413
- D("Xdebug configuration failed.")
1414
- ), console.log(
1387
+ )) : (o.print(
1388
+ o.bold(
1389
+ "Xdebug configuration failed."
1390
+ )
1391
+ ), o.print(
1415
1392
  "No IDE-specific project settings directory was found in the current working directory."
1416
- )), console.log(""), k && v.vscode && (console.log(
1417
- D("VS Code / Cursor instructions:")
1418
- ), console.log(
1393
+ )), o.print(""), I && v.vscode && (o.print(
1394
+ o.bold(
1395
+ "VS Code / Cursor instructions:"
1396
+ )
1397
+ ), o.print(
1419
1398
  " 1. Ensure you have installed an IDE extension for PHP Debugging"
1420
- ), console.log(
1421
- ` (The ${D("PHP Debug")} extension by ${D(
1399
+ ), o.print(
1400
+ ` (The ${o.bold("PHP Debug")} extension by ${o.bold(
1422
1401
  "Xdebug"
1423
1402
  )} has been a solid option)`
1424
- ), console.log(
1403
+ ), o.print(
1425
1404
  " 2. Open the Run and Debug panel on the left sidebar"
1426
- ), console.log(
1427
- ` 3. Select "${N(
1405
+ ), o.print(
1406
+ ` 3. Select "${o.italic(
1428
1407
  x
1429
1408
  )}" from the dropdown`
1430
- ), console.log(' 3. Click "start debugging"'), console.log(
1409
+ ), o.print(' 4. Click "start debugging"'), o.print(
1431
1410
  " 5. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"
1432
- ), console.log(
1411
+ ), o.print(
1433
1412
  " 6. Visit Playground in your browser to hit the breakpoint"
1434
- ), _ && console.log("")), _ && v.phpstorm && (console.log(D("PhpStorm instructions:")), console.log(
1435
- ` 1. Choose "${N(
1413
+ ), U && o.print("")), U && v.phpstorm && (o.print(
1414
+ o.bold("PhpStorm instructions:")
1415
+ ), o.print(
1416
+ ` 1. Choose "${o.italic(
1436
1417
  x
1437
1418
  )}" debug configuration in the toolbar`
1438
- ), console.log(
1439
- " 2. Click the debug button (bug icon)`"
1440
- ), console.log(
1419
+ ), o.print(
1420
+ " 2. Click the debug button (bug icon)"
1421
+ ), o.print(
1441
1422
  " 3. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"
1442
- ), console.log(
1423
+ ), o.print(
1443
1424
  " 4. Visit Playground in your browser to hit the breakpoint"
1444
- )), console.log("");
1425
+ )), o.print("");
1445
1426
  } catch (P) {
1446
1427
  throw new Error("Could not configure Xdebug", {
1447
1428
  cause: P
@@ -1449,15 +1430,15 @@ async function ke(e) {
1449
1430
  }
1450
1431
  }
1451
1432
  }
1452
- const Me = d.dirname(b.path), Ce = 2 * 24 * 60 * 60 * 1e3;
1453
- Ut(
1454
- y,
1455
- Ce,
1456
- Me
1433
+ const ke = d.dirname(y.path), Ie = 2 * 24 * 60 * 60 * 1e3;
1434
+ Wt(
1435
+ b,
1436
+ Ie,
1437
+ ke
1457
1438
  );
1458
- const re = d.join(b.path, "internal");
1459
- Q(re);
1460
- const Ae = [
1439
+ const ee = d.join(y.path, "internal");
1440
+ z(ee);
1441
+ const Me = [
1461
1442
  "wordpress",
1462
1443
  "tools",
1463
1444
  // Note: These dirs are from Emscripten's "default dirs" list:
@@ -1469,87 +1450,87 @@ async function ke(e) {
1469
1450
  "tmp",
1470
1451
  "home"
1471
1452
  ];
1472
- for (const c of Ae) {
1473
- const w = (P) => P.vfsPath === `/${c}`;
1453
+ for (const p of Me) {
1454
+ const w = (P) => P.vfsPath === `/${p}`;
1474
1455
  if (!(e["mount-before-install"]?.some(w) || e.mount?.some(w))) {
1475
1456
  const P = d.join(
1476
- b.path,
1477
- c
1457
+ y.path,
1458
+ p
1478
1459
  );
1479
- Q(P), e["mount-before-install"] === void 0 && (e["mount-before-install"] = []), e["mount-before-install"].unshift({
1480
- vfsPath: `/${c}`,
1460
+ z(P), e["mount-before-install"] === void 0 && (e["mount-before-install"] = []), e["mount-before-install"].unshift({
1461
+ vfsPath: `/${p}`,
1481
1462
  hostPath: P
1482
1463
  });
1483
1464
  }
1484
1465
  }
1485
1466
  if (e["mount-before-install"])
1486
- for (const c of e["mount-before-install"])
1487
- f.debug(
1488
- `Mount before WP install: ${c.vfsPath} -> ${c.hostPath}`
1467
+ for (const p of e["mount-before-install"])
1468
+ h.debug(
1469
+ `Mount before WP install: ${p.vfsPath} -> ${p.hostPath}`
1489
1470
  );
1490
1471
  if (e.mount)
1491
- for (const c of e.mount)
1492
- f.debug(
1493
- `Mount after WP install: ${c.vfsPath} -> ${c.hostPath}`
1472
+ for (const p of e.mount)
1473
+ h.debug(
1474
+ `Mount after WP install: ${p.vfsPath} -> ${p.hostPath}`
1494
1475
  );
1495
1476
  let R;
1496
- e["experimental-blueprints-v2-runner"] ? R = new At(e, {
1497
- siteUrl: B,
1498
- cliOutput: a
1499
- }) : (R = new Wt(e, {
1500
- siteUrl: B,
1501
- cliOutput: a
1502
- }), typeof e.blueprint == "string" && (e.blueprint = await Ct({
1477
+ e["experimental-blueprints-v2-runner"] ? R = new Tt(e, {
1478
+ siteUrl: D,
1479
+ cliOutput: o
1480
+ }) : (R = new Rt(e, {
1481
+ siteUrl: D,
1482
+ cliOutput: o
1483
+ }), typeof e.blueprint == "string" && (e.blueprint = await Mt({
1503
1484
  sourceString: e.blueprint,
1504
1485
  blueprintMayReadAdjacentFiles: e["blueprint-may-read-adjacent-files"] === !0
1505
1486
  })));
1506
- let V = !1;
1507
- const L = async function() {
1508
- V || (V = !0, await Promise.all(
1509
- r.map(async (w) => {
1510
- await n.get(w)?.dispose(), await w.worker.terminate();
1487
+ let F = !1;
1488
+ const W = async function() {
1489
+ F || (F = !0, await Promise.all(
1490
+ n.map(async (w) => {
1491
+ await i.get(w)?.dispose(), await w.worker.terminate();
1511
1492
  })
1512
1493
  ), m && await new Promise((w) => {
1513
1494
  m.close(w), m.closeAllConnections();
1514
- }), await b.cleanup());
1495
+ }), await y.cleanup());
1515
1496
  };
1516
1497
  try {
1517
- const c = [], w = R.getWorkerType();
1498
+ const p = [], w = R.getWorkerType();
1518
1499
  for (let g = 0; g < s; g++) {
1519
- const P = Ie(w, {
1500
+ const P = $e(w, {
1520
1501
  onExit: (v) => {
1521
- V || v !== 0 && f.error(
1502
+ F || v !== 0 && h.error(
1522
1503
  `Worker ${g} exited with code ${v}
1523
1504
  `
1524
1505
  );
1525
1506
  }
1526
1507
  }).then(
1527
1508
  async (v) => {
1528
- r.push(v);
1529
- const S = await qt(u), k = await R.bootRequestHandler({
1509
+ n.push(v);
1510
+ const S = await jt(u), I = await R.bootRequestHandler({
1530
1511
  worker: v,
1531
1512
  fileLockManagerPort: S,
1532
- nativeInternalDirPath: re
1513
+ nativeInternalDirPath: ee
1533
1514
  });
1534
- return n.set(
1515
+ return i.set(
1535
1516
  v,
1536
- k
1537
- ), [v, k];
1517
+ I
1518
+ ), [v, I];
1538
1519
  }
1539
1520
  );
1540
- c.push(P), g === 0 && await P;
1521
+ p.push(P), g === 0 && await P;
1541
1522
  }
1542
- await Promise.all(c), t = Le(
1543
- r.map(
1544
- (g) => n.get(g)
1523
+ await Promise.all(p), t = Re(
1524
+ n.map(
1525
+ (g) => i.get(g)
1545
1526
  )
1546
1527
  );
1547
1528
  {
1548
- const g = new Pe(), P = g.port1, v = g.port2;
1549
- if (await Ue(
1529
+ const g = new we(), P = g.port1, v = g.port2;
1530
+ if (await Le(
1550
1531
  {
1551
1532
  applyPostInstallMountsToAllWorkers: async () => {
1552
- for (const S of n.values())
1533
+ for (const S of i.values())
1553
1534
  await S.mountAfterWordPressInstall(
1554
1535
  e.mount || []
1555
1536
  );
@@ -1560,26 +1541,26 @@ async function ke(e) {
1560
1541
  ), await R.bootWordPress(
1561
1542
  t,
1562
1543
  v
1563
- ), P.close(), h = !0, !e["experimental-blueprints-v2-runner"]) {
1544
+ ), P.close(), f = !0, !e["experimental-blueprints-v2-runner"]) {
1564
1545
  const S = await R.compileInputBlueprint(
1565
1546
  e["additional-blueprint-steps"] || []
1566
1547
  );
1567
- S && await le(
1548
+ S && await ie(
1568
1549
  S,
1569
1550
  t
1570
1551
  );
1571
1552
  }
1572
1553
  if (e.phpmyadmin && !await t.fileExists(
1573
- `${pe}/index.php`
1554
+ `${ue}/index.php`
1574
1555
  )) {
1575
- const S = await pt(), k = await ge({ steps: S });
1576
- await le(k, t);
1556
+ const S = await dt(), I = await he({ steps: S });
1557
+ await ie(I, t);
1577
1558
  }
1578
1559
  if (e.command === "build-snapshot") {
1579
- await Gt(t, e.outfile), a.printStatus(`Exported to ${e.outfile}`), await L();
1560
+ await qt(t, e.outfile), o.printStatus(`Exported to ${e.outfile}`), await W();
1580
1561
  return;
1581
1562
  } else if (e.command === "run-blueprint") {
1582
- a.finishProgress("Done"), await L();
1563
+ o.finishProgress("Done"), await W();
1583
1564
  return;
1584
1565
  } else if (e.command === "php") {
1585
1566
  const S = [
@@ -1587,76 +1568,76 @@ async function ke(e) {
1587
1568
  // Hardcoding it feels fragile.
1588
1569
  "/internal/shared/bin/php",
1589
1570
  ...(e._ || []).slice(1)
1590
- ], k = await t.cli(S), [_] = await Promise.all([
1591
- k.exitCode,
1592
- k.stdout.pipeTo(
1571
+ ], I = await t.cli(S), [U] = await Promise.all([
1572
+ I.exitCode,
1573
+ I.stdout.pipeTo(
1593
1574
  new WritableStream({
1594
- write(W) {
1595
- process.stdout.write(W);
1575
+ write(L) {
1576
+ process.stdout.write(L);
1596
1577
  }
1597
1578
  })
1598
1579
  ),
1599
- k.stderr.pipeTo(
1580
+ I.stderr.pipeTo(
1600
1581
  new WritableStream({
1601
- write(W) {
1602
- process.stderr.write(W);
1582
+ write(L) {
1583
+ process.stderr.write(L);
1603
1584
  }
1604
1585
  })
1605
1586
  )
1606
1587
  ]);
1607
- await L(), process.exit(_);
1588
+ await W(), process.exit(U);
1608
1589
  }
1609
1590
  }
1610
- if (a.finishProgress(), a.printReady(I, s), e.phpmyadmin) {
1591
+ if (o.finishProgress(), o.printReady(M, s), e.phpmyadmin) {
1611
1592
  const g = d.join(
1612
1593
  e.phpmyadmin,
1613
- mt
1594
+ pt
1614
1595
  );
1615
- a.printPhpMyAdminUrl(
1616
- new URL(g, I).toString()
1596
+ o.printPhpMyAdminUrl(
1597
+ new URL(g, M).toString()
1617
1598
  );
1618
1599
  }
1619
- return e.xdebug && e.experimentalDevtools && (await nt({
1600
+ return e.xdebug && e.experimentalDevtools && (await tt({
1620
1601
  phpInstance: t,
1621
1602
  phpRoot: "/wordpress"
1622
1603
  })).start(), {
1623
1604
  playground: t,
1624
1605
  server: m,
1625
- serverUrl: I,
1626
- [Symbol.asyncDispose]: L,
1627
- [oe]: {
1606
+ serverUrl: M,
1607
+ [Symbol.asyncDispose]: W,
1608
+ [K]: {
1628
1609
  workerThreadCount: s
1629
1610
  }
1630
1611
  };
1631
- } catch (c) {
1612
+ } catch (p) {
1632
1613
  if (e.verbosity !== "debug")
1633
- throw c;
1614
+ throw p;
1634
1615
  let w = "";
1635
- throw await t?.fileExists(ne) && (w = await t.readFileAsText(ne)), await L(), new Error(w, { cause: c });
1616
+ throw await t?.fileExists(te) && (w = await t.readFileAsText(te)), await W(), new Error(w, { cause: p });
1636
1617
  }
1637
1618
  },
1638
1619
  async handleRequest(m) {
1639
- if (!h)
1640
- return se.forHttpCode(
1620
+ if (!f)
1621
+ return oe.forHttpCode(
1641
1622
  502,
1642
1623
  "WordPress is not ready yet"
1643
1624
  );
1644
1625
  if (A) {
1645
1626
  A = !1;
1646
- const T = {
1627
+ const k = {
1647
1628
  "Content-Type": ["text/plain"],
1648
1629
  "Content-Length": ["0"],
1649
1630
  Location: [m.url]
1650
1631
  };
1651
1632
  return m.headers?.cookie?.includes(
1652
1633
  "playground_auto_login_already_happened"
1653
- ) && (T["Set-Cookie"] = [
1634
+ ) && (k["Set-Cookie"] = [
1654
1635
  "playground_auto_login_already_happened=1; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/"
1655
- ]), se.fromPHPResponse(
1656
- new _e(302, T, new Uint8Array())
1636
+ ]), oe.fromPHPResponse(
1637
+ new We(302, k, new Uint8Array())
1657
1638
  );
1658
1639
  }
1659
- o && (m = {
1640
+ r && (m = {
1660
1641
  ...m,
1661
1642
  headers: {
1662
1643
  ...m.headers,
@@ -1665,49 +1646,51 @@ async function ke(e) {
1665
1646
  // header with the cookies from our store. This avoids
1666
1647
  // getting into a strange state where both browser and
1667
1648
  // server are managing cookies.
1668
- cookie: o.getCookieRequestHeader()
1649
+ cookie: r.getCookieRequestHeader()
1669
1650
  }
1670
1651
  });
1671
1652
  const $ = await t.requestStreamed(m);
1672
- if (o) {
1673
- const T = await $.headers;
1674
- o.rememberCookiesFromResponseHeaders(T), delete T["set-cookie"];
1653
+ if (r) {
1654
+ const k = await $.headers;
1655
+ r.rememberCookiesFromResponseHeaders(k), delete k["set-cookie"];
1675
1656
  }
1676
1657
  return $;
1677
1658
  }
1678
1659
  }).catch((m) => {
1679
- a.printError($e(m)), process.exit(1);
1660
+ o.printError(Se(m)), process.exit(1);
1680
1661
  });
1681
- return E && e.command === "start" && !e.skipBrowser && zt(E.serverUrl), E;
1662
+ return E && e.command === "start" && !e.skipBrowser && Vt(E.serverUrl), E;
1682
1663
  }
1683
- function Yt(e) {
1684
- let t = { ...e, command: "server" };
1685
- const o = e.autoMount !== !1;
1686
- delete t.autoMount, delete t["auto-mount"], o && (t.autoMount = d.resolve(process.cwd(), t.path ?? ""), t = xe(t), delete t.autoMount);
1687
- const r = we(
1688
- t["mount-before-install"] || [],
1664
+ function Ot(e, t) {
1665
+ let r = { ...e, command: "server" };
1666
+ const n = e.autoMount !== !1;
1667
+ delete r.autoMount, delete r["auto-mount"], n && (r.autoMount = d.resolve(process.cwd(), r.path ?? ""), r = ge(r), delete r.autoMount);
1668
+ const i = me(
1669
+ r["mount-before-install"] || [],
1689
1670
  "/wordpress"
1690
- ) || we(t.mount || [], "/wordpress");
1691
- if (r)
1692
- console.log("Site files stored at:", r?.hostPath), e.reset && (console.log(""), console.log(
1693
- jt(
1671
+ ) || me(r.mount || [], "/wordpress");
1672
+ if (i)
1673
+ t.print(
1674
+ `Site files stored at: ${i?.hostPath}`
1675
+ ), e.reset && (t.print(""), t.print(
1676
+ t.red(
1694
1677
  "This site is not managed by Playground CLI and cannot be reset."
1695
1678
  )
1696
- ), console.log(
1679
+ ), t.print(
1697
1680
  "(It's not stored in the ~/.wordpress-playground/sites/<site-id> directory.)"
1698
- ), console.log(""), console.log(
1681
+ ), t.print(""), t.print(
1699
1682
  "You may still remove the site's directory manually if you wish."
1700
1683
  ), process.exit(1));
1701
1684
  else {
1702
- const n = t.autoMount || process.cwd(), i = ct("sha256").update(n).digest("hex"), a = U.homedir(), l = d.join(
1703
- a,
1685
+ const o = r.autoMount || process.cwd(), a = ut("sha256").update(o).digest("hex"), l = B.homedir(), u = d.join(
1686
+ l,
1704
1687
  ".wordpress-playground/sites",
1705
- i
1688
+ a
1706
1689
  );
1707
- console.log("Site files stored at:", l), J(l) && e.reset && (console.log("Resetting site..."), Ve(l, { recursive: !0 })), Q(l, { recursive: !0 }), t["mount-before-install"] = [
1708
- ...t["mount-before-install"] || [],
1709
- { vfsPath: "/wordpress", hostPath: l }
1710
- ], t.wordpressInstallMode = je(l).length === 0 ? (
1690
+ t.print(`Site files stored at: ${u}`), Q(u) && e.reset && (t.print("Resetting site..."), He(u, { recursive: !0 })), z(u, { recursive: !0 }), r["mount-before-install"] = [
1691
+ ...r["mount-before-install"] || [],
1692
+ { vfsPath: "/wordpress", hostPath: u }
1693
+ ], r.wordpressInstallMode = Fe(u).length === 0 ? (
1711
1694
  // Only download WordPress on the first run when the site directory is still
1712
1695
  // empty.
1713
1696
  "download-and-install"
@@ -1716,58 +1699,58 @@ function Yt(e) {
1716
1699
  "install-from-existing-files-if-needed"
1717
1700
  );
1718
1701
  }
1719
- return t;
1702
+ return r;
1720
1703
  }
1721
- const G = new Be();
1722
- function Ie(e, { onExit: t } = {}) {
1723
- let o;
1724
- return e === "v1" ? o = new ue(new URL("./worker-thread-v1.js", import.meta.url)) : o = new ue(new URL("./worker-thread-v2.js", import.meta.url)), new Promise((r, n) => {
1725
- const i = G.claim();
1726
- o.once("message", function(l) {
1727
- l.command === "worker-script-initialized" && r({
1728
- processId: i,
1729
- worker: o,
1704
+ const q = new Te();
1705
+ function $e(e, { onExit: t } = {}) {
1706
+ let r;
1707
+ return e === "v1" ? r = new se(new URL("./worker-thread-v1.js", import.meta.url)) : r = new se(new URL("./worker-thread-v2.js", import.meta.url)), new Promise((n, i) => {
1708
+ const o = q.claim();
1709
+ r.once("message", function(l) {
1710
+ l.command === "worker-script-initialized" && n({
1711
+ processId: o,
1712
+ worker: r,
1730
1713
  phpPort: l.phpPort
1731
1714
  });
1732
- }), o.once("error", function(l) {
1733
- G.release(i), console.error(l);
1734
- const u = l?.message || (l ? String(l) : "unknown error"), h = new Error(
1715
+ }), r.once("error", function(l) {
1716
+ q.release(o), console.error(l);
1717
+ const u = l?.message || (l ? String(l) : "unknown error"), f = new Error(
1735
1718
  `Worker failed to load. Original error: ${u}`,
1736
1719
  { cause: l }
1737
1720
  );
1738
- n(h);
1721
+ i(f);
1739
1722
  });
1740
1723
  let a = !1;
1741
- o.once("spawn", () => {
1724
+ r.once("spawn", () => {
1742
1725
  a = !0;
1743
- }), o.once("exit", (l) => {
1744
- G.release(i), a || n(new Error(`Worker exited before spawning: ${l}`)), t?.(l);
1726
+ }), r.once("exit", (l) => {
1727
+ q.release(o), a || i(new Error(`Worker exited before spawning: ${l}`)), t?.(l);
1745
1728
  });
1746
1729
  });
1747
1730
  }
1748
- async function qt(e) {
1749
- const { port1: t, port2: o } = new Pe();
1750
- return await Ne(e, t), o;
1731
+ async function jt(e) {
1732
+ const { port1: t, port2: r } = new we();
1733
+ return await Be(e, t), r;
1751
1734
  }
1752
- function zt(e) {
1753
- const t = U.platform();
1754
- let o;
1735
+ function Vt(e) {
1736
+ const t = B.platform();
1737
+ let r;
1755
1738
  switch (t) {
1756
1739
  case "darwin":
1757
- o = `open "${e}"`;
1740
+ r = `open "${e}"`;
1758
1741
  break;
1759
1742
  case "win32":
1760
- o = `start "" "${e}"`;
1743
+ r = `start "" "${e}"`;
1761
1744
  break;
1762
1745
  default:
1763
- o = `xdg-open "${e}"`;
1746
+ r = `xdg-open "${e}"`;
1764
1747
  break;
1765
1748
  }
1766
- ve(o, (r) => {
1767
- r && f.debug(`Could not open browser: ${r.message}`);
1749
+ be(r, (n) => {
1750
+ n && h.debug(`Could not open browser: ${n.message}`);
1768
1751
  });
1769
1752
  }
1770
- async function Gt(e, t) {
1753
+ async function qt(e, t) {
1771
1754
  await e.run({
1772
1755
  code: `<?php
1773
1756
  $zip = new ZipArchive();
@@ -1788,29 +1771,29 @@ async function Gt(e, t) {
1788
1771
 
1789
1772
  `
1790
1773
  });
1791
- const o = await e.readFileAsBuffer("/tmp/build.zip");
1792
- p.writeFileSync(t, o);
1774
+ const r = await e.readFileAsBuffer("/tmp/build.zip");
1775
+ c.writeFileSync(t, r);
1793
1776
  }
1794
- const Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1777
+ const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1795
1778
  __proto__: null,
1796
- LogVerbosity: te,
1797
- internalsKeyForTesting: oe,
1798
- mergeDefinedConstants: ee,
1799
- parseOptionsAndRunCLI: Vt,
1800
- resolveWorkerCount: Te,
1801
- runCLI: ke,
1802
- spawnWorkerThread: Ie
1779
+ LogVerbosity: J,
1780
+ internalsKeyForTesting: K,
1781
+ mergeDefinedConstants: Z,
1782
+ parseOptionsAndRunCLI: Ft,
1783
+ resolveWorkerCount: xe,
1784
+ runCLI: Ee,
1785
+ spawnWorkerThread: $e
1803
1786
  }, Symbol.toStringTag, { value: "Module" }));
1804
1787
  export {
1805
- te as L,
1806
- ke as a,
1807
- xo as b,
1808
- Ot as c,
1809
- Eo as d,
1810
- oe as i,
1811
- ee as m,
1812
- Vt as p,
1813
- Te as r,
1814
- Ie as s
1788
+ J as L,
1789
+ Ee as a,
1790
+ gr as b,
1791
+ Nt as c,
1792
+ Pr as d,
1793
+ K as i,
1794
+ Z as m,
1795
+ Ft as p,
1796
+ xe as r,
1797
+ $e as s
1815
1798
  };
1816
- //# sourceMappingURL=run-cli-C2bV7mIt.js.map
1799
+ //# sourceMappingURL=run-cli-CC9V0J3D.js.map