@wp-playground/cli 3.1.20 → 3.1.21

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