@colbymchenry/codegraph-win32-arm64 1.6.3 → 1.6.4

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 (252) hide show
  1. package/lib/dist/.test-build-engine.json +1 -1
  2. package/lib/dist/.test-build-viewer.json +1 -1
  3. package/lib/dist/bin/codegraph.js +85 -17
  4. package/lib/dist/bin/codegraph.js.map +1 -1
  5. package/lib/dist/db/queries.d.ts +44 -1
  6. package/lib/dist/db/queries.d.ts.map +1 -1
  7. package/lib/dist/db/queries.js +75 -5
  8. package/lib/dist/db/queries.js.map +1 -1
  9. package/lib/dist/engine.d.ts +1 -1
  10. package/lib/dist/engine.d.ts.map +1 -1
  11. package/lib/dist/engine.js +2 -1
  12. package/lib/dist/engine.js.map +1 -1
  13. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
  14. package/lib/dist/extraction/cfml-extractor.js +4 -2
  15. package/lib/dist/extraction/cfml-extractor.js.map +1 -1
  16. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  17. package/lib/dist/extraction/extraction-version.js +1 -1
  18. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  19. package/lib/dist/extraction/function-ref.js +12 -1
  20. package/lib/dist/extraction/function-ref.js.map +1 -1
  21. package/lib/dist/extraction/grammars.d.ts +28 -0
  22. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  23. package/lib/dist/extraction/grammars.js +106 -0
  24. package/lib/dist/extraction/grammars.js.map +1 -1
  25. package/lib/dist/extraction/index.d.ts +11 -0
  26. package/lib/dist/extraction/index.d.ts.map +1 -1
  27. package/lib/dist/extraction/index.js +42 -3
  28. package/lib/dist/extraction/index.js.map +1 -1
  29. package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
  30. package/lib/dist/extraction/kernel/index.js +23 -2
  31. package/lib/dist/extraction/kernel/index.js.map +1 -1
  32. package/lib/dist/extraction/kernel/loader.d.ts +5 -1
  33. package/lib/dist/extraction/kernel/loader.d.ts.map +1 -1
  34. package/lib/dist/extraction/kernel/loader.js.map +1 -1
  35. package/lib/dist/extraction/languages/dart.d.ts +47 -2
  36. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  37. package/lib/dist/extraction/languages/dart.js +193 -6
  38. package/lib/dist/extraction/languages/dart.js.map +1 -1
  39. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  40. package/lib/dist/extraction/languages/kotlin.js +8 -13
  41. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  42. package/lib/dist/extraction/languages/php.d.ts +9 -0
  43. package/lib/dist/extraction/languages/php.d.ts.map +1 -1
  44. package/lib/dist/extraction/languages/php.js +202 -2
  45. package/lib/dist/extraction/languages/php.js.map +1 -1
  46. package/lib/dist/extraction/languages/rust-macro-calls.d.ts +32 -0
  47. package/lib/dist/extraction/languages/rust-macro-calls.d.ts.map +1 -0
  48. package/lib/dist/extraction/languages/rust-macro-calls.js +306 -0
  49. package/lib/dist/extraction/languages/rust-macro-calls.js.map +1 -0
  50. package/lib/dist/extraction/parse-budget.d.ts +42 -7
  51. package/lib/dist/extraction/parse-budget.d.ts.map +1 -1
  52. package/lib/dist/extraction/parse-budget.js +39 -2
  53. package/lib/dist/extraction/parse-budget.js.map +1 -1
  54. package/lib/dist/extraction/parse-pool.d.ts +1 -13
  55. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  56. package/lib/dist/extraction/parse-pool.js +7 -19
  57. package/lib/dist/extraction/parse-pool.js.map +1 -1
  58. package/lib/dist/extraction/tree-sitter.d.ts +77 -7
  59. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  60. package/lib/dist/extraction/tree-sitter.js +218 -18
  61. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  62. package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  63. package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  64. package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  65. package/lib/dist/extraction/wasm-runtime-flags.d.ts +9 -0
  66. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  67. package/lib/dist/extraction/wasm-runtime-flags.js +17 -1
  68. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  69. package/lib/dist/graph/file-drift.d.ts +35 -0
  70. package/lib/dist/graph/file-drift.d.ts.map +1 -0
  71. package/lib/dist/graph/file-drift.js +46 -0
  72. package/lib/dist/graph/file-drift.js.map +1 -0
  73. package/lib/dist/graph/queries.d.ts +4 -1
  74. package/lib/dist/graph/queries.d.ts.map +1 -1
  75. package/lib/dist/graph/queries.js +2 -2
  76. package/lib/dist/graph/queries.js.map +1 -1
  77. package/lib/dist/graph/symbol-references.d.ts +86 -0
  78. package/lib/dist/graph/symbol-references.d.ts.map +1 -0
  79. package/lib/dist/graph/symbol-references.js +304 -0
  80. package/lib/dist/graph/symbol-references.js.map +1 -0
  81. package/lib/dist/graph/test-code.d.ts +15 -3
  82. package/lib/dist/graph/test-code.d.ts.map +1 -1
  83. package/lib/dist/graph/test-code.js +56 -2
  84. package/lib/dist/graph/test-code.js.map +1 -1
  85. package/lib/dist/graph/traversal.d.ts.map +1 -1
  86. package/lib/dist/graph/traversal.js +2 -4
  87. package/lib/dist/graph/traversal.js.map +1 -1
  88. package/lib/dist/index.d.ts +24 -1
  89. package/lib/dist/index.d.ts.map +1 -1
  90. package/lib/dist/index.js +42 -3
  91. package/lib/dist/index.js.map +1 -1
  92. package/lib/dist/installer/index.d.ts +4 -1
  93. package/lib/dist/installer/index.d.ts.map +1 -1
  94. package/lib/dist/installer/index.js +2 -1
  95. package/lib/dist/installer/index.js.map +1 -1
  96. package/lib/dist/installer/instructions-template.d.ts +15 -0
  97. package/lib/dist/installer/instructions-template.d.ts.map +1 -1
  98. package/lib/dist/installer/instructions-template.js +10 -1
  99. package/lib/dist/installer/instructions-template.js.map +1 -1
  100. package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
  101. package/lib/dist/installer/targets/opencode.js +1 -1
  102. package/lib/dist/installer/targets/opencode.js.map +1 -1
  103. package/lib/dist/installer/targets/shared.d.ts +2 -2
  104. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  105. package/lib/dist/installer/targets/shared.js +18 -2
  106. package/lib/dist/installer/targets/shared.js.map +1 -1
  107. package/lib/dist/mcp/daemon-paths.d.ts +2 -0
  108. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  109. package/lib/dist/mcp/daemon-paths.js +7 -0
  110. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  111. package/lib/dist/mcp/daemon-proof.d.ts +19 -0
  112. package/lib/dist/mcp/daemon-proof.d.ts.map +1 -0
  113. package/lib/dist/mcp/daemon-proof.js +126 -0
  114. package/lib/dist/mcp/daemon-proof.js.map +1 -0
  115. package/lib/dist/mcp/daemon-registry.d.ts +7 -2
  116. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  117. package/lib/dist/mcp/daemon-registry.js +14 -2
  118. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  119. package/lib/dist/mcp/daemon.d.ts +46 -0
  120. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  121. package/lib/dist/mcp/daemon.js +97 -3
  122. package/lib/dist/mcp/daemon.js.map +1 -1
  123. package/lib/dist/mcp/engine.d.ts +16 -0
  124. package/lib/dist/mcp/engine.d.ts.map +1 -1
  125. package/lib/dist/mcp/engine.js +14 -0
  126. package/lib/dist/mcp/engine.js.map +1 -1
  127. package/lib/dist/mcp/explore-diagnostics.d.ts +6 -0
  128. package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -1
  129. package/lib/dist/mcp/explore-diagnostics.js +8 -0
  130. package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
  131. package/lib/dist/mcp/explore-one-symbol.d.ts +77 -0
  132. package/lib/dist/mcp/explore-one-symbol.d.ts.map +1 -0
  133. package/lib/dist/mcp/explore-one-symbol.js +431 -0
  134. package/lib/dist/mcp/explore-one-symbol.js.map +1 -0
  135. package/lib/dist/mcp/hook-client.d.ts +44 -0
  136. package/lib/dist/mcp/hook-client.d.ts.map +1 -0
  137. package/lib/dist/mcp/hook-client.js +202 -0
  138. package/lib/dist/mcp/hook-client.js.map +1 -0
  139. package/lib/dist/mcp/index.d.ts +13 -3
  140. package/lib/dist/mcp/index.d.ts.map +1 -1
  141. package/lib/dist/mcp/index.js +15 -9
  142. package/lib/dist/mcp/index.js.map +1 -1
  143. package/lib/dist/mcp/opencode-tool-names.d.ts +32 -0
  144. package/lib/dist/mcp/opencode-tool-names.d.ts.map +1 -0
  145. package/lib/dist/mcp/opencode-tool-names.js +24 -0
  146. package/lib/dist/mcp/opencode-tool-names.js.map +1 -0
  147. package/lib/dist/mcp/project-lifecycle.d.ts +6 -0
  148. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
  149. package/lib/dist/mcp/project-lifecycle.js +21 -3
  150. package/lib/dist/mcp/project-lifecycle.js.map +1 -1
  151. package/lib/dist/mcp/prompt-explore.d.ts +19 -0
  152. package/lib/dist/mcp/prompt-explore.d.ts.map +1 -0
  153. package/lib/dist/mcp/prompt-explore.js +6 -0
  154. package/lib/dist/mcp/prompt-explore.js.map +1 -0
  155. package/lib/dist/mcp/proxy.d.ts +14 -7
  156. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  157. package/lib/dist/mcp/proxy.js +71 -26
  158. package/lib/dist/mcp/proxy.js.map +1 -1
  159. package/lib/dist/mcp/query-pool.d.ts +9 -0
  160. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  161. package/lib/dist/mcp/query-pool.js +5 -0
  162. package/lib/dist/mcp/query-pool.js.map +1 -1
  163. package/lib/dist/mcp/server-instructions.d.ts +18 -0
  164. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  165. package/lib/dist/mcp/server-instructions.js +12 -1
  166. package/lib/dist/mcp/server-instructions.js.map +1 -1
  167. package/lib/dist/mcp/session.d.ts +19 -0
  168. package/lib/dist/mcp/session.d.ts.map +1 -1
  169. package/lib/dist/mcp/session.js +42 -3
  170. package/lib/dist/mcp/session.js.map +1 -1
  171. package/lib/dist/mcp/tools.d.ts +31 -1
  172. package/lib/dist/mcp/tools.d.ts.map +1 -1
  173. package/lib/dist/mcp/tools.js +137 -32
  174. package/lib/dist/mcp/tools.js.map +1 -1
  175. package/lib/dist/project-config.d.ts +20 -0
  176. package/lib/dist/project-config.d.ts.map +1 -1
  177. package/lib/dist/project-config.js +30 -2
  178. package/lib/dist/project-config.js.map +1 -1
  179. package/lib/dist/resolution/callback-synthesizer.d.ts +4 -4
  180. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  181. package/lib/dist/resolution/callback-synthesizer.js +44 -77
  182. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  183. package/lib/dist/resolution/event-emitter-synthesizer.d.ts +39 -0
  184. package/lib/dist/resolution/event-emitter-synthesizer.d.ts.map +1 -0
  185. package/lib/dist/resolution/event-emitter-synthesizer.js +656 -0
  186. package/lib/dist/resolution/event-emitter-synthesizer.js.map +1 -0
  187. package/lib/dist/resolution/frameworks/aspnet-routes.d.ts +62 -0
  188. package/lib/dist/resolution/frameworks/aspnet-routes.d.ts.map +1 -0
  189. package/lib/dist/resolution/frameworks/aspnet-routes.js +382 -0
  190. package/lib/dist/resolution/frameworks/aspnet-routes.js.map +1 -0
  191. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  192. package/lib/dist/resolution/frameworks/csharp.js +80 -34
  193. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  194. package/lib/dist/resolution/frameworks/elysia.d.ts +38 -0
  195. package/lib/dist/resolution/frameworks/elysia.d.ts.map +1 -0
  196. package/lib/dist/resolution/frameworks/elysia.js +683 -0
  197. package/lib/dist/resolution/frameworks/elysia.js.map +1 -0
  198. package/lib/dist/resolution/frameworks/express.d.ts +48 -1
  199. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  200. package/lib/dist/resolution/frameworks/express.js +13 -2
  201. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  202. package/lib/dist/resolution/frameworks/index.d.ts +1 -0
  203. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  204. package/lib/dist/resolution/frameworks/index.js +5 -1
  205. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  206. package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
  207. package/lib/dist/resolution/frameworks/laravel.js +69 -11
  208. package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
  209. package/lib/dist/resolution/import-resolver.d.ts +2 -0
  210. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  211. package/lib/dist/resolution/import-resolver.js +164 -25
  212. package/lib/dist/resolution/import-resolver.js.map +1 -1
  213. package/lib/dist/resolution/index.d.ts +102 -0
  214. package/lib/dist/resolution/index.d.ts.map +1 -1
  215. package/lib/dist/resolution/index.js +289 -13
  216. package/lib/dist/resolution/index.js.map +1 -1
  217. package/lib/dist/resolution/js-builtins.d.ts +9 -0
  218. package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
  219. package/lib/dist/resolution/js-builtins.js +21 -1
  220. package/lib/dist/resolution/js-builtins.js.map +1 -1
  221. package/lib/dist/resolution/module-importers.d.ts +25 -0
  222. package/lib/dist/resolution/module-importers.d.ts.map +1 -1
  223. package/lib/dist/resolution/module-importers.js +85 -0
  224. package/lib/dist/resolution/module-importers.js.map +1 -1
  225. package/lib/dist/resolution/name-matcher.d.ts +129 -1
  226. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  227. package/lib/dist/resolution/name-matcher.js +1603 -92
  228. package/lib/dist/resolution/name-matcher.js.map +1 -1
  229. package/lib/dist/resolution/php-web-root.d.ts +39 -0
  230. package/lib/dist/resolution/php-web-root.d.ts.map +1 -0
  231. package/lib/dist/resolution/php-web-root.js +141 -0
  232. package/lib/dist/resolution/php-web-root.js.map +1 -0
  233. package/lib/dist/resolution/python-overloads.d.ts +10 -0
  234. package/lib/dist/resolution/python-overloads.d.ts.map +1 -0
  235. package/lib/dist/resolution/python-overloads.js +75 -0
  236. package/lib/dist/resolution/python-overloads.js.map +1 -0
  237. package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -1
  238. package/lib/dist/resolution/swift-type-visibility.js +60 -3
  239. package/lib/dist/resolution/swift-type-visibility.js.map +1 -1
  240. package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
  241. package/lib/dist/resolution/tier-synthesizer.js +31 -7
  242. package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
  243. package/lib/dist/resolution/types.d.ts +9 -0
  244. package/lib/dist/resolution/types.d.ts.map +1 -1
  245. package/lib/dist/resolution/types.js.map +1 -1
  246. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
  247. package/lib/dist/resolution/workspace-packages.js +3 -0
  248. package/lib/dist/resolution/workspace-packages.js.map +1 -1
  249. package/lib/kernel/codegraph-kernel.node +2 -2
  250. package/lib/node_modules/.package-lock.json +1 -1
  251. package/lib/package.json +1 -1
  252. package/package.json +1 -1
@@ -0,0 +1,683 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.elysiaResolver = void 0;
4
+ const strip_comments_1 = require("../strip-comments");
5
+ const import_resolver_1 = require("../import-resolver");
6
+ const synth_utils_1 = require("../synth-utils");
7
+ const query_utils_1 = require("../../search/query-utils");
8
+ const package_deps_1 = require("./package-deps");
9
+ const express_1 = require("./express");
10
+ const SCRIPT_FILE = /\.(?:[cm]?[jt]sx?)$/;
11
+ const ELYSIA_WORD = /\bElysia\b/;
12
+ const VERBS = new Set(['get', 'post', 'put', 'patch', 'delete', 'options', 'head', 'all', 'connect']);
13
+ const CHAIN_START = /(\bnew\s+Elysia\s*(?:<[^()]*?>\s*)?\()|(?<![\w$.])([A-Za-z_$][\w$]*)(?=\s*!?\s*\??\.\s*[A-Za-z_$][\w$]*\s*(?:<[^()]*?>\s*)?\()|\b([A-Za-z_$][\w$]*)\s*\??\s*:\s*(?:Any)?Elysia\b/g;
14
+ const LINK = /\s*!?\s*\??\.\s*([A-Za-z_$][\w$]*)\s*(?:<[^()]*?>\s*)?\(/y;
15
+ const TOP_LEVEL_DECL = /^(?:export[ \t]+)?(?:default[ \t]+)?(?:declare[ \t]+)?(?:async[ \t]+)?(?:const|let|var|function[ \t]*\*?|class)[ \t]+([A-Za-z_$][\w$]*)|^export[ \t]+default\b/gm;
16
+ const FUNCTION_ARG = /^\s*(?:async\s*)?(?:\([^()]*\)|[A-Za-z_$][\w$]*)\s*(?::[^=]*?)?=>|^\s*(?:async\s+)?function\b/;
17
+ const ARROW_HEAD = /^\s*(?:async\s*)?(?:\(\s*([A-Za-z_$][\w$]*)?[^()]*\)|([A-Za-z_$][\w$]*))\s*(?::[^=]*?)?=>/;
18
+ const FUNCTION_HEAD = /^\s*(?:async\s+)?function\b\s*\*?\s*[\w$]*\s*\(\s*([A-Za-z_$][\w$]*)?[^()]*\)\s*(?::[^{]*?)?(?=\{)/;
19
+ const MOUNT_TARGET = /^(?:await\s+)?import\s*\(\s*(['"`])[^'"`]+\1\s*\)$|^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)?\s*(?:\([\s\S]*\))?$/;
20
+ const LAZY_BINDING = /(?:^|[^\w$.])(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::[^=;]*)?=[^;\n]*?\bimport\s*\(\s*(['"`])([^'"`]+)\2\s*\)\s*\)?\s*(?:\.\s*([A-Za-z_$][\w$]*))?/g;
21
+ const NAMED_HANDLER = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*$/;
22
+ const SOCKET_CALLBACK = /(?:^|[{,]\s*)(?:async\s+)?(open|message|close|drain|ping|pong)\s*(\(|:)/g;
23
+ const KEYWORDS = new Set(['if', 'for', 'while', 'switch', 'catch', 'with', 'return', 'typeof', 'new', 'await', 'function']);
24
+ function languageOf(filePath) {
25
+ if (filePath.endsWith('.tsx'))
26
+ return 'tsx';
27
+ if (filePath.endsWith('.jsx'))
28
+ return 'jsx';
29
+ return /\.[cm]?ts$/.test(filePath) ? 'typescript' : 'javascript';
30
+ }
31
+ function stripFor(filePath, content) {
32
+ const language = languageOf(filePath);
33
+ return (0, strip_comments_1.stripCommentsForRegex)(content, language === 'typescript' || language === 'tsx' ? 'typescript' : 'javascript');
34
+ }
35
+ function joinRoute(prefix, path) {
36
+ const joined = (0, express_1.joinPaths)(prefix, path);
37
+ return joined.startsWith('/') ? joined : `/${joined}`;
38
+ }
39
+ function joinPrefix(a, b) {
40
+ const joined = joinRoute(a, b);
41
+ return joined === '/' ? '' : joined;
42
+ }
43
+ function routeId(filePath, site) {
44
+ return `route:${filePath}:${site.line}:${site.method}:${site.path}`;
45
+ }
46
+ function instanceKey(filePath, owner) {
47
+ return `${filePath}\0${owner}`;
48
+ }
49
+ function literalArg(safe, at, structure) {
50
+ if (!/^\s*(['"`])[^'"`]*\1\s*$/.test(structure))
51
+ return null;
52
+ let i = at;
53
+ while (i < safe.length && /\s/.test(safe[i]))
54
+ i++;
55
+ const quote = safe[i];
56
+ let out = '';
57
+ for (let k = i + 1; k < safe.length; k++) {
58
+ const c = safe[k];
59
+ if (c === '\\') {
60
+ out += safe[k + 1] ?? '';
61
+ k++;
62
+ }
63
+ else if (c === quote) {
64
+ return out;
65
+ }
66
+ else if (quote === '`' && c === '$' && safe[k + 1] === '{') {
67
+ return null;
68
+ }
69
+ else {
70
+ out += c;
71
+ }
72
+ }
73
+ return null;
74
+ }
75
+ function constructorPrefix(safe, open, structure) {
76
+ const inner = structure.slice(1, -1);
77
+ const objectAt = inner.search(/\S/);
78
+ if (objectAt < 0 || inner[objectAt] !== '{')
79
+ return '';
80
+ const key = /\bprefix\s*:\s*/g;
81
+ let m;
82
+ while ((m = key.exec(inner)) !== null) {
83
+ let depth = 0;
84
+ for (let k = objectAt; k < m.index; k++) {
85
+ const c = inner[k];
86
+ if (c === '{' || c === '(' || c === '[')
87
+ depth++;
88
+ else if (c === '}' || c === ')' || c === ']')
89
+ depth--;
90
+ }
91
+ if (depth !== 1)
92
+ continue;
93
+ const valueAt = m.index + m[0].length;
94
+ const value = /^(['"`])[^'"`]*\1(?=\s*[,}])/.exec(inner.slice(valueAt));
95
+ return value ? literalArg(safe, open + 1 + valueAt, value[0]) ?? '' : '';
96
+ }
97
+ return '';
98
+ }
99
+ function boundName(safe, at) {
100
+ const m = /(?:^|[^\w$.])(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::[^=;]*)?=\s*(?:await\s+)?$/.exec(safe.slice(Math.max(0, at - 240), at));
101
+ return m ? m[1] : null;
102
+ }
103
+ function enclosingParen(search, at) {
104
+ let depth = 0;
105
+ for (let i = at - 1; i >= 0 && at - i < 2000; i--) {
106
+ const c = search[i];
107
+ if (c === ')' || c === ']' || c === '}')
108
+ depth++;
109
+ else if (c === '(' || c === '[' || c === '{') {
110
+ if (depth === 0)
111
+ return c === '(' ? i : -1;
112
+ depth--;
113
+ }
114
+ else if (c === ';' && depth === 0)
115
+ return -1;
116
+ }
117
+ return -1;
118
+ }
119
+ function topLevelOwners(search) {
120
+ const at = [];
121
+ const names = [];
122
+ TOP_LEVEL_DECL.lastIndex = 0;
123
+ let m;
124
+ while ((m = TOP_LEVEL_DECL.exec(search)) !== null) {
125
+ at.push(m.index);
126
+ names.push(m[1] ?? 'default');
127
+ }
128
+ return { at, names };
129
+ }
130
+ function exportsOf(search) {
131
+ const out = new Map();
132
+ let m;
133
+ const named = /^export[ \t]+default[ \t]+(?:async[ \t]+)?(?:function\b[ \t]*\*?[ \t]*|class\b[ \t]*)([A-Za-z_$][\w$]*)/gm;
134
+ while ((m = named.exec(search)) !== null)
135
+ out.set('default', m[1]);
136
+ const value = /^export[ \t]+default[ \t]+([A-Za-z_$][\w$]*)[ \t]*;?[ \t]*$/gm;
137
+ while ((m = value.exec(search)) !== null)
138
+ if (!KEYWORDS.has(m[1]))
139
+ out.set('default', m[1]);
140
+ const clause = /\bexport\s*\{([^}]*)\}(?!\s*from\b)/g;
141
+ while ((m = clause.exec(search)) !== null) {
142
+ for (const spec of m[1].split(',')) {
143
+ const parts = /^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/.exec(spec);
144
+ if (parts)
145
+ out.set(parts[2] ?? parts[1], parts[1]);
146
+ }
147
+ }
148
+ return out;
149
+ }
150
+ function walkElysia(safe) {
151
+ const search = (0, strip_comments_1.blankStringContents)(safe);
152
+ const lineAt = (0, synth_utils_1.makeLineAt)(safe, 1);
153
+ const top = topLevelOwners(search);
154
+ const file = { routes: [], mounts: [], owners: new Set(top.names), exports: exportsOf(search), lazyImports: new Map() };
155
+ LAZY_BINDING.lastIndex = 0;
156
+ for (let m = LAZY_BINDING.exec(safe); m !== null; m = LAZY_BINDING.exec(safe)) {
157
+ if (search[m.index + m[0].search(/\bimport\s*\(/)] === 'i')
158
+ file.lazyImports.set(m[1], { specifier: m[3], member: m[4] ?? 'default' });
159
+ }
160
+ const ownerAt = (i) => {
161
+ let lo = 0;
162
+ let hi = top.at.length;
163
+ while (lo < hi) {
164
+ const mid = (lo + hi) >> 1;
165
+ if (top.at[mid] <= i)
166
+ lo = mid + 1;
167
+ else
168
+ hi = mid;
169
+ }
170
+ return lo > 0 ? top.names[lo - 1] : '';
171
+ };
172
+ walkRange(0, safe.length, new Map());
173
+ return file;
174
+ function walkRange(from, to, names) {
175
+ const local = new Map(names);
176
+ const re = new RegExp(CHAIN_START.source, 'g');
177
+ re.lastIndex = from;
178
+ let m;
179
+ while ((m = re.exec(search)) !== null && m.index < to) {
180
+ let end = -1;
181
+ if (m[1] !== undefined) {
182
+ const open = m.index + m[0].length - 1;
183
+ const ctor = (0, express_1.scanCall)(safe, open);
184
+ if (!ctor)
185
+ continue;
186
+ const scope = { prefix: constructorPrefix(safe, open, ctor.structure), owner: ownerAt(m.index) };
187
+ const bound = boundName(safe, m.index);
188
+ if (bound)
189
+ local.set(bound, scope);
190
+ end = walkChain(ctor.close + 1, scope, local);
191
+ }
192
+ else if (m[2] !== undefined) {
193
+ const scope = local.get(m[2]);
194
+ if (scope)
195
+ end = walkChain(m.index + m[2].length, scope, local);
196
+ }
197
+ else if (m[3] !== undefined) {
198
+ end = typedParameter(m.index, m[3], local);
199
+ }
200
+ if (end > re.lastIndex)
201
+ re.lastIndex = end;
202
+ }
203
+ }
204
+ function typedParameter(at, name, names) {
205
+ const open = enclosingParen(search, at);
206
+ if (open < 0)
207
+ return -1;
208
+ const params = (0, express_1.scanCall)(safe, open);
209
+ if (!params || params.close < at)
210
+ return -1;
211
+ const after = /^\s*(?::[^=;{}()]*?)?\s*(=>|\{)/.exec(safe.slice(params.close + 1, params.close + 400));
212
+ if (!after)
213
+ return -1;
214
+ if (after[1] === '{') {
215
+ const head = /(?:\bfunction\b\s*\*?\s*[\w$]*|([A-Za-z_$][\w$]*))\s*(?:<[^()]*>)?\s*$/.exec(safe.slice(Math.max(0, open - 120), open));
216
+ if (!head || (head[1] !== undefined && KEYWORDS.has(head[1])))
217
+ return -1;
218
+ }
219
+ const bodyAt = params.close + 1 + after[0].length - (after[1] === '{' ? 1 : 0);
220
+ return walkBody(bodyAt, name, { prefix: '', owner: ownerAt(at) }, names);
221
+ }
222
+ function walkCallback(start, text, scope, names) {
223
+ const arrow = ARROW_HEAD.exec(text);
224
+ if (arrow) {
225
+ walkBody(start + arrow[0].length, arrow[1] ?? arrow[2], scope, names);
226
+ return;
227
+ }
228
+ const fn = FUNCTION_HEAD.exec(text);
229
+ if (fn)
230
+ walkBody(start + fn[0].length, fn[1], scope, names);
231
+ }
232
+ function walkBody(at, param, scope, names) {
233
+ let i = at;
234
+ while (i < safe.length && /\s/.test(safe[i]))
235
+ i++;
236
+ if (safe[i] === '{') {
237
+ const block = (0, express_1.scanCall)(safe, i);
238
+ if (!block)
239
+ return -1;
240
+ const inner = new Map(names);
241
+ if (param)
242
+ inner.set(param, scope);
243
+ walkRange(i + 1, block.close, inner);
244
+ return block.close + 1;
245
+ }
246
+ while (safe[i] === '(' || (i < safe.length && /\s/.test(safe[i])))
247
+ i++;
248
+ if (param && safe.startsWith(param, i) && !/[\w$]/.test(safe[i + param.length] ?? '')) {
249
+ return walkChain(i + param.length, scope, names);
250
+ }
251
+ return -1;
252
+ }
253
+ function walkChain(at, scope, names) {
254
+ let i = at;
255
+ for (;;) {
256
+ LINK.lastIndex = i;
257
+ const link = LINK.exec(safe);
258
+ if (!link)
259
+ return i;
260
+ const open = LINK.lastIndex - 1;
261
+ const call = (0, express_1.scanCall)(safe, open);
262
+ if (!call)
263
+ return i;
264
+ onLink(link[1], open, call.structure, link[0].trim().length, scope, names);
265
+ i = call.close + 1;
266
+ }
267
+ }
268
+ function onLink(method, open, structure, length, scope, names) {
269
+ const parts = (0, express_1.topLevelArgs)(structure.slice(1, -1))
270
+ .filter((p) => p.text.trim() !== '')
271
+ .map((p) => ({ start: open + 1 + p.start, text: p.text }));
272
+ const line = lineAt(open);
273
+ if (VERBS.has(method)) {
274
+ addRoute(method.toUpperCase(), parts, 0, line, length, scope, false);
275
+ }
276
+ else if (method === 'route') {
277
+ const verb = parts[0] ? literalArg(safe, parts[0].start, parts[0].text) : null;
278
+ if (verb && /^[A-Za-z][\w-]*$/.test(verb))
279
+ addRoute(verb.toUpperCase(), parts, 1, line, length, scope, false);
280
+ }
281
+ else if (method === 'ws') {
282
+ addRoute('WS', parts, 0, line, length, scope, true);
283
+ }
284
+ else if (method === 'group') {
285
+ const callback = parts.length > 1 ? parts[parts.length - 1] : null;
286
+ if (!callback)
287
+ return;
288
+ const prefix = literalArg(safe, parts[0].start, parts[0].text) ?? '';
289
+ useSite(callback, { prefix: joinPrefix(scope.prefix, prefix), owner: scope.owner }, names);
290
+ }
291
+ else if (method === 'guard') {
292
+ const callback = parts[parts.length - 1];
293
+ if (callback && !/^\s*\{/.test(callback.text))
294
+ useSite(callback, scope, names);
295
+ }
296
+ else if (method === 'use' && parts.length === 1) {
297
+ useSite(parts[0], scope, names);
298
+ }
299
+ }
300
+ function addRoute(method, parts, pathAt, line, length, scope, socket) {
301
+ const pathPart = parts[pathAt];
302
+ if (!pathPart)
303
+ return;
304
+ const path = literalArg(safe, pathPart.start, pathPart.text);
305
+ if (path === null)
306
+ return;
307
+ const rest = parts.slice(pathAt + 1);
308
+ const handler = socket ? rest[0] : rest.find((p) => !/^\s*\{/.test(p.text));
309
+ file.routes.push({
310
+ method,
311
+ path: joinRoute(scope.prefix, path),
312
+ line,
313
+ length,
314
+ owner: scope.owner,
315
+ handler: handler ? { start: handler.start, text: handler.text } : null,
316
+ socket,
317
+ });
318
+ }
319
+ function useSite(part, scope, names) {
320
+ const lead = part.text.search(/\S/);
321
+ const text = part.text.trim();
322
+ if (text.startsWith('[')) {
323
+ const items = (0, express_1.scanCall)(safe, part.start + lead);
324
+ if (!items)
325
+ return;
326
+ for (const item of (0, express_1.topLevelArgs)(items.structure.slice(1, -1))) {
327
+ if (item.text.trim() !== '')
328
+ useSite({ start: part.start + lead + 1 + item.start, text: item.text }, scope, names);
329
+ }
330
+ return;
331
+ }
332
+ const inline = /^new\s+Elysia\s*(?:<[^()]*?>\s*)?\(/.exec(text);
333
+ if (inline) {
334
+ const open = part.start + lead + inline[0].length - 1;
335
+ const ctor = (0, express_1.scanCall)(safe, open);
336
+ if (!ctor)
337
+ return;
338
+ const prefix = joinPrefix(scope.prefix, constructorPrefix(safe, open, ctor.structure));
339
+ walkChain(ctor.close + 1, { prefix, owner: scope.owner }, names);
340
+ return;
341
+ }
342
+ if (FUNCTION_ARG.test(text)) {
343
+ walkCallback(part.start, part.text, scope, names);
344
+ return;
345
+ }
346
+ const target = safe.slice(part.start, part.start + part.text.length).trim();
347
+ if (MOUNT_TARGET.test(target))
348
+ file.mounts.push({ owner: scope.owner, prefix: scope.prefix, target });
349
+ }
350
+ }
351
+ function codeOnly(safe) {
352
+ const out = safe.split('');
353
+ const n = safe.length;
354
+ const blank = (from, to) => {
355
+ for (let k = from; k < to; k++)
356
+ if (out[k] !== '\n' && out[k] !== '\r')
357
+ out[k] = ' ';
358
+ };
359
+ const template = (open) => {
360
+ let text = open + 1;
361
+ for (let i = open + 1; i < n; i++) {
362
+ const c = safe[i];
363
+ if (c === '\\')
364
+ i++;
365
+ else if (c === '`') {
366
+ blank(text, i);
367
+ return i + 1;
368
+ }
369
+ else if (c === '$' && safe[i + 1] === '{') {
370
+ blank(text, i);
371
+ i = code(i + 2, true) - 1;
372
+ text = i + 1;
373
+ }
374
+ }
375
+ blank(text, n);
376
+ return n;
377
+ };
378
+ const code = (at, closing) => {
379
+ let depth = 0;
380
+ for (let i = at; i < n; i++) {
381
+ const c = safe[i];
382
+ if (c === '`') {
383
+ i = template(i) - 1;
384
+ }
385
+ else if ((c === '"' || c === "'") && (0, express_1.closesOnLine)(safe, i)) {
386
+ let end = i + 1;
387
+ while (end < n && safe[end] !== c)
388
+ end += safe[end] === '\\' ? 2 : 1;
389
+ blank(i + 1, end);
390
+ i = end;
391
+ }
392
+ else if (c === '{') {
393
+ depth++;
394
+ }
395
+ else if (c === '}') {
396
+ if (depth === 0 && closing)
397
+ return i + 1;
398
+ depth--;
399
+ }
400
+ }
401
+ return n;
402
+ };
403
+ code(0, false);
404
+ const text = out.join('');
405
+ const head = /(?<![\w$.])([A-Za-z_$][\w$]*)\s*\(/g;
406
+ for (let m = head.exec(text); m !== null; m = head.exec(text)) {
407
+ if (DEFINITION_KEYWORDS.has(m[1]))
408
+ continue;
409
+ let depth = 0;
410
+ let close = m.index + m[0].length - 1;
411
+ for (; close < n; close++) {
412
+ if (text[close] === '(')
413
+ depth++;
414
+ else if (text[close] === ')' && --depth === 0)
415
+ break;
416
+ }
417
+ if (/^\s*(?::[^{};=()]*)?\{/.test(text.slice(close + 1, close + 200)))
418
+ blank(m.index, m.index + m[1].length);
419
+ }
420
+ return out.join('');
421
+ }
422
+ const DEFINITION_KEYWORDS = new Set(['if', 'for', 'while', 'switch', 'catch', 'with', 'function']);
423
+ function parameterNames(text) {
424
+ const single = /^\s*(?:async\s+)?([A-Za-z_$][\w$]*)\s*=>/.exec(text);
425
+ if (single)
426
+ return new Set([single[1]]);
427
+ const head = /^\s*(?:async\s*)?(?:function\b\s*\*?\s*[\w$]*\s*)?\(/.exec(text);
428
+ if (!head)
429
+ return new Set();
430
+ let depth = 0;
431
+ let end = head[0].length - 1;
432
+ for (; end < text.length; end++) {
433
+ if (text[end] === '(')
434
+ depth++;
435
+ else if (text[end] === ')' && --depth === 0)
436
+ break;
437
+ }
438
+ return new Set(text.slice(head[0].length, end).match(/[A-Za-z_$][\w$]*/g) ?? []);
439
+ }
440
+ function routeRefs(safe, code, site, fromNodeId, filePath, language) {
441
+ const handler = site.handler;
442
+ if (!handler)
443
+ return [];
444
+ const refOf = (referenceName, referenceKind) => ({ fromNodeId, referenceName, referenceKind, line: site.line, column: 0, filePath, language });
445
+ const unbound = (refs, params) => refs.filter((r) => r.referenceKind !== 'calls' || r.referenceName.includes('.') || !params.has(r.referenceName));
446
+ if (!site.socket) {
447
+ const text = handler.text.trim();
448
+ if (NAMED_HANDLER.test(text))
449
+ return [refOf(text.replace(/\s+/g, ''), 'references')];
450
+ return unbound((0, express_1.handlerRefs)(code, handler.start, handler.text, fromNodeId, site.line, filePath, language), parameterNames(handler.text));
451
+ }
452
+ const lead = handler.text.search(/\S/);
453
+ if (lead < 0 || handler.text[lead] !== '{')
454
+ return [];
455
+ const object = (0, express_1.scanCall)(safe, handler.start + lead);
456
+ if (!object)
457
+ return [];
458
+ const body = object.structure;
459
+ const out = [];
460
+ SOCKET_CALLBACK.lastIndex = 0;
461
+ let m;
462
+ while ((m = SOCKET_CALLBACK.exec(body)) !== null) {
463
+ const keyAt = m.index + m[0].length - 1;
464
+ let depth = 0;
465
+ for (let k = 0; k < keyAt; k++) {
466
+ const c = body[k];
467
+ if (c === '{' || c === '(' || c === '[')
468
+ depth++;
469
+ else if (c === '}' || c === ')' || c === ']')
470
+ depth--;
471
+ }
472
+ if (depth !== 1)
473
+ continue;
474
+ const at = handler.start + lead + keyAt;
475
+ if (m[2] === '(') {
476
+ const params = (0, express_1.scanCall)(safe, at);
477
+ const braceAt = params ? safe.indexOf('{', params.close) : -1;
478
+ const block = braceAt >= 0 && /^\s*(?::[^{]*)?$/.test(safe.slice(params.close + 1, braceAt)) ? (0, express_1.scanCall)(safe, braceAt) : null;
479
+ if (!block)
480
+ continue;
481
+ const calls = (0, express_1.handlerCallNames)(code.slice(braceAt + 1, block.close)).map((name) => refOf(name, 'calls'));
482
+ out.push(...unbound(calls, parameterNames(params.structure)));
483
+ SOCKET_CALLBACK.lastIndex = block.close - (handler.start + lead);
484
+ }
485
+ else {
486
+ const value = (0, express_1.topLevelArgs)(body.slice(keyAt + 1, body.length - 1))[0];
487
+ if (!value)
488
+ continue;
489
+ const name = value.text.trim();
490
+ if (NAMED_HANDLER.test(name))
491
+ out.push(refOf(name.replace(/\s+/g, ''), 'references'));
492
+ else
493
+ out.push(...unbound((0, express_1.handlerRefs)(code, at + 1, value.text, fromNodeId, site.line, filePath, language), parameterNames(value.text)));
494
+ }
495
+ }
496
+ return out;
497
+ }
498
+ function mountedInstance(target, file, walks, context) {
499
+ const language = languageOf(file);
500
+ const lazy = /^(?:await\s+)?import\s*\(\s*(['"`])([^'"`]+)\1\s*\)$/.exec(target);
501
+ if (lazy) {
502
+ const resolved = (0, import_resolver_1.resolveImportPath)(lazy[2], file, language, context);
503
+ return resolved ? exportedInstance(resolved, 'default', walks, context, 0) : null;
504
+ }
505
+ const ref = /^([A-Za-z_$][\w$]*)(?:\s*\.\s*([A-Za-z_$][\w$]*))?\s*(?:\([\s\S]*\))?$/.exec(target);
506
+ if (!ref)
507
+ return null;
508
+ const head = ref[1];
509
+ const member = ref[2];
510
+ const mapping = context.getImportMappings(file, language).find((im) => im.localName === head);
511
+ if (mapping) {
512
+ const resolved = mapping.resolvedPath ?? (0, import_resolver_1.resolveImportPath)(mapping.source, file, language, context);
513
+ if (!resolved)
514
+ return null;
515
+ const name = mapping.isNamespace
516
+ ? member
517
+ : member !== undefined && member !== 'default'
518
+ ? undefined
519
+ : mapping.isDefault ? 'default' : mapping.exportedName;
520
+ return name ? exportedInstance(resolved, name, walks, context, 0) : null;
521
+ }
522
+ const lazyImport = walks.get(file)?.lazyImports.get(head);
523
+ if (lazyImport) {
524
+ const resolved = (0, import_resolver_1.resolveImportPath)(lazyImport.specifier, file, language, context);
525
+ return resolved ? exportedInstance(resolved, member ?? lazyImport.member, walks, context, 0) : null;
526
+ }
527
+ if (member !== undefined && member !== 'default')
528
+ return null;
529
+ return walks.get(file)?.owners.has(head) ? instanceKey(file, head) : null;
530
+ }
531
+ function exportedInstance(file, name, walks, context, depth) {
532
+ const walk = walks.get(file);
533
+ if (walk) {
534
+ const owner = walk.exports.get(name) ?? name;
535
+ if (walk.owners.has(owner))
536
+ return instanceKey(file, owner);
537
+ }
538
+ if (depth >= 8)
539
+ return null;
540
+ const language = languageOf(file);
541
+ const reExports = context.getReExports?.(file, language) ?? [];
542
+ for (const re of reExports) {
543
+ if (re.kind !== 'named' || re.exportedName !== name)
544
+ continue;
545
+ const resolved = (0, import_resolver_1.resolveImportPath)(re.source, file, language, context);
546
+ return resolved ? exportedInstance(resolved, re.originalName, walks, context, depth + 1) : null;
547
+ }
548
+ if (name === 'default')
549
+ return null;
550
+ for (const re of reExports) {
551
+ if (re.kind !== 'wildcard')
552
+ continue;
553
+ const resolved = (0, import_resolver_1.resolveImportPath)(re.source, file, language, context);
554
+ const hit = resolved ? exportedInstance(resolved, name, walks, context, depth + 1) : null;
555
+ if (hit)
556
+ return hit;
557
+ }
558
+ return null;
559
+ }
560
+ exports.elysiaResolver = {
561
+ name: 'elysia',
562
+ languages: ['typescript', 'javascript', 'tsx', 'jsx'],
563
+ appDependencies: ['elysia'],
564
+ detect(context) {
565
+ return (0, package_deps_1.dependsOn)(context, 'elysia');
566
+ },
567
+ resolve() {
568
+ return null;
569
+ },
570
+ extract(filePath, content) {
571
+ const nodes = [];
572
+ const references = [];
573
+ if (!SCRIPT_FILE.test(filePath) || !ELYSIA_WORD.test(content))
574
+ return { nodes, references };
575
+ const language = languageOf(filePath);
576
+ const safe = stripFor(filePath, content);
577
+ const routes = walkElysia(safe).routes;
578
+ if (routes.length === 0)
579
+ return { nodes, references };
580
+ const code = codeOnly(safe);
581
+ const now = Date.now();
582
+ const seen = new Set();
583
+ for (const site of routes) {
584
+ const id = routeId(filePath, site);
585
+ if (seen.has(id))
586
+ continue;
587
+ seen.add(id);
588
+ nodes.push({
589
+ id,
590
+ kind: 'route',
591
+ name: `${site.method} ${site.path}`,
592
+ qualifiedName: `${filePath}::${site.method}:${site.path}`,
593
+ filePath,
594
+ startLine: site.line,
595
+ endLine: site.line,
596
+ startColumn: 0,
597
+ endColumn: site.length,
598
+ language,
599
+ updatedAt: now,
600
+ });
601
+ references.push(...routeRefs(safe, code, site, id, filePath, language));
602
+ }
603
+ return { nodes, references };
604
+ },
605
+ postExtract(context) {
606
+ const walks = new Map();
607
+ for (const file of context.getAllFiles()) {
608
+ if (!SCRIPT_FILE.test(file))
609
+ continue;
610
+ if (context.fileContains && !context.fileContains(file, 'Elysia'))
611
+ continue;
612
+ const content = context.readFile(file);
613
+ if (!content || !ELYSIA_WORD.test(content))
614
+ continue;
615
+ const walk = walkElysia(stripFor(file, content));
616
+ if (walk.routes.length > 0 || walk.mounts.length > 0)
617
+ walks.set(file, walk);
618
+ }
619
+ if (walks.size === 0)
620
+ return [];
621
+ const mounts = new Map();
622
+ for (const [file, walk] of walks) {
623
+ if ((0, query_utils_1.isTestPath)(file))
624
+ continue;
625
+ for (const m of walk.mounts) {
626
+ const target = mountedInstance(m.target, file, walks, context);
627
+ const parent = instanceKey(file, m.owner);
628
+ if (!target || target === parent)
629
+ continue;
630
+ let list = mounts.get(parent);
631
+ if (!list)
632
+ mounts.set(parent, (list = []));
633
+ list.push({ prefix: m.prefix, target });
634
+ }
635
+ }
636
+ let prefixOf = new Map();
637
+ for (let round = 0; round < 8 && mounts.size > 0; round++) {
638
+ const next = new Map();
639
+ const ambiguous = new Set();
640
+ for (const [parent, list] of mounts) {
641
+ const base = prefixOf.get(parent) ?? '';
642
+ for (const { prefix, target } of list) {
643
+ const full = joinPrefix(base, prefix);
644
+ const seen = next.get(target);
645
+ if (seen !== undefined && seen !== full)
646
+ ambiguous.add(target);
647
+ else
648
+ next.set(target, full);
649
+ }
650
+ }
651
+ for (const a of ambiguous)
652
+ next.delete(a);
653
+ let changed = next.size !== prefixOf.size;
654
+ if (!changed)
655
+ for (const [k, v] of next)
656
+ if (prefixOf.get(k) !== v)
657
+ changed = true;
658
+ prefixOf = next;
659
+ if (!changed)
660
+ break;
661
+ }
662
+ const updates = [];
663
+ for (const [file, walk] of walks) {
664
+ if (walk.routes.length === 0)
665
+ continue;
666
+ const routes = new Map();
667
+ for (const node of context.getNodesInFile(file))
668
+ if (node.kind === 'route')
669
+ routes.set(node.id, node);
670
+ for (const site of walk.routes) {
671
+ const node = routes.get(routeId(file, site));
672
+ if (!node)
673
+ continue;
674
+ routes.delete(node.id);
675
+ const name = `${site.method} ${joinRoute(prefixOf.get(instanceKey(file, site.owner)) ?? '', site.path)}`;
676
+ if (name !== node.name)
677
+ updates.push({ ...node, name });
678
+ }
679
+ }
680
+ return updates;
681
+ },
682
+ };
683
+ //# sourceMappingURL=elysia.js.map