@telorun/analyzer 0.49.1 → 0.50.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/index.d.ts CHANGED
@@ -26,7 +26,7 @@ export { parseLoadedFile } from "./parse-loaded-file.js";
26
26
  export type { ParseOptions } from "./parse-loaded-file.js";
27
27
  export { desugarLoadedFile, inlineImportManifests } from "./inline-imports.js";
28
28
  export type { SyntheticImport } from "./inline-imports.js";
29
- export { compareModuleVersions, compareParsedModuleVersions, isNewerModuleVersion, isSameModuleVersion, parseModuleVersion, } from "./module-version-order.js";
29
+ export { compareModuleVersions, compareParsedModuleVersions, isNewerModuleVersion, isSameModuleVersion, newestModuleVersion, parseModuleVersion, } from "./module-version-order.js";
30
30
  export type { ParsedModuleVersion } from "./module-version-order.js";
31
31
  export { reconcileModuleVersions } from "./reconcile-module-versions.js";
32
32
  export type { VersionReconciliation } from "./reconcile-module-versions.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,YAAY,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,gCAAgC,EAChC,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE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index.js CHANGED
@@ -14,7 +14,7 @@ export { Loader } from "./manifest-loader.js";
14
14
  export { isModuleKind, MODULE_KINDS } from "./module-kinds.js";
15
15
  export { parseLoadedFile } from "./parse-loaded-file.js";
16
16
  export { desugarLoadedFile, inlineImportManifests } from "./inline-imports.js";
17
- export { compareModuleVersions, compareParsedModuleVersions, isNewerModuleVersion, isSameModuleVersion, parseModuleVersion, } from "./module-version-order.js";
17
+ export { compareModuleVersions, compareParsedModuleVersions, isNewerModuleVersion, isSameModuleVersion, newestModuleVersion, parseModuleVersion, } from "./module-version-order.js";
18
18
  export { reconcileModuleVersions } from "./reconcile-module-versions.js";
19
19
  export { residualEntrySchema, residualEntrySchemaMap } from "./residual-schema.js";
20
20
  export { buildDocumentPositions, buildLineOffsets, buildPositionIndex, documentLineOffsets, offsetToPosition, } from "./position-metadata.js";
@@ -33,4 +33,26 @@ export declare function isNewerModuleVersion(candidate: string, current: string)
33
33
  * side. Falls back to exact equality for unparseable tags, so a digest still
34
34
  * matches itself. */
35
35
  export declare function isSameModuleVersion(a: string, b: string): boolean;
36
+ /** The highest-precedence version in `versions`, or `undefined` when none is
37
+ * eligible — the counterpart to {@link isNewerModuleVersion}, and the answer to
38
+ * "what would this import be upgraded TO".
39
+ *
40
+ * Both halves of an upgrade check have to come from the same rule. A host that
41
+ * decides "behind" here but reads "latest" off the head of a version list is
42
+ * answering with whatever order its index happened to return: for a module
43
+ * whose newest tag is a prerelease, list-order says the import is behind and
44
+ * this says it is current — the same manifest against the same index, two
45
+ * answers.
46
+ *
47
+ * Unparseable tags (an OCI digest, a moving `latest`) are dropped rather than
48
+ * ordered, matching this module's refusal to guess elsewhere: keeping one as
49
+ * the running maximum would silence every comparable candidate after it.
50
+ *
51
+ * Prereleases are excluded unless `includePrerelease` — an upgrade offered
52
+ * without being asked for must not walk a caller onto an `-rc` build. A
53
+ * release still outranks a prerelease pin, so `1.0.0-rc.1` → `1.0.0` is found
54
+ * either way. */
55
+ export declare function newestModuleVersion(versions: readonly string[], options?: {
56
+ includePrerelease?: boolean;
57
+ }): string | undefined;
36
58
  //# sourceMappingURL=module-version-order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-version-order.d.ts","sourceRoot":"","sources":["../src/module-version-order.ts"],"names":[],"mappings":"AAAA;;;;;;;kDAOkD;AAElD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CACtB;AAED;;wBAEwB;AACxB,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,mBAAmB,GAAG,IAAI,CAatF;AAED;;iEAEiE;AACjE,wBAAgB,2BAA2B,CACzC,CAAC,EAAE,mBAAmB,EACtB,CAAC,EAAE,mBAAmB,GACrB,MAAM,CAyBR;AAED;+EAC+E;AAC/E,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKzE;AAED;;;+EAG+E;AAC/E,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhF;AAED;;sBAEsB;AACtB,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAEjE"}
1
+ {"version":3,"file":"module-version-order.d.ts","sourceRoot":"","sources":["../src/module-version-order.ts"],"names":[],"mappings":"AAAA;;;;;;;kDAOkD;AAElD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CACtB;AAED;;wBAEwB;AACxB,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,mBAAmB,GAAG,IAAI,CAatF;AAED;;iEAEiE;AACjE,wBAAgB,2BAA2B,CACzC,CAAC,EAAE,mBAAmB,EACtB,CAAC,EAAE,mBAAmB,GACrB,MAAM,CAyBR;AAED;+EAC+E;AAC/E,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKzE;AAED;;;+EAG+E;AAC/E,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhF;AAED;;sBAEsB;AACtB,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED;;;;;;;;;;;;;;;;;;kBAkBkB;AAClB,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,GAAE;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5C,MAAM,GAAG,SAAS,CAapB"}
@@ -89,3 +89,38 @@ export function isNewerModuleVersion(candidate, current) {
89
89
  export function isSameModuleVersion(a, b) {
90
90
  return a === b || compareModuleVersions(a, b) === 0;
91
91
  }
92
+ /** The highest-precedence version in `versions`, or `undefined` when none is
93
+ * eligible — the counterpart to {@link isNewerModuleVersion}, and the answer to
94
+ * "what would this import be upgraded TO".
95
+ *
96
+ * Both halves of an upgrade check have to come from the same rule. A host that
97
+ * decides "behind" here but reads "latest" off the head of a version list is
98
+ * answering with whatever order its index happened to return: for a module
99
+ * whose newest tag is a prerelease, list-order says the import is behind and
100
+ * this says it is current — the same manifest against the same index, two
101
+ * answers.
102
+ *
103
+ * Unparseable tags (an OCI digest, a moving `latest`) are dropped rather than
104
+ * ordered, matching this module's refusal to guess elsewhere: keeping one as
105
+ * the running maximum would silence every comparable candidate after it.
106
+ *
107
+ * Prereleases are excluded unless `includePrerelease` — an upgrade offered
108
+ * without being asked for must not walk a caller onto an `-rc` build. A
109
+ * release still outranks a prerelease pin, so `1.0.0-rc.1` → `1.0.0` is found
110
+ * either way. */
111
+ export function newestModuleVersion(versions, options = {}) {
112
+ let best;
113
+ let bestParsed;
114
+ for (const version of versions) {
115
+ const parsed = parseModuleVersion(version);
116
+ if (parsed === null)
117
+ continue;
118
+ if (parsed.pre !== null && !options.includePrerelease)
119
+ continue;
120
+ if (bestParsed === undefined || compareParsedModuleVersions(parsed, bestParsed) > 0) {
121
+ best = version;
122
+ bestParsed = parsed;
123
+ }
124
+ }
125
+ return best;
126
+ }
@@ -33,7 +33,11 @@ export function validateModuleArtifact(manifests) {
33
33
  }
34
34
  return out;
35
35
  }
36
- const KNOWN_QUALIFIERS = new Set(["path", "siblings", ...PLATFORM_AXES]);
36
+ /** `local_path` names the source `path=` was built from, so a working copy runs
37
+ * with no build step. It is inert in a published artifact — which ships no
38
+ * `src/` — and contributes nothing to the selector, so it never affects which
39
+ * layer a host fetches. */
40
+ const KNOWN_QUALIFIERS = new Set(["path", "local_path", "siblings", ...PLATFORM_AXES]);
37
41
  /** `pkg:telo/local/<format>?…` — the bundled-controller delivery mode. Parsed by
38
42
  * hand rather than with a PURL library: the analyzer must stay browser-safe and
39
43
  * dependency-light, and the only thing needed here is the qualifier map. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/analyzer",
3
- "version": "0.49.1",
3
+ "version": "0.50.0",
4
4
  "description": "Telo Analyzer - Static manifest validator for Telo manifests.",
5
5
  "keywords": [
6
6
  "telo",
@@ -48,7 +48,7 @@
48
48
  "@types/node": "^20.0.0",
49
49
  "typescript": "^5.0.0",
50
50
  "vitest": "^2.1.8",
51
- "@telorun/sdk": "0.62.0"
51
+ "@telorun/sdk": "0.63.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@telorun/sdk": "*"
package/src/index.ts CHANGED
@@ -90,6 +90,7 @@ export {
90
90
  compareParsedModuleVersions,
91
91
  isNewerModuleVersion,
92
92
  isSameModuleVersion,
93
+ newestModuleVersion,
93
94
  parseModuleVersion,
94
95
  } from "./module-version-order.js";
95
96
  export type { ParsedModuleVersion } from "./module-version-order.js";
@@ -89,3 +89,40 @@ export function isNewerModuleVersion(candidate: string, current: string): boolea
89
89
  export function isSameModuleVersion(a: string, b: string): boolean {
90
90
  return a === b || compareModuleVersions(a, b) === 0;
91
91
  }
92
+
93
+ /** The highest-precedence version in `versions`, or `undefined` when none is
94
+ * eligible — the counterpart to {@link isNewerModuleVersion}, and the answer to
95
+ * "what would this import be upgraded TO".
96
+ *
97
+ * Both halves of an upgrade check have to come from the same rule. A host that
98
+ * decides "behind" here but reads "latest" off the head of a version list is
99
+ * answering with whatever order its index happened to return: for a module
100
+ * whose newest tag is a prerelease, list-order says the import is behind and
101
+ * this says it is current — the same manifest against the same index, two
102
+ * answers.
103
+ *
104
+ * Unparseable tags (an OCI digest, a moving `latest`) are dropped rather than
105
+ * ordered, matching this module's refusal to guess elsewhere: keeping one as
106
+ * the running maximum would silence every comparable candidate after it.
107
+ *
108
+ * Prereleases are excluded unless `includePrerelease` — an upgrade offered
109
+ * without being asked for must not walk a caller onto an `-rc` build. A
110
+ * release still outranks a prerelease pin, so `1.0.0-rc.1` → `1.0.0` is found
111
+ * either way. */
112
+ export function newestModuleVersion(
113
+ versions: readonly string[],
114
+ options: { includePrerelease?: boolean } = {},
115
+ ): string | undefined {
116
+ let best: string | undefined;
117
+ let bestParsed: ParsedModuleVersion | undefined;
118
+ for (const version of versions) {
119
+ const parsed = parseModuleVersion(version);
120
+ if (parsed === null) continue;
121
+ if (parsed.pre !== null && !options.includePrerelease) continue;
122
+ if (bestParsed === undefined || compareParsedModuleVersions(parsed, bestParsed) > 0) {
123
+ best = version;
124
+ bestParsed = parsed;
125
+ }
126
+ }
127
+ return best;
128
+ }
@@ -42,7 +42,11 @@ export function validateModuleArtifact(manifests: ResourceManifest[]): AnalysisD
42
42
  return out;
43
43
  }
44
44
 
45
- const KNOWN_QUALIFIERS = new Set<string>(["path", "siblings", ...PLATFORM_AXES]);
45
+ /** `local_path` names the source `path=` was built from, so a working copy runs
46
+ * with no build step. It is inert in a published artifact — which ships no
47
+ * `src/` — and contributes nothing to the selector, so it never affects which
48
+ * layer a host fetches. */
49
+ const KNOWN_QUALIFIERS = new Set<string>(["path", "local_path", "siblings", ...PLATFORM_AXES]);
46
50
 
47
51
  /** `pkg:telo/local/<format>?…` — the bundled-controller delivery mode. Parsed by
48
52
  * hand rather than with a PURL library: the analyzer must stay browser-safe and