@akanjs/devkit 3.1.2-rc.4 → 3.2.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +348 -0
- package/abstractDoc.ts +1 -1
- package/agentAssets.ts +2 -2
- package/akanConfig/akanConfig.ts +2 -2
- package/akanMcpContract.ts +1 -1
- package/apiReference.test.ts +37 -0
- package/apiReference.ts +240 -0
- package/applicationBuildReporter.test.ts +25 -3
- package/applicationBuildReporter.ts +8 -1
- package/applicationBuildRunner.test.ts +34 -14
- package/applicationBuildRunner.ts +76 -14
- package/artifact/implicitRootLayout.test.ts +42 -0
- package/artifact/implicitRootLayout.ts +5 -6
- package/artifact/storeBootstrap.ts +24 -0
- package/cloud/cloudApi.test.ts +70 -7
- package/cloud/cloudApi.ts +10 -4
- package/cloud/constants.ts +3 -0
- package/cloud/globalConfig.test.ts +36 -0
- package/cloud/globalConfig.ts +10 -1
- package/codeAgent/skills/akan-debug/SKILL.md +2 -1
- package/codeAgent/skills/akan-page/SKILL.md +16 -7
- package/codeAgent/skills/akan-service/SKILL.md +48 -19
- package/commandDecorators/command.ts +55 -9
- package/commandDecorators/commandDecorators.test.ts +131 -2
- package/declarationReader.ts +211 -0
- package/executors.test.ts +65 -8
- package/executors.ts +5 -3
- package/frameworkGraph.test.ts +121 -0
- package/frameworkGraph.ts +165 -0
- package/frontendBuild/allRoutesBuilder.test.ts +84 -0
- package/frontendBuild/allRoutesBuilder.ts +32 -12
- package/frontendBuild/buildRouteClient.test.ts +192 -2
- package/frontendBuild/bundleDefine.ts +4 -0
- package/frontendBuild/clientBuildTypes.ts +7 -1
- package/frontendBuild/clientEntriesBundler.test.ts +82 -0
- package/frontendBuild/clientEntriesBundler.ts +55 -4
- package/frontendBuild/csrArtifactBuilder.test.ts +23 -0
- package/frontendBuild/csrArtifactBuilder.ts +2 -1
- package/frontendBuild/fontOptimizer.test.ts +54 -0
- package/frontendBuild/fontOptimizer.ts +5 -4
- package/frontendBuild/index.ts +3 -0
- package/frontendBuild/routeClientBuilder.ts +6 -2
- package/frontendBuild/routeModulePreloads.test.ts +59 -0
- package/frontendBuild/routeModulePreloads.ts +52 -0
- package/frontendBuild/ssrBaseArtifactBuilder.ts +35 -10
- package/frontendBuild/ssrDevBundler.test.ts +26 -0
- package/frontendBuild/ssrDevBundler.ts +2 -1
- package/frontendBuild/vendorImportScanner.test.ts +71 -0
- package/frontendBuild/vendorImportScanner.ts +80 -0
- package/frontendBuild/vendorNarrowing.test.ts +103 -0
- package/frontendBuild/vendorNarrowing.ts +64 -0
- package/frontendBuild/vendorSpecifiers.ts +13 -0
- package/gitRevision.ts +6 -2
- package/incrementalBuilder/builderGraphPayloads.ts +60 -0
- package/incrementalBuilder/incrementalBuilder.proc.test.ts +65 -1
- package/incrementalBuilder/incrementalBuilder.proc.ts +5 -36
- package/integration/devStability.integration.test.ts +1 -1
- package/integration/devStabilityHarness.test.ts +1 -1
- package/lint/no-deep-internal-import.grit +1 -1
- package/maintainabilityBaseline.ts +7 -2
- package/maintainabilityContract.test.ts +183 -0
- package/maintainabilityContract.ts +145 -30
- package/maintainabilityExceptionScanner.test.ts +13 -2
- package/maintainabilityExceptionScanner.ts +16 -6
- package/maintainabilityLimits.ts +12 -0
- package/maintainabilityReport.test.ts +35 -0
- package/maintainabilityReport.ts +29 -8
- package/mobile/nativePublicEnv.test.ts +5 -1
- package/package.json +3 -3
- package/routeJsBudget.test.ts +177 -0
- package/routeJsBudget.ts +222 -0
- package/structureScanner.test.ts +167 -0
- package/structureScanner.ts +164 -0
- package/transforms/barrelAnalyzer.ts +10 -3
- package/transforms/barrelImportsPlugin.ts +13 -7
- package/transforms/serverEnvPlugin.test.ts +1 -1
- package/transforms/serverEnvPlugin.ts +1 -1
- package/transforms/transforms.test.ts +64 -12
- package/transforms/tsconfigPackageResolver.test.ts +12 -0
- package/workflow/plan.ts +79 -17
- package/workflow/types.ts +1 -0
- package/workspaceGraph.test.ts +58 -0
- package/workspaceGraph.ts +32 -3
- package/workspaceLayout.ts +1 -0
- /package/integration/{devStabilityHarness.ts → devStabilityHarness.fixture.ts} +0 -0
package/workspaceGraph.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface GraphScope {
|
|
|
14
14
|
const indexedPath = /^(apps|libs)\/(?!(?:.*\/)?(?:node_modules|dist|\.akan|env)\/).*\.tsx?$/;
|
|
15
15
|
const hiddenPath = /(?:^|\/)(?:node_modules|dist|\.akan|env)\//;
|
|
16
16
|
const unscopedNodeLimit = 600;
|
|
17
|
+
const pageKinds = new Set<AkanGraphNode["kind"]>(["route", "layout"]);
|
|
17
18
|
const cachedBaseLimit = 4;
|
|
18
19
|
const slashed = (fileName: string) => fileName.replace(/\\/g, "/");
|
|
19
20
|
|
|
@@ -103,11 +104,36 @@ export class WorkspaceGraph {
|
|
|
103
104
|
.filter((node) => (!owners || owners.has(node.owner ?? "")) && (!module || node.module === module))
|
|
104
105
|
.map((node) => node.id),
|
|
105
106
|
);
|
|
106
|
-
|
|
107
|
+
//? A lib's guard is linked from every app's endpoints; through it, a scope would reach all of them.
|
|
108
|
+
const guards = new Set(graph.nodes.filter((node) => node.kind === "guard").map((node) => node.id));
|
|
109
|
+
const reaches = (id: string) => seeds.has(id) && !guards.has(id);
|
|
110
|
+
const edges = graph.edges.filter((edge) => reaches(edge.from) || reaches(edge.to));
|
|
107
111
|
const ids = new Set([...seeds, ...edges.flatMap((edge) => [edge.from, edge.to])]);
|
|
108
112
|
return { version: 1, nodes: graph.nodes.filter((node) => ids.has(node.id)), edges };
|
|
109
113
|
}
|
|
110
114
|
|
|
115
|
+
//? Pages are many and most only wrap one another, so a graph too large to answer whole drops the pages that neither
|
|
116
|
+
//? changed nor use a change first, and the route-only guards they leave unlinked.
|
|
117
|
+
static #withoutPages(graph: AkanGraph): AkanGraph {
|
|
118
|
+
const changed = new Set(graph.nodes.filter((node) => node.change).map((node) => node.id));
|
|
119
|
+
const touching = new Set(
|
|
120
|
+
graph.edges
|
|
121
|
+
.filter((edge) => edge.kind !== "wraps" && (changed.has(edge.from) || changed.has(edge.to)))
|
|
122
|
+
.flatMap((edge) => [edge.from, edge.to]),
|
|
123
|
+
);
|
|
124
|
+
const dropped = new Set(
|
|
125
|
+
graph.nodes
|
|
126
|
+
.filter((node) => pageKinds.has(node.kind) && !node.change && !touching.has(node.id))
|
|
127
|
+
.map((node) => node.id),
|
|
128
|
+
);
|
|
129
|
+
const edges = graph.edges.filter((edge) => !dropped.has(edge.from) && !dropped.has(edge.to));
|
|
130
|
+
const linked = new Set(edges.flatMap((edge) => [edge.from, edge.to]));
|
|
131
|
+
const isRouteOnly = (node: AkanGraphNode) =>
|
|
132
|
+
node.kind === "guard" && node.detail.includes("route") && !node.change && !linked.has(node.id);
|
|
133
|
+
const nodes = graph.nodes.filter((node) => !dropped.has(node.id) && !isRouteOnly(node));
|
|
134
|
+
return { version: 1, nodes, edges };
|
|
135
|
+
}
|
|
136
|
+
|
|
111
137
|
static visibleTo(graph: AkanGraph, app: string): AkanGraph {
|
|
112
138
|
const appOwner = `apps/${app}`;
|
|
113
139
|
const isVisible = ({ owner }: AkanGraphNode) => !owner || owner === appOwner || owner.startsWith("libs/");
|
|
@@ -160,14 +186,17 @@ export class WorkspaceGraph {
|
|
|
160
186
|
|
|
161
187
|
static answer(graph: AkanGraph, scope: GraphScope, counted = graph.nodes) {
|
|
162
188
|
if (scope.app || scope.module || graph.nodes.length <= unscopedNodeLimit) return WorkspaceGraph.scope(graph, scope);
|
|
189
|
+
const unscoped = WorkspaceGraph.#withoutPages(graph);
|
|
190
|
+
if (unscoped.nodes.length <= unscopedNodeLimit) return unscoped;
|
|
163
191
|
const owners = new Map<string, number>();
|
|
164
|
-
for (const node of counted)
|
|
192
|
+
for (const node of counted)
|
|
193
|
+
if (node.owner && !pageKinds.has(node.kind)) owners.set(node.owner, (owners.get(node.owner) ?? 0) + 1);
|
|
165
194
|
return {
|
|
166
195
|
diagnostics: [
|
|
167
196
|
{
|
|
168
197
|
severity: "error",
|
|
169
198
|
code: "graph-scope-required",
|
|
170
|
-
message: `The graph has ${
|
|
199
|
+
message: `The graph has ${unscoped.nodes.length} nodes besides its pages. Pass app, module or both to scope it.`,
|
|
171
200
|
input: "app",
|
|
172
201
|
},
|
|
173
202
|
],
|
package/workspaceLayout.ts
CHANGED
|
File without changes
|