@absolutejs/absolute 0.19.0-beta.664 → 0.19.0-beta.666
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/dist/angular/index.js +2 -2
- package/dist/angular/index.js.map +1 -1
- package/dist/angular/server.js +2 -2
- package/dist/angular/server.js.map +1 -1
- package/dist/build.js +2 -2
- package/dist/build.js.map +1 -1
- package/dist/cli/index.js +286 -98
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/src/cli/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -257,11 +257,12 @@ var COMPOSE_PATH = "db/docker-compose.db.yml", DEFAULT_SERVER_ENTRY = "src/backe
|
|
|
257
257
|
}
|
|
258
258
|
pids.forEach(safeKill);
|
|
259
259
|
console.log(`\x1B[2m${formatTimestamp()}\x1B[0m \x1B[33m[cli]\x1B[0m \x1B[33mKilled ${pids.length} stale ${pids.length === 1 ? "process" : "processes"} on port ${port}.\x1B[0m`);
|
|
260
|
-
}, printHelp = () => {
|
|
260
|
+
}, printHelp = (subject = "server") => {
|
|
261
|
+
const title = subject === "workspace" ? "workspace" : subject;
|
|
261
262
|
console.log("");
|
|
262
263
|
console.log("\x1B[1mShortcuts:\x1B[0m");
|
|
263
|
-
console.log(
|
|
264
|
-
console.log(
|
|
264
|
+
console.log(` \x1B[36mr\x1B[0m / restart \u2014 Restart ${title}`);
|
|
265
|
+
console.log(` \x1B[36mp\x1B[0m / pause \u2014 Pause/resume ${title}`);
|
|
265
266
|
console.log(" \x1B[36mo\x1B[0m / open \u2014 Open in browser");
|
|
266
267
|
console.log(" \x1B[36mc\x1B[0m / clear \u2014 Clear terminal");
|
|
267
268
|
console.log(" \x1B[36mq\x1B[0m / quit \u2014 Graceful shutdown");
|
|
@@ -668,7 +669,7 @@ var exports_compile = {};
|
|
|
668
669
|
__export(exports_compile, {
|
|
669
670
|
compile: () => compile
|
|
670
671
|
});
|
|
671
|
-
var {env:
|
|
672
|
+
var {env: env4 } = globalThis.Bun;
|
|
672
673
|
import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync8, unlinkSync } from "fs";
|
|
673
674
|
import { basename as basename2, join as join6, relative, resolve as resolve7 } from "path";
|
|
674
675
|
var cliTag3 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, collectFiles2 = (dir) => {
|
|
@@ -847,7 +848,7 @@ console.log(\`
|
|
|
847
848
|
\`);
|
|
848
849
|
`;
|
|
849
850
|
}, stubPlugin, FRAMEWORK_EXTERNALS, compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
850
|
-
const prerenderPort = Number(
|
|
851
|
+
const prerenderPort = Number(env4.COMPILE_PORT) || Number(env4.PORT) || DEFAULT_PORT + 1;
|
|
851
852
|
killStaleProcesses(prerenderPort);
|
|
852
853
|
const entryName = basename2(serverEntry).replace(/\.[^.]+$/, "");
|
|
853
854
|
const resolvedOutdir = resolve7(outdir ?? "dist");
|
|
@@ -2379,9 +2380,10 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
2379
2380
|
init_constants();
|
|
2380
2381
|
init_loadConfig();
|
|
2381
2382
|
init_startupBanner();
|
|
2382
|
-
|
|
2383
|
+
var {$: $3 } = globalThis.Bun;
|
|
2383
2384
|
import { existsSync as existsSync8 } from "fs";
|
|
2384
2385
|
import { resolve as resolve6 } from "path";
|
|
2386
|
+
init_utils();
|
|
2385
2387
|
var serviceTag = (name, color) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[${name}]\x1B[0m`;
|
|
2386
2388
|
var workspaceTag = (color, message) => `${serviceTag("workspace", color)} ${color}${message}\x1B[0m`;
|
|
2387
2389
|
var sleep = (ms) => new Promise((resolvePromise) => setTimeout(resolvePromise, ms));
|
|
@@ -2392,7 +2394,16 @@ var getServiceUrl = (service) => {
|
|
|
2392
2394
|
}
|
|
2393
2395
|
return `http://localhost:${service.port}/`;
|
|
2394
2396
|
};
|
|
2395
|
-
var getServicePortLabel = (service) => service.port ?
|
|
2397
|
+
var getServicePortLabel = (service) => service.port ? `${service.port}` : "no-port";
|
|
2398
|
+
var getHealthcheckUrl = (service) => {
|
|
2399
|
+
if (service.healthcheck) {
|
|
2400
|
+
return service.healthcheck;
|
|
2401
|
+
}
|
|
2402
|
+
if (service.kind === "absolute" && service.port) {
|
|
2403
|
+
return `http://127.0.0.1:${service.port}/hmr-status`;
|
|
2404
|
+
}
|
|
2405
|
+
return;
|
|
2406
|
+
};
|
|
2396
2407
|
var ensureWorkspaceConfig = (config) => {
|
|
2397
2408
|
if (!config.workspace?.services || Object.keys(config.workspace.services).length === 0) {
|
|
2398
2409
|
throw new Error("absolute.config.ts is missing workspace.services. Add a workspace section before using `absolute workspace dev`.");
|
|
@@ -2416,7 +2427,7 @@ var resolveHealthcheck = (healthcheck) => {
|
|
|
2416
2427
|
url: healthcheck.url
|
|
2417
2428
|
};
|
|
2418
2429
|
};
|
|
2419
|
-
var waitForHealthcheck = async (
|
|
2430
|
+
var waitForHealthcheck = async (healthcheck) => {
|
|
2420
2431
|
const resolved = resolveHealthcheck(healthcheck);
|
|
2421
2432
|
if (!resolved) {
|
|
2422
2433
|
return;
|
|
@@ -2426,13 +2437,12 @@ var waitForHealthcheck = async (name, healthcheck) => {
|
|
|
2426
2437
|
try {
|
|
2427
2438
|
const response = await fetch(resolved.url);
|
|
2428
2439
|
if (response.ok) {
|
|
2429
|
-
console.log(workspaceTag("\x1B[32m", `${name} ready`));
|
|
2430
2440
|
return;
|
|
2431
2441
|
}
|
|
2432
2442
|
} catch {}
|
|
2433
2443
|
await sleep(resolved.intervalMs);
|
|
2434
2444
|
}
|
|
2435
|
-
throw new Error(
|
|
2445
|
+
throw new Error(`service did not become healthy within ${resolved.timeoutMs}ms (${resolved.url})`);
|
|
2436
2446
|
};
|
|
2437
2447
|
var topologicallySortServices = (services) => {
|
|
2438
2448
|
const ordered = [];
|
|
@@ -2465,8 +2475,17 @@ var topologicallySortServices = (services) => {
|
|
|
2465
2475
|
}
|
|
2466
2476
|
return ordered;
|
|
2467
2477
|
};
|
|
2468
|
-
var createLineForwarder = (name, color, dest) => {
|
|
2478
|
+
var createLineForwarder = (name, color, dest, onBeforeWrite, onAfterWrite) => {
|
|
2469
2479
|
let buffer = "";
|
|
2480
|
+
const writeLine = (line) => {
|
|
2481
|
+
if (line.trim().length === 0) {
|
|
2482
|
+
return;
|
|
2483
|
+
}
|
|
2484
|
+
onBeforeWrite?.();
|
|
2485
|
+
dest.write(`${serviceTag(name, color)} ${line}
|
|
2486
|
+
`);
|
|
2487
|
+
onAfterWrite?.();
|
|
2488
|
+
};
|
|
2470
2489
|
return {
|
|
2471
2490
|
push: (chunk) => {
|
|
2472
2491
|
buffer += Buffer.from(chunk).toString();
|
|
@@ -2474,27 +2493,42 @@ var createLineForwarder = (name, color, dest) => {
|
|
|
2474
2493
|
`);
|
|
2475
2494
|
buffer = lines.pop() ?? "";
|
|
2476
2495
|
for (const line of lines) {
|
|
2477
|
-
|
|
2478
|
-
continue;
|
|
2479
|
-
}
|
|
2480
|
-
dest.write(`${serviceTag(name, color)} ${line}
|
|
2481
|
-
`);
|
|
2496
|
+
writeLine(line);
|
|
2482
2497
|
}
|
|
2483
2498
|
},
|
|
2484
2499
|
flush: () => {
|
|
2485
2500
|
if (!buffer || buffer.trim().length === 0) {
|
|
2501
|
+
buffer = "";
|
|
2486
2502
|
return;
|
|
2487
2503
|
}
|
|
2488
|
-
|
|
2489
|
-
`);
|
|
2504
|
+
writeLine(buffer);
|
|
2490
2505
|
buffer = "";
|
|
2491
2506
|
}
|
|
2492
2507
|
};
|
|
2493
2508
|
};
|
|
2494
|
-
var pipeProcessLogs = (name, processHandle) => {
|
|
2495
|
-
const stdoutForwarder = createLineForwarder(name, "\x1B[36m", process.stdout);
|
|
2496
|
-
const stderrForwarder = createLineForwarder(name, "\x1B[31m", process.stderr);
|
|
2497
|
-
|
|
2509
|
+
var pipeProcessLogs = (name, processHandle, onBeforeWrite, onAfterWrite) => {
|
|
2510
|
+
const stdoutForwarder = createLineForwarder(name, "\x1B[36m", process.stdout, onBeforeWrite, onAfterWrite);
|
|
2511
|
+
const stderrForwarder = createLineForwarder(name, "\x1B[31m", process.stderr, onBeforeWrite, onAfterWrite);
|
|
2512
|
+
let bufferingStartupLogs = true;
|
|
2513
|
+
const stdoutStartupChunks = [];
|
|
2514
|
+
const stderrStartupChunks = [];
|
|
2515
|
+
const releaseStartupLogs = () => {
|
|
2516
|
+
if (!bufferingStartupLogs) {
|
|
2517
|
+
return;
|
|
2518
|
+
}
|
|
2519
|
+
bufferingStartupLogs = false;
|
|
2520
|
+
for (const chunk of stdoutStartupChunks) {
|
|
2521
|
+
stdoutForwarder.push(chunk);
|
|
2522
|
+
}
|
|
2523
|
+
stdoutStartupChunks.length = 0;
|
|
2524
|
+
stdoutForwarder.flush();
|
|
2525
|
+
for (const chunk of stderrStartupChunks) {
|
|
2526
|
+
stderrForwarder.push(chunk);
|
|
2527
|
+
}
|
|
2528
|
+
stderrStartupChunks.length = 0;
|
|
2529
|
+
stderrForwarder.flush();
|
|
2530
|
+
};
|
|
2531
|
+
const forward = async (stream, forwarder, startupBuffer) => {
|
|
2498
2532
|
const reader = stream.getReader();
|
|
2499
2533
|
try {
|
|
2500
2534
|
while (true) {
|
|
@@ -2502,21 +2536,29 @@ var pipeProcessLogs = (name, processHandle) => {
|
|
|
2502
2536
|
if (done) {
|
|
2503
2537
|
break;
|
|
2504
2538
|
}
|
|
2505
|
-
if (value) {
|
|
2506
|
-
|
|
2539
|
+
if (!value) {
|
|
2540
|
+
continue;
|
|
2507
2541
|
}
|
|
2542
|
+
if (bufferingStartupLogs) {
|
|
2543
|
+
startupBuffer.push(value);
|
|
2544
|
+
continue;
|
|
2545
|
+
}
|
|
2546
|
+
forwarder.push(value);
|
|
2508
2547
|
}
|
|
2509
2548
|
} finally {
|
|
2510
|
-
|
|
2549
|
+
if (!bufferingStartupLogs) {
|
|
2550
|
+
forwarder.flush();
|
|
2551
|
+
}
|
|
2511
2552
|
reader.releaseLock();
|
|
2512
2553
|
}
|
|
2513
2554
|
};
|
|
2514
|
-
forward(processHandle.stdout, stdoutForwarder);
|
|
2515
|
-
forward(processHandle.stderr, stderrForwarder);
|
|
2555
|
+
forward(processHandle.stdout, stdoutForwarder, stdoutStartupChunks);
|
|
2556
|
+
forward(processHandle.stderr, stderrForwarder, stderrStartupChunks);
|
|
2557
|
+
return { releaseStartupLogs };
|
|
2516
2558
|
};
|
|
2517
2559
|
var resolveService = (name, service, options) => {
|
|
2518
2560
|
const cwd = resolve6(service.cwd ?? ".");
|
|
2519
|
-
const
|
|
2561
|
+
const envVars = {
|
|
2520
2562
|
...process.env,
|
|
2521
2563
|
...service.env,
|
|
2522
2564
|
ABSOLUTE_WORKSPACE_SERVICE_NAME: name,
|
|
@@ -2524,13 +2566,13 @@ var resolveService = (name, service, options) => {
|
|
|
2524
2566
|
FORCE_COLOR: "1",
|
|
2525
2567
|
NODE_ENV: "development"
|
|
2526
2568
|
};
|
|
2527
|
-
if (service.port && !
|
|
2528
|
-
|
|
2569
|
+
if (service.port && !envVars.PORT) {
|
|
2570
|
+
envVars.PORT = String(service.port);
|
|
2529
2571
|
}
|
|
2530
2572
|
if (service.kind === "absolute") {
|
|
2531
2573
|
const configPath2 = service.config ? resolve6(cwd, service.config) : options.configPath ? resolve6(options.configPath) : process.env.ABSOLUTE_CONFIG ? resolve6(process.env.ABSOLUTE_CONFIG) : undefined;
|
|
2532
2574
|
if (configPath2) {
|
|
2533
|
-
|
|
2575
|
+
envVars.ABSOLUTE_CONFIG = configPath2;
|
|
2534
2576
|
}
|
|
2535
2577
|
const command = [
|
|
2536
2578
|
process.execPath,
|
|
@@ -2542,7 +2584,7 @@ var resolveService = (name, service, options) => {
|
|
|
2542
2584
|
command,
|
|
2543
2585
|
configPath: configPath2,
|
|
2544
2586
|
cwd,
|
|
2545
|
-
env:
|
|
2587
|
+
env: envVars,
|
|
2546
2588
|
name,
|
|
2547
2589
|
service,
|
|
2548
2590
|
visibility: getVisibility(service)
|
|
@@ -2551,12 +2593,19 @@ var resolveService = (name, service, options) => {
|
|
|
2551
2593
|
return {
|
|
2552
2594
|
command: service.command,
|
|
2553
2595
|
cwd,
|
|
2554
|
-
env:
|
|
2596
|
+
env: envVars,
|
|
2555
2597
|
name,
|
|
2556
2598
|
service,
|
|
2557
2599
|
visibility: getVisibility(service)
|
|
2558
2600
|
};
|
|
2559
2601
|
};
|
|
2602
|
+
var renderWorkspaceStepStart = (message) => {
|
|
2603
|
+
process.stdout.write(`${workspaceTag("\x1B[36m", message)}\r`);
|
|
2604
|
+
};
|
|
2605
|
+
var renderWorkspaceStepDone = (message, color = "\x1B[32m") => {
|
|
2606
|
+
process.stdout.write(`\r\x1B[2K${workspaceTag(color, message)}
|
|
2607
|
+
`);
|
|
2608
|
+
};
|
|
2560
2609
|
var workspace = async (subcommand, options) => {
|
|
2561
2610
|
if (subcommand !== "dev") {
|
|
2562
2611
|
throw new Error(subcommand ? `Unknown workspace command: ${subcommand}` : "No workspace subcommand specified. Use `absolute workspace dev`.");
|
|
@@ -2566,85 +2615,224 @@ var workspace = async (subcommand, options) => {
|
|
|
2566
2615
|
const orderedNames = topologicallySortServices(workspaceConfig.services);
|
|
2567
2616
|
const running = [];
|
|
2568
2617
|
let shuttingDown = false;
|
|
2569
|
-
|
|
2570
|
-
|
|
2618
|
+
let restarting = false;
|
|
2619
|
+
let paused = false;
|
|
2620
|
+
let workspaceReady = false;
|
|
2621
|
+
let interactive = null;
|
|
2622
|
+
const withPromptHidden = () => {
|
|
2623
|
+
if (!workspaceReady) {
|
|
2571
2624
|
return;
|
|
2572
2625
|
}
|
|
2573
|
-
|
|
2574
|
-
|
|
2626
|
+
interactive?.clearPrompt();
|
|
2627
|
+
};
|
|
2628
|
+
const restorePrompt = () => {
|
|
2629
|
+
if (!workspaceReady) {
|
|
2630
|
+
return;
|
|
2631
|
+
}
|
|
2632
|
+
interactive?.showPrompt();
|
|
2633
|
+
};
|
|
2634
|
+
const killProcesses = async () => {
|
|
2635
|
+
const snapshot = [...running];
|
|
2636
|
+
running.length = 0;
|
|
2637
|
+
for (const service of snapshot) {
|
|
2575
2638
|
try {
|
|
2576
2639
|
service.process.kill();
|
|
2577
2640
|
} catch {}
|
|
2578
2641
|
}
|
|
2579
|
-
await Promise.all(
|
|
2642
|
+
await Promise.all(snapshot.map((service) => service.process.exited));
|
|
2643
|
+
};
|
|
2644
|
+
const sendSignalToService = (processHandle, signal) => {
|
|
2645
|
+
try {
|
|
2646
|
+
process.kill(-processHandle.pid, signal);
|
|
2647
|
+
return;
|
|
2648
|
+
} catch {}
|
|
2649
|
+
try {
|
|
2650
|
+
process.kill(processHandle.pid, signal);
|
|
2651
|
+
} catch {}
|
|
2652
|
+
};
|
|
2653
|
+
const shutdown = async (exitCode = 0) => {
|
|
2654
|
+
if (shuttingDown) {
|
|
2655
|
+
return;
|
|
2656
|
+
}
|
|
2657
|
+
shuttingDown = true;
|
|
2658
|
+
if (interactive) {
|
|
2659
|
+
interactive.dispose();
|
|
2660
|
+
}
|
|
2661
|
+
if (paused) {
|
|
2662
|
+
for (const service of running) {
|
|
2663
|
+
sendSignalToService(service.process, "SIGCONT");
|
|
2664
|
+
}
|
|
2665
|
+
paused = false;
|
|
2666
|
+
}
|
|
2667
|
+
await killProcesses();
|
|
2580
2668
|
process.exit(exitCode);
|
|
2581
2669
|
};
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2670
|
+
const buildWorkspaceReadySummary = () => {
|
|
2671
|
+
const publicServices = orderedNames.map((name) => {
|
|
2672
|
+
const service = workspaceConfig.services[name];
|
|
2673
|
+
if (!service || getVisibility(service) !== "public") {
|
|
2674
|
+
return null;
|
|
2675
|
+
}
|
|
2676
|
+
const url = getServiceUrl(service);
|
|
2677
|
+
return url ? `${name} ${url}` : name;
|
|
2678
|
+
}).filter((value) => Boolean(value));
|
|
2679
|
+
const internalServices = orderedNames.map((name) => {
|
|
2680
|
+
const service = workspaceConfig.services[name];
|
|
2681
|
+
if (!service || getVisibility(service) !== "internal") {
|
|
2682
|
+
return null;
|
|
2683
|
+
}
|
|
2684
|
+
return service.port ? `${name} on ${service.port}` : name;
|
|
2685
|
+
}).filter((value) => Boolean(value));
|
|
2686
|
+
const segments = [];
|
|
2687
|
+
if (publicServices.length > 0) {
|
|
2688
|
+
segments.push(...publicServices);
|
|
2689
|
+
}
|
|
2690
|
+
if (internalServices.length > 0) {
|
|
2691
|
+
segments.push(`internal: ${internalServices.join(", ")}`);
|
|
2692
|
+
}
|
|
2693
|
+
return segments.join(" \xB7 ");
|
|
2694
|
+
};
|
|
2695
|
+
const startServices = async () => {
|
|
2696
|
+
workspaceReady = false;
|
|
2697
|
+
for (const name of orderedNames) {
|
|
2698
|
+
const service = workspaceConfig.services[name];
|
|
2699
|
+
if (!service) {
|
|
2700
|
+
throw new Error(`workspace.services is missing "${name}"`);
|
|
2701
|
+
}
|
|
2702
|
+
const resolved = resolveService(name, service, options);
|
|
2703
|
+
const port = (resolved.service.port ?? Number(resolved.env.PORT ?? "")) || DEFAULT_PORT;
|
|
2704
|
+
if (port > 0) {
|
|
2705
|
+
killStaleProcesses(port);
|
|
2706
|
+
}
|
|
2707
|
+
if (resolved.service.kind === "absolute" && resolved.configPath && !existsSync8(resolved.configPath)) {
|
|
2708
|
+
throw new Error(`${name} references missing config "${resolved.configPath}"`);
|
|
2709
|
+
}
|
|
2710
|
+
renderWorkspaceStepStart(`Starting ${name} (${resolved.visibility}, ${getServicePortLabel(resolved.service)})...`);
|
|
2711
|
+
const processHandle = Bun.spawn(resolved.command, {
|
|
2712
|
+
cwd: resolved.cwd,
|
|
2713
|
+
env: resolved.env,
|
|
2714
|
+
stderr: "pipe",
|
|
2715
|
+
stdin: "ignore",
|
|
2716
|
+
stdout: "pipe"
|
|
2717
|
+
});
|
|
2718
|
+
const { releaseStartupLogs } = pipeProcessLogs(name, processHandle, withPromptHidden, restorePrompt);
|
|
2719
|
+
const runningService = {
|
|
2720
|
+
name,
|
|
2721
|
+
process: processHandle,
|
|
2722
|
+
resolved,
|
|
2723
|
+
releaseStartupLogs
|
|
2724
|
+
};
|
|
2725
|
+
running.push(runningService);
|
|
2726
|
+
processHandle.exited.then((exitCode) => {
|
|
2727
|
+
if (shuttingDown || restarting) {
|
|
2728
|
+
return;
|
|
2729
|
+
}
|
|
2730
|
+
if (!running.includes(runningService)) {
|
|
2731
|
+
return;
|
|
2732
|
+
}
|
|
2733
|
+
console.error(workspaceTag("\x1B[31m", `${name} exited with code ${exitCode}. Shutting down workspace.`));
|
|
2734
|
+
shutdown(exitCode || 1);
|
|
2735
|
+
});
|
|
2736
|
+
await waitForHealthcheck(getHealthcheckUrl(resolved.service));
|
|
2737
|
+
renderWorkspaceStepDone(`${name} ready`);
|
|
2738
|
+
releaseStartupLogs();
|
|
2597
2739
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2740
|
+
workspaceReady = true;
|
|
2741
|
+
console.log(workspaceTag("\x1B[32m", `Ready \xB7 ${buildWorkspaceReadySummary()}`));
|
|
2742
|
+
printHint();
|
|
2743
|
+
interactive?.showPrompt();
|
|
2744
|
+
};
|
|
2745
|
+
const restartWorkspace = async () => {
|
|
2746
|
+
if (shuttingDown || restarting) {
|
|
2747
|
+
return;
|
|
2602
2748
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2749
|
+
restarting = true;
|
|
2750
|
+
workspaceReady = false;
|
|
2751
|
+
if (paused) {
|
|
2752
|
+
for (const service of running) {
|
|
2753
|
+
sendSignalToService(service.process, "SIGCONT");
|
|
2754
|
+
}
|
|
2755
|
+
paused = false;
|
|
2605
2756
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
processHandle.exited.then((exitCode) => {
|
|
2617
|
-
if (shuttingDown) {
|
|
2618
|
-
return;
|
|
2757
|
+
withPromptHidden();
|
|
2758
|
+
console.log(workspaceTag("\x1B[36m", "Restarting workspace..."));
|
|
2759
|
+
await killProcesses();
|
|
2760
|
+
restarting = false;
|
|
2761
|
+
await startServices();
|
|
2762
|
+
};
|
|
2763
|
+
const togglePause = () => {
|
|
2764
|
+
if (paused) {
|
|
2765
|
+
for (const service of running) {
|
|
2766
|
+
sendSignalToService(service.process, "SIGCONT");
|
|
2619
2767
|
}
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
if (!service || getVisibility(service) !== "public") {
|
|
2629
|
-
return null;
|
|
2768
|
+
paused = false;
|
|
2769
|
+
console.log(workspaceTag("\x1B[32m", "Workspace resumed."));
|
|
2770
|
+
} else {
|
|
2771
|
+
for (const service of running) {
|
|
2772
|
+
sendSignalToService(service.process, "SIGSTOP");
|
|
2773
|
+
}
|
|
2774
|
+
paused = true;
|
|
2775
|
+
console.log(`${workspaceTag("\x1B[33m", "Workspace paused.")} \x1B[90m[paused]\x1B[0m`);
|
|
2630
2776
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2777
|
+
};
|
|
2778
|
+
const runShellCommand2 = async (command) => {
|
|
2779
|
+
await $3`${{ raw: command }}`.env({ ...process.env, FORCE_COLOR: "1" }).nothrow();
|
|
2780
|
+
};
|
|
2781
|
+
const openInBrowser = async () => {
|
|
2782
|
+
const publicService = orderedNames.map((name) => workspaceConfig.services[name]).find((service) => service && getVisibility(service) === "public");
|
|
2783
|
+
const url = publicService ? getServiceUrl(publicService) : null;
|
|
2784
|
+
if (!url) {
|
|
2785
|
+
console.log(workspaceTag("\x1B[33m", "No public service to open."));
|
|
2786
|
+
return;
|
|
2638
2787
|
}
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2788
|
+
const { platform: platform4 } = process;
|
|
2789
|
+
const isWSL = platform4 === "linux" && isWSLEnvironment();
|
|
2790
|
+
let cmd;
|
|
2791
|
+
if (isWSL) {
|
|
2792
|
+
cmd = "cmd.exe";
|
|
2793
|
+
} else if (platform4 === "darwin") {
|
|
2794
|
+
cmd = "open";
|
|
2795
|
+
} else if (platform4 === "win32") {
|
|
2796
|
+
cmd = "start";
|
|
2797
|
+
} else {
|
|
2798
|
+
cmd = "xdg-open";
|
|
2799
|
+
}
|
|
2800
|
+
const args = isWSL ? ["/c", "start", url] : [url];
|
|
2801
|
+
try {
|
|
2802
|
+
Bun.spawn([cmd, ...args], {
|
|
2803
|
+
stderr: "ignore",
|
|
2804
|
+
stdout: "ignore"
|
|
2805
|
+
});
|
|
2806
|
+
console.log(workspaceTag("\x1B[36m", `Opening ${url}`));
|
|
2807
|
+
} catch {
|
|
2808
|
+
console.log(workspaceTag("\x1B[33m", `Could not open browser. Visit ${url}`));
|
|
2809
|
+
}
|
|
2810
|
+
};
|
|
2811
|
+
interactive = createInteractiveHandler({
|
|
2812
|
+
shell: runShellCommand2,
|
|
2813
|
+
clear: () => {
|
|
2814
|
+
process.stdout.write("\x1Bc");
|
|
2815
|
+
},
|
|
2816
|
+
help: () => {
|
|
2817
|
+
printHelp("workspace");
|
|
2818
|
+
},
|
|
2819
|
+
open: () => openInBrowser(),
|
|
2820
|
+
pause: () => {
|
|
2821
|
+
togglePause();
|
|
2822
|
+
},
|
|
2823
|
+
quit: () => {
|
|
2824
|
+
shutdown(0);
|
|
2825
|
+
},
|
|
2826
|
+
restart: () => restartWorkspace()
|
|
2827
|
+
});
|
|
2828
|
+
process.on("SIGINT", () => {
|
|
2829
|
+
shutdown(0);
|
|
2830
|
+
});
|
|
2831
|
+
process.on("SIGTERM", () => {
|
|
2832
|
+
shutdown(0);
|
|
2833
|
+
});
|
|
2834
|
+
await startServices();
|
|
2835
|
+
await new Promise(() => {});
|
|
2648
2836
|
};
|
|
2649
2837
|
|
|
2650
2838
|
// src/cli/index.ts
|
package/dist/index.js
CHANGED
|
@@ -174803,7 +174803,7 @@ ${registrations}
|
|
|
174803
174803
|
({ tsLibDir } = cached);
|
|
174804
174804
|
cached.lastUsed = Date.now();
|
|
174805
174805
|
} else {
|
|
174806
|
-
const tsPath = __require.resolve("typescript");
|
|
174806
|
+
const tsPath = __require.resolve("/home/alexkahn/abs/absolutejs/node_modules/typescript/lib/typescript.js");
|
|
174807
174807
|
const tsRootDir = dirname9(tsPath);
|
|
174808
174808
|
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve18(tsRootDir, "lib");
|
|
174809
174809
|
const config = readConfiguration("./tsconfig.json");
|
|
@@ -188807,5 +188807,5 @@ export {
|
|
|
188807
188807
|
ANGULAR_INIT_TIMEOUT_MS
|
|
188808
188808
|
};
|
|
188809
188809
|
|
|
188810
|
-
//# debugId=
|
|
188810
|
+
//# debugId=2B2FCBFEECB6C7FA64756E2164756E21
|
|
188811
188811
|
//# sourceMappingURL=index.js.map
|