@telorun/cli 0.88.0 → 0.90.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/bundle/built-layers.d.ts +36 -0
- package/dist/bundle/built-layers.d.ts.map +1 -0
- package/dist/bundle/built-layers.js +84 -0
- package/dist/bundle/built-layers.js.map +1 -0
- package/dist/bundle/module-payload.d.ts +30 -15
- package/dist/bundle/module-payload.d.ts.map +1 -1
- package/dist/bundle/module-payload.js +118 -21
- package/dist/bundle/module-payload.js.map +1 -1
- package/dist/bundle/partition-layers.d.ts +13 -6
- package/dist/bundle/partition-layers.d.ts.map +1 -1
- package/dist/bundle/partition-layers.js +49 -7
- package/dist/bundle/partition-layers.js.map +1 -1
- package/dist/bundle/payload-drift.d.ts +1 -1
- package/dist/bundle/payload-drift.d.ts.map +1 -1
- package/dist/bundle/select-files.d.ts +11 -2
- package/dist/bundle/select-files.d.ts.map +1 -1
- package/dist/bundle/select-files.js +23 -8
- package/dist/bundle/select-files.js.map +1 -1
- package/dist/bundle/staged-files.d.ts +43 -0
- package/dist/bundle/staged-files.d.ts.map +1 -0
- package/dist/bundle/staged-files.js +158 -0
- package/dist/bundle/staged-files.js.map +1 -0
- package/dist/bundle/warm-layers.d.ts +11 -6
- package/dist/bundle/warm-layers.d.ts.map +1 -1
- package/dist/bundle/warm-layers.js +26 -10
- package/dist/bundle/warm-layers.js.map +1 -1
- package/dist/commands/install.d.ts +1 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +7 -1
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/module.d.ts.map +1 -1
- package/dist/commands/module.js +21 -7
- package/dist/commands/module.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +5 -1
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/release.d.ts +8 -6
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +168 -69
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +14 -6
- package/dist/commands/run.js.map +1 -1
- package/dist/controller-runtime.d.ts +25 -3
- package/dist/controller-runtime.d.ts.map +1 -1
- package/dist/controller-runtime.js +39 -9
- package/dist/controller-runtime.js.map +1 -1
- package/dist/env-files.d.ts +23 -8
- package/dist/env-files.d.ts.map +1 -1
- package/dist/env-files.js +77 -17
- package/dist/env-files.js.map +1 -1
- package/dist/release/apply-plan.d.ts +2 -1
- package/dist/release/apply-plan.d.ts.map +1 -1
- package/dist/release/apply-plan.js +8 -4
- package/dist/release/apply-plan.js.map +1 -1
- package/dist/release/cargo-toml.d.ts +17 -0
- package/dist/release/cargo-toml.d.ts.map +1 -0
- package/dist/release/cargo-toml.js +253 -0
- package/dist/release/cargo-toml.js.map +1 -0
- package/dist/release/crate-inputs.d.ts +41 -0
- package/dist/release/crate-inputs.d.ts.map +1 -0
- package/dist/release/crate-inputs.js +407 -0
- package/dist/release/crate-inputs.js.map +1 -0
- package/dist/release/evidence.d.ts +13 -17
- package/dist/release/evidence.d.ts.map +1 -1
- package/dist/release/evidence.js +26 -30
- package/dist/release/evidence.js.map +1 -1
- package/dist/release/stage.d.ts +61 -0
- package/dist/release/stage.d.ts.map +1 -0
- package/dist/release/stage.js +506 -0
- package/dist/release/stage.js.map +1 -0
- package/dist/release/targets.d.ts +60 -0
- package/dist/release/targets.d.ts.map +1 -0
- package/dist/release/targets.js +94 -0
- package/dist/release/targets.js.map +1 -0
- package/dist/release/workspace.d.ts +17 -5
- package/dist/release/workspace.d.ts.map +1 -1
- package/dist/release/workspace.js +89 -13
- package/dist/release/workspace.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NativeEntry } from "@telorun/analyzer";
|
|
1
2
|
/** A kernel that can host a controller candidate.
|
|
2
3
|
*
|
|
3
4
|
* Telo is polyglot: one manifest is loaded by different kernels, and a given
|
|
@@ -11,8 +12,8 @@
|
|
|
11
12
|
* learn that this filter wants something else. */
|
|
12
13
|
export type Runtime = "nodejs" | "rust";
|
|
13
14
|
/** The language a controller is written in, where the PURL actually determines
|
|
14
|
-
* it. A bundled `napi` / `wasm` artifact does not: a `.node` file may
|
|
15
|
-
* C++ or Zig, so those contribute no language rather than a guess. */
|
|
15
|
+
* it. A bundled `napi` / `dylib` / `wasm` artifact does not: a `.node` file may
|
|
16
|
+
* be Rust, C++ or Zig, so those contribute no language rather than a guess. */
|
|
16
17
|
export type Language = "javascript" | "rust";
|
|
17
18
|
export interface KindRuntimeSupport {
|
|
18
19
|
/** Kernels that can load this kind. Empty when it is `portable`, and also when
|
|
@@ -33,13 +34,34 @@ export interface KindRuntimeEntry extends KindRuntimeSupport {
|
|
|
33
34
|
/** Per-kernel coverage across a module's kinds. A kernel that hosts none of them
|
|
34
35
|
* is absent rather than `"none"`, so the map lists only what actually runs. */
|
|
35
36
|
export type RuntimeCoverage = Partial<Record<Runtime, "full" | "partial">>;
|
|
37
|
+
/** A platform tuple a module's `native:` entries cover. */
|
|
38
|
+
export interface NativePlatform {
|
|
39
|
+
os: string;
|
|
40
|
+
arch: string;
|
|
41
|
+
libc?: string;
|
|
42
|
+
}
|
|
43
|
+
/** What a module's `native:` entries cover. Per module, because no kind declares
|
|
44
|
+
* which native file it uses — and a module that needs a native file loads
|
|
45
|
+
* nowhere else, whatever its kinds' controllers say. */
|
|
46
|
+
export interface NativeReach {
|
|
47
|
+
/** Distinct `os`/`arch`/`libc` tuples, sorted. */
|
|
48
|
+
platforms: NativePlatform[];
|
|
49
|
+
/** Distinct `abi` values, sorted; an entry stating none (an N-API addon)
|
|
50
|
+
* contributes nothing, since it matches every ABI. */
|
|
51
|
+
abis: string[];
|
|
52
|
+
}
|
|
36
53
|
export interface ModuleRuntimeReport {
|
|
37
54
|
kinds: KindRuntimeEntry[];
|
|
38
55
|
languages: Language[];
|
|
39
56
|
runtimes: RuntimeCoverage;
|
|
40
57
|
/** Every kind is portable — the module carries no controller code at all. */
|
|
41
58
|
portable: boolean;
|
|
59
|
+
/** Present only for a module declaring `native:` entries. */
|
|
60
|
+
native?: NativeReach;
|
|
42
61
|
}
|
|
62
|
+
/** The platforms and ABIs a module's `native:` entries cover, or `undefined`
|
|
63
|
+
* for a module declaring none. */
|
|
64
|
+
export declare function nativeReach(entries: readonly NativeEntry[]): NativeReach | undefined;
|
|
43
65
|
/** Roll per-kind support up to the module.
|
|
44
66
|
*
|
|
45
67
|
* A boolean would lie: `std/console` ships Rust controllers for two of its four
|
|
@@ -47,5 +69,5 @@ export interface ModuleRuntimeReport {
|
|
|
47
69
|
* supported everywhere, which is what keeps a "runs on rust" filter honest for
|
|
48
70
|
* a module that mixes portable and JS-only kinds. The rollup is recomputed on
|
|
49
71
|
* every re-ingest, so it self-heals when the kernel set changes. */
|
|
50
|
-
export declare function moduleRuntimeReport(kinds: KindRuntimeEntry[]): ModuleRuntimeReport;
|
|
72
|
+
export declare function moduleRuntimeReport(kinds: KindRuntimeEntry[], native?: NativeReach): ModuleRuntimeReport;
|
|
51
73
|
//# sourceMappingURL=controller-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller-runtime.d.ts","sourceRoot":"","sources":["../src/controller-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controller-runtime.d.ts","sourceRoot":"","sources":["../src/controller-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;;;;;;;mDAUmD;AACnD,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAIxC;;gFAEgF;AAChF,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;AAsD7C,MAAM,WAAW,kBAAkB;IACjC;kFAC8E;IAC9E,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB;;yDAEqD;IACrD,QAAQ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API addon the Node
|
|
4
|
+
* kernel loads; `dylib` is a library over the Rust controller ABI, which only
|
|
5
|
+
* the Rust kernel opens. */
|
|
6
|
+
const BUNDLE_FORMAT_RUNTIMES = {
|
|
7
|
+
js: { runtime: "nodejs", language: "javascript" },
|
|
8
|
+
napi: { runtime: "nodejs", language: null },
|
|
9
|
+
dylib: { runtime: "rust", language: null },
|
|
10
|
+
};
|
|
3
11
|
/** How one `controllers:` candidate maps onto kernels, or `null` when no kernel
|
|
4
12
|
* hosts it today (an unparseable PURL, a non-`local` `pkg:telo` namespace, or a
|
|
5
13
|
* bundle format both kernels report as env-missing).
|
|
@@ -7,10 +15,10 @@ const KNOWN_RUNTIMES = ["nodejs", "rust"];
|
|
|
7
15
|
* This mirrors what the loaders actually dispatch on. Sources of truth, both of
|
|
8
16
|
* which must move together with this function:
|
|
9
17
|
* - Node: `dispatchResolveOne` in `kernel/nodejs/src/controller-loader.ts`
|
|
10
|
-
* (PURL type → loader) and
|
|
18
|
+
* (PURL type → loader) and `NODE_HOSTED_FORMATS` in
|
|
11
19
|
* `controller-loaders/bundle-loader.ts` (hostable bundle formats).
|
|
12
20
|
* - Rust: `dispatch_one` in `kernel/rust/src/controller_loader.rs`
|
|
13
|
-
* (`pkg:cargo
|
|
21
|
+
* (`pkg:cargo`, and the `dylib` bundle format).
|
|
14
22
|
* The Rust half cannot be imported from here at all, so at least one constant
|
|
15
23
|
* is unavoidable; keeping both in one function makes the pair reviewable. */
|
|
16
24
|
function classifyCandidate(purl) {
|
|
@@ -31,14 +39,15 @@ function classifyCandidate(purl) {
|
|
|
31
39
|
return { runtimes: ["nodejs", "rust"], language: "rust" };
|
|
32
40
|
case "npm":
|
|
33
41
|
return { runtimes: ["nodejs"], language: "javascript" };
|
|
34
|
-
case "telo":
|
|
42
|
+
case "telo": {
|
|
35
43
|
// Delivery sub-mode lives in the namespace; only `local` (bundled in the
|
|
36
|
-
// module artifact) exists today. The name is the artifact format
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
if (
|
|
44
|
+
// module artifact) exists today. The name is the artifact format; one no
|
|
45
|
+
// kernel opens (`wasm`) names no runtime.
|
|
46
|
+
const hosted = parsed.namespace === "local" ? BUNDLE_FORMAT_RUNTIMES[parsed.name] : undefined;
|
|
47
|
+
if (!hosted)
|
|
40
48
|
return null;
|
|
41
|
-
return { runtimes: [
|
|
49
|
+
return { runtimes: [hosted.runtime], language: hosted.language };
|
|
50
|
+
}
|
|
42
51
|
default:
|
|
43
52
|
return null;
|
|
44
53
|
}
|
|
@@ -64,6 +73,26 @@ export function kindRuntimeSupport(controllers) {
|
|
|
64
73
|
portable: false,
|
|
65
74
|
};
|
|
66
75
|
}
|
|
76
|
+
/** The platforms and ABIs a module's `native:` entries cover, or `undefined`
|
|
77
|
+
* for a module declaring none. */
|
|
78
|
+
export function nativeReach(entries) {
|
|
79
|
+
if (entries.length === 0)
|
|
80
|
+
return undefined;
|
|
81
|
+
const platforms = new Map();
|
|
82
|
+
const abis = new Set();
|
|
83
|
+
for (const { selector } of entries) {
|
|
84
|
+
const { os, arch, libc, abi } = selector;
|
|
85
|
+
if (os === undefined || arch === undefined)
|
|
86
|
+
continue;
|
|
87
|
+
platforms.set([os, arch, libc ?? ""].join("/"), { os, arch, ...(libc ? { libc } : {}) });
|
|
88
|
+
if (abi !== undefined)
|
|
89
|
+
abis.add(abi);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
platforms: [...platforms.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([, p]) => p),
|
|
93
|
+
abis: [...abis].sort(),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
67
96
|
/** Roll per-kind support up to the module.
|
|
68
97
|
*
|
|
69
98
|
* A boolean would lie: `std/console` ships Rust controllers for two of its four
|
|
@@ -71,7 +100,7 @@ export function kindRuntimeSupport(controllers) {
|
|
|
71
100
|
* supported everywhere, which is what keeps a "runs on rust" filter honest for
|
|
72
101
|
* a module that mixes portable and JS-only kinds. The rollup is recomputed on
|
|
73
102
|
* every re-ingest, so it self-heals when the kernel set changes. */
|
|
74
|
-
export function moduleRuntimeReport(kinds) {
|
|
103
|
+
export function moduleRuntimeReport(kinds, native) {
|
|
75
104
|
const languages = new Set();
|
|
76
105
|
for (const k of kinds)
|
|
77
106
|
for (const l of k.languages)
|
|
@@ -92,6 +121,7 @@ export function moduleRuntimeReport(kinds) {
|
|
|
92
121
|
// A module with no kinds at all declares no controllers either, which is
|
|
93
122
|
// vacuously portable — and reads correctly for a manifest-only library.
|
|
94
123
|
portable: kinds.every((k) => k.portable),
|
|
124
|
+
...(native ? { native } : {}),
|
|
95
125
|
};
|
|
96
126
|
}
|
|
97
127
|
//# sourceMappingURL=controller-runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller-runtime.js","sourceRoot":"","sources":["../src/controller-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controller-runtime.js","sourceRoot":"","sources":["../src/controller-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAe3C,MAAM,cAAc,GAAuB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAO9D;;6BAE6B;AAC7B,MAAM,sBAAsB,GAA8E;IACxG,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE;IACjD,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;CAC3C,CAAC;AAEF;;;;;;;;;;;;8EAY8E;AAC9E,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI,MAAkB,CAAC;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAA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E,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;QACxC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9B,CAAC;AACJ,CAAC"}
|
package/dist/env-files.d.ts
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `.env` / `.env.local` collection for `telo run`.
|
|
3
3
|
*
|
|
4
|
-
* **The workspace marker
|
|
5
|
-
*
|
|
4
|
+
* **The workspace marker bounds the walk, and its `env:` block says how.** A
|
|
5
|
+
* walk-up needs a stop: walking to `/` would read a user's home `.env.local`
|
|
6
6
|
* into an app run, and stopping at `.git` would tie env resolution to a VCS a
|
|
7
7
|
* deployed checkout may not have. `telo-workspace.yaml` is already the anchor
|
|
8
8
|
* every workspace-relative path is measured from, so it is the honest boundary
|
|
9
|
-
* for "this repo"
|
|
10
|
-
* is
|
|
11
|
-
* `examples/` (in no release subtree) still gets the full walk.
|
|
9
|
+
* for "this repo" — and `env.roots` is how a workspace draws a tighter one,
|
|
10
|
+
* which is what keeps a vendor subtree's apps from reading a repo-root `.env`.
|
|
12
11
|
*
|
|
13
12
|
* With no marker anywhere above the manifest the walk collapses to the
|
|
14
13
|
* manifest's own directory, which is what this did before the bound existed, so
|
|
15
14
|
* the file stays harmless by its absence: it enables the parent lookup rather
|
|
16
15
|
* than gating one, and deleting it cannot silently drop a variable an app had.
|
|
17
16
|
*
|
|
18
|
-
* Precedence (highest first): the real environment > nearest
|
|
19
|
-
*
|
|
20
|
-
* reaches every manifest beneath it, so a nearer
|
|
17
|
+
* Precedence (highest first): the real environment > the nearest directory's
|
|
18
|
+
* files, last-declared winning within one directory > the same, one directory
|
|
19
|
+
* up, and so on. A repo-root file reaches every manifest beneath it, so a nearer
|
|
20
|
+
* declaration has to win.
|
|
21
|
+
*
|
|
22
|
+
* **Only `env:` is consulted, and only its diagnostics stop a run.** A typo
|
|
23
|
+
* under `release.modules` is a block this command has no interest in, so it is
|
|
24
|
+
* reported and the run proceeds — aborting every app in a workspace over a
|
|
25
|
+
* release typo is not a trade to make silently. A diagnostic inside `env:` is
|
|
26
|
+
* fatal: degrading to the marker-wide bound there would WIDEN the walk, which is
|
|
27
|
+
* the leak the block exists to prevent, and a block that opted into a boundary
|
|
28
|
+
* and got nothing is a defect rather than a default.
|
|
21
29
|
*
|
|
22
30
|
* **Resolving is separate from applying**, so the walk is answerable without
|
|
23
31
|
* touching `process.env` or writing a line of output — the caller owns both.
|
|
24
32
|
*/
|
|
33
|
+
import { type WorkspaceDiagnostic } from "@telorun/analyzer";
|
|
25
34
|
/** One file the walk could not read for a reason other than its absence. */
|
|
26
35
|
export interface UnreadableEnvFile {
|
|
27
36
|
readonly path: string;
|
|
@@ -39,6 +48,12 @@ export interface EnvFileResolution {
|
|
|
39
48
|
* and it is not optional: an unreadable `.env` is indistinguishable from an
|
|
40
49
|
* absent one to everything downstream. */
|
|
41
50
|
readonly unreadable: readonly UnreadableEnvFile[];
|
|
51
|
+
/** What the marker got wrong. Anything anchored outside `env:` is reported and
|
|
52
|
+
* survivable; an error inside it is why `failed` is set. */
|
|
53
|
+
readonly diagnostics: readonly WorkspaceDiagnostic[];
|
|
54
|
+
/** Set when `env:` itself could not be read, so the caller must refuse rather
|
|
55
|
+
* than run against a boundary it had to guess at. */
|
|
56
|
+
readonly failed?: string;
|
|
42
57
|
}
|
|
43
58
|
/** Collect the env files visible to a manifest. Pure: reads the filesystem and
|
|
44
59
|
* returns what it found. */
|
package/dist/env-files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-files.d.ts","sourceRoot":"","sources":["../src/env-files.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"env-files.d.ts","sourceRoot":"","sources":["../src/env-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAOL,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAO3B,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC;uBACmB;IACnB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD;6EACyE;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;+CAE2C;IAC3C,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD;iEAC6D;IAC7D,QAAQ,CAAC,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACrD;0DACsD;IACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;6BAC6B;AAC7B,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,iBAAiB,CA+BvE"}
|
package/dist/env-files.js
CHANGED
|
@@ -1,41 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `.env` / `.env.local` collection for `telo run`.
|
|
3
3
|
*
|
|
4
|
-
* **The workspace marker
|
|
5
|
-
*
|
|
4
|
+
* **The workspace marker bounds the walk, and its `env:` block says how.** A
|
|
5
|
+
* walk-up needs a stop: walking to `/` would read a user's home `.env.local`
|
|
6
6
|
* into an app run, and stopping at `.git` would tie env resolution to a VCS a
|
|
7
7
|
* deployed checkout may not have. `telo-workspace.yaml` is already the anchor
|
|
8
8
|
* every workspace-relative path is measured from, so it is the honest boundary
|
|
9
|
-
* for "this repo"
|
|
10
|
-
* is
|
|
11
|
-
* `examples/` (in no release subtree) still gets the full walk.
|
|
9
|
+
* for "this repo" — and `env.roots` is how a workspace draws a tighter one,
|
|
10
|
+
* which is what keeps a vendor subtree's apps from reading a repo-root `.env`.
|
|
12
11
|
*
|
|
13
12
|
* With no marker anywhere above the manifest the walk collapses to the
|
|
14
13
|
* manifest's own directory, which is what this did before the bound existed, so
|
|
15
14
|
* the file stays harmless by its absence: it enables the parent lookup rather
|
|
16
15
|
* than gating one, and deleting it cannot silently drop a variable an app had.
|
|
17
16
|
*
|
|
18
|
-
* Precedence (highest first): the real environment > nearest
|
|
19
|
-
*
|
|
20
|
-
* reaches every manifest beneath it, so a nearer
|
|
17
|
+
* Precedence (highest first): the real environment > the nearest directory's
|
|
18
|
+
* files, last-declared winning within one directory > the same, one directory
|
|
19
|
+
* up, and so on. A repo-root file reaches every manifest beneath it, so a nearer
|
|
20
|
+
* declaration has to win.
|
|
21
|
+
*
|
|
22
|
+
* **Only `env:` is consulted, and only its diagnostics stop a run.** A typo
|
|
23
|
+
* under `release.modules` is a block this command has no interest in, so it is
|
|
24
|
+
* reported and the run proceeds — aborting every app in a workspace over a
|
|
25
|
+
* release typo is not a trade to make silently. A diagnostic inside `env:` is
|
|
26
|
+
* fatal: degrading to the marker-wide bound there would WIDEN the walk, which is
|
|
27
|
+
* the leak the block exists to prevent, and a block that opted into a boundary
|
|
28
|
+
* and got nothing is a defect rather than a default.
|
|
21
29
|
*
|
|
22
30
|
* **Resolving is separate from applying**, so the walk is answerable without
|
|
23
31
|
* touching `process.env` or writing a line of output — the caller owns both.
|
|
24
32
|
*/
|
|
33
|
+
import { DEFAULT_ENV_FILES, WORKSPACE_FILENAME, diagnosticsFor, hasError, matchesPatterns, readWorkspaceConfig, } from "@telorun/analyzer";
|
|
34
|
+
import { lastMatchIndex } from "@telorun/glob";
|
|
25
35
|
import * as dotenv from "dotenv";
|
|
26
36
|
import * as fs from "node:fs";
|
|
27
37
|
import * as path from "node:path";
|
|
28
38
|
import { findWorkspaceRoot, realPath } from "./workspace-marker.js";
|
|
29
|
-
const FILENAMES = [".env", ".env.local"];
|
|
30
39
|
/** Collect the env files visible to a manifest. Pure: reads the filesystem and
|
|
31
40
|
* returns what it found. */
|
|
32
41
|
export function resolveEnvFiles(manifestPath) {
|
|
33
42
|
const loaded = [];
|
|
34
43
|
const unreadable = [];
|
|
35
44
|
const values = {};
|
|
45
|
+
const from = manifestDirectory(manifestPath);
|
|
46
|
+
const root = findWorkspaceRoot(from);
|
|
47
|
+
const marker = readMarker(root);
|
|
48
|
+
const envErrors = diagnosticsFor(marker.diagnostics, "env");
|
|
49
|
+
if (hasError(envErrors)) {
|
|
50
|
+
return {
|
|
51
|
+
values,
|
|
52
|
+
loaded,
|
|
53
|
+
unreadable,
|
|
54
|
+
diagnostics: marker.diagnostics,
|
|
55
|
+
failed: envErrors.find((diagnostic) => diagnostic.severity === "error").message,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const files = marker.config.env?.files ?? DEFAULT_ENV_FILES;
|
|
36
59
|
// Farthest-first, so each nearer directory overwrites what the one above set.
|
|
37
|
-
for (const directory of envDirectories(
|
|
38
|
-
for (const name of
|
|
60
|
+
for (const directory of envDirectories(from, root, marker.config.env?.roots).reverse()) {
|
|
61
|
+
for (const name of files) {
|
|
39
62
|
const file = path.join(directory, name);
|
|
40
63
|
const text = readEnvFile(file, unreadable);
|
|
41
64
|
if (text === undefined)
|
|
@@ -44,7 +67,34 @@ export function resolveEnvFiles(manifestPath) {
|
|
|
44
67
|
Object.assign(values, dotenv.parse(text));
|
|
45
68
|
}
|
|
46
69
|
}
|
|
47
|
-
return { values, loaded, unreadable };
|
|
70
|
+
return { values, loaded, unreadable, diagnostics: marker.diagnostics };
|
|
71
|
+
}
|
|
72
|
+
function readMarker(root) {
|
|
73
|
+
if (!root)
|
|
74
|
+
return { config: {}, diagnostics: [] };
|
|
75
|
+
const file = path.join(root, WORKSPACE_FILENAME);
|
|
76
|
+
try {
|
|
77
|
+
return readWorkspaceConfig(fs.readFileSync(file, "utf8"), WORKSPACE_FILENAME);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
// Reported, never swallowed. The marker was found by walking for it, so a
|
|
81
|
+
// read failure is a race or a permission problem — and degrading to "no
|
|
82
|
+
// blocks" would drop `env.roots` and read exactly the files the block was
|
|
83
|
+
// written to exclude, with no signal at all. Anchored at the document, which
|
|
84
|
+
// is inside every block's scope, so the run refuses.
|
|
85
|
+
return {
|
|
86
|
+
config: {},
|
|
87
|
+
diagnostics: [
|
|
88
|
+
{
|
|
89
|
+
code: "WORKSPACE_INVALID_VALUE",
|
|
90
|
+
severity: "error",
|
|
91
|
+
message: `${WORKSPACE_FILENAME} could not be read (${err.code ?? String(err)}). ` +
|
|
92
|
+
`It bounds which .env files this run may read, so its contents cannot be assumed.`,
|
|
93
|
+
path: [],
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
48
98
|
}
|
|
49
99
|
/** The directory holding the manifest — or the path itself when it names a
|
|
50
100
|
* directory. Resolved through symlinks, so the walk climbs the real tree. */
|
|
@@ -54,11 +104,16 @@ function manifestDirectory(manifestPath) {
|
|
|
54
104
|
? resolved
|
|
55
105
|
: path.dirname(resolved);
|
|
56
106
|
}
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
107
|
+
/**
|
|
108
|
+
* The manifest's directory, then each ancestor up to and including the bound.
|
|
109
|
+
*
|
|
110
|
+
* The bound is the nearest ancestor matching `env.roots`, else the workspace
|
|
111
|
+
* root; with no marker it is the manifest's own directory. Two `roots` matches
|
|
112
|
+
* need no refusal — unlike two `release.modules` entries, which contradict about
|
|
113
|
+
* a destination, two bounds differ only in tightness and the nearest is the
|
|
114
|
+
* answer.
|
|
115
|
+
*/
|
|
116
|
+
function envDirectories(from, root, roots) {
|
|
62
117
|
if (root === undefined)
|
|
63
118
|
return [from];
|
|
64
119
|
const dirs = [];
|
|
@@ -66,6 +121,11 @@ function envDirectories(from) {
|
|
|
66
121
|
dirs.push(dir);
|
|
67
122
|
if (dir === root || path.dirname(dir) === dir)
|
|
68
123
|
break;
|
|
124
|
+
if (roots?.length) {
|
|
125
|
+
const rel = path.relative(root, dir).split(path.sep).join("/");
|
|
126
|
+
if (rel !== "" && matchesPatterns(rel, roots, lastMatchIndex))
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
69
129
|
}
|
|
70
130
|
return dirs;
|
|
71
131
|
}
|
package/dist/env-files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-files.js","sourceRoot":"","sources":["../src/env-files.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"env-files.js","sourceRoot":"","sources":["../src/env-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,eAAe,EACf,mBAAmB,GAEpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AA4BpE;6BAC6B;AAC7B,MAAM,UAAU,eAAe,CAAC,YAAoB;IAClD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,UAAU,GAAwB,EAAE,CAAC;IAC3C,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,SAAS,GAAG,cAAc,CAAC,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AC,GAAG,CAAC,CAAC;QACf,IAAI,GAAG,KAAK,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG;YAAE,MAAM;QACrD,IAAI,KAAK,EAAE,MAAM,EAAE,CAAC;YAClB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC/D,IAAI,GAAG,KAAK,EAAE,IAAI,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,cAAc,CAAC;gBAAE,MAAM;QACvE,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,UAA+B;IAChE,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;QACjD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC9D,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* already a complete description of what to write.
|
|
9
9
|
*/
|
|
10
10
|
import { type Ledger, type ModuleKey, type ReleasePlan } from "@telorun/analyzer";
|
|
11
|
+
import { type ModuleTarget } from "./evidence.js";
|
|
11
12
|
import { type Workspace } from "./workspace.js";
|
|
12
13
|
/** One module's writes, reported so `apply` can list what it touched. */
|
|
13
14
|
export interface AppliedModule {
|
|
@@ -34,5 +35,5 @@ export declare function writePlannedVersions(workspace: Workspace, plan: Release
|
|
|
34
35
|
* pre-bump digest would guarantee the next `check` reported drift on every
|
|
35
36
|
* module in this release.
|
|
36
37
|
*/
|
|
37
|
-
export declare function recordLedger(root: string,
|
|
38
|
+
export declare function recordLedger(root: string, targets: ReadonlyMap<ModuleKey, ModuleTarget>, plan: ReleasePlan): Promise<Ledger>;
|
|
38
39
|
//# sourceMappingURL=apply-plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../src/release/apply-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAQL,KAAK,MAAM,EAEX,KAAK,SAAS,EAEd,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../src/release/apply-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAQL,KAAK,MAAM,EAEX,KAAK,SAAS,EAEd,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9E,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,GACX,aAAa,EAAE,CAQjB;AA0FD;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC,EAC7C,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,MAAM,CAAC,CAwBjB"}
|
|
@@ -11,7 +11,7 @@ import { prependChangelogRelease, renderChangelogRelease, stampCrateVersion, sta
|
|
|
11
11
|
import * as fs from "node:fs";
|
|
12
12
|
import * as path from "node:path";
|
|
13
13
|
import { ModulePayloadBuilder } from "../bundle/module-payload.js";
|
|
14
|
-
import {
|
|
14
|
+
import { digestPayload, imageDigest } from "./evidence.js";
|
|
15
15
|
import { readLedger } from "./ledger-store.js";
|
|
16
16
|
import { loadWorkspace, requireModule } from "./workspace.js";
|
|
17
17
|
/**
|
|
@@ -116,7 +116,7 @@ function writeChangelog(workspace, dir, module, date) {
|
|
|
116
116
|
* pre-bump digest would guarantee the next `check` reported drift on every
|
|
117
117
|
* module in this release.
|
|
118
118
|
*/
|
|
119
|
-
export async function recordLedger(root,
|
|
119
|
+
export async function recordLedger(root, targets, plan) {
|
|
120
120
|
// Re-read the workspace so discovery sees the versions just written.
|
|
121
121
|
const workspace = loadWorkspace(root);
|
|
122
122
|
const planned = new Set(plan.modules.map((module) => module.key));
|
|
@@ -128,13 +128,17 @@ export async function recordLedger(root, registry, plan) {
|
|
|
128
128
|
for (const module of workspace.modules) {
|
|
129
129
|
if (!planned.has(module.key))
|
|
130
130
|
continue;
|
|
131
|
+
const target = targets.get(module.key);
|
|
132
|
+
if (!target)
|
|
133
|
+
continue;
|
|
131
134
|
entries.set(module.key, {
|
|
132
135
|
version: module.version,
|
|
136
|
+
registry: target.registry,
|
|
133
137
|
layers: module.artifactKind === "image"
|
|
134
138
|
? { image: await imageDigest(module) }
|
|
135
|
-
: await digestPayload(await builder.payload(module.manifestPath,
|
|
139
|
+
: await digestPayload(await builder.payload(module.manifestPath, target.destination)),
|
|
136
140
|
});
|
|
137
141
|
}
|
|
138
|
-
return {
|
|
142
|
+
return { modules: entries };
|
|
139
143
|
}
|
|
140
144
|
//# sourceMappingURL=apply-plan.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-plan.js","sourceRoot":"","sources":["../../src/release/apply-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAMlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"apply-plan.js","sourceRoot":"","sources":["../../src/release/apply-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAMlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAW9E;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAAoB,EACpB,IAAiB,EACjB,IAAY;IAEZ,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACjC,MAAM,UAAU,GAAG,aAAa,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C,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAE5F,4EAA4E;IAC5E,8EAA8E;IAC9E,8EAA8E;IAC9E,MAAM,OAAO,GAAG,IAAI,GAAG,CAAyB,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;IACpF,KAAK,MAAM,MAAM,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;YAAE,SAAS;QACvC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM;YAAE,SAAS;QACtB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE;YACtB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EACJ,MAAM,CAAC,YAAY,KAAK,OAAO;gBAC7B,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC,EAAE;gBACtC,CAAC,CAAC,MAAM,aAAa,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;SAC1F,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a `Cargo.toml` into plain data, for the build-input digest of a
|
|
3
|
+
* crate-built source.
|
|
4
|
+
*
|
|
5
|
+
* A strict reader of the TOML cargo manifests are written in — tables, arrays of
|
|
6
|
+
* tables, dotted and quoted keys, strings of all four kinds, arrays, inline
|
|
7
|
+
* tables, booleans, and other scalars kept as their text. Anything else is a
|
|
8
|
+
* refusal naming the line, never a skip: a dependency table read wrongly would
|
|
9
|
+
* drop a path dependency from the digest, and a prebuild would then outlive a
|
|
10
|
+
* change to code it links without anything reporting it.
|
|
11
|
+
*/
|
|
12
|
+
export type TomlValue = string | boolean | TomlValue[] | TomlTable;
|
|
13
|
+
export interface TomlTable {
|
|
14
|
+
[key: string]: TomlValue;
|
|
15
|
+
}
|
|
16
|
+
export declare function parseCargoToml(text: string, where: string): TomlTable;
|
|
17
|
+
//# sourceMappingURL=cargo-toml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cargo-toml.d.ts","sourceRoot":"","sources":["../../src/release/cargo-toml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,EAAE,GAAG,SAAS,CAAC;AACnE,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAErE"}
|