@akanjs/cli 3.2.0 → 3.2.1-rc.1
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-xdw73nbz.js +11 -0
- package/{CodeTui-zee8atsr.js → CodeTui-0gewm71c.js} +4 -4
- package/TunnelShare-cccfdgbm.js +16 -0
- package/{agent.command-x65f2ags.js → agent.command-g1mj34wz.js} +20 -22
- package/akanCode.js +5 -5
- package/appExecutor-rrx10jya.js +11 -0
- package/{application.command-azbd1pb2.js → application.command-3w4v7t40.js} +17 -19
- package/{applicationBuildRunner-trfxv3pd.js → applicationBuildRunner-y5xbetyz.js} +12 -12
- package/buildBatch.proc.js +19 -18
- package/{cloud.command-gapp4634.js → cloud.command-ph0rz6sw.js} +19 -24
- package/cloud.script-8bs9tp4j.js +30 -0
- package/{code.command-5smx61yf.js → code.command-9b967qpg.js} +13 -13
- package/{context.command-ym5jbkny.js → context.command-ndzs5rbf.js} +20 -22
- package/context.runner-bmstpng2.js +32 -0
- package/csrArtifactBuilder-gtvff6k7.js +10 -0
- package/{index-2ny1e95c.js → dependencyScanner-93g8tk0r.js} +6 -5
- package/{fileSys-q22646yc.js → fileSys-e5mwt73x.js} +1 -1
- package/frameworkGraph-aneq2nwy.js +8 -0
- package/{guideline.command-zwypaqsh.js → guideline.command-y8qz9kxy.js} +8 -8
- package/incrementalBuilder.proc.js +24 -18
- package/{index-8jtqfye2.js → index-02v45hh9.js} +6 -6
- package/{index-2jmvfa62.js → index-0csk6jqm.js} +3 -3
- package/{index-nc3br31y.js → index-0wa5z6rm.js} +2 -2
- package/{index-9wh04mqy.js → index-0z8sbdme.js} +2 -2
- package/{index-zmd9xxgd.js → index-1c2807kg.js} +3 -3
- package/{index-4ss4gkv3.js → index-1p9bxjmt.js} +2 -2
- package/{index-612fdtbk.js → index-2kh4xj3m.js} +1 -1
- package/{index-kfvjzk8r.js → index-2vn0m9z5.js} +3 -3
- package/{index-xwwex8rf.js → index-3569fr49.js} +5 -5
- package/{index-a860mx0m.js → index-38x8ynrx.js} +24 -24
- package/{index-p7beqww9.js → index-3fmzz9sf.js} +18 -18
- package/{index-s885g0jj.js → index-45aprybg.js} +3 -3
- package/{index-v7ajmsh3.js → index-4a1n0nym.js} +1 -1
- package/{index-ybcb9wc8.js → index-4zgm54wf.js} +9 -9
- package/{index-2yn3r67f.js → index-652f3bs8.js} +6 -6
- package/{index-j6jjmn2r.js → index-6gepp8yn.js} +10 -10
- package/{index-dmcpetwe.js → index-6j351de4.js} +98 -23
- package/{index-0dm25wvf.js → index-7ssr7wq4.js} +1 -1
- package/{index-k6vwww45.js → index-82cmbpxc.js} +7 -7
- package/{index-j592zfqc.js → index-9rymt8d6.js} +1 -1
- package/{index-275a4r3n.js → index-ankyx6dj.js} +11 -15
- package/{index-41a03gkj.js → index-b0t92k71.js} +19 -19
- package/{index-z92zm3wd.js → index-b372rck5.js} +17 -6
- package/{index-78y75t0a.js → index-cm9rb480.js} +6 -6
- package/{index-z96ks033.js → index-d0n78fzc.js} +153 -45
- package/{index-gt8phqpt.js → index-dr1carpr.js} +4 -4
- package/{index-zfnz878d.js → index-f2arv0mv.js} +1 -1
- package/{index-67sd09ag.js → index-gtydr9qc.js} +8 -8
- package/{index-knpm8sdm.js → index-j3fqs8rc.js} +1 -1
- package/{index-h901f24n.js → index-jdw9m5c4.js} +5 -5
- package/{index-dadwp2aw.js → index-jg5rwrf7.js} +49 -22
- package/{index-baccvws5.js → index-ktxdfqg5.js} +1 -1
- package/{index-w1zexzpx.js → index-mnhrqjjq.js} +1 -1
- package/{index-71y6176j.js → index-pc42gxa5.js} +7 -7
- package/{index-6dzjer7p.js → index-q8h4eg5y.js} +6 -6
- package/{index-j0wr4e32.js → index-qh81drde.js} +9 -9
- package/{index-jek2re5k.js → index-scfsqen7.js} +4 -4
- package/{index-0s7w2085.js → index-twjgmryg.js} +4 -4
- package/{index-7wf8snar.js → index-whvhsb5f.js} +1 -1
- package/{index-p5zh7pmc.js → index-xv3pvdw4.js} +1 -1
- package/{index-3txdtztz.js → index-y2g0s9tn.js} +1 -1
- package/{index-ebn9kgea.js → index-ymgsvhc5.js} +4 -5
- package/{index-by2tvsq6.js → index-zyjztrvc.js} +1 -1
- package/index.js +30 -28
- package/{libExecutor-jc6f8hm6.js → libExecutor-nstr00s7.js} +3 -3
- package/{library.command-nxvesvhb.js → library.command-b02aw1hm.js} +8 -8
- package/{localRegistry.command-xz62e4ng.js → localRegistry.command-3hg1p4aj.js} +18 -23
- package/{module.command-aaws9byg.js → module.command-bd9gz6cv.js} +10 -10
- package/{package.command-j7hv26p0.js → package.command-xmr0mxze.js} +9 -12
- package/package.json +2 -2
- package/{page.command-7yffs7n9.js → page.command-x94qf58g.js} +8 -8
- package/{pipeline.command-7yk0zcng.js → pipeline.command-n2843k6t.js} +7 -7
- package/{pkgExecutor-arxmvx4t.js → pkgExecutor-cka27e3c.js} +3 -3
- package/{primitive.command-7a1pt715.js → primitive.command-cs7v376h.js} +11 -11
- package/{projectTypecheck-f4qhbecd.js → projectTypecheck-za2n3nbr.js} +1 -1
- package/{prompter-qyggfhqd.js → prompter-d33wmdpa.js} +2 -2
- package/{quality.command-c6mvrjh1.js → quality.command-nqngh1jd.js} +9 -9
- package/{repair.command-093adzt9.js → repair.command-v2medwsm.js} +10 -10
- package/{scalar.command-2ex84spb.js → scalar.command-61cjmxn1.js} +9 -9
- package/{subspace.command-4n4n4jpv.js → subspace.command-dtv8nfh7.js} +11 -13
- package/{tunnel.command-f7ep1qfa.js → tunnel.command-fmwm5fgb.js} +10 -12
- package/{verify.command-zrkxnvct.js → verify.command-4f260t53.js} +15 -17
- package/{workflow.command-ks16jegk.js → workflow.command-tm5q9xsm.js} +15 -15
- package/{workspace.command-ahhfpaag.js → workspace.command-75gc280j.js} +34 -38
- package/CodeAgent-fx6088tv.js +0 -11
- package/TunnelShare-9ry4vh0y.js +0 -18
- package/appExecutor-79azsb2w.js +0 -11
- package/cloud.script-3b401efv.js +0 -35
- package/context.runner-kctbfsde.js +0 -34
- package/dependencyScanner-ge10gb52.js +0 -8
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
script,
|
|
4
4
|
command
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-652f3bs8.js";
|
|
6
6
|
import"./index-j4yvgfhr.js";
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-
|
|
7
|
+
import"./index-pc42gxa5.js";
|
|
8
|
+
import"./index-zyjztrvc.js";
|
|
9
|
+
import"./index-b372rck5.js";
|
|
10
|
+
import"./index-f2arv0mv.js";
|
|
11
|
+
import"./index-mnhrqjjq.js";
|
|
12
12
|
import {
|
|
13
13
|
Prompter2
|
|
14
|
-
} from "./index-
|
|
15
|
-
import"./index-
|
|
14
|
+
} from "./index-j3fqs8rc.js";
|
|
15
|
+
import"./index-whvhsb5f.js";
|
|
16
16
|
|
|
17
17
|
// pkgs/@akanjs/cli/guideline/guideline.script.ts
|
|
18
18
|
import { Logger } from "akanjs/common";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import
|
|
3
|
-
HmrWatcher,
|
|
4
|
-
WatchRootResolver,
|
|
5
|
-
ApplicationBuildReporter
|
|
6
|
-
} from "./index-dmcpetwe.js";
|
|
2
|
+
import"./index-zyjztrvc.js";
|
|
7
3
|
import {
|
|
8
4
|
CodegenLock,
|
|
9
5
|
WorkspaceExecutor
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-by2tvsq6.js";
|
|
6
|
+
} from "./index-pc42gxa5.js";
|
|
12
7
|
import"./index-j4yvgfhr.js";
|
|
8
|
+
import {
|
|
9
|
+
HmrWatcher,
|
|
10
|
+
WatchRootResolver,
|
|
11
|
+
ApplicationBuildReporter
|
|
12
|
+
} from "./index-6j351de4.js";
|
|
13
13
|
import {
|
|
14
14
|
AppExecutor2
|
|
15
|
-
} from "./index-
|
|
16
|
-
import"./index-
|
|
17
|
-
import"./index-
|
|
15
|
+
} from "./index-b372rck5.js";
|
|
16
|
+
import"./index-f2arv0mv.js";
|
|
17
|
+
import"./index-mnhrqjjq.js";
|
|
18
18
|
import {
|
|
19
19
|
ServerGraphFile
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-0z8sbdme.js";
|
|
21
21
|
import {
|
|
22
22
|
GraphClientEntryDiscovery,
|
|
23
23
|
RouteClientBuilder,
|
|
@@ -27,11 +27,11 @@ import {
|
|
|
27
27
|
DevChangePlanner,
|
|
28
28
|
DevGeneratedIndexSync,
|
|
29
29
|
SsrDevBundler
|
|
30
|
-
} from "./index-
|
|
30
|
+
} from "./index-scfsqen7.js";
|
|
31
31
|
import"./index-trffs83s.js";
|
|
32
32
|
import {
|
|
33
|
-
|
|
34
|
-
} from "./index-
|
|
33
|
+
FrameworkGraph2
|
|
34
|
+
} from "./index-3fmzz9sf.js";
|
|
35
35
|
import {
|
|
36
36
|
GitRevision
|
|
37
37
|
} from "./index-zyb0ebm4.js";
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
import {
|
|
42
42
|
prepareDevWatchBatch
|
|
43
43
|
} from "./index-a5vmm6x4.js";
|
|
44
|
-
import"./index-
|
|
44
|
+
import"./index-whvhsb5f.js";
|
|
45
45
|
|
|
46
46
|
// pkgs/@akanjs/devkit/incrementalBuilder/incrementalBuilder.proc.ts
|
|
47
47
|
import path6 from "path";
|
|
@@ -194,7 +194,12 @@ class BuilderBoot {
|
|
|
194
194
|
if (!result.artifact || !result.optimizedFonts)
|
|
195
195
|
throw new Error("boot build reported success without an artifact; the build worker likely died");
|
|
196
196
|
const discovery = await GraphClientEntryDiscovery.create(app);
|
|
197
|
-
return {
|
|
197
|
+
return {
|
|
198
|
+
artifact: result.artifact,
|
|
199
|
+
optimizedFonts: result.optimizedFonts,
|
|
200
|
+
discovery,
|
|
201
|
+
basePhaseMs: result.basePhaseMs ?? {}
|
|
202
|
+
};
|
|
198
203
|
}
|
|
199
204
|
static recoverBoot(app, bootError, logger, runner, initialGeneration, create) {
|
|
200
205
|
const firstMessage = bootError instanceof Error ? bootError.message : String(bootError);
|
|
@@ -272,7 +277,7 @@ class BuilderGraphPayloads {
|
|
|
272
277
|
this.#generation = generation;
|
|
273
278
|
}
|
|
274
279
|
touched(files) {
|
|
275
|
-
|
|
280
|
+
FrameworkGraph2.touched(this.#app.workspace.workspaceRoot, files);
|
|
276
281
|
}
|
|
277
282
|
async of(msg) {
|
|
278
283
|
if (msg.framework)
|
|
@@ -290,7 +295,7 @@ class BuilderGraphPayloads {
|
|
|
290
295
|
}
|
|
291
296
|
async#framework() {
|
|
292
297
|
const { workspaceRoot } = this.#app.workspace;
|
|
293
|
-
return { workspaceRoot, framework: await
|
|
298
|
+
return { workspaceRoot, framework: await FrameworkGraph2.cached(workspaceRoot) };
|
|
294
299
|
}
|
|
295
300
|
async#changesSince(since) {
|
|
296
301
|
const { workspace, name } = this.#app;
|
|
@@ -1352,6 +1357,7 @@ class IncrementalBuilder {
|
|
|
1352
1357
|
const initialGeneration = BuilderBoot.initialGeneration();
|
|
1353
1358
|
try {
|
|
1354
1359
|
const deps = await BuilderBoot.buildBootDeps(app, bootRunner);
|
|
1360
|
+
BuilderChannel.emit({ type: "base-built", phaseMs: deps.basePhaseMs });
|
|
1355
1361
|
builder = new IncrementalBuilder({ app, watch, initialGeneration, ...deps });
|
|
1356
1362
|
} catch (err) {
|
|
1357
1363
|
if (!watch)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AkanCodeEnv,
|
|
4
4
|
akanCodePaths2
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-xv3pvdw4.js";
|
|
6
6
|
import {
|
|
7
7
|
akanCodeDefaultModel2,
|
|
8
8
|
akanCodeModel2,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
akanCodeModelWarnings2,
|
|
11
11
|
McpServerConfig,
|
|
12
12
|
WorkspaceTrust
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-7ssr7wq4.js";
|
|
14
14
|
import {
|
|
15
15
|
PreviewView2,
|
|
16
16
|
stripAnsi
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
SubagentPool2,
|
|
20
20
|
McpSignIn,
|
|
21
21
|
AkanCodeCompaction2
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-0wa5z6rm.js";
|
|
23
23
|
import {
|
|
24
24
|
codeAgentIsLoopback,
|
|
25
25
|
codeAgentHostListed,
|
|
@@ -676,7 +676,7 @@ class AkanToolPack2 {
|
|
|
676
676
|
return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
|
|
677
677
|
}
|
|
678
678
|
async names() {
|
|
679
|
-
const { ContextRunner } = await import("./context.runner-
|
|
679
|
+
const { ContextRunner } = await import("./context.runner-bmstpng2.js");
|
|
680
680
|
return [
|
|
681
681
|
...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
|
|
682
682
|
AkanToolPack2.verifyToolName
|
|
@@ -684,7 +684,7 @@ class AkanToolPack2 {
|
|
|
684
684
|
}
|
|
685
685
|
static verifyToolName = "akan_verify";
|
|
686
686
|
async#register(pi) {
|
|
687
|
-
const { ContextRunner } = await import("./context.runner-
|
|
687
|
+
const { ContextRunner } = await import("./context.runner-bmstpng2.js");
|
|
688
688
|
const runner = new ContextRunner;
|
|
689
689
|
const guidelineNames = await AkanToolPack2.#guidelineNames();
|
|
690
690
|
for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
|
|
@@ -722,7 +722,7 @@ class AkanToolPack2 {
|
|
|
722
722
|
}
|
|
723
723
|
static async#guidelineNames() {
|
|
724
724
|
try {
|
|
725
|
-
const { Prompter } = await import("./prompter-
|
|
725
|
+
const { Prompter } = await import("./prompter-d33wmdpa.js");
|
|
726
726
|
return await Prompter.listGuidelines();
|
|
727
727
|
} catch {
|
|
728
728
|
return [];
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-652f3bs8.js";
|
|
6
6
|
import {
|
|
7
7
|
CommandExecutionError,
|
|
8
8
|
LibSource,
|
|
9
9
|
formatLibStatuses
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-pc42gxa5.js";
|
|
11
11
|
import {
|
|
12
12
|
LibExecutor2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-f2arv0mv.js";
|
|
14
14
|
import {
|
|
15
15
|
assertPlainName
|
|
16
16
|
} from "./index-va90m8nd.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
akanCodePaths2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-xv3pvdw4.js";
|
|
5
5
|
import {
|
|
6
6
|
ConfigLock
|
|
7
7
|
} from "./index-bqbf654f.js";
|
|
@@ -157,7 +157,7 @@ class SubagentPool2 {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
async#run(id, kind, prompt, signal) {
|
|
160
|
-
const { CodeAgent } = await import("./CodeAgent-
|
|
160
|
+
const { CodeAgent } = await import("./CodeAgent-xdw73nbz.js");
|
|
161
161
|
const budget = this.#options.parent.tools.subagent;
|
|
162
162
|
const child = SubagentPool2.childOf(this.#options.parent, kind);
|
|
163
163
|
const model = this.#options.model?.();
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
AsyncDefaultExportDetector,
|
|
4
4
|
StoreBootstrap,
|
|
5
5
|
resolveSsrPageEntriesForApp
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-b372rck5.js";
|
|
7
7
|
import {
|
|
8
8
|
FileSys2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-zyjztrvc.js";
|
|
10
10
|
|
|
11
11
|
// pkgs/@akanjs/devkit/transforms/barrelAnalyzer.ts
|
|
12
12
|
import fs from "fs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-b372rck5.js";
|
|
5
5
|
import {
|
|
6
6
|
LibExecutor2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-f2arv0mv.js";
|
|
8
8
|
import {
|
|
9
9
|
createAst,
|
|
10
10
|
AkanIndex
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./index-va90m8nd.js";
|
|
16
16
|
import {
|
|
17
17
|
camelToKebabCase
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-652f3bs8.js";
|
|
19
19
|
|
|
20
20
|
// pkgs/@akanjs/devkit/workflow/artifacts.ts
|
|
21
21
|
import { capitalize as capitalize2 } from "akanjs/common";
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-652f3bs8.js";
|
|
6
6
|
import {
|
|
7
7
|
generatedFilesForSync,
|
|
8
8
|
createPassedPrimitiveReport,
|
|
9
9
|
scalarChangedFiles
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-1c2807kg.js";
|
|
11
11
|
import {
|
|
12
12
|
pluralizeName
|
|
13
13
|
} from "./index-nz8prx9g.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
runner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-652f3bs8.js";
|
|
5
5
|
import {
|
|
6
6
|
writeWorkflowRunArtifact,
|
|
7
7
|
generatedFilePathsForTarget,
|
|
8
8
|
writeGeneratedSyncState,
|
|
9
9
|
createRepairReport,
|
|
10
10
|
renderRepairReport
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-1c2807kg.js";
|
|
12
12
|
import {
|
|
13
13
|
AkanContextAnalyzer
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-jdw9m5c4.js";
|
|
15
15
|
import {
|
|
16
16
|
isWorkflowSysName,
|
|
17
17
|
isWorkflowModuleName
|
|
@@ -6,23 +6,23 @@ import {
|
|
|
6
6
|
CloudApi,
|
|
7
7
|
CloudUpdates,
|
|
8
8
|
PipelineSecrets
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-45aprybg.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveMobileTargets
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
14
|
WorkspaceExecutor
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-pc42gxa5.js";
|
|
16
16
|
import {
|
|
17
17
|
AppExecutor2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-b372rck5.js";
|
|
19
19
|
import {
|
|
20
20
|
NativeApp
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-ymgsvhc5.js";
|
|
22
22
|
import {
|
|
23
23
|
runner,
|
|
24
24
|
assertPromptable
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-652f3bs8.js";
|
|
26
26
|
import {
|
|
27
27
|
getNpmRegistryUrl,
|
|
28
28
|
getPublishedVersions,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
resolveSsrPageEntriesForApp
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-b372rck5.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-0z8sbdme.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";
|
|
@@ -236,7 +236,7 @@ class McpAppViewBuilder {
|
|
|
236
236
|
...options,
|
|
237
237
|
plugins: [
|
|
238
238
|
...options.plugins,
|
|
239
|
-
await
|
|
239
|
+
await CsrArtifactBuilder2.barrelImportsPlugin(this.#app, McpAppPageTrimmer.pipe(pagePaths)),
|
|
240
240
|
PureLazyMarker.plugin()
|
|
241
241
|
],
|
|
242
242
|
entrypoints: views.map((view) => path3.join(generatedDir, `${view.name}.html`)),
|
|
@@ -365,12 +365,12 @@ ${importsOf(view.rootOverrides, "rootOverride")}${importsOf(view.overrides, "ove
|
|
|
365
365
|
if (cssAsset) {
|
|
366
366
|
const artifactDir = path3.join(this.#command === "build" ? this.#app.dist.cwdPath : this.#app.cwdPath, ".akan", "artifact");
|
|
367
367
|
const css = await Bun.file(path3.join(artifactDir, cssAsset.cssRelPath)).text();
|
|
368
|
-
html =
|
|
368
|
+
html = CsrArtifactBuilder2.injectBeforeHeadEnd(html, CsrArtifactBuilder2.createInlineStyle(css));
|
|
369
369
|
} else
|
|
370
370
|
this.#app.logger.warn(`[mcp-app-build] no compiled stylesheet for ${view.name}; its view ships without CSS`);
|
|
371
371
|
const scripts = [];
|
|
372
|
-
html = await
|
|
373
|
-
const jsPath =
|
|
372
|
+
html = await CsrArtifactBuilder2.replaceModuleScriptSrc(html, async (src) => {
|
|
373
|
+
const jsPath = CsrArtifactBuilder2.resolveHtmlAssetPath(htmlPath, src);
|
|
374
374
|
scripts.push(jsPath);
|
|
375
375
|
return await Bun.file(jsPath).text();
|
|
376
376
|
});
|
|
@@ -383,7 +383,7 @@ ${importsOf(view.rootOverrides, "rootOverride")}${importsOf(view.overrides, "ove
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
// pkgs/@akanjs/devkit/frontendBuild/csrArtifactBuilder.ts
|
|
386
|
-
class
|
|
386
|
+
class CsrArtifactBuilder2 {
|
|
387
387
|
#app;
|
|
388
388
|
#command;
|
|
389
389
|
#lang;
|
|
@@ -409,13 +409,13 @@ class CsrArtifactBuilder {
|
|
|
409
409
|
await mkdir2(this.#generatedDir, { recursive: true });
|
|
410
410
|
const generatedFiles = Object.fromEntries((await Promise.all(htmlBasePaths.map(async (basePath) => [
|
|
411
411
|
this.#createHtmlFile(basePath),
|
|
412
|
-
await this.#createEntryFile(basePath,
|
|
412
|
+
await this.#createEntryFile(basePath, CsrArtifactBuilder2.pageEntriesForBasePath(pageEntries, basePath, basePaths))
|
|
413
413
|
]))).flat());
|
|
414
|
-
const options =
|
|
414
|
+
const options = CsrArtifactBuilder2.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports);
|
|
415
415
|
const result = await Bun.build({
|
|
416
416
|
...options,
|
|
417
|
-
plugins: [...options.plugins, await
|
|
418
|
-
entrypoints: htmlBasePaths.map((basePath) => this.#generatedPath(
|
|
417
|
+
plugins: [...options.plugins, await CsrArtifactBuilder2.barrelImportsPlugin(this.#app)],
|
|
418
|
+
entrypoints: htmlBasePaths.map((basePath) => this.#generatedPath(CsrArtifactBuilder2.htmlFilename(basePath))),
|
|
419
419
|
files: generatedFiles,
|
|
420
420
|
root: this.#generatedDir,
|
|
421
421
|
outdir: this.#outputDir
|
|
@@ -429,7 +429,7 @@ ${logs}` : ""}`);
|
|
|
429
429
|
await this.#inlineCsrArtifacts(cssAssets);
|
|
430
430
|
await this.#buildMcpAppViews(pageEntries, { basePaths, cssAssets, options });
|
|
431
431
|
if (this.#command === "build")
|
|
432
|
-
await
|
|
432
|
+
await CsrArtifactBuilder2.writePublicEnv(this.#app, options.define);
|
|
433
433
|
this.#app.verbose(`[csr-build] output -> ${this.#outputDir}`);
|
|
434
434
|
return { outputDir: this.#outputDir };
|
|
435
435
|
}
|
|
@@ -442,7 +442,7 @@ ${logs}` : ""}`);
|
|
|
442
442
|
return await this.#buildMcpAppViews(pageEntries, {
|
|
443
443
|
basePaths: [...akanConfig.basePaths],
|
|
444
444
|
cssAssets: await this.#loadCssAssets(),
|
|
445
|
-
options:
|
|
445
|
+
options: CsrArtifactBuilder2.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports)
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
448
|
async#buildMcpAppViews(pageEntries, option) {
|
|
@@ -472,7 +472,7 @@ ${logs}` : ""}`);
|
|
|
472
472
|
static async writePublicEnv(app, define) {
|
|
473
473
|
const prefix = "process.env.";
|
|
474
474
|
const publicEnv = Object.fromEntries(Object.entries(define).filter(([key]) => key.startsWith(`${prefix}AKAN_PUBLIC_`)).map(([key, value]) => [key.slice(prefix.length), JSON.parse(value)]));
|
|
475
|
-
await Bun.write(
|
|
475
|
+
await Bun.write(CsrArtifactBuilder2.publicEnvPath(app), `${JSON.stringify(publicEnv, null, 2)}
|
|
476
476
|
`);
|
|
477
477
|
}
|
|
478
478
|
static pageEntriesForBasePath(pageEntries, basePath, basePaths) {
|
|
@@ -502,7 +502,7 @@ ${logs}` : ""}`);
|
|
|
502
502
|
}
|
|
503
503
|
async#createEntryFile(basePath, pageEntries) {
|
|
504
504
|
return [
|
|
505
|
-
this.#generatedPath(
|
|
505
|
+
this.#generatedPath(CsrArtifactBuilder2.entryFilename(basePath)),
|
|
506
506
|
`import { bootCsr } from "akanjs/webkit";
|
|
507
507
|
${await PagesEntrySourceGenerator.generateStatic(pageEntries)}
|
|
508
508
|
void bootCsr(pages);
|
|
@@ -511,7 +511,7 @@ void bootCsr(pages);
|
|
|
511
511
|
}
|
|
512
512
|
#createHtmlFile(basePath) {
|
|
513
513
|
return [
|
|
514
|
-
this.#generatedPath(
|
|
514
|
+
this.#generatedPath(CsrArtifactBuilder2.htmlFilename(basePath)),
|
|
515
515
|
`<!doctype html>
|
|
516
516
|
<html lang="${this.#lang}">
|
|
517
517
|
<head>
|
|
@@ -522,7 +522,7 @@ void bootCsr(pages);
|
|
|
522
522
|
</head>
|
|
523
523
|
<body>
|
|
524
524
|
<div id="root"></div>
|
|
525
|
-
<script type="module" src="./${
|
|
525
|
+
<script type="module" src="./${CsrArtifactBuilder2.entryFilename(basePath)}"></script>
|
|
526
526
|
</body>
|
|
527
527
|
</html>
|
|
528
528
|
`
|
|
@@ -543,7 +543,7 @@ void bootCsr(pages);
|
|
|
543
543
|
const htmlFile = Bun.file(htmlPath);
|
|
544
544
|
if (!await htmlFile.exists())
|
|
545
545
|
continue;
|
|
546
|
-
const basePath =
|
|
546
|
+
const basePath = CsrArtifactBuilder2.basePathOfHtml(htmlPath);
|
|
547
547
|
const cssAsset = cssAssets[basePath];
|
|
548
548
|
if (!cssAsset) {
|
|
549
549
|
this.#app.logger.warn(`[csr-build] base-artifact.json has no compiled stylesheet for ${basePath || "root"}; ${path4.basename(htmlPath)} ships without CSS`);
|
|
@@ -568,11 +568,11 @@ ${remainingAssets.join(`
|
|
|
568
568
|
let next = html;
|
|
569
569
|
if (cssAsset) {
|
|
570
570
|
const css = await Bun.file(path4.join(this.#artifactDir, cssAsset.cssRelPath)).text();
|
|
571
|
-
next =
|
|
571
|
+
next = CsrArtifactBuilder2.injectBeforeHeadEnd(next, CsrArtifactBuilder2.createInlineStyle(css));
|
|
572
572
|
}
|
|
573
573
|
const jsFiles = [];
|
|
574
|
-
next = await
|
|
575
|
-
const jsPath =
|
|
574
|
+
next = await CsrArtifactBuilder2.replaceModuleScriptSrc(next, async (src) => {
|
|
575
|
+
const jsPath = CsrArtifactBuilder2.resolveHtmlAssetPath(htmlPath, src);
|
|
576
576
|
jsFiles.push(jsPath);
|
|
577
577
|
return await Bun.file(jsPath).text();
|
|
578
578
|
});
|
|
@@ -588,7 +588,7 @@ ${remainingAssets.join(`
|
|
|
588
588
|
return files.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
589
589
|
}
|
|
590
590
|
static injectBeforeHeadEnd(html, snippet) {
|
|
591
|
-
const scannable =
|
|
591
|
+
const scannable = CsrArtifactBuilder2.blankEmbeddedContent(html);
|
|
592
592
|
const headEnd = scannable.search(/<\/head\s*>/i);
|
|
593
593
|
if (headEnd !== -1)
|
|
594
594
|
return `${html.slice(0, headEnd)}${snippet}
|
|
@@ -621,7 +621,7 @@ ${css.replace(/<\/style/gi, "<\\/style")}
|
|
|
621
621
|
matched = true;
|
|
622
622
|
result += html.slice(lastIndex, match.index);
|
|
623
623
|
result += `<script type="module">
|
|
624
|
-
${
|
|
624
|
+
${CsrArtifactBuilder2.escapeInlineScript(await loadScript(src))}
|
|
625
625
|
</script>`;
|
|
626
626
|
lastIndex = match.index + full.length;
|
|
627
627
|
}
|
|
@@ -641,4 +641,4 @@ ${CsrArtifactBuilder.escapeInlineScript(await loadScript(src))}
|
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
643
|
|
|
644
|
-
export {
|
|
644
|
+
export { CsrArtifactBuilder2 };
|
|
@@ -21,23 +21,23 @@ var channelSpecs = [
|
|
|
21
21
|
];
|
|
22
22
|
var skippedDirs = new Set(["node_modules", "vendor", "types", "integration", "csrE2e", "platformTest"]);
|
|
23
23
|
|
|
24
|
-
class
|
|
24
|
+
class FrameworkGraph2 {
|
|
25
25
|
static architectureFile = "pkgs/akanjs/ARCHITECTURE.md";
|
|
26
26
|
static #cache = new Map;
|
|
27
27
|
static #edits = new Map;
|
|
28
28
|
static async packagesOf(workspaceRoot) {
|
|
29
29
|
const found = await Promise.all(packageSpecs.map(async ({ name, split }) => {
|
|
30
|
-
const root = await
|
|
30
|
+
const root = await FrameworkGraph2.#isDir(path.join(workspaceRoot, "pkgs", name)) ? `pkgs/${name}` : await FrameworkGraph2.#installedRoot(workspaceRoot, name);
|
|
31
31
|
return root ? [{ name, root, split }] : [];
|
|
32
32
|
}));
|
|
33
33
|
return found.flat();
|
|
34
34
|
}
|
|
35
35
|
static async build(workspaceRoot) {
|
|
36
|
-
const packages = await
|
|
36
|
+
const packages = await FrameworkGraph2.packagesOf(workspaceRoot);
|
|
37
37
|
const akanjs = packages.find(({ name }) => name === "akanjs");
|
|
38
38
|
if (!akanjs)
|
|
39
39
|
return null;
|
|
40
|
-
const files = (await Promise.all(packages.map(({ root }) =>
|
|
40
|
+
const files = (await Promise.all(packages.map(({ root }) => FrameworkGraph2.#filesUnder(workspaceRoot, root)))).flat();
|
|
41
41
|
const texts = await Promise.all(files.map(async (file) => [file, await readFile(path.join(workspaceRoot, file), "utf8")]));
|
|
42
42
|
return new FrameworkMapBuilder({
|
|
43
43
|
ts,
|
|
@@ -47,13 +47,13 @@ class FrameworkGraph {
|
|
|
47
47
|
}).build();
|
|
48
48
|
}
|
|
49
49
|
static async architecture(workspaceRoot) {
|
|
50
|
-
const file = path.join(workspaceRoot,
|
|
50
|
+
const file = path.join(workspaceRoot, FrameworkGraph2.architectureFile);
|
|
51
51
|
const current = await readFile(file, "utf8").then((text) => text.replace(/\r\n/g, `
|
|
52
52
|
`)).catch(() => null);
|
|
53
|
-
const map = current === null ? null : await
|
|
53
|
+
const map = current === null ? null : await FrameworkGraph2.build(workspaceRoot);
|
|
54
54
|
if (current === null || !map || map.packages.find(({ name }) => name === "akanjs")?.root !== "pkgs/akanjs")
|
|
55
55
|
return null;
|
|
56
|
-
const next = FrameworkMapDoc.splice(current, FrameworkMapDoc.render(map, path.posix.dirname(
|
|
56
|
+
const next = FrameworkMapDoc.splice(current, FrameworkMapDoc.render(map, path.posix.dirname(FrameworkGraph2.architectureFile)));
|
|
57
57
|
return {
|
|
58
58
|
file,
|
|
59
59
|
current,
|
|
@@ -65,31 +65,31 @@ class FrameworkGraph {
|
|
|
65
65
|
static touched(workspaceRoot, files) {
|
|
66
66
|
const roots = packageSpecs.map(({ name }) => path.join(workspaceRoot, "pkgs", name) + path.sep);
|
|
67
67
|
if (files.some((file) => roots.some((root) => path.resolve(workspaceRoot, file).startsWith(root))))
|
|
68
|
-
|
|
68
|
+
FrameworkGraph2.#edits.set(workspaceRoot, (FrameworkGraph2.#edits.get(workspaceRoot) ?? 0) + 1);
|
|
69
69
|
}
|
|
70
70
|
static async cached(workspaceRoot) {
|
|
71
|
-
const packages = await
|
|
72
|
-
const stamps = await Promise.all(packages.map(async ({ name, root }) => root.startsWith("pkgs/") ? `${name}#${
|
|
71
|
+
const packages = await FrameworkGraph2.packagesOf(workspaceRoot);
|
|
72
|
+
const stamps = await Promise.all(packages.map(async ({ name, root }) => root.startsWith("pkgs/") ? `${name}#${FrameworkGraph2.#edits.get(workspaceRoot) ?? 0}` : `${name}@${await FrameworkGraph2.#versionOf(path.join(workspaceRoot, root))}`));
|
|
73
73
|
const cacheKey = [workspaceRoot, ...stamps].join(`
|
|
74
74
|
`);
|
|
75
|
-
const existing =
|
|
75
|
+
const existing = FrameworkGraph2.#cache.get(cacheKey);
|
|
76
76
|
if (existing)
|
|
77
77
|
return await existing;
|
|
78
|
-
const built =
|
|
79
|
-
built.catch(() =>
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
const built = FrameworkGraph2.build(workspaceRoot);
|
|
79
|
+
built.catch(() => FrameworkGraph2.#cache.delete(cacheKey));
|
|
80
|
+
FrameworkGraph2.#cache.clear();
|
|
81
|
+
FrameworkGraph2.#cache.set(cacheKey, built);
|
|
82
82
|
return await built;
|
|
83
83
|
}
|
|
84
84
|
static async#installedRoot(workspaceRoot, name) {
|
|
85
|
-
if (!await
|
|
85
|
+
if (!await FrameworkGraph2.#isDir(path.join(workspaceRoot, "node_modules")))
|
|
86
86
|
return null;
|
|
87
87
|
const resolved = await (async () => {
|
|
88
88
|
try {
|
|
89
89
|
return path.dirname(await realpath(Bun.resolveSync(`${name}/package.json`, workspaceRoot)));
|
|
90
90
|
} catch {
|
|
91
91
|
const dir = path.join(workspaceRoot, "node_modules", name);
|
|
92
|
-
return await
|
|
92
|
+
return await FrameworkGraph2.#isDir(dir) ? await realpath(dir) : null;
|
|
93
93
|
}
|
|
94
94
|
})();
|
|
95
95
|
if (!resolved)
|
|
@@ -123,4 +123,4 @@ class FrameworkGraph {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export {
|
|
126
|
+
export { FrameworkGraph2 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
FileSys2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-zyjztrvc.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveMobileTargets
|
|
7
7
|
} from "./index-m9jj544v.js";
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
UpdatePackFolder,
|
|
10
10
|
NativePublicEnv,
|
|
11
11
|
NativeApp
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-ymgsvhc5.js";
|
|
13
13
|
import {
|
|
14
14
|
ExitCodeError
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-652f3bs8.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigLock
|
|
18
18
|
} from "./index-bqbf654f.js";
|