@wp-playground/cli 2.0.0 → 2.0.1

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,22 +1,22 @@
1
- import { logger as p, errorLogPath as z } from "@php-wasm/logger";
2
- import { consumeAPI as L, SupportedPHPVersions as T, PHPResponse as F, exposeAPI as V, exposeSyncAPI as q } from "@php-wasm/universal";
3
- import { resolveRemoteBlueprint as j, isBlueprintBundle as O, compileBlueprint as D, runBlueprintSteps as Z } from "@wp-playground/blueprints";
4
- import { zipDirectory as M, RecommendedPHPVersion as B, unzipFile as _ } from "@wp-playground/common";
5
- import m from "fs";
6
- import { Worker as N, MessageChannel as J } from "worker_threads";
7
- import { p as R, a as Y, e as Q } from "./mounts-B-Qdcyyt.js";
8
- import X from "express";
9
- import { FileLockManagerForNode as G } from "@php-wasm/node";
10
- import K, { cpus as ee } from "os";
11
- import { jspi as te } from "wasm-feature-detect";
12
- import re from "yargs";
13
- import y, { basename as oe } from "path";
14
- import { NodeJsFilesystem as se, OverlayFilesystem as ie, InMemoryFilesystem as ne, ZipFilesystem as ae } from "@wp-playground/storage";
15
- import { EmscriptenDownloadMonitor as le, ProgressTracker as pe } from "@php-wasm/progress";
16
- import { resolveWordPressRelease as de } from "@wp-playground/wordpress";
1
+ import { logger as p, errorLogPath as F } from "@php-wasm/logger";
2
+ import { consumeAPI as L, SupportedPHPVersions as T, printDebugDetails as V, PHPResponse as R, exposeAPI as q, exposeSyncAPI as j } from "@php-wasm/universal";
3
+ import { resolveRemoteBlueprint as D, isBlueprintBundle as O, compileBlueprint as Z, runBlueprintSteps as _ } from "@wp-playground/blueprints";
4
+ import { zipDirectory as M, RecommendedPHPVersion as $, unzipFile as N } from "@wp-playground/common";
5
+ import w from "fs";
6
+ import { Worker as J, MessageChannel as Y } from "worker_threads";
7
+ import { p as U, a as Q, e as X } from "./mounts-B-Qdcyyt.js";
8
+ import G from "express";
9
+ import { FileLockManagerForNode as K } from "@php-wasm/node";
10
+ import ee, { cpus as te } from "os";
11
+ import { jspi as re } from "wasm-feature-detect";
12
+ import oe from "yargs";
13
+ import y, { basename as se } from "path";
14
+ import { NodeJsFilesystem as ie, OverlayFilesystem as ne, InMemoryFilesystem as ae, ZipFilesystem as le } from "@wp-playground/storage";
15
+ import { EmscriptenDownloadMonitor as pe, ProgressTracker as de } from "@php-wasm/progress";
16
+ import { resolveWordPressRelease as ce } from "@wp-playground/wordpress";
17
17
  import P from "fs-extra";
18
- async function ce(t) {
19
- const r = X(), e = await new Promise((i, n) => {
18
+ async function ue(t) {
19
+ const r = G(), e = await new Promise((i, n) => {
20
20
  const l = r.listen(t.port, () => {
21
21
  const a = l.address();
22
22
  a === null || typeof a == "string" ? n(new Error("Server address is not available")) : i(l);
@@ -25,9 +25,9 @@ async function ce(t) {
25
25
  r.use("/", async (i, n) => {
26
26
  const l = await t.handleRequest({
27
27
  url: i.url,
28
- headers: he(i),
28
+ headers: fe(i),
29
29
  method: i.method,
30
- body: await ue(i)
30
+ body: await he(i)
31
31
  });
32
32
  n.statusCode = l.httpStatusCode;
33
33
  for (const a in l.headers)
@@ -37,21 +37,21 @@ async function ce(t) {
37
37
  const s = e.address().port;
38
38
  return await t.onBind(e, s);
39
39
  }
40
- const ue = async (t) => await new Promise((r) => {
40
+ const he = async (t) => await new Promise((r) => {
41
41
  const e = [];
42
42
  t.on("data", (o) => {
43
43
  e.push(o);
44
44
  }), t.on("end", () => {
45
45
  r(new Uint8Array(Buffer.concat(e)));
46
46
  });
47
- }), he = (t) => {
47
+ }), fe = (t) => {
48
48
  const r = {};
49
49
  if (t.rawHeaders && t.rawHeaders.length)
50
50
  for (let e = 0; e < t.rawHeaders.length; e += 2)
51
51
  r[t.rawHeaders[e].toLowerCase()] = t.rawHeaders[e + 1];
52
52
  return r;
53
53
  };
54
- class fe {
54
+ class me {
55
55
  constructor(r) {
56
56
  this.workerLoads = [], this.addWorker(r);
57
57
  }
@@ -73,21 +73,21 @@ class fe {
73
73
  });
74
74
  }
75
75
  }
76
- function me(t) {
76
+ function we(t) {
77
77
  return /^latest$|^trunk$|^nightly$|^(?:(\d+)\.(\d+)(?:\.(\d+))?)((?:-beta(?:\d+)?)|(?:-RC(?:\d+)?))?$/.test(t);
78
78
  }
79
- async function we({
79
+ async function ge({
80
80
  sourceString: t,
81
81
  blueprintMayReadAdjacentFiles: r
82
82
  }) {
83
83
  if (!t)
84
84
  return;
85
85
  if (t.startsWith("http://") || t.startsWith("https://"))
86
- return await j(t);
86
+ return await D(t);
87
87
  let e = y.resolve(process.cwd(), t);
88
- if (!m.existsSync(e))
88
+ if (!w.existsSync(e))
89
89
  throw new Error(`Blueprint file does not exist: ${e}`);
90
- const o = m.statSync(e);
90
+ const o = w.statSync(e);
91
91
  if (o.isDirectory() && (e = y.join(e, "blueprint.json")), !o.isFile() && o.isSymbolicLink())
92
92
  throw new Error(
93
93
  `Blueprint path is neither a file nor a directory: ${e}`
@@ -95,11 +95,11 @@ async function we({
95
95
  const s = y.extname(e);
96
96
  switch (s) {
97
97
  case ".zip":
98
- return ae.fromArrayBuffer(
99
- m.readFileSync(e).buffer
98
+ return le.fromArrayBuffer(
99
+ w.readFileSync(e).buffer
100
100
  );
101
101
  case ".json": {
102
- const i = m.readFileSync(e, "utf-8");
102
+ const i = w.readFileSync(e, "utf-8");
103
103
  try {
104
104
  JSON.parse(i);
105
105
  } catch {
@@ -107,9 +107,9 @@ async function we({
107
107
  `Blueprint file at ${e} is not a valid JSON file`
108
108
  );
109
109
  }
110
- const n = y.dirname(e), l = new se(n);
111
- return new ie([
112
- new ne({
110
+ const n = y.dirname(e), l = new ie(n);
111
+ return new ne([
112
+ new ae({
113
113
  "blueprint.json": i
114
114
  }),
115
115
  /**
@@ -135,13 +135,13 @@ You can allow this Blueprint to read files from the same parent directory by exp
135
135
  );
136
136
  }
137
137
  }
138
- const ge = "" + new URL("worker-thread-v2-Pfv6UYF4.js", import.meta.url).href;
139
- class ye {
138
+ const ye = "" + new URL("worker-thread-v2-Pfv6UYF4.js", import.meta.url).href;
139
+ class be {
140
140
  constructor(r, e) {
141
141
  this.lastProgressMessage = "", this.args = r, this.siteUrl = e.siteUrl, this.processIdSpaceLength = e.processIdSpaceLength, this.phpVersion = r.php;
142
142
  }
143
143
  getWorkerUrl() {
144
- return ge;
144
+ return ye;
145
145
  }
146
146
  async bootPrimaryWorker(r, e) {
147
147
  const o = L(r);
@@ -181,19 +181,19 @@ class ye {
181
181
  `));
182
182
  }
183
183
  }
184
- const I = y.join(K.homedir(), ".wordpress-playground");
185
- async function be(t) {
186
- return await $(
184
+ const I = y.join(ee.homedir(), ".wordpress-playground");
185
+ async function Pe(t) {
186
+ return await E(
187
187
  "https://github.com/WordPress/sqlite-database-integration/archive/refs/heads/develop.zip",
188
188
  "sqlite.zip",
189
189
  t
190
190
  );
191
191
  }
192
- async function $(t, r, e) {
192
+ async function E(t, r, e) {
193
193
  const o = y.join(I, r);
194
- return P.existsSync(o) || (P.ensureDirSync(I), await Pe(t, o, e)), A(o);
194
+ return P.existsSync(o) || (P.ensureDirSync(I), await ke(t, o, e)), A(o);
195
195
  }
196
- async function Pe(t, r, e) {
196
+ async function ke(t, r, e) {
197
197
  const s = (await e.monitorFetch(fetch(t))).body.getReader(), i = `${r}.partial`, n = P.createWriteStream(i);
198
198
  for (; ; ) {
199
199
  const { done: l, value: a } = await s.read();
@@ -209,15 +209,15 @@ async function Pe(t, r, e) {
209
209
  });
210
210
  }
211
211
  function A(t, r) {
212
- return new File([P.readFileSync(t)], oe(t));
212
+ return new File([P.readFileSync(t)], se(t));
213
213
  }
214
- const ke = "" + new URL("worker-thread-v1-BTJIbQLy.js", import.meta.url).href;
215
- class ve {
214
+ const ve = "" + new URL("worker-thread-v1-BTJIbQLy.js", import.meta.url).href;
215
+ class We {
216
216
  constructor(r, e) {
217
217
  this.lastProgressMessage = "", this.args = r, this.siteUrl = e.siteUrl, this.processIdSpaceLength = e.processIdSpaceLength;
218
218
  }
219
219
  getWorkerUrl() {
220
- return ke;
220
+ return ve;
221
221
  }
222
222
  async bootPrimaryWorker(r, e) {
223
223
  const o = await this.compileInputBlueprint(
@@ -225,39 +225,39 @@ class ve {
225
225
  );
226
226
  this.phpVersion = o.versions.php;
227
227
  let s;
228
- const i = new le();
228
+ const i = new pe();
229
229
  if (!this.args.skipWordPressSetup) {
230
230
  let k = !1;
231
231
  i.addEventListener("progress", (h) => {
232
232
  if (k)
233
233
  return;
234
- const { loaded: g, total: v } = h.detail, f = Math.floor(
235
- Math.min(100, 100 * g / v)
234
+ const { loaded: f, total: v } = h.detail, m = Math.floor(
235
+ Math.min(100, 100 * f / v)
236
236
  );
237
- k = f === 100, this.args.quiet || this.writeProgressUpdate(
237
+ k = m === 100, this.args.quiet || this.writeProgressUpdate(
238
238
  process.stdout,
239
- `Downloading WordPress ${f}%...`,
239
+ `Downloading WordPress ${m}%...`,
240
240
  k
241
241
  );
242
- }), s = await de(this.args.wp), p.log(
242
+ }), s = await ce(this.args.wp), p.log(
243
243
  `Resolved WordPress release URL: ${s?.releaseUrl}`
244
244
  );
245
245
  }
246
246
  const n = s && y.join(
247
247
  I,
248
248
  `prebuilt-wp-content-for-wp-${s.version}.zip`
249
- ), l = s ? m.existsSync(n) ? A(n) : await $(
249
+ ), l = s ? w.existsSync(n) ? A(n) : await E(
250
250
  s.releaseUrl,
251
251
  `${s.version}.zip`,
252
252
  i
253
253
  ) : void 0;
254
254
  p.log("Fetching SQLite integration plugin...");
255
- const a = this.args.skipSqliteSetup ? void 0 : await be(i), c = this.args.followSymlinks === !0, d = this.args.experimentalTrace === !0, w = this.args["mount-before-install"] || [], b = this.args.mount || [], u = L(r);
255
+ const a = this.args.skipSqliteSetup ? void 0 : await Pe(i), c = this.args.followSymlinks === !0, d = this.args.experimentalTrace === !0, g = this.args["mount-before-install"] || [], b = this.args.mount || [], u = L(r);
256
256
  return await u.isConnected(), p.log("Booting WordPress..."), await u.useFileLockManager(e), await u.bootAsPrimaryWorker({
257
257
  phpVersion: this.phpVersion,
258
258
  wpVersion: o.versions.wp,
259
259
  absoluteUrl: this.siteUrl,
260
- mountsBeforeWpInstall: w,
260
+ mountsBeforeWpInstall: g,
261
261
  mountsAfterWpInstall: b,
262
262
  wordPressZip: l && await l.arrayBuffer(),
263
263
  sqliteIntegrationPluginZip: await a.arrayBuffer(),
@@ -267,7 +267,7 @@ class ve {
267
267
  trace: d,
268
268
  internalCookieStore: this.args.internalCookieStore,
269
269
  withXdebug: this.args.xdebug
270
- }), s && !this.args["mount-before-install"] && !m.existsSync(n) && (p.log("Caching preinstalled WordPress for the next boot..."), m.writeFileSync(
270
+ }), s && !this.args["mount-before-install"] && !w.existsSync(n) && (p.log("Caching preinstalled WordPress for the next boot..."), w.writeFileSync(
271
271
  n,
272
272
  await M(u, "/wordpress")
273
273
  ), p.log("Cached!")), u;
@@ -307,11 +307,11 @@ class ve {
307
307
  login: e.login,
308
308
  ...o || {},
309
309
  preferredVersions: {
310
- php: e.php ?? o?.preferredVersions?.php ?? B,
310
+ php: e.php ?? o?.preferredVersions?.php ?? $,
311
311
  wp: e.wp ?? o?.preferredVersions?.wp ?? "latest",
312
312
  ...o?.preferredVersions || {}
313
313
  }
314
- }, i = new pe();
314
+ }, i = new de();
315
315
  let n = "", l = !1;
316
316
  return i.addEventListener("progress", (a) => {
317
317
  if (l)
@@ -325,7 +325,7 @@ class ve {
325
325
  d,
326
326
  l
327
327
  );
328
- }), await D(s, {
328
+ }), await Z(s, {
329
329
  progress: i,
330
330
  additionalSteps: r
331
331
  });
@@ -338,7 +338,7 @@ class ve {
338
338
  }
339
339
  async function Oe() {
340
340
  try {
341
- const t = re(process.argv.slice(2)).usage("Usage: wp-playground <command> [options]").positional("command", {
341
+ const t = oe(process.argv.slice(2)).usage("Usage: wp-playground <command> [options]").positional("command", {
342
342
  describe: "Command to run",
343
343
  choices: ["server", "run-blueprint", "build-snapshot"],
344
344
  demandOption: !0
@@ -353,7 +353,7 @@ async function Oe() {
353
353
  }).option("php", {
354
354
  describe: "PHP version to use.",
355
355
  type: "string",
356
- default: B,
356
+ default: $,
357
357
  choices: T
358
358
  }).option("wp", {
359
359
  describe: "WordPress version to use.",
@@ -363,12 +363,12 @@ async function Oe() {
363
363
  describe: "Mount a directory to the PHP runtime (can be used multiple times). Format: /host/path:/vfs/path",
364
364
  type: "array",
365
365
  string: !0,
366
- coerce: R
366
+ coerce: U
367
367
  }).option("mount-before-install", {
368
368
  describe: "Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format: /host/path:/vfs/path",
369
369
  type: "array",
370
370
  string: !0,
371
- coerce: R
371
+ coerce: U
372
372
  }).option("mount-dir", {
373
373
  describe: 'Mount a directory to the PHP runtime (can be used multiple times). Format: "/host/path" "/vfs/path"',
374
374
  type: "array",
@@ -380,7 +380,7 @@ async function Oe() {
380
380
  type: "string",
381
381
  nargs: 2,
382
382
  array: !0,
383
- coerce: Y
383
+ coerce: Q
384
384
  }).option("login", {
385
385
  describe: "Should log the user in",
386
386
  type: "boolean",
@@ -434,7 +434,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
434
434
  }).option("experimental-multi-worker", {
435
435
  describe: "Enable experimental multi-worker support which requires JSPI and 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.",
436
436
  type: "number",
437
- coerce: (s) => s ?? ee().length - 1
437
+ coerce: (s) => s ?? te().length - 1
438
438
  }).option("experimental-blueprints-v2-runner", {
439
439
  describe: "Use the experimental Blueprint V2 runner.",
440
440
  type: "boolean",
@@ -442,7 +442,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
442
442
  // Remove the "hidden" flag once Blueprint V2 is fully supported
443
443
  hidden: !0
444
444
  }).showHelpOnFail(!1).strictOptions().check(async (s) => {
445
- if (s.wp !== void 0 && !me(s.wp))
445
+ if (s.wp !== void 0 && !we(s.wp))
446
446
  try {
447
447
  new URL(s.wp);
448
448
  } catch {
@@ -477,54 +477,65 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
477
477
  ...r["mount-dir-before-install"] || []
478
478
  ]
479
479
  };
480
- await We(o);
480
+ await Se(o);
481
481
  } catch (t) {
482
482
  if (!(t instanceof Error))
483
483
  throw t;
484
- const r = process.argv.includes("--debug");
485
- console.error(r ? t : t.message), process.exit(1);
484
+ if (process.argv.includes("--debug"))
485
+ V(t);
486
+ else {
487
+ const e = [];
488
+ let o = t;
489
+ do
490
+ e.push(o.message), o = o.cause;
491
+ while (o instanceof Error);
492
+ console.error(
493
+ "\x1B[1m" + e.join(" caused by ") + "\x1B[0m"
494
+ );
495
+ }
496
+ process.exit(1);
486
497
  }
487
498
  }
488
- async function We(t) {
499
+ async function Se(t) {
489
500
  let r, e;
490
501
  const o = [];
491
- t.autoMount && (t = Q(t)), t.quiet && (p.handlers = []);
502
+ t.autoMount && (t = X(t)), t.quiet && (p.handlers = []);
492
503
  const s = await import("fs-ext").then((a) => a.flockSync).catch(() => {
493
504
  p.warn(
494
505
  "The fs-ext package is not installed. Internal file locking will not be integrated with host OS file locking."
495
506
  );
496
- }), i = new G(s);
507
+ }), i = new K(s);
497
508
  let n = !1, l = !0;
498
- return p.log("Starting a PHP server..."), ce({
509
+ return p.log("Starting a PHP server..."), ue({
499
510
  port: t.port,
500
511
  onBind: async (a, c) => {
501
- const d = `http://127.0.0.1:${c}`, w = t.experimentalMultiWorker ?? 1, b = Math.floor(
502
- Number.MAX_SAFE_INTEGER / w
512
+ const d = `http://127.0.0.1:${c}`, g = t.experimentalMultiWorker ?? 1, b = Math.floor(
513
+ Number.MAX_SAFE_INTEGER / g
503
514
  );
504
515
  let u;
505
- t["experimental-blueprints-v2-runner"] ? u = new ye(t, {
516
+ t["experimental-blueprints-v2-runner"] ? u = new be(t, {
506
517
  siteUrl: d,
507
518
  processIdSpaceLength: b
508
- }) : (u = new ve(t, {
519
+ }) : (u = new We(t, {
509
520
  siteUrl: d,
510
521
  processIdSpaceLength: b
511
- }), typeof t.blueprint == "string" && (t.blueprint = await we({
522
+ }), typeof t.blueprint == "string" && (t.blueprint = await ge({
512
523
  sourceString: t.blueprint,
513
524
  blueprintMayReadAdjacentFiles: t["blueprint-may-read-adjacent-files"] === !0
514
525
  })));
515
- const k = Se(
526
+ const k = xe(
516
527
  u.getWorkerUrl(),
517
- w,
518
- ({ exitCode: h, isMain: g, workerIndex: v }) => {
528
+ g,
529
+ ({ exitCode: h, isMain: f, workerIndex: v }) => {
519
530
  h !== 0 && (p.error(
520
531
  `Worker ${v} exited with code ${h}
521
532
  `
522
- ), g && t.exitOnPrimaryWorkerCrash && process.exit(1));
533
+ ), f && t.exitOnPrimaryWorkerCrash && process.exit(1));
523
534
  }
524
535
  );
525
536
  p.log(`Setting up WordPress ${t.wp}`);
526
537
  try {
527
- const [h, ...g] = await k, v = await U(
538
+ const [h, ...f] = await k, v = await B(
528
539
  i
529
540
  );
530
541
  if (e = await u.bootPrimaryWorker(
@@ -533,32 +544,32 @@ async function We(t) {
533
544
  ), o.push({
534
545
  playground: e,
535
546
  worker: h.worker
536
- }), await e.isReady(), n = !0, p.log("Booted!"), r = new fe(e), !t["experimental-blueprints-v2-runner"]) {
537
- const f = await u.compileInputBlueprint(
547
+ }), await e.isReady(), n = !0, p.log("Booted!"), r = new me(e), !t["experimental-blueprints-v2-runner"]) {
548
+ const m = await u.compileInputBlueprint(
538
549
  t["additional-blueprint-steps"] || []
539
550
  );
540
- f && (p.log("Running the Blueprint..."), await Z(f, e), p.log("Finished running the blueprint"));
551
+ m && (p.log("Running the Blueprint..."), await _(m, e), p.log("Finished running the blueprint"));
541
552
  }
542
- if (t.command === "build-snapshot" ? (await xe(e, t.outfile), p.log(`WordPress exported to ${t.outfile}`), process.exit(0)) : t.command === "run-blueprint" && (p.log("Blueprint executed"), process.exit(0)), t.experimentalMultiWorker && t.experimentalMultiWorker > 1) {
553
+ if (t.command === "build-snapshot" ? (await Le(e, t.outfile), p.log(`WordPress exported to ${t.outfile}`), process.exit(0)) : t.command === "run-blueprint" && (p.log("Blueprint executed"), process.exit(0)), t.experimentalMultiWorker && t.experimentalMultiWorker > 1) {
543
554
  p.log("Preparing additional workers...");
544
- const f = await M(
555
+ const m = await M(
545
556
  e,
546
557
  "/internal"
547
558
  ), W = b;
548
559
  await Promise.all(
549
- g.map(async (x, C) => {
550
- const E = W + C * b, H = await U(i), S = await u.bootSecondaryWorker({
560
+ f.map(async (x, C) => {
561
+ const H = W + C * b, z = await B(i), S = await u.bootSecondaryWorker({
551
562
  worker: x,
552
- fileLockManagerPort: H,
553
- firstProcessId: E
563
+ fileLockManagerPort: z,
564
+ firstProcessId: H
554
565
  });
555
566
  o.push({
556
567
  playground: S,
557
568
  worker: x.worker
558
569
  }), await S.writeFile(
559
570
  "/tmp/internal.zip",
560
- f
561
- ), await _(
571
+ m
572
+ ), await N(
562
573
  S,
563
574
  "/tmp/internal.zip",
564
575
  "/internal"
@@ -584,13 +595,13 @@ async function We(t) {
584
595
  } catch (h) {
585
596
  if (!t.debug)
586
597
  throw h;
587
- const g = await e.readFileAsText(z);
588
- throw new Error(g, { cause: h });
598
+ let f = "";
599
+ throw await e.fileExists(F) && (f = await e.readFileAsText(F)), new Error(f, { cause: h });
589
600
  }
590
601
  },
591
602
  async handleRequest(a) {
592
603
  if (!n)
593
- return F.forHttpCode(
604
+ return R.forHttpCode(
594
605
  502,
595
606
  "WordPress is not ready yet"
596
607
  );
@@ -605,16 +616,16 @@ async function We(t) {
605
616
  "playground_auto_login_already_happened"
606
617
  ) && (c["Set-Cookie"] = [
607
618
  "playground_auto_login_already_happened=1; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/"
608
- ]), new F(302, c, new Uint8Array());
619
+ ]), new R(302, c, new Uint8Array());
609
620
  }
610
621
  return await r.handleRequest(a);
611
622
  }
612
623
  });
613
624
  }
614
- function Se(t, r, e) {
625
+ function xe(t, r, e) {
615
626
  const o = new URL(t, import.meta.url), s = [];
616
627
  for (let i = 0; i < r; i++) {
617
- const n = new N(o), l = (a) => {
628
+ const n = new J(o), l = (a) => {
618
629
  e({
619
630
  exitCode: a,
620
631
  isMain: i === 0,
@@ -628,10 +639,10 @@ function Se(t, r, e) {
628
639
  d.command === "worker-script-initialized" && a({ worker: n, phpPort: d.phpPort });
629
640
  }), n.once("error", function(d) {
630
641
  console.error(d);
631
- const w = new Error(
642
+ const g = new Error(
632
643
  `Worker failed to load at ${o}. ${d.message ? `Original error: ${d.message}` : ""}`
633
644
  );
634
- w.filename = o, c(w);
645
+ g.filename = o, c(g);
635
646
  }), n.once("exit", l);
636
647
  }
637
648
  )
@@ -639,11 +650,11 @@ function Se(t, r, e) {
639
650
  }
640
651
  return Promise.all(s);
641
652
  }
642
- async function U(t) {
643
- const { port1: r, port2: e } = new J();
644
- return await te() ? V(t, null, r) : await q(t, r), e;
653
+ async function B(t) {
654
+ const { port1: r, port2: e } = new Y();
655
+ return await re() ? q(t, null, r) : await j(t, r), e;
645
656
  }
646
- async function xe(t, r) {
657
+ async function Le(t, r) {
647
658
  await t.run({
648
659
  code: `<?php
649
660
  $zip = new ZipArchive();
@@ -665,10 +676,10 @@ async function xe(t, r) {
665
676
  `
666
677
  });
667
678
  const e = await t.readFileAsBuffer("/tmp/build.zip");
668
- m.writeFileSync(r, e);
679
+ w.writeFileSync(r, e);
669
680
  }
670
681
  export {
671
682
  Oe as p,
672
- We as r
683
+ Se as r
673
684
  };
674
- //# sourceMappingURL=run-cli-CY1lYIJH.js.map
685
+ //# sourceMappingURL=run-cli-JA8jNok0.js.map