@akanjs/cli 3.2.0-rc.9 → 3.2.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 +2 -2
- package/CodeAgent-xdw73nbz.js +11 -0
- package/{CodeTui-qstk5vpj.js → CodeTui-0gewm71c.js} +822 -666
- package/README.ko.md +7 -0
- package/README.md +7 -0
- package/TunnelShare-cccfdgbm.js +16 -0
- package/agent.command-g1mj34wz.js +59 -0
- package/akanCode.js +12 -12
- package/appExecutor-rrx10jya.js +11 -0
- package/{application.command-m4rq4wc2.js → application.command-3w4v7t40.js} +84 -40
- package/{applicationBuildRunner-df7rx3ra.js → applicationBuildRunner-y5xbetyz.js} +51 -20
- package/buildBatch.proc.js +31 -16
- package/{cloud.command-a0gy0qq2.js → cloud.command-ph0rz6sw.js} +28 -29
- package/cloud.script-8bs9tp4j.js +30 -0
- package/{code.command-5rsdqw8s.js → code.command-9b967qpg.js} +13 -9
- package/context.command-ndzs5rbf.js +62 -0
- package/context.runner-bmstpng2.js +32 -0
- package/csrArtifactBuilder-gtvff6k7.js +10 -0
- package/{index-qd7xn2bk.js → dependencyScanner-93g8tk0r.js} +7 -6
- package/{devTui-h77zrjv5.js → devTui-rf374y2w.js} +1 -1
- package/{fileSys-zpvt5gtf.js → fileSys-e5mwt73x.js} +1 -1
- package/frameworkGraph-aneq2nwy.js +8 -0
- package/{guideline.command-mffxknbr.js → guideline.command-y8qz9kxy.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 +609 -437
- package/{index-skmtj8rm.js → index-02v45hh9.js} +27 -10
- package/{index-j6gc8n14.js → index-0csk6jqm.js} +11 -9
- package/{index-2r9ff9qm.js → index-0wa5z6rm.js} +2 -2
- package/{index-nmvhjn8c.js → index-0z8sbdme.js} +93 -82
- package/{index-2vgv7fs7.js → index-1c2807kg.js} +727 -693
- package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
- package/{index-2mf1aen9.js → index-1p9bxjmt.js} +2 -2
- package/{index-an76bdrv.js → index-2kh4xj3m.js} +1 -1
- package/{index-99qvtff2.js → index-2vn0m9z5.js} +5 -5
- package/{index-rp4yf32g.js → index-3569fr49.js} +36 -29
- package/{index-xvk2a75m.js → index-38x8ynrx.js} +25 -25
- package/{index-cmg5ngqa.js → index-3fmzz9sf.js} +20 -20
- package/{index-rfzp4pqs.js → index-45aprybg.js} +3 -3
- package/{index-k92x3vne.js → index-4a1n0nym.js} +1 -1
- package/{index-ra9fvn7s.js → index-4zgm54wf.js} +76 -40
- package/{index-exn38bzx.js → index-652f3bs8.js} +116 -54
- package/{index-grxs6fts.js → index-6gepp8yn.js} +57 -31
- package/{index-vm0dn0mt.js → index-6j351de4.js} +294 -157
- package/{index-w15mg3km.js → index-7ssr7wq4.js} +1 -1
- package/{index-gxav1bjz.js → index-82cmbpxc.js} +9 -9
- package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
- package/{index-gcx48get.js → index-9rymt8d6.js} +2 -2
- package/{index-swwjakt0.js → index-ankyx6dj.js} +14 -18
- package/{index-28x1aszt.js → index-b0t92k71.js} +154 -58
- package/index-b372rck5.js +799 -0
- package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
- package/{index-r0a604h4.js → index-c669pbyb.js} +5 -4
- package/{index-xyn02k0w.js → index-cm9rb480.js} +662 -433
- package/{index-j9790rhk.js → index-d0n78fzc.js} +1635 -1139
- package/{index-hqv34wzq.js → index-dr1carpr.js} +10 -10
- package/index-f2arv0mv.js +30 -0
- package/{index-5radqwn2.js → index-gtydr9qc.js} +12 -12
- package/{index-j6eeh5d7.js → index-j3fqs8rc.js} +5 -5
- package/{index-yckz5t8b.js → index-jdw9m5c4.js} +516 -434
- package/{index-ny2k80mv.js → index-jf4vk1s0.js} +9 -2
- package/{index-x40bdsca.js → index-jg5rwrf7.js} +77 -115
- package/{index-5zwr4n6k.js → index-ktxdfqg5.js} +65 -8
- package/index-mnhrqjjq.js +127 -0
- package/{index-3ghdb7p5.js → index-pc42gxa5.js} +2777 -3676
- package/{index-0hbtve0a.js → index-q8h4eg5y.js} +32 -28
- package/{index-j3v29pq7.js → index-qh81drde.js} +219 -175
- package/{index-b4qq3rq0.js → index-rwgqba9p.js} +1 -1
- package/{index-w8yasvpc.js → index-scfsqen7.js} +2136 -2175
- package/{index-9p260r4e.js → index-trffs83s.js} +538 -250
- package/{index-0gg15zwa.js → index-twjgmryg.js} +6 -6
- package/index-whvhsb5f.js +80 -0
- package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
- package/{index-39jz41jb.js → index-xs9a3ddt.js} +3 -3
- package/{index-35j83zkd.js → index-xv3pvdw4.js} +2 -2
- package/{index-34792nh7.js → index-y2g0s9tn.js} +1 -1
- package/{index-43f4h4cm.js → index-ymgsvhc5.js} +7 -8
- package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
- package/{index-bns3wcpc.js → index-zyjztrvc.js} +2 -2
- package/index.js +30 -24
- package/libExecutor-nstr00s7.js +10 -0
- package/{library.command-bmd7zc5m.js → library.command-b02aw1hm.js} +12 -5
- package/{localRegistry.command-y6en1599.js → localRegistry.command-3hg1p4aj.js} +24 -24
- package/{module.command-7exfffqw.js → module.command-bd9gz6cv.js} +11 -7
- package/{package.command-adskw2rj.js → package.command-xmr0mxze.js} +11 -10
- package/package.json +8 -8
- package/{page.command-dw01272p.js → page.command-x94qf58g.js} +8 -4
- package/{pipeline.command-0b1r3y5r.js → pipeline.command-n2843k6t.js} +15 -9
- package/pkgExecutor-cka27e3c.js +10 -0
- package/{primitive.command-byw6vc04.js → primitive.command-cs7v376h.js} +12 -8
- package/{projectTypecheck-kkrpq60a.js → projectTypecheck-za2n3nbr.js} +1 -1
- package/{prompter-qrwx1p17.js → prompter-d33wmdpa.js} +2 -2
- package/{quality.command-6rqnhzct.js → quality.command-nqngh1jd.js} +25 -16
- package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
- package/{repair.command-rw5zymak.js → repair.command-v2medwsm.js} +12 -8
- package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
- package/{scalar.command-2dyp9nh9.js → scalar.command-61cjmxn1.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-dtv8nfh7.js} +30 -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-fmwm5fgb.js} +15 -13
- package/{typeChecker-s640r6c0.js → typeChecker-7jt6abrs.js} +1 -1
- package/typecheck.proc.js +3 -2
- package/{verify.command-djgs86ma.js → verify.command-4f260t53.js} +19 -17
- package/{workflow.command-n0k2mxr5.js → workflow.command-tm5q9xsm.js} +21 -14
- package/{workspace.command-fh1qwxfx.js → workspace.command-75gc280j.js} +56 -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/dependencyScanner-78sq8m4q.js +0 -8
- /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
|
@@ -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
|
-
|
|
4
|
-
} from "./index-
|
|
3
|
+
runner
|
|
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
|
-
|
|
14
|
-
} from "./index-
|
|
13
|
+
AkanContextAnalyzer
|
|
14
|
+
} from "./index-jdw9m5c4.js";
|
|
15
15
|
import {
|
|
16
16
|
isWorkflowSysName,
|
|
17
17
|
isWorkflowModuleName
|
|
@@ -6,29 +6,32 @@ 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
|
-
WorkspaceExecutor
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
WorkspaceExecutor
|
|
15
|
+
} from "./index-pc42gxa5.js";
|
|
16
|
+
import {
|
|
17
|
+
AppExecutor2
|
|
18
|
+
} from "./index-b372rck5.js";
|
|
17
19
|
import {
|
|
18
20
|
NativeApp
|
|
19
|
-
} from "./index-
|
|
21
|
+
} from "./index-ymgsvhc5.js";
|
|
20
22
|
import {
|
|
21
23
|
runner,
|
|
22
24
|
assertPromptable
|
|
23
|
-
} from "./index-
|
|
25
|
+
} from "./index-652f3bs8.js";
|
|
24
26
|
import {
|
|
25
27
|
getNpmRegistryUrl,
|
|
26
28
|
getPublishedVersions,
|
|
27
|
-
getLatestPackageVersion
|
|
28
|
-
|
|
29
|
+
getLatestPackageVersion,
|
|
30
|
+
getPublishedPeerDependencies
|
|
31
|
+
} from "./index-jf4vk1s0.js";
|
|
29
32
|
import {
|
|
30
33
|
SubspaceConfig
|
|
31
|
-
} from "./index-
|
|
34
|
+
} from "./index-xczjdng6.js";
|
|
32
35
|
import {
|
|
33
36
|
openBrowser
|
|
34
37
|
} from "./index-9dp031by.js";
|
|
@@ -304,7 +307,7 @@ class LinuxDockerTarget extends PlatformTestTarget {
|
|
|
304
307
|
if (started.exitCode !== 0)
|
|
305
308
|
throw new Error(`docker run failed: ${started.stderr.trim()}`);
|
|
306
309
|
this.#container = container;
|
|
307
|
-
const extract = await this.exec(`tar -xf /io/${path3.basename(context.snapshot.tarPath)} -C /w && cp /io-env /w/.env && git -C /w init -q`, path3.join(context.logDir, this.platform, "extract.log"), PlatformTestTarget.installIdleMs);
|
|
310
|
+
const extract = await this.exec(`tar -xf /io/${path3.basename(context.snapshot.tarPath)} -C /w && cp /io-env /w/.env && git -C /w init -q && git -C /w add -A`, path3.join(context.logDir, this.platform, "extract.log"), PlatformTestTarget.installIdleMs);
|
|
308
311
|
if (extract.exitCode !== 0)
|
|
309
312
|
throw new Error("extracting the snapshot into the container failed");
|
|
310
313
|
}
|
|
@@ -473,7 +476,7 @@ class WindowsSshTarget extends PlatformTestTarget {
|
|
|
473
476
|
if (copied.exitCode !== 0)
|
|
474
477
|
throw new Error(`scp ${remoteName} failed: ${copied.stderr.trim()}`);
|
|
475
478
|
}
|
|
476
|
-
const extract = await this.exec("tar -xf ..\\src.tar && copy /Y ..\\env .env >nul && git init -q", path5.join(context.logDir, this.platform, "extract.log"), PlatformTestTarget.installIdleMs);
|
|
479
|
+
const extract = await this.exec("tar -xf ..\\src.tar && copy /Y ..\\env .env >nul && git init -q && git add -A", path5.join(context.logDir, this.platform, "extract.log"), PlatformTestTarget.installIdleMs);
|
|
477
480
|
if (extract.exitCode !== 0)
|
|
478
481
|
throw new Error("extracting the snapshot on the Windows host failed");
|
|
479
482
|
}
|
|
@@ -715,7 +718,7 @@ class EnvArchive {
|
|
|
715
718
|
static async#secretGlobs(workspace) {
|
|
716
719
|
const [appNames] = await workspace.getExecs();
|
|
717
720
|
const entries = await Promise.all(appNames.map(async (appName) => {
|
|
718
|
-
const { secrets = [] } = await
|
|
721
|
+
const { secrets = [] } = await AppExecutor2.from(workspace, appName).getConfig();
|
|
719
722
|
return [appName, secrets.map((pattern) => new Bun.Glob(pattern))];
|
|
720
723
|
}));
|
|
721
724
|
return new Map(entries);
|
|
@@ -1240,27 +1243,31 @@ ${run.format(results)}
|
|
|
1240
1243
|
}
|
|
1241
1244
|
async update(workspace, tag = "latest", { registryUrl } = {}) {
|
|
1242
1245
|
const registry = registryUrl ? getNpmRegistryUrl(registryUrl) : undefined;
|
|
1243
|
-
const
|
|
1244
|
-
const
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
]);
|
|
1246
|
+
const hasPackageJson = await workspace.exists("package.json");
|
|
1247
|
+
const version = hasPackageJson ? await getLatestPackageVersion("akanjs", tag, registry) : tag;
|
|
1248
|
+
const peers = hasPackageJson ? await getPublishedPeerDependencies("akanjs", version, registry) : null;
|
|
1249
|
+
await Promise.all([
|
|
1250
|
+
workspace.spawn("bun", ["add", "-g", `@akanjs/cli@${version}`, ...this.#getRegistryArgs(registry)], {
|
|
1251
|
+
env: this.#getRegistryEnv(registry)
|
|
1252
|
+
}),
|
|
1253
|
+
peers && this.#updateAkanPkgs(workspace, version, peers, registry)
|
|
1254
|
+
]);
|
|
1253
1255
|
}
|
|
1254
|
-
async#updateAkanPkgs(workspace,
|
|
1255
|
-
const latestPublishedVersion = await getLatestPackageVersion("akanjs", tag, registryUrl);
|
|
1256
|
+
async#updateAkanPkgs(workspace, akanVersion, peers, registryUrl) {
|
|
1256
1257
|
const rootPackageJson = await workspace.getPackageJson();
|
|
1257
1258
|
if (!rootPackageJson.dependencies)
|
|
1258
1259
|
throw new Error("No dependencies found in package.json");
|
|
1259
|
-
|
|
1260
|
+
const pins = Object.fromEntries(["akanjs", "@akanjs/devkit", "@akanjs/cli", "@akanjs/language"].map((name) => [name, akanVersion]));
|
|
1261
|
+
for (const peer of ["react", "react-dom", "react-server-dom-webpack"]) {
|
|
1262
|
+
const version = peers[peer];
|
|
1263
|
+
if (version)
|
|
1264
|
+
pins[peer] = version;
|
|
1265
|
+
}
|
|
1266
|
+
for (const [name, version] of Object.entries(pins)) {
|
|
1260
1267
|
if (rootPackageJson.dependencies[name])
|
|
1261
|
-
rootPackageJson.dependencies[name] =
|
|
1268
|
+
rootPackageJson.dependencies[name] = version;
|
|
1262
1269
|
if (rootPackageJson.devDependencies?.[name])
|
|
1263
|
-
rootPackageJson.devDependencies[name] =
|
|
1270
|
+
rootPackageJson.devDependencies[name] = version;
|
|
1264
1271
|
}
|
|
1265
1272
|
await workspace.setPackageJson(rootPackageJson);
|
|
1266
1273
|
await workspace.spawn("bun", ["install", ...this.#getRegistryArgs(registryUrl)], {
|
|
@@ -1355,7 +1362,7 @@ ${run.format(results)}
|
|
|
1355
1362
|
}
|
|
1356
1363
|
async#gatherCustomSecretFiles(workspace, appNames) {
|
|
1357
1364
|
const secretPaths = await Promise.all(appNames.map(async (appName) => {
|
|
1358
|
-
const config = await
|
|
1365
|
+
const config = await AppExecutor2.from(workspace, appName).getConfig();
|
|
1359
1366
|
const secretGlobs = config.secrets ?? [];
|
|
1360
1367
|
if (secretGlobs.length === 0)
|
|
1361
1368
|
return [];
|
|
@@ -1439,7 +1446,7 @@ ${run.format(results)}
|
|
|
1439
1446
|
}
|
|
1440
1447
|
async#syncSecretGitignore(workspace, appNames) {
|
|
1441
1448
|
const patterns = (await Promise.all(appNames.map(async (appName) => {
|
|
1442
|
-
const config = await
|
|
1449
|
+
const config = await AppExecutor2.from(workspace, appName).getConfig();
|
|
1443
1450
|
return (config.secrets ?? []).map((pattern) => `apps/${appName}/${pattern.replace(/^\/+/, "")}`);
|
|
1444
1451
|
}))).flat();
|
|
1445
1452
|
const uniquePatterns = [...new Set(patterns)].sort();
|
|
@@ -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`)),
|
|
@@ -269,7 +269,7 @@ ${logs}` : ""}`);
|
|
|
269
269
|
await rm(stagingDir, { recursive: true, force: true });
|
|
270
270
|
}
|
|
271
271
|
static async discover(pageEntries, basePaths) {
|
|
272
|
-
const { RouteSourceValidator } = await import("./routeSourceValidator-
|
|
272
|
+
const { RouteSourceValidator } = await import("./routeSourceValidator-8n6j1vn7.js");
|
|
273
273
|
const roots = pageEntries.filter((entry) => parseRouteModuleKey(entry.key).isInternalRootLayout);
|
|
274
274
|
const overrides = pageEntries.filter((entry) => parseRouteModuleKey(entry.key).kind === "overrides");
|
|
275
275
|
const layoutNodes = new Set(pageEntries.flatMap((entry) => {
|
|
@@ -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 };
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
FrameworkMapBuilder,
|
|
4
4
|
FrameworkMapDoc
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-trffs83s.js";
|
|
6
6
|
|
|
7
|
-
// pkgs/@akanjs/devkit/frameworkGraph.ts
|
|
7
|
+
// pkgs/@akanjs/devkit/docs/frameworkGraph.ts
|
|
8
8
|
import { readdir, readFile, realpath, stat } from "fs/promises";
|
|
9
9
|
import path from "path";
|
|
10
10
|
import ts from "typescript";
|
|
@@ -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";
|