@akanjs/devkit 3.3.0-rc.4 → 3.3.0-rc.40

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 (250) hide show
  1. package/CHANGELOG.md +618 -0
  2. package/DEV_RUNTIME_KNOBS.md +1 -1
  3. package/README.ko.md +3 -2
  4. package/README.md +3 -3
  5. package/akanApp/akanApp.host.test.ts +1 -1
  6. package/akanApp/akanApp.host.ts +11 -0
  7. package/akanConfig/akanBin.ts +4 -0
  8. package/akanConfig/akanConfig.test.ts +66 -7
  9. package/akanConfig/akanConfig.ts +53 -204
  10. package/akanConfig/akanWorkers.test.ts +39 -0
  11. package/akanConfig/akanWorkers.ts +32 -0
  12. package/akanConfig/desktopServerConfig.ts +96 -0
  13. package/akanConfig/dockerImage.ts +37 -0
  14. package/akanConfig/nativeKeys.ts +52 -0
  15. package/akanConfig/types.ts +1 -0
  16. package/app/appBin.test.ts +63 -0
  17. package/app/appBin.ts +50 -0
  18. package/app/applicationBuildReporter.test.ts +32 -0
  19. package/app/applicationBuildReporter.ts +4 -0
  20. package/app/applicationBuildRunner.test.ts +275 -0
  21. package/app/applicationBuildRunner.ts +133 -6
  22. package/app/dictionarySizes.ts +91 -0
  23. package/app/routeFilesReport.test.ts +59 -0
  24. package/app/routeFilesReport.ts +46 -0
  25. package/app/routeJsBudget.ts +18 -4
  26. package/artifact/implicitRootLayout.test.ts +19 -0
  27. package/artifact/implicitRootLayout.ts +16 -2
  28. package/artifact/implicitRootLayoutRender.test.tsx +4 -1
  29. package/artifact/storeBootstrap.test.ts +28 -0
  30. package/artifact/storeBootstrap.ts +64 -8
  31. package/biome.base.json +6 -4
  32. package/codeAgent/agent/CodeAgent.ts +36 -16
  33. package/codeAgent/agent/CodeAgentAllowed.ts +35 -0
  34. package/codeAgent/agent/CodeAgentCommandLine.ts +372 -0
  35. package/codeAgent/agent/CodeAgentGate.ts +23 -4
  36. package/codeAgent/agent/CodeAgentRpcHost.ts +1 -1
  37. package/codeAgent/agent/codeAgent.test.ts +62 -0
  38. package/codeAgent/agent/codeAgentCommandLine.test.ts +212 -0
  39. package/codeAgent/agent/codeAgentContract.test.ts +117 -5
  40. package/codeAgent/skills/akan-agent/SKILL.md +8 -1
  41. package/codeAgent/skills/akan-code/SKILL.md +38 -3
  42. package/codeAgent/skills/akan-deps/SKILL.md +3 -2
  43. package/codeAgent/skills/akan-err/SKILL.md +13 -8
  44. package/codeAgent/skills/akan-mcp/SKILL.md +1 -1
  45. package/codeAgent/skills/akan-module/SKILL.md +2 -2
  46. package/codeAgent/skills/akan-page/SKILL.md +31 -20
  47. package/codeAgent/skills/akan-query/SKILL.md +13 -20
  48. package/codeAgent/skills/akan-runtime/SKILL.md +20 -0
  49. package/codeAgent/skills/akan-service/SKILL.md +2 -5
  50. package/codeAgent/skills/akan-transport/SKILL.md +5 -14
  51. package/codeAgent/skills/akan-ui/SKILL.md +2 -5
  52. package/context/akanContext.ts +2 -0
  53. package/docs/apiReference.test.ts +9 -0
  54. package/docs/apiReference.ts +14 -0
  55. package/executors/appExecutor.ts +3 -1
  56. package/executors/clientRuntimeKeyOrder.fixture.json +682 -0
  57. package/executors/clientRuntimeKeys.fixture.json +393 -0
  58. package/executors/clientRuntimeKeys.test.ts +1690 -0
  59. package/executors/executors.test.ts +2 -0
  60. package/executors/sysExecutor.ts +70 -4
  61. package/executors/workspaceExecutor.ts +7 -4
  62. package/frontendBuild/allRoutesBuilder.ts +88 -7
  63. package/frontendBuild/autoImportSync.ts +3 -2
  64. package/frontendBuild/buildRouteClient.test.ts +580 -12
  65. package/frontendBuild/clientBuildTypes.ts +26 -0
  66. package/frontendBuild/clientEntriesBundler.ts +49 -1
  67. package/frontendBuild/clientEntryDiscovery.test.ts +308 -1
  68. package/frontendBuild/clientEntryDiscovery.ts +135 -13
  69. package/frontendBuild/csrDevModuleCompiler.test.ts +86 -0
  70. package/frontendBuild/csrDevModuleCompiler.ts +44 -8
  71. package/frontendBuild/csrDevPatcher.ts +33 -7
  72. package/frontendBuild/csrDevTypes.ts +9 -0
  73. package/frontendBuild/devBarrelImports.test.ts +154 -0
  74. package/frontendBuild/devBarrelImports.ts +83 -23
  75. package/frontendBuild/devRegistryBundler.ts +4 -2
  76. package/frontendBuild/devRouteRuntime.test.ts +492 -0
  77. package/frontendBuild/devRouteRuntime.ts +167 -0
  78. package/frontendBuild/dictionaryAssetBuilder.test.ts +324 -0
  79. package/frontendBuild/dictionaryAssetBuilder.ts +165 -16
  80. package/frontendBuild/dictionaryConstants.ts +136 -0
  81. package/frontendBuild/dictionaryPacking.test.ts +142 -0
  82. package/frontendBuild/dictionaryPacking.ts +135 -0
  83. package/frontendBuild/dictionaryRoutes.test.ts +251 -0
  84. package/frontendBuild/dictionaryRoutes.ts +227 -0
  85. package/frontendBuild/pagesBundleBuilder.test.ts +84 -0
  86. package/frontendBuild/pagesBundleBuilder.ts +81 -3
  87. package/frontendBuild/precompressArtifacts.test.ts +22 -0
  88. package/frontendBuild/precompressArtifacts.ts +22 -8
  89. package/frontendBuild/registryMetadataFingerprint.ts +3 -3
  90. package/frontendBuild/renderedEntries.ts +144 -0
  91. package/frontendBuild/routeClientBuilder.ts +340 -29
  92. package/frontendBuild/routeHandoffs.test.ts +155 -0
  93. package/frontendBuild/routeHandoffs.ts +117 -0
  94. package/frontendBuild/routeModulePreloads.test.ts +32 -0
  95. package/frontendBuild/routeModulePreloads.ts +20 -11
  96. package/frontendBuild/routeRuntimeCheck.test.ts +280 -0
  97. package/frontendBuild/routeRuntimeCheck.ts +248 -0
  98. package/frontendBuild/routeRuntimePays.test.ts +143 -0
  99. package/frontendBuild/routeRuntimePays.ts +117 -0
  100. package/frontendBuild/rscServerRendererGuard.test.ts +60 -0
  101. package/frontendBuild/rscServerRendererGuard.ts +68 -0
  102. package/frontendBuild/ssrBaseArtifactBuilder.ts +24 -34
  103. package/frontendBuild/ssrDevBundler.test.ts +150 -1
  104. package/frontendBuild/ssrDevBundler.ts +66 -11
  105. package/frontendBuild/vendorFileImports.test.ts +254 -0
  106. package/frontendBuild/vendorFileImports.ts +163 -0
  107. package/frontendBuild/vendorNarrowing.ts +28 -0
  108. package/frontendBuild/vendorSpecifiers.ts +2 -0
  109. package/incrementalBuilder/buildBatch.proc.ts +9 -9
  110. package/incrementalBuilder/buildBatchProtocol.ts +1 -1
  111. package/incrementalBuilder/builderBoot.ts +5 -5
  112. package/incrementalBuilder/builderGraphPayloads.ts +4 -4
  113. package/incrementalBuilder/builderLanes.ts +2 -2
  114. package/incrementalBuilder/builderWatch.ts +8 -8
  115. package/incrementalBuilder/csrRegistry.ts +4 -4
  116. package/incrementalBuilder/incrementalBuilder.proc.test.ts +79 -0
  117. package/incrementalBuilder/incrementalBuilder.proc.ts +27 -8
  118. package/incrementalBuilder/ssrRegistry.ts +6 -6
  119. package/index.ts +1 -1
  120. package/integration/renderAdmissionSoak.test.ts +99 -0
  121. package/integration/renderAdmissionSoak.ts +609 -0
  122. package/lint/__fixtures__/no-arbitrary-color/every-color-function/bad.tsx +11 -0
  123. package/lint/__fixtures__/no-arbitrary-color/every-color-function/good.tsx +2 -0
  124. package/lint/__fixtures__/no-daisyui-legacy-class/every-class/bad.tsx +34 -0
  125. package/lint/__fixtures__/no-daisyui-legacy-class/every-class/good.tsx +2 -0
  126. package/lint/__fixtures__/no-inline-color/every-color-function/bad.tsx +10 -0
  127. package/lint/__fixtures__/no-inline-color/every-color-function/good.tsx +2 -0
  128. package/lint/__fixtures__/no-raw-palette-class/every-palette/bad.tsx +22 -0
  129. package/lint/__fixtures__/no-raw-palette-class/every-palette/good.tsx +2 -0
  130. package/lint/biomeBase.test.ts +23 -3
  131. package/lint/biomeCheck.test.ts +145 -0
  132. package/lint/biomeCheck.ts +131 -0
  133. package/lint/no-arbitrary-color.grit +5 -0
  134. package/lint/no-conditional-st-hook.grit +5 -1
  135. package/lint/no-daisyui-legacy-class.grit +8 -0
  136. package/lint/no-document-cookie.grit +3 -0
  137. package/lint/no-inline-color.grit +10 -2
  138. package/lint/no-oversized-list-limit.grit +2 -0
  139. package/lint/no-raw-palette-class.grit +7 -0
  140. package/lint/no-unpublished-form-setter.grit +2 -0
  141. package/lint/no-web-only-api-outside-webkit.grit +5 -0
  142. package/lint/no-web-storage.grit +3 -0
  143. package/lint/withheldEnvFile.ts +17 -0
  144. package/mobile/desktopBin.ts +2 -2
  145. package/mobile/desktopServerStage.ts +1 -0
  146. package/mobile/nativeApp.test.ts +7 -5
  147. package/mobile/nativeApp.ts +2 -2
  148. package/mobile/nativeConfig.test.ts +96 -1
  149. package/mobile/nativeConfig.ts +46 -12
  150. package/mobile/serverBundleSecrets.ts +43 -0
  151. package/package.json +15 -169
  152. package/packageExports.test.ts +38 -24
  153. package/quality/dictionaryKeys.test.ts +356 -0
  154. package/quality/dictionaryKeys.ts +488 -0
  155. package/quality/objectImportReport.test.ts +36 -0
  156. package/quality/objectImportReport.ts +105 -0
  157. package/quality/qualityScanner.ts +1 -1
  158. package/quality/routeRuntimeReport.test.ts +91 -0
  159. package/quality/routeRuntimeReport.ts +121 -0
  160. package/quality/runtimeConstantFacts.ts +71 -0
  161. package/quality/runtimeConstantGraph.ts +123 -0
  162. package/quality/runtimeConstantReads.ts +116 -0
  163. package/quality/runtimeImports.test.ts +190 -0
  164. package/quality/runtimeImports.ts +233 -0
  165. package/quality/runtimeKeyNames.ts +46 -0
  166. package/quality/runtimeLexicalScope.ts +132 -0
  167. package/quality/runtimeMarkerReach.test.ts +84 -0
  168. package/quality/runtimeMarkerReach.ts +255 -0
  169. package/quality/runtimeModuleFacts.ts +290 -0
  170. package/quality/runtimeNameTable.test.ts +172 -0
  171. package/quality/runtimeNameTable.ts +477 -0
  172. package/quality/runtimeScopeReport.test.ts +123 -0
  173. package/quality/runtimeScopeReport.ts +167 -0
  174. package/quality/runtimeSliceKey.ts +269 -0
  175. package/quality/runtimeSyntax.ts +133 -0
  176. package/quality/runtimeTable.fixture.ts +189 -0
  177. package/quality/runtimeUse.test.ts +737 -0
  178. package/quality/runtimeUse.ts +696 -0
  179. package/quality/runtimeUseReadable.test.ts +393 -0
  180. package/quality/ssrScanner.test.ts +13 -0
  181. package/quality/ssrScanner.ts +1 -1
  182. package/quality/translatorBindings.ts +187 -0
  183. package/test/secretEnvFixture.ts +134 -0
  184. package/test/testHelpers.ts +11 -0
  185. package/transforms/barrelAnalyzer.ts +26 -4
  186. package/transforms/barrelImportsPlugin.ts +121 -32
  187. package/transforms/exportReach.test.ts +162 -0
  188. package/transforms/exportReach.ts +308 -0
  189. package/transforms/frameworkObjects.fixture.tsx +58 -0
  190. package/transforms/frameworkObjects.test.ts +54 -0
  191. package/transforms/modelReference.test.ts +196 -0
  192. package/transforms/modelReference.ts +39 -0
  193. package/transforms/moduleParts.test.ts +225 -0
  194. package/transforms/moduleParts.ts +418 -0
  195. package/transforms/objectImportEdits.ts +150 -0
  196. package/transforms/objectMemberImports.test.ts +629 -0
  197. package/transforms/objectMemberImports.ts +571 -0
  198. package/transforms/objectMemberLookup.ts +150 -0
  199. package/transforms/objectModule.test.ts +307 -0
  200. package/transforms/objectModule.ts +482 -0
  201. package/transforms/objectModuleAnalyzer.ts +104 -0
  202. package/transforms/partImports.test.ts +76 -0
  203. package/transforms/partImports.ts +110 -0
  204. package/transforms/partModules.test.ts +187 -0
  205. package/transforms/partModules.ts +90 -0
  206. package/transforms/partPurity.ts +124 -0
  207. package/transforms/reactIconImports.test.ts +231 -0
  208. package/transforms/reactIconImports.ts +325 -0
  209. package/transforms/routeConstants.ts +122 -0
  210. package/transforms/routeRuntime.test.ts +835 -0
  211. package/transforms/routeRuntime.ts +703 -0
  212. package/transforms/routeRuntimeEdits.ts +92 -0
  213. package/transforms/routeRuntimeGraph.ts +66 -0
  214. package/transforms/routeRuntimePlan.ts +244 -0
  215. package/transforms/secretEnvDeclaration.test.ts +208 -0
  216. package/transforms/secretEnvDeclaration.ts +213 -0
  217. package/transforms/secretEnvFile.test.ts +117 -0
  218. package/transforms/secretEnvFile.ts +113 -0
  219. package/transforms/secretEnvName.test.ts +54 -0
  220. package/transforms/secretEnvName.ts +29 -0
  221. package/transforms/secretEnvSource.test.ts +148 -0
  222. package/transforms/secretEnvSource.ts +166 -0
  223. package/transforms/serverEnvEvaluationError.ts +11 -0
  224. package/transforms/serverEnvPlugin.test.ts +2 -1
  225. package/transforms/serverEnvPlugin.ts +13 -0
  226. package/transforms/serverEnvProfile.test.ts +115 -2
  227. package/transforms/serverEnvProfile.ts +117 -40
  228. package/transforms/serverEnvSecrets.test.ts +292 -0
  229. package/transforms/signalDescriptors.test.ts +280 -0
  230. package/transforms/signalDescriptors.ts +227 -0
  231. package/transforms/thisFreeExports.ts +87 -0
  232. package/transforms/transforms.test.ts +180 -3
  233. package/transforms/tsconfigPackageResolver.test.ts +1 -0
  234. package/tunnel/createTunnel.test.ts +29 -8
  235. package/tunnel/createTunnel.ts +18 -11
  236. package/typecheck/projectTypecheck.test.ts +29 -0
  237. package/typecheck/typeChecker.test.ts +49 -0
  238. package/typecheck/typeChecker.ts +9 -7
  239. package/typecheck/withheldDiagnostics.ts +41 -0
  240. package/util/fileEditor.ts +1 -0
  241. package/util/selectModel.ts +1 -0
  242. package/workflow/executor.ts +6 -2
  243. package/workflow/index.ts +1 -0
  244. package/workflow/plan.ts +36 -7
  245. package/workflow/types.ts +1 -1
  246. package/workflow/uiTarget.ts +50 -0
  247. package/workspace/getRelatedCnsts.ts +7 -0
  248. package/workspace/scanInfo.test.ts +39 -0
  249. package/workspace/scanInfo.ts +48 -5
  250. package/workspace/workspaceLayout.ts +1 -0
@@ -2,8 +2,11 @@ import { describe, expect, test } from "bun:test";
2
2
  import { generateKeyPairSync } from "node:crypto";
3
3
  import { mkdir, writeFile } from "node:fs/promises";
4
4
  import path from "node:path";
5
+ import { resolveAcl } from "../../native/packages/cli/src/lib/acl";
5
6
  import { buildCsp, cspHash, parseCsp } from "../../native/packages/cli/src/lib/csp";
6
7
  import { rewriteDevHtml } from "../../native/packages/cli/src/lib/hmr";
8
+ import { aclCheck } from "../../native/packages/core/src/acl";
9
+ import externalViewManifest from "../../native/plugins/external-view/native-plugin.json";
7
10
  import type { AkanNativeTarget } from "../akanConfig";
8
11
  import { tempDirs } from "../test/testHelpers";
9
12
  import { NativeApi } from "./nativeApi";
@@ -139,6 +142,7 @@ describe("NativeConfig.build", () => {
139
142
  googleServices: path.resolve("/repo/apps/minimal", "secrets/google-services.json"),
140
143
  },
141
144
  keyboard: { resize: "none" },
145
+ splash: { autoHide: false },
142
146
  });
143
147
  });
144
148
 
@@ -184,7 +188,7 @@ describe("NativeConfig.build", () => {
184
188
  android: { debugAppIdSuffix: ".debug" },
185
189
  keyboard: { resize: "none" },
186
190
  icon: path.resolve("/repo/apps/portal", "assets/icon.png"),
187
- splash: { image: path.resolve("/repo/apps/portal", "assets/splash.png") },
191
+ splash: { image: path.resolve("/repo/apps/portal", "assets/splash.png"), autoHide: false },
188
192
  });
189
193
  });
190
194
 
@@ -303,6 +307,21 @@ describe("NativeConfig.build", () => {
303
307
  expect(build()).toBeUndefined();
304
308
  });
305
309
 
310
+ test("the runtime hides the splash once the first page is drawn, unless the app hands that back to the shell", () => {
311
+ const splashOf = (splash: Parameters<typeof NativeConfig.build>[0]["target"]["splash"]) =>
312
+ NativeConfig.build({
313
+ appPath: "/repo/apps/portal",
314
+ target: { ...adminTarget, splash },
315
+ webDir: "/web",
316
+ contributions: [],
317
+ locales: ["en"],
318
+ platform: "ios",
319
+ }).config.splash;
320
+ expect(splashOf(undefined)).toEqual({ autoHide: false });
321
+ expect(splashOf({ autoHide: true, timeout: 3000 })).toEqual({ autoHide: true, timeout: 3000 });
322
+ expect(NativeConfig.basePlugins).toContain("splash-screen");
323
+ });
324
+
306
325
  test("push, privacy and the icon and splash objects reach the runtime, paths from the app folder", () => {
307
326
  const { config } = NativeConfig.build({
308
327
  appPath: "/repo/apps/portal",
@@ -718,6 +737,82 @@ describe("NativeConfig.build", () => {
718
737
  expect(opener(["*"])).toBe("opener:default");
719
738
  });
720
739
 
740
+ test("an external view opens only the origins native.desktop.externalView lists, and evaluates or types only when it says so", () => {
741
+ const externalView = (setting?: NonNullable<AkanNativeTarget["desktop"]>["externalView"]) => {
742
+ const { config, warnings } = NativeConfig.build({
743
+ appPath: "/repo/apps/minimal",
744
+ target: {
745
+ ...minimalTarget,
746
+ plugins: ["external-view"],
747
+ ...(setting ? { desktop: { externalView: setting } } : {}),
748
+ },
749
+ webDir: "/web",
750
+ contributions: [],
751
+ locales: ["en"],
752
+ platform: "windows",
753
+ publicEnv: cloudEnv,
754
+ });
755
+ const permissions = config.capabilities?.[0]?.permissions.filter((p) =>
756
+ JSON.stringify(p).includes("external-view"),
757
+ );
758
+ const plugin = { spec: "external-view", dir: "/plugins/external-view", manifest: externalViewManifest as never };
759
+ const acl = resolveAcl([{ identifier: "app", permissions: permissions ?? [] }], [plugin], "windows");
760
+ return {
761
+ permissions,
762
+ warnings: warnings.filter((warning) => warning.includes("external-view")),
763
+ open: aclCheck(acl, "external-view", "open").scope?.allow,
764
+ evaluate: aclCheck(acl, "external-view", "evaluate").allowed,
765
+ sendKey: aclCheck(acl, "external-view", "sendKey").allowed,
766
+ };
767
+ };
768
+
769
+ expect(externalView()).toEqual({
770
+ permissions: [{ identifier: "external-view:default", allow: [] }],
771
+ warnings: [
772
+ "Native target 'default': external-view opens no origin until native.desktop.externalView.allowOrigins lists one.",
773
+ ],
774
+ open: [],
775
+ evaluate: false,
776
+ sendKey: false,
777
+ });
778
+ expect(
779
+ externalView({
780
+ allowOrigins: ["https://Board.example:443", "http://10.0.0.5:8080"],
781
+ evaluate: true,
782
+ sendKey: true,
783
+ }),
784
+ ).toEqual({
785
+ permissions: [
786
+ {
787
+ identifier: "external-view:default",
788
+ allow: [{ origin: "https://board.example" }, { origin: "http://10.0.0.5:8080" }],
789
+ },
790
+ "external-view:allow-evaluate",
791
+ "external-view:allow-sendKey",
792
+ ],
793
+ warnings: [],
794
+ open: [{ origin: "https://board.example" }, { origin: "http://10.0.0.5:8080" }],
795
+ evaluate: true,
796
+ sendKey: true,
797
+ });
798
+ expect(externalView({ allowOrigins: ["https://b\u00fccher.example"], sendKey: true })).toMatchObject({
799
+ open: [{ origin: "https://xn--bcher-kva.example" }],
800
+ evaluate: false,
801
+ sendKey: true,
802
+ });
803
+ for (const origin of [
804
+ "https://board.example/screen",
805
+ "https://*.example",
806
+ "https://user@board.example",
807
+ "board.example",
808
+ "ftp://board.example",
809
+ "https://board.example?x=1",
810
+ ])
811
+ expect(() => externalView({ allowOrigins: [origin] })).toThrow(
812
+ `native.desktop.externalView.allowOrigins holds "${origin}", which is not an exact http(s) origin`,
813
+ );
814
+ });
815
+
721
816
  test("keeps a file name the runtime accepts", () => {
722
817
  expect(NativeConfig.fileNameOf("minimal")).toBe("minimal");
723
818
  expect(NativeConfig.fileNameOf("my app!")).toBe("my-app");
@@ -9,7 +9,7 @@ import type {
9
9
  NativePermission,
10
10
  } from "akanjs";
11
11
  import { type AkanI18nConfig, LocalePath, trimSlashes } from "akanjs/common";
12
- import type { AkanNativeConfig } from "akanjs/native/config";
12
+ import type { AkanNativeConfig, CapabilityPermission } from "akanjs/native/config";
13
13
  import type { DesktopServerBundle } from "./desktopServerStage";
14
14
  import { type NativePlatform, resolveAppId } from "./mobileTarget";
15
15
  import type { NativePluginFolder } from "./nativePluginFolders";
@@ -46,8 +46,9 @@ export interface NativeConfigResult {
46
46
  type NativeIos = NonNullable<NonNullable<AkanNativeConfig["native"]>["ios"]>;
47
47
 
48
48
  export class NativeConfig {
49
- //* What every akanjs page may call: routing, lifecycle, links, storage, the device facts the runtime reads, and the
50
- //* system sheet useCamera asks camera-or-library with.
49
+ //* What every akanjs page may call: routing, lifecycle, links, storage, the device facts the runtime reads, the
50
+ //* system sheet useCamera asks camera-or-library with, and the splash the CSR runtime hides once the first page is
51
+ //* drawn.
51
52
  static readonly basePlugins = [
52
53
  "app",
53
54
  "app-state",
@@ -60,6 +61,7 @@ export class NativeConfig {
60
61
  "preferences",
61
62
  "secure-storage",
62
63
  "haptics",
64
+ "splash-screen",
63
65
  ] as const;
64
66
  //? Only scripts stay strict ('self', inline ones by hash): injected script must not reach the native bridge.
65
67
  static readonly defaultCsp: Readonly<Record<string, readonly string[]>> = {
@@ -239,11 +241,7 @@ export class NativeConfig {
239
241
  {
240
242
  identifier: "app",
241
243
  description: `The plugins ${target.appName} ships, each with its default permissions`,
242
- permissions: pluginIds.map((id) =>
243
- id === "opener" && !openUrls.includes("*")
244
- ? { identifier: "opener:default", allow: openUrls.map((url) => ({ url })) }
245
- : `${id}:default`,
246
- ),
244
+ permissions: NativeConfig.#permissions(pluginIds, target, openUrls, warnings),
247
245
  },
248
246
  ],
249
247
  ...(csp ? { security: { csp } } : {}),
@@ -271,7 +269,7 @@ export class NativeConfig {
271
269
  keyboard: { resize: "none" },
272
270
  ...(desktop ? { desktop } : {}),
273
271
  ...(target.icon ? { icon: NativeConfig.#icon(target.icon, abs) } : {}),
274
- ...(target.splash ? { splash: NativeConfig.#splash(target.splash, abs) } : {}),
272
+ splash: NativeConfig.#splash(target.splash, abs),
275
273
  ...(shell ? { shell } : {}),
276
274
  };
277
275
  return { config, warnings };
@@ -328,6 +326,39 @@ export class NativeConfig {
328
326
  return policy;
329
327
  }
330
328
 
329
+ static #permissions(pluginIds: string[], target: AkanNativeTarget, openUrls: readonly string[], warnings: string[]) {
330
+ return pluginIds.flatMap((id): (string | CapabilityPermission)[] => {
331
+ if (id === "opener" && !openUrls.includes("*"))
332
+ return [{ identifier: "opener:default", allow: openUrls.map((url) => ({ url })) }];
333
+ if (id === "external-view") return NativeConfig.#externalView(target, warnings);
334
+ return [`${id}:default`];
335
+ });
336
+ }
337
+
338
+ //? `external-view:default` alone opens no origin and leaves out evaluate and sendKey (the plugin's manifest).
339
+ static #externalView({ name, desktop }: AkanNativeTarget, warnings: string[]): (string | CapabilityPermission)[] {
340
+ const { allowOrigins = [], evaluate, sendKey } = desktop?.externalView ?? {};
341
+ const origins = allowOrigins.map((origin) => NativeConfig.#exactOrigin(name, origin));
342
+ if (!origins.length)
343
+ warnings.push(
344
+ `Native target '${name}': external-view opens no origin until native.desktop.externalView.allowOrigins lists one.`,
345
+ );
346
+ return [
347
+ { identifier: "external-view:default", allow: origins.map((origin) => ({ origin })) },
348
+ ...(evaluate ? ["external-view:allow-evaluate"] : []),
349
+ ...(sendKey ? ["external-view:allow-sendKey"] : []),
350
+ ];
351
+ }
352
+
353
+ static #exactOrigin(name: string, origin: string) {
354
+ const url = URL.canParse(origin) ? new URL(origin) : null;
355
+ if (!url || !/^https?:$/.test(url.protocol) || url.hostname.includes("*") || url.href !== `${url.origin}/`)
356
+ throw new Error(
357
+ `Native target '${name}': native.desktop.externalView.allowOrigins holds "${origin}", which is not an exact http(s) origin such as "https://board.example".`,
358
+ );
359
+ return url.origin;
360
+ }
361
+
331
362
  //? https: and wss: cover a cloud API, so only plain-http origins are named; a carried server's port comes at launch.
332
363
  static #plainOrigins(publicEnv: Record<string, string | undefined>, env: NativeEnv | undefined, carried: boolean) {
333
364
  const origins = new Set<string>();
@@ -347,12 +378,15 @@ export class NativeConfig {
347
378
  return typeof icon === "string" ? abs(icon) : { ...icon, image: abs(icon.image) };
348
379
  }
349
380
 
381
+ //? The shell's own hide fires when the document has loaded, before the CSR page is drawn; the runtime hides it then
382
+ //? (`NativeSplash`), so it stays off unless the app says otherwise.
350
383
  static #splash(
351
- splash: NonNullable<AkanNativeTarget["splash"]>,
384
+ splash: AkanNativeTarget["splash"],
352
385
  abs: (relative: string) => string,
353
386
  ): NonNullable<AkanNativeConfig["splash"]> {
354
- if (typeof splash === "string") return { image: abs(splash) };
355
- return { ...splash, ...(splash.image ? { image: abs(splash.image) } : {}) };
387
+ if (!splash) return { autoHide: false };
388
+ if (typeof splash === "string") return { image: abs(splash), autoHide: false };
389
+ return { autoHide: false, ...splash, ...(splash.image ? { image: abs(splash.image) } : {}) };
356
390
  }
357
391
 
358
392
  static #desktop(
@@ -1,5 +1,6 @@
1
1
  import { readdir, readFile, stat } from "node:fs/promises";
2
2
  import path from "node:path";
3
+ import type { SecretEnvMoved } from "../transforms/secretEnvDeclaration";
3
4
  import { ServerEnvProfile } from "../transforms/serverEnvProfile";
4
5
 
5
6
  interface SecretValue {
@@ -66,6 +67,48 @@ export class ServerBundleSecrets {
66
67
  return unread;
67
68
  }
68
69
 
70
+ //* An image's own check: the build left each secret string out at its key, and the same string may sit in what it
71
+ //* wrote for another reason. A long mixed one stops the build; a short or plain one, which code holds by chance
72
+ //* (a password equal to a database's name), comes back as a warning. Neither names a value.
73
+ async assertImageClean(bundleDir: string, moved: readonly SecretEnvMoved[]): Promise<string | null> {
74
+ //? A string under eight characters is in any bundle by chance, so it is not looked for: the env alone says
75
+ //? whether a key the build leaves as written holds it too.
76
+ const searched = (value: string) => value.length >= 8;
77
+ const sought = moved
78
+ .filter(({ value }) => searched(value))
79
+ .map((secret) => ({ secret, needles: ServerBundleSecrets.#needles(secret.value) }));
80
+ const holders = new Map<SecretEnvMoved, string[]>();
81
+ if (sought.length)
82
+ for (const bundled of await ServerBundleSecrets.#files(bundleDir)) {
83
+ const text = await readFile(bundled, "latin1");
84
+ for (const { secret, needles } of sought)
85
+ if (needles.some((needle) => text.includes(needle)))
86
+ holders.set(secret, [...(holders.get(secret) ?? []), ServerBundleSecrets.#relative(bundleDir, bundled)]);
87
+ }
88
+ const stops: string[] = [];
89
+ const notes: string[] = [];
90
+ for (const secret of moved) {
91
+ const files = holders.get(secret) ?? [];
92
+ const key = `${secret.path} (${secret.name})`;
93
+ const twins = secret.twins.length ? `the env's ${secret.twins.join(", ")}` : "";
94
+ if (files.length && ServerEnvProfile.distinctive(secret.value))
95
+ stops.push(
96
+ ...files.map((file) => `${file} holds the value of ${key}${twins ? `, which ${twins} holds as well` : ""}`),
97
+ );
98
+ else if (files.length || (twins && !searched(secret.value)))
99
+ notes.push(
100
+ `${key}: ${[files.join(", "), twins ? `${twins} holds the same string` : ""].filter(Boolean).join("; ")}`,
101
+ );
102
+ }
103
+ if (stops.length)
104
+ throw new Error(
105
+ `The build holds secret values the server reads from its process env, so it stops here:\n ${[...new Set(stops)].join("\n ")}\nThe build left each out at its secret-named key of the env file, and the same string is in what it wrote for another reason: another key of the env holds it too, or the app's code, or a file the build copies. Take it out there, or read it there from the same variable. \`akan build --inline-secrets\` builds with the env files as written until akanjs 3.5.0 removes it.`,
106
+ );
107
+ if (!notes.length) return null;
108
+ const lines = [...new Set(notes)];
109
+ return `${lines.length} secret value${lines.length === 1 ? "" : "s"} the server reads from its process env ${lines.length === 1 ? "is" : "are"} also in what this build wrote, short or plain enough to be there for another reason, so the build goes on:\n ${lines.join("\n ")}\nWhere another key of the env or the app's code holds a secret's own string, the image holds it too: change one of the two.`;
110
+ }
111
+
69
112
  //? A short or plain value the app's or a lib's own code holds as well (a default password) is that code's, which
70
113
  //? the bundle carries with or without the env file; a long mixed one is a secret copied into the code.
71
114
  async #coded(values: string[]): Promise<Set<string>> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "3.3.0-rc.4",
3
+ "version": "3.3.0-rc.40",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -30,6 +30,7 @@
30
30
  "./cloud": "./cloud/index.ts",
31
31
  "./codeAgent": "./codeAgent/index.ts",
32
32
  "./commandDecorators": "./commandDecorators/index.ts",
33
+ "./executors": "./executors/index.ts",
33
34
  "./frontendBuild": "./frontendBuild/index.ts",
34
35
  "./incrementalBuilder": "./incrementalBuilder/index.ts",
35
36
  "./mobile": "./mobile/index.ts",
@@ -37,175 +38,19 @@
37
38
  "./preview": "./preview/index.ts",
38
39
  "./transforms": "./transforms/index.ts",
39
40
  "./workflow": "./workflow/index.ts",
40
- "./abstractDoc": "./quality/abstractDoc.ts",
41
- "./abstractDoc.ts": "./quality/abstractDoc.ts",
42
- "./agentAssets": "./guideline/agentAssets.ts",
43
- "./agentAssets.ts": "./guideline/agentAssets.ts",
44
- "./agentsIndex": "./guideline/agentsIndex.ts",
45
- "./agentsIndex.ts": "./guideline/agentsIndex.ts",
46
- "./akanContext": "./context/akanContext.ts",
47
- "./akanContext.ts": "./context/akanContext.ts",
48
- "./akanMcpContract": "./context/akanMcpContract.ts",
49
- "./akanMcpContract.ts": "./context/akanMcpContract.ts",
50
- "./akanMcpToolError": "./context/akanMcpToolError.ts",
51
- "./akanMcpToolError.ts": "./context/akanMcpToolError.ts",
52
- "./apiReference": "./docs/apiReference.ts",
53
- "./apiReference.ts": "./docs/apiReference.ts",
54
- "./appSelectionMemory": "./workspace/appSelectionMemory.ts",
55
- "./appSelectionMemory.ts": "./workspace/appSelectionMemory.ts",
56
- "./applicationBuildReporter": "./app/applicationBuildReporter.ts",
57
- "./applicationBuildReporter.ts": "./app/applicationBuildReporter.ts",
58
- "./applicationBuildRunner": "./app/applicationBuildRunner.ts",
59
- "./applicationBuildRunner.ts": "./app/applicationBuildRunner.ts",
60
- "./applicationTestPreload": "./app/applicationTestPreload.ts",
61
- "./applicationTestPreload.ts": "./app/applicationTestPreload.ts",
62
- "./bareErrorScanner": "./quality/bareErrorScanner.ts",
63
- "./bareErrorScanner.ts": "./quality/bareErrorScanner.ts",
64
- "./biomeBase": "./lint/biomeBase.ts",
65
- "./biomeBase.ts": "./lint/biomeBase.ts",
66
- "./codegenLock": "./workspace/codegenLock.ts",
67
- "./codegenLock.ts": "./workspace/codegenLock.ts",
68
- "./commentDensityScanner": "./quality/commentDensityScanner.ts",
69
- "./commentDensityScanner.ts": "./quality/commentDensityScanner.ts",
70
- "./componentSizeScanner": "./quality/componentSizeScanner.ts",
71
- "./componentSizeScanner.ts": "./quality/componentSizeScanner.ts",
72
- "./componentWriteChainScanner": "./quality/componentWriteChainScanner.ts",
73
- "./componentWriteChainScanner.ts": "./quality/componentWriteChainScanner.ts",
74
- "./conventionSet": "./guideline/conventionSet.ts",
75
- "./conventionSet.ts": "./guideline/conventionSet.ts",
76
- "./createTunnel": "./tunnel/createTunnel.ts",
77
- "./createTunnel.ts": "./tunnel/createTunnel.ts",
78
- "./declarationReader": "./docs/declarationReader.ts",
79
- "./declarationReader.ts": "./docs/declarationReader.ts",
80
- "./dependencyScanner": "./workspace/dependencyScanner.ts",
81
- "./dependencyScanner.ts": "./workspace/dependencyScanner.ts",
82
- "./deprecatedCommentScanner": "./quality/deprecatedCommentScanner.ts",
83
- "./deprecatedCommentScanner.ts": "./quality/deprecatedCommentScanner.ts",
84
- "./endpointReach": "./quality/endpointReach.ts",
85
- "./endpointReach.ts": "./quality/endpointReach.ts",
86
- "./envSeed": "./workspace/envSeed.ts",
87
- "./envSeed.ts": "./workspace/envSeed.ts",
88
- "./errorCodeReference": "./docs/errorCodeReference.ts",
89
- "./errorCodeReference.ts": "./docs/errorCodeReference.ts",
90
- "./errorCodeScan": "./docs/errorCodeScan.ts",
91
- "./errorCodeScan.ts": "./docs/errorCodeScan.ts",
92
- "./executors": "./executors/index.ts",
93
- "./executors.ts": "./executors/index.ts",
94
- "./fileEditor": "./util/fileEditor.ts",
95
- "./fileEditor.ts": "./util/fileEditor.ts",
96
- "./fileSys": "./util/fileSys.ts",
97
- "./fileSys.ts": "./util/fileSys.ts",
98
- "./formSetterScanner": "./quality/formSetterScanner.ts",
99
- "./formSetterScanner.ts": "./quality/formSetterScanner.ts",
100
- "./frameworkGraph": "./docs/frameworkGraph.ts",
101
- "./frameworkGraph.ts": "./docs/frameworkGraph.ts",
102
- "./getRelatedCnsts": "./workspace/getRelatedCnsts.ts",
103
- "./getRelatedCnsts.ts": "./workspace/getRelatedCnsts.ts",
104
- "./gitRevision": "./workspace/gitRevision.ts",
105
- "./gitRevision.ts": "./workspace/gitRevision.ts",
106
- "./jsonFormatter": "./util/jsonFormatter.ts",
107
- "./jsonFormatter.ts": "./util/jsonFormatter.ts",
108
- "./kindBranchScanner": "./quality/kindBranchScanner.ts",
109
- "./kindBranchScanner.ts": "./quality/kindBranchScanner.ts",
110
- "./libSource": "./workspace/libSource.ts",
111
- "./libSource.ts": "./workspace/libSource.ts",
112
- "./linter": "./lint/linter.ts",
113
- "./linter.ts": "./lint/linter.ts",
114
- "./maintainabilityBaseline": "./quality/maintainabilityBaseline.ts",
115
- "./maintainabilityBaseline.ts": "./quality/maintainabilityBaseline.ts",
116
- "./maintainabilityContract": "./quality/maintainabilityContract.ts",
117
- "./maintainabilityContract.ts": "./quality/maintainabilityContract.ts",
118
- "./maintainabilityExceptionScanner": "./quality/maintainabilityExceptionScanner.ts",
119
- "./maintainabilityExceptionScanner.ts": "./quality/maintainabilityExceptionScanner.ts",
120
- "./maintainabilityLimits": "./quality/maintainabilityLimits.ts",
121
- "./maintainabilityLimits.ts": "./quality/maintainabilityLimits.ts",
122
- "./maintainabilityReport": "./quality/maintainabilityReport.ts",
123
- "./maintainabilityReport.ts": "./quality/maintainabilityReport.ts",
124
- "./manifestDependencies": "./workspace/manifestDependencies.ts",
125
- "./manifestDependencies.ts": "./workspace/manifestDependencies.ts",
126
- "./moduleFieldNames": "./context/moduleFieldNames.ts",
127
- "./moduleFieldNames.ts": "./context/moduleFieldNames.ts",
128
- "./packageExportsMap": "./workspace/packageExportsMap.ts",
129
- "./packageExportsMap.ts": "./workspace/packageExportsMap.ts",
130
- "./prompter": "./guideline/prompter.ts",
131
- "./prompter.ts": "./guideline/prompter.ts",
132
- "./qualityScanner": "./quality/qualityScanner.ts",
133
- "./qualityScanner.ts": "./quality/qualityScanner.ts",
134
- "./recipeScanner": "./context/recipeScanner.ts",
135
- "./recipeScanner.ts": "./context/recipeScanner.ts",
136
- "./renderMutationScanner": "./quality/renderMutationScanner.ts",
137
- "./renderMutationScanner.ts": "./quality/renderMutationScanner.ts",
138
- "./repoIdentity": "./workspace/repoIdentity.ts",
139
- "./repoIdentity.ts": "./workspace/repoIdentity.ts",
140
- "./routeJsBudget": "./app/routeJsBudget.ts",
141
- "./routeJsBudget.ts": "./app/routeJsBudget.ts",
142
- "./routeSourceValidator": "./app/routeSourceValidator.ts",
143
- "./routeSourceValidator.ts": "./app/routeSourceValidator.ts",
144
- "./scanInfo": "./workspace/scanInfo.ts",
145
- "./scanInfo.ts": "./workspace/scanInfo.ts",
146
- "./selectModel": "./util/selectModel.ts",
147
- "./selectModel.ts": "./util/selectModel.ts",
148
- "./semver": "./util/semver.ts",
149
- "./semver.ts": "./util/semver.ts",
150
- "./serviceLoopCallScanner": "./quality/serviceLoopCallScanner.ts",
151
- "./serviceLoopCallScanner.ts": "./quality/serviceLoopCallScanner.ts",
152
- "./shellOnlyEnv": "./util/shellOnlyEnv.ts",
153
- "./shellOnlyEnv.ts": "./util/shellOnlyEnv.ts",
154
- "./signalMutationIndex": "./quality/signalMutationIndex.ts",
155
- "./signalMutationIndex.ts": "./quality/signalMutationIndex.ts",
156
- "./slicePlanner": "./workspace/slicePlanner.ts",
157
- "./slicePlanner.ts": "./workspace/slicePlanner.ts",
158
- "./sourceComments": "./quality/sourceComments.ts",
159
- "./sourceComments.ts": "./quality/sourceComments.ts",
160
- "./spinner": "./util/spinner.ts",
161
- "./spinner.ts": "./util/spinner.ts",
162
- "./sshHostKeys": "./tunnel/sshHostKeys.ts",
163
- "./sshHostKeys.ts": "./tunnel/sshHostKeys.ts",
164
- "./sshTunnel": "./tunnel/sshTunnel.ts",
165
- "./sshTunnel.ts": "./tunnel/sshTunnel.ts",
166
- "./ssrScanner": "./quality/ssrScanner.ts",
167
- "./ssrScanner.ts": "./quality/ssrScanner.ts",
168
- "./storeAccessScanner": "./quality/storeAccessScanner.ts",
169
- "./storeAccessScanner.ts": "./quality/storeAccessScanner.ts",
170
- "./storeSource": "./quality/storeSource.ts",
171
- "./storeSource.ts": "./quality/storeSource.ts",
172
- "./storeWriteScanner": "./quality/storeWriteScanner.ts",
173
- "./storeWriteScanner.ts": "./quality/storeWriteScanner.ts",
174
- "./stripAnsi": "./util/stripAnsi.ts",
175
- "./stripAnsi.ts": "./util/stripAnsi.ts",
176
- "./structureScanner": "./quality/structureScanner.ts",
177
- "./structureScanner.ts": "./quality/structureScanner.ts",
178
- "./subspace": "./subspace/subspace.ts",
179
- "./subspace.ts": "./subspace/subspace.ts",
180
- "./subspaceClone": "./subspace/subspaceClone.ts",
181
- "./subspaceClone.ts": "./subspace/subspaceClone.ts",
182
- "./subspaceConfig": "./subspace/subspaceConfig.ts",
183
- "./subspaceConfig.ts": "./subspace/subspaceConfig.ts",
184
- "./subspaceReport": "./subspace/subspaceReport.ts",
185
- "./subspaceReport.ts": "./subspace/subspaceReport.ts",
186
- "./testHelpers": "./test/testHelpers.ts",
187
- "./testHelpers.ts": "./test/testHelpers.ts",
188
- "./testOnlyExportScanner": "./quality/testOnlyExportScanner.ts",
189
- "./testOnlyExportScanner.ts": "./quality/testOnlyExportScanner.ts",
190
- "./typeChecker": "./typecheck/typeChecker.ts",
191
- "./typeChecker.ts": "./typecheck/typeChecker.ts",
192
- "./types": "./workspace/types.ts",
193
- "./types.ts": "./workspace/types.ts",
194
- "./workspaceGraph": "./workspace/workspaceGraph.ts",
195
- "./workspaceGraph.ts": "./workspace/workspaceGraph.ts",
196
- "./workspaceLayout": "./workspace/workspaceLayout.ts",
197
- "./workspaceLayout.ts": "./workspace/workspaceLayout.ts",
198
- "./writePath": "./quality/writePath.ts",
199
- "./writePath.ts": "./quality/writePath.ts",
200
- "./writePlacementScanner": "./quality/writePlacementScanner.ts",
201
- "./writePlacementScanner.ts": "./quality/writePlacementScanner.ts",
202
- "./writingActionIndex": "./quality/writingActionIndex.ts",
203
- "./writingActionIndex.ts": "./quality/writingActionIndex.ts",
204
- "./*.ts": "./*.ts",
205
- "./*": "./*.ts"
41
+ "./app/applicationBuildRunner": "./app/applicationBuildRunner.ts",
42
+ "./cloud/cloudApi": "./cloud/cloudApi.ts",
43
+ "./cloud/cloudUpdates": "./cloud/cloudUpdates.ts",
44
+ "./commandDecorators/exitCodeError": "./commandDecorators/exitCodeError.ts",
45
+ "./mobile/desktopRelease": "./mobile/desktopRelease.ts",
46
+ "./mobile/serverBundleSecrets": "./mobile/serverBundleSecrets.ts",
47
+ "./transforms/serverEnvProfile": "./transforms/serverEnvProfile.ts",
48
+ "./util/fileEditor": "./util/fileEditor.ts",
49
+ "./util/selectModel": "./util/selectModel.ts",
50
+ "./workspace/getRelatedCnsts": "./workspace/getRelatedCnsts.ts"
206
51
  },
207
52
  "dependencies": {
208
- "@akanjs/language": "3.3.0-rc.4",
53
+ "@akanjs/language": "3.3.0-rc.40",
209
54
  "@earendil-works/pi-agent-core": "1.5.2",
210
55
  "@earendil-works/pi-ai": "1.5.2",
211
56
  "@earendil-works/pi-codemode": "1.5.2",
@@ -214,7 +59,7 @@
214
59
  "@earendil-works/pi-tui": "1.5.2",
215
60
  "@inquirer/prompts": "^8.7.3",
216
61
  "@tailwindcss/node": "^4.3.3",
217
- "akanjs": "3.3.0-rc.4",
62
+ "akanjs": "3.3.0-rc.40",
218
63
  "chalk": "^6.0.1",
219
64
  "commander": "^15.0.0",
220
65
  "dayjs": "^1.11.23",
@@ -222,6 +67,7 @@
222
67
  "fonteditor-core": "^2.6.3",
223
68
  "ignore": "^7.0.12",
224
69
  "ora": "^9.4.1",
70
+ "react-server-dom-webpack": "^19.3.1",
225
71
  "ssh2": "^1.17.0",
226
72
  "subset-font": "^2.9.0",
227
73
  "tailwind-scrollbar": "^4.0.2",
@@ -14,12 +14,19 @@ const barrelFacets = async (): Promise<string[]> => {
14
14
  return [...barrel.matchAll(/^export (?:type )?\* from "\.\/([^"]+)";$/gm)].map((match) => `./${match[1]}`);
15
15
  };
16
16
 
17
+ //? The CLI's dist inlines devkit: once installed, only devkit's own sources, the CLI's templates and the README
18
+ //? examples a tool author copies import a subpath.
17
19
  const importedSubpaths = async (): Promise<string[]> => {
18
20
  const repoRoot = path.resolve(packageDir, "../../..");
19
- const glob = new Bun.Glob("pkgs/@akanjs/{cli,devkit}/**/*.{ts,tsx}");
20
21
  const found = new Set<string>();
21
- for await (const relative of glob.scan({ cwd: repoRoot })) {
22
- if (relative.includes("node_modules/") || relative.includes("/dist/")) continue;
22
+ const sources = [
23
+ ...new Bun.Glob("pkgs/@akanjs/devkit/**/*.{ts,tsx}").scanSync({ cwd: repoRoot }),
24
+ ...new Bun.Glob("pkgs/@akanjs/devkit/README*.md").scanSync({ cwd: repoRoot }),
25
+ ...new Bun.Glob("pkgs/@akanjs/cli/templates/**/*").scanSync({ cwd: repoRoot }),
26
+ ];
27
+ for (const relative of sources) {
28
+ if (relative.includes("node_modules/") || relative.includes("/dist/") || /\.(test|spec)\.tsx?$/.test(relative))
29
+ continue;
23
30
  const source = await Bun.file(path.join(repoRoot, relative)).text();
24
31
  for (const match of source.matchAll(/"@akanjs\/devkit\/([a-zA-Z0-9_./-]+)"/g)) found.add(`./${match[1]}`);
25
32
  }
@@ -27,29 +34,45 @@ const importedSubpaths = async (): Promise<string[]> => {
27
34
  };
28
35
 
29
36
  describe("published exports map", () => {
30
- test("resolves every facet the root barrel re-exports", async () => {
31
- const facets = await barrelFacets();
32
- expect(facets.length).toBeGreaterThan(30);
33
- expect(exportsMap.findUnreachable(facets)).toEqual([]);
37
+ test("names every public subpath, with no wildcard to reach a file it does not", async () => {
38
+ const manifest = (await Bun.file(path.join(packageDir, "package.json")).json()) as {
39
+ exports: Record<string, unknown>;
40
+ };
41
+ const subpaths = Object.keys(manifest.exports);
42
+ expect(subpaths.filter((subpath) => subpath.includes("*"))).toEqual([]);
43
+ expect(subpaths.length).toBeGreaterThan(20);
44
+ expect(exportsMap.findUnreachable(subpaths)).toEqual([]);
34
45
  });
35
46
 
36
- test("resolves every subpath the monorepo actually imports", async () => {
47
+ test("resolves every subpath a published install imports", async () => {
37
48
  const subpaths = await importedSubpaths();
38
- expect(subpaths.length).toBeGreaterThan(20);
49
+ expect(subpaths).toContain("./executors");
39
50
  expect(exportsMap.findUnreachable(subpaths)).toEqual([]);
40
51
  });
41
52
 
42
- test("covers both facet shapes and keeps explicit extensions intact", () => {
43
- // One wildcard cannot serve bare files, directory facets and already-suffixed specifiers (no `.ts.ts`) at once.
53
+ test("points a directory facet at its index and a nested entry at its file", () => {
44
54
  expect(exportsMap.resolve("./executors")).toBe("./executors/index.ts");
45
- expect(exportsMap.resolve("./fileSys")).toBe("./util/fileSys.ts");
46
- expect(exportsMap.resolve("./workspaceLayout.ts")).toBe("./workspace/workspaceLayout.ts");
47
55
  expect(exportsMap.resolve("./frontendBuild")).toBe("./frontendBuild/index.ts");
48
- expect(exportsMap.resolve("./cloud/cloudApi.ts")).toBe("./cloud/cloudApi.ts");
56
+ expect(exportsMap.resolve("./cloud/cloudApi")).toBe("./cloud/cloudApi.ts");
49
57
  expect(exportsMap.resolve("./package.json")).toBe("./package.json");
50
58
  });
51
59
 
52
- test("every directory facet has a literal entry, since the wildcard cannot probe index.ts", async () => {
60
+ test("keeps an entry for each nested file a consumer workspace imports", () => {
61
+ const nested = [
62
+ "cloud/cloudApi",
63
+ "cloud/cloudUpdates",
64
+ "commandDecorators/exitCodeError",
65
+ "mobile/desktopRelease",
66
+ "mobile/serverBundleSecrets",
67
+ "transforms/serverEnvProfile",
68
+ "util/fileEditor",
69
+ "util/selectModel",
70
+ "workspace/getRelatedCnsts",
71
+ ];
72
+ expect(nested.filter((file) => exportsMap.resolve(`./${file}`) !== `./${file}.ts`)).toEqual([]);
73
+ });
74
+
75
+ test("every directory facet the root barrel re-exports has a literal entry", async () => {
53
76
  const facets = await barrelFacets();
54
77
  const missing = facets.filter(
55
78
  (subpath) =>
@@ -58,15 +81,6 @@ describe("published exports map", () => {
58
81
  expect(missing).toEqual([]);
59
82
  });
60
83
 
61
- test("points every literal entry at a file, so a subpath the root once held still loads from its folder", async () => {
62
- const manifest = (await Bun.file(path.join(packageDir, "package.json")).json()) as {
63
- exports: Record<string, unknown>;
64
- };
65
- const literals = Object.keys(manifest.exports).filter((subpath) => !subpath.includes("*"));
66
- expect(literals.length).toBeGreaterThan(100);
67
- expect(exportsMap.findUnreachable(literals)).toEqual([]);
68
- });
69
-
70
84
  test("keeps every source out of the package root but its type barrel", () => {
71
85
  const loose = [...new Bun.Glob("*.{ts,tsx}").scanSync({ cwd: packageDir })].filter(
72
86
  (file) => file !== "index.ts" && !file.endsWith(".test.ts"),