githolon 0.84.1 → 0.85.0
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/cli.mjs +11 -1
- package/dist/dev-server.mjs +33 -3
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1778,7 +1778,17 @@ function servePack(eng, ws, base = "") {
|
|
|
1778
1778
|
try {
|
|
1779
1779
|
r = JSON.parse(call(eng.ex, "pack_delta", { repoArg: repoArgOf(ws), workspace: ws, base, branch: BRANCH }, eng.STDERR));
|
|
1780
1780
|
} catch (e) {
|
|
1781
|
-
|
|
1781
|
+
const msg = String(e);
|
|
1782
|
+
if (/nothing to pack|head == base/.test(msg)) return { packB64: "", bytes: 0, upToDate: true, ...head ? { head } : {} };
|
|
1783
|
+
if (base && /reached root|before base|not found|unknown|no (?:merge )?base|missing|invalid/i.test(msg)) {
|
|
1784
|
+
try {
|
|
1785
|
+
const full = JSON.parse(call(eng.ex, "pack_delta", { repoArg: repoArgOf(ws), workspace: ws, base: "", branch: BRANCH }, eng.STDERR));
|
|
1786
|
+
if (full && full.ok === true && typeof full.packB64 === "string") {
|
|
1787
|
+
return { packB64: full.packB64, bytes: full.bytes, divergent: true, ...head ? { head } : {} };
|
|
1788
|
+
}
|
|
1789
|
+
} catch {
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1782
1792
|
throw e;
|
|
1783
1793
|
}
|
|
1784
1794
|
if (!r || r.ok !== true || typeof r.packB64 !== "string") throw new Error("servePack: kernel produced no pack");
|
package/dist/dev-server.mjs
CHANGED
|
@@ -794,7 +794,17 @@ function servePack(eng, ws, base = "") {
|
|
|
794
794
|
try {
|
|
795
795
|
r = JSON.parse(call(eng.ex, "pack_delta", { repoArg: repoArgOf(ws), workspace: ws, base, branch: BRANCH }, eng.STDERR));
|
|
796
796
|
} catch (e) {
|
|
797
|
-
|
|
797
|
+
const msg = String(e);
|
|
798
|
+
if (/nothing to pack|head == base/.test(msg)) return { packB64: "", bytes: 0, upToDate: true, ...head ? { head } : {} };
|
|
799
|
+
if (base && /reached root|before base|not found|unknown|no (?:merge )?base|missing|invalid/i.test(msg)) {
|
|
800
|
+
try {
|
|
801
|
+
const full = JSON.parse(call(eng.ex, "pack_delta", { repoArg: repoArgOf(ws), workspace: ws, base: "", branch: BRANCH }, eng.STDERR));
|
|
802
|
+
if (full && full.ok === true && typeof full.packB64 === "string") {
|
|
803
|
+
return { packB64: full.packB64, bytes: full.bytes, divergent: true, ...head ? { head } : {} };
|
|
804
|
+
}
|
|
805
|
+
} catch {
|
|
806
|
+
}
|
|
807
|
+
}
|
|
798
808
|
throw e;
|
|
799
809
|
}
|
|
800
810
|
if (!r || r.ok !== true || typeof r.packB64 !== "string") throw new Error("servePack: kernel produced no pack");
|
|
@@ -1897,9 +1907,20 @@ async function startDevCloud(opts = {}) {
|
|
|
1897
1907
|
return serialize(async () => {
|
|
1898
1908
|
await mountWorkspace(eng, ws, ledgerFor(ws));
|
|
1899
1909
|
const have = url.searchParams.get("have") || "";
|
|
1900
|
-
|
|
1910
|
+
let r;
|
|
1911
|
+
try {
|
|
1912
|
+
r = servePack(eng, ws, have);
|
|
1913
|
+
} catch (e) {
|
|
1914
|
+
return sendJson(res, { ok: false, custodyBreak: true, error: String(e && e.message || e).slice(0, 400), have }, 409);
|
|
1915
|
+
}
|
|
1901
1916
|
if (!r.packB64) return sendBytes(res, Buffer.alloc(0), 204, r.head ? { "x-nomos-head": r.head } : {});
|
|
1902
|
-
|
|
1917
|
+
const kind = r.divergent ? "full" : have ? "delta" : "full";
|
|
1918
|
+
sendBytes(res, unb64(r.packB64), 200, {
|
|
1919
|
+
"content-type": "application/x-git-packfile",
|
|
1920
|
+
"x-nomos-pack": kind,
|
|
1921
|
+
...r.divergent ? { "x-nomos-divergent": "1" } : {},
|
|
1922
|
+
...r.head ? { "x-nomos-head": r.head } : {}
|
|
1923
|
+
});
|
|
1903
1924
|
});
|
|
1904
1925
|
}
|
|
1905
1926
|
if (sub[0] === "snapshot" && req.method === "GET") {
|
|
@@ -2044,6 +2065,15 @@ Sec-WebSocket-Accept: ${accept}\r
|
|
|
2044
2065
|
socket.on("error", () => {
|
|
2045
2066
|
});
|
|
2046
2067
|
});
|
|
2068
|
+
if (!globalThis.__nomosDevGuards) {
|
|
2069
|
+
globalThis.__nomosDevGuards = true;
|
|
2070
|
+
process.on("unhandledRejection", (e) => {
|
|
2071
|
+
console.error("[dev-cloud] unhandledRejection (kept alive):", String(e && e.stack || e && e.message || e).slice(0, 500));
|
|
2072
|
+
});
|
|
2073
|
+
process.on("uncaughtException", (e) => {
|
|
2074
|
+
console.error("[dev-cloud] uncaughtException (kept alive):", String(e && e.stack || e && e.message || e).slice(0, 500));
|
|
2075
|
+
});
|
|
2076
|
+
}
|
|
2047
2077
|
await new Promise((resolve) => server.listen(port, host, resolve));
|
|
2048
2078
|
return { server, origin, dataDir, kernelSha, eng, custody, ledgerFor, serialize, persistBorn, close: () => new Promise((r) => server.close(r)) };
|
|
2049
2079
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githolon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "githolon — the Nomos developer CLI: Rails-style generators for @githolon/dsl domains + the package compiler. Kernel-independent.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@bjorn3/browser_wasi_shim": "0.4.2",
|
|
32
|
-
"@githolon/client": "^0.
|
|
33
|
-
"@githolon/dsl": "^0.
|
|
32
|
+
"@githolon/client": "^0.85.0",
|
|
33
|
+
"@githolon/dsl": "^0.85.0",
|
|
34
34
|
"isomorphic-git": "^1.38.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|