@limno/core 0.1.5 → 0.1.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/index.cjs CHANGED
@@ -553,7 +553,7 @@ var import_node_module2 = require("module");
553
553
  var import_node_os2 = __toESM(require("os"), 1);
554
554
  var import_node_path3 = __toESM(require("path"), 1);
555
555
  var require2 = (0, import_node_module2.createRequire)(importMetaUrl);
556
- var DAY = 24 * 60 * 60 * 1e3;
556
+ var TTL = 60 * 60 * 1e3;
557
557
  function currentVersion() {
558
558
  try {
559
559
  return require2("../package.json").version;
@@ -561,6 +561,13 @@ function currentVersion() {
561
561
  return "0.0.0";
562
562
  }
563
563
  }
564
+ function installedVersion(fallback) {
565
+ try {
566
+ return JSON.parse((0, import_node_fs2.readFileSync)(require2.resolve("../package.json"), "utf8")).version;
567
+ } catch {
568
+ return fallback;
569
+ }
570
+ }
564
571
  var newer = (a, b) => {
565
572
  const pa = a.split(/[.-]/).map((n) => parseInt(n, 10) || 0);
566
573
  const pb = b.split(/[.-]/).map((n) => parseInt(n, 10) || 0);
@@ -598,7 +605,7 @@ var cacheFile = () => import_node_path3.default.join(import_node_os2.default.hom
598
605
  async function latestVersion() {
599
606
  try {
600
607
  const cached = JSON.parse((0, import_node_fs2.readFileSync)(cacheFile(), "utf8"));
601
- if (Date.now() - cached.at < DAY) return cached.latest;
608
+ if (Date.now() - cached.at < TTL) return cached.latest;
602
609
  } catch {
603
610
  }
604
611
  try {
@@ -618,12 +625,14 @@ function createUpdater(root) {
618
625
  let installing = null;
619
626
  async function info() {
620
627
  const current = currentVersion();
621
- if (process.env.LIMNO_NO_UPDATE_CHECK) return { current, latest: null, available: false, command: null };
628
+ const installed = installedVersion(current);
629
+ const restart = newer(installed, current);
630
+ if (process.env.LIMNO_NO_UPDATE_CHECK) return { current, installed, restart, latest: null, available: false, command: null };
622
631
  const latest = await latestVersion();
623
632
  const pkgs = listedPackages(root);
624
633
  const [cmd, args] = installArgs(packageManager(root), pkgs);
625
- const available = !!latest && newer(latest, current) && pkgs.length > 0;
626
- return { current, latest, available, command: available ? `${cmd} ${args.join(" ")}` : null };
634
+ const available = !!latest && newer(latest, installed) && pkgs.length > 0;
635
+ return { current, installed, restart, latest, available, command: available ? `${cmd} ${args.join(" ")}` : null };
627
636
  }
628
637
  function install() {
629
638
  if (installing) return installing;
package/dist/index.js CHANGED
@@ -504,7 +504,7 @@ import { createRequire as createRequire2 } from "module";
504
504
  import os2 from "os";
505
505
  import path3 from "path";
506
506
  var require2 = createRequire2(import.meta.url);
507
- var DAY = 24 * 60 * 60 * 1e3;
507
+ var TTL = 60 * 60 * 1e3;
508
508
  function currentVersion() {
509
509
  try {
510
510
  return require2("../package.json").version;
@@ -512,6 +512,13 @@ function currentVersion() {
512
512
  return "0.0.0";
513
513
  }
514
514
  }
515
+ function installedVersion(fallback) {
516
+ try {
517
+ return JSON.parse(readFileSync2(require2.resolve("../package.json"), "utf8")).version;
518
+ } catch {
519
+ return fallback;
520
+ }
521
+ }
515
522
  var newer = (a, b) => {
516
523
  const pa = a.split(/[.-]/).map((n) => parseInt(n, 10) || 0);
517
524
  const pb = b.split(/[.-]/).map((n) => parseInt(n, 10) || 0);
@@ -549,7 +556,7 @@ var cacheFile = () => path3.join(os2.homedir(), ".limno", "update-check.json");
549
556
  async function latestVersion() {
550
557
  try {
551
558
  const cached = JSON.parse(readFileSync2(cacheFile(), "utf8"));
552
- if (Date.now() - cached.at < DAY) return cached.latest;
559
+ if (Date.now() - cached.at < TTL) return cached.latest;
553
560
  } catch {
554
561
  }
555
562
  try {
@@ -569,12 +576,14 @@ function createUpdater(root) {
569
576
  let installing = null;
570
577
  async function info() {
571
578
  const current = currentVersion();
572
- if (process.env.LIMNO_NO_UPDATE_CHECK) return { current, latest: null, available: false, command: null };
579
+ const installed = installedVersion(current);
580
+ const restart = newer(installed, current);
581
+ if (process.env.LIMNO_NO_UPDATE_CHECK) return { current, installed, restart, latest: null, available: false, command: null };
573
582
  const latest = await latestVersion();
574
583
  const pkgs = listedPackages(root);
575
584
  const [cmd, args] = installArgs(packageManager(root), pkgs);
576
- const available = !!latest && newer(latest, current) && pkgs.length > 0;
577
- return { current, latest, available, command: available ? `${cmd} ${args.join(" ")}` : null };
585
+ const available = !!latest && newer(latest, installed) && pkgs.length > 0;
586
+ return { current, installed, restart, latest, available, command: available ? `${cmd} ${args.join(" ")}` : null };
578
587
  }
579
588
  function install() {
580
589
  if (installing) return installing;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limno/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Limno's framework-neutral dev tooling: JSX source stamping, the change-set store and the endpoints the editor talks to.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "type": "module",
@@ -43,7 +43,7 @@
43
43
  "@babel/parser": "^7.29.0",
44
44
  "@babel/traverse": "^7.29.0",
45
45
  "@limno/mcp": "0.1.2",
46
- "@limno/overlay": "0.1.5",
46
+ "@limno/overlay": "0.1.7",
47
47
  "@limno/spec": "0.1.2",
48
48
  "launch-editor": "^2.14.1",
49
49
  "magic-string": "^0.30.17"