@driftsys/markspec 0.6.1 → 0.6.2

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.
Files changed (103) hide show
  1. package/esm/lint/mod.d.ts +2 -0
  2. package/esm/lint/mod.d.ts.map +1 -1
  3. package/esm/lint/mod.js +1 -0
  4. package/esm/lint/rules/xref.d.ts +32 -5
  5. package/esm/lint/rules/xref.d.ts.map +1 -1
  6. package/esm/lint/rules/xref.js +40 -0
  7. package/esm/lint/runner.d.ts.map +1 -1
  8. package/esm/lint/runner.js +6 -2
  9. package/esm/lint/score_text.d.ts +67 -0
  10. package/esm/lint/score_text.d.ts.map +1 -0
  11. package/esm/lint/score_text.js +74 -0
  12. package/esm/lock/compare.d.ts +34 -0
  13. package/esm/lock/compare.d.ts.map +1 -0
  14. package/esm/lock/compare.js +64 -0
  15. package/esm/lock/mod.d.ts +2 -1
  16. package/esm/lock/mod.d.ts.map +1 -1
  17. package/esm/lock/mod.js +1 -0
  18. package/esm/lock/model.d.ts +13 -0
  19. package/esm/lock/model.d.ts.map +1 -1
  20. package/esm/lock/parser.d.ts +3 -0
  21. package/esm/lock/parser.d.ts.map +1 -1
  22. package/esm/lock/parser.js +37 -1
  23. package/esm/lock/serializer.d.ts.map +1 -1
  24. package/esm/lock/serializer.js +4 -0
  25. package/esm/mod.d.ts +7 -3
  26. package/esm/mod.d.ts.map +1 -1
  27. package/esm/mod.js +6 -2
  28. package/esm/profile/display_id.d.ts +60 -0
  29. package/esm/profile/display_id.d.ts.map +1 -0
  30. package/esm/profile/display_id.js +80 -0
  31. package/esm/profile/mod.d.ts +3 -0
  32. package/esm/profile/mod.d.ts.map +1 -1
  33. package/esm/profile/mod.js +2 -0
  34. package/esm/profile/trace_targets.d.ts +43 -0
  35. package/esm/profile/trace_targets.d.ts.map +1 -0
  36. package/esm/profile/trace_targets.js +74 -0
  37. package/esm/self_upgrade/compare.d.ts +19 -0
  38. package/esm/self_upgrade/compare.d.ts.map +1 -0
  39. package/esm/self_upgrade/compare.js +35 -0
  40. package/esm/self_upgrade/manifest.d.ts +21 -0
  41. package/esm/self_upgrade/manifest.d.ts.map +1 -0
  42. package/esm/self_upgrade/manifest.js +27 -0
  43. package/esm/self_upgrade/mod.d.ts +12 -0
  44. package/esm/self_upgrade/mod.d.ts.map +1 -0
  45. package/esm/self_upgrade/mod.js +11 -0
  46. package/esm/self_upgrade/pm_detect.d.ts +27 -0
  47. package/esm/self_upgrade/pm_detect.d.ts.map +1 -0
  48. package/esm/self_upgrade/pm_detect.js +55 -0
  49. package/esm/self_upgrade/target.d.ts +25 -0
  50. package/esm/self_upgrade/target.d.ts.map +1 -0
  51. package/esm/self_upgrade/target.js +34 -0
  52. package/package.json +1 -1
  53. package/script/lint/mod.d.ts +2 -0
  54. package/script/lint/mod.d.ts.map +1 -1
  55. package/script/lint/mod.js +3 -1
  56. package/script/lint/rules/xref.d.ts +32 -5
  57. package/script/lint/rules/xref.d.ts.map +1 -1
  58. package/script/lint/rules/xref.js +42 -0
  59. package/script/lint/runner.d.ts.map +1 -1
  60. package/script/lint/runner.js +5 -1
  61. package/script/lint/score_text.d.ts +67 -0
  62. package/script/lint/score_text.d.ts.map +1 -0
  63. package/script/lint/score_text.js +77 -0
  64. package/script/lock/compare.d.ts +34 -0
  65. package/script/lock/compare.d.ts.map +1 -0
  66. package/script/lock/compare.js +67 -0
  67. package/script/lock/mod.d.ts +2 -1
  68. package/script/lock/mod.d.ts.map +1 -1
  69. package/script/lock/mod.js +3 -1
  70. package/script/lock/model.d.ts +13 -0
  71. package/script/lock/model.d.ts.map +1 -1
  72. package/script/lock/parser.d.ts +3 -0
  73. package/script/lock/parser.d.ts.map +1 -1
  74. package/script/lock/parser.js +37 -1
  75. package/script/lock/serializer.d.ts.map +1 -1
  76. package/script/lock/serializer.js +4 -0
  77. package/script/mod.d.ts +7 -3
  78. package/script/mod.d.ts.map +1 -1
  79. package/script/mod.js +82 -63
  80. package/script/profile/display_id.d.ts +60 -0
  81. package/script/profile/display_id.d.ts.map +1 -0
  82. package/script/profile/display_id.js +86 -0
  83. package/script/profile/mod.d.ts +3 -0
  84. package/script/profile/mod.d.ts.map +1 -1
  85. package/script/profile/mod.js +10 -1
  86. package/script/profile/trace_targets.d.ts +43 -0
  87. package/script/profile/trace_targets.d.ts.map +1 -0
  88. package/script/profile/trace_targets.js +79 -0
  89. package/script/self_upgrade/compare.d.ts +19 -0
  90. package/script/self_upgrade/compare.d.ts.map +1 -0
  91. package/script/self_upgrade/compare.js +38 -0
  92. package/script/self_upgrade/manifest.d.ts +21 -0
  93. package/script/self_upgrade/manifest.d.ts.map +1 -0
  94. package/script/self_upgrade/manifest.js +31 -0
  95. package/script/self_upgrade/mod.d.ts +12 -0
  96. package/script/self_upgrade/mod.d.ts.map +1 -0
  97. package/script/self_upgrade/mod.js +20 -0
  98. package/script/self_upgrade/pm_detect.d.ts +27 -0
  99. package/script/self_upgrade/pm_detect.d.ts.map +1 -0
  100. package/script/self_upgrade/pm_detect.js +58 -0
  101. package/script/self_upgrade/target.d.ts +25 -0
  102. package/script/self_upgrade/target.d.ts.map +1 -0
  103. package/script/self_upgrade/target.js +38 -0
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @module core/self_upgrade/manifest
3
+ *
4
+ * Build the release tarball + SHA-256 URLs for a (version, target) pair,
5
+ * and parse the single-line .sha256 files produced by sha256sum /
6
+ * shasum -a 256 in the release workflow. Pure — no I/O.
7
+ *
8
+ * The .sha256 line format is the standard one shared by GNU coreutils
9
+ * sha256sum and BSD/macOS shasum: `<64-hex> <basename>` with a two-space
10
+ * separator. We accept a trailing newline and lowercase the digest so
11
+ * callers can compare strings directly.
12
+ */
13
+ export interface ReleaseAssets {
14
+ readonly tarballUrl: string;
15
+ readonly checksumUrl: string;
16
+ }
17
+ /** Build the tarball + checksum URLs for a (version, target). */
18
+ export declare function releaseAssets(baseUrl: string, version: string, target: string): ReleaseAssets;
19
+ /** Parse a single sha256sum-format line; return the lowercase hex digest. */
20
+ export declare function parseSha256Line(line: string): string;
21
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAID,iEAAiE;AACjE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,aAAa,CAKf;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIpD"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/self_upgrade/manifest
4
+ *
5
+ * Build the release tarball + SHA-256 URLs for a (version, target) pair,
6
+ * and parse the single-line .sha256 files produced by sha256sum /
7
+ * shasum -a 256 in the release workflow. Pure — no I/O.
8
+ *
9
+ * The .sha256 line format is the standard one shared by GNU coreutils
10
+ * sha256sum and BSD/macOS shasum: `<64-hex> <basename>` with a two-space
11
+ * separator. We accept a trailing newline and lowercase the digest so
12
+ * callers can compare strings directly.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.releaseAssets = releaseAssets;
16
+ exports.parseSha256Line = parseSha256Line;
17
+ const SHA256_LINE_RE = /^([0-9a-fA-F]{64})\s+(\S.*?)\s*$/;
18
+ /** Build the tarball + checksum URLs for a (version, target). */
19
+ function releaseAssets(baseUrl, version, target) {
20
+ const tag = version.startsWith("v") ? version : `v${version}`;
21
+ const tarballUrl = `${baseUrl}/${tag}/markspec-${target}.tar.gz`;
22
+ const checksumUrl = `${tarballUrl}.sha256`;
23
+ return { tarballUrl, checksumUrl };
24
+ }
25
+ /** Parse a single sha256sum-format line; return the lowercase hex digest. */
26
+ function parseSha256Line(line) {
27
+ const m = SHA256_LINE_RE.exec(line);
28
+ if (!m)
29
+ throw new Error(`malformed sha256 line: ${JSON.stringify(line)}`);
30
+ return m[1].toLowerCase();
31
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module core/self_upgrade
3
+ *
4
+ * Pure helpers for `markspec self-upgrade`. No I/O — see
5
+ * `cli/self_upgrade/` and `cli/commands/self_upgrade.ts` for the
6
+ * orchestrator and helpers that wire these into HTTP + filesystem.
7
+ */
8
+ export { compareVersions, type Comparison } from "./compare.js";
9
+ export { classifyInstallPath, type ClassifyResult, type InstallSource, } from "./pm_detect.js";
10
+ export { parseSha256Line, type ReleaseAssets, releaseAssets, } from "./manifest.js";
11
+ export { type Arch, detectTarget, type Os, type Platform, platformFromBuild, type Target, } from "./target.js";
12
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,KAAK,aAAa,EAClB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,IAAI,EACT,YAAY,EACZ,KAAK,EAAE,EACP,KAAK,QAAQ,EACb,iBAAiB,EACjB,KAAK,MAAM,GACZ,MAAM,aAAa,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/self_upgrade
4
+ *
5
+ * Pure helpers for `markspec self-upgrade`. No I/O — see
6
+ * `cli/self_upgrade/` and `cli/commands/self_upgrade.ts` for the
7
+ * orchestrator and helpers that wire these into HTTP + filesystem.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.platformFromBuild = exports.detectTarget = exports.releaseAssets = exports.parseSha256Line = exports.classifyInstallPath = exports.compareVersions = void 0;
11
+ var compare_js_1 = require("./compare.js");
12
+ Object.defineProperty(exports, "compareVersions", { enumerable: true, get: function () { return compare_js_1.compareVersions; } });
13
+ var pm_detect_js_1 = require("./pm_detect.js");
14
+ Object.defineProperty(exports, "classifyInstallPath", { enumerable: true, get: function () { return pm_detect_js_1.classifyInstallPath; } });
15
+ var manifest_js_1 = require("./manifest.js");
16
+ Object.defineProperty(exports, "parseSha256Line", { enumerable: true, get: function () { return manifest_js_1.parseSha256Line; } });
17
+ Object.defineProperty(exports, "releaseAssets", { enumerable: true, get: function () { return manifest_js_1.releaseAssets; } });
18
+ var target_js_1 = require("./target.js");
19
+ Object.defineProperty(exports, "detectTarget", { enumerable: true, get: function () { return target_js_1.detectTarget; } });
20
+ Object.defineProperty(exports, "platformFromBuild", { enumerable: true, get: function () { return target_js_1.platformFromBuild; } });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @module core/self_upgrade/pm_detect
3
+ *
4
+ * Classify the realpath of the running binary into one of four
5
+ * install-source buckets so the self-upgrade orchestrator can refuse
6
+ * with a per-manager hint instead of fighting the package manager.
7
+ *
8
+ * The check is heuristic and order-sensitive — Homebrew first (because
9
+ * brew's bin paths live under /opt/homebrew or /usr/local), npm second,
10
+ * system third, user-local fourth. Anything that falls through is
11
+ * "unknown" and the orchestrator proceeds with a warning.
12
+ *
13
+ * Path matching is whole-segment (path separator on both sides) to
14
+ * avoid matching e.g. `/foo/.localfish/markspec` against the user-local
15
+ * `.local` rule.
16
+ *
17
+ * Pure — no I/O. Callers must pass the realpath (symlinks resolved) so
18
+ * brew's `/opt/homebrew/bin/markspec` -> `/opt/homebrew/Cellar/.../bin/markspec`
19
+ * is classified correctly.
20
+ */
21
+ export type InstallSource = "user-local" | "homebrew" | "npm" | "system" | "unknown";
22
+ export interface ClassifyResult {
23
+ readonly source: InstallSource;
24
+ readonly hintCommand?: string;
25
+ }
26
+ export declare function classifyInstallPath(realPath: string, home: string): ClassifyResult;
27
+ //# sourceMappingURL=pm_detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pm_detect.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/pm_detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,UAAU,GACV,KAAK,GACL,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,cAAc,CA+ChB"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/self_upgrade/pm_detect
4
+ *
5
+ * Classify the realpath of the running binary into one of four
6
+ * install-source buckets so the self-upgrade orchestrator can refuse
7
+ * with a per-manager hint instead of fighting the package manager.
8
+ *
9
+ * The check is heuristic and order-sensitive — Homebrew first (because
10
+ * brew's bin paths live under /opt/homebrew or /usr/local), npm second,
11
+ * system third, user-local fourth. Anything that falls through is
12
+ * "unknown" and the orchestrator proceeds with a warning.
13
+ *
14
+ * Path matching is whole-segment (path separator on both sides) to
15
+ * avoid matching e.g. `/foo/.localfish/markspec` against the user-local
16
+ * `.local` rule.
17
+ *
18
+ * Pure — no I/O. Callers must pass the realpath (symlinks resolved) so
19
+ * brew's `/opt/homebrew/bin/markspec` -> `/opt/homebrew/Cellar/.../bin/markspec`
20
+ * is classified correctly.
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.classifyInstallPath = classifyInstallPath;
24
+ function classifyInstallPath(realPath, home) {
25
+ // Normalise to forward slashes for matching. Windows paths use '\';
26
+ // we accept both by replacing.
27
+ const p = realPath.replace(/\\/g, "/");
28
+ const h = home.replace(/\\/g, "/");
29
+ // 1. Homebrew. The Cellar segment is the canonical real-path marker;
30
+ // /opt/homebrew/ on its own catches symlink-without-realpath.
31
+ if (p.includes("/Cellar/") ||
32
+ p.startsWith("/opt/homebrew/")) {
33
+ return { source: "homebrew", hintCommand: "brew upgrade markspec" };
34
+ }
35
+ // 2. npm. node_modules, .npm/, .nvm/.
36
+ if (p.includes("/node_modules/") ||
37
+ p.includes("/.nvm/") ||
38
+ p.includes("/.npm/")) {
39
+ return { source: "npm", hintCommand: "npm update -g markspec" };
40
+ }
41
+ // 3. user-local paths under $HOME.
42
+ if (h && p.startsWith(`${h}/`)) {
43
+ const tail = p.slice(h.length + 1);
44
+ if (tail.startsWith(".local/") ||
45
+ tail.startsWith(".cargo/bin/") ||
46
+ tail.startsWith("bin/") ||
47
+ tail.startsWith("Library/")) {
48
+ return { source: "user-local" };
49
+ }
50
+ }
51
+ // 4. system bins.
52
+ if (p.startsWith("/usr/") ||
53
+ p.startsWith("/opt/") ||
54
+ p.startsWith("/snap/")) {
55
+ return { source: "system" };
56
+ }
57
+ return { source: "unknown" };
58
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @module core/self_upgrade/target
3
+ *
4
+ * Map (os, arch) → the GitHub release target string used in tarball
5
+ * names. Targets match those produced by the Release workflow:
6
+ * x86_64-unknown-linux-gnu, x86_64-apple-darwin,
7
+ * aarch64-apple-darwin, x86_64-pc-windows-msvc.
8
+ *
9
+ * Pure functions — no I/O, no Deno.* APIs. The CLI passes
10
+ * `Deno.build.os` / `Deno.build.arch` strings to platformFromBuild;
11
+ * this module never reads them itself so tests don't need any
12
+ * environment setup.
13
+ */
14
+ export type Os = "linux" | "darwin" | "windows";
15
+ export type Arch = "x86_64" | "aarch64";
16
+ export interface Platform {
17
+ readonly os: Os;
18
+ readonly arch: Arch;
19
+ }
20
+ export type Target = "x86_64-unknown-linux-gnu" | "x86_64-apple-darwin" | "aarch64-apple-darwin" | "x86_64-pc-windows-msvc";
21
+ /** Return the release target for a platform, or undefined if not shipped. */
22
+ export declare function detectTarget(platform: Platform): Target | undefined;
23
+ /** Parse Deno.build.{os,arch} strings into a typed Platform, or undefined. */
24
+ export declare function platformFromBuild(os: string, arch: string): Platform | undefined;
25
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,EAAE,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,MAAM,GACd,0BAA0B,GAC1B,qBAAqB,GACrB,sBAAsB,GACtB,wBAAwB,CAAC;AAE7B,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAOnE;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GACX,QAAQ,GAAG,SAAS,CAKtB"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/self_upgrade/target
4
+ *
5
+ * Map (os, arch) → the GitHub release target string used in tarball
6
+ * names. Targets match those produced by the Release workflow:
7
+ * x86_64-unknown-linux-gnu, x86_64-apple-darwin,
8
+ * aarch64-apple-darwin, x86_64-pc-windows-msvc.
9
+ *
10
+ * Pure functions — no I/O, no Deno.* APIs. The CLI passes
11
+ * `Deno.build.os` / `Deno.build.arch` strings to platformFromBuild;
12
+ * this module never reads them itself so tests don't need any
13
+ * environment setup.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.detectTarget = detectTarget;
17
+ exports.platformFromBuild = platformFromBuild;
18
+ /** Return the release target for a platform, or undefined if not shipped. */
19
+ function detectTarget(platform) {
20
+ const { os, arch } = platform;
21
+ if (os === "linux" && arch === "x86_64")
22
+ return "x86_64-unknown-linux-gnu";
23
+ if (os === "darwin" && arch === "x86_64")
24
+ return "x86_64-apple-darwin";
25
+ if (os === "darwin" && arch === "aarch64")
26
+ return "aarch64-apple-darwin";
27
+ if (os === "windows" && arch === "x86_64")
28
+ return "x86_64-pc-windows-msvc";
29
+ return undefined;
30
+ }
31
+ /** Parse Deno.build.{os,arch} strings into a typed Platform, or undefined. */
32
+ function platformFromBuild(os, arch) {
33
+ const okOs = os === "linux" || os === "darwin" || os === "windows";
34
+ const okArch = arch === "x86_64" || arch === "aarch64";
35
+ if (!okOs || !okArch)
36
+ return undefined;
37
+ return { os, arch };
38
+ }