@akanjs/cli 3.2.0-rc.3 → 3.2.0-rc.30
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-c17abdbf.js +11 -0
- package/{CodeTui-wv9yf7eq.js → CodeTui-jed1nj82.js} +822 -666
- package/README.ko.md +26 -1
- package/README.md +26 -1
- package/TunnelShare-mbfcaqg0.js +18 -0
- package/agent.command-9whnc6vb.js +56 -0
- package/akanCode.js +12 -12
- package/appExecutor-020cyesq.js +11 -0
- package/{application.command-6515t682.js → application.command-4eqvyxkw.js} +77 -36
- package/{applicationBuildRunner-bqbyeg84.js → applicationBuildRunner-frtcrqfd.js} +18 -13
- package/buildBatch.proc.js +26 -11
- package/{cloud.command-32esk0v1.js → cloud.command-hbvmeezn.js} +31 -28
- package/cloud.script-9kmbr3d6.js +35 -0
- package/{code.command-xk7rwq2x.js → code.command-0ayrenk4.js} +14 -9
- package/{context.command-jwenkkf0.js → context.command-php852kf.js} +28 -23
- package/context.runner-nngmn7c0.js +34 -0
- package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
- package/{devTui-cd03z4mx.js → devTui-rf374y2w.js} +1 -1
- package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
- package/{guideline.command-w6yqpdec.js → guideline.command-w1grfwh7.js} +9 -4
- package/guidelines/agentRule/agentRule.instruction.md +29 -12
- package/guidelines/akanApi/akanApi.instruction.md +5 -3
- package/guidelines/conventions/core.md +23 -5
- package/guidelines/conventions/rules/app.md +4 -1
- package/guidelines/conventions/rules/page.md +5 -0
- package/guidelines/conventions/rules/ts.md +3 -3
- package/guidelines/errorCodes/errorCodes.instruction.md +158 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +96 -2
- package/guidelines/pageRule/pageRule.instruction.md +15 -1
- package/guidelines/runtimeRule/runtimeRule.instruction.md +12 -6
- package/guidelines/transportRule/transportRule.instruction.md +8 -1
- package/incrementalBuilder.proc.js +574 -410
- package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
- package/{index-xrmrvafh.js → index-0gaj78wn.js} +808 -694
- package/{index-j1hjb477.js → index-11d7nh8a.js} +1 -1
- package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
- package/{index-ygrdw6jw.js → index-1pjwsh2g.js} +65 -8
- package/{index-43acpsc7.js → index-28nk8w3j.js} +12 -12
- package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
- package/{index-8gm4yag8.js → index-42jhx2ya.js} +6 -6
- package/{index-2rqyrvcy.js → index-4st0hq72.js} +62 -33
- package/{index-bak9f2br.js → index-5d57kx0s.js} +15 -11
- package/{index-bdmgqzb5.js → index-6469101k.js} +58 -29
- package/{index-7kmbqp0b.js → index-6pxmcaq8.js} +1 -1
- package/{index-54s6knqe.js → index-6zb17wcm.js} +12 -10
- package/{index-0ba8nj4d.js → index-7bs463x7.js} +50 -38
- package/{index-y725zb1a.js → index-7v7tvgt7.js} +196 -168
- package/{index-r0a604h4.js → index-99kjwyma.js} +1 -1
- package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
- package/{index-386canwe.js → index-9rv2zt48.js} +186 -121
- package/{index-20wvskt8.js → index-9wab2ngg.js} +1 -1
- package/{index-2eym1yjb.js → index-9wjrwjgz.js} +288 -209
- package/{index-kcpk2d20.js → index-at6haq2x.js} +1474 -1139
- package/{index-6h775rv3.js → index-ba2xd32s.js} +53 -12
- package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
- package/{index-ngpt3zz3.js → index-bj8s07s7.js} +525 -440
- package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
- package/{index-vbhx60x5.js → index-cb91b6d8.js} +2140 -2165
- package/index-dss3ds74.js +127 -0
- package/{index-e22zedc2.js → index-f16kr6vj.js} +3 -3
- package/{index-ny2k80mv.js → index-ffa52fwf.js} +1 -1
- package/{index-djc5nxpy.js → index-fp5xf6ef.js} +6 -6
- package/{index-qrk06tfp.js → index-g45y5f3e.js} +2 -2
- package/{index-8jpc5fqv.js → index-g7jgd4xs.js} +2 -2
- package/index-j4yvgfhr.js +70 -0
- package/{index-ytpmk3pb.js → index-jgj31xvw.js} +18 -11
- package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
- package/{index-s34v3y28.js → index-m3t28rt3.js} +11 -11
- package/{index-dpgywgeq.js → index-m5gg0wzv.js} +27 -16
- package/index-na8r4a27.js +30 -0
- package/{index-h0p6n4k1.js → index-nm7nt9vm.js} +3 -3
- package/{index-j4hkbzj6.js → index-p06kfhdf.js} +6 -6
- package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
- package/{index-cmg5ngqa.js → index-p7beqww9.js} +2 -2
- package/{index-zhkcab5a.js → index-prgvqqxe.js} +580 -364
- package/{index-wfmpxke3.js → index-qssq2d41.js} +2775 -3677
- package/{index-sc0g6zbm.js → index-rwgqba9p.js} +24 -11
- package/{index-zcdmnfrf.js → index-s3m89wt2.js} +9 -9
- package/{index-v50xjbbe.js → index-t4d0ckde.js} +1 -1
- package/{index-9p260r4e.js → index-trffs83s.js} +538 -250
- package/{index-ddk49ypz.js → index-v929w7j7.js} +133 -49
- package/index-va90m8nd.js +25 -0
- package/index-vjbne22r.js +80 -0
- package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
- package/{index-39jz41jb.js → index-xs9a3ddt.js} +3 -3
- package/{index-84c2pgak.js → index-yvzm8mby.js} +94 -82
- package/{index-wr9magsr.js → index-yxkjsyx8.js} +3 -3
- package/index-ze48c0vd.js +788 -0
- package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
- package/index.js +29 -24
- package/libExecutor-tq994592.js +10 -0
- package/{library.command-qs8beggh.js → library.command-x219mhcx.js} +9 -4
- package/{localRegistry.command-hz4ged9n.js → localRegistry.command-zvdcejhn.js} +30 -24
- package/{module.command-z9js77m2.js → module.command-k6cwcm7g.js} +17 -8
- package/{package.command-zqenq8c0.js → package.command-vw7x09f8.js} +13 -8
- package/package.json +2 -2
- package/{page.command-t0nx1jat.js → page.command-gf06paq2.js} +9 -4
- package/{pipeline.command-2yjeas7m.js → pipeline.command-y07dgj9b.js} +14 -8
- package/pkgExecutor-stde3yc3.js +10 -0
- package/{primitive.command-v5kypwy4.js → primitive.command-edydvh07.js} +13 -8
- package/{projectTypecheck-s9hhe5sa.js → projectTypecheck-mk8wefvd.js} +2 -1
- package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
- package/{quality.command-q55j2htd.js → quality.command-mdb45vyr.js} +23 -16
- package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
- package/{repair.command-7ssbbdq2.js → repair.command-kvtaeecy.js} +13 -8
- package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
- package/{scalar.command-p5jb7z57.js → scalar.command-sjt9p5e1.js} +11 -6
- package/skills/akan-debug/SKILL.md +10 -3
- package/skills/akan-err/SKILL.md +7 -0
- package/skills/akan-mcp/SKILL.md +14 -2
- package/skills/akan-scaffold/SKILL.md +2 -2
- package/skills/akan-transport/SKILL.md +2 -0
- package/skills/akan-validate/SKILL.md +1 -0
- package/{subspace.command-7wxy6ptj.js → subspace.command-mkkqync4.js} +29 -23
- 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/AGENTS.md.template +2 -1
- package/{tunnel.command-22g11n0x.js → tunnel.command-tr5b3030.js} +17 -12
- package/{typeChecker-s640r6c0.js → typeChecker-bfrd1n9n.js} +1 -1
- package/typecheck.proc.js +6 -3
- package/{verify.command-m0wnndd7.js → verify.command-0p9h8tpp.js} +26 -20
- package/{workflow.command-jx8dqs9n.js → workflow.command-9mfcwqzj.js} +37 -19
- package/{workspace.command-ca9kfyt3.js → workspace.command-5hjtmcfs.js} +61 -54
- package/CodeAgent-e9c712an.js +0 -11
- package/TunnelShare-zkfkrw8w.js +0 -14
- package/agent.command-9erafkcb.js +0 -51
- package/cloud.script-arsagnq6.js +0 -30
- package/context.runner-mqpp67br.js +0 -29
- package/index-x3x31df8.js +0 -14
- /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
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
AsyncDefaultExportDetector,
|
|
4
4
|
StoreBootstrap,
|
|
5
5
|
resolveSsrPageEntriesForApp
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-ze48c0vd.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) => {
|
|
@@ -576,13 +631,14 @@ var bundleDefine = (app, command, renderEnv) => {
|
|
|
576
631
|
return {
|
|
577
632
|
"process.env.NODE_ENV": JSON.stringify(nodeEnv),
|
|
578
633
|
"process.env.AKAN_PUBLIC_RENDER_ENV": JSON.stringify(renderEnv),
|
|
634
|
+
"process.env.AKAN_BUNDLE_COMMAND": JSON.stringify(command),
|
|
579
635
|
...Object.fromEntries(Object.entries(app.getPublicEnv()).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, value]) => [`process.env.${key}`, JSON.stringify(value)]))
|
|
580
636
|
};
|
|
581
637
|
};
|
|
582
638
|
|
|
583
639
|
// pkgs/@akanjs/devkit/frontendBuild/csrDevPaths.ts
|
|
584
640
|
import fs2 from "fs";
|
|
585
|
-
import
|
|
641
|
+
import path4 from "path";
|
|
586
642
|
|
|
587
643
|
class CsrDevPaths {
|
|
588
644
|
static modulePrefix = "akan-module:";
|
|
@@ -595,18 +651,18 @@ class CsrDevPaths {
|
|
|
595
651
|
}
|
|
596
652
|
idOf(file) {
|
|
597
653
|
const real = CsrDevPaths.realpath(file);
|
|
598
|
-
const relative =
|
|
599
|
-
const id = relative.startsWith("..") ||
|
|
600
|
-
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("/");
|
|
601
657
|
}
|
|
602
658
|
fileOf(id) {
|
|
603
|
-
return
|
|
659
|
+
return path4.isAbsolute(id) ? id : path4.join(this.root, id);
|
|
604
660
|
}
|
|
605
661
|
static isStub(target) {
|
|
606
662
|
return target.startsWith(CsrDevPaths.stubPrefix);
|
|
607
663
|
}
|
|
608
664
|
static isVendorFile(file) {
|
|
609
|
-
return file.includes(`${
|
|
665
|
+
return file.includes(`${path4.sep}node_modules${path4.sep}`);
|
|
610
666
|
}
|
|
611
667
|
static isScript(file) {
|
|
612
668
|
return /\.[cm]?[jt]sx?$/.test(file);
|
|
@@ -619,7 +675,7 @@ class CsrDevPaths {
|
|
|
619
675
|
return await source.exists() ? Bun.hash(await source.arrayBuffer()).toString(36) : "";
|
|
620
676
|
}
|
|
621
677
|
static realpath(file) {
|
|
622
|
-
return fs2.existsSync(file) ? fs2.realpathSync.native(file) :
|
|
678
|
+
return fs2.existsSync(file) ? fs2.realpathSync.native(file) : path4.resolve(file);
|
|
623
679
|
}
|
|
624
680
|
static isNamed(file) {
|
|
625
681
|
try {
|
|
@@ -636,7 +692,7 @@ class CsrDevPaths {
|
|
|
636
692
|
return CsrDevPaths.#asFile(base, kind) ?? CsrDevPaths.#asFolder(base, kind);
|
|
637
693
|
}
|
|
638
694
|
static resolveRelative(dir, specifier, kind = "import") {
|
|
639
|
-
const base =
|
|
695
|
+
const base = path4.resolve(dir, specifier);
|
|
640
696
|
const folder = /(^|[\\/])\.\.?$|[\\/]$/.test(specifier);
|
|
641
697
|
return folder ? CsrDevPaths.#asFolder(base, kind) : CsrDevPaths.resolveOnDisk(base, kind);
|
|
642
698
|
}
|
|
@@ -646,15 +702,15 @@ class CsrDevPaths {
|
|
|
646
702
|
}
|
|
647
703
|
static #asFolder(dir, kind) {
|
|
648
704
|
const entry = CsrDevPaths.#packageEntryOf(dir, kind);
|
|
649
|
-
const named = entry ? CsrDevPaths.#asFile(
|
|
705
|
+
const named = entry ? CsrDevPaths.#asFile(path4.join(dir, entry), kind) ?? CsrDevPaths.#indexOf(path4.join(dir, entry), kind) : null;
|
|
650
706
|
return named ?? CsrDevPaths.#indexOf(dir, kind);
|
|
651
707
|
}
|
|
652
708
|
static #indexOf(dir, kind) {
|
|
653
|
-
return CsrDevPaths.#asFile(
|
|
709
|
+
return CsrDevPaths.#asFile(path4.join(dir, "index"), kind);
|
|
654
710
|
}
|
|
655
711
|
static #packageEntryOf(dir, kind) {
|
|
656
712
|
try {
|
|
657
|
-
const pkg = JSON.parse(fs2.readFileSync(
|
|
713
|
+
const pkg = JSON.parse(fs2.readFileSync(path4.join(dir, "package.json"), "utf8"));
|
|
658
714
|
const fields = kind === "require" ? [pkg.browser, pkg.main] : [pkg.browser, pkg.module, pkg.main];
|
|
659
715
|
const entry = fields.find((field) => typeof field === "string");
|
|
660
716
|
return typeof entry === "string" ? entry : null;
|
|
@@ -667,11 +723,11 @@ class CsrDevPaths {
|
|
|
667
723
|
const name = first.startsWith("@") ? `${first}/${second}` : first;
|
|
668
724
|
if (!name || name.startsWith("."))
|
|
669
725
|
return false;
|
|
670
|
-
for (let dir =
|
|
671
|
-
const pkgDir =
|
|
672
|
-
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")))
|
|
673
729
|
return (fs2.statSync(pkgDir, { throwIfNoEntry: false })?.ctimeMs ?? 0) > since;
|
|
674
|
-
if (
|
|
730
|
+
if (path4.dirname(dir) === dir)
|
|
675
731
|
return false;
|
|
676
732
|
}
|
|
677
733
|
}
|
|
@@ -693,7 +749,7 @@ class CsrDevPaths {
|
|
|
693
749
|
}
|
|
694
750
|
|
|
695
751
|
// pkgs/@akanjs/devkit/frontendBuild/csrEntryFiles.ts
|
|
696
|
-
import
|
|
752
|
+
import path5 from "path";
|
|
697
753
|
|
|
698
754
|
class CsrEntryFiles {
|
|
699
755
|
static entryFilename(basePath) {
|
|
@@ -706,7 +762,7 @@ class CsrEntryFiles {
|
|
|
706
762
|
});
|
|
707
763
|
}
|
|
708
764
|
static basePathOfPageKey(pageKey, basePaths) {
|
|
709
|
-
const normalized = pageKey.split(
|
|
765
|
+
const normalized = pageKey.split(path5.sep).join("/").replace(/^\.\//, "");
|
|
710
766
|
const segments = normalized.split("/");
|
|
711
767
|
const firstPublicSegment = segments.find((segment) => segment !== "[lang]" && !/^\(.+\)$/.test(segment));
|
|
712
768
|
return firstPublicSegment && basePaths.includes(firstPublicSegment) ? firstPublicSegment : null;
|
|
@@ -719,7 +775,7 @@ import path9 from "path";
|
|
|
719
775
|
import ts3 from "typescript";
|
|
720
776
|
|
|
721
777
|
// pkgs/@akanjs/devkit/transforms/externalizeFrameworkPlugin.ts
|
|
722
|
-
import
|
|
778
|
+
import path6 from "path";
|
|
723
779
|
var DEFAULT_INCLUDE = ["akanjs/", "@apps/", "@libs/"];
|
|
724
780
|
var DEFAULT_EXCLUDE_EXACT = new Set(["akanjs/webkit", "@akanjs/cli", "@akanjs/devkit"]);
|
|
725
781
|
var DEFAULT_EXCLUDE_PREFIX = ["@akanjs/cli/", "@akanjs/devkit/"];
|
|
@@ -755,7 +811,7 @@ async function createExternalizeFrameworkPlugin(options) {
|
|
|
755
811
|
const replPath = repl?.endsWith("/*") ? repl.slice(0, -1) : repl ?? "";
|
|
756
812
|
if (!replPath)
|
|
757
813
|
continue;
|
|
758
|
-
const candidate =
|
|
814
|
+
const candidate = path6.resolve(workspaceRoot, replPath + suffix);
|
|
759
815
|
const hit = await firstExisting(candidate);
|
|
760
816
|
if (hit)
|
|
761
817
|
return hit;
|
|
@@ -765,8 +821,8 @@ async function createExternalizeFrameworkPlugin(options) {
|
|
|
765
821
|
if (!spec.startsWith(`${pkg}/`))
|
|
766
822
|
continue;
|
|
767
823
|
const suffix = spec.slice(pkg.length + 1);
|
|
768
|
-
const pkgDir =
|
|
769
|
-
const candidate =
|
|
824
|
+
const pkgDir = path6.dirname(path6.resolve(workspaceRoot, entryFile));
|
|
825
|
+
const candidate = path6.join(pkgDir, suffix);
|
|
770
826
|
const hit = await firstExisting(candidate);
|
|
771
827
|
if (hit)
|
|
772
828
|
return hit;
|
|
@@ -811,57 +867,13 @@ async function firstExisting(basePath) {
|
|
|
811
867
|
return candidate;
|
|
812
868
|
}
|
|
813
869
|
for (const ext of CANDIDATE_EXTS3) {
|
|
814
|
-
const candidate =
|
|
870
|
+
const candidate = path6.join(basePath, `index${ext}`);
|
|
815
871
|
if (await Bun.file(candidate).exists())
|
|
816
872
|
return candidate;
|
|
817
873
|
}
|
|
818
874
|
return null;
|
|
819
875
|
}
|
|
820
876
|
|
|
821
|
-
// pkgs/@akanjs/devkit/transforms/rscUseClientTransform.ts
|
|
822
|
-
import path6 from "path";
|
|
823
|
-
import ts2 from "typescript";
|
|
824
|
-
var USE_CLIENT_RE = /^\s*(?:\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\/\s*|\/\/[^\n]*\n\s*)*["']use client["']/;
|
|
825
|
-
var IMPLICIT_ROOT_LAYOUT_RE = /[/\\]\.akan[/\\]generated[/\\](?:implicit-root-layout|root-layouts[/\\][^/\\]*__root_layout)\.(tsx|ts|jsx|js)$/;
|
|
826
|
-
var STAR_REEXPORT_HINT_RE = /\bexport\s*\*\s*from\b/;
|
|
827
|
-
var hasUseClientDirective = (source) => USE_CLIENT_RE.test(source);
|
|
828
|
-
function toClientReferencePath(absPath, workspaceRoot) {
|
|
829
|
-
return path6.relative(path6.resolve(workspaceRoot), path6.resolve(absPath)).split(path6.sep).join("/");
|
|
830
|
-
}
|
|
831
|
-
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);
|
|
832
|
-
var scanUseClientExports = (source, filePath, workspaceRoot) => {
|
|
833
|
-
const stars = USE_CLIENT_RE.test(source) && STAR_REEXPORT_HINT_RE.test(source) ? starReexportSpecifiers(source, filePath) : [];
|
|
834
|
-
if (stars.length) {
|
|
835
|
-
const file = workspaceRoot ? toClientReferencePath(filePath, workspaceRoot) : filePath;
|
|
836
|
-
const listed = stars.slice(0, 3).map((specifier) => `\`export * from ${JSON.stringify(specifier)}\``);
|
|
837
|
-
const written = stars.length > 3 ? `${listed.join(", ")} (and ${stars.length - 3} more)` : listed.join(", ");
|
|
838
|
-
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])}\`.`);
|
|
839
|
-
}
|
|
840
|
-
return new Bun.Transpiler({ loader: loaderFor(filePath) }).scan(source).exports;
|
|
841
|
-
};
|
|
842
|
-
function transformUseClient(source, args) {
|
|
843
|
-
if (!USE_CLIENT_RE.test(source))
|
|
844
|
-
return null;
|
|
845
|
-
if (IMPLICIT_ROOT_LAYOUT_RE.test(args.path))
|
|
846
|
-
return null;
|
|
847
|
-
const exports = scanUseClientExports(source, args.path, args.workspaceRoot);
|
|
848
|
-
if (exports.length === 0)
|
|
849
|
-
return null;
|
|
850
|
-
args.onClientModule?.(args.path, exports);
|
|
851
|
-
const referencePath = args.workspaceRoot ? toClientReferencePath(args.path, args.workspaceRoot) : args.path;
|
|
852
|
-
const filePathLit = JSON.stringify(referencePath);
|
|
853
|
-
const lines = [`import { registerClientReference } from "react-server-dom-webpack/server.node";`];
|
|
854
|
-
for (const name of exports) {
|
|
855
|
-
const nameLit = JSON.stringify(name);
|
|
856
|
-
const errMsg = JSON.stringify(`Attempted to call '${name}' from '${referencePath}' on the server, but it is a client-only export.`);
|
|
857
|
-
const proxy = `() => { throw new Error(${errMsg}); }`;
|
|
858
|
-
const binding = name === "default" ? `export default registerClientReference(${proxy}, ${filePathLit}, ${nameLit});` : `export const ${name} = registerClientReference(${proxy}, ${filePathLit}, ${nameLit});`;
|
|
859
|
-
lines.push(binding);
|
|
860
|
-
}
|
|
861
|
-
return lines.join(`
|
|
862
|
-
`);
|
|
863
|
-
}
|
|
864
|
-
|
|
865
877
|
// pkgs/@akanjs/devkit/transforms/useClientBundlePlugin.ts
|
|
866
878
|
function createUseClientBundlePlugin(options = {}) {
|
|
867
879
|
return {
|
|
@@ -1181,7 +1193,7 @@ class PagesBundleBuilder {
|
|
|
1181
1193
|
edits.push({
|
|
1182
1194
|
start: tokens[fetchProtoAt].start,
|
|
1183
1195
|
end: fetchProtoEnd.end,
|
|
1184
|
-
text: "const fetchProto = FetchClient.build<typeof signal>(cnst, serverFetch.serializedSignal, {
|
|
1196
|
+
text: "const fetchProto = FetchClient.build<typeof signal>(cnst, serverFetch.serializedSignal, { base: serverFetch });"
|
|
1185
1197
|
});
|
|
1186
1198
|
let transformed = source;
|
|
1187
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-ze48c0vd.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-yvzm8mby.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) => {
|