@akanjs/devkit 3.3.0-rc.1 → 3.3.0-rc.11
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/CHANGELOG.md +230 -2
- package/README.ko.md +3 -2
- package/README.md +3 -3
- package/akanApp/akanApp.host.test.ts +22 -5
- package/akanApp/akanApp.host.ts +46 -9
- package/akanApp/akanApp.host.wiring.test.ts +206 -2
- package/akanApp/devBackend.ts +3 -1
- package/akanApp/devBuilder.ts +5 -1
- package/akanApp/devStartTimeline.test.ts +115 -0
- package/akanApp/devStartTimeline.ts +69 -0
- package/akanConfig/akanConfig.test.ts +57 -8
- package/akanConfig/akanConfig.ts +12 -65
- package/akanConfig/dockerImage.ts +17 -0
- package/akanConfig/nativeKeys.ts +52 -0
- package/app/applicationBuildRunner.test.ts +49 -1
- package/app/applicationBuildRunner.ts +3 -1
- package/codeAgent/agent/CodeAgent.ts +36 -16
- package/codeAgent/agent/CodeAgentAllowed.ts +35 -0
- package/codeAgent/agent/CodeAgentCommandLine.ts +372 -0
- package/codeAgent/agent/CodeAgentGate.ts +23 -4
- package/codeAgent/agent/CodeAgentRpcHost.ts +1 -1
- package/codeAgent/agent/codeAgent.test.ts +62 -0
- package/codeAgent/agent/codeAgentCommandLine.test.ts +212 -0
- package/codeAgent/agent/codeAgentContract.test.ts +117 -5
- package/codeAgent/skills/akan-agent/SKILL.md +8 -1
- package/codeAgent/skills/akan-code/SKILL.md +38 -3
- package/codeAgent/skills/akan-page/SKILL.md +18 -13
- package/codeAgent/skills/akan-runtime/SKILL.md +21 -16
- package/codeAgent/skills/akan-service/SKILL.md +2 -2
- package/docs/apiReference.test.ts +5 -0
- package/docs/apiReference.ts +7 -3
- package/docs/declarationReader.ts +28 -1
- package/executors/appExecutor.ts +35 -11
- package/executors/executors.test.ts +30 -3
- package/frontendBuild/buildCacheStamp.test.ts +42 -0
- package/frontendBuild/buildCacheStamp.ts +23 -0
- package/frontendBuild/buildRouteClient.test.ts +2 -7
- package/frontendBuild/clientEntryDiscovery.ts +2 -2
- package/frontendBuild/cssCandidateCache.test.ts +70 -1
- package/frontendBuild/cssCandidateCache.ts +17 -10
- package/frontendBuild/cssCompiler.test.ts +112 -0
- package/frontendBuild/cssCompiler.ts +41 -21
- package/frontendBuild/devBarrelImports.test.ts +30 -0
- package/frontendBuild/devBarrelImports.ts +2 -2
- package/frontendBuild/fontOptimizer.test.ts +144 -3
- package/frontendBuild/fontOptimizer.ts +103 -18
- package/frontendBuild/pagesBundleBuilder.ts +3 -1
- package/frontendBuild/plainStylesheet.test.ts +155 -0
- package/frontendBuild/plainStylesheet.ts +197 -0
- package/frontendBuild/rscServerRendererGuard.test.ts +60 -0
- package/frontendBuild/rscServerRendererGuard.ts +68 -0
- package/frontendBuild/ssrBaseArtifactBuilder.test.ts +30 -1
- package/frontendBuild/ssrBaseArtifactBuilder.ts +40 -12
- package/guideline/agentAssets.test.ts +10 -0
- package/guideline/agentAssets.ts +52 -11
- package/incrementalBuilder/buildBatch.proc.ts +11 -10
- package/incrementalBuilder/buildBatchProtocol.ts +2 -1
- package/incrementalBuilder/builderBoot.ts +14 -7
- package/incrementalBuilder/builderChannel.ts +8 -2
- package/incrementalBuilder/builderGraphPayloads.ts +4 -4
- package/incrementalBuilder/builderLanes.ts +2 -2
- package/incrementalBuilder/builderWatch.ts +8 -8
- package/incrementalBuilder/csrRegistry.ts +4 -4
- package/incrementalBuilder/incrementalBuilder.host.test.ts +16 -0
- package/incrementalBuilder/incrementalBuilder.host.ts +7 -1
- package/incrementalBuilder/incrementalBuilder.proc.test.ts +41 -0
- package/incrementalBuilder/incrementalBuilder.proc.ts +9 -8
- package/incrementalBuilder/ssrRegistry.ts +6 -6
- package/index.ts +1 -1
- package/integration/renderAdmissionSoak.test.ts +99 -0
- package/integration/renderAdmissionSoak.ts +609 -0
- package/mobile/nativeConfig.test.ts +100 -0
- package/mobile/nativeConfig.ts +55 -16
- package/mobile/nativePublicEnv.ts +2 -1
- package/package.json +14 -169
- package/packageExports.test.ts +38 -24
- package/transforms/barrelAnalyzer.ts +2 -2
- package/transforms/transforms.test.ts +3 -3
- package/tunnel/createTunnel.test.ts +29 -8
- package/tunnel/createTunnel.ts +18 -11
- package/util/fileEditor.ts +1 -0
- package/util/fileSys.test.ts +13 -0
- package/util/fileSys.ts +2 -2
- package/util/selectModel.ts +1 -0
- package/workspace/getRelatedCnsts.ts +7 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
export interface LoadedStylesheet {
|
|
2
|
+
path: string;
|
|
3
|
+
base: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type StylesheetLoader = (id: string, fromBase: string) => Promise<LoadedStylesheet>;
|
|
8
|
+
|
|
9
|
+
interface ImportConditions {
|
|
10
|
+
layer: string | null;
|
|
11
|
+
supports: string | null;
|
|
12
|
+
media: string | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface PlainImport extends ImportConditions {
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
uri: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Every at-rule Tailwind v4's `compile()` acts on (`parseCss`, `substituteAtImports`, `registerPlugins`, `@apply`).
|
|
22
|
+
const TAILWIND_AT_RULES = new Set([
|
|
23
|
+
"@tailwind",
|
|
24
|
+
"@apply",
|
|
25
|
+
"@plugin",
|
|
26
|
+
"@config",
|
|
27
|
+
"@theme",
|
|
28
|
+
"@utility",
|
|
29
|
+
"@variant",
|
|
30
|
+
"@custom-variant",
|
|
31
|
+
"@slot",
|
|
32
|
+
"@source",
|
|
33
|
+
"@reference",
|
|
34
|
+
]);
|
|
35
|
+
// Tailwind's own test (`theme\(` also covers `--theme(`), run over declaration values and media/supports params.
|
|
36
|
+
const TAILWIND_FUNCTION_RE = /(?:--alpha|--spacing|theme)\(/;
|
|
37
|
+
// `@import "x" theme(…)`, `source(…)`, `prefix(…)`, `important` and `reference` become Tailwind-only `@media` params.
|
|
38
|
+
const TAILWIND_CONDITION_RE = /\b(?:source|prefix|theme)\(|(?:^|\s)(?:important|reference)(?=\s|$)/i;
|
|
39
|
+
const TAILWIND_PACKAGE_RE = /^tailwindcss(?:\/|$)/;
|
|
40
|
+
const REMOTE_URI_RE = /^(?:data:|https?:\/\/)/i;
|
|
41
|
+
const COMMENT_RE = /\/\*[\s\S]*?\*\//g;
|
|
42
|
+
const AT_KEYWORD_RE = /@[\w-]+/y;
|
|
43
|
+
const QUOTED_IMPORT_RE = /^\s*(["'])((?:\\[\s\S]|(?!\1)[^\\\n])*)\1([\s\S]*)$/;
|
|
44
|
+
const LAYER_RE = /^layer(?:\(\s*([^()]*?)\s*\))?(?![\w(-])/i;
|
|
45
|
+
const MAX_IMPORT_DEPTH = 100;
|
|
46
|
+
|
|
47
|
+
interface OpenAtRule {
|
|
48
|
+
name: string;
|
|
49
|
+
start: number;
|
|
50
|
+
preludeStart: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type AtRuleVerdict = (ImportConditions & { uri: string }) | "tailwind" | "plain";
|
|
54
|
+
|
|
55
|
+
export class PlainStylesheet {
|
|
56
|
+
static async bundle(css: string, base: string, load: StylesheetLoader, depth = 0): Promise<string | null> {
|
|
57
|
+
//? Past Tailwind's own depth limit (an import cycle), `compile()` runs instead and reports it.
|
|
58
|
+
if (depth > MAX_IMPORT_DEPTH) return null;
|
|
59
|
+
const imports = PlainStylesheet.scan(css);
|
|
60
|
+
if (!imports) return null;
|
|
61
|
+
const parts: string[] = [];
|
|
62
|
+
let cursor = 0;
|
|
63
|
+
for (const rule of imports) {
|
|
64
|
+
const loaded = await load(rule.uri, base);
|
|
65
|
+
const inner = await PlainStylesheet.bundle(loaded.content, loaded.base, load, depth + 1);
|
|
66
|
+
if (inner === null) return null;
|
|
67
|
+
parts.push(css.slice(cursor, rule.start), PlainStylesheet.#wrap(inner, rule));
|
|
68
|
+
cursor = rule.end;
|
|
69
|
+
}
|
|
70
|
+
parts.push(css.slice(cursor));
|
|
71
|
+
return parts.join("");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static scan(css: string): PlainImport[] | null {
|
|
75
|
+
const imports: PlainImport[] = [];
|
|
76
|
+
const code: string[] = [];
|
|
77
|
+
let segmentStart = 0;
|
|
78
|
+
let parenDepth = 0;
|
|
79
|
+
let braceDepth = 0;
|
|
80
|
+
let atRule: OpenAtRule | null = null;
|
|
81
|
+
let idx = 0;
|
|
82
|
+
while (idx < css.length) {
|
|
83
|
+
const char = css[idx];
|
|
84
|
+
if (char === "/" && css[idx + 1] === "*") {
|
|
85
|
+
const end = css.indexOf("*/", idx + 2);
|
|
86
|
+
if (end === -1) return null;
|
|
87
|
+
code.push(css.slice(segmentStart, idx));
|
|
88
|
+
idx = segmentStart = end + 2;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (char === "\\") {
|
|
92
|
+
idx += 2;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (char === '"' || char === "'") {
|
|
96
|
+
code.push(css.slice(segmentStart, idx));
|
|
97
|
+
idx = segmentStart = PlainStylesheet.#skipString(css, idx);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (char === "@" && !atRule && parenDepth === 0) {
|
|
101
|
+
AT_KEYWORD_RE.lastIndex = idx;
|
|
102
|
+
const keyword = AT_KEYWORD_RE.exec(css);
|
|
103
|
+
if (keyword) {
|
|
104
|
+
const name = keyword[0].toLowerCase();
|
|
105
|
+
if (TAILWIND_AT_RULES.has(name)) return null;
|
|
106
|
+
atRule = { name, start: idx, preludeStart: idx + keyword[0].length };
|
|
107
|
+
idx += keyword[0].length;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (char === "(") parenDepth += 1;
|
|
112
|
+
else if (char === ")") parenDepth = Math.max(0, parenDepth - 1);
|
|
113
|
+
else if (parenDepth === 0 && (char === ";" || char === "{" || char === "}")) {
|
|
114
|
+
if (atRule && !PlainStylesheet.#closeAtRule(css, atRule, idx, char, imports)) return null;
|
|
115
|
+
atRule = null;
|
|
116
|
+
braceDepth += char === "{" ? 1 : char === "}" ? -1 : 0;
|
|
117
|
+
if (braceDepth < 0) return null;
|
|
118
|
+
}
|
|
119
|
+
idx += 1;
|
|
120
|
+
}
|
|
121
|
+
if (atRule && !PlainStylesheet.#closeAtRule(css, atRule, css.length, "", imports)) return null;
|
|
122
|
+
if (braceDepth !== 0 || parenDepth !== 0) return null;
|
|
123
|
+
code.push(css.slice(segmentStart));
|
|
124
|
+
return TAILWIND_FUNCTION_RE.test(code.join(" ")) ? null : imports;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
static #closeAtRule(css: string, atRule: OpenAtRule, end: number, terminator: string, imports: PlainImport[]) {
|
|
128
|
+
const prelude = css.slice(atRule.preludeStart, end).replace(COMMENT_RE, " ");
|
|
129
|
+
const verdict = PlainStylesheet.#readAtRule(atRule.name, prelude, terminator === "{");
|
|
130
|
+
if (verdict === "tailwind") return false;
|
|
131
|
+
if (verdict !== "plain") imports.push({ ...verdict, start: atRule.start, end: terminator === ";" ? end + 1 : end });
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static #readAtRule(name: string, prelude: string, opensBlock: boolean): AtRuleVerdict {
|
|
136
|
+
if (name === "@media") return TAILWIND_CONDITION_RE.test(prelude) ? "tailwind" : "plain";
|
|
137
|
+
if (name !== "@import") return "plain";
|
|
138
|
+
const match = QUOTED_IMPORT_RE.exec(prelude);
|
|
139
|
+
//? Tailwind leaves an `@import url(…)` where it stands, so this does too.
|
|
140
|
+
if (!match) return "plain";
|
|
141
|
+
const [, , uri = "", rest = ""] = match;
|
|
142
|
+
if (TAILWIND_PACKAGE_RE.test(uri) || TAILWIND_CONDITION_RE.test(rest) || opensBlock) return "tailwind";
|
|
143
|
+
if (REMOTE_URI_RE.test(uri)) return "plain";
|
|
144
|
+
const conditions = PlainStylesheet.#parseConditions(rest.trim());
|
|
145
|
+
return conditions ? { uri, ...conditions } : "tailwind";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
static #parseConditions(text: string): ImportConditions | null {
|
|
149
|
+
let rest = text;
|
|
150
|
+
let layer: string | null = null;
|
|
151
|
+
let supports: string | null = null;
|
|
152
|
+
const layerMatch = LAYER_RE.exec(rest);
|
|
153
|
+
if (layerMatch) {
|
|
154
|
+
layer = layerMatch[1] ?? "";
|
|
155
|
+
rest = rest.slice(layerMatch[0].length).trim();
|
|
156
|
+
}
|
|
157
|
+
if (/^supports\(/i.test(rest)) {
|
|
158
|
+
const close = PlainStylesheet.#closingParen(rest, "supports".length);
|
|
159
|
+
if (close === -1) return null;
|
|
160
|
+
supports = rest.slice("supports(".length, close).trim();
|
|
161
|
+
rest = rest.slice(close + 1).trim();
|
|
162
|
+
}
|
|
163
|
+
if (/["']|\burl\(|\blayer\b|\bsupports\(/i.test(rest)) return null;
|
|
164
|
+
return { layer, supports, media: rest || null };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
static #closingParen(text: string, open: number): number {
|
|
168
|
+
let depth = 0;
|
|
169
|
+
for (let idx = open; idx < text.length; idx++) {
|
|
170
|
+
if (text[idx] === "(") depth += 1;
|
|
171
|
+
else if (text[idx] === ")" && --depth === 0) return idx;
|
|
172
|
+
}
|
|
173
|
+
return -1;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
static #wrap(css: string, { layer, media, supports }: PlainImport): string {
|
|
177
|
+
let wrapped = css;
|
|
178
|
+
if (layer !== null) wrapped = `@layer${layer ? ` ${layer}` : ""} {\n${wrapped}\n}`;
|
|
179
|
+
if (media !== null) wrapped = `@media ${media} {\n${wrapped}\n}`;
|
|
180
|
+
if (supports !== null)
|
|
181
|
+
wrapped = `@supports ${supports.startsWith("(") ? supports : `(${supports})`} {\n${wrapped}\n}`;
|
|
182
|
+
return wrapped;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
static #skipString(css: string, start: number): number {
|
|
186
|
+
const quote = css[start];
|
|
187
|
+
let idx = start + 1;
|
|
188
|
+
while (idx < css.length) {
|
|
189
|
+
const char = css[idx];
|
|
190
|
+
if (char === "\\") idx += 2;
|
|
191
|
+
else if (char === quote) return idx + 1;
|
|
192
|
+
else if (char === "\n") return idx;
|
|
193
|
+
else idx += 1;
|
|
194
|
+
}
|
|
195
|
+
return css.length;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
|
2
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { RscServerRendererGuard } from "./rscServerRendererGuard";
|
|
6
|
+
|
|
7
|
+
let root = "";
|
|
8
|
+
|
|
9
|
+
const files = {
|
|
10
|
+
"renderer.ts": `import { renderToReadableStream } from "react-dom/server.edge";\nexport const render = () => renderToReadableStream;\n`,
|
|
11
|
+
"server.ts": `import { render } from "./renderer";\nexport const boot = () => render;\nexport const migrations = ["m1"];\n`,
|
|
12
|
+
"service.ts": `export const report = async () => (await import("./server")).migrations;\n`,
|
|
13
|
+
"dynamicPage.ts": `import { report } from "./service";\nexport const page = () => report;\n`,
|
|
14
|
+
"lazyRenderer.ts": `export const render = async () => (await import("react-dom/server.browser")).renderToReadableStream;\n`,
|
|
15
|
+
"lazyPage.ts": `import { render } from "./lazyRenderer";\nexport const page = () => render;\n`,
|
|
16
|
+
"plainPage.ts": `export const page = () => "plain";\n`,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const metafileOf = async (entry: string) => {
|
|
20
|
+
const result = await Bun.build({
|
|
21
|
+
entrypoints: [path.join(root, entry)],
|
|
22
|
+
outdir: path.join(root, "out", entry),
|
|
23
|
+
target: "bun",
|
|
24
|
+
format: "esm",
|
|
25
|
+
metafile: true,
|
|
26
|
+
external: ["react-dom/*"],
|
|
27
|
+
});
|
|
28
|
+
expect(result.success).toBe(true);
|
|
29
|
+
return result.metafile;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
beforeAll(async () => {
|
|
33
|
+
root = await mkdtemp(path.join(tmpdir(), "rsc-guard-"));
|
|
34
|
+
for (const [file, source] of Object.entries(files)) await writeFile(path.join(root, file), source);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
afterAll(async () => {
|
|
38
|
+
await rm(root, { recursive: true, force: true });
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe("RscServerRendererGuard", () => {
|
|
42
|
+
test("names the chain from the page through the dynamic import of the server entry to the renderer", async () => {
|
|
43
|
+
const assertion = (async () => RscServerRendererGuard.assert(await metafileOf("dynamicPage.ts"), root))();
|
|
44
|
+
|
|
45
|
+
await expect(assertion).rejects.toThrow(
|
|
46
|
+
[
|
|
47
|
+
"where that import throws. It is reached through:",
|
|
48
|
+
" dynamicPage.ts",
|
|
49
|
+
" → service.ts",
|
|
50
|
+
" → import() server.ts",
|
|
51
|
+
" → renderer.ts",
|
|
52
|
+
].join("\n"),
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("passes a page whose renderer import waits inside a function, and one that reaches no renderer", async () => {
|
|
57
|
+
for (const entry of ["lazyPage.ts", "plainPage.ts"])
|
|
58
|
+
expect(RscServerRendererGuard.offenders((await metafileOf(entry)) as Bun.BuildMetafile)).toEqual([]);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
interface ImportEdge {
|
|
5
|
+
from: string;
|
|
6
|
+
dynamic: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//? Every `react-dom/server` entry resolves to `server.react-server.js` under the react-server condition, which throws.
|
|
10
|
+
const SERVER_RENDERER_RE = /^react-dom\/server(?:\.\w+)?$/;
|
|
11
|
+
|
|
12
|
+
export class RscServerRendererGuard {
|
|
13
|
+
//? Bun keeps an external `import` after tree-shaking drops its bindings, and hoists one out of a lazily wrapped module.
|
|
14
|
+
static offenders(metafile: Bun.BuildMetafile): { input: string; specifier: string }[] {
|
|
15
|
+
const offenders: { input: string; specifier: string }[] = [];
|
|
16
|
+
const included = new Set(
|
|
17
|
+
Object.values(metafile.outputs).flatMap((output) =>
|
|
18
|
+
Object.entries(output.inputs)
|
|
19
|
+
.filter(([, { bytesInOutput }]) => bytesInOutput > 0)
|
|
20
|
+
.map(([input]) => input),
|
|
21
|
+
),
|
|
22
|
+
);
|
|
23
|
+
for (const input of included)
|
|
24
|
+
for (const edge of metafile.inputs[input]?.imports ?? [])
|
|
25
|
+
if (edge.external && edge.kind === "import-statement" && SERVER_RENDERER_RE.test(edge.path))
|
|
26
|
+
offenders.push({ input, specifier: edge.path });
|
|
27
|
+
return offenders;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static chain(metafile: Bun.BuildMetafile, target: string): { input: string; dynamic: boolean }[] {
|
|
31
|
+
const entries = Object.values(metafile.outputs).flatMap((output) => (output.entryPoint ? [output.entryPoint] : []));
|
|
32
|
+
const reached = new Map<string, ImportEdge | null>(entries.map((entry) => [entry, null]));
|
|
33
|
+
const queue = [...entries];
|
|
34
|
+
for (let input = queue.shift(); input !== undefined && !reached.has(target); input = queue.shift())
|
|
35
|
+
for (const edge of metafile.inputs[input]?.imports ?? []) {
|
|
36
|
+
if (edge.external || reached.has(edge.path)) continue;
|
|
37
|
+
reached.set(edge.path, {
|
|
38
|
+
from: input,
|
|
39
|
+
dynamic: edge.kind === "dynamic-import" || edge.kind === "require-call",
|
|
40
|
+
});
|
|
41
|
+
queue.push(edge.path);
|
|
42
|
+
}
|
|
43
|
+
const chain: { input: string; dynamic: boolean }[] = [];
|
|
44
|
+
for (let input: string | undefined = target; input !== undefined; ) {
|
|
45
|
+
const edge: ImportEdge | null | undefined = reached.get(input);
|
|
46
|
+
chain.unshift({ input, dynamic: edge?.dynamic ?? false });
|
|
47
|
+
input = edge?.from;
|
|
48
|
+
}
|
|
49
|
+
return chain;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static assert(metafile: Bun.BuildMetafile | undefined, workspaceRoot: string) {
|
|
53
|
+
const [offender] = metafile ? RscServerRendererGuard.offenders(metafile) : [];
|
|
54
|
+
if (!metafile || !offender) return;
|
|
55
|
+
const root = realpathSync(workspaceRoot);
|
|
56
|
+
const shown = (input: string) => path.relative(root, path.resolve(input)) || input;
|
|
57
|
+
const lines = RscServerRendererGuard.chain(metafile, offender.input).map(
|
|
58
|
+
({ input, dynamic }, idx) => ` ${idx === 0 ? "" : dynamic ? "→ import() " : "→ "}${shown(input)}`,
|
|
59
|
+
);
|
|
60
|
+
throw new Error(
|
|
61
|
+
[
|
|
62
|
+
`[PagesBundleBuilder] The server pages bundle imports ${offender.specifier} as it loads, and the RSC worker runs under the react-server condition, where that import throws. It is reached through:`,
|
|
63
|
+
...lines,
|
|
64
|
+
"A module in the page graph that imports the app's server entry, or anything that starts the server, brings the SSR renderer with it: import only what that module uses, or hand it in from the code that boots the server.",
|
|
65
|
+
].join("\n"),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
1
|
+
import { describe, expect, spyOn, test } from "bun:test";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { mkdtemp, readdir, rm } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import type { BaseBuildArtifact } from "akanjs/server";
|
|
2
7
|
import { SsrBaseArtifactBuilder } from "./ssrBaseArtifactBuilder";
|
|
3
8
|
|
|
9
|
+
describe("SsrBaseArtifactBuilder.writeArtifact", () => {
|
|
10
|
+
test("writes beside the final path and renames into it, so a reader never finds a half-written artifact", async () => {
|
|
11
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "akan-base-artifact-"));
|
|
12
|
+
const finalPath = path.join(dir, "base-artifact.json");
|
|
13
|
+
const artifact = { domains: ["a.example.com"], pagesBundlePath: "/app/pages.js" } as unknown as BaseBuildArtifact;
|
|
14
|
+
const write = Bun.write;
|
|
15
|
+
const seen: { target: string; finalExisted: boolean }[] = [];
|
|
16
|
+
const written = spyOn(Bun, "write").mockImplementation(((target: string, data: string) => {
|
|
17
|
+
seen.push({ target: String(target), finalExisted: existsSync(finalPath) });
|
|
18
|
+
return write(target, data);
|
|
19
|
+
}) as typeof Bun.write);
|
|
20
|
+
try {
|
|
21
|
+
await SsrBaseArtifactBuilder.writeArtifact(dir, artifact);
|
|
22
|
+
} finally {
|
|
23
|
+
written.mockRestore();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
expect(seen).toEqual([{ target: `${finalPath}.tmp`, finalExisted: false }]);
|
|
27
|
+
expect(await Bun.file(finalPath).json()).toEqual(artifact);
|
|
28
|
+
expect(await readdir(dir)).toEqual(["base-artifact.json"]);
|
|
29
|
+
await rm(dir, { recursive: true, force: true });
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
4
33
|
describe("SsrBaseArtifactBuilder.outletModuleMap", () => {
|
|
5
34
|
const outlet = "pkgs/akanjs/server/rscSegmentOutlet.tsx";
|
|
6
35
|
const ssrOutput = "/dist/client-ssr/rscSegmentOutlet.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { rename } from "node:fs/promises";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { optimize } from "@tailwindcss/node";
|
|
3
4
|
import type { AkanNativeAppId, AkanWebConfig } from "akanjs";
|
|
@@ -16,12 +17,15 @@ import type { RuntimeChunks } from "./routeModulePreloads";
|
|
|
16
17
|
import { VendorNarrowing } from "./vendorNarrowing";
|
|
17
18
|
import type { VendorSpecifier } from "./vendorSpecifiers";
|
|
18
19
|
|
|
20
|
+
export type BaseBuildPhase = "runtime" | "routes" | "styles" | "dictionary" | "pages" | "total";
|
|
21
|
+
|
|
19
22
|
export interface BuildSsrBaseArtifactResult {
|
|
20
23
|
artifact: BaseBuildArtifact;
|
|
21
24
|
seedIndex: RouteSeedIndex;
|
|
22
25
|
cssCompiler: CssCompiler;
|
|
23
26
|
optimizedFonts: Awaited<ReturnType<FontOptimizer["optimize"]>>;
|
|
24
27
|
runtimeChunks: RuntimeChunks;
|
|
28
|
+
phaseMs: Record<BaseBuildPhase, number>;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
export function prepareCssAsset(command: "build" | "start", basePath: string, cssText: string): string {
|
|
@@ -65,15 +69,31 @@ export class SsrBaseArtifactBuilder {
|
|
|
65
69
|
|
|
66
70
|
async build(): Promise<BuildSsrBaseArtifactResult> {
|
|
67
71
|
const akanConfig = await this.#app.getConfig();
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
const phaseMs = { runtime: 0, routes: 0, styles: 0, dictionary: 0, pages: 0, total: 0 };
|
|
73
|
+
const timed = async <T>(phase: BaseBuildPhase, run: () => Promise<T>): Promise<T> => {
|
|
74
|
+
const started = performance.now();
|
|
75
|
+
try {
|
|
76
|
+
return await run();
|
|
77
|
+
} finally {
|
|
78
|
+
phaseMs[phase] = Math.round(performance.now() - started);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const { rscClientUrl, rscRuntimeClientManifest, rscRuntimeSsrManifest, vendorMap, runtimeChunks } = await timed(
|
|
82
|
+
"runtime",
|
|
83
|
+
() => this.#buildRuntimeClientEntries(),
|
|
84
|
+
);
|
|
85
|
+
const pageEntries = await timed("routes", async () => {
|
|
86
|
+
const pageKeys = await this.#app.getPageKeys();
|
|
87
|
+
this.#app.verbose(`[base-artifact] discovered ${pageKeys.length} route files under ${this.#app.cwdPath}/page`);
|
|
88
|
+
return await resolveSsrPageEntriesForApp(this.#app, pageKeys);
|
|
89
|
+
});
|
|
90
|
+
const { cssCompiler, optimizedFonts, cssAssets } = await timed("styles", () => this.#buildStyleAssets());
|
|
91
|
+
const dictAssets = await timed("dictionary", () =>
|
|
92
|
+
new DictionaryAssetBuilder(this.#app, this.#absArtifactDir).build(akanConfig.i18n),
|
|
93
|
+
);
|
|
94
|
+
const pagesBundle = await timed("pages", () =>
|
|
95
|
+
new PagesBundleBuilder(this.#app, this.#command, pageEntries, this.#serverEnv).build(),
|
|
96
|
+
);
|
|
77
97
|
this.#app.verbose(
|
|
78
98
|
`[base-artifact] pages bundle -> ${pagesBundle.bundlePath} (buildId=${pagesBundle.buildId}, splitting=${pagesBundle.splitting}, entry=${pagesBundle.entryBytes} bytes, outputs=${pagesBundle.outputCount}, chunks=${pagesBundle.chunkCount}, total=${pagesBundle.outputBytes} bytes)`,
|
|
79
99
|
);
|
|
@@ -118,10 +138,18 @@ export class SsrBaseArtifactBuilder {
|
|
|
118
138
|
androidSha256CertFingerprints: target.android?.sha256CertFingerprints,
|
|
119
139
|
})),
|
|
120
140
|
};
|
|
121
|
-
await
|
|
122
|
-
|
|
141
|
+
await SsrBaseArtifactBuilder.writeArtifact(this.#absArtifactDir, artifact);
|
|
142
|
+
phaseMs.total = Date.now() - this.#started;
|
|
143
|
+
this.#app.verbose(`[base-artifact] complete in ${phaseMs.total}ms`);
|
|
144
|
+
|
|
145
|
+
return { artifact, seedIndex, cssCompiler, optimizedFonts, runtimeChunks, phaseMs };
|
|
146
|
+
}
|
|
123
147
|
|
|
124
|
-
|
|
148
|
+
//? Renamed into place, last: a dev backend booted beside this build starts on the file the moment it exists.
|
|
149
|
+
static async writeArtifact(absArtifactDir: string, artifact: BaseBuildArtifact): Promise<void> {
|
|
150
|
+
const artifactPath = path.join(absArtifactDir, "base-artifact.json");
|
|
151
|
+
await Bun.write(`${artifactPath}.tmp`, `${JSON.stringify(artifact, null, 2)}\n`);
|
|
152
|
+
await rename(`${artifactPath}.tmp`, artifactPath);
|
|
125
153
|
}
|
|
126
154
|
|
|
127
155
|
async #buildRuntimeClientEntries(): Promise<
|
|
@@ -46,6 +46,16 @@ describe("AgentAssets", () => {
|
|
|
46
46
|
expect(references.filter((asset) => asset.path.includes("/agentRule")).length).toBeGreaterThan(1);
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
+
test("ships a guideline section on its own, and the skill's index names every entry in it", async () => {
|
|
50
|
+
const assets = await AgentAssets.skills();
|
|
51
|
+
const read = (file: string) => assets.find((asset) => asset.path === file)?.content ?? "";
|
|
52
|
+
const routes = read(".agents/skills/akan-page/references/akanApi-routes.md");
|
|
53
|
+
expect(read(".agents/skills/akan-page/SKILL.md")).toMatch(/akanApi-routes\.md` — Routes .*`Link`/);
|
|
54
|
+
expect(routes).toContain("### `Link` · `akanjs/ui`");
|
|
55
|
+
expect(routes).toContain("none of\nthem has to be looked up in `node_modules`");
|
|
56
|
+
expect(routes).not.toContain("## Endpoints");
|
|
57
|
+
});
|
|
58
|
+
|
|
49
59
|
test("names no rule or skill file that a new workspace's .gitignore would keep out of git", async () => {
|
|
50
60
|
const assets = [...(await AgentAssets.rules()), ...(await AgentAssets.skills())];
|
|
51
61
|
const root = await fsPromise.mkdtemp(path.join(os.tmpdir(), "akan-agent-ignore-"));
|
package/guideline/agentAssets.ts
CHANGED
|
@@ -31,7 +31,15 @@ export class AgentAssets {
|
|
|
31
31
|
"akan-scaffold": ["workspaceRecipes"],
|
|
32
32
|
"akan-module": ["moduleOverview", "modelConstant", "modelDictionary", "fieldRule"],
|
|
33
33
|
"akan-scalar": ["scalarModule", "scalarConstant", "scalarDictionary"],
|
|
34
|
-
"akan-service": [
|
|
34
|
+
"akan-service": [
|
|
35
|
+
"modelService",
|
|
36
|
+
"modelSignal",
|
|
37
|
+
"modelDocument",
|
|
38
|
+
"akanApi#imports",
|
|
39
|
+
"akanApi#services-and-adapters",
|
|
40
|
+
"akanApi#endpoints",
|
|
41
|
+
"akanApi#dictionaries",
|
|
42
|
+
],
|
|
35
43
|
"akan-store": ["modelStore"],
|
|
36
44
|
"akan-ui": [
|
|
37
45
|
"ssrRule",
|
|
@@ -48,7 +56,7 @@ export class AgentAssets {
|
|
|
48
56
|
"akan-err": ["errorCodes"],
|
|
49
57
|
"akan-deps": [],
|
|
50
58
|
"akan-debug": [],
|
|
51
|
-
"akan-page": ["pageRule", "akanApi"],
|
|
59
|
+
"akan-page": ["pageRule", "akanApi#imports", "akanApi#routes", "akanApi#app-config"],
|
|
52
60
|
"akan-query": ["queryRule"],
|
|
53
61
|
"akan-transport": ["transportRule"],
|
|
54
62
|
"akan-runtime": ["runtimeRule"],
|
|
@@ -101,14 +109,12 @@ ${AgentAssets.marker}
|
|
|
101
109
|
for (const [name, guidelines] of Object.entries(AgentAssets.skillReferences)) {
|
|
102
110
|
const source = await fsPromise.readFile(path.join(dir, name, "SKILL.md"), "utf-8");
|
|
103
111
|
const index: string[] = [];
|
|
104
|
-
for (const
|
|
105
|
-
const
|
|
106
|
-
parts.forEach((part, idx) => {
|
|
107
|
-
const file = parts.length === 1 ? `${guideline}.md` : `${guideline}-${idx + 1}.md`;
|
|
112
|
+
for (const reference of guidelines) {
|
|
113
|
+
for (const { file, text, summary } of await AgentAssets.#referenceFiles(reference)) {
|
|
108
114
|
const referencePath = `.agents/skills/${name}/references/${file}`;
|
|
109
|
-
assets.push({ path: referencePath, content: `${AgentAssets.marker}\n\n${
|
|
110
|
-
index.push(`- \`${referencePath}\` — ${
|
|
111
|
-
}
|
|
115
|
+
assets.push({ path: referencePath, content: `${AgentAssets.marker}\n\n${text.trim()}\n` });
|
|
116
|
+
index.push(`- \`${referencePath}\` — ${summary}`);
|
|
117
|
+
}
|
|
112
118
|
}
|
|
113
119
|
const skill = AgentAssets.#skillFile(source, index);
|
|
114
120
|
for (const root of AgentAssets.skillRoots) assets.push({ path: `${root}/${name}/SKILL.md`, content: skill });
|
|
@@ -116,7 +122,38 @@ ${AgentAssets.marker}
|
|
|
116
122
|
return assets;
|
|
117
123
|
}
|
|
118
124
|
|
|
119
|
-
static
|
|
125
|
+
static async #referenceFiles(reference: string) {
|
|
126
|
+
const [guideline = reference, slug] = reference.split("#");
|
|
127
|
+
const text = await Prompter.getInstruction(guideline);
|
|
128
|
+
if (slug) {
|
|
129
|
+
const sections = AgentAssets.sections(text);
|
|
130
|
+
const preamble = sections[0]?.headings.length === 0 ? sections[0].text : "";
|
|
131
|
+
const section = sections.find((each) => each.headings[0] && AgentAssets.slug(each.headings[0]) === slug);
|
|
132
|
+
if (!section) throw new Error(`Guideline ${guideline} has no section ${slug}`);
|
|
133
|
+
const entries = [...section.text.matchAll(/^### (.+?)(?: · .*)?$/gm)].map((match) => match[1]);
|
|
134
|
+
const title = section.headings[0];
|
|
135
|
+
return [
|
|
136
|
+
{
|
|
137
|
+
file: `${guideline}-${slug}.md`,
|
|
138
|
+
text: preamble ? `${preamble.trim()}\n\n${section.text.trim()}` : section.text,
|
|
139
|
+
summary: entries.length ? `${title}: ${entries.join(", ")}` : title,
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
const parts = AgentAssets.split(text);
|
|
144
|
+
return parts.map((part, idx) => ({
|
|
145
|
+
file: parts.length === 1 ? `${guideline}.md` : `${guideline}-${idx + 1}.md`,
|
|
146
|
+
text: part.text,
|
|
147
|
+
summary: AgentAssets.#summarize(part.headings),
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static slug(heading: string) {
|
|
152
|
+
const paren = heading.indexOf("(");
|
|
153
|
+
return (paren === -1 ? heading : heading.slice(0, paren).trimEnd()).toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static sections(markdown: string): ReferencePart[] {
|
|
120
157
|
const sections: ReferencePart[] = [];
|
|
121
158
|
let fenced = false;
|
|
122
159
|
for (const line of markdown.trim().split("\n")) {
|
|
@@ -126,8 +163,12 @@ ${AgentAssets.marker}
|
|
|
126
163
|
if (heading !== null || !last) sections.push({ text: line, headings: heading === null ? [] : [heading] });
|
|
127
164
|
else last.text += `\n${line}`;
|
|
128
165
|
}
|
|
166
|
+
return sections;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static split(markdown: string): ReferencePart[] {
|
|
129
170
|
const parts: ReferencePart[] = [];
|
|
130
|
-
for (const section of sections) {
|
|
171
|
+
for (const section of AgentAssets.sections(markdown)) {
|
|
131
172
|
const last = parts.at(-1);
|
|
132
173
|
if (last && last.text.length + section.text.length + 1 <= AgentAssets.referenceLimit) {
|
|
133
174
|
last.text += `\n${section.text}`;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { Logger } from "akanjs/common";
|
|
3
|
+
import type { BuilderMessage, BuildPhase, HmrTrace } from "akanjs/server";
|
|
4
|
+
import { resolveDevCsrMode } from "akanjs/server/hmr/csrDevManifest";
|
|
5
|
+
import { ApplicationBuildReporter } from "../app/applicationBuildReporter";
|
|
6
|
+
import { resolveSsrPageEntriesForApp } from "../artifact/implicitRootLayout";
|
|
7
|
+
import { computeRouteSeedIndex, saveRouteSeedIndex } from "../artifact/routeSeedIndex";
|
|
8
|
+
import type { App } from "../commandDecorators";
|
|
6
9
|
// Subpath imports only, as few as possible: spawned per generation, this process pays every import on every save.
|
|
7
|
-
import { AppExecutor, WorkspaceExecutor } from "
|
|
10
|
+
import { AppExecutor, WorkspaceExecutor } from "../executors";
|
|
8
11
|
import {
|
|
9
12
|
CsrArtifactBuilder,
|
|
10
13
|
CsrDevBundler,
|
|
@@ -14,10 +17,7 @@ import {
|
|
|
14
17
|
ServerGraphFile,
|
|
15
18
|
SsrBaseArtifactBuilder,
|
|
16
19
|
SsrDevBundler,
|
|
17
|
-
} from "
|
|
18
|
-
import { Logger } from "akanjs/common";
|
|
19
|
-
import type { BuilderMessage, BuildPhase, HmrTrace } from "akanjs/server";
|
|
20
|
-
import { resolveDevCsrMode } from "akanjs/server/hmr/csrDevManifest";
|
|
20
|
+
} from "../frontendBuild";
|
|
21
21
|
import type { BuildBatchRequest, BuildBatchResult, OptimizedFonts, PagesBatchCssAssets } from "./buildBatchProtocol";
|
|
22
22
|
|
|
23
23
|
// `Bun.build` keeps native bundler arenas that `Bun.gc(true)` cannot reclaim; only exiting returns them.
|
|
@@ -84,9 +84,10 @@ class BuildBatch {
|
|
|
84
84
|
async #buildBase(): Promise<void> {
|
|
85
85
|
const started = Date.now();
|
|
86
86
|
try {
|
|
87
|
-
const { artifact, optimizedFonts } = await new SsrBaseArtifactBuilder(this.#app).build();
|
|
87
|
+
const { artifact, optimizedFonts, phaseMs } = await new SsrBaseArtifactBuilder(this.#app).build();
|
|
88
88
|
this.#result.artifact = artifact;
|
|
89
89
|
this.#result.optimizedFonts = optimizedFonts;
|
|
90
|
+
this.#result.basePhaseMs = phaseMs;
|
|
90
91
|
this.#logger.verbose(`base-artifact ok buildId=${artifact.pagesBundleBuildId} (${Date.now() - started}ms)`);
|
|
91
92
|
} catch (err) {
|
|
92
93
|
this.#fail("base", "base-artifact", err);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FontOptimizer } from "@akanjs/devkit/frontendBuild";
|
|
2
1
|
import type { BaseBuildArtifact, CssPayload, HmrTrace, PagesBundlePayload } from "akanjs/server";
|
|
2
|
+
import type { FontOptimizer } from "../frontendBuild";
|
|
3
3
|
|
|
4
4
|
export type OptimizedFonts = Awaited<ReturnType<FontOptimizer["optimize"]>>;
|
|
5
5
|
|
|
@@ -32,6 +32,7 @@ export interface BuildBatchResult {
|
|
|
32
32
|
cssAssets?: PagesBatchCssAssets;
|
|
33
33
|
optimizedFonts?: OptimizedFonts;
|
|
34
34
|
artifact?: BaseBuildArtifact; // `base` batches only
|
|
35
|
+
basePhaseMs?: Record<string, number>;
|
|
35
36
|
errors: Partial<Record<BuildBatchNeed, string>>;
|
|
36
37
|
crashed?: boolean; // died before reporting its result
|
|
37
38
|
/** Of a crashed batch, the needs it died before reporting: the others streamed their build-status first. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import type { App } from "@akanjs/devkit/commandDecorators";
|
|
3
|
-
import type { ClientEntryDiscovery } from "@akanjs/devkit/frontendBuild/clientBuildTypes";
|
|
4
|
-
import { GraphClientEntryDiscovery } from "@akanjs/devkit/frontendBuild/clientEntryDiscovery";
|
|
5
|
-
import { HmrWatcher } from "@akanjs/devkit/frontendBuild/hmrWatcher";
|
|
6
|
-
import { WatchRootResolver } from "@akanjs/devkit/frontendBuild/watchRootResolver";
|
|
7
2
|
import type { Logger } from "akanjs/common";
|
|
8
3
|
import type { BaseBuildArtifact } from "akanjs/server";
|
|
4
|
+
import type { App } from "../commandDecorators";
|
|
5
|
+
import type { ClientEntryDiscovery } from "../frontendBuild/clientBuildTypes";
|
|
6
|
+
import { GraphClientEntryDiscovery } from "../frontendBuild/clientEntryDiscovery";
|
|
7
|
+
import { HmrWatcher } from "../frontendBuild/hmrWatcher";
|
|
8
|
+
import { WatchRootResolver } from "../frontendBuild/watchRootResolver";
|
|
9
9
|
import type { OptimizedFonts } from "./buildBatchProtocol";
|
|
10
10
|
import type { BuildBatchRunner } from "./buildBatchRunner";
|
|
11
11
|
import { BuilderChannel } from "./builderChannel";
|
|
@@ -19,7 +19,9 @@ export interface IncrementalBuilderOptions {
|
|
|
19
19
|
initialGeneration?: number;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
type IncrementalBuilderBootDeps = Pick<IncrementalBuilderOptions, "artifact" | "optimizedFonts" | "discovery"
|
|
22
|
+
type IncrementalBuilderBootDeps = Pick<IncrementalBuilderOptions, "artifact" | "optimizedFonts" | "discovery"> & {
|
|
23
|
+
basePhaseMs: Record<string, number>;
|
|
24
|
+
};
|
|
23
25
|
|
|
24
26
|
export class BuilderBoot {
|
|
25
27
|
// Discovery stays in-process because route builds need it live; it is free at boot, building its graph lazily.
|
|
@@ -41,7 +43,12 @@ export class BuilderBoot {
|
|
|
41
43
|
if (!result.artifact || !result.optimizedFonts)
|
|
42
44
|
throw new Error("boot build reported success without an artifact; the build worker likely died");
|
|
43
45
|
const discovery = await GraphClientEntryDiscovery.create(app);
|
|
44
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
artifact: result.artifact,
|
|
48
|
+
optimizedFonts: result.optimizedFonts,
|
|
49
|
+
discovery,
|
|
50
|
+
basePhaseMs: result.basePhaseMs ?? {},
|
|
51
|
+
};
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
// A boot compile error must not kill the builder, the dev server's only file watcher: report it, emit builder-ready
|