@akanjs/cli 3.2.0-rc.8 → 3.2.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/.build-stamp +2 -2
- package/CodeAgent-fx6088tv.js +11 -0
- package/{CodeTui-qstk5vpj.js → CodeTui-zee8atsr.js} +822 -666
- package/README.ko.md +7 -0
- package/README.md +7 -0
- package/TunnelShare-9ry4vh0y.js +18 -0
- package/agent.command-x65f2ags.js +61 -0
- package/akanCode.js +12 -12
- package/appExecutor-79azsb2w.js +11 -0
- package/{application.command-m4rq4wc2.js → application.command-azbd1pb2.js} +83 -37
- package/{applicationBuildRunner-df7rx3ra.js → applicationBuildRunner-trfxv3pd.js} +49 -18
- package/buildBatch.proc.js +25 -11
- package/{cloud.command-a0gy0qq2.js → cloud.command-gapp4634.js} +33 -29
- package/cloud.script-3b401efv.js +35 -0
- package/{code.command-5rsdqw8s.js → code.command-5smx61yf.js} +13 -9
- package/context.command-ym5jbkny.js +64 -0
- package/context.runner-kctbfsde.js +34 -0
- package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
- package/{devTui-h77zrjv5.js → devTui-rf374y2w.js} +1 -1
- package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
- package/{guideline.command-mffxknbr.js → guideline.command-zwypaqsh.js} +9 -5
- package/guidelines/agentRule/agentRule.instruction.md +25 -9
- package/guidelines/akanApi/akanApi.instruction.md +6 -4
- package/guidelines/conventions/core.md +23 -5
- package/guidelines/conventions/rules/app.md +4 -1
- package/guidelines/conventions/rules/page.md +5 -4
- package/guidelines/conventions/rules/ts.md +3 -3
- package/guidelines/errorCodes/errorCodes.instruction.md +165 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +225 -5
- package/guidelines/pageRule/pageRule.instruction.md +10 -1
- package/guidelines/queryRule/queryRule.instruction.md +3 -1
- package/guidelines/runtimeRule/runtimeRule.instruction.md +14 -8
- package/guidelines/transportRule/transportRule.instruction.md +31 -1
- package/incrementalBuilder.proc.js +577 -411
- package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
- package/{index-0gg15zwa.js → index-0s7w2085.js} +6 -6
- package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
- package/{index-swwjakt0.js → index-275a4r3n.js} +11 -11
- package/{index-j6gc8n14.js → index-2jmvfa62.js} +11 -9
- package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
- package/{index-exn38bzx.js → index-2yn3r67f.js} +116 -54
- package/{index-34792nh7.js → index-3txdtztz.js} +1 -1
- package/{index-28x1aszt.js → index-41a03gkj.js} +149 -53
- package/{index-2mf1aen9.js → index-4ss4gkv3.js} +2 -2
- package/{index-an76bdrv.js → index-612fdtbk.js} +1 -1
- package/{index-5radqwn2.js → index-67sd09ag.js} +12 -12
- package/{index-0hbtve0a.js → index-6dzjer7p.js} +32 -28
- package/{index-3ghdb7p5.js → index-71y6176j.js} +2777 -3676
- package/{index-xyn02k0w.js → index-78y75t0a.js} +662 -433
- package/index-7wf8snar.js +80 -0
- package/{index-skmtj8rm.js → index-8jtqfye2.js} +27 -10
- package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
- package/{index-nmvhjn8c.js → index-9wh04mqy.js} +93 -82
- package/{index-xvk2a75m.js → index-a860mx0m.js} +3 -3
- package/{index-5zwr4n6k.js → index-baccvws5.js} +65 -8
- package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
- package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
- package/{index-r0a604h4.js → index-c669pbyb.js} +5 -4
- package/{index-x40bdsca.js → index-dadwp2aw.js} +33 -98
- package/{index-vm0dn0mt.js → index-dmcpetwe.js} +200 -138
- package/{index-43f4h4cm.js → index-ebn9kgea.js} +6 -6
- package/{index-hqv34wzq.js → index-gt8phqpt.js} +10 -10
- package/{index-yckz5t8b.js → index-h901f24n.js} +516 -434
- package/{index-j3v29pq7.js → index-j0wr4e32.js} +219 -175
- package/{index-gcx48get.js → index-j592zfqc.js} +2 -2
- package/{index-grxs6fts.js → index-j6jjmn2r.js} +57 -31
- package/{index-w8yasvpc.js → index-jek2re5k.js} +2136 -2175
- package/{index-ny2k80mv.js → index-jf4vk1s0.js} +9 -2
- package/{index-gxav1bjz.js → index-k6vwww45.js} +9 -9
- package/{index-99qvtff2.js → index-kfvjzk8r.js} +5 -5
- package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
- package/{index-2r9ff9qm.js → index-nc3br31y.js} +2 -2
- package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
- package/{index-cmg5ngqa.js → index-p7beqww9.js} +2 -2
- package/{index-b4qq3rq0.js → index-rwgqba9p.js} +1 -1
- package/{index-rfzp4pqs.js → index-s885g0jj.js} +3 -3
- package/{index-9p260r4e.js → index-trffs83s.js} +538 -250
- package/{index-k92x3vne.js → index-v7ajmsh3.js} +1 -1
- package/index-w1zexzpx.js +127 -0
- package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
- package/{index-39jz41jb.js → index-xs9a3ddt.js} +3 -3
- package/{index-rp4yf32g.js → index-xwwex8rf.js} +36 -29
- package/{index-ra9fvn7s.js → index-ybcb9wc8.js} +74 -38
- package/index-z92zm3wd.js +788 -0
- package/{index-j9790rhk.js → index-z96ks033.js} +1509 -1121
- package/index-zfnz878d.js +30 -0
- package/{index-2vgv7fs7.js → index-zmd9xxgd.js} +727 -693
- package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
- package/index.js +28 -24
- package/libExecutor-jc6f8hm6.js +10 -0
- package/{library.command-bmd7zc5m.js → library.command-nxvesvhb.js} +12 -5
- package/{localRegistry.command-y6en1599.js → localRegistry.command-xz62e4ng.js} +29 -24
- package/{module.command-7exfffqw.js → module.command-aaws9byg.js} +11 -7
- package/{package.command-adskw2rj.js → package.command-j7hv26p0.js} +14 -10
- package/package.json +8 -8
- package/{page.command-dw01272p.js → page.command-7yffs7n9.js} +8 -4
- package/{pipeline.command-0b1r3y5r.js → pipeline.command-7yk0zcng.js} +15 -9
- package/pkgExecutor-arxmvx4t.js +10 -0
- package/{primitive.command-byw6vc04.js → primitive.command-7a1pt715.js} +12 -8
- package/{projectTypecheck-kkrpq60a.js → projectTypecheck-f4qhbecd.js} +1 -1
- package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
- package/{quality.command-6rqnhzct.js → quality.command-c6mvrjh1.js} +25 -16
- package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
- package/{repair.command-rw5zymak.js → repair.command-093adzt9.js} +12 -8
- package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
- package/{scalar.command-2dyp9nh9.js → scalar.command-2ex84spb.js} +10 -6
- package/skills/akan-debug/SKILL.md +8 -5
- package/skills/akan-err/SKILL.md +7 -0
- package/skills/akan-mcp/SKILL.md +19 -1
- package/skills/akan-scaffold/SKILL.md +1 -1
- package/skills/akan-validate/SKILL.md +3 -3
- package/{subspace.command-111ynwv1.js → subspace.command-4n4n4jpv.js} +32 -24
- package/templates/app/page/_layout.tsx +13 -0
- package/templates/app/page/styles.css.template +40 -0
- package/templates/appSample/page/_index.tsx +9 -9
- package/templates/appSample/page/_layout.tsx +1 -0
- package/templates/appSample/page/styles.css.template +40 -5
- package/templates/appSample/ui/Recipe/jellyButton.ts +1 -1
- package/templates/biomeForm.ts +1 -1
- package/templates/env/_env.server.type.ts +1 -1
- package/templates/facetIndex/index.ts +2 -37
- package/templates/lib/sig.ts +0 -4
- package/templates/lib/useClient.ts +1 -1
- package/templates/workspaceRoot/.devcontainer/devcontainer.json.template +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +2 -1
- package/templates/workspaceRoot/README.ts +4 -2
- package/{tunnel.command-2gcpfbdj.js → tunnel.command-f7ep1qfa.js} +17 -13
- package/{typeChecker-s640r6c0.js → typeChecker-7jt6abrs.js} +1 -1
- package/typecheck.proc.js +3 -2
- package/{verify.command-djgs86ma.js → verify.command-zrkxnvct.js} +21 -17
- package/{workflow.command-n0k2mxr5.js → workflow.command-ks16jegk.js} +21 -14
- package/{workspace.command-fh1qwxfx.js → workspace.command-ahhfpaag.js} +60 -54
- package/CodeAgent-x2p3a3e0.js +0 -11
- package/TunnelShare-c4xsfzg5.js +0 -15
- package/agent.command-9et2e27p.js +0 -52
- package/cloud.script-xze4zh7n.js +0 -31
- package/context.command-rk1dwrg4.js +0 -57
- package/context.runner-83ky5m1b.js +0 -30
- /package/templates/{appSample → app}/public/fonts/Pretendard-Bold.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-Medium.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-Regular.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
execEmoji,
|
|
4
|
+
Executor
|
|
5
|
+
} from "./index-71y6176j.js";
|
|
6
|
+
// pkgs/@akanjs/devkit/executors/moduleExecutor.ts
|
|
7
|
+
class ModuleExecutor extends Executor {
|
|
8
|
+
sys;
|
|
9
|
+
emoji = execEmoji.module;
|
|
10
|
+
constructor({ sys, name }) {
|
|
11
|
+
super(name, `${sys.workspace.workspaceRoot}/${sys.type}s/${sys.name}/lib/${name}`);
|
|
12
|
+
this.sys = sys;
|
|
13
|
+
}
|
|
14
|
+
static from(sysExecutor, name) {
|
|
15
|
+
return new ModuleExecutor({ sys: sysExecutor, name });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// pkgs/@akanjs/devkit/util/errorReport.ts
|
|
19
|
+
import { realpathSync } from "fs";
|
|
20
|
+
import path from "path";
|
|
21
|
+
|
|
22
|
+
class ErrorReport {
|
|
23
|
+
static shownNestedErrors = 20;
|
|
24
|
+
static format(error, workspaceRoot = process.cwd()) {
|
|
25
|
+
return ErrorReport.#format(error, workspaceRoot, []);
|
|
26
|
+
}
|
|
27
|
+
static #format(error, workspaceRoot, ancestors) {
|
|
28
|
+
if (ancestors.includes(error))
|
|
29
|
+
return "[circular]";
|
|
30
|
+
const chain = [...ancestors, error];
|
|
31
|
+
if (error instanceof AggregateError) {
|
|
32
|
+
const shown = error.errors.slice(0, ErrorReport.shownNestedErrors);
|
|
33
|
+
const hidden = error.errors.length - shown.length;
|
|
34
|
+
const nestedMessages = [
|
|
35
|
+
...shown.map((nestedError, index) => ErrorReport.#format(nestedError, workspaceRoot, chain).trim() || `Unknown error ${index + 1}`),
|
|
36
|
+
...hidden > 0 ? [`\u2026and ${hidden} more`] : []
|
|
37
|
+
].map((message) => message.replace(/^/gm, " ")).join(`
|
|
38
|
+
`);
|
|
39
|
+
const message = nestedMessages ? `${error.message}
|
|
40
|
+
${nestedMessages}` : error.message;
|
|
41
|
+
return `${message}${ErrorReport.#causeOf(error, workspaceRoot, chain)}`;
|
|
42
|
+
}
|
|
43
|
+
if (error instanceof Error)
|
|
44
|
+
return `${ErrorReport.#withLocation(error.message, error, workspaceRoot)}${ErrorReport.#causeOf(error, workspaceRoot, chain)}`;
|
|
45
|
+
if (typeof error === "object" && error !== null && "message" in error)
|
|
46
|
+
return ErrorReport.#withLocation(String(error.message), error, workspaceRoot);
|
|
47
|
+
return String(error);
|
|
48
|
+
}
|
|
49
|
+
static #causeOf(error, workspaceRoot, chain) {
|
|
50
|
+
return error.cause ? `
|
|
51
|
+
Caused by: ${ErrorReport.#format(error.cause, workspaceRoot, chain)}` : "";
|
|
52
|
+
}
|
|
53
|
+
static #withLocation(message, error, workspaceRoot) {
|
|
54
|
+
const { position } = error;
|
|
55
|
+
if (!position?.file)
|
|
56
|
+
return message;
|
|
57
|
+
const file = ErrorReport.#relativeToWorkspace(position.file, workspaceRoot);
|
|
58
|
+
const location = position.line > 0 ? `${file}:${position.line}:${position.column}` : file;
|
|
59
|
+
return message.includes(location) ? message : message.replace(/^.*/, (headline) => `${headline} (${location})`);
|
|
60
|
+
}
|
|
61
|
+
static #relativeToWorkspace(file, workspaceRoot) {
|
|
62
|
+
if (!path.isAbsolute(file))
|
|
63
|
+
return file;
|
|
64
|
+
for (const root of [workspaceRoot, ErrorReport.#realpathOf(workspaceRoot)]) {
|
|
65
|
+
const relative = path.relative(root, file);
|
|
66
|
+
if (!relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative))
|
|
67
|
+
return relative.replaceAll(path.sep, "/");
|
|
68
|
+
}
|
|
69
|
+
return file;
|
|
70
|
+
}
|
|
71
|
+
static #realpathOf(dir) {
|
|
72
|
+
try {
|
|
73
|
+
return realpathSync(dir);
|
|
74
|
+
} catch {
|
|
75
|
+
return dir;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { ModuleExecutor, ErrorReport };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AkanCodeEnv,
|
|
4
4
|
akanCodePaths2
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-p5zh7pmc.js";
|
|
6
6
|
import {
|
|
7
7
|
akanCodeDefaultModel2,
|
|
8
8
|
akanCodeModel2,
|
|
@@ -10,16 +10,16 @@ import {
|
|
|
10
10
|
akanCodeModelWarnings2,
|
|
11
11
|
McpServerConfig,
|
|
12
12
|
WorkspaceTrust
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-0dm25wvf.js";
|
|
14
14
|
import {
|
|
15
15
|
PreviewView2,
|
|
16
16
|
stripAnsi
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-rwgqba9p.js";
|
|
18
18
|
import {
|
|
19
19
|
SubagentPool2,
|
|
20
20
|
McpSignIn,
|
|
21
21
|
AkanCodeCompaction2
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-nc3br31y.js";
|
|
23
23
|
import {
|
|
24
24
|
codeAgentIsLoopback,
|
|
25
25
|
codeAgentHostListed,
|
|
@@ -171,7 +171,7 @@ var akanSystemPrompt2 = (profile) => {
|
|
|
171
171
|
lines.push(`- Some tool calls need the user's approval (policy: ${profile.approval}). A refusal is an answer; do not retry it a different way.`);
|
|
172
172
|
if (profile.network.askOutside)
|
|
173
173
|
lines.push("- `web_fetch` to a host outside a short list of documentation sites, and a shell command that reaches the network (`curl`, `wget`, `ssh`, \u2026), wait for the user's approval. A refusal is an answer; do not retry it a different way.");
|
|
174
|
-
lines.push("- Secrets are refused at the tool boundary. If you need a value from `.env`, ask the user for it rather than looking for another way to read the file.", "", "## How to answer", "", "- Answer in as few words as carry the answer. A short question gets one sentence with no heading.", "- Do not open with what you are about to do, and do not
|
|
174
|
+
lines.push("- Secrets are refused at the tool boundary. If you need a value from `.env`, ask the user for it rather than looking for another way to read the file.", "", "## How to answer", "", "- Answer in as few words as carry the answer. A short question gets one sentence with no heading.", "- Do not open with what you are about to do, and do not retell the tool calls at the end; they are already on the user's screen. A turn that changed files closes with those files and what `akan_verify` said.", "- Skip headings, bold labels and bullet lists unless the answer is genuinely a list. Prose is shorter.", "- State a file as `path:line`. Do not paste a file back that the user can open.", "- Say what you could not do, and why, in one line. Do not offer alternatives nobody asked for.");
|
|
175
175
|
return lines.join(`
|
|
176
176
|
`);
|
|
177
177
|
};
|
|
@@ -267,7 +267,8 @@ class AkanCodeServices2 {
|
|
|
267
267
|
enableInstallTelemetry: false,
|
|
268
268
|
enableAnalytics: false,
|
|
269
269
|
quietStartup: true,
|
|
270
|
-
compaction: { reserveTokens: AkanCodeCompaction2.reserveFloor }
|
|
270
|
+
compaction: { reserveTokens: AkanCodeCompaction2.reserveFloor },
|
|
271
|
+
cacheWarming: "streaming"
|
|
271
272
|
});
|
|
272
273
|
}
|
|
273
274
|
static async runtime(workspaceRoot, proxy = null) {
|
|
@@ -276,12 +277,28 @@ class AkanCodeServices2 {
|
|
|
276
277
|
authPath: proxy ? path4.join(mkdtempSync(path4.join(tmpdir(), "akan-code-proxy-")), "auth.json") : akanCodePaths2.authFile(),
|
|
277
278
|
modelsPath: akanCodePaths2.modelsFile()
|
|
278
279
|
});
|
|
280
|
+
AkanCodeServices2.#holdMessageThreadsOff(runtime);
|
|
279
281
|
if (proxy)
|
|
280
282
|
await proxy.apply(runtime);
|
|
281
283
|
else
|
|
282
284
|
await AkanEnvKeys2.apply(runtime, workspaceRoot);
|
|
283
285
|
return runtime;
|
|
284
286
|
}
|
|
287
|
+
static #holdMessageThreadsOff(runtime) {
|
|
288
|
+
const target = runtime;
|
|
289
|
+
const original = target.prepareRequest?.bind(runtime);
|
|
290
|
+
if (!original)
|
|
291
|
+
throw new Error("The model runtime no longer exposes prepareRequest; update AkanCodeServices");
|
|
292
|
+
target.prepareRequest = async (model, options) => {
|
|
293
|
+
const prepared = await original(model, options);
|
|
294
|
+
if (prepared.model.compat?.supportsMessageThreads !== undefined)
|
|
295
|
+
return prepared;
|
|
296
|
+
return {
|
|
297
|
+
...prepared,
|
|
298
|
+
model: { ...prepared.model, compat: { ...prepared.model.compat, supportsMessageThreads: false } }
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
}
|
|
285
302
|
static sessions(workspaceRoot, cwd, profile, resume) {
|
|
286
303
|
if (profile.session.store === "memory")
|
|
287
304
|
return SessionManager.inMemory(cwd);
|
|
@@ -659,7 +676,7 @@ class AkanToolPack2 {
|
|
|
659
676
|
return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
|
|
660
677
|
}
|
|
661
678
|
async names() {
|
|
662
|
-
const { ContextRunner } = await import("./context.runner-
|
|
679
|
+
const { ContextRunner } = await import("./context.runner-kctbfsde.js");
|
|
663
680
|
return [
|
|
664
681
|
...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
|
|
665
682
|
AkanToolPack2.verifyToolName
|
|
@@ -667,7 +684,7 @@ class AkanToolPack2 {
|
|
|
667
684
|
}
|
|
668
685
|
static verifyToolName = "akan_verify";
|
|
669
686
|
async#register(pi) {
|
|
670
|
-
const { ContextRunner } = await import("./context.runner-
|
|
687
|
+
const { ContextRunner } = await import("./context.runner-kctbfsde.js");
|
|
671
688
|
const runner = new ContextRunner;
|
|
672
689
|
const guidelineNames = await AkanToolPack2.#guidelineNames();
|
|
673
690
|
for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
|
|
@@ -694,7 +711,7 @@ class AkanToolPack2 {
|
|
|
694
711
|
pi.registerTool({
|
|
695
712
|
name: AkanToolPack2.verifyToolName,
|
|
696
713
|
label: "akan verify",
|
|
697
|
-
description: "Run `akan verify` over everything the working tree has changed: sync, lint (with fixes), typecheck, a
|
|
714
|
+
description: "Run `akan verify` over everything the working tree has changed: sync, lint (with fixes), typecheck, a build of each changed app's server and SSR routes, and the SSR check for .tsx changes, in one call. It prints one line when it passes and one line per problem when it fails. Call this after editing, before you finish; never run lint, typecheck or build separately.",
|
|
698
715
|
promptSnippet: "akan_verify: sync, lint, typecheck and build what the working tree changed, in one call",
|
|
699
716
|
parameters: Type.Object({}),
|
|
700
717
|
execute: async () => {
|
|
@@ -705,7 +722,7 @@ class AkanToolPack2 {
|
|
|
705
722
|
}
|
|
706
723
|
static async#guidelineNames() {
|
|
707
724
|
try {
|
|
708
|
-
const { Prompter } = await import("./prompter-
|
|
725
|
+
const { Prompter } = await import("./prompter-qyggfhqd.js");
|
|
709
726
|
return await Prompter.listGuidelines();
|
|
710
727
|
} catch {
|
|
711
728
|
return [];
|
|
@@ -758,4 +758,4 @@ class CodeTuiParts2 {
|
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
760
|
|
|
761
|
-
export {
|
|
761
|
+
export { CodeTuiCommands2, CodeTuiLines2, CodeTuiEditor2, CodeTuiAgents2, CodeTuiMarkdown2, CodeTuiParts2, CodeTuiClipboard2, CodeTuiFiles2 };
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
AsyncDefaultExportDetector,
|
|
4
4
|
StoreBootstrap,
|
|
5
5
|
resolveSsrPageEntriesForApp
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-z92zm3wd.js";
|
|
7
7
|
import {
|
|
8
8
|
FileSys2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-by2tvsq6.js";
|
|
10
10
|
|
|
11
11
|
// pkgs/@akanjs/devkit/transforms/barrelAnalyzer.ts
|
|
12
12
|
import fs from "fs";
|
|
@@ -48,6 +48,7 @@ var parseNamedList = (listBody) => {
|
|
|
48
48
|
// pkgs/@akanjs/devkit/transforms/barrelAnalyzer.ts
|
|
49
49
|
var REEXPORT_RE = /(?:^|\n)\s*export\s+(?:type\s+)?(?:(\*)(?:\s+as\s+(\w+))?|\{\s*([^}]*?)\s*\})\s+from\s+(["'])([^"']+)\4;?/g;
|
|
50
50
|
var LOCAL_NAMED_RE = /(?:^|\n)\s*export\s+\{\s*([^}]*?)\s*\}(?!\s*from)/g;
|
|
51
|
+
var MACRO_ATTR_RE = /\swith\s*\{\s*type\s*:\s*["']macro["']\s*\}/g;
|
|
51
52
|
var CANDIDATE_EXTS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
52
53
|
|
|
53
54
|
class BarrelAnalyzer {
|
|
@@ -102,17 +103,18 @@ class BarrelAnalyzer {
|
|
|
102
103
|
const map = new Map;
|
|
103
104
|
const read = new Set;
|
|
104
105
|
this.#read.set(pkgName, read);
|
|
105
|
-
await this.#walk(pkg.entryFile, pkg, map, read);
|
|
106
|
+
await this.#walk(pkg.entryFile, pkg, map, { visited: new Set, read, following: new Set([pkg.entryFile]) });
|
|
106
107
|
return map;
|
|
107
108
|
} catch (err) {
|
|
108
109
|
this.#logger.error(`analyze failed for ${pkgName}: ${err.message}`);
|
|
109
110
|
return null;
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
async#walk(absFile, pkg, map,
|
|
113
|
-
if (visited.has(absFile))
|
|
113
|
+
async#walk(absFile, pkg, map, walk) {
|
|
114
|
+
if (walk.visited.has(absFile))
|
|
114
115
|
return;
|
|
115
|
-
visited.add(absFile);
|
|
116
|
+
walk.visited.add(absFile);
|
|
117
|
+
walk.read.add(absFile);
|
|
116
118
|
const file = Bun.file(absFile);
|
|
117
119
|
if (!await file.exists())
|
|
118
120
|
return;
|
|
@@ -123,13 +125,14 @@ class BarrelAnalyzer {
|
|
|
123
125
|
const authoritative = this.#scanExports(source, absFile);
|
|
124
126
|
authoritative.delete("default");
|
|
125
127
|
const attributed = new Set;
|
|
126
|
-
const attribute = (listBody, subpath) => {
|
|
128
|
+
const attribute = (listBody, subpath, source) => {
|
|
127
129
|
for (const item of parseNamedList(listBody)) {
|
|
128
130
|
if (item.isType || item.imported === "default" || !authoritative.has(item.local))
|
|
129
131
|
continue;
|
|
130
132
|
attributed.add(item.local);
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
+
if (map.has(item.local))
|
|
134
|
+
continue;
|
|
135
|
+
map.set(item.local, source?.get(item.imported) ?? { subpath, originalName: item.imported });
|
|
133
136
|
}
|
|
134
137
|
};
|
|
135
138
|
const starSpecs = [];
|
|
@@ -158,7 +161,7 @@ class BarrelAnalyzer {
|
|
|
158
161
|
continue;
|
|
159
162
|
const targetSubpath = this.#subpathFor(pkg, targetAbs);
|
|
160
163
|
if (targetSubpath)
|
|
161
|
-
attribute(namedList, targetSubpath);
|
|
164
|
+
attribute(namedList, targetSubpath, await this.#exportsOf(targetAbs, pkg, walk));
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
LOCAL_NAMED_RE.lastIndex = 0;
|
|
@@ -178,16 +181,24 @@ class BarrelAnalyzer {
|
|
|
178
181
|
for (const spec of starSpecs) {
|
|
179
182
|
const targetAbs = await this.#resolveRel(absFile, spec);
|
|
180
183
|
if (targetAbs)
|
|
181
|
-
await this.#walk(targetAbs, pkg, map,
|
|
184
|
+
await this.#walk(targetAbs, pkg, map, walk);
|
|
182
185
|
}
|
|
183
186
|
}
|
|
187
|
+
async#exportsOf(absFile, pkg, walk) {
|
|
188
|
+
if (walk.following.has(absFile))
|
|
189
|
+
return null;
|
|
190
|
+
const map = new Map;
|
|
191
|
+
const following = new Set([...walk.following, absFile]);
|
|
192
|
+
await this.#walk(absFile, pkg, map, { visited: new Set, read: walk.read, following });
|
|
193
|
+
return map;
|
|
194
|
+
}
|
|
184
195
|
#scanExports(source, absFile) {
|
|
185
196
|
try {
|
|
186
197
|
const transpiler = [".tsx", ".jsx"].includes(path.extname(absFile)) ? this.#tsxTranspiler : this.#tsTranspiler;
|
|
187
|
-
const { exports } = transpiler.scan(source);
|
|
198
|
+
const { exports } = transpiler.scan(source.replaceAll(MACRO_ATTR_RE, ""));
|
|
188
199
|
return new Set(exports);
|
|
189
200
|
} catch (err) {
|
|
190
|
-
this.#logger.error(`scan failed: ${err.message}`);
|
|
201
|
+
this.#logger.error(`scan failed for ${absFile}: ${err.message}`);
|
|
191
202
|
return new Set;
|
|
192
203
|
}
|
|
193
204
|
}
|
|
@@ -264,7 +275,7 @@ var createBarrelImportsPlugin = async (app, { skipPath = defaultSkipPath, pipeAf
|
|
|
264
275
|
let source = await file.text();
|
|
265
276
|
if (skipPath(realPath))
|
|
266
277
|
return { contents: source, loader };
|
|
267
|
-
if (!
|
|
278
|
+
if (!MACRO_ATTR_RE2.test(source) && barrels.length > 0) {
|
|
268
279
|
const rewritten = await rewriteBarrelImports(source, barrels, analyzer);
|
|
269
280
|
if (rewritten !== null)
|
|
270
281
|
source = rewritten;
|
|
@@ -434,7 +445,7 @@ var resolveFileCandidate = async (candidate) => {
|
|
|
434
445
|
}
|
|
435
446
|
return null;
|
|
436
447
|
};
|
|
437
|
-
var
|
|
448
|
+
var MACRO_ATTR_RE2 = /with\s*\{\s*type\s*:\s*["']macro["']\s*\}/;
|
|
438
449
|
var workspaceBarrels = (barrels) => barrels.filter((barrel) => /^@(?:apps|libs)\//.test(barrel));
|
|
439
450
|
var rewriteBarrelImports = async (source, barrels, analyzer, { keepLines = false, specifierOf = (subpath) => subpath, onImport } = {}) => {
|
|
440
451
|
if (!barrels.some((barrel) => source.includes(barrel)))
|
|
@@ -569,6 +580,50 @@ var serializeNamedItem = (item) => {
|
|
|
569
580
|
return `${prefix}${item.imported} as ${item.local}`;
|
|
570
581
|
};
|
|
571
582
|
|
|
583
|
+
// pkgs/@akanjs/devkit/transforms/rscUseClientTransform.ts
|
|
584
|
+
import path3 from "path";
|
|
585
|
+
import ts2 from "typescript";
|
|
586
|
+
var USE_CLIENT_RE = /^\s*(?:\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\/\s*|\/\/[^\n]*\n\s*)*["']use client["']/;
|
|
587
|
+
var IMPLICIT_ROOT_LAYOUT_RE = /[/\\]\.akan[/\\]generated[/\\](?:implicit-root-layout|root-layouts[/\\][^/\\]*__root_layout)\.(tsx|ts|jsx|js)$/;
|
|
588
|
+
var STAR_REEXPORT_HINT_RE = /\bexport\s*\*\s*from\b/;
|
|
589
|
+
var hasUseClientDirective = (source) => USE_CLIENT_RE.test(source);
|
|
590
|
+
function toClientReferencePath(absPath, workspaceRoot) {
|
|
591
|
+
return path3.relative(path3.resolve(workspaceRoot), path3.resolve(absPath)).split(path3.sep).join("/");
|
|
592
|
+
}
|
|
593
|
+
var starReexportSpecifiers = (source, filePath) => ts2.createSourceFile(filePath, source, ts2.ScriptTarget.Latest).statements.filter((statement) => ts2.isExportDeclaration(statement) && !statement.exportClause && !statement.isTypeOnly && !!statement.moduleSpecifier && ts2.isStringLiteral(statement.moduleSpecifier)).map((statement) => statement.moduleSpecifier.text);
|
|
594
|
+
var scanUseClientExports = (source, filePath, workspaceRoot) => {
|
|
595
|
+
const stars = USE_CLIENT_RE.test(source) && STAR_REEXPORT_HINT_RE.test(source) ? starReexportSpecifiers(source, filePath) : [];
|
|
596
|
+
if (stars.length) {
|
|
597
|
+
const file = workspaceRoot ? toClientReferencePath(filePath, workspaceRoot) : filePath;
|
|
598
|
+
const listed = stars.slice(0, 3).map((specifier) => `\`export * from ${JSON.stringify(specifier)}\``);
|
|
599
|
+
const written = stars.length > 3 ? `${listed.join(", ")} (and ${stars.length - 3} more)` : listed.join(", ");
|
|
600
|
+
throw new Error(`${file} is a "use client" module, so it cannot ${written}: the server sees only the names a client module ` + `declares, and a star re-export declares none. Re-export them by name \u2014 \`export { \u2026 } from ${JSON.stringify(stars[0])}\`.`);
|
|
601
|
+
}
|
|
602
|
+
return new Bun.Transpiler({ loader: loaderFor(filePath) }).scan(source).exports;
|
|
603
|
+
};
|
|
604
|
+
function transformUseClient(source, args) {
|
|
605
|
+
if (!USE_CLIENT_RE.test(source))
|
|
606
|
+
return null;
|
|
607
|
+
if (IMPLICIT_ROOT_LAYOUT_RE.test(args.path))
|
|
608
|
+
return null;
|
|
609
|
+
const exports = scanUseClientExports(source, args.path, args.workspaceRoot);
|
|
610
|
+
if (exports.length === 0)
|
|
611
|
+
return null;
|
|
612
|
+
args.onClientModule?.(args.path, exports);
|
|
613
|
+
const referencePath = args.workspaceRoot ? toClientReferencePath(args.path, args.workspaceRoot) : args.path;
|
|
614
|
+
const filePathLit = JSON.stringify(referencePath);
|
|
615
|
+
const lines = [`import { registerClientReference } from "react-server-dom-webpack/server.node";`];
|
|
616
|
+
for (const name of exports) {
|
|
617
|
+
const nameLit = JSON.stringify(name);
|
|
618
|
+
const errMsg = JSON.stringify(`Attempted to call '${name}' from '${referencePath}' on the server, but it is a client-only export.`);
|
|
619
|
+
const proxy = `() => { throw new Error(${errMsg}); }`;
|
|
620
|
+
const binding = name === "default" ? `export default registerClientReference(${proxy}, ${filePathLit}, ${nameLit});` : `export const ${name} = registerClientReference(${proxy}, ${filePathLit}, ${nameLit});`;
|
|
621
|
+
lines.push(binding);
|
|
622
|
+
}
|
|
623
|
+
return lines.join(`
|
|
624
|
+
`);
|
|
625
|
+
}
|
|
626
|
+
|
|
572
627
|
// pkgs/@akanjs/devkit/frontendBuild/bundleDefine.ts
|
|
573
628
|
var bundleConditions = (command) => command === "build" ? ["production"] : [];
|
|
574
629
|
var bundleDefine = (app, command, renderEnv) => {
|
|
@@ -583,7 +638,7 @@ var bundleDefine = (app, command, renderEnv) => {
|
|
|
583
638
|
|
|
584
639
|
// pkgs/@akanjs/devkit/frontendBuild/csrDevPaths.ts
|
|
585
640
|
import fs2 from "fs";
|
|
586
|
-
import
|
|
641
|
+
import path4 from "path";
|
|
587
642
|
|
|
588
643
|
class CsrDevPaths {
|
|
589
644
|
static modulePrefix = "akan-module:";
|
|
@@ -596,18 +651,18 @@ class CsrDevPaths {
|
|
|
596
651
|
}
|
|
597
652
|
idOf(file) {
|
|
598
653
|
const real = CsrDevPaths.realpath(file);
|
|
599
|
-
const relative =
|
|
600
|
-
const id = relative.startsWith("..") ||
|
|
601
|
-
return id.split(
|
|
654
|
+
const relative = path4.relative(this.root, real);
|
|
655
|
+
const id = relative.startsWith("..") || path4.isAbsolute(relative) ? real : relative;
|
|
656
|
+
return id.split(path4.sep).join("/");
|
|
602
657
|
}
|
|
603
658
|
fileOf(id) {
|
|
604
|
-
return
|
|
659
|
+
return path4.isAbsolute(id) ? id : path4.join(this.root, id);
|
|
605
660
|
}
|
|
606
661
|
static isStub(target) {
|
|
607
662
|
return target.startsWith(CsrDevPaths.stubPrefix);
|
|
608
663
|
}
|
|
609
664
|
static isVendorFile(file) {
|
|
610
|
-
return file.includes(`${
|
|
665
|
+
return file.includes(`${path4.sep}node_modules${path4.sep}`);
|
|
611
666
|
}
|
|
612
667
|
static isScript(file) {
|
|
613
668
|
return /\.[cm]?[jt]sx?$/.test(file);
|
|
@@ -620,7 +675,7 @@ class CsrDevPaths {
|
|
|
620
675
|
return await source.exists() ? Bun.hash(await source.arrayBuffer()).toString(36) : "";
|
|
621
676
|
}
|
|
622
677
|
static realpath(file) {
|
|
623
|
-
return fs2.existsSync(file) ? fs2.realpathSync.native(file) :
|
|
678
|
+
return fs2.existsSync(file) ? fs2.realpathSync.native(file) : path4.resolve(file);
|
|
624
679
|
}
|
|
625
680
|
static isNamed(file) {
|
|
626
681
|
try {
|
|
@@ -637,7 +692,7 @@ class CsrDevPaths {
|
|
|
637
692
|
return CsrDevPaths.#asFile(base, kind) ?? CsrDevPaths.#asFolder(base, kind);
|
|
638
693
|
}
|
|
639
694
|
static resolveRelative(dir, specifier, kind = "import") {
|
|
640
|
-
const base =
|
|
695
|
+
const base = path4.resolve(dir, specifier);
|
|
641
696
|
const folder = /(^|[\\/])\.\.?$|[\\/]$/.test(specifier);
|
|
642
697
|
return folder ? CsrDevPaths.#asFolder(base, kind) : CsrDevPaths.resolveOnDisk(base, kind);
|
|
643
698
|
}
|
|
@@ -647,15 +702,15 @@ class CsrDevPaths {
|
|
|
647
702
|
}
|
|
648
703
|
static #asFolder(dir, kind) {
|
|
649
704
|
const entry = CsrDevPaths.#packageEntryOf(dir, kind);
|
|
650
|
-
const named = entry ? CsrDevPaths.#asFile(
|
|
705
|
+
const named = entry ? CsrDevPaths.#asFile(path4.join(dir, entry), kind) ?? CsrDevPaths.#indexOf(path4.join(dir, entry), kind) : null;
|
|
651
706
|
return named ?? CsrDevPaths.#indexOf(dir, kind);
|
|
652
707
|
}
|
|
653
708
|
static #indexOf(dir, kind) {
|
|
654
|
-
return CsrDevPaths.#asFile(
|
|
709
|
+
return CsrDevPaths.#asFile(path4.join(dir, "index"), kind);
|
|
655
710
|
}
|
|
656
711
|
static #packageEntryOf(dir, kind) {
|
|
657
712
|
try {
|
|
658
|
-
const pkg = JSON.parse(fs2.readFileSync(
|
|
713
|
+
const pkg = JSON.parse(fs2.readFileSync(path4.join(dir, "package.json"), "utf8"));
|
|
659
714
|
const fields = kind === "require" ? [pkg.browser, pkg.main] : [pkg.browser, pkg.module, pkg.main];
|
|
660
715
|
const entry = fields.find((field) => typeof field === "string");
|
|
661
716
|
return typeof entry === "string" ? entry : null;
|
|
@@ -668,11 +723,11 @@ class CsrDevPaths {
|
|
|
668
723
|
const name = first.startsWith("@") ? `${first}/${second}` : first;
|
|
669
724
|
if (!name || name.startsWith("."))
|
|
670
725
|
return false;
|
|
671
|
-
for (let dir =
|
|
672
|
-
const pkgDir =
|
|
673
|
-
if (fs2.existsSync(
|
|
726
|
+
for (let dir = path4.resolve(from);; dir = path4.dirname(dir)) {
|
|
727
|
+
const pkgDir = path4.join(dir, "node_modules", name);
|
|
728
|
+
if (fs2.existsSync(path4.join(pkgDir, "package.json")))
|
|
674
729
|
return (fs2.statSync(pkgDir, { throwIfNoEntry: false })?.ctimeMs ?? 0) > since;
|
|
675
|
-
if (
|
|
730
|
+
if (path4.dirname(dir) === dir)
|
|
676
731
|
return false;
|
|
677
732
|
}
|
|
678
733
|
}
|
|
@@ -694,7 +749,7 @@ class CsrDevPaths {
|
|
|
694
749
|
}
|
|
695
750
|
|
|
696
751
|
// pkgs/@akanjs/devkit/frontendBuild/csrEntryFiles.ts
|
|
697
|
-
import
|
|
752
|
+
import path5 from "path";
|
|
698
753
|
|
|
699
754
|
class CsrEntryFiles {
|
|
700
755
|
static entryFilename(basePath) {
|
|
@@ -707,7 +762,7 @@ class CsrEntryFiles {
|
|
|
707
762
|
});
|
|
708
763
|
}
|
|
709
764
|
static basePathOfPageKey(pageKey, basePaths) {
|
|
710
|
-
const normalized = pageKey.split(
|
|
765
|
+
const normalized = pageKey.split(path5.sep).join("/").replace(/^\.\//, "");
|
|
711
766
|
const segments = normalized.split("/");
|
|
712
767
|
const firstPublicSegment = segments.find((segment) => segment !== "[lang]" && !/^\(.+\)$/.test(segment));
|
|
713
768
|
return firstPublicSegment && basePaths.includes(firstPublicSegment) ? firstPublicSegment : null;
|
|
@@ -720,7 +775,7 @@ import path9 from "path";
|
|
|
720
775
|
import ts3 from "typescript";
|
|
721
776
|
|
|
722
777
|
// pkgs/@akanjs/devkit/transforms/externalizeFrameworkPlugin.ts
|
|
723
|
-
import
|
|
778
|
+
import path6 from "path";
|
|
724
779
|
var DEFAULT_INCLUDE = ["akanjs/", "@apps/", "@libs/"];
|
|
725
780
|
var DEFAULT_EXCLUDE_EXACT = new Set(["akanjs/webkit", "@akanjs/cli", "@akanjs/devkit"]);
|
|
726
781
|
var DEFAULT_EXCLUDE_PREFIX = ["@akanjs/cli/", "@akanjs/devkit/"];
|
|
@@ -756,7 +811,7 @@ async function createExternalizeFrameworkPlugin(options) {
|
|
|
756
811
|
const replPath = repl?.endsWith("/*") ? repl.slice(0, -1) : repl ?? "";
|
|
757
812
|
if (!replPath)
|
|
758
813
|
continue;
|
|
759
|
-
const candidate =
|
|
814
|
+
const candidate = path6.resolve(workspaceRoot, replPath + suffix);
|
|
760
815
|
const hit = await firstExisting(candidate);
|
|
761
816
|
if (hit)
|
|
762
817
|
return hit;
|
|
@@ -766,8 +821,8 @@ async function createExternalizeFrameworkPlugin(options) {
|
|
|
766
821
|
if (!spec.startsWith(`${pkg}/`))
|
|
767
822
|
continue;
|
|
768
823
|
const suffix = spec.slice(pkg.length + 1);
|
|
769
|
-
const pkgDir =
|
|
770
|
-
const candidate =
|
|
824
|
+
const pkgDir = path6.dirname(path6.resolve(workspaceRoot, entryFile));
|
|
825
|
+
const candidate = path6.join(pkgDir, suffix);
|
|
771
826
|
const hit = await firstExisting(candidate);
|
|
772
827
|
if (hit)
|
|
773
828
|
return hit;
|
|
@@ -812,57 +867,13 @@ async function firstExisting(basePath) {
|
|
|
812
867
|
return candidate;
|
|
813
868
|
}
|
|
814
869
|
for (const ext of CANDIDATE_EXTS3) {
|
|
815
|
-
const candidate =
|
|
870
|
+
const candidate = path6.join(basePath, `index${ext}`);
|
|
816
871
|
if (await Bun.file(candidate).exists())
|
|
817
872
|
return candidate;
|
|
818
873
|
}
|
|
819
874
|
return null;
|
|
820
875
|
}
|
|
821
876
|
|
|
822
|
-
// pkgs/@akanjs/devkit/transforms/rscUseClientTransform.ts
|
|
823
|
-
import path6 from "path";
|
|
824
|
-
import ts2 from "typescript";
|
|
825
|
-
var USE_CLIENT_RE = /^\s*(?:\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\/\s*|\/\/[^\n]*\n\s*)*["']use client["']/;
|
|
826
|
-
var IMPLICIT_ROOT_LAYOUT_RE = /[/\\]\.akan[/\\]generated[/\\](?:implicit-root-layout|root-layouts[/\\][^/\\]*__root_layout)\.(tsx|ts|jsx|js)$/;
|
|
827
|
-
var STAR_REEXPORT_HINT_RE = /\bexport\s*\*\s*from\b/;
|
|
828
|
-
var hasUseClientDirective = (source) => USE_CLIENT_RE.test(source);
|
|
829
|
-
function toClientReferencePath(absPath, workspaceRoot) {
|
|
830
|
-
return path6.relative(path6.resolve(workspaceRoot), path6.resolve(absPath)).split(path6.sep).join("/");
|
|
831
|
-
}
|
|
832
|
-
var starReexportSpecifiers = (source, filePath) => ts2.createSourceFile(filePath, source, ts2.ScriptTarget.Latest).statements.filter((statement) => ts2.isExportDeclaration(statement) && !statement.exportClause && !statement.isTypeOnly && !!statement.moduleSpecifier && ts2.isStringLiteral(statement.moduleSpecifier)).map((statement) => statement.moduleSpecifier.text);
|
|
833
|
-
var scanUseClientExports = (source, filePath, workspaceRoot) => {
|
|
834
|
-
const stars = USE_CLIENT_RE.test(source) && STAR_REEXPORT_HINT_RE.test(source) ? starReexportSpecifiers(source, filePath) : [];
|
|
835
|
-
if (stars.length) {
|
|
836
|
-
const file = workspaceRoot ? toClientReferencePath(filePath, workspaceRoot) : filePath;
|
|
837
|
-
const listed = stars.slice(0, 3).map((specifier) => `\`export * from ${JSON.stringify(specifier)}\``);
|
|
838
|
-
const written = stars.length > 3 ? `${listed.join(", ")} (and ${stars.length - 3} more)` : listed.join(", ");
|
|
839
|
-
throw new Error(`${file} is a "use client" module, so it cannot ${written}: the server sees only the names a client module ` + `declares, and a star re-export declares none. Re-export them by name \u2014 \`export { \u2026 } from ${JSON.stringify(stars[0])}\`.`);
|
|
840
|
-
}
|
|
841
|
-
return new Bun.Transpiler({ loader: loaderFor(filePath) }).scan(source).exports;
|
|
842
|
-
};
|
|
843
|
-
function transformUseClient(source, args) {
|
|
844
|
-
if (!USE_CLIENT_RE.test(source))
|
|
845
|
-
return null;
|
|
846
|
-
if (IMPLICIT_ROOT_LAYOUT_RE.test(args.path))
|
|
847
|
-
return null;
|
|
848
|
-
const exports = scanUseClientExports(source, args.path, args.workspaceRoot);
|
|
849
|
-
if (exports.length === 0)
|
|
850
|
-
return null;
|
|
851
|
-
args.onClientModule?.(args.path, exports);
|
|
852
|
-
const referencePath = args.workspaceRoot ? toClientReferencePath(args.path, args.workspaceRoot) : args.path;
|
|
853
|
-
const filePathLit = JSON.stringify(referencePath);
|
|
854
|
-
const lines = [`import { registerClientReference } from "react-server-dom-webpack/server.node";`];
|
|
855
|
-
for (const name of exports) {
|
|
856
|
-
const nameLit = JSON.stringify(name);
|
|
857
|
-
const errMsg = JSON.stringify(`Attempted to call '${name}' from '${referencePath}' on the server, but it is a client-only export.`);
|
|
858
|
-
const proxy = `() => { throw new Error(${errMsg}); }`;
|
|
859
|
-
const binding = name === "default" ? `export default registerClientReference(${proxy}, ${filePathLit}, ${nameLit});` : `export const ${name} = registerClientReference(${proxy}, ${filePathLit}, ${nameLit});`;
|
|
860
|
-
lines.push(binding);
|
|
861
|
-
}
|
|
862
|
-
return lines.join(`
|
|
863
|
-
`);
|
|
864
|
-
}
|
|
865
|
-
|
|
866
877
|
// pkgs/@akanjs/devkit/transforms/useClientBundlePlugin.ts
|
|
867
878
|
function createUseClientBundlePlugin(options = {}) {
|
|
868
879
|
return {
|
|
@@ -1182,7 +1193,7 @@ class PagesBundleBuilder {
|
|
|
1182
1193
|
edits.push({
|
|
1183
1194
|
start: tokens[fetchProtoAt].start,
|
|
1184
1195
|
end: fetchProtoEnd.end,
|
|
1185
|
-
text: "const fetchProto = FetchClient.build<typeof signal>(cnst, serverFetch.serializedSignal, {
|
|
1196
|
+
text: "const fetchProto = FetchClient.build<typeof signal>(cnst, serverFetch.serializedSignal, { base: serverFetch });"
|
|
1186
1197
|
});
|
|
1187
1198
|
let transformed = source;
|
|
1188
1199
|
for (const { start, end, text } of edits.sort((a, b) => b.start - a.start))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
resolveSsrPageEntriesForApp
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-z92zm3wd.js";
|
|
5
5
|
import {
|
|
6
6
|
createBarrelImportsPlugin,
|
|
7
7
|
workspaceBarrels,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
CsrEntryFiles,
|
|
11
11
|
PagesEntrySourceGenerator,
|
|
12
12
|
PagesBundleBuilder
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-9wh04mqy.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/devkit/frontendBuild/csrArtifactBuilder.ts
|
|
16
16
|
import { mkdir as mkdir2, rm as rm2, unlink as unlink2 } from "fs/promises";
|
|
@@ -269,7 +269,7 @@ ${logs}` : ""}`);
|
|
|
269
269
|
await rm(stagingDir, { recursive: true, force: true });
|
|
270
270
|
}
|
|
271
271
|
static async discover(pageEntries, basePaths) {
|
|
272
|
-
const { RouteSourceValidator } = await import("./routeSourceValidator-
|
|
272
|
+
const { RouteSourceValidator } = await import("./routeSourceValidator-8n6j1vn7.js");
|
|
273
273
|
const roots = pageEntries.filter((entry) => parseRouteModuleKey(entry.key).isInternalRootLayout);
|
|
274
274
|
const overrides = pageEntries.filter((entry) => parseRouteModuleKey(entry.key).kind === "overrides");
|
|
275
275
|
const layoutNodes = new Set(pageEntries.flatMap((entry) => {
|