@wp-playground/cli 3.0.19 → 3.0.20
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.
- package/README.md +1 -1
- package/blueprints-v1/worker-thread-v1.d.ts +3 -1
- package/cli.cjs +1 -1
- package/cli.js +1 -1
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/{mounts-D1_eXSTw.js → mounts-ChxECdbN.js} +53 -53
- package/{mounts-D1_eXSTw.js.map → mounts-ChxECdbN.js.map} +1 -1
- package/mounts-R4uHe-O-.cjs +16 -0
- package/{mounts-BJFrPHGW.cjs.map → mounts-R4uHe-O-.cjs.map} +1 -1
- package/package.json +12 -12
- package/run-cli-DJ9bUpjg.cjs +46 -0
- package/run-cli-DJ9bUpjg.cjs.map +1 -0
- package/{run-cli-fhMEvo2X.js → run-cli-g3_uJkf5.js} +197 -181
- package/run-cli-g3_uJkf5.js.map +1 -0
- package/run-cli.d.ts +2 -1
- package/worker-thread-v1.cjs +2 -2
- package/worker-thread-v1.cjs.map +1 -1
- package/worker-thread-v1.js +80 -78
- package/worker-thread-v1.js.map +1 -1
- package/mounts-BJFrPHGW.cjs +0 -16
- package/run-cli-4UcAoCNX.cjs +0 -46
- package/run-cli-4UcAoCNX.cjs.map +0 -1
- package/run-cli-fhMEvo2X.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { logger as g, LogSeverity as
|
|
2
|
-
import { PHPResponse as O, consumeAPI as
|
|
1
|
+
import { logger as g, LogSeverity as N, errorLogPath as z } from "@php-wasm/logger";
|
|
2
|
+
import { PHPResponse as O, consumeAPI as R, SupportedPHPVersions as me, printDebugDetails as he, exposeAPI as ge, exposeSyncAPI as we } from "@php-wasm/universal";
|
|
3
3
|
import { resolveRemoteBlueprint as ye, resolveRuntimeConfiguration as X, compileBlueprintV1 as be, isBlueprintBundle as ve, runBlueprintV1Steps as Pe } from "@wp-playground/blueprints";
|
|
4
4
|
import { zipDirectory as Se, RecommendedPHPVersion as ee } from "@wp-playground/common";
|
|
5
|
-
import
|
|
6
|
-
import { Worker as Z, MessageChannel as
|
|
7
|
-
import { p as Y, a as G, e as
|
|
5
|
+
import p, { mkdirSync as J } from "fs";
|
|
6
|
+
import { Worker as Z, MessageChannel as xe } from "worker_threads";
|
|
7
|
+
import { p as Y, a as G, e as ke } from "./mounts-ChxECdbN.js";
|
|
8
8
|
import Ie from "express";
|
|
9
9
|
import { FileLockManagerForNode as Ee } from "@php-wasm/node";
|
|
10
10
|
import te, { cpus as Ce } from "os";
|
|
11
11
|
import { jspi as Le } from "wasm-feature-detect";
|
|
12
12
|
import $e from "yargs";
|
|
13
13
|
import m, { basename as Te } from "path";
|
|
14
|
-
import { NodeJsFilesystem as
|
|
15
|
-
import { EmscriptenDownloadMonitor as Fe, ProgressTracker as
|
|
14
|
+
import { NodeJsFilesystem as je, OverlayFilesystem as Be, InMemoryFilesystem as Me, ZipFilesystem as Re } from "@wp-playground/storage";
|
|
15
|
+
import { EmscriptenDownloadMonitor as Fe, ProgressTracker as We } from "@php-wasm/progress";
|
|
16
16
|
import { resolveWordPressRelease as De } from "@wp-playground/wordpress";
|
|
17
17
|
import T from "fs-extra";
|
|
18
18
|
import { startBridge as Ae } from "@php-wasm/xdebug-bridge";
|
|
@@ -104,9 +104,9 @@ async function Xe({
|
|
|
104
104
|
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
105
105
|
return await ye(e);
|
|
106
106
|
let t = m.resolve(process.cwd(), e);
|
|
107
|
-
if (!
|
|
107
|
+
if (!p.existsSync(t))
|
|
108
108
|
throw new Error(`Blueprint file does not exist: ${t}`);
|
|
109
|
-
const i =
|
|
109
|
+
const i = p.statSync(t);
|
|
110
110
|
if (i.isDirectory() && (t = m.join(t, "blueprint.json")), !i.isFile() && i.isSymbolicLink())
|
|
111
111
|
throw new Error(
|
|
112
112
|
`Blueprint path is neither a file nor a directory: ${t}`
|
|
@@ -115,10 +115,10 @@ async function Xe({
|
|
|
115
115
|
switch (s) {
|
|
116
116
|
case ".zip":
|
|
117
117
|
return Re.fromArrayBuffer(
|
|
118
|
-
|
|
118
|
+
p.readFileSync(t).buffer
|
|
119
119
|
);
|
|
120
120
|
case ".json": {
|
|
121
|
-
const n =
|
|
121
|
+
const n = p.readFileSync(t, "utf-8");
|
|
122
122
|
try {
|
|
123
123
|
JSON.parse(n);
|
|
124
124
|
} catch {
|
|
@@ -126,9 +126,9 @@ async function Xe({
|
|
|
126
126
|
`Blueprint file at ${t} is not a valid JSON file`
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
|
-
const r = m.dirname(t), a = new
|
|
130
|
-
return new
|
|
131
|
-
new
|
|
129
|
+
const r = m.dirname(t), a = new je(r);
|
|
130
|
+
return new Be([
|
|
131
|
+
new Me({
|
|
132
132
|
"blueprint.json": n
|
|
133
133
|
}),
|
|
134
134
|
/**
|
|
@@ -162,7 +162,7 @@ class Je {
|
|
|
162
162
|
return "v2";
|
|
163
163
|
}
|
|
164
164
|
async bootAndSetUpInitialPlayground(o, t, i) {
|
|
165
|
-
const s =
|
|
165
|
+
const s = R(o);
|
|
166
166
|
await s.useFileLockManager(t);
|
|
167
167
|
const n = {
|
|
168
168
|
...this.args,
|
|
@@ -188,7 +188,7 @@ class Je {
|
|
|
188
188
|
firstProcessId: i,
|
|
189
189
|
nativeInternalDirPath: s
|
|
190
190
|
}) {
|
|
191
|
-
const n =
|
|
191
|
+
const n = R(o.phpPort);
|
|
192
192
|
await n.useFileLockManager(t);
|
|
193
193
|
const r = {
|
|
194
194
|
...this.args,
|
|
@@ -232,8 +232,8 @@ async function Ye(e, o, t) {
|
|
|
232
232
|
r.close(), r.closed || await new Promise((a, l) => {
|
|
233
233
|
r.on("finish", () => {
|
|
234
234
|
T.renameSync(n, o), a(null);
|
|
235
|
-
}), r.on("error", (
|
|
236
|
-
T.removeSync(n), l(
|
|
235
|
+
}), r.on("error", (d) => {
|
|
236
|
+
T.removeSync(n), l(d);
|
|
237
237
|
});
|
|
238
238
|
});
|
|
239
239
|
}
|
|
@@ -248,35 +248,34 @@ class Ge {
|
|
|
248
248
|
return "v1";
|
|
249
249
|
}
|
|
250
250
|
async bootAndSetUpInitialPlayground(o, t, i) {
|
|
251
|
-
let s;
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
let
|
|
255
|
-
|
|
256
|
-
if (
|
|
251
|
+
let s, n, r;
|
|
252
|
+
const a = new Fe();
|
|
253
|
+
if (this.args.wordpressInstallMode === "download-and-install") {
|
|
254
|
+
let k = !1;
|
|
255
|
+
a.addEventListener("progress", (j) => {
|
|
256
|
+
if (k)
|
|
257
257
|
return;
|
|
258
|
-
const { loaded:
|
|
259
|
-
Math.min(100, 100 *
|
|
258
|
+
const { loaded: x, total: f } = j.detail, B = Math.floor(
|
|
259
|
+
Math.min(100, 100 * x / f)
|
|
260
260
|
);
|
|
261
|
-
|
|
261
|
+
k = B === 100, this.writeProgressUpdate(
|
|
262
262
|
process.stdout,
|
|
263
|
-
`Downloading WordPress ${
|
|
264
|
-
|
|
263
|
+
`Downloading WordPress ${B}%...`,
|
|
264
|
+
k
|
|
265
265
|
);
|
|
266
|
-
}), s = await De(this.args.wp),
|
|
266
|
+
}), s = await De(this.args.wp), r = m.join(
|
|
267
|
+
_,
|
|
268
|
+
`prebuilt-wp-content-for-wp-${s.version}.zip`
|
|
269
|
+
), n = p.existsSync(r) ? ie(r) : await ne(
|
|
270
|
+
s.releaseUrl,
|
|
271
|
+
`${s.version}.zip`,
|
|
272
|
+
a
|
|
273
|
+
), g.log(
|
|
267
274
|
`Resolved WordPress release URL: ${s?.releaseUrl}`
|
|
268
275
|
);
|
|
269
276
|
}
|
|
270
|
-
const r = s && m.join(
|
|
271
|
-
_,
|
|
272
|
-
`prebuilt-wp-content-for-wp-${s.version}.zip`
|
|
273
|
-
), a = s ? u.existsSync(r) ? ie(r) : await ne(
|
|
274
|
-
s.releaseUrl,
|
|
275
|
-
`${s.version}.zip`,
|
|
276
|
-
n
|
|
277
|
-
) : void 0;
|
|
278
277
|
g.log("Fetching SQLite integration plugin...");
|
|
279
|
-
const l = this.args.skipSqliteSetup ? void 0 : await Ze(
|
|
278
|
+
const l = this.args.skipSqliteSetup ? void 0 : await Ze(a), d = this.args.followSymlinks === !0, c = this.args.experimentalTrace === !0, u = this.args["mount-before-install"] || [], h = this.args.mount || [], b = R(o);
|
|
280
279
|
await b.isConnected(), g.log("Booting WordPress...");
|
|
281
280
|
const S = await X(
|
|
282
281
|
this.getEffectiveBlueprint()
|
|
@@ -285,13 +284,14 @@ class Ge {
|
|
|
285
284
|
phpVersion: S.phpVersion,
|
|
286
285
|
wpVersion: S.wpVersion,
|
|
287
286
|
siteUrl: this.siteUrl,
|
|
288
|
-
mountsBeforeWpInstall:
|
|
287
|
+
mountsBeforeWpInstall: u,
|
|
289
288
|
mountsAfterWpInstall: h,
|
|
290
|
-
|
|
289
|
+
wordpressInstallMode: this.args.wordpressInstallMode || "download-and-install",
|
|
290
|
+
wordPressZip: n && await n.arrayBuffer(),
|
|
291
291
|
sqliteIntegrationPluginZip: await l?.arrayBuffer(),
|
|
292
292
|
firstProcessId: 0,
|
|
293
293
|
processIdSpaceLength: this.processIdSpaceLength,
|
|
294
|
-
followSymlinks:
|
|
294
|
+
followSymlinks: d,
|
|
295
295
|
trace: c,
|
|
296
296
|
internalCookieStore: this.args.internalCookieStore,
|
|
297
297
|
// We do not enable Xdebug by default for the initial worker
|
|
@@ -300,7 +300,7 @@ class Ge {
|
|
|
300
300
|
// TODO: Consider supporting Xdebug for the initial worker via a dedicated flag.
|
|
301
301
|
withXdebug: !1,
|
|
302
302
|
nativeInternalDirPath: i
|
|
303
|
-
}),
|
|
303
|
+
}), r && !this.args["mount-before-install"] && !p.existsSync(r) && (g.log("Caching preinstalled WordPress for the next boot..."), p.writeFileSync(
|
|
304
304
|
r,
|
|
305
305
|
await Se(b, "/wordpress")
|
|
306
306
|
), g.log("Cached!")), b;
|
|
@@ -311,7 +311,7 @@ class Ge {
|
|
|
311
311
|
firstProcessId: i,
|
|
312
312
|
nativeInternalDirPath: s
|
|
313
313
|
}) {
|
|
314
|
-
const n =
|
|
314
|
+
const n = R(
|
|
315
315
|
o.phpPort
|
|
316
316
|
);
|
|
317
317
|
await n.isConnected();
|
|
@@ -335,7 +335,7 @@ class Ge {
|
|
|
335
335
|
}), await n.isReady(), n;
|
|
336
336
|
}
|
|
337
337
|
async compileInputBlueprint(o) {
|
|
338
|
-
const t = this.getEffectiveBlueprint(), i = new
|
|
338
|
+
const t = this.getEffectiveBlueprint(), i = new We();
|
|
339
339
|
let s = "", n = !1;
|
|
340
340
|
return i.addEventListener("progress", (r) => {
|
|
341
341
|
if (n)
|
|
@@ -394,7 +394,7 @@ async function Qe(e, o, t) {
|
|
|
394
394
|
t
|
|
395
395
|
)).map(
|
|
396
396
|
(n) => new Promise((r) => {
|
|
397
|
-
|
|
397
|
+
p.rm(n, { recursive: !0 }, (a) => {
|
|
398
398
|
a ? g.warn(
|
|
399
399
|
`Failed to delete stale Playground temp dir: ${n}`,
|
|
400
400
|
a
|
|
@@ -408,7 +408,7 @@ async function Qe(e, o, t) {
|
|
|
408
408
|
}
|
|
409
409
|
async function et(e, o, t) {
|
|
410
410
|
try {
|
|
411
|
-
const i =
|
|
411
|
+
const i = p.readdirSync(t).map((n) => m.join(t, n)), s = [];
|
|
412
412
|
for (const n of i)
|
|
413
413
|
await tt(
|
|
414
414
|
e,
|
|
@@ -421,7 +421,7 @@ async function et(e, o, t) {
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
async function tt(e, o, t) {
|
|
424
|
-
if (!
|
|
424
|
+
if (!p.lstatSync(t).isDirectory())
|
|
425
425
|
return !1;
|
|
426
426
|
const s = m.basename(t);
|
|
427
427
|
if (!s.includes(e))
|
|
@@ -438,7 +438,7 @@ async function tt(e, o, t) {
|
|
|
438
438
|
if (await ot(r.pid, r.executableName))
|
|
439
439
|
return !1;
|
|
440
440
|
const a = Date.now() - o;
|
|
441
|
-
return
|
|
441
|
+
return p.statSync(t).mtime.getTime() < a;
|
|
442
442
|
}
|
|
443
443
|
async function ot(e, o) {
|
|
444
444
|
const [t] = await new Promise(
|
|
@@ -465,11 +465,11 @@ async function rt(e, o, t) {
|
|
|
465
465
|
// symlinks and do not require elevated permissions.
|
|
466
466
|
"junction"
|
|
467
467
|
) : "dir";
|
|
468
|
-
|
|
468
|
+
p.symlinkSync(e, o, i);
|
|
469
469
|
}
|
|
470
470
|
async function nt(e) {
|
|
471
471
|
try {
|
|
472
|
-
|
|
472
|
+
p.lstatSync(e).isSymbolicLink() && p.unlinkSync(e);
|
|
473
473
|
} catch {
|
|
474
474
|
}
|
|
475
475
|
}
|
|
@@ -500,7 +500,7 @@ const E = {
|
|
|
500
500
|
suppressBooleanAttributes: !E.allowBooleanAttributes,
|
|
501
501
|
format: !0,
|
|
502
502
|
indentBy: " "
|
|
503
|
-
},
|
|
503
|
+
}, F = {
|
|
504
504
|
allowEmptyContent: !0,
|
|
505
505
|
allowTrailingComma: !0
|
|
506
506
|
};
|
|
@@ -511,7 +511,7 @@ function st(e, o) {
|
|
|
511
511
|
} catch {
|
|
512
512
|
throw new Error("PhpStorm configuration file is not valid XML.");
|
|
513
513
|
}
|
|
514
|
-
})(),
|
|
514
|
+
})(), d = {
|
|
515
515
|
server: [
|
|
516
516
|
{
|
|
517
517
|
path_mappings: n.map((f) => ({
|
|
@@ -550,21 +550,21 @@ function st(e, o) {
|
|
|
550
550
|
project: [],
|
|
551
551
|
":@": { version: "4" }
|
|
552
552
|
}, l.push(c));
|
|
553
|
-
let
|
|
553
|
+
let u = c.project?.find(
|
|
554
554
|
(f) => !!f?.component && f?.[":@"]?.name === "PhpServers"
|
|
555
555
|
);
|
|
556
|
-
|
|
556
|
+
u === void 0 && (u = {
|
|
557
557
|
component: [],
|
|
558
558
|
":@": { name: "PhpServers" }
|
|
559
|
-
}, c.project === void 0 && (c.project = []), c.project.push(
|
|
560
|
-
let h =
|
|
559
|
+
}, c.project === void 0 && (c.project = []), c.project.push(u));
|
|
560
|
+
let h = u.component?.find(
|
|
561
561
|
(f) => !!f?.servers
|
|
562
562
|
);
|
|
563
|
-
h === void 0 && (h = { servers: [] },
|
|
563
|
+
h === void 0 && (h = { servers: [] }, u.component === void 0 && (u.component = []), u.component.push(h));
|
|
564
564
|
const b = h.servers?.findIndex(
|
|
565
565
|
(f) => !!f?.server && f?.[":@"]?.name === t
|
|
566
566
|
);
|
|
567
|
-
(b === void 0 || b < 0) && (h.servers === void 0 && (h.servers = []), h.servers.push(
|
|
567
|
+
(b === void 0 || b < 0) && (h.servers === void 0 && (h.servers = []), h.servers.push(d));
|
|
568
568
|
let S = c.project?.find(
|
|
569
569
|
(f) => !!f?.component && f?.[":@"]?.name === "RunManager"
|
|
570
570
|
);
|
|
@@ -592,33 +592,33 @@ function st(e, o) {
|
|
|
592
592
|
};
|
|
593
593
|
S.component === void 0 && (S.component = []), S.component.push(f);
|
|
594
594
|
}
|
|
595
|
-
const
|
|
595
|
+
const x = new re(se).build(l);
|
|
596
596
|
try {
|
|
597
|
-
a.parse(
|
|
597
|
+
a.parse(x, !0);
|
|
598
598
|
} catch {
|
|
599
599
|
throw new Error(
|
|
600
600
|
"The resulting PhpStorm configuration file is not valid XML."
|
|
601
601
|
);
|
|
602
602
|
}
|
|
603
|
-
return
|
|
603
|
+
return x;
|
|
604
604
|
}
|
|
605
605
|
function at(e, o) {
|
|
606
606
|
const { name: t, mappings: i } = o, s = [];
|
|
607
|
-
let n = e, r = v.parseTree(n, s,
|
|
607
|
+
let n = e, r = v.parseTree(n, s, F);
|
|
608
608
|
if (r === void 0 || s.length)
|
|
609
609
|
throw new Error("VS Code configuration file is not valid JSON.");
|
|
610
610
|
let a = v.findNodeAtLocation(r, ["configurations"]);
|
|
611
611
|
if (a === void 0 || a.children === void 0) {
|
|
612
|
-
const
|
|
613
|
-
n = v.applyEdits(n,
|
|
612
|
+
const d = v.modify(n, ["configurations"], [], {});
|
|
613
|
+
n = v.applyEdits(n, d), r = v.parseTree(n, [], F), a = v.findNodeAtLocation(r, [
|
|
614
614
|
"configurations"
|
|
615
615
|
]);
|
|
616
616
|
}
|
|
617
617
|
const l = a?.children?.findIndex(
|
|
618
|
-
(
|
|
618
|
+
(d) => v.findNodeAtLocation(d, ["name"])?.value === t
|
|
619
619
|
);
|
|
620
620
|
if (l === void 0 || l < 0) {
|
|
621
|
-
const
|
|
621
|
+
const d = {
|
|
622
622
|
name: t,
|
|
623
623
|
type: "php",
|
|
624
624
|
request: "launch",
|
|
@@ -626,10 +626,10 @@ function at(e, o) {
|
|
|
626
626
|
pathMappings: i.reduce((h, b) => (h[b.vfsPath] = `\${workspaceFolder}/${le(
|
|
627
627
|
m.relative(o.workspaceDir, b.hostPath)
|
|
628
628
|
)}`, h), {})
|
|
629
|
-
}, c = a?.children?.length || 0,
|
|
629
|
+
}, c = a?.children?.length || 0, u = v.modify(
|
|
630
630
|
n,
|
|
631
631
|
["configurations", c],
|
|
632
|
-
|
|
632
|
+
d,
|
|
633
633
|
{
|
|
634
634
|
formattingOptions: {
|
|
635
635
|
insertSpaces: !0,
|
|
@@ -639,7 +639,7 @@ function at(e, o) {
|
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
);
|
|
642
|
-
n = ae(n,
|
|
642
|
+
n = ae(n, u);
|
|
643
643
|
}
|
|
644
644
|
return n;
|
|
645
645
|
}
|
|
@@ -654,13 +654,13 @@ async function lt({
|
|
|
654
654
|
}) {
|
|
655
655
|
const a = it(s, n), l = [];
|
|
656
656
|
if (o.includes("phpstorm")) {
|
|
657
|
-
const
|
|
657
|
+
const d = ".idea/workspace.xml", c = m.join(
|
|
658
658
|
s,
|
|
659
|
-
|
|
659
|
+
d
|
|
660
660
|
);
|
|
661
|
-
if (!
|
|
662
|
-
if (
|
|
663
|
-
|
|
661
|
+
if (!p.existsSync(c)) {
|
|
662
|
+
if (p.existsSync(m.dirname(c)))
|
|
663
|
+
p.writeFileSync(
|
|
664
664
|
c,
|
|
665
665
|
`<?xml version="1.0" encoding="UTF-8"?>
|
|
666
666
|
<project version="4">
|
|
@@ -671,8 +671,8 @@ async function lt({
|
|
|
671
671
|
"PhpStorm IDE integration requested, but no '.idea' directory was found in the current working directory."
|
|
672
672
|
);
|
|
673
673
|
}
|
|
674
|
-
if (
|
|
675
|
-
const
|
|
674
|
+
if (p.existsSync(c)) {
|
|
675
|
+
const u = p.readFileSync(c, "utf8"), h = st(u, {
|
|
676
676
|
name: e,
|
|
677
677
|
host: t,
|
|
678
678
|
port: i,
|
|
@@ -680,18 +680,18 @@ async function lt({
|
|
|
680
680
|
mappings: a,
|
|
681
681
|
ideKey: r
|
|
682
682
|
});
|
|
683
|
-
|
|
683
|
+
p.writeFileSync(c, h);
|
|
684
684
|
}
|
|
685
|
-
l.push(
|
|
685
|
+
l.push(d);
|
|
686
686
|
}
|
|
687
687
|
if (o.includes("vscode")) {
|
|
688
|
-
const
|
|
688
|
+
const d = ".vscode/launch.json", c = m.join(
|
|
689
689
|
s,
|
|
690
|
-
|
|
690
|
+
d
|
|
691
691
|
);
|
|
692
|
-
if (!
|
|
693
|
-
if (
|
|
694
|
-
|
|
692
|
+
if (!p.existsSync(c)) {
|
|
693
|
+
if (p.existsSync(m.dirname(c)))
|
|
694
|
+
p.writeFileSync(
|
|
695
695
|
c,
|
|
696
696
|
`{
|
|
697
697
|
"configurations": []
|
|
@@ -702,21 +702,21 @@ async function lt({
|
|
|
702
702
|
"VS Code IDE integration requested, but no '.vscode' directory was found in the current working directory."
|
|
703
703
|
);
|
|
704
704
|
}
|
|
705
|
-
if (
|
|
706
|
-
const
|
|
705
|
+
if (p.existsSync(c)) {
|
|
706
|
+
const u = p.readFileSync(c, "utf-8"), h = at(u, {
|
|
707
707
|
name: e,
|
|
708
708
|
workspaceDir: s,
|
|
709
709
|
mappings: a
|
|
710
710
|
});
|
|
711
|
-
h !==
|
|
711
|
+
h !== u && (p.writeFileSync(c, h), l.push(d));
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
714
|
return l;
|
|
715
715
|
}
|
|
716
716
|
async function ct(e, o) {
|
|
717
717
|
const t = m.join(o, ".idea/workspace.xml");
|
|
718
|
-
if (
|
|
719
|
-
const s =
|
|
718
|
+
if (p.existsSync(t)) {
|
|
719
|
+
const s = p.readFileSync(t, "utf8"), n = new oe(E), r = (() => {
|
|
720
720
|
try {
|
|
721
721
|
return n.parse(s, !0);
|
|
722
722
|
} catch {
|
|
@@ -724,17 +724,17 @@ async function ct(e, o) {
|
|
|
724
724
|
"PhpStorm configuration file is not valid XML."
|
|
725
725
|
);
|
|
726
726
|
}
|
|
727
|
-
})(),
|
|
728
|
-
(
|
|
727
|
+
})(), d = r.find(
|
|
728
|
+
(u) => !!u?.project
|
|
729
729
|
)?.project?.find(
|
|
730
|
-
(
|
|
730
|
+
(u) => !!u?.component && u?.[":@"]?.name === "PhpServers"
|
|
731
731
|
)?.component?.find(
|
|
732
|
-
(
|
|
733
|
-
), c =
|
|
734
|
-
(
|
|
732
|
+
(u) => !!u?.servers
|
|
733
|
+
), c = d?.servers?.findIndex(
|
|
734
|
+
(u) => !!u?.server && u?.[":@"]?.name === e
|
|
735
735
|
);
|
|
736
736
|
if (c !== void 0 && c >= 0) {
|
|
737
|
-
|
|
737
|
+
d.servers.splice(c, 1);
|
|
738
738
|
const h = new re(se).build(r);
|
|
739
739
|
try {
|
|
740
740
|
n.parse(h, !0);
|
|
@@ -748,21 +748,21 @@ async function ct(e, o) {
|
|
|
748
748
|
<component name="PhpServers">
|
|
749
749
|
<servers></servers>
|
|
750
750
|
</component>
|
|
751
|
-
</project>` ?
|
|
751
|
+
</project>` ? p.unlinkSync(t) : p.writeFileSync(t, h);
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
754
|
const i = m.join(o, ".vscode/launch.json");
|
|
755
|
-
if (
|
|
756
|
-
const s = [], n =
|
|
755
|
+
if (p.existsSync(i)) {
|
|
756
|
+
const s = [], n = p.readFileSync(i, "utf-8"), r = v.parseTree(n, s, F);
|
|
757
757
|
if (r === void 0 || s.length)
|
|
758
758
|
throw new Error("VS Code configuration file is not valid JSON.");
|
|
759
759
|
const l = v.findNodeAtLocation(r, [
|
|
760
760
|
"configurations"
|
|
761
761
|
])?.children?.findIndex(
|
|
762
|
-
(
|
|
762
|
+
(d) => v.findNodeAtLocation(d, ["name"])?.value === e
|
|
763
763
|
);
|
|
764
764
|
if (l !== void 0 && l >= 0) {
|
|
765
|
-
const
|
|
765
|
+
const d = v.modify(
|
|
766
766
|
n,
|
|
767
767
|
["configurations", l],
|
|
768
768
|
void 0,
|
|
@@ -774,16 +774,16 @@ async function ct(e, o) {
|
|
|
774
774
|
`
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
|
-
), c = ae(n,
|
|
777
|
+
), c = ae(n, d);
|
|
778
778
|
c === `{
|
|
779
779
|
"configurations": []
|
|
780
|
-
}` ?
|
|
780
|
+
}` ? p.unlinkSync(i) : p.writeFileSync(i, c);
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
784
|
function ae(e, o) {
|
|
785
785
|
const t = [], i = v.applyEdits(e, o);
|
|
786
|
-
if (t.length = 0, v.parseTree(i, t,
|
|
786
|
+
if (t.length = 0, v.parseTree(i, t, F), t.length) {
|
|
787
787
|
const s = t.map((r) => ({
|
|
788
788
|
message: v.printParseErrorCode(r.error),
|
|
789
789
|
offset: r.offset,
|
|
@@ -815,9 +815,9 @@ function le(e) {
|
|
|
815
815
|
return e.replaceAll(m.sep, m.posix.sep);
|
|
816
816
|
}
|
|
817
817
|
const H = {
|
|
818
|
-
Quiet: { name: "quiet", severity:
|
|
819
|
-
Normal: { name: "normal", severity:
|
|
820
|
-
Debug: { name: "debug", severity:
|
|
818
|
+
Quiet: { name: "quiet", severity: N.Fatal },
|
|
819
|
+
Normal: { name: "normal", severity: N.Info },
|
|
820
|
+
Debug: { name: "debug", severity: N.Debug }
|
|
821
821
|
};
|
|
822
822
|
async function At() {
|
|
823
823
|
try {
|
|
@@ -878,10 +878,20 @@ async function At() {
|
|
|
878
878
|
describe: 'Consent flag: Allow "bundled" resources in a local blueprint to read files in the same directory as the blueprint file.',
|
|
879
879
|
type: "boolean",
|
|
880
880
|
default: !1
|
|
881
|
-
}).option("
|
|
882
|
-
describe: "
|
|
881
|
+
}).option("wordpress-install-mode", {
|
|
882
|
+
describe: "Control how Playground prepares WordPress before booting.",
|
|
883
|
+
type: "string",
|
|
884
|
+
default: "download-and-install",
|
|
885
|
+
choices: [
|
|
886
|
+
"download-and-install",
|
|
887
|
+
"install-from-existing-files",
|
|
888
|
+
"install-from-existing-files-if-needed",
|
|
889
|
+
"do-not-attempt-installing"
|
|
890
|
+
]
|
|
891
|
+
}).option("skip-wordpress-install", {
|
|
892
|
+
describe: "[Deprecated] Use --wordpress-install-mode instead.",
|
|
883
893
|
type: "boolean",
|
|
884
|
-
|
|
894
|
+
hidden: !0
|
|
885
895
|
}).option("skip-sqlite-setup", {
|
|
886
896
|
describe: "Skip the SQLite integration plugin setup to allow the WordPress site to use MySQL.",
|
|
887
897
|
type: "boolean",
|
|
@@ -955,7 +965,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
955
965
|
// Remove the "hidden" flag once Blueprint V2 is fully supported
|
|
956
966
|
hidden: !0
|
|
957
967
|
}).showHelpOnFail(!1).strictOptions().check(async (r) => {
|
|
958
|
-
if (
|
|
968
|
+
if (r["skip-wordpress-install"] === !0 && (r["wordpress-install-mode"] = "do-not-attempt-installing", r.wordpressInstallMode = "do-not-attempt-installing"), r.wp !== void 0 && !ze(r.wp))
|
|
959
969
|
try {
|
|
960
970
|
new URL(r.wp);
|
|
961
971
|
} catch {
|
|
@@ -974,7 +984,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
974
984
|
if (r["auto-mount"]) {
|
|
975
985
|
let a = !1;
|
|
976
986
|
try {
|
|
977
|
-
a =
|
|
987
|
+
a = p.statSync(r["auto-mount"]).isDirectory();
|
|
978
988
|
} catch {
|
|
979
989
|
a = !1;
|
|
980
990
|
}
|
|
@@ -989,9 +999,9 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
989
999
|
);
|
|
990
1000
|
if (r["experimental-blueprints-v2-runner"] === !0) {
|
|
991
1001
|
if (r.mode !== void 0) {
|
|
992
|
-
if ("
|
|
1002
|
+
if (r["wordpress-install-mode"] !== void 0)
|
|
993
1003
|
throw new Error(
|
|
994
|
-
"The --
|
|
1004
|
+
"The --wordpress-install-mode option cannot be used with the --mode option. Use one or the other."
|
|
995
1005
|
);
|
|
996
1006
|
if ("skip-sqlite-setup" in r)
|
|
997
1007
|
throw new Error(
|
|
@@ -1002,7 +1012,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
1002
1012
|
"The --mode option cannot be used with --auto-mount because --auto-mount automatically sets the mode."
|
|
1003
1013
|
);
|
|
1004
1014
|
} else
|
|
1005
|
-
r["
|
|
1015
|
+
r["wordpress-install-mode"] === "do-not-attempt-installing" ? r.mode = "apply-to-existing-site" : r.mode = "create-new-site";
|
|
1006
1016
|
const a = r.allow || [];
|
|
1007
1017
|
r.followSymlinks === !0 && a.push("follow-symlinks"), r["blueprint-may-read-adjacent-files"] === !0 && a.push("read-local-fs"), r.allow = a;
|
|
1008
1018
|
} else if (r.mode !== void 0)
|
|
@@ -1022,7 +1032,7 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
1022
1032
|
...o["mount-before-install"] || [],
|
|
1023
1033
|
...o["mount-dir-before-install"] || []
|
|
1024
1034
|
]
|
|
1025
|
-
}, s = await
|
|
1035
|
+
}, s = await pt(i);
|
|
1026
1036
|
s === void 0 && process.exit(0);
|
|
1027
1037
|
const n = /* @__PURE__ */ (() => {
|
|
1028
1038
|
let r;
|
|
@@ -1043,19 +1053,19 @@ Warning: Following symlinks will expose files outside mounted directories to Pla
|
|
|
1043
1053
|
t.push(i.message), i = i.cause;
|
|
1044
1054
|
while (i instanceof Error);
|
|
1045
1055
|
console.error(
|
|
1046
|
-
"\x1B[1m" + t.join(" caused by ") + "\x1B[0m"
|
|
1056
|
+
"\x1B[1m" + t.join(" caused by: ") + "\x1B[0m"
|
|
1047
1057
|
);
|
|
1048
1058
|
}
|
|
1049
1059
|
process.exit(1);
|
|
1050
1060
|
}
|
|
1051
1061
|
}
|
|
1052
|
-
const
|
|
1053
|
-
async function
|
|
1062
|
+
const M = (e) => process.stdout.isTTY ? "\x1B[1m" + e + "\x1B[0m" : e, dt = (e) => process.stdout.isTTY ? `\x1B[2m${e}\x1B[0m` : e, V = (e) => process.stdout.isTTY ? `\x1B[3m${e}\x1B[0m` : e, K = (e) => process.stdout.isTTY ? `\x1B[33m${e}\x1B[0m` : e;
|
|
1063
|
+
async function pt(e) {
|
|
1054
1064
|
let o, t;
|
|
1055
1065
|
const i = [];
|
|
1056
|
-
if (e.autoMount !== void 0 && (e.autoMount === "" && (e = { ...e, autoMount: process.cwd() }), e =
|
|
1066
|
+
if (e.autoMount !== void 0 && (e.autoMount === "" && (e = { ...e, autoMount: process.cwd() }), e = ke(e)), e.wordpressInstallMode === void 0 && (e.wordpressInstallMode = "download-and-install"), e.quiet && (e.verbosity = "quiet", delete e.quiet), e.debug ? e.verbosity = "debug" : e.verbosity === "debug" && (e.debug = !0), e.verbosity) {
|
|
1057
1067
|
const l = Object.values(H).find(
|
|
1058
|
-
(
|
|
1068
|
+
(d) => d.name === e.verbosity
|
|
1059
1069
|
).severity;
|
|
1060
1070
|
g.setSeverityFilterLevel(l);
|
|
1061
1071
|
}
|
|
@@ -1070,22 +1080,22 @@ async function ut(e) {
|
|
|
1070
1080
|
let r = !1, a = !0;
|
|
1071
1081
|
return g.log("Starting a PHP server..."), Oe({
|
|
1072
1082
|
port: e.port,
|
|
1073
|
-
onBind: async (l,
|
|
1074
|
-
const c = "127.0.0.1",
|
|
1083
|
+
onBind: async (l, d) => {
|
|
1084
|
+
const c = "127.0.0.1", u = `http://${c}:${d}`, h = e["site-url"] || u, b = e.experimentalMultiWorker ?? 1, S = b + 1, k = Math.floor(
|
|
1075
1085
|
Number.MAX_SAFE_INTEGER / S
|
|
1076
|
-
),
|
|
1077
|
-
|
|
1086
|
+
), j = "-playground-cli-site-", x = await Ke(
|
|
1087
|
+
j
|
|
1078
1088
|
);
|
|
1079
|
-
g.debug(`Native temp dir for VFS root: ${
|
|
1080
|
-
const f = "WP Playground CLI - Listen for Xdebug",
|
|
1089
|
+
g.debug(`Native temp dir for VFS root: ${x.path}`);
|
|
1090
|
+
const f = "WP Playground CLI - Listen for Xdebug", B = ".playground-xdebug-root", q = m.join(process.cwd(), B);
|
|
1081
1091
|
if (await nt(q), e.xdebug && e.experimentalUnsafeIdeIntegration) {
|
|
1082
1092
|
await rt(
|
|
1083
|
-
|
|
1093
|
+
x.path,
|
|
1084
1094
|
q,
|
|
1085
1095
|
process.platform
|
|
1086
1096
|
);
|
|
1087
1097
|
const w = {
|
|
1088
|
-
hostPath: m.join(".", m.sep,
|
|
1098
|
+
hostPath: m.join(".", m.sep, B),
|
|
1089
1099
|
vfsPath: "/"
|
|
1090
1100
|
};
|
|
1091
1101
|
try {
|
|
@@ -1093,7 +1103,7 @@ async function ut(e) {
|
|
|
1093
1103
|
const y = typeof e.xdebug == "object" ? e.xdebug : void 0, $ = await lt({
|
|
1094
1104
|
name: f,
|
|
1095
1105
|
host: c,
|
|
1096
|
-
port:
|
|
1106
|
+
port: d,
|
|
1097
1107
|
ides: e.experimentalUnsafeIdeIntegration,
|
|
1098
1108
|
cwd: process.cwd(),
|
|
1099
1109
|
mounts: [
|
|
@@ -1103,25 +1113,31 @@ async function ut(e) {
|
|
|
1103
1113
|
],
|
|
1104
1114
|
ideKey: y?.ideKey
|
|
1105
1115
|
}), P = e.experimentalUnsafeIdeIntegration, I = P.includes("vscode"), C = P.includes("phpstorm");
|
|
1106
|
-
console.log(""), console.log(
|
|
1116
|
+
console.log(""), console.log(M("Xdebug configured successfully")), console.log(
|
|
1107
1117
|
K("Updated IDE config: ") + $.join(" ")
|
|
1108
1118
|
), console.log(
|
|
1109
1119
|
K("Playground source root: ") + ".playground-xdebug-root" + V(
|
|
1110
|
-
|
|
1120
|
+
dt(
|
|
1111
1121
|
" – you can set breakpoints and preview Playground's VFS structure in there."
|
|
1112
1122
|
)
|
|
1113
1123
|
)
|
|
1114
|
-
), console.log(""), I && (console.log(
|
|
1115
|
-
" 1.
|
|
1124
|
+
), console.log(""), I && (console.log(M("VS Code / Cursor instructions:")), console.log(
|
|
1125
|
+
" 1. Ensure you have installed an IDE extension for PHP Debugging"
|
|
1126
|
+
), console.log(
|
|
1127
|
+
` (The ${M("PHP Debug")} extension by ${M(
|
|
1128
|
+
"Xdebug"
|
|
1129
|
+
)} has been a solid option)`
|
|
1130
|
+
), console.log(
|
|
1131
|
+
" 2. Open the Run and Debug panel on the left sidebar"
|
|
1116
1132
|
), console.log(
|
|
1117
|
-
`
|
|
1133
|
+
` 3. Select "${V(
|
|
1118
1134
|
f
|
|
1119
1135
|
)}" from the dropdown`
|
|
1120
1136
|
), console.log(' 3. Click "start debugging"'), console.log(
|
|
1121
|
-
"
|
|
1137
|
+
" 5. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"
|
|
1122
1138
|
), console.log(
|
|
1123
|
-
"
|
|
1124
|
-
), C && console.log("")), C && (console.log(
|
|
1139
|
+
" 6. Visit Playground in your browser to hit the breakpoint"
|
|
1140
|
+
), C && console.log("")), C && (console.log(M("PhpStorm instructions:")), console.log(
|
|
1125
1141
|
` 1. Choose "${V(
|
|
1126
1142
|
f
|
|
1127
1143
|
)}" debug configuration in the toolbar`
|
|
@@ -1136,15 +1152,15 @@ async function ut(e) {
|
|
|
1136
1152
|
});
|
|
1137
1153
|
}
|
|
1138
1154
|
}
|
|
1139
|
-
const ce = m.dirname(
|
|
1155
|
+
const ce = m.dirname(x.path), de = 2 * 24 * 60 * 60 * 1e3;
|
|
1140
1156
|
Qe(
|
|
1141
|
-
|
|
1142
|
-
|
|
1157
|
+
j,
|
|
1158
|
+
de,
|
|
1143
1159
|
ce
|
|
1144
1160
|
);
|
|
1145
|
-
const
|
|
1146
|
-
J(
|
|
1147
|
-
const
|
|
1161
|
+
const W = m.join(x.path, "internal");
|
|
1162
|
+
J(W);
|
|
1163
|
+
const pe = [
|
|
1148
1164
|
"wordpress",
|
|
1149
1165
|
// Note: These dirs are from Emscripten's "default dirs" list:
|
|
1150
1166
|
// https://github.com/emscripten-core/emscripten/blob/f431ec220e472e1f8d3db6b52fe23fb377facf30/src/lib/libfs.js#L1400-L1402
|
|
@@ -1155,11 +1171,11 @@ async function ut(e) {
|
|
|
1155
1171
|
"tmp",
|
|
1156
1172
|
"home"
|
|
1157
1173
|
];
|
|
1158
|
-
for (const w of
|
|
1174
|
+
for (const w of pe) {
|
|
1159
1175
|
const y = (P) => P.vfsPath === `/${w}`;
|
|
1160
1176
|
if (!(e["mount-before-install"]?.some(y) || e.mount?.some(y))) {
|
|
1161
1177
|
const P = m.join(
|
|
1162
|
-
|
|
1178
|
+
x.path,
|
|
1163
1179
|
w
|
|
1164
1180
|
);
|
|
1165
1181
|
J(P), e["mount-before-install"] === void 0 && (e["mount-before-install"] = []), e["mount-before-install"].unshift({
|
|
@@ -1181,41 +1197,41 @@ async function ut(e) {
|
|
|
1181
1197
|
let L;
|
|
1182
1198
|
e["experimental-blueprints-v2-runner"] ? L = new Je(e, {
|
|
1183
1199
|
siteUrl: h,
|
|
1184
|
-
processIdSpaceLength:
|
|
1200
|
+
processIdSpaceLength: k
|
|
1185
1201
|
}) : (L = new Ge(e, {
|
|
1186
1202
|
siteUrl: h,
|
|
1187
|
-
processIdSpaceLength:
|
|
1203
|
+
processIdSpaceLength: k
|
|
1188
1204
|
}), typeof e.blueprint == "string" && (e.blueprint = await Xe({
|
|
1189
1205
|
sourceString: e.blueprint,
|
|
1190
1206
|
blueprintMayReadAdjacentFiles: e["blueprint-may-read-adjacent-files"] === !0
|
|
1191
1207
|
})));
|
|
1192
|
-
let
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1208
|
+
let D = !1;
|
|
1209
|
+
const A = async function() {
|
|
1210
|
+
D || (D = !0, await Promise.all(
|
|
1195
1211
|
i.map(async ({ playground: y, worker: $ }) => {
|
|
1196
1212
|
await y.dispose(), await $.terminate();
|
|
1197
1213
|
})
|
|
1198
|
-
), l && await new Promise((y) => l.close(y)), await
|
|
1199
|
-
},
|
|
1214
|
+
), l && await new Promise((y) => l.close(y)), await x.cleanup());
|
|
1215
|
+
}, ue = ut(
|
|
1200
1216
|
S,
|
|
1201
1217
|
L.getWorkerType(),
|
|
1202
1218
|
({ exitCode: w, workerIndex: y }) => {
|
|
1203
|
-
|
|
1219
|
+
D || w === 0 && g.error(
|
|
1204
1220
|
`Worker ${y} exited with code ${w}
|
|
1205
1221
|
`
|
|
1206
1222
|
);
|
|
1207
1223
|
}
|
|
1208
1224
|
);
|
|
1209
|
-
g.log(
|
|
1225
|
+
g.log("Starting up workers");
|
|
1210
1226
|
try {
|
|
1211
|
-
const w = await
|
|
1227
|
+
const w = await ue, y = await Q(
|
|
1212
1228
|
n
|
|
1213
1229
|
);
|
|
1214
1230
|
{
|
|
1215
1231
|
const P = w.shift(), I = await L.bootAndSetUpInitialPlayground(
|
|
1216
1232
|
P.phpPort,
|
|
1217
1233
|
y,
|
|
1218
|
-
|
|
1234
|
+
W
|
|
1219
1235
|
);
|
|
1220
1236
|
if (await I.isReady(), r = !0, g.log("Booted!"), o = new qe(I), !e["experimental-blueprints-v2-runner"]) {
|
|
1221
1237
|
const C = await L.compileInputBlueprint(
|
|
@@ -1227,41 +1243,41 @@ async function ut(e) {
|
|
|
1227
1243
|
), g.log("Finished running the blueprint"));
|
|
1228
1244
|
}
|
|
1229
1245
|
if (e.command === "build-snapshot") {
|
|
1230
|
-
await mt(t, e.outfile), g.log(`WordPress exported to ${e.outfile}`), await
|
|
1246
|
+
await mt(t, e.outfile), g.log(`WordPress exported to ${e.outfile}`), await A();
|
|
1231
1247
|
return;
|
|
1232
1248
|
} else if (e.command === "run-blueprint") {
|
|
1233
|
-
g.log("Blueprint executed"), await
|
|
1249
|
+
g.log("Blueprint executed"), await A();
|
|
1234
1250
|
return;
|
|
1235
1251
|
}
|
|
1236
1252
|
await o.removeWorker(I), await I.dispose(), await P.worker.terminate();
|
|
1237
1253
|
}
|
|
1238
1254
|
g.log("Preparing workers...");
|
|
1239
|
-
const $ =
|
|
1255
|
+
const $ = k;
|
|
1240
1256
|
return [t] = await Promise.all(
|
|
1241
1257
|
w.map(async (P, I) => {
|
|
1242
|
-
const C = $ + I *
|
|
1258
|
+
const C = $ + I * k, fe = await Q(
|
|
1243
1259
|
n
|
|
1244
|
-
),
|
|
1260
|
+
), U = await L.bootPlayground({
|
|
1245
1261
|
worker: P,
|
|
1246
1262
|
fileLockManagerPort: fe,
|
|
1247
1263
|
firstProcessId: C,
|
|
1248
|
-
nativeInternalDirPath:
|
|
1264
|
+
nativeInternalDirPath: W
|
|
1249
1265
|
});
|
|
1250
1266
|
return i.push({
|
|
1251
|
-
playground:
|
|
1267
|
+
playground: U,
|
|
1252
1268
|
worker: P.worker
|
|
1253
|
-
}), o.addWorker(
|
|
1269
|
+
}), o.addWorker(U), U;
|
|
1254
1270
|
})
|
|
1255
1271
|
), g.log(
|
|
1256
|
-
`WordPress is running on ${
|
|
1272
|
+
`WordPress is running on ${u} with ${b} worker(s)`
|
|
1257
1273
|
), e.xdebug && e.experimentalDevtools && (await Ae({
|
|
1258
1274
|
phpInstance: t,
|
|
1259
1275
|
phpRoot: "/wordpress"
|
|
1260
1276
|
})).start(), {
|
|
1261
1277
|
playground: t,
|
|
1262
1278
|
server: l,
|
|
1263
|
-
serverUrl:
|
|
1264
|
-
[Symbol.asyncDispose]:
|
|
1279
|
+
serverUrl: u,
|
|
1280
|
+
[Symbol.asyncDispose]: A,
|
|
1265
1281
|
workerThreadCount: b
|
|
1266
1282
|
};
|
|
1267
1283
|
} catch (w) {
|
|
@@ -1279,22 +1295,22 @@ async function ut(e) {
|
|
|
1279
1295
|
);
|
|
1280
1296
|
if (a) {
|
|
1281
1297
|
a = !1;
|
|
1282
|
-
const
|
|
1298
|
+
const d = {
|
|
1283
1299
|
"Content-Type": ["text/plain"],
|
|
1284
1300
|
"Content-Length": ["0"],
|
|
1285
1301
|
Location: [l.url]
|
|
1286
1302
|
};
|
|
1287
1303
|
return l.headers?.cookie?.includes(
|
|
1288
1304
|
"playground_auto_login_already_happened"
|
|
1289
|
-
) && (
|
|
1305
|
+
) && (d["Set-Cookie"] = [
|
|
1290
1306
|
"playground_auto_login_already_happened=1; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/"
|
|
1291
|
-
]), new O(302,
|
|
1307
|
+
]), new O(302, d, new Uint8Array());
|
|
1292
1308
|
}
|
|
1293
1309
|
return await o.handleRequest(l);
|
|
1294
1310
|
}
|
|
1295
1311
|
});
|
|
1296
1312
|
}
|
|
1297
|
-
async function
|
|
1313
|
+
async function ut(e, o, t) {
|
|
1298
1314
|
const i = [];
|
|
1299
1315
|
for (let s = 0; s < e; s++) {
|
|
1300
1316
|
const n = await ft(o), r = (a) => {
|
|
@@ -1306,12 +1322,12 @@ async function dt(e, o, t) {
|
|
|
1306
1322
|
i.push(
|
|
1307
1323
|
new Promise(
|
|
1308
1324
|
(a, l) => {
|
|
1309
|
-
n.once("message", function(
|
|
1310
|
-
|
|
1311
|
-
}), n.once("error", function(
|
|
1312
|
-
console.error(
|
|
1325
|
+
n.once("message", function(d) {
|
|
1326
|
+
d.command === "worker-script-initialized" && a({ worker: n, phpPort: d.phpPort });
|
|
1327
|
+
}), n.once("error", function(d) {
|
|
1328
|
+
console.error(d);
|
|
1313
1329
|
const c = new Error(
|
|
1314
|
-
`Worker failed to load worker. ${
|
|
1330
|
+
`Worker failed to load worker. ${d.message ? `Original error: ${d.message}` : ""}`
|
|
1315
1331
|
);
|
|
1316
1332
|
l(c);
|
|
1317
1333
|
}), n.once("exit", r);
|
|
@@ -1325,7 +1341,7 @@ async function ft(e) {
|
|
|
1325
1341
|
return e === "v1" ? new Z(new URL("./worker-thread-v1.js", import.meta.url)) : new Z(new URL("./worker-thread-v2.js", import.meta.url));
|
|
1326
1342
|
}
|
|
1327
1343
|
async function Q(e) {
|
|
1328
|
-
const { port1: o, port2: t } = new
|
|
1344
|
+
const { port1: o, port2: t } = new xe();
|
|
1329
1345
|
return await Le() ? ge(e, null, o) : await we(e, o), t;
|
|
1330
1346
|
}
|
|
1331
1347
|
async function mt(e, o) {
|
|
@@ -1350,11 +1366,11 @@ async function mt(e, o) {
|
|
|
1350
1366
|
`
|
|
1351
1367
|
});
|
|
1352
1368
|
const t = await e.readFileAsBuffer("/tmp/build.zip");
|
|
1353
|
-
|
|
1369
|
+
p.writeFileSync(o, t);
|
|
1354
1370
|
}
|
|
1355
1371
|
export {
|
|
1356
1372
|
H as L,
|
|
1357
1373
|
At as p,
|
|
1358
|
-
|
|
1374
|
+
pt as r
|
|
1359
1375
|
};
|
|
1360
|
-
//# sourceMappingURL=run-cli-
|
|
1376
|
+
//# sourceMappingURL=run-cli-g3_uJkf5.js.map
|