@telorun/analyzer 0.72.0 → 0.74.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/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +76 -20
- package/dist/artifact-axes.d.ts +14 -0
- package/dist/artifact-axes.d.ts.map +1 -0
- package/dist/artifact-axes.js +12 -0
- package/dist/artifact-layer-index.d.ts +2 -2
- package/dist/artifact-layer-index.d.ts.map +1 -1
- package/dist/artifact-layer-index.js +9 -4
- package/dist/artifact-selector.d.ts +47 -21
- package/dist/artifact-selector.d.ts.map +1 -1
- package/dist/artifact-selector.js +85 -16
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +144 -113
- package/dist/call-graph.d.ts +12 -1
- package/dist/call-graph.d.ts.map +1 -1
- package/dist/call-graph.js +22 -0
- package/dist/catch-scope.js +1 -1
- package/dist/cel-scope-query.d.ts.map +1 -1
- package/dist/cel-scope-query.js +32 -11
- package/dist/cel-scope.d.ts.map +1 -1
- package/dist/cel-scope.js +1 -0
- package/dist/eval-paths.d.ts +36 -5
- package/dist/eval-paths.d.ts.map +1 -1
- package/dist/eval-paths.js +47 -6
- package/dist/extends-resolution.d.ts +12 -0
- package/dist/extends-resolution.d.ts.map +1 -1
- package/dist/extends-resolution.js +23 -0
- package/dist/forwarded-declaration.d.ts +26 -0
- package/dist/forwarded-declaration.d.ts.map +1 -0
- package/dist/forwarded-declaration.js +31 -0
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/kernel-globals.d.ts.map +1 -1
- package/dist/kernel-globals.js +21 -5
- package/dist/module-alias-scope.d.ts +11 -0
- package/dist/module-alias-scope.d.ts.map +1 -1
- package/dist/module-alias-scope.js +10 -0
- package/dist/module-file-claims.d.ts +17 -1
- package/dist/module-file-claims.d.ts.map +1 -1
- package/dist/module-file-claims.js +38 -3
- package/dist/module-named-files.d.ts +72 -0
- package/dist/module-named-files.d.ts.map +1 -0
- package/dist/module-named-files.js +115 -0
- package/dist/native-entries.d.ts +83 -0
- package/dist/native-entries.d.ts.map +1 -0
- package/dist/native-entries.js +169 -0
- package/dist/nearest-name.d.ts +22 -0
- package/dist/nearest-name.d.ts.map +1 -0
- package/dist/nearest-name.js +43 -0
- package/dist/normalize-inline-resources.d.ts +41 -13
- package/dist/normalize-inline-resources.d.ts.map +1 -1
- package/dist/normalize-inline-resources.js +236 -54
- package/dist/reference-field-map.d.ts +59 -1
- package/dist/reference-field-map.d.ts.map +1 -1
- package/dist/reference-field-map.js +200 -34
- package/dist/release/destinations.d.ts +59 -0
- package/dist/release/destinations.d.ts.map +1 -0
- package/dist/release/destinations.js +75 -0
- package/dist/release/index.d.ts +6 -2
- package/dist/release/index.d.ts.map +1 -1
- package/dist/release/index.js +3 -1
- package/dist/release/ledger.d.ts +20 -11
- package/dist/release/ledger.d.ts.map +1 -1
- package/dist/release/ledger.js +43 -14
- package/dist/release/payload-digest.d.ts +2 -1
- package/dist/release/payload-digest.d.ts.map +1 -1
- package/dist/release/payload-digest.js +2 -1
- package/dist/release/release-plan.d.ts +3 -2
- package/dist/release/release-plan.d.ts.map +1 -1
- package/dist/release/release-plan.js +12 -19
- package/dist/release/workspace-config.d.ts +114 -34
- package/dist/release/workspace-config.d.ts.map +1 -1
- package/dist/release/workspace-config.js +322 -38
- package/dist/release/workspace-schema.d.ts +41 -0
- package/dist/release/workspace-schema.d.ts.map +1 -0
- package/dist/release/workspace-schema.js +77 -0
- package/dist/resolve-ref-sentinels.d.ts.map +1 -1
- package/dist/resolve-ref-sentinels.js +8 -5
- package/dist/resolve-throws-union.d.ts +25 -4
- package/dist/resolve-throws-union.d.ts.map +1 -1
- package/dist/resolve-throws-union.js +62 -32
- package/dist/resolve-zone-requirements.d.ts.map +1 -1
- package/dist/resolve-zone-requirements.js +2 -1
- package/dist/rewrite-synthetic-origins.d.ts +6 -1
- package/dist/rewrite-synthetic-origins.d.ts.map +1 -1
- package/dist/rewrite-synthetic-origins.js +107 -13
- package/dist/schema-compat.d.ts.map +1 -1
- package/dist/schema-compat.js +18 -5
- package/dist/schema-error-report.d.ts +7 -0
- package/dist/schema-error-report.d.ts.map +1 -1
- package/dist/schema-error-report.js +9 -4
- package/dist/schema-walk.d.ts +47 -13
- package/dist/schema-walk.d.ts.map +1 -1
- package/dist/schema-walk.js +150 -30
- package/dist/scope-declarations.d.ts +59 -0
- package/dist/scope-declarations.d.ts.map +1 -0
- package/dist/scope-declarations.js +45 -0
- package/dist/source-entries.d.ts +119 -0
- package/dist/source-entries.d.ts.map +1 -0
- package/dist/source-entries.js +349 -0
- package/dist/step-bodies.d.ts +24 -0
- package/dist/step-bodies.d.ts.map +1 -0
- package/dist/step-bodies.js +28 -0
- package/dist/telo-version.d.ts +1 -1
- package/dist/telo-version.js +1 -1
- package/dist/template-body.d.ts +10 -0
- package/dist/template-body.d.ts.map +1 -1
- package/dist/template-body.js +25 -0
- package/dist/validate-cel-context.d.ts +23 -8
- package/dist/validate-cel-context.d.ts.map +1 -1
- package/dist/validate-cel-context.js +51 -18
- package/dist/validate-exports.d.ts +28 -0
- package/dist/validate-exports.d.ts.map +1 -0
- package/dist/validate-exports.js +146 -0
- package/dist/validate-extends.d.ts.map +1 -1
- package/dist/validate-extends.js +37 -1
- package/dist/validate-module-artifact.d.ts +4 -2
- package/dist/validate-module-artifact.d.ts.map +1 -1
- package/dist/validate-module-artifact.js +43 -4
- package/dist/validate-native-entries.d.ts +15 -0
- package/dist/validate-native-entries.d.ts.map +1 -0
- package/dist/validate-native-entries.js +103 -0
- package/dist/validate-observed-state.d.ts +7 -1
- package/dist/validate-observed-state.d.ts.map +1 -1
- package/dist/validate-observed-state.js +24 -6
- package/dist/validate-provider-coherence.d.ts +4 -8
- package/dist/validate-provider-coherence.d.ts.map +1 -1
- package/dist/validate-provider-coherence.js +12 -123
- package/dist/validate-reference-forms.d.ts.map +1 -1
- package/dist/validate-reference-forms.js +2 -2
- package/dist/validate-references.d.ts.map +1 -1
- package/dist/validate-references.js +152 -65
- package/dist/validate-scope-reach.d.ts +31 -0
- package/dist/validate-scope-reach.d.ts.map +1 -0
- package/dist/validate-scope-reach.js +180 -0
- package/dist/validate-source-entries.d.ts +16 -0
- package/dist/validate-source-entries.d.ts.map +1 -0
- package/dist/validate-source-entries.js +90 -0
- package/dist/validate-template-body.d.ts +36 -0
- package/dist/validate-template-body.d.ts.map +1 -0
- package/dist/validate-template-body.js +246 -0
- package/dist/validate-throws-coverage.d.ts.map +1 -1
- package/dist/validate-throws-coverage.js +21 -39
- package/dist/value-type-keyword.d.ts +22 -5
- package/dist/value-type-keyword.d.ts.map +1 -1
- package/dist/value-type-keyword.js +16 -7
- package/package.json +4 -3
- package/src/analyzer.ts +97 -20
- package/src/artifact-axes.ts +24 -0
- package/src/artifact-layer-index.ts +9 -6
- package/src/artifact-selector.ts +110 -35
- package/src/builtins.ts +160 -113
- package/src/call-graph.ts +30 -0
- package/src/catch-scope.ts +1 -1
- package/src/cel-scope-query.ts +28 -9
- package/src/cel-scope.ts +1 -0
- package/src/eval-paths.ts +53 -6
- package/src/extends-resolution.ts +24 -0
- package/src/forwarded-declaration.ts +32 -0
- package/src/index.ts +37 -1
- package/src/kernel-globals.ts +28 -5
- package/src/migrations/CLAUDE.md +35 -0
- package/src/module-alias-scope.ts +17 -0
- package/src/module-file-claims.ts +63 -4
- package/src/module-named-files.ts +162 -0
- package/src/native-entries.ts +227 -0
- package/src/nearest-name.ts +47 -0
- package/src/normalize-inline-resources.ts +326 -70
- package/src/reference-field-map.ts +257 -52
- package/src/release/CLAUDE.md +32 -0
- package/src/release/destinations.ts +105 -0
- package/src/release/index.ts +33 -2
- package/src/release/ledger.ts +51 -21
- package/src/release/payload-digest.ts +2 -1
- package/src/release/release-plan.ts +16 -26
- package/src/release/workspace-config.ts +483 -47
- package/src/release/workspace-schema.ts +99 -0
- package/src/resolve-ref-sentinels.ts +7 -6
- package/src/resolve-throws-union.ts +87 -32
- package/src/resolve-zone-requirements.ts +2 -1
- package/src/rewrite-synthetic-origins.ts +107 -16
- package/src/schema-compat.ts +18 -4
- package/src/schema-error-report.ts +16 -4
- package/src/schema-walk.ts +162 -34
- package/src/scope-declarations.ts +98 -0
- package/src/source-entries.ts +502 -0
- package/src/step-bodies.ts +55 -0
- package/src/telo-version.ts +1 -1
- package/src/template-body.ts +25 -0
- package/src/validate-cel-context.ts +60 -18
- package/src/validate-exports.ts +185 -0
- package/src/validate-extends.ts +43 -0
- package/src/validate-module-artifact.ts +46 -3
- package/src/validate-native-entries.ts +147 -0
- package/src/validate-observed-state.ts +36 -7
- package/src/validate-provider-coherence.ts +17 -127
- package/src/validate-reference-forms.ts +2 -3
- package/src/validate-references.ts +151 -66
- package/src/validate-scope-reach.ts +213 -0
- package/src/validate-source-entries.ts +120 -0
- package/src/validate-template-body.ts +274 -0
- package/src/validate-throws-coverage.ts +24 -31
- package/src/value-type-keyword.ts +35 -9
- package/dist/validate-template-dispatch.d.ts +0 -27
- package/dist/validate-template-dispatch.d.ts.map +0 -1
- package/dist/validate-template-dispatch.js +0 -95
- package/src/validate-template-dispatch.ts +0 -99
|
@@ -1,64 +1,348 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `telo-workspace.yaml` — the
|
|
2
|
+
* `telo-workspace.yaml` — the anchor.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* module).
|
|
4
|
+
* **Its location is the anchor, and every field lives in a block scoped to what
|
|
5
|
+
* it governs.** Every path the release system names — a module key, a ledger
|
|
6
|
+
* entry, a fragment's `modules:` — is relative to this file's directory, and so
|
|
7
|
+
* is the `.telo` cache. `release:` is what `telo release` reads; `env:` is what
|
|
8
|
+
* `telo run` reads when it resolves a manifest's environment.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* `.
|
|
15
|
-
* it
|
|
16
|
-
*
|
|
17
|
-
* `upgrade`, `migrate`, `module`, and not the kernel — looks for it, so a
|
|
18
|
-
* single-manifest repo, a bare `examples/` directory and a third-party module
|
|
19
|
-
* checkout keep working with nothing added. Any field added later must be true
|
|
20
|
-
* of the whole tree, not derivable from it, and harmless by its absence.
|
|
10
|
+
* That rule is why `modules:` sits under `release:` rather than at the top
|
|
11
|
+
* level. It is a release inventory, not an inventory of manifests: it exists so
|
|
12
|
+
* a whole-tree scan does not read every example and every cached
|
|
13
|
+
* `.telo/manifests` copy as something to version and publish, and nothing else
|
|
14
|
+
* consults it — the env walk refuses to, which is why a manifest under
|
|
15
|
+
* `examples/`, in no release subtree, still gets the full walk.
|
|
21
16
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
17
|
+
* The file is **optional and every block in it is optional**. A marker whose
|
|
18
|
+
* whole content is comments is valid: it anchors the cache and bounds the env
|
|
19
|
+
* walk, which is exactly what a runner seeds one for.
|
|
20
|
+
*
|
|
21
|
+
* **The reader is lenient; the diagnostics are the strict half.** It returns
|
|
22
|
+
* everything it could read plus everything it found wrong, each anchored at a
|
|
23
|
+
* key path, because an editor wants all of them and a command wants to exit on
|
|
24
|
+
* the first. Which of them are fatal is the CALLER's policy, not the file's:
|
|
25
|
+
* `telo release` refuses on any error, while `telo run` consumes `env:` alone
|
|
26
|
+
* and prints the rest — aborting every app in a workspace over a release typo is
|
|
27
|
+
* not a trade to make silently.
|
|
28
|
+
*
|
|
29
|
+
* Parsing lives here, in the browser-safe half, because the editor answers "what
|
|
30
|
+
* does changing this library bump?" from the same model. Finding the file on
|
|
31
|
+
* disk is the CLI's half — this side takes text. Gitignore matching is INJECTED
|
|
32
|
+
* (`PatternMatch`) for the same reason: the grammar belongs to the glob package,
|
|
33
|
+
* which this half does not depend on.
|
|
25
34
|
*/
|
|
26
35
|
import { parseDocument } from "yaml";
|
|
36
|
+
import { DEFAULT_ENV_FILES, DEFAULT_RELEASE_IGNORE, MODULE_ENTRY_KEYS, WORKSPACE_BLOCKS, WORKSPACE_SCHEMA, } from "./workspace-schema.js";
|
|
27
37
|
export const WORKSPACE_FILENAME = "telo-workspace.yaml";
|
|
38
|
+
export { DEFAULT_ENV_FILES, DEFAULT_RELEASE_IGNORE };
|
|
28
39
|
export class WorkspaceConfigError extends Error {
|
|
29
40
|
}
|
|
41
|
+
const EMPTY = {};
|
|
30
42
|
/**
|
|
31
|
-
*
|
|
43
|
+
* Read the marker's text.
|
|
32
44
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* module and every gate would silently pass over a whole repo.
|
|
45
|
+
* Never throws: unreadable YAML is itself a diagnostic, because the one caller
|
|
46
|
+
* that must not abort on it is the run path.
|
|
36
47
|
*/
|
|
37
|
-
export function
|
|
48
|
+
export function readWorkspaceConfig(text, where) {
|
|
49
|
+
const diagnostics = [];
|
|
50
|
+
const report = (code, message, path, severity = "error") => {
|
|
51
|
+
diagnostics.push({ code, severity, message, path });
|
|
52
|
+
};
|
|
38
53
|
let value;
|
|
39
54
|
try {
|
|
40
55
|
value = parseDocument(text).toJSON();
|
|
41
56
|
}
|
|
42
57
|
catch (err) {
|
|
43
|
-
|
|
58
|
+
report("WORKSPACE_INVALID_VALUE", `${where} is not valid YAML: ${err instanceof Error ? err.message : String(err)}`, []);
|
|
59
|
+
return { config: EMPTY, diagnostics };
|
|
44
60
|
}
|
|
45
|
-
if (value === null ||
|
|
46
|
-
|
|
61
|
+
if (value === null || value === undefined)
|
|
62
|
+
return { config: EMPTY, diagnostics };
|
|
63
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
64
|
+
report("WORKSPACE_INVALID_VALUE", `${where} must be a YAML mapping.`, []);
|
|
65
|
+
return { config: EMPTY, diagnostics };
|
|
47
66
|
}
|
|
48
67
|
const record = value;
|
|
49
68
|
for (const key of Object.keys(record)) {
|
|
50
|
-
if (key
|
|
51
|
-
|
|
52
|
-
|
|
69
|
+
if (WORKSPACE_BLOCKS.includes(key))
|
|
70
|
+
continue;
|
|
71
|
+
if (key === "modules") {
|
|
72
|
+
report("WORKSPACE_MODULES_MOVED", `${where}: 'modules' moved under 'release:'. It is release scope — where modules live, ` +
|
|
73
|
+
`for versioning and publishing — and every field of this file now sits in the block ` +
|
|
74
|
+
`that governs it. Indent this list under a 'release:' key.`, ["modules"]);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
// A near-miss of a block name is the typo whose settings would otherwise go
|
|
78
|
+
// silently unapplied; an unrecognized block is a version skew, so the next
|
|
79
|
+
// one ships without breaking today's runs.
|
|
80
|
+
const near = nearMiss(key, WORKSPACE_BLOCKS);
|
|
81
|
+
if (near) {
|
|
82
|
+
report("WORKSPACE_UNKNOWN_KEY", `${where}: unknown block '${key}'. Did you mean '${near}'?`, [key]);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
report("WORKSPACE_UNKNOWN_KEY", `${where}: unknown block '${key}', which nothing reads. This telo knows ${WORKSPACE_BLOCKS.map((b) => `'${b}'`).join(" and ")}.`, [key], "warning");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const release = readRelease(record.release, where, report);
|
|
89
|
+
const env = readEnv(record.env, where, report);
|
|
90
|
+
return {
|
|
91
|
+
config: { ...(release ? { release } : {}), ...(env ? { env } : {}) },
|
|
92
|
+
diagnostics,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function readRelease(raw, where, report) {
|
|
96
|
+
if (raw === undefined || raw === null)
|
|
97
|
+
return undefined;
|
|
98
|
+
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
99
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: 'release' must be a mapping.`, ["release"]);
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
const block = raw;
|
|
103
|
+
const read = readBlock(block, WORKSPACE_SCHEMA.release.properties, where, ["release"], report);
|
|
104
|
+
return {
|
|
105
|
+
...(read.registry !== undefined ? { registry: read.registry } : {}),
|
|
106
|
+
...(read.ignore !== undefined ? { ignore: read.ignore } : {}),
|
|
107
|
+
modules: read.modules ?? [],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Read one block against its declared shape.
|
|
112
|
+
*
|
|
113
|
+
* The declared `type` is what DISPATCHES, so a new key is one entry in the
|
|
114
|
+
* schema and no change here. Reading the key names from the data while
|
|
115
|
+
* hand-writing every type check beside it would leave the half nothing reads
|
|
116
|
+
* free to drift from the half that decides — with the data half being the one no
|
|
117
|
+
* test would catch.
|
|
118
|
+
*/
|
|
119
|
+
function readBlock(block, properties, where, at, report) {
|
|
120
|
+
reportUnknownKeys(block, properties, where, at, report);
|
|
121
|
+
const out = {};
|
|
122
|
+
for (const [name, schema] of Object.entries(properties)) {
|
|
123
|
+
const value = schema.type === "string"
|
|
124
|
+
? readString(block[name], where, [...at, name], report)
|
|
125
|
+
: schema.type === "string[]"
|
|
126
|
+
? readStringList(block[name], where, [...at, name], report)
|
|
127
|
+
: readModuleEntries(block[name], where, report);
|
|
128
|
+
if (value !== undefined)
|
|
129
|
+
out[name] = value;
|
|
130
|
+
}
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
function readModuleEntries(raw, where, report) {
|
|
134
|
+
if (raw === undefined || raw === null)
|
|
135
|
+
return [];
|
|
136
|
+
if (!Array.isArray(raw)) {
|
|
137
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: 'release.modules' must be a list of path patterns, e.g. [modules/*, apps/*].`, ["release", "modules"]);
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
if (raw.length === 0) {
|
|
141
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: 'release.modules' is empty, so no directory can ever be discovered as a module. ` +
|
|
142
|
+
`List the subtrees that hold them, e.g. [modules/*, apps/*].`, ["release", "modules"]);
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
const entries = [];
|
|
146
|
+
for (const [index, item] of raw.entries()) {
|
|
147
|
+
const at = ["release", "modules", index];
|
|
148
|
+
if (typeof item === "string") {
|
|
149
|
+
entries.push({ path: item });
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (item === null || typeof item !== "object" || Array.isArray(item)) {
|
|
153
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: 'release.modules' entry ${index} must be a pattern string, or a mapping ` +
|
|
154
|
+
`carrying 'path:' plus the keys it overrides.`, at);
|
|
155
|
+
continue;
|
|
53
156
|
}
|
|
157
|
+
const entry = item;
|
|
158
|
+
const read = readBlock(entry, MODULE_ENTRY_KEYS, where, at, report);
|
|
159
|
+
const path = read.path;
|
|
160
|
+
if (path === undefined) {
|
|
161
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: 'release.modules' entry ${index} declares no 'path:', so it matches nothing.`, at);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
entries.push({
|
|
165
|
+
path,
|
|
166
|
+
...(read.registry !== undefined ? { registry: read.registry } : {}),
|
|
167
|
+
...(read.ignore !== undefined ? { ignore: read.ignore } : {}),
|
|
168
|
+
});
|
|
54
169
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
170
|
+
return entries;
|
|
171
|
+
}
|
|
172
|
+
function readEnv(raw, where, report) {
|
|
173
|
+
if (raw === undefined || raw === null)
|
|
174
|
+
return undefined;
|
|
175
|
+
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
176
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: 'env' must be a mapping.`, ["env"]);
|
|
177
|
+
return undefined;
|
|
58
178
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
179
|
+
const block = raw;
|
|
180
|
+
const read = readBlock(block, WORKSPACE_SCHEMA.env.properties, where, ["env"], report);
|
|
181
|
+
const roots = read.roots;
|
|
182
|
+
const files = read.files;
|
|
183
|
+
if (files) {
|
|
184
|
+
for (const [index, name] of files.entries()) {
|
|
185
|
+
// A path would let one entry reach outside the bound `roots:` exists to
|
|
186
|
+
// state, so the list is filenames and the refusal is structural.
|
|
187
|
+
if (name.includes("/") || name.includes("\\") || name.includes("*")) {
|
|
188
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: 'env.files' entry '${name}' is a path or a glob. It names a file collected in ` +
|
|
189
|
+
`each directory the walk visits, so it must be a bare filename — the walk's reach is ` +
|
|
190
|
+
`'env.roots'.`, ["env", "files", index]);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
62
193
|
}
|
|
63
|
-
return {
|
|
194
|
+
return {
|
|
195
|
+
...(roots !== undefined ? { roots } : {}),
|
|
196
|
+
...(files !== undefined ? { files } : {}),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function reportUnknownKeys(block, known, where, at, report) {
|
|
200
|
+
const names = Object.keys(known);
|
|
201
|
+
for (const key of Object.keys(block)) {
|
|
202
|
+
if (names.includes(key))
|
|
203
|
+
continue;
|
|
204
|
+
const near = nearMiss(key, names);
|
|
205
|
+
report("WORKSPACE_UNKNOWN_KEY", `${where}: unknown key '${[...at, key].join(".")}'.` +
|
|
206
|
+
(near ? ` Did you mean '${near}'?` : ` Known keys: ${names.map((n) => `'${n}'`).join(", ")}.`), [...at, key]);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function readString(raw, where, at, report) {
|
|
210
|
+
if (raw === undefined || raw === null)
|
|
211
|
+
return undefined;
|
|
212
|
+
if (typeof raw !== "string") {
|
|
213
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: '${at.join(".")}' must be a string.`, at);
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
if (raw === "") {
|
|
217
|
+
// Reported rather than read as an absence: an empty value would fall
|
|
218
|
+
// through to the next rung of the cascade and publish somewhere the author
|
|
219
|
+
// did not name, which is the one thing a declared destination must not do.
|
|
220
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: '${at.join(".")}' is empty.`, at);
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
return raw;
|
|
224
|
+
}
|
|
225
|
+
function readStringList(raw, where, at, report) {
|
|
226
|
+
if (raw === undefined || raw === null)
|
|
227
|
+
return undefined;
|
|
228
|
+
if (!Array.isArray(raw)) {
|
|
229
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: '${at.join(".")}' must be a list of strings.`, at);
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
const out = [];
|
|
233
|
+
for (const [index, item] of raw.entries()) {
|
|
234
|
+
if (typeof item !== "string") {
|
|
235
|
+
report("WORKSPACE_INVALID_VALUE", `${where}: '${at.join(".")}' entry ${index} must be a string.`, [
|
|
236
|
+
...at,
|
|
237
|
+
index,
|
|
238
|
+
]);
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
out.push(item);
|
|
242
|
+
}
|
|
243
|
+
return out;
|
|
244
|
+
}
|
|
245
|
+
/** One edit apart, case-insensitively — enough to separate a typo from a key
|
|
246
|
+
* this reader is simply too old to know. */
|
|
247
|
+
function nearMiss(key, known) {
|
|
248
|
+
const lower = key.toLowerCase();
|
|
249
|
+
return known.find((name) => name !== key && editDistanceAtMostOne(lower, name.toLowerCase()));
|
|
250
|
+
}
|
|
251
|
+
function editDistanceAtMostOne(a, b) {
|
|
252
|
+
if (a === b)
|
|
253
|
+
return true;
|
|
254
|
+
if (Math.abs(a.length - b.length) > 1)
|
|
255
|
+
return false;
|
|
256
|
+
let i = 0;
|
|
257
|
+
let j = 0;
|
|
258
|
+
let edits = 0;
|
|
259
|
+
while (i < a.length && j < b.length) {
|
|
260
|
+
if (a[i] === b[j]) {
|
|
261
|
+
i++;
|
|
262
|
+
j++;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (++edits > 1)
|
|
266
|
+
return false;
|
|
267
|
+
if (a.length > b.length)
|
|
268
|
+
i++;
|
|
269
|
+
else if (a.length < b.length)
|
|
270
|
+
j++;
|
|
271
|
+
else {
|
|
272
|
+
i++;
|
|
273
|
+
j++;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return edits + (a.length - i) + (b.length - j) <= 1;
|
|
277
|
+
}
|
|
278
|
+
// ---------------------------------------------------------------------------
|
|
279
|
+
// Diagnostics as a caller's policy
|
|
280
|
+
// ---------------------------------------------------------------------------
|
|
281
|
+
/** The diagnostics anchored inside one top-level block, plus the ones anchored
|
|
282
|
+
* at the document itself (unreadable YAML, a non-mapping root) — those are
|
|
283
|
+
* every block's problem. */
|
|
284
|
+
export function diagnosticsFor(diagnostics, block) {
|
|
285
|
+
return diagnostics.filter((d) => d.path.length === 0 || d.path[0] === block);
|
|
286
|
+
}
|
|
287
|
+
export function hasError(diagnostics) {
|
|
288
|
+
return diagnostics.some((d) => d.severity === "error");
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The release settings, or a throw naming what is missing.
|
|
292
|
+
*
|
|
293
|
+
* `telo release` is the one caller for which any error is fatal, and for which
|
|
294
|
+
* an absent block is itself one: a marker with no `release:` anchors a cache and
|
|
295
|
+
* declares no release scope, which is exactly the state a runner's seeded marker
|
|
296
|
+
* is in.
|
|
297
|
+
*/
|
|
298
|
+
export function requireReleaseSettings(read, where) {
|
|
299
|
+
const first = read.diagnostics.find((d) => d.severity === "error");
|
|
300
|
+
if (first)
|
|
301
|
+
throw new WorkspaceConfigError(first.message);
|
|
302
|
+
if (!read.config.release || read.config.release.modules.length === 0) {
|
|
303
|
+
throw new WorkspaceConfigError(`${where} declares no 'release.modules', so no directory can be discovered as a module. ` +
|
|
304
|
+
`List the subtrees that hold them:\n\n release:\n modules:\n - modules/*\n - apps/*\n`);
|
|
305
|
+
}
|
|
306
|
+
return read.config.release;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Which entry claims `key`, and what it therefore settles.
|
|
310
|
+
*
|
|
311
|
+
* **The last matching entry supplies them** — the rule the list already has,
|
|
312
|
+
* since it is one gitignore-style list evaluated last-match-wins. A negation
|
|
313
|
+
* entry is an exclusion and therefore supplies nothing: a module the last match
|
|
314
|
+
* excludes is not a module of this workspace at all, which is why this returns
|
|
315
|
+
* `undefined` rather than a settings object for it.
|
|
316
|
+
*
|
|
317
|
+
* The cascade is key-wise and each key's value replaces whole, so an entry
|
|
318
|
+
* naming only `registry:` keeps the block's `ignore:`.
|
|
319
|
+
*/
|
|
320
|
+
export function settingsForModule(release, key, match) {
|
|
321
|
+
const index = decidingIndex(key, release.modules.map((entry) => entry.path), match);
|
|
322
|
+
if (index < 0)
|
|
323
|
+
return undefined;
|
|
324
|
+
const entry = release.modules[index];
|
|
325
|
+
return {
|
|
326
|
+
entry: index,
|
|
327
|
+
...(entry.registry ?? release.registry
|
|
328
|
+
? { registry: entry.registry ?? release.registry }
|
|
329
|
+
: {}),
|
|
330
|
+
ignore: entry.ignore ?? release.ignore ?? DEFAULT_RELEASE_IGNORE,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
/** Whether `path` is matched by an authored pattern list, negations honoured.
|
|
334
|
+
* `env.roots` and a resolved `ignore` list are both read through this. */
|
|
335
|
+
export function matchesPatterns(path, patterns, match) {
|
|
336
|
+
return decidingIndex(path, patterns, match) >= 0;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The index of the entry that CLAIMS `path`, or `-1`.
|
|
340
|
+
*
|
|
341
|
+
* The one place last-match-wins and the negation reading live: every pattern
|
|
342
|
+
* list in this file rests on that rule, and two derivations of it would be two
|
|
343
|
+
* answers to what a marker means.
|
|
344
|
+
*/
|
|
345
|
+
function decidingIndex(path, patterns, match) {
|
|
346
|
+
const index = match(path, patterns);
|
|
347
|
+
return index >= 0 && patterns[index].startsWith("!") ? -1 : index;
|
|
64
348
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of `telo-workspace.yaml`, declared as data.
|
|
3
|
+
*
|
|
4
|
+
* One declaration read by two consumers — the strict half that reports what a
|
|
5
|
+
* marker got wrong, and the editor's completion list. Two hand-maintained key
|
|
6
|
+
* lists drift, and the drift is silent in the worst direction: an editor
|
|
7
|
+
* offering a key the checker rejects.
|
|
8
|
+
*
|
|
9
|
+
* Written as JSON Schema because that is what the shape *is*, and because the
|
|
10
|
+
* `description` a completion item shows and the type a diagnostic names are the
|
|
11
|
+
* same two facts a schema already carries. It is not compiled by AJV — the
|
|
12
|
+
* strict half walks it, which is what lets a wrong value say `'registry' must be
|
|
13
|
+
* the publish destination base, as a string` instead of a keyword trace.
|
|
14
|
+
*/
|
|
15
|
+
export interface WorkspaceKeySchema {
|
|
16
|
+
readonly type: "string" | "string[]" | "entry[]";
|
|
17
|
+
readonly description: string;
|
|
18
|
+
/** Values worth offering at this key when nothing better is known. */
|
|
19
|
+
readonly examples?: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export interface WorkspaceBlockSchema {
|
|
22
|
+
readonly description: string;
|
|
23
|
+
readonly properties: Readonly<Record<string, WorkspaceKeySchema>>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Every block, and every key in it, is optional — a marker whose whole content
|
|
27
|
+
* is comments is valid, and is what a runner seeds for the cache anchor alone.
|
|
28
|
+
*/
|
|
29
|
+
export declare const WORKSPACE_SCHEMA: Readonly<Record<string, WorkspaceBlockSchema>>;
|
|
30
|
+
/** Keys a `release.modules` entry may carry in its object form. `path` is the
|
|
31
|
+
* pattern; the rest override the block's own keys, key-wise. */
|
|
32
|
+
export declare const MODULE_ENTRY_KEYS: Readonly<Record<string, WorkspaceKeySchema>>;
|
|
33
|
+
export declare const WORKSPACE_BLOCKS: readonly string[];
|
|
34
|
+
/** Built-in when `release.ignore` is absent. Every pattern carries `**\/` — the
|
|
35
|
+
* anchoring at a module root is the defect this replaced, so anchoring some and
|
|
36
|
+
* not others would reproduce it partially. */
|
|
37
|
+
export declare const DEFAULT_RELEASE_IGNORE: readonly string[];
|
|
38
|
+
/** Built-in when `env.files` is absent — the pair the walk hardcoded before it
|
|
39
|
+
* was authorable, in the order it applied them. */
|
|
40
|
+
export declare const DEFAULT_ENV_FILES: readonly string[];
|
|
41
|
+
//# sourceMappingURL=workspace-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-schema.d.ts","sourceRoot":"","sources":["../../src/release/workspace-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;CACnE;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAuC3E,CAAC;AAEF;iEACiE;AACjE,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAO1E,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAAkC,CAAC;AAEjF;;+CAE+C;AAC/C,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAMnD,CAAC;AAEF;oDACoD;AACpD,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAA2B,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of `telo-workspace.yaml`, declared as data.
|
|
3
|
+
*
|
|
4
|
+
* One declaration read by two consumers — the strict half that reports what a
|
|
5
|
+
* marker got wrong, and the editor's completion list. Two hand-maintained key
|
|
6
|
+
* lists drift, and the drift is silent in the worst direction: an editor
|
|
7
|
+
* offering a key the checker rejects.
|
|
8
|
+
*
|
|
9
|
+
* Written as JSON Schema because that is what the shape *is*, and because the
|
|
10
|
+
* `description` a completion item shows and the type a diagnostic names are the
|
|
11
|
+
* same two facts a schema already carries. It is not compiled by AJV — the
|
|
12
|
+
* strict half walks it, which is what lets a wrong value say `'registry' must be
|
|
13
|
+
* the publish destination base, as a string` instead of a keyword trace.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Every block, and every key in it, is optional — a marker whose whole content
|
|
17
|
+
* is comments is valid, and is what a runner seeds for the cache anchor alone.
|
|
18
|
+
*/
|
|
19
|
+
export const WORKSPACE_SCHEMA = {
|
|
20
|
+
release: {
|
|
21
|
+
description: "How `telo release` behaves: where modules are, where they publish, and which of their paths are not release-relevant.",
|
|
22
|
+
properties: {
|
|
23
|
+
registry: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Publish destination base. A module's ref is `<registry>/<its own directory name>`. Omitted: --registry, then TELO_OCI_REGISTRY, then the base each module's own ledger entry recorded.",
|
|
26
|
+
examples: ["oci://ghcr.io/telorun"],
|
|
27
|
+
},
|
|
28
|
+
ignore: {
|
|
29
|
+
type: "string[]",
|
|
30
|
+
description: "Paths under a module whose changes are not release-relevant, so no changelog fragment is asked for. Module-relative, gitignore-style. Declaring it replaces the built-in default; [] ignores nothing.",
|
|
31
|
+
examples: ["**/tests/**", "**/docs/**", "**/plans/**", "**/README.md", "**/CHANGELOG.md"],
|
|
32
|
+
},
|
|
33
|
+
modules: {
|
|
34
|
+
type: "entry[]",
|
|
35
|
+
description: "The subtrees that may hold modules — a place to look, never a module: what makes a directory a module is its telo.yaml. Workspace-relative, gitignore-style, last match wins. A bare string is an entry with no overrides.",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
env: {
|
|
40
|
+
description: "How `telo run` resolves a manifest's environment.",
|
|
41
|
+
properties: {
|
|
42
|
+
roots: {
|
|
43
|
+
type: "string[]",
|
|
44
|
+
description: "How far up the .env walk may climb. Workspace-relative, gitignore-style, matched against each ancestor directory; the nearest match stops the walk. Omitted: the walk stops at this file.",
|
|
45
|
+
},
|
|
46
|
+
files: {
|
|
47
|
+
type: "string[]",
|
|
48
|
+
description: "Which files are collected in each directory, later winning within one directory. Filenames only — a / or a glob is an error. Declaring it replaces the default; [] collects none.",
|
|
49
|
+
examples: [".env", ".env.local"],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
/** Keys a `release.modules` entry may carry in its object form. `path` is the
|
|
55
|
+
* pattern; the rest override the block's own keys, key-wise. */
|
|
56
|
+
export const MODULE_ENTRY_KEYS = {
|
|
57
|
+
path: {
|
|
58
|
+
type: "string",
|
|
59
|
+
description: "The gitignore-style pattern this entry matches modules with.",
|
|
60
|
+
},
|
|
61
|
+
registry: WORKSPACE_SCHEMA.release.properties.registry,
|
|
62
|
+
ignore: WORKSPACE_SCHEMA.release.properties.ignore,
|
|
63
|
+
};
|
|
64
|
+
export const WORKSPACE_BLOCKS = Object.keys(WORKSPACE_SCHEMA);
|
|
65
|
+
/** Built-in when `release.ignore` is absent. Every pattern carries `**\/` — the
|
|
66
|
+
* anchoring at a module root is the defect this replaced, so anchoring some and
|
|
67
|
+
* not others would reproduce it partially. */
|
|
68
|
+
export const DEFAULT_RELEASE_IGNORE = [
|
|
69
|
+
"**/tests/**",
|
|
70
|
+
"**/docs/**",
|
|
71
|
+
"**/plans/**",
|
|
72
|
+
"**/README.md",
|
|
73
|
+
"**/CHANGELOG.md",
|
|
74
|
+
];
|
|
75
|
+
/** Built-in when `env.files` is absent — the pair the walk hardcoded before it
|
|
76
|
+
* was authorable, in the order it applied them. */
|
|
77
|
+
export const DEFAULT_ENV_FILES = [".env", ".env.local"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-ref-sentinels.d.ts","sourceRoot":"","sources":["../src/resolve-ref-sentinels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve-ref-sentinels.d.ts","sourceRoot":"","sources":["../src/resolve-ref-sentinels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAIlC;+CAC+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,GACvD,iBAAiB,GAAG,SAAS,CAAC;CAClC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,aAAa,EACvB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAK5C,kBAAkB,GAAE,gBAAgB,EAAO;AAC3C;;+CAE+C;AAC/C,IAAI,CAAC,EAAE,mBAAmB,GACzB,IAAI,CAyIN"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isRefSentinel, isTaggedSentinel } from "@telorun/templating";
|
|
2
2
|
import { isScopeEntry, resolveFieldEntries, } from "./reference-field-map.js";
|
|
3
3
|
import { REF_RESOLUTION_SKIP_KINDS as SYSTEM_KINDS } from "./system-kinds.js";
|
|
4
|
+
import { isForwardedDeclaration, isForwardedExport } from "./forwarded-declaration.js";
|
|
4
5
|
/**
|
|
5
6
|
* Rewrites every `!ref <name>` sentinel in each non-system resource's value tree
|
|
6
7
|
* to `{kind, name}` (local) or `{kind, name, alias}` (cross-module), in place.
|
|
@@ -48,9 +49,10 @@ crossModuleTargets = [],
|
|
|
48
49
|
* it shadows — so both call sites pass it. */
|
|
49
50
|
defs) {
|
|
50
51
|
const moduleOf = (r) => r.metadata?.module;
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
|
|
52
|
+
// A dependency's code — a forwarded export, or what extraction pulled out of one — is
|
|
53
|
+
// never walked as a local ref source here and never a local name; only an EXPORT is a
|
|
54
|
+
// cross-module resolution target.
|
|
55
|
+
const isForeign = isForwardedDeclaration;
|
|
54
56
|
// Local resources resolve a bare / `Self.`-qualified name; forwarded foreign exports
|
|
55
57
|
// resolve an `Alias.`-qualified name keyed by (module, name).
|
|
56
58
|
const byName = new Map();
|
|
@@ -60,14 +62,15 @@ defs) {
|
|
|
60
62
|
continue;
|
|
61
63
|
const name = r.metadata.name;
|
|
62
64
|
if (isForeign(r)) {
|
|
63
|
-
|
|
65
|
+
if (isForwardedExport(r))
|
|
66
|
+
byModuleName.set(`${moduleOf(r)}\0${name}`, r);
|
|
64
67
|
}
|
|
65
68
|
else {
|
|
66
69
|
byName.set(name, r);
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
for (const r of crossModuleTargets) {
|
|
70
|
-
if (!r.metadata?.name || SYSTEM_KINDS.has(r.kind) || !
|
|
73
|
+
if (!r.metadata?.name || SYSTEM_KINDS.has(r.kind) || !isForwardedExport(r))
|
|
71
74
|
continue;
|
|
72
75
|
byModuleName.set(`${moduleOf(r)}\0${r.metadata.name}`, r);
|
|
73
76
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ResourceDefinition, ResourceManifest } from "@telorun/sdk";
|
|
2
2
|
import { type AliasResolver } from "./alias-resolver.js";
|
|
3
3
|
import type { DefinitionRegistry } from "./definition-registry.js";
|
|
4
|
+
import { type RefSlot, type RefUse } from "./ref-slot.js";
|
|
4
5
|
export interface ThrowsCodeMeta {
|
|
5
6
|
data?: Record<string, any>;
|
|
6
7
|
}
|
|
@@ -56,11 +57,31 @@ export interface ResolveCtx {
|
|
|
56
57
|
}
|
|
57
58
|
export declare function createResolveCtx(allManifests: ResourceManifest[], defs: DefinitionRegistry, aliases: AliasResolver, aliasesByModule?: Map<string, AliasResolver>, rootModules?: Set<string>, moduleManifests?: Map<string, ResourceManifest[]>): ResolveCtx;
|
|
58
59
|
/** Resolve the effective throw union for a named manifest. The result combines
|
|
59
|
-
* explicit `throws.codes`, `throws.inherit: true` dataflow (step
|
|
60
|
-
*
|
|
61
|
-
* unresolvable passthrough call sites. Cycles
|
|
62
|
-
* result so resolution always terminates. */
|
|
60
|
+
* explicit `throws.codes`, `throws.inherit: true` dataflow (step bodies with
|
|
61
|
+
* try/catch subtraction, plus reference slots that hand a failure back), and
|
|
62
|
+
* unbounded markers for unresolvable passthrough call sites. Cycles
|
|
63
|
+
* short-circuit to an empty result so resolution always terminates. */
|
|
63
64
|
export declare function resolveThrowsUnion(manifest: ResourceManifest, ctx: ResolveCtx): ThrowsUnion;
|
|
65
|
+
/**
|
|
66
|
+
* True for a use through which a target's failure reaches the declaring
|
|
67
|
+
* resource's CALLER: `call` returns into my invocation, and `trigger.consumer`
|
|
68
|
+
* rejects the value my caller drains. `detached` and `trigger.inbound` run where
|
|
69
|
+
* no caller of mine awaits them; `dependency` and `schema` dispatch nothing.
|
|
70
|
+
*
|
|
71
|
+
* The reduction `inherit` is read through — by the resolver and by the check
|
|
72
|
+
* that a definition declaring it has something to inherit from.
|
|
73
|
+
*/
|
|
74
|
+
export declare function handsFailureBack(use: RefUse): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The uses a throws consumer reads off a slot. A slot that declares no use —
|
|
77
|
+
* the legacy bare-string form — reads as `call`: the throws union must assume
|
|
78
|
+
* `call` to keep an error path, the direction the call graph takes for the same
|
|
79
|
+
* slot. The zone projection reads it the opposite way, deliberately.
|
|
80
|
+
*
|
|
81
|
+
* `uses` defaults to every use the slot can take; a consumer that resolved the
|
|
82
|
+
* slot's case map for one instance passes that answer instead.
|
|
83
|
+
*/
|
|
84
|
+
export declare function throwsUses(slot: RefSlot, uses?: readonly RefUse[]): readonly RefUse[];
|
|
64
85
|
/**
|
|
65
86
|
* The union a SCOPE-LEVEL `catches:` list can be asked to render — everything
|
|
66
87
|
* the resource it is written on drives, transitively.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-throws-union.d.ts","sourceRoot":"","sources":["../src/resolve-throws-union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve-throws-union.d.ts","sourceRoot":"","sources":["../src/resolve-throws-union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,MAAM,EACZ,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED;;gFAEgF;AAChF,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACnC;;;8EAG0E;IAC1E,SAAS,EAAE,OAAO,CAAC;IACnB;;;;gDAI4C;IAC5C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,aAAa,CAAC;IACvB;;;wFAGoF;IACpF,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC5C,0FAA0F;IAC1F,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB;;;;;;;;;;;;;OAaG;IACH,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;IACjD;uEACmE;IACnE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,gBAAgB,EAAE,EAChC,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,aAAa,EACtB,eAAe,GAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAa,EACvD,WAAW,GAAE,GAAG,CAAC,MAAM,CAAa,EACpC,eAAe,GAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAa,GAC3D,UAAU,CAWZ;AA2HD;;;;wEAIwE;AACxE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,gBAAgB,EAC1B,GAAG,EAAE,UAAU,GACd,WAAW,CAiDb;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,OAAO,EACb,IAAI,GAAE,SAAS,MAAM,EAAuB,GAC3C,SAAS,MAAM,EAAE,CAEnB;AAuCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,EAC9B,GAAG,EAAE,UAAU,EACf,IAAI,GAAE,GAAG,CAAC,gBAAgB,CAAa,GACtC,WAAW,CAkCb;AAiND;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,OAAO,EACjB,GAAG,EAAE,UAAU,EACf,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,gBAAgB,GAAG,SAAS,CAsB9B"}
|