@wp-playground/cli 3.1.20 → 3.1.22

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