hinmil 0.0.0-stage → 0.2.0

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 (301) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2306 -2
  3. package/dist/cli.d.ts +15 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +338 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commentParser.d.ts +384 -0
  8. package/dist/commentParser.d.ts.map +1 -0
  9. package/dist/commentParser.js +2487 -0
  10. package/dist/commentParser.js.map +1 -0
  11. package/dist/config.d.ts +203 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +375 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/debugLog.d.ts +13 -0
  16. package/dist/debugLog.d.ts.map +1 -0
  17. package/dist/debugLog.js +44 -0
  18. package/dist/debugLog.js.map +1 -0
  19. package/dist/estree.d.ts +100 -0
  20. package/dist/estree.d.ts.map +1 -0
  21. package/dist/estree.js +34 -0
  22. package/dist/estree.js.map +1 -0
  23. package/dist/hm/env.d.ts +134 -0
  24. package/dist/hm/env.d.ts.map +1 -0
  25. package/dist/hm/env.js +939 -0
  26. package/dist/hm/env.js.map +1 -0
  27. package/dist/hm/index.d.ts +7 -0
  28. package/dist/hm/index.d.ts.map +1 -0
  29. package/dist/hm/index.js +26 -0
  30. package/dist/hm/index.js.map +1 -0
  31. package/dist/hm/substitution.d.ts +57 -0
  32. package/dist/hm/substitution.d.ts.map +1 -0
  33. package/dist/hm/substitution.js +546 -0
  34. package/dist/hm/substitution.js.map +1 -0
  35. package/dist/hm/typeParser.d.ts +39 -0
  36. package/dist/hm/typeParser.d.ts.map +1 -0
  37. package/dist/hm/typeParser.js +1285 -0
  38. package/dist/hm/typeParser.js.map +1 -0
  39. package/dist/hm/typeUtils.d.ts +248 -0
  40. package/dist/hm/typeUtils.d.ts.map +1 -0
  41. package/dist/hm/typeUtils.js +905 -0
  42. package/dist/hm/typeUtils.js.map +1 -0
  43. package/dist/hm/types.d.ts +738 -0
  44. package/dist/hm/types.d.ts.map +1 -0
  45. package/dist/hm/types.js +1853 -0
  46. package/dist/hm/types.js.map +1 -0
  47. package/dist/hm/unify.d.ts +59 -0
  48. package/dist/hm/unify.d.ts.map +1 -0
  49. package/dist/hm/unify.js +1700 -0
  50. package/dist/hm/unify.js.map +1 -0
  51. package/dist/index.d.ts +20 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +196 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/infer/annotation-rigid.d.ts +76 -0
  56. package/dist/infer/annotation-rigid.d.ts.map +1 -0
  57. package/dist/infer/annotation-rigid.js +542 -0
  58. package/dist/infer/annotation-rigid.js.map +1 -0
  59. package/dist/infer/annotation-validation.d.ts +109 -0
  60. package/dist/infer/annotation-validation.d.ts.map +1 -0
  61. package/dist/infer/annotation-validation.js +1078 -0
  62. package/dist/infer/annotation-validation.js.map +1 -0
  63. package/dist/infer/annotations.d.ts +277 -0
  64. package/dist/infer/annotations.d.ts.map +1 -0
  65. package/dist/infer/annotations.js +1343 -0
  66. package/dist/infer/annotations.js.map +1 -0
  67. package/dist/infer/call-overloads.d.ts +24 -0
  68. package/dist/infer/call-overloads.d.ts.map +1 -0
  69. package/dist/infer/call-overloads.js +900 -0
  70. package/dist/infer/call-overloads.js.map +1 -0
  71. package/dist/infer/call-rows.d.ts +154 -0
  72. package/dist/infer/call-rows.d.ts.map +1 -0
  73. package/dist/infer/call-rows.js +2162 -0
  74. package/dist/infer/call-rows.js.map +1 -0
  75. package/dist/infer/calls.d.ts +20 -0
  76. package/dist/infer/calls.d.ts.map +1 -0
  77. package/dist/infer/calls.js +1468 -0
  78. package/dist/infer/calls.js.map +1 -0
  79. package/dist/infer/constraints.d.ts +99 -0
  80. package/dist/infer/constraints.d.ts.map +1 -0
  81. package/dist/infer/constraints.js +1208 -0
  82. package/dist/infer/constraints.js.map +1 -0
  83. package/dist/infer/expr-assignment.d.ts +20 -0
  84. package/dist/infer/expr-assignment.d.ts.map +1 -0
  85. package/dist/infer/expr-assignment.js +620 -0
  86. package/dist/infer/expr-assignment.js.map +1 -0
  87. package/dist/infer/expr-constraint-lookup.d.ts +44 -0
  88. package/dist/infer/expr-constraint-lookup.d.ts.map +1 -0
  89. package/dist/infer/expr-constraint-lookup.js +207 -0
  90. package/dist/infer/expr-constraint-lookup.js.map +1 -0
  91. package/dist/infer/expr-functions.d.ts +20 -0
  92. package/dist/infer/expr-functions.d.ts.map +1 -0
  93. package/dist/infer/expr-functions.js +1359 -0
  94. package/dist/infer/expr-functions.js.map +1 -0
  95. package/dist/infer/expr-jsx.d.ts +19 -0
  96. package/dist/infer/expr-jsx.d.ts.map +1 -0
  97. package/dist/infer/expr-jsx.js +310 -0
  98. package/dist/infer/expr-jsx.js.map +1 -0
  99. package/dist/infer/expr-member.d.ts +40 -0
  100. package/dist/infer/expr-member.d.ts.map +1 -0
  101. package/dist/infer/expr-member.js +1154 -0
  102. package/dist/infer/expr-member.js.map +1 -0
  103. package/dist/infer/expr-prototype.d.ts +11 -0
  104. package/dist/infer/expr-prototype.d.ts.map +1 -0
  105. package/dist/infer/expr-prototype.js +202 -0
  106. package/dist/infer/expr-prototype.js.map +1 -0
  107. package/dist/infer/expressions.d.ts +40 -0
  108. package/dist/infer/expressions.d.ts.map +1 -0
  109. package/dist/infer/expressions.js +1497 -0
  110. package/dist/infer/expressions.js.map +1 -0
  111. package/dist/infer/functionPatterns.d.ts +229 -0
  112. package/dist/infer/functionPatterns.d.ts.map +1 -0
  113. package/dist/infer/functionPatterns.js +1035 -0
  114. package/dist/infer/functionPatterns.js.map +1 -0
  115. package/dist/infer/helpers.d.ts +73 -0
  116. package/dist/infer/helpers.d.ts.map +1 -0
  117. package/dist/infer/helpers.js +187 -0
  118. package/dist/infer/helpers.js.map +1 -0
  119. package/dist/infer/index.d.ts +551 -0
  120. package/dist/infer/index.d.ts.map +1 -0
  121. package/dist/infer/index.js +1127 -0
  122. package/dist/infer/index.js.map +1 -0
  123. package/dist/infer/jsx-dom.d.ts +26 -0
  124. package/dist/infer/jsx-dom.d.ts.map +1 -0
  125. package/dist/infer/jsx-dom.js +303 -0
  126. package/dist/infer/jsx-dom.js.map +1 -0
  127. package/dist/infer/moduleReps.d.ts +7 -0
  128. package/dist/infer/moduleReps.d.ts.map +1 -0
  129. package/dist/infer/moduleReps.js +48 -0
  130. package/dist/infer/moduleReps.js.map +1 -0
  131. package/dist/infer/modules.d.ts +10 -0
  132. package/dist/infer/modules.d.ts.map +1 -0
  133. package/dist/infer/modules.js +775 -0
  134. package/dist/infer/modules.js.map +1 -0
  135. package/dist/infer/narrowing.d.ts +199 -0
  136. package/dist/infer/narrowing.d.ts.map +1 -0
  137. package/dist/infer/narrowing.js +1428 -0
  138. package/dist/infer/narrowing.js.map +1 -0
  139. package/dist/infer/results.d.ts +24 -0
  140. package/dist/infer/results.d.ts.map +1 -0
  141. package/dist/infer/results.js +611 -0
  142. package/dist/infer/results.js.map +1 -0
  143. package/dist/infer/setupPass.d.ts +11 -0
  144. package/dist/infer/setupPass.d.ts.map +1 -0
  145. package/dist/infer/setupPass.js +524 -0
  146. package/dist/infer/setupPass.js.map +1 -0
  147. package/dist/infer/statements.d.ts +26 -0
  148. package/dist/infer/statements.d.ts.map +1 -0
  149. package/dist/infer/statements.js +750 -0
  150. package/dist/infer/statements.js.map +1 -0
  151. package/dist/infer/stmt-bindings.d.ts +22 -0
  152. package/dist/infer/stmt-bindings.d.ts.map +1 -0
  153. package/dist/infer/stmt-bindings.js +1482 -0
  154. package/dist/infer/stmt-bindings.js.map +1 -0
  155. package/dist/infer/stmt-destructure.d.ts +29 -0
  156. package/dist/infer/stmt-destructure.d.ts.map +1 -0
  157. package/dist/infer/stmt-destructure.js +490 -0
  158. package/dist/infer/stmt-destructure.js.map +1 -0
  159. package/dist/infer/types.d.ts +220 -0
  160. package/dist/infer/types.d.ts.map +1 -0
  161. package/dist/infer/types.js +46 -0
  162. package/dist/infer/types.js.map +1 -0
  163. package/dist/infer/unifyDiag.d.ts +46 -0
  164. package/dist/infer/unifyDiag.d.ts.map +1 -0
  165. package/dist/infer/unifyDiag.js +642 -0
  166. package/dist/infer/unifyDiag.js.map +1 -0
  167. package/dist/parsing-babel.d.ts +3 -0
  168. package/dist/parsing-babel.d.ts.map +1 -0
  169. package/dist/parsing-babel.js +353 -0
  170. package/dist/parsing-babel.js.map +1 -0
  171. package/dist/parsing.d.ts +69 -0
  172. package/dist/parsing.d.ts.map +1 -0
  173. package/dist/parsing.js +288 -0
  174. package/dist/parsing.js.map +1 -0
  175. package/dist/registries/constraintRegistry.d.ts +233 -0
  176. package/dist/registries/constraintRegistry.d.ts.map +1 -0
  177. package/dist/registries/constraintRegistry.js +803 -0
  178. package/dist/registries/constraintRegistry.js.map +1 -0
  179. package/dist/registries/dataTypeRegistry.d.ts +63 -0
  180. package/dist/registries/dataTypeRegistry.d.ts.map +1 -0
  181. package/dist/registries/dataTypeRegistry.js +180 -0
  182. package/dist/registries/dataTypeRegistry.js.map +1 -0
  183. package/dist/registries/domGlobals.d.ts +33 -0
  184. package/dist/registries/domGlobals.d.ts.map +1 -0
  185. package/dist/registries/domGlobals.js +309 -0
  186. package/dist/registries/domGlobals.js.map +1 -0
  187. package/dist/registries/methodRegistry.d.ts +277 -0
  188. package/dist/registries/methodRegistry.d.ts.map +1 -0
  189. package/dist/registries/methodRegistry.js +2074 -0
  190. package/dist/registries/methodRegistry.js.map +1 -0
  191. package/dist/registries/session.d.ts +38 -0
  192. package/dist/registries/session.d.ts.map +1 -0
  193. package/dist/registries/session.js +75 -0
  194. package/dist/registries/session.js.map +1 -0
  195. package/dist/server.d.ts +2 -0
  196. package/dist/server.d.ts.map +1 -0
  197. package/dist/server.js +1896 -0
  198. package/dist/server.js.map +1 -0
  199. package/dist/services/codeActions.d.ts +22 -0
  200. package/dist/services/codeActions.d.ts.map +1 -0
  201. package/dist/services/codeActions.js +465 -0
  202. package/dist/services/codeActions.js.map +1 -0
  203. package/dist/services/completion.d.ts +259 -0
  204. package/dist/services/completion.d.ts.map +1 -0
  205. package/dist/services/completion.js +2794 -0
  206. package/dist/services/completion.js.map +1 -0
  207. package/dist/services/definitions.d.ts +37 -0
  208. package/dist/services/definitions.d.ts.map +1 -0
  209. package/dist/services/definitions.js +605 -0
  210. package/dist/services/definitions.js.map +1 -0
  211. package/dist/services/diagnosticCodes.d.ts +70 -0
  212. package/dist/services/diagnosticCodes.d.ts.map +1 -0
  213. package/dist/services/diagnosticCodes.js +239 -0
  214. package/dist/services/diagnosticCodes.js.map +1 -0
  215. package/dist/services/diagnostics.d.ts +86 -0
  216. package/dist/services/diagnostics.d.ts.map +1 -0
  217. package/dist/services/diagnostics.js +665 -0
  218. package/dist/services/diagnostics.js.map +1 -0
  219. package/dist/services/documentCache.d.ts +88 -0
  220. package/dist/services/documentCache.d.ts.map +1 -0
  221. package/dist/services/documentCache.js +108 -0
  222. package/dist/services/documentCache.js.map +1 -0
  223. package/dist/services/documentSymbols.d.ts +20 -0
  224. package/dist/services/documentSymbols.d.ts.map +1 -0
  225. package/dist/services/documentSymbols.js +381 -0
  226. package/dist/services/documentSymbols.js.map +1 -0
  227. package/dist/services/fileSelection.d.ts +24 -0
  228. package/dist/services/fileSelection.d.ts.map +1 -0
  229. package/dist/services/fileSelection.js +154 -0
  230. package/dist/services/fileSelection.js.map +1 -0
  231. package/dist/services/fileSelectionRefresh.d.ts +26 -0
  232. package/dist/services/fileSelectionRefresh.d.ts.map +1 -0
  233. package/dist/services/fileSelectionRefresh.js +77 -0
  234. package/dist/services/fileSelectionRefresh.js.map +1 -0
  235. package/dist/services/files.d.ts +342 -0
  236. package/dist/services/files.d.ts.map +1 -0
  237. package/dist/services/files.js +1712 -0
  238. package/dist/services/files.js.map +1 -0
  239. package/dist/services/fsProbe.d.ts +14 -0
  240. package/dist/services/fsProbe.d.ts.map +1 -0
  241. package/dist/services/fsProbe.js +112 -0
  242. package/dist/services/fsProbe.js.map +1 -0
  243. package/dist/services/globalsLoader.d.ts +20 -0
  244. package/dist/services/globalsLoader.d.ts.map +1 -0
  245. package/dist/services/globalsLoader.js +122 -0
  246. package/dist/services/globalsLoader.js.map +1 -0
  247. package/dist/services/hmFileServices.d.ts +113 -0
  248. package/dist/services/hmFileServices.d.ts.map +1 -0
  249. package/dist/services/hmFileServices.js +686 -0
  250. package/dist/services/hmFileServices.js.map +1 -0
  251. package/dist/services/hover.d.ts +280 -0
  252. package/dist/services/hover.d.ts.map +1 -0
  253. package/dist/services/hover.js +1687 -0
  254. package/dist/services/hover.js.map +1 -0
  255. package/dist/services/importContext.d.ts +396 -0
  256. package/dist/services/importContext.d.ts.map +1 -0
  257. package/dist/services/importContext.js +1999 -0
  258. package/dist/services/importContext.js.map +1 -0
  259. package/dist/services/projectChecker.d.ts +50 -0
  260. package/dist/services/projectChecker.d.ts.map +1 -0
  261. package/dist/services/projectChecker.js +228 -0
  262. package/dist/services/projectChecker.js.map +1 -0
  263. package/dist/services/references.d.ts +41 -0
  264. package/dist/services/references.d.ts.map +1 -0
  265. package/dist/services/references.js +757 -0
  266. package/dist/services/references.js.map +1 -0
  267. package/dist/services/rename.d.ts +22 -0
  268. package/dist/services/rename.d.ts.map +1 -0
  269. package/dist/services/rename.js +101 -0
  270. package/dist/services/rename.js.map +1 -0
  271. package/dist/services/shortCircuit.d.ts +27 -0
  272. package/dist/services/shortCircuit.d.ts.map +1 -0
  273. package/dist/services/shortCircuit.js +28 -0
  274. package/dist/services/shortCircuit.js.map +1 -0
  275. package/dist/services/sidecarPerf.d.ts +19 -0
  276. package/dist/services/sidecarPerf.d.ts.map +1 -0
  277. package/dist/services/sidecarPerf.js +59 -0
  278. package/dist/services/sidecarPerf.js.map +1 -0
  279. package/dist/services/signatureHelp.d.ts +27 -0
  280. package/dist/services/signatureHelp.d.ts.map +1 -0
  281. package/dist/services/signatureHelp.js +984 -0
  282. package/dist/services/signatureHelp.js.map +1 -0
  283. package/dist/walking.d.ts +25 -0
  284. package/dist/walking.d.ts.map +1 -0
  285. package/dist/walking.js +107 -0
  286. package/dist/walking.js.map +1 -0
  287. package/hm-types-builtin/assert.hm +20 -0
  288. package/hm-types-builtin/buffer.hm +8 -0
  289. package/hm-types-builtin/child_process.hm +16 -0
  290. package/hm-types-builtin/crypto.hm +17 -0
  291. package/hm-types-builtin/fs.hm +15 -0
  292. package/hm-types-builtin/http.hm +14 -0
  293. package/hm-types-builtin/os.hm +19 -0
  294. package/hm-types-builtin/path.hm +18 -0
  295. package/hm-types-builtin/react-dom.hm +27 -0
  296. package/hm-types-builtin/react.hm +113 -0
  297. package/hm-types-builtin/url.hm +7 -0
  298. package/hm-types-builtin/zlib.hm +12 -0
  299. package/package.json +53 -4
  300. package/schemas/hinmil.config.schema.json +261 -0
  301. package/schemas/package-hinmil.schema.json +59 -0
@@ -0,0 +1,342 @@
1
+ import { Location } from 'vscode-languageserver/node';
2
+ import { InferenceResult } from '../infer';
3
+ /** Keep custom selected source extensions importable (explicit or extensionless).
4
+ *
5
+ * NOTE: mutates process-global resolution state shared by every engine in
6
+ * this process. The LSP server and CLI each run in their own process; API
7
+ * consumers must not run two checkers with different extension sets
8
+ * concurrently in one process. */
9
+ export declare function configureModuleExtensions(extensions: readonly string[]): void;
10
+ /**
11
+ * Resolve an import specifier (relative path or bare package name) to a file URI.
12
+ */
13
+ export declare function resolveImportSpecifier(specifier: string, fromUri: string): string | null;
14
+ /**
15
+ * Resolve an import specifier (seen from the file `fromPath`) to the SOURCE
16
+ * file a reader would want to open: like {@link resolveImportSpecifier}, but
17
+ * a package whose root resolves to an `.hm` sidecar yields its JavaScript
18
+ * entry (`main` / `module` / `index`) instead. Used by go-to-definition.
19
+ */
20
+ export declare function resolveImportSourceFile(specifier: string, fromPath: string): string | null;
21
+ /**
22
+ * True when `specifier` is a bundler-managed asset import — a relative (or
23
+ * absolute) path to an existing file whose extension is not a JS module
24
+ * (e.g. `./assets/hero.png`, `./App.css`, `./logo.svg?url`). Such imports
25
+ * are resolved by the bundler (Vite, webpack) at build time; the engine
26
+ * binds their names to the opaque `Any` type instead of reporting
27
+ * "Cannot resolve module" / "Unbound variable".
28
+ */
29
+ export declare function isAssetImportSpecifier(specifier: string, fromUri: string): boolean;
30
+ /**
31
+ * Resolve a `// ::types <specifier>` directive to a file path.
32
+ * Supports:
33
+ * - Relative paths: `./demo`, `../lib/types`
34
+ * - Package names: `fantasy-box`
35
+ * - Scoped packages: `@scope/package`
36
+ */
37
+ export declare function resolveTypeDirectiveSpecifier(specifier: string, fromUri: string): string | null;
38
+ /**
39
+ * Extract import specifiers mapping imported name → module specifier.
40
+ * Handles: `import Foo from './foo'`, `const { Foo } = require('./foo')`
41
+ */
42
+ export declare function extractImportSpecifiers(source: string): Map<string, string>;
43
+ /**
44
+ * Pre-process source to insert `;` before `[` at line starts where JS parsers
45
+ * would otherwise treat the array literal as a computed member access on the
46
+ * previous expression (the well-known ASI hazard).
47
+ *
48
+ * Returns the patched source and an array of insertion offsets so that
49
+ * diagnostic positions can be mapped back to the original source.
50
+ *
51
+ * Heuristic: a `[` at the start of a line (after optional whitespace) is
52
+ * treated as an array literal start when the last significant character of
53
+ * the previous line is one of: ) ] } identifier-char " ' ` digit
54
+ * (i.e. something that ends a complete expression/statement).
55
+ */
56
+ export declare function normalizeArrayLiteralASI(source: string): {
57
+ patched: string;
58
+ insertions: number[];
59
+ };
60
+ /**
61
+ * Map an offset from original source to the patched source,
62
+ * accounting for all `;` insertions.
63
+ */
64
+ export declare function mapOffset(offset: number, insertions: number[]): number;
65
+ /**
66
+ * Map an offset from patched source back to the original source,
67
+ * accounting for all `;` insertions.
68
+ */
69
+ export declare function unmapOffset(patchedOffset: number, insertions: number[]): number;
70
+ /**
71
+ * Find the matching `[` for a `]` at `closeBracketIdx` in `source` and
72
+ * return a patched source with `;` inserted before the `[`.
73
+ *
74
+ * This is the single, reusable fix for the ASI ambiguity where JavaScript
75
+ * (and the parser) treat `[...]` on a new line as computed member access on
76
+ * the previous expression rather than as an array literal.
77
+ */
78
+ export declare function patchArrayLiteralASI(source: string, closeBracketIdx: number): {
79
+ patched: string;
80
+ openBracket: number;
81
+ shift: number;
82
+ } | null;
83
+ /**
84
+ * Find the offset of an exported identifier in a source file.
85
+ * Handles: `export const name`, `export function name`, `export default name`,
86
+ * `export { name }`, and `const name` / `function name` (for default
87
+ * or re-export patterns).
88
+ * Returns the start offset of the identifier or -1 if not found.
89
+ */
90
+ export declare function findExportedIdentifierOffset(source: string, name: string): number;
91
+ /** Convert a character offset to a Position {line, character}. */
92
+ export declare function positionAt(source: string, offset: number): {
93
+ line: number;
94
+ character: number;
95
+ };
96
+ /**
97
+ * Find the definition location of a type name.
98
+ * Checks: 1) type aliases, 2) local constructor annotations,
99
+ * 3) imported files, 4) ::types directive targets,
100
+ * 5) globals file.
101
+ */
102
+ export declare function findTypeDefinitionLocation(typeName: string, source: string, fromUri: string, result: InferenceResult, globals?: {
103
+ source: string;
104
+ uri: string;
105
+ } | null): Location | null;
106
+ type Scheme = import('../hm/types').Scheme;
107
+ type Type = import('../hm/types').Type;
108
+ type Logger = {
109
+ warn(msg: string): void;
110
+ };
111
+ export declare function clearHmSidecarCache(): void;
112
+ /**
113
+ * Evict a single `.hm` sidecar entry from the parse cache. Used by the
114
+ * selective-invalidation path so unrelated sidecars stay parsed when one
115
+ * sidecar changes. Accepts either an absolute file path (the cache key)
116
+ * or a `file://` URI — converts the URI form to a path before lookup.
117
+ */
118
+ export declare function evictHmSidecar(pathOrUri: string): void;
119
+ /**
120
+ * Wrap every non-comment line of a `.hm` source with `// ` so that the
121
+ * existing comment-based annotation parser can extract `Name :: Type`
122
+ * declarations.
123
+ *
124
+ * Comment semantics inside `.hm`:
125
+ * - A line starting with `//` (after trimming) is a true source-level
126
+ * comment and is NOT registered. Its bytes are blanked out (replaced
127
+ * by spaces of the same length) so directive/annotation regexes can
128
+ * never see them, while line offsets remain stable for diagnostics.
129
+ * - Block comments (`/* ... *\/`) are likewise stripped to whitespace.
130
+ * - Bare directive/annotation lines are wrapped with `// ` so the
131
+ * existing JS comment parser picks them up.
132
+ */
133
+ export declare function wrapHmSource(source: string): string;
134
+ /**
135
+ * Parse a `.hm` annotation source into a map from exported name to its
136
+ * `Scheme`. By default the source is wrapped via {@link wrapHmSource} so
137
+ * the JS comment-parser can read bare-line `Name :: Type` declarations.
138
+ * Pass `{ wrap: false }` when the source is JS (or any file whose
139
+ * annotations already live inside `// ` comments) — e.g. when scanning
140
+ * a package's JS entries for inline signatures next to definitions.
141
+ */
142
+ export declare function parseHmSource(source: string, opts?: {
143
+ wrap?: boolean;
144
+ }): Map<string, Scheme>;
145
+ /**
146
+ * The `::curried` lines of a `.hm` source, each with the name declared on
147
+ * the line directly below it (`null` when that line declares nothing). The
148
+ * function with that name is curried the way Ramda's functions are: it
149
+ * accepts its arguments in any grouping (`f (a, b)`, `f (a) (b)`), like the
150
+ * result of a `curry (…)` call in JavaScript. Its overload lines share the
151
+ * marker.
152
+ */
153
+ export declare function curriedHmDeclarations(source: string): {
154
+ line: number;
155
+ name: string | null;
156
+ }[];
157
+ /** `a -> b -> c` (or longer): a function whose result is again a function. */
158
+ export declare function takesSeveralArguments(type: Type): boolean;
159
+ /**
160
+ * Like `parseHmSource` but returns the raw signature text exactly as the
161
+ * user wrote it, indexed by export name. Used by hover / completion to
162
+ * preserve the user's parens, whitespace and ordering instead of
163
+ * round-tripping through the type printer (which loses redundant parens).
164
+ */
165
+ export declare function parseHmSourceRaw(source: string): Map<string, string>;
166
+ /**
167
+ * Read and parse a standalone `.hm` annotation file. Returns a map from
168
+ * exported name to its parsed `Scheme`, or `null` when the file can't be
169
+ * read. Results are cached by absolute path.
170
+ */
171
+ export declare function loadHmFile(filePath: string, logger?: Logger): Map<string, Scheme> | null;
172
+ /**
173
+ * Parse the contents of a `.hm` annotation source and extract the type
174
+ * aliases declared in it. An entry is treated as an alias when the name
175
+ * is uppercase, is not a method (no `#`/`.`), is not a sumtype declaration
176
+ * or constructor, and is not a registered data-type variant. Returned
177
+ * alongside each alias is the ordered list of free type-variable names
178
+ * appearing in the alias body — needed for polymorphic alias expansion.
179
+ */
180
+ export declare function parseHmTypeAliases(source: string, opts?: {
181
+ wrap?: boolean;
182
+ }): {
183
+ aliases: Map<string, Type>;
184
+ aliasVars: Map<string, string[]>;
185
+ constructors: Map<string, Scheme>;
186
+ instanceCallables: Map<string, Scheme[]>;
187
+ aliasExtensions: {
188
+ name: string;
189
+ raw: string;
190
+ start: number;
191
+ end: number;
192
+ }[];
193
+ };
194
+ /**
195
+ * Type aliases declared in a JavaScript/TypeScript module's own comment
196
+ * annotations (`// RequestObj :: { … }`, `// Rule :: (String, Any) -> …`).
197
+ *
198
+ * Only STANDALONE annotations count: an uppercase annotation that is not
199
+ * attached to a declaration (`nodeStart === undefined`). An annotation on a
200
+ * declaration (`// Engine :: (String, EngineFn) -> Component` above
201
+ * `const Engine = …`) types a value, not a type name. Unlike `.hm`
202
+ * sidecars, function-bodied aliases (`RouteFn :: RequestObj -> …`) stay
203
+ * aliases: in a JS module the standalone form is always a type name.
204
+ *
205
+ * Used by the import-alias resolver so that importing a value from a module
206
+ * also brings the type names that module (and its `::types` closure)
207
+ * declares — consumers no longer need an explicit `// ::types` for them.
208
+ */
209
+ export declare function parseJsTypeAliases(source: string): ReturnType<typeof parseHmTypeAliases>;
210
+ /**
211
+ * Walk up from `entryPath` to the nearest `package.json` and collect every
212
+ * sidecar declared in its `hinmil.sidecars` field. The field may be a single
213
+ * string or an array of strings — entries are resolved relative to the
214
+ * `package.json` directory. Missing files are silently skipped. Order
215
+ * is preserved: when consumers merge the results, later entries should
216
+ * override earlier ones.
217
+ */
218
+ export declare function findHmSidecarPaths(entryPath: string): string[];
219
+ /**
220
+ * Walk up from `entryPath` to the nearest `package.json` and return the
221
+ * package directory plus its parsed JSON. Returns null when no
222
+ * `package.json` is found.
223
+ */
224
+ export declare function findPackageJson(entryPath: string): {
225
+ pkgDir: string;
226
+ pkgJson: Record<string, unknown>;
227
+ } | null;
228
+ /**
229
+ * Resolve the absolute paths of a package's `hinmil.globals` files.
230
+ * Returns an empty array when the package declares no globals. Each
231
+ * declared entry must point at an existing file; unresolvable entries
232
+ * are warned about and skipped.
233
+ */
234
+ export declare function findPackageGlobalsPaths(entryPath: string, logger?: Logger): string[];
235
+ /** Backward-compatible single-result helper: returns the first sidecar, or null. */
236
+ export declare function findHmSidecarPath(entryPath: string): string | null;
237
+ export declare function loadHmSidecar(entryPath: string, logger?: Logger): Map<string, Scheme> | null;
238
+ /** True for an import specifier that targets a node_modules package. */
239
+ export declare function isBareSpecifier(specifier: string): boolean;
240
+ /** Public re-export of the internal `splitBareSpecifier` helper. */
241
+ export declare function getBarePackageName(specifier: string): string;
242
+ /**
243
+ * Candidate conventional stub paths (relative to `<typesDir>/`) for a bare
244
+ * specifier, most specific first. Deep imports of CJS utility packages
245
+ * (`import RTask from "pkg/RTask/index.js"`) need a stub describing the
246
+ * SUBPATH module's exports — the package-level `<pkg>.hm` stub describes
247
+ * the root module and is only the last-resort fallback:
248
+ *
249
+ * `pkg/RTask/index.js` → [`pkg/RTask/index.hm`, `pkg/RTask.hm`, `pkg.hm`]
250
+ * `pkg/RTask` → [`pkg/RTask.hm`, `pkg/RTask/index.hm`, `pkg.hm`]
251
+ * `pkg` → [`pkg.hm`]
252
+ */
253
+ export declare function conventionalStubRelPaths(specifier: string): string[];
254
+ /**
255
+ * Derive the conventional `@hm/*` companion package name for a given
256
+ * bare package specifier. Mirrors the DefinitelyTyped (`@types/*`) scheme:
257
+ * `lodash` → `@hm/lodash`
258
+ * `@scope/pkg` → `@hm/scope__pkg`
259
+ */
260
+ export declare function hmCompanionPackageName(pkgName: string): string;
261
+ /** Hard cap on visited files per scan to keep cost bounded. */
262
+ export declare const INLINE_PACKAGE_MAX_FILES = 256;
263
+ export interface InlinePackageScan {
264
+ /** Top-level `Name :: Type` annotations found inline. Consumed by
265
+ * `createImportResolver` (merged with sidecar exports) to resolve
266
+ * imports of the package from outside its own tree. */
267
+ exports: Map<string, Scheme>;
268
+ /** Concatenated raw sources of all visited files — fed to the
269
+ * annotation registrar so it can pull out `Type#m` / `Type.m`
270
+ * method annotations and aliases. */
271
+ methodSource: string;
272
+ /** Verbatim raw signature text per top-level export name (the part
273
+ * after `Name :: `, exactly as written by the user). Used by hover
274
+ * to render inline imports with their full constraint context, and
275
+ * by `findTypeDefinitions` to confirm an export carries an inline
276
+ * annotation. */
277
+ inlineRawSignatures: Map<string, string>;
278
+ /** Absolute file path of the visited source that first declared each
279
+ * top-level export (first-writer-wins). Lets `findTypeDefinitions`
280
+ * jump directly to the defining file without re-scanning. */
281
+ nameToSource: Map<string, string>;
282
+ /** Absolute file paths visited — used for dependency tracking. */
283
+ visitedFiles: string[];
284
+ }
285
+ /**
286
+ * Runtime export names per `require` target, as read by
287
+ * `supplementWithRuntimeExports` (importContext.ts); `null` = the module
288
+ * could not be loaded. Without this cache every import of a package re-ran
289
+ * the `require` attempt and — for a package whose `main` is missing — logged
290
+ * the same warning once per importing module. Cleared together with the
291
+ * inline-package cache (package changes on disk).
292
+ */
293
+ export declare const runtimeExportNamesCache: Map<string, string[] | null>;
294
+ export declare function clearInlinePackageCache(): void;
295
+ /**
296
+ * Does the package that owns `targetPath` (a JS module under node_modules)
297
+ * ship inline HM annotations in its own source? Such a package (e.g. a curried FP library,
298
+ * whose buble build keeps every `// name :: Type` comment) has opted into
299
+ * hinmil: its modules are inferred exactly like local source, so CommonJS
300
+ * export shapes (`module.exports = _RTask` + dotted statics, re-export
301
+ * barrels `module.exports = { RTask: require ("./RTask") }`) resolve
302
+ * per module instead of through the name-based inline scan.
303
+ *
304
+ * Probes the target and a few same-package modules it requires (a barrel
305
+ * `index.js` usually has no annotations itself). Positive answers are
306
+ * cached per package root.
307
+ */
308
+ export declare function isInlineAnnotatedPackageModule(targetPath: string): boolean;
309
+ /**
310
+ * Evict every inline-annotation scan whose cache key starts with the
311
+ * given package root. Use this instead of {@link clearInlinePackageCache}
312
+ * when a single package's `.hm` sidecar changes — wiping the whole map
313
+ * forces every other imported package to re-do its BFS scan on the next
314
+ * resolver call (up to {@link INLINE_PACKAGE_MAX_FILES} files each),
315
+ * which dominates cold-hover latency in workspaces with several heavy
316
+ * dependencies.
317
+ *
318
+ * The cache key shape is `${pkgRoot}\0${effectiveEntry}` (see
319
+ * {@link collectInlinePackageAnnotations}), so a prefix match on
320
+ * `${pkgRoot}\0` cleanly targets the package.
321
+ */
322
+ export declare function clearInlinePackageCacheForPackage(pkgRoot: string): void;
323
+ /**
324
+ * Extract every module specifier referenced by a JS source. Handles:
325
+ * - `import x from '...'`
326
+ * - `import { x } from '...'`
327
+ * - `export { x } from '...'`
328
+ * - `export * from '...'`
329
+ * - `require('...')` (call expressions, anywhere)
330
+ * Uses the parser when possible and falls back to a permissive regex when
331
+ * the parse fails (e.g. flow / TS-only syntax).
332
+ */
333
+ export declare function extractAllModuleSpecifiers(source: string): string[];
334
+ /**
335
+ * BFS the JS module graph rooted at `entryPath`, staying inside the
336
+ * package root, collecting inline `// Name :: Type` annotations. Returns
337
+ * `null` when nothing was found (so callers can short-circuit). Results
338
+ * are cached by `pkgRoot + entry`.
339
+ */
340
+ export declare function collectInlinePackageAnnotations(entryPath: string, logger?: Logger): InlinePackageScan | null;
341
+ export {};
342
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/services/files.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAc3C;;;;;mCAKmC;AACnC,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAM7E;AA+LD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYxF;AAED;;;;;GAKG;AACH,wBAAgB,uB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