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