@akanjs/devkit 3.3.0-rc.7 → 3.3.0-rc.70

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 (358) hide show
  1. package/DEV_RUNTIME_KNOBS.md +1 -1
  2. package/README.ko.md +10 -3
  3. package/README.md +10 -4
  4. package/akanApp/akanApp.host.test.ts +4 -2
  5. package/akanApp/akanApp.host.ts +26 -2
  6. package/akanApp/akanApp.host.wiring.test.ts +111 -0
  7. package/akanApp/devHostPolicy.ts +5 -0
  8. package/akanApp/devMetadataRestart.ts +93 -0
  9. package/akanApp/devRecycler.test.ts +2 -0
  10. package/akanApp/devRecycler.ts +9 -0
  11. package/akanConfig/akanBin.ts +4 -0
  12. package/akanConfig/akanConfig.test.ts +320 -21
  13. package/akanConfig/akanConfig.ts +113 -272
  14. package/akanConfig/akanPreview.test.ts +28 -0
  15. package/akanConfig/akanPreview.ts +24 -0
  16. package/akanConfig/akanWorkers.test.ts +73 -0
  17. package/akanConfig/akanWorkers.ts +61 -0
  18. package/akanConfig/desktopServerConfig.ts +96 -0
  19. package/akanConfig/dockerImage.ts +229 -0
  20. package/akanConfig/index.ts +3 -0
  21. package/akanConfig/nativeFileSettings.ts +33 -0
  22. package/akanConfig/nativeKeys.ts +52 -0
  23. package/akanConfig/types.ts +4 -0
  24. package/app/appBin.test.ts +63 -0
  25. package/app/appBin.ts +50 -0
  26. package/app/applicationBuildReporter.test.ts +51 -1
  27. package/app/applicationBuildReporter.ts +6 -1
  28. package/app/applicationBuildRunner.test.ts +358 -5
  29. package/app/applicationBuildRunner.ts +221 -31
  30. package/app/clientServerBoundary.test.ts +115 -0
  31. package/app/clientServerBoundary.ts +89 -0
  32. package/app/dictionarySizes.test.ts +40 -0
  33. package/app/dictionarySizes.ts +95 -0
  34. package/app/routeFilesReport.test.ts +59 -0
  35. package/app/routeFilesReport.ts +46 -0
  36. package/app/routeJsBudget.ts +18 -4
  37. package/artifact/implicitRootLayout.test.ts +19 -0
  38. package/artifact/implicitRootLayout.ts +16 -2
  39. package/artifact/implicitRootLayoutRender.test.tsx +4 -1
  40. package/artifact/storeBootstrap.test.ts +28 -0
  41. package/artifact/storeBootstrap.ts +64 -8
  42. package/biome.base.json +7 -5
  43. package/codeAgent/index.ts +1 -34
  44. package/codeAgent/skills/akan-agent/SKILL.md +8 -1
  45. package/codeAgent/skills/akan-code/SKILL.md +38 -3
  46. package/codeAgent/skills/akan-debug/SKILL.md +8 -3
  47. package/codeAgent/skills/akan-deps/SKILL.md +10 -3
  48. package/codeAgent/skills/akan-err/SKILL.md +13 -8
  49. package/codeAgent/skills/akan-mcp/SKILL.md +1 -1
  50. package/codeAgent/skills/akan-module/SKILL.md +2 -2
  51. package/codeAgent/skills/akan-page/SKILL.md +65 -30
  52. package/codeAgent/skills/akan-query/SKILL.md +13 -20
  53. package/codeAgent/skills/akan-runtime/SKILL.md +21 -1
  54. package/codeAgent/skills/akan-service/SKILL.md +21 -20
  55. package/codeAgent/skills/akan-transport/SKILL.md +5 -14
  56. package/codeAgent/skills/akan-ui/SKILL.md +16 -21
  57. package/codeAgent/skills/akan-validate/SKILL.md +8 -2
  58. package/commandDecorators/command.ts +28 -12
  59. package/commandDecorators/commandBuilder.ts +8 -1
  60. package/commandDecorators/commandDecorators.test.ts +70 -3
  61. package/commandDecorators/helpFormatter.ts +14 -12
  62. package/context/akanContext.ts +2 -0
  63. package/csrE2e/devHmrLatency.e2e.test.ts +1 -1
  64. package/csrE2e/ssrRegistry.e2e.test.ts +108 -22
  65. package/docs/apiReference.test.ts +25 -0
  66. package/docs/apiReference.ts +38 -5
  67. package/docs/declarationReader.ts +30 -0
  68. package/executors/appExecutor.ts +26 -12
  69. package/executors/clientRuntimeKeyOrder.fixture.json +682 -0
  70. package/executors/clientRuntimeKeys.fixture.json +393 -0
  71. package/executors/clientRuntimeKeys.test.ts +1690 -0
  72. package/executors/executor.ts +14 -6
  73. package/executors/executors.test.ts +155 -1
  74. package/executors/pkgExecutor.ts +2 -1
  75. package/executors/sysExecutor.ts +112 -8
  76. package/executors/workspaceExecutor.ts +7 -4
  77. package/frontendBuild/allRoutesBuilder.ts +99 -7
  78. package/frontendBuild/autoImportSync.ts +3 -2
  79. package/frontendBuild/buildRouteClient.test.ts +686 -13
  80. package/frontendBuild/clientBuildTypes.ts +26 -0
  81. package/frontendBuild/clientEntriesBundler.ts +49 -1
  82. package/frontendBuild/clientEntryDiscovery.test.ts +308 -1
  83. package/frontendBuild/clientEntryDiscovery.ts +136 -14
  84. package/frontendBuild/clientEntryGroups.test.ts +77 -0
  85. package/frontendBuild/clientEntryGroups.ts +61 -0
  86. package/frontendBuild/csrDevArtifactWriter.ts +2 -2
  87. package/frontendBuild/csrDevModuleCompiler.test.ts +86 -0
  88. package/frontendBuild/csrDevModuleCompiler.ts +44 -8
  89. package/frontendBuild/csrDevPatcher.test.ts +4 -5
  90. package/frontendBuild/csrDevPatcher.ts +37 -11
  91. package/frontendBuild/csrDevTypes.ts +9 -0
  92. package/frontendBuild/devBarrelImports.test.ts +154 -0
  93. package/frontendBuild/devBarrelImports.ts +83 -23
  94. package/frontendBuild/devChangePlanner.ts +0 -1
  95. package/frontendBuild/devRegistryBundler.ts +4 -2
  96. package/frontendBuild/devRouteRuntime.test.ts +492 -0
  97. package/frontendBuild/devRouteRuntime.ts +167 -0
  98. package/frontendBuild/dictionaryAssetBuilder.test.ts +408 -0
  99. package/frontendBuild/dictionaryAssetBuilder.ts +185 -17
  100. package/frontendBuild/dictionaryConstants.ts +136 -0
  101. package/frontendBuild/dictionaryOwnParts.ts +88 -0
  102. package/frontendBuild/dictionaryPackState.ts +131 -0
  103. package/frontendBuild/dictionaryPacking.test.ts +207 -0
  104. package/frontendBuild/dictionaryPacking.ts +160 -0
  105. package/frontendBuild/dictionaryRoutes.test.ts +251 -0
  106. package/frontendBuild/dictionaryRoutes.ts +227 -0
  107. package/frontendBuild/frontendBuild.test.ts +5 -3
  108. package/frontendBuild/pagesBundleBuilder.test.ts +84 -0
  109. package/frontendBuild/pagesBundleBuilder.ts +78 -2
  110. package/frontendBuild/precompressArtifacts.test.ts +22 -0
  111. package/frontendBuild/precompressArtifacts.ts +34 -8
  112. package/frontendBuild/registryMetadataFingerprint.ts +3 -3
  113. package/frontendBuild/renderedEntries.ts +144 -0
  114. package/frontendBuild/routeClientBuilder.ts +407 -43
  115. package/frontendBuild/routeHandoffs.test.ts +155 -0
  116. package/frontendBuild/routeHandoffs.ts +117 -0
  117. package/frontendBuild/routeModulePreloads.test.ts +32 -0
  118. package/frontendBuild/routeModulePreloads.ts +20 -11
  119. package/frontendBuild/routeRuntimeCheck.test.ts +280 -0
  120. package/frontendBuild/routeRuntimeCheck.ts +248 -0
  121. package/frontendBuild/routeRuntimePays.test.ts +143 -0
  122. package/frontendBuild/routeRuntimePays.ts +117 -0
  123. package/frontendBuild/ssrBaseArtifactBuilder.ts +30 -35
  124. package/frontendBuild/ssrDevBundler.test.ts +150 -1
  125. package/frontendBuild/ssrDevBundler.ts +66 -11
  126. package/frontendBuild/vendorFileImports.test.ts +254 -0
  127. package/frontendBuild/vendorFileImports.ts +163 -0
  128. package/frontendBuild/vendorNarrowing.test.ts +47 -3
  129. package/frontendBuild/vendorNarrowing.ts +38 -2
  130. package/frontendBuild/vendorSpecifiers.ts +2 -0
  131. package/guideline/agentAssets.ts +1 -1
  132. package/incrementalBuilder/buildBatch.proc.ts +35 -9
  133. package/incrementalBuilder/buildBatchProtocol.ts +2 -1
  134. package/incrementalBuilder/builderBoot.ts +5 -5
  135. package/incrementalBuilder/builderGraphPayloads.ts +4 -4
  136. package/incrementalBuilder/builderLanes.ts +2 -2
  137. package/incrementalBuilder/builderWatch.ts +19 -9
  138. package/incrementalBuilder/csrRegistry.ts +4 -4
  139. package/incrementalBuilder/incrementalBuilder.proc.test.ts +159 -0
  140. package/incrementalBuilder/incrementalBuilder.proc.ts +38 -10
  141. package/incrementalBuilder/pendingMetadata.test.ts +27 -0
  142. package/incrementalBuilder/pendingMetadata.ts +19 -0
  143. package/incrementalBuilder/ssrRegistry.ts +6 -6
  144. package/index.ts +1 -1
  145. package/integration/devStability.integration.test.ts +46 -21
  146. package/integration/renderAdmissionSoak.test.ts +99 -0
  147. package/integration/renderAdmissionSoak.ts +609 -0
  148. package/lint/__fixtures__/no-arbitrary-color/every-color-function/bad.tsx +11 -0
  149. package/lint/__fixtures__/no-arbitrary-color/every-color-function/good.tsx +2 -0
  150. package/lint/__fixtures__/no-daisyui-legacy-class/every-class/bad.tsx +34 -0
  151. package/lint/__fixtures__/no-daisyui-legacy-class/every-class/good.tsx +2 -0
  152. package/lint/__fixtures__/no-inline-color/every-color-function/bad.tsx +10 -0
  153. package/lint/__fixtures__/no-inline-color/every-color-function/good.tsx +2 -0
  154. package/lint/__fixtures__/no-raw-palette-class/every-palette/bad.tsx +22 -0
  155. package/lint/__fixtures__/no-raw-palette-class/every-palette/good.tsx +2 -0
  156. package/lint/biomeBase.test.ts +50 -3
  157. package/lint/biomeBase.ts +1 -1
  158. package/lint/biomeCheck.test.ts +162 -0
  159. package/lint/biomeCheck.ts +131 -0
  160. package/lint/linter.test.ts +16 -11
  161. package/lint/no-arbitrary-color.grit +5 -0
  162. package/lint/no-conditional-st-hook.grit +5 -1
  163. package/lint/no-daisyui-legacy-class.grit +8 -0
  164. package/lint/no-document-cookie.grit +3 -0
  165. package/lint/no-inline-color.grit +10 -2
  166. package/lint/no-oversized-list-limit.grit +2 -0
  167. package/lint/no-raw-palette-class.grit +7 -0
  168. package/lint/no-unpublished-form-setter.grit +2 -0
  169. package/lint/no-web-only-api-outside-webkit.grit +5 -0
  170. package/lint/no-web-storage.grit +3 -0
  171. package/lint/withheldEnvFile.ts +17 -0
  172. package/mobile/desktopBin.ts +2 -2
  173. package/mobile/desktopServerStage.test.ts +18 -3
  174. package/mobile/desktopServerStage.ts +7 -2
  175. package/mobile/nativeApp.test.ts +7 -5
  176. package/mobile/nativeApp.ts +2 -2
  177. package/mobile/nativeConfig.test.ts +96 -1
  178. package/mobile/nativeConfig.ts +46 -12
  179. package/mobile/nativePublicEnv.ts +1 -1
  180. package/mobile/serverBundleSecrets.ts +43 -0
  181. package/package.json +22 -178
  182. package/packageExports.test.ts +39 -24
  183. package/preview/PreviewView.ts +25 -3
  184. package/quality/dictionaryKeys.test.ts +356 -0
  185. package/quality/dictionaryKeys.ts +488 -0
  186. package/quality/objectImportReport.test.ts +36 -0
  187. package/quality/objectImportReport.ts +105 -0
  188. package/quality/qualityScanner.ts +1 -1
  189. package/quality/routeRuntimeReport.test.ts +91 -0
  190. package/quality/routeRuntimeReport.ts +121 -0
  191. package/quality/runtimeConstantFacts.ts +71 -0
  192. package/quality/runtimeConstantGraph.ts +123 -0
  193. package/quality/runtimeConstantReads.ts +116 -0
  194. package/quality/runtimeImports.test.ts +190 -0
  195. package/quality/runtimeImports.ts +233 -0
  196. package/quality/runtimeKeyNames.ts +46 -0
  197. package/quality/runtimeLexicalScope.ts +132 -0
  198. package/quality/runtimeMarkerReach.test.ts +84 -0
  199. package/quality/runtimeMarkerReach.ts +255 -0
  200. package/quality/runtimeModuleFacts.ts +290 -0
  201. package/quality/runtimeNameTable.test.ts +172 -0
  202. package/quality/runtimeNameTable.ts +477 -0
  203. package/quality/runtimeScopeReport.test.ts +123 -0
  204. package/quality/runtimeScopeReport.ts +167 -0
  205. package/quality/runtimeSliceKey.ts +269 -0
  206. package/quality/runtimeSyntax.ts +133 -0
  207. package/quality/runtimeTable.fixture.ts +189 -0
  208. package/quality/runtimeUse.test.ts +737 -0
  209. package/quality/runtimeUse.ts +696 -0
  210. package/quality/runtimeUseReadable.test.ts +393 -0
  211. package/quality/ssrScanner.test.ts +13 -0
  212. package/quality/ssrScanner.ts +1 -1
  213. package/quality/translatorBindings.ts +187 -0
  214. package/test/fakeTerminal.ts +45 -0
  215. package/test/secretEnvFixture.ts +134 -0
  216. package/test/testHelpers.ts +11 -0
  217. package/transforms/barrelAnalyzer.ts +26 -4
  218. package/transforms/barrelImportsPlugin.ts +121 -32
  219. package/transforms/exportReach.test.ts +162 -0
  220. package/transforms/exportReach.ts +308 -0
  221. package/transforms/frameworkObjects.fixture.tsx +58 -0
  222. package/transforms/frameworkObjects.test.ts +54 -0
  223. package/transforms/modelReference.test.ts +196 -0
  224. package/transforms/modelReference.ts +39 -0
  225. package/transforms/moduleParts.test.ts +225 -0
  226. package/transforms/moduleParts.ts +418 -0
  227. package/transforms/objectImportEdits.ts +150 -0
  228. package/transforms/objectMemberImports.test.ts +633 -0
  229. package/transforms/objectMemberImports.ts +571 -0
  230. package/transforms/objectMemberLookup.ts +150 -0
  231. package/transforms/objectModule.test.ts +307 -0
  232. package/transforms/objectModule.ts +482 -0
  233. package/transforms/objectModuleAnalyzer.ts +104 -0
  234. package/transforms/partImports.test.ts +76 -0
  235. package/transforms/partImports.ts +110 -0
  236. package/transforms/partModules.test.ts +187 -0
  237. package/transforms/partModules.ts +90 -0
  238. package/transforms/partPurity.ts +124 -0
  239. package/transforms/reactIconImports.test.ts +231 -0
  240. package/transforms/reactIconImports.ts +325 -0
  241. package/transforms/routeConstants.ts +122 -0
  242. package/transforms/routeRuntime.test.ts +835 -0
  243. package/transforms/routeRuntime.ts +703 -0
  244. package/transforms/routeRuntimeEdits.ts +92 -0
  245. package/transforms/routeRuntimeGraph.ts +66 -0
  246. package/transforms/routeRuntimePlan.ts +244 -0
  247. package/transforms/secretEnvDeclaration.test.ts +208 -0
  248. package/transforms/secretEnvDeclaration.ts +213 -0
  249. package/transforms/secretEnvFile.test.ts +117 -0
  250. package/transforms/secretEnvFile.ts +113 -0
  251. package/transforms/secretEnvName.test.ts +54 -0
  252. package/transforms/secretEnvName.ts +29 -0
  253. package/transforms/secretEnvSource.test.ts +148 -0
  254. package/transforms/secretEnvSource.ts +166 -0
  255. package/transforms/serverEnvEvaluationError.ts +11 -0
  256. package/transforms/serverEnvPlugin.test.ts +2 -1
  257. package/transforms/serverEnvPlugin.ts +13 -0
  258. package/transforms/serverEnvProfile.test.ts +129 -2
  259. package/transforms/serverEnvProfile.ts +126 -40
  260. package/transforms/serverEnvSecrets.test.ts +292 -0
  261. package/transforms/signalDescriptors.test.ts +280 -0
  262. package/transforms/signalDescriptors.ts +227 -0
  263. package/transforms/thisFreeExports.ts +87 -0
  264. package/transforms/transforms.test.ts +180 -3
  265. package/transforms/tsconfigPackageResolver.test.ts +1 -0
  266. package/tunnel/createTunnel.test.ts +29 -8
  267. package/tunnel/createTunnel.ts +22 -11
  268. package/tunnel/ssh2Module.test.ts +37 -0
  269. package/tunnel/ssh2Module.ts +28 -0
  270. package/tunnel/sshTunnel.ts +4 -2
  271. package/typecheck/projectTypecheck.test.ts +32 -1
  272. package/typecheck/projectTypecheck.ts +3 -3
  273. package/typecheck/typeChecker.test.ts +49 -0
  274. package/typecheck/typeChecker.ts +9 -7
  275. package/typecheck/withheldDiagnostics.ts +41 -0
  276. package/util/devInstallCommand.ts +7 -0
  277. package/util/fileEditor.ts +1 -0
  278. package/util/jsonFormatter.test.ts +13 -9
  279. package/util/selectModel.ts +1 -0
  280. package/workflow/executor.ts +6 -2
  281. package/workflow/index.ts +1 -0
  282. package/workflow/plan.ts +36 -7
  283. package/workflow/types.ts +1 -1
  284. package/workflow/uiTarget.ts +50 -0
  285. package/workspace/envSeed.test.ts +30 -1
  286. package/workspace/envSeed.ts +30 -1
  287. package/workspace/getRelatedCnsts.ts +7 -0
  288. package/workspace/mainCheckout.test.ts +55 -0
  289. package/workspace/mainCheckout.ts +38 -0
  290. package/workspace/scanInfo.test.ts +39 -0
  291. package/workspace/scanInfo.ts +55 -6
  292. package/workspace/slicePlanner.ts +2 -1
  293. package/workspace/workspaceLayout.test.ts +22 -1
  294. package/workspace/workspaceLayout.ts +3 -3
  295. package/CHANGELOG.md +0 -2718
  296. package/codeAgent/agent/AkanCodeCompaction.ts +0 -49
  297. package/codeAgent/agent/AkanCodeServices.ts +0 -122
  298. package/codeAgent/agent/AkanContextFiles.ts +0 -94
  299. package/codeAgent/agent/CodeAgent.ts +0 -606
  300. package/codeAgent/agent/CodeAgentAsks.ts +0 -66
  301. package/codeAgent/agent/CodeAgentEventMapper.ts +0 -225
  302. package/codeAgent/agent/CodeAgentGate.ts +0 -239
  303. package/codeAgent/agent/CodeAgentProxy.ts +0 -83
  304. package/codeAgent/agent/CodeAgentRpcHost.ts +0 -109
  305. package/codeAgent/agent/CodeAgentRpcListener.ts +0 -195
  306. package/codeAgent/agent/CodeAgentStreamPrinter.ts +0 -86
  307. package/codeAgent/agent/CodeAgentSuspended.ts +0 -85
  308. package/codeAgent/agent/CodeAgentUi.ts +0 -47
  309. package/codeAgent/agent/CodeMailbox.ts +0 -148
  310. package/codeAgent/agent/CodeSessionFork.ts +0 -56
  311. package/codeAgent/agent/CodeSessionIndex.ts +0 -78
  312. package/codeAgent/agent/SubagentPool.ts +0 -219
  313. package/codeAgent/agent/WorkspaceTrust.ts +0 -200
  314. package/codeAgent/agent/akanCodeCompaction.test.ts +0 -36
  315. package/codeAgent/agent/akanCodeModel.ts +0 -47
  316. package/codeAgent/agent/akanCodeServices.test.ts +0 -54
  317. package/codeAgent/agent/akanContextFiles.test.ts +0 -116
  318. package/codeAgent/agent/akanSystemPrompt.ts +0 -50
  319. package/codeAgent/agent/codeAgent.test.ts +0 -275
  320. package/codeAgent/agent/codeAgentContract.test.ts +0 -643
  321. package/codeAgent/agent/codeAgentHosts.ts +0 -30
  322. package/codeAgent/agent/codeAgentProxy.test.ts +0 -126
  323. package/codeAgent/agent/codeAgentRpcListener.test.ts +0 -215
  324. package/codeAgent/agent/codeAgentSuspended.test.ts +0 -47
  325. package/codeAgent/agent/codeMailbox.test.ts +0 -76
  326. package/codeAgent/agent/codeSessionFork.test.ts +0 -58
  327. package/codeAgent/agent/codeSessionIndex.test.ts +0 -77
  328. package/codeAgent/agent/consoleToStderr.ts +0 -8
  329. package/codeAgent/agent/jsonLines.ts +0 -29
  330. package/codeAgent/agent/stringArg.ts +0 -5
  331. package/codeAgent/feedback/DevLogFeedback.ts +0 -82
  332. package/codeAgent/feedback/PreviewFeedback.ts +0 -46
  333. package/codeAgent/feedback/TurnFeedback.ts +0 -98
  334. package/codeAgent/feedback/VerifyFeedback.ts +0 -39
  335. package/codeAgent/tools/AkanCli.ts +0 -51
  336. package/codeAgent/tools/AkanCodePlugins.ts +0 -142
  337. package/codeAgent/tools/AkanEditScope.ts +0 -53
  338. package/codeAgent/tools/AkanEnvKeys.ts +0 -50
  339. package/codeAgent/tools/AkanToolPack.ts +0 -86
  340. package/codeAgent/tools/AkanVerifier.ts +0 -30
  341. package/codeAgent/tools/AskToolPack.ts +0 -99
  342. package/codeAgent/tools/DeepSeekWeb.ts +0 -127
  343. package/codeAgent/tools/MailToolPack.ts +0 -76
  344. package/codeAgent/tools/McpClient.ts +0 -209
  345. package/codeAgent/tools/McpOAuth.ts +0 -233
  346. package/codeAgent/tools/McpOAuthLoopback.ts +0 -64
  347. package/codeAgent/tools/McpServerConfig.ts +0 -131
  348. package/codeAgent/tools/McpSignIn.ts +0 -158
  349. package/codeAgent/tools/McpTokenStore.ts +0 -128
  350. package/codeAgent/tools/McpToolPack.ts +0 -206
  351. package/codeAgent/tools/SessionToolPack.ts +0 -91
  352. package/codeAgent/tools/WebToolPack.ts +0 -315
  353. package/codeAgent/tools/akanCodePlugins.test.ts +0 -954
  354. package/codeAgent/tools/askToolPack.test.ts +0 -116
  355. package/codeAgent/tools/deepSeekWeb.test.ts +0 -113
  356. package/codeAgent/tools/mcpOAuth.test.ts +0 -648
  357. package/codeAgent/tools/mcpServerConfig.test.ts +0 -341
  358. package/piDependencyPins.test.ts +0 -45
@@ -0,0 +1,163 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import type { BunPlugin } from "bun";
4
+ import ts from "typescript";
5
+ import { VendorNarrowing } from "./vendorNarrowing";
6
+ import { VENDOR_SPECIFIERS, type VendorSpecifier } from "./vendorSpecifiers";
7
+
8
+ const scriptExtensions = [".ts", ".tsx", ".js", ".jsx"];
9
+ //? Only the vendor a page loaded twice: a file of another vendor reached by its path stays in the build, as before.
10
+ const fileVendors: readonly VendorSpecifier[] = ["akanjs/client"];
11
+
12
+ //? A route build bundles a file of a vendor package reached by its path, beside the copy the vendor carries and the
13
+ //? state that copy holds; a file the vendor's barrel re-exports whole, under the same names, comes from the vendor.
14
+ export class VendorFileImports {
15
+ readonly specifiers: readonly VendorSpecifier[];
16
+ readonly #akanjsRoots: readonly string[];
17
+ readonly #specifierByModule: ReadonlyMap<string, VendorSpecifier>;
18
+ readonly #realDirs = new Map<string, string>();
19
+
20
+ static async of(workspaceRoot: string): Promise<VendorFileImports> {
21
+ const akanServerPath = await VendorFileImports.#akanServerPath(workspaceRoot);
22
+ return akanServerPath
23
+ ? new VendorFileImports(path.dirname(akanServerPath), VendorFileImports.#shippedIn(akanServerPath))
24
+ : new VendorFileImports(null, VENDOR_SPECIFIERS);
25
+ }
26
+
27
+ static async specifiersIn(workspaceRoot: string): Promise<readonly VendorSpecifier[]> {
28
+ const akanServerPath = await VendorFileImports.#akanServerPath(workspaceRoot);
29
+ return akanServerPath ? VendorFileImports.#shippedIn(akanServerPath) : VENDOR_SPECIFIERS;
30
+ }
31
+
32
+ //? Only the vendors this akanjs ships an entry for: an older one has no `akanjs/client` vendor to import from.
33
+ static #shippedIn(akanServerPath: string): VendorSpecifier[] {
34
+ return VendorNarrowing.entriesIn(akanServerPath).map(({ specifier }) => specifier);
35
+ }
36
+
37
+ static async #akanServerPath(workspaceRoot: string): Promise<string | null> {
38
+ try {
39
+ return await VendorNarrowing.akanServerPath(workspaceRoot);
40
+ } catch {
41
+ return null;
42
+ }
43
+ }
44
+
45
+ constructor(akanjsRoot: string | null, specifiers: readonly VendorSpecifier[]) {
46
+ this.specifiers = specifiers;
47
+ this.#akanjsRoots = akanjsRoot ? [...new Set([path.resolve(akanjsRoot), fs.realpathSync(akanjsRoot)])] : [];
48
+ this.#specifierByModule = akanjsRoot ? this.#mapModules(akanjsRoot) : new Map();
49
+ }
50
+
51
+ #mapModules(akanjsRoot: string): Map<string, VendorSpecifier> {
52
+ const specifierByModule = new Map<string, VendorSpecifier>();
53
+ const packaged = this.specifiers.filter((specifier) => fileVendors.includes(specifier));
54
+ for (const specifier of packaged) {
55
+ const barrel = VendorFileImports.#fileOf(path.join(akanjsRoot, specifier.slice("akanjs/".length)));
56
+ if (!barrel) continue;
57
+ for (const file of [barrel, ...VendorFileImports.wholeReexports(barrel)])
58
+ for (const root of this.#akanjsRoots)
59
+ for (const key of VendorFileImports.#moduleKeys(path.join(root, path.relative(akanjsRoot, file))))
60
+ if (!specifierByModule.has(key)) specifierByModule.set(key, specifier);
61
+ }
62
+ return specifierByModule;
63
+ }
64
+
65
+ vendorOf(request: string, importer: string): VendorSpecifier | null {
66
+ const [akanjsRoot] = this.#akanjsRoots;
67
+ if (!akanjsRoot) return null;
68
+ const target = request.startsWith("akanjs/")
69
+ ? path.join(akanjsRoot, request.slice("akanjs/".length))
70
+ : request.startsWith(".") || path.isAbsolute(request)
71
+ ? path.resolve(path.dirname(importer), request)
72
+ : null;
73
+ if (!target) return null;
74
+ const extension = path.extname(target);
75
+ const module = scriptExtensions.includes(extension) ? target.slice(0, -extension.length) : target;
76
+ return this.#specifierByModule.get(module) ?? this.#specifierByModule.get(this.#realModule(module)) ?? null;
77
+ }
78
+
79
+ //? A linked install reaches akanjs through a symlink, so an entry's path need not be the one Bun resolved.
80
+ #realModule(module: string): string {
81
+ const dir = path.dirname(module);
82
+ let realDir = this.#realDirs.get(dir);
83
+ if (realDir === undefined) {
84
+ realDir = fs.existsSync(dir) ? fs.realpathSync(dir) : dir;
85
+ this.#realDirs.set(dir, realDir);
86
+ }
87
+ return path.join(realDir, path.basename(module));
88
+ }
89
+
90
+ //? A dynamic import stays a lazy chunk of the route build: `import("akanjs/client")` would load the whole vendor.
91
+ plugin(): BunPlugin {
92
+ return {
93
+ name: "akan-vendor-file-imports",
94
+ setup: (build) => {
95
+ build.onResolve({ filter: /^(\.|\/|akanjs\/)/ }, (args) => {
96
+ if (args.kind !== "import-statement" || !args.importer) return undefined;
97
+ const specifier = this.vendorOf(args.path, args.importer);
98
+ return specifier && specifier !== args.path ? { path: specifier, external: true } : undefined;
99
+ });
100
+ },
101
+ };
102
+ }
103
+
104
+ static wholeReexports(barrel: string): string[] {
105
+ const text = fs.readFileSync(barrel, "utf8");
106
+ const source = ts.createSourceFile(barrel, text, ts.ScriptTarget.Latest, false);
107
+ const sourceOfName = new Map<string, string | null>();
108
+ const starred = new Map<string, string | null>();
109
+ const files = new Set<string>();
110
+ for (const statement of source.statements) {
111
+ if (!ts.isExportDeclaration(statement) || statement.isTypeOnly) continue;
112
+ const { moduleSpecifier, exportClause } = statement;
113
+ if (!moduleSpecifier || !ts.isStringLiteral(moduleSpecifier)) continue;
114
+ const file = VendorFileImports.#fileOf(path.resolve(path.dirname(barrel), moduleSpecifier.text));
115
+ if (!file) continue;
116
+ files.add(file);
117
+ if (!exportClause) {
118
+ for (const name of VendorFileImports.#exportsOf(file) ?? [])
119
+ if (name !== "default") starred.set(name, starred.has(name) && starred.get(name) !== file ? null : file);
120
+ continue;
121
+ }
122
+ if (!ts.isNamedExports(exportClause)) continue;
123
+ for (const element of exportClause.elements) {
124
+ if (element.isTypeOnly) continue;
125
+ const exported = element.name.text;
126
+ sourceOfName.set(exported, (element.propertyName ?? element.name).text === exported ? file : null);
127
+ }
128
+ }
129
+ //? A name the barrel exports itself shadows the one an `export *` brings in, so no starred file owns it.
130
+ for (const name of VendorFileImports.#scannedExports(barrel, text))
131
+ if (!sourceOfName.has(name)) sourceOfName.set(name, null);
132
+ const sourceOf = (name: string) => (sourceOfName.has(name) ? sourceOfName.get(name) : starred.get(name)) ?? null;
133
+ return [...files].filter((file) => {
134
+ const names = VendorFileImports.#exportsOf(file);
135
+ return !!names && names.length > 0 && names.every((name) => sourceOf(name) === file);
136
+ });
137
+ }
138
+
139
+ //? `null` for a file that re-exports with `export *`: its names are not all in its own source.
140
+ static #exportsOf(file: string): string[] | null {
141
+ const source = fs.readFileSync(file, "utf8");
142
+ if (/^\s*export\s*\*/m.test(source)) return null;
143
+ return VendorFileImports.#scannedExports(file, source);
144
+ }
145
+
146
+ static #scannedExports(file: string, source: string): string[] {
147
+ const loader = file.endsWith(".tsx") || file.endsWith(".jsx") ? "tsx" : "ts";
148
+ return new Bun.Transpiler({ loader }).scan(source).exports;
149
+ }
150
+
151
+ static #fileOf(base: string): string | null {
152
+ for (const candidate of [...scriptExtensions.map((ext) => `${base}${ext}`), path.join(base, "index.ts")])
153
+ if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return candidate;
154
+ return null;
155
+ }
156
+
157
+ static #moduleKeys(file: string): string[] {
158
+ const withoutExtension = file.slice(0, -path.extname(file).length);
159
+ return path.basename(withoutExtension) === "index"
160
+ ? [withoutExtension, path.dirname(withoutExtension)]
161
+ : [withoutExtension];
162
+ }
163
+ }
@@ -9,6 +9,8 @@ const makeTempRoot = tempDirs("akan-vendor-narrowing-");
9
9
  const akanjsRoot = path.resolve(import.meta.dir, "../../../akanjs");
10
10
  const vendorFile = (name: string) => path.join(akanjsRoot, "server/vendor", `${name}.ts`);
11
11
  const agentOnlyText = "path must be an internal path starting with /.";
12
+ const formFieldsText = "does not take null.";
13
+ const fieldToolsText = "Leaves every existing row untouched.";
12
14
 
13
15
  const staticClosure = (absPath: string, seen = new Set<string>()): Set<string> => {
14
16
  if (seen.has(absPath)) return seen;
@@ -42,7 +44,11 @@ const buildVendors = async (storeNames: string[], plugins: Awaited<ReturnType<Ve
42
44
  if (!output) throw new Error(`no ${name}.js output`);
43
45
  return output.path;
44
46
  };
45
- return { store: closureText(outputOf("store")), agent: closureText(outputOf("agent")) };
47
+ return {
48
+ store: closureText(outputOf("store")),
49
+ agent: closureText(outputOf("agent")),
50
+ all: result.outputs.map((output) => readFileSync(output.path, "utf8")).join("\n"),
51
+ };
46
52
  };
47
53
 
48
54
  describe("VendorNarrowing", () => {
@@ -58,8 +64,9 @@ describe("VendorNarrowing", () => {
58
64
  ).toEqual({ "/v/akanjs-store.ts": ["st"], "/v/akanjs-base.ts": [] });
59
65
  });
60
66
 
61
- test("keeps the deprecated agent re-export when a route imports one of its names, or reads the store whole", async () => {
62
- expect(await new VendorNarrowing(akanjsRoot, { "akanjs/store": ["AgentContext", "st"] }).plugins()).toEqual([]);
67
+ test("keeps each blankable re-export when a route imports one of its names, or reads the store whole", async () => {
68
+ const names = ["AgentContext", "FormFields", "st"];
69
+ expect(await new VendorNarrowing(akanjsRoot, { "akanjs/store": names }).plugins()).toEqual([]);
63
70
  expect(await new VendorNarrowing(akanjsRoot, {}).plugins()).toEqual([]);
64
71
  });
65
72
 
@@ -74,6 +81,29 @@ describe("VendorNarrowing", () => {
74
81
  expect(agent).toContain(agentOnlyText);
75
82
  }, 60_000);
76
83
 
84
+ test("a store vendor no route reads `FormFields` from loads the field tools only through a dynamic import", async () => {
85
+ const names = ["StoreRegistry", "store", "useFieldTool"];
86
+ const { store, all } = await buildVendors(
87
+ names,
88
+ await new VendorNarrowing(akanjsRoot, { "akanjs/store": names }).plugins(),
89
+ );
90
+
91
+ expect(store).not.toContain(formFieldsText);
92
+ expect(store).not.toContain(fieldToolsText);
93
+ expect(all).toContain(fieldToolsText);
94
+ }, 60_000);
95
+
96
+ test("a route that names `FormFields` keeps it in the store vendor, and the field tools still load apart", async () => {
97
+ const names = ["FormFields", "StoreRegistry", "store"];
98
+ const { store } = await buildVendors(
99
+ names,
100
+ await new VendorNarrowing(akanjsRoot, { "akanjs/store": names }).plugins(),
101
+ );
102
+
103
+ expect(store).toContain(formFieldsText);
104
+ expect(store).not.toContain(fieldToolsText);
105
+ }, 60_000);
106
+
77
107
  test("without the blanking, the deprecated re-export drags the agent runtime into the store vendor", async () => {
78
108
  const { store } = await buildVendors(["StoreRegistry", "store"], []);
79
109
 
@@ -95,6 +125,20 @@ describe("VendorNarrowing", () => {
95
125
  );
96
126
  });
97
127
 
128
+ test("an akanjs from before the lazy field tools has nothing there to blank but its deprecated re-export", async () => {
129
+ const root = await makeTempRoot();
130
+ await write(path.join(root, "store/deprecatedAgent.ts"), 'export { AgentContext } from "./agent";\n');
131
+ await write(path.join(root, "store/agentic/formFields.ts"), "export class FormFields {}\n");
132
+
133
+ const [plugin, ...rest] = await new VendorNarrowing(root, { "akanjs/store": ["st"] }).plugins();
134
+ const filters: RegExp[] = [];
135
+ void plugin?.setup({ onLoad: ({ filter }: { filter: RegExp }) => void filters.push(filter) } as never);
136
+
137
+ expect(rest).toEqual([]);
138
+ expect(filters.map((filter) => filter.test("/w/node_modules/akanjs/store/deprecatedAgent.ts"))).toEqual([true]);
139
+ expect(filters.map((filter) => filter.test("/w/node_modules/akanjs/store/agentic/formFields.ts"))).toEqual([false]);
140
+ });
141
+
98
142
  test("an alias narrowed to no names still loads its entry, so the entry's side effects run", () => {
99
143
  expect(ClientEntriesBundler.narrowedAliasSource("/v/akanjs-fetch.ts", [])).toBe(
100
144
  `export {} from ${JSON.stringify(path.resolve("/v/akanjs-fetch.ts"))};\n`,
@@ -6,6 +6,10 @@ import { VENDOR_SPECIFIERS, type VendorSpecifier } from "./vendorSpecifiers";
6
6
  //? Bun puts a module in the chunk of every entry that reaches it, read or not, so a deprecated re-export would keep
7
7
  //? its target in a vendor every page loads; a narrowed build blanks it unless a route imports one of its names.
8
8
  const deprecatedReexports: Partial<Record<VendorSpecifier, string>> = { "akanjs/store": "store/deprecatedAgent.ts" };
9
+ //? Blanked the same way, but kept out of the guard below: an akanjs older than the lazy field tools lacks the file.
10
+ const lazyReexports: Partial<Record<VendorSpecifier, string>> = {
11
+ "akanjs/store": "store/agentic/formFieldsReexport.ts",
12
+ };
9
13
 
10
14
  export interface VendorEntry {
11
15
  specifier: VendorSpecifier;
@@ -16,6 +20,34 @@ export class VendorNarrowing {
16
20
  readonly #akanjsRoot: string;
17
21
  readonly #vendorExports: Partial<Record<VendorSpecifier, readonly string[]>>;
18
22
 
23
+ static async akanServerPath(workspaceRoot: string): Promise<string> {
24
+ const candidates: string[] = [];
25
+ try {
26
+ candidates.push(path.dirname(Bun.resolveSync("akanjs/server", workspaceRoot)));
27
+ } catch {
28
+ // Source workspaces and bundled CLI execution have different resolution roots; try explicit candidates below.
29
+ }
30
+ candidates.push(
31
+ path.join(workspaceRoot, "pkgs/akanjs/server"),
32
+ path.join(workspaceRoot, "node_modules/akanjs/server"),
33
+ );
34
+ try {
35
+ candidates.push(path.dirname(Bun.resolveSync("akanjs/server", path.dirname(Bun.main))));
36
+ } catch {
37
+ // Published CLI installs may hoist dependencies differently; explicit Bun.main candidates cover that.
38
+ }
39
+ candidates.push(
40
+ path.join(path.dirname(Bun.main), "node_modules/akanjs/server"),
41
+ path.join(path.dirname(Bun.main), "../../akanjs/server"),
42
+ path.resolve(import.meta.dir, "../../server"),
43
+ path.resolve(import.meta.dir, "../server"),
44
+ );
45
+ for (const candidate of candidates) {
46
+ if (await Bun.file(path.join(candidate, "rscClient.tsx")).exists()) return candidate;
47
+ }
48
+ throw new Error(`[base-artifact] failed to locate akanjs/server; looked in: ${candidates.join(", ")}`);
49
+ }
50
+
19
51
  //? A devkit newer than the installed akanjs finds no agent vendor or deprecated re-export there, and builds that
20
52
  //? akanjs's vendors whole, as the devkit it shipped with did.
21
53
  static entriesIn(akanServerPath: string): VendorEntry[] {
@@ -42,9 +74,13 @@ export class VendorNarrowing {
42
74
 
43
75
  async plugins(): Promise<BunPlugin[]> {
44
76
  const blanked: string[] = [];
45
- for (const [specifier, file] of Object.entries(deprecatedReexports) as [VendorSpecifier, string][]) {
77
+ const reexports = [...Object.entries(deprecatedReexports), ...Object.entries(lazyReexports)] as [
78
+ VendorSpecifier,
79
+ string,
80
+ ][];
81
+ for (const [specifier, file] of reexports) {
46
82
  const used = this.#vendorExports[specifier];
47
- if (!used) continue;
83
+ if (!used || !fs.existsSync(path.join(this.#akanjsRoot, file))) continue;
48
84
  const source = await Bun.file(path.join(this.#akanjsRoot, file)).text();
49
85
  const names = new Bun.Transpiler({ loader: "ts" }).scan(source).exports;
50
86
  if (!names.some((name) => used.includes(name))) blanked.push(`akanjs/${file}`);
@@ -10,6 +10,7 @@ export const VENDOR_SPECIFIERS = [
10
10
  "akanjs/store",
11
11
  "akanjs/store/agent",
12
12
  "akanjs/base",
13
+ "akanjs/client",
13
14
  "akanjs/common",
14
15
  "akanjs/constant",
15
16
  "akanjs/fetch",
@@ -24,6 +25,7 @@ export const NARROWABLE_VENDOR_SPECIFIERS = [
24
25
  "akanjs/store",
25
26
  "akanjs/store/agent",
26
27
  "akanjs/base",
28
+ "akanjs/client",
27
29
  "akanjs/common",
28
30
  "akanjs/constant",
29
31
  "akanjs/fetch",
@@ -54,7 +54,7 @@ export class AgentAssets {
54
54
  "framework",
55
55
  ],
56
56
  "akan-err": ["errorCodes"],
57
- "akan-deps": [],
57
+ "akan-deps": ["syncRule"],
58
58
  "akan-debug": [],
59
59
  "akan-page": ["pageRule", "akanApi#imports", "akanApi#routes", "akanApi#app-config"],
60
60
  "akan-query": ["queryRule"],
@@ -1,10 +1,13 @@
1
1
  import path from "node:path";
2
- import { ApplicationBuildReporter } from "@akanjs/devkit/app/applicationBuildReporter";
3
- import { resolveSsrPageEntriesForApp } from "@akanjs/devkit/artifact/implicitRootLayout";
4
- import { computeRouteSeedIndex, saveRouteSeedIndex } from "@akanjs/devkit/artifact/routeSeedIndex";
5
- import type { App } from "@akanjs/devkit/commandDecorators";
2
+ import { Logger } from "akanjs/common";
3
+ import type { BaseBuildArtifact, BuilderMessage, BuildPhase, HmrTrace } from "akanjs/server";
4
+ import { resolveDevCsrMode } from "akanjs/server/hmr/csrDevManifest";
5
+ import { ApplicationBuildReporter } from "../app/applicationBuildReporter";
6
+ import { resolveSsrPageEntriesForApp } from "../artifact/implicitRootLayout";
7
+ import { computeRouteSeedIndex, saveRouteSeedIndex } from "../artifact/routeSeedIndex";
8
+ import type { App } from "../commandDecorators";
6
9
  // Subpath imports only, as few as possible: spawned per generation, this process pays every import on every save.
7
- import { AppExecutor, WorkspaceExecutor } from "@akanjs/devkit/executors";
10
+ import { AppExecutor, WorkspaceExecutor } from "../executors";
8
11
  import {
9
12
  CsrArtifactBuilder,
10
13
  CsrDevBundler,
@@ -14,10 +17,7 @@ import {
14
17
  ServerGraphFile,
15
18
  SsrBaseArtifactBuilder,
16
19
  SsrDevBundler,
17
- } from "@akanjs/devkit/frontendBuild";
18
- import { Logger } from "akanjs/common";
19
- import type { BuilderMessage, BuildPhase, HmrTrace } from "akanjs/server";
20
- import { resolveDevCsrMode } from "akanjs/server/hmr/csrDevManifest";
20
+ } from "../frontendBuild";
21
21
  import type { BuildBatchRequest, BuildBatchResult, OptimizedFonts, PagesBatchCssAssets } from "./buildBatchProtocol";
22
22
 
23
23
  // `Bun.build` keeps native bundler arenas that `Bun.gc(true)` cannot reclaim; only exiting returns them.
@@ -202,8 +202,12 @@ class BuildBatch {
202
202
  const pageEntries = await resolveSsrPageEntriesForApp(this.#app, await this.#app.getPageKeys());
203
203
  const seedIndex = computeRouteSeedIndex(pageEntries);
204
204
  const previousGraph = await ServerGraphFile.read(this.#request.artifactDir);
205
+ const dictionaries = this.#request.metadata
206
+ ? await new SsrBaseArtifactBuilder(this.#app).buildDictionaries()
207
+ : null;
205
208
  const next = await new PagesBundleBuilder(this.#app, "start", pageEntries).build();
206
209
  await saveRouteSeedIndex(this.#request.artifactDir, seedIndex);
210
+ if (dictionaries) await this.#rewriteBaseArtifact(next, dictionaries);
207
211
  const nextGraph = await ServerGraphFile.read(this.#request.artifactDir);
208
212
  const serverTouched = await ServerGraphFile.touches(
209
213
  previousGraph,
@@ -232,6 +236,28 @@ class BuildBatch {
232
236
  }
233
237
  }
234
238
 
239
+ //? Before `pages-updated` and the pages status: the dev host restarts the backend on that status, and the backend
240
+ //? reads this file once, at its boot.
241
+ async #rewriteBaseArtifact(
242
+ pages: { bundlePath: string; buildId: number },
243
+ { assets, routes, groups }: Awaited<ReturnType<SsrBaseArtifactBuilder["buildDictionaries"]>>,
244
+ ): Promise<void> {
245
+ const artifactPath = path.join(this.#request.artifactDir, "base-artifact.json");
246
+ const { dictRoutes, dictGroups, ...artifact } = (await Bun.file(artifactPath).json()) as BaseBuildArtifact;
247
+ await SsrBaseArtifactBuilder.writeArtifact(this.#request.artifactDir, {
248
+ ...artifact,
249
+ cssAssets: this.#result.cssAssets ?? this.#request.cssAssets ?? artifact.cssAssets,
250
+ dictAssets: assets,
251
+ ...(routes ? { dictRoutes: routes } : {}),
252
+ ...(groups ? { dictGroups: groups } : {}),
253
+ pagesBundlePath: pages.bundlePath,
254
+ pagesBundleBuildId: pages.buildId,
255
+ });
256
+ this.#logger.verbose(
257
+ `base-artifact rewritten for ${this.#request.metadata?.length ?? 0} metadata file(s) buildId=${pages.buildId}`,
258
+ );
259
+ }
260
+
235
261
  async #buildCss(): Promise<void> {
236
262
  const started = Date.now();
237
263
  try {
@@ -1,5 +1,5 @@
1
- import type { FontOptimizer } from "@akanjs/devkit/frontendBuild";
2
1
  import type { BaseBuildArtifact, CssPayload, HmrTrace, PagesBundlePayload } from "akanjs/server";
2
+ import type { FontOptimizer } from "../frontendBuild";
3
3
 
4
4
  export type OptimizedFonts = Awaited<ReturnType<FontOptimizer["optimize"]>>;
5
5
 
@@ -20,6 +20,7 @@ export interface BuildBatchRequest {
20
20
  cssAssets: PagesBatchCssAssets | null; // an unchanged compile skips the broadcast instead of busting hashes
21
21
  artifactDir: string;
22
22
  trace?: HmrTrace;
23
+ metadata?: string[]; // signal and dictionary saves no batch has built green yet; `pages` batches only
23
24
  }
24
25
 
25
26
  export type BatchWork = Pick<BuildBatchRequest, "generation" | "needs" | "changedFiles" | "trace">;
@@ -1,11 +1,11 @@
1
1
  import path from "node:path";
2
- import type { App } from "@akanjs/devkit/commandDecorators";
3
- import type { ClientEntryDiscovery } from "@akanjs/devkit/frontendBuild/clientBuildTypes";
4
- import { GraphClientEntryDiscovery } from "@akanjs/devkit/frontendBuild/clientEntryDiscovery";
5
- import { HmrWatcher } from "@akanjs/devkit/frontendBuild/hmrWatcher";
6
- import { WatchRootResolver } from "@akanjs/devkit/frontendBuild/watchRootResolver";
7
2
  import type { Logger } from "akanjs/common";
8
3
  import type { BaseBuildArtifact } from "akanjs/server";
4
+ import type { App } from "../commandDecorators";
5
+ import type { ClientEntryDiscovery } from "../frontendBuild/clientBuildTypes";
6
+ import { GraphClientEntryDiscovery } from "../frontendBuild/clientEntryDiscovery";
7
+ import { HmrWatcher } from "../frontendBuild/hmrWatcher";
8
+ import { WatchRootResolver } from "../frontendBuild/watchRootResolver";
9
9
  import type { OptimizedFonts } from "./buildBatchProtocol";
10
10
  import type { BuildBatchRunner } from "./buildBatchRunner";
11
11
  import { BuilderChannel } from "./builderChannel";
@@ -1,8 +1,8 @@
1
- import type { App } from "@akanjs/devkit/commandDecorators";
2
- import { FrameworkGraph } from "@akanjs/devkit/docs/frameworkGraph";
3
- import { GitRevision } from "@akanjs/devkit/workspace/gitRevision";
4
- import { WorkspaceGraph } from "@akanjs/devkit/workspace/workspaceGraph";
5
1
  import type { BuildChangesPayload, BuilderGraphReq, BuildFrameworkPayload, BuildGraphPayload } from "akanjs/server";
2
+ import type { App } from "../commandDecorators";
3
+ import { FrameworkGraph } from "../docs/frameworkGraph";
4
+ import { GitRevision } from "../workspace/gitRevision";
5
+ import { WorkspaceGraph } from "../workspace/workspaceGraph";
6
6
 
7
7
  export class BuilderGraphPayloads {
8
8
  readonly #app: App;
@@ -1,6 +1,6 @@
1
- import { ApplicationBuildReporter } from "@akanjs/devkit/app/applicationBuildReporter";
2
- import type { App } from "@akanjs/devkit/commandDecorators";
3
1
  import type { Logger } from "akanjs/common";
2
+ import { ApplicationBuildReporter } from "../app/applicationBuildReporter";
3
+ import type { App } from "../commandDecorators";
4
4
  import type { BatchWork, BuildBatchResult } from "./buildBatchProtocol";
5
5
  import { sendBuildStatus } from "./builderBuildStatus";
6
6
  import { BuilderChannel } from "./builderChannel";
@@ -1,14 +1,15 @@
1
1
  import path from "node:path";
2
- import type { App } from "@akanjs/devkit/commandDecorators";
3
- import type { PageRoot } from "@akanjs/devkit/executors";
4
- import { AutoImportSync } from "@akanjs/devkit/frontendBuild/autoImportSync";
5
- import { DevChangePlanner } from "@akanjs/devkit/frontendBuild/devChangePlanner";
6
- import { DevGeneratedIndexSync } from "@akanjs/devkit/frontendBuild/devGeneratedIndexSync";
7
- import { HmrWatcher } from "@akanjs/devkit/frontendBuild/hmrWatcher";
8
- import { WatchRootResolver } from "@akanjs/devkit/frontendBuild/watchRootResolver";
9
- import { CodegenLock } from "@akanjs/devkit/workspace/codegenLock";
10
2
  import type { Logger } from "akanjs/common";
11
3
  import type { ChangeBatch } from "akanjs/server";
4
+ import { runtimeMetadataFilesOf } from "../akanApp/devHostPolicy";
5
+ import type { App } from "../commandDecorators";
6
+ import type { PageRoot } from "../executors";
7
+ import { AutoImportSync } from "../frontendBuild/autoImportSync";
8
+ import { DevChangePlanner } from "../frontendBuild/devChangePlanner";
9
+ import { DevGeneratedIndexSync } from "../frontendBuild/devGeneratedIndexSync";
10
+ import { HmrWatcher } from "../frontendBuild/hmrWatcher";
11
+ import { WatchRootResolver } from "../frontendBuild/watchRootResolver";
12
+ import { CodegenLock } from "../workspace/codegenLock";
12
13
  import type { BuildBatchNeed } from "./buildBatchProtocol";
13
14
  import { sendBuildStatus } from "./builderBuildStatus";
14
15
  import { BuilderChannel } from "./builderChannel";
@@ -17,6 +18,7 @@ import type { BuilderLanes } from "./builderLanes";
17
18
  import type { BatchJob, DiscoveryJob } from "./builderWorkQueue";
18
19
  import type { CsrRegistry } from "./csrRegistry";
19
20
  import { prepareDevWatchBatch } from "./devWatchBatch";
21
+ import type { PendingMetadata } from "./pendingMetadata";
20
22
  import type { SsrRegistry } from "./ssrRegistry";
21
23
 
22
24
  interface BuilderWatchParts {
@@ -25,6 +27,7 @@ interface BuilderWatchParts {
25
27
  csr: CsrRegistry;
26
28
  ssr: SsrRegistry;
27
29
  graphPayloads: BuilderGraphPayloads;
30
+ metadata: PendingMetadata;
28
31
  }
29
32
 
30
33
  interface BuilderWatchLinks {
@@ -39,6 +42,7 @@ export class BuilderWatch {
39
42
  readonly #csr: CsrRegistry;
40
43
  readonly #ssr: SsrRegistry;
41
44
  readonly #graphPayloads: BuilderGraphPayloads;
45
+ readonly #metadata: PendingMetadata;
42
46
  readonly #links: BuilderWatchLinks;
43
47
  #changePlanner: DevChangePlanner;
44
48
  #generatedIndexSync: DevGeneratedIndexSync;
@@ -46,13 +50,18 @@ export class BuilderWatch {
46
50
  #watcher: HmrWatcher | null = null;
47
51
  #barrelFailed = false;
48
52
 
49
- constructor(app: App, { logger, lanes, csr, ssr, graphPayloads }: BuilderWatchParts, links: BuilderWatchLinks) {
53
+ constructor(
54
+ app: App,
55
+ { logger, lanes, csr, ssr, graphPayloads, metadata }: BuilderWatchParts,
56
+ links: BuilderWatchLinks,
57
+ ) {
50
58
  this.#app = app;
51
59
  this.#logger = logger;
52
60
  this.#lanes = lanes;
53
61
  this.#csr = csr;
54
62
  this.#ssr = ssr;
55
63
  this.#graphPayloads = graphPayloads;
64
+ this.#metadata = metadata;
56
65
  this.#links = links;
57
66
  this.#changePlanner = new DevChangePlanner({ workspaceRoot: app.workspace.workspaceRoot });
58
67
  this.#generatedIndexSync = new DevGeneratedIndexSync({ workspaceRoot: app.workspace.workspaceRoot });
@@ -131,6 +140,7 @@ export class BuilderWatch {
131
140
  indexSync,
132
141
  changePlanner: this.#changePlanner,
133
142
  });
143
+ this.#metadata.note(runtimeMetadataFilesOf(devPlan), generation);
134
144
  this.#logger.verbose(
135
145
  `[hmr] batch generation=${generation} kinds=${kinds.join(",")} files=${files.length} generated=${indexSync.changedFiles.length} roles=${devPlan.roles.join(",") || "(none)"} actions=${devPlan.actions.join(",") || "(none)"}`,
136
146
  );
@@ -1,12 +1,12 @@
1
1
  import { rm } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { ApplicationBuildReporter } from "@akanjs/devkit/app/applicationBuildReporter";
4
- import type { App } from "@akanjs/devkit/commandDecorators";
5
- import { CsrDevBundler } from "@akanjs/devkit/frontendBuild/csrDevBundler";
6
- import { CsrDevPatcher } from "@akanjs/devkit/frontendBuild/csrDevPatcher";
7
3
  import type { Logger } from "akanjs/common";
8
4
  import type { BaseBuildArtifact, BuilderCsrReq, HmrTrace } from "akanjs/server";
9
5
  import { CSR_DEV_PATCHING_MARKER } from "akanjs/server/hmr/csrDevManifest";
6
+ import { ApplicationBuildReporter } from "../app/applicationBuildReporter";
7
+ import type { App } from "../commandDecorators";
8
+ import { CsrDevBundler } from "../frontendBuild/csrDevBundler";
9
+ import { CsrDevPatcher } from "../frontendBuild/csrDevPatcher";
10
10
  import type { BatchWork, BuildBatchRequest } from "./buildBatchProtocol";
11
11
  import type { BuildBatchRunner } from "./buildBatchRunner";
12
12
  import { isCompileError, sendBuildStatus } from "./builderBuildStatus";