@wp-playground/cli 3.1.12 → 3.1.13

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,29 +1,29 @@
1
- import { logger as w, LogSeverity as O, errorLogPath as J } from "@php-wasm/logger";
2
- import { consumeAPI as de, ProcessIdAllocator as Ee, SupportedPHPVersions as W, printDebugDetails as $e, HttpCookieStore as Te, FileLockManagerInMemory as Ie, StreamedPHPResponse as K, createObjectPoolProxy as ke, exposeAPI as Me, PHPResponse as Ce, exposeSyncAPI as Ae } from "@php-wasm/universal";
3
- import { resolveRemoteBlueprint as Be, resolveRuntimeConfiguration as ee, compileBlueprintV1 as ce, isBlueprintBundle as Re, runBlueprintV1Steps as te } from "@wp-playground/blueprints";
4
- import { zipDirectory as De, RecommendedPHPVersion as C } from "@wp-playground/common";
5
- import p, { existsSync as z, rmdirSync as We, mkdirSync as Y, readdirSync as Le } from "fs";
6
- import { MessageChannel as pe, Worker as re } from "worker_threads";
7
- import { createNodeFsMountHandler as Ue } from "@php-wasm/node";
8
- import d, { basename as D, join as me } from "path";
9
- import { exec as he } from "child_process";
10
- import { promisify as _e } from "util";
11
- import fe from "express";
12
- import { Readable as He } from "stream";
13
- import { pipeline as Ne } from "stream/promises";
14
- import Oe from "yargs";
15
- import { NodeJsFilesystem as Fe, OverlayFilesystem as je, InMemoryFilesystem as Ve, ZipFilesystem as Ye } from "@wp-playground/storage";
16
- import { EmscriptenDownloadMonitor as qe, ProgressTracker as ze } from "@php-wasm/progress";
17
- import { resolveWordPressRelease as Ge } from "@wp-playground/wordpress";
1
+ import { logger as w, LogSeverity as O, errorLogPath as te } from "@php-wasm/logger";
2
+ import { consumeAPI as me, ProcessIdAllocator as Te, SupportedPHPVersions as W, printDebugDetails as Ie, HttpCookieStore as ke, FileLockManagerInMemory as Me, StreamedPHPResponse as re, createObjectPoolProxy as Ce, exposeAPI as Ae, PHPResponse as Be, exposeSyncAPI as Re } from "@php-wasm/universal";
3
+ import { resolveRemoteBlueprint as De, resolveRuntimeConfiguration as oe, compileBlueprintV1 as fe, isBlueprintBundle as We, runBlueprintV1Steps as se } from "@wp-playground/blueprints";
4
+ import { zipDirectory as Le, RecommendedPHPVersion as C } from "@wp-playground/common";
5
+ import p, { existsSync as z, rmdirSync as _e, mkdirSync as Y, readdirSync as Ue } from "fs";
6
+ import { MessageChannel as he, Worker as ie } from "worker_threads";
7
+ import { createNodeFsMountHandler as He } from "@php-wasm/node";
8
+ import d, { basename as D, join as we } from "path";
9
+ import { exec as ye } from "child_process";
10
+ import { promisify as Ne } from "util";
11
+ import be from "express";
12
+ import { Readable as Oe } from "stream";
13
+ import { pipeline as Fe } from "stream/promises";
14
+ import je from "yargs";
15
+ import { NodeJsFilesystem as Ve, OverlayFilesystem as Ye, InMemoryFilesystem as qe, ZipFilesystem as ze } from "@wp-playground/storage";
16
+ import { EmscriptenDownloadMonitor as Ge, ProgressTracker as Qe } from "@php-wasm/progress";
17
+ import { resolveWordPressRelease as Xe } from "@wp-playground/wordpress";
18
18
  import $ from "fs-extra";
19
- import { createRequire as Qe } from "module";
19
+ import { createRequire as Ze } from "module";
20
20
  import G from "os";
21
- import { startBridge as Xe } from "@php-wasm/xdebug-bridge";
22
- import { dir as Ze, setGracefulCleanup as Je } from "tmp-promise";
23
- import { removeTempDirSymlink as Ke, createTempDirSymlink as oe, makeXdebugConfig as et, clearXdebugIDEConfig as tt, addXdebugIDEConfig as rt } from "@php-wasm/cli-util";
24
- import { createHash as ot } from "crypto";
25
- import { PHPMYADMIN_INSTALL_PATH as se, getPhpMyAdminInstallSteps as st, PHPMYADMIN_ENTRY_PATH as it } from "@wp-playground/tools";
26
- import { jspi as ie } from "wasm-feature-detect";
21
+ import { startBridge as Je } from "@php-wasm/xdebug-bridge";
22
+ import { dir as Ke, setGracefulCleanup as et } from "tmp-promise";
23
+ import { removeTempDirSymlink as tt, createTempDirSymlink as ne, makeXdebugConfig as rt, clearXdebugIDEConfig as ot, addXdebugIDEConfig as st } from "@php-wasm/cli-util";
24
+ import { createHash as it } from "crypto";
25
+ import { PHPMYADMIN_INSTALL_PATH as ae, getPhpMyAdminInstallSteps as nt, PHPMYADMIN_ENTRY_PATH as at } from "@wp-playground/tools";
26
+ import { jspi as le } from "wasm-feature-detect";
27
27
  function F(e) {
28
28
  const t = [];
29
29
  for (const r of e) {
@@ -40,7 +40,7 @@ function F(e) {
40
40
  }
41
41
  return t;
42
42
  }
43
- function ne(e) {
43
+ function ue(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 = [];
@@ -55,14 +55,14 @@ function ne(e) {
55
55
  }
56
56
  return t;
57
57
  }
58
- async function fr(e, t) {
58
+ async function wr(e, t) {
59
59
  for (const r of t)
60
60
  await e.mount(
61
61
  r.vfsPath,
62
- Ue(r.hostPath)
62
+ He(r.hostPath)
63
63
  );
64
64
  }
65
- const ae = {
65
+ const de = {
66
66
  step: "runPHP",
67
67
  code: {
68
68
  filename: "activate-theme.php",
@@ -81,7 +81,7 @@ const ae = {
81
81
  `
82
82
  }
83
83
  };
84
- function we(e) {
84
+ function ge(e) {
85
85
  const t = e.autoMount, r = [...e.mount || []], o = [...e["mount-before-install"] || []], s = {
86
86
  ...e,
87
87
  mount: r,
@@ -90,7 +90,7 @@ function we(e) {
90
90
  ...e["additional-blueprint-steps"] || []
91
91
  ]
92
92
  };
93
- if (ut(t)) {
93
+ if (ct(t)) {
94
94
  const a = `/wordpress/wp-content/plugins/${D(t)}`;
95
95
  r.push({
96
96
  hostPath: t,
@@ -100,7 +100,7 @@ function we(e) {
100
100
  step: "activatePlugin",
101
101
  pluginPath: `/wordpress/wp-content/plugins/${D(t)}`
102
102
  });
103
- } else if (lt(t)) {
103
+ } else if (dt(t)) {
104
104
  const i = D(t), a = `/wordpress/wp-content/themes/${i}`;
105
105
  r.push({
106
106
  hostPath: t,
@@ -115,7 +115,7 @@ function we(e) {
115
115
  themeFolderName: i
116
116
  }
117
117
  );
118
- } else if (at(t)) {
118
+ } else if (ut(t)) {
119
119
  const i = p.readdirSync(t);
120
120
  for (const a of i)
121
121
  a !== "index.php" && r.push({
@@ -123,36 +123,36 @@ function we(e) {
123
123
  vfsPath: `/wordpress/wp-content/${a}`,
124
124
  autoMounted: !0
125
125
  });
126
- s["additional-blueprint-steps"].push(ae);
127
- } else nt(t) && (o.push({
126
+ s["additional-blueprint-steps"].push(de);
127
+ } else lt(t) && (o.push({
128
128
  hostPath: t,
129
129
  vfsPath: "/wordpress",
130
130
  autoMounted: !0
131
- }), s.mode = "apply-to-existing-site", s["additional-blueprint-steps"].push(ae), s.wordpressInstallMode || (s.wordpressInstallMode = "install-from-existing-files-if-needed"));
131
+ }), s.mode = "apply-to-existing-site", s["additional-blueprint-steps"].push(de), s.wordpressInstallMode || (s.wordpressInstallMode = "install-from-existing-files-if-needed"));
132
132
  return s;
133
133
  }
134
- function nt(e) {
134
+ function lt(e) {
135
135
  const t = p.readdirSync(e);
136
136
  return t.includes("wp-admin") && t.includes("wp-includes") && t.includes("wp-content");
137
137
  }
138
- function at(e) {
138
+ function ut(e) {
139
139
  const t = p.readdirSync(e);
140
140
  return t.includes("themes") || t.includes("plugins") || t.includes("mu-plugins") || t.includes("uploads");
141
141
  }
142
- function lt(e) {
142
+ function dt(e) {
143
143
  if (!p.readdirSync(e).includes("style.css"))
144
144
  return !1;
145
- const r = p.readFileSync(me(e, "style.css"), "utf8");
145
+ const r = p.readFileSync(we(e, "style.css"), "utf8");
146
146
  return !!/^(?:[ \t]*<\?php)?[ \t/*#@]*Theme Name:(.*)$/im.exec(r);
147
147
  }
148
- function ut(e) {
148
+ function ct(e) {
149
149
  const t = p.readdirSync(e), r = /^(?:[ \t]*<\?php)?[ \t/*#@]*Plugin Name:(.*)$/im;
150
150
  return !!t.filter((s) => s.endsWith(".php")).find((s) => {
151
- const i = p.readFileSync(me(e, s), "utf8");
151
+ const i = p.readFileSync(we(e, s), "utf8");
152
152
  return !!r.exec(i);
153
153
  });
154
154
  }
155
- function dt(e) {
155
+ function pt(e) {
156
156
  if (e.length % 2 !== 0)
157
157
  throw new Error(
158
158
  "Invalid constant definition format. Expected pairs of NAME value"
@@ -166,7 +166,7 @@ function dt(e) {
166
166
  }
167
167
  return t;
168
168
  }
169
- function ct(e) {
169
+ function mt(e) {
170
170
  if (e.length % 2 !== 0)
171
171
  throw new Error(
172
172
  "Invalid boolean constant definition format. Expected pairs of NAME value"
@@ -187,7 +187,7 @@ function ct(e) {
187
187
  }
188
188
  return t;
189
189
  }
190
- function pt(e) {
190
+ function ft(e) {
191
191
  if (e.length % 2 !== 0)
192
192
  throw new Error(
193
193
  "Invalid number constant definition format. Expected pairs of NAME value"
@@ -206,7 +206,7 @@ function pt(e) {
206
206
  }
207
207
  return t;
208
208
  }
209
- function mt(e = {}, t = {}, r = {}) {
209
+ function ht(e = {}, t = {}, r = {}) {
210
210
  const o = {}, s = /* @__PURE__ */ new Set(), i = (a, l) => {
211
211
  for (const u in a) {
212
212
  if (s.has(u))
@@ -218,26 +218,26 @@ function mt(e = {}, t = {}, r = {}) {
218
218
  };
219
219
  return i(e, "string"), i(t, "bool"), i(r, "number"), o;
220
220
  }
221
- function ye(e) {
222
- return mt(
221
+ function Q(e) {
222
+ return ht(
223
223
  e.define,
224
224
  e["define-bool"],
225
225
  e["define-number"]
226
226
  );
227
227
  }
228
- const ht = _e(he);
229
- function ft(e) {
228
+ const wt = Ne(ye);
229
+ function yt(e) {
230
230
  return new Promise((t) => {
231
231
  if (e === 0) return t(!1);
232
- const r = fe().listen(e);
232
+ const r = be().listen(e);
233
233
  r.once("listening", () => r.close(() => t(!1))), r.once(
234
234
  "error",
235
235
  (o) => t(o.code === "EADDRINUSE")
236
236
  );
237
237
  });
238
238
  }
239
- async function wt(e) {
240
- const t = fe(), r = await new Promise((a, l) => {
239
+ async function bt(e) {
240
+ const t = be(), r = await new Promise((a, l) => {
241
241
  const u = t.listen(e.port, () => {
242
242
  const y = u.address();
243
243
  y === null || typeof y == "string" ? l(new Error("Server address is not available")) : a(u);
@@ -247,19 +247,19 @@ async function wt(e) {
247
247
  try {
248
248
  const u = {
249
249
  url: a.url,
250
- headers: Pt(a),
250
+ headers: St(a),
251
251
  method: a.method,
252
- body: await bt(a)
252
+ body: await Pt(a)
253
253
  }, y = await e.handleRequest(u);
254
- await yt(y, l);
254
+ await gt(y, l);
255
255
  } catch (u) {
256
256
  w.error(u), l.headersSent || (l.statusCode = 500, l.end("Internal Server Error"));
257
257
  }
258
258
  });
259
259
  const s = r.address().port, i = process.env.CODESPACE_NAME;
260
- return i && gt(s, i), await e.onBind(r, s);
260
+ return i && vt(s, i), await e.onBind(r, s);
261
261
  }
262
- async function yt(e, t) {
262
+ async function gt(e, t) {
263
263
  const [r, o] = await Promise.all([
264
264
  e.headers,
265
265
  e.httpStatusCode
@@ -267,16 +267,16 @@ async function yt(e, t) {
267
267
  t.statusCode = o;
268
268
  for (const i in r)
269
269
  t.setHeader(i, r[i]);
270
- const s = He.fromWeb(e.stdout);
270
+ const s = Oe.fromWeb(e.stdout);
271
271
  try {
272
- await Ne(s, t);
272
+ await Fe(s, t);
273
273
  } catch (i) {
274
274
  if (i instanceof Error && "code" in i && (i.code === "ERR_STREAM_PREMATURE_CLOSE" || i.code === "ERR_STREAM_UNABLE_TO_PIPE"))
275
275
  return;
276
276
  throw i;
277
277
  }
278
278
  }
279
- const bt = async (e) => await new Promise((t) => {
279
+ const Pt = async (e) => await new Promise((t) => {
280
280
  const r = [];
281
281
  e.on("data", (o) => {
282
282
  r.push(o);
@@ -284,35 +284,35 @@ const bt = async (e) => await new Promise((t) => {
284
284
  t(new Uint8Array(Buffer.concat(r)));
285
285
  });
286
286
  });
287
- async function gt(e, t) {
287
+ async function vt(e, t) {
288
288
  w.log(`Publishing port ${e}...`);
289
289
  const r = `gh codespace ports visibility ${e}:public -c ${t}`;
290
290
  for (let o = 0; o < 10; o++)
291
291
  try {
292
- await ht(r);
292
+ await wt(r);
293
293
  return;
294
294
  } catch {
295
295
  await new Promise((s) => setTimeout(s, 2e3));
296
296
  }
297
297
  }
298
- const Pt = (e) => {
298
+ const St = (e) => {
299
299
  const t = {};
300
300
  if (e.rawHeaders && e.rawHeaders.length)
301
301
  for (let r = 0; r < e.rawHeaders.length; r += 2)
302
302
  t[e.rawHeaders[r].toLowerCase()] = e.rawHeaders[r + 1];
303
303
  return t;
304
304
  };
305
- function vt(e) {
305
+ function xt(e) {
306
306
  return /^latest$|^trunk$|^nightly$|^(?:(\d+)\.(\d+)(?:\.(\d+))?)((?:-beta(?:\d+)?)|(?:-RC(?:\d+)?))?$/.test(e);
307
307
  }
308
- async function St({
308
+ async function Et({
309
309
  sourceString: e,
310
310
  blueprintMayReadAdjacentFiles: t
311
311
  }) {
312
312
  if (!e)
313
313
  return;
314
314
  if (e.startsWith("http://") || e.startsWith("https://"))
315
- return await Be(e);
315
+ return await De(e);
316
316
  let r = d.resolve(process.cwd(), e);
317
317
  if (!p.existsSync(r))
318
318
  throw new Error(`Blueprint file does not exist: ${r}`);
@@ -324,7 +324,7 @@ async function St({
324
324
  const s = d.extname(r);
325
325
  switch (s) {
326
326
  case ".zip":
327
- return Ye.fromArrayBuffer(
327
+ return ze.fromArrayBuffer(
328
328
  p.readFileSync(r).buffer
329
329
  );
330
330
  case ".json": {
@@ -336,9 +336,9 @@ async function St({
336
336
  `Blueprint file at ${r} is not a valid JSON file`
337
337
  );
338
338
  }
339
- const a = d.dirname(r), l = new Fe(a);
340
- return new je([
341
- new Ve({
339
+ const a = d.dirname(r), l = new Ve(a);
340
+ return new Ye([
341
+ new qe({
342
342
  "blueprint.json": i
343
343
  }),
344
344
  /**
@@ -364,7 +364,7 @@ You can allow this Blueprint to read files from the same parent directory by exp
364
364
  );
365
365
  }
366
366
  }
367
- class xt {
367
+ class $t {
368
368
  constructor(t, r) {
369
369
  this.args = t, this.siteUrl = r.siteUrl, this.phpVersion = t.php, this.cliOutput = r.cliOutput;
370
370
  }
@@ -385,7 +385,7 @@ class xt {
385
385
  fileLockManagerPort: r,
386
386
  nativeInternalDirPath: o
387
387
  }) {
388
- const s = de(t.phpPort);
388
+ const s = me(t.phpPort);
389
389
  await s.useFileLockManager(r);
390
390
  const i = {
391
391
  ...this.args,
@@ -400,17 +400,17 @@ class xt {
400
400
  nativeInternalDirPath: o,
401
401
  mountsBeforeWpInstall: this.args["mount-before-install"] || [],
402
402
  mountsAfterWpInstall: this.args.mount || [],
403
- constants: ye(this.args)
403
+ constants: Q(this.args)
404
404
  };
405
405
  return await s.bootWorker(i), s;
406
406
  }
407
407
  }
408
408
  const q = d.join(G.homedir(), ".wordpress-playground");
409
- async function Et() {
409
+ async function Tt() {
410
410
  const e = typeof __dirname < "u" ? __dirname : import.meta.dirname;
411
411
  let t = d.join(e, "sqlite-database-integration.zip");
412
412
  if (!$.existsSync(t)) {
413
- const r = Qe(import.meta.url), o = d.dirname(
413
+ const r = Ze(import.meta.url), o = d.dirname(
414
414
  r.resolve("@wp-playground/wordpress-builds/package.json")
415
415
  );
416
416
  t = d.join(
@@ -422,11 +422,11 @@ async function Et() {
422
422
  }
423
423
  return new File([await $.readFile(t)], d.basename(t));
424
424
  }
425
- async function $t(e, t, r) {
425
+ async function It(e, t, r) {
426
426
  const o = d.join(q, t);
427
- return $.existsSync(o) || ($.ensureDirSync(q), await Tt(e, o, r)), be(o);
427
+ return $.existsSync(o) || ($.ensureDirSync(q), await kt(e, o, r)), Pe(o);
428
428
  }
429
- async function Tt(e, t, r) {
429
+ async function kt(e, t, r) {
430
430
  const s = (await r.monitorFetch(fetch(e))).body.getReader(), i = `${t}.partial`, a = $.createWriteStream(i);
431
431
  for (; ; ) {
432
432
  const { done: l, value: u } = await s.read();
@@ -441,10 +441,10 @@ async function Tt(e, t, r) {
441
441
  });
442
442
  });
443
443
  }
444
- function be(e, t) {
444
+ function Pe(e, t) {
445
445
  return new File([$.readFileSync(e)], D(e));
446
446
  }
447
- class It {
447
+ class Mt {
448
448
  constructor(t, r) {
449
449
  this.args = t, this.siteUrl = r.siteUrl, this.cliOutput = r.cliOutput;
450
450
  }
@@ -453,7 +453,7 @@ class It {
453
453
  }
454
454
  async bootWordPress(t, r) {
455
455
  let o, s, i;
456
- const a = new qe();
456
+ const a = new Ge();
457
457
  if (this.args.wordpressInstallMode === "download-and-install") {
458
458
  let y = !1;
459
459
  a.addEventListener("progress", (E) => {
@@ -466,10 +466,10 @@ class It {
466
466
  "Downloading WordPress",
467
467
  m
468
468
  );
469
- }), o = await Ge(this.args.wp), i = d.join(
469
+ }), o = await Xe(this.args.wp), i = d.join(
470
470
  q,
471
471
  `prebuilt-wp-content-for-wp-${o.version}.zip`
472
- ), s = p.existsSync(i) ? be(i) : await $t(
472
+ ), s = p.existsSync(i) ? Pe(i) : await It(
473
473
  o.releaseUrl,
474
474
  `${o.version}.zip`,
475
475
  a
@@ -478,8 +478,8 @@ class It {
478
478
  );
479
479
  }
480
480
  let l;
481
- this.args.skipSqliteSetup ? (w.debug("Skipping SQLite integration plugin setup..."), l = void 0) : (this.cliOutput.updateProgress("Preparing SQLite database"), l = await Et()), this.cliOutput.updateProgress("Booting WordPress");
482
- const u = await ee(
481
+ this.args.skipSqliteSetup ? (w.debug("Skipping SQLite integration plugin setup..."), l = void 0) : (this.cliOutput.updateProgress("Preparing SQLite database"), l = await Tt()), this.cliOutput.updateProgress("Booting WordPress");
482
+ const u = await oe(
483
483
  this.getEffectiveBlueprint()
484
484
  );
485
485
  return await t.bootWordPress(
@@ -489,14 +489,14 @@ class It {
489
489
  wordpressInstallMode: this.args.wordpressInstallMode || "download-and-install",
490
490
  wordPressZip: s && await s.arrayBuffer(),
491
491
  sqliteIntegrationPluginZip: await l?.arrayBuffer(),
492
- constants: ye(this.args)
492
+ constants: Q(this.args)
493
493
  },
494
494
  r
495
495
  ), i && !this.args["mount-before-install"] && !p.existsSync(i) && (this.cliOutput.updateProgress("Caching WordPress for next boot"), p.writeFileSync(
496
496
  i,
497
497
  // Comlink proxy is not assignable to UniversalPHP but
498
498
  // proxies all method calls transparently at runtime.
499
- await De(
499
+ await Le(
500
500
  t,
501
501
  "/wordpress"
502
502
  )
@@ -507,11 +507,11 @@ class It {
507
507
  fileLockManagerPort: r,
508
508
  nativeInternalDirPath: o
509
509
  }) {
510
- const s = de(
510
+ const s = me(
511
511
  t.phpPort
512
512
  );
513
513
  await s.isConnected();
514
- const i = await ee(
514
+ const i = await oe(
515
515
  this.getEffectiveBlueprint()
516
516
  );
517
517
  return await s.useFileLockManager(r), await s.bootRequestHandler({
@@ -531,7 +531,7 @@ class It {
531
531
  }), await s.isReady(), s;
532
532
  }
533
533
  async compileInputBlueprint(t) {
534
- const r = this.getEffectiveBlueprint(), o = new ze();
534
+ const r = this.getEffectiveBlueprint(), o = new Qe();
535
535
  let s = "", i = !1;
536
536
  return o.addEventListener("progress", (a) => {
537
537
  if (i)
@@ -539,14 +539,14 @@ class It {
539
539
  i = a.detail.progress === 100;
540
540
  const l = Math.floor(a.detail.progress);
541
541
  s = a.detail.caption || s || "Running Blueprint", this.cliOutput.updateProgress(s.trim(), l);
542
- }), await ce(r, {
542
+ }), await fe(r, {
543
543
  progress: o,
544
544
  additionalSteps: t
545
545
  });
546
546
  }
547
547
  getEffectiveBlueprint() {
548
548
  const t = this.args.blueprint;
549
- return Re(t) ? t : {
549
+ return We(t) ? t : {
550
550
  login: this.args.login,
551
551
  ...t || {},
552
552
  preferredVersions: {
@@ -557,8 +557,8 @@ class It {
557
557
  };
558
558
  }
559
559
  }
560
- async function kt(e, t = !0) {
561
- const o = `${d.basename(process.argv0)}${e}${process.pid}-`, s = await Ze({
560
+ async function Ct(e, t = !0) {
561
+ const o = `${d.basename(process.argv0)}${e}${process.pid}-`, s = await Ke({
562
562
  prefix: o,
563
563
  /*
564
564
  * Allow recursive cleanup on process exit.
@@ -570,10 +570,10 @@ async function kt(e, t = !0) {
570
570
  */
571
571
  unsafeCleanup: !0
572
572
  });
573
- return t && Je(), s;
573
+ return t && et(), s;
574
574
  }
575
- async function Mt(e, t, r) {
576
- const s = (await Ct(
575
+ async function At(e, t, r) {
576
+ const s = (await Bt(
577
577
  e,
578
578
  t,
579
579
  r
@@ -591,11 +591,11 @@ async function Mt(e, t, r) {
591
591
  );
592
592
  await Promise.all(s);
593
593
  }
594
- async function Ct(e, t, r) {
594
+ async function Bt(e, t, r) {
595
595
  try {
596
596
  const o = p.readdirSync(r).map((i) => d.join(r, i)), s = [];
597
597
  for (const i of o)
598
- await At(
598
+ await Rt(
599
599
  e,
600
600
  t,
601
601
  i
@@ -605,7 +605,7 @@ async function Ct(e, t, r) {
605
605
  return w.warn(`Failed to find stale Playground temp dirs: ${o}`), [];
606
606
  }
607
607
  }
608
- async function At(e, t, r) {
608
+ async function Rt(e, t, r) {
609
609
  if (!p.lstatSync(r).isDirectory())
610
610
  return !1;
611
611
  const s = d.basename(r);
@@ -620,12 +620,12 @@ async function At(e, t, r) {
620
620
  executableName: i[1],
621
621
  pid: i[2]
622
622
  };
623
- if (Bt(a.pid))
623
+ if (Dt(a.pid))
624
624
  return !1;
625
625
  const l = Date.now() - t;
626
626
  return p.statSync(r).mtime.getTime() < l;
627
627
  }
628
- function Bt(e, t) {
628
+ function Dt(e, t) {
629
629
  try {
630
630
  return process.kill(Number(e), 0), !0;
631
631
  } catch (r) {
@@ -639,10 +639,10 @@ function Bt(e, t) {
639
639
  ), !0);
640
640
  }
641
641
  }
642
- function Rt(e) {
642
+ function Wt(e) {
643
643
  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;
644
644
  }
645
- class Dt {
645
+ class Lt {
646
646
  constructor(t) {
647
647
  this.lastProgressLine = "", this.progressActive = !1, this.verbosity = t.verbosity, this.writeStream = t.writeStream || process.stdout;
648
648
  }
@@ -656,7 +656,7 @@ class Dt {
656
656
  * This prevents progress spam in logs - users only see the final outcome.
657
657
  */
658
658
  get shouldRender() {
659
- return Rt(this.writeStream);
659
+ return Wt(this.writeStream);
660
660
  }
661
661
  get isQuiet() {
662
662
  return this.verbosity === "quiet";
@@ -805,12 +805,12 @@ ${this.green("Ready!")} WordPress is running on ${this.bold(t)} ${this.dim(`(${r
805
805
  );
806
806
  }
807
807
  }
808
- const ge = {
808
+ const X = {
809
809
  Quiet: { name: "quiet", severity: O.Fatal },
810
810
  Normal: { name: "normal", severity: O.Info },
811
811
  Debug: { name: "debug", severity: O.Debug }
812
812
  };
813
- async function wr(e) {
813
+ async function _t(e) {
814
814
  try {
815
815
  const t = {
816
816
  "site-url": {
@@ -833,21 +833,21 @@ async function wr(e) {
833
833
  type: "string",
834
834
  nargs: 2,
835
835
  array: !0,
836
- coerce: dt
836
+ coerce: pt
837
837
  },
838
838
  "define-bool": {
839
839
  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',
840
840
  type: "string",
841
841
  nargs: 2,
842
842
  array: !0,
843
- coerce: ct
843
+ coerce: mt
844
844
  },
845
845
  "define-number": {
846
846
  describe: "Define PHP number constants (can be used multiple times). Format: NAME value. Examples: --define-number LIMIT 100 --define-number RATE 45.67",
847
847
  type: "string",
848
848
  nargs: 2,
849
849
  array: !0,
850
- coerce: pt
850
+ coerce: ft
851
851
  },
852
852
  // @TODO: Support read-only mounts, e.g. via WORKERFS, a custom
853
853
  // ReadOnlyNODEFS, or by copying the files into MEMFS
@@ -870,14 +870,14 @@ async function wr(e) {
870
870
  type: "array",
871
871
  nargs: 2,
872
872
  array: !0,
873
- coerce: ne
873
+ coerce: ue
874
874
  },
875
875
  "mount-dir-before-install": {
876
876
  describe: 'Mount a directory before WordPress installation (can be used multiple times). Format: "/host/path" "/vfs/path"',
877
877
  type: "string",
878
878
  nargs: 2,
879
879
  array: !0,
880
- coerce: ne
880
+ coerce: ue
881
881
  },
882
882
  login: {
883
883
  describe: "Should log the user in",
@@ -924,7 +924,7 @@ async function wr(e) {
924
924
  verbosity: {
925
925
  describe: "Output logs and progress messages.",
926
926
  type: "string",
927
- choices: Object.values(ge).map(
927
+ choices: Object.values(X).map(
928
928
  (n) => n.name
929
929
  ),
930
930
  default: "normal"
@@ -1099,7 +1099,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1099
1099
  type: "string",
1100
1100
  default: "wordpress.zip"
1101
1101
  }
1102
- }, i = Oe(e).usage("Usage: wp-playground <command> [options]").command(
1102
+ }, i = je(e).usage("Usage: wp-playground <command> [options]").command(
1103
1103
  "start",
1104
1104
  "Start a local WordPress server with automatic project detection (recommended)",
1105
1105
  (n) => n.usage(
@@ -1147,7 +1147,7 @@ Examples:
1147
1147
  n && n.includes("Please specify a command") && (b.showHelp(), console.error(`
1148
1148
  ` + n), process.exit(1)), console.error(n), process.exit(1);
1149
1149
  }).strictOptions().check(async (n) => {
1150
- if (n["skip-wordpress-install"] === !0 && (n["wordpress-install-mode"] = "do-not-attempt-installing", n.wordpressInstallMode = "do-not-attempt-installing"), n.wp !== void 0 && typeof n.wp == "string" && !vt(n.wp))
1150
+ if (n["skip-wordpress-install"] === !0 && (n["wordpress-install-mode"] = "do-not-attempt-installing", n.wordpressInstallMode = "do-not-attempt-installing"), n.wp !== void 0 && typeof n.wp == "string" && !xt(n.wp))
1151
1151
  try {
1152
1152
  new URL(n.wp);
1153
1153
  } catch {
@@ -1211,7 +1211,7 @@ Examples:
1211
1211
  ...a["mount-before-install"] || [],
1212
1212
  ...a["mount-dir-before-install"] || []
1213
1213
  ]
1214
- }, E = await Lt(y);
1214
+ }, E = await ve(y);
1215
1215
  E === void 0 && process.exit(0);
1216
1216
  const c = /* @__PURE__ */ (() => {
1217
1217
  let n;
@@ -1223,13 +1223,13 @@ Examples:
1223
1223
  [Symbol.asyncDispose]: async () => {
1224
1224
  process.off("SIGINT", c), process.off("SIGTERM", c), await E[Symbol.asyncDispose]();
1225
1225
  },
1226
- [Pe]: { cliServer: E }
1226
+ [Z]: { cliServer: E }
1227
1227
  };
1228
1228
  } catch (t) {
1229
1229
  if (console.error(t), !(t instanceof Error))
1230
1230
  throw t;
1231
1231
  if (process.argv.includes("--debug"))
1232
- $e(t);
1232
+ Ie(t);
1233
1233
  else {
1234
1234
  const o = [];
1235
1235
  let s = t;
@@ -1243,34 +1243,28 @@ Examples:
1243
1243
  process.exit(1);
1244
1244
  }
1245
1245
  }
1246
- function le(e, t) {
1246
+ function ce(e, t) {
1247
1247
  return e.find(
1248
1248
  (r) => r.vfsPath.replace(/\/$/, "") === t.replace(/\/$/, "")
1249
1249
  );
1250
1250
  }
1251
- const Pe = 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, ue = (e) => process.stdout.isTTY ? `\x1B[2m${e}\x1B[0m` : e, R = (e) => process.stdout.isTTY ? `\x1B[3m${e}\x1B[0m` : e, j = (e) => process.stdout.isTTY ? `\x1B[33m${e}\x1B[0m` : e;
1252
- async function Lt(e) {
1251
+ const Z = Symbol("playground-cli-testing"), I = (e) => process.stdout.isTTY ? "\x1B[1m" + e + "\x1B[0m" : e, Ut = (e) => process.stdout.isTTY ? "\x1B[31m" + e + "\x1B[0m" : e, pe = (e) => process.stdout.isTTY ? `\x1B[2m${e}\x1B[0m` : e, R = (e) => process.stdout.isTTY ? `\x1B[3m${e}\x1B[0m` : e, j = (e) => process.stdout.isTTY ? `\x1B[33m${e}\x1B[0m` : e;
1252
+ async function ve(e) {
1253
1253
  let t;
1254
- const r = e.internalCookieStore ? new Te() : void 0, o = [], s = /* @__PURE__ */ new Map();
1255
- if (e.command === "start" && (e = Ut(e)), e.autoMount !== void 0 && (e.autoMount === "" && (e = { ...e, autoMount: process.cwd() }), e = we(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) {
1256
- const c = Object.values(ge).find(
1254
+ const r = e.internalCookieStore ? new ke() : void 0, o = [], s = /* @__PURE__ */ new Map();
1255
+ if (e.command === "start" && (e = Ht(e)), 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) {
1256
+ const c = Object.values(X).find(
1257
1257
  (n) => n.name === e.verbosity
1258
1258
  ).severity;
1259
1259
  w.setSeverityFilterLevel(c);
1260
1260
  }
1261
- if (e.intl || (e.intl = !0), e.redis === void 0 && (e.redis = await ie()), e.memcached === void 0 && (e.memcached = await ie()), e.phpmyadmin) {
1262
- if (e.phpmyadmin === !0 && (e.phpmyadmin = "/phpmyadmin"), e.skipSqliteSetup)
1263
- throw new Error(
1264
- "--phpmyadmin requires SQLite. Cannot be used with --skip-sqlite-setup."
1265
- );
1266
- e.pathAliases = [
1267
- {
1268
- urlPrefix: e.phpmyadmin,
1269
- fsPath: se
1270
- }
1271
- ];
1272
- }
1273
- const i = new Dt({
1261
+ e.intl || (e.intl = !0), e.redis === void 0 && (e.redis = await le()), e.memcached === void 0 && (e.memcached = await le()), e.phpmyadmin && (e.phpmyadmin === !0 && (e.phpmyadmin = "/phpmyadmin"), e.pathAliases = [
1262
+ {
1263
+ urlPrefix: e.phpmyadmin,
1264
+ fsPath: ae
1265
+ }
1266
+ ]);
1267
+ const i = new Lt({
1274
1268
  verbosity: e.verbosity || "normal"
1275
1269
  });
1276
1270
  e.command === "server" && (i.printBanner(), i.printConfig({
@@ -1287,30 +1281,30 @@ async function Lt(e) {
1287
1281
  ],
1288
1282
  blueprint: typeof e.blueprint == "string" ? e.blueprint : void 0
1289
1283
  }));
1290
- const a = e.command === "server" ? e.port ?? 9400 : 0, l = new Ie();
1284
+ const a = e.command === "server" ? e.port ?? 9400 : 0, l = new Me();
1291
1285
  let u = !1, y = !0;
1292
- const E = await wt({
1293
- port: e.port ? e.port : await ft(a) ? 0 : a,
1286
+ const E = await bt({
1287
+ port: e.port ? e.port : await yt(a) ? 0 : a,
1294
1288
  onBind: async (c, n) => {
1295
- const m = "127.0.0.1", b = `http://${m}:${n}`, L = e["site-url"] || b, U = 6, Q = "-playground-cli-site-", T = await kt(Q);
1289
+ const m = "127.0.0.1", b = `http://${m}:${n}`, L = e["site-url"] || b, _ = 6, J = "-playground-cli-site-", T = await Ct(J);
1296
1290
  w.debug(`Native temp dir for VFS root: ${T.path}`);
1297
- const A = "WP Playground CLI - Listen for Xdebug", X = ".playground-xdebug-root", _ = d.join(process.cwd(), X);
1298
- if (await Ke(_), e.xdebug) {
1299
- const h = {
1300
- hostPath: d.join(".", d.sep, X),
1291
+ const A = "WP Playground CLI - Listen for Xdebug", K = ".playground-xdebug-root", U = d.join(process.cwd(), K);
1292
+ if (await tt(U), e.xdebug) {
1293
+ const f = {
1294
+ hostPath: d.join(".", d.sep, K),
1301
1295
  vfsPath: "/"
1302
1296
  };
1303
1297
  if (W.indexOf(
1304
1298
  e.php || C
1305
1299
  ) <= W.indexOf("8.5"))
1306
- await oe(
1300
+ await ne(
1307
1301
  T.path,
1308
- _,
1302
+ U,
1309
1303
  process.platform
1310
- ), e.xdebug = et({
1304
+ ), e.xdebug = rt({
1311
1305
  cwd: process.cwd(),
1312
1306
  mounts: [
1313
- h,
1307
+ f,
1314
1308
  ...e["mount-before-install"] || [],
1315
1309
  ...e.mount || []
1316
1310
  ],
@@ -1323,34 +1317,34 @@ async function Lt(e) {
1323
1317
  ]
1324
1318
  }), console.log(I("Xdebug configured successfully")), console.log(
1325
1319
  j("Playground source root: ") + ".playground-xdebug-root" + R(
1326
- ue(
1320
+ pe(
1327
1321
  " – you can set breakpoints and preview Playground's VFS structure in there."
1328
1322
  )
1329
1323
  )
1330
1324
  );
1331
1325
  else if (e.experimentalUnsafeIdeIntegration) {
1332
- await oe(
1326
+ await ne(
1333
1327
  T.path,
1334
- _,
1328
+ U,
1335
1329
  process.platform
1336
1330
  );
1337
1331
  try {
1338
- await tt(
1332
+ await ot(
1339
1333
  A,
1340
1334
  process.cwd()
1341
1335
  );
1342
- const f = typeof e.xdebug == "object" ? e.xdebug : {}, g = await rt({
1336
+ const h = typeof e.xdebug == "object" ? e.xdebug : {}, g = await st({
1343
1337
  name: A,
1344
1338
  host: m,
1345
1339
  port: n,
1346
1340
  ides: e.experimentalUnsafeIdeIntegration,
1347
1341
  cwd: process.cwd(),
1348
1342
  mounts: [
1349
- h,
1343
+ f,
1350
1344
  ...e["mount-before-install"] || [],
1351
1345
  ...e.mount || []
1352
1346
  ],
1353
- ideKey: f.ideKey || "WPPLAYGROUNDCLI"
1347
+ ideKey: h.ideKey || "WPPLAYGROUNDCLI"
1354
1348
  }), v = e.experimentalUnsafeIdeIntegration, S = v.includes("vscode"), x = v.includes("phpstorm"), B = Object.values(g);
1355
1349
  console.log(""), B.length > 0 ? (console.log(
1356
1350
  I("Xdebug configured successfully")
@@ -1358,7 +1352,7 @@ async function Lt(e) {
1358
1352
  j("Updated IDE config: ") + B.join(" ")
1359
1353
  ), console.log(
1360
1354
  j("Playground source root: ") + ".playground-xdebug-root" + R(
1361
- ue(
1355
+ pe(
1362
1356
  " – you can set breakpoints and preview Playground's VFS structure in there."
1363
1357
  )
1364
1358
  )
@@ -1395,22 +1389,22 @@ async function Lt(e) {
1395
1389
  ), console.log(
1396
1390
  " 4. Visit Playground in your browser to hit the breakpoint"
1397
1391
  )), console.log("");
1398
- } catch (f) {
1392
+ } catch (h) {
1399
1393
  throw new Error("Could not configure Xdebug", {
1400
- cause: f
1394
+ cause: h
1401
1395
  });
1402
1396
  }
1403
1397
  }
1404
1398
  }
1405
- const ve = d.dirname(T.path), Se = 2 * 24 * 60 * 60 * 1e3;
1406
- Mt(
1407
- Q,
1408
- Se,
1409
- ve
1399
+ const xe = d.dirname(T.path), Ee = 2 * 24 * 60 * 60 * 1e3;
1400
+ At(
1401
+ J,
1402
+ Ee,
1403
+ xe
1410
1404
  );
1411
- const Z = d.join(T.path, "internal");
1412
- Y(Z);
1413
- const xe = [
1405
+ const ee = d.join(T.path, "internal");
1406
+ Y(ee);
1407
+ const $e = [
1414
1408
  "wordpress",
1415
1409
  "tools",
1416
1410
  // Note: These dirs are from Emscripten's "default dirs" list:
@@ -1422,37 +1416,37 @@ async function Lt(e) {
1422
1416
  "tmp",
1423
1417
  "home"
1424
1418
  ];
1425
- for (const h of xe) {
1426
- const P = (g) => g.vfsPath === `/${h}`;
1419
+ for (const f of $e) {
1420
+ const P = (g) => g.vfsPath === `/${f}`;
1427
1421
  if (!(e["mount-before-install"]?.some(P) || e.mount?.some(P))) {
1428
1422
  const g = d.join(
1429
1423
  T.path,
1430
- h
1424
+ f
1431
1425
  );
1432
1426
  Y(g), e["mount-before-install"] === void 0 && (e["mount-before-install"] = []), e["mount-before-install"].unshift({
1433
- vfsPath: `/${h}`,
1427
+ vfsPath: `/${f}`,
1434
1428
  hostPath: g
1435
1429
  });
1436
1430
  }
1437
1431
  }
1438
1432
  if (e["mount-before-install"])
1439
- for (const h of e["mount-before-install"])
1433
+ for (const f of e["mount-before-install"])
1440
1434
  w.debug(
1441
- `Mount before WP install: ${h.vfsPath} -> ${h.hostPath}`
1435
+ `Mount before WP install: ${f.vfsPath} -> ${f.hostPath}`
1442
1436
  );
1443
1437
  if (e.mount)
1444
- for (const h of e.mount)
1438
+ for (const f of e.mount)
1445
1439
  w.debug(
1446
- `Mount after WP install: ${h.vfsPath} -> ${h.hostPath}`
1440
+ `Mount after WP install: ${f.vfsPath} -> ${f.hostPath}`
1447
1441
  );
1448
1442
  let k;
1449
- e["experimental-blueprints-v2-runner"] ? k = new xt(e, {
1443
+ e["experimental-blueprints-v2-runner"] ? k = new $t(e, {
1450
1444
  siteUrl: L,
1451
1445
  cliOutput: i
1452
- }) : (k = new It(e, {
1446
+ }) : (k = new Mt(e, {
1453
1447
  siteUrl: L,
1454
1448
  cliOutput: i
1455
- }), typeof e.blueprint == "string" && (e.blueprint = await St({
1449
+ }), typeof e.blueprint == "string" && (e.blueprint = await Et({
1456
1450
  sourceString: e.blueprint,
1457
1451
  blueprintMayReadAdjacentFiles: e["blueprint-may-read-adjacent-files"] === !0
1458
1452
  })));
@@ -1467,22 +1461,22 @@ async function Lt(e) {
1467
1461
  }), await T.cleanup());
1468
1462
  };
1469
1463
  try {
1470
- const h = [], P = k.getWorkerType();
1471
- for (let f = 0; f < U; f++) {
1472
- const g = _t(P, {
1464
+ const f = [], P = k.getWorkerType();
1465
+ for (let h = 0; h < _; h++) {
1466
+ const g = Se(P, {
1473
1467
  onExit: (v) => {
1474
1468
  H || v === 0 && w.error(
1475
- `Worker ${f} exited with code ${v}
1469
+ `Worker ${h} exited with code ${v}
1476
1470
  `
1477
1471
  );
1478
1472
  }
1479
1473
  }).then(
1480
1474
  async (v) => {
1481
1475
  o.push(v);
1482
- const S = await Ht(l), x = await k.bootRequestHandler({
1476
+ const S = await Nt(l), x = await k.bootRequestHandler({
1483
1477
  worker: v,
1484
1478
  fileLockManagerPort: S,
1485
- nativeInternalDirPath: Z
1479
+ nativeInternalDirPath: ee
1486
1480
  });
1487
1481
  return s.set(
1488
1482
  v,
@@ -1490,16 +1484,16 @@ async function Lt(e) {
1490
1484
  ), [v, x];
1491
1485
  }
1492
1486
  );
1493
- h.push(g), f === 0 && await g;
1487
+ f.push(g), h === 0 && await g;
1494
1488
  }
1495
- await Promise.all(h), t = ke(
1489
+ await Promise.all(f), t = Ce(
1496
1490
  o.map(
1497
- (f) => s.get(f)
1491
+ (h) => s.get(h)
1498
1492
  )
1499
1493
  );
1500
1494
  {
1501
- const f = new pe(), g = f.port1, v = f.port2;
1502
- if (await Me(
1495
+ const h = new he(), g = h.port1, v = h.port2;
1496
+ if (await Ae(
1503
1497
  {
1504
1498
  applyPostInstallMountsToAllWorkers: async () => {
1505
1499
  await Promise.all(
@@ -1522,19 +1516,19 @@ async function Lt(e) {
1522
1516
  const S = await k.compileInputBlueprint(
1523
1517
  e["additional-blueprint-steps"] || []
1524
1518
  );
1525
- S && await te(
1519
+ S && await se(
1526
1520
  S,
1527
1521
  t
1528
1522
  );
1529
1523
  }
1530
1524
  if (e.phpmyadmin && !await t.fileExists(
1531
- `${se}/index.php`
1525
+ `${ae}/index.php`
1532
1526
  )) {
1533
- const S = await st(), x = await ce({ steps: S });
1534
- await te(x, t);
1527
+ const S = await nt(), x = await fe({ steps: S });
1528
+ await se(x, t);
1535
1529
  }
1536
1530
  if (e.command === "build-snapshot") {
1537
- await Ot(t, e.outfile), i.printStatus(`Exported to ${e.outfile}`), await M();
1531
+ await Ft(t, e.outfile), i.printStatus(`Exported to ${e.outfile}`), await M();
1538
1532
  return;
1539
1533
  } else if (e.command === "run-blueprint") {
1540
1534
  i.finishProgress("Done"), await M();
@@ -1565,16 +1559,16 @@ async function Lt(e) {
1565
1559
  await M(), process.exit(B);
1566
1560
  }
1567
1561
  }
1568
- if (i.finishProgress(), i.printReady(b, U), e.phpmyadmin) {
1569
- const f = d.join(
1562
+ if (i.finishProgress(), i.printReady(b, _), e.phpmyadmin) {
1563
+ const h = d.join(
1570
1564
  e.phpmyadmin,
1571
- it
1565
+ at
1572
1566
  );
1573
1567
  i.printPhpMyAdminUrl(
1574
- new URL(f, b).toString()
1568
+ new URL(h, b).toString()
1575
1569
  );
1576
1570
  }
1577
- return e.xdebug && e.experimentalDevtools && (await Xe({
1571
+ return e.xdebug && e.experimentalDevtools && (await Je({
1578
1572
  phpInstance: t,
1579
1573
  phpRoot: "/wordpress"
1580
1574
  })).start(), {
@@ -1582,20 +1576,20 @@ async function Lt(e) {
1582
1576
  server: c,
1583
1577
  serverUrl: b,
1584
1578
  [Symbol.asyncDispose]: M,
1585
- [Pe]: {
1586
- workerThreadCount: U
1579
+ [Z]: {
1580
+ workerThreadCount: _
1587
1581
  }
1588
1582
  };
1589
- } catch (h) {
1583
+ } catch (f) {
1590
1584
  if (e.verbosity !== "debug")
1591
- throw h;
1585
+ throw f;
1592
1586
  let P = "";
1593
- throw await t?.fileExists(J) && (P = await t.readFileAsText(J)), await M(), new Error(P, { cause: h });
1587
+ throw await t?.fileExists(te) && (P = await t.readFileAsText(te)), await M(), new Error(P, { cause: f });
1594
1588
  }
1595
1589
  },
1596
1590
  async handleRequest(c) {
1597
1591
  if (!u)
1598
- return K.forHttpCode(
1592
+ return re.forHttpCode(
1599
1593
  502,
1600
1594
  "WordPress is not ready yet"
1601
1595
  );
@@ -1610,8 +1604,8 @@ async function Lt(e) {
1610
1604
  "playground_auto_login_already_happened"
1611
1605
  ) && (m["Set-Cookie"] = [
1612
1606
  "playground_auto_login_already_happened=1; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/"
1613
- ]), K.fromPHPResponse(
1614
- new Ce(302, m, new Uint8Array())
1607
+ ]), re.fromPHPResponse(
1608
+ new Be(302, m, new Uint8Array())
1615
1609
  );
1616
1610
  }
1617
1611
  r && (c = {
@@ -1636,18 +1630,18 @@ async function Lt(e) {
1636
1630
  }).catch((c) => {
1637
1631
  i.printError(c.message), process.exit(1);
1638
1632
  });
1639
- return E && e.command === "start" && !e.skipBrowser && Nt(E.serverUrl), E;
1633
+ return E && e.command === "start" && !e.skipBrowser && Ot(E.serverUrl), E;
1640
1634
  }
1641
- function Ut(e) {
1635
+ function Ht(e) {
1642
1636
  let t = { ...e, command: "server" };
1643
- e.noAutoMount || (t.autoMount = d.resolve(process.cwd(), t.path ?? ""), t = we(t), delete t.autoMount);
1644
- const r = le(
1637
+ e.noAutoMount || (t.autoMount = d.resolve(process.cwd(), t.path ?? ""), t = ge(t), delete t.autoMount);
1638
+ const r = ce(
1645
1639
  t["mount-before-install"] || [],
1646
1640
  "/wordpress"
1647
- ) || le(t.mount || [], "/wordpress");
1641
+ ) || ce(t.mount || [], "/wordpress");
1648
1642
  if (r)
1649
1643
  console.log("Site files stored at:", r?.hostPath), e.reset && (console.log(""), console.log(
1650
- Wt(
1644
+ Ut(
1651
1645
  "This site is not managed by Playground CLI and cannot be reset."
1652
1646
  )
1653
1647
  ), console.log(
@@ -1656,15 +1650,15 @@ function Ut(e) {
1656
1650
  "You may still remove the site's directory manually if you wish."
1657
1651
  ), process.exit(1));
1658
1652
  else {
1659
- const o = t.autoMount || process.cwd(), s = ot("sha256").update(o).digest("hex"), i = G.homedir(), a = d.join(
1653
+ const o = t.autoMount || process.cwd(), s = it("sha256").update(o).digest("hex"), i = G.homedir(), a = d.join(
1660
1654
  i,
1661
1655
  ".wordpress-playground/sites",
1662
1656
  s
1663
1657
  );
1664
- console.log("Site files stored at:", a), z(a) && e.reset && (console.log("Resetting site..."), We(a, { recursive: !0 })), Y(a, { recursive: !0 }), t["mount-before-install"] = [
1658
+ console.log("Site files stored at:", a), z(a) && e.reset && (console.log("Resetting site..."), _e(a, { recursive: !0 })), Y(a, { recursive: !0 }), t["mount-before-install"] = [
1665
1659
  ...t["mount-before-install"] || [],
1666
1660
  { vfsPath: "/wordpress", hostPath: a }
1667
- ], t.wordpressInstallMode = Le(a).length === 0 ? (
1661
+ ], t.wordpressInstallMode = Ue(a).length === 0 ? (
1668
1662
  // Only download WordPress on the first run when the site directory is still
1669
1663
  // empty.
1670
1664
  "download-and-install"
@@ -1675,10 +1669,10 @@ function Ut(e) {
1675
1669
  }
1676
1670
  return t;
1677
1671
  }
1678
- const V = new Ee();
1679
- function _t(e, { onExit: t } = {}) {
1672
+ const V = new Te();
1673
+ function Se(e, { onExit: t } = {}) {
1680
1674
  let r;
1681
- return e === "v1" ? r = new re(new URL("./worker-thread-v1.js", import.meta.url)) : r = new re(new URL("./worker-thread-v2.js", import.meta.url)), new Promise((o, s) => {
1675
+ return e === "v1" ? r = new ie(new URL("./worker-thread-v1.js", import.meta.url)) : r = new ie(new URL("./worker-thread-v2.js", import.meta.url)), new Promise((o, s) => {
1682
1676
  const i = V.claim();
1683
1677
  r.once("message", function(l) {
1684
1678
  l.command === "worker-script-initialized" && o({
@@ -1701,11 +1695,11 @@ function _t(e, { onExit: t } = {}) {
1701
1695
  });
1702
1696
  });
1703
1697
  }
1704
- async function Ht(e) {
1705
- const { port1: t, port2: r } = new pe();
1706
- return await Ae(e, t), r;
1698
+ async function Nt(e) {
1699
+ const { port1: t, port2: r } = new he();
1700
+ return await Re(e, t), r;
1707
1701
  }
1708
- function Nt(e) {
1702
+ function Ot(e) {
1709
1703
  const t = G.platform();
1710
1704
  let r;
1711
1705
  switch (t) {
@@ -1719,11 +1713,11 @@ function Nt(e) {
1719
1713
  r = `xdg-open "${e}"`;
1720
1714
  break;
1721
1715
  }
1722
- he(r, (o) => {
1716
+ ye(r, (o) => {
1723
1717
  o && w.debug(`Could not open browser: ${o.message}`);
1724
1718
  });
1725
1719
  }
1726
- async function Ot(e, t) {
1720
+ async function Ft(e, t) {
1727
1721
  await e.run({
1728
1722
  code: `<?php
1729
1723
  $zip = new ZipArchive();
@@ -1747,14 +1741,24 @@ async function Ot(e, t) {
1747
1741
  const r = await e.readFileAsBuffer("/tmp/build.zip");
1748
1742
  p.writeFileSync(t, r);
1749
1743
  }
1744
+ const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1745
+ __proto__: null,
1746
+ LogVerbosity: X,
1747
+ internalsKeyForTesting: Z,
1748
+ mergeDefinedConstants: Q,
1749
+ parseOptionsAndRunCLI: _t,
1750
+ runCLI: ve,
1751
+ spawnWorkerThread: Se
1752
+ }, Symbol.toStringTag, { value: "Module" }));
1750
1753
  export {
1751
- ge as L,
1752
- fr as a,
1753
- Rt as b,
1754
- Pe as i,
1755
- ye as m,
1756
- wr as p,
1757
- Lt as r,
1758
- _t as s
1754
+ X as L,
1755
+ wr as a,
1756
+ Wt as b,
1757
+ yr as c,
1758
+ Z as i,
1759
+ Q as m,
1760
+ _t as p,
1761
+ ve as r,
1762
+ Se as s
1759
1763
  };
1760
- //# sourceMappingURL=run-cli-2YzKNrNz.js.map
1764
+ //# sourceMappingURL=run-cli-Dka9y1Ev.js.map