@akanjs/cli 3.1.0-rc.9 → 3.1.1-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 +1 -1
- package/{CodeAgent-rkjyxgec.js → CodeAgent-4pnxwptq.js} +2 -2
- package/{CodeAgentRpcHost-p7h6n2hp.js → CodeAgentRpcHost-9g27hmer.js} +1 -1
- package/{CodeTui-h7pyj6xa.js → CodeTui-hhndze8h.js} +47 -4
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/TunnelShare-zmq6bbar.js +14 -0
- package/{agent.command-3qxf4xcj.js → agent.command-p02330r6.js} +5 -5
- package/akanCode.js +7 -5
- package/{application.command-m1kcd7jf.js → application.command-ywks5ywm.js} +35 -9
- package/{applicationBuildRunner-dj0xkrep.js → applicationBuildRunner-9cnnsdm5.js} +23 -8
- package/buildBatch.proc.js +9 -9
- package/{cloud.command-9cp1t0f5.js → cloud.command-1tzkvje1.js} +13 -13
- package/cloud.script-8g83xqdg.js +24 -0
- package/{code.command-0ad6gw2a.js → code.command-16pm1p2v.js} +25 -12
- package/commandManifest.json +1 -1
- package/{context.command-0qx447mb.js → context.command-6ys86sqf.js} +16 -16
- package/context.runner-3jrypwe3.js +25 -0
- package/{guideline.command-cv5bmrx2.js → guideline.command-3zay3d8g.js} +2 -2
- package/guidelines/agentRule/agentRule.instruction.md +25 -10
- package/guidelines/conventions/conventions.instruction.md +71 -24
- package/guidelines/fieldRule/fieldRule.instruction.md +17 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +93 -48
- package/guidelines/modelDocument/modelDocument.instruction.md +2 -1
- package/guidelines/modelStore/modelStore.instruction.md +7 -0
- package/guidelines/pageRule/pageRule.instruction.md +55 -8
- package/guidelines/queryRule/queryRule.instruction.md +24 -10
- package/guidelines/runtimeRule/runtimeRule.instruction.md +12 -4
- package/guidelines/ssrRule/ssrRule.instruction.md +9 -6
- package/guidelines/transportRule/transportRule.instruction.md +36 -5
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +5 -3
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +28 -8
- package/incrementalBuilder.proc.js +3 -3
- package/{index-cpb3nvma.js → index-1f33g2z5.js} +2 -2
- package/{index-tamvyvj3.js → index-1mfyyxh5.js} +3 -3
- package/{index-wa5jbxj1.js → index-2mrn1mrg.js} +1 -0
- package/{index-8fp3b47h.js → index-4w3skd33.js} +281 -46
- package/{index-bspm21y1.js → index-68c3gzvg.js} +7 -7
- package/{index-20bxxyvn.js → index-9hbhm6cs.js} +40 -2
- package/{index-d2242ksy.js → index-at7bz0xq.js} +3 -0
- package/{index-fmzcs8v6.js → index-b5vptvnt.js} +4 -4
- package/{index-d72hfmdm.js → index-bb4hj03s.js} +8 -8
- package/{index-9z426msb.js → index-e9e9cebg.js} +78 -27
- package/{index-vk0pa0mn.js → index-ekpp5tax.js} +2 -1
- package/{index-35hc95h5.js → index-fmder14z.js} +1 -1
- package/{index-86jt2a0e.js → index-g2s33373.js} +1 -1
- package/{index-4mhy6qme.js → index-jaa81e9r.js} +4 -4
- package/{index-192ha4xh.js → index-jgs8z8xb.js} +3 -3
- package/{index-qwa5k1j8.js → index-kcbq2qcf.js} +1 -1
- package/{index-w44cy4vs.js → index-ngpn9hzy.js} +6 -4
- package/{index-jw1zm273.js → index-p4dnj2wc.js} +54 -10
- package/index-q8age5az.js +643 -0
- package/{index-j4mkhz93.js → index-qfzfaq96.js} +3 -3
- package/{index-pydbnfez.js → index-qkcwsg6r.js} +35 -9
- package/{index-d47ypebv.js → index-qtkycaqn.js} +75 -19
- package/{index-va06nr10.js → index-rr7jk14m.js} +65 -20
- package/{index-1xj2t7cb.js → index-sh9mmp5v.js} +7 -7
- package/{index-1p98exm2.js → index-sng3vt0p.js} +2 -2
- package/{index-j237xtew.js → index-tk3jg2bm.js} +25 -8
- package/{index-fyq1z6kt.js → index-vg28jsf9.js} +3 -3
- package/{index-trpasv9q.js → index-ynqxpwx6.js} +1 -1
- package/{index-5edzv8fn.js → index-z6v7k9sb.js} +2 -2
- package/{index-g1mbppa9.js → index-z9xepn8t.js} +5 -5
- package/{index-awbdfcf2.js → index-zn6bn1s2.js} +4 -4
- package/index.js +40 -22
- package/{library.command-erp2f56n.js → library.command-a8n9h8j4.js} +3 -3
- package/{localRegistry.command-y176p558.js → localRegistry.command-1e6m7w2f.js} +12 -12
- package/{module.command-gs2r615e.js → module.command-b6f1p1xa.js} +5 -5
- package/{package.command-j10r76ax.js → package.command-tc27ftmy.js} +3 -3
- package/package.json +16 -16
- package/{page.command-4h4a8pnh.js → page.command-m5wyqfkd.js} +3 -3
- package/{pipeline.command-a2nrk26m.js → pipeline.command-4qxyafpz.js} +2 -2
- package/{primitive.command-w6t0asqz.js → primitive.command-9yaatk0d.js} +6 -6
- package/{projectTypecheck-f534enqj.js → projectTypecheck-87k6z6ab.js} +1 -1
- package/{quality.command-77x7vbbx.js → quality.command-ht1wjhv8.js} +2 -2
- package/{repair.command-y6sstev7.js → repair.command-evg9g911.js} +5 -5
- package/{routeSourceValidator-7ycnfz0e.js → routeSourceValidator-6jd0q6r6.js} +47 -14
- package/{scalar.command-20b8cy0k.js → scalar.command-xsejjeq1.js} +4 -4
- package/skills/akan-code/SKILL.md +4 -0
- package/skills/akan-store/SKILL.md +4 -2
- package/{subspace.command-5c7yasd7.js → subspace.command-ps12q5y7.js} +8 -17
- package/templates/migration/__migrationId__.ts +23 -0
- package/templates/server.ts +8 -1
- package/templates/workspaceRoot/biome.json.template +1 -1
- package/{tunnel.command-2kw8vt9g.js → tunnel.command-khzgvrj8.js} +7 -7
- package/{workflow.command-2djwmpqf.js → workflow.command-qpyq0ya5.js} +10 -10
- package/{workspace.command-ms84ykse.js → workspace.command-3dq7e9g2.js} +30 -28
- package/TunnelShare-661cxz5e.js +0 -14
- package/cloud.script-dgstqt1m.js +0 -24
- package/context.runner-1vsjztjg.js +0 -25
- package/index-665zp9rs.js +0 -271
|
@@ -4,26 +4,26 @@ import {
|
|
|
4
4
|
CloudApi,
|
|
5
5
|
CloudUpdates,
|
|
6
6
|
PipelineSecrets
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-1f33g2z5.js";
|
|
8
8
|
import {
|
|
9
9
|
PkgExecutor
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-rr7jk14m.js";
|
|
11
11
|
import {
|
|
12
12
|
NativePublicEnv,
|
|
13
13
|
UpdatePackFolder
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-z9xepn8t.js";
|
|
15
15
|
import {
|
|
16
16
|
script
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-p4dnj2wc.js";
|
|
18
18
|
import {
|
|
19
19
|
ApplicationScript
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-qtkycaqn.js";
|
|
21
21
|
import {
|
|
22
22
|
PackageScript
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-tk3jg2bm.js";
|
|
24
24
|
import {
|
|
25
25
|
CloudRunner
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-vg28jsf9.js";
|
|
27
27
|
|
|
28
28
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
29
29
|
import { Logger } from "akanjs/common";
|
|
@@ -3,6 +3,44 @@ import {
|
|
|
3
3
|
ConfigLock
|
|
4
4
|
} from "./index-bqbf654f.js";
|
|
5
5
|
|
|
6
|
+
// pkgs/@akanjs/devkit/codeAgent/agent/AkanCodeCompaction.ts
|
|
7
|
+
class AkanCodeCompaction2 {
|
|
8
|
+
static reserveFloor = 32768;
|
|
9
|
+
static steps = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
|
|
10
|
+
static isStep(percent) {
|
|
11
|
+
return AkanCodeCompaction2.steps.some((step) => step === percent);
|
|
12
|
+
}
|
|
13
|
+
static normalize(percent) {
|
|
14
|
+
if (percent === undefined)
|
|
15
|
+
return;
|
|
16
|
+
if (!AkanCodeCompaction2.isStep(percent))
|
|
17
|
+
throw new Error(`Autocompact takes a percent in steps of 10: ${AkanCodeCompaction2.steps.join(", ")}.`);
|
|
18
|
+
return percent === 100 ? undefined : percent;
|
|
19
|
+
}
|
|
20
|
+
static thresholdOf(contextWindow, percent) {
|
|
21
|
+
const share = percent ? Math.floor(contextWindow * percent / 100) : contextWindow;
|
|
22
|
+
return Math.min(share, contextWindow - AkanCodeCompaction2.reserveFloor);
|
|
23
|
+
}
|
|
24
|
+
static apply(settings, model, percent) {
|
|
25
|
+
const threshold = AkanCodeCompaction2.thresholdOf(model.contextWindow, percent);
|
|
26
|
+
settings.applyOverrides({
|
|
27
|
+
compaction: {
|
|
28
|
+
modelOverrides: { [`${model.provider}/${model.id}`]: { reserveTokens: model.contextWindow - threshold } }
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
static problemOf(model, percent, keepRecentTokens) {
|
|
33
|
+
const name = `${model.provider}/${model.id}`;
|
|
34
|
+
if (model.contextWindow <= 0)
|
|
35
|
+
return `${name} declares no context window, so it has no share to compact at.`;
|
|
36
|
+
const threshold = AkanCodeCompaction2.thresholdOf(model.contextWindow, percent);
|
|
37
|
+
if (threshold >= keepRecentTokens)
|
|
38
|
+
return;
|
|
39
|
+
const k = (tokens) => `${Math.round(tokens / 1000)}k`;
|
|
40
|
+
return `Compacting at ${percent}% of the ${k(model.contextWindow)} window of ${name} starts at ${k(threshold)}, under the ${k(keepRecentTokens)} of recent turns every compaction keeps, so every turn would compact again.`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
6
44
|
// pkgs/@akanjs/devkit/codeAgent/agent/akanCodePaths.ts
|
|
7
45
|
import { existsSync } from "fs";
|
|
8
46
|
import { homedir } from "os";
|
|
@@ -141,7 +179,7 @@ class SubagentPool2 {
|
|
|
141
179
|
}
|
|
142
180
|
}
|
|
143
181
|
async#run(id, kind, prompt, signal) {
|
|
144
|
-
const { CodeAgent } = await import("./CodeAgent-
|
|
182
|
+
const { CodeAgent } = await import("./CodeAgent-4pnxwptq.js");
|
|
145
183
|
const budget = this.#options.parent.tools.subagent;
|
|
146
184
|
const child = SubagentPool2.childOf(this.#options.parent, kind);
|
|
147
185
|
const agent = await CodeAgent.create({
|
|
@@ -697,4 +735,4 @@ ${stored.refreshToken}`;
|
|
|
697
735
|
}
|
|
698
736
|
}
|
|
699
737
|
|
|
700
|
-
export { SubagentPool2, akanCodePaths2, McpServerConfig, McpTokenStore, McpSignIn };
|
|
738
|
+
export { SubagentPool2, akanCodePaths2, McpServerConfig, McpTokenStore, McpSignIn, AkanCodeCompaction2 };
|
|
@@ -77,6 +77,9 @@ class CodeAgentRpcHost2 {
|
|
|
77
77
|
case "set_model":
|
|
78
78
|
await this.#agent.setModel({ provider: command.provider, id: command.modelId });
|
|
79
79
|
return await this.#agent.state();
|
|
80
|
+
case "set_auto_compact":
|
|
81
|
+
this.#agent.setAutoCompactAt(command.percent);
|
|
82
|
+
return await this.#agent.state();
|
|
80
83
|
case "get_state":
|
|
81
84
|
return await this.#agent.state(command.sinceSeq === undefined ? {} : { sinceSeq: command.sinceSeq });
|
|
82
85
|
case "shutdown":
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-p4dnj2wc.js";
|
|
6
6
|
import {
|
|
7
7
|
ModuleExecutor
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-rr7jk14m.js";
|
|
9
9
|
import {
|
|
10
10
|
sourceFile,
|
|
11
11
|
moduleSourcePaths,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
createPassedPrimitiveReport,
|
|
14
14
|
bilingualLabelForField,
|
|
15
15
|
bilingualDescriptionForField
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-ynqxpwx6.js";
|
|
17
17
|
import {
|
|
18
18
|
PageScript
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-g2s33373.js";
|
|
20
20
|
import {
|
|
21
21
|
pluralizeName
|
|
22
22
|
} from "./index-nz8prx9g.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-rr7jk14m.js";
|
|
5
5
|
import {
|
|
6
6
|
jsonText,
|
|
7
7
|
createWorkflowBaselineSummary,
|
|
8
8
|
buildAkanModuleContextIndex,
|
|
9
9
|
toolingRolloutGate
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-ynqxpwx6.js";
|
|
11
11
|
import {
|
|
12
12
|
buildResourceList,
|
|
13
13
|
codexMcpConfigPath,
|
|
@@ -17,29 +17,29 @@ import {
|
|
|
17
17
|
upsertCodexMcpServerBlock,
|
|
18
18
|
renderDoctorText,
|
|
19
19
|
AkanContextAnalyzer
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-z6v7k9sb.js";
|
|
21
21
|
import {
|
|
22
22
|
runner
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-p4dnj2wc.js";
|
|
24
24
|
import {
|
|
25
25
|
isPlaceholderAppId
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-ekpp5tax.js";
|
|
27
27
|
import {
|
|
28
28
|
getMobileTargets,
|
|
29
29
|
appIdsOf
|
|
30
30
|
} from "./index-m9jj544v.js";
|
|
31
31
|
import {
|
|
32
32
|
NativeApp
|
|
33
|
-
} from "./index-
|
|
33
|
+
} from "./index-z9xepn8t.js";
|
|
34
34
|
import {
|
|
35
35
|
Prompter2
|
|
36
36
|
} from "./index-zzvvc845.js";
|
|
37
37
|
import {
|
|
38
38
|
RepairRunner
|
|
39
|
-
} from "./index-
|
|
39
|
+
} from "./index-qfzfaq96.js";
|
|
40
40
|
import {
|
|
41
41
|
WorkflowRunner
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-sh9mmp5v.js";
|
|
43
43
|
|
|
44
44
|
// pkgs/@akanjs/devkit/akanMcpContract.ts
|
|
45
45
|
import path from "path";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
resolveSsrPageEntriesForApp
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-rr7jk14m.js";
|
|
5
5
|
import {
|
|
6
6
|
computeRouteSeedIndex,
|
|
7
7
|
saveRouteSeedIndex,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ClientEntriesBundler,
|
|
10
10
|
VENDOR_SPECIFIERS,
|
|
11
11
|
RouteClientBuilder
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-ngpn9hzy.js";
|
|
13
13
|
import {
|
|
14
14
|
SOURCE_EXTS
|
|
15
15
|
} from "./index-5nd1wtkv.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
createTsconfigPackageResolver,
|
|
20
20
|
rewriteBarrelImports,
|
|
21
21
|
PagesBundleBuilder
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-jgs8z8xb.js";
|
|
23
23
|
import {
|
|
24
24
|
CssBlockParser
|
|
25
25
|
} from "./index-62md4dwy.js";
|
|
@@ -137,10 +137,10 @@ import { compile } from "tailwindcss";
|
|
|
137
137
|
|
|
138
138
|
// pkgs/@akanjs/devkit/frontendBuild/cssCandidateCache.ts
|
|
139
139
|
import { stat } from "fs/promises";
|
|
140
|
-
var CANDIDATE_RE = /-?(?:[\w@]|\[[
|
|
140
|
+
var CANDIDATE_RE = /-?(?:[\w@]|\[(?:[^[\]\s]|\[[^[\]\s]+\])+\])[\w:/.-]*(?:(?:\[(?:[^[\]\s]|\[[^[\]\s]+\])+\]|\((?:[a-z-]+:)?--[^)\s]+\))[\w:/.-]*)*/g;
|
|
141
141
|
|
|
142
142
|
class CssCandidateCache {
|
|
143
|
-
static #version =
|
|
143
|
+
static #version = 5;
|
|
144
144
|
#path;
|
|
145
145
|
#entries = new Map;
|
|
146
146
|
#dirty = false;
|
|
@@ -1240,7 +1240,8 @@ class FontPruner {
|
|
|
1240
1240
|
{ dir: path5.join(this.#artifactRoot, "client"), label: ".akan/artifact/client", needles: bundled },
|
|
1241
1241
|
{ dir: path5.join(this.#artifactRoot, "client-ssr"), label: ".akan/artifact/client-ssr", needles: bundled },
|
|
1242
1242
|
{ dir: path5.join(this.#artifactRoot, "server"), label: ".akan/artifact/server", needles: bundled },
|
|
1243
|
-
{ dir: path5.join(this.#app.dist.cwdPath, "csr"), label: "csr", needles: bundled }
|
|
1243
|
+
{ dir: path5.join(this.#app.dist.cwdPath, "csr"), label: "csr", needles: bundled },
|
|
1244
|
+
{ dir: path5.join(this.#app.dist.cwdPath, "mcp-apps"), label: "mcp-apps", needles: bundled }
|
|
1244
1245
|
];
|
|
1245
1246
|
for (const root of roots) {
|
|
1246
1247
|
const pending = root.needles.filter((candidate) => !referrers.has(candidate.rel));
|
|
@@ -1323,23 +1324,26 @@ import path6 from "path";
|
|
|
1323
1324
|
import zlib from "zlib";
|
|
1324
1325
|
var COMPRESSIBLE_EXTS = new Set([".css", ".html", ".js", ".json", ".svg"]);
|
|
1325
1326
|
var MIN_COMPRESS_BYTES = 1024;
|
|
1326
|
-
var
|
|
1327
|
+
var MAX_BROTLI_QUALITY = 11;
|
|
1328
|
+
var BROTLI_QUALITY_BY_EXT = { ".css": MAX_BROTLI_QUALITY };
|
|
1327
1329
|
var DEFAULT_BROTLI_QUALITY = 9;
|
|
1328
1330
|
var GZIP_LEVEL = 9;
|
|
1329
1331
|
var { formatBytes } = FontPruner;
|
|
1330
1332
|
async function precompressArtifacts(app) {
|
|
1333
|
+
const artifactDir = path6.join(app.dist.cwdPath, ".akan/artifact");
|
|
1331
1334
|
const roots = [
|
|
1332
|
-
path6.join(
|
|
1333
|
-
path6.join(
|
|
1335
|
+
{ root: path6.join(artifactDir, "client") },
|
|
1336
|
+
{ root: path6.join(artifactDir, "styles") },
|
|
1337
|
+
{ root: path6.join(artifactDir, "dict"), brotliQuality: MAX_BROTLI_QUALITY }
|
|
1334
1338
|
];
|
|
1335
1339
|
const result = { files: 0, inputBytes: 0, outputBytes: 0, brotliBytes: 0 };
|
|
1336
|
-
await Promise.all(roots.map((root) => precompressRoot(root, result)));
|
|
1340
|
+
await Promise.all(roots.map(({ root, brotliQuality }) => precompressRoot(root, result, brotliQuality)));
|
|
1337
1341
|
if (result.files > 0) {
|
|
1338
1342
|
app.verbose(`[precompress] wrote ${result.files} sidecars (${formatBytes(result.inputBytes)} -> gzip ${formatBytes(result.outputBytes)} / br ${formatBytes(result.brotliBytes)})`);
|
|
1339
1343
|
}
|
|
1340
1344
|
return result;
|
|
1341
1345
|
}
|
|
1342
|
-
async function precompressRoot(root, result) {
|
|
1346
|
+
async function precompressRoot(root, result, brotliQuality) {
|
|
1343
1347
|
if (!fs.existsSync(root) || !fs.statSync(root).isDirectory())
|
|
1344
1348
|
return;
|
|
1345
1349
|
const glob = new Bun.Glob("**/*");
|
|
@@ -1349,7 +1353,7 @@ async function precompressRoot(root, result) {
|
|
|
1349
1353
|
const bytes = await Bun.file(filePath).bytes();
|
|
1350
1354
|
const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
1351
1355
|
const gz = Bun.gzipSync(buffer, { level: GZIP_LEVEL });
|
|
1352
|
-
const br = brotliCompress(buffer, path6.extname(filePath).toLowerCase());
|
|
1356
|
+
const br = brotliCompress(buffer, brotliQuality ?? brotliQualityOf(path6.extname(filePath).toLowerCase()));
|
|
1353
1357
|
await Promise.all([Bun.write(`${filePath}.gz`, gz), Bun.write(`${filePath}.br`, br)]);
|
|
1354
1358
|
result.files += 1;
|
|
1355
1359
|
result.inputBytes += bytes.byteLength;
|
|
@@ -1357,8 +1361,10 @@ async function precompressRoot(root, result) {
|
|
|
1357
1361
|
result.brotliBytes += br.byteLength;
|
|
1358
1362
|
}
|
|
1359
1363
|
}
|
|
1360
|
-
function
|
|
1361
|
-
|
|
1364
|
+
function brotliQualityOf(ext) {
|
|
1365
|
+
return BROTLI_QUALITY_BY_EXT[ext] ?? DEFAULT_BROTLI_QUALITY;
|
|
1366
|
+
}
|
|
1367
|
+
function brotliCompress(buffer, quality) {
|
|
1362
1368
|
return zlib.brotliCompressSync(buffer, {
|
|
1363
1369
|
params: {
|
|
1364
1370
|
[zlib.constants.BROTLI_PARAM_QUALITY]: quality,
|
|
@@ -1377,8 +1383,51 @@ async function shouldPrecompress(filePath) {
|
|
|
1377
1383
|
return file.size >= MIN_COMPRESS_BYTES;
|
|
1378
1384
|
}
|
|
1379
1385
|
// pkgs/@akanjs/devkit/frontendBuild/ssrBaseArtifactBuilder.ts
|
|
1380
|
-
import
|
|
1386
|
+
import path8 from "path";
|
|
1381
1387
|
import { optimize } from "@tailwindcss/node";
|
|
1388
|
+
|
|
1389
|
+
// pkgs/@akanjs/devkit/frontendBuild/dictionaryAssetBuilder.ts
|
|
1390
|
+
import path7 from "path";
|
|
1391
|
+
import { Translator } from "akanjs/client";
|
|
1392
|
+
|
|
1393
|
+
class DictionaryAssetBuilder {
|
|
1394
|
+
static urlPrefix = "/_akan/dict";
|
|
1395
|
+
#app;
|
|
1396
|
+
#absArtifactDir;
|
|
1397
|
+
constructor(app, absArtifactDir) {
|
|
1398
|
+
this.#app = app;
|
|
1399
|
+
this.#absArtifactDir = absArtifactDir;
|
|
1400
|
+
}
|
|
1401
|
+
async build(i18n) {
|
|
1402
|
+
const allDictionary = await this.#loadAllDictionary();
|
|
1403
|
+
if (!allDictionary)
|
|
1404
|
+
return {};
|
|
1405
|
+
const assets = await Promise.all(i18n.locales.map((lang) => this.#write(lang, Translator.fillFromDefault(allDictionary, lang, i18n.defaultLocale))));
|
|
1406
|
+
this.#app.verbose(`[base-artifact] dictionaries -> ${assets.map(([, asset]) => asset.relPath).join(", ")}`);
|
|
1407
|
+
return Object.fromEntries(assets);
|
|
1408
|
+
}
|
|
1409
|
+
async#loadAllDictionary() {
|
|
1410
|
+
const dictPath = path7.resolve(this.#app.cwdPath, "lib", "dict.ts");
|
|
1411
|
+
if (!await Bun.file(dictPath).exists())
|
|
1412
|
+
return null;
|
|
1413
|
+
const { getAllDictionary } = await import(dictPath);
|
|
1414
|
+
return getAllDictionary ? getAllDictionary() : null;
|
|
1415
|
+
}
|
|
1416
|
+
async#write(lang, dictionary) {
|
|
1417
|
+
const source = DictionaryAssetBuilder.source(lang, dictionary);
|
|
1418
|
+
const name = `${lang}-${Bun.hash(source).toString(36)}.js`;
|
|
1419
|
+
const relPath = `dict/${name}`;
|
|
1420
|
+
await Bun.write(path7.join(this.#absArtifactDir, relPath), source);
|
|
1421
|
+
return [lang, { url: `${DictionaryAssetBuilder.urlPrefix}/${name}`, relPath }];
|
|
1422
|
+
}
|
|
1423
|
+
static source(lang, dictionary) {
|
|
1424
|
+
return `export const lang = ${JSON.stringify(lang)};
|
|
1425
|
+
export default JSON.parse(${JSON.stringify(JSON.stringify(dictionary))});
|
|
1426
|
+
`;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
// pkgs/@akanjs/devkit/frontendBuild/ssrBaseArtifactBuilder.ts
|
|
1382
1431
|
function prepareCssAsset(command, basePath, cssText) {
|
|
1383
1432
|
return optimize(cssText, { file: `${basePath || "root"}.css`, minify: command === "build" }).code;
|
|
1384
1433
|
}
|
|
@@ -1395,7 +1444,7 @@ class SsrBaseArtifactBuilder {
|
|
|
1395
1444
|
this.#command = command;
|
|
1396
1445
|
this.#serverEnv = serverEnv;
|
|
1397
1446
|
this.#artifactDir = `${command === "build" ? app.dist.cwdPath : app.cwdPath}/.akan/artifact`;
|
|
1398
|
-
this.#absArtifactDir =
|
|
1447
|
+
this.#absArtifactDir = path8.resolve(this.#artifactDir);
|
|
1399
1448
|
}
|
|
1400
1449
|
static servedWeb(command, web) {
|
|
1401
1450
|
return command === "start" ? { ssr: true, csr: true } : web;
|
|
@@ -1407,6 +1456,7 @@ class SsrBaseArtifactBuilder {
|
|
|
1407
1456
|
this.#app.verbose(`[base-artifact] discovered ${pageKeys.length} route files under ${this.#app.cwdPath}/page`);
|
|
1408
1457
|
const pageEntries = await resolveSsrPageEntriesForApp(this.#app, pageKeys);
|
|
1409
1458
|
const { cssCompiler, optimizedFonts, cssAssets } = await this.#buildStyleAssets();
|
|
1459
|
+
const dictAssets = await new DictionaryAssetBuilder(this.#app, this.#absArtifactDir).build(akanConfig.i18n);
|
|
1410
1460
|
const pagesBundle = await new PagesBundleBuilder(this.#app, this.#command, pageEntries, this.#serverEnv).build();
|
|
1411
1461
|
this.#app.verbose(`[base-artifact] pages bundle -> ${pagesBundle.bundlePath} (buildId=${pagesBundle.buildId}, splitting=${pagesBundle.splitting}, entry=${pagesBundle.entryBytes} bytes, outputs=${pagesBundle.outputCount}, chunks=${pagesBundle.chunkCount}, total=${pagesBundle.outputBytes} bytes)`);
|
|
1412
1462
|
const seedIndex = computeRouteSeedIndex(pageEntries);
|
|
@@ -1420,7 +1470,8 @@ class SsrBaseArtifactBuilder {
|
|
|
1420
1470
|
rscRuntimeSsrManifest,
|
|
1421
1471
|
vendorMap,
|
|
1422
1472
|
cssAssets,
|
|
1423
|
-
|
|
1473
|
+
dictAssets,
|
|
1474
|
+
pagesBundlePath: this.#command === "build" ? path8.relative(this.#absArtifactDir, pagesBundle.bundlePath) : pagesBundle.bundlePath,
|
|
1424
1475
|
pagesBundleBuildId: pagesBundle.buildId,
|
|
1425
1476
|
domains: [...akanConfig.domains],
|
|
1426
1477
|
subRoutes: Object.fromEntries(Array.from(akanConfig.subRoutes.entries()).map(([basePath, domains]) => [basePath, [...domains]])),
|
|
@@ -1438,18 +1489,18 @@ class SsrBaseArtifactBuilder {
|
|
|
1438
1489
|
androidSha256CertFingerprints: target.android?.sha256CertFingerprints
|
|
1439
1490
|
}))
|
|
1440
1491
|
};
|
|
1441
|
-
await Bun.write(
|
|
1492
|
+
await Bun.write(path8.join(this.#absArtifactDir, "base-artifact.json"), `${JSON.stringify(artifact, null, 2)}
|
|
1442
1493
|
`);
|
|
1443
1494
|
this.#app.verbose(`[base-artifact] complete in ${Date.now() - this.#started}ms`);
|
|
1444
1495
|
return { artifact, seedIndex, cssCompiler, optimizedFonts };
|
|
1445
1496
|
}
|
|
1446
1497
|
async#buildRuntimeClientEntries() {
|
|
1447
1498
|
const akanServerPath = await this.#resolveAkanServerPath();
|
|
1448
|
-
const rscClientEntry =
|
|
1449
|
-
const rscSegmentOutletEntry =
|
|
1499
|
+
const rscClientEntry = path8.resolve(akanServerPath, "rscClient.tsx");
|
|
1500
|
+
const rscSegmentOutletEntry = path8.resolve(akanServerPath, "rscSegmentOutlet.tsx");
|
|
1450
1501
|
const vendorEntries = VENDOR_SPECIFIERS.map((specifier) => ({
|
|
1451
1502
|
specifier,
|
|
1452
|
-
absPath:
|
|
1503
|
+
absPath: path8.resolve(akanServerPath, "vendor", `${specifier.replaceAll("/", "-").replaceAll(".", "-")}.ts`)
|
|
1453
1504
|
}));
|
|
1454
1505
|
const entries = [rscClientEntry, rscSegmentOutletEntry, ...vendorEntries.map((v) => v.absPath)];
|
|
1455
1506
|
const clientBundle = await new ClientEntriesBundler({ app: this.#app, entries, command: this.#command }).bundle();
|
|
@@ -1486,15 +1537,15 @@ class SsrBaseArtifactBuilder {
|
|
|
1486
1537
|
async#resolveAkanServerPath() {
|
|
1487
1538
|
const candidates = [];
|
|
1488
1539
|
try {
|
|
1489
|
-
candidates.push(
|
|
1540
|
+
candidates.push(path8.dirname(Bun.resolveSync("akanjs/server", this.#app.workspace.workspaceRoot)));
|
|
1490
1541
|
} catch {}
|
|
1491
|
-
candidates.push(
|
|
1542
|
+
candidates.push(path8.join(this.#app.workspace.workspaceRoot, "pkgs/akanjs/server"), path8.join(this.#app.workspace.workspaceRoot, "node_modules/akanjs/server"));
|
|
1492
1543
|
try {
|
|
1493
|
-
candidates.push(
|
|
1544
|
+
candidates.push(path8.dirname(Bun.resolveSync("akanjs/server", path8.dirname(Bun.main))));
|
|
1494
1545
|
} catch {}
|
|
1495
|
-
candidates.push(
|
|
1546
|
+
candidates.push(path8.join(path8.dirname(Bun.main), "node_modules/akanjs/server"), path8.join(path8.dirname(Bun.main), "../../akanjs/server"), path8.resolve(import.meta.dir, "../../server"), path8.resolve(import.meta.dir, "../server"));
|
|
1496
1547
|
for (const candidate of candidates) {
|
|
1497
|
-
if (await Bun.file(
|
|
1548
|
+
if (await Bun.file(path8.join(candidate, "rscClient.tsx")).exists())
|
|
1498
1549
|
return candidate;
|
|
1499
1550
|
}
|
|
1500
1551
|
throw new Error(`[base-artifact] failed to locate akanjs/server; looked in: ${candidates.join(", ")}`);
|
|
@@ -1523,7 +1574,7 @@ ${preparedCssText}`).toString(36);
|
|
|
1523
1574
|
`styles/${cssAssetName}-${cssHash}.css`,
|
|
1524
1575
|
`/_akan/styles/${cssAssetName}-${cssHash}.css`
|
|
1525
1576
|
];
|
|
1526
|
-
await Bun.write(
|
|
1577
|
+
await Bun.write(path8.join(this.#absArtifactDir, cssRelPath), preparedCssText);
|
|
1527
1578
|
SsrBaseArtifactBuilder.#warnDroppedImports(this.#app, cssRelPath, preparedCssText, imported);
|
|
1528
1579
|
this.#app.verbose(`[base-artifact] wrote ${preparedCssText.length} bytes of CSS for ${basePath} -> ${cssRelPath}`);
|
|
1529
1580
|
return [basePath, { cssUrl, cssRelPath }];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
DesktopBin,
|
|
4
4
|
UpdatePackFolder
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-z9xepn8t.js";
|
|
6
6
|
// pkgs/@akanjs/devkit/mobile/desktopServerStage.ts
|
|
7
7
|
import { cp, mkdir, readdir, rm, writeFile } from "fs/promises";
|
|
8
8
|
import path from "path";
|
|
@@ -16,6 +16,7 @@ class DesktopServerStage {
|
|
|
16
16
|
"console.js",
|
|
17
17
|
"console-runtime.js",
|
|
18
18
|
"csr",
|
|
19
|
+
"mcp-apps",
|
|
19
20
|
"public",
|
|
20
21
|
".akan"
|
|
21
22
|
]);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
jsonText
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-ynqxpwx6.js";
|
|
5
5
|
import {
|
|
6
6
|
akanMcpInstallTargets
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-z6v7k9sb.js";
|
|
8
8
|
import {
|
|
9
9
|
script
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-p4dnj2wc.js";
|
|
11
11
|
import {
|
|
12
12
|
ContextRunner2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-bb4hj03s.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/context/context.script.ts
|
|
16
16
|
import { Logger } from "akanjs/common";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AsyncDefaultExportDetector,
|
|
4
4
|
resolveSsrPageEntriesForApp
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-rr7jk14m.js";
|
|
6
6
|
import {
|
|
7
7
|
FileSys2
|
|
8
8
|
} from "./index-52w0fvh8.js";
|
|
@@ -201,9 +201,9 @@ var defaultResolveRelative = async (fromFile, relSpec) => {
|
|
|
201
201
|
// pkgs/@akanjs/devkit/transforms/barrelImportsPlugin.ts
|
|
202
202
|
import path2 from "path";
|
|
203
203
|
import ts from "typescript";
|
|
204
|
-
var createBarrelImportsPlugin = async (app, { skipPath = defaultSkipPath, pipeAfter } = {}) => {
|
|
204
|
+
var createBarrelImportsPlugin = async (app, { skipPath = defaultSkipPath, pipeAfter, external = [] } = {}) => {
|
|
205
205
|
const akanConfig = await app.getConfig();
|
|
206
|
-
const barrels = [...new Set(akanConfig.barrelImports)].filter(
|
|
206
|
+
const barrels = [...new Set(akanConfig.barrelImports)].filter((barrel) => barrel && !external.includes(barrel));
|
|
207
207
|
const analyzer = new BarrelAnalyzer({
|
|
208
208
|
resolvePackage: await createTsconfigPackageResolver(app)
|
|
209
209
|
});
|
|
@@ -19,11 +19,11 @@ import {
|
|
|
19
19
|
CsrDevPaths,
|
|
20
20
|
PagesEntrySourceGenerator,
|
|
21
21
|
PagesBundleBuilder
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-jgs8z8xb.js";
|
|
23
23
|
import {
|
|
24
24
|
AsyncDefaultExportDetector,
|
|
25
25
|
resolveSsrPageEntriesForApp
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-rr7jk14m.js";
|
|
27
27
|
|
|
28
28
|
// pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
|
|
29
29
|
import { readdir, readFile, stat } from "fs/promises";
|
|
@@ -1578,7 +1578,8 @@ var VENDOR_SPECIFIERS = [
|
|
|
1578
1578
|
"akanjs/base",
|
|
1579
1579
|
"akanjs/common",
|
|
1580
1580
|
"akanjs/constant",
|
|
1581
|
-
"akanjs/fetch"
|
|
1581
|
+
"akanjs/fetch",
|
|
1582
|
+
"tailwind-merge"
|
|
1582
1583
|
];
|
|
1583
1584
|
|
|
1584
1585
|
// pkgs/@akanjs/devkit/frontendBuild/routeClientBuilder.ts
|
|
@@ -1693,7 +1694,8 @@ class RouteClientBuilder {
|
|
|
1693
1694
|
entries: bootstrapEntries.buildEntries,
|
|
1694
1695
|
plugins: [
|
|
1695
1696
|
await createBarrelImportsPlugin(this.#app, {
|
|
1696
|
-
pipeAfter: reactFastRefresh ? RouteClientBuilder.normalizeNamedDefaultFunctionForFastRefresh : undefined
|
|
1697
|
+
pipeAfter: reactFastRefresh ? RouteClientBuilder.normalizeNamedDefaultFunctionForFastRefresh : undefined,
|
|
1698
|
+
external: VENDOR_SPECIFIERS
|
|
1697
1699
|
})
|
|
1698
1700
|
],
|
|
1699
1701
|
external: VENDOR_SPECIFIERS,
|