@wp-playground/cli 3.1.13 → 3.1.15

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,11 +1,11 @@
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";
1
+ import { logger as w, LogSeverity as F, errorLogPath as te } from "@php-wasm/logger";
2
+ import { consumeAPI as me, ProcessIdAllocator as Te, SupportedPHPVersions as U, printDebugDetails as Ie, HttpCookieStore as ke, FileLockManagerInMemory as Me, StreamedPHPResponse as re, createObjectPoolProxy as Ce, exposeAPI as Ae, PHPResponse as Be, exposeSyncAPI as De } from "@php-wasm/universal";
3
+ import { resolveRemoteBlueprint as Re, resolveRuntimeConfiguration as oe, compileBlueprintV1 as fe, isBlueprintBundle as We, runBlueprintV1Steps as se } from "@wp-playground/blueprints";
4
+ import { zipDirectory as Le, RecommendedPHPVersion as D } from "@wp-playground/common";
5
+ import p, { existsSync as G, rmdirSync as _e, mkdirSync as q, readdirSync as Ue } from "fs";
6
6
  import { MessageChannel as he, Worker as ie } from "worker_threads";
7
7
  import { createNodeFsMountHandler as He } from "@php-wasm/node";
8
- import d, { basename as D, join as we } from "path";
8
+ import d, { basename as _, join as we } from "path";
9
9
  import { exec as ye } from "child_process";
10
10
  import { promisify as Ne } from "util";
11
11
  import be from "express";
@@ -15,16 +15,16 @@ import je from "yargs";
15
15
  import { NodeJsFilesystem as Ve, OverlayFilesystem as Ye, InMemoryFilesystem as qe, ZipFilesystem as ze } from "@wp-playground/storage";
16
16
  import { EmscriptenDownloadMonitor as Ge, ProgressTracker as Qe } from "@php-wasm/progress";
17
17
  import { resolveWordPressRelease as Xe } from "@wp-playground/wordpress";
18
- import $ from "fs-extra";
18
+ import k from "fs-extra";
19
19
  import { createRequire as Ze } from "module";
20
- import G from "os";
20
+ import Q from "os";
21
21
  import { startBridge as Je } from "@php-wasm/xdebug-bridge";
22
22
  import { dir as Ke, setGracefulCleanup as et } from "tmp-promise";
23
23
  import { removeTempDirSymlink as tt, createTempDirSymlink as ne, makeXdebugConfig as rt, clearXdebugIDEConfig as ot, addXdebugIDEConfig as st } from "@php-wasm/cli-util";
24
24
  import { createHash as it } from "crypto";
25
25
  import { PHPMYADMIN_INSTALL_PATH as ae, getPhpMyAdminInstallSteps as nt, PHPMYADMIN_ENTRY_PATH as at } from "@wp-playground/tools";
26
26
  import { jspi as le } from "wasm-feature-detect";
27
- function F(e) {
27
+ function j(e) {
28
28
  const t = [];
29
29
  for (const r of e) {
30
30
  const o = r.split(":");
@@ -34,7 +34,7 @@ function F(e) {
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
36
  const [s, i] = o;
37
- if (!z(s))
37
+ if (!G(s))
38
38
  throw new Error(`Host path does not exist: ${s}`);
39
39
  t.push({ hostPath: s, vfsPath: i });
40
40
  }
@@ -46,7 +46,7 @@ function ue(e) {
46
46
  const t = [];
47
47
  for (let r = 0; r < e.length; r += 2) {
48
48
  const o = e[r], s = e[r + 1];
49
- if (!z(o))
49
+ if (!G(o))
50
50
  throw new Error(`Host path does not exist: ${o}`);
51
51
  t.push({
52
52
  hostPath: d.resolve(process.cwd(), o),
@@ -91,20 +91,20 @@ function ge(e) {
91
91
  ]
92
92
  };
93
93
  if (ct(t)) {
94
- const a = `/wordpress/wp-content/plugins/${D(t)}`;
94
+ const n = `/wordpress/wp-content/plugins/${_(t)}`;
95
95
  r.push({
96
96
  hostPath: t,
97
- vfsPath: a,
97
+ vfsPath: n,
98
98
  autoMounted: !0
99
99
  }), s["additional-blueprint-steps"].push({
100
100
  step: "activatePlugin",
101
- pluginPath: `/wordpress/wp-content/plugins/${D(t)}`
101
+ pluginPath: `/wordpress/wp-content/plugins/${_(t)}`
102
102
  });
103
103
  } else if (dt(t)) {
104
- const i = D(t), a = `/wordpress/wp-content/themes/${i}`;
104
+ const i = _(t), n = `/wordpress/wp-content/themes/${i}`;
105
105
  r.push({
106
106
  hostPath: t,
107
- vfsPath: a,
107
+ vfsPath: n,
108
108
  autoMounted: !0
109
109
  }), s["additional-blueprint-steps"].push(
110
110
  e["experimental-blueprints-v2-runner"] ? {
@@ -117,10 +117,10 @@ function ge(e) {
117
117
  );
118
118
  } else if (ut(t)) {
119
119
  const i = p.readdirSync(t);
120
- for (const a of i)
121
- a !== "index.php" && r.push({
122
- hostPath: `${t}/${a}`,
123
- vfsPath: `/wordpress/wp-content/${a}`,
120
+ for (const n of i)
121
+ n !== "index.php" && r.push({
122
+ hostPath: `${t}/${n}`,
123
+ vfsPath: `/wordpress/wp-content/${n}`,
124
124
  autoMounted: !0
125
125
  });
126
126
  s["additional-blueprint-steps"].push(de);
@@ -207,18 +207,18 @@ function ft(e) {
207
207
  return t;
208
208
  }
209
209
  function ht(e = {}, t = {}, r = {}) {
210
- const o = {}, s = /* @__PURE__ */ new Set(), i = (a, l) => {
211
- for (const u in a) {
210
+ const o = {}, s = /* @__PURE__ */ new Set(), i = (n, l) => {
211
+ for (const u in n) {
212
212
  if (s.has(u))
213
213
  throw new Error(
214
214
  `Constant "${u}" is defined multiple times across different --define-${l} flags`
215
215
  );
216
- s.add(u), o[u] = a[u];
216
+ s.add(u), o[u] = n[u];
217
217
  }
218
218
  };
219
219
  return i(e, "string"), i(t, "bool"), i(r, "number"), o;
220
220
  }
221
- function Q(e) {
221
+ function X(e) {
222
222
  return ht(
223
223
  e.define,
224
224
  e["define-bool"],
@@ -237,19 +237,19 @@ function yt(e) {
237
237
  });
238
238
  }
239
239
  async function bt(e) {
240
- const t = be(), r = await new Promise((a, l) => {
240
+ const t = be(), r = await new Promise((n, l) => {
241
241
  const u = t.listen(e.port, () => {
242
242
  const y = u.address();
243
- y === null || typeof y == "string" ? l(new Error("Server address is not available")) : a(u);
243
+ y === null || typeof y == "string" ? l(new Error("Server address is not available")) : n(u);
244
244
  }).once("error", l);
245
245
  });
246
- t.use("/", async (a, l) => {
246
+ t.use("/", async (n, l) => {
247
247
  try {
248
248
  const u = {
249
- url: a.url,
250
- headers: St(a),
251
- method: a.method,
252
- body: await Pt(a)
249
+ url: n.url,
250
+ headers: St(n),
251
+ method: n.method,
252
+ body: await Pt(n)
253
253
  }, y = await e.handleRequest(u);
254
254
  await gt(y, l);
255
255
  } catch (u) {
@@ -312,7 +312,7 @@ async function Et({
312
312
  if (!e)
313
313
  return;
314
314
  if (e.startsWith("http://") || e.startsWith("https://"))
315
- return await De(e);
315
+ return await Re(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}`);
@@ -336,7 +336,7 @@ async function Et({
336
336
  `Blueprint file at ${r} is not a valid JSON file`
337
337
  );
338
338
  }
339
- const a = d.dirname(r), l = new Ve(a);
339
+ const n = d.dirname(r), l = new Ve(n);
340
340
  return new Ye([
341
341
  new qe({
342
342
  "blueprint.json": i
@@ -400,16 +400,16 @@ class $t {
400
400
  nativeInternalDirPath: o,
401
401
  mountsBeforeWpInstall: this.args["mount-before-install"] || [],
402
402
  mountsAfterWpInstall: this.args.mount || [],
403
- constants: Q(this.args)
403
+ constants: X(this.args)
404
404
  };
405
405
  return await s.bootWorker(i), s;
406
406
  }
407
407
  }
408
- const q = d.join(G.homedir(), ".wordpress-playground");
408
+ const z = d.join(Q.homedir(), ".wordpress-playground");
409
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
- if (!$.existsSync(t)) {
412
+ if (!k.existsSync(t)) {
413
413
  const r = Ze(import.meta.url), o = d.dirname(
414
414
  r.resolve("@wp-playground/wordpress-builds/package.json")
415
415
  );
@@ -420,29 +420,29 @@ async function Tt() {
420
420
  "sqlite-database-integration-trunk.zip"
421
421
  );
422
422
  }
423
- return new File([await $.readFile(t)], d.basename(t));
423
+ return new File([await k.readFile(t)], d.basename(t));
424
424
  }
425
425
  async function It(e, t, r) {
426
- const o = d.join(q, t);
427
- return $.existsSync(o) || ($.ensureDirSync(q), await kt(e, o, r)), Pe(o);
426
+ const o = d.join(z, t);
427
+ return k.existsSync(o) || (k.ensureDirSync(z), await kt(e, o, r)), Pe(o);
428
428
  }
429
429
  async function kt(e, t, r) {
430
- const s = (await r.monitorFetch(fetch(e))).body.getReader(), i = `${t}.partial`, a = $.createWriteStream(i);
430
+ const s = (await r.monitorFetch(fetch(e))).body.getReader(), i = `${t}.partial`, n = k.createWriteStream(i);
431
431
  for (; ; ) {
432
432
  const { done: l, value: u } = await s.read();
433
- if (u && a.write(u), l)
433
+ if (u && n.write(u), l)
434
434
  break;
435
435
  }
436
- a.close(), a.closed || await new Promise((l, u) => {
437
- a.on("finish", () => {
438
- $.renameSync(i, t), l(null);
439
- }), a.on("error", (y) => {
440
- $.removeSync(i), u(y);
436
+ n.close(), n.closed || await new Promise((l, u) => {
437
+ n.on("finish", () => {
438
+ k.renameSync(i, t), l(null);
439
+ }), n.on("error", (y) => {
440
+ k.removeSync(i), u(y);
441
441
  });
442
442
  });
443
443
  }
444
444
  function Pe(e, t) {
445
- return new File([$.readFileSync(e)], D(e));
445
+ return new File([k.readFileSync(e)], _(e));
446
446
  }
447
447
  class Mt {
448
448
  constructor(t, r) {
@@ -453,26 +453,26 @@ class Mt {
453
453
  }
454
454
  async bootWordPress(t, r) {
455
455
  let o, s, i;
456
- const a = new Ge();
456
+ const n = new Ge();
457
457
  if (this.args.wordpressInstallMode === "download-and-install") {
458
458
  let y = !1;
459
- a.addEventListener("progress", (E) => {
459
+ n.addEventListener("progress", (M) => {
460
460
  if (y)
461
461
  return;
462
- const { loaded: c, total: n } = E.detail, m = Math.floor(
463
- Math.min(100, 100 * c / n)
462
+ const { loaded: c, total: x } = M.detail, h = Math.floor(
463
+ Math.min(100, 100 * c / x)
464
464
  );
465
- y = m === 100, this.cliOutput.updateProgress(
465
+ y = h === 100, this.cliOutput.updateProgress(
466
466
  "Downloading WordPress",
467
- m
467
+ h
468
468
  );
469
469
  }), o = await Xe(this.args.wp), i = d.join(
470
- q,
470
+ z,
471
471
  `prebuilt-wp-content-for-wp-${o.version}.zip`
472
472
  ), s = p.existsSync(i) ? Pe(i) : await It(
473
473
  o.releaseUrl,
474
474
  `${o.version}.zip`,
475
- a
475
+ n
476
476
  ), w.debug(
477
477
  `Resolved WordPress release URL: ${o?.releaseUrl}`
478
478
  );
@@ -489,7 +489,7 @@ class Mt {
489
489
  wordpressInstallMode: this.args.wordpressInstallMode || "download-and-install",
490
490
  wordPressZip: s && await s.arrayBuffer(),
491
491
  sqliteIntegrationPluginZip: await l?.arrayBuffer(),
492
- constants: Q(this.args)
492
+ constants: X(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(
@@ -533,12 +533,12 @@ class Mt {
533
533
  async compileInputBlueprint(t) {
534
534
  const r = this.getEffectiveBlueprint(), o = new Qe();
535
535
  let s = "", i = !1;
536
- return o.addEventListener("progress", (a) => {
536
+ return o.addEventListener("progress", (n) => {
537
537
  if (i)
538
538
  return;
539
- i = a.detail.progress === 100;
540
- const l = Math.floor(a.detail.progress);
541
- s = a.detail.caption || s || "Running Blueprint", this.cliOutput.updateProgress(s.trim(), l);
539
+ i = n.detail.progress === 100;
540
+ const l = Math.floor(n.detail.progress);
541
+ s = n.detail.caption || s || "Running Blueprint", this.cliOutput.updateProgress(s.trim(), l);
542
542
  }), await fe(r, {
543
543
  progress: o,
544
544
  additionalSteps: t
@@ -550,7 +550,7 @@ class Mt {
550
550
  login: this.args.login,
551
551
  ...t || {},
552
552
  preferredVersions: {
553
- php: this.args.php ?? t?.preferredVersions?.php ?? C,
553
+ php: this.args.php ?? t?.preferredVersions?.php ?? D,
554
554
  wp: this.args.wp ?? t?.preferredVersions?.wp ?? "latest",
555
555
  ...t?.preferredVersions || {}
556
556
  }
@@ -578,14 +578,14 @@ async function At(e, t, r) {
578
578
  t,
579
579
  r
580
580
  )).map(
581
- (i) => new Promise((a) => {
581
+ (i) => new Promise((n) => {
582
582
  p.rm(i, { recursive: !0 }, (l) => {
583
583
  l ? w.warn(
584
584
  `Failed to delete stale Playground temp dir: ${i}`,
585
585
  l
586
586
  ) : w.info(
587
587
  `Deleted stale Playground temp dir: ${i}`
588
- ), a();
588
+ ), n();
589
589
  });
590
590
  })
591
591
  );
@@ -595,7 +595,7 @@ 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 Rt(
598
+ await Dt(
599
599
  e,
600
600
  t,
601
601
  i
@@ -605,7 +605,7 @@ async function Bt(e, t, r) {
605
605
  return w.warn(`Failed to find stale Playground temp dirs: ${o}`), [];
606
606
  }
607
607
  }
608
- async function Rt(e, t, r) {
608
+ async function Dt(e, t, r) {
609
609
  if (!p.lstatSync(r).isDirectory())
610
610
  return !1;
611
611
  const s = d.basename(r);
@@ -616,16 +616,16 @@ async function Rt(e, t, r) {
616
616
  );
617
617
  if (!i)
618
618
  return !1;
619
- const a = {
619
+ const n = {
620
620
  executableName: i[1],
621
621
  pid: i[2]
622
622
  };
623
- if (Dt(a.pid))
623
+ if (Rt(n.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 Dt(e, t) {
628
+ function Rt(e, t) {
629
629
  try {
630
630
  return process.kill(Number(e), 0), !0;
631
631
  } catch (r) {
@@ -805,10 +805,10 @@ ${this.green("Ready!")} WordPress is running on ${this.bold(t)} ${this.dim(`(${r
805
805
  );
806
806
  }
807
807
  }
808
- const X = {
809
- Quiet: { name: "quiet", severity: O.Fatal },
810
- Normal: { name: "normal", severity: O.Info },
811
- Debug: { name: "debug", severity: O.Debug }
808
+ const Z = {
809
+ Quiet: { name: "quiet", severity: F.Fatal },
810
+ Normal: { name: "normal", severity: F.Info },
811
+ Debug: { name: "debug", severity: F.Debug }
812
812
  };
813
813
  async function _t(e) {
814
814
  try {
@@ -820,8 +820,8 @@ async function _t(e) {
820
820
  php: {
821
821
  describe: "PHP version to use.",
822
822
  type: "string",
823
- default: C,
824
- choices: W
823
+ default: D,
824
+ choices: U
825
825
  },
826
826
  wp: {
827
827
  describe: "WordPress version to use.",
@@ -856,14 +856,14 @@ async function _t(e) {
856
856
  type: "array",
857
857
  string: !0,
858
858
  nargs: 1,
859
- coerce: F
859
+ coerce: j
860
860
  },
861
861
  "mount-before-install": {
862
862
  describe: "Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format: /host/path:/vfs/path",
863
863
  type: "array",
864
864
  string: !0,
865
865
  nargs: 1,
866
- coerce: F
866
+ coerce: j
867
867
  },
868
868
  "mount-dir": {
869
869
  describe: 'Mount a directory to the PHP runtime (can be used multiple times). Format: "/host/path" "/vfs/path"',
@@ -924,8 +924,8 @@ async function _t(e) {
924
924
  verbosity: {
925
925
  describe: "Output logs and progress messages.",
926
926
  type: "string",
927
- choices: Object.values(X).map(
928
- (n) => n.name
927
+ choices: Object.values(Z).map(
928
+ (a) => a.name
929
929
  ),
930
930
  default: "normal"
931
931
  },
@@ -985,7 +985,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
985
985
  // supported IDEs and, if needed, will create the relevant
986
986
  // config file for each.
987
987
  choices: ["", "vscode", "phpstorm"],
988
- coerce: (n) => n === "" ? ["vscode", "phpstorm"] : [n]
988
+ coerce: (a) => a === "" ? ["vscode", "phpstorm"] : [a]
989
989
  },
990
990
  "experimental-blueprints-v2-runner": {
991
991
  describe: "Use the experimental Blueprint V2 runner.",
@@ -1004,7 +1004,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1004
1004
  phpmyadmin: {
1005
1005
  describe: "Install phpMyAdmin for database management. The phpMyAdmin URL will be printed after boot. Optionally specify a custom URL path (default: /phpmyadmin).",
1006
1006
  type: "string",
1007
- coerce: (n) => n === "" ? "/phpmyadmin" : n
1007
+ coerce: (a) => a === "" ? "/phpmyadmin" : a
1008
1008
  }
1009
1009
  }, r = {
1010
1010
  port: {
@@ -1029,8 +1029,8 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1029
1029
  php: {
1030
1030
  describe: "PHP version to use.",
1031
1031
  type: "string",
1032
- default: C,
1033
- choices: W
1032
+ default: D,
1033
+ choices: U
1034
1034
  },
1035
1035
  wp: {
1036
1036
  describe: "WordPress version to use.",
@@ -1075,7 +1075,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1075
1075
  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.",
1076
1076
  type: "array",
1077
1077
  string: !0,
1078
- coerce: F
1078
+ coerce: j
1079
1079
  },
1080
1080
  reset: {
1081
1081
  describe: "Deletes the stored site directory and starts a new site from scratch.",
@@ -1102,7 +1102,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1102
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
- (n) => n.usage(
1105
+ (a) => a.usage(
1106
1106
  `Usage: wp-playground start [options]
1107
1107
 
1108
1108
  The easiest way to run WordPress locally. Automatically detects
@@ -1119,77 +1119,77 @@ Examples:
1119
1119
  ).command(
1120
1120
  "server",
1121
1121
  "Start a local WordPress server (advanced, low-level)",
1122
- (n) => n.options({
1122
+ (a) => a.options({
1123
1123
  ...t,
1124
1124
  ...r
1125
1125
  })
1126
1126
  ).command(
1127
1127
  "run-blueprint",
1128
1128
  "Execute a Blueprint without starting a server",
1129
- (n) => n.options({ ...t })
1129
+ (a) => a.options({ ...t })
1130
1130
  ).command(
1131
1131
  "build-snapshot",
1132
1132
  "Build a ZIP snapshot of a WordPress site based on a Blueprint",
1133
- (n) => n.options({
1133
+ (a) => a.options({
1134
1134
  ...t,
1135
1135
  ...s
1136
1136
  })
1137
1137
  ).command(
1138
1138
  "php",
1139
1139
  "Run a PHP script",
1140
- (n) => n.options({ ...t })
1140
+ (a) => a.options({ ...t })
1141
1141
  ).demandCommand(1, "Please specify a command").strictCommands().conflicts(
1142
1142
  "experimental-unsafe-ide-integration",
1143
1143
  "experimental-devtools"
1144
- ).showHelpOnFail(!1).fail((n, m, b) => {
1145
- if (m)
1146
- throw m;
1147
- n && n.includes("Please specify a command") && (b.showHelp(), console.error(`
1148
- ` + n), process.exit(1)), console.error(n), process.exit(1);
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" && !xt(n.wp))
1144
+ ).showHelpOnFail(!1).fail((a, E, P) => {
1145
+ if (E)
1146
+ throw E;
1147
+ a && a.includes("Please specify a command") && (P.showHelp(), console.error(`
1148
+ ` + a), process.exit(1)), console.error(a), process.exit(1);
1149
+ }).strictOptions().check(async (a) => {
1150
+ if (a["skip-wordpress-install"] === !0 && (a["wordpress-install-mode"] = "do-not-attempt-installing", a.wordpressInstallMode = "do-not-attempt-installing"), a.wp !== void 0 && typeof a.wp == "string" && !xt(a.wp))
1151
1151
  try {
1152
- new URL(n.wp);
1152
+ new URL(a.wp);
1153
1153
  } catch {
1154
1154
  throw new Error(
1155
1155
  'Unrecognized WordPress version. Please use "latest", a URL, or a numeric version such as "6.2", "6.0.1", "6.2-beta1", or "6.2-RC1"'
1156
1156
  );
1157
1157
  }
1158
- const m = n["site-url"];
1159
- if (typeof m == "string" && m.trim() !== "")
1158
+ const E = a["site-url"];
1159
+ if (typeof E == "string" && E.trim() !== "")
1160
1160
  try {
1161
- new URL(m);
1161
+ new URL(E);
1162
1162
  } catch {
1163
1163
  throw new Error(
1164
- `Invalid site-url "${m}". Please provide a valid URL (e.g., http://localhost:8080 or https://example.com)`
1164
+ `Invalid site-url "${E}". Please provide a valid URL (e.g., http://localhost:8080 or https://example.com)`
1165
1165
  );
1166
1166
  }
1167
- if (n["auto-mount"]) {
1168
- let b = !1;
1167
+ if (a["auto-mount"]) {
1168
+ let P = !1;
1169
1169
  try {
1170
- b = p.statSync(
1171
- n["auto-mount"]
1170
+ P = p.statSync(
1171
+ a["auto-mount"]
1172
1172
  ).isDirectory();
1173
1173
  } catch {
1174
- b = !1;
1174
+ P = !1;
1175
1175
  }
1176
- if (!b)
1176
+ if (!P)
1177
1177
  throw new Error(
1178
- `The specified --auto-mount path is not a directory: '${n["auto-mount"]}'.`
1178
+ `The specified --auto-mount path is not a directory: '${a["auto-mount"]}'.`
1179
1179
  );
1180
1180
  }
1181
- if (n["experimental-blueprints-v2-runner"] === !0)
1181
+ if (a["experimental-blueprints-v2-runner"] === !0)
1182
1182
  throw new Error(
1183
1183
  "Blueprints v2 are temporarily disabled while we rework their runtime implementation."
1184
1184
  );
1185
- if (n.mode !== void 0)
1185
+ if (a.mode !== void 0)
1186
1186
  throw new Error(
1187
1187
  "The --mode option requires the --experimentalBlueprintsV2Runner flag."
1188
1188
  );
1189
1189
  return !0;
1190
1190
  });
1191
1191
  i.wrap(i.terminalWidth());
1192
- const a = await i.argv, l = a._[0];
1192
+ const n = await i.argv, l = n._[0];
1193
1193
  [
1194
1194
  "start",
1195
1195
  "run-blueprint",
@@ -1197,33 +1197,33 @@ Examples:
1197
1197
  "build-snapshot",
1198
1198
  "php"
1199
1199
  ].includes(l) || (i.showHelp(), process.exit(1));
1200
- const u = a.define || {};
1201
- !("WP_DEBUG" in u) && !("WP_DEBUG_LOG" in u) && !("WP_DEBUG_DISPLAY" in u) && (u.WP_DEBUG = "true", u.WP_DEBUG_LOG = "true", u.WP_DEBUG_DISPLAY = "true");
1202
- const y = {
1203
- ...a,
1200
+ const u = n.define || {}, y = n["define-bool"] || {}, M = n["define-number"] || {}, c = (a) => a in u || a in y || a in M;
1201
+ c("WP_DEBUG") || (u.WP_DEBUG = "true"), c("WP_DEBUG_LOG") || (u.WP_DEBUG_LOG = "true"), c("WP_DEBUG_DISPLAY") || (u.WP_DEBUG_DISPLAY = "false");
1202
+ const x = {
1203
+ ...n,
1204
1204
  define: u,
1205
1205
  command: l,
1206
1206
  mount: [
1207
- ...a.mount || [],
1208
- ...a["mount-dir"] || []
1207
+ ...n.mount || [],
1208
+ ...n["mount-dir"] || []
1209
1209
  ],
1210
1210
  "mount-before-install": [
1211
- ...a["mount-before-install"] || [],
1212
- ...a["mount-dir-before-install"] || []
1211
+ ...n["mount-before-install"] || [],
1212
+ ...n["mount-dir-before-install"] || []
1213
1213
  ]
1214
- }, E = await ve(y);
1215
- E === void 0 && process.exit(0);
1216
- const c = /* @__PURE__ */ (() => {
1217
- let n;
1214
+ }, h = await ve(x);
1215
+ h === void 0 && process.exit(0);
1216
+ const T = /* @__PURE__ */ (() => {
1217
+ let a;
1218
1218
  return async () => {
1219
- n === void 0 && (n = E[Symbol.asyncDispose]()), await n, process.exit(0);
1219
+ a === void 0 && (a = h[Symbol.asyncDispose]()), await a, process.exit(0);
1220
1220
  };
1221
1221
  })();
1222
- return process.on("SIGINT", c), process.on("SIGTERM", c), {
1222
+ return process.on("SIGINT", T), process.on("SIGTERM", T), {
1223
1223
  [Symbol.asyncDispose]: async () => {
1224
- process.off("SIGINT", c), process.off("SIGTERM", c), await E[Symbol.asyncDispose]();
1224
+ process.off("SIGINT", T), process.off("SIGTERM", T), await h[Symbol.asyncDispose]();
1225
1225
  },
1226
- [Z]: { cliServer: E }
1226
+ [J]: { cliServer: h }
1227
1227
  };
1228
1228
  } catch (t) {
1229
1229
  if (console.error(t), !(t instanceof Error))
@@ -1248,13 +1248,13 @@ function ce(e, t) {
1248
1248
  (r) => r.vfsPath.replace(/\/$/, "") === t.replace(/\/$/, "")
1249
1249
  );
1250
1250
  }
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;
1251
+ const J = Symbol("playground-cli-testing"), C = (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, L = (e) => process.stdout.isTTY ? `\x1B[3m${e}\x1B[0m` : e, V = (e) => process.stdout.isTTY ? `\x1B[33m${e}\x1B[0m` : e;
1252
1252
  async function ve(e) {
1253
1253
  let t;
1254
1254
  const r = e.internalCookieStore ? new ke() : void 0, o = [], s = /* @__PURE__ */ new Map();
1255
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
- (n) => n.name === e.verbosity
1256
+ const c = Object.values(Z).find(
1257
+ (x) => x.name === e.verbosity
1258
1258
  ).severity;
1259
1259
  w.setSeverityFilterLevel(c);
1260
1260
  }
@@ -1268,7 +1268,7 @@ async function ve(e) {
1268
1268
  verbosity: e.verbosity || "normal"
1269
1269
  });
1270
1270
  e.command === "server" && (i.printBanner(), i.printConfig({
1271
- phpVersion: e.php || C,
1271
+ phpVersion: e.php || D,
1272
1272
  wpVersion: e.wp || "latest",
1273
1273
  port: e.port ?? 9400,
1274
1274
  xdebug: !!e.xdebug,
@@ -1281,30 +1281,30 @@ async function ve(e) {
1281
1281
  ],
1282
1282
  blueprint: typeof e.blueprint == "string" ? e.blueprint : void 0
1283
1283
  }));
1284
- const a = e.command === "server" ? e.port ?? 9400 : 0, l = new Me();
1284
+ const n = e.command === "server" ? e.port ?? 9400 : 0, l = new Me();
1285
1285
  let u = !1, y = !0;
1286
- const E = await bt({
1287
- port: e.port ? e.port : await yt(a) ? 0 : a,
1288
- onBind: async (c, n) => {
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);
1290
- w.debug(`Native temp dir for VFS root: ${T.path}`);
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 = {
1286
+ const M = await bt({
1287
+ port: e.port ? e.port : await yt(n) ? 0 : n,
1288
+ onBind: async (c, x) => {
1289
+ const h = "127.0.0.1", T = `http://${h}:${x}`, a = e["site-url"] || T, E = 6, P = "-playground-cli-site-", I = await Ct(P);
1290
+ w.debug(`Native temp dir for VFS root: ${I.path}`);
1291
+ const R = "WP Playground CLI - Listen for Xdebug", K = ".playground-xdebug-root", H = d.join(process.cwd(), K);
1292
+ if (await tt(H), e.xdebug) {
1293
+ const m = {
1294
1294
  hostPath: d.join(".", d.sep, K),
1295
1295
  vfsPath: "/"
1296
1296
  };
1297
- if (W.indexOf(
1298
- e.php || C
1299
- ) <= W.indexOf("8.5"))
1297
+ if (U.indexOf(
1298
+ e.php || D
1299
+ ) <= U.indexOf("8.5"))
1300
1300
  await ne(
1301
- T.path,
1302
- U,
1301
+ I.path,
1302
+ H,
1303
1303
  process.platform
1304
1304
  ), e.xdebug = rt({
1305
1305
  cwd: process.cwd(),
1306
1306
  mounts: [
1307
- f,
1307
+ m,
1308
1308
  ...e["mount-before-install"] || [],
1309
1309
  ...e.mount || []
1310
1310
  ],
@@ -1315,8 +1315,8 @@ async function ve(e) {
1315
1315
  "/request/",
1316
1316
  "/proc/"
1317
1317
  ]
1318
- }), console.log(I("Xdebug configured successfully")), console.log(
1319
- j("Playground source root: ") + ".playground-xdebug-root" + R(
1318
+ }), console.log(C("Xdebug configured successfully")), console.log(
1319
+ V("Playground source root: ") + ".playground-xdebug-root" + L(
1320
1320
  pe(
1321
1321
  " – you can set breakpoints and preview Playground's VFS structure in there."
1322
1322
  )
@@ -1324,63 +1324,63 @@ async function ve(e) {
1324
1324
  );
1325
1325
  else if (e.experimentalUnsafeIdeIntegration) {
1326
1326
  await ne(
1327
- T.path,
1328
- U,
1327
+ I.path,
1328
+ H,
1329
1329
  process.platform
1330
1330
  );
1331
1331
  try {
1332
1332
  await ot(
1333
- A,
1333
+ R,
1334
1334
  process.cwd()
1335
1335
  );
1336
- const h = typeof e.xdebug == "object" ? e.xdebug : {}, g = await st({
1337
- name: A,
1338
- host: m,
1339
- port: n,
1336
+ const f = typeof e.xdebug == "object" ? e.xdebug : {}, b = await st({
1337
+ name: R,
1338
+ host: h,
1339
+ port: x,
1340
1340
  ides: e.experimentalUnsafeIdeIntegration,
1341
1341
  cwd: process.cwd(),
1342
1342
  mounts: [
1343
- f,
1343
+ m,
1344
1344
  ...e["mount-before-install"] || [],
1345
1345
  ...e.mount || []
1346
1346
  ],
1347
- ideKey: h.ideKey || "WPPLAYGROUNDCLI"
1348
- }), v = e.experimentalUnsafeIdeIntegration, S = v.includes("vscode"), x = v.includes("phpstorm"), B = Object.values(g);
1349
- console.log(""), B.length > 0 ? (console.log(
1350
- I("Xdebug configured successfully")
1347
+ ideKey: f.ideKey || "WPPLAYGROUNDCLI"
1348
+ }), v = e.experimentalUnsafeIdeIntegration, S = v.includes("vscode"), $ = v.includes("phpstorm"), W = Object.values(b);
1349
+ console.log(""), W.length > 0 ? (console.log(
1350
+ C("Xdebug configured successfully")
1351
1351
  ), console.log(
1352
- j("Updated IDE config: ") + B.join(" ")
1352
+ V("Updated IDE config: ") + W.join(" ")
1353
1353
  ), console.log(
1354
- j("Playground source root: ") + ".playground-xdebug-root" + R(
1354
+ V("Playground source root: ") + ".playground-xdebug-root" + L(
1355
1355
  pe(
1356
1356
  " – you can set breakpoints and preview Playground's VFS structure in there."
1357
1357
  )
1358
1358
  )
1359
1359
  )) : (console.log(
1360
- I("Xdebug configuration failed.")
1360
+ C("Xdebug configuration failed.")
1361
1361
  ), console.log(
1362
1362
  "No IDE-specific project settings directory was found in the current working directory."
1363
- )), console.log(""), S && g.vscode && (console.log(
1364
- I("VS Code / Cursor instructions:")
1363
+ )), console.log(""), S && b.vscode && (console.log(
1364
+ C("VS Code / Cursor instructions:")
1365
1365
  ), console.log(
1366
1366
  " 1. Ensure you have installed an IDE extension for PHP Debugging"
1367
1367
  ), console.log(
1368
- ` (The ${I("PHP Debug")} extension by ${I(
1368
+ ` (The ${C("PHP Debug")} extension by ${C(
1369
1369
  "Xdebug"
1370
1370
  )} has been a solid option)`
1371
1371
  ), console.log(
1372
1372
  " 2. Open the Run and Debug panel on the left sidebar"
1373
1373
  ), console.log(
1374
- ` 3. Select "${R(
1375
- A
1374
+ ` 3. Select "${L(
1375
+ R
1376
1376
  )}" from the dropdown`
1377
1377
  ), console.log(' 3. Click "start debugging"'), console.log(
1378
1378
  " 5. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"
1379
1379
  ), console.log(
1380
1380
  " 6. Visit Playground in your browser to hit the breakpoint"
1381
- ), x && console.log("")), x && g.phpstorm && (console.log(I("PhpStorm instructions:")), console.log(
1382
- ` 1. Choose "${R(
1383
- A
1381
+ ), $ && console.log("")), $ && b.phpstorm && (console.log(C("PhpStorm instructions:")), console.log(
1382
+ ` 1. Choose "${L(
1383
+ R
1384
1384
  )}" debug configuration in the toolbar`
1385
1385
  ), console.log(
1386
1386
  " 2. Click the debug button (bug icon)`"
@@ -1389,21 +1389,21 @@ async function ve(e) {
1389
1389
  ), console.log(
1390
1390
  " 4. Visit Playground in your browser to hit the breakpoint"
1391
1391
  )), console.log("");
1392
- } catch (h) {
1392
+ } catch (f) {
1393
1393
  throw new Error("Could not configure Xdebug", {
1394
- cause: h
1394
+ cause: f
1395
1395
  });
1396
1396
  }
1397
1397
  }
1398
1398
  }
1399
- const xe = d.dirname(T.path), Ee = 2 * 24 * 60 * 60 * 1e3;
1399
+ const xe = d.dirname(I.path), Ee = 2 * 24 * 60 * 60 * 1e3;
1400
1400
  At(
1401
- J,
1401
+ P,
1402
1402
  Ee,
1403
1403
  xe
1404
1404
  );
1405
- const ee = d.join(T.path, "internal");
1406
- Y(ee);
1405
+ const ee = d.join(I.path, "internal");
1406
+ q(ee);
1407
1407
  const $e = [
1408
1408
  "wordpress",
1409
1409
  "tools",
@@ -1416,83 +1416,83 @@ async function ve(e) {
1416
1416
  "tmp",
1417
1417
  "home"
1418
1418
  ];
1419
- for (const f of $e) {
1420
- const P = (g) => g.vfsPath === `/${f}`;
1421
- if (!(e["mount-before-install"]?.some(P) || e.mount?.some(P))) {
1422
- const g = d.join(
1423
- T.path,
1424
- f
1419
+ for (const m of $e) {
1420
+ const g = (b) => b.vfsPath === `/${m}`;
1421
+ if (!(e["mount-before-install"]?.some(g) || e.mount?.some(g))) {
1422
+ const b = d.join(
1423
+ I.path,
1424
+ m
1425
1425
  );
1426
- Y(g), e["mount-before-install"] === void 0 && (e["mount-before-install"] = []), e["mount-before-install"].unshift({
1427
- vfsPath: `/${f}`,
1428
- hostPath: g
1426
+ q(b), e["mount-before-install"] === void 0 && (e["mount-before-install"] = []), e["mount-before-install"].unshift({
1427
+ vfsPath: `/${m}`,
1428
+ hostPath: b
1429
1429
  });
1430
1430
  }
1431
1431
  }
1432
1432
  if (e["mount-before-install"])
1433
- for (const f of e["mount-before-install"])
1433
+ for (const m of e["mount-before-install"])
1434
1434
  w.debug(
1435
- `Mount before WP install: ${f.vfsPath} -> ${f.hostPath}`
1435
+ `Mount before WP install: ${m.vfsPath} -> ${m.hostPath}`
1436
1436
  );
1437
1437
  if (e.mount)
1438
- for (const f of e.mount)
1438
+ for (const m of e.mount)
1439
1439
  w.debug(
1440
- `Mount after WP install: ${f.vfsPath} -> ${f.hostPath}`
1440
+ `Mount after WP install: ${m.vfsPath} -> ${m.hostPath}`
1441
1441
  );
1442
- let k;
1443
- e["experimental-blueprints-v2-runner"] ? k = new $t(e, {
1444
- siteUrl: L,
1442
+ let A;
1443
+ e["experimental-blueprints-v2-runner"] ? A = new $t(e, {
1444
+ siteUrl: a,
1445
1445
  cliOutput: i
1446
- }) : (k = new Mt(e, {
1447
- siteUrl: L,
1446
+ }) : (A = new Mt(e, {
1447
+ siteUrl: a,
1448
1448
  cliOutput: i
1449
1449
  }), typeof e.blueprint == "string" && (e.blueprint = await Et({
1450
1450
  sourceString: e.blueprint,
1451
1451
  blueprintMayReadAdjacentFiles: e["blueprint-may-read-adjacent-files"] === !0
1452
1452
  })));
1453
- let H = !1;
1454
- const M = async function() {
1455
- H || (H = !0, await Promise.all(
1456
- o.map(async (P) => {
1457
- await s.get(P)?.dispose(), await P.worker.terminate();
1453
+ let N = !1;
1454
+ const B = async function() {
1455
+ N || (N = !0, await Promise.all(
1456
+ o.map(async (g) => {
1457
+ await s.get(g)?.dispose(), await g.worker.terminate();
1458
1458
  })
1459
- ), c && await new Promise((P) => {
1460
- c.close(P), c.closeAllConnections();
1461
- }), await T.cleanup());
1459
+ ), c && await new Promise((g) => {
1460
+ c.close(g), c.closeAllConnections();
1461
+ }), await I.cleanup());
1462
1462
  };
1463
1463
  try {
1464
- const f = [], P = k.getWorkerType();
1465
- for (let h = 0; h < _; h++) {
1466
- const g = Se(P, {
1464
+ const m = [], g = A.getWorkerType();
1465
+ for (let f = 0; f < E; f++) {
1466
+ const b = Se(g, {
1467
1467
  onExit: (v) => {
1468
- H || v === 0 && w.error(
1469
- `Worker ${h} exited with code ${v}
1468
+ N || v === 0 && w.error(
1469
+ `Worker ${f} exited with code ${v}
1470
1470
  `
1471
1471
  );
1472
1472
  }
1473
1473
  }).then(
1474
1474
  async (v) => {
1475
1475
  o.push(v);
1476
- const S = await Nt(l), x = await k.bootRequestHandler({
1476
+ const S = await Nt(l), $ = await A.bootRequestHandler({
1477
1477
  worker: v,
1478
1478
  fileLockManagerPort: S,
1479
1479
  nativeInternalDirPath: ee
1480
1480
  });
1481
1481
  return s.set(
1482
1482
  v,
1483
- x
1484
- ), [v, x];
1483
+ $
1484
+ ), [v, $];
1485
1485
  }
1486
1486
  );
1487
- f.push(g), h === 0 && await g;
1487
+ m.push(b), f === 0 && await b;
1488
1488
  }
1489
- await Promise.all(f), t = Ce(
1489
+ await Promise.all(m), t = Ce(
1490
1490
  o.map(
1491
- (h) => s.get(h)
1491
+ (f) => s.get(f)
1492
1492
  )
1493
1493
  );
1494
1494
  {
1495
- const h = new he(), g = h.port1, v = h.port2;
1495
+ const f = new he(), b = f.port1, v = f.port2;
1496
1496
  if (await Ae(
1497
1497
  {
1498
1498
  applyPostInstallMountsToAllWorkers: async () => {
@@ -1508,12 +1508,12 @@ async function ve(e) {
1508
1508
  }
1509
1509
  },
1510
1510
  void 0,
1511
- g
1512
- ), await k.bootWordPress(
1511
+ b
1512
+ ), await A.bootWordPress(
1513
1513
  t,
1514
1514
  v
1515
- ), g.close(), u = !0, !e["experimental-blueprints-v2-runner"]) {
1516
- const S = await k.compileInputBlueprint(
1515
+ ), b.close(), u = !0, !e["experimental-blueprints-v2-runner"]) {
1516
+ const S = await A.compileInputBlueprint(
1517
1517
  e["additional-blueprint-steps"] || []
1518
1518
  );
1519
1519
  S && await se(
@@ -1524,14 +1524,14 @@ async function ve(e) {
1524
1524
  if (e.phpmyadmin && !await t.fileExists(
1525
1525
  `${ae}/index.php`
1526
1526
  )) {
1527
- const S = await nt(), x = await fe({ steps: S });
1528
- await se(x, t);
1527
+ const S = await nt(), $ = await fe({ steps: S });
1528
+ await se($, t);
1529
1529
  }
1530
1530
  if (e.command === "build-snapshot") {
1531
- await Ft(t, e.outfile), i.printStatus(`Exported to ${e.outfile}`), await M();
1531
+ await Ft(t, e.outfile), i.printStatus(`Exported to ${e.outfile}`), await B();
1532
1532
  return;
1533
1533
  } else if (e.command === "run-blueprint") {
1534
- i.finishProgress("Done"), await M();
1534
+ i.finishProgress("Done"), await B();
1535
1535
  return;
1536
1536
  } else if (e.command === "php") {
1537
1537
  const S = [
@@ -1539,33 +1539,33 @@ async function ve(e) {
1539
1539
  // Hardcoding it feels fragile.
1540
1540
  "/internal/shared/bin/php",
1541
1541
  ...(e._ || []).slice(1)
1542
- ], x = await t.cli(S), [B] = await Promise.all([
1543
- x.exitCode,
1544
- x.stdout.pipeTo(
1542
+ ], $ = await t.cli(S), [W] = await Promise.all([
1543
+ $.exitCode,
1544
+ $.stdout.pipeTo(
1545
1545
  new WritableStream({
1546
- write(N) {
1547
- process.stdout.write(N);
1546
+ write(O) {
1547
+ process.stdout.write(O);
1548
1548
  }
1549
1549
  })
1550
1550
  ),
1551
- x.stderr.pipeTo(
1551
+ $.stderr.pipeTo(
1552
1552
  new WritableStream({
1553
- write(N) {
1554
- process.stderr.write(N);
1553
+ write(O) {
1554
+ process.stderr.write(O);
1555
1555
  }
1556
1556
  })
1557
1557
  )
1558
1558
  ]);
1559
- await M(), process.exit(B);
1559
+ await B(), process.exit(W);
1560
1560
  }
1561
1561
  }
1562
- if (i.finishProgress(), i.printReady(b, _), e.phpmyadmin) {
1563
- const h = d.join(
1562
+ if (i.finishProgress(), i.printReady(T, E), e.phpmyadmin) {
1563
+ const f = d.join(
1564
1564
  e.phpmyadmin,
1565
1565
  at
1566
1566
  );
1567
1567
  i.printPhpMyAdminUrl(
1568
- new URL(h, b).toString()
1568
+ new URL(f, T).toString()
1569
1569
  );
1570
1570
  }
1571
1571
  return e.xdebug && e.experimentalDevtools && (await Je({
@@ -1574,17 +1574,17 @@ async function ve(e) {
1574
1574
  })).start(), {
1575
1575
  playground: t,
1576
1576
  server: c,
1577
- serverUrl: b,
1578
- [Symbol.asyncDispose]: M,
1579
- [Z]: {
1580
- workerThreadCount: _
1577
+ serverUrl: T,
1578
+ [Symbol.asyncDispose]: B,
1579
+ [J]: {
1580
+ workerThreadCount: E
1581
1581
  }
1582
1582
  };
1583
- } catch (f) {
1583
+ } catch (m) {
1584
1584
  if (e.verbosity !== "debug")
1585
- throw f;
1586
- let P = "";
1587
- throw await t?.fileExists(te) && (P = await t.readFileAsText(te)), await M(), new Error(P, { cause: f });
1585
+ throw m;
1586
+ let g = "";
1587
+ throw await t?.fileExists(te) && (g = await t.readFileAsText(te)), await B(), new Error(g, { cause: m });
1588
1588
  }
1589
1589
  },
1590
1590
  async handleRequest(c) {
@@ -1595,17 +1595,17 @@ async function ve(e) {
1595
1595
  );
1596
1596
  if (y) {
1597
1597
  y = !1;
1598
- const m = {
1598
+ const h = {
1599
1599
  "Content-Type": ["text/plain"],
1600
1600
  "Content-Length": ["0"],
1601
1601
  Location: [c.url]
1602
1602
  };
1603
1603
  return c.headers?.cookie?.includes(
1604
1604
  "playground_auto_login_already_happened"
1605
- ) && (m["Set-Cookie"] = [
1605
+ ) && (h["Set-Cookie"] = [
1606
1606
  "playground_auto_login_already_happened=1; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/"
1607
1607
  ]), re.fromPHPResponse(
1608
- new Be(302, m, new Uint8Array())
1608
+ new Be(302, h, new Uint8Array())
1609
1609
  );
1610
1610
  }
1611
1611
  r && (c = {
@@ -1620,17 +1620,17 @@ async function ve(e) {
1620
1620
  cookie: r.getCookieRequestHeader()
1621
1621
  }
1622
1622
  });
1623
- const n = await t.requestStreamed(c);
1623
+ const x = await t.requestStreamed(c);
1624
1624
  if (r) {
1625
- const m = await n.headers;
1626
- r.rememberCookiesFromResponseHeaders(m), delete m["set-cookie"];
1625
+ const h = await x.headers;
1626
+ r.rememberCookiesFromResponseHeaders(h), delete h["set-cookie"];
1627
1627
  }
1628
- return n;
1628
+ return x;
1629
1629
  }
1630
1630
  }).catch((c) => {
1631
1631
  i.printError(c.message), process.exit(1);
1632
1632
  });
1633
- return E && e.command === "start" && !e.skipBrowser && Ot(E.serverUrl), E;
1633
+ return M && e.command === "start" && !e.skipBrowser && Ot(M.serverUrl), M;
1634
1634
  }
1635
1635
  function Ht(e) {
1636
1636
  let t = { ...e, command: "server" };
@@ -1650,15 +1650,15 @@ function Ht(e) {
1650
1650
  "You may still remove the site's directory manually if you wish."
1651
1651
  ), process.exit(1));
1652
1652
  else {
1653
- const o = t.autoMount || process.cwd(), s = it("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 = Q.homedir(), n = d.join(
1654
1654
  i,
1655
1655
  ".wordpress-playground/sites",
1656
1656
  s
1657
1657
  );
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"] = [
1658
+ console.log("Site files stored at:", n), G(n) && e.reset && (console.log("Resetting site..."), _e(n, { recursive: !0 })), q(n, { recursive: !0 }), t["mount-before-install"] = [
1659
1659
  ...t["mount-before-install"] || [],
1660
- { vfsPath: "/wordpress", hostPath: a }
1661
- ], t.wordpressInstallMode = Ue(a).length === 0 ? (
1660
+ { vfsPath: "/wordpress", hostPath: n }
1661
+ ], t.wordpressInstallMode = Ue(n).length === 0 ? (
1662
1662
  // Only download WordPress on the first run when the site directory is still
1663
1663
  // empty.
1664
1664
  "download-and-install"
@@ -1669,11 +1669,11 @@ function Ht(e) {
1669
1669
  }
1670
1670
  return t;
1671
1671
  }
1672
- const V = new Te();
1672
+ const Y = new Te();
1673
1673
  function Se(e, { onExit: t } = {}) {
1674
1674
  let r;
1675
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) => {
1676
- const i = V.claim();
1676
+ const i = Y.claim();
1677
1677
  r.once("message", function(l) {
1678
1678
  l.command === "worker-script-initialized" && o({
1679
1679
  processId: i,
@@ -1681,26 +1681,26 @@ function Se(e, { onExit: t } = {}) {
1681
1681
  phpPort: l.phpPort
1682
1682
  });
1683
1683
  }), r.once("error", function(l) {
1684
- V.release(i), console.error(l);
1684
+ Y.release(i), console.error(l);
1685
1685
  const u = new Error(
1686
1686
  `Worker failed to load worker. ${l.message ? `Original error: ${l.message}` : ""}`
1687
1687
  );
1688
1688
  s(u);
1689
1689
  });
1690
- let a = !1;
1690
+ let n = !1;
1691
1691
  r.once("spawn", () => {
1692
- a = !0;
1692
+ n = !0;
1693
1693
  }), r.once("exit", (l) => {
1694
- V.release(i), a || s(new Error(`Worker exited before spawning: ${l}`)), t?.(l);
1694
+ Y.release(i), n || s(new Error(`Worker exited before spawning: ${l}`)), t?.(l);
1695
1695
  });
1696
1696
  });
1697
1697
  }
1698
1698
  async function Nt(e) {
1699
1699
  const { port1: t, port2: r } = new he();
1700
- return await Re(e, t), r;
1700
+ return await De(e, t), r;
1701
1701
  }
1702
1702
  function Ot(e) {
1703
- const t = G.platform();
1703
+ const t = Q.platform();
1704
1704
  let r;
1705
1705
  switch (t) {
1706
1706
  case "darwin":
@@ -1743,22 +1743,22 @@ async function Ft(e, t) {
1743
1743
  }
1744
1744
  const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1745
1745
  __proto__: null,
1746
- LogVerbosity: X,
1747
- internalsKeyForTesting: Z,
1748
- mergeDefinedConstants: Q,
1746
+ LogVerbosity: Z,
1747
+ internalsKeyForTesting: J,
1748
+ mergeDefinedConstants: X,
1749
1749
  parseOptionsAndRunCLI: _t,
1750
1750
  runCLI: ve,
1751
1751
  spawnWorkerThread: Se
1752
1752
  }, Symbol.toStringTag, { value: "Module" }));
1753
1753
  export {
1754
- X as L,
1754
+ Z as L,
1755
1755
  wr as a,
1756
1756
  Wt as b,
1757
1757
  yr as c,
1758
- Z as i,
1759
- Q as m,
1758
+ J as i,
1759
+ X as m,
1760
1760
  _t as p,
1761
1761
  ve as r,
1762
1762
  Se as s
1763
1763
  };
1764
- //# sourceMappingURL=run-cli-Dka9y1Ev.js.map
1764
+ //# sourceMappingURL=run-cli-CaJWk9j8.js.map