latticesql 3.4.6 → 3.4.7
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.js +79 -4
- package/dist/index.cjs +43 -2
- package/dist/index.js +43 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -56081,9 +56081,41 @@ var appJs = `
|
|
|
56081
56081
|
}
|
|
56082
56082
|
function reloadForUpdate(label) {
|
|
56083
56083
|
if (reloadingForUpdate) return;
|
|
56084
|
+
// Guard against an infinite reload loop. Reloading when the server version
|
|
56085
|
+
// changes is the seamless-update trigger \u2014 but if the version the page was
|
|
56086
|
+
// SERVED with keeps disagreeing with /api/version (e.g. a stale or duplicate
|
|
56087
|
+
// server is holding the port and reporting a different version), every fresh
|
|
56088
|
+
// page would reload again. That unbounded loop pegs memory and crashes the
|
|
56089
|
+
// browser. Cap reloads to MAX within WINDOW; past that, stop and surface the
|
|
56090
|
+
// mismatch instead of spinning. A genuine update reloads once and then the
|
|
56091
|
+
// versions agree, which clears the counter (see checkServerVersion).
|
|
56092
|
+
var KEY = 'lattice:updateReloads',
|
|
56093
|
+
MAX = 3,
|
|
56094
|
+
WINDOW = 60000,
|
|
56095
|
+
now = Date.now(),
|
|
56096
|
+
recent = [];
|
|
56097
|
+
try {
|
|
56098
|
+
recent = (JSON.parse(sessionStorage.getItem(KEY) || '[]') || []).filter(function (t) {
|
|
56099
|
+
return now - t < WINDOW;
|
|
56100
|
+
});
|
|
56101
|
+
} catch (_) {
|
|
56102
|
+
/* sessionStorage blocked \u2014 degrade to a single best-effort reload below */
|
|
56103
|
+
}
|
|
56104
|
+
if (recent.length >= MAX) {
|
|
56105
|
+
showUpdatePill('Version mismatch \u2014 stopped auto-reloading. Reload manually if needed.');
|
|
56106
|
+
return;
|
|
56107
|
+
}
|
|
56108
|
+
recent.push(now);
|
|
56109
|
+
try {
|
|
56110
|
+
sessionStorage.setItem(KEY, JSON.stringify(recent));
|
|
56111
|
+
} catch (_) {
|
|
56112
|
+
/* best-effort */
|
|
56113
|
+
}
|
|
56084
56114
|
reloadingForUpdate = true;
|
|
56085
56115
|
showUpdatePill(label || 'Updated \u2014 reloading\u2026');
|
|
56086
|
-
setTimeout(function () {
|
|
56116
|
+
setTimeout(function () {
|
|
56117
|
+
location.reload();
|
|
56118
|
+
}, 600);
|
|
56087
56119
|
}
|
|
56088
56120
|
// Manual upgrade fallback: show an "Update available \u2014 Upgrade" link next to
|
|
56089
56121
|
// the version chip only when the server reports a newer, installable version.
|
|
@@ -56115,7 +56147,16 @@ var appJs = `
|
|
|
56115
56147
|
var v = d && d.version ? String(d.version).replace(/^v/, '').trim() : '';
|
|
56116
56148
|
if (!v) return;
|
|
56117
56149
|
if (v !== BOOT_VERSION) reloadForUpdate('Updated to v' + v + ' \u2014 reloading\u2026');
|
|
56118
|
-
else
|
|
56150
|
+
else {
|
|
56151
|
+
hideUpdatePill();
|
|
56152
|
+
// Versions agree \u2014 clear the reload-loop guard so a later genuine
|
|
56153
|
+
// update can reload again from a clean slate.
|
|
56154
|
+
try {
|
|
56155
|
+
sessionStorage.removeItem('lattice:updateReloads');
|
|
56156
|
+
} catch (_) {
|
|
56157
|
+
/* best-effort */
|
|
56158
|
+
}
|
|
56159
|
+
}
|
|
56119
56160
|
})
|
|
56120
56161
|
.catch(function () { /* offline / mid-restart \u2014 the next reconnect retries */ });
|
|
56121
56162
|
// Refresh the manual-upgrade link alongside the reconnect version check.
|
|
@@ -70019,6 +70060,28 @@ ${e6.stack ?? ""}`
|
|
|
70019
70060
|
};
|
|
70020
70061
|
}
|
|
70021
70062
|
|
|
70063
|
+
// src/gui/probe-running.ts
|
|
70064
|
+
async function probeRunningGui(port, timeoutMs = 1e3) {
|
|
70065
|
+
const controller = new AbortController();
|
|
70066
|
+
const timer = setTimeout(() => {
|
|
70067
|
+
controller.abort();
|
|
70068
|
+
}, timeoutMs);
|
|
70069
|
+
try {
|
|
70070
|
+
const res = await fetch(`http://127.0.0.1:${String(port)}/api/version`, {
|
|
70071
|
+
signal: controller.signal
|
|
70072
|
+
});
|
|
70073
|
+
if (!res.ok) return null;
|
|
70074
|
+
const data = await res.json();
|
|
70075
|
+
if (typeof data !== "object" || data === null || !("version" in data)) return null;
|
|
70076
|
+
const v2 = data.version;
|
|
70077
|
+
return { version: typeof v2 === "string" ? v2 : "" };
|
|
70078
|
+
} catch {
|
|
70079
|
+
return null;
|
|
70080
|
+
} finally {
|
|
70081
|
+
clearTimeout(timer);
|
|
70082
|
+
}
|
|
70083
|
+
}
|
|
70084
|
+
|
|
70022
70085
|
// src/gui/supervisor.ts
|
|
70023
70086
|
import { spawn as spawn3 } from "child_process";
|
|
70024
70087
|
async function superviseGui(opts) {
|
|
@@ -70253,7 +70316,7 @@ function printHelp() {
|
|
|
70253
70316
|
);
|
|
70254
70317
|
}
|
|
70255
70318
|
function getVersion() {
|
|
70256
|
-
if (true) return "3.4.
|
|
70319
|
+
if (true) return "3.4.7";
|
|
70257
70320
|
try {
|
|
70258
70321
|
const pkgPath = new URL("../package.json", import.meta.url).pathname;
|
|
70259
70322
|
const pkg = JSON.parse(readFileSync20(pkgPath, "utf-8"));
|
|
@@ -70450,6 +70513,18 @@ async function runWatch(args) {
|
|
|
70450
70513
|
process.on("SIGTERM", shutdown);
|
|
70451
70514
|
}
|
|
70452
70515
|
async function runGui(args) {
|
|
70516
|
+
const port = args.port;
|
|
70517
|
+
if (!process.env.LATTICE_GUI_SUPERVISED) {
|
|
70518
|
+
const running = await probeRunningGui(port);
|
|
70519
|
+
if (running) {
|
|
70520
|
+
const url = `http://127.0.0.1:${String(port)}/`;
|
|
70521
|
+
console.log(
|
|
70522
|
+
`Lattice is already running at ${url}${running.version ? ` (v${running.version})` : ""} \u2014 opening it.`
|
|
70523
|
+
);
|
|
70524
|
+
if (!args.noOpen) openUrl(url);
|
|
70525
|
+
return;
|
|
70526
|
+
}
|
|
70527
|
+
}
|
|
70453
70528
|
if (!process.env.LATTICE_GUI_SUPERVISED && detectInstallContext().installable) {
|
|
70454
70529
|
try {
|
|
70455
70530
|
await superviseGui({
|
|
@@ -70477,7 +70552,7 @@ async function runGui(args) {
|
|
|
70477
70552
|
configPath: boot.configPath,
|
|
70478
70553
|
outputDir: boot.contextDir,
|
|
70479
70554
|
latticeRoot: boot.root,
|
|
70480
|
-
port
|
|
70555
|
+
port,
|
|
70481
70556
|
openBrowser: !args.noOpen,
|
|
70482
70557
|
autoRender: true,
|
|
70483
70558
|
version: getVersion(),
|
package/dist/index.cjs
CHANGED
|
@@ -57959,9 +57959,41 @@ var appJs = `
|
|
|
57959
57959
|
}
|
|
57960
57960
|
function reloadForUpdate(label) {
|
|
57961
57961
|
if (reloadingForUpdate) return;
|
|
57962
|
+
// Guard against an infinite reload loop. Reloading when the server version
|
|
57963
|
+
// changes is the seamless-update trigger \u2014 but if the version the page was
|
|
57964
|
+
// SERVED with keeps disagreeing with /api/version (e.g. a stale or duplicate
|
|
57965
|
+
// server is holding the port and reporting a different version), every fresh
|
|
57966
|
+
// page would reload again. That unbounded loop pegs memory and crashes the
|
|
57967
|
+
// browser. Cap reloads to MAX within WINDOW; past that, stop and surface the
|
|
57968
|
+
// mismatch instead of spinning. A genuine update reloads once and then the
|
|
57969
|
+
// versions agree, which clears the counter (see checkServerVersion).
|
|
57970
|
+
var KEY = 'lattice:updateReloads',
|
|
57971
|
+
MAX = 3,
|
|
57972
|
+
WINDOW = 60000,
|
|
57973
|
+
now = Date.now(),
|
|
57974
|
+
recent = [];
|
|
57975
|
+
try {
|
|
57976
|
+
recent = (JSON.parse(sessionStorage.getItem(KEY) || '[]') || []).filter(function (t) {
|
|
57977
|
+
return now - t < WINDOW;
|
|
57978
|
+
});
|
|
57979
|
+
} catch (_) {
|
|
57980
|
+
/* sessionStorage blocked \u2014 degrade to a single best-effort reload below */
|
|
57981
|
+
}
|
|
57982
|
+
if (recent.length >= MAX) {
|
|
57983
|
+
showUpdatePill('Version mismatch \u2014 stopped auto-reloading. Reload manually if needed.');
|
|
57984
|
+
return;
|
|
57985
|
+
}
|
|
57986
|
+
recent.push(now);
|
|
57987
|
+
try {
|
|
57988
|
+
sessionStorage.setItem(KEY, JSON.stringify(recent));
|
|
57989
|
+
} catch (_) {
|
|
57990
|
+
/* best-effort */
|
|
57991
|
+
}
|
|
57962
57992
|
reloadingForUpdate = true;
|
|
57963
57993
|
showUpdatePill(label || 'Updated \u2014 reloading\u2026');
|
|
57964
|
-
setTimeout(function () {
|
|
57994
|
+
setTimeout(function () {
|
|
57995
|
+
location.reload();
|
|
57996
|
+
}, 600);
|
|
57965
57997
|
}
|
|
57966
57998
|
// Manual upgrade fallback: show an "Update available \u2014 Upgrade" link next to
|
|
57967
57999
|
// the version chip only when the server reports a newer, installable version.
|
|
@@ -57993,7 +58025,16 @@ var appJs = `
|
|
|
57993
58025
|
var v = d && d.version ? String(d.version).replace(/^v/, '').trim() : '';
|
|
57994
58026
|
if (!v) return;
|
|
57995
58027
|
if (v !== BOOT_VERSION) reloadForUpdate('Updated to v' + v + ' \u2014 reloading\u2026');
|
|
57996
|
-
else
|
|
58028
|
+
else {
|
|
58029
|
+
hideUpdatePill();
|
|
58030
|
+
// Versions agree \u2014 clear the reload-loop guard so a later genuine
|
|
58031
|
+
// update can reload again from a clean slate.
|
|
58032
|
+
try {
|
|
58033
|
+
sessionStorage.removeItem('lattice:updateReloads');
|
|
58034
|
+
} catch (_) {
|
|
58035
|
+
/* best-effort */
|
|
58036
|
+
}
|
|
58037
|
+
}
|
|
57997
58038
|
})
|
|
57998
58039
|
.catch(function () { /* offline / mid-restart \u2014 the next reconnect retries */ });
|
|
57999
58040
|
// Refresh the manual-upgrade link alongside the reconnect version check.
|
package/dist/index.js
CHANGED
|
@@ -57784,9 +57784,41 @@ var appJs = `
|
|
|
57784
57784
|
}
|
|
57785
57785
|
function reloadForUpdate(label) {
|
|
57786
57786
|
if (reloadingForUpdate) return;
|
|
57787
|
+
// Guard against an infinite reload loop. Reloading when the server version
|
|
57788
|
+
// changes is the seamless-update trigger \u2014 but if the version the page was
|
|
57789
|
+
// SERVED with keeps disagreeing with /api/version (e.g. a stale or duplicate
|
|
57790
|
+
// server is holding the port and reporting a different version), every fresh
|
|
57791
|
+
// page would reload again. That unbounded loop pegs memory and crashes the
|
|
57792
|
+
// browser. Cap reloads to MAX within WINDOW; past that, stop and surface the
|
|
57793
|
+
// mismatch instead of spinning. A genuine update reloads once and then the
|
|
57794
|
+
// versions agree, which clears the counter (see checkServerVersion).
|
|
57795
|
+
var KEY = 'lattice:updateReloads',
|
|
57796
|
+
MAX = 3,
|
|
57797
|
+
WINDOW = 60000,
|
|
57798
|
+
now = Date.now(),
|
|
57799
|
+
recent = [];
|
|
57800
|
+
try {
|
|
57801
|
+
recent = (JSON.parse(sessionStorage.getItem(KEY) || '[]') || []).filter(function (t) {
|
|
57802
|
+
return now - t < WINDOW;
|
|
57803
|
+
});
|
|
57804
|
+
} catch (_) {
|
|
57805
|
+
/* sessionStorage blocked \u2014 degrade to a single best-effort reload below */
|
|
57806
|
+
}
|
|
57807
|
+
if (recent.length >= MAX) {
|
|
57808
|
+
showUpdatePill('Version mismatch \u2014 stopped auto-reloading. Reload manually if needed.');
|
|
57809
|
+
return;
|
|
57810
|
+
}
|
|
57811
|
+
recent.push(now);
|
|
57812
|
+
try {
|
|
57813
|
+
sessionStorage.setItem(KEY, JSON.stringify(recent));
|
|
57814
|
+
} catch (_) {
|
|
57815
|
+
/* best-effort */
|
|
57816
|
+
}
|
|
57787
57817
|
reloadingForUpdate = true;
|
|
57788
57818
|
showUpdatePill(label || 'Updated \u2014 reloading\u2026');
|
|
57789
|
-
setTimeout(function () {
|
|
57819
|
+
setTimeout(function () {
|
|
57820
|
+
location.reload();
|
|
57821
|
+
}, 600);
|
|
57790
57822
|
}
|
|
57791
57823
|
// Manual upgrade fallback: show an "Update available \u2014 Upgrade" link next to
|
|
57792
57824
|
// the version chip only when the server reports a newer, installable version.
|
|
@@ -57818,7 +57850,16 @@ var appJs = `
|
|
|
57818
57850
|
var v = d && d.version ? String(d.version).replace(/^v/, '').trim() : '';
|
|
57819
57851
|
if (!v) return;
|
|
57820
57852
|
if (v !== BOOT_VERSION) reloadForUpdate('Updated to v' + v + ' \u2014 reloading\u2026');
|
|
57821
|
-
else
|
|
57853
|
+
else {
|
|
57854
|
+
hideUpdatePill();
|
|
57855
|
+
// Versions agree \u2014 clear the reload-loop guard so a later genuine
|
|
57856
|
+
// update can reload again from a clean slate.
|
|
57857
|
+
try {
|
|
57858
|
+
sessionStorage.removeItem('lattice:updateReloads');
|
|
57859
|
+
} catch (_) {
|
|
57860
|
+
/* best-effort */
|
|
57861
|
+
}
|
|
57862
|
+
}
|
|
57822
57863
|
})
|
|
57823
57864
|
.catch(function () { /* offline / mid-restart \u2014 the next reconnect retries */ });
|
|
57824
57865
|
// Refresh the manual-upgrade link alongside the reconnect version check.
|
package/package.json
CHANGED