@telorun/analyzer 0.49.1 → 0.51.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/README.md +3 -1
- package/dist/cel-ast.d.ts +13 -1
- package/dist/cel-ast.d.ts.map +1 -1
- package/dist/cel-ast.js +36 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/module-version-order.d.ts +22 -0
- package/dist/module-version-order.d.ts.map +1 -1
- package/dist/module-version-order.js +35 -0
- package/dist/validate-module-artifact.js +5 -1
- package/package.json +2 -2
- package/src/cel-ast.ts +37 -7
- package/src/index.ts +2 -1
- package/src/module-version-order.ts +37 -0
- package/src/validate-module-artifact.ts +5 -1
package/README.md
CHANGED
|
@@ -48,7 +48,9 @@ See [examples/](./examples/) for a list of working applications.
|
|
|
48
48
|
|
|
49
49
|
## Status
|
|
50
50
|
|
|
51
|
-
Telo is under
|
|
51
|
+
Telo is under heavy development. While it is pre-1.0, breaking changes ship in **minor** releases — manifest shapes, kind schemas, and APIs can change between versions. Pin your imports and expect to update manifests when you upgrade. The core runtime, module system, and standard library are functional, but Telo is not yet recommended for production use.
|
|
52
|
+
|
|
53
|
+
**1.0 lands when the Rust kernel reaches feature parity with the Node.js implementation** — that is the milestone that freezes the manifest contract across runtimes.
|
|
52
54
|
|
|
53
55
|
## The Meaning of Telo
|
|
54
56
|
|
package/dist/cel-ast.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { type ASTNode as CelJsNode } from "@marcbachmann/cel-js";
|
|
2
|
+
/** A CEL body that does not parse — an author's expression, mid-typing or
|
|
3
|
+
* malformed. Owned here so a consumer can be lenient about author syntax
|
|
4
|
+
* (navigation, completion) without also swallowing a defect in the wrapper
|
|
5
|
+
* below, and so the third-party parser's error type stays internal, exactly as
|
|
6
|
+
* its AST type does. */
|
|
7
|
+
export declare class CelParseError extends Error {
|
|
8
|
+
readonly source: string;
|
|
9
|
+
readonly cause: unknown;
|
|
10
|
+
constructor(source: string, cause: unknown);
|
|
11
|
+
}
|
|
2
12
|
/** Read-only CEL expression tree owned by the analyzer. The third-party
|
|
3
13
|
* `@marcbachmann/cel-js` `ASTNode` stays an internal detail — `wrapCelAst`
|
|
4
14
|
* translates it into this union so no external AST type leaks through the
|
|
@@ -79,7 +89,9 @@ export interface CelSegment {
|
|
|
79
89
|
source: string;
|
|
80
90
|
/** True when a `${{` has no matching `}}` yet (the user is mid-typing). */
|
|
81
91
|
open: boolean;
|
|
82
|
-
/** Lazily parse + wrap; ranges are already absolute.
|
|
92
|
+
/** Lazily parse + wrap; ranges are already absolute. Throws `CelParseError`
|
|
93
|
+
* when the body doesn't parse — an `open` segment recovers to its longest
|
|
94
|
+
* parseable prefix instead, so only a closed one can throw. */
|
|
83
95
|
ast(): CelNode;
|
|
84
96
|
}
|
|
85
97
|
/** Maps a `@marcbachmann/cel-js` node into the analyzer `CelNode`, translating
|
package/dist/cel-ast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cel-ast.d.ts","sourceRoot":"","sources":["../src/cel-ast.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"cel-ast.d.ts","sourceRoot":"","sources":["../src/cel-ast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpF;;;;yBAIyB;AACzB,qBAAa,aAAc,SAAQ,KAAK;IAEpC,QAAQ,CAAC,MAAM,EAAE,MAAM;aACL,KAAK,EAAE,OAAO;gBADvB,MAAM,EAAE,MAAM,EACL,KAAK,EAAE,OAAO;CAKnC;AAaD;;;;qDAIqD;AACrD,MAAM,MAAM,OAAO,GACf;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA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+
import { ParseError, parse } from "@marcbachmann/cel-js";
|
|
2
|
+
/** A CEL body that does not parse — an author's expression, mid-typing or
|
|
3
|
+
* malformed. Owned here so a consumer can be lenient about author syntax
|
|
4
|
+
* (navigation, completion) without also swallowing a defect in the wrapper
|
|
5
|
+
* below, and so the third-party parser's error type stays internal, exactly as
|
|
6
|
+
* its AST type does. */
|
|
7
|
+
export class CelParseError extends Error {
|
|
8
|
+
source;
|
|
9
|
+
cause;
|
|
10
|
+
constructor(source, cause) {
|
|
11
|
+
super(cause instanceof Error ? cause.message : String(cause));
|
|
12
|
+
this.source = source;
|
|
13
|
+
this.cause = cause;
|
|
14
|
+
this.name = "CelParseError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Parse a CEL body, translating the parser's own failure into `CelParseError`.
|
|
18
|
+
* Anything else (a bug in `wrapCelAst`) propagates untouched. */
|
|
19
|
+
function parseCel(source) {
|
|
20
|
+
try {
|
|
21
|
+
return parse(source).ast;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
if (error instanceof ParseError)
|
|
25
|
+
throw new CelParseError(source, error);
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
2
29
|
const BINARY_OPS = new Set([
|
|
3
30
|
"!=",
|
|
4
31
|
"==",
|
|
@@ -115,10 +142,13 @@ function parseLenient(source, segmentStart, range) {
|
|
|
115
142
|
if (!trimmed)
|
|
116
143
|
break;
|
|
117
144
|
try {
|
|
118
|
-
return wrapCelAst(
|
|
145
|
+
return wrapCelAst(parseCel(trimmed), segmentStart);
|
|
119
146
|
}
|
|
120
|
-
catch {
|
|
121
|
-
//
|
|
147
|
+
catch (error) {
|
|
148
|
+
// Only a body that doesn't parse warrants the next-shorter prefix; a
|
|
149
|
+
// wrapper defect is not something a shorter prefix fixes.
|
|
150
|
+
if (!(error instanceof CelParseError))
|
|
151
|
+
throw error;
|
|
122
152
|
}
|
|
123
153
|
}
|
|
124
154
|
return { kind: "ident", range, name: source.trim() };
|
|
@@ -142,7 +172,7 @@ export function buildCelSegments(scalarText, scalarStart, tag, taggedSource) {
|
|
|
142
172
|
range,
|
|
143
173
|
source: taggedSource,
|
|
144
174
|
open: false,
|
|
145
|
-
ast: () => wrapCelAst(
|
|
175
|
+
ast: () => wrapCelAst(parseCel(taggedSource), bodyStart),
|
|
146
176
|
},
|
|
147
177
|
];
|
|
148
178
|
}
|
|
@@ -160,7 +190,7 @@ export function buildCelSegments(scalarText, scalarStart, tag, taggedSource) {
|
|
|
160
190
|
range: [scalarStart + match.index, scalarStart + match.index + whole.length],
|
|
161
191
|
source,
|
|
162
192
|
open: false,
|
|
163
|
-
ast: () => wrapCelAst(
|
|
193
|
+
ast: () => wrapCelAst(parseCel(source), bodyStart),
|
|
164
194
|
});
|
|
165
195
|
lastClosedEnd = match.index + whole.length;
|
|
166
196
|
}
|
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";
|
|
@@ -54,7 +54,7 @@ export { validateModuleArtifact } from "./validate-module-artifact.js";
|
|
|
54
54
|
export { withSyntheticPositions } from "./with-synthetic-positions.js";
|
|
55
55
|
export { documentToAst, parseToAst } from "./yaml-ast.js";
|
|
56
56
|
export type { AstDocument, AstMap, AstNode, AstPair, AstScalar, AstSeq } from "./yaml-ast.js";
|
|
57
|
-
export { buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
57
|
+
export { CelParseError, buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
58
58
|
export type { CelNode, CelSegment } from "./cel-ast.js";
|
|
59
59
|
export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity } from "./types.js";
|
|
60
60
|
export type { AnalysisDiagnostic, AnalysisOptions, LoaderInitOptions, LoadOptions, ManifestSource, Position, PositionIndex, Range } from "./types.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,MAAM,iBAAiB,CAAC;AACjE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,iCAAiC,EACjC,wBAAwB,EACxB,iBAAiB,EACjB,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,gBA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ChB,SAAS,EACT,YAAY,EACZ,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3E,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC3E,YAAY,EACR,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,aAAa,EACb,KAAK,EACR,MAAM,YAAY,CAAC"}
|
package/dist/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";
|
|
@@ -32,5 +32,5 @@ export { LayerIndexError, matchControllerLayers, parseLayerIndex, singletonLayer
|
|
|
32
32
|
export { validateModuleArtifact } from "./validate-module-artifact.js";
|
|
33
33
|
export { withSyntheticPositions } from "./with-synthetic-positions.js";
|
|
34
34
|
export { documentToAst, parseToAst } from "./yaml-ast.js";
|
|
35
|
-
export { buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
35
|
+
export { CelParseError, buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
36
36
|
export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity } from "./types.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
|
-
|
|
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.
|
|
3
|
+
"version": "0.51.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.
|
|
51
|
+
"@telorun/sdk": "0.64.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@telorun/sdk": "*"
|
package/src/cel-ast.ts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import { parse, type ASTNode as CelJsNode } from "@marcbachmann/cel-js";
|
|
1
|
+
import { ParseError, parse, type ASTNode as CelJsNode } from "@marcbachmann/cel-js";
|
|
2
|
+
|
|
3
|
+
/** A CEL body that does not parse — an author's expression, mid-typing or
|
|
4
|
+
* malformed. Owned here so a consumer can be lenient about author syntax
|
|
5
|
+
* (navigation, completion) without also swallowing a defect in the wrapper
|
|
6
|
+
* below, and so the third-party parser's error type stays internal, exactly as
|
|
7
|
+
* its AST type does. */
|
|
8
|
+
export class CelParseError extends Error {
|
|
9
|
+
constructor(
|
|
10
|
+
readonly source: string,
|
|
11
|
+
override readonly cause: unknown,
|
|
12
|
+
) {
|
|
13
|
+
super(cause instanceof Error ? cause.message : String(cause));
|
|
14
|
+
this.name = "CelParseError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Parse a CEL body, translating the parser's own failure into `CelParseError`.
|
|
19
|
+
* Anything else (a bug in `wrapCelAst`) propagates untouched. */
|
|
20
|
+
function parseCel(source: string): CelJsNode {
|
|
21
|
+
try {
|
|
22
|
+
return parse(source).ast;
|
|
23
|
+
} catch (error) {
|
|
24
|
+
if (error instanceof ParseError) throw new CelParseError(source, error);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
2
28
|
|
|
3
29
|
/** Read-only CEL expression tree owned by the analyzer. The third-party
|
|
4
30
|
* `@marcbachmann/cel-js` `ASTNode` stays an internal detail — `wrapCelAst`
|
|
@@ -57,7 +83,9 @@ export interface CelSegment {
|
|
|
57
83
|
source: string;
|
|
58
84
|
/** True when a `${{` has no matching `}}` yet (the user is mid-typing). */
|
|
59
85
|
open: boolean;
|
|
60
|
-
/** Lazily parse + wrap; ranges are already absolute.
|
|
86
|
+
/** Lazily parse + wrap; ranges are already absolute. Throws `CelParseError`
|
|
87
|
+
* when the body doesn't parse — an `open` segment recovers to its longest
|
|
88
|
+
* parseable prefix instead, so only a closed one can throw. */
|
|
61
89
|
ast(): CelNode;
|
|
62
90
|
}
|
|
63
91
|
|
|
@@ -178,9 +206,11 @@ function parseLenient(source: string, segmentStart: number, range: [number, numb
|
|
|
178
206
|
const trimmed = candidate.trim();
|
|
179
207
|
if (!trimmed) break;
|
|
180
208
|
try {
|
|
181
|
-
return wrapCelAst(
|
|
182
|
-
} catch {
|
|
183
|
-
//
|
|
209
|
+
return wrapCelAst(parseCel(trimmed), segmentStart);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
// Only a body that doesn't parse warrants the next-shorter prefix; a
|
|
212
|
+
// wrapper defect is not something a shorter prefix fixes.
|
|
213
|
+
if (!(error instanceof CelParseError)) throw error;
|
|
184
214
|
}
|
|
185
215
|
}
|
|
186
216
|
return { kind: "ident", range, name: source.trim() };
|
|
@@ -211,7 +241,7 @@ export function buildCelSegments(
|
|
|
211
241
|
range,
|
|
212
242
|
source: taggedSource,
|
|
213
243
|
open: false,
|
|
214
|
-
ast: () => wrapCelAst(
|
|
244
|
+
ast: () => wrapCelAst(parseCel(taggedSource), bodyStart),
|
|
215
245
|
},
|
|
216
246
|
];
|
|
217
247
|
}
|
|
@@ -230,7 +260,7 @@ export function buildCelSegments(
|
|
|
230
260
|
range: [scalarStart + match.index, scalarStart + match.index + whole.length],
|
|
231
261
|
source,
|
|
232
262
|
open: false,
|
|
233
|
-
ast: () => wrapCelAst(
|
|
263
|
+
ast: () => wrapCelAst(parseCel(source), bodyStart),
|
|
234
264
|
});
|
|
235
265
|
lastClosedEnd = match.index + whole.length;
|
|
236
266
|
}
|
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";
|
|
@@ -160,7 +161,7 @@ export { validateModuleArtifact } from "./validate-module-artifact.js";
|
|
|
160
161
|
export { withSyntheticPositions } from "./with-synthetic-positions.js";
|
|
161
162
|
export { documentToAst, parseToAst } from "./yaml-ast.js";
|
|
162
163
|
export type { AstDocument, AstMap, AstNode, AstPair, AstScalar, AstSeq } from "./yaml-ast.js";
|
|
163
|
-
export { buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
164
|
+
export { CelParseError, buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
164
165
|
export type { CelNode, CelSegment } from "./cel-ast.js";
|
|
165
166
|
export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity } from "./types.js";
|
|
166
167
|
export type {
|
|
@@ -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
|
-
|
|
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
|