@akanjs/devkit 3.3.0-rc.3 → 3.3.0-rc.30

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 (229) hide show
  1. package/CHANGELOG.md +547 -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 +126 -5
  22. package/app/dictionarySizes.ts +94 -0
  23. package/artifact/implicitRootLayout.test.ts +19 -0
  24. package/artifact/implicitRootLayout.ts +16 -2
  25. package/artifact/implicitRootLayoutRender.test.tsx +4 -1
  26. package/artifact/storeBootstrap.test.ts +28 -0
  27. package/artifact/storeBootstrap.ts +60 -8
  28. package/biome.base.json +5 -1
  29. package/codeAgent/agent/CodeAgent.ts +36 -16
  30. package/codeAgent/agent/CodeAgentAllowed.ts +35 -0
  31. package/codeAgent/agent/CodeAgentCommandLine.ts +372 -0
  32. package/codeAgent/agent/CodeAgentGate.ts +23 -4
  33. package/codeAgent/agent/CodeAgentRpcHost.ts +1 -1
  34. package/codeAgent/agent/codeAgent.test.ts +62 -0
  35. package/codeAgent/agent/codeAgentCommandLine.test.ts +212 -0
  36. package/codeAgent/agent/codeAgentContract.test.ts +117 -5
  37. package/codeAgent/skills/akan-agent/SKILL.md +8 -1
  38. package/codeAgent/skills/akan-code/SKILL.md +38 -3
  39. package/codeAgent/skills/akan-deps/SKILL.md +3 -2
  40. package/codeAgent/skills/akan-err/SKILL.md +13 -8
  41. package/codeAgent/skills/akan-mcp/SKILL.md +1 -1
  42. package/codeAgent/skills/akan-module/SKILL.md +2 -2
  43. package/codeAgent/skills/akan-page/SKILL.md +4 -14
  44. package/codeAgent/skills/akan-query/SKILL.md +13 -20
  45. package/codeAgent/skills/akan-runtime/SKILL.md +20 -0
  46. package/codeAgent/skills/akan-service/SKILL.md +2 -5
  47. package/codeAgent/skills/akan-transport/SKILL.md +5 -14
  48. package/codeAgent/skills/akan-ui/SKILL.md +2 -5
  49. package/context/akanContext.ts +2 -0
  50. package/docs/apiReference.test.ts +9 -0
  51. package/docs/apiReference.ts +14 -0
  52. package/executors/clientRuntimeKeyOrder.fixture.json +682 -0
  53. package/executors/clientRuntimeKeys.fixture.json +393 -0
  54. package/executors/clientRuntimeKeys.test.ts +1591 -0
  55. package/executors/executors.test.ts +2 -0
  56. package/executors/sysExecutor.ts +66 -3
  57. package/executors/workspaceExecutor.ts +7 -4
  58. package/frontendBuild/allRoutesBuilder.ts +72 -3
  59. package/frontendBuild/autoImportSync.ts +3 -2
  60. package/frontendBuild/buildRouteClient.test.ts +515 -12
  61. package/frontendBuild/clientBuildTypes.ts +15 -0
  62. package/frontendBuild/clientEntriesBundler.ts +38 -0
  63. package/frontendBuild/clientEntryDiscovery.test.ts +95 -1
  64. package/frontendBuild/clientEntryDiscovery.ts +88 -7
  65. package/frontendBuild/csrDevModuleCompiler.test.ts +86 -0
  66. package/frontendBuild/csrDevModuleCompiler.ts +44 -8
  67. package/frontendBuild/csrDevPatcher.ts +33 -7
  68. package/frontendBuild/csrDevTypes.ts +9 -0
  69. package/frontendBuild/devBarrelImports.test.ts +100 -0
  70. package/frontendBuild/devBarrelImports.ts +82 -23
  71. package/frontendBuild/devRegistryBundler.ts +4 -2
  72. package/frontendBuild/devRouteRuntime.test.ts +492 -0
  73. package/frontendBuild/devRouteRuntime.ts +167 -0
  74. package/frontendBuild/dictionaryAssetBuilder.test.ts +316 -0
  75. package/frontendBuild/dictionaryAssetBuilder.ts +152 -16
  76. package/frontendBuild/dictionaryConstants.ts +82 -0
  77. package/frontendBuild/dictionaryPacking.test.ts +84 -0
  78. package/frontendBuild/dictionaryPacking.ts +92 -0
  79. package/frontendBuild/dictionaryRoutes.test.ts +186 -0
  80. package/frontendBuild/dictionaryRoutes.ts +225 -0
  81. package/frontendBuild/pagesBundleBuilder.test.ts +84 -0
  82. package/frontendBuild/pagesBundleBuilder.ts +81 -3
  83. package/frontendBuild/precompressArtifacts.ts +7 -0
  84. package/frontendBuild/registryMetadataFingerprint.ts +3 -3
  85. package/frontendBuild/routeClientBuilder.ts +288 -15
  86. package/frontendBuild/routeHandoffs.test.ts +145 -0
  87. package/frontendBuild/routeHandoffs.ts +115 -0
  88. package/frontendBuild/routeRuntimeCheck.test.ts +257 -0
  89. package/frontendBuild/routeRuntimeCheck.ts +241 -0
  90. package/frontendBuild/routeRuntimePays.test.ts +137 -0
  91. package/frontendBuild/routeRuntimePays.ts +117 -0
  92. package/frontendBuild/rscServerRendererGuard.test.ts +60 -0
  93. package/frontendBuild/rscServerRendererGuard.ts +68 -0
  94. package/frontendBuild/ssrBaseArtifactBuilder.ts +24 -34
  95. package/frontendBuild/ssrDevBundler.test.ts +150 -1
  96. package/frontendBuild/ssrDevBundler.ts +66 -11
  97. package/frontendBuild/vendorFileImports.test.ts +254 -0
  98. package/frontendBuild/vendorFileImports.ts +163 -0
  99. package/frontendBuild/vendorNarrowing.ts +28 -0
  100. package/frontendBuild/vendorSpecifiers.ts +2 -0
  101. package/incrementalBuilder/buildBatch.proc.ts +9 -9
  102. package/incrementalBuilder/buildBatchProtocol.ts +1 -1
  103. package/incrementalBuilder/builderBoot.ts +5 -5
  104. package/incrementalBuilder/builderGraphPayloads.ts +4 -4
  105. package/incrementalBuilder/builderLanes.ts +2 -2
  106. package/incrementalBuilder/builderWatch.ts +8 -8
  107. package/incrementalBuilder/csrRegistry.ts +4 -4
  108. package/incrementalBuilder/incrementalBuilder.proc.test.ts +79 -0
  109. package/incrementalBuilder/incrementalBuilder.proc.ts +27 -8
  110. package/incrementalBuilder/ssrRegistry.ts +6 -6
  111. package/index.ts +1 -1
  112. package/integration/renderAdmissionSoak.test.ts +99 -0
  113. package/integration/renderAdmissionSoak.ts +609 -0
  114. package/lint/__fixtures__/no-arbitrary-color/every-color-function/bad.tsx +11 -0
  115. package/lint/__fixtures__/no-arbitrary-color/every-color-function/good.tsx +2 -0
  116. package/lint/__fixtures__/no-daisyui-legacy-class/every-class/bad.tsx +34 -0
  117. package/lint/__fixtures__/no-daisyui-legacy-class/every-class/good.tsx +2 -0
  118. package/lint/__fixtures__/no-inline-color/every-color-function/bad.tsx +10 -0
  119. package/lint/__fixtures__/no-inline-color/every-color-function/good.tsx +2 -0
  120. package/lint/__fixtures__/no-raw-palette-class/every-palette/bad.tsx +22 -0
  121. package/lint/__fixtures__/no-raw-palette-class/every-palette/good.tsx +2 -0
  122. package/lint/biomeCheck.test.ts +145 -0
  123. package/lint/biomeCheck.ts +131 -0
  124. package/lint/no-arbitrary-color.grit +5 -0
  125. package/lint/no-conditional-st-hook.grit +5 -1
  126. package/lint/no-daisyui-legacy-class.grit +8 -0
  127. package/lint/no-document-cookie.grit +3 -0
  128. package/lint/no-inline-color.grit +10 -2
  129. package/lint/no-oversized-list-limit.grit +2 -0
  130. package/lint/no-raw-palette-class.grit +7 -0
  131. package/lint/no-unpublished-form-setter.grit +2 -0
  132. package/lint/no-web-only-api-outside-webkit.grit +5 -0
  133. package/lint/no-web-storage.grit +3 -0
  134. package/lint/withheldEnvFile.ts +17 -0
  135. package/mobile/desktopBin.ts +2 -2
  136. package/mobile/desktopServerStage.ts +1 -0
  137. package/mobile/nativeApp.test.ts +7 -5
  138. package/mobile/nativeApp.ts +2 -2
  139. package/mobile/nativeConfig.test.ts +96 -1
  140. package/mobile/nativeConfig.ts +46 -12
  141. package/mobile/serverBundleSecrets.ts +43 -0
  142. package/package.json +15 -169
  143. package/packageExports.test.ts +38 -24
  144. package/quality/dictionaryKeys.test.ts +173 -0
  145. package/quality/dictionaryKeys.ts +415 -0
  146. package/quality/objectImportReport.test.ts +36 -0
  147. package/quality/objectImportReport.ts +102 -0
  148. package/quality/qualityScanner.ts +1 -1
  149. package/quality/routeRuntimeReport.test.ts +91 -0
  150. package/quality/routeRuntimeReport.ts +121 -0
  151. package/quality/runtimeConstantFacts.ts +71 -0
  152. package/quality/runtimeConstantGraph.ts +123 -0
  153. package/quality/runtimeConstantReads.ts +116 -0
  154. package/quality/runtimeImports.test.ts +190 -0
  155. package/quality/runtimeImports.ts +233 -0
  156. package/quality/runtimeKeyNames.ts +46 -0
  157. package/quality/runtimeLexicalScope.ts +132 -0
  158. package/quality/runtimeMarkerReach.test.ts +84 -0
  159. package/quality/runtimeMarkerReach.ts +255 -0
  160. package/quality/runtimeModuleFacts.ts +290 -0
  161. package/quality/runtimeNameTable.test.ts +172 -0
  162. package/quality/runtimeNameTable.ts +477 -0
  163. package/quality/runtimeScopeReport.test.ts +123 -0
  164. package/quality/runtimeScopeReport.ts +167 -0
  165. package/quality/runtimeSliceKey.ts +269 -0
  166. package/quality/runtimeSyntax.ts +133 -0
  167. package/quality/runtimeTable.fixture.ts +189 -0
  168. package/quality/runtimeUse.test.ts +737 -0
  169. package/quality/runtimeUse.ts +696 -0
  170. package/quality/runtimeUseReadable.test.ts +393 -0
  171. package/quality/ssrScanner.test.ts +13 -0
  172. package/quality/ssrScanner.ts +1 -1
  173. package/test/secretEnvFixture.ts +134 -0
  174. package/test/testHelpers.ts +11 -0
  175. package/transforms/barrelAnalyzer.ts +26 -4
  176. package/transforms/barrelImportsPlugin.ts +82 -14
  177. package/transforms/frameworkObjects.fixture.tsx +58 -0
  178. package/transforms/frameworkObjects.test.ts +54 -0
  179. package/transforms/modelReference.test.ts +196 -0
  180. package/transforms/modelReference.ts +39 -0
  181. package/transforms/objectImportEdits.ts +150 -0
  182. package/transforms/objectMemberImports.test.ts +347 -0
  183. package/transforms/objectMemberImports.ts +537 -0
  184. package/transforms/objectModule.test.ts +237 -0
  185. package/transforms/objectModule.ts +458 -0
  186. package/transforms/objectModuleAnalyzer.ts +104 -0
  187. package/transforms/reactIconImports.test.ts +231 -0
  188. package/transforms/reactIconImports.ts +325 -0
  189. package/transforms/routeConstants.ts +122 -0
  190. package/transforms/routeRuntime.test.ts +835 -0
  191. package/transforms/routeRuntime.ts +703 -0
  192. package/transforms/routeRuntimeEdits.ts +92 -0
  193. package/transforms/routeRuntimeGraph.ts +66 -0
  194. package/transforms/routeRuntimePlan.ts +244 -0
  195. package/transforms/secretEnvDeclaration.test.ts +208 -0
  196. package/transforms/secretEnvDeclaration.ts +213 -0
  197. package/transforms/secretEnvFile.test.ts +117 -0
  198. package/transforms/secretEnvFile.ts +113 -0
  199. package/transforms/secretEnvName.test.ts +54 -0
  200. package/transforms/secretEnvName.ts +29 -0
  201. package/transforms/secretEnvSource.test.ts +148 -0
  202. package/transforms/secretEnvSource.ts +166 -0
  203. package/transforms/serverEnvEvaluationError.ts +11 -0
  204. package/transforms/serverEnvPlugin.test.ts +2 -1
  205. package/transforms/serverEnvPlugin.ts +13 -0
  206. package/transforms/serverEnvProfile.test.ts +115 -2
  207. package/transforms/serverEnvProfile.ts +117 -40
  208. package/transforms/serverEnvSecrets.test.ts +292 -0
  209. package/transforms/signalDescriptors.test.ts +280 -0
  210. package/transforms/signalDescriptors.ts +227 -0
  211. package/transforms/thisFreeExports.ts +87 -0
  212. package/transforms/transforms.test.ts +180 -3
  213. package/transforms/tsconfigPackageResolver.test.ts +1 -0
  214. package/tunnel/createTunnel.test.ts +29 -8
  215. package/tunnel/createTunnel.ts +18 -11
  216. package/typecheck/projectTypecheck.test.ts +29 -0
  217. package/typecheck/typeChecker.test.ts +49 -0
  218. package/typecheck/typeChecker.ts +9 -7
  219. package/typecheck/withheldDiagnostics.ts +41 -0
  220. package/util/fileEditor.ts +1 -0
  221. package/util/selectModel.ts +1 -0
  222. package/workflow/executor.ts +6 -2
  223. package/workflow/index.ts +1 -0
  224. package/workflow/plan.ts +36 -7
  225. package/workflow/types.ts +1 -1
  226. package/workflow/uiTarget.ts +50 -0
  227. package/workspace/getRelatedCnsts.ts +7 -0
  228. package/workspace/scanInfo.ts +1 -1
  229. package/workspace/workspaceLayout.ts +1 -0
@@ -0,0 +1,22 @@
1
+ export const Slate = () => <div className="bg-slate-500" />; // @flag
2
+ export const Gray = () => <div className="bg-gray-500" />; // @flag
3
+ export const Zinc = () => <div className="bg-zinc-500" />; // @flag
4
+ export const Neutral = () => <div className="bg-neutral-500" />; // @flag
5
+ export const Stone = () => <div className="bg-stone-500" />; // @flag
6
+ export const Red = () => <div className="bg-red-500" />; // @flag
7
+ export const Orange = () => <div className="bg-orange-500" />; // @flag
8
+ export const Amber = () => <div className="bg-amber-500" />; // @flag
9
+ export const Yellow = () => <div className="bg-yellow-500" />; // @flag
10
+ export const Lime = () => <div className="bg-lime-500" />; // @flag
11
+ export const Green = () => <div className="bg-green-500" />; // @flag
12
+ export const Emerald = () => <div className="bg-emerald-500" />; // @flag
13
+ export const Teal = () => <div className="bg-teal-500" />; // @flag
14
+ export const Cyan = () => <div className="bg-cyan-500" />; // @flag
15
+ export const Sky = () => <div className="bg-sky-500" />; // @flag
16
+ export const Blue = () => <div className="bg-blue-500" />; // @flag
17
+ export const Indigo = () => <div className="bg-indigo-500" />; // @flag
18
+ export const Violet = () => <div className="bg-violet-500" />; // @flag
19
+ export const Purple = () => <div className="bg-purple-500" />; // @flag
20
+ export const Fuchsia = () => <div className="bg-fuchsia-500" />; // @flag
21
+ export const Pink = () => <div className="bg-pink-500" />; // @flag
22
+ export const Rose = () => <div className="bg-rose-500" />; // @flag
@@ -0,0 +1,2 @@
1
+ export const PaletteNameWithoutAShade = () => <div className="text-red-dark sky-blue" />; // @ok
2
+ export const PaletteNameWithoutAUtility = () => <div className="red-500 rose-300" />; // @ok
@@ -0,0 +1,145 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { mkdir, symlink } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { hasBiome, tempDirs, writeText } from "../test/testHelpers";
5
+ import { BiomeCheck } from "./biomeCheck";
6
+
7
+ const makeTempRoot = tempDirs("akan-devkit-biome-check-");
8
+ const repoRoot = path.resolve(import.meta.dir, "../../../..");
9
+ const sentinel = "SENTINEL_DB_PASSWORD_4f9c2a71e0b3";
10
+
11
+ const workspace = async () => {
12
+ const root = await makeTempRoot();
13
+ await mkdir(path.join(root, "node_modules"), { recursive: true });
14
+ await symlink(path.join(repoRoot, "node_modules/@biomejs"), path.join(root, "node_modules/@biomejs"));
15
+ await writeText(
16
+ path.join(root, "biome.json"),
17
+ JSON.stringify({
18
+ vcs: { enabled: false },
19
+ linter: { rules: { suspicious: { noTemplateCurlyInString: "error", noExplicitAny: "error" } } },
20
+ }),
21
+ );
22
+ await writeText(
23
+ path.join(root, "apps/demo/env/env.server.main.ts"),
24
+ `export const env = { apiKey: "${sentinel}", password: "${sentinel}\${x}" };\n`,
25
+ );
26
+ await writeText(path.join(root, "apps/demo/ui/card.ts"), "export const card: any = 1;\n");
27
+ return root;
28
+ };
29
+
30
+ const run = async (root: string, options: { write: boolean; maxDiagnostics: number }) => {
31
+ const printed: string[] = [];
32
+ const error = await BiomeCheck.run({
33
+ root,
34
+ target: path.join(root, "apps/demo"),
35
+ configPath: path.join(root, "biome.json"),
36
+ print: (text) => printed.push(text),
37
+ ...options,
38
+ }).then(
39
+ () => null,
40
+ (e: unknown) => e as Error,
41
+ );
42
+ return { output: printed.join("\n"), error };
43
+ };
44
+
45
+ describe.skipIf(!hasBiome)("BiomeCheck", () => {
46
+ test.each([true, false])(
47
+ "names an env file's diagnostics by position and rule only, with write %p",
48
+ async (write) => {
49
+ const root = await workspace();
50
+ const { output, error } = await run(root, { write, maxDiagnostics: 200 });
51
+
52
+ expect(output).not.toContain(sentinel);
53
+ expect(output).not.toContain("apiKey");
54
+ expect(output).toMatch(
55
+ /apps\/demo\/env\/env\.server\.main\.ts:\d+:\d+ error lint\/suspicious\/noTemplateCurlyInString/,
56
+ );
57
+ expect(output).toContain("withheld");
58
+ expect(output).toContain("export const card: any = 1;");
59
+ expect(error?.message).toBe(write ? "Lint found 2 errors." : "Lint found 3 errors.");
60
+ if (!write) expect(output).toMatch(/env\.server\.main\.ts:0:0 error format/);
61
+ },
62
+ 60_000,
63
+ );
64
+
65
+ test("counts an env file's diagnostics when nothing else fails, and keeps to the cap", async () => {
66
+ const root = await workspace();
67
+ await writeText(path.join(root, "apps/demo/ui/card.ts"), "export const card = 1;\n");
68
+ const all = await run(root, { write: true, maxDiagnostics: 0 });
69
+ expect(all.error?.message).toBe("Lint found 1 error.");
70
+ expect(all.output).not.toContain(sentinel);
71
+
72
+ const capped = await run(await workspace(), { write: false, maxDiagnostics: 1 });
73
+ expect(capped.output.match(/env\.server\.main\.ts:/g)).toHaveLength(1);
74
+ expect(capped.output).toContain("not shown");
75
+ expect(capped.output).not.toContain("export const card: any");
76
+ expect(capped.error).not.toBeNull();
77
+ }, 60_000);
78
+
79
+ test("explains a biome.json Biome cannot read, in Biome's own words", async () => {
80
+ const root = await workspace();
81
+ await writeText(path.join(root, "biome.json"), '{ // a comment\n "vcs": { "enabled": false } }');
82
+ const { error, output } = await run(root, { write: false, maxDiagnostics: 200 });
83
+ expect(output).toBe("");
84
+ expect(error?.message).toContain("biome.json");
85
+ expect(error?.message).not.toContain("gave no report");
86
+ }, 60_000);
87
+
88
+ test("reports every file of a large app in groups, and stops at the cap with the count left", async () => {
89
+ const root = await workspace();
90
+ await writeText(path.join(root, "apps/demo/env/env.server.main.ts"), "export const env = {};\n");
91
+ await writeText(path.join(root, "apps/demo/ui/card.ts"), "export const card = 1;\n");
92
+ for (let idx = 0; idx < 250; idx += 1)
93
+ await writeText(path.join(root, `apps/demo/ui/many/file${idx}.ts`), `export const value${idx}: any = ${idx};\n`);
94
+ const reported = (output: string) => output.match(/noExplicitAny ━/g)?.length ?? 0;
95
+
96
+ const all = await run(root, { write: false, maxDiagnostics: 0 });
97
+ expect(reported(all.output)).toBe(250);
98
+ expect(all.output).not.toContain("not shown");
99
+ expect(all.output.match(/^Found 250 errors\.$/gm)).toHaveLength(1);
100
+ expect(all.output).not.toContain("Checked ");
101
+ expect(all.error?.message).toBe("Lint found 250 errors.");
102
+
103
+ const capped = await run(root, { write: false, maxDiagnostics: 150 });
104
+ expect(reported(capped.output)).toBe(150);
105
+ expect(capped.output).toContain("50 more diagnostics are not shown; --max-diagnostics 0 shows them all.");
106
+ }, 120_000);
107
+
108
+ test("lists after a write only what is still wrong", async () => {
109
+ const root = await workspace();
110
+ await writeText(path.join(root, "apps/demo/env/env.server.main.ts"), "export const env = {};\n");
111
+ await writeText(path.join(root, "apps/demo/ui/card.ts"), "export const card = 1;\nexport const other = 2\n");
112
+ const { output, error } = await run(root, { write: true, maxDiagnostics: 200 });
113
+ expect(output).toBe("");
114
+ expect(error).toBeNull();
115
+ expect(await Bun.file(path.join(root, "apps/demo/ui/card.ts")).text()).toContain("export const other = 2;");
116
+ }, 60_000);
117
+
118
+ test("withholds a grit plugin diagnostic on an env file", async () => {
119
+ const root = await workspace();
120
+ await writeText(
121
+ path.join(root, "no-marker.grit"),
122
+ 'engine biome(1.0)\nlanguage js(typescript)\n`MARKER` as $m where { register_diagnostic(span = $m, message = "marker found", severity = "error") }\n',
123
+ );
124
+ await writeText(
125
+ path.join(root, "biome.json"),
126
+ JSON.stringify({ vcs: { enabled: false }, plugins: ["./no-marker.grit"] }),
127
+ );
128
+ await writeText(
129
+ path.join(root, "apps/demo/env/env.server.main.ts"),
130
+ `export const env = { password: MARKER, other: "${sentinel}" };\n`,
131
+ );
132
+ const { output, error } = await run(root, { write: false, maxDiagnostics: 200 });
133
+ expect(output).not.toContain(sentinel);
134
+ expect(output).toMatch(/env\.server\.main\.ts:\d+:\d+ error plugin - the text is withheld/);
135
+ expect(error).not.toBeNull();
136
+ }, 60_000);
137
+
138
+ test("drops a group's own summary lines, coloured or not", () => {
139
+ const coloured = "\u001b[1mChecked 100 files in 1s.\u001b[0m\n\u001b[31mFound 3 errors.\u001b[39m\na.ts:1:1 lint/x";
140
+ expect(BiomeCheck.withoutSummary(coloured)).toBe("a.ts:1:1 lint/x");
141
+ expect(BiomeCheck.withoutSummary("Checked 1 file in 2ms.\nFound 1 warning.\nb.ts:2:1 lint/y")).toBe(
142
+ "b.ts:2:1 lint/y",
143
+ );
144
+ });
145
+ });
@@ -0,0 +1,131 @@
1
+ import { CliError } from "../commandDecorators/cliError";
2
+ import { type BiomeDiagnostic, Linter, parseBiomeReport } from "./linter";
3
+ import { WithheldEnvFile } from "./withheldEnvFile";
4
+
5
+ export interface BiomeCheckOptions {
6
+ root: string;
7
+ target: string;
8
+ configPath: string | null;
9
+ write: boolean;
10
+ //? 0 shows every diagnostic.
11
+ maxDiagnostics: number;
12
+ print: (text: string) => void;
13
+ }
14
+
15
+ //* Biome's own report quotes source lines, so a first run writes the fixes and reads the JSON report. An env file's
16
+ //* diagnostics are printed from it by position and rule alone; Biome prints the rest again, from the files that have any.
17
+ export class BiomeCheck {
18
+ static readonly #groupSize = 100;
19
+ static readonly #summary = /^(?:Checked \d+ files? in |Found \d+ (?:errors?|warnings?|info))/;
20
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: an ANSI colour sequence starts with the escape character
21
+ static readonly #colour = /\u001b\[[0-9;]*m/g;
22
+
23
+ static async run({ root, target, configPath, write, maxDiagnostics, print }: BiomeCheckOptions) {
24
+ const [biome, ...biomeArgs] = Linter.biomeCommand(root);
25
+ //? Pinned: without it a malformed biome.json makes Biome fall back to discovery and name the wrong file.
26
+ const config = configPath ? ["--config-path", configPath] : [];
27
+ const first = Bun.spawn(
28
+ [
29
+ biome,
30
+ ...biomeArgs,
31
+ "check",
32
+ ...(write ? ["--write"] : []),
33
+ "--reporter=json",
34
+ "--max-diagnostics=none",
35
+ "--no-errors-on-unmatched",
36
+ ...config,
37
+ target,
38
+ ],
39
+ { cwd: root, stdout: "pipe", stderr: "pipe" },
40
+ );
41
+ const [stdout, stderr, exitCode] = await Promise.all([
42
+ new Response(first.stdout).text(),
43
+ new Response(first.stderr).text(),
44
+ first.exited,
45
+ ]);
46
+ let diagnostics: BiomeDiagnostic[];
47
+ try {
48
+ diagnostics = parseBiomeReport(stdout).diagnostics ?? [];
49
+ } catch {
50
+ const cause = (stderr || stdout).trim();
51
+ throw new CliError(
52
+ "failed",
53
+ cause && !WithheldEnvFile.namesEnvFile(cause)
54
+ ? cause
55
+ : `Biome exited with ${exitCode} and gave no report that could be read.`,
56
+ );
57
+ }
58
+ const shown = diagnostics.filter(({ severity }) => severity !== "hint");
59
+ const inEnv = (diagnostic: BiomeDiagnostic) =>
60
+ WithheldEnvFile.isEnvFile(diagnostic.location?.path?.replaceAll("\\", "/"));
61
+ const fromEnv = shown.filter(inEnv);
62
+ const rest = shown.filter((diagnostic) => !inEnv(diagnostic));
63
+ let remaining = maxDiagnostics > 0 ? maxDiagnostics : Number.POSITIVE_INFINITY;
64
+ for (const diagnostic of fromEnv.slice(0, remaining)) print(BiomeCheck.#line(diagnostic));
65
+ let hidden = Math.max(0, fromEnv.length - remaining);
66
+ remaining -= Math.min(fromEnv.length, remaining);
67
+ for (const group of BiomeCheck.#groups(rest)) {
68
+ if (remaining <= 0) {
69
+ hidden += group.count;
70
+ continue;
71
+ }
72
+ const second = Bun.spawn(
73
+ [
74
+ biome,
75
+ ...biomeArgs,
76
+ "check",
77
+ //? Biome shows 20 diagnostics unless told otherwise.
78
+ `--max-diagnostics=${Number.isFinite(remaining) ? remaining : "none"}`,
79
+ ...(process.stdout.isTTY && !process.env.NO_COLOR ? ["--colors=force"] : []),
80
+ ...config,
81
+ ...group.files,
82
+ ],
83
+ { cwd: root, stdout: "pipe", stderr: "pipe" },
84
+ );
85
+ const [out, err] = await Promise.all([
86
+ new Response(second.stdout).text(),
87
+ new Response(second.stderr).text(),
88
+ second.exited,
89
+ ]);
90
+ print(BiomeCheck.withoutSummary(`${out}${err}`));
91
+ remaining -= Math.min(group.count, remaining);
92
+ }
93
+ for (const diagnostic of rest.filter(({ location }) => !location?.path)) print(diagnostic.message);
94
+ if (hidden) print(`${hidden} more diagnostics are not shown; --max-diagnostics 0 shows them all.`);
95
+ const count = (severity: string) => shown.filter((diagnostic) => diagnostic.severity === severity).length;
96
+ for (const [severity, noun] of [
97
+ ["error", "error"],
98
+ ["warning", "warning"],
99
+ ["information", "info"],
100
+ ] as const)
101
+ if (count(severity))
102
+ print(`Found ${count(severity)} ${noun}${count(severity) === 1 || noun === "info" ? "" : "s"}.`);
103
+ const errors = count("error");
104
+ if (errors) throw new CliError("checkFailed", `Lint found ${errors} error${errors === 1 ? "" : "s"}.`);
105
+ }
106
+
107
+ //? Each group's summary counts only its own files; the one printed at the end counts the whole run.
108
+ static withoutSummary(text: string) {
109
+ return text
110
+ .split("\n")
111
+ .filter((line) => !BiomeCheck.#summary.test(line.replace(BiomeCheck.#colour, "")))
112
+ .join("\n")
113
+ .trim();
114
+ }
115
+
116
+ static #groups(diagnostics: BiomeDiagnostic[]) {
117
+ const counts = new Map<string, number>();
118
+ for (const { location } of diagnostics)
119
+ if (location?.path) counts.set(location.path, (counts.get(location.path) ?? 0) + 1);
120
+ const entries = [...counts];
121
+ return Array.from({ length: Math.ceil(entries.length / BiomeCheck.#groupSize) }, (_, index) => {
122
+ const slice = entries.slice(index * BiomeCheck.#groupSize, (index + 1) * BiomeCheck.#groupSize);
123
+ return { files: slice.map(([file]) => file), count: slice.reduce((sum, [, count]) => sum + count, 0) };
124
+ });
125
+ }
126
+
127
+ static #line({ severity, category, location }: BiomeDiagnostic) {
128
+ const at = `${location?.path}:${location?.start?.line ?? 0}:${location?.start?.column ?? 0}`;
129
+ return `${at} ${severity} ${category ?? "biome"} - ${WithheldEnvFile.note}`;
130
+ }
131
+ }
@@ -10,6 +10,11 @@ or {
10
10
  JsStringLiteralExpression() as $s,
11
11
  JsTemplateChunkElement() as $s
12
12
  } where {
13
+ // GritQL compiles a regex anew for every node it tries, so a substring every match must contain gates it.
14
+ $s <: or {
15
+ includes "[#", includes "[rgb", includes "[hsl", includes "[ok", includes "[lab(", includes "[lch(",
16
+ includes "[hwb(", includes "[color("
17
+ },
13
18
  $s <: r"[\s\S]*\[(?:#[0-9a-fA-F]{3,8}|(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|hwb|color)\([^\]]*\))\][\s\S]*",
14
19
  register_diagnostic(
15
20
  span = $s,
@@ -32,6 +32,8 @@ pattern st_hook_call() {
32
32
  `$chain.value($args)` where { $chain <: r"st\s*\.\s*expose\s*\([\s\S]*" },
33
33
  // Computed access (`st["use"].x()`, `st.use[key]()`) at any step, which would take a snippet per combination.
34
34
  JsCallExpression(callee = $callee) where {
35
+ // GritQL compiles a regex anew for every node it tries, so a substring every match must contain gates it.
36
+ $callee <: or { includes "use", includes "sel", includes "ref" },
35
37
  $callee <: or {
36
38
  r"st\s*(?:\.\s*use|\[\s*[\x27\x22`]use[\x27\x22`]\s*\])\s*(?:\.\s*[\w$]+|\[[^\]]*\])",
37
39
  r"st\s*(?:\.\s*slice|\[\s*[\x27\x22`]slice[\x27\x22`]\s*\])\s*(?:\.\s*[\w$]+|\[[^\]]*\])\s*(?:\.\s*use|\[\s*[\x27\x22`]use[\x27\x22`]\s*\])\s*(?:\.\s*[\w$]+|\[[^\]]*\])",
@@ -78,7 +80,9 @@ pattern passed_by_name($name) {
78
80
  }
79
81
  }
80
82
 
81
- JsCallExpression() as $call where {
83
+ // GritQL copies its match state for every snippet it tries, so a substring every hook's callee contains goes first.
84
+ JsCallExpression(callee = $hookCallee) as $call where {
85
+ $hookCallee <: includes "st",
82
86
  $call <: st_hook_call(),
83
87
  or {
84
88
  $call <: within JsLogicalExpression(right = $right) where { $right <: contains $call } until function_boundary(),
@@ -18,8 +18,10 @@ or {
18
18
  JsStringLiteralExpression() as $s,
19
19
  JsTemplateChunkElement() as $s
20
20
  } where {
21
+ // GritQL compiles a regex anew for every node it tries, so a substring every match must contain gates each one.
21
22
  any {
22
23
  and {
24
+ $s <: or { includes "-base-", includes "-content", includes "-error" },
23
25
  $s <: r"[\s\S]*(?:^|[\s\"'`{(\[:!])(?:bg|text|border(?:-[tblrxy])?(?:-[se])?|ring(?:-offset)?|fill|stroke|shadow|from|to|via|divide|outline|decoration|placeholder|caret|accent)-(?:base-(?:100|200|300|content)|(?:primary|secondary|accent|neutral|info|success|warning|error)-content|error)(?:[\s\"'`})\]:/!,]|$)[\s\S]*",
24
26
  register_diagnostic(
25
27
  span = $s,
@@ -28,6 +30,12 @@ or {
28
30
  )
29
31
  },
30
32
  and {
33
+ $s <: or {
34
+ includes "btn-", includes "badge-", includes "alert-", includes "input-", includes "select-",
35
+ includes "textarea-", includes "checkbox-", includes "toggle-", includes "loading-", includes "card-",
36
+ includes "modal-", includes "collapse-", includes "dropdown-", includes "stat-", includes "tab",
37
+ includes "menu-", includes "steps-", includes "join-item", includes "mockup-", includes "drawer-"
38
+ },
31
39
  $s <: r"[\s\S]*(?:^|[\s\"'`{(\[:!])(?:btn-(?:primary|secondary|accent|neutral|info|success|warning|error|ghost|link|outline|square|circle|wide|block|xs|sm|md|lg)|badge-(?:primary|secondary|accent|neutral|info|success|warning|error|ghost|outline)|alert-(?:info|success|warning|error)|input-(?:bordered|primary|secondary|accent|ghost|error)|select-(?:bordered|primary|ghost)|textarea-(?:bordered|primary|ghost)|checkbox-(?:primary|secondary|accent)|toggle-(?:primary|secondary|accent)|loading-(?:spinner|dots|ring|ball|bars|infinity)|card-(?:body|title|actions)|modal-(?:box|action|backdrop)|collapse-(?:title|content|arrow|plus)|dropdown-(?:content|end|start|hover)|stat-(?:title|value|desc)|tabs-(?:boxed|lifted|bordered)|tab-active|menu-(?:title|dropdown)|steps-(?:horizontal|vertical)|join-item|mockup-(?:code|phone|browser|window)|drawer-(?:side|content|toggle))(?:[\s\"'`})\]:/!,]|$)[\s\S]*",
32
40
  register_diagnostic(
33
41
  span = $s,
@@ -10,6 +10,8 @@ language js(typescript, jsx)
10
10
  // write is its own node (JsStaticMemberAssignment) that the expression form does not match.
11
11
  or {
12
12
  JsStaticMemberExpression() as $access where {
13
+ // GritQL copies its match state for every snippet it tries, so a substring every match must contain goes first.
14
+ $access <: includes "cookie",
13
15
  $access <: or { `document.cookie`, `window.document.cookie`, `globalThis.document.cookie`, `self.document.cookie` },
14
16
  register_diagnostic(
15
17
  span = $access,
@@ -18,6 +20,7 @@ or {
18
20
  )
19
21
  },
20
22
  JsStaticMemberAssignment(object = $object, member = $member) as $access where {
23
+ $member <: includes "cookie",
21
24
  $member <: `cookie`,
22
25
  $object <: or { `document`, `window.document`, `globalThis.document`, `self.document` },
23
26
  register_diagnostic(
@@ -11,16 +11,24 @@ language js(typescript, jsx)
11
11
  // warnings, not errors, so code written before the rule reached them is not broken.
12
12
  // The hex arm skips `url(#id)`: a paint-server id such as `#fade` is spelled in hex digits.
13
13
  // Cases: lint/__fixtures__/no-inline-color/{bad,good}.tsx
14
+
15
+ // GritQL compiles a regex anew for every node it tries, so a substring every match must contain gates it first.
16
+ pattern colour_literal_text() {
17
+ or { includes "#", includes "rgb", includes "hsl", includes "lab(", includes "lch(", includes "hwb(" }
18
+ }
19
+
14
20
  or {
15
21
  or {
16
- JsStringLiteralExpression() as $s where { $s <: within `style={$obj}` },
17
- JsTemplateChunkElement() as $s where { $s <: within `<style>$body</style>` }
22
+ JsStringLiteralExpression() as $s where { $s <: colour_literal_text(), $s <: within `style={$obj}` },
23
+ JsTemplateChunkElement() as $s where { $s <: colour_literal_text(), $s <: within `<style>$body</style>` }
18
24
  } where { $tier = "error" },
19
25
  or {
20
26
  or { JsxString(), JsStringLiteralExpression(), JsTemplateChunkElement() } as $s where {
27
+ $s <: colour_literal_text(),
21
28
  $s <: within JsxAttribute(name = r"(?:fill|stroke|stopColor|floodColor|lightingColor|color|stop-color|flood-color|lighting-color)")
22
29
  },
23
30
  or { JsStringLiteralExpression(), JsTemplateChunkElement() } as $s where {
31
+ $s <: colour_literal_text(),
24
32
  $s <: within or { `$el.style.$prop = $value`, `$el.style[$prop] = $value`, `$el.style.setProperty($prop, $value)` }
25
33
  }
26
34
  } where { $tier = "warn" }
@@ -34,6 +34,8 @@ pattern page_sort() {
34
34
  }
35
35
 
36
36
  JsCallExpression(callee = $callee, arguments = JsCallArguments(args = $args)) where {
37
+ // GritQL copies its match state for every snippet it tries, so a substring every match must contain goes first.
38
+ $callee <: or { includes "fetch", includes "do" },
37
39
  or {
38
40
  and {
39
41
  $callee <: `fetch.$endpoint`,
@@ -16,6 +16,13 @@ or {
16
16
  JsStringLiteralExpression() as $s,
17
17
  JsTemplateChunkElement() as $s
18
18
  } where {
19
+ // GritQL compiles a regex anew for every node it tries, so a substring every match must contain gates it.
20
+ $s <: or {
21
+ includes "slate-", includes "gray-", includes "zinc-", includes "neutral-", includes "stone-", includes "red-",
22
+ includes "orange-", includes "amber-", includes "yellow-", includes "lime-", includes "green-", includes "emerald-",
23
+ includes "teal-", includes "cyan-", includes "sky-", includes "blue-", includes "indigo-", includes "violet-",
24
+ includes "purple-", includes "fuchsia-", includes "pink-", includes "rose-"
25
+ },
19
26
  $s <: r"[\s\S]*(?:^|[\s\"'`{(\[:!])(?:bg|text|border(?:-[tblrxy])?(?:-[se])?|ring(?:-offset)?|fill|stroke|shadow|from|to|via|divide|outline|decoration|placeholder|caret|accent)-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-\d{2,3}(?:[\s\"'`})\]:/!,]|$)[\s\S]*",
20
27
  register_diagnostic(
21
28
  span = $s,
@@ -24,6 +24,8 @@ language js(typescript, jsx)
24
24
  // bind to different text, so the metavariable cannot unify them. Under-reporting, not a false positive.
25
25
  //
26
26
  JsxAttribute() as $attr where {
27
+ // GritQL copies its match state for every node a pattern tries, so a substring the reported body needs goes first.
28
+ $attr <: includes "st.do.",
27
29
  $attr <: contains JsArrowFunctionExpression() as $arrow,
28
30
  $arrow <: `($p) => $body`,
29
31
  // One bare parameter. A metavariable matches a whole parameter list leniently, so `(a, b)` binds the
@@ -10,6 +10,8 @@ language js(typescript, jsx)
10
10
  // points, because the name is also the libs/shared model (`Notification.View`, `cnst.Notification`).
11
11
  or {
12
12
  JsStaticMemberExpression() as $access where {
13
+ // GritQL copies its match state for every snippet it tries, so a substring every match must contain goes first.
14
+ $access <: includes "navigator",
13
15
  $access <: or { `navigator.share`, `navigator.canShare` },
14
16
  register_diagnostic(
15
17
  span = $access,
@@ -18,6 +20,7 @@ or {
18
20
  )
19
21
  },
20
22
  JsStaticMemberExpression() as $access where {
23
+ $access <: or { includes "navigator", includes "Notification" },
21
24
  $access <: or { `navigator.serviceWorker`, `Notification.requestPermission`, `Notification.permission` },
22
25
  register_diagnostic(
23
26
  span = $access,
@@ -26,6 +29,7 @@ or {
26
29
  )
27
30
  },
28
31
  JsStaticMemberExpression() as $access where {
32
+ $access <: includes "navigator",
29
33
  $access <: `navigator.geolocation`,
30
34
  register_diagnostic(
31
35
  span = $access,
@@ -34,6 +38,7 @@ or {
34
38
  )
35
39
  },
36
40
  JsStaticMemberExpression() as $access where {
41
+ $access <: includes "navigator",
37
42
  $access <: `navigator.vibrate`,
38
43
  register_diagnostic(
39
44
  span = $access,
@@ -11,6 +11,8 @@ language js(typescript, jsx)
11
11
  // bare snippet matches the name in any position, a field, an object key or JSX text included.
12
12
  or {
13
13
  JsIdentifierExpression() as $access where {
14
+ // GritQL copies its match state for every snippet it tries, so a substring every match must contain goes first.
15
+ $access <: includes "Storage",
14
16
  $access <: or { `localStorage`, `sessionStorage` },
15
17
  register_diagnostic(
16
18
  span = $access,
@@ -19,6 +21,7 @@ or {
19
21
  )
20
22
  },
21
23
  JsStaticMemberExpression(object = $root, member = $name) as $access where {
24
+ $name <: includes "Storage",
22
25
  $root <: or { `window`, `globalThis`, `self` },
23
26
  $name <: or { `localStorage`, `sessionStorage` },
24
27
  register_diagnostic(
@@ -0,0 +1,17 @@
1
+ //* An env file holds deployment secrets, and a source line, a formatter diff or a rule message quotes them.
2
+ export class WithheldEnvFile {
3
+ static readonly #name = "env[\\\\/]env\\.(?:server|client)(?:\\.[A-Za-z0-9-]+)*\\.ts";
4
+ static readonly #envFile = new RegExp(`[\\\\/]${WithheldEnvFile.#name}$`);
5
+ static readonly #named = new RegExp(WithheldEnvFile.#name);
6
+ static readonly note = "the text is withheld because this file holds secrets";
7
+
8
+ static isEnvFile(fileName: string | undefined) {
9
+ return (
10
+ fileName !== undefined && WithheldEnvFile.#envFile.test(fileName.startsWith("env/") ? `/${fileName}` : fileName)
11
+ );
12
+ }
13
+
14
+ static namesEnvFile(text: string) {
15
+ return WithheldEnvFile.#named.test(text);
16
+ }
17
+ }
@@ -94,7 +94,7 @@ export class DesktopBin {
94
94
  throw new Error(
95
95
  `${owner}: bin.${name} names no ${platform} file, the platform this desktop app is built for (it names ${Object.keys(platforms).join(", ") || "none"}).`,
96
96
  );
97
- const executable = await this.#executable(`${owner}: bin.${name}.${platform}`, source);
97
+ const executable = await this.executable(`${owner}: bin.${name}.${platform}`, source);
98
98
  const target = path.join(dir, DesktopBin.fileName(name, executable));
99
99
  await Bun.write(target, Bun.file(executable));
100
100
  await chmod(target, 0o755);
@@ -103,7 +103,7 @@ export class DesktopBin {
103
103
  return [...chosen.keys()];
104
104
  }
105
105
 
106
- async #executable(at: string, source: AkanBinSource): Promise<string> {
106
+ async executable(at: string, source: AkanBinSource): Promise<string> {
107
107
  const file = "url" in source ? await this.#download(at, source) : source.path;
108
108
  if (!(await Bun.file(file).exists())) throw new Error(`${at}: ${file} does not exist`);
109
109
  if (!source.file) return file;
@@ -39,6 +39,7 @@ export class DesktopServerStage {
39
39
  "csr",
40
40
  "mcp-apps",
41
41
  "public",
42
+ "bin",
42
43
  ".akan",
43
44
  ]);
44
45
  //? Only the RSC worker loads it, and its peer webpack makes 35 of the 43 MB an install would add.
@@ -273,12 +273,12 @@ describe("NativeApp", () => {
273
273
  expect(() => NativeApp.assertInstaller("ios", true)).toThrow(/not for ios/);
274
274
  });
275
275
 
276
- test("opens a dev build on its target's home, the CSR shell under the locale", () => {
276
+ test("opens a dev build on its target's home, the CSR shell under the locale, the device's language to pick", () => {
277
277
  expect(new NativeApp(fakeApp(), target({ indexPath: "/explore" })).startPath("en", "ios")).toBe(
278
- "/en/explore?csr=true&akanMobileTarget=default&akanMobileIndexPath=%2Fexplore",
278
+ "/en/explore?csr=true&akanMobileTarget=default&akanMobileLang=device&akanMobileIndexPath=%2Fexplore",
279
279
  );
280
280
  expect(new NativeApp(fakeApp(), target({ name: "admin", basePath: "/admin/" })).startPath("ko", "android")).toBe(
281
- "/ko/admin?csr=true&akanMobileTarget=admin&akanMobileBasePath=admin",
281
+ "/ko/admin?csr=true&akanMobileTarget=admin&akanMobileLang=device&akanMobileBasePath=admin",
282
282
  );
283
283
  });
284
284
 
@@ -289,9 +289,11 @@ describe("NativeApp", () => {
289
289
  expect(app.indexPath("android")).toBe("/mobile");
290
290
  expect(app.indexPath("macos")).toBe("/");
291
291
  expect(app.indexPath("windows")).toBe("/");
292
- expect(app.startPath("en", "macos")).toBe("/en?csr=true&akanMobileTarget=default&akanMobileIndexPath=%2F");
292
+ expect(app.startPath("en", "macos")).toBe(
293
+ "/en?csr=true&akanMobileTarget=default&akanMobileLang=device&akanMobileIndexPath=%2F",
294
+ );
293
295
  expect(app.startPath("en", "ios")).toBe(
294
- "/en/mobile?csr=true&akanMobileTarget=default&akanMobileIndexPath=%2Fmobile",
296
+ "/en/mobile?csr=true&akanMobileTarget=default&akanMobileLang=device&akanMobileIndexPath=%2Fmobile",
295
297
  );
296
298
  });
297
299
 
@@ -564,11 +564,11 @@ export class NativeApp {
564
564
  }
565
565
 
566
566
  /** The first page of a dev build, the target's home as a release bundle opens it; the dev server answers the CSR
567
- * shell only for `?csr=true`. */
567
+ * shell only for `?csr=true`, under a locale, and `akanMobileLang=device` has the page swap `lang` for the device's. */
568
568
  startPath(lang: string, platform: NativePlatform) {
569
569
  const basePath = this.target.config.basePath?.replace(/^\/+|\/+$/g, "");
570
570
  const indexPath = this.indexPath(platform);
571
- const params = new URLSearchParams({ csr: "true", akanMobileTarget: this.target.name });
571
+ const params = new URLSearchParams({ csr: "true", akanMobileTarget: this.target.name, akanMobileLang: "device" });
572
572
  if (basePath) params.set("akanMobileBasePath", basePath);
573
573
  if (indexPath) params.set("akanMobileIndexPath", indexPath);
574
574
  const home = [lang, basePath, indexPath]