@akanjs/cli 3.2.0-rc.0 → 3.2.0-rc.10
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/.build-stamp +2 -1
- package/{CodeAgent-h6g8dg3a.js → CodeAgent-fk66n37w.js} +3 -3
- package/{CodeTui-n9gacepn.js → CodeTui-4rf1mqmv.js} +1 -1
- package/README.ko.md +26 -1
- package/README.md +26 -1
- package/TunnelShare-44er4e29.js +15 -0
- package/{agent.command-2f657613.js → agent.command-7g9czkkd.js} +20 -19
- package/akanCode.js +6 -6
- package/{application.command-yb8v177e.js → application.command-00spg55s.js} +31 -24
- package/{applicationBuildRunner-sctcmkyx.js → applicationBuildRunner-f4yf0qyc.js} +9 -7
- package/buildBatch.proc.js +7 -6
- package/{cloud.command-et06ja22.js → cloud.command-ab704p0g.js} +24 -25
- package/cloud.script-4p4y0s7e.js +31 -0
- package/{code.command-7m67c7zc.js → code.command-m6c9xk56.js} +7 -6
- package/{context.command-569z0rqf.js → context.command-hgcgxtdk.js} +20 -19
- package/context.runner-w071gmc3.js +30 -0
- package/{devTui-evr3b35y.js → devTui-h77zrjv5.js} +1 -1
- package/{guideline.command-gnv3e8p8.js → guideline.command-6yz6d4hf.js} +3 -2
- package/guidelines/agentRule/agentRule.instruction.md +4 -3
- package/guidelines/conventions/core.md +1 -1
- package/guidelines/conventions/rules/app.md +3 -0
- package/guidelines/conventions/rules/page.md +5 -0
- package/guidelines/errorCodes/errorCodes.instruction.md +140 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +28 -0
- package/guidelines/pageRule/pageRule.instruction.md +5 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +5 -1
- package/guidelines/transportRule/transportRule.instruction.md +5 -0
- package/incrementalBuilder.proc.js +8 -7
- package/{index-vkzfk7qt.js → index-097bjwvm.js} +40 -30
- package/{index-93ewzmp6.js → index-23d8gw08.js} +165 -102
- package/{index-p6hjwt2d.js → index-41mfhgq0.js} +72 -26
- package/{index-ktb3wcqz.js → index-4k9nv4m3.js} +71 -81
- package/{index-ryrm5z2c.js → index-5jwx4bf2.js} +69 -33
- package/{index-5w9my9qe.js → index-6eptmk8z.js} +30 -20
- package/{index-d4n1wmrz.js → index-6fnrhpn1.js} +8 -4
- package/{index-kpdv34rq.js → index-6qtxs86x.js} +10 -7
- package/{index-ed6ea0qp.js → index-6z57w95f.js} +1 -1
- package/{index-drz9e84d.js → index-7ky4brfy.js} +2 -2
- package/{index-8g7tdsk4.js → index-849qvd7t.js} +58 -29
- package/{index-1q1cjn8s.js → index-9xh4zvw3.js} +94 -53
- package/{index-48d5qsj3.js → index-adj7qmz9.js} +23 -15
- package/{index-fjr4d6yd.js → index-apcr1qgk.js} +458 -304
- package/{index-8ts9774g.js → index-aybfcx58.js} +9 -4
- package/{index-3wjbhj2n.js → index-b3pr4ee6.js} +1 -1
- package/{index-tenw3mah.js → index-b4qq3rq0.js} +32 -7
- package/{index-thckcabc.js → index-bper31wr.js} +24 -6
- package/{index-jdamtr7e.js → index-bxkx0x03.js} +17 -10
- package/{index-0fb3cpbt.js → index-c3r23w24.js} +9 -7
- package/{index-8pb9yvp8.js → index-dfsa009c.js} +148 -31
- package/{index-zpv14wpy.js → index-dsg50er9.js} +3 -3
- package/{index-hqrkqxx2.js → index-e5f6czck.js} +46 -7
- package/{index-sy481q2x.js → index-frvjq1rd.js} +1 -1
- package/{index-abgh0jve.js → index-grt0e6kk.js} +1 -1
- package/{index-e3vmjtph.js → index-hf9nvwam.js} +7 -2
- package/{index-zxsygkda.js → index-hhagjhkh.js} +7 -7
- package/index-j4yvgfhr.js +70 -0
- package/{index-s2grpzef.js → index-k2r3hmbz.js} +6 -4
- package/{index-7y5yghjg.js → index-nd39rssn.js} +1162 -435
- package/{index-6wpaq392.js → index-p4htjyvk.js} +44 -5
- package/{index-aj3ehkcx.js → index-p54s83sz.js} +1 -1
- package/{index-7xdpww43.js → index-rdx8cyv2.js} +342 -134
- package/{index-sr5da35e.js → index-sq9d0jhj.js} +21 -18
- package/{index-eajbmk10.js → index-t4d0ckde.js} +2 -2
- package/{index-mqntfzv5.js → index-t8h09yjs.js} +7 -2
- package/index-va90m8nd.js +25 -0
- package/{index-rc5fvqj2.js → index-xfv2p7b5.js} +95 -58
- package/{index-w639tvkd.js → index-xgqz3kak.js} +29 -8
- package/{index-9tbgb4d8.js → index-xy70tcv4.js} +1 -1
- package/{index-mmym5xmb.js → index-z43wddce.js} +5 -3
- package/index.js +24 -23
- package/{library.command-1gp5qe3r.js → library.command-kc1zahcg.js} +5 -4
- package/{localRegistry.command-v3g21rex.js → localRegistry.command-bz2df40m.js} +19 -18
- package/{module.command-4xz9he6h.js → module.command-cchwzz9r.js} +12 -7
- package/{package.command-s7qpnn1g.js → package.command-qcjajpv8.js} +8 -7
- package/package.json +2 -2
- package/{page.command-fan34c49.js → page.command-1t86dx8a.js} +4 -3
- package/{pipeline.command-ph4fnn9w.js → pipeline.command-2xx9z3d0.js} +3 -2
- package/{primitive.command-3fqh8emf.js → primitive.command-mc0x8txr.js} +8 -7
- package/{projectTypecheck-vkb40hjc.js → projectTypecheck-tz497yx7.js} +2 -1
- package/{quality.command-ecj6exsh.js → quality.command-11rayf5c.js} +7 -6
- package/{repair.command-fe9jw719.js → repair.command-8w41vy78.js} +7 -6
- package/{scalar.command-cnvfhk0n.js → scalar.command-rvwh98ny.js} +7 -6
- package/skills/akan-debug/SKILL.md +7 -3
- package/skills/akan-err/SKILL.md +7 -0
- package/skills/akan-mcp/SKILL.md +7 -1
- package/skills/akan-scaffold/SKILL.md +3 -2
- package/skills/akan-transport/SKILL.md +2 -0
- package/skills/akan-validate/SKILL.md +1 -0
- package/{subspace.command-yxtt3v3e.js → subspace.command-0970n7kd.js} +9 -8
- package/{tunnel.command-ggj38mqf.js → tunnel.command-bcy0rtmh.js} +8 -7
- package/typecheck.proc.js +5 -2
- package/{verify.command-w9ttxkdz.js → verify.command-ynaztxr2.js} +18 -16
- package/{workflow.command-ss8devj0.js → workflow.command-yp9ajthb.js} +45 -16
- package/{workspace.command-rw1p0xeq.js → workspace.command-e4wfxm86.js} +39 -34
- package/TunnelShare-k3ja4w9x.js +0 -14
- package/cloud.script-s6rbrwer.js +0 -30
- package/context.runner-ms8v1rxy.js +0 -29
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script,
|
|
5
|
-
ExitCodeError,
|
|
6
5
|
markCliErrorPrinted
|
|
7
|
-
} from "./index-
|
|
6
|
+
} from "./index-23d8gw08.js";
|
|
7
|
+
import {
|
|
8
|
+
CliError
|
|
9
|
+
} from "./index-j4yvgfhr.js";
|
|
8
10
|
import {
|
|
9
11
|
AGENT_BLOCK_START,
|
|
10
12
|
AGENT_BLOCK_END,
|
|
@@ -15,7 +17,7 @@ import {
|
|
|
15
17
|
CLAUDE_COMMENT_RULE,
|
|
16
18
|
AppExecutor,
|
|
17
19
|
LibExecutor
|
|
18
|
-
} from "./index-
|
|
20
|
+
} from "./index-sq9d0jhj.js";
|
|
19
21
|
import {
|
|
20
22
|
akanCodePaths2
|
|
21
23
|
} from "./index-35j83zkd.js";
|
|
@@ -23,25 +25,25 @@ import {
|
|
|
23
25
|
ConventionSet,
|
|
24
26
|
Prompter2
|
|
25
27
|
} from "./index-j6eeh5d7.js";
|
|
28
|
+
import {
|
|
29
|
+
AkanContextAnalyzer
|
|
30
|
+
} from "./index-bper31wr.js";
|
|
26
31
|
import {
|
|
27
32
|
collectRecipeSources2,
|
|
28
33
|
scanRecipes2
|
|
29
34
|
} from "./index-hj6w4ka1.js";
|
|
30
|
-
import {
|
|
31
|
-
AkanContextAnalyzer
|
|
32
|
-
} from "./index-thckcabc.js";
|
|
33
35
|
import {
|
|
34
36
|
ApplicationRunner,
|
|
35
37
|
VerifyScope
|
|
36
|
-
} from "./index-
|
|
38
|
+
} from "./index-4k9nv4m3.js";
|
|
37
39
|
import {
|
|
38
40
|
WorkspaceRunner
|
|
39
|
-
} from "./index-
|
|
41
|
+
} from "./index-apcr1qgk.js";
|
|
40
42
|
import {
|
|
41
43
|
VerifyComments,
|
|
42
44
|
VerifyPipeline,
|
|
43
45
|
VerifyReport
|
|
44
|
-
} from "./index-
|
|
46
|
+
} from "./index-k2r3hmbz.js";
|
|
45
47
|
|
|
46
48
|
// pkgs/@akanjs/cli/agent/agent.script.ts
|
|
47
49
|
import { Logger as Logger3 } from "akanjs/common";
|
|
@@ -79,7 +81,7 @@ class AgentAssets {
|
|
|
79
81
|
"modelUtil",
|
|
80
82
|
"framework"
|
|
81
83
|
],
|
|
82
|
-
"akan-err": [],
|
|
84
|
+
"akan-err": ["errorCodes"],
|
|
83
85
|
"akan-deps": [],
|
|
84
86
|
"akan-debug": [],
|
|
85
87
|
"akan-page": ["pageRule", "akanApi"],
|
|
@@ -610,7 +612,7 @@ var resolveTargets = (target) => {
|
|
|
610
612
|
const single = singleTargets.find((name) => name === target);
|
|
611
613
|
if (single)
|
|
612
614
|
return [single];
|
|
613
|
-
throw new
|
|
615
|
+
throw new CliError("usage", `Unknown agent target: ${target}. Use cursor, agents-md, claude, rules, skills, hooks, or all.`);
|
|
614
616
|
};
|
|
615
617
|
|
|
616
618
|
class AgentScript extends script("agent", [AgentRunner]) {
|
|
@@ -618,7 +620,7 @@ class AgentScript extends script("agent", [AgentRunner]) {
|
|
|
618
620
|
if (action === "hook")
|
|
619
621
|
return await this.#hook(workspace, target);
|
|
620
622
|
if (action !== "install")
|
|
621
|
-
throw new
|
|
623
|
+
throw new CliError("usage", `Unknown agent action: ${action}. Use "install" or "hook".`);
|
|
622
624
|
if (check)
|
|
623
625
|
return await this.#check(workspace, resolveTargets(target));
|
|
624
626
|
const written = await this.agentRunner.install(workspace, resolveTargets(target), { force });
|
|
@@ -634,19 +636,27 @@ ${written.map((file) => `- ${file}`).join(`
|
|
|
634
636
|
const lines = drift.map(({ path, change }) => `${path} ${change}`);
|
|
635
637
|
Logger3.rawLog([`agent files differ \xB7 ${files} \xB7 run \`akan agent install\``, ...lines].join(`
|
|
636
638
|
`));
|
|
637
|
-
const failure = new
|
|
639
|
+
const failure = new CliError("checkFailed", "agent files differ");
|
|
638
640
|
markCliErrorPrinted(failure);
|
|
639
641
|
throw failure;
|
|
640
642
|
}
|
|
641
643
|
async#hook(workspace, event) {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
644
|
+
try {
|
|
645
|
+
if (!AgentHook.isEvent(event))
|
|
646
|
+
throw new CliError("usage", `Unknown hook: ${event}. Use ${AgentHook.events.join(", ")}.`);
|
|
647
|
+
const raw = (await Bun.stdin.text()).trim();
|
|
648
|
+
const input = raw ? JSON.parse(raw) : {};
|
|
649
|
+
const response = AgentHook.respond(event, await new AgentHook(workspace).run(event, input));
|
|
650
|
+
if (response)
|
|
651
|
+
process.stdout.write(`${response}
|
|
649
652
|
`);
|
|
653
|
+
} catch (error) {
|
|
654
|
+
const message = CliError.messageOf(error);
|
|
655
|
+
Logger3.rawLog(message, undefined, "error");
|
|
656
|
+
const failure = new CliError("failed", message, { cause: error });
|
|
657
|
+
markCliErrorPrinted(failure);
|
|
658
|
+
throw failure;
|
|
659
|
+
}
|
|
650
660
|
}
|
|
651
661
|
}
|
|
652
662
|
|
|
@@ -2,22 +2,25 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-23d8gw08.js";
|
|
6
6
|
import {
|
|
7
7
|
FileSys2
|
|
8
8
|
} from "./index-bns3wcpc.js";
|
|
9
9
|
import {
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-sq9d0jhj.js";
|
|
12
12
|
import {
|
|
13
13
|
TypeScriptDependencyScanner2
|
|
14
14
|
} from "./index-qd7xn2bk.js";
|
|
15
15
|
import {
|
|
16
16
|
FrameworkGraph
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-grt0e6kk.js";
|
|
18
18
|
import {
|
|
19
19
|
MaintainabilityBaseline
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-e5f6czck.js";
|
|
21
|
+
import {
|
|
22
|
+
assertPackageName
|
|
23
|
+
} from "./index-va90m8nd.js";
|
|
21
24
|
|
|
22
25
|
// pkgs/@akanjs/cli/package/package.runner.ts
|
|
23
26
|
import path2 from "path";
|
|
@@ -404,6 +407,7 @@ class PackageScript extends script("package", [PackageRunner]) {
|
|
|
404
407
|
return await this.packageRunner.version(workspace, { log });
|
|
405
408
|
}
|
|
406
409
|
async createPackage(workspace, pkgName) {
|
|
410
|
+
assertPackageName(pkgName);
|
|
407
411
|
const spinner = workspace.spinning(`Creating package in pkgs/${pkgName}...`);
|
|
408
412
|
await this.packageRunner.createPackage(workspace, pkgName);
|
|
409
413
|
spinner.succeed(`Package in pkgs/${pkgName} is created`);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
jsonText
|
|
4
|
-
} from "./index-8pb9yvp8.js";
|
|
5
2
|
import {
|
|
6
3
|
akanMcpInstallTargets
|
|
7
|
-
} from "./index-
|
|
4
|
+
} from "./index-bper31wr.js";
|
|
5
|
+
import {
|
|
6
|
+
jsonText
|
|
7
|
+
} from "./index-dfsa009c.js";
|
|
8
8
|
import {
|
|
9
9
|
script
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-23d8gw08.js";
|
|
11
11
|
import {
|
|
12
12
|
ContextRunner2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-xfv2p7b5.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/context/context.script.ts
|
|
16
16
|
import { Logger } from "akanjs/common";
|
|
@@ -32,7 +32,10 @@ class ContextScript extends script("context", [ContextRunner2]) {
|
|
|
32
32
|
Logger.rawLog(await this.contextRunner.getContext(workspace, options));
|
|
33
33
|
}
|
|
34
34
|
async doctor(workspace, options = {}) {
|
|
35
|
-
|
|
35
|
+
const { status, output } = await this.contextRunner.doctor(workspace, options);
|
|
36
|
+
Logger.rawLog(output);
|
|
37
|
+
if (status === "failed")
|
|
38
|
+
process.exitCode = 1;
|
|
36
39
|
}
|
|
37
40
|
async mcpInstall(workspace, target, { force = false, mode = "apply" } = {}) {
|
|
38
41
|
const targets = resolveMcpInstallTargets(target);
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
UpdatePackFolder,
|
|
10
10
|
NativePublicEnv,
|
|
11
11
|
NativeApp
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-dsg50er9.js";
|
|
13
13
|
import {
|
|
14
14
|
ExitCodeError
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-23d8gw08.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigLock
|
|
18
18
|
} from "./index-bqbf654f.js";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
ROOT_LAYOUT_SYSTEM,
|
|
4
|
+
isImplicitRootLayoutKey,
|
|
3
5
|
resolveSsrPageEntriesForApp
|
|
4
|
-
} from "./index-
|
|
6
|
+
} from "./index-sq9d0jhj.js";
|
|
5
7
|
import {
|
|
6
8
|
computeRouteSeedIndex,
|
|
7
9
|
saveRouteSeedIndex,
|
|
@@ -9,12 +11,12 @@ import {
|
|
|
9
11
|
ClientEntriesBundler,
|
|
10
12
|
VENDOR_SPECIFIERS,
|
|
11
13
|
RouteClientBuilder
|
|
12
|
-
} from "./index-
|
|
14
|
+
} from "./index-rdx8cyv2.js";
|
|
13
15
|
import {
|
|
14
16
|
SOURCE_EXTS,
|
|
15
17
|
FontOptimizer,
|
|
16
18
|
FontPruner
|
|
17
|
-
} from "./index-
|
|
19
|
+
} from "./index-41mfhgq0.js";
|
|
18
20
|
import {
|
|
19
21
|
BarrelAnalyzer,
|
|
20
22
|
createTsconfigPackageResolver,
|
|
@@ -22,7 +24,7 @@ import {
|
|
|
22
24
|
CsrEntryFiles,
|
|
23
25
|
toClientReferencePath,
|
|
24
26
|
PagesBundleBuilder
|
|
25
|
-
} from "./index-
|
|
27
|
+
} from "./index-9xh4zvw3.js";
|
|
26
28
|
import {
|
|
27
29
|
CssBlockParser
|
|
28
30
|
} from "./index-62md4dwy.js";
|
|
@@ -98,7 +100,7 @@ class AllRoutesBuilder {
|
|
|
98
100
|
};
|
|
99
101
|
#knownSet = new Set;
|
|
100
102
|
#routeIds = [];
|
|
101
|
-
#
|
|
103
|
+
#ssrEntriesByRoute = new Map;
|
|
102
104
|
#externalsByChunkUrl = {};
|
|
103
105
|
#discovery = null;
|
|
104
106
|
constructor(app, command = "start") {
|
|
@@ -111,14 +113,16 @@ class AllRoutesBuilder {
|
|
|
111
113
|
const pageEntries = await resolveSsrPageEntriesForApp(this.#app, pageKeys);
|
|
112
114
|
const seedIndex = computeRouteSeedIndex(pageEntries);
|
|
113
115
|
this.#app.verbose(`[build-all] discovered ${seedIndex.entries.length} routes`);
|
|
114
|
-
|
|
116
|
+
const discovery = await GraphClientEntryDiscovery.create(this.#app);
|
|
117
|
+
this.#discovery = discovery;
|
|
118
|
+
const importsAs = await this.#ssrImportsAs(discovery, pageEntries);
|
|
115
119
|
const allEntries = new Set;
|
|
116
120
|
for (const entry of seedIndex.entries) {
|
|
117
121
|
const seeds = Array.from(new Set([...seedIndex.globalLayoutFiles, ...entry.seeds]));
|
|
118
|
-
const routeEntries = await
|
|
122
|
+
const routeEntries = await discovery.discover(seeds);
|
|
119
123
|
for (const discovered of routeEntries)
|
|
120
124
|
allEntries.add(discovered);
|
|
121
|
-
this.#
|
|
125
|
+
this.#ssrEntriesByRoute.set(entry.routeId, await discovery.discover(seeds, { importsAs }));
|
|
122
126
|
this.#routeIds.push(entry.routeId);
|
|
123
127
|
}
|
|
124
128
|
this.#app.verbose(`[build-all] ${allEntries.size} client entries across ${this.#routeIds.length} routes`);
|
|
@@ -134,10 +138,22 @@ class AllRoutesBuilder {
|
|
|
134
138
|
this.#app.verbose(`[build-all] wrote ${manifestPath} routes=${this.#routeIds.length} entries=${this.#merged.knownEntries.length}`);
|
|
135
139
|
return { manifest, manifestPath, seedIndex };
|
|
136
140
|
}
|
|
141
|
+
async#ssrImportsAs(discovery, pageEntries) {
|
|
142
|
+
const { specifier, ssrShell, importsNoSsrPageRenders } = ROOT_LAYOUT_SYSTEM;
|
|
143
|
+
const importsAs = new Map;
|
|
144
|
+
const toShell = new Map([[specifier, ssrShell]]);
|
|
145
|
+
for (const { key, moduleAbsPath } of pageEntries)
|
|
146
|
+
if (isImplicitRootLayoutKey(key))
|
|
147
|
+
importsAs.set(path.resolve(moduleAbsPath), toShell);
|
|
148
|
+
const system = await discovery.resolveImport(specifier, this.#app.cwdPath);
|
|
149
|
+
if (system)
|
|
150
|
+
importsAs.set(system, new Map(importsNoSsrPageRenders.map((spec) => [spec, null])));
|
|
151
|
+
return importsAs;
|
|
152
|
+
}
|
|
137
153
|
async writeModulePreloads(runtimeChunks) {
|
|
138
154
|
const preloads = new RouteModulePreloads({
|
|
139
155
|
runtimeChunks,
|
|
140
|
-
entriesByRoute: this.#
|
|
156
|
+
entriesByRoute: this.#ssrEntriesByRoute,
|
|
141
157
|
clientManifest: this.#merged.clientManifest,
|
|
142
158
|
externalsByChunkUrl: this.#externalsByChunkUrl,
|
|
143
159
|
workspaceRoot: this.#app.workspace.workspaceRoot
|
|
@@ -975,16 +991,7 @@ class SsrBaseArtifactBuilder {
|
|
|
975
991
|
const rscClientUrl = clientBundle.entryUrlsByAbsPath.get(rscClientEntry) ?? "";
|
|
976
992
|
const rscRuntimeSsrManifest = {
|
|
977
993
|
moduleLoading: null,
|
|
978
|
-
moduleMap:
|
|
979
|
-
const ssrOutput = ssrBundle.entryOutputAbsByAbsPath.get(rscSegmentOutletEntry);
|
|
980
|
-
if (!ssrOutput || key !== `${clientBundle.clientReferenceIdByAbsPath.get(rscSegmentOutletEntry)}#${row.name}`) {
|
|
981
|
-
return null;
|
|
982
|
-
}
|
|
983
|
-
return [
|
|
984
|
-
row.id,
|
|
985
|
-
{ [row.name]: { id: ssrOutput, chunks: [ssrOutput, ssrOutput], name: row.name, async: true } }
|
|
986
|
-
];
|
|
987
|
-
}).filter((entry) => Boolean(entry)))
|
|
994
|
+
moduleMap: SsrBaseArtifactBuilder.outletModuleMap(clientBundle.manifest, clientBundle.clientReferenceIdByAbsPath.get(rscSegmentOutletEntry), ssrBundle.entryOutputAbsByAbsPath.get(rscSegmentOutletEntry))
|
|
988
995
|
};
|
|
989
996
|
const vendorMap = Object.fromEntries(vendorEntries.map(({ specifier, absPath }) => [specifier, clientBundle.entryUrlsByAbsPath.get(absPath) ?? ""]));
|
|
990
997
|
this.#app.verbose(`[base-artifact] rscClientUrl=${rscClientUrl} vendors=${Object.keys(vendorMap).length}`);
|
|
@@ -1000,6 +1007,20 @@ class SsrBaseArtifactBuilder {
|
|
|
1000
1007
|
}
|
|
1001
1008
|
};
|
|
1002
1009
|
}
|
|
1010
|
+
static outletModuleMap(manifest, outletReferenceId, ssrOutput) {
|
|
1011
|
+
const moduleMap = {};
|
|
1012
|
+
if (!ssrOutput || !outletReferenceId)
|
|
1013
|
+
return moduleMap;
|
|
1014
|
+
for (const [key, row] of Object.entries(manifest)) {
|
|
1015
|
+
if (key !== `${outletReferenceId}#${row.name}`)
|
|
1016
|
+
continue;
|
|
1017
|
+
moduleMap[row.id] = {
|
|
1018
|
+
...moduleMap[row.id],
|
|
1019
|
+
[row.name]: { id: ssrOutput, chunks: [ssrOutput, ssrOutput], name: row.name, async: true }
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
return moduleMap;
|
|
1023
|
+
}
|
|
1003
1024
|
async#resolveAkanServerPath() {
|
|
1004
1025
|
const candidates = [];
|
|
1005
1026
|
try {
|
|
@@ -1070,28 +1091,36 @@ class VendorImportScanner {
|
|
|
1070
1091
|
for (const specifier of specifiers)
|
|
1071
1092
|
this.#names.set(specifier, new Set);
|
|
1072
1093
|
}
|
|
1073
|
-
static async exportsUsedIn(dir, specifiers) {
|
|
1094
|
+
static async exportsUsedIn(dir, specifiers, entryUrls) {
|
|
1074
1095
|
const scanner = new VendorImportScanner(specifiers);
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1096
|
+
const scanned = [];
|
|
1097
|
+
if (fs3.existsSync(dir))
|
|
1098
|
+
for await (const relative of new Bun.Glob("**/*.js").scan({ cwd: dir })) {
|
|
1099
|
+
scanner.scan(await Bun.file(path8.join(dir, relative)).text(), relative);
|
|
1100
|
+
scanned.push(`/${relative.split(path8.sep).join("/")}`);
|
|
1101
|
+
}
|
|
1102
|
+
const unread = [...new Set(entryUrls)].filter((url) => !scanned.some((relative) => url.endsWith(relative)));
|
|
1103
|
+
if (unread.length > 0) {
|
|
1104
|
+
const named = `${unread.slice(0, 3).join(", ")}${unread.length > 3 ? `, and ${unread.length - 3} more` : ""}`;
|
|
1105
|
+
throw new Error(`[VendorImportScanner] no file under ${dir} for the route client entries ${named}; narrowing the vendor entries without them would drop names those pages import`);
|
|
1106
|
+
}
|
|
1079
1107
|
return scanner.usedExports();
|
|
1080
1108
|
}
|
|
1081
1109
|
scan(source, fileName = "chunk.js") {
|
|
1082
1110
|
if (![...this.#specifiers].some((specifier) => source.includes(specifier)))
|
|
1083
1111
|
return this;
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1112
|
+
const stack = [ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS)];
|
|
1113
|
+
for (let node = stack.pop();node; node = stack.pop()) {
|
|
1086
1114
|
if (ts.isImportDeclaration(node))
|
|
1087
1115
|
this.#readImport(node);
|
|
1088
1116
|
else if (ts.isExportDeclaration(node))
|
|
1089
1117
|
this.#readExport(node);
|
|
1090
1118
|
else if (ts.isCallExpression(node))
|
|
1091
1119
|
this.#readCall(node);
|
|
1092
|
-
ts.forEachChild(node,
|
|
1093
|
-
|
|
1094
|
-
|
|
1120
|
+
ts.forEachChild(node, (child) => {
|
|
1121
|
+
stack.push(child);
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1095
1124
|
return this;
|
|
1096
1125
|
}
|
|
1097
1126
|
usedExports() {
|