@getmonoceros/workbench 1.38.9 → 1.38.10
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/bin.js +15 -84
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -9005,7 +9005,7 @@ var CLI_VERSION;
|
|
|
9005
9005
|
var init_version = __esm({
|
|
9006
9006
|
"src/version.ts"() {
|
|
9007
9007
|
"use strict";
|
|
9008
|
-
CLI_VERSION = true ? "1.38.
|
|
9008
|
+
CLI_VERSION = true ? "1.38.10" : "dev";
|
|
9009
9009
|
}
|
|
9010
9010
|
});
|
|
9011
9011
|
|
|
@@ -11373,6 +11373,8 @@ async function runRemove(opts) {
|
|
|
11373
11373
|
if (code !== "EACCES" && code !== "EPERM") {
|
|
11374
11374
|
throw err;
|
|
11375
11375
|
}
|
|
11376
|
+
const parentDir = path29.dirname(containerPath);
|
|
11377
|
+
const childName = path29.basename(containerPath);
|
|
11376
11378
|
logger.info(
|
|
11377
11379
|
`[remove] host-side rm hit ${code} on ${prettyPath(containerPath)}; using a throw-away alpine container to clean root-owned files\u2026`
|
|
11378
11380
|
);
|
|
@@ -11380,20 +11382,18 @@ async function runRemove(opts) {
|
|
|
11380
11382
|
"run",
|
|
11381
11383
|
"--rm",
|
|
11382
11384
|
"-v",
|
|
11383
|
-
`${
|
|
11385
|
+
`${parentDir}:/parent`,
|
|
11384
11386
|
"alpine:3.21",
|
|
11385
|
-
"
|
|
11386
|
-
"
|
|
11387
|
-
|
|
11388
|
-
"1",
|
|
11389
|
-
"-delete"
|
|
11387
|
+
"rm",
|
|
11388
|
+
"-rf",
|
|
11389
|
+
`/parent/${childName}`
|
|
11390
11390
|
]);
|
|
11391
11391
|
try {
|
|
11392
11392
|
await fs19.rm(containerPath, { recursive: true, force: true });
|
|
11393
11393
|
} catch (err2) {
|
|
11394
11394
|
const code2 = err2.code;
|
|
11395
11395
|
throw new Error(
|
|
11396
|
-
`docker-based cleanup of ${containerPath} did not fully clear it (alpine
|
|
11396
|
+
`docker-based cleanup of ${containerPath} did not fully clear it (alpine rm exit ${exit}${stderr.trim() ? `: ${stderr.trim()}` : ""}; host rm: ${code2}). Inspect with \`sudo ls -la ${containerPath}\` and clean manually.`
|
|
11397
11397
|
);
|
|
11398
11398
|
}
|
|
11399
11399
|
}
|
|
@@ -12623,65 +12623,15 @@ var init_caddy = __esm({
|
|
|
12623
12623
|
}
|
|
12624
12624
|
});
|
|
12625
12625
|
|
|
12626
|
-
// src/devcontainer/wsl-networking.ts
|
|
12627
|
-
import { spawn as spawn14 } from "child_process";
|
|
12628
|
-
import os4 from "os";
|
|
12629
|
-
function capture(cmd, args) {
|
|
12630
|
-
return new Promise((resolve) => {
|
|
12631
|
-
let stdout = "";
|
|
12632
|
-
const child = spawn14(cmd, args, {
|
|
12633
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
12634
|
-
});
|
|
12635
|
-
child.stdout.on("data", (c) => stdout += c.toString());
|
|
12636
|
-
child.on("error", () => resolve({ stdout: "", code: -1 }));
|
|
12637
|
-
child.on("exit", (code) => resolve({ stdout, code: code ?? -1 }));
|
|
12638
|
-
});
|
|
12639
|
-
}
|
|
12640
|
-
async function windowsLanIpv4() {
|
|
12641
|
-
if (!isWsl()) return null;
|
|
12642
|
-
const psScript = "(Get-NetIPConfiguration | Where-Object { $_.IPv4DefaultGateway -ne $null -and $_.NetAdapter.Status -eq 'Up' } | Select-Object -First 1 -ExpandProperty IPv4Address).IPAddress";
|
|
12643
|
-
const r = await capture("powershell.exe", [
|
|
12644
|
-
"-NoProfile",
|
|
12645
|
-
"-NonInteractive",
|
|
12646
|
-
"-Command",
|
|
12647
|
-
psScript
|
|
12648
|
-
]);
|
|
12649
|
-
const ip = r.stdout.replace(/\r/g, "").trim().split(/\s+/)[0] ?? "";
|
|
12650
|
-
return IPV4_RE3.test(ip) ? ip : null;
|
|
12651
|
-
}
|
|
12652
|
-
function localInterfacesInclude(ip) {
|
|
12653
|
-
for (const list of Object.values(os4.networkInterfaces())) {
|
|
12654
|
-
for (const addr of list ?? []) {
|
|
12655
|
-
if (addr.family === "IPv4" && addr.address === ip) return true;
|
|
12656
|
-
}
|
|
12657
|
-
}
|
|
12658
|
-
return false;
|
|
12659
|
-
}
|
|
12660
|
-
async function wslLanTarget() {
|
|
12661
|
-
const lanIp = await windowsLanIpv4();
|
|
12662
|
-
return {
|
|
12663
|
-
lanIp,
|
|
12664
|
-
mirrored: lanIp !== null && localInterfacesInclude(lanIp)
|
|
12665
|
-
};
|
|
12666
|
-
}
|
|
12667
|
-
var IPV4_RE3;
|
|
12668
|
-
var init_wsl_networking = __esm({
|
|
12669
|
-
"src/devcontainer/wsl-networking.ts"() {
|
|
12670
|
-
"use strict";
|
|
12671
|
-
init_ssh_attach();
|
|
12672
|
-
IPV4_RE3 = /^(\d{1,3}\.){3}\d{1,3}$/;
|
|
12673
|
-
}
|
|
12674
|
-
});
|
|
12675
|
-
|
|
12676
12626
|
// src/share/run.ts
|
|
12677
|
-
import
|
|
12678
|
-
import { spawn as
|
|
12627
|
+
import os4 from "os";
|
|
12628
|
+
import { spawn as spawn14, spawnSync as spawnSync2 } from "child_process";
|
|
12679
12629
|
import { consola as consola35 } from "consola";
|
|
12680
12630
|
import { promises as fs22 } from "fs";
|
|
12681
12631
|
import path34 from "path";
|
|
12682
12632
|
function realHostAddresses() {
|
|
12683
12633
|
let ip;
|
|
12684
|
-
for (const list of Object.values(
|
|
12634
|
+
for (const list of Object.values(os4.networkInterfaces())) {
|
|
12685
12635
|
for (const addr of list ?? []) {
|
|
12686
12636
|
if (addr.family === "IPv4" && !addr.internal) {
|
|
12687
12637
|
ip = addr.address;
|
|
@@ -12700,19 +12650,19 @@ function mdnsHostName() {
|
|
|
12700
12650
|
const name = res.status === 0 ? res.stdout.trim() : "";
|
|
12701
12651
|
if (name) return `${name}.local`;
|
|
12702
12652
|
}
|
|
12703
|
-
const hn =
|
|
12653
|
+
const hn = os4.hostname();
|
|
12704
12654
|
return hn.endsWith(".local") ? hn : `${hn}.local`;
|
|
12705
12655
|
}
|
|
12706
12656
|
async function defaultEnsureImage(image, log) {
|
|
12707
12657
|
const present = await new Promise((resolve) => {
|
|
12708
|
-
const c =
|
|
12658
|
+
const c = spawn14("docker", ["image", "inspect", image], { stdio: "ignore" });
|
|
12709
12659
|
c.on("error", () => resolve(false));
|
|
12710
12660
|
c.on("exit", (code) => resolve(code === 0));
|
|
12711
12661
|
});
|
|
12712
12662
|
if (present) return;
|
|
12713
12663
|
log.info(dim(`Pulling ${image} (first run, one-time)\u2026`));
|
|
12714
12664
|
await new Promise((resolve, reject) => {
|
|
12715
|
-
const c =
|
|
12665
|
+
const c = spawn14("docker", ["pull", "-q", image], {
|
|
12716
12666
|
stdio: ["ignore", "ignore", "pipe"]
|
|
12717
12667
|
});
|
|
12718
12668
|
let err = "";
|
|
@@ -12765,14 +12715,7 @@ async function runShare(opts) {
|
|
|
12765
12715
|
for (const port of ports) {
|
|
12766
12716
|
await preflight({ port, address: SHARE_ADDRESS });
|
|
12767
12717
|
}
|
|
12768
|
-
const { ip
|
|
12769
|
-
let ip = rawIp;
|
|
12770
|
-
let wslNatUnreachable = false;
|
|
12771
|
-
if (isWsl()) {
|
|
12772
|
-
const t = await wslLanTarget();
|
|
12773
|
-
if (t.lanIp) ip = t.lanIp;
|
|
12774
|
-
wslNatUnreachable = t.lanIp !== null && !t.mirrored;
|
|
12775
|
-
}
|
|
12718
|
+
const { ip, mdnsName } = (opts.hostAddresses ?? realHostAddresses)();
|
|
12776
12719
|
const sans = [mdnsName, ip, "localhost", "127.0.0.1"].filter(
|
|
12777
12720
|
(s) => typeof s === "string" && s.length > 0
|
|
12778
12721
|
);
|
|
@@ -12819,17 +12762,6 @@ async function runShare(opts) {
|
|
|
12819
12762
|
` First device? Trust the local CA once so HTTPS is warning-free: ${caPath}`
|
|
12820
12763
|
)
|
|
12821
12764
|
);
|
|
12822
|
-
if (wslNatUnreachable) {
|
|
12823
|
-
const warn = log.warn ?? log.info;
|
|
12824
|
-
warn(
|
|
12825
|
-
"WSL is in NAT mode, so the URL above is not reachable from other devices yet."
|
|
12826
|
-
);
|
|
12827
|
-
warn("Enable mirrored networking once, then re-run this command:");
|
|
12828
|
-
warn(" 1. add to %USERPROFILE%\\.wslconfig:");
|
|
12829
|
-
warn(" [wsl2]");
|
|
12830
|
-
warn(" networkingMode=mirrored");
|
|
12831
|
-
warn(" 2. run wsl --shutdown in PowerShell (closes your WSL sessions)");
|
|
12832
|
-
}
|
|
12833
12765
|
const dockerSpawn = opts.dockerSpawn ?? defaultDockerSpawn;
|
|
12834
12766
|
const handles = [
|
|
12835
12767
|
dockerSpawn(
|
|
@@ -12869,7 +12801,6 @@ var init_run4 = __esm({
|
|
|
12869
12801
|
init_caddy();
|
|
12870
12802
|
init_paths();
|
|
12871
12803
|
init_ssh_attach();
|
|
12872
|
-
init_wsl_networking();
|
|
12873
12804
|
init_format();
|
|
12874
12805
|
SHARE_ADDRESS = "0.0.0.0";
|
|
12875
12806
|
}
|