@akanjs/cli 3.1.0-rc.2 → 3.1.0-rc.21
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-q50k4s45.js → CodeAgent-gzfc5t52.js} +2 -2
- package/{CodeAgentRpcHost-p7h6n2hp.js → CodeAgentRpcHost-9g27hmer.js} +1 -1
- package/{CodeTui-62g35ztk.js → CodeTui-bpsjs8wz.js} +47 -4
- package/TunnelShare-tfrnftgr.js +14 -0
- package/{agent.command-adfd5299.js → agent.command-67ysh3n6.js} +5 -5
- package/akanCode.js +7 -5
- package/{application.command-hj3gv1rx.js → application.command-q0tqw5pc.js} +38 -11
- package/{applicationBuildRunner-by10r9gf.js → applicationBuildRunner-wsszr305.js} +16 -9
- package/buildBatch.proc.js +7 -7
- package/{cloud.command-k2fhaape.js → cloud.command-e7tkxyx6.js} +17 -16
- package/cloud.script-krzh3d7k.js +24 -0
- package/{code.command-kt5zgcc2.js → code.command-ttk8tje2.js} +25 -12
- package/commandManifest.json +1 -1
- package/{context.command-8fgn42jw.js → context.command-bdsk2z2r.js} +17 -16
- package/context.runner-bxzv0gm0.js +25 -0
- package/{dependencyScanner-06z2dmrr.js → dependencyScanner-3afj2vt1.js} +1 -1
- package/{guideline.command-3yxxr2mm.js → guideline.command-man90n70.js} +2 -2
- package/guidelines/agentRule/agentRule.instruction.md +25 -10
- package/guidelines/conventions/conventions.instruction.md +486 -1084
- package/guidelines/cssRule/cssRule.instruction.md +16 -1
- package/guidelines/fieldRule/fieldRule.instruction.md +74 -0
- package/guidelines/framework/framework.instruction.md +4 -7
- package/guidelines/mcpRule/mcpRule.instruction.md +16 -9
- package/guidelines/modelConstant/modelConstant.instruction.md +2 -1
- package/guidelines/modelStore/modelStore.instruction.md +16 -0
- package/guidelines/pageRule/pageRule.instruction.md +80 -0
- package/guidelines/queryRule/queryRule.instruction.md +47 -12
- package/guidelines/runtimeRule/runtimeRule.instruction.md +89 -2
- package/guidelines/ssrRule/ssrRule.instruction.md +13 -0
- package/guidelines/transportRule/transportRule.instruction.md +107 -8
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +4 -4
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +70 -7
- package/incrementalBuilder.proc.js +4 -4
- package/{index-rhbabmja.js → index-033wne2j.js} +260 -259
- package/{index-xpdgxsj5.js → index-1r5a8bzx.js} +2216 -2216
- package/{index-jwqtchha.js → index-27y8t17p.js} +1 -1
- package/{index-wa5jbxj1.js → index-2mrn1mrg.js} +1 -0
- package/{index-t7nws9mx.js → index-2w8j2fnv.js} +661 -448
- package/{index-0909wckt.js → index-35m6bzm7.js} +238 -236
- package/{index-sqfdmb5b.js → index-4393nb4b.js} +4 -4
- package/{index-sby8fe1p.js → index-48edp6q4.js} +1 -1
- package/{index-g0vwzy9m.js → index-4v43h00g.js} +20 -21
- package/{index-azh29dc8.js → index-54wc2phm.js} +19 -14
- package/{index-k9rrten6.js → index-5nd1wtkv.js} +92 -94
- package/index-62md4dwy.js +260 -0
- package/{index-hnby7p9n.js → index-75n5q4ph.js} +7 -7
- package/{index-fjsv10hd.js → index-844q7f8z.js} +7 -7
- package/{index-tv8fjaba.js → index-8jehkey8.js} +4 -4
- package/{index-bea2gwc6.js → index-9mt4smfy.js} +2 -2
- package/{index-d2242ksy.js → index-at7bz0xq.js} +3 -0
- package/{index-3hx1z96c.js → index-bqbf654f.js} +1 -1
- package/{index-8zdwpxef.js → index-cae9m5jz.js} +119 -81
- package/{index-tz5evhdr.js → index-ebarbgba.js} +6 -6
- package/{index-2etqq75t.js → index-g6ax17x4.js} +1114 -1082
- package/{index-h85cxfkg.js → index-g9ks2k8c.js} +2 -2
- package/{index-nq045px5.js → index-h3r3nr9y.js} +356 -307
- package/{index-20cebtth.js → index-h6czey01.js} +79 -24
- package/{index-6726qr1m.js → index-jrmzcp66.js} +57 -58
- package/{index-q958tqqg.js → index-m9jj544v.js} +1 -1
- package/{index-8935h3n1.js → index-mdjc93e1.js} +1 -1
- package/{index-rk9sdys3.js → index-nv79n88g.js} +5 -5
- package/{index-kc8z134d.js → index-nx64dz92.js} +38 -15
- package/{index-z507nzhg.js → index-p2r64bpa.js} +4 -4
- package/{index-nq2ja5e0.js → index-pg1t468s.js} +3 -3
- package/{index-3reaaa1h.js → index-rc51f9ht.js} +29 -27
- package/{index-e9prnmyt.js → index-ta1dychm.js} +3 -3
- package/{index-2ahj896a.js → index-tvehn2sp.js} +1 -1
- package/{index-31ce9vhg.js → index-vkb9m4z7.js} +80 -38
- package/{index-58vvz603.js → index-xsd96yzw.js} +1 -1
- package/{index-pyxn1b53.js → index-zv5s8x58.js} +13 -13
- package/index.js +22 -22
- package/{library.command-8tw59xzj.js → library.command-6amzsrb8.js} +3 -3
- package/{localRegistry.command-tf3dmznd.js → localRegistry.command-yqc0nyhh.js} +15 -14
- package/{module.command-9vm8hffy.js → module.command-10x6jv6c.js} +5 -5
- package/{package.command-erbxe2tz.js → package.command-pwfvecjf.js} +4 -4
- package/package.json +21 -21
- package/{page.command-jpavcj0p.js → page.command-ahhgx9y1.js} +3 -3
- package/{pipeline.command-b8rzvjvv.js → pipeline.command-1ptr3e9y.js} +3 -3
- package/{primitive.command-sm32chzk.js → primitive.command-g5xwv6tj.js} +6 -6
- package/{projectTypecheck-jamtx95x.js → projectTypecheck-fx8x7cat.js} +1 -1
- package/{quality.command-pkd17n6y.js → quality.command-fw9ck061.js} +4 -4
- package/{repair.command-8y4mq6hs.js → repair.command-g8kecj96.js} +5 -5
- package/{scalar.command-q8khmyx5.js → scalar.command-fprap51w.js} +4 -4
- package/skills/akan-code/SKILL.md +4 -0
- package/skills/akan-store/SKILL.md +2 -1
- package/{subspace.command-51n0ykbx.js → subspace.command-sc0t527y.js} +11 -10
- package/templates/appSample/lib/task/Task.Util.tsx +7 -7
- package/templates/appSample/lib/task/Task.Zone.tsx +1 -1
- package/templates/appSample/ui/QuantityControl.tsx +2 -2
- package/templates/crudSinglePage/page.tsx +1 -1
- package/templates/lib/cnst.ts +0 -1
- package/templates/migration/__migrationId__.ts +23 -0
- package/templates/server.ts +8 -1
- package/templates/workspaceRoot/.gitignore.template +23 -52
- package/templates/workspaceRoot/biome.json.template +1 -1
- package/{tunnel.command-7820vtxq.js → tunnel.command-mqnsqbwf.js} +8 -7
- package/{workflow.command-n5sv4wqz.js → workflow.command-j0jgkr13.js} +10 -10
- package/{workspace.command-zdy60jh8.js → workspace.command-1r9hvvw0.js} +29 -28
- package/TunnelShare-f1egrktx.js +0 -13
- package/cloud.script-z8p5dz7e.js +0 -23
- package/context.runner-hnh0rg7m.js +0 -24
- package/index-n68jx79w.js +0 -120
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
script
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-vkb9m4z7.js";
|
|
5
5
|
import {
|
|
6
6
|
AppExecutor,
|
|
7
7
|
LibExecutor,
|
|
8
8
|
ModuleExecutor
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-g6ax17x4.js";
|
|
10
10
|
import {
|
|
11
11
|
workflowStatus,
|
|
12
12
|
compactDiagnostics,
|
|
@@ -41,10 +41,10 @@ import {
|
|
|
41
41
|
hasSignalFactoryEntry,
|
|
42
42
|
insertSignalFactoryEntry,
|
|
43
43
|
addFieldUiPolicyForType
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-033wne2j.js";
|
|
45
45
|
import {
|
|
46
46
|
ModuleScript
|
|
47
|
-
} from "./index-
|
|
47
|
+
} from "./index-p2r64bpa.js";
|
|
48
48
|
|
|
49
49
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
50
50
|
import { capitalize, lowerlize } from "akanjs/common";
|
|
@@ -2,24 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
DesktopBin,
|
|
4
4
|
UpdatePackFolder
|
|
5
|
-
} from "./index-
|
|
6
|
-
|
|
7
|
-
// pkgs/@akanjs/devkit/mobile/placeholderAppId.ts
|
|
8
|
-
var PLACEHOLDER_APP_IDS = [
|
|
9
|
-
"com.myapp.app",
|
|
10
|
-
"com.myorg.myapp",
|
|
11
|
-
"com.example.app",
|
|
12
|
-
"com.example.myapp"
|
|
13
|
-
];
|
|
14
|
-
var placeholderAppIdSegment = /^(example|examples|myorg|myapp|mycompany|myorganization|changeme|todo|sample|test)$/;
|
|
15
|
-
var isPlaceholderAppId = (appId) => {
|
|
16
|
-
const normalized = appId?.trim().toLowerCase() ?? "";
|
|
17
|
-
if (!normalized)
|
|
18
|
-
return true;
|
|
19
|
-
if (PLACEHOLDER_APP_IDS.includes(normalized))
|
|
20
|
-
return true;
|
|
21
|
-
return normalized.split(".").some((segment) => placeholderAppIdSegment.test(segment));
|
|
22
|
-
};
|
|
5
|
+
} from "./index-35m6bzm7.js";
|
|
23
6
|
// pkgs/@akanjs/devkit/mobile/desktopServerStage.ts
|
|
24
7
|
import { cp, mkdir, readdir, rm, writeFile } from "fs/promises";
|
|
25
8
|
import path from "path";
|
|
@@ -145,19 +128,35 @@ ${toError(error).message}`, { cause: error });
|
|
|
145
128
|
};
|
|
146
129
|
}
|
|
147
130
|
}
|
|
131
|
+
// pkgs/@akanjs/devkit/mobile/placeholderAppId.ts
|
|
132
|
+
var PLACEHOLDER_APP_IDS = [
|
|
133
|
+
"com.myapp.app",
|
|
134
|
+
"com.myorg.myapp",
|
|
135
|
+
"com.example.app",
|
|
136
|
+
"com.example.myapp"
|
|
137
|
+
];
|
|
138
|
+
var placeholderAppIdSegment = /^(example|examples|myorg|myapp|mycompany|myorganization|changeme|todo|sample|test)$/;
|
|
139
|
+
var isPlaceholderAppId = (appId) => {
|
|
140
|
+
const normalized = appId?.trim().toLowerCase() ?? "";
|
|
141
|
+
if (!normalized)
|
|
142
|
+
return true;
|
|
143
|
+
if (PLACEHOLDER_APP_IDS.includes(normalized))
|
|
144
|
+
return true;
|
|
145
|
+
return normalized.split(".").some((segment) => placeholderAppIdSegment.test(segment));
|
|
146
|
+
};
|
|
148
147
|
// pkgs/@akanjs/devkit/mobile/updateUploader.ts
|
|
149
148
|
import { readdir as readdir2 } from "fs/promises";
|
|
150
149
|
import path2 from "path";
|
|
151
|
-
import { isRecord } from "akanjs/common";
|
|
150
|
+
import { isRecord, trimTrailingSlashes } from "akanjs/common";
|
|
152
151
|
class UpdateUploader {
|
|
153
152
|
bucket;
|
|
154
153
|
prefix;
|
|
155
154
|
static #manifest = /\.json(?:\.sig)?$/;
|
|
156
155
|
static parseTarget(target) {
|
|
157
|
-
const match = /^s3:\/\/([^/]+)
|
|
156
|
+
const match = /^s3:\/\/([^/]+)(?:\/(.*))?$/.exec(target.trim());
|
|
158
157
|
if (!match?.[1])
|
|
159
158
|
throw new Error(`--upload takes s3://<bucket>/<prefix>, not ${JSON.stringify(target)}.`);
|
|
160
|
-
return { bucket: match[1], prefix: (match[2] ?? "")
|
|
159
|
+
return { bucket: match[1], prefix: trimTrailingSlashes(match[2] ?? "") };
|
|
161
160
|
}
|
|
162
161
|
static order(files) {
|
|
163
162
|
const manifests = files.filter((file) => UpdateUploader.#manifest.test(file));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
resolveSsrPageEntriesForApp
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-g6ax17x4.js";
|
|
5
5
|
import {
|
|
6
6
|
computeRouteSeedIndex,
|
|
7
7
|
saveRouteSeedIndex,
|
|
@@ -9,17 +9,20 @@ import {
|
|
|
9
9
|
ClientEntriesBundler,
|
|
10
10
|
VENDOR_SPECIFIERS,
|
|
11
11
|
RouteClientBuilder
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-1r5a8bzx.js";
|
|
13
13
|
import {
|
|
14
14
|
SOURCE_EXTS
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-5nd1wtkv.js";
|
|
16
16
|
import {
|
|
17
17
|
CsrEntryFiles,
|
|
18
18
|
BarrelAnalyzer,
|
|
19
19
|
createTsconfigPackageResolver,
|
|
20
20
|
rewriteBarrelImports,
|
|
21
21
|
PagesBundleBuilder
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-h3r3nr9y.js";
|
|
23
|
+
import {
|
|
24
|
+
CssBlockParser
|
|
25
|
+
} from "./index-62md4dwy.js";
|
|
23
26
|
var __require = import.meta.require;
|
|
24
27
|
|
|
25
28
|
// pkgs/@akanjs/devkit/frontendBuild/allRoutesBuilder.ts
|
|
@@ -127,7 +130,6 @@ class AllRoutesBuilder {
|
|
|
127
130
|
this.#knownSet.add(abs);
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
|
|
131
133
|
// pkgs/@akanjs/devkit/frontendBuild/cssCompiler.ts
|
|
132
134
|
import path3 from "path";
|
|
133
135
|
import { Logger } from "akanjs/common";
|
|
@@ -135,10 +137,10 @@ import { compile } from "tailwindcss";
|
|
|
135
137
|
|
|
136
138
|
// pkgs/@akanjs/devkit/frontendBuild/cssCandidateCache.ts
|
|
137
139
|
import { stat } from "fs/promises";
|
|
138
|
-
var CANDIDATE_RE = /-?(?:[\w@]|\[[
|
|
140
|
+
var CANDIDATE_RE = /-?(?:[\w@]|\[(?:[^[\]\s]|\[[^[\]\s]+\])+\])[\w:/.-]*(?:(?:\[(?:[^[\]\s]|\[[^[\]\s]+\])+\]|\((?:[a-z-]+:)?--[^)\s]+\))[\w:/.-]*)*/g;
|
|
139
141
|
|
|
140
142
|
class CssCandidateCache {
|
|
141
|
-
static #version =
|
|
143
|
+
static #version = 5;
|
|
142
144
|
#path;
|
|
143
145
|
#entries = new Map;
|
|
144
146
|
#dirty = false;
|
|
@@ -651,13 +653,19 @@ function isIgnoredNodeModuleSource(filePath) {
|
|
|
651
653
|
return NODE_MODULES_RE.test(filePath) && !AKANJS_NODE_MODULE_RE.test(filePath);
|
|
652
654
|
}
|
|
653
655
|
function declaredCustomProperties(css) {
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
+
const names = new Set;
|
|
657
|
+
CssBlockParser.walk(CssBlockParser.parse(css), true, (node) => {
|
|
658
|
+
if (node.kind === "block")
|
|
659
|
+
return node.atRule === "@theme" ? null : true;
|
|
660
|
+
if (node.property.startsWith("--"))
|
|
661
|
+
names.add(node.property);
|
|
662
|
+
return null;
|
|
663
|
+
});
|
|
664
|
+
return [...names];
|
|
656
665
|
}
|
|
657
666
|
function getPageKeyBasePath(pageKey, basePaths) {
|
|
658
667
|
return CsrEntryFiles.basePathOfPageKey(pageKey, basePaths);
|
|
659
668
|
}
|
|
660
|
-
|
|
661
669
|
// pkgs/@akanjs/devkit/frontendBuild/fontOptimizer.ts
|
|
662
670
|
import { mkdir, stat as stat2 } from "fs/promises";
|
|
663
671
|
import path4 from "path";
|
|
@@ -1045,7 +1053,7 @@ class FontOptimizer {
|
|
|
1045
1053
|
const filePaths = [];
|
|
1046
1054
|
for await (const filePath of glob.scan({ cwd: root, absolute: true }))
|
|
1047
1055
|
filePaths.push(filePath);
|
|
1048
|
-
for (const filePath of filePaths.sort())
|
|
1056
|
+
for (const filePath of filePaths.sort((a, b) => a < b ? -1 : a > b ? 1 : 0))
|
|
1049
1057
|
parts.push(await Bun.file(filePath).text());
|
|
1050
1058
|
}
|
|
1051
1059
|
return parts.join("");
|
|
@@ -1146,7 +1154,6 @@ ${declarations.map(([prop, value]) => ` ${prop}: ${value};`).join(`
|
|
|
1146
1154
|
return JSON.stringify(value);
|
|
1147
1155
|
}
|
|
1148
1156
|
}
|
|
1149
|
-
|
|
1150
1157
|
// pkgs/@akanjs/devkit/frontendBuild/fontPruner.ts
|
|
1151
1158
|
import { rm, rmdir, stat as stat3 } from "fs/promises";
|
|
1152
1159
|
import path5 from "path";
|
|
@@ -1310,7 +1317,6 @@ class FontPruner {
|
|
|
1310
1317
|
return await stat3(dir).then((entry) => entry.isDirectory(), () => false);
|
|
1311
1318
|
}
|
|
1312
1319
|
}
|
|
1313
|
-
|
|
1314
1320
|
// pkgs/@akanjs/devkit/frontendBuild/precompressArtifacts.ts
|
|
1315
1321
|
import fs from "fs";
|
|
1316
1322
|
import path6 from "path";
|
|
@@ -1370,7 +1376,6 @@ async function shouldPrecompress(filePath) {
|
|
|
1370
1376
|
return false;
|
|
1371
1377
|
return file.size >= MIN_COMPRESS_BYTES;
|
|
1372
1378
|
}
|
|
1373
|
-
|
|
1374
1379
|
// pkgs/@akanjs/devkit/frontendBuild/ssrBaseArtifactBuilder.ts
|
|
1375
1380
|
import path7 from "path";
|
|
1376
1381
|
import { optimize } from "@tailwindcss/node";
|
|
@@ -71,13 +71,6 @@ Caused by: ${ApplicationBuildReporter.formatError(error.cause, workspaceRoot)}`
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
// pkgs/@akanjs/devkit/frontendBuild/hmrWatcher.ts
|
|
75
|
-
import fs from "fs";
|
|
76
|
-
import path5 from "path";
|
|
77
|
-
|
|
78
|
-
// pkgs/@akanjs/devkit/frontendBuild/hmrChangeClassifier.ts
|
|
79
|
-
import path3 from "path";
|
|
80
|
-
|
|
81
74
|
// pkgs/@akanjs/devkit/akanApp/devHostPolicy.ts
|
|
82
75
|
import path2 from "path";
|
|
83
76
|
var UNAVAILABLE_REDIS_HOST = "redis-tunnel-unavailable.invalid";
|
|
@@ -293,7 +286,83 @@ var mergeInvalidateMessages = (current, next) => {
|
|
|
293
286
|
var buildStatusReplaySequence = (pendingReplay, latestByPhase) => [...pendingReplay, ...latestByPhase.values()];
|
|
294
287
|
var filesChangedSince = (before, after) => [...before].filter(([file, stamp]) => after.get(file) !== stamp).map(([file]) => file);
|
|
295
288
|
|
|
289
|
+
// pkgs/@akanjs/devkit/frontendBuild/watchRootResolver.ts
|
|
290
|
+
import fs from "fs";
|
|
291
|
+
import { readFile } from "fs/promises";
|
|
292
|
+
import path3 from "path";
|
|
293
|
+
|
|
294
|
+
class WatchRootResolver {
|
|
295
|
+
#app;
|
|
296
|
+
constructor(app) {
|
|
297
|
+
this.#app = app;
|
|
298
|
+
}
|
|
299
|
+
async resolve() {
|
|
300
|
+
const tsconfig = await this.#app.getTsConfig();
|
|
301
|
+
const appDir = path3.resolve(this.#app.cwdPath);
|
|
302
|
+
const appsContainer = path3.dirname(appDir);
|
|
303
|
+
const libsContainer = path3.resolve(this.#app.workspace.workspaceRoot, "libs");
|
|
304
|
+
const libRoots = (await this.#resolveLibDeps(libsContainer))?.map((name) => path3.join(libsContainer, name)).filter((dir) => fs.existsSync(dir));
|
|
305
|
+
const set = new Set;
|
|
306
|
+
set.add(path3.resolve(`${this.#app.cwdPath}/page`));
|
|
307
|
+
for (const targets of Object.values(tsconfig.compilerOptions.paths ?? {})) {
|
|
308
|
+
for (const target of targets) {
|
|
309
|
+
if (!target)
|
|
310
|
+
continue;
|
|
311
|
+
if (path3.isAbsolute(target))
|
|
312
|
+
continue;
|
|
313
|
+
const cleaned = target.replace(/\/?\*+.*$/, "").replace(/\/[^/]+\.[^/]+$/, "");
|
|
314
|
+
const resolved = path3.resolve(this.#app.workspace.workspaceRoot, cleaned);
|
|
315
|
+
if (resolved === libsContainer && libRoots) {
|
|
316
|
+
for (const root of libRoots)
|
|
317
|
+
set.add(root);
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
const root = resolved === appsContainer ? appDir : resolved;
|
|
321
|
+
if (fs.existsSync(root))
|
|
322
|
+
set.add(root);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return [...set];
|
|
326
|
+
}
|
|
327
|
+
async#resolveLibDeps(libsContainer) {
|
|
328
|
+
const scanInfo = this.#app.getScanInfo({ allowEmpty: true });
|
|
329
|
+
if (scanInfo?.type === "app")
|
|
330
|
+
return scanInfo.libDeps;
|
|
331
|
+
const direct = await WatchRootResolver.#readManifestLibDeps(path3.join(this.#app.cwdPath, "akan.app.json"));
|
|
332
|
+
if (!direct)
|
|
333
|
+
return null;
|
|
334
|
+
const closure = new Set;
|
|
335
|
+
const queue = [...direct];
|
|
336
|
+
while (queue.length > 0) {
|
|
337
|
+
const name = queue.shift();
|
|
338
|
+
if (!name || closure.has(name))
|
|
339
|
+
continue;
|
|
340
|
+
closure.add(name);
|
|
341
|
+
const nested = await WatchRootResolver.#readManifestLibDeps(path3.join(libsContainer, name, "akan.lib.json"));
|
|
342
|
+
if (!nested)
|
|
343
|
+
return null;
|
|
344
|
+
queue.push(...nested);
|
|
345
|
+
}
|
|
346
|
+
return [...closure];
|
|
347
|
+
}
|
|
348
|
+
static async#readManifestLibDeps(manifestPath) {
|
|
349
|
+
try {
|
|
350
|
+
const parsed = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
351
|
+
if (!Array.isArray(parsed.libDeps))
|
|
352
|
+
return null;
|
|
353
|
+
return parsed.libDeps.filter((name) => typeof name === "string" && name.length > 0);
|
|
354
|
+
} catch {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// pkgs/@akanjs/devkit/frontendBuild/hmrWatcher.ts
|
|
361
|
+
import fs2 from "fs";
|
|
362
|
+
import path6 from "path";
|
|
363
|
+
|
|
296
364
|
// pkgs/@akanjs/devkit/frontendBuild/hmrChangeClassifier.ts
|
|
365
|
+
import path4 from "path";
|
|
297
366
|
var CSS_EXTS = new Set([".css"]);
|
|
298
367
|
var CONFIG_BASENAMES = new Set(["akan.config.ts", "bunfig.toml", "tsconfig.json", "package.json"]);
|
|
299
368
|
|
|
@@ -301,10 +370,10 @@ class HmrChangeClassifier {
|
|
|
301
370
|
classify(abs) {
|
|
302
371
|
if (this.#isUninteresting(abs))
|
|
303
372
|
return "ignore";
|
|
304
|
-
const base =
|
|
373
|
+
const base = path4.basename(abs);
|
|
305
374
|
if (CONFIG_BASENAMES.has(base))
|
|
306
375
|
return "config";
|
|
307
|
-
const ext =
|
|
376
|
+
const ext = path4.extname(abs).toLowerCase();
|
|
308
377
|
if (CSS_EXTS.has(ext))
|
|
309
378
|
return "css";
|
|
310
379
|
if (SOURCE_EXTS.has(ext))
|
|
@@ -312,16 +381,16 @@ class HmrChangeClassifier {
|
|
|
312
381
|
return "ignore";
|
|
313
382
|
}
|
|
314
383
|
#isUninteresting(abs) {
|
|
315
|
-
const base =
|
|
384
|
+
const base = path4.basename(abs);
|
|
316
385
|
if (!base)
|
|
317
386
|
return true;
|
|
318
387
|
if (base.startsWith("."))
|
|
319
388
|
return true;
|
|
320
389
|
if (base.endsWith("~") || base.endsWith(".swp") || base.endsWith(".swx") || base.endsWith(".tmp"))
|
|
321
390
|
return true;
|
|
322
|
-
if (abs.includes(`${
|
|
391
|
+
if (abs.includes(`${path4.sep}node_modules${path4.sep}`))
|
|
323
392
|
return true;
|
|
324
|
-
if (abs.includes(`${
|
|
393
|
+
if (abs.includes(`${path4.sep}.akan${path4.sep}`))
|
|
325
394
|
return true;
|
|
326
395
|
return false;
|
|
327
396
|
}
|
|
@@ -329,7 +398,7 @@ class HmrChangeClassifier {
|
|
|
329
398
|
|
|
330
399
|
// pkgs/@akanjs/devkit/frontendBuild/sourceMtimeIndex.ts
|
|
331
400
|
import { readdir, stat } from "fs/promises";
|
|
332
|
-
import
|
|
401
|
+
import path5 from "path";
|
|
333
402
|
var UNREADABLE = Number.NaN;
|
|
334
403
|
|
|
335
404
|
class SourceMtimeIndex {
|
|
@@ -392,7 +461,7 @@ class SourceMtimeIndex {
|
|
|
392
461
|
if (!this.#primed)
|
|
393
462
|
return;
|
|
394
463
|
await Promise.all(paths.map(async (file) => {
|
|
395
|
-
const abs =
|
|
464
|
+
const abs = path5.resolve(file);
|
|
396
465
|
const stats = await stat(abs).catch(() => null);
|
|
397
466
|
if (!stats?.isFile()) {
|
|
398
467
|
this.#files.delete(abs);
|
|
@@ -478,7 +547,7 @@ class SourceMtimeIndex {
|
|
|
478
547
|
for (const entry of entries) {
|
|
479
548
|
if (SourceMtimeIndex.#skipDirent(entry.name))
|
|
480
549
|
continue;
|
|
481
|
-
const abs =
|
|
550
|
+
const abs = path5.join(dir, entry.name);
|
|
482
551
|
if (entry.isDirectory()) {
|
|
483
552
|
descend.push(abs);
|
|
484
553
|
continue;
|
|
@@ -505,7 +574,7 @@ class SourceMtimeIndex {
|
|
|
505
574
|
}
|
|
506
575
|
if (known) {
|
|
507
576
|
for (const abs of [...this.#files.keys()]) {
|
|
508
|
-
if (present.has(abs) ||
|
|
577
|
+
if (present.has(abs) || path5.dirname(abs) !== dir)
|
|
509
578
|
continue;
|
|
510
579
|
this.#files.delete(abs);
|
|
511
580
|
changed?.add(abs);
|
|
@@ -523,7 +592,7 @@ class SourceMtimeIndex {
|
|
|
523
592
|
this.#unsettled.delete(dir);
|
|
524
593
|
}
|
|
525
594
|
#forget(dir) {
|
|
526
|
-
const prefix = `${dir}${
|
|
595
|
+
const prefix = `${dir}${path5.sep}`;
|
|
527
596
|
this.#dirs.delete(dir);
|
|
528
597
|
this.#unreadable.delete(dir);
|
|
529
598
|
this.#unsettled.delete(dir);
|
|
@@ -561,8 +630,8 @@ class SourceMtimeIndex {
|
|
|
561
630
|
return !name || name.startsWith(".") || name === "node_modules";
|
|
562
631
|
}
|
|
563
632
|
static #pruneNestedRoots(roots) {
|
|
564
|
-
const resolved = [...new Set(roots.map((root) =>
|
|
565
|
-
return resolved.filter((root) => !resolved.some((other) => other !== root && root.startsWith(`${other}${
|
|
633
|
+
const resolved = [...new Set(roots.map((root) => path5.resolve(root)))].sort();
|
|
634
|
+
return resolved.filter((root) => !resolved.some((other) => other !== root && root.startsWith(`${other}${path5.sep}`)));
|
|
566
635
|
}
|
|
567
636
|
}
|
|
568
637
|
|
|
@@ -587,7 +656,7 @@ class HmrWatcher {
|
|
|
587
656
|
#reportedCompensating = false;
|
|
588
657
|
#reportedGaps = "";
|
|
589
658
|
constructor(opts) {
|
|
590
|
-
this.#roots = [...new Set(opts.roots.map((r) =>
|
|
659
|
+
this.#roots = [...new Set(opts.roots.map((r) => path6.resolve(r)))];
|
|
591
660
|
this.#debounceMs = opts.debounceMs ?? HmrWatcher.#envDebounceMs() ?? 30;
|
|
592
661
|
this.#verifyDelayMs = opts.verifyDelayMs ?? 250;
|
|
593
662
|
this.#onBatch = opts.onBatch;
|
|
@@ -600,10 +669,10 @@ class HmrWatcher {
|
|
|
600
669
|
async start() {
|
|
601
670
|
for (const root of this.#roots) {
|
|
602
671
|
try {
|
|
603
|
-
const w =
|
|
672
|
+
const w = fs2.watch(root, { recursive: true, persistent: false }, (_event, filename) => {
|
|
604
673
|
if (!filename)
|
|
605
674
|
return;
|
|
606
|
-
const abs =
|
|
675
|
+
const abs = path6.resolve(root, filename.toString());
|
|
607
676
|
this.#queue(abs);
|
|
608
677
|
});
|
|
609
678
|
w.on("error", (err) => {
|
|
@@ -729,7 +798,7 @@ class HmrWatcher {
|
|
|
729
798
|
}
|
|
730
799
|
#reportCoverageGaps() {
|
|
731
800
|
const gaps = this.#index.coverageGaps;
|
|
732
|
-
const key = gaps.map((gap) => `${gap.code}:${gap.path}`).sort().join("|");
|
|
801
|
+
const key = gaps.map((gap) => `${gap.code}:${gap.path}`).sort((a, b) => a < b ? -1 : a > b ? 1 : 0).join("|");
|
|
733
802
|
if (key === this.#reportedGaps)
|
|
734
803
|
return;
|
|
735
804
|
this.#reportedGaps = key;
|
|
@@ -767,75 +836,4 @@ class HmrWatcher {
|
|
|
767
836
|
}
|
|
768
837
|
}
|
|
769
838
|
|
|
770
|
-
// pkgs/@akanjs/devkit/frontendBuild/watchRootResolver.ts
|
|
771
|
-
import fs2 from "fs";
|
|
772
|
-
import { readFile } from "fs/promises";
|
|
773
|
-
import path6 from "path";
|
|
774
|
-
|
|
775
|
-
class WatchRootResolver {
|
|
776
|
-
#app;
|
|
777
|
-
constructor(app) {
|
|
778
|
-
this.#app = app;
|
|
779
|
-
}
|
|
780
|
-
async resolve() {
|
|
781
|
-
const tsconfig = await this.#app.getTsConfig();
|
|
782
|
-
const appDir = path6.resolve(this.#app.cwdPath);
|
|
783
|
-
const appsContainer = path6.dirname(appDir);
|
|
784
|
-
const libsContainer = path6.resolve(this.#app.workspace.workspaceRoot, "libs");
|
|
785
|
-
const libRoots = (await this.#resolveLibDeps(libsContainer))?.map((name) => path6.join(libsContainer, name)).filter((dir) => fs2.existsSync(dir));
|
|
786
|
-
const set = new Set;
|
|
787
|
-
set.add(path6.resolve(`${this.#app.cwdPath}/page`));
|
|
788
|
-
for (const targets of Object.values(tsconfig.compilerOptions.paths ?? {})) {
|
|
789
|
-
for (const target of targets) {
|
|
790
|
-
if (!target)
|
|
791
|
-
continue;
|
|
792
|
-
if (path6.isAbsolute(target))
|
|
793
|
-
continue;
|
|
794
|
-
const cleaned = target.replace(/\/?\*+.*$/, "").replace(/\/[^/]+\.[^/]+$/, "");
|
|
795
|
-
const resolved = path6.resolve(this.#app.workspace.workspaceRoot, cleaned);
|
|
796
|
-
if (resolved === libsContainer && libRoots) {
|
|
797
|
-
for (const root of libRoots)
|
|
798
|
-
set.add(root);
|
|
799
|
-
continue;
|
|
800
|
-
}
|
|
801
|
-
const root = resolved === appsContainer ? appDir : resolved;
|
|
802
|
-
if (fs2.existsSync(root))
|
|
803
|
-
set.add(root);
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
return [...set];
|
|
807
|
-
}
|
|
808
|
-
async#resolveLibDeps(libsContainer) {
|
|
809
|
-
const scanInfo = this.#app.getScanInfo({ allowEmpty: true });
|
|
810
|
-
if (scanInfo?.type === "app")
|
|
811
|
-
return scanInfo.libDeps;
|
|
812
|
-
const direct = await WatchRootResolver.#readManifestLibDeps(path6.join(this.#app.cwdPath, "akan.app.json"));
|
|
813
|
-
if (!direct)
|
|
814
|
-
return null;
|
|
815
|
-
const closure = new Set;
|
|
816
|
-
const queue = [...direct];
|
|
817
|
-
while (queue.length > 0) {
|
|
818
|
-
const name = queue.shift();
|
|
819
|
-
if (!name || closure.has(name))
|
|
820
|
-
continue;
|
|
821
|
-
closure.add(name);
|
|
822
|
-
const nested = await WatchRootResolver.#readManifestLibDeps(path6.join(libsContainer, name, "akan.lib.json"));
|
|
823
|
-
if (!nested)
|
|
824
|
-
return null;
|
|
825
|
-
queue.push(...nested);
|
|
826
|
-
}
|
|
827
|
-
return [...closure];
|
|
828
|
-
}
|
|
829
|
-
static async#readManifestLibDeps(manifestPath) {
|
|
830
|
-
try {
|
|
831
|
-
const parsed = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
832
|
-
if (!Array.isArray(parsed.libDeps))
|
|
833
|
-
return null;
|
|
834
|
-
return parsed.libDeps.filter((name) => typeof name === "string" && name.length > 0);
|
|
835
|
-
} catch {
|
|
836
|
-
return null;
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
|
|
841
839
|
export { ApplicationBuildReporter, UNAVAILABLE_REDIS_HOST, redisTunnelPolicy, BUILDER_MIN_RSS_RECYCLE_INTERVAL_MS, SOURCE_EXTS, shouldRestartBackendByDevPlan, shouldRestartBuilderByDevPlan, shouldAbandonBackendRecovery, 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 };
|