@akanjs/cli 3.2.0-rc.9 → 3.3.0-rc.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
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
ErrorReport
|
|
4
|
+
} from "./index-7wf8snar.js";
|
|
2
5
|
import {
|
|
3
6
|
JsonFormatter
|
|
4
|
-
} from "./index-
|
|
7
|
+
} from "./index-71y6176j.js";
|
|
5
8
|
|
|
6
|
-
// pkgs/@akanjs/devkit/applicationBuildReporter.ts
|
|
7
|
-
import { realpathSync } from "fs";
|
|
8
|
-
import path4 from "path";
|
|
9
|
+
// pkgs/@akanjs/devkit/app/applicationBuildReporter.ts
|
|
9
10
|
import { Logger } from "akanjs/common";
|
|
10
11
|
|
|
11
|
-
// pkgs/@akanjs/devkit/routeJsBudget.ts
|
|
12
|
-
import
|
|
12
|
+
// pkgs/@akanjs/devkit/app/routeJsBudget.ts
|
|
13
|
+
import path4 from "path";
|
|
13
14
|
import { toError } from "akanjs/common";
|
|
14
15
|
|
|
15
16
|
// pkgs/@akanjs/devkit/frontendBuild/fontPruner.ts
|
|
@@ -668,7 +669,85 @@ class FontPruner {
|
|
|
668
669
|
}
|
|
669
670
|
}
|
|
670
671
|
|
|
671
|
-
// pkgs/@akanjs/devkit/
|
|
672
|
+
// pkgs/@akanjs/devkit/frontendBuild/precompressArtifacts.ts
|
|
673
|
+
import fs from "fs";
|
|
674
|
+
import path3 from "path";
|
|
675
|
+
import zlib from "zlib";
|
|
676
|
+
var COMPRESSIBLE_EXTS = new Set([".css", ".html", ".js", ".json", ".svg"]);
|
|
677
|
+
var MIN_COMPRESS_BYTES = 1024;
|
|
678
|
+
var MAX_BROTLI_QUALITY = 11;
|
|
679
|
+
var BROTLI_QUALITY_BY_EXT = { ".css": MAX_BROTLI_QUALITY };
|
|
680
|
+
var DEFAULT_BROTLI_QUALITY = 9;
|
|
681
|
+
var GZIP_LEVEL = 9;
|
|
682
|
+
var ROOT_BROTLI_QUALITY = {
|
|
683
|
+
client: undefined,
|
|
684
|
+
styles: undefined,
|
|
685
|
+
dict: MAX_BROTLI_QUALITY
|
|
686
|
+
};
|
|
687
|
+
var { formatBytes } = FontPruner;
|
|
688
|
+
async function precompressArtifacts(app) {
|
|
689
|
+
const artifactDir = path3.join(app.dist.cwdPath, ".akan/artifact");
|
|
690
|
+
const roots = Object.entries(ROOT_BROTLI_QUALITY).map(([dir, brotliQuality]) => ({
|
|
691
|
+
root: path3.join(artifactDir, dir),
|
|
692
|
+
brotliQuality
|
|
693
|
+
}));
|
|
694
|
+
const result = { files: 0, inputBytes: 0, outputBytes: 0, brotliBytes: 0 };
|
|
695
|
+
await Promise.all(roots.map(({ root, brotliQuality }) => precompressRoot(root, result, brotliQuality)));
|
|
696
|
+
if (result.files > 0) {
|
|
697
|
+
app.verbose(`[precompress] wrote ${result.files} sidecars (${formatBytes(result.inputBytes)} -> gzip ${formatBytes(result.outputBytes)} / br ${formatBytes(result.brotliBytes)})`);
|
|
698
|
+
}
|
|
699
|
+
return result;
|
|
700
|
+
}
|
|
701
|
+
async function precompressRoot(root, result, brotliQuality) {
|
|
702
|
+
if (!fs.existsSync(root) || !fs.statSync(root).isDirectory())
|
|
703
|
+
return;
|
|
704
|
+
const glob = new Bun.Glob("**/*");
|
|
705
|
+
for await (const filePath of glob.scan({ cwd: root, absolute: true })) {
|
|
706
|
+
if (!await shouldPrecompress(filePath))
|
|
707
|
+
continue;
|
|
708
|
+
const bytes = await Bun.file(filePath).bytes();
|
|
709
|
+
const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
710
|
+
const gz = Bun.gzipSync(buffer, { level: GZIP_LEVEL });
|
|
711
|
+
const br = brotliCompress(buffer, brotliQuality ?? brotliQualityOf(path3.extname(filePath).toLowerCase()));
|
|
712
|
+
await Promise.all([Bun.write(`${filePath}.gz`, gz), Bun.write(`${filePath}.br`, br)]);
|
|
713
|
+
result.files += 1;
|
|
714
|
+
result.inputBytes += bytes.byteLength;
|
|
715
|
+
result.outputBytes += gz.byteLength;
|
|
716
|
+
result.brotliBytes += br.byteLength;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
async function servedBrotliBytesOf(artifactDir, filePath) {
|
|
720
|
+
const root = path3.relative(artifactDir, filePath).split(path3.sep)[0] ?? "";
|
|
721
|
+
if (!Object.hasOwn(ROOT_BROTLI_QUALITY, root) || !await shouldPrecompress(filePath))
|
|
722
|
+
return Bun.file(filePath).size;
|
|
723
|
+
const bytes = await Bun.file(filePath).bytes();
|
|
724
|
+
const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
725
|
+
const quality = ROOT_BROTLI_QUALITY[root] ?? brotliQualityOf(path3.extname(filePath).toLowerCase());
|
|
726
|
+
return brotliCompress(buffer, quality).byteLength;
|
|
727
|
+
}
|
|
728
|
+
function brotliQualityOf(ext) {
|
|
729
|
+
return BROTLI_QUALITY_BY_EXT[ext] ?? DEFAULT_BROTLI_QUALITY;
|
|
730
|
+
}
|
|
731
|
+
function brotliCompress(buffer, quality) {
|
|
732
|
+
return zlib.brotliCompressSync(buffer, {
|
|
733
|
+
params: {
|
|
734
|
+
[zlib.constants.BROTLI_PARAM_QUALITY]: quality,
|
|
735
|
+
[zlib.constants.BROTLI_PARAM_SIZE_HINT]: buffer.byteLength
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
async function shouldPrecompress(filePath) {
|
|
740
|
+
if (filePath.endsWith(".gz") || filePath.endsWith(".br"))
|
|
741
|
+
return false;
|
|
742
|
+
if (!COMPRESSIBLE_EXTS.has(path3.extname(filePath).toLowerCase()))
|
|
743
|
+
return false;
|
|
744
|
+
const file = Bun.file(filePath);
|
|
745
|
+
if (!await file.exists())
|
|
746
|
+
return false;
|
|
747
|
+
return file.size >= MIN_COMPRESS_BYTES;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// pkgs/@akanjs/devkit/app/routeJsBudget.ts
|
|
672
751
|
class RouteJsBudget {
|
|
673
752
|
kbByRoute;
|
|
674
753
|
env;
|
|
@@ -677,11 +756,13 @@ class RouteJsBudget {
|
|
|
677
756
|
static tableRows = 10;
|
|
678
757
|
static #relativeSlack = 0.01;
|
|
679
758
|
static #absoluteSlack = 4096;
|
|
680
|
-
static async measure(artifactDir, modulesByRoute) {
|
|
759
|
+
static async measure(artifactDir, modulesByRoute, { precompressed = true } = {}) {
|
|
681
760
|
const sizeByUrl = new Map;
|
|
682
761
|
const sizeOf = async (url) => {
|
|
683
|
-
const file =
|
|
762
|
+
const file = path4.join(artifactDir, url.replace(/^\/_akan\//, ""));
|
|
684
763
|
const raw = Bun.file(file).size;
|
|
764
|
+
if (!precompressed)
|
|
765
|
+
return { raw, brotli: await servedBrotliBytesOf(artifactDir, file) };
|
|
685
766
|
const sidecar = Bun.file(`${file}.br`);
|
|
686
767
|
return { raw, brotli: await sidecar.exists() ? sidecar.size : raw };
|
|
687
768
|
};
|
|
@@ -863,7 +944,7 @@ class RouteJsBudget {
|
|
|
863
944
|
}
|
|
864
945
|
}
|
|
865
946
|
|
|
866
|
-
// pkgs/@akanjs/devkit/applicationBuildReporter.ts
|
|
947
|
+
// pkgs/@akanjs/devkit/app/applicationBuildReporter.ts
|
|
867
948
|
class ApplicationBuildReporter {
|
|
868
949
|
static create() {
|
|
869
950
|
return {
|
|
@@ -893,45 +974,7 @@ class ApplicationBuildReporter {
|
|
|
893
974
|
}
|
|
894
975
|
static localBuildNotice = "Built for local: the server runs without endpoint rate limits, and boots on local defaults (Redis on localhost, the first database mode) where a deployment would stop to ask. For a host others can reach, run `akan build <app> --env main` with AKAN_PUBLIC_REPO_NAME and AKAN_PUBLIC_SERVE_DOMAIN set in the shell or the workspace .env.";
|
|
895
976
|
static formatError(error, workspaceRoot = process.cwd()) {
|
|
896
|
-
|
|
897
|
-
const nestedMessages = error.errors.map((nestedError, index) => ApplicationBuildReporter.formatError(nestedError, workspaceRoot).trim() || `Unknown error ${index + 1}`).map((message) => message.replace(/^/gm, " ")).join(`
|
|
898
|
-
`);
|
|
899
|
-
return nestedMessages ? `${error.message}
|
|
900
|
-
${nestedMessages}` : error.message;
|
|
901
|
-
}
|
|
902
|
-
if (error instanceof Error) {
|
|
903
|
-
const causeMessage = error.cause ? `
|
|
904
|
-
Caused by: ${ApplicationBuildReporter.formatError(error.cause, workspaceRoot)}` : "";
|
|
905
|
-
return `${ApplicationBuildReporter.#withLocation(error.message, error, workspaceRoot)}${causeMessage}`;
|
|
906
|
-
}
|
|
907
|
-
if (typeof error === "object" && error !== null && "message" in error)
|
|
908
|
-
return ApplicationBuildReporter.#withLocation(String(error.message), error, workspaceRoot);
|
|
909
|
-
return String(error);
|
|
910
|
-
}
|
|
911
|
-
static #withLocation(message, error, workspaceRoot) {
|
|
912
|
-
const { position } = error;
|
|
913
|
-
if (!position?.file)
|
|
914
|
-
return message;
|
|
915
|
-
const file = ApplicationBuildReporter.#relativeToWorkspace(position.file, workspaceRoot);
|
|
916
|
-
const location = position.line > 0 ? `${file}:${position.line}:${position.column}` : file;
|
|
917
|
-
return message.includes(location) ? message : message.replace(/^.*/, (headline) => `${headline} (${location})`);
|
|
918
|
-
}
|
|
919
|
-
static #relativeToWorkspace(file, workspaceRoot) {
|
|
920
|
-
if (!path4.isAbsolute(file))
|
|
921
|
-
return file;
|
|
922
|
-
for (const root of [workspaceRoot, ApplicationBuildReporter.#realpathOf(workspaceRoot)]) {
|
|
923
|
-
const relative = path4.relative(root, file);
|
|
924
|
-
if (!relative.startsWith(`..${path4.sep}`) && !path4.isAbsolute(relative))
|
|
925
|
-
return relative.replaceAll(path4.sep, "/");
|
|
926
|
-
}
|
|
927
|
-
return file;
|
|
928
|
-
}
|
|
929
|
-
static #realpathOf(dir) {
|
|
930
|
-
try {
|
|
931
|
-
return realpathSync(dir);
|
|
932
|
-
} catch {
|
|
933
|
-
return dir;
|
|
934
|
-
}
|
|
977
|
+
return ErrorReport.format(error, workspaceRoot);
|
|
935
978
|
}
|
|
936
979
|
static formatDuration(ms) {
|
|
937
980
|
if (ms < 1000)
|
|
@@ -1161,83 +1204,12 @@ var mergeInvalidateMessages = (current, next) => {
|
|
|
1161
1204
|
var buildStatusReplaySequence = (pendingReplay, latestByPhase) => [...pendingReplay, ...latestByPhase.values()];
|
|
1162
1205
|
var filesChangedSince = (before, after) => [...before].filter(([file, stamp]) => after.get(file) !== stamp).map(([file]) => file);
|
|
1163
1206
|
|
|
1164
|
-
// pkgs/@akanjs/devkit/frontendBuild/watchRootResolver.ts
|
|
1165
|
-
import fs from "fs";
|
|
1166
|
-
import { readFile } from "fs/promises";
|
|
1167
|
-
import path6 from "path";
|
|
1168
|
-
|
|
1169
|
-
class WatchRootResolver {
|
|
1170
|
-
#app;
|
|
1171
|
-
constructor(app) {
|
|
1172
|
-
this.#app = app;
|
|
1173
|
-
}
|
|
1174
|
-
async resolve() {
|
|
1175
|
-
const tsconfig = await this.#app.getTsConfig();
|
|
1176
|
-
const appDir = path6.resolve(this.#app.cwdPath);
|
|
1177
|
-
const appsContainer = path6.dirname(appDir);
|
|
1178
|
-
const libsContainer = path6.resolve(this.#app.workspace.workspaceRoot, "libs");
|
|
1179
|
-
const libRoots = (await this.#resolveLibDeps(libsContainer))?.map((name) => path6.join(libsContainer, name)).filter((dir) => fs.existsSync(dir));
|
|
1180
|
-
const set = new Set;
|
|
1181
|
-
set.add(path6.resolve(`${this.#app.cwdPath}/page`));
|
|
1182
|
-
for (const targets of Object.values(tsconfig.compilerOptions.paths ?? {})) {
|
|
1183
|
-
for (const target of targets) {
|
|
1184
|
-
if (!target)
|
|
1185
|
-
continue;
|
|
1186
|
-
if (path6.isAbsolute(target))
|
|
1187
|
-
continue;
|
|
1188
|
-
const cleaned = target.replace(/\/?\*+.*$/, "").replace(/\/[^/]+\.[^/]+$/, "");
|
|
1189
|
-
const resolved = path6.resolve(this.#app.workspace.workspaceRoot, cleaned);
|
|
1190
|
-
if (resolved === libsContainer && libRoots) {
|
|
1191
|
-
for (const root of libRoots)
|
|
1192
|
-
set.add(root);
|
|
1193
|
-
continue;
|
|
1194
|
-
}
|
|
1195
|
-
const root = resolved === appsContainer ? appDir : resolved;
|
|
1196
|
-
if (fs.existsSync(root))
|
|
1197
|
-
set.add(root);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
return [...set];
|
|
1201
|
-
}
|
|
1202
|
-
async#resolveLibDeps(libsContainer) {
|
|
1203
|
-
const scanInfo = this.#app.getScanInfo({ allowEmpty: true });
|
|
1204
|
-
if (scanInfo?.type === "app")
|
|
1205
|
-
return scanInfo.libDeps;
|
|
1206
|
-
const direct = await WatchRootResolver.#readManifestLibDeps(path6.join(this.#app.cwdPath, "akan.app.json"));
|
|
1207
|
-
if (!direct)
|
|
1208
|
-
return null;
|
|
1209
|
-
const closure = new Set;
|
|
1210
|
-
const queue = [...direct];
|
|
1211
|
-
while (queue.length > 0) {
|
|
1212
|
-
const name = queue.shift();
|
|
1213
|
-
if (!name || closure.has(name))
|
|
1214
|
-
continue;
|
|
1215
|
-
closure.add(name);
|
|
1216
|
-
const nested = await WatchRootResolver.#readManifestLibDeps(path6.join(libsContainer, name, "akan.lib.json"));
|
|
1217
|
-
if (!nested)
|
|
1218
|
-
return null;
|
|
1219
|
-
queue.push(...nested);
|
|
1220
|
-
}
|
|
1221
|
-
return [...closure];
|
|
1222
|
-
}
|
|
1223
|
-
static async#readManifestLibDeps(manifestPath) {
|
|
1224
|
-
try {
|
|
1225
|
-
const parsed = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
1226
|
-
if (!Array.isArray(parsed.libDeps))
|
|
1227
|
-
return null;
|
|
1228
|
-
return parsed.libDeps.filter((name) => typeof name === "string" && name.length > 0);
|
|
1229
|
-
} catch {
|
|
1230
|
-
return null;
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
1207
|
// pkgs/@akanjs/devkit/frontendBuild/hmrWatcher.ts
|
|
1236
1208
|
import fs2 from "fs";
|
|
1237
|
-
import
|
|
1209
|
+
import path8 from "path";
|
|
1238
1210
|
|
|
1239
1211
|
// pkgs/@akanjs/devkit/frontendBuild/hmrChangeClassifier.ts
|
|
1240
|
-
import
|
|
1212
|
+
import path6 from "path";
|
|
1241
1213
|
var CSS_EXTS = new Set([".css"]);
|
|
1242
1214
|
var CONFIG_BASENAMES = new Set(["akan.config.ts", "bunfig.toml", "tsconfig.json", "package.json"]);
|
|
1243
1215
|
|
|
@@ -1245,10 +1217,10 @@ class HmrChangeClassifier {
|
|
|
1245
1217
|
classify(abs) {
|
|
1246
1218
|
if (this.#isUninteresting(abs))
|
|
1247
1219
|
return "ignore";
|
|
1248
|
-
const base =
|
|
1220
|
+
const base = path6.basename(abs);
|
|
1249
1221
|
if (CONFIG_BASENAMES.has(base))
|
|
1250
1222
|
return "config";
|
|
1251
|
-
const ext =
|
|
1223
|
+
const ext = path6.extname(abs).toLowerCase();
|
|
1252
1224
|
if (CSS_EXTS.has(ext))
|
|
1253
1225
|
return "css";
|
|
1254
1226
|
if (SOURCE_EXTS.has(ext))
|
|
@@ -1256,16 +1228,16 @@ class HmrChangeClassifier {
|
|
|
1256
1228
|
return "ignore";
|
|
1257
1229
|
}
|
|
1258
1230
|
#isUninteresting(abs) {
|
|
1259
|
-
const base =
|
|
1231
|
+
const base = path6.basename(abs);
|
|
1260
1232
|
if (!base)
|
|
1261
1233
|
return true;
|
|
1262
1234
|
if (base.startsWith("."))
|
|
1263
1235
|
return true;
|
|
1264
1236
|
if (base.endsWith("~") || base.endsWith(".swp") || base.endsWith(".swx") || base.endsWith(".tmp"))
|
|
1265
1237
|
return true;
|
|
1266
|
-
if (abs.includes(`${
|
|
1238
|
+
if (abs.includes(`${path6.sep}node_modules${path6.sep}`))
|
|
1267
1239
|
return true;
|
|
1268
|
-
if (abs.includes(`${
|
|
1240
|
+
if (abs.includes(`${path6.sep}.akan${path6.sep}`))
|
|
1269
1241
|
return true;
|
|
1270
1242
|
return false;
|
|
1271
1243
|
}
|
|
@@ -1273,7 +1245,7 @@ class HmrChangeClassifier {
|
|
|
1273
1245
|
|
|
1274
1246
|
// pkgs/@akanjs/devkit/frontendBuild/sourceMtimeIndex.ts
|
|
1275
1247
|
import { readdir, stat as stat3 } from "fs/promises";
|
|
1276
|
-
import
|
|
1248
|
+
import path7 from "path";
|
|
1277
1249
|
var UNREADABLE = Number.NaN;
|
|
1278
1250
|
|
|
1279
1251
|
class SourceMtimeIndex {
|
|
@@ -1336,7 +1308,7 @@ class SourceMtimeIndex {
|
|
|
1336
1308
|
if (!this.#primed)
|
|
1337
1309
|
return;
|
|
1338
1310
|
await Promise.all(paths.map(async (file) => {
|
|
1339
|
-
const abs =
|
|
1311
|
+
const abs = path7.resolve(file);
|
|
1340
1312
|
const stats = await stat3(abs).catch(() => null);
|
|
1341
1313
|
if (!stats?.isFile()) {
|
|
1342
1314
|
this.#files.delete(abs);
|
|
@@ -1422,7 +1394,7 @@ class SourceMtimeIndex {
|
|
|
1422
1394
|
for (const entry of entries) {
|
|
1423
1395
|
if (SourceMtimeIndex.#skipDirent(entry.name))
|
|
1424
1396
|
continue;
|
|
1425
|
-
const abs =
|
|
1397
|
+
const abs = path7.join(dir, entry.name);
|
|
1426
1398
|
if (entry.isDirectory()) {
|
|
1427
1399
|
descend.push(abs);
|
|
1428
1400
|
continue;
|
|
@@ -1449,7 +1421,7 @@ class SourceMtimeIndex {
|
|
|
1449
1421
|
}
|
|
1450
1422
|
if (known) {
|
|
1451
1423
|
for (const abs of [...this.#files.keys()]) {
|
|
1452
|
-
if (present.has(abs) ||
|
|
1424
|
+
if (present.has(abs) || path7.dirname(abs) !== dir)
|
|
1453
1425
|
continue;
|
|
1454
1426
|
this.#files.delete(abs);
|
|
1455
1427
|
changed?.add(abs);
|
|
@@ -1467,7 +1439,7 @@ class SourceMtimeIndex {
|
|
|
1467
1439
|
this.#unsettled.delete(dir);
|
|
1468
1440
|
}
|
|
1469
1441
|
#forget(dir) {
|
|
1470
|
-
const prefix = `${dir}${
|
|
1442
|
+
const prefix = `${dir}${path7.sep}`;
|
|
1471
1443
|
this.#dirs.delete(dir);
|
|
1472
1444
|
this.#unreadable.delete(dir);
|
|
1473
1445
|
this.#unsettled.delete(dir);
|
|
@@ -1505,8 +1477,8 @@ class SourceMtimeIndex {
|
|
|
1505
1477
|
return !name || name.startsWith(".") || name === "node_modules";
|
|
1506
1478
|
}
|
|
1507
1479
|
static #pruneNestedRoots(roots) {
|
|
1508
|
-
const resolved = [...new Set(roots.map((root) =>
|
|
1509
|
-
return resolved.filter((root) => !resolved.some((other) => other !== root && root.startsWith(`${other}${
|
|
1480
|
+
const resolved = [...new Set(roots.map((root) => path7.resolve(root)))].sort();
|
|
1481
|
+
return resolved.filter((root) => !resolved.some((other) => other !== root && root.startsWith(`${other}${path7.sep}`)));
|
|
1510
1482
|
}
|
|
1511
1483
|
}
|
|
1512
1484
|
|
|
@@ -1522,6 +1494,7 @@ class HmrWatcher {
|
|
|
1522
1494
|
#hinted = new Set;
|
|
1523
1495
|
#classifier = new HmrChangeClassifier;
|
|
1524
1496
|
#index;
|
|
1497
|
+
#scans = new Set;
|
|
1525
1498
|
#timer = null;
|
|
1526
1499
|
#verifyTimer = null;
|
|
1527
1500
|
#windowStartedAt = null;
|
|
@@ -1531,7 +1504,7 @@ class HmrWatcher {
|
|
|
1531
1504
|
#reportedCompensating = false;
|
|
1532
1505
|
#reportedGaps = "";
|
|
1533
1506
|
constructor(opts) {
|
|
1534
|
-
this.#roots = [...new Set(opts.roots.map((r) =>
|
|
1507
|
+
this.#roots = [...new Set(opts.roots.map((r) => path8.resolve(r)))];
|
|
1535
1508
|
this.#debounceMs = opts.debounceMs ?? HmrWatcher.#envDebounceMs() ?? 30;
|
|
1536
1509
|
this.#verifyDelayMs = opts.verifyDelayMs ?? 250;
|
|
1537
1510
|
this.#onBatch = opts.onBatch;
|
|
@@ -1547,7 +1520,7 @@ class HmrWatcher {
|
|
|
1547
1520
|
const w = fs2.watch(root, { recursive: true, persistent: false }, (_event, filename) => {
|
|
1548
1521
|
if (!filename)
|
|
1549
1522
|
return;
|
|
1550
|
-
const abs =
|
|
1523
|
+
const abs = path8.resolve(root, filename.toString());
|
|
1551
1524
|
this.#queue(abs);
|
|
1552
1525
|
});
|
|
1553
1526
|
w.on("error", (err) => {
|
|
@@ -1582,6 +1555,17 @@ class HmrWatcher {
|
|
|
1582
1555
|
} catch {}
|
|
1583
1556
|
}
|
|
1584
1557
|
}
|
|
1558
|
+
async close() {
|
|
1559
|
+
this.stop();
|
|
1560
|
+
await Promise.all(this.#scans);
|
|
1561
|
+
await this.#mergeDetectedChanges();
|
|
1562
|
+
if (this.#pending.size === 0)
|
|
1563
|
+
return null;
|
|
1564
|
+
const batch = { files: Array.from(this.#pending.keys()), kinds: new Set(this.#pending.values()) };
|
|
1565
|
+
this.#pending.clear();
|
|
1566
|
+
this.#hinted.clear();
|
|
1567
|
+
return batch;
|
|
1568
|
+
}
|
|
1585
1569
|
async absorb(paths) {
|
|
1586
1570
|
if (paths.length === 0)
|
|
1587
1571
|
return;
|
|
@@ -1622,6 +1606,8 @@ class HmrWatcher {
|
|
|
1622
1606
|
try {
|
|
1623
1607
|
while (!this.#stopped) {
|
|
1624
1608
|
await this.#mergeDetectedChanges();
|
|
1609
|
+
if (this.#stopped)
|
|
1610
|
+
break;
|
|
1625
1611
|
if (this.#pending.size === 0) {
|
|
1626
1612
|
this.#windowStartedAt = null;
|
|
1627
1613
|
break;
|
|
@@ -1647,7 +1633,12 @@ class HmrWatcher {
|
|
|
1647
1633
|
this.#scheduleVerify();
|
|
1648
1634
|
}
|
|
1649
1635
|
}
|
|
1650
|
-
|
|
1636
|
+
#mergeDetectedChanges() {
|
|
1637
|
+
const scan = this.#collectDetectedChanges().finally(() => this.#scans.delete(scan));
|
|
1638
|
+
this.#scans.add(scan);
|
|
1639
|
+
return scan;
|
|
1640
|
+
}
|
|
1641
|
+
async#collectDetectedChanges() {
|
|
1651
1642
|
const detected = await this.#index.collectChanges().catch((err) => {
|
|
1652
1643
|
this.#logger.error(`[hmr] mtime scan failed: ${err.message}`);
|
|
1653
1644
|
return [];
|
|
@@ -1711,4 +1702,75 @@ class HmrWatcher {
|
|
|
1711
1702
|
}
|
|
1712
1703
|
}
|
|
1713
1704
|
|
|
1714
|
-
|
|
1705
|
+
// pkgs/@akanjs/devkit/frontendBuild/watchRootResolver.ts
|
|
1706
|
+
import fs3 from "fs";
|
|
1707
|
+
import { readFile } from "fs/promises";
|
|
1708
|
+
import path9 from "path";
|
|
1709
|
+
|
|
1710
|
+
class WatchRootResolver {
|
|
1711
|
+
#app;
|
|
1712
|
+
constructor(app) {
|
|
1713
|
+
this.#app = app;
|
|
1714
|
+
}
|
|
1715
|
+
async resolve() {
|
|
1716
|
+
const tsconfig = await this.#app.getTsConfig();
|
|
1717
|
+
const appDir = path9.resolve(this.#app.cwdPath);
|
|
1718
|
+
const appsContainer = path9.dirname(appDir);
|
|
1719
|
+
const libsContainer = path9.resolve(this.#app.workspace.workspaceRoot, "libs");
|
|
1720
|
+
const libRoots = (await this.#resolveLibDeps(libsContainer))?.map((name) => path9.join(libsContainer, name)).filter((dir) => fs3.existsSync(dir));
|
|
1721
|
+
const set = new Set;
|
|
1722
|
+
set.add(path9.resolve(`${this.#app.cwdPath}/page`));
|
|
1723
|
+
for (const targets of Object.values(tsconfig.compilerOptions.paths ?? {})) {
|
|
1724
|
+
for (const target of targets) {
|
|
1725
|
+
if (!target)
|
|
1726
|
+
continue;
|
|
1727
|
+
if (path9.isAbsolute(target))
|
|
1728
|
+
continue;
|
|
1729
|
+
const cleaned = target.replace(/\/?\*+.*$/, "").replace(/\/[^/]+\.[^/]+$/, "");
|
|
1730
|
+
const resolved = path9.resolve(this.#app.workspace.workspaceRoot, cleaned);
|
|
1731
|
+
if (resolved === libsContainer && libRoots) {
|
|
1732
|
+
for (const root of libRoots)
|
|
1733
|
+
set.add(root);
|
|
1734
|
+
continue;
|
|
1735
|
+
}
|
|
1736
|
+
const root = resolved === appsContainer ? appDir : resolved;
|
|
1737
|
+
if (fs3.existsSync(root))
|
|
1738
|
+
set.add(root);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
return [...set];
|
|
1742
|
+
}
|
|
1743
|
+
async#resolveLibDeps(libsContainer) {
|
|
1744
|
+
const scanInfo = this.#app.getScanInfo({ allowEmpty: true });
|
|
1745
|
+
if (scanInfo?.type === "app")
|
|
1746
|
+
return scanInfo.libDeps;
|
|
1747
|
+
const direct = await WatchRootResolver.#readManifestLibDeps(path9.join(this.#app.cwdPath, "akan.app.json"));
|
|
1748
|
+
if (!direct)
|
|
1749
|
+
return null;
|
|
1750
|
+
const closure = new Set;
|
|
1751
|
+
const queue = [...direct];
|
|
1752
|
+
while (queue.length > 0) {
|
|
1753
|
+
const name = queue.shift();
|
|
1754
|
+
if (!name || closure.has(name))
|
|
1755
|
+
continue;
|
|
1756
|
+
closure.add(name);
|
|
1757
|
+
const nested = await WatchRootResolver.#readManifestLibDeps(path9.join(libsContainer, name, "akan.lib.json"));
|
|
1758
|
+
if (!nested)
|
|
1759
|
+
return null;
|
|
1760
|
+
queue.push(...nested);
|
|
1761
|
+
}
|
|
1762
|
+
return [...closure];
|
|
1763
|
+
}
|
|
1764
|
+
static async#readManifestLibDeps(manifestPath) {
|
|
1765
|
+
try {
|
|
1766
|
+
const parsed = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
1767
|
+
if (!Array.isArray(parsed.libDeps))
|
|
1768
|
+
return null;
|
|
1769
|
+
return parsed.libDeps.filter((name) => typeof name === "string" && name.length > 0);
|
|
1770
|
+
} catch {
|
|
1771
|
+
return null;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
export { UNAVAILABLE_REDIS_HOST, redisTunnelPolicy, backendRecoveryPolicy, BUILDER_MIN_RSS_RECYCLE_INTERVAL_MS, SOURCE_EXTS, shouldRestartBackendByDevPlan, shouldRestartBuilderByDevPlan, normalizeBackendReportedGeneration, shouldRestartDevHostByDevPlan, devHostStateOf, isLegacyBackendFallbackFile, shouldMarkBuildPhaseRecovered, shouldKeepBuildFailure, createBackendBuildStatus, backendRestartReasonFromMessage, mergeBackendRestartReasons, shouldReplaceLastGoodMessage, shouldQueueBuildStatusReplay, hasBuildFailureForGeneration, decideBuilderRssRecycle, decideBuilderRssSettle, decideIdleSuspend, resolveIdleSuspendMs, hasAnyBuildFailure, shouldRefreshConfigOnIdleWake, shouldHoldForReturningBuilder, shouldWarnBuilderRssCeilingTight, isRssCeilingUnreachable, shouldRelayRecycledFrontendState, mergeInvalidateMessages, buildStatusReplaySequence, filesChangedSince, HmrWatcher, WatchRootResolver, FontOptimizer, FontPruner, precompressArtifacts, RouteJsBudget, ApplicationBuildReporter };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
binPlatforms,
|
|
4
|
-
ServerEnvProfile,
|
|
5
|
-
AkanAppConfig,
|
|
6
4
|
Executor,
|
|
7
|
-
WorkspaceExecutor
|
|
8
|
-
|
|
5
|
+
WorkspaceExecutor,
|
|
6
|
+
ServerEnvProfile,
|
|
7
|
+
AkanAppConfig
|
|
8
|
+
} from "./index-71y6176j.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveAppId,
|
|
11
11
|
targetHtmlFilename
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
14
|
CsrArtifactBuilder
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-a860mx0m.js";
|
|
16
16
|
import {
|
|
17
17
|
ExitCodeError
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-2yn3r67f.js";
|
|
19
19
|
|
|
20
20
|
// pkgs/@akanjs/devkit/mobile/desktopBin.ts
|
|
21
21
|
import { chmod, mkdir, rename, rm, writeFile } from "fs/promises";
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-2yn3r67f.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
sourceFile,
|
|
7
|
+
bilingualLabelForField,
|
|
8
|
+
bilingualDescriptionForField,
|
|
11
9
|
moduleSourcePaths,
|
|
10
|
+
sourceFile,
|
|
12
11
|
generatedFilesForSync,
|
|
13
|
-
createPassedPrimitiveReport
|
|
14
|
-
|
|
15
|
-
bilingualDescriptionForField
|
|
16
|
-
} from "./index-2vgv7fs7.js";
|
|
12
|
+
createPassedPrimitiveReport
|
|
13
|
+
} from "./index-zmd9xxgd.js";
|
|
17
14
|
import {
|
|
18
15
|
PageScript
|
|
19
|
-
} from "./index-
|
|
16
|
+
} from "./index-3txdtztz.js";
|
|
20
17
|
import {
|
|
21
18
|
pluralizeName
|
|
22
19
|
} from "./index-nz8prx9g.js";
|
|
23
20
|
import {
|
|
24
21
|
assertPlainName
|
|
25
22
|
} from "./index-va90m8nd.js";
|
|
23
|
+
import {
|
|
24
|
+
ModuleExecutor
|
|
25
|
+
} from "./index-7wf8snar.js";
|
|
26
26
|
|
|
27
27
|
// pkgs/@akanjs/cli/module/module.script.ts
|
|
28
28
|
import { capitalize as capitalize2 } from "akanjs/common";
|