@telorun/cli 0.59.0 → 0.61.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 +32 -14
- package/dist/bundle/partition-layers.d.ts +71 -0
- package/dist/bundle/partition-layers.d.ts.map +1 -0
- package/dist/bundle/partition-layers.js +166 -0
- package/dist/bundle/partition-layers.js.map +1 -0
- package/dist/bundle/warm-layers.d.ts +36 -0
- package/dist/bundle/warm-layers.d.ts.map +1 -0
- package/dist/bundle/warm-layers.js +85 -0
- package/dist/bundle/warm-layers.js.map +1 -0
- package/dist/commands/install.d.ts +1 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +25 -6
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/publish.d.ts +3 -0
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +33 -16
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +21 -3
- package/dist/commands/run.js.map +1 -1
- package/dist/logger.d.ts +7 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +48 -22
- package/dist/logger.js.map +1 -1
- package/package.json +5 -5
- package/dist/bundle/extract.d.ts +0 -22
- package/dist/bundle/extract.d.ts.map +0 -1
- package/dist/bundle/extract.js +0 -97
- package/dist/bundle/extract.js.map +0 -1
package/README.md
CHANGED
|
@@ -35,8 +35,8 @@ Publish one or more module manifests to the Telo registry. For each manifest, th
|
|
|
35
35
|
4. Publishes each controller package to its registry (currently npm). If the version already exists, the publish step is skipped — the command is idempotent.
|
|
36
36
|
5. Rewrites the PURL version specs in the manifest to exact static versions.
|
|
37
37
|
6. Bumps `metadata.version` in the manifest when `--bump` is given.
|
|
38
|
-
7. Pushes the artifact to
|
|
39
|
-
|
|
38
|
+
7. Pushes the artifact to an OCI registry — `telo.yaml` in its own layer, plus
|
|
39
|
+
one layer per group of files the manifest declares (see below).
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
42
|
telo publish ./modules/my-module/telo.yaml
|
|
@@ -46,13 +46,12 @@ telo publish ./modules/my-module/telo.yaml --dry-run
|
|
|
46
46
|
telo publish ./modules/my-module/telo.yaml --skip-controllers
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
**
|
|
49
|
+
**Shipping files with `files:`**
|
|
50
50
|
|
|
51
|
-
A `Telo.Application` or `Telo.Library` may declare a `files:` list to ship
|
|
52
|
-
|
|
53
|
-
templates, seed data
|
|
54
|
-
|
|
55
|
-
consumer.
|
|
51
|
+
A `Telo.Application` or `Telo.Library` may declare a `files:` list to ship files
|
|
52
|
+
alongside `telo.yaml` — bundled controllers, a built SPA served by `Http.Static`,
|
|
53
|
+
templates, seed data. Without it, only the manifest reaches the registry and a
|
|
54
|
+
relative `Http.Static` `root:` resolves to an empty directory on the consumer.
|
|
56
55
|
|
|
57
56
|
```yaml
|
|
58
57
|
kind: Telo.Application
|
|
@@ -68,12 +67,31 @@ engine git uses): positive patterns opt files in, `!` patterns carve them out,
|
|
|
68
67
|
always-on set is never shipped regardless of patterns: `node_modules/`,
|
|
69
68
|
`.git/`, `.telo/`, `.telobundle.*`.
|
|
70
69
|
|
|
71
|
-
When `files:` selects anything, `telo publish`
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
When `files:` selects anything, `telo publish` **partitions** the selection into
|
|
71
|
+
layers and pushes each as its own blob: one layer per bundled-controller platform,
|
|
72
|
+
one for whatever the optional `assets:` list claims, and one for everything else.
|
|
73
|
+
It prints the partition so you can see where each file landed. The consumer then
|
|
74
|
+
fetches only what it needs — a Node host skips a Rust controller's binary, a
|
|
75
|
+
`linux/amd64` host skips the `darwin/arm64` one, and the asset layer is fetched
|
|
76
|
+
only if something actually reads a file from it.
|
|
77
|
+
|
|
78
|
+
Declaring `assets:` (a subset of `files:`) is what makes those files lazy:
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
files:
|
|
82
|
+
- nodejs/*.mjs
|
|
83
|
+
- public/**
|
|
84
|
+
assets:
|
|
85
|
+
- public/**
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Omitting it is safe — the files still ship and still resolve, they are just
|
|
89
|
+
fetched alongside the module's controllers instead of on demand.
|
|
90
|
+
|
|
91
|
+
`telo run` materializes layers on demand, so nothing has to be pre-fetched.
|
|
92
|
+
`telo install` pre-fetches everything for one platform so a later run needs no
|
|
93
|
+
network; pass `--platform os/arch[/libc]` (e.g. `linux/arm64/musl`) when baking an
|
|
94
|
+
image for an architecture other than the build machine's.
|
|
77
95
|
|
|
78
96
|
**Options:**
|
|
79
97
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type ArtifactSelector } from "@telorun/analyzer";
|
|
2
|
+
import type { PayloadLayer } from "@telorun/kernel";
|
|
3
|
+
/** Manifest-relative POSIX path of a selected file, grouped into the layer it
|
|
4
|
+
* belongs to. Content is read by the caller — this module decides membership
|
|
5
|
+
* only, so it stays testable without a filesystem. */
|
|
6
|
+
export interface LayerPlan {
|
|
7
|
+
role: PayloadLayer["role"];
|
|
8
|
+
selector?: ArtifactSelector;
|
|
9
|
+
files: string[];
|
|
10
|
+
}
|
|
11
|
+
/** Where every selected file landed, for the publish-time printout. The author's
|
|
12
|
+
* only feedback that a file they meant as a controller sidecar ended up in the
|
|
13
|
+
* common layer, or that an asset they forgot to claim is not lazy. */
|
|
14
|
+
export interface Partition {
|
|
15
|
+
layers: LayerPlan[];
|
|
16
|
+
/** `assets:` patterns that matched nothing — almost always a typo, and invisible
|
|
17
|
+
* in `layers` because an empty layer is dropped. */
|
|
18
|
+
unmatchedAssets: string[];
|
|
19
|
+
/** `siblings=` patterns that matched nothing, with the candidate that declared
|
|
20
|
+
* each one. */
|
|
21
|
+
unmatchedSiblings: Array<{
|
|
22
|
+
purl: string;
|
|
23
|
+
pattern: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
interface ControllerClaim {
|
|
27
|
+
selector: ArtifactSelector;
|
|
28
|
+
/** Entry-point path exactly as `path=` names it, manifest-relative. */
|
|
29
|
+
entry: string;
|
|
30
|
+
/** Sibling patterns declared on the same candidate. */
|
|
31
|
+
siblings: string[];
|
|
32
|
+
/** For diagnostics: the PURL this claim came from. */
|
|
33
|
+
purl: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Every bundled-controller candidate declared anywhere in the manifest, with its
|
|
37
|
+
* selector and the files it claims. Read from `controllers:` on each doc — the
|
|
38
|
+
* manifest already names each entry point, so the partition is derived rather
|
|
39
|
+
* than declared.
|
|
40
|
+
*/
|
|
41
|
+
export declare function readControllerClaims(manifestText: string): ControllerClaim[];
|
|
42
|
+
/**
|
|
43
|
+
* Partition the selected payload into the layers a module artifact ships.
|
|
44
|
+
*
|
|
45
|
+
* A **controller layer** per distinct selector, holding its entry points plus
|
|
46
|
+
* whatever their sibling qualifiers claim. The **assets** layer holds what
|
|
47
|
+
* `assets:` claims — it is fetched lazily, on first module-relative access. The
|
|
48
|
+
* **common** layer holds everything left over.
|
|
49
|
+
*
|
|
50
|
+
* The sink runs toward correctness: an unclaimed file joins `common`, which is
|
|
51
|
+
* materialized alongside *any* controller layer, so a sidecar nobody declared is
|
|
52
|
+
* on disk before the controller that needs it imports. A forgotten declaration
|
|
53
|
+
* therefore costs bytes, never a module-not-found at runtime. Both declarations
|
|
54
|
+
* are optional and only ever buy laziness.
|
|
55
|
+
*
|
|
56
|
+
* `files` are the manifest-relative paths `selectFiles` produced; `assetPatterns`
|
|
57
|
+
* is the author's `assets:` list. Layers with no files are dropped, so a
|
|
58
|
+
* controller-only module publishes exactly one payload layer.
|
|
59
|
+
*/
|
|
60
|
+
export declare function partitionLayers(manifestText: string, files: string[], assetPatterns: string[]): Partition;
|
|
61
|
+
/**
|
|
62
|
+
* One line per layer for the publish output, so an author can see that a file they
|
|
63
|
+
* meant as a sidecar or an asset landed in `common` instead.
|
|
64
|
+
*
|
|
65
|
+
* Patterns that matched nothing are reported too: an empty layer is dropped from
|
|
66
|
+
* the partition, so a typo'd `assets:` glob would otherwise print nothing at all —
|
|
67
|
+
* silence about the single mistake this output exists to catch.
|
|
68
|
+
*/
|
|
69
|
+
export declare function describePartition(partition: Partition): string[];
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=partition-layers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partition-layers.d.ts","sourceRoot":"","sources":["../../src/bundle/partition-layers.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD;;uDAEuD;AACvD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;uEAEuE;AACvE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB;yDACqD;IACrD,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B;oBACgB;IAChB,iBAAiB,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7D;AAgBD,UAAU,eAAe;IACvB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;CACd;AAQD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,EAAE,CAmC5E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EAAE,EACf,aAAa,EAAE,MAAM,EAAE,GACtB,SAAS,CAqEX;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,EAAE,CAYhE"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { describeSelector, selectorFromQualifiers, selectorKey, } from "@telorun/analyzer";
|
|
2
|
+
import { selectByPatterns } from "@telorun/glob";
|
|
3
|
+
import { defaultCustomTags } from "@telorun/templating";
|
|
4
|
+
import { PackageURL } from "packageurl-js";
|
|
5
|
+
import { parseAllDocuments } from "yaml";
|
|
6
|
+
/** `pkg:telo/local/<format>?path=…` — the bundled-controller delivery mode.
|
|
7
|
+
* Anything else (`pkg:npm`, `pkg:cargo`) fetches from its own ecosystem and
|
|
8
|
+
* contributes no layer. */
|
|
9
|
+
const BUNDLED_TYPE = "telo";
|
|
10
|
+
const BUNDLED_NAMESPACE = "local";
|
|
11
|
+
/** Qualifier naming extra files that belong in a controller's layer — what an
|
|
12
|
+
* entry point loads but the manifest cannot otherwise see (a `.wasm` beside its
|
|
13
|
+
* glue, a native library opened at runtime). Comma-separated
|
|
14
|
+
* `.gitignore`-style patterns, matched through the one glob engine. Optional:
|
|
15
|
+
* an unclaimed sidecar joins the common layer, which every controller-hosting
|
|
16
|
+
* kernel pulls, so omitting it costs bytes rather than a broken import. */
|
|
17
|
+
const SIBLINGS_QUALIFIER = "siblings";
|
|
18
|
+
/** Normalize a `path=` / sibling value to the manifest-relative POSIX form
|
|
19
|
+
* `selectFiles` returns, so membership is a string comparison. */
|
|
20
|
+
function normalizeRelative(value) {
|
|
21
|
+
return value.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Every bundled-controller candidate declared anywhere in the manifest, with its
|
|
25
|
+
* selector and the files it claims. Read from `controllers:` on each doc — the
|
|
26
|
+
* manifest already names each entry point, so the partition is derived rather
|
|
27
|
+
* than declared.
|
|
28
|
+
*/
|
|
29
|
+
export function readControllerClaims(manifestText) {
|
|
30
|
+
const claims = [];
|
|
31
|
+
for (const doc of parseAllDocuments(manifestText, { customTags: defaultCustomTags() })) {
|
|
32
|
+
const json = doc.toJSON();
|
|
33
|
+
const candidates = Array.isArray(json?.controllers) ? json.controllers : [];
|
|
34
|
+
for (const candidate of candidates) {
|
|
35
|
+
if (typeof candidate !== "string")
|
|
36
|
+
continue;
|
|
37
|
+
let parsed;
|
|
38
|
+
try {
|
|
39
|
+
parsed = PackageURL.fromString(candidate);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// Not a parseable PURL — publish is not the place to reject it; the
|
|
43
|
+
// analyzer and the controller loader both report it with better context.
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (parsed.type !== BUNDLED_TYPE || parsed.namespace !== BUNDLED_NAMESPACE)
|
|
47
|
+
continue;
|
|
48
|
+
const entry = parsed.qualifiers?.path;
|
|
49
|
+
if (typeof entry !== "string" || entry === "")
|
|
50
|
+
continue;
|
|
51
|
+
const siblings = String(parsed.qualifiers?.[SIBLINGS_QUALIFIER] ?? "")
|
|
52
|
+
.split(",")
|
|
53
|
+
.map((p) => p.trim())
|
|
54
|
+
.filter((p) => p !== "");
|
|
55
|
+
claims.push({
|
|
56
|
+
selector: selectorFromQualifiers(parsed.name, parsed.qualifiers, `controller "${candidate}"`),
|
|
57
|
+
entry: normalizeRelative(entry),
|
|
58
|
+
siblings,
|
|
59
|
+
purl: candidate,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return claims;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Partition the selected payload into the layers a module artifact ships.
|
|
67
|
+
*
|
|
68
|
+
* A **controller layer** per distinct selector, holding its entry points plus
|
|
69
|
+
* whatever their sibling qualifiers claim. The **assets** layer holds what
|
|
70
|
+
* `assets:` claims — it is fetched lazily, on first module-relative access. The
|
|
71
|
+
* **common** layer holds everything left over.
|
|
72
|
+
*
|
|
73
|
+
* The sink runs toward correctness: an unclaimed file joins `common`, which is
|
|
74
|
+
* materialized alongside *any* controller layer, so a sidecar nobody declared is
|
|
75
|
+
* on disk before the controller that needs it imports. A forgotten declaration
|
|
76
|
+
* therefore costs bytes, never a module-not-found at runtime. Both declarations
|
|
77
|
+
* are optional and only ever buy laziness.
|
|
78
|
+
*
|
|
79
|
+
* `files` are the manifest-relative paths `selectFiles` produced; `assetPatterns`
|
|
80
|
+
* is the author's `assets:` list. Layers with no files are dropped, so a
|
|
81
|
+
* controller-only module publishes exactly one payload layer.
|
|
82
|
+
*/
|
|
83
|
+
export function partitionLayers(manifestText, files, assetPatterns) {
|
|
84
|
+
const claims = readControllerClaims(manifestText);
|
|
85
|
+
const selected = new Set(files);
|
|
86
|
+
const unclaimed = new Set(files);
|
|
87
|
+
// A controller entry point the `files:` list does not select is a broken
|
|
88
|
+
// artifact, and it is decidable right here: its layer would ship without it (or
|
|
89
|
+
// be dropped entirely as empty), and the consumer would only find out at load
|
|
90
|
+
// time as "ships no layer for <selector>". Fail at publish, naming both the PURL
|
|
91
|
+
// and the path that has to be added.
|
|
92
|
+
const missing = claims.filter((c) => !selected.has(c.entry));
|
|
93
|
+
if (missing.length > 0) {
|
|
94
|
+
throw new Error(`controller entry point${missing.length === 1 ? "" : "s"} not selected by 'files:':\n` +
|
|
95
|
+
missing.map((c) => ` ${c.entry} (from ${c.purl})`).join("\n") +
|
|
96
|
+
`\nAdd the path to 'files:' — a bundled controller must ship in the module's artifact.`);
|
|
97
|
+
}
|
|
98
|
+
// Controller layers first: a file an entry point or sibling claims belongs to
|
|
99
|
+
// that selector, never to assets or common, so the layer a kernel skips is
|
|
100
|
+
// genuinely skippable. A file several candidates claim is copied into each of
|
|
101
|
+
// their layers rather than taken by whichever came first — the alternative
|
|
102
|
+
// leaves the later platform's layer missing a file it declared it needs, which
|
|
103
|
+
// would break the "a declaration never costs correctness" guarantee.
|
|
104
|
+
const bySelector = new Map();
|
|
105
|
+
const unmatchedSiblings = [];
|
|
106
|
+
for (const claim of claims) {
|
|
107
|
+
const key = selectorKey(claim.selector);
|
|
108
|
+
let plan = bySelector.get(key);
|
|
109
|
+
if (!plan) {
|
|
110
|
+
plan = { role: "controller", selector: claim.selector, files: [] };
|
|
111
|
+
bySelector.set(key, plan);
|
|
112
|
+
}
|
|
113
|
+
const siblings = selectByPatterns([...selected], claim.siblings, {
|
|
114
|
+
applyDefaultIgnore: false,
|
|
115
|
+
});
|
|
116
|
+
for (const pattern of claim.siblings) {
|
|
117
|
+
if (selectByPatterns([...selected], [pattern], { applyDefaultIgnore: false }).length === 0) {
|
|
118
|
+
unmatchedSiblings.push({ purl: claim.purl, pattern });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
for (const file of [claim.entry, ...siblings]) {
|
|
122
|
+
unclaimed.delete(file);
|
|
123
|
+
if (!plan.files.includes(file))
|
|
124
|
+
plan.files.push(file);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const assetFiles = selectByPatterns([...unclaimed], assetPatterns, {
|
|
128
|
+
applyDefaultIgnore: false,
|
|
129
|
+
});
|
|
130
|
+
for (const file of assetFiles)
|
|
131
|
+
unclaimed.delete(file);
|
|
132
|
+
const unmatchedAssets = assetPatterns.filter((pattern) => !pattern.startsWith("!") &&
|
|
133
|
+
selectByPatterns([...selected], [pattern], { applyDefaultIgnore: false }).length === 0);
|
|
134
|
+
const layers = [
|
|
135
|
+
...[...bySelector.values()].map((plan) => ({ ...plan, files: plan.files.sort() })),
|
|
136
|
+
{ role: "assets", files: assetFiles },
|
|
137
|
+
{ role: "common", files: [...unclaimed].sort() },
|
|
138
|
+
];
|
|
139
|
+
return {
|
|
140
|
+
layers: layers.filter((l) => l.files.length > 0),
|
|
141
|
+
unmatchedAssets,
|
|
142
|
+
unmatchedSiblings,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* One line per layer for the publish output, so an author can see that a file they
|
|
147
|
+
* meant as a sidecar or an asset landed in `common` instead.
|
|
148
|
+
*
|
|
149
|
+
* Patterns that matched nothing are reported too: an empty layer is dropped from
|
|
150
|
+
* the partition, so a typo'd `assets:` glob would otherwise print nothing at all —
|
|
151
|
+
* silence about the single mistake this output exists to catch.
|
|
152
|
+
*/
|
|
153
|
+
export function describePartition(partition) {
|
|
154
|
+
const lines = partition.layers.map((layer) => {
|
|
155
|
+
const label = layer.selector ? `${layer.role} ${describeSelector(layer.selector)}` : layer.role;
|
|
156
|
+
return `${label}: ${layer.files.length} file(s)`;
|
|
157
|
+
});
|
|
158
|
+
for (const pattern of partition.unmatchedAssets) {
|
|
159
|
+
lines.push(`assets pattern '${pattern}' matched no file`);
|
|
160
|
+
}
|
|
161
|
+
for (const { purl, pattern } of partition.unmatchedSiblings) {
|
|
162
|
+
lines.push(`siblings pattern '${pattern}' matched no file (from ${purl})`);
|
|
163
|
+
}
|
|
164
|
+
return lines;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=partition-layers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partition-layers.js","sourceRoot":"","sources":["../../src/bundle/partition-layers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,GAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAwBzC;;4BAE4B;AAC5B,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC;;;;;4EAK4E;AAC5E,MAAM,kBAAkB,GAAG,UAAU,CAAC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B;KAClB,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAoB;IACpD,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QAChG,OAAO,GAAG,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,MAAM,UAAU,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,eAAe,EAAE,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,mBAAmB,OAAO,mBAAmB,CAAC,CAAC;IAC5D,CAAC;IACD,KAAK,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,SAAS,CAAC,iBAAiB,EAAE,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,qBAAqB,OAAO,2BAA2B,IAAI,GAAG,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type LoadedGraph, type PlatformTarget } from "@telorun/analyzer";
|
|
2
|
+
/**
|
|
3
|
+
* Pre-materialize every module layer a `target` platform could need.
|
|
4
|
+
*
|
|
5
|
+
* This is `telo install`'s make-this-offline pass. `telo run` materializes layers
|
|
6
|
+
* lazily — a controller layer when its candidate wins resolution, an asset layer
|
|
7
|
+
* on first module-relative access — so warming here is an optimization, never a
|
|
8
|
+
* correctness requirement. That is the point of the change it replaces:
|
|
9
|
+
* previously a cold `telo run` failed outright because payloads landed on disk
|
|
10
|
+
* only after the load that needed them.
|
|
11
|
+
*
|
|
12
|
+
* `target` defaults to the host but is explicit so a baked image
|
|
13
|
+
* (`TELO_CACHE_DIR`) can be built from a machine of a different architecture —
|
|
14
|
+
* without it, cross-building a `linux/arm64` image on a darwin laptop would cache
|
|
15
|
+
* the wrong binaries.
|
|
16
|
+
*
|
|
17
|
+
* Best-effort per module for transient fetch failures (reported and skipped —
|
|
18
|
+
* the manifest is cached either way, and `run` will fetch what it needs). An
|
|
19
|
+
* integrity failure, a malformed layer index, and a tar entry escaping the module
|
|
20
|
+
* directory are all hard: a tampered or corrupt artifact must never be used, and
|
|
21
|
+
* a bad index is an authoring error the publisher has to fix.
|
|
22
|
+
*
|
|
23
|
+
* Returns the number of layers materialized.
|
|
24
|
+
*/
|
|
25
|
+
export declare function warmModuleLayers(graph: LoadedGraph, entryDir: string, registryUrl: string, manifestsDir: string, target: PlatformTarget, onWarn: (message: string) => void): Promise<number>;
|
|
26
|
+
/**
|
|
27
|
+
* Parse a `--platform` value into a target. Accepts the familiar
|
|
28
|
+
* `os/arch[/libc]` shorthand (`linux/amd64`, `linux/arm64/musl`) in the same
|
|
29
|
+
* OCI/GOOS vocabulary the published selectors use. Omitted entirely, the host is
|
|
30
|
+
* the target.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parsePlatformTarget(value: string | undefined): PlatformTarget;
|
|
33
|
+
/** Label for the install output — `linux/amd64/gnu`, or what the host resolved
|
|
34
|
+
* to, with an unknown axis shown rather than hidden. */
|
|
35
|
+
export declare function describePlatformTarget(target: PlatformTarget): string;
|
|
36
|
+
//# sourceMappingURL=warm-layers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warm-layers.d.ts","sourceRoot":"","sources":["../../src/bundle/warm-layers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAS3B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAChC,OAAO,CAAC,MAAM,CAAC,CAwCjB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAY7E;AAED;yDACyD;AACzD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAIrE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { IntegrityError, } from "@telorun/analyzer";
|
|
2
|
+
import { defaultTransportRegistry, hostPlatformTarget, moduleArtifactFor, moduleDirectoryFor, readOwnerManifest, } from "@telorun/kernel";
|
|
3
|
+
/**
|
|
4
|
+
* Pre-materialize every module layer a `target` platform could need.
|
|
5
|
+
*
|
|
6
|
+
* This is `telo install`'s make-this-offline pass. `telo run` materializes layers
|
|
7
|
+
* lazily — a controller layer when its candidate wins resolution, an asset layer
|
|
8
|
+
* on first module-relative access — so warming here is an optimization, never a
|
|
9
|
+
* correctness requirement. That is the point of the change it replaces:
|
|
10
|
+
* previously a cold `telo run` failed outright because payloads landed on disk
|
|
11
|
+
* only after the load that needed them.
|
|
12
|
+
*
|
|
13
|
+
* `target` defaults to the host but is explicit so a baked image
|
|
14
|
+
* (`TELO_CACHE_DIR`) can be built from a machine of a different architecture —
|
|
15
|
+
* without it, cross-building a `linux/arm64` image on a darwin laptop would cache
|
|
16
|
+
* the wrong binaries.
|
|
17
|
+
*
|
|
18
|
+
* Best-effort per module for transient fetch failures (reported and skipped —
|
|
19
|
+
* the manifest is cached either way, and `run` will fetch what it needs). An
|
|
20
|
+
* integrity failure, a malformed layer index, and a tar entry escaping the module
|
|
21
|
+
* directory are all hard: a tampered or corrupt artifact must never be used, and
|
|
22
|
+
* a bad index is an authoring error the publisher has to fix.
|
|
23
|
+
*
|
|
24
|
+
* Returns the number of layers materialized.
|
|
25
|
+
*/
|
|
26
|
+
export async function warmModuleLayers(graph, entryDir, registryUrl, manifestsDir, target, onWarn) {
|
|
27
|
+
const transports = defaultTransportRegistry(registryUrl);
|
|
28
|
+
const seen = new Set();
|
|
29
|
+
let count = 0;
|
|
30
|
+
for (const [, module] of graph.modules) {
|
|
31
|
+
const file = module.owner;
|
|
32
|
+
if (seen.has(file.source))
|
|
33
|
+
continue;
|
|
34
|
+
seen.add(file.source);
|
|
35
|
+
// A malformed index is an authoring error the publisher must fix, so it
|
|
36
|
+
// propagates rather than being downgraded to a warning.
|
|
37
|
+
const artifact = moduleArtifactFor({
|
|
38
|
+
pinnedRef: file.requestedUrl,
|
|
39
|
+
layers: readOwnerManifest(file.text).layers,
|
|
40
|
+
moduleDir: moduleDirectoryFor(file.requestedUrl, file.source, entryDir, registryUrl, manifestsDir),
|
|
41
|
+
transports,
|
|
42
|
+
});
|
|
43
|
+
if (!artifact)
|
|
44
|
+
continue;
|
|
45
|
+
try {
|
|
46
|
+
count += (await artifact.materializeAll(target)).length;
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
if (err instanceof IntegrityError)
|
|
50
|
+
throw err;
|
|
51
|
+
const code = err?.code;
|
|
52
|
+
if (code === "ERR_MODULE_LAYER_INTEGRITY" || code === "ERR_MODULE_LAYER_INVALID")
|
|
53
|
+
throw err;
|
|
54
|
+
onWarn(`could not warm layers for ${file.requestedUrl}: ` +
|
|
55
|
+
(err instanceof Error ? err.message : String(err)));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return count;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Parse a `--platform` value into a target. Accepts the familiar
|
|
62
|
+
* `os/arch[/libc]` shorthand (`linux/amd64`, `linux/arm64/musl`) in the same
|
|
63
|
+
* OCI/GOOS vocabulary the published selectors use. Omitted entirely, the host is
|
|
64
|
+
* the target.
|
|
65
|
+
*/
|
|
66
|
+
export function parsePlatformTarget(value) {
|
|
67
|
+
if (!value)
|
|
68
|
+
return hostPlatformTarget();
|
|
69
|
+
const parts = value
|
|
70
|
+
.split("/")
|
|
71
|
+
.map((p) => p.trim().toLowerCase())
|
|
72
|
+
.filter((p) => p !== "");
|
|
73
|
+
if (parts.length < 2 || parts.length > 3) {
|
|
74
|
+
throw new Error(`--platform '${value}' is not an os/arch[/libc] triple, e.g. 'linux/amd64' or 'linux/arm64/musl'.`);
|
|
75
|
+
}
|
|
76
|
+
return { os: parts[0], arch: parts[1], ...(parts[2] ? { libc: parts[2] } : {}) };
|
|
77
|
+
}
|
|
78
|
+
/** Label for the install output — `linux/amd64/gnu`, or what the host resolved
|
|
79
|
+
* to, with an unknown axis shown rather than hidden. */
|
|
80
|
+
export function describePlatformTarget(target) {
|
|
81
|
+
return [target.os ?? "unknown", target.arch ?? "unknown", target.libc]
|
|
82
|
+
.filter((p) => p !== undefined)
|
|
83
|
+
.join("/");
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=warm-layers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warm-layers.js","sourceRoot":"","sources":["../../src/bundle/warm-layers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAIf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAkB,EAClB,QAAgB,EAChB,WAAmB,EACnB,YAAoB,EACpB,MAAsB,EACtB,MAAiC;IAEjC,MAAM,UAAU,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,MAAM,CAAC,EAAE,MA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C,KAAK;QAAE,OAAO,kBAAkB,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,KAAK;SAChB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAC3B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CACb,eAAe,KAAK,8EAA8E,CACnG,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACnF,CAAC;AAED;yDACyD;AACzD,MAAM,UAAU,sBAAsB,CAAC,MAAsB;IAC3D,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,SAAS,EAAE,MAAM,CAAC,IAAI,IAAI,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC;SACnE,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC;SAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAuOlC,wBAAsB,OAAO,CAAC,IAAI,EAAE;IAClC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CA4BhD"}
|
package/dist/commands/install.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Loader, flattenForAnalyzer } from "@telorun/analyzer";
|
|
|
2
2
|
import { ControllerLoader, Kernel, LocalFileSource, LocalManifestCacheSource, defaultTransportRegistry, resolveCacheRoot, resolveEntryDir, writeManifestCache, } from "@telorun/kernel";
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import { pathToFileURL } from "url";
|
|
5
|
-
import {
|
|
5
|
+
import { describePlatformTarget, parsePlatformTarget, warmModuleLayers, } from "../bundle/warm-layers.js";
|
|
6
6
|
import { createLogger } from "../logger.js";
|
|
7
7
|
const DEFAULT_REGISTRY_URL = "https://registry.telo.run";
|
|
8
8
|
/**
|
|
@@ -69,7 +69,7 @@ async function warmAnalysisCache(entryPath, entryDir, registryUrl, log, cacheRoo
|
|
|
69
69
|
(err instanceof Error ? err.message : String(err)));
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
async function installOne(inputPath, registryUrl, log) {
|
|
72
|
+
async function installOne(inputPath, registryUrl, platform, log) {
|
|
73
73
|
const isUrl = inputPath.startsWith("http://") || inputPath.startsWith("https://");
|
|
74
74
|
const entryPath = isUrl ? inputPath : path.resolve(process.cwd(), inputPath);
|
|
75
75
|
const displayPath = isUrl ? entryPath : path.relative(process.cwd(), entryPath);
|
|
@@ -114,9 +114,12 @@ async function installOne(inputPath, registryUrl, log) {
|
|
|
114
114
|
if (written.length > 0) {
|
|
115
115
|
console.log(` ${log.ok("✓")} cached ${written.length} manifest${written.length !== 1 ? "s" : ""} to ${log.dim(path.relative(process.cwd(), manifestsDir))}`);
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
// Warm every layer this target could need. `run` fetches lazily, so this
|
|
118
|
+
// is purely so a later run (or a baked image) needs no network.
|
|
119
|
+
const warmed = await warmModuleLayers(graph, entryDir, registryUrl, manifestsDir, platform, (msg) => console.error(` ${log.warn("⚠")} ${msg}`));
|
|
120
|
+
if (warmed > 0) {
|
|
121
|
+
console.log(` ${log.ok("✓")} materialized ${warmed} module layer${warmed !== 1 ? "s" : ""} ` +
|
|
122
|
+
`for ${log.dim(describePlatformTarget(platform))}`);
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
125
|
catch (err) {
|
|
@@ -176,6 +179,16 @@ async function installOne(inputPath, registryUrl, log) {
|
|
|
176
179
|
}
|
|
177
180
|
export async function install(argv) {
|
|
178
181
|
const log = createLogger(false);
|
|
182
|
+
// The platform whose layers get warmed. Explicit so a baked image can be built
|
|
183
|
+
// from a machine of a different architecture; the host otherwise.
|
|
184
|
+
let platform;
|
|
185
|
+
try {
|
|
186
|
+
platform = parsePlatformTarget(argv.platform);
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
console.error(log.error("error") + ` ${err instanceof Error ? err.message : String(err)}`);
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
179
192
|
// Same fallback chain as `telo run`: --registry-url > TELO_REGISTRY_URL >
|
|
180
193
|
// built-in default. The configured URL drives both the network fetches and
|
|
181
194
|
// the on-disk cache layout — registry-served manifests are keyed under
|
|
@@ -184,7 +197,7 @@ export async function install(argv) {
|
|
|
184
197
|
const registryUrl = argv.registryUrl ?? process.env.TELO_REGISTRY_URL ?? DEFAULT_REGISTRY_URL;
|
|
185
198
|
let failed = false;
|
|
186
199
|
for (const p of argv.paths) {
|
|
187
|
-
const ok = await installOne(p, registryUrl, log);
|
|
200
|
+
const ok = await installOne(p, registryUrl, platform, log);
|
|
188
201
|
if (!ok)
|
|
189
202
|
failed = true;
|
|
190
203
|
}
|
|
@@ -202,6 +215,12 @@ export function installCommand(yargs) {
|
|
|
202
215
|
.option("registry-url", {
|
|
203
216
|
type: "string",
|
|
204
217
|
describe: "Base URL for the telo module registry. Overrides TELO_REGISTRY_URL.",
|
|
218
|
+
})
|
|
219
|
+
.option("platform", {
|
|
220
|
+
type: "string",
|
|
221
|
+
describe: "Platform whose module layers to pre-fetch, as os/arch[/libc] " +
|
|
222
|
+
"(e.g. linux/amd64, linux/arm64/musl). Defaults to the host — set it " +
|
|
223
|
+
"when baking an image for a different architecture.",
|
|
205
224
|
}), async (argv) => {
|
|
206
225
|
await install(argv);
|
|
207
226
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AACpF,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AAEzD,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAWzD;;;;GAIG;AACH,SAAS,qBAAqB,CAAC,SAA6B;IAC1D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC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2DAA2D;IAC3D,MAAM,WAAW,GACf,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,oBAAoB,CAAC;IAE5E,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC3D,IAAI,CAAC,EAAE;YAAE,MAAM,GAAG,IAAI,CAAC;IACzB,CAAC;IAED,IAAI,MAAM;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAW;IACxC,OAAO,KAAK,CAAC,OAAO,CAClB,mBAAmB,EACnB,4FAA4F,EAC5F,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC;SACE,UAAU,CAAC,OAAO,EAAE;QACnB,QAAQ,EAAE,4EAA4E;QACtF,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,IAAI;KACnB,CAAC;SACD,MAAM,CAAC,cAAc,EAAE;QACtB,IAAI,EAAE,QAAQ;QACd,QAAQ,EACN,qEAAqE;KACxE,CAAC;SACD,MAAM,CAAC,UAAU,EAAE;QAClB,IAAI,EAAE,QAAQ;QACd,QAAQ,EACN,+DAA+D;YAC/D,sEAAsE;YACtE,oDAAoD;KACvD,CAAC,EACN,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,OAAO,CAAC,IAAW,CAAC,CAAC;IAC7B,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -6,6 +6,9 @@ import type { BumpLevel } from "../publishers/interface.js";
|
|
|
6
6
|
export declare function expandAndInlineIncludes(content: string, manifestDir: string): string;
|
|
7
7
|
/** Read the first doc's `files:` glob patterns (empty when none declared). */
|
|
8
8
|
export declare function readFilesPatterns(content: string): string[];
|
|
9
|
+
/** Read the first doc's `assets:` glob patterns — the author-claimed subset of
|
|
10
|
+
* `files:` that ships in the lazily materialized asset layer. */
|
|
11
|
+
export declare function readAssetPatterns(content: string): string[];
|
|
9
12
|
export declare function canonicalizeRelativeImports(content: string, manifestPath: string, destination: string, loader: Loader, localFileSource: LocalFileSource): Promise<{
|
|
10
13
|
content: string;
|
|
11
14
|
refs: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6B,MAAM,EAAsD,MAAM,mBAAmB,CAAC;AAC1H,OAAO,EAAE,eAAe,EAA4B,MAAM,iBAAiB,CAAC;AAI5E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6B,MAAM,EAAsD,MAAM,mBAAmB,CAAC;AAC1H,OAAO,EAAE,eAAe,EAA4B,MAAM,iBAAiB,CAAC;AAI5E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAA2C,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,4BAA4B,CAAC;AA8F9E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAyDpF;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAE3D;AAED;kEACkE;AAClE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAE3D;AAqBD,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,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