@akanjs/devkit 3.3.0-rc.25 → 3.3.0-rc.27

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.
Files changed (145) hide show
  1. package/CHANGELOG.md +300 -0
  2. package/akanApp/akanApp.host.ts +11 -0
  3. package/akanConfig/akanBin.ts +4 -0
  4. package/akanConfig/akanConfig.test.ts +11 -0
  5. package/akanConfig/akanConfig.ts +39 -137
  6. package/akanConfig/akanWorkers.test.ts +39 -0
  7. package/akanConfig/akanWorkers.ts +32 -0
  8. package/akanConfig/desktopServerConfig.ts +96 -0
  9. package/akanConfig/dockerImage.ts +20 -0
  10. package/akanConfig/types.ts +1 -0
  11. package/app/appBin.test.ts +63 -0
  12. package/app/appBin.ts +50 -0
  13. package/app/applicationBuildReporter.test.ts +32 -0
  14. package/app/applicationBuildReporter.ts +4 -0
  15. package/app/applicationBuildRunner.test.ts +3 -0
  16. package/app/applicationBuildRunner.ts +40 -4
  17. package/app/dictionarySizes.ts +94 -0
  18. package/artifact/implicitRootLayout.test.ts +19 -0
  19. package/artifact/implicitRootLayout.ts +16 -2
  20. package/artifact/storeBootstrap.test.ts +28 -0
  21. package/artifact/storeBootstrap.ts +60 -8
  22. package/biome.base.json +5 -1
  23. package/codeAgent/skills/akan-agent/SKILL.md +2 -2
  24. package/codeAgent/skills/akan-deps/SKILL.md +3 -2
  25. package/codeAgent/skills/akan-err/SKILL.md +2 -6
  26. package/codeAgent/skills/akan-mcp/SKILL.md +1 -1
  27. package/codeAgent/skills/akan-module/SKILL.md +2 -2
  28. package/codeAgent/skills/akan-query/SKILL.md +13 -20
  29. package/codeAgent/skills/akan-service/SKILL.md +2 -5
  30. package/codeAgent/skills/akan-transport/SKILL.md +5 -14
  31. package/codeAgent/skills/akan-ui/SKILL.md +2 -5
  32. package/context/akanContext.ts +2 -0
  33. package/executors/clientRuntimeKeyOrder.fixture.json +682 -0
  34. package/executors/clientRuntimeKeys.fixture.json +393 -0
  35. package/executors/clientRuntimeKeys.test.ts +1591 -0
  36. package/executors/executors.test.ts +2 -0
  37. package/executors/sysExecutor.ts +66 -3
  38. package/frontendBuild/allRoutesBuilder.ts +72 -3
  39. package/frontendBuild/autoImportSync.ts +3 -2
  40. package/frontendBuild/buildRouteClient.test.ts +513 -5
  41. package/frontendBuild/clientBuildTypes.ts +15 -0
  42. package/frontendBuild/clientEntriesBundler.ts +38 -0
  43. package/frontendBuild/clientEntryDiscovery.test.ts +60 -1
  44. package/frontendBuild/clientEntryDiscovery.ts +72 -4
  45. package/frontendBuild/csrDevModuleCompiler.test.ts +86 -0
  46. package/frontendBuild/csrDevModuleCompiler.ts +44 -8
  47. package/frontendBuild/csrDevPatcher.ts +33 -7
  48. package/frontendBuild/csrDevTypes.ts +9 -0
  49. package/frontendBuild/devBarrelImports.test.ts +70 -0
  50. package/frontendBuild/devBarrelImports.ts +80 -21
  51. package/frontendBuild/devRegistryBundler.ts +4 -2
  52. package/frontendBuild/devRouteRuntime.test.ts +492 -0
  53. package/frontendBuild/devRouteRuntime.ts +167 -0
  54. package/frontendBuild/dictionaryAssetBuilder.test.ts +316 -0
  55. package/frontendBuild/dictionaryAssetBuilder.ts +152 -16
  56. package/frontendBuild/dictionaryConstants.ts +82 -0
  57. package/frontendBuild/dictionaryPacking.test.ts +84 -0
  58. package/frontendBuild/dictionaryPacking.ts +92 -0
  59. package/frontendBuild/dictionaryRoutes.test.ts +186 -0
  60. package/frontendBuild/dictionaryRoutes.ts +225 -0
  61. package/frontendBuild/pagesBundleBuilder.test.ts +84 -0
  62. package/frontendBuild/pagesBundleBuilder.ts +78 -2
  63. package/frontendBuild/precompressArtifacts.ts +7 -0
  64. package/frontendBuild/registryMetadataFingerprint.ts +3 -3
  65. package/frontendBuild/routeClientBuilder.ts +288 -15
  66. package/frontendBuild/routeHandoffs.test.ts +145 -0
  67. package/frontendBuild/routeHandoffs.ts +115 -0
  68. package/frontendBuild/routeRuntimeCheck.test.ts +257 -0
  69. package/frontendBuild/routeRuntimeCheck.ts +241 -0
  70. package/frontendBuild/routeRuntimePays.test.ts +137 -0
  71. package/frontendBuild/routeRuntimePays.ts +117 -0
  72. package/frontendBuild/ssrBaseArtifactBuilder.ts +24 -34
  73. package/frontendBuild/ssrDevBundler.test.ts +150 -1
  74. package/frontendBuild/ssrDevBundler.ts +66 -11
  75. package/frontendBuild/vendorFileImports.test.ts +254 -0
  76. package/frontendBuild/vendorFileImports.ts +163 -0
  77. package/frontendBuild/vendorNarrowing.ts +28 -0
  78. package/frontendBuild/vendorSpecifiers.ts +2 -0
  79. package/incrementalBuilder/incrementalBuilder.proc.test.ts +79 -0
  80. package/incrementalBuilder/incrementalBuilder.proc.ts +20 -1
  81. package/mobile/desktopBin.ts +2 -2
  82. package/mobile/desktopServerStage.ts +1 -0
  83. package/package.json +4 -3
  84. package/quality/dictionaryKeys.test.ts +173 -0
  85. package/quality/dictionaryKeys.ts +415 -0
  86. package/quality/objectImportReport.test.ts +36 -0
  87. package/quality/objectImportReport.ts +102 -0
  88. package/quality/qualityScanner.ts +1 -1
  89. package/quality/routeRuntimeReport.test.ts +91 -0
  90. package/quality/routeRuntimeReport.ts +121 -0
  91. package/quality/runtimeConstantFacts.ts +71 -0
  92. package/quality/runtimeConstantGraph.ts +123 -0
  93. package/quality/runtimeConstantReads.ts +116 -0
  94. package/quality/runtimeImports.test.ts +190 -0
  95. package/quality/runtimeImports.ts +233 -0
  96. package/quality/runtimeKeyNames.ts +46 -0
  97. package/quality/runtimeLexicalScope.ts +132 -0
  98. package/quality/runtimeMarkerReach.test.ts +84 -0
  99. package/quality/runtimeMarkerReach.ts +255 -0
  100. package/quality/runtimeModuleFacts.ts +290 -0
  101. package/quality/runtimeNameTable.test.ts +172 -0
  102. package/quality/runtimeNameTable.ts +477 -0
  103. package/quality/runtimeScopeReport.test.ts +123 -0
  104. package/quality/runtimeScopeReport.ts +167 -0
  105. package/quality/runtimeSliceKey.ts +269 -0
  106. package/quality/runtimeSyntax.ts +133 -0
  107. package/quality/runtimeTable.fixture.ts +189 -0
  108. package/quality/runtimeUse.test.ts +737 -0
  109. package/quality/runtimeUse.ts +696 -0
  110. package/quality/runtimeUseReadable.test.ts +393 -0
  111. package/quality/ssrScanner.test.ts +13 -0
  112. package/quality/ssrScanner.ts +1 -1
  113. package/test/testHelpers.ts +11 -0
  114. package/transforms/barrelAnalyzer.ts +24 -2
  115. package/transforms/barrelImportsPlugin.ts +82 -14
  116. package/transforms/frameworkObjects.fixture.tsx +58 -0
  117. package/transforms/frameworkObjects.test.ts +54 -0
  118. package/transforms/modelReference.test.ts +196 -0
  119. package/transforms/modelReference.ts +39 -0
  120. package/transforms/objectImportEdits.ts +150 -0
  121. package/transforms/objectMemberImports.test.ts +347 -0
  122. package/transforms/objectMemberImports.ts +537 -0
  123. package/transforms/objectModule.test.ts +237 -0
  124. package/transforms/objectModule.ts +458 -0
  125. package/transforms/objectModuleAnalyzer.ts +104 -0
  126. package/transforms/reactIconImports.test.ts +231 -0
  127. package/transforms/reactIconImports.ts +325 -0
  128. package/transforms/routeConstants.ts +122 -0
  129. package/transforms/routeRuntime.test.ts +835 -0
  130. package/transforms/routeRuntime.ts +703 -0
  131. package/transforms/routeRuntimeEdits.ts +92 -0
  132. package/transforms/routeRuntimeGraph.ts +66 -0
  133. package/transforms/routeRuntimePlan.ts +244 -0
  134. package/transforms/signalDescriptors.test.ts +280 -0
  135. package/transforms/signalDescriptors.ts +227 -0
  136. package/transforms/thisFreeExports.ts +87 -0
  137. package/transforms/transforms.test.ts +177 -0
  138. package/transforms/tsconfigPackageResolver.test.ts +1 -0
  139. package/workflow/executor.ts +6 -2
  140. package/workflow/index.ts +1 -0
  141. package/workflow/plan.ts +36 -7
  142. package/workflow/types.ts +1 -1
  143. package/workflow/uiTarget.ts +50 -0
  144. package/workspace/scanInfo.ts +1 -1
  145. package/workspace/workspaceLayout.ts +1 -0
@@ -0,0 +1,237 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { ObjectModule } from "./objectModule";
3
+
4
+ const read = (lines: string[], file = "index.tsx") => ObjectModule.read(lines.join("\n"), file);
5
+ const membersOf = (lines: string[], object: string) =>
6
+ Object.fromEntries(read(lines).objects.get(object)?.members ?? []);
7
+
8
+ describe("ObjectModule: a module an importer may skip for the members it names", () => {
9
+ test("passes the model index akan sync writes", () => {
10
+ const facts = read([
11
+ 'import * as Template from "./Memo.Template";',
12
+ 'import * as Unit from "./Memo.Unit";',
13
+ 'import * as Zone from "./Memo.Zone";',
14
+ "export const Memo = { Template, Unit, Zone };",
15
+ ]);
16
+
17
+ expect(facts.failed).toBeNull();
18
+ expect(Object.fromEntries(facts.objects.get("Memo")?.members ?? [])).toEqual({
19
+ Template: { specifier: "./Memo.Template", imported: "*" },
20
+ Unit: { specifier: "./Memo.Unit", imported: "*" },
21
+ Zone: { specifier: "./Memo.Zone", imported: "*" },
22
+ });
23
+ });
24
+
25
+ test("passes declarations that bind names: types, directives, functions, const values, export lists", () => {
26
+ const facts = read([
27
+ '"use client";',
28
+ 'import type { Props } from "./types";',
29
+ 'import { Text } from "./Text";',
30
+ 'import Default from "./Default";',
31
+ "interface Local { a: string }",
32
+ "type Alias = Local;",
33
+ "declare const injected: string;",
34
+ "const enum Size { Small }",
35
+ "function helper(props: Props) { return props; }",
36
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: the fixture module's own source holds a template literal
37
+ "const label = `size ${Size.Small}`;",
38
+ "const options = [1, ...[2]];",
39
+ "const pick = typeof label === 'string' ? !label : void 0;",
40
+ "const Wrapper = () => null;",
41
+ "const Fields = { Text, Default, Wrapper, helper, label, options, pick };",
42
+ "export { Fields as Field };",
43
+ ]);
44
+
45
+ expect(facts.failed).toBeNull();
46
+ expect(facts.useClient).toBe(true);
47
+ expect([...facts.objects.keys()]).toEqual(["Field"]);
48
+ });
49
+
50
+ test("passes members put on an object the module declares, with `X.m = …` or `Object.assign`", () => {
51
+ const lines = [
52
+ 'import { Navigator } from "./Navigator";',
53
+ 'import { Slide } from "./Slide";',
54
+ 'import * as parts from "./parts";',
55
+ "export const Scroll = () => null;",
56
+ "Scroll.Navigator = Navigator;",
57
+ "export const Dialog = Object.assign(() => null, { Slide, Part: parts.Part });",
58
+ "const Base = { Slide };",
59
+ "Object.assign(Base, { Navigator });",
60
+ "export { Base };",
61
+ ];
62
+
63
+ expect(read(lines).failed).toBeNull();
64
+ expect(membersOf(lines, "Scroll")).toEqual({ Navigator: { specifier: "./Navigator", imported: "Navigator" } });
65
+ expect(membersOf(lines, "Dialog")).toEqual({
66
+ Slide: { specifier: "./Slide", imported: "Slide" },
67
+ Part: { specifier: "./parts", imported: "Part" },
68
+ });
69
+ expect(Object.keys(membersOf(lines, "Base"))).toEqual(["Slide", "Navigator"]);
70
+ });
71
+
72
+ test("fails an import that runs a module for its effect (bare-import)", () => {
73
+ expect(read(['import "./register";', 'import { A } from "./A";', "export const X = { A };"]).failed).toEqual({
74
+ clause: "bare-import",
75
+ line: 1,
76
+ });
77
+ const tail = ['import { A } from "./A";', "export const X = { A };"];
78
+ expect(read(['import {} from "./register";', ...tail]).failed).toEqual({ clause: "bare-import", line: 1 });
79
+ expect(read(['import { type T } from "./types";', ...tail]).failed).toBeNull();
80
+ });
81
+
82
+ test("fails a re-export, which runs a module no member of the object loads (reexport)", () => {
83
+ const tail = ['import { A } from "./A";', "export const X = { A };"];
84
+ for (const line of [
85
+ 'export * from "./register";',
86
+ 'export * as parts from "./register";',
87
+ 'export { helper } from "./register";',
88
+ 'export { type T, helper } from "./register";',
89
+ 'export {} from "./register";',
90
+ ])
91
+ expect(read([line, ...tail]).failed).toEqual({ clause: "reexport", line: 1 });
92
+ for (const line of [
93
+ 'export type { T } from "./types";',
94
+ 'export type * from "./types";',
95
+ 'export { type T } from "./types";',
96
+ ])
97
+ expect(read([line, ...tail]).failed).toBeNull();
98
+ });
99
+
100
+ test("fails a statement with an effect, a `let`, or a member put on a name the module does not declare (effect-statement)", () => {
101
+ const exported = 'import { A } from "./A";\nexport const X = { A };';
102
+ for (const line of [
103
+ "register(X);",
104
+ "let count = 0;",
105
+ "if (X) X.b = A;",
106
+ "class Holder { static { register(); } }",
107
+ "enum Size { Small }",
108
+ "globalThis.X = X;",
109
+ "window.X = X;",
110
+ ])
111
+ expect(read([exported, line]).failed?.clause).toBe("effect-statement");
112
+ });
113
+
114
+ test("fails a call or construction evaluated at load (call)", () => {
115
+ const head = 'import { memo } from "react";\nimport { A } from "./A";';
116
+ for (const value of ["memo(A)", "new Map()", "tag`x`", "{ Text: memo(A) }", "Object.assign({}, { A: memo(A) })"])
117
+ expect(read([head, `export const X = ${value};`]).failed).toEqual({ clause: "call", line: 3 });
118
+ });
119
+
120
+ test("fails a value that assigns or awaits while it is evaluated (effect-value)", () => {
121
+ const head = 'import { A } from "./A";\nconst state = { n: 0 };';
122
+ for (const value of ["{ A, n: (state.n = 1) }", "{ A, n: ++state.n }", "await A", "Object.assign(window, { A })"])
123
+ expect(read([head, `export const X = ${value};`]).failed?.clause).toBe("effect-value");
124
+ });
125
+
126
+ test("fails a module that puts a member on an import (mutated-import)", () => {
127
+ const head = 'import { Field } from "./Field";\nimport { A } from "./A";';
128
+ expect(read([head, "Field.A = A;", "export const X = { A };"]).failed?.clause).toBe("mutated-import");
129
+ expect(read([head, "Object.assign(Field, { A });", "export const X = { A };"]).failed?.clause).toBe(
130
+ "mutated-import",
131
+ );
132
+ expect(read([head, "export const X = Object.assign(Field, { A });"]).failed?.clause).toBe("mutated-import");
133
+ expect(read([head, "export const X = Object.assign(Field.Sub, { A });"]).failed?.clause).toBe("mutated-import");
134
+ });
135
+
136
+ test("fails a member put on anything but an object the module created above it, which the object would not record", () => {
137
+ const head = 'import { Base } from "./Base";\nimport { A } from "./A";\nimport { B } from "./B";';
138
+ const failedOn = (...lines: string[]) => read([head, ...lines]).failed;
139
+
140
+ expect(failedOn("const Alias = Base;", "Alias.Extra = B;", "export const X = { A };")).toEqual({
141
+ clause: "effect-statement",
142
+ line: 5,
143
+ });
144
+ expect(failedOn("const Alias = Base;", "Object.assign(Alias, { B });", "export const X = { A };")?.clause).toBe(
145
+ "effect-statement",
146
+ );
147
+ expect(failedOn("X.A = B;", "export const X = { A };")).toEqual({ clause: "effect-statement", line: 4 });
148
+ expect(failedOn("const Own = { A };", "export const X = { Sub: Object.assign(Own, { B }) };")?.clause).toBe(
149
+ "effect-value",
150
+ );
151
+ const shadowed = ['import { Object } from "./Object";', 'import { A } from "./A";'];
152
+ expect(read([...shadowed, "export const X = Object.assign({}, { A });"]).failed?.clause).toBe("call");
153
+ });
154
+
155
+ test("records a member put on an object under every name bound to it, in the order the module runs", () => {
156
+ const lines = [
157
+ 'import { A } from "./A";',
158
+ 'import { B } from "./B";',
159
+ 'import { C } from "./C";',
160
+ "export function Root() { return null; }",
161
+ "export const Toast = Object.assign(Root, { A });",
162
+ "Root.B = B;",
163
+ "Toast.A = C;",
164
+ ];
165
+
166
+ expect(read(lines).failed).toBeNull();
167
+ for (const object of ["Root", "Toast"])
168
+ expect(membersOf(lines, object)).toEqual({
169
+ A: { specifier: "./C", imported: "C" },
170
+ B: { specifier: "./B", imported: "B" },
171
+ });
172
+ });
173
+
174
+ test("names no file for a member a function with members of its own may replace when it is copied in", () => {
175
+ const head = ['import { A } from "./A";', 'import { B } from "./B";', "export const X = { A };"];
176
+ const merged = [...head, "const Base = () => null;", "Base.A = B;", "Object.assign(X, Base);"];
177
+
178
+ expect(membersOf(merged, "X")).toEqual({ A: null });
179
+ expect(read(merged).objects.get("X")?.open).toBe(true);
180
+ expect(membersOf([...head, "const Plain = () => null;", "Object.assign(X, Plain);"], "X")).toEqual({
181
+ A: { specifier: "./A", imported: "A" },
182
+ });
183
+ });
184
+
185
+ test("points a member written one level down at its file, and no deeper", () => {
186
+ const lines = [
187
+ 'import { Zone } from "./Doc";',
188
+ 'import { Graph } from "./Graph";',
189
+ 'import { Leaf } from "./Leaf";',
190
+ "export const Constant = { Doc: { Zone, Deep: { Leaf } }, Graph };",
191
+ ];
192
+
193
+ expect(membersOf(lines, "Constant")).toEqual({
194
+ Doc: null,
195
+ "Doc.Zone": { specifier: "./Doc", imported: "Zone" },
196
+ "Doc.Deep": null,
197
+ Graph: { specifier: "./Graph", imported: "Graph" },
198
+ });
199
+ });
200
+
201
+ test("names no file for a member a later spread, computed key or source may replace", () => {
202
+ const head = ['import { A } from "./A";', 'import { B } from "./B";', 'import { Other } from "./Other";'];
203
+
204
+ expect(membersOf([...head, "export const X = { A, ...Other, B };"], "X")).toEqual({
205
+ A: null,
206
+ B: { specifier: "./B", imported: "B" },
207
+ });
208
+ expect(membersOf([...head, 'export const X = { A, ["k"]: B };'], "X")).toEqual({ A: null });
209
+ expect(membersOf([...head, "export const X = Object.assign({ A }, Other, { B });"], "X")).toEqual({
210
+ A: null,
211
+ B: { specifier: "./B", imported: "B" },
212
+ });
213
+ expect(membersOf([...head, "export const X = { Doc: { A, ...Other }, B };"], "X")).toEqual({
214
+ Doc: null,
215
+ "Doc.A": null,
216
+ B: { specifier: "./B", imported: "B" },
217
+ });
218
+ expect(membersOf([...head, "export const X = { Doc: { A } };", "X.Doc = Other;"], "X")).toEqual({
219
+ Doc: { specifier: "./Other", imported: "Other" },
220
+ });
221
+ });
222
+
223
+ test("names no file for a member declared in the object's own file or keyed with a dot", () => {
224
+ const lines = [
225
+ 'import { A } from "./A";',
226
+ "const Local = () => null;",
227
+ 'export const X = { A, Local, "Doc.A": A, method() { return A; } };',
228
+ ];
229
+
230
+ expect(membersOf(lines, "X")).toEqual({
231
+ A: { specifier: "./A", imported: "A" },
232
+ Local: null,
233
+ "Doc.A": null,
234
+ method: null,
235
+ });
236
+ });
237
+ });