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

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,84 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { RuntimeMarkerReach } from "./runtimeMarkerReach";
3
+
4
+ const root = "/ws";
5
+ const framework = {
6
+ "node_modules/akanjs/ui/index.ts":
7
+ 'export { Field } from "./Field";\nexport { Button } from "./Button";\nexport type { FieldProps } from "./Field";\n',
8
+ "node_modules/akanjs/ui/Button.tsx": '"use client";\nexport const Button = () => null;\n',
9
+ "node_modules/akanjs/ui/Field/index.tsx":
10
+ '"use client";\nimport { Parent } from "./Relation";\nexport interface FieldProps {}\nexport const Field = { Parent };\n',
11
+ "node_modules/akanjs/ui/Field/Relation.tsx":
12
+ '"use client";\nimport { useRelationOptions } from "./useRelationOptions";\nexport const Parent = () => useRelationOptions();\n',
13
+ "node_modules/akanjs/ui/Field/useRelationOptions.ts":
14
+ '"use client";\nimport "../modelRuntime";\nexport const useRelationOptions = () => null;\n',
15
+ "node_modules/akanjs/ui/modelRuntime.ts": "export {};\n",
16
+ };
17
+ const pinsOf = (files: Record<string, string>) => {
18
+ const all: Record<string, string> = { ...framework, ...files };
19
+ const reach = new RuntimeMarkerReach(root, (absPath) => all[absPath.slice(root.length + 1)] ?? null);
20
+ return reach.pinsOf(Object.keys(files).sort());
21
+ };
22
+ const relationChain = [
23
+ "akanjs/ui/Field/index.tsx",
24
+ "akanjs/ui/Field/Relation.tsx",
25
+ "akanjs/ui/Field/useRelationOptions.ts",
26
+ ];
27
+
28
+ describe("the pages a framework component reading models by name makes load the whole runtime", () => {
29
+ test("names the imports from a page, through a lib's re-export, to the framework file importing the marker", () => {
30
+ const pins = pinsOf({
31
+ "apps/demo/page/memo/_index.tsx":
32
+ 'import { MemoEdit } from "@apps/demo/lib/memo/Memo.Template";\nexport default () => MemoEdit;\n',
33
+ "apps/demo/page/about.tsx":
34
+ '"use client";\nimport { Button, cnst } from "@libs/kit/ui";\nexport default () => [Button, cnst];\n',
35
+ "apps/demo/lib/memo/Memo.Template.tsx":
36
+ '"use client";\nimport { Field, type FieldProps } from "@libs/kit/ui";\nexport const MemoEdit = () => Field;\n',
37
+ "libs/kit/ui/index.ts": 'export * as cnst from "./cnst";\nexport * from "./shim";\n',
38
+ "libs/kit/ui/cnst.ts": "export const memo = 1;\n",
39
+ "libs/kit/ui/shim.ts": 'export { Button, Field, type FieldProps } from "akanjs/ui";\n',
40
+ });
41
+ expect(pins).toEqual([
42
+ {
43
+ page: "apps/demo/page/memo/_index.tsx",
44
+ chain: ["apps/demo/page/memo/_index.tsx", "apps/demo/lib/memo/Memo.Template.tsx", ...relationChain],
45
+ },
46
+ ]);
47
+ });
48
+
49
+ test("counts a layout above the page, and neither a type import nor a chain no client file is on", () => {
50
+ const pins = pinsOf({
51
+ "apps/demo/page/_layout.tsx": 'import { Field } from "akanjs/ui";\nexport default () => Field;\n',
52
+ "apps/demo/page/admin/_layout.tsx": 'import type { FieldProps } from "akanjs/ui";\nexport default () => null;\n',
53
+ "apps/demo/page/admin/user.tsx": 'import { FieldProps } from "akanjs/ui";\nexport default () => null;\n',
54
+ "apps/demo/page/doc.tsx": 'import { marked } from "../ui/marked";\nexport default () => marked;\n',
55
+ "apps/demo/ui/marked.ts": 'import "akanjs/ui/modelRuntime";\nexport const marked = 1;\n',
56
+ "libs/kit/page/plain.tsx": "export default () => null;\n",
57
+ });
58
+ const viaLayout = ["apps/demo/page/_layout.tsx", ...relationChain];
59
+ expect(pins).toEqual([
60
+ { page: "apps/demo/page/admin/user.tsx", chain: viaLayout },
61
+ { page: "apps/demo/page/doc.tsx", chain: viaLayout },
62
+ ]);
63
+ });
64
+
65
+ test("leaves the pages of an app with a build report to that report, which names the routes really held", () => {
66
+ const pins = ["apps/demo/page/a.tsx", "apps/demonstration/page/a.tsx", "libs/kit/page/a.tsx"].map((page) => ({
67
+ page,
68
+ chain: [page, ...relationChain],
69
+ }));
70
+ expect(RuntimeMarkerReach.unbuilt(pins, ["demo"]).map(({ page }) => page)).toEqual([
71
+ "apps/demonstration/page/a.tsx",
72
+ "libs/kit/page/a.tsx",
73
+ ]);
74
+ expect(RuntimeMarkerReach.unbuilt(pins, [])).toEqual(pins);
75
+ });
76
+
77
+ test("prints one note per file importing the framework component, with how many pages it holds", () => {
78
+ const pages = ["a", "b", "c", "d"].map((name) => `apps/demo/page/${name}.tsx`);
79
+ const chain = ["apps/demo/ui/Edit.tsx", ...relationChain];
80
+ expect(RuntimeMarkerReach.format(pages.map((page) => ({ page, chain: [page, ...chain] })))).toEqual([
81
+ "apps/demo/ui/Edit.tsx - note akan.runtime.framework-marker: reaches a framework component that reads models by name (apps/demo/ui/Edit.tsx → akanjs/ui/Field/index.tsx → akanjs/ui/Field/Relation.tsx → akanjs/ui/Field/useRelationOptions.ts). 4 pages load the whole client runtime through it: apps/demo/page/a.tsx, apps/demo/page/b.tsx, apps/demo/page/c.tsx and 1 more.",
82
+ ]);
83
+ });
84
+ });
@@ -0,0 +1,255 @@
1
+ import { readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import ts from "typescript";
4
+
5
+ export interface RuntimeMarkerPin {
6
+ page: string;
7
+ //? From the page or layout file to the framework file importing the marker, each a workspace or `akanjs/` path.
8
+ chain: string[];
9
+ }
10
+
11
+ const markerFile = /(?:^|\/)akanjs\/ui\/modelRuntime\.ts$/;
12
+ const pageFile = /^((?:apps|libs)\/[^/]+\/page)\/(?:.+\/)?[^/]+\.tsx$/;
13
+ const useClientDirective = /^\s*(?:\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\/\s*|\/\/[^\n]*\n\s*)*["']use client["']/;
14
+ const suffixes = ["", ".ts", ".tsx", "/index.ts", "/index.tsx"];
15
+ const typeOnly = "";
16
+
17
+ const readFile = (absPath: string) => {
18
+ try {
19
+ return readFileSync(absPath, "utf8");
20
+ } catch {
21
+ return null;
22
+ }
23
+ };
24
+
25
+ //* Which pages load the whole client runtime because a framework UI component that reads models by name is on them:
26
+ //* the imports from a page or its layouts to a file importing `akanjs/ui/modelRuntime`, past a `"use client"` file.
27
+ export class RuntimeMarkerReach {
28
+ static readonly rule = "akan.runtime.framework-marker";
29
+ readonly #workspaceRoot: string;
30
+ readonly #read: (absPath: string) => string | null;
31
+ readonly #sources = new Map<string, ts.SourceFile | null>();
32
+ readonly #imports = new Map<string, string[]>();
33
+ readonly #resolved = new Map<string, string | null>();
34
+ #akanjsRoot: string | null | undefined;
35
+
36
+ constructor(workspaceRoot: string, read: (absPath: string) => string | null = readFile) {
37
+ this.#workspaceRoot = workspaceRoot;
38
+ this.#read = read;
39
+ }
40
+
41
+ static pagesOf(files: string[]): Map<string, string[]> {
42
+ const known = new Set(files);
43
+ const pages = new Map<string, string[]>();
44
+ for (const file of files) {
45
+ const [, pageRoot] = file.match(pageFile) ?? [];
46
+ if (!pageRoot || path.posix.basename(file) === "_layout.tsx") continue;
47
+ const dirs = path.posix.dirname(file).slice(pageRoot.length).split("/").filter(Boolean);
48
+ const layouts = dirs
49
+ .map((_, index) => `${[pageRoot, ...dirs.slice(0, index + 1)].join("/")}/_layout.tsx`)
50
+ .concat(`${pageRoot}/_layout.tsx`)
51
+ .filter((layout) => known.has(layout));
52
+ pages.set(file, [file, ...layouts.sort()]);
53
+ }
54
+ return pages;
55
+ }
56
+
57
+ pinsOf(files: string[]): RuntimeMarkerPin[] {
58
+ const pins: RuntimeMarkerPin[] = [];
59
+ for (const [page, roots] of RuntimeMarkerReach.pagesOf(files)) {
60
+ const chain = this.#chainFrom(roots.map((root) => path.join(this.#workspaceRoot, root)));
61
+ if (chain) pins.push({ page, chain: chain.map((file) => this.#nameOf(file)) });
62
+ }
63
+ return pins;
64
+ }
65
+
66
+ //? This read counts every page importing such a component; a build's report names the routes that really hold it.
67
+ static unbuilt(pins: RuntimeMarkerPin[], builtApps: readonly string[]): RuntimeMarkerPin[] {
68
+ return pins.filter(({ page }) => !builtApps.some((app) => page.startsWith(`apps/${app}/`)));
69
+ }
70
+
71
+ static format(pins: RuntimeMarkerPin[]): string[] {
72
+ const groups = new Map<string, { chain: string[]; pages: string[] }>();
73
+ for (const { page, chain } of pins) {
74
+ const from = Math.max(0, chain.findIndex((file) => file.startsWith("akanjs/")) - 1);
75
+ const tail = chain.slice(from);
76
+ const group = groups.get(tail.join("\n")) ?? { chain: tail, pages: [] };
77
+ group.pages.push(page);
78
+ groups.set(tail.join("\n"), group);
79
+ }
80
+ return [...groups.values()].map(({ chain, pages }) => {
81
+ const more = pages.length > 3 ? ` and ${pages.length - 3} more` : "";
82
+ return `${chain[0]} - note ${RuntimeMarkerReach.rule}: reaches a framework component that reads models by name (${chain.join(" → ")}). ${pages.length} ${pages.length === 1 ? "page loads" : "pages load"} the whole client runtime through it: ${pages.slice(0, 3).join(", ")}${more}.`;
83
+ });
84
+ }
85
+
86
+ #nameOf(absPath: string) {
87
+ const akanjsRoot = this.#akanjs();
88
+ const inPackage = akanjsRoot && !path.relative(akanjsRoot, absPath).startsWith("..");
89
+ const name = inPackage
90
+ ? path.join("akanjs", path.relative(akanjsRoot, absPath))
91
+ : path.relative(this.#workspaceRoot, absPath);
92
+ return name.split(path.sep).join("/");
93
+ }
94
+
95
+ #akanjs(): string | null {
96
+ if (this.#akanjsRoot !== undefined) return this.#akanjsRoot;
97
+ const roots = ["node_modules/akanjs", "pkgs/akanjs"].map((dir) => path.join(this.#workspaceRoot, dir));
98
+ this.#akanjsRoot = roots.find((dir) => this.#read(path.join(dir, "ui/modelRuntime.ts")) !== null) ?? null;
99
+ return this.#akanjsRoot;
100
+ }
101
+
102
+ #chainFrom(roots: string[]): string[] | null {
103
+ const keyOf = (file: string, client: boolean) => `${client ? "client" : "server"}:${file}`;
104
+ const parents = new Map<string, string | null>();
105
+ const queue: { file: string; client: boolean }[] = [];
106
+ const visit = (file: string, client: boolean, parent: string | null) => {
107
+ if (parents.has(keyOf(file, client))) return;
108
+ parents.set(keyOf(file, client), parent);
109
+ queue.push({ file, client });
110
+ };
111
+ for (const root of roots) visit(root, this.#isClient(root), null);
112
+ for (const { file, client } of queue)
113
+ for (const imported of this.#importsOf(file)) {
114
+ if (!markerFile.test(this.#nameOf(imported)))
115
+ visit(imported, client || this.#isClient(imported), keyOf(file, client));
116
+ else if (client) {
117
+ const chain: string[] = [];
118
+ for (let key: string | null = keyOf(file, client); key; key = parents.get(key) ?? null)
119
+ chain.unshift(key.slice(key.indexOf(":") + 1));
120
+ return chain;
121
+ }
122
+ }
123
+ return null;
124
+ }
125
+
126
+ #isClient(absPath: string) {
127
+ return useClientDirective.test(this.#read(absPath) ?? "");
128
+ }
129
+
130
+ #sourceOf(absPath: string): ts.SourceFile | null {
131
+ const known = this.#sources.get(absPath);
132
+ if (known !== undefined) return known;
133
+ const text = this.#read(absPath);
134
+ const kind = absPath.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
135
+ const source = text === null ? null : ts.createSourceFile(absPath, text, ts.ScriptTarget.Latest, false, kind);
136
+ this.#sources.set(absPath, source);
137
+ return source;
138
+ }
139
+
140
+ #resolve(specifier: string, importer: string): string | null {
141
+ const akanjsRoot = this.#akanjs();
142
+ const base = specifier.startsWith(".")
143
+ ? path.resolve(path.dirname(importer), specifier)
144
+ : /^@(?:apps|libs)\//.test(specifier)
145
+ ? path.join(this.#workspaceRoot, specifier.slice(1))
146
+ : akanjsRoot && /^akanjs(?:\/|$)/.test(specifier)
147
+ ? path.join(akanjsRoot, specifier.slice("akanjs".length))
148
+ : null;
149
+ if (!base) return null;
150
+ const known = this.#resolved.get(base);
151
+ if (known !== undefined) return known;
152
+ const found = suffixes.map((suffix) => `${base}${suffix}`).find((file) => this.#read(file) !== null) ?? null;
153
+ this.#resolved.set(base, found);
154
+ return found;
155
+ }
156
+
157
+ #importsOf(absPath: string): string[] {
158
+ const known = this.#imports.get(absPath);
159
+ if (known) return known;
160
+ const imports = new Set<string>();
161
+ this.#imports.set(absPath, []);
162
+ const follow = (specifier: ts.Expression, names: string[] | null) => {
163
+ const target = ts.isStringLiteral(specifier) ? this.#resolve(specifier.text, absPath) : null;
164
+ if (!target) return;
165
+ for (const name of names ?? [null]) {
166
+ const holder = name === null ? target : (this.#exporterOf(target, name, new Set()) ?? target);
167
+ if (holder !== typeOnly) imports.add(holder);
168
+ }
169
+ };
170
+ for (const statement of this.#sourceOf(absPath)?.statements ?? []) {
171
+ if (ts.isImportDeclaration(statement) && !statement.importClause?.isTypeOnly) {
172
+ const { name, namedBindings } = statement.importClause ?? {};
173
+ const named = !name && namedBindings && ts.isNamedImports(namedBindings) ? namedBindings.elements : null;
174
+ const names = named
175
+ ?.filter((element) => !element.isTypeOnly)
176
+ .map((element) => (element.propertyName ?? element.name).text);
177
+ if (!names || names.length > 0) follow(statement.moduleSpecifier, names ?? null);
178
+ } else if (ts.isExportDeclaration(statement) && statement.moduleSpecifier && !statement.isTypeOnly) {
179
+ const named =
180
+ statement.exportClause && ts.isNamedExports(statement.exportClause) ? statement.exportClause : null;
181
+ const names = named?.elements
182
+ .filter((element) => !element.isTypeOnly)
183
+ .map((element) => (element.propertyName ?? element.name).text);
184
+ follow(statement.moduleSpecifier, names ?? null);
185
+ }
186
+ }
187
+ const result = [...imports];
188
+ this.#imports.set(absPath, result);
189
+ return result;
190
+ }
191
+
192
+ //? The file a name imported from `absPath` comes from: a re-export is followed, as the build narrows a barrel import.
193
+ #exporterOf(absPath: string, name: string, seen: Set<string>): string | null {
194
+ if (seen.has(absPath)) return null;
195
+ seen.add(absPath);
196
+ const statements = this.#sourceOf(absPath)?.statements ?? [];
197
+ const stars: string[] = [];
198
+ for (const statement of statements) {
199
+ if (ts.isExportDeclaration(statement)) {
200
+ const target =
201
+ statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier)
202
+ ? this.#resolve(statement.moduleSpecifier.text, absPath)
203
+ : null;
204
+ if (!statement.exportClause && target) stars.push(target);
205
+ const { exportClause } = statement;
206
+ if (exportClause && ts.isNamespaceExport(exportClause) && exportClause.name.text === name)
207
+ return target ?? absPath;
208
+ const elements =
209
+ statement.exportClause && ts.isNamedExports(statement.exportClause) ? statement.exportClause.elements : [];
210
+ const element = elements.find((candidate) => candidate.name.text === name);
211
+ if (!element) continue;
212
+ if (statement.isTypeOnly || element.isTypeOnly) return typeOnly;
213
+ const source = (element.propertyName ?? element.name).text;
214
+ if (target) return this.#exporterOf(target, source, seen) ?? target;
215
+ return statement.moduleSpecifier ? absPath : (this.#importedFrom(absPath, source, seen) ?? absPath);
216
+ }
217
+ const exported =
218
+ ts.canHaveModifiers(statement) &&
219
+ ts.getModifiers(statement)?.some(({ kind }) => kind === ts.SyntaxKind.ExportKeyword);
220
+ if (!exported) continue;
221
+ if (
222
+ (ts.isInterfaceDeclaration(statement) || ts.isTypeAliasDeclaration(statement)) &&
223
+ statement.name.text === name
224
+ )
225
+ return typeOnly;
226
+ const declared = ts.isVariableStatement(statement)
227
+ ? statement.declarationList.declarations.some(
228
+ ({ name: binding }) => !ts.isIdentifier(binding) || binding.text === name,
229
+ )
230
+ : (ts.isFunctionDeclaration(statement) ||
231
+ ts.isClassDeclaration(statement) ||
232
+ ts.isEnumDeclaration(statement)) &&
233
+ statement.name?.text === name;
234
+ if (declared) return absPath;
235
+ }
236
+ for (const star of stars) {
237
+ const holder = this.#exporterOf(star, name, seen);
238
+ if (holder !== null) return holder;
239
+ }
240
+ return null;
241
+ }
242
+
243
+ #importedFrom(absPath: string, local: string, seen: Set<string>): string | null {
244
+ for (const statement of this.#sourceOf(absPath)?.statements ?? []) {
245
+ if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) continue;
246
+ const { namedBindings } = statement.importClause ?? {};
247
+ const elements = namedBindings && ts.isNamedImports(namedBindings) ? namedBindings.elements : [];
248
+ const element = elements.find((candidate) => candidate.name.text === local);
249
+ const target = element ? this.#resolve(statement.moduleSpecifier.text, absPath) : null;
250
+ if (element && target)
251
+ return this.#exporterOf(target, (element.propertyName ?? element.name).text, seen) ?? target;
252
+ }
253
+ return null;
254
+ }
255
+ }
@@ -0,0 +1,290 @@
1
+ import { createAst, createFactReader } from "@akanjs/language";
2
+ import ts from "typescript";
3
+ import type { RuntimeConstantFact } from "./runtimeConstantFacts";
4
+
5
+ export type RuntimeModuleKind = "database" | "service";
6
+
7
+ export interface RuntimeSourceFile {
8
+ file: string;
9
+ sourceFile: ts.SourceFile;
10
+ }
11
+
12
+ export interface RuntimeEndpointFact {
13
+ name: string;
14
+ verb: string | null;
15
+ fileUpload: boolean;
16
+ }
17
+
18
+ export interface RuntimeVerbGuards {
19
+ root: string[] | null;
20
+ get: string[];
21
+ create: string[];
22
+ update: string[];
23
+ remove: string[];
24
+ }
25
+
26
+ export interface RuntimeSliceFact {
27
+ guards: RuntimeVerbGuards;
28
+ keys: { name: string; live: boolean }[];
29
+ }
30
+
31
+ export interface RuntimeStoreFact {
32
+ name: string;
33
+ refName: string;
34
+ signal: boolean;
35
+ state: string[];
36
+ derived: string[];
37
+ actions: string[];
38
+ libStores: string[];
39
+ }
40
+
41
+ export interface RuntimeFieldFact {
42
+ name: string;
43
+ type: string | null;
44
+ array: boolean;
45
+ }
46
+
47
+ export interface RuntimeModuleFact {
48
+ scope: string;
49
+ module: string;
50
+ kind: RuntimeModuleKind;
51
+ signal: { endpoints: RuntimeEndpointFact[]; slice: RuntimeSliceFact | null; extendsLib: boolean } | null;
52
+ store: (RuntimeStoreFact & { extendsLib: boolean }) | null;
53
+ model: { fields: RuntimeFieldFact[]; extendsLib: boolean } | null;
54
+ }
55
+
56
+ export interface RuntimeLayer {
57
+ scope: string;
58
+ modules: RuntimeModuleFact[];
59
+ approximations: string[];
60
+ constants?: RuntimeConstantFact[];
61
+ constantLibs?: string[];
62
+ }
63
+
64
+ interface ModuleFiles {
65
+ module: string;
66
+ kind: RuntimeModuleKind;
67
+ signal?: RuntimeSourceFile;
68
+ store?: RuntimeSourceFile;
69
+ constant?: RuntimeSourceFile;
70
+ }
71
+
72
+ export class RuntimeModuleFacts {
73
+ static readonly #ast = createAst(ts);
74
+ static readonly #reader = createFactReader(ts, RuntimeModuleFacts.#ast);
75
+ static readonly #heritageCallees = new Set(["endpoint", "slice", "store", "via"]);
76
+
77
+ static moduleFileOf(scope: string, file: string) {
78
+ const match = file
79
+ .slice(scope.length)
80
+ .match(/^\/lib\/(_?)([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)\.(signal|store|constant)\.ts$/);
81
+ if (!match || match[2] !== match[3]) return null;
82
+ const [, underscore, module, , role] = match as unknown as [string, string, string, string, keyof ModuleFiles];
83
+ return { module, kind: (underscore ? "service" : "database") as RuntimeModuleKind, role };
84
+ }
85
+
86
+ static layerOf(scope: string, files: RuntimeSourceFile[]): RuntimeLayer {
87
+ const byModule = new Map<string, ModuleFiles>();
88
+ for (const source of files) {
89
+ const found = RuntimeModuleFacts.moduleFileOf(scope, source.file);
90
+ if (!found) continue;
91
+ const entry = byModule.get(found.module) ?? { module: found.module, kind: found.kind };
92
+ Object.assign(entry, { [found.role]: source });
93
+ byModule.set(found.module, entry);
94
+ }
95
+ const approximations: string[] = [];
96
+ const modules = [...byModule.values()]
97
+ .sort((a, b) => (a.module < b.module ? -1 : a.module > b.module ? 1 : 0))
98
+ .map((entry) => RuntimeModuleFacts.#moduleOf(scope, entry, approximations));
99
+ return { scope, modules, approximations };
100
+ }
101
+
102
+ static storeOf(source: RuntimeSourceFile, approximations: string[]) {
103
+ const facts = RuntimeModuleFacts.#reader.read(source.sourceFile, null);
104
+ const calls = RuntimeModuleFacts.#heritageCallsIn(source.sourceFile);
105
+ const [fact] = facts.stores;
106
+ const call = fact && calls.get(fact.name);
107
+ if (!fact?.model || !call) return null;
108
+ const [refArg, stateArg, ...rest] = call.arguments;
109
+ const builders = [stateArg, ...rest].filter((arg) => arg && RuntimeModuleFacts.#isFunction(arg));
110
+ const libArgs = rest.filter((arg) => !RuntimeModuleFacts.#isFunction(arg));
111
+ const keysOf = (builder: ts.Expression | undefined) =>
112
+ RuntimeModuleFacts.#objectKeys(source, builder, approximations, "state");
113
+ return {
114
+ name: fact.name,
115
+ refName: fact.model,
116
+ signal: !!refArg && !ts.isStringLiteral(RuntimeModuleFacts.#unwrap(refArg)),
117
+ state: keysOf(builders[0]),
118
+ derived: builders.length > 1 ? keysOf(builders[1]) : [],
119
+ actions: fact.actions.map(({ name }) => name).filter((name) => !name.startsWith("#")),
120
+ libStores: libArgs.flatMap((arg) => (ts.isIdentifier(arg) ? [arg.text] : [])),
121
+ extendsLib: libArgs.some(ts.isSpreadElement),
122
+ };
123
+ }
124
+
125
+ static signalOf(source: RuntimeSourceFile, refName: string, approximations: string[]) {
126
+ const facts = RuntimeModuleFacts.#reader.read(source.sourceFile, null);
127
+ const calls = RuntimeModuleFacts.#heritageCallsIn(source.sourceFile);
128
+ const uploads = RuntimeModuleFacts.#fileUploadPositionsIn(source.sourceFile);
129
+ const extendsLib = (name: string) => !!calls.get(name)?.arguments.some(ts.isSpreadElement);
130
+ const endpointClasses = facts.endpoints.filter(({ model }) => model === refName);
131
+ const sliceClass = facts.slices.find(({ model }) => model === refName);
132
+ for (const { name } of [...endpointClasses, ...(sliceClass ? [sliceClass] : [])])
133
+ for (const builder of calls.get(name)?.arguments.filter(RuntimeModuleFacts.#isFunction) ?? [])
134
+ RuntimeModuleFacts.#objectKeys(source, builder, approximations, "signal");
135
+ const endpoints = endpointClasses.flatMap(({ keys }) =>
136
+ keys.map(({ name, verb, extent }) => ({
137
+ name,
138
+ verb,
139
+ fileUpload: uploads.some((position) => position >= extent.start && position < extent.end),
140
+ })),
141
+ );
142
+ const sliceCall = sliceClass && calls.get(sliceClass.name);
143
+ const slice = sliceClass &&
144
+ sliceCall && {
145
+ guards: RuntimeModuleFacts.#verbGuardsOf(source, sliceCall, approximations),
146
+ keys: sliceClass.keys.map(({ name, live }) => ({ name, live })),
147
+ };
148
+ return {
149
+ endpoints,
150
+ slice: slice || null,
151
+ extendsLib: [...endpointClasses, ...(sliceClass ? [sliceClass] : [])].some(({ name }) => extendsLib(name)),
152
+ };
153
+ }
154
+
155
+ static #moduleOf(scope: string, files: ModuleFiles, approximations: string[]): RuntimeModuleFact {
156
+ const store = files.store ? RuntimeModuleFacts.storeOf(files.store, approximations) : null;
157
+ return {
158
+ scope,
159
+ module: files.module,
160
+ kind: files.kind,
161
+ signal: files.signal ? RuntimeModuleFacts.signalOf(files.signal, files.module, approximations) : null,
162
+ store,
163
+ model: files.constant ? RuntimeModuleFacts.#modelOf(files.constant, files.module) : null,
164
+ };
165
+ }
166
+
167
+ static #modelOf(source: RuntimeSourceFile, refName: string) {
168
+ const facts = RuntimeModuleFacts.#reader.read(source.sourceFile, null);
169
+ const calls = RuntimeModuleFacts.#heritageCallsIn(source.sourceFile);
170
+ const byName = new Map(facts.constants.map((constant) => [constant.name, constant]));
171
+ const model = byName.get(refName.charAt(0).toUpperCase() + refName.slice(1));
172
+ if (!model) return null;
173
+ const fields = new Map<string, RuntimeFieldFact>();
174
+ let extendsLib = false;
175
+ const seen = new Set<string>();
176
+ const visit = (name: string) => {
177
+ const constant = byName.get(name);
178
+ if (!constant || seen.has(name)) return;
179
+ seen.add(name);
180
+ if (calls.get(name)?.arguments.some(ts.isSpreadElement)) extendsLib = true;
181
+ for (const { name: field, type, array } of constant.fields)
182
+ if (!fields.has(field)) fields.set(field, { name: field, type, array });
183
+ for (const parent of constant.parents) visit(parent);
184
+ };
185
+ visit(model.name);
186
+ return { fields: [...fields.values()], extendsLib };
187
+ }
188
+
189
+ static #verbGuardsOf(source: RuntimeSourceFile, call: ts.CallExpression, approximations: string[]) {
190
+ const option = call.arguments.map(RuntimeModuleFacts.#unwrap).find(ts.isObjectLiteralExpression);
191
+ const guardsProperty = option?.properties.find(
192
+ (property) => RuntimeModuleFacts.#ast.propertyName(property) === "guards",
193
+ );
194
+ const guards = new Map<string, string[]>();
195
+ const value =
196
+ guardsProperty && ts.isPropertyAssignment(guardsProperty)
197
+ ? RuntimeModuleFacts.#unwrap(guardsProperty.initializer)
198
+ : null;
199
+ if (guardsProperty && !(value && ts.isObjectLiteralExpression(value)))
200
+ approximations.push(`${RuntimeModuleFacts.#where(source, call)}: slice guards are not an object literal`);
201
+ for (const property of value && ts.isObjectLiteralExpression(value) ? value.properties : []) {
202
+ const key = RuntimeModuleFacts.#ast.propertyName(property);
203
+ if (!key || !ts.isPropertyAssignment(property)) {
204
+ approximations.push(`${RuntimeModuleFacts.#where(source, property)}: a slice guard key is not written out`);
205
+ continue;
206
+ }
207
+ guards.set(key, RuntimeModuleFacts.#guardNamesOf(source, property.initializer, approximations));
208
+ }
209
+ const cru = guards.get("cru") ?? [];
210
+ return {
211
+ root: guards.get("root") ?? null,
212
+ get: guards.get("get") ?? [],
213
+ create: guards.get("create") ?? cru,
214
+ update: guards.get("update") ?? cru,
215
+ remove: guards.get("remove") ?? cru,
216
+ } satisfies RuntimeVerbGuards;
217
+ }
218
+
219
+ static #guardNamesOf(source: RuntimeSourceFile, expression: ts.Expression, approximations: string[]): string[] {
220
+ const value = RuntimeModuleFacts.#unwrap(expression);
221
+ if (value.kind === ts.SyntaxKind.FalseKeyword || (ts.isIdentifier(value) && value.text === "undefined")) return [];
222
+ if (ts.isArrayLiteralExpression(value))
223
+ return value.elements.flatMap((element) => RuntimeModuleFacts.#guardNamesOf(source, element, approximations));
224
+ const name = RuntimeModuleFacts.#ast.expressionName(value);
225
+ if (name) return [name];
226
+ approximations.push(`${RuntimeModuleFacts.#where(source, value)}: a slice guard is not a name; counted as mounted`);
227
+ return ["?"];
228
+ }
229
+
230
+ static #objectKeys(
231
+ source: RuntimeSourceFile,
232
+ builder: ts.Expression | undefined,
233
+ approximations: string[],
234
+ what: string,
235
+ ) {
236
+ const object = builder ? RuntimeModuleFacts.#ast.firstObjectReturnedByArrow(builder) : null;
237
+ if (builder && !object)
238
+ approximations.push(
239
+ `${RuntimeModuleFacts.#where(source, builder)}: the ${what} factory returns no object literal`,
240
+ );
241
+ return (object?.properties ?? []).flatMap((property) => {
242
+ const name = RuntimeModuleFacts.#ast.propertyName(property);
243
+ if (!name)
244
+ approximations.push(`${RuntimeModuleFacts.#where(source, property)}: a ${what} key is spread or computed`);
245
+ return name ? [name] : [];
246
+ });
247
+ }
248
+
249
+ static #heritageCallsIn(sourceFile: ts.SourceFile) {
250
+ const calls = new Map<string, ts.CallExpression>();
251
+ for (const statement of sourceFile.statements) {
252
+ if (!ts.isClassDeclaration(statement) || !statement.name) continue;
253
+ const heritage = RuntimeModuleFacts.#ast.heritageCallNamed(statement, RuntimeModuleFacts.#heritageCallees);
254
+ if (heritage) calls.set(statement.name.text, heritage.call);
255
+ }
256
+ return calls;
257
+ }
258
+
259
+ static #fileUploadPositionsIn(sourceFile: ts.SourceFile) {
260
+ const positions: number[] = [];
261
+ const visit = (node: ts.Node) => {
262
+ if (
263
+ ts.isPropertyAssignment(node) &&
264
+ RuntimeModuleFacts.#ast.nodeName(node.name) === "fileUpload" &&
265
+ node.initializer.kind === ts.SyntaxKind.TrueKeyword
266
+ )
267
+ positions.push(node.getStart(sourceFile));
268
+ ts.forEachChild(node, visit);
269
+ };
270
+ if (sourceFile.text.includes("fileUpload")) visit(sourceFile);
271
+ return positions;
272
+ }
273
+
274
+ static #isFunction(expression: ts.Expression) {
275
+ const value = RuntimeModuleFacts.#unwrap(expression);
276
+ return ts.isArrowFunction(value) || ts.isFunctionExpression(value);
277
+ }
278
+
279
+ static #unwrap(expression: ts.Expression): ts.Expression {
280
+ let current = expression;
281
+ while (ts.isParenthesizedExpression(current) || ts.isAsExpression(current) || ts.isSatisfiesExpression(current))
282
+ current = current.expression;
283
+ return current;
284
+ }
285
+
286
+ static #where({ file, sourceFile }: RuntimeSourceFile, node: ts.Node) {
287
+ const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
288
+ return `${file}:${line + 1}:${character + 1}`;
289
+ }
290
+ }