@wp-playground/cli 3.1.0 → 3.1.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,11 +1,11 @@
1
1
  import { logger as g, LogSeverity as L, errorLogPath as Q } from "@php-wasm/logger";
2
2
  import { PHPResponse as H, consumeAPI as ne, SupportedPHPVersions as X, printDebugDetails as be, HttpCookieStore as ge, FileLockManagerInMemory as Pe, createObjectPoolProxy as ve, exposeAPI as xe, exposeSyncAPI as Se } from "@php-wasm/universal";
3
3
  import { resolveRemoteBlueprint as Ie, resolveRuntimeConfiguration as Z, compileBlueprintV1 as ae, isBlueprintBundle as $e, runBlueprintV1Steps as J } from "@wp-playground/blueprints";
4
- import { zipDirectory as Te, RecommendedPHPVersion as D } from "@wp-playground/common";
4
+ import { zipDirectory as Te, RecommendedPHPVersion as C } from "@wp-playground/common";
5
5
  import c, { existsSync as j, rmdirSync as Ee, mkdirSync as N, readdirSync as ke } from "fs";
6
6
  import { MessageChannel as le, Worker as K } from "worker_threads";
7
7
  import { createNodeFsMountHandler as Me } from "@php-wasm/node";
8
- import u, { basename as C, join as de } from "path";
8
+ import u, { basename as A, join as de } from "path";
9
9
  import Be from "express";
10
10
  import V, { cpus as Ae } from "os";
11
11
  import Ce from "yargs";
@@ -109,17 +109,17 @@ function ue(e) {
109
109
  ]
110
110
  };
111
111
  if (st(t)) {
112
- const a = `/wordpress/wp-content/plugins/${C(t)}`;
112
+ const a = `/wordpress/wp-content/plugins/${A(t)}`;
113
113
  r.push({
114
114
  hostPath: t,
115
115
  vfsPath: a,
116
116
  autoMounted: !0
117
117
  }), s["additional-blueprint-steps"].push({
118
118
  step: "activatePlugin",
119
- pluginPath: `/wordpress/wp-content/plugins/${C(t)}`
119
+ pluginPath: `/wordpress/wp-content/plugins/${A(t)}`
120
120
  });
121
121
  } else if (ot(t)) {
122
- const i = C(t), a = `/wordpress/wp-content/themes/${i}`;
122
+ const i = A(t), a = `/wordpress/wp-content/themes/${i}`;
123
123
  r.push({
124
124
  hostPath: t,
125
125
  vfsPath: a,
@@ -424,7 +424,7 @@ async function yt(e, t, r) {
424
424
  });
425
425
  }
426
426
  function ce(e, t) {
427
- return new File([I.readFileSync(e)], C(e));
427
+ return new File([I.readFileSync(e)], A(e));
428
428
  }
429
429
  class bt {
430
430
  constructor(t, r) {
@@ -532,7 +532,7 @@ class bt {
532
532
  login: this.args.login,
533
533
  ...t || {},
534
534
  preferredVersions: {
535
- php: this.args.php ?? t?.preferredVersions?.php ?? D,
535
+ php: this.args.php ?? t?.preferredVersions?.php ?? C,
536
536
  wp: this.args.wp ?? t?.preferredVersions?.wp ?? "latest",
537
537
  ...t?.preferredVersions || {}
538
538
  }
@@ -806,7 +806,7 @@ async function ar(e) {
806
806
  php: {
807
807
  describe: "PHP version to use.",
808
808
  type: "string",
809
- default: D,
809
+ default: C,
810
810
  choices: X
811
811
  },
812
812
  wp: {
@@ -1014,7 +1014,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
1014
1014
  php: {
1015
1015
  describe: "PHP version to use.",
1016
1016
  type: "string",
1017
- default: D,
1017
+ default: C,
1018
1018
  choices: X
1019
1019
  },
1020
1020
  wp: {
@@ -1252,7 +1252,7 @@ async function Mt(e) {
1252
1252
  verbosity: e.verbosity || "normal"
1253
1253
  });
1254
1254
  e.command === "server" && (i.printBanner(), i.printConfig({
1255
- phpVersion: e.php || D,
1255
+ phpVersion: e.php || C,
1256
1256
  wpVersion: e.wp || "latest",
1257
1257
  port: e.port || 9400,
1258
1258
  xdebug: !!e.xdebug,
@@ -1270,12 +1270,12 @@ async function Mt(e) {
1270
1270
  const x = await dt({
1271
1271
  port: a,
1272
1272
  onBind: async (p, n) => {
1273
- const f = "127.0.0.1", y = `http://${f}:${n}`, R = e["site-url"] || y, M = Math.max(
1273
+ const f = "127.0.0.1", y = `http://${f}:${n}`, D = e["site-url"] || y, R = Math.max(
1274
1274
  Ae().length - 1,
1275
1275
  Tt
1276
1276
  ), Y = "-playground-cli-site-", T = await gt(Y);
1277
1277
  g.debug(`Native temp dir for VFS root: ${T.path}`);
1278
- const B = "WP Playground CLI - Listen for Xdebug", q = ".playground-xdebug-root", z = u.join(process.cwd(), q);
1278
+ const M = "WP Playground CLI - Listen for Xdebug", q = ".playground-xdebug-root", z = u.join(process.cwd(), q);
1279
1279
  if (await qe(z), e.xdebug && e.experimentalUnsafeIdeIntegration) {
1280
1280
  await ze(
1281
1281
  T.path,
@@ -1287,9 +1287,9 @@ async function Mt(e) {
1287
1287
  vfsPath: "/"
1288
1288
  };
1289
1289
  try {
1290
- await Ge(B, process.cwd());
1290
+ await Ge(M, process.cwd());
1291
1291
  const w = typeof e.xdebug == "object" ? e.xdebug : void 0, h = await Qe({
1292
- name: B,
1292
+ name: M,
1293
1293
  host: f,
1294
1294
  port: n,
1295
1295
  ides: e.experimentalUnsafeIdeIntegration,
@@ -1321,7 +1321,7 @@ async function Mt(e) {
1321
1321
  " 2. Open the Run and Debug panel on the left sidebar"
1322
1322
  ), console.log(
1323
1323
  ` 3. Select "${F(
1324
- B
1324
+ M
1325
1325
  )}" from the dropdown`
1326
1326
  ), console.log(' 3. Click "start debugging"'), console.log(
1327
1327
  " 5. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"
@@ -1329,7 +1329,7 @@ async function Mt(e) {
1329
1329
  " 6. Visit Playground in your browser to hit the breakpoint"
1330
1330
  ), v && console.log("")), v && h.phpstorm && (console.log(k("PhpStorm instructions:")), console.log(
1331
1331
  ` 1. Choose "${F(
1332
- B
1332
+ M
1333
1333
  )}" debug configuration in the toolbar`
1334
1334
  ), console.log(" 2. Click the debug button (bug icon)`"), console.log(
1335
1335
  " 3. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"
@@ -1387,17 +1387,17 @@ async function Mt(e) {
1387
1387
  );
1388
1388
  let E;
1389
1389
  e["experimental-blueprints-v2-runner"] ? E = new ht(e, {
1390
- siteUrl: R,
1390
+ siteUrl: D,
1391
1391
  cliOutput: i
1392
1392
  }) : (E = new bt(e, {
1393
- siteUrl: R,
1393
+ siteUrl: D,
1394
1394
  cliOutput: i
1395
1395
  }), typeof e.blueprint == "string" && (e.blueprint = await mt({
1396
1396
  sourceString: e.blueprint,
1397
1397
  blueprintMayReadAdjacentFiles: e["blueprint-may-read-adjacent-files"] === !0
1398
1398
  })));
1399
1399
  let W = !1;
1400
- const A = async function() {
1400
+ const B = async function() {
1401
1401
  W || (W = !0, await Promise.all(
1402
1402
  o.map(async (w) => {
1403
1403
  await s.get(w)?.dispose(), await w.worker.terminate();
@@ -1408,7 +1408,7 @@ async function Mt(e) {
1408
1408
  };
1409
1409
  try {
1410
1410
  const m = [], w = E.getWorkerType();
1411
- for (let h = 0; h < M; h++) {
1411
+ for (let h = 0; h < R; h++) {
1412
1412
  const b = At(w, {
1413
1413
  onExit: (P) => {
1414
1414
  W || P === 0 && g.error(
@@ -1474,14 +1474,14 @@ async function Mt(e) {
1474
1474
  await J($, t);
1475
1475
  }
1476
1476
  if (e.command === "build-snapshot") {
1477
- await Rt(t, e.outfile), i.printStatus(`Exported to ${e.outfile}`), await A();
1477
+ await Rt(t, e.outfile), i.printStatus(`Exported to ${e.outfile}`), await B();
1478
1478
  return;
1479
1479
  } else if (e.command === "run-blueprint") {
1480
- i.finishProgress("Done"), await A();
1480
+ i.finishProgress("Done"), await B();
1481
1481
  return;
1482
1482
  }
1483
1483
  }
1484
- if (i.finishProgress(), i.printReady(y, M), i.finishProgress(), i.printReady(y, M), e.phpmyadmin) {
1484
+ if (i.finishProgress(), i.printReady(y, R), e.phpmyadmin) {
1485
1485
  const h = u.join(
1486
1486
  e.phpmyadmin,
1487
1487
  Je
@@ -1497,16 +1497,16 @@ async function Mt(e) {
1497
1497
  playground: t,
1498
1498
  server: p,
1499
1499
  serverUrl: y,
1500
- [Symbol.asyncDispose]: A,
1500
+ [Symbol.asyncDispose]: B,
1501
1501
  [he]: {
1502
- workerThreadCount: M
1502
+ workerThreadCount: R
1503
1503
  }
1504
1504
  };
1505
1505
  } catch (m) {
1506
1506
  if (e.verbosity !== "debug")
1507
1507
  throw m;
1508
1508
  let w = "";
1509
- throw await t?.fileExists(Q) && (w = await t.readFileAsText(Q)), await A(), new Error(w, { cause: m });
1509
+ throw await t?.fileExists(Q) && (w = await t.readFileAsText(Q)), await B(), new Error(w, { cause: m });
1510
1510
  }
1511
1511
  },
1512
1512
  async handleRequest(p) {
@@ -1667,4 +1667,4 @@ export {
1667
1667
  Mt as r,
1668
1668
  At as s
1669
1669
  };
1670
- //# sourceMappingURL=run-cli-BzYAH0YF.js.map
1670
+ //# sourceMappingURL=run-cli-FHDubnX7.js.map